[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] xen/amd/iommu: record the IOMMU for alias DeviceIDs


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stefano Stabellini <stefano.stabellini@xxxxxxx>
  • Date: Mon, 26 Oct 2026 16:59:26 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TWgMMYm6qraa7yW0VlmJDne9MS3CBCB+gTW/oD8hbgw=; b=LASdTsR/ERZal9GOdhfObaYIl0la3PujmrDM5Szoi6Ksh5k7NA7OciRGjZqJ19/FivcqqirvkLdHlomKHrft+o4SQxYJgAFlWrziTOXGz5LKQ4GMBlqq/8jT4LovN7C6droc35TecseC02cxfxQ88VRan4HF3ZaVARCBgMShHr2HLPehtrNJVdf4dgWOBPsPv4SGS8pzVSJwC1JxvIQBmIyHwh9o4W+nQRhJsQ4vj/GUQMwmzRSXjsngU8B0aydZZt35hh3sgVmEbtcb9a81UUyIIY54U9emZi+IVYG/CHDc6QawbY3Z376jE8ISzOqjH+7Y+cd/6YEeqAHX9HoO6g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DPU7hfR9d0myahnPwxUYUCceN7j3pbzBi+Q/JI4G8h8Y9sOAEhgHz5peGKPm1deH8nBpKONZbwwwpo/6gC2o2MFUpQTDWgIRPvqNxgHd9n313L2if3etVjXdYk7DLkMwhkzzICtY4pey0ZKF4AB/Ez+NHe0dEfHFkQQTViagryPKQjnJIpHKIZPybadf6bUe4Cg9SfRRdLVDXEnOVCYVuqsluXbSmFfd3Fw3hXqNid+9uQH6KhjZpbQmASsL+q+kMeXNyzZsXhjyiQtmInT5GaC9XW1RPV4gGTfzqHFrf1TrRVMspl3g2bi+yta15Ha0X2/kIr1A4GVbJCMM8mCJ1Q==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Stefano Stabellini <stefano.stabellini@xxxxxxx>, <jbeulich@xxxxxxxx>, <andrew.cooper3@xxxxxxxxxx>, <roger@xxxxxxxxxxxxxx>, <jason.andryuk@xxxxxxx>, <teddy.astie@xxxxxxxxxx>
  • Delivery-date: Mon, 26 Oct 2026 23:59:44 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

add_ivrs_mapping_entry() marks an alias DeviceID valid and may give it
an interrupt remapping table, but records the IOMMU only for the device
using the alias.  If no IVHD entry names the alias DeviceID itself,
amd_iommu_setup_device_table() passes a NULL IOMMU to
amd_iommu_set_intremap_table(), which dereferences it at boot.

Record the IOMMU for the alias too, as was done before the interrupt
remapping rework.  Nothing relies on it being NULL: the alias is then
handled like any other DeviceID.  Its remapping table is freed on
cleanup and dumped by the 'V' key, a device at the alias DeviceID can
be added instead of failing with -ENODEV, and reserved ranges, already
recorded for the alias as well, are reported once under it.  A NULL
check at the crash site instead would leave the alias device table
entry without interrupt remapping.

Fixes: a3713b97e8e1 ("AMD IOMMU: Rework of interrupt remapping")
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
---
Changes in v2:
- describe the crash precisely, and why nothing relies on the alias
  entry's IOMMU being NULL
- add a Fixes tag

 xen/drivers/passthrough/amd/iommu_acpi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c 
b/xen/drivers/passthrough/amd/iommu_acpi.c
index d118b36d80..d8ff4d24da 100644
--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -104,6 +104,10 @@ static void __init add_ivrs_mapping_entry(
 
     /* Assign IOMMU hardware. */
     ivrs_mappings[bdf].iommu = iommu;
+
+    /* Requests using the alias go through the same IOMMU. */
+    if ( !ivrs_mappings[alias_id].iommu )
+        ivrs_mappings[alias_id].iommu = iommu;
 }
 
 static struct amd_iommu * __init find_iommu_from_bdf_cap(
-- 
2.47.3




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.