From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.193.45 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796033868; b=giTsMO3h0BS7DNLK9TvAMY5K1ygJi0ouHCG6LtHLnmj4N1Mdm4Ll7rUcF8eUDex+We0q 4/UmY0p3EON5AFQzzeMgzUtHtoT5lChEsicxobNAdPhelGXYcAjQvmo1OqwqF4wwjI1cl eGv9OnDfZeVXXrc+3HgvAVbNdRDO952ORwHDFerom4Xb7mNArrslDlFz3rzuq1Y8Ez3zT XOP5EAMmyK368Fw0KvF+uxWi8DPxkH9phydypUSkfzfT8PaV0H2x5hSL3Iggf45KBnjV/ 9IegdOCnCVwj9gMUb2D5zJeKyb0OUdu3ZfxhM7nizUlUNBtbiN3f9frzvuQC9yVyjtA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796033868; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=Ug8sI0pc8yjcfR8OfRadRqG/a/HW4V0vfuffMLCaOdg=; b=EBT+TgNA1VsL0Ce4HPARSj+yj85QU4lTuTkZOp4hDJuk9hMIqtWqCTgKUUWuopQ1MhEc bX642ST1gLEVNzf4Agmxs7gGeCsD93VG5IG9ftHNt68Z53utHIREffgwUswjdc2fl6QvO 2zuQZ/nsYVy/TOO2RyMjH3tSoMv/4KkwoH3rfUQ9Y6f52ORoYNl2H9U62b6W5p11fetVw 8SoyS6fdkZpTubzHx+4H22uWXCIAvOnY6iykWGhmJTauO2/p8eW63hWWKZS7ogrUOLzGX 1x3Nz8ytzZArwBMMBq0dLTY39r+OMueINvg9Psf8q7qrciABo351VUfeXcl+Rc71ofg== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=aTcNRVH2; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.193.45 Received: from CH1PR05CU001.outbound.protection.outlook.com (mail-northcentralusazon11010045.outbound.protection.outlook.com [52.101.193.45]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6AF0D606A31C for ; Mon, 30 Nov 2026 10:17:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6AF0D606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=aTcNRVH2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xkNEZG7avCkWAKN65r6Y+WORGZy+lG6fsYRFV8vfQon0DDqd05yk9jHu1DTosB0m5ez0bCNfrWf5YCNmxw2OCwtEC4esl7ZfzUXpGUgsNl0UCpHfeAwhjKdH1MHmoZmBhqvd34L+wAPMato4QtENL3A8r9Dd4n5pgnviA4enfp1+p7jZ+SZGN0HQTnjPbhH6+tpyCMfBk5Zvj0G30bXuzlfVTifRzKhHO3ePYhOlz9ODvz1T6VuEGdRj9G9BxNl0SWudWP6mqH7V9BYlROyoPEKR/+Q4op/kU/QzRtEsGapmeUwlk3dFstz7RHqa3avcZuJYMFeYZw/oSglSu2X/Cw== 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=Ug8sI0pc8yjcfR8OfRadRqG/a/HW4V0vfuffMLCaOdg=; b=YlXMkKf9aB/HonyJvG+i/h2afQ6nQ+FniA2QYIe0AxPvVpNgCrupI5j9uASPxqVWHZW6SHWI87ixczeCm0RYnEMAOExe7guRwK6HpisnjdBR4Ofyi4DnY07pV6gVtxBdkGxeC2NR6UgVtW5wT9V8dMq0p/jNZdSHTbetjhMPDsGslBOl2grBSjD4GyXQR0+8R7Sp6iP22LxjbE7vK+C4Oc3QECSBlZrjHX4F67LeaeLK30ul5lkvocWQ4NZxcN/gYAhKfGPYia+rV4/+3Zlv3wEgMvVf9lNH2pcxEVyB5brk+lboLvUZXltbL5STopcGOCLmbGVcZtS5qN4YfYQFag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=bull.com 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ug8sI0pc8yjcfR8OfRadRqG/a/HW4V0vfuffMLCaOdg=; b=aTcNRVH2zXK1iflLJ246BeBKwtk2gw3pE687ILzVeQi8Yur/bPtT4jDP9uFr+xrHZvPC6UTABA77gpUThz2wPgw4HJd6jd6fAgL/9PCo5OTq7oUtNIYVAl5/VPxznfuILW3NoyscKAty/a0fsh2ETTMh4cC3H2yt3R7VgqqY/nY= Received: from MW4PR02CA0017.namprd02.prod.outlook.com (2603:10b6:303:16d::24) by LY0PR12MB639115.namprd12.prod.outlook.com (2603:10b6:404:216::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.12; Mon, 30 Nov 2026 10:17:43 +0000 Received: from SJ1PEPF00002327.namprd03.prod.outlook.com (2603:10b6:303:16d:cafe::6d) by MW4PR02CA0017.outlook.office365.com (2603:10b6:303:16d::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.662.13 via Frontend Transport; Mon, 30 Nov 2026 10:17:42 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by SJ1PEPF00002327.mail.protection.outlook.com (10.167.242.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Mon, 30 Nov 2026 10:17:42 +0000 Received: from BLR-L1-SARUNKOD.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Mon, 30 Nov 2026 04:17:37 -0600 From: Sairaj Kodilkar To: =?UTF-8?q?Cl=C3=A9ment=20Mathieu--Drif?= , "Michael S. Tsirkin" , Alejandro Jimenez , Ani Sinha , "Igor Mammedov" , Jason Wang , "Marcelo Tosatti" , Paolo Bonzini , "Richard Henderson" , Sairaj Kodilkar , Yi Liu , , CC: , Subject: [PATCH 5/6] amd_iommu: Introduce AMDIVRSInfo for shared IVRS construction Date: Mon, 30 Nov 2026 15:42:36 +0530 Message-ID: <20261130101237.1416-6-sarunkod@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261130101237.1416-1-sarunkod@amd.com> References: <20261130101237.1416-1-sarunkod@amd.com> X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002327:EE_|LY0PR12MB639115:EE_ X-MS-Office365-Filtering-Correlation-Id: c4aa16af-f4ca-43a1-6a56-08df4ecb2b74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|23010399003|1800799024|82310400026|7416014|376014|921020|10067099003|56012099006|261028144727099003|261102130727099003|261102123227099003|261026121527099003|261026140227099003|261021123027099003|261021121427099003|261022105027099003|261022075727099003|261009223027099003|18002099003|22082099003|5023799004|11063799006|6133799003; X-Microsoft-Antispam-Message-Info: 9B6xWwoZ6/XxtjuitUdD7fj05f+fiklD3Xe6Rf7Ymnc0zHzhEwvlwi8HcmT2X3zgtzQCL5XEAh7FWQNBYCcWTVDpxHELcUbOhppAt/Ub6N7t+aeRsahYhZaZipQg9zURt3mCaGDA26xcg/x0cMRd+4a3wMWHbsqWsKpnzWDcWrqdyKxzy0mAXe88hq2ZpjFpZENGuz7HKNHK1OF+sBsITVU1velXwveML4n1Kh6axKe+lXlh/Jo+zQLIG1PvH1DZ6JAljN7Kg0hjBmMbSAiQmA5XBPoISrTx0DRXM8l8VitlKpn4b2S2+tg1YdNo3PHQ3j4IIZ98jxXRsrbHm3LdCD8dfMPn1PcxGKvI0MC0z+LZZ/cItRi47FHgXiQilpSjtJYT2ZYPKY7TwuGhrMGclNpp4C/dUiFwJACB5GUhbtz2FDdXtZm+5/c8hoVVeGZysaUrRHTSrfqaOJSe79e62cpYN8wOzQFJG7LvXESHAPUMkgGOvvKc4S+LVJ9Lpv8GVUPhteuIoJ3u2lyiPCBMYyBql/OGLmTy8pUCRzAnNuVvQkOrAB5vsKUNd1eqzC1SM86rKMJI9kjVomEFWnnb78He5Ga+db4U4Optg1chovwk2cSAYlMTzjbY9BBLh6M/MV/ie10OGTgTcMzKTOu0OHF3+YFaAZTZ3llYGfNdI1xmjmYdZ8iYwo3kb2YP5eBdLMGnk7aiZ8K7gpWQR2fWkb0e3W7jwpCJSu9QK8GsWzp0y7JmQcW/K5w/nZvAFIF1 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(23010399003)(1800799024)(82310400026)(7416014)(376014)(921020)(10067099003)(56012099006)(261028144727099003)(261102130727099003)(261102123227099003)(261026121527099003)(261026140227099003)(261021123027099003)(261021121427099003)(261022105027099003)(261022075727099003)(261009223027099003)(18002099003)(22082099003)(5023799004)(11063799006)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5ccI/0UzLZkklglOaWjxPaey6BY7LphNJZ3FYrHt0a2tv5iPfEdqmp3H5wH7/blI0GIe6JcQDHCj3GZiVphFDteZXXqPyq2/F1PSw865dyl3OOw3pOfMNb5JM+hjEUj2ok87Ju2MTaUShkDNauAulmNr2pnCaStcKwU3YPWK4ZBeVWHJtiB2reqB2hkhJv7zFNmWQc+bg418YRWOrsTlR9vp/qWPf2zBtDaQ6jlMeB3x4dRiVq1KuKwNucRHvMvoLOQiyLiynVnvefZF+KYEMJ4kx8WJWhk7eLziZCeru2nZv6kls52/YpTT/L4AXWQULrUXMFUtalITUwF73dKiK0bZ6jZMGVtnhYIuOc/FtxUQaTPSlGognUIX2VuYdNPnjJ/k5/bQI+2oASVTlT3rpi+EY9FTT4us3NKYPGISBHMrq1TuieR08KIfUrTkaZqN X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2026 10:17:42.3017 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c4aa16af-f4ca-43a1-6a56-08df4ecb2b74 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00002327.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LY0PR12MB639115 IVRS construction will be shared by the both emulated IOMMU and upcoming hardware vIOMMU. The hardware model does not use AMDVIState and will introduce new struct "AMDVIOMMUState", so there is need to have a common API which IVRS builder can use independently. Add AMDIVRSInfo for that. Each model supplies the IOMMU PCI device, the root bus, the MMIO base address, and a extended_feature. acpi-build reads those fields when it emits IVHD type 10h and 11h entries. The struct also includes dma_translation because upcoming AMD HW-VIOMMU model doesn't support V1 page tables, and must always set the HATDis=1 (dma_translation=0). The emulated model fills AMDIVRSInfo from AMDVIState. Drop the exported helper and amd_iommu-stub.c, which existed only to provide that helper when CONFIG_AMD_IOMMU is off. Signed-off-by: Sairaj Kodilkar --- hw/i386/acpi-build.c | 26 +++++++++++++++++--------- hw/i386/amd_iommu-stub.c | 26 -------------------------- hw/i386/amd_iommu.c | 16 +++++++++++++--- hw/i386/amd_iommu.h | 12 ++++++++++-- hw/i386/meson.build | 3 +-- 5 files changed, 41 insertions(+), 42 deletions(-) delete mode 100644 hw/i386/amd_iommu-stub.c diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 188c97f0e916..d4be50ade22f 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1918,11 +1918,19 @@ build_amd_iommu(GArray *table_data, BIOSLinker *linker, const char *oem_id, X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(entry->dev); AMDVIState *s = AMD_IOMMU_DEVICE(entry->dev); GArray *ivhd_blob = g_array_new(false, true, 1); - uint16_t iommu_devid = pci_get_bdf(&s->pci->dev); - uint64_t extended_feature = amdvi_extended_feature_register(s); + uint16_t iommu_devid; + uint64_t extended_feature; + AMDIVRSInfo ivrs_info; - assert(s->root_bus); - add_ivhd_entries_from_bus(s->root_bus, ivhd_blob); + s->get_ivrs_info(s, &ivrs_info); + + assert(ivrs_info.pci); + assert(ivrs_info.root_bus); + + add_ivhd_entries_from_bus(ivrs_info.root_bus, ivhd_blob); + + iommu_devid = pci_get_bdf(&ivrs_info.pci->dev); + extended_feature = ivrs_info.extended_feature; if (!ivhd_blob->len) { /* @@ -1964,9 +1972,9 @@ build_amd_iommu(GArray *table_data, BIOSLinker *linker, const char *oem_id, /* DeviceID */ build_append_int_noprefix(table_data, iommu_devid, 2); /* Capability offset */ - build_append_int_noprefix(table_data, s->pci->capab_offset, 2); + build_append_int_noprefix(table_data, ivrs_info.pci->capab_offset, 2); /* IOMMU base address */ - build_append_int_noprefix(table_data, s->mr_mmio.addr, 8); + build_append_int_noprefix(table_data, ivrs_info.base_addr, 8); /* PCI Segment Group */ build_append_int_noprefix(table_data, 0, 2); /* IOMMU info */ @@ -1993,15 +2001,15 @@ build_amd_iommu(GArray *table_data, BIOSLinker *linker, const char *oem_id, /* DeviceID */ build_append_int_noprefix(table_data, iommu_devid, 2); /* Capability offset */ - build_append_int_noprefix(table_data, s->pci->capab_offset, 2); + build_append_int_noprefix(table_data, ivrs_info.pci->capab_offset, 2); /* IOMMU base address */ - build_append_int_noprefix(table_data, s->mr_mmio.addr, 8); + build_append_int_noprefix(table_data, ivrs_info.base_addr, 8); /* PCI Segment Group */ build_append_int_noprefix(table_data, 0, 2); /* IOMMU info */ build_append_int_noprefix(table_data, 0, 2); /* IOMMU Attributes */ - if (!s->iommu.dma_translation) { + if (!ivrs_info.dma_translation) { build_append_int_noprefix(table_data, (1UL << 0) /* HATDis */, 4); } else { build_append_int_noprefix(table_data, 0, 4); diff --git a/hw/i386/amd_iommu-stub.c b/hw/i386/amd_iommu-stub.c deleted file mode 100644 index fb36dee903ee..000000000000 --- a/hw/i386/amd_iommu-stub.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Stubs for AMD IOMMU emulation - * - * Copyright (C) 2023 Bui Quang Minh - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License along - * with this program; if not, see . - */ - -#include "qemu/osdep.h" -#include "amd_iommu.h" - -uint64_t amdvi_extended_feature_register(AMDVIState *s) -{ - return 0; -} diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 79d3fcf9fd9b..64009f4908d2 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -133,7 +133,7 @@ FIELD(AMDVI_IRTE_GA_LO, DESTINATION, 8, 24) FIELD(AMDVI_IRTE_GA_HI, VECTOR, 0, 8) FIELD(AMDVI_IRTE_GA_HI, DESTINATION_HI, 56, 8) -uint64_t amdvi_extended_feature_register(AMDVIState *s) +static uint64_t amdvi_extended_feature_register(AMDVIState *s) { uint64_t feature = AMDVI_DEFAULT_EXT_FEATURES; if (s->xtsup) { @@ -2538,6 +2538,15 @@ static int amdvi_iommu_notify_flag_changed(IOMMUMemoryRegion *iommu, return 0; } +static void amdvi_get_ivrs_info(AMDVIState *s, AMDIVRSInfo *ivrs_info) +{ + ivrs_info->pci = s->pci; + ivrs_info->root_bus = s->root_bus; + ivrs_info->base_addr = AMDVI_GET_BASE_ADDR(s->iommu.index); + ivrs_info->extended_feature = s->extended_feature; + ivrs_info->dma_translation = s->iommu.dma_translation; +} + static void amdvi_init(AMDVIState *s) { amdvi_iotlb_reset(s); @@ -2555,12 +2564,13 @@ static void amdvi_init(AMDVIState *s) s->cmdbuf_enabled = false; s->xten = false; s->intcapxten = false; + s->extended_feature = amdvi_extended_feature_register(s); + s->get_ivrs_info = amdvi_get_ivrs_info; /* reset MMIO */ memset(s->mmior, 0, AMDVI_MMIO_SIZE); amdvi_set_quad(s, AMDVI_MMIO_EXT_FEATURES, - amdvi_extended_feature_register(s), - 0xffffffffffffffef, 0); + s->extended_feature, 0xffffffffffffffef, 0); amdvi_set_quad(s, AMDVI_MMIO_STATUS, 0, 0x98, 0x67); } diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h index 383605c38e6c..38ab7aa97c47 100644 --- a/hw/i386/amd_iommu.h +++ b/hw/i386/amd_iommu.h @@ -326,6 +326,14 @@ struct AMDVIPCIState { uint32_t capab_offset; /* capability offset pointer */ }; +typedef struct AMDIVRSInfo { + AMDVIPCIState *pci; /* IOMMU PCI device */ + PCIBus *root_bus; /* root bus to register IOMMU ops */ + uint64_t base_addr; /* MMIO region */ + uint64_t extended_feature; /* Extended feature bits */ + bool dma_translation; /* Host address translation enabled */ +} AMDIVRSInfo; + struct AMDVIState { X86IOMMUState iommu; /* IOMMU bus device */ AMDVIPCIState *pci; /* IOMMU PCI device */ @@ -395,8 +403,8 @@ struct AMDVIState { /* root bus to register IOMMU ops */ PCIBus *root_bus; + uint64_t extended_feature; + void (*get_ivrs_info)(AMDVIState *s, AMDIVRSInfo *ivrs_info); }; -uint64_t amdvi_extended_feature_register(AMDVIState *s); - #endif diff --git a/hw/i386/meson.build b/hw/i386/meson.build index 6bb73b8731cc..39a2886e7292 100644 --- a/hw/i386/meson.build +++ b/hw/i386/meson.build @@ -12,8 +12,7 @@ i386_ss.add(files( i386_ss.add(when: 'CONFIG_APIC', if_true: files('vapic.c')) i386_ss.add(when: 'CONFIG_X86_IOMMU', if_true: files('x86-iommu.c'), if_false: files('x86-iommu-stub.c')) -i386_ss.add(when: 'CONFIG_AMD_IOMMU', if_true: files('amd_iommu.c'), - if_false: files('amd_iommu-stub.c')) +i386_ss.add(when: 'CONFIG_AMD_IOMMU', if_true: files('amd_iommu.c')) i386_ss.add(when: 'CONFIG_I440FX', if_true: files('pc_piix.c')) i386_ss.add(when: 'CONFIG_ISAPC', if_true: files('isapc.c')) i386_ss.add(when: 'CONFIG_MICROVM', if_true: files('x86-common.c', 'microvm.c', 'acpi-microvm.c', 'microvm-dt.c')) -- 2.34.1