58 lines
2.2 KiB
Diff
58 lines
2.2 KiB
Diff
|
|
From ea8049e63b663cab607d1f900ce593547485b33b Mon Sep 17 00:00:00 2001
|
||
|
|
From: zhujun2 <zhujun2_yewu@cmss.chinamobile.com>
|
||
|
|
Date: Wed, 10 Apr 2024 20:02:38 -0700
|
||
|
|
Subject: [PATCH] amd_iommu: Fix APIC address check
|
||
|
|
|
||
|
|
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: zhujun2 <zhujun2_yewu@cmss.chinamobile.com>
|
||
|
|
---
|
||
|
|
hw/i386/amd_iommu.c | 9 ++-------
|
||
|
|
hw/i386/amd_iommu.h | 2 --
|
||
|
|
2 files changed, 2 insertions(+), 9 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
|
||
|
|
index 4d13d8e697..dfb9a2d8e6 100644
|
||
|
|
--- a/hw/i386/amd_iommu.c
|
||
|
|
+++ b/hw/i386/amd_iommu.c
|
||
|
|
@@ -1245,13 +1245,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 79d38a3e41..210a37dfb1 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.27.0
|
||
|
|
|