[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.1.2 57/57] amd_iommu: Fix APIC address check
From: |
Michael Tokarev |
Subject: |
[Stable-8.1.2 57/57] amd_iommu: Fix APIC address check |
Date: |
Fri, 6 Oct 2023 21:14:46 +0300 |
From: Akihiko Odaki <akihiko.odaki@daynix.com>
An MSI from I/O APIC may not exactly equal to APIC_DEFAULT_ADDRESS. In
fact, Windows 17763.3650 configures I/O APIC to set the dest_mode bit.
Cover the range assigned to APIC.
Fixes: 577c470f43 ("x86_iommu/amd: Prepare for interrupt remap support")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20230921114612.40671-1-akihiko.odaki@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 0114c4513095598cdf1cd8d7dacdfff757628121)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 9c77304438..9b7c6e2921 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -1246,13 +1246,8 @@ static int amdvi_int_remap_msi(AMDVIState *iommu,
return -AMDVI_IR_ERR;
}
- if (origin->address & AMDVI_MSI_ADDR_HI_MASK) {
- trace_amdvi_err("MSI address high 32 bits non-zero when "
- "Interrupt Remapping enabled.");
- return -AMDVI_IR_ERR;
- }
-
- if ((origin->address & AMDVI_MSI_ADDR_LO_MASK) != APIC_DEFAULT_ADDRESS) {
+ if (origin->address < AMDVI_INT_ADDR_FIRST ||
+ origin->address + sizeof(origin->data) > AMDVI_INT_ADDR_LAST + 1) {
trace_amdvi_err("MSI is not from IOAPIC.");
return -AMDVI_IR_ERR;
}
diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h
index 6da893ee57..c5065a3e27 100644
--- a/hw/i386/amd_iommu.h
+++ b/hw/i386/amd_iommu.h
@@ -210,8 +210,6 @@
#define AMDVI_INT_ADDR_FIRST 0xfee00000
#define AMDVI_INT_ADDR_LAST 0xfeefffff
#define AMDVI_INT_ADDR_SIZE (AMDVI_INT_ADDR_LAST - AMDVI_INT_ADDR_FIRST +
1)
-#define AMDVI_MSI_ADDR_HI_MASK (0xffffffff00000000ULL)
-#define AMDVI_MSI_ADDR_LO_MASK (0x00000000ffffffffULL)
/* SB IOAPIC is always on this device in AMD systems */
#define AMDVI_IOAPIC_SB_DEVID PCI_BUILD_BDF(0, PCI_DEVFN(0x14, 0))
--
2.39.2
- [Stable-8.1.2 47/57] target/i386: generalize operand size "ph" for use in CVTPS2PD, (continued)
- [Stable-8.1.2 47/57] target/i386: generalize operand size "ph" for use in CVTPS2PD, Michael Tokarev, 2023/10/06
- [Stable-8.1.2 48/57] target/i386: fix memory operand size for CVTPS2PD, Michael Tokarev, 2023/10/06
- [Stable-8.1.2 49/57] win32: avoid discarding the exception handler, Michael Tokarev, 2023/10/06
- [Stable-8.1.2 50/57] hw/display/ramfb: plug slight guest-triggerable leak on mode setting, Michael Tokarev, 2023/10/06
- [Stable-8.1.2 51/57] chardev/char-pty: Avoid losing bytes when the other side just (re-)connected, Michael Tokarev, 2023/10/06
- [Stable-8.1.2 52/57] linux-user/hppa: Fix struct target_sigcontext layout, Michael Tokarev, 2023/10/06
- [Stable-8.1.2 53/57] vdpa net: zero vhost_vdpa iova_tree pointer at cleanup, Michael Tokarev, 2023/10/06
- [Stable-8.1.2 54/57] vdpa net: fix error message setting virtio status, Michael Tokarev, 2023/10/06
- [Stable-8.1.2 55/57] vdpa net: stop probing if cannot set features, Michael Tokarev, 2023/10/06
- [Stable-8.1.2 56/57] vdpa net: follow VirtIO initialization properly at cvq isolation probing, Michael Tokarev, 2023/10/06
- [Stable-8.1.2 57/57] amd_iommu: Fix APIC address check,
Michael Tokarev <=