]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
5 years agoroms: build edk2 firmware binaries and variable store templates
Laszlo Ersek [Thu, 7 Mar 2019 13:57:17 +0000 (14:57 +0100)]
roms: build edk2 firmware binaries and variable store templates

Add the "efi" target to "Makefile".

Introduce "Makefile.edk2" for building and cleaning the firmware images
and varstore templates.

Collect the common bits from the recipes in the helper script
"edk2-build.sh".

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5 years agoroms/Makefile: replace the $(EDK2_EFIROM) target with "edk2-basetools"
Laszlo Ersek [Thu, 7 Mar 2019 12:24:41 +0000 (13:24 +0100)]
roms/Makefile: replace the $(EDK2_EFIROM) target with "edk2-basetools"

We don't (can't) have a recipe for building just $(EDK2_EFIROM);
therefore, while we call the target $(EDK2_EFIROM), we actually build all
of the edk2 BaseTools. Rename the target to edk2-basetools, and update the
iPXE prerequisite accordingly. This will let other targets depend on
"edk2-basetools", where an $(EDK2_EFIROM) pre-requisite would be
misleading.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5 years agoroms/edk2-funcs.sh: add the qemu_edk2_get_thread_count() function
Laszlo Ersek [Thu, 7 Mar 2019 12:15:20 +0000 (13:15 +0100)]
roms/edk2-funcs.sh: add the qemu_edk2_get_thread_count() function

The edk2 "build" utility natively supports building modules (that is, INF
files) in parallel. The feature is not useful when building a single
module (with the "-m" option), but it is useful for platform firmware
builds (which include many modules). Add a function that determines the
"-n" option argument for "build", from the MAKEFLAGS variable (i.e. based
on the presence of a make job server).

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5 years agoroms/edk2: advance to tag edk2-stable201903
Laszlo Ersek [Fri, 8 Mar 2019 21:09:05 +0000 (22:09 +0100)]
roms/edk2: advance to tag edk2-stable201903

Update the roms/edk2 submodule hash from edk2-stable201811 to
edk2-stable201903. The release notes are available at
<https://github.com/tianocore/edk2/releases/tag/edk2-stable201903>.

$ git shortlog edk2-stable201811..edk2-stable201903

Achin Gupta (9):
      ArmPkg: Add PCDs needed for MM communication driver.
      ArmPkg/Drivers: Add EFI_MM_COMMUNICATION_PROTOCOL DXE driver.
      ArmPkg/Include: Add MM interface SVC return codes.
      ArmPkg/ArmMmuLib: Add MMU Library suitable for use in S-EL0.
      StandaloneMmPkg: Add missing dependency on PL011UartClockLib
      StandaloneMmPkg: Enforce alignment check for AArch64
      StandaloneMmPkg: Zero data structure explicitly
      StandaloneMmPkg: Replace dependency on ArmMmuLib
      StandaloneMmPkg: Update dependency on PeCoffExtraActionLib

Albecki, Mateusz (1):
      MdeModulePkg/SdMmcPciHcDxe Fix eMMC HS400 switch sequence

Alex James (2):
      StdLib/sys/termios: Define cc_t as unsigned
      StdLib/Environs: Avoid infinite recursion in _Exit

Antoine Coeur (5):
      ArmVirtPkg: Fix various typos
      CryptoPkg: Fix various typos
      CorebootPayloadPkg: Fix various typos
      CorebootModulePkg: Fix various typos
      BaseTools: Various typo

Ard Biesheuvel (116):
      MdePkg/BaseIoLibIntrinsicArmVirt ARM: avoid double word loads and stores
      ArmPkg/ArmGicDxe ARM: fix encoding for GICv3 interrupt acknowledge
      ArmPlatformPkg: clear frame pointer in startup code
      ArmVirtPkg/PrePi: clear frame pointer in startup code
      ArmPkg/ArmSmcPsciResetSystemLib: add missing call to ExitBootServices()
      ArmPkg: remove now unused BsdLib.h
      ArmPlatformPkg/NorFlashDxe: prepare for devicepath format change
      ArmPlatformPkg/NorFlashDxe: use one GUID plus index to identify flash banks
      ArmVirtPkg/FdtClientDxe: take DT node 'status' properties into account
      ArmVirtPkg/NorFlashQemuLib: discover NOR flash banks dynamically
      ArmPlatformPkg/NorFlashPlatformLib: remove unused Guid member from struct
      ArmPkg/ArmPkg.dsc: move ArmMmuStandaloneMmLib.inf to AARCH64 section
      EmbeddedPkg/TemplateSec: remove unused module
      EmbeddedPkg/PrePiHobLib: drop CreateHobList() from library
      ArmVirtPkg/FdtPciHostBridgeLib: map ECAM and I/O spaces in GCD memory map
      ArmVirtPkg/QemuVirtMemInfoLib: remove 1:1 mapping of top of PA range
      MdePkg/ProcessorBind.h AARCH64: limit MAX_ADDRESS to 48 bits
      ArmPkg/ArmLib: add support for reading the max physical address space size
      ArmVirtPkg/XenVirtMemInfoLib: refactor reading of the PA space size
      ArmPkg/ArmMmuLib: take the CPU supported maximum PA space into account
      ArmPkg/CpuPei: base GCD memory space size on CPU's PA range
      ArmPlatformPkg/PrePi: base GCD memory space size on CPU's PA range
      ArmVirtPkg/PrePi: base GCD memory space size on CPU's PA range
      BeagleBoardPkg/PrePi: base GCD memory space size on CPU's PA range
      ArmPlatformPkg/PlatformPei: drop unused PCD references
      EmbeddedPkg/PrePiLib: drop unused PCD reference
      ArmVirtPkg: drop PcdPrePiCpuMemorySize assignments from all platforms
      EmbeddedPkg/EmbeddedPkg.dec: drop PcdPrePiCpuMemorySize declarations
      ArmPkg/ArmMmuLib ARM: handle unmapped section in GetMemoryRegion()
      ArmPkg/ArmMmuLib ARM: handle unmapped sections when updating permissions
      ArmVirtPkg/NorFlashQemuLib: disregard our primary FV
      ArmVirtPkg/QemuVirtMemInfoLib: trim the MMIO region mapping
      BaseTools/CommonLib: avoid using 'native' word size in IP address handling
      BaseTools/CommonLib: use explicit 64-bit type in Strtoi()
      BaseTools/DevicePath: use explicit 64-bit number parsing routines
      BaseTools/CommonLib: add definition of MAX_UINT32
      BaseTools/DevicePath: use MAX_UINT32 as default device path max size
      BaseTools/CommonLib: get rid of 'native' type string parsing routines
      BaseTools/CommonLib: drop definition of MAX_UINTN
      BaseTools/CommonLib: drop the use of MAX_ADDRESS
      Revert "MdePkg/ProcessorBind.h AARCH64: limit MAX_ADDRESS to 48 bits"
      MdeModulePkg/FileExplorerLib: avoid packed struct for program data
      BaseTools/tools_def AARCH64 RELEASE: move GCC49/GGC5 to 4 KB alignment
      ArmVirtPkg/ArmVirtQemuKernel ARM: make some PCD settings apply to ARM
      ArmVirtPkg/PrePiUniCoreRelocatable CLANG38: work around build issues
      BaseTools/GenFw ARM: don't permit R_ARM_GOT_PREL relocations
      MdePkg/BaseMemoryLibOptDxe ARM: add missing function annotations
      BaseTools/tools_def ARM CLANG35: work around -mno-movt option name change
      ArmVirtPkg/PrePi ARM CLANG35: drop incompatible command line option
      ArmVirtPkg/ArmVirt.dsc.inc: define TcpIoLib resolution unconditionally
      ArmPkg: remove redundant _ARM_PLATFORM_FLAGS overrides
      EmbeddedPkg: remove GdbDebugAgent library
      BaseTools/tools_def ARM: emit PIC veneers
      ArmPkg/DefaultExceptionHandlerLib ARM: avoid endless loop in RELEASE builds
      MdePkg/Base: introduce MAX_ALLOC_ADDRESS
      MdeModulePkg/Dxe/Gcd: disregard memory above MAX_ALLOC_ADDRESS
      MdeModulePkg/Dxe/Page: take MAX_ALLOC_ADDRESS into account
      ArmPkg/ArmMmuLib: take MAX_ALLOC_ADDRESS into account
      ArmPlatformPkg/MemoryInitPeim: take MAX_ALLOC_ADDRESS into account
      ArmVirtPkg/MemoryInitPeiLib: split memory HOB based on MAX_ALLOC_ADDRESS
      MdePkg/Arm/ProcessorBind.h: fix copy/paste error
      ArmPlatformPkg/SP805WatchdogDxe: cosmetic cleanup
      ArmPlatformPkg/SP805WatchdogDxe: switch to interrupt mode
      ArmPkg/GenericWatchdogDxe: clean up the code
      ArmPkg/GenericWatchdogDxe: implement RegisterHandler() method
      ArmPlatformPkg/PL011SerialPortLib: use untyped PCD for register base
      BaseTools/tools_def ARM: use softfloat target for CLANG3x
      BaseTools/GenFds: permit stripped MM_CORE_STANDALONE binaries
      BaseTools/Conf/tools_def.template: drop ARM/AARCH support from GCC46/GCC47
      ArmPkg/ArmMmuLib ARM: add missing support for non-shareable cached mappings
      ArmPkg/ArmMmuLib ARM: fix thinko in second level page table handling
      MdePkg: implement MmServicesTableLib based on traditional SMM
      BaseTools/tools_def GCC5: disable LTO for ASLC invocations
      ArmPkg/ArmMmuLib ARM: disregard high memory when setting permissions
      ArmPkg/ArmMmuLib AARCH64: fix out of bounds access
      MdeModulePkg/MdeModulePkg.dsc: add MmServicesTableLib resolution
      OvmfPkg: add MmServicesTableLib resolution
      QuarkPlatformPkg: add MmServicesTableLib resolution
      Vlv2TbltDevicePkg: add MmServicesTableLib resolution
      MdeModulePkg/FaultTolerantWriteDxe: factor out boot service accesses
      MdeModulePkg/FaultTolerantWriteDxe: implement standalone MM version
      MdeModulePkg/VariableRuntimeDxe: factor out boot service accesses
      MdeModulePkg/VariableRuntimeDxe: implement standalone MM version
      MdePkg: introduce standalone MM entry point library class
      MdePkg: introduce standalone MM entry point library implementation
      MdePkg: add MM_STANDALONE implementation of MmServicesTableLib
      MdeModulePkg: implement NULL instance of HobLib library class
      MdeModulePkg: implement NULL instance of MemoryAllocationLib library class
      MdeModulePkg/MdeModulePkg/dsc: move DxeDebugSupportDxe to x86 only section
      MdeModulePkg/AuthVariableLibNull: add MM_STANDALONE support
      MdeModulePkg/VarCheckLib: add MM_STANDALONE support
      MdeModulePkg/MdeModulePkg.dsc: add MM_STANDALONE FTW and variable modules
      ArmPkg/DebugAgentSymbolsBaseLib: remove exception handling
      ArmPkg/DefaultExceptionHandlerLib: declare the permitted usage context
      ArmVirtPkg: drop reference to ArmPkg/DefaultExceptionHandlerLibBase
      ArmPkg/DefaultExceptionHandlerLib: drop BASE variant
      ArmPkg/DefaultExceptionHandlerLib: use console if available
      EmbeddedPkg/NorFlashInfoLib: convert to BASE library
      ArmPkg/DefaultExceptionHandlerLib: add missing UefiLib include
      CryptoPkg/SmmCryptLib: permit use by MM_STANDALONE modules
      SecurityPkg/PlatformSecureLibNull: permit use by MM_STANDALONE modules
      MdeModulePkg/VarCheckUefiLib: permit use by MM_STANDALONE modules
      MdePkg/UefiDevicePathLib: permit use by MM_STANDALONE modules
      StandaloneMmPkg: add HobLib implementation for MM_STANDALONE modules
      StandaloneMmPkg: add MM_STANDALONE MemoryAllocationLib implementation
      StandaloneMmPkg/StandaloneMmCoreHobLib: restrict to MM_CORE_STANDALONE
      StandaloneMmPkg/StandaloneMmCpu: fix typo Standlone -> Standalone
      StandaloneMmPkg/StandaloneMmCoreEntryPoint: use %a modifier for ASCII strings
      StandaloneMmPkg/StandaloneMmCoreEntryPoint: remove bogus ASSERT_EFI_ERROR()s
      StandaloneMmPkg/StandaloneMmPeCoffExtraActionLib: ignore runtime attribute
      StandaloneMmPkg/Core/Dispatcher: don't copy dispatched image twice
      StandaloneMmPkg/StandaloneMmCoreEntryPoint: permit the use of TE images
      MdeModulePkg/MdeModulePkg.dsc: ignore standalone MM modules for EBC or XCODE5
      ArmPkg/ArmMmuLib ARM: trim high memory regions instead of rejecting them
      ArmPkg/ArmMmuLib AARCH64: get rid of needless TLB invalidation
      MdePkg/BaseLib: implement SpeculationBarrier() for ARM and AArch64

Ashish Singhal (6):
      MdeModulePkg/SdMmcPciHcDxe: Add SDMMC HC v4 and above Support.
      MdePkg/UefiLib: Abstract driver model protocol uninstallation
      NetworkPkg/IScsiDxe: Use UEFILib APIs to uninstall protocols.
      NetworkPkg: Protocol Uninstallation Cleanup
      DynamicTablesPkg/DynamicTableManagerDxe: Update DEPEX
      DynamicTablesPkg/AcpiSpcrLibArm: Support 16550 UART.

Bret Barkelew (4):
      MdePkg/IndustryStandard: Introduce a correctly spelled macro
      SecurityPkg/Tcg: Fix typos in TcgDxe.c and Tcg2Dxe.c
      MdePkg/IndustryStandard: Remove an incorrectly spelled macro
      MdePkg/UefiLib: Add a new API GetVariable3

Chasel, Chiu (16):
      IntelFsp2WrapperPkg: Support FSP Dispatch mode
      IntelFsp2WrapperPkg: Revert 90c5bc08
      IntelFsp2WrapperPkg: Support FSP Dispatch mode
      IntelFsp2WrapperPkg: Fix line ending format issue
      IntelFsp2WrapperPkg: Fix constant if statements issue
      Maintainers.txt: Change package maintainer of IntelFsp*Pkg
      BaseTools/GenFv: Support SecCore and PeiCore in different FV
      IntelFsp2Pkg: Add FspmArchConfigPpi to support Dispatch mode
      IntelFsp2Pkg: Remove unused keyword in new PPI header
      IntelFsp2Pkg: Add function to get bootloader stack pointer
      IntelFsp2Pkg: FSP can utilize bootloader stack
      MdePkg: Support EFI_PEI_CORE_FV_LOCATION_PPI
      MdeModulePkg/PeiMain: Support EFI_PEI_CORE_FV_LOCATION_PPI
      UefiCpuPkg/SecCore: Support EFI_PEI_CORE_FV_LOCATION_PPI
      UefiCpuPkg/SecCore: Support EFI_PEI_CORE_FV_LOCATION_PPI
      UefiCpuPkg/SecCore: Wrong Debug Information for SecCore

