1. 06 11月, 2018 26 次提交
    • P
      hw/pci-bridge/xio3130: Remove unused functions · c6329a2d
      Philippe Mathieu-Daudé 提交于
      Introduced in 48ebf2f9 and faf1e708, these functions
      were never used. Remove them.
      Signed-off-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      c6329a2d
    • L
      tests/bios-tables-test: add 64-bit PCI MMIO aperture round-up test on Q35 · 0259e966
      Laszlo Ersek 提交于
      In commit 9fa99d25 ("hw/pci-host: Fix x86 Host Bridges 64bit PCI
      hole", 2017-11-16), we meant to expose such a 64-bit PCI MMIO aperture in
      the ACPI DSDT that would be at least as large as the new "pci-hole64-size"
      property (2GB on i440fx, 32GB on q35). The goal was to offer "enough"
      64-bit MMIO aperture to the guest OS for hotplug purposes.
      
      Previous patch fixed the issue that the aperture is extended relative to
      a possibly incorrect base.  This may result in an aperture size that is
      smaller than the intent of commit 9fa99d25.
      
      This patch adds a test to make sure it won't happen again.
      
      In the test case being added:
      - use 128 MB initial RAM size,
      - ask for one DIMM hotplug slot,
      - ask for 2 GB maximum RAM size,
      - use a pci-testdev with a 64-bit BAR of 2 GB size.
      
      Consequences:
      
      (1) In pc_memory_init() [hw/i386/pc.c], the DIMM hotplug area size is
          initially set to 2048-128 = 1920 MB. (Maximum RAM size minus initial
          RAM size.)
      
      (2) The DIMM area base is set to 4096 MB (because the initial RAM is only
          128 MB -- there is no initial "high RAM").
      
      (3) Due to commit 085f8e88 ("pc: count in 1Gb hugepage alignment when
          sizing hotplug-memory container", 2014-11-24), we add 1 GB for the one
          DIMM hotplug slot that was specified. This sets the DIMM area size to
          1920+1024 = 2944 MB.
      
      (4) The reserved-memory-end address (exclusive) is set to 4096 + 2944 =
          7040 MB (DIMM area base plus DIMM area size).
      
      (5) The reserved-memory-end address is rounded up to GB alignment,
          yielding 7 GB (7168 MB).
      
      (6) Given the 2 GB BAR size of pci-testdev, SeaBIOS allocates said 64-bit
          BAR in 64-bit address space.
      
      (7) Because reserved-memory-end is at 7 GB, it is unaligned for the 2 GB
          BAR. Therefore SeaBIOS allocates the BAR at 8 GB. QEMU then
          (correctly) assigns the root bridge aperture base this BAR address, to
          be exposed in \_SB.PCI0._CRS.
      
      (8) The intent of commit 9fa99d25 dictates that QEMU extend the
          aperture size to 32 GB, implying a 40 GB end address. However, QEMU
          performs the extension relative to reserved-memory-end (7 GB), not
          relative to the bridge aperture base that was correctly deduced from
          SeaBIOS's BAR programming (8 GB). Therefore we see 39 GB as the
          aperture end address in \_SB.PCI0._CRS:
      
      > QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
      >     0x0000000000000000, // Granularity
      >     0x0000000200000000, // Range Minimum
      >     0x00000009BFFFFFFF, // Range Maximum
      >     0x0000000000000000, // Translation Offset
      >     0x00000007C0000000, // Length
      >     ,, , AddressRangeMemory, TypeStatic)
      
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NMarcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      0259e966
    • M
      bios-tables-test: prepare expected files for mmio64 · f5f4002d
      Michael S. Tsirkin 提交于
      test will be added by follow-up patch.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      f5f4002d
    • L
      hw/pci-host/x86: extend the 64-bit PCI hole relative to the fw-assigned base · ed6bb4b5
      Laszlo Ersek 提交于
      In commit 9fa99d25 ("hw/pci-host: Fix x86 Host Bridges 64bit PCI
      hole", 2017-11-16), we meant to expose such a 64-bit PCI MMIO aperture in
      the ACPI DSDT that would be at least as large as the new "pci-hole64-size"
      property (2GB on i440fx, 32GB on q35). The goal was to offer "enough"
      64-bit MMIO aperture to the guest OS for hotplug purposes.
      
      In that commit, we added or modified five functions:
      
      - pc_pci_hole64_start(): shared between i440fx and q35. Provides a default
        64-bit base, which starts beyond the cold-plugged 64-bit RAM, and skips
        the DIMM hotplug area too (if any).
      
      - i440fx_pcihost_get_pci_hole64_start(), q35_host_get_pci_hole64_start():
        board-specific 64-bit base property getters called abstractly by the
        ACPI generator. Both of these fall back to pc_pci_hole64_start() if the
        firmware didn't program any 64-bit hole (i.e. if the firmware didn't
        assign a 64-bit GPA to any MMIO BAR on any device). Otherwise, they
        honor the firmware's BAR assignments (i.e., they treat the lowest 64-bit
        GPA programmed by the firmware as the base address for the aperture).
      
      - i440fx_pcihost_get_pci_hole64_end(), q35_host_get_pci_hole64_end():
        these intended to extend the aperture to our size recommendation,
        calculated relative to the base of the aperture.
      
      Despite the original intent, i440fx_pcihost_get_pci_hole64_end() and
      q35_host_get_pci_hole64_end() currently only extend the aperture relative
      to the default base (pc_pci_hole64_start()), ignoring any programming done
      by the firmware. This means that our size recommendation may not be met.
      Fix it by honoring the firmware's address assignments.
      
      The strange extension sizes were spotted by Alex, in the log of a guest
      kernel running on top of OVMF (which prefers to assign 64-bit GPAs to
      64-bit BARs).
      
      This change only affects DSDT generation, therefore no new compat property
      is being introduced.
      
      Using an i440fx OVMF guest with 5GB RAM, an example _CRS change is:
      
      > @@ -881,9 +881,9 @@
      >              QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
      >                  0x0000000000000000, // Granularity
      >                  0x0000000800000000, // Range Minimum
      > -                0x000000080001C0FF, // Range Maximum
      > +                0x000000087FFFFFFF, // Range Maximum
      >                  0x0000000000000000, // Translation Offset
      > -                0x000000000001C100, // Length
      > +                0x0000000080000000, // Length
      >                  ,, , AddressRangeMemory, TypeStatic)
      >          })
      >          Device (GPE0)
      
      (On i440fx, the low RAM split is at 3GB, in this case. Therefore, with 5GB
      guest RAM and no DIMM hotplug range, pc_pci_hole64_start() returns 4 +
      (5-3) = 6 GB. Adding the 2GB extension to that yields 8GB, which is below
      the firmware-programmed base of 32GB, before the patch. Therefore, before
      the patch, the extension is ineffective. After the patch, we add the 2GB
      extension to the firmware-programmed base, namely 32GB.)
      
      Using a q35 OVMF guest with 5GB RAM, an example _CRS change is:
      
      > @@ -3162,9 +3162,9 @@
      >              QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
      >                  0x0000000000000000, // Granularity
      >                  0x0000000800000000, // Range Minimum
      > -                0x00000009BFFFFFFF, // Range Maximum
      > +                0x0000000FFFFFFFFF, // Range Maximum
      >                  0x0000000000000000, // Translation Offset
      > -                0x00000001C0000000, // Length
      > +                0x0000000800000000, // Length
      >                  ,, , AddressRangeMemory, TypeStatic)
      >          })
      >          Device (GPE0)
      
      (On Q35, the low RAM split is at 2GB. Therefore, with 5GB guest RAM and no
      DIMM hotplug range, pc_pci_hole64_start() returns 4 + (5-2) = 7 GB. Adding
      the 32GB extension to that yields 39GB (0x0000_0009_BFFF_FFFF + 1), before
      the patch. After the patch, we add the 32GB extension to the
      firmware-programmed base, namely 32GB.)
      
      The ACPI test data for the bios-tables-test case that we added earlier in
      this series are corrected too, as follows:
      
      > @@ -3339,9 +3339,9 @@
      >              QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
      >                  0x0000000000000000, // Granularity
      >                  0x0000000200000000, // Range Minimum
      > -                0x00000009BFFFFFFF, // Range Maximum
      > +                0x00000009FFFFFFFF, // Range Maximum
      >                  0x0000000000000000, // Translation Offset
      > -                0x00000007C0000000, // Length
      > +                0x0000000800000000, // Length
      >                  ,, , AddressRangeMemory, TypeStatic)
      >          })
      >          Device (GPE0)
      
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Fixes: 9fa99d25Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NMarcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      ed6bb4b5
    • L
      hw/pci-host/x86: extract get_pci_hole64_start_value() helpers · ccef5b1f
      Laszlo Ersek 提交于
      Expose the calculated "hole64 start" GPAs as plain uint64_t values,
      extracting the internals of the current property getters.
      
      This patch doesn't change behavior.
      
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NMarcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      ccef5b1f
    • G
      pci-testdev: add optional memory bar · 41746334
      Gerd Hoffmann 提交于
      Add memory bar to pci-testdev.  Size is configurable using the membar
      property.  Setting the size to zero (default) turns it off.  Can be used
      to check whether guests handle large pci bars correctly.
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
      Tested-by: NLaszlo Ersek <lersek@redhat.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      41746334
    • L
      MAINTAINERS: list "tests/acpi-test-data" files in ACPI/SMBIOS section · 7115dcf4
      Laszlo Ersek 提交于
      The "tests/acpi-test-data" files are currently not covered by any section
      in MAINTAINERS, and "scripts/checkpatch.pl" complains when new data files
      are added.
      
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NMarcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      7115dcf4
    • S
      x86_iommu/amd: Enable Guest virtual APIC support · 12499b23
      Singh, Brijesh 提交于
      Now that amd-iommu support interrupt remapping, enable the GASup in IVRS
      table and GASup in extended feature register to indicate that IOMMU
      support guest virtual APIC mode. GASup provides option to guest OS to
      make use of 128-bit IRTE.
      
      Note that the GAMSup is set to zero to indicate that amd-iommu does not
      support guest virtual APIC mode (aka AVIC) which would be used for the
      nested VMs.
      
      See Table 21 from IOMMU spec for interrupt virtualization controls
      Signed-off-by: NBrijesh Singh <brijesh.singh@amd.com>
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      Cc: Peter Xu <peterx@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
      Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      12499b23
    • S
      x86_iommu/amd: Add interrupt remap support when VAPIC is enabled · 135f866e
      Singh, Brijesh 提交于
      Emulate the interrupt remapping support when guest virtual APIC is
      enabled.
      
      For more information refer: IOMMU spec rev 3.0 (section 2.2.5.2)
      
      When VAPIC is enabled, it uses interrupt remapping as defined in
      Table 22 and Figure 17 from IOMMU spec.
      Signed-off-by: NBrijesh Singh <brijesh.singh@amd.com>
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      Cc: Peter Xu <peterx@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
      Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      135f866e
    • S
      i386: acpi: add IVHD device entry for IOAPIC · c028818d
      Singh, Brijesh 提交于
      When interrupt remapping is enabled, add a special IVHD device
      (type IOAPIC).
      Signed-off-by: NBrijesh Singh <brijesh.singh@amd.com>
      Acked-by: NPeter Xu <peterx@redhat.com>
      Cc: Peter Xu <peterx@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
      Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      c028818d
    • S
      x86_iommu/amd: Add interrupt remap support when VAPIC is not enabled · b44159fe
      Singh, Brijesh 提交于
      Emulate the interrupt remapping support when guest virtual APIC is
      not enabled.
      
      For more info Refer: AMD IOMMU spec Rev 3.0 - section 2.2.5.1
      
      When VAPIC is not enabled, it uses interrupt remapping as defined in
      Table 20 and Figure 15 from IOMMU spec.
      Signed-off-by: NBrijesh Singh <brijesh.singh@amd.com>
      Cc: Peter Xu <peterx@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
      Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      b44159fe
    • S
      x86_iommu/amd: Prepare for interrupt remap support · 577c470f
      Singh, Brijesh 提交于
      Register the interrupt remapping callback and read/write ops for the
      amd-iommu-ir memory region.
      
      amd-iommu-ir is set to higher priority to ensure that this region won't
      be masked out by other memory regions.
      Signed-off-by: NBrijesh Singh <brijesh.singh@amd.com>
      Cc: Peter Xu <peterx@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
      Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      577c470f
    • S
      x86_iommu/amd: make the address space naming consistent with intel-iommu · 53244386
      Singh, Brijesh 提交于
      To be consistent with intel-iommu:
      
      - rename the address space to use '_' instead of '-'
      - update the memory region relationships
      Signed-off-by: NBrijesh Singh <brijesh.singh@amd.com>
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      Cc: Peter Xu <peterx@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
      Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      53244386
    • S
      x86_iommu/amd: remove V=1 check from amdvi_validate_dte() · 470506b5
      Singh, Brijesh 提交于
      Currently, the amdvi_validate_dte() assumes that a valid DTE will
      always have V=1. This is not true. The V=1 means that bit[127:1] are
      valid. A valid DTE can have IV=1 and V=0 (i.e address translation
      disabled and interrupt remapping enabled)
      
      Remove the V=1 check from amdvi_validate_dte(), make the caller
      responsible to check for V or IV bits.
      
      This also fixes a bug in existing code that when error is
      detected during the translation we'll fail the translation
      instead of assuming a passthrough mode.
      Signed-off-by: NBrijesh Singh <brijesh.singh@amd.com>
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      Cc: Peter Xu <peterx@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
      Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      470506b5
    • S
      x86_iommu: move vtd_generate_msi_message in common file · 35c24501
      Singh, Brijesh 提交于
      The vtd_generate_msi_message() in intel-iommu is used to construct a MSI
      Message from IRQ. A similar function will be needed when we add interrupt
      remapping support in amd-iommu. Moving the function in common file to
      avoid the code duplication. Rename it to x86_iommu_irq_to_msi_message().
      There is no logic changes in the code flow.
      Signed-off-by: NBrijesh Singh <brijesh.singh@amd.com>
      Suggested-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      Cc: Peter Xu <peterx@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
      Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      35c24501
    • S
      x86_iommu: move the kernel-irqchip check in common code · 50662ce1
      Singh, Brijesh 提交于
      Interrupt remapping needs kernel-irqchip={off|split} on both Intel and AMD
      platforms. Move the check in common place.
      Signed-off-by: NBrijesh Singh <brijesh.singh@amd.com>
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      Cc: Peter Xu <peterx@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
      Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      50662ce1
    • Y
      vhost-user-blk: start vhost when guest kicks · 110b9463
      Yongji Xie 提交于
      Some old guests (before commit 7a11370e5: "virtio_blk: enable VQs early")
      kick virtqueue before setting VIRTIO_CONFIG_S_DRIVER_OK. This violates
      the virtio spec. But virtio 1.0 transitional devices support this behaviour.
      So we should start vhost when guest kicks in this case.
      Signed-off-by: NYongji Xie <xieyongji@baidu.com>
      Signed-off-by: NChai Wen <chaiwen@baidu.com>
      Signed-off-by: NNi Xun <nixun@baidu.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      110b9463
    • P
      intel_iommu: handle invalid ce for shadow sync · c28b535d
      Peter Xu 提交于
      We should handle VTD_FR_CONTEXT_ENTRY_P properly when synchronizing
      shadow page tables.  Having invalid context entry there is perfectly
      valid when we move a device out of an existing domain.  When that
      happens, instead of posting an error we invalidate the whole region.
      
      Without this patch, QEMU will crash if we do these steps:
      
      (1) start QEMU with VT-d IOMMU and two 10G NICs (ixgbe)
      (2) bind the NICs with vfio-pci in the guest
      (3) start testpmd with the NICs applied
      (4) stop testpmd
      (5) rebind the NIC back to ixgbe kernel driver
      
      The patch should fix it.
      Reported-by: NPei Zhang <pezhang@redhat.com>
      Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1627272Signed-off-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NEric Auger <eric.auger@redhat.com>
      Reviewed-by: NMaxime Coquelin <maxime.coquelin@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      c28b535d
    • P
      intel_iommu: move ce fetching out when sync shadow · 95ecd3df
      Peter Xu 提交于
      There are two callers for vtd_sync_shadow_page_table_range(): one
      provided a valid context entry and one not.  Move that fetching
      operation into the caller vtd_sync_shadow_page_table() where we need to
      fetch the context entry.
      
      Meanwhile, remove the error_report_once() directly since we're already
      tracing all the error cases in the previous call.  Instead, return error
      number back to caller.  This will not change anything functional since
      callers are dropping it after all.
      
      We do this move majorly because we want to do something more later in
      vtd_sync_shadow_page_table().
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NEric Auger <eric.auger@redhat.com>
      Reviewed-by: NMaxime Coquelin <maxime.coquelin@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      95ecd3df
    • P
      intel_iommu: better handling of dmar state switch · 2cc9ddcc
      Peter Xu 提交于
      QEMU is not handling the global DMAR switch well, especially when from
      "on" to "off".
      
      Let's first take the example of system reset.
      
      Assuming that a guest has IOMMU enabled.  When it reboots, we will drop
      all the existing DMAR mappings to handle the system reset, however we'll
      still keep the existing memory layouts which has the IOMMU memory region
      enabled.  So after the reboot and before the kernel reloads again, there
      will be no mapping at all for the host device.  That's problematic since
      any software (for example, SeaBIOS) that runs earlier than the kernel
      after the reboot will assume the IOMMU is disabled, so any DMA from the
      software will fail.
      
      For example, a guest that boots on an assigned NVMe device might fail to
      find the boot device after a system reboot/reset and we'll be able to
      observe SeaBIOS errors if we capture the debugging log:
      
        WARNING - Timeout at nvme_wait:144!
      
      Meanwhile, we should see DMAR errors on the host of that NVMe device.
      It's the DMA fault that caused a NVMe driver timeout.
      
      The correct fix should be that we do proper switching of device DMA
      address spaces when system resets, which will setup correct memory
      regions and notify the backend of the devices.  This might not affect
      much on non-assigned devices since QEMU VT-d emulation will assume a
      default passthrough mapping if DMAR is not enabled in the GCMD
      register (please refer to vtd_iommu_translate).  However that's required
      for an assigned devices, since that'll rebuild the correct GPA to HPA
      mapping that is needed for any DMA operation during guest bootstrap.
      
      Besides the system reset, we have some other places that might change
      the global DMAR status and we'd better do the same thing there.  For
      example, when we change the state of GCMD register, or the DMAR root
      pointer.  Do the same refresh for all these places.  For these two
      places we'll also need to explicitly invalidate the context entry cache
      and iotlb cache.
      
      Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1625173
      CC: QEMU Stable <qemu-stable@nongnu.org>
      Reported-by: NCong Li <coli@redhat.com>
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      --
      v2:
      - do the same for GCMD write, or root pointer update [Alex]
      - test is carried out by me this time, by observing the
        vtd_switch_address_space tracepoint after system reboot
      v3:
      - rewrite commit message as suggested by Alex
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NEric Auger <eric.auger@redhat.com>
      Reviewed-by: NJason Wang <jasowang@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      2cc9ddcc
    • P
      intel_iommu: introduce vtd_reset_caches() · 06aba4ca
      Peter Xu 提交于
      Provide the function and use it in vtd_init().  Used to reset both
      context entry cache and iotlb cache for the whole IOMMU unit.
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NEric Auger <eric.auger@redhat.com>
      Reviewed-by: NJason Wang <jasowang@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      06aba4ca
    • Y
      virtio-blk: fix comment for virtio_blk_rw_complete · 9bb192a4
      Yaowei Bai 提交于
      Here should be submit_requests, there is no submit_merged_requests
      function.
      Signed-off-by: NYaowei Bai <baiyaowei@cmss.chinamobile.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      9bb192a4
    • P
      configure: Use LINKS loop for all build tree symlinks · 39950353
      Peter Maydell 提交于
      A few places in configure were doing ad-hoc calls to
      the symlink function to set up symlinks from the build tree
      back to the source tree. We have a loop that does this
      already for all files and directories listed in the LINKS
      environment variable; use that instead.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      39950353
    • P
      configure: Rename FILES variable to LINKS · e29e5c6e
      Peter Maydell 提交于
      The FILES variable is used to accumulate a list of things to symlink
      from the source tree into the build tree.  These don't have to be
      individual files; symlinking an entire directory of data files is
      also fine.  Rename it to something less confusing before we add a few
      directories to it.
      
      Improve the comment to clarify what DIRS and LINKS do and why
      it's not a good idea to add things to LINKS with wildcarding.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      e29e5c6e
    • P
      tests: Move tests/hex-loader-check-data/ to tests/data/hex-loader/ · 4b2ff65a
      Peter Maydell 提交于
      Currently tests/hex-loader-check-data contains data files used
      by the hexloader-test, and configure individually symlinks those
      data files into the build directory using a wildcard.
      
      Using a wildcard like this is a bad idea, because if a new
      data file is added, nothing causes configure to be rerun,
      and so no symlink is added for the new file. This can cause
      tests to spuriously fail when they can't find their data.
      Instead, it's better to symlink an entire directory of
      data files. We already have such a directory: tests/data.
      
      Move the data files from tests/hex-loader-check-data/ to
      tests/data/hex-loader/, and remove the unnecessary symlinking.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      4b2ff65a
    • P
      tests: Move tests/acpi-test-data/ to tests/data/acpi/ · 438c78da
      Peter Maydell 提交于
      Currently tests/acpi-test-data contains data files used by the
      bios-tables-test, and configure individually symlinks those
      data files into the build directory using a wildcard.
      
      Using a wildcard like this is a bad idea, because if a new
      data file is added, nothing causes configure to be rerun,
      and so no symlink is added for the new file. This can cause
      tests to spuriously fail when they can't find their data.
      Instead, it's better to symlink an entire directory of
      data files. We already have such a directory: tests/data.
      
      Move the data files from tests/acpi-test-data/ to
      tests/data/acpi/, and remove the unnecessary symlinking.
      
      We can remove entirely the note in rebuild-expected-aml.sh
      about copying any new data files, because now they will
      be in the source directory, not the build directory, and
      no copying is required.
      
      (We can't just change the existing tests/acpi-test-data/
      to being a symlinked directory, because if we did that and
      a developer switched git branches from one after that change
      to one before it then configure would end up trashing all
      the test files by making them symlinks to themselves.
      Changing their path avoids this annoyance.)
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      438c78da
  2. 05 11月, 2018 1 次提交
  3. 04 11月, 2018 1 次提交
  4. 03 11月, 2018 1 次提交
    • P
      Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20181102' into staging · 7d56239f
      Peter Maydell 提交于
      target-arm queue:
       * microbit: Add the UART to our nRF51 SoC model
       * Add a virtual Xilinx Versal board "xlnx-versal-virt"
       * hw/arm/virt: Set VIRT_COMPAT_3_0 compat
       * MAINTAINERS: Remove bouncing email in ARM ACPI
       * strongarm: mask off high[31:28] bits from dir and state registers
       * target/arm: Conditionalize some asserts on aarch32 support
       * hw/arm/xilinx_zynq: Use the ARRAY_SIZE macro
      
      # gpg: Signature made Fri 02 Nov 2018 17:14:43 GMT
      # gpg:                using RSA key 3C2525ED14360CDE
      # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
      # gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
      # gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"
      # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE
      
      * remotes/pmaydell/tags/pull-target-arm-20181102:
        hw/arm: versal: Add a virtual Xilinx Versal board
        hw/arm: versal: Add a model of Xilinx Versal SoC
        target/arm: Conditionalize some asserts on aarch32 support
        hw/arm/xilinx_zynq: Use the ARRAY_SIZE macro
        strongarm: mask off high[31:28] bits from dir and state registers
        MAINTAINERS: Remove bouncing email in ARM ACPI
        tests/boot-serial-test: Add microbit board testcase
        hw/arm/nrf51_soc: Connect UART to nRF51 SoC
        hw/char: Implement nRF51 SoC UART
        hw/arm/virt: Set VIRT_COMPAT_3_0 compat
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      7d56239f
  5. 02 11月, 2018 11 次提交