Chen A Chen (18):
      SecurityPkg: Remove dead code and inf redundant definitions.
      SecurityPkg: Remove code under UserIdentification folder.
      FatPkg: Break down Part.c file.
      MdePkg/UefiGpt.h: Add new definition for enable GPT support
      FatPkg: Add GPT check in FatPei to support Capsule-on-Disk feature.
      MdePkg/UefiSpec.h: Add definition to support Capsule-on-Disk feature
      MdeModulePkg/CapsuleApp: Add a function used to get next DevicePath
      MdeModulePkg/CapsuleApp: Add functions to support Capsule-on-Disk
      MdeModulePkg/CapsuleApp: Enhance CapsuleApp to support Capsule-on-Disk
      FatPkg/FatPei/Gpt.c: Fix uninitialized variable issue
      MdeModulePkg/CapsuleApp: Fix potential NULL pointer dereference issue
      MdeModulePkg/CapsuleApp: Fix potential NULL pointer dereference issue
      MdeModulePkg/CapsuleApp: Fix memory leak issue.
      UefiCpuPkg/Microcode: Fix incorrect checksum issue for extended table
      IntelSiliconPkg/MicrocodeUpdate: Fix incorrect checksum issue
      MdeModulePkg: Rename confusion function name
      UefiCpuPkg/Microcode: Fix InComplete CheckSum32 issue
      UefiCpuPkg/Microcode.c: Add verification before calculate CheckSum32

Chu, Maggie (2):
      SecurityPkg: Incorrect warning message for Opal admin revert action
      SecurityPkg: Add a PCD to skip Opal password prompt

Dandan Bi (12):
      MdeModulePkg/DisplayEngine: Remove useless NULL ptr check for NewPos
      MdePkg: check Length para before use in DevPathToTextUsbWWID
      MdePkg: Check input Ptrs in GetSectionFromAnyFvByFileType
      BaseTools/VfrCompile: report error for Integer overflow
      MdeModulePkg/NonDiscoverablePciDevice: Remove the redundant check
      MdePkg/BasePeCoffLib: Add more check for relocation data
      MdePkg/BasePeCoffLib: Correct the address of RelocBaseEnd
      ShellPkg/UefiShellAcpiViewCommandLib: Fix VS tool chain build failure
      MdeModulePkg: Fix coding style issues
      MdePkg: Fix coding style issues
      MdePkg/StatusCodeDataTypeId.h: Add new definition per PI1.7 Spec
      MdeModulePkg/BmBoot: Report status when fail to load/start boot option

Derek Lin (1):
      BaseTools: Fix GenFds error doesn't break build.

Edgar Handal (1):
      MdeModulePkg/SdMmcPciHcDxe: Use 16/32-bit IO widths

Eric Dong (9):
      UefiCpuPkg/Cpuid.h: Sync CPUID definition to latest SDM.
      UefiCpuPkg/Cpuid: Add code to support new definition.
      UefiCpuPkg/RegisterCpuFeaturesLib: Enhance debug message.
      UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls PeiService.
      UefiCpuPkg/S3Resume2Pei: check 64BIT_WAKE_F in FACS.OSPMFlags.
      MdeModulePkg/BootScriptExecuteorDxe: check 64BIT_WAKE_F in FACS.OSPMFlags
      UefiCpuPkg/RegisterCpuFeaturesLib: Replace AcquireSpinLock.
      SecurityPkg/OpalPassword: Update strings on Opal Setup page
      SecurityPkg/OpalPassword: Add NULL pointer check before using it

Felix Polyudov (1):
      BaseTools: Fix incorrect formatting of GenFds command dictionary

Feng, Bob C (52):
      BaseTools: Fix the problem using FILE_GUID override in .dsc
      BaseTools: Enable Pcd Array support.
      BaseTool: Filter out unused structure pcds
      BaseTools: Replace the sqlite database with list
      BaseTools: Optimize string concatenation
      BaseTools: Customize deepcopy function.
      BaseTools: Correct CCFLAG for PcdValueInit
      BaseTools: Fix PcdNvStoreDefaultValueBuffer Value.
      BaseTools: Fixed bugs in CopyDict function
      BaseTools: Fixed the build fail issue for cases
      BaseTools: Fix PcdArray issue
      BaseTools: Fixed metafile parser issues
      BaseTools: Reset FdsGlobalVariable
      BaseTools: Fixed build report issue.
      BaseTools: Correct PcdArray value assigment statement
      BaseTools: Report Error if use SET in Dsc
      BaseTools: Remove unused logic for EDKI
      BaseTools: Remove unused logic for IPF
      BaseTools: Remove unused logic from C tools
      BaseTools: Enable component override functionality
      BaseTools: Remove unused logic for EDKI
      BaseTools: Remove EDK_SOURCE keyword from ECC Tool
      BaseTools: Remove EDK_SOURCE keyword from GenFds tool.
      BaseTools: Remove EDK_SOURCE keyword from Inf Parser.
      BaseTools: Allow empty value for HiiPcd in Dsc
      BaseTools: Fix build report issue.
      BaseTools: use OrderedDict instead of sdict
      BaseTools: Make sure AllPcdList valid.
      BaseTools:File open failed for VPD MapFile
      BaseTools:Fixed Rsa issue and a set define issue.
      BaseTools:ord() don't match in py2 and py3
      BaseTools: the list and iterator translation
      BaseTools: Handle the bytes and str difference
      BaseTools: ECC tool Python3 adaption
      BaseTools: Eot tool Python3 adaption
      BaseTools: Enable CODE format in DEC file
      BaseTools: Fixed incorrect line number in PcdValueInit.c
      BaseTools: Correct the error message for UPT
      BaseTools: Fixed a build report issue.
      BaseTools: Fix the build report issue about Structure PCD
      BaseTools: Fixed an issue about StructurePcd
      BaseTools: Add MaxSizeUserSet to Pcd deepcopy function
      BaseTools: Fix a ParseDevPathValue function issue.
      BaseTools: Fixed a bug in Vpd handling
      BaseTools: Fixed a code bug for Pcd Array.
      BaseTools: replace Sdict with OrderedDict in UPT
      BaseTool: Fixed incremental rebuild issue.
      BaseTools: Fix a bug about Structure PCD
      BaseTools: Add parameter check for the AsciiStringToUint64
      BaseTools: Eot failed when enable python3
      BaseTools: Fix a Eot issue.
      BaseTools: Add python3-distutils Ubuntu package checking

Gary Lin (2):
      MdePkg ACPI: fix the typos in Acpi61.h and Acpi62.h
      MdeModulePkg/UefiBootManagerLib: Match the nested partitions

Gonzalez Del Cueto, Rodrigo (1):
      SecurityPkg/TcgConfigDxe: Allow enabling TPM 1.2 device from disabled state.

Hao Wu (25):
      MdePkg/BaseLib: Introduce new SpeculationBarrier API
      MdeModulePkg/FaultTolerantWrite: Update to consume SpeculationBarrier
      MdeModulePkg/SmmLockBox: Update to consume SpeculationBarrier
      MdeModulePkg/Variable: Update to consume SpeculationBarrier
      UefiCpuPkg/PiSmmCpuDxeSmm: Update to consume SpeculationBarrier
      UefiCpuPkg: Merge StuffRsb.inc files into one in UefiCpuPkg/Include
      MdeModulePkg/SdMmcPciHcDxe: Fix VS2015 IA32 NOOPT build failure
      MdeModulePkg/SdMmcPciHcDxe: Update comment for spec compliance status
      MdeModulePkg: Add definitions for ATA AHCI host controller PPI
      MdeModulePkg: Add definitions for EDKII PEI ATA PassThru PPI
      MdeModulePkg: Add definitions for Storage Security Command PPI
      MdeModulePkg: Add GUID for LockBox to save storage dev to init in S3
      MdeModulePkg/NvmExpressPei: Avoid updating the module-level variable
      MdeModulePkg/NvmExpressPei: Add logic to produce SSC PPI
      MdeModulePkg/NvmExpressPei: Consume S3StorageDeviceInitList LockBox
      MdeModulePkg/AhciPei: Add AHCI mode ATA device support in PEI
      MdeModulePkg/SmmLockBoxLib: Use 'DEBUG_' prefix instead of 'EFI_D_'
      MdeModulePkg/SmmLockBox(PEI): Remove an ASSERT in RestoreLockBox()
      MdeModulePkg/SmmLockBoxLib: Support LockBox enlarge in UpdateLockBox()
      OvmfPkg/LockBoxLib: Update the comments for API UpdateLockBox()
      SecurityPkg/OpalPassword: Remove HW init codes and consume SSC PPI
      SecurityPkg/HddPassword: Add Security feature set support for ATA dev
      MdeModulePkg/UfsBlockIoPei: Correct use of 'DeviceIndex' in BlkIO PPI
      MdeModulePkg/PartitionDxe: Ensure blocksize holds MBR (CVE-2018-12180)
      MdeModulePkg/RamDiskDxe: Restrict on RAM disk size (CVE-2018-12180)

Hess Chen (1):
      BaseTools/ECC: Add a new type of exception

Hsueh, Hong-chihX (1):
      MdePkg/BasePeCoffLib: skip runtime relocation if reloc info is invalid

Jaben Carsey (14):
      BaseTools: Move Identification file to Eot
      BaseTools: cleanup LongFilePathSupport usage
      BaseTools: create and use a standard shared variable for '*'
      BaseTools: fix imports
      MdeModulePkg: fix comments in BaseSortLib
      BaseTools/build/build: refactor and move functions
      BaseTools/Workspace/InfBuildData: move functions
      BaseTools/DscBuildData: move function
      BaseTools/AutoGen: move functions
      BaseTools/GenFds/Capsule: move function logic
      BaseTools/Common/Misc: move private functions
      BaseTools/Common/Misc: remove uncalled code
      BaseTools/Common/Misc: Cleanup the imports
      BaseTools/build/build: delete variable

Jagadeesh Ujja (2):
      SecurityPkg/AuthVariableLib: allow MM_STANDALONE drivers to use this library
      MdePkg/Include: add MmServicesTableLib header file

Jeff Brasen (5):
      MdeModulePkg/SdDxe: Fix potential NULL pointer access
      EmbeddedPkg/PrePiMemoryAllocationLib: Added AllocateZeroPool()
      MdeModulePkg/BaseSortLib: Enable for all module types
      ArmPkg/ArmScmiDxe: Add clock enable function
      EmbeddedPkg/PrePiLib: Correct function name

Jian J Wang (7):
      CryptoPkg/IntrinsicLib: add missing BaseLib declaration
      Upgrade OpenSSL to 1.1.0j
      CryptoPkg/BaseCryptLib: split CryptPkcs7Verify.c on behalf of runtime
      MdePkg/UefiDevicePathLib: Add sanity check for FilePath device path
      MdePkg/UefiDevicePathLibDevicePathProtocol: Add sanity check for FilePath device path
      UefiCpuPkg: restore strict page attributes via #DB in nonstop mode only
      Maintainers.txt: remove unexpected unicode BOM

Jiaxin Wu (7):
      MdeModulePkg/Dhcp4Dxe: Remove unnecessary NULL pointer check.
      NetworkPkg/IScsiDxe: Remove unnecessary NULL pointer check.
      NetworkPkg/DnsDxe: Remove unnecessary NULL pointer check.
      MdeModulePkg/Ip4Dxe: Uninstall protocols when error happen in Driver Binding Start.
      NetworkPkg/Ip6Dxe: Uninstall protocols when error happen in Driver Binding Start.
      NetworkPkg/Ip6Dxe: Clean the invalid IPv6 configuration during driver start.
      NetworkPkg/DnsDxe: [CVE-2018-12178] Check the received packet size before parsing the message.

Jiewen Yao (6):
      MdeModulePkg/LockboxNullLib: clean up INF file.
      BaseTool/GenC: Fix build error when type is BASE or USER_DEFINED.
      MdePkg/Include: Add Nasm.inc
      MdePkg/BaseLib: Add Shadow Stack Support for X86.
      UefiCpuPkg/ExceptionLib: Add CET support.
      UefiCpuPkg/PiSmmCpu: Add Shadow Stack Support for X86 SMM.

Jordan Justen (1):
      OvmfPkg/build.sh: Enable flash for qemu 3 or later

Julien Grall (1):
      Maintainers.txt: Update e-mail address for Julien Grall

Krzysztof Koch (1):
      ShellPkg/UefiShellAcpiViewCommandLib: Add support for PPTT

Laszlo Ersek (47):
      EmulatorPkg: require GCC48 or later
      OvmfPkg: require GCC48 or later
      Vlv2TbltDevicePkg: assume GCC48 or later
      BaseTools/tools_def.template: fix up LF-only line terminator
      BaseTools/tools_def.template: strip trailing whitespace
      BaseTools/tools_def.template: remove GCC48_IA32_X64_DLINK_COMMON dead-end
      BaseTools/tools_def.template: remove GCC47 leaf definitions
      BaseTools/tools_def.template: propagate loss of GCC47 references
      BaseTools/tools_def.template: remove GCC47 documentation
      BaseTools/tools_def.template: remove GCC46 leaf definitions
      BaseTools/tools_def.template: propagate loss of GCC46 references
      BaseTools/tools_def.template: remove GCC46 documentation
      BaseTools/tools_def.template: remove GCC45 leaf definitions
      BaseTools/tools_def.template: propagate loss of GCC45 references
      BaseTools/tools_def.template: remove GCC45 documentation
      BaseTools/tools_def.template: remove GCC44 leaf definitions
      BaseTools/tools_def.template: propagate loss of GCC44 references
      BaseTools/tools_def.template: rename GCC44_ALL_CC_FLAGS to GCC48_ALL_CC_FLAGS
      BaseTools/tools_def.template: eliminate GCC44_IA32_X64_DLINK_FLAGS
      BaseTools/tools_def.template: rename GCC44_IA32_X64_DLINK_COMMON to GCC48_IA32_X64_DLINK_COMMON
      BaseTools/tools_def.template: remove comment about GCC44 + LzmaF86Compress
      BaseTools/tools_def.template: remove GCC44 documentation
      ArmPkg/ArmSoftFloatLib: drop build flags specific to GCC46/GCC47
      CryptoPkg/BaseCryptLib: drop build flags specific to GCC44
      Revert "MdePkg: avoid __builtin_unreachable() on GCC v4.4"
      BaseTools/BuildReport: fix report for platforms/arches without struct PCDs
      ArmVirtPkg/ArmVirtQemuKernel: don't set PcdCPUCoresStackBase
      ArmVirtPkg: don't set PcdRelocateVectorTable
      ArmVirtPkg/{ArmVirtQemu,ArmVirtQemuKernel}: don't set PcdTrustzoneSupport
      ArmVirtPkg: don't set PcdPostCodePropertyMask
      ArmVirtPkg: clean up PcdSetNxForStack setting (applies to ArmVirtQemu only)
      ArmVirtPkg/PrePi: drop wrong PcdCoreCount dependency
      ArmVirtPkg: don't set PcdCoreCount
      ArmVirtPkg: don't set PcdDebugClearMemoryValue
      ArmVirtPkg: don't set PcdDebugPrintErrorLevel in RELEASE builds
      ArmVirtPkg/ArmVirtXen: don't set PcdPL031RtcBase
      ArmVirtPkg/ArmVirtXen: don't set PcdTerminalTypeGuidBuffer
      ArmVirtPkg/ArmVirtXen: don't set PcdShellFile
      ArmVirtPkg/ArmVirtXen: don't set PcdTurnOffUsbLegacySupport
      ArmVirtPkg/ArmVirtXen: don't set Pcd*ImageVerificationPolicy
      Maintainers: add TPM2 reviewers for OvmfPkg
      Maintainers: specify the scope for OvmfPkg/ArmVirtPkg Xen module reviewers
      MdeModulePkg/UefiBootManagerLib: fix LoadImage/StartImage status code rep.
      OvmfPkg: add library to track boot option loading/starting on the console
      OvmfPkg/PlatformBootManagerLib: display boot option loading/starting
      ArmVirtPkg/ArmVirtQemu*: enable minimal Status Code Routing in DXE
      ArmVirtPkg/PlatformBootManagerLib: display boot option loading/starting

Leif Lindholm (8):
      ArmPkg: fix StandaloneMmMmuLib subdirectory case
      ArmPkg: drop ArmBds remnant Pcds from .dec
      ArmPkg: delete unused ArmTrustZoneSmc.h
      AppPkg: fix webserver build for !Ia32/X64
      IntelFrameworkModulePkg: fix build for AARCH64/ARM
      IntelFrameworkPkg: fix build for AARCH64/ARM
      SecurityPkg: fix package build on ARM
      SignedCapsulePkg: enable package build for AARCH64/ARM

Liming Gao (12):
      OvmfPkg: Don't include TftpDynamicCommand in XCODE5 tool chain
      MdeModulePkg PCD: Add DynamicEx PcdVpdBaseAddress64 for non SPI platform
      Maintainers.txt: Add the rule to hand over the package maintain role
      BaseTools Script: Update ConvertFceToStructurePcd to report warning messages
      MdeModulePkg: Correct PCD name in MdeModulePkg.uni
      Readme.md: Add edk2 release tag and edk2 release plan
      BaseTools GenFw: Fix XCODE5 build issue
      BaseTools VolInfo: Fix XCODE5 build issue
      BaseTools: Update PYTHON env to PYTHON_COMMAND
      MdeModulePkg DxeCapsuleLibFmp: Update SupportCapsuleImage() for Fake Capsule
      BaseTools: Remove unused txt files
      Revert "BaseTools:BaseTools supports to the driver combination."

Liu Yu (1):
      EmulatorPkg/build.sh: Fix 'run' path to simulator host executable

Marcin Wojtas (2):
      MdeModulePkg/SdMmcPciHcDxe: Add an optional parameter in NotifyPhase
      MdeModulePkg/SdMmcPciHcDxe: Allow overriding base clock frequency

Max Knutsen (1):
      MdeModulePkg/ReportStatusCodeLib: Avoid using AllocatePool if possible

Meenakshi Aggarwal (1):
      EmbeddedPkg: Fix Command Argument for SD/eMMC R/W operation.

Mike Maslenkin (1):
      UefiCpuPkg/CpuExceptionHandlerLib: Fix spelling issue

Mike Turner (4):
      MdePkg/BaseLib: Introduce CharToUpper and AsciiCharToUpper publicly
      MdePkg/UefiDevicePathLib: Add a checking step
      BaseTools/DevicePath: Add a checking step
      MdePkg/BaseLib: Add Base64Encode() and Base64Decode()

Pete Batard (2):
      EmbeddedPkg/Library: Add VirtualRealTimeClockLib
      EmbeddedPkg/VirtualRealTimeClockLib: Fix correctness issues

Philippe Mathieu-Daude (1):
      BaseTools: Fix build failure when specifying multiple BUILDTARGET

Ray Ni (10):
      MdeModulePkg/PciBus: Shadow option ROM after BARs are programmed
      MdeModulePkg/PciBus: Fix system hang when no PCI Option ROM exists
      Maintainers.txt: Update mail address
      MdeModulePkg/PciBus: Change PCI_IO_DEVICE.RomSize to UINT32 type
      MdeModulePkg/PciBus: Correct typos
      MdeModulePkg/PciBus: Fix a bug PPB MEM32 BAR isn't restored sometimes
      UefiCpuPkg/MtrrLib: Fix a bug that may wrongly set memory <1MB to UC
      ShellBinPkg: Ia32/X64 Shell binary update.
      MdeModulePkg/HiiDatabase: Fix potential integer overflow (CVE-2018-12181)
      MdeModulePkg/HiiImage: Fix stack overflow when corrupted BMP is parsed (CVE-2018-12181)

Sami Mujawar (36):
      Maintainers.txt: Change DynamicTablesPkg maintainer
      DynamicTablesPkg: Dynamic Tables Framework
      DynamicTablesPkg: Table Generator definition
      DynamicTablesPkg: Acpi Table Generator
      DynamicTablesPkg: SMBIOS Table Generator
      DynamicTablesPkg: DT Table Generator
      DynamicTablesPkg: Standard NameSpace Objects
      DynamicTablesPkg: Arm NameSpace Objects
      DynamicTablesPkg: Configuration Manager Objects
      DynamicTablesPkg: Configuration Manager Protocol
      DynamicTablesPkg: Configuration Manager Helper
      DynamicTablesPkg: Table Helper Library
      DynamicTablesPkg: Dynamic Table Factory Protocol
      DynamicTablesPkg: Dynamic Table Factory Dxe
      DynamicTablesPkg: Dynamic Table Manager Dxe
      DynamicTablesPkg: Arm Raw/DSDT/SSDT Generator
      DynamicTablesPkg: Arm ACPI FADT Generator
      DynamicTablesPkg: Arm ACPI MADT Generator
      DynamicTablesPkg: Arm ACPI GTDT Generator
      DynamicTablesPkg: Arm SPCR Table Generator
      DynamicTablesPkg: Arm DBG2 Table Generator
      DynamicTablesPkg: Arm PCI MCFG Table Generator
      DynamicTablesPkg: Arm IORT Table Generator
      DynamicTablesPkg: Fix protocol section
      DynamicTablesPkg: Rename enum used for ID Mapping
      DynamicTablesPkg: Add OEM Info
      DynamicTablesPkg: DGB2: Update DBG2_DEBUG_PORT_DDI
      DynamicTablesPkg: Remove GIC Distributor Id field
      DynamicTablesPkg: Minor updates and fix typos
      ArmPkg: Fix writes to GICv3 GICD_IROUTER<n> reg
      Revert "DynamicTablesPkg: Minor updates and fix typos"
      Revert "DynamicTablesPkg: Remove GIC Distributor Id field"
      Revert "DynamicTablesPkg: DGB2: Update DBG2_DEBUG_PORT_DDI"
      Revert "DynamicTablesPkg: Add OEM Info"
      Revert "DynamicTablesPkg: Rename enum used for ID Mapping"
      Revert "DynamicTablesPkg: Fix protocol section"

Sean Brogan (1):
      MdeModulePkg/NvmExpressDxe: Report StatusCode for device init failure

Shenglei Zhang (37):
      EmulatorPkg: Remove EdkShellBinPkg in FDF and DEC
      Nt32Pkg: Remove EdkShellBinPkg in FDF and DEC
      OvmfPkg: Remove EdkShellBinPkg in FDF
      Vlv2TbltDevicePkg: Remove EdkShellBinPkg with ShellPkg
      EdkShellBinPkg: Remove EdkShellBinPkg
      EdkShellPkg: Remove EdkShellPkg
      Maintainers.txt: Remove EdkShellPkg and EkdShellBinPkg
      UnixPkg: Remove UnixPkg and update Maintainers.txt
      MdeModulePkg: Remove PcdIdentifyMappingPageTablePtr
      ShellPkg: Remove ShellPkg wrapper header files
      BaseTools: Remove GenVtf
      DuetPkg: Remove DuetPkg
      BaseTools: Remove tools only used by DuetPkg
      Maintainers.txt: Remove DuetPkg
      ShellPkg/UefiShellDebug1CommandsLib: Remove the unused function CharToUpper
      MdeModulePkg/EbcDebugger: Change function names
      MdePkg/BaseLib: Remove definitions of two functions
      MdeModulePkg/EbcDebugger: Use AsciiCharToUpper and CharToUpper
      MdeModulePkg/DxeHttpLib: Use BaseLib api AsciiCharToUpper
      ShellPkg/Shell: Use BaseLib api CharToUpper
      ShellPkg/UefiShellLib: Use BaseLib api CharToUpper
      MdePkg: Change function parameter type
      MdeModulePkg/S3SaveStateDxe: Change function parameter types
      MdeModulePkg/SmmS3SaveStateDxe: Change function parameter types
      BaseTools/tools_def.template: Remove CYGGCC
      OptionRomPkg/ReadMe.txt: Remove CYGGCC
      BaseTools: Update MYTOOLS
      BaseTools/tools_def.template: Remove VS2003 and VS2005
      OptionRomPkg/ReadMe.txt: Remove VS2005
      BaseTools/tools_def.template: Remove UNIXGCC
      OvmfPkg/README: Remove UNIXGCC
      BaseTools/tools_def.template: Remove ELFGCC
      BaseTools/tools_def.template: Remove DDK3790
      BaseTools/build_rule.template: Remove GCCLD
      MdePkg/BaseLib: Change a variable type in a bitwise operation
      MdeModulePkg/PropertiesTableAttributesDxe: Remove this driver
      IntelSiliconPkg/MicrocodeUpdateDxe: Error message enhancement

Siyuan Fu (8):
      ArmVirtPkg: Replace obsoleted network drivers from platform DSC/FDF.
      ArmVirtPkg: Remove redundant library instances in ArmVirtQemuKernel.dsc
      MdeModulePkg: Delete Tcp4Dxe in MdeModulePkg.
      NetworkPkg: Remove some clarification from TcpDxe.inf
      MdeModulePkg: Delete IScsiDxe in MdeModulePkg.
      NetworkPkg: Remove some clarification from IScsiDxe.inf
      MdeModulePkg: Delete UefiPxeBcDxe in MdeModulePkg.
      NetworkPkg: Remove some clarification from UefiPxeBcDxe.inf

Solanki, Digant H (1):
      IntelSiliconPkg\Include\IndustryStandard: Update IGD_OPREGION_MBOX3 Structure

Songpeng Li (3):
      ShellPkg/TftpDynamicCommand: Change file writing method in tftp
      NetworkPkg/IScsiDxe: Remove unused global variables.
      NetworkPkg/Dhcp6Dxe: Remove an unused global variable.

Star Zeng (30):
      Maintainers.txt: Update FmpDevicePkg maintainer
      Maintainers.txt: Update MdeModulePkg maintainers
      MdeModulePkg PeiCore: Remove the using of PcdPeiCoreMaxPeimPerFv
      SecurityPkg Tcg(2)Pei: Remove the using of PcdPeiCoreMaxFvSupported
      MdeModulePkg PeiCore: Remove the using of PcdPeiCoreMaxFvSupported
      MdeModulePkg PeiCore: Remove the using of PcdPeiCoreMaxPpiSupported
      OvmfPkg: Remove PcdPeiCoreMaxXXX PCDs' statement
      Vlv2TbltDevicePkg: Remove PcdPeiCoreMaxXXX PCDs' statement
      MdeModulePkg: Remove PcdPeiCoreMaxXXX PCDs
      MdeModulePkg Variable: Add some missing changes for 9b18845
      MdeModulePkg Variable: Abstract InitRealNonVolatileVariableStore
      MdeModulePkg Variable: Move "extern XXX" to Variable.h
      MdeModulePkg Variable: Not get NV PCD in VariableWriteServiceInitialize
      MdeModulePkg Variable: Abstract VariableWriteServiceInitializeDxe/Smm
      MdeModulePkg Variable: Remove CacheOffset in UpdateVariable()
      MdeModulePkg Variable: type case VolatileBase to UINTN directly
      MdeModulePkg: Add PcdEmuVariableNvModeEnable in dec
      MdeModulePkg: Refine description a little for PcdEmuVariableNvStoreReserved
      MdeModulePkg Variable: Add emulated variable NV mode support
      MdeModulePkg VariablePei: Don't check BOOT_IN_RECOVERY_MODE
      ArmVirtXen: Use merged variable driver for emulated NV mode
      ArmVirtXen: Link VarCheckUefiLib NULL class library instance
      BeagleBoardPkg: Use merged variable driver for emulated NV mode
      QuarkMin: Use merged variable driver for emulated NV mode
      CorebootPayloadPkg: Use merged variable driver for emulated NV mode
      MdeModulePkg VariableStandaloneMm: Add PcdEmuVariableNvModeEnable in inf
      MdeModulePkg: Remove EmuVariableRuntimeDxe
      MdeModulePkg/PeiCore: Ensure FfsFileHeader 8 bytes aligned
      MdeModulePkg/DxeCore: Ensure FfsFileHeader 8 bytes aligned
      IntelFrameworkModulePkg/FwVolDxe: Ensure FfsFileHeader 8 bytes aligned

Stefan Berger (1):
      OvmfPkg: Add TCG2 Configuration menu to the Device Manager menu

Sughosh Ganu (3):
      ArmPkg/Include: Fix the SPM version SVC ID
      StandaloneMM: Include the newly added library class for MMU functions
      StandaloneMM: Update permissions for Standalone MM drivers memory area

Sumit Garg (2):
      ArmPkg/OpteeLib: Add dummy RPC handler
      ArmPkg/OpteeLib: Add OPTEE_SUCCESS return code

Sun, Zailiang (1):
      Maintainers.txt: update Vlv2*Pkg maintainers.

Tomasz Michalec (2):
      MdeModulePkg/SdMmcPciHcDxe: Add UhsSignaling to SdMmcOverride protocol
      MdeModulePkg/SdMmcPciHcDxe: Add SwitchClockFreqPost to SdMmcOverride

Vijayenthiran Subramaniam (2):
      MdeModulePkg/Variable: add debug logs in VariableServiceSetVariable
      NetworkPkg/IScsiDxe: add debug logs for failed SetVariable attempts

Vladimir Olovyannikov (1):
      MdeModulePkg/NonDiscoverablePciDeviceDxe: add missing validation

Vladimir Olovyannikov via edk2-devel (1):
      ShellPkg/TftpDynamicCommand: Return proper status

Wang Fan (2):
      NetworkPkg: Add WiFi Connection Manager to NetworkPkg
      NetworkPkg: Fix Duplicate FreePool Error in WCM

Ye Ting (1):
      Maintainers.txt: Change package maintainer and reviewer of CryptoPkg.

Yonghong Zhu (1):
      Maintainers.txt: Update BaseTools maintainers

Yunhua Feng (3):
      BaseTools: nametuple not have verbose parameter in python3
      BaseTools: Remove unnecessary super function
      BaseTools: replace long by int

Zhang, Chao B (6):
      SecurityPkg: TCG Add more Event type
      SecurityPkg: Update TCG PFP spec revision.
      SecurityPkg/Tcg: Fix Warnings and Remarks reported by IASL
      SecurityPkg/TCG: Upgrade UEFI supporting TCG spec info
      MdeModulePkg:Tpm2Acpi.h: Upgrade UEFI supporting TCG spec info
      Maintainers.txt: Change package maintainer and reviewer of SecurityPkg.

Zhao, ZhiqiangX (1):
      BaseTools: AutoGen and GenFds share the parser data.

Zhichao Gao (8):
      ShellPkg: add array index check for shell delay option
      MdeModulePkg: change the function name ResetSystem
      MdeModulePkg: Add the new API ResetSystem in the head file
      MdeModulePkg: Add a new API ResetSystem for DXE ResetSystemLib
      MdeModulePkg: Add a new API ResetSystem for Null version
      MdeModulePkg: Add a new API ResetSystem for PEI ResetSystemLib
      MdeModulePkg: Add a runtime library instance of ResetSystemLib
      MdeModulePkg: Add the runtime ResetSystemLib in MdeModulePkg.dsc

Zhijux Fan (38):
      BaseTools: Update nasm file build rule to support $(INC)
      BaseTools: Add $(INC)-like support when compiling .nasm files
      BaseTools:Build fail when PCD use in the [DEPEX] section of INF files
      BaseTools:build break if the Path contains SingleFile.Ext
      BaseTools:The BuildOptionPcd value is wrong
      BaseTools: Fix Pcd Array changes build report issue.
      BaseTools:Define Macro in Inf file, the pcdvalue Can't convert
      BaseTool:Rename xrange() to range()
      BaseTools:use iterate list to replace the itertools
      BaseTools: Rename iteritems to items
      BaseTools: replace get_bytes_le() to bytes_le
      BaseTools:Solve the data sorting problem use python3
      BaseTools: Update argparse arguments since it not have version now
      BaseTools:Similar to octal data rectification
      BaseTools/UPT:merge UPT Tool use Python2 and Python3
      BaseTools: update Test scripts support python3
      BaseTools/Scripts: Porting PackageDocumentTools code to use Python3
      Basetools: It went wrong when use os.linesep
      BaseTools:Fv BaseAddress must set If it not set
      BaseTools:TestTools character encoding issue
      BaseTools:Double carriage return inserted from Trim.py on Python3
      BaseTools: change the Division Operator
      BaseTools:There is extra blank line in datalog
      BaseTools: Similar to octal data rectification
      BaseTools: Update windows and linux run scripts file to use Python3
      BaseTools:Update build tool to print python version information
      BaseTools:Linux Python highest version check.
      BaseTools: PCD value incorrect in structure pcd sku case.
      BaseTools:StructurePCD value display incorrect in "Not used" section.
      BaseTools:Fix a ECC issue
      BaseTools:BaseTools supports to the driver combination.
      BaseTools:Fixed build failure when specifying multiple BUILDTARGET
      BaseTools:PCD value error in structure pcd sku case.
      BaseTools:Build fail if define [DEPEX] in library inf
      BaseTools:Some build generated files content are not ordered on linux
      BaseTools:PackageDocumentTools import lib error occurs.
      BaseTools:The BOM character is processed when python reads a file
      BaseTools:Run packagedoc_cli.py to generate doc failed

yuchenlin (5):
      Revert "OvmfPkg/QemuVideoDxe: list "UnalignedIoInternal.h" in the INF file"
      Revert "OvmfPkg/QemuVideoDxe: VMWare SVGA device support"
      Revert "OvmfPkg/QemuVideoDxe: Helper functions for unaligned port I/O."
      Revert "OvmfPkg: VMWare SVGA display device register definitions"
      OvmfPkg: simply use the Bochs interface for vmsvga

zwei4 (1):
      Vlv2TbltDevicePkg:Fix build and boot failure of Minnowboard Max platform.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5 years agotests/uefi-test-tools/build.sh: work around TianoCore#1607
Laszlo Ersek [Fri, 8 Mar 2019 23:26:38 +0000 (00:26 +0100)]
tests/uefi-test-tools/build.sh: work around TianoCore#1607

The edk2-stabe201903 release introduced Python3 support to edk2's
BaseTools; however the Python3 enablement breaks in a corner case (which
is nevertheless supported by the edk2 community), namely the in-module
parallelization that we utilize.

This is tracked under
<https://bugzilla.tianocore.org/show_bug.cgi?id=1607>. For now, work
around the issue (in advance) by forcing Python2. (The workaround is a
no-op before we move to edk2-stabe201903 in the roms/edk2 submodule.)

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5 years agoroms/edk2-funcs.sh: require gcc-4.8+ for building i386 and x86_64
Laszlo Ersek [Fri, 8 Mar 2019 21:48:50 +0000 (22:48 +0100)]
roms/edk2-funcs.sh: require gcc-4.8+ for building i386 and x86_64

Adapt the qemu_edk2_get_toolchain() function in "roms/edk2-funcs.sh" in
advance to edk2 commit 8d7cdfae8cb8 ("OvmfPkg: require GCC48 or later",
2019-01-08), which is part of the "edk2-stable201903" tag.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5 years agoroms: lift "edk2-funcs.sh" from "tests/uefi-test-tools/build.sh"
Laszlo Ersek [Wed, 6 Mar 2019 12:12:23 +0000 (13:12 +0100)]
roms: lift "edk2-funcs.sh" from "tests/uefi-test-tools/build.sh"

Extract the dense logic for architecture and toolchain massaging from
"tests/uefi-test-tools/build.sh", to a set of small functions. We'll reuse
these functions for building full platform firmware images.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5 years agoUpdate version for v4.0.0-rc4 release
Peter Maydell [Tue, 16 Apr 2019 20:53:00 +0000 (21:53 +0100)]
Update version for v4.0.0-rc4 release

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agousb-mtp: fix bounds check for guest provided filename
Daniel P. Berrangé [Mon, 15 Apr 2019 15:45:02 +0000 (16:45 +0100)]
usb-mtp: fix bounds check for guest provided filename

The ObjectInfo struct has a variable length array containing the UTF-16
encoded filename. The number of characters of trailing data is given by
the 'length' field in the struct and this must be validated against the
size of the data packet received from the guest.

Since the data is UTF-16, we must convert the byte count we have to a
character count before validating. This must take care to truncate if
a malicious guest sent an odd number of bytes.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Tue, 16 Apr 2019 14:33:38 +0000 (15:33 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches:

- qcow2: Fix potential corruption for preallocated resize with external data file

# gpg: Signature made Tue 16 Apr 2019 15:23:35 BST
# gpg:                using RSA key 7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream:
  qcow2: Fix preallocation bdrv_pwrite to wrong file

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoqcow2: Fix preallocation bdrv_pwrite to wrong file
Kevin Wolf [Mon, 15 Apr 2019 15:54:50 +0000 (17:54 +0200)]
qcow2: Fix preallocation bdrv_pwrite to wrong file

With an external data file, preallocate_co() must write the final byte
to the external data file, not to the qcow2 image file.

This is harmless for preallocation of newly created images (only the
qcow2 file size is increased to the virtual disk size while it should be
much smaller), but with preallocated resize, it could in theory cause
visible corruption if the metadata of the image is larger than the data
(e.g. lots of bitmaps).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agosocket: allow wait=false for client socket
Marc-André Lureau [Mon, 15 Apr 2019 16:33:36 +0000 (18:33 +0200)]
socket: allow wait=false for client socket

Commit 767abe7 ("chardev: forbid 'wait' option with client sockets")
is a bit too strict. Current libvirt always set wait=false, and will
thus fail to add client chardev.

Make the code more permissive, allowing wait=false with client socket
chardevs. Deprecate usage of 'wait' with client sockets.

Fixes: 767abe7f49e8be14d29da5db3527817b5d696a52
Cc: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20190415163337.2795-1-marcandre.lureau@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging
Peter Maydell [Tue, 16 Apr 2019 08:27:35 +0000 (09:27 +0100)]
Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging

Slirp updates

Dr. David Alan Gilbert (1):
  slirp: Gcc 9 -O3 fix

# gpg: Signature made Mon 15 Apr 2019 19:05:39 BST
# gpg:                using RSA key E61DBB15D4172BDEC97E92D9DB550E89F0FA54F3
# gpg: Good signature from "Samuel Thibault <samuel.thibault@aquilenet.fr>" [unknown]
# gpg:                 aka "Samuel Thibault <sthibault@debian.org>" [marginal]
# gpg:                 aka "Samuel Thibault <samuel.thibault@gnu.org>" [unknown]
# gpg:                 aka "Samuel Thibault <samuel.thibault@inria.fr>" [marginal]
# gpg:                 aka "Samuel Thibault <samuel.thibault@labri.fr>" [marginal]
# gpg:                 aka "Samuel Thibault <samuel.thibault@ens-lyon.org>" [marginal]
# gpg:                 aka "Samuel Thibault <samuel.thibault@u-bordeaux.fr>" [unknown]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 900C B024 B679 31D4 0F82  304B D017 8C76 7D06 9EE6
#      Subkey fingerprint: E61D BB15 D417 2BDE C97E  92D9 DB55 0E89 F0FA 54F3

* remotes/thibault/tags/samuel-thibault:
  slirp: Gcc 9 -O3 fix

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoslirp: Gcc 9 -O3 fix
Dr. David Alan Gilbert [Mon, 15 Apr 2019 12:17:40 +0000 (13:17 +0100)]
slirp: Gcc 9 -O3 fix

Gcc 9 needs some convincing that sopreprbuf really is going to fill
in iov in the call from soreadbuf, even though the failure case
shouldn't happen.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20190415121740.9881-1-dgilbert@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
5 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Fri, 12 Apr 2019 16:06:49 +0000 (17:06 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches:

- iotests fixes

# gpg: Signature made Fri 12 Apr 2019 17:04:09 BST
# gpg:                using RSA key 7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream:
  iotest: Fix 241 to run in generic directory
  iotests: Let 245 pass on tmpfs

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoiotest: Fix 241 to run in generic directory
Eric Blake [Wed, 10 Apr 2019 20:42:17 +0000 (15:42 -0500)]
iotest: Fix 241 to run in generic directory

Filter the qemu-nbd server output to get rid of a direct reference
to my build directory.

Fixes: e9dce9cb
Reported-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoiotests: Let 245 pass on tmpfs
Max Reitz [Wed, 10 Apr 2019 16:29:18 +0000 (18:29 +0200)]
iotests: Let 245 pass on tmpfs

tmpfs does not support O_DIRECT.  Detect this case, and skip flipping
@direct if the filesystem does not support it.

Fixes: bf3e50f6239090e63a8ffaaec971671e66d88e07
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqemu-img: fix .hx and .texi disparity
John Snow [Tue, 9 Apr 2019 21:06:55 +0000 (17:06 -0400)]
qemu-img: fix .hx and .texi disparity

It turns out that having options listed in three places continues to be
a bad idea. I'm still toying with the idea of an improved infrastructure
here, but in the meantime, another bandaid.

There are three locations:
(1) .hx file, formatted as texi
(2) .hx file, formatted as human readable.
(3) .texi file, as section headers, formatted as texi.

You can compare the two summaries within the .hx file like so:

Human-readable command summaries:
`./qemu-img --help | grep 'Command syntax' -A14`
Detokenized texi command summaries:
`grep "@item" qemu-img-cmds.hx | sed -E 's|@var\{([^\}]*?)\}|\1|g'`

You can compare the two separate texi summaries like so:

Texi command summaries:
`grep "@item" qemu-img-cmds.hx"`
Texi command headers:
grep -E "@item.*@var" qemu-img.texi | tail -14

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20190409210655.777-1-jsnow@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agocurses: fix wchar_t printf warning
Gerd Hoffmann [Tue, 2 Apr 2019 07:30:18 +0000 (09:30 +0200)]
curses: fix wchar_t printf warning

On some systems wchar_t is "long int", on others just "int".
So go cast to "long int" and adjust the printf format accordingly.

Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20190402073018.17747-1-kraxel@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.0-20190412' into staging
Peter Maydell [Fri, 12 Apr 2019 10:23:14 +0000 (11:23 +0100)]
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.0-20190412' into staging

ppc patch queue for 2018-04-12

Here's a last minute pull request for 4.0.  Turns out my last pull
request, to fix a regression in extended config space access for the
pseries machine didn't fix things hard enough.  This PR has a single
patch which improves the fix to work in more cases.

It's a ghastly, ghastly hack, but it's simple and localized.  I
already have patches almost ready to go in 4.1 that provides a simpler
and cleaner solution to all this.

# gpg: Signature made Fri 12 Apr 2019 06:34:16 BST
# gpg:                using RSA key 75F46586AE61A66CC44E87DC6C38CACA20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>" [full]
# gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>" [full]
# gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>" [full]
# gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>" [unknown]
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-4.0-20190412:
  spapr_pci: Fix broken naming of PCI bus

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agospapr_pci: Fix broken naming of PCI bus
Greg Kurz [Thu, 11 Apr 2019 16:32:24 +0000 (18:32 +0200)]
spapr_pci: Fix broken naming of PCI bus

Recent commit 5cf0d326a0fe fixed a regression which was preventing the
guest to access the extended config space of a PCIe device. This was
done by introducing a new PCI bus subtype for PAPR. The original fix
was causing PCI busses to be named "spapr-pci-host-bridge-root-bus.N"
instead of "pci.N", which was making upper layers unhappy of course.
This got worked around by hardcoding the PCI bus name to "pci.0", but
this only works for the default PHB. And we're now hitting:

# qemu-system-ppc64 \
             -device spapr-pci-host-bridge,index=1 \
             -device e1000e,bus=pci.0 \
             -device e1000e,bus=pci.1
qemu-system-ppc64: -device e1000e,bus=pci.1: Bus 'pci.1' not found

David already posted some patches [1] to control PCI extended config
space accesses with a new flag in the base PCI bus class instead of
subtyping. These patches are a bit more intrusive though, and
are targetted for 4.1.

When no name is passed to pci_register_bus(), the core device code
generates a lowercase name based on the QOM typename. The typename
for the base PCI bus class is "PCI", hence the "pci.0", "pci.1"
bus names. Rename the type of the PAPR PCI bus to "pci", so that
the QOM code can generate proper names. This is a hack but it is
enough to fix the regression. And all this will be reworked properly
in 4.1.

[1] https://patchwork.ozlabs.org/project/qemu-devel/list/?series=100486

Fixes: 5cf0d326a0fe
Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <155500034416.646888.1307366522340665522.stgit@bahia.lab.toulouse-stg.fr.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agoUpdate version for v4.0.0-rc3 release
Peter Maydell [Wed, 10 Apr 2019 14:38:59 +0000 (15:38 +0100)]
Update version for v4.0.0-rc3 release

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/alistair/tags/pull-device-tree-20190409-1'...
Peter Maydell [Wed, 10 Apr 2019 07:57:19 +0000 (08:57 +0100)]
Merge remote-tracking branch 'remotes/alistair/tags/pull-device-tree-20190409-1' into staging

Single device tree fix for 4.0

A single patch to avoid an overflow when loading device trees.

# gpg: Signature made Wed 10 Apr 2019 00:52:16 BST
# gpg:                using RSA key F6C4AC46D4934868D3B8CE8F21E10D29DF977054
# gpg: Good signature from "Alistair Francis <alistair@alistair23.me>" [full]
# Primary key fingerprint: F6C4 AC46 D493 4868 D3B8  CE8F 21E1 0D29 DF97 7054

* remotes/alistair/tags/pull-device-tree-20190409-1:
  device_tree: Fix integer overflowing in load_device_tree()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agodevice_tree: Fix integer overflowing in load_device_tree()
Markus Armbruster [Tue, 9 Apr 2019 17:40:18 +0000 (19:40 +0200)]
device_tree: Fix integer overflowing in load_device_tree()

If the value of get_image_size() exceeds INT_MAX / 2 - 10000, the
computation of @dt_size overflows to a negative number, which then
gets converted to a very large size_t for g_malloc0() and
load_image_size().  In the (fortunately improbable) case g_malloc0()
succeeds and load_image_size() survives, we'd assign the negative
number to *sizep.  What that would do to the callers I can't say, but
it's unlikely to be good.

Fix by rejecting images whose size would overflow.

Reported-by: Kurtis Miller <kurtis.miller@nccgroup.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20190409174018.25798-1-armbru@redhat.com>

5 years agomigration/ram.c: Fix use-after-free in multifd_recv_unfill_packet()
Peter Maydell [Tue, 9 Apr 2019 15:18:30 +0000 (16:18 +0100)]
migration/ram.c: Fix use-after-free in multifd_recv_unfill_packet()

Coverity points out (CID 1400442) that in this code:

    if (packet->pages_alloc > p->pages->allocated) {
        multifd_pages_clear(p->pages);
        multifd_pages_init(packet->pages_alloc);
    }

we free p->pages in multifd_pages_clear() but continue to
use it in the following code. We also leak memory, because
multifd_pages_init() returns the pointer to a new MultiFDPages_t
struct but we are ignoring its return value.

Fix both of these bugs by adding the missing assignment of
the newly created struct to p->pages.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-id: 20190409151830.6024-1-peter.maydell@linaro.org
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Tue, 9 Apr 2019 16:36:00 +0000 (17:36 +0100)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* fixes for Alpine and SuSE
* fix crash when hot-plugging nvdimm on older machine types

# gpg: Signature made Tue 09 Apr 2019 17:34:27 BST
# gpg:                using RSA key BFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream:
  tests: Make check-block a phony target
  hw/i386/pc: Fix crash when hot-plugging nvdimm on older machine types
  include/qemu/bswap.h: Use __builtin_memcpy() in accessor functions
  roms: Allow passing configure options to the EDK2 build tools
  roms: Rename the EFIROM variable to avoid clashing with iPXE

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotests: Make check-block a phony target
Markus Armbruster [Tue, 19 Mar 2019 07:21:04 +0000 (08:21 +0100)]
tests: Make check-block a phony target

Fixes: b93b63f574c "test makefile overhaul"
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190319072104.32591-1-armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agohw/i386/pc: Fix crash when hot-plugging nvdimm on older machine types
Thomas Huth [Sun, 7 Apr 2019 09:23:14 +0000 (11:23 +0200)]
hw/i386/pc: Fix crash when hot-plugging nvdimm on older machine types

QEMU currently crashes when you try to hot-plug an "nvdimm" device
on older machine types:

$ qemu-system-x86_64 -monitor stdio -M pc-1.1
QEMU 3.1.92 monitor - type 'help' for more information
(qemu) device_add nvdimm,id=nvdimmn1
qemu-system-x86_64: /home/thuth/devel/qemu/util/error.c:57: error_setv:
 Assertion `*errp == ((void *)0)' failed.
Aborted (core dumped)

The call to hotplug_handler_pre_plug() in pc_memory_pre_plug() has been
added recently before the check whether nvdimm is enabled. It should
be done after the check. And while we're at it, also check the errp
after the hotplug_handler_pre_plug(), otherwise errors are silently
ignored here.

Fixes: 9040e6dfa8c3fed87695a3de555d2c775727bb51
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20190407092314.11066-1-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agoinclude/qemu/bswap.h: Use __builtin_memcpy() in accessor functions
Peter Maydell [Mon, 18 Mar 2019 11:29:38 +0000 (11:29 +0000)]
include/qemu/bswap.h: Use __builtin_memcpy() in accessor functions

In the accessor functions ld*_he_p() and st*_he_p() we use memcpy()
to perform a load or store to a pointer which might not be aligned
for the size of the type. We rely on the compiler to optimize this
memcpy() into an efficient load or store instruction where possible.
This is required for good performance, but at the moment it is also
required for correct operation, because some users of these functions
require that the access is atomic if the pointer is aligned, which
will only be the case if the compiler has optimized out the memcpy().
(The particular example where we discovered this is the virtio
vring_avail_idx() which calls virtio_lduw_phys_cached() which
eventually ends up calling lduw_he_p().)

Unfortunately some compile environments, such as the fortify-source
setup used in Alpine Linux, define memcpy() to a wrapper function
in a way that inhibits this compiler optimization.

The correct long-term fix here is to add a set of functions for
doing atomic accesses into AddressSpaces (and to other relevant
families of accessor functions like the virtio_*_phys_cached()
ones), and make sure that callsites which want atomic behaviour
use the correct functions.

In the meantime, switch to using __builtin_memcpy() in the
bswap.h accessor functions. This will make us robust against things
like this fortify library in the short term. In the longer term
it will mean that we don't end up with these functions being really
badly-performing even if the semantics of the out-of-line memcpy()
are correct.

Reported-by: Fernando Casas Schössow <casasfernando@outlook.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20190318112938.8298-1-peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agoroms: Allow passing configure options to the EDK2 build tools
Philippe Mathieu-Daudé [Tue, 9 Apr 2019 13:45:36 +0000 (15:45 +0200)]
roms: Allow passing configure options to the EDK2 build tools

Since commit f590a812c210 we build the EDK2 EfiRom utility
unconditionally.

Some distributions require to use extra compiler/linker flags,
i.e. SUSE which enforces the PIE protection (see [*]).

EDK2 build tools already provide a set of variables for that,
use them to allow the caller to easily inject compiler/linker
options..

Now build scripts can pass extra options, example:

  $ make -C roms \
      EDK2_BASETOOLS_OPTFLAGS='-fPIE' \
      efirom

[*] https://lists.opensuse.org/opensuse-factory/2017-06/msg00403.html

Reported-by: Olaf Hering <olaf@aepfle.de>
Suggested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190409134536.15548-3-philmd@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agoroms: Rename the EFIROM variable to avoid clashing with iPXE
Philippe Mathieu-Daudé [Tue, 9 Apr 2019 13:45:35 +0000 (15:45 +0200)]
roms: Rename the EFIROM variable to avoid clashing with iPXE

The iPXE's 'veryclean' recipe removes $(EFIROM) even if the EFIROM
macro originates from elsewhere:

  $ git checkout f590a812c21~
  $ make -C roms clean EFIROM=$(type -P EfiRom)
  make: Entering directory '/source/qemu/roms'
  [...]
  make -C ipxe/src veryclean
  make[1]: Entering directory '/source/qemu/roms/ipxe/src'
  rm -f bin{,-*}/*.* bin{,-*}/.certificate.* bin{,-*}/.certificates.* bin{,-*}/.private_key.* bin{,-*}/errors bin{,-*}/NIC ./util/zbin ./util/elf2efi32 ./util/elf2efi64 /usr/bin/EfiRom ./util/efifatbin ./util/iccfix ./util/einfo TAGS bin{,-*}/symtab
  rm: cannot remove '/usr/bin/EfiRom': Permission denied
  make[1]: *** [Makefile.housekeeping:1564: clean] Error 1
  make[1]: Leaving directory '/source/qemu/roms/ipxe/src'
  make: *** [Makefile:152: clean] Error 2
  make: Leaving directory '/source/qemu/roms'

Before f590a812c21 this variable could be overridden or unset,
and the 'veryclean' Makefile rule would not complain.

Commit f590a812c21 enforces this variable to the Intel EfiRom
tool provided by the EDK2 project.

To avoid the name clash and make the difference between the
projects obvious, rename the variable used by the EDK2 project
as EDK2_EFIROM.

Fixes: f590a812c21074e82228de3e1dfb57b75fc02b62
Reported-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190409134536.15548-2-philmd@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agotarget/i386: Generate #UD for LOCK on a register increment
Peter Maydell [Thu, 28 Mar 2019 10:47:50 +0000 (10:47 +0000)]
target/i386: Generate #UD for LOCK on a register increment

Fix a TCG crash due to attempting an atomic increment
operation without having set up the address first.
This is a similar case to that dealt with in commit
e84fcd7f662a0d8198703, and we fix it in the same way.

Fixes: https://bugs.launchpad.net/qemu/+bug/1807675
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20190328104750.25046-1-peter.maydell@linaro.org

5 years agoMerge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.0-20190409' into staging
Peter Maydell [Tue, 9 Apr 2019 11:58:50 +0000 (12:58 +0100)]
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.0-20190409' into staging

ppc patch queue 2019-04-09

This is a small, hard freeze, pull request which fixes a regression on
the pseries machine handling of PCI-E extended config space accesses.

# gpg: Signature made Tue 09 Apr 2019 08:00:36 BST
# gpg:                using RSA key 75F46586AE61A66CC44E87DC6C38CACA20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>" [full]
# gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>" [full]
# gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>" [full]
# gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>" [unknown]
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-4.0-20190409:
  spapr_pci: Fix extended config space accesses
  pci: Allow PCI bus subtypes to support extended config space accesses

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-4.0-pull-request...
Peter Maydell [Tue, 9 Apr 2019 09:02:30 +0000 (10:02 +0100)]
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-4.0-pull-request' into staging

fix gettid() clash with new glibc

# gpg: Signature made Mon 08 Apr 2019 20:36:06 BST
# gpg:                using RSA key F30C38BD3F2FBE3C
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/linux-user-for-4.0-pull-request:
  linux-user: rename gettid() to sys_gettid() to avoid clash with glibc
  linux-user: assume __NR_gettid always exists

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agospapr_pci: Fix extended config space accesses
Greg Kurz [Mon, 1 Apr 2019 17:55:08 +0000 (19:55 +0200)]
spapr_pci: Fix extended config space accesses

The PAPR PHB acts as a legacy PCI bus but it allows PCIe extended
config space accesses anyway (for pseries-2.9 and newer machine
types).

Introduce a specific PCI bus subtype to inform the common PCI code
about that.

Fixes: c2077e2ca0da7
Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <155414130834.574858.16502276132110219890.stgit@bahia.lan>
[dwg: Apply fix so we don't rename the default pci bus, breaking everything]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agopci: Allow PCI bus subtypes to support extended config space accesses
Greg Kurz [Mon, 1 Apr 2019 17:55:02 +0000 (19:55 +0200)]
pci: Allow PCI bus subtypes to support extended config space accesses

Some PHB implementations, eg. PAPR used on pseries machine, act like
a regular PCI bus rather than a PCIe bus, but allow access to the
PCIe extended config space anyway.

Introduce a new PCI bus class method to modelize this behaviour and
use it when adjusting the config space size limit during accesses.

No behaviour change for existing PCI bus types.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <155414130271.574858.4253514266378127489.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agoMerge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-04-08' into staging
Peter Maydell [Mon, 8 Apr 2019 19:10:21 +0000 (20:10 +0100)]
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-04-08' into staging

nbd patches for 2019-04-08

- Fix minor issues in recent alignment patches

# gpg: Signature made Mon 08 Apr 2019 19:53:48 BST
# gpg:                using RSA key A7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full]
# gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full]
# gpg:                 aka "[jpeg image of size 6874]" [full]
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-nbd-2019-04-08:
  nbd/client: Fix error message for server with unusable sizing
  nbd/server: Don't fail NBD_OPT_INFO for byte-aligned sources
  nbd/server: Trace client noncompliance on unaligned requests
  nbd/server: Fix blockstatus trace

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agonbd/client: Fix error message for server with unusable sizing
Eric Blake [Thu, 4 Apr 2019 14:52:26 +0000 (09:52 -0500)]
nbd/client: Fix error message for server with unusable sizing

Add a missing space to the error message used when giving up on a
server that insists on an alignment which renders the last few bytes
of the export unreadable.

Fixes: 3add3ab78
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190404145226.32649-1-eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
5 years agonbd/server: Don't fail NBD_OPT_INFO for byte-aligned sources
Eric Blake [Wed, 3 Apr 2019 03:05:22 +0000 (22:05 -0500)]
nbd/server: Don't fail NBD_OPT_INFO for byte-aligned sources

In commit 0c1d50bd, I added a couple of TODO comments about whether we
consult bl.request_alignment when responding to NBD_OPT_INFO. At the
time, qemu as server was hard-coding an advertised alignment of 512 to
clients that promised to obey constraints, and there was no function
for getting at a device's preferred alignment. But in hindsight,
advertising 512 when the block device prefers 1 caused other
compliance problems, and commit b0245d64 changed one of the two TODO
comments to advertise a more accurate alignment. Time to fix the other
TODO.  Doesn't really impact qemu as client (our normal client doesn't
use NBD_OPT_INFO, and qemu-nbd --list promises to obey block sizes),
but it might prove useful to other clients.

Fixes: b0245d64
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190403030526.12258-4-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agonbd/server: Trace client noncompliance on unaligned requests
Eric Blake [Wed, 3 Apr 2019 03:05:21 +0000 (22:05 -0500)]
nbd/server: Trace client noncompliance on unaligned requests

We've recently added traces for clients to flag server non-compliance;
let's do the same for servers to flag client non-compliance. According
to the spec, if the client requests NBD_INFO_BLOCK_SIZE, it is
promising to send all requests aligned to those boundaries.  Of
course, if the client does not request NBD_INFO_BLOCK_SIZE, then it
made no promises so we shouldn't flag anything; and because we are
willing to handle clients that made no promises (the spec allows us to
use NBD_REP_ERR_BLOCK_SIZE_REQD if we had been unwilling), we already
have to handle unaligned requests (which the block layer already does
on our behalf).  So even though the spec allows us to return EINVAL
for clients that promised to behave, it's easier to always answer
unaligned requests.  Still, flagging non-compliance can be useful in
debugging a client that is trying to be maximally portable.

Qemu as client used to have one spot where it sent non-compliant
requests: if the server sends an unaligned reply to
NBD_CMD_BLOCK_STATUS, and the client was iterating over the entire
disk, the next request would start at that unaligned point; this was
fixed in commit a39286dd when the client was taught to work around
server non-compliance; but is equally fixed if the server is patched
to not send unaligned replies in the first place (yes, qemu 4.0 as
server still has few such bugs, although they will be patched in
4.1). Fortunately, I did not find any more spots where qemu as client
was non-compliant. I was able to test the patch by using the following
hack to convince qemu-io to run various unaligned commands, coupled
with serving 512-byte alignment by intentionally omitting '-f raw' on
the server while viewing server traces.

| diff --git i/nbd/client.c w/nbd/client.c
| index 427980bdd22..1858b2aac35 100644
| --- i/nbd/client.c
| +++ w/nbd/client.c
| @@ -449,6 +449,7 @@ static int nbd_opt_info_or_go(QIOChannel *ioc, uint32_t opt,
|                  nbd_send_opt_abort(ioc);
|                  return -1;
|              }
| +            info->min_block = 1;//hack
|              if (!is_power_of_2(info->min_block)) {
|                  error_setg(errp, "server minimum block size %" PRIu32
|                             " is not a power of two", info->min_block);

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190403030526.12258-3-eblake@redhat.com>
[eblake: address minor review nits]
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agonbd/server: Fix blockstatus trace
Eric Blake [Wed, 3 Apr 2019 03:05:20 +0000 (22:05 -0500)]
nbd/server: Fix blockstatus trace

Don't increment remaining_bytes until we know that we will actually be
including the current block status extent in the reply; otherwise, the
value traced will include a bytes value that is oversized by the
length of the next block status extent which did not get sent because
it instead ended the loop.

Fixes: fb7afc79
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190403030526.12258-2-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Mon, 8 Apr 2019 16:53:18 +0000 (17:53 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches:

- hmp: Fix drive_add ... format=help crash
- block: Forward 'discard' to temporary overlay

# gpg: Signature made Mon 08 Apr 2019 16:43:20 BST
# gpg:                using RSA key 7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream:
  hmp: Fix drive_add ... format=help crash
  block: Forward 'discard' to temporary overlay

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agohmp: Fix drive_add ... format=help crash
Markus Armbruster [Mon, 8 Apr 2019 15:30:03 +0000 (17:30 +0200)]
hmp: Fix drive_add ... format=help crash

drive_new() returns null without setting an error when it provided
help.  add_init_drive() assumes null means failure, and crashes trying
to report a null error.

Fixes: c4f26c9f37ce511e5fe629c21c180dc6eb7c5a25
Cc: qemu-stable@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agolinux-user: rename gettid() to sys_gettid() to avoid clash with glibc
Daniel P. Berrangé [Wed, 20 Mar 2019 16:18:42 +0000 (16:18 +0000)]
linux-user: rename gettid() to sys_gettid() to avoid clash with glibc

The glibc-2.29.9000-6.fc31.x86_64 package finally includes the gettid()
function as part of unistd.h when __USE_GNU is defined. This clashes
with linux-user code which unconditionally defines this function name
itself.

/home/berrange/src/virt/qemu/linux-user/syscall.c:253:16: error: static declaration of ‘gettid’ follows non-static declaration
  253 | _syscall0(int, gettid)
      |                ^~~~~~
/home/berrange/src/virt/qemu/linux-user/syscall.c:184:13: note: in definition of macro ‘_syscall0’
  184 | static type name (void)   \
      |             ^~~~
In file included from /usr/include/unistd.h:1170,
                 from /home/berrange/src/virt/qemu/include/qemu/osdep.h:107,
                 from /home/berrange/src/virt/qemu/linux-user/syscall.c:20:
/usr/include/bits/unistd_ext.h:34:16: note: previous declaration of ‘gettid’ was here
   34 | extern __pid_t gettid (void) __THROW;
      |                ^~~~~~
  CC      aarch64-linux-user/linux-user/signal.o
make[1]: *** [/home/berrange/src/virt/qemu/rules.mak:69: linux-user/syscall.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:449: subdir-aarch64-linux-user] Error 2

While we could make our definition conditional and rely on glibc's impl,
this patch simply renames our definition to sys_gettid() which is a
common pattern in this file.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20190320161842.13908-3-berrange@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agolinux-user: assume __NR_gettid always exists
Daniel P. Berrangé [Wed, 20 Mar 2019 16:18:41 +0000 (16:18 +0000)]
linux-user: assume __NR_gettid always exists

The gettid syscall was introduced in Linux 2.4.11. This is old enough
that we can assume it always exists and thus not bother with the
conditional backcompat logic.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20190320161842.13908-2-berrange@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoblock: Forward 'discard' to temporary overlay
Kevin Wolf [Thu, 4 Apr 2019 15:04:43 +0000 (17:04 +0200)]
block: Forward 'discard' to temporary overlay

When bdrv_temp_snapshot_options() is called for snapshot=on, the
'discard' option in the options QDict hasn't been parsed and merged into
the flags yet. So copy the dict entry to make sure that the temporary
overlay enables discard when it was requested for the drive.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
5 years agoMerge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-04-08' into...
Peter Maydell [Mon, 8 Apr 2019 14:21:11 +0000 (15:21 +0100)]
Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-04-08' into staging

- Fix a crash in libqos with GCC 9
- Fix usage of wrong boolean types in libqos

# gpg: Signature made Mon 08 Apr 2019 11:48:56 BST
# gpg:                using RSA key 2ED9D774FE702DB5
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/huth-gitlab/tags/pull-request-2019-04-08:
  test qgraph.c: Fix segs due to out of scope default
  tests/libqos: fix usage of bool in pci-spapr.c
  tests/libqos: fix usage of bool in pci-pc.c

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotest qgraph.c: Fix segs due to out of scope default
Dr. David Alan Gilbert [Fri, 5 Apr 2019 18:40:37 +0000 (19:40 +0100)]
test qgraph.c: Fix segs due to out of scope default

The test uses the trick:
   if (!opts) {
     opts = &(QOSGraph...Options) { };
   }

  in a couple of places, however the temporary created
by the &() {}  goes out of scope at the bottom of the if,
and results in a seg or assert when opts-> fields are
used (on fedora 30's gcc 9).

Fixes: fc281c802022cb3a73a5
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190405184037.16799-1-dgilbert@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
5 years agotests/libqos: fix usage of bool in pci-spapr.c
Jafar Abdi [Sat, 23 Mar 2019 14:26:36 +0000 (17:26 +0300)]
tests/libqos: fix usage of bool in pci-spapr.c

Clean up wrong usage of FALSE and TRUE in places that use "bool" from stdbool.h.

FALSE and TRUE (with capital letters) are the constants defined by glib for
being used with the "gboolean" type of glib. But some parts of the code also use
TRUE and FALSE for variables that are declared as "bool" (the type from <stdbool.h>).

Signed-off-by: Jafar Abdi <cafer.abdi@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <1553351197-14581-4-git-send-email-cafer.abdi@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
5 years agotests/libqos: fix usage of bool in pci-pc.c
Jafar Abdi [Sat, 23 Mar 2019 14:26:35 +0000 (17:26 +0300)]
tests/libqos: fix usage of bool in pci-pc.c

Clean up wrong usage of FALSE and TRUE in places that use "bool" from stdbool.h.

FALSE and TRUE (with capital letters) are the constants defined by glib for
being used with the "gboolean" type of glib. But some parts of the code also use
TRUE and FALSE for variables that are declared as "bool" (the type from <stdbool.h>).

Signed-off-by: Jafar Abdi <cafer.abdi@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1553351197-14581-3-git-send-email-cafer.abdi@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Sun, 7 Apr 2019 13:54:55 +0000 (14:54 +0100)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pci, pc, virtio: fixes

intel-iommu fixes
virtio typo fixes
linker: a couple of asserts for consistency/security

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Tue 02 Apr 2019 16:51:19 BST
# gpg:                using RSA key 281F0DB8D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full]
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>" [full]
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* remotes/mst/tags/for_upstream:
  intel_iommu: Drop extended root field
  intel_iommu: Fix root_scalable migration breakage
  virtio-net: Fix typo in comment
  intel_iommu: Correct caching-mode error message
  acpi: verify file entries in bios_linker_loader_add_pointer()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20190405a' into...
Peter Maydell [Fri, 5 Apr 2019 23:22:34 +0000 (00:22 +0100)]
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20190405a' into staging

Migration fixes pull for 4.0

A couple of fixes for crashes in colo and
migration parameters.

# gpg: Signature made Fri 05 Apr 2019 16:47:38 BST
# gpg:                using RSA key 45F5C71B4A0CB7FB977A9FA90516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" [full]
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert/tags/pull-migration-20190405a:
  migration: Fix migrate_set_parameter
  migration/ram.c: Fix codes conflict about bitmap_mutex

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agomigration: Fix migrate_set_parameter
Juan Quintela [Wed, 3 Apr 2019 11:49:51 +0000 (13:49 +0200)]
migration: Fix migrate_set_parameter

Otherwise we are setting err twice, what is wrong and causes an abort.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20190403114958.3705-2-quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
5 years agomigration/ram.c: Fix codes conflict about bitmap_mutex
Zhang Chen [Fri, 29 Mar 2019 22:29:51 +0000 (06:29 +0800)]
migration/ram.c: Fix codes conflict about bitmap_mutex

I found upstream codes conflict with COLO and lead to crash,
and I located to this patch:

commit 386a907b37a9321bc5d699bc37104d6ffba1b34d
Author: Wei Wang <wei.w.wang@intel.com>
Date:   Tue Dec 11 16:24:49 2018 +0800

migration: use bitmap_mutex in migration_bitmap_clear_dirty

My colleague Wei's patch add bitmap_mutex in migration_bitmap_clear_dirty,
but COLO didn't initialize the bitmap_mutex. So we always get an error
when COLO start up. like that:
qemu-system-x86_64: util/qemu-thread-posix.c:64: qemu_mutex_lock_impl: Assertion `mutex->initialized' failed.

This patch add the bitmap_mutex initialize and destroy in COLO
lifecycle.

Signed-off-by: Zhang Chen <chen.zhang@intel.com>
Message-Id: <20190329222951.28945-1-chen.zhang@intel.com>
Reviewed-by: Wei Wang <wei.w.wang@intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-4.0-rc3-v2' into...
Peter Maydell [Fri, 5 Apr 2019 03:50:30 +0000 (04:50 +0100)]
Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-4.0-rc3-v2' into staging

RISC-V Patches for 4.0-rc3, v2

This patch set contains a pair of tightly coupled PLIC bug fixes:

* We were calculating the PLIC addresses incorrectly.
* We were installing the wrong number of PLIC interrupts.

The two bugs togther resulted in a mostly-working system, but they're
impossible to seperate because fixing one bug would result in
significant breakage.  As a result they're in the same patch.

There is also a cleanup to use qemu_log_mask(LOG_GUEST_ERROR,...) for
error reporting.

As far as I know these are the last outstanding RISC-V patches for 4.0.

v2 no longer fails "make check" for me... sorry!

# gpg: Signature made Fri 05 Apr 2019 01:33:57 BST
# gpg:                using RSA key 00CE76D1834960DFCE886DF8EF4CA1502CCBAB41
# gpg:                issuer "palmer@dabbelt.com"
# gpg: Good signature from "Palmer Dabbelt <palmer@dabbelt.com>" [unknown]
# gpg:                 aka "Palmer Dabbelt <palmer@sifive.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 00CE 76D1 8349 60DF CE88  6DF8 EF4C A150 2CCB AB41

* remotes/palmer/tags/riscv-for-master-4.0-rc3-v2:
  riscv: plic: Log guest errors
  riscv: plic: Fix incorrect irq calculation

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/aperard/tags/pull-xen-20190404' into staging
Peter Maydell [Fri, 5 Apr 2019 02:52:05 +0000 (03:52 +0100)]
Merge remote-tracking branch 'remotes/aperard/tags/pull-xen-20190404' into staging

Xen queue

xen-block fixes

# gpg: Signature made Thu 04 Apr 2019 18:04:38 BST
# gpg:                using RSA key F80C006308E22CFD8A92E7980CF5572FD7FB55AF
# gpg:                issuer "anthony.perard@citrix.com"
# gpg: Good signature from "Anthony PERARD <anthony.perard@gmail.com>" [marginal]
# gpg:                 aka "Anthony PERARD <anthony.perard@citrix.com>" [marginal]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 5379 2F71 024C 600F 778A  7161 D8D5 7199 DF83 42C8
#      Subkey fingerprint: F80C 0063 08E2 2CFD 8A92  E798 0CF5 572F D7FB 55AF

* remotes/aperard/tags/pull-xen-20190404:
  xen-block: scale sector based quantities correctly
  xen-block: only advertize discard to the frontend when it is enabled...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoriscv: plic: Log guest errors
Alistair Francis [Thu, 4 Apr 2019 18:15:34 +0000 (18:15 +0000)]
riscv: plic: Log guest errors

Instead of using error_report() to print guest errors let's use
qemu_log_mask(LOG_GUEST_ERROR,...) to log the error.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
5 years agoriscv: plic: Fix incorrect irq calculation
Alistair Francis [Thu, 4 Apr 2019 18:15:23 +0000 (18:15 +0000)]
riscv: plic: Fix incorrect irq calculation

This patch fixes four different things, to maintain bisectability they
have been merged into a single patch. The following fixes are below:

sifive_plic: Fix incorrect irq calculation
The irq is incorrectly calculated to be off by one. It has worked in the
past as the priority_base offset has also been set incorrectly. We are
about to fix the priority_base offset so first first the irq
calculation.

sifive_u: Fix PLIC priority base offset and numbering
According to the FU540 manual the PLIC source priority address starts at
an offset of 0x04 and not 0x00. The same manual also specifies that the
PLIC only has 53 source priorities. Fix these two incorrect header
files.

We also need to over extend the plic_gpios[] array as the PLIC sources
count from 1 and not 0.

riscv: sifive_e: Fix PLIC priority base offset
According to the FE31 manual the PLIC source priority address starts at
an offset of 0x04 and not 0x00.

riscv: virt: Fix PLIC priority base offset
Update the virt offsets based on the newly updated SiFive U and SiFive E
offsets.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
5 years agoxen-block: scale sector based quantities correctly
Paul Durrant [Mon, 1 Apr 2019 12:17:19 +0000 (13:17 +0100)]
xen-block: scale sector based quantities correctly

The Xen blkif protocol requires that sector based quantities should be
interpreted strictly as multiples of 512 bytes. Specifically:

"first_sect and last_sect in blkif_request_segment, as well as
sector_number in blkif_request, are always expressed in 512-byte units."

Commit fcab2b464e06 "xen: add header and build dataplane/xen-block.c"
incorrectly modified behaviour to use the block device logical_block_size
property as the scale, instead of correctly shifting values by the
hardcoded BDRV_SECTOR_BITS (and hence scaling them to 512 byte units).
This patch undoes that change and restores compliance with the spec.

Furthermore, this patch also restores the original xen_disk behaviour
of advertizing a hardcoded 'sector-size' value of 512 in xenstore and
scaling 'sectors' accordingly. The realize() method is also modified to
fail if logical_block_size is set to anything other than 512.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Message-Id: <20190401121719.27208-1-paul.durrant@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoxen-block: only advertize discard to the frontend when it is enabled...
Paul Durrant [Wed, 20 Mar 2019 14:28:25 +0000 (14:28 +0000)]
xen-block: only advertize discard to the frontend when it is enabled...

...and properly enable it when synthesizing a drive.

The Xen toolstack sets 'discard-enable' to '1' in xenstore when it wants
to enable discard on a specified image. The code in
xen_block_drive_create() correctly parses this and uses it to set
'discard' to 'unmap' for the file_layer, but fails to do the same for the
driver_layer (which effectively disables it). Meanwhile the code in
xen_block_realize() advertizes discard support to the frontend in the
default case (because conf->discard_granularity defaults to -1), even when
the underlying image may not handle it.

This patch adds the missing option to the driver_layer in
xen_block_driver_create() and checks whether BDRV_O_UNMAP is actually
set on the block device before advertizing discard to the frontend.
In the case that discard is supported it also makes sure that the
granularity is set to the physical block size.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Message-Id: <20190320142825.24565-1-paul.durrant@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
5 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20190403' into staging
Peter Maydell [Wed, 3 Apr 2019 12:13:30 +0000 (13:13 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20190403' into staging

Fix taking address of fields in packed structs warnings
by gcc 9

# gpg: Signature made Wed 03 Apr 2019 10:58:42 BST
# gpg:                using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF
# gpg:                issuer "cohuck@redhat.com"
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>" [unknown]
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>" [full]
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>" [full]
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>" [unknown]
# gpg:                 aka "Cornelia Huck <cohuck@redhat.com>" [unknown]
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20190403:
  hw/s390x/3270-ccw: avoid taking address of fields in packed struct
  hw/s390x/ipl: avoid taking address of fields in packed struct
  hw/s390/css: avoid taking address members in packed structs
  hw/vfio/ccw: avoid taking address members in packed structs

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agohw/s390x/3270-ccw: avoid taking address of fields in packed struct
Daniel P. Berrangé [Fri, 29 Mar 2019 11:11:04 +0000 (11:11 +0000)]
hw/s390x/3270-ccw: avoid taking address of fields in packed struct

Compiling with GCC 9 complains

hw/s390x/3270-ccw.c: In function ‘emulated_ccw_3270_cb’:
hw/s390x/3270-ccw.c:81:19: error: taking address of packed member of ‘struct SCHIB’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
   81 |         SCSW *s = &sch->curr_status.scsw;
      |                   ^~~~~~~~~~~~~~~~~~~~~~

This local variable is only present to save a little bit of
typing when setting the field later. Get rid of this to avoid
the warning about unaligned accesses.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20190329111104.17223-15-berrange@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agohw/s390x/ipl: avoid taking address of fields in packed struct
Daniel P. Berrangé [Fri, 29 Mar 2019 11:11:03 +0000 (11:11 +0000)]
hw/s390x/ipl: avoid taking address of fields in packed struct

Compiling with GCC 9 complains

hw/s390x/ipl.c: In function ‘s390_ipl_set_boot_menu’:
hw/s390x/ipl.c:256:25: warning: taking address of packed member of ‘struct QemuIplParameters’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  256 |     uint32_t *timeout = &ipl->qipl.boot_menu_timeout;
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

This local variable is only present to save a little bit of
typing when setting the field later. Get rid of this to avoid
the warning about unaligned accesses.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20190329111104.17223-14-berrange@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agohw/s390/css: avoid taking address members in packed structs
Daniel P. Berrangé [Fri, 29 Mar 2019 11:11:02 +0000 (11:11 +0000)]
hw/s390/css: avoid taking address members in packed structs

The GCC 9 compiler complains about many places in s390 code
that take the address of members of the 'struct SCHIB' which
is marked packed:

hw/s390x/css.c: In function ‘sch_handle_clear_func’:
hw/s390x/css.c:698:15: warning: taking address of packed member of ‘struct SCHIB’ may result in an unaligned pointer val\
ue [-Waddress-of-packed-member]
  698 |     PMCW *p = &sch->curr_status.pmcw;
      |               ^~~~~~~~~~~~~~~~~~~~~~
hw/s390x/css.c:699:15: warning: taking address of packed member of ‘struct SCHIB’ may result in an unaligned pointer val\
ue [-Waddress-of-packed-member]
  699 |     SCSW *s = &sch->curr_status.scsw;
      |               ^~~~~~~~~~~~~~~~~~~~~~

...snip many more...

Almost all of these are just done for convenience to avoid
typing out long variable/field names when referencing struct
members. We can get most of this convenience by taking the
address of the 'struct SCHIB' instead, avoiding triggering
the compiler warnings.

In a couple of places we copy via a local variable which is
a technique already applied elsewhere in s390 code for this
problem.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20190329111104.17223-13-berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agohw/vfio/ccw: avoid taking address members in packed structs
Daniel P. Berrangé [Fri, 29 Mar 2019 11:11:01 +0000 (11:11 +0000)]
hw/vfio/ccw: avoid taking address members in packed structs

The GCC 9 compiler complains about many places in s390 code
that take the address of members of the 'struct SCHIB' which
is marked packed:

hw/vfio/ccw.c: In function ‘vfio_ccw_io_notifier_handler’:
hw/vfio/ccw.c:133:15: warning: taking address of packed member of ‘struct SCHIB’ may result in an unaligned pointer value \
[-Waddress-of-packed-member]
  133 |     SCSW *s = &sch->curr_status.scsw;
      |               ^~~~~~~~~~~~~~~~~~~~~~
hw/vfio/ccw.c:134:15: warning: taking address of packed member of ‘struct SCHIB’ may result in an unaligned pointer value \
[-Waddress-of-packed-member]
  134 |     PMCW *p = &sch->curr_status.pmcw;
      |               ^~~~~~~~~~~~~~~~~~~~~~

...snip many more...

Almost all of these are just done for convenience to avoid
typing out long variable/field names when referencing struct
members. We can get most of this convenience by taking the
address of the 'struct SCHIB' instead, avoiding triggering
the compiler warnings.

In a couple of places we copy via a local variable which is
a technique already applied elsewhere in s390 code for this
problem.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20190329111104.17223-12-berrange@redhat.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agoUpdate version for v4.0.0-rc2 release
Peter Maydell [Tue, 2 Apr 2019 16:01:20 +0000 (17:01 +0100)]
Update version for v4.0.0-rc2 release

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agointel_iommu: Drop extended root field
Peter Xu [Fri, 29 Mar 2019 06:14:22 +0000 (14:14 +0800)]
intel_iommu: Drop extended root field

VTD_RTADDR_RTT is dropped even by the VT-d spec, so QEMU should
probably do the same thing (after all we never really implemented it).
Since we've had a field for that in the migration stream, to keep
compatibility we need to fill the hole up.

Please refer to VT-d spec 10.4.6.

Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20190329061422.7926-3-peterx@redhat.com>
Reviewed-by: Liu, Yi L <yi.l.liu@intel.com>
Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agointel_iommu: Fix root_scalable migration breakage
Peter Xu [Fri, 29 Mar 2019 06:14:21 +0000 (14:14 +0800)]
intel_iommu: Fix root_scalable migration breakage

When introducing the initial support for scalable mode we added a
new field into vmstate however we blindly migrate that field without
notice.  That'll break migration no matter forward or backward.

The normal way should be that we use something like
VMSTATE_UINT32_TEST() or subsections for the new vmstate field however
for this case of vt-d we can even make it simpler because we've
already migrated all the registers and it'll be fairly simple that we
re-generate root_scalable field from the register values during post
load of the device.

Fixes: fb43cf739e ("intel_iommu: scalable mode emulation")
Reviewed-by: Yi Sun <yi.y.sun@linux.intel.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20190329061422.7926-2-peterx@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agovirtio-net: Fix typo in comment
Yuval Shaia [Thu, 21 Mar 2019 16:18:32 +0000 (18:18 +0200)]
virtio-net: Fix typo in comment

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Message-Id: <20190321161832.10533-1-yuval.shaia@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agointel_iommu: Correct caching-mode error message
Alex Williamson [Tue, 26 Mar 2019 23:05:38 +0000 (17:05 -0600)]
intel_iommu: Correct caching-mode error message

If we try to use the intel-iommu device with vfio-pci devices without
caching mode enabled, we're told:

  qemu-system-x86_64: We need to set caching-mode=1 for intel-iommu to enable
  device assignment with IOMMU protection.

But to enable caching mode, the option is actually "caching-mode=on".

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Message-Id: <155364147432.16467.15898335025013220939.stgit@gimli.home>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Alex Williamson &lt;<a href="mailto:alex.williamson@redhat.com" target="_blank" rel="noreferrer">alex.williamson@redhat.com</a>&gt;<br>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agoacpi: verify file entries in bios_linker_loader_add_pointer()
Liam Merwick [Thu, 21 Mar 2019 20:13:49 +0000 (20:13 +0000)]
acpi: verify file entries in bios_linker_loader_add_pointer()

The callers to bios_linker_find_file() assert that the file entry returned
is not NULL, except for those in bios_linker_loader_add_pointer().  Add two
asserts in that case for completeness and to facilitate static code analysis.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Message-Id: <1553199229-25318-1-git-send-email-liam.merwick@oracle.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/armbru/tags/pull-misc-2019-04-02' into staging
Peter Maydell [Tue, 2 Apr 2019 15:13:59 +0000 (16:13 +0100)]
Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2019-04-02' into staging

Miscellaneous patches for 2019-04-02

# gpg: Signature made Tue 02 Apr 2019 12:54:27 BST
# gpg:                using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-misc-2019-04-02:
  accel: Unbreak accelerator fallback
  vl: Document dependencies hiding in global and compat props
  migration: Support adding migration blockers earlier
  Revert "migration: move only_migratable to MigrationState"
  Revert "vl: Fix to create migration object before block backends again"
  qapi/migration.json: Rename COLOStatus last_mode to last-mode
  qapi/migration.json: Fix ColoStatus member last_mode's version
  vl: Fix error location of positional arguments

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/berrange/tags/filemon-next-pull-request' into...
Peter Maydell [Tue, 2 Apr 2019 13:52:17 +0000 (14:52 +0100)]
Merge remote-tracking branch 'remotes/berrange/tags/filemon-next-pull-request' into staging

filemon: various fixes / improvements to file monitor for USB MTP

Ensure watch IDs unique within a monitor and avoid integer wraparound
issues when many watches are set & unset over time.

# gpg: Signature made Tue 02 Apr 2019 13:53:40 BST
# gpg:                using RSA key BE86EBB415104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" [full]
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>" [full]
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF

* remotes/berrange/tags/filemon-next-pull-request:
  filemon: fix watch IDs to avoid potential wraparound issues
  filemon: ensure watch IDs are unique to QFileMonitor scope
  tests: refactor file monitor test to make it more understandable

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Tue, 2 Apr 2019 13:03:11 +0000 (14:03 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches:

- file-posix: Ignore unlock failure instead of crashing
- gluster: Limit the transfer size to 512 MiB
- stream: Fix backing chain freezing
- qemu-img: Enable BDRV_REQ_MAY_UNMAP for zero writes in convert
- iotests fixes

# gpg: Signature made Tue 02 Apr 2019 13:47:43 BST
# gpg:                using RSA key 7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream:
  tests/qemu-iotests/235: Allow fallback to tcg
  block: test block-stream with a base node that is used by block-commit
  block: freeze the backing chain earlier in stream_start()
  block: continue until base is found in bdrv_freeze_backing_chain() et al
  block/file-posix: do not fail on unlock bytes
  tests/qemu-iotests: Remove redundant COPYING file
  block/gluster: limit the transfer size to 512 MiB
  qemu-img: Enable BDRV_REQ_MAY_UNMAP in convert
  iotests: Fix test 200 on s390x without virtio-pci

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agofilemon: fix watch IDs to avoid potential wraparound issues
Daniel P. Berrangé [Tue, 19 Mar 2019 15:47:47 +0000 (15:47 +0000)]
filemon: fix watch IDs to avoid potential wraparound issues

Watch IDs are allocated from incrementing a int counter against
the QFileMonitor object. In very long life QEMU processes with
a huge amount of USB MTP activity creating & deleting directories
it is just about conceivable that the int counter can wrap
around. This would result in incorrect behaviour of the file
monitor watch APIs due to clashing watch IDs.

Instead of trying to detect this situation, this patch changes
the way watch IDs are allocated. It is turned into an int64_t
variable where the high 32 bits are set from the underlying
inotify "int" ID. This gives an ID that is guaranteed unique
for the directory as a whole, and we can rely on the kernel
to enforce this. QFileMonitor then sets the low 32 bits from
a per-directory counter.

The USB MTP device only sets watches on the directory as a
whole, not files within, so there is no risk of guest
triggered wrap around on the low 32 bits.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agofilemon: ensure watch IDs are unique to QFileMonitor scope
Daniel P. Berrangé [Wed, 13 Mar 2019 17:36:18 +0000 (17:36 +0000)]
filemon: ensure watch IDs are unique to QFileMonitor scope

The watch IDs are mistakenly only unique within the scope of the
directory being monitored. This is not useful for clients which are
monitoring multiple directories. They require watch IDs to be unique
globally within the QFileMonitor scope.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Tested-by: Bandan Das <bsd@redhat.com>
Reviewed-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotests: refactor file monitor test to make it more understandable
Daniel P. Berrangé [Thu, 14 Mar 2019 14:45:08 +0000 (14:45 +0000)]
tests: refactor file monitor test to make it more understandable

The current file monitor unit tests are too clever for their own good
making it hard to understand the desired output.

Instead of trying to infer the expected events, explicitly list the
events we expect in the operation sequence.

Instead of dynamically building a matrix of tests, just have one giant
operation sequence that validates all scenarios in a single test.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoaccel: Unbreak accelerator fallback
Markus Armbruster [Mon, 1 Apr 2019 09:08:27 +0000 (11:08 +0200)]
accel: Unbreak accelerator fallback

When the user specifies a list of accelerators, we pick the first one
that initializes successfully.  Recent commit 1a3ec8c1564 broke that.
Reproducer:

    $ qemu-system-x86_64 --machine accel=xen:tcg
    xencall: error: Could not obtain handle on privileged command interface: No such file or directory
    xen be core: xen be core: can't open xen interface
    can't open xen interface
    qemu-system-x86_64: failed to initialize Xen: Operation not permitted
    qemu-system-x86_64: /home/armbru/work/qemu/qom/object.c:436: object_set_accelerator_compat_props: Assertion `!object_compat_props[0]' failed.

Root cause: we register accelerator compat properties even when the
accelerator fails.  The failed assertion is
object_set_accelerator_compat_props() telling us off.  Fix by calling
it only for the accelerator that succeeded.

Fixes: 1a3ec8c1564f51628cce10d435a2e22559ea29fd
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20190401090827.20793-6-armbru@redhat.com>

5 years agovl: Document dependencies hiding in global and compat props
Markus Armbruster [Mon, 1 Apr 2019 09:08:26 +0000 (11:08 +0200)]
vl: Document dependencies hiding in global and compat props

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190401090827.20793-5-armbru@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5 years agomigration: Support adding migration blockers earlier
Markus Armbruster [Mon, 1 Apr 2019 09:08:25 +0000 (11:08 +0200)]
migration: Support adding migration blockers earlier

migrate_add_blocker() asserts we have a current_migration object, in
migrate_get_current().  We do only after migration_object_init().

This contributes to the following dependency cycle:

* configure_blockdev() must run before machine_set_property()
  so machine properties can refer to block backends

* machine_set_property() before configure_accelerator()
  so machine properties like kvm-irqchip get applied

* configure_accelerator() before migration_object_init()
  so that Xen's accelerator compat properties get applied.

* migration_object_init() before configure_blockdev()
  so configure_blockdev() can add migration blockers

The cycle was closed when recent commit cda4aa9a5a0 "Create block
backends before setting machine properties" added the first
dependency, and satisfied it by violating the last one.  Broke block
backends that add migration blockers, as demonstrated by qemu-iotests
055.

To fix it, break the last dependency: make migrate_add_blocker()
usable before migration_object_init().

The previous commit already removed the use of migrate_get_current()
from migrate_add_blocker() itself.  Didn't quite do the trick, as
there's another one hiding in migration_is_idle().

The use there isn't actually necessary: when no migration object has
been created yet, migration is surely idle.  Make migration_is_idle()
return true then.

Fixes: cda4aa9a5a08777cf13e164c0543bd4888b8adce
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190401090827.20793-4-armbru@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5 years agoRevert "migration: move only_migratable to MigrationState"
Markus Armbruster [Mon, 1 Apr 2019 09:08:24 +0000 (11:08 +0200)]
Revert "migration: move only_migratable to MigrationState"

This reverts commit 3df663e575f1876d7f3bc684f80e72fca0703d39.
This reverts commit b605c47b57b58e61a901a50a0762dccf43d94783.

Command line option --only-migratable is for disallowing any
configuration that can block migration.

Initially, --only-migratable set global variable @only_migratable.

Commit 3df663e575 "migration: move only_migratable to MigrationState"
replaced it by MigrationState member @only_migratable.  That was a
mistake.

First, it doesn't make sense on the design level.  MigrationState
captures the state of an individual migration, but --only-migratable
isn't a property of an individual migration, it's a restriction on
QEMU configuration.  With fault tolerance, we could have several
migrations at once.  --only-migratable would certainly protect all of
them.  Storing it in MigrationState feels inappropriate.

Second, it contributes to a dependency cycle that manifests itself as
a bug now.

Putting @only_migratable into MigrationState means its available only
after migration_object_init().

We can't set it before migration_object_init(), so we delay setting it
with a global property (this is fixup commit b605c47b57 "migration:
fix handling for --only-migratable").

We can't get it before migration_object_init(), so anything that uses
it can only run afterwards.

Since migrate_add_blocker() needs to obey --only-migratable, any code
adding migration blockers can run only afterwards.  This contributes
to the following dependency cycle:

* configure_blockdev() must run before machine_set_property()
  so machine properties can refer to block backends

* machine_set_property() before configure_accelerator()
  so machine properties like kvm-irqchip get applied

* configure_accelerator() before migration_object_init()
  so that Xen's accelerator compat properties get applied.

* migration_object_init() before configure_blockdev()
  so configure_blockdev() can add migration blockers

The cycle was closed when recent commit cda4aa9a5a0 "Create block
backends before setting machine properties" added the first
dependency, and satisfied it by violating the last one.  Broke block
backends that add migration blockers.

Moving @only_migratable into MigrationState was a mistake.  Revert it.

This doesn't quite break the "migration_object_init() before
configure_blockdev() dependency, since migrate_add_blocker() still has
another dependency on migration_object_init().  To be addressed the
next commit.

Note that the reverted commit made -only-migratable sugar for -global
migration.only-migratable=on below the hood.  Documentation has only
ever mentioned -only-migratable.  This commit removes the arcane &
undocumented alternative to -only-migratable again.  Nobody should be
using it.

Conflicts:
include/migration/misc.h
migration/migration.c
migration/migration.h
vl.c

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190401090827.20793-3-armbru@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5 years agoRevert "vl: Fix to create migration object before block backends again"
Markus Armbruster [Mon, 1 Apr 2019 09:08:23 +0000 (11:08 +0200)]
Revert "vl: Fix to create migration object before block backends again"

This reverts commit e60483f2f8498ae08ae79ca4c6fb03a3317f5e1e.

Recent commit cda4aa9a5a0 moved block backend creation before machine
property evaluation.  This broke block backends registering migration
blockers.  Commit e60483f2f84 fixed it by moving migration object
creation before block backend creation.  This broke migration with
Xen.  Turns out we need to configure the accelerator before we create
the migration object so that Xen's accelerator compat properties get
applied.  Revert the flawed commit.  This fixes the Xen regression,
but brings back the block backend regression.  The next commits will
fix it again.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190401090827.20793-2-armbru@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5 years agoqapi/migration.json: Rename COLOStatus last_mode to last-mode
Zhang Chen [Tue, 2 Apr 2019 08:55:21 +0000 (16:55 +0800)]
qapi/migration.json: Rename COLOStatus last_mode to last-mode

Signed-off-by: Zhang Chen <chen.zhang@intel.com>
Message-Id: <20190402085521.17973-1-chen.zhang@intel.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Commit message rephrased]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agoqapi/migration.json: Fix ColoStatus member last_mode's version
Zhang Chen [Tue, 26 Mar 2019 17:45:10 +0000 (01:45 +0800)]
qapi/migration.json: Fix ColoStatus member last_mode's version

Signed-off-by: Zhang Chen <chen.zhang@intel.com>
Message-Id: <20190326174510.13303-1-chen.zhang@intel.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[Commit message tweaked as per Eric's review]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agovl: Fix error location of positional arguments
Markus Armbruster [Mon, 18 Mar 2019 18:33:12 +0000 (19:33 +0100)]
vl: Fix error location of positional arguments

We blame badness in positional arguments on the last option argument:

    $ qemu-system-x86_64 -vnc :1 bad.img
    qemu-system-x86_64: -vnc :1: Could not open 'foo': No such file or directory

I believe we've done this ever since we reported locations.  Fix it to

    qemu-system-x86_64: bad.img: Could not open 'bad.img': No such file or directory

Reported-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190318183312.4684-1-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
5 years agotests/qemu-iotests/235: Allow fallback to tcg
Thomas Huth [Wed, 27 Mar 2019 09:23:42 +0000 (10:23 +0100)]
tests/qemu-iotests/235: Allow fallback to tcg

iotest 235 currently only works with KVM - this is bad for systems where
it is not available, e.g. CI pipelines. The test also works when using
"tcg" as accelerator, so we can simply add that to the list of accelerators,
too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: test block-stream with a base node that is used by block-commit
Alberto Garcia [Thu, 28 Mar 2019 16:25:11 +0000 (18:25 +0200)]
block: test block-stream with a base node that is used by block-commit

The base node of a block-stream operation indicates the first image
from the backing chain starting from which no data is copied to the
top node.

The block-stream job allows others to use that base image, so a second
block-stream job could be writing to it at the same time. An important
restriction is that the base image must not disappear while the stream
job is ongoing. stream_start() freezes the backing chain from top to
base with that purpose but it does it too late in the code so there is
a race condition there.

This bug was fixed in the previous commit, and this patch contains an
iotest for this scenario.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: freeze the backing chain earlier in stream_start()
Alberto Garcia [Thu, 28 Mar 2019 16:25:10 +0000 (18:25 +0200)]
block: freeze the backing chain earlier in stream_start()

Commit 6585493369819a48d34a86d57ec6b97cb5cd9bc0 added code to freeze
the backing chain from 'top' to 'base' for the duration of the
block-stream job.

The problem is that the freezing happens too late in stream_start():
during the bdrv_reopen_set_read_only() call earlier in that function
another job can jump in and remove the base image. If that happens we
have an invalid chain and QEMU crashes.

This patch puts the bdrv_freeze_backing_chain() call at the beginning
of the function.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: continue until base is found in bdrv_freeze_backing_chain() et al
Alberto Garcia [Thu, 28 Mar 2019 16:25:09 +0000 (18:25 +0200)]
block: continue until base is found in bdrv_freeze_backing_chain() et al

All three functions that handle the BdrvChild.frozen attribute walk
the backing chain from 'bs' to 'base' and stop either when 'base' is
found or at the end of the chain if 'base' is NULL.

However if 'base' is not found then the functions return without
errors as if it was NULL.

This is wrong: if the caller passed an incorrect parameter that means
that there is a bug in the code.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock/file-posix: do not fail on unlock bytes
Vladimir Sementsov-Ogievskiy [Fri, 29 Mar 2019 11:04:54 +0000 (14:04 +0300)]
block/file-posix: do not fail on unlock bytes

bdrv_replace_child() calls bdrv_check_perm() with error_abort on
loosening permissions. However file-locking operations may fail even
in this case, for example on NFS. And this leads to Qemu crash.

Let's avoid such errors. Note, that we ignore such things anyway on
permission update commit and abort.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agotests/qemu-iotests: Remove redundant COPYING file
Thomas Huth [Tue, 5 Feb 2019 14:49:45 +0000 (15:49 +0100)]
tests/qemu-iotests: Remove redundant COPYING file

The file tests/qemu-iotests/COPYING is the same text as in the
COPYING file in the main directory. So as far as I can see, we don't
need the duplicate here.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock/gluster: limit the transfer size to 512 MiB
Stefano Garzarella [Thu, 28 Mar 2019 10:52:27 +0000 (11:52 +0100)]
block/gluster: limit the transfer size to 512 MiB

Several versions of GlusterFS (3.12? -> 6.0.1) fail when the
transfer size is greater or equal to 1024 MiB, so we are
limiting the transfer size to 512 MiB to avoid this rare issue.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1691320
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqemu-img: Enable BDRV_REQ_MAY_UNMAP in convert
Nir Soffer [Sun, 24 Mar 2019 00:20:12 +0000 (02:20 +0200)]
qemu-img: Enable BDRV_REQ_MAY_UNMAP in convert

With Kevin's "block: Fix slow pre-zeroing in qemu-img convert"[1]
(commit c9fdcf202f, 'qemu-img: Use BDRV_REQ_NO_FALLBACK for
pre-zeroing') we skip the pre zero step called like this:

    blk_make_zero(s->target, BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK)

And we write zeroes later using:

    blk_co_pwrite_zeroes(s->target,
                         sector_num << BDRV_SECTOR_BITS,
                         n << BDRV_SECTOR_BITS, 0);

Since we use flags=0, this is translated to NBD_CMD_WRITE_ZEROES with
NBD_CMD_FLAG_NO_HOLE flag, which cause the NBD server to allocated space
instead of punching a hole.

Here is an example failure:

$ dd if=/dev/urandom of=src.img bs=1M count=5
$ truncate -s 50m src.img
$ truncate -s 50m dst.img
$ nbdkit -f -v -e '' -U nbd.sock file file=dst.img

$ ./qemu-img convert -n src.img nbd:unix:nbd.sock

We can see in nbdkit log that it received the NBD_CMD_FLAG_NO_HOLE
(may_trim=0):

nbdkit: file[1]: debug: newstyle negotiation: flags: export 0x4d
nbdkit: file[1]: debug: pwrite count=2097152 offset=0
nbdkit: file[1]: debug: pwrite count=2097152 offset=2097152
nbdkit: file[1]: debug: pwrite count=1048576 offset=4194304
nbdkit: file[1]: debug: zero count=33554432 offset=5242880 may_trim=0
nbdkit: file[1]: debug: zero count=13631488 offset=38797312 may_trim=0
nbdkit: file[1]: debug: flush

And the image became fully allocated:

$ qemu-img info dst.img
virtual size: 50M (52428800 bytes)
disk size: 50M

With this change we see that nbdkit did not receive the
NBD_CMD_FLAG_NO_HOLE (may_trim=1):

nbdkit: file[1]: debug: newstyle negotiation: flags: export 0x4d
nbdkit: file[1]: debug: pwrite count=2097152 offset=0
nbdkit: file[1]: debug: pwrite count=2097152 offset=2097152
nbdkit: file[1]: debug: pwrite count=1048576 offset=4194304
nbdkit: file[1]: debug: zero count=33554432 offset=5242880 may_trim=1
nbdkit: file[1]: debug: zero count=13631488 offset=38797312 may_trim=1
nbdkit: file[1]: debug: flush

And the file is sparse as expected:

$ qemu-img info dst.img
virtual size: 50M (52428800 bytes)
disk size: 5.0M

[1] http://lists.nongnu.org/archive/html/qemu-block/2019-03/msg00761.html

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoiotests: Fix test 200 on s390x without virtio-pci
Thomas Huth [Wed, 27 Mar 2019 06:43:49 +0000 (07:43 +0100)]
iotests: Fix test 200 on s390x without virtio-pci

virtio-pci is optional on s390x, e.g. in downstream RHEL builds, it
is disabled. On s390x, virtio-ccw should be used instead. Other tests
like 051 or 240 already use virtio-scsi-ccw instead of virtio-scsi-pci
on s390x, so let's do the same here and always use virtio-scsi-ccw on
s390x.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/kraxel/tags/fixes-20190402-pull-request' into...
Peter Maydell [Tue, 2 Apr 2019 07:18:24 +0000 (08:18 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/fixes-20190402-pull-request' into staging

fixes for 4.0 (audio, usb),

# gpg: Signature made Tue 02 Apr 2019 07:46:22 BST
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/fixes-20190402-pull-request:
  audio: fix audio timer rate conversion bug
  usb-mtp: remove usb_mtp_object_free_one
  usb-mtp: fix return status of delete
  hw/usb/bus.c: Handle "no speed matched" case in usb_mask_to_str()
  Revert "audio: fix pc speaker init"

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoaudio: fix audio timer rate conversion bug
Volker Rümelin [Mon, 1 Apr 2019 18:59:20 +0000 (20:59 +0200)]
audio: fix audio timer rate conversion bug

Currently the default audio timer frequency is 10000Hz instead of
a period of 10000us. Also the audiodev timer-period property gets
converted like a frequency. Only handling of the legacy
QEMU_AUDIO_TIMER_PERIOD environment variable is correct because
it's actually a frequency.

With this patch the property timer-period is really a timer period
and QEMU_AUDIO_TIMER_PERIOD remains a frequency.

Fixes: 71830221fb "-audiodev command line option basic implementation."
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Reviewed-by: Zoltán Kővágó <DirtY.iCE.hu@gmail.com>
Message-id: 90b95e4f-39ef-2b01-da6a-857ebaee1ec5@t-online.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agousb-mtp: remove usb_mtp_object_free_one
Bandan Das [Mon, 1 Apr 2019 21:17:11 +0000 (17:17 -0400)]
usb-mtp: remove usb_mtp_object_free_one

This function is used in the delete path only and can
be replaced by a call to usb_mtp_object_free.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Bandan Das <bsd@redhat.com>
Message-Id: <20190401211712.19012-3-bsd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agousb-mtp: fix return status of delete
Bandan Das [Mon, 1 Apr 2019 21:17:10 +0000 (17:17 -0400)]
usb-mtp: fix return status of delete

Spotted by Coverity: CID 1399414

mtp delete allows the return status of delete succeeded,
partial_delete or readonly - when none of the objects could be
deleted. Give more meaningful names to return values of the
delete function.

Some initiators recurse over the objects themselves. In that case,
only READ_ONLY can be returned.

Signed-off-by: Bandan Das <bsd@redhat.com>
Message-Id: <20190401211712.19012-2-bsd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-04-01' into staging
Peter Maydell [Tue, 2 Apr 2019 02:46:30 +0000 (03:46 +0100)]
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-04-01' into staging

nbd patches for 2019-04-01

- Better behavior of qemu-img map on NBD images
- Fixes for NBD protocol alignment corner cases:
 - the server has fewer places where it sends reads or block status
   not aligned to its advertised block size
 - the client has more cases where it can work around server
   non-compliance present in qemu 3.1
 - the client now avoids non-compliant requests when interoperating
   with nbdkit or other servers not advertising block size

# gpg: Signature made Mon 01 Apr 2019 15:06:54 BST
# gpg:                using RSA key A7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full]
# gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full]
# gpg:                 aka "[jpeg image of size 6874]" [full]
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-nbd-2019-04-01:
  nbd/client: Trace server noncompliance on structured reads
  nbd/server: Advertise actual minimum block size
  block: Add bdrv_get_request_alignment()
  nbd/client: Support qemu-img convert from unaligned size
  nbd/client: Reject inaccessible tail of inconsistent server
  nbd/client: Report offsets in bdrv_block_status
  nbd/client: Lower min_block for block-status, unaligned size
  iotests: Add 241 to test NBD on unaligned images
  nbd-client: Work around server BLOCK_STATUS misalignment at EOF
  qemu-img: Gracefully shutdown when map can't finish
  nbd: Permit simple error to NBD_CMD_BLOCK_STATUS
  nbd: Don't lose server's error to NBD_CMD_BLOCK_STATUS
  nbd: Tolerate some server non-compliance in NBD_CMD_BLOCK_STATUS
  qemu-img: Report bdrv_block_status failures

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agonbd/client: Trace server noncompliance on structured reads
Eric Blake [Sat, 30 Mar 2019 16:53:49 +0000 (11:53 -0500)]
nbd/client: Trace server noncompliance on structured reads

Just as we recently added a trace for a server sending block status
that doesn't match the server's advertised minimum block alignment,
let's do the same for read chunks.  But since qemu 3.1 is such a
server (because it advertised 512-byte alignment, but when serving a
file that ends in data but is not sector-aligned, NBD_CMD_READ would
detect a mid-sector change between data and hole at EOF and the
resulting read chunks are unaligned), we don't want to change our
behavior of otherwise tolerating unaligned reads.

Note that even though we fixed the server for 4.0 to advertise an
actual block alignment (which gets rid of the unaligned reads at EOF
for posix files), we can still trigger it via other means:

$ qemu-nbd --image-opts driver=blkdebug,align=512,image.driver=file,image.filename=/path/to/non-aligned-file

Arguably, that is a bug in the blkdebug block status function, for
leaking a block status that is not aligned. It may also be possible to
observe issues with a backing layer with smaller alignment than the
active layer, although so far I have been unable to write a reliable
iotest for that scenario.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190330165349.32256-1-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>