From nobody Sun Nov 24 02:27:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1726497164; cv=pass; d=zohomail.com; s=zohoarc; b=VAgKRMXLdEu8VF1SWhppMMAxqixkE9aqlgeenV5MAzESu+qII6ckiMNOtpYgqYkgLUV6U4TxrvyKxeDBBrZuecOo4xZt6JHqvxE+5vWVq7WMXum8oLMRFkxYgDzW0zPuxCJXfCoZVYJ8tJlkEGtUZW8PzdQqc4j0AI2OBhoNjEM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726497164; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VDn6O8TRmR2aviZQj/8nPRMzuOOx7oOVsG0u/qDyRnw=; b=Pp/6QYluU6CyENrqtpTOseyYU4u66c3YGesb2wedBzJJdewzz0oE95rvSWnGF6Kr0oUUQ83HzfMjI2qpqwhZpGiTv8RGosIC7MBECAX9iSdd9PkHTf6l/WxH9CjLrGyLzbMNStAG9ERCIapu4J3sA52xTEWXHIjh2C6lQM+Q0gk= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1726497164951695.5597199851492; Mon, 16 Sep 2024 07:32:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqCli-0002jn-15; Mon, 16 Sep 2024 10:31:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqClf-0002hS-AW for qemu-devel@nongnu.org; Mon, 16 Sep 2024 10:31:55 -0400 Received: from mail-dm6nam11on2062a.outbound.protection.outlook.com ([2a01:111:f403:2415::62a] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqClY-0008OY-BX for qemu-devel@nongnu.org; Mon, 16 Sep 2024 10:31:54 -0400 Received: from MW4PR04CA0219.namprd04.prod.outlook.com (2603:10b6:303:87::14) by DM4PR12MB6421.namprd12.prod.outlook.com (2603:10b6:8:b7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.24; Mon, 16 Sep 2024 14:31:41 +0000 Received: from SJ5PEPF00000208.namprd05.prod.outlook.com (2603:10b6:303:87:cafe::af) by MW4PR04CA0219.outlook.office365.com (2603:10b6:303:87::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.30 via Frontend Transport; Mon, 16 Sep 2024 14:31:41 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF00000208.mail.protection.outlook.com (10.167.244.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Mon, 16 Sep 2024 14:31:40 +0000 Received: from volcano-ed17host-rhel.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 16 Sep 2024 09:31:39 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IAapSEsnn22Tj1q1E9PpNDYxJQJ1cQO4Ht4EKUBoLjmKFVlSQXZ5wc/Rcsy3Ihgjvp4lMQmXwZYAjBckLYAX4hLXYiH4dRiyLW4KLtKBFKgJFNKYI/Cy9bq4qDH8VYdwozTAvTHzTj3bl9Gz4L5bXuFUV2ZRRZP+SjAHMAnp3rccM0/XOSc9zQ1ULdEtH3rjZlAZoM4VZ6VNC5pUPYb2CxMmKXtiOSPYS+MeD/udYHfljCjAiMNX4PxNnQ7ruIvk66upVaMo+mcONaZFMUvnWoZRCaa/aIk8vuRAnT94Z78+pNAu2rrNDOgDstQYvTMS2Wj1ZasPSz50F411E0qemg== 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=VDn6O8TRmR2aviZQj/8nPRMzuOOx7oOVsG0u/qDyRnw=; b=LC7QrNnEGHH19MNNTQgbFFURN67hr4n8XWVrzPja8fP8nfE6qEaD0AMDsrXym/pPYHrCSV2EmXaZdOUa4G7Y+GhNISqb6PxdNpx0aMkE2PQFi8TzGvRaAqxKwJ03Y+kKXZmdGL6FYfhIS8SRIqwuua2R7YvNgyqDqVQ4rw6/h/5+UYjAAdGIaTzxZTbjXGXqnNhJHY2dHCC5bYI0AGP6rdjuS5dBpN1/78mB8PU5ub6vWdd/PoSVabPj88W6hZvd83Q3GUmP7OJFPBxJ5MH3adTly5/pFXMIwdJ44Vy9cQMBkAb9opbSg2j5/2Ip32JFA4QMcUDubJ5XG8BhjjLZiA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.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) 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=VDn6O8TRmR2aviZQj/8nPRMzuOOx7oOVsG0u/qDyRnw=; b=qpwrVazyC+GYoTPXx8KOervszsIy5cBDRdnHfUqJhcfn6krN2C86Xq+jUW/Y19oGyB0AUkn6avEY0AgkY3DQag+jKqSk8CDWJHuQUZLqSSzde/O/ymC9kJy40Z0EX++QAwr96/a7oQrrfW5cfbidL+wQ9JG6b8E34Dn/i3QDLMY= X-MS-Exchange-Authentication-Results: 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=SATLEXMB04.amd.com; pr=C From: Santosh Shukla To: CC: , , , , , , Subject: [PATCH v2 1/5] amd_iommu: Rename variable mmio to mr_mmio Date: Mon, 16 Sep 2024 09:31:12 -0500 Message-ID: <20240916143116.169693-2-santosh.shukla@amd.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240916143116.169693-1-santosh.shukla@amd.com> References: <20240916143116.169693-1-santosh.shukla@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF00000208:EE_|DM4PR12MB6421:EE_ X-MS-Office365-Filtering-Correlation-Id: be10effc-2014-4bff-d413-08dcd65c47ad X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?DA74l9tbU68n3g9CkTSzi9IY90NslqAuHecDi7Q7XlvDnYIZlkwG2fLsqoS6?= =?us-ascii?Q?pvfMdhAuax54H1wSyUoITJz9mz6jO3KTSc3A7iJKe/xdl1sQ7PoyppSMFJKH?= =?us-ascii?Q?44gIYQgA3Z1xLmoln0vP2OaClGSUL08/t5YYGIXeY5xeMuu5uoyggg6gGT2U?= =?us-ascii?Q?x5EXa4v7uYDEdlXmZoHFOaJTZ9PX1+r1UufnHjm1YafoALf9dsoFIqpkWeHl?= =?us-ascii?Q?U6eJohnZ87w1Yfca2/kQOSPl/EYTfFhry1tRxNHdnjYyqdLB3luFdxCAs4ZH?= =?us-ascii?Q?GVr+1d2qiyIK0OvA8QHVAx5aw1ZS7ExUnVOGebJ/hPnmhDmQ0pIPPcka3/eF?= =?us-ascii?Q?6+feDmjiLmjz9NVE/7v3cNhtYeO9Pc2lSgG2yaRu78fDsK5zkKQlNxxFkANh?= =?us-ascii?Q?SbL+d7UYi37nNNgJIkSUE1C0VufFZ0YyocLJmAvXN/iJMBcmlRwQdOdlvg2c?= =?us-ascii?Q?JkV9FPEBXlBXWjIlrr4C/EAtkh1uRcsdieABpz5BYGhmPqDr7likJuBuoi0t?= =?us-ascii?Q?3xdZjiFLw7MdyKbegaQBVyvCP3ZfuP8jNPgekQnOGzNrfD6kQg2TxR1w/iRa?= =?us-ascii?Q?ZDiAA2bUdMc+2+Mirsc5BY343f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RY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2024 14:31:40.6114 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: be10effc-2014-4bff-d413-08dcd65c47ad 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF00000208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6421 Received-SPF: permerror client-ip=2a01:111:f403:2415::62a; envelope-from=Santosh.Shukla@amd.com; helo=NAM11-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1726497167554116600 Content-Type: text/plain; charset="utf-8" From: Suravee Suthikulpanit Rename the MMIO memory region variable 'mmio' to 'mr_mmio' so to correctly name align with struct AMDVIState::variable type. No functional change intended. Signed-off-by: Suravee Suthikulpanit Signed-off-by: Santosh Shukla Reviewed-by: Alejandro Jimenez --- hw/i386/acpi-build.c | 4 ++-- hw/i386/amd_iommu.c | 6 +++--- hw/i386/amd_iommu.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 4967aa745902..5c6920f90d05 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2321,7 +2321,7 @@ build_amd_iommu(GArray *table_data, BIOSLinker *linke= r, const char *oem_id, /* Capability offset */ build_append_int_noprefix(table_data, s->pci.capab_offset, 2); /* IOMMU base address */ - build_append_int_noprefix(table_data, s->mmio.addr, 8); + build_append_int_noprefix(table_data, s->mr_mmio.addr, 8); /* PCI Segment Group */ build_append_int_noprefix(table_data, 0, 2); /* IOMMU info */ @@ -2356,7 +2356,7 @@ build_amd_iommu(GArray *table_data, BIOSLinker *linke= r, const char *oem_id, /* Capability offset */ build_append_int_noprefix(table_data, s->pci.capab_offset, 2); /* IOMMU base address */ - build_append_int_noprefix(table_data, s->mmio.addr, 8); + build_append_int_noprefix(table_data, s->mr_mmio.addr, 8); /* PCI Segment Group */ build_append_int_noprefix(table_data, 0, 2); /* IOMMU info */ diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 464f0b666e69..abb64ea507be 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -1598,10 +1598,10 @@ static void amdvi_sysbus_realize(DeviceState *dev, = Error **errp) x86ms->ioapic_as =3D amdvi_host_dma_iommu(bus, s, AMDVI_IOAPIC_SB_DEVI= D); =20 /* set up MMIO */ - memory_region_init_io(&s->mmio, OBJECT(s), &mmio_mem_ops, s, "amdvi-mm= io", - AMDVI_MMIO_SIZE); + memory_region_init_io(&s->mr_mmio, OBJECT(s), &mmio_mem_ops, s, + "amdvi-mmio", AMDVI_MMIO_SIZE); memory_region_add_subregion(get_system_memory(), AMDVI_BASE_ADDR, - &s->mmio); + &s->mr_mmio); pci_setup_iommu(bus, &amdvi_iommu_ops, s); amdvi_init(s); } diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h index 73619fe9eaa7..e5c2ae94f243 100644 --- a/hw/i386/amd_iommu.h +++ b/hw/i386/amd_iommu.h @@ -353,7 +353,7 @@ struct AMDVIState { uint32_t pprlog_head; /* ppr log head */ uint32_t pprlog_tail; /* ppr log tail */ =20 - MemoryRegion mmio; /* MMIO region */ + MemoryRegion mr_mmio; /* MMIO region */ uint8_t mmior[AMDVI_MMIO_SIZE]; /* read/write MMIO */ uint8_t w1cmask[AMDVI_MMIO_SIZE]; /* read/write 1 clear mask */ uint8_t romask[AMDVI_MMIO_SIZE]; /* MMIO read/only mask */ --=20 2.43.5 From nobody Sun Nov 24 02:27:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1726497166; cv=pass; d=zohomail.com; s=zohoarc; b=U2mP9/cWFtLGgrwTMdQMsNogpIxslFZ2SCNl6WMWXyXsdDrmaL5QtC9wl8wV0SmS7lACkjNmx5j2xnzyzKnYnbDgIs2QcEPEwNP925+4Dl2PmXdDzywlzbXclxhE6hAKk3h3GkNZVtnqdqqROt+LJ1sBcUcWWJZax+RzDHzYfao= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726497166; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=x5ubfCtBc+j644eI27xuiuImRuefsEjP+rSV1R2oN/M=; b=XNr4hptifBAlamPE42uTHzQzjwql1Or8NgEDTdYcY/TTliFa9N8auAg/PkjHFFGVQVRXB/qQDDPSiX2lBEQjSIc1+gcAmX7fh6P7ft0KeBVgQdJm0q2EeCe5RIG9DKlPayLtcc8FKGNNU+7K8uNu2YJy5RhofcXA1txIMr1bVXs= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1726497166437920.6898010911124; Mon, 16 Sep 2024 07:32:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqClq-0002u5-3X; Mon, 16 Sep 2024 10:32:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqClj-0002qc-UM for qemu-devel@nongnu.org; Mon, 16 Sep 2024 10:31:59 -0400 Received: from mail-dm6nam10on20607.outbound.protection.outlook.com ([2a01:111:f400:7e88::607] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqClh-0008Qy-1S for qemu-devel@nongnu.org; Mon, 16 Sep 2024 10:31:59 -0400 Received: from MW4PR04CA0215.namprd04.prod.outlook.com (2603:10b6:303:87::10) by BY5PR12MB4162.namprd12.prod.outlook.com (2603:10b6:a03:201::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.24; Mon, 16 Sep 2024 14:31:51 +0000 Received: from SJ5PEPF00000208.namprd05.prod.outlook.com (2603:10b6:303:87:cafe::9f) by MW4PR04CA0215.outlook.office365.com (2603:10b6:303:87::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24 via Frontend Transport; Mon, 16 Sep 2024 14:31:51 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF00000208.mail.protection.outlook.com (10.167.244.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Mon, 16 Sep 2024 14:31:51 +0000 Received: from volcano-ed17host-rhel.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 16 Sep 2024 09:31:50 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Hv8vVSIhSL09Po1MiXNv0nOqKuXxeUcdNqJpU+JpC64iXvdAMgvBZ8PSdaHjuzn/sBprSbObJTwpW9e7VOg8czD9ZjuZ8dkSXpV/gwWiZmQfhum2SrFMIDCAuLbN9/UIvApzxCd0VhnIqwZI1v+zhdqh6KuhJm4zLD/MYfKHW0AVxvGrm9/h+CoHgvY8xvfySqnqfjERiqlLVv4Rp5uNu23VPcsJRLzldFjcH5FRefdUYpcDMbapTZ+OdJVU31nXSPo10OgRCzuG9TvEVMT5p6JQEVWmJTiyXOsWTeKlmU3gdOvP5qQgxZIAXJcUJdiOP+Qa+wboU5Rmpo18hBmFlQ== 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=x5ubfCtBc+j644eI27xuiuImRuefsEjP+rSV1R2oN/M=; b=PVrV2ZU0lnN9zveARyksMXZc8eZaapzcBKUWMRj2JPYwjU5xy4YoTRWhOB3hSR/X2PFe655EE5F8scx7H++ATir6whlANBsG1MiWg3MLVntrVpeuB9clq9vl5kU5qDG1931kB8P+7IvqAeQbW3/+d0yojYpv4O6rhtEr3M34BAnrCnAcF7acpHlwC5h/2HTZN2q8hb/fWhrJuMBhCE1NkLC0sjyQZT27IX4OaGZxJ8ERqvmslv87anS1cXTWACmZrOJuFVHKBY86DeVEPSPULgvGbweYhnz2HWvvoVk3BdV4fHPjkvPwoAp182qFARw+JAo++coW+1O7MV/5yBf5QA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.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) 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=x5ubfCtBc+j644eI27xuiuImRuefsEjP+rSV1R2oN/M=; b=MhSyIC9ylG1fu5Lwsm2migPotOVSRIh5g+OpcWxCymq+ZnLTqM9R3QmqgoksqXgO7LinGPyxhTAswYNeg82FRpz4VLUZfQPX/j8bldeC9cZrae4+DG16zNjfuRb3eNzWzwZeq9W+ap59F/DDf9cXHC77ptMWlDy12apgXJXafSY= X-MS-Exchange-Authentication-Results: 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=SATLEXMB04.amd.com; pr=C From: Santosh Shukla To: CC: , , , , , , Subject: [PATCH v2 2/5] amd_iommu: Add support for pass though mode Date: Mon, 16 Sep 2024 09:31:13 -0500 Message-ID: <20240916143116.169693-3-santosh.shukla@amd.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240916143116.169693-1-santosh.shukla@amd.com> References: <20240916143116.169693-1-santosh.shukla@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF00000208:EE_|BY5PR12MB4162:EE_ X-MS-Office365-Filtering-Correlation-Id: d79eee10-8ca6-47bd-3cc1-08dcd65c4e0a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Yp6+7n1pPD8hsmrrr6mlUVJ/vCgVwBmcTPsuAx5SEU4UMcWVIGYYM9ADGtNx?= =?us-ascii?Q?u6QQyWmq6VQT0SxRb6OeT3WbVf5zh91qEjyQgthXjypiiac9j7wVOhMjLRBw?= =?us-ascii?Q?e/Pay0hbxjo8tro2umGwYQMup9S6eziXvKQKsQxk7paCaQz0Xp5u6t2iYwem?= =?us-ascii?Q?mvXzjsYIIk2S/SKuUUdqbR7HI75xRPOiwt88+60MxhZ68vFpERrruWGz/PAi?= =?us-ascii?Q?LAtZ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snMmazB9f?= =?us-ascii?Q?9eEk2V8jD4HL1TnZZtDAu4iab+LSjd2dmMh2pstrHDKmyG344pbvTgR2APpE?= =?us-ascii?Q?CEMS8SJ/Lr6f6C2BYWcKVJ0k87FevfB9w3Bgp2NKPyUy+rVZ6KEvO/RvRpXD?= =?us-ascii?Q?oo/PCW4S8dLMTi/snl04URP7JmUlMxPWk3XoLJe/HJU+SGmgO1DG1cHFvH4B?= =?us-ascii?Q?Qdu8BywZdj/DFJAqOsxkWLC1pHngPGtDHxTSFbNIxLx9BeITh2fBMekgXCiH?= =?us-ascii?Q?JLexdRHh2XZ9qE6WauwZdzqCbe2Vm5r/jZg2vylGNALYoWm7wRvk642ucap8?= =?us-ascii?Q?fRNMx5JbvHCv3wROlg7Z+Zrgdij5Q4NF?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(36860700013)(1800799024)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2024 14:31:51.2990 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d79eee10-8ca6-47bd-3cc1-08dcd65c4e0a 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF00000208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4162 Received-SPF: permerror client-ip=2a01:111:f400:7e88::607; envelope-from=Santosh.Shukla@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1726497168230116600 Content-Type: text/plain; charset="utf-8" From: Suravee Suthikulpanit Introduce 'nodma' shared memory region to support PT mode so that for each device, we only create an alias to shared memory region when DMA-remapping is disabled. Signed-off-by: Suravee Suthikulpanit Signed-off-by: Santosh Shukla Reviewed-by: Alejandro Jimenez --- hw/i386/amd_iommu.c | 49 ++++++++++++++++++++++++++++++++++++--------- hw/i386/amd_iommu.h | 2 ++ 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index abb64ea507be..c5f5103f4911 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -60,8 +60,9 @@ struct AMDVIAddressSpace { uint8_t bus_num; /* bus number */ uint8_t devfn; /* device function */ AMDVIState *iommu_state; /* AMDVI - one per machine */ - MemoryRegion root; /* AMDVI Root memory map region */ + MemoryRegion root; /* AMDVI Root memory map region */ IOMMUMemoryRegion iommu; /* Device's address translation region */ + MemoryRegion iommu_nodma; /* Alias of shared nodma memory region */ MemoryRegion iommu_ir; /* Device's interrupt remapping region */ AddressSpace as; /* device's corresponding address space */ }; @@ -1412,6 +1413,7 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus= , void *opaque, int devfn) AMDVIState *s =3D opaque; AMDVIAddressSpace **iommu_as, *amdvi_dev_as; int bus_num =3D pci_bus_num(bus); + X86IOMMUState *x86_iommu =3D X86_IOMMU_DEVICE(s); =20 iommu_as =3D s->address_spaces[bus_num]; =20 @@ -1436,13 +1438,13 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *b= us, void *opaque, int devfn) * Memory region relationships looks like (Address range shows * only lower 32 bits to make it short in length...): * - * |-----------------+-------------------+----------| - * | Name | Address range | Priority | - * |-----------------+-------------------+----------+ - * | amdvi_root | 00000000-ffffffff | 0 | - * | amdvi_iommu | 00000000-ffffffff | 1 | - * | amdvi_iommu_ir | fee00000-feefffff | 64 | - * |-----------------+-------------------+----------| + * |--------------------+-------------------+----------| + * | Name | Address range | Priority | + * |--------------------+-------------------+----------+ + * | amdvi-root | 00000000-ffffffff | 0 | + * | amdvi-iommu_nodma | 00000000-ffffffff | 0 | + * | amdvi-iommu_ir | fee00000-feefffff | 64 | + * |--------------------+-------------------+----------| */ memory_region_init_iommu(&amdvi_dev_as->iommu, sizeof(amdvi_dev_as->iommu), @@ -1461,7 +1463,25 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bu= s, void *opaque, int devfn) 64); memory_region_add_subregion_overlap(&amdvi_dev_as->root, 0, MEMORY_REGION(&amdvi_dev_as->i= ommu), - 1); + 0); + + /* Build the DMA Disabled alias to shared memory */ + memory_region_init_alias(&amdvi_dev_as->iommu_nodma, OBJECT(s), + "amdvi-sys", &s->mr_sys, 0, + memory_region_size(&s->mr_sys)); + memory_region_add_subregion_overlap(&amdvi_dev_as->root, 0, + &amdvi_dev_as->iommu_nodma, + 0); + + if (!x86_iommu->pt_supported) { + memory_region_set_enabled(&amdvi_dev_as->iommu_nodma, false); + memory_region_set_enabled(MEMORY_REGION(&amdvi_dev_as->iommu), + true); + } else { + memory_region_set_enabled(MEMORY_REGION(&amdvi_dev_as->iommu), + false); + memory_region_set_enabled(&amdvi_dev_as->iommu_nodma, true); + } } return &iommu_as[devfn]->as; } @@ -1602,6 +1622,17 @@ static void amdvi_sysbus_realize(DeviceState *dev, E= rror **errp) "amdvi-mmio", AMDVI_MMIO_SIZE); memory_region_add_subregion(get_system_memory(), AMDVI_BASE_ADDR, &s->mr_mmio); + + /* Create the share memory regions by all devices */ + memory_region_init(&s->mr_sys, OBJECT(s), "amdvi-sys", UINT64_MAX); + + /* set up the DMA disabled memory region */ + memory_region_init_alias(&s->mr_nodma, OBJECT(s), + "amdvi-nodma", get_system_memory(), 0, + memory_region_size(get_system_memory())); + memory_region_add_subregion_overlap(&s->mr_sys, 0, + &s->mr_nodma, 0); + pci_setup_iommu(bus, &amdvi_iommu_ops, s); amdvi_init(s); } diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h index e5c2ae94f243..be417e51c4dc 100644 --- a/hw/i386/amd_iommu.h +++ b/hw/i386/amd_iommu.h @@ -354,6 +354,8 @@ struct AMDVIState { uint32_t pprlog_tail; /* ppr log tail */ =20 MemoryRegion mr_mmio; /* MMIO region */ + MemoryRegion mr_sys; + MemoryRegion mr_nodma; uint8_t mmior[AMDVI_MMIO_SIZE]; /* read/write MMIO */ uint8_t w1cmask[AMDVI_MMIO_SIZE]; /* read/write 1 clear mask */ uint8_t romask[AMDVI_MMIO_SIZE]; /* MMIO read/only mask */ --=20 2.43.5 From nobody Sun Nov 24 02:27:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1726497216; cv=pass; d=zohomail.com; s=zohoarc; b=mkziZKPbNQA5xQWMEvu9Z9udpk21+3LJEj2mg9LUee9TrZbj/uLgPbru9L2mquAuuiy5N8lS3BYawR17fTIjB3JJ+d4R3uchrs3VMVLeXg6Jt+2PS21zWRvHWn329tYIhIcx73ty0AHPt8pFWhvvJwLpZ6UGirN/ltiheAON+U8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726497216; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uVZp8W/mrH7cMm9l7mu2ltWFQ0fVkgp5gJs11YYxcIE=; b=Qk3WC7Y/E2U53pUK/OvOaJFc3S6HpH0oqd7dKyZvHDHlHkeq/Z2SFQiiMYV4Xv3oW1MRU8ruCJhw6pXhVyUGljVsdrD3mfmdYepLmpkDeBm9uvaQRwkJsdxhnnEO6/6OMOfhyAiimwzBPE3lPcZT4fvMxhS5fgSzaBLBJQYb5Lw= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1726497216197718.2866339229482; Mon, 16 Sep 2024 07:33:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqClz-0003AM-Co; Mon, 16 Sep 2024 10:32:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqClx-00039A-Nu for qemu-devel@nongnu.org; Mon, 16 Sep 2024 10:32:14 -0400 Received: from mail-mw2nam12on2061b.outbound.protection.outlook.com ([2a01:111:f403:200a::61b] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqClv-0008SP-Or for qemu-devel@nongnu.org; Mon, 16 Sep 2024 10:32:13 -0400 Received: from MW4PR04CA0220.namprd04.prod.outlook.com (2603:10b6:303:87::15) by DM4PR12MB6012.namprd12.prod.outlook.com (2603:10b6:8:6c::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.23; Mon, 16 Sep 2024 14:32:03 +0000 Received: from SJ5PEPF00000209.namprd05.prod.outlook.com (2603:10b6:303:87:cafe::81) by MW4PR04CA0220.outlook.office365.com (2603:10b6:303:87::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24 via Frontend Transport; Mon, 16 Sep 2024 14:32:03 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF00000209.mail.protection.outlook.com (10.167.244.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Mon, 16 Sep 2024 14:32:02 +0000 Received: from volcano-ed17host-rhel.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 16 Sep 2024 09:32:01 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Vi3IMVr4HPa8WmnXGHSJ88zuCkEJmlCglOXcbVFAkRBE9R/0ncxFttDCMsXAv85FFcd1gM8Ghcjum5PXfeI063m39m6tOBNn9f069ml5DRJ25/6UZLXVGcRvf6yKv2npySVdOaJfcY/Y6Eem7m9x7QhHnls5lk4Z05roUTSN0BVr4nHlDRflKJbU/hSskUTby1wV28FSkQaWSM/NGoA6vE6C5l1P2cfv7QnoeeVOLbvutGALkXIzi5rWyvyym+Cpzcm6lclVTU4+ZDX23153RQ8Wc6F4LdJUjb0TGjfYB7c4AypkpNRCB+2wATzpbBnKFK2PxWDQY5Lx4E+gBcELIA== 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=uVZp8W/mrH7cMm9l7mu2ltWFQ0fVkgp5gJs11YYxcIE=; b=etkblZ5uDkJUudeajfu6gPMxXsPszcezVNCEGCAH3/A2L+vn9g6zjeEcd3YRBM7rrwGvCTZJqBNaPshbLWKWKkenyx1bOJgCF8kJwRiXRdy8ikiehzm85cpbcQXtcFLtgiyc38e7TuZR3xbtk83tzEM8KljUw835oFKrSBqpEZK27efC/TrrX0hinBph+UVHiO3UWzHW5hhMZkyvOEs0BViqSHOazUAgQiXpr+W7bDwf6ydFsb1J0tF+1RzcRtm5+kNWP/r2OeJdzGv0LnBrl2c9HiFjTdKCThlxlUi/zmonl8TMyYveQAmA/BHYjWNDXMfnsKpMvQvNgAfhQtqUXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.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) 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=uVZp8W/mrH7cMm9l7mu2ltWFQ0fVkgp5gJs11YYxcIE=; b=b+3uxurw6DiOsaGEVEIg8vvyiDIarFVJvrW/39/yxeCycLxtJcq/0SsfRQ5vD/JLAExXGkkH3TAds1FtJswEzuNwNAOc9TIgcEUfaZDhlygIrALeNvPhqQojuE8aFW36J6H38pD8UI1P1//urj/32t55KkNW/ucG3fULnuTqLLg= X-MS-Exchange-Authentication-Results: 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=SATLEXMB04.amd.com; pr=C From: Santosh Shukla To: CC: , , , , , , Subject: [PATCH v2 3/5] amd_iommu: Use shared memory region for Interrupt Remapping Date: Mon, 16 Sep 2024 09:31:14 -0500 Message-ID: <20240916143116.169693-4-santosh.shukla@amd.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240916143116.169693-1-santosh.shukla@amd.com> References: <20240916143116.169693-1-santosh.shukla@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF00000209:EE_|DM4PR12MB6012:EE_ X-MS-Office365-Filtering-Correlation-Id: ba0a5bff-0461-410b-2b8a-08dcd65c54e7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?saqN4pTtxV3Cp6d1TDZPM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=?us-ascii?Q?L6NiDSgAaveaYUXpRPAJy5KPDdHQbxqwZX/kCIRB9c/yefyzv9tm+e5ZV8ef?= =?us-ascii?Q?Zt2xYZ8Ixq2wnndRVUvG4nzm2n8pD8wl/nQRejVmYQsfkcMg7Bzg5SNTYsQZ?= =?us-ascii?Q?T6Yshdv1cRG7mYPRUfdjaBfvFPDG08xvRjrtD8zgNC+spCgOPdYLAfyJ0Etj?= =?us-ascii?Q?AJRkoaS1zjTT3InRd9im1modl5+Jt4ZzphxI20+LopxxgpHWk7mjxg/NOPWo?= =?us-ascii?Q?3l6P6i6uEnqNR6iL4fP/JmvOw0LlAQAmIL540vGHtEYsjDNqHkzazmq94FuR?= =?us-ascii?Q?XNX0YD2dGDlnkxH02h4o5v81SfsPvQ7wT0GRcD/vv9B2pJwvJRKKiewNSSXa?= =?us-ascii?Q?e8KWbZcygW2Ba8uRS0u5a8hf1YJUpHFD69KdVj8E70ec+LMY0UV4pMFK+J7Q?= =?us-ascii?Q?8hA5Cqqq10GA2MkK82wPgcZXq45rKwgJ8wlXk2/QLgDXDppJ2HvKtpvLqvcQ?= =?us-ascii?Q?u8ezyLfTqZ1n48io95weSWPdqvmIH/wD5LWuea7Yuzdt6mE5q0QDHo7sRNF9?= =?us-ascii?Q?U3ANU2efYBHvbskZw6jfKhAtFKfX3PgA?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(1800799024)(36860700013)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2024 14:32:02.7976 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba0a5bff-0461-410b-2b8a-08dcd65c54e7 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF00000209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6012 Received-SPF: permerror client-ip=2a01:111:f403:200a::61b; envelope-from=Santosh.Shukla@amd.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1726497216521116600 Content-Type: text/plain; charset="utf-8" From: Suravee Suthikulpanit Use shared memory region for interrupt remapping which can be aliased by all devices. Signed-off-by: Suravee Suthikulpanit Signed-off-by: Santosh Shukla Reviewed-by: Alejandro Jimenez --- hw/i386/amd_iommu.c | 22 ++++++++++++++-------- hw/i386/amd_iommu.h | 1 + 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index c5f5103f4911..24fcd561345c 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -1443,7 +1443,7 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus= , void *opaque, int devfn) * |--------------------+-------------------+----------+ * | amdvi-root | 00000000-ffffffff | 0 | * | amdvi-iommu_nodma | 00000000-ffffffff | 0 | - * | amdvi-iommu_ir | fee00000-feefffff | 64 | + * | amdvi-iommu_ir | fee00000-feefffff | 1 | * |--------------------+-------------------+----------| */ memory_region_init_iommu(&amdvi_dev_as->iommu, @@ -1454,13 +1454,6 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bu= s, void *opaque, int devfn) memory_region_init(&amdvi_dev_as->root, OBJECT(s), "amdvi_root", UINT64_MAX); address_space_init(&amdvi_dev_as->as, &amdvi_dev_as->root, name); - memory_region_init_io(&amdvi_dev_as->iommu_ir, OBJECT(s), - &amdvi_ir_ops, s, "amd_iommu_ir", - AMDVI_INT_ADDR_SIZE); - memory_region_add_subregion_overlap(&amdvi_dev_as->root, - AMDVI_INT_ADDR_FIRST, - &amdvi_dev_as->iommu_ir, - 64); memory_region_add_subregion_overlap(&amdvi_dev_as->root, 0, MEMORY_REGION(&amdvi_dev_as->i= ommu), 0); @@ -1472,6 +1465,13 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bu= s, void *opaque, int devfn) memory_region_add_subregion_overlap(&amdvi_dev_as->root, 0, &amdvi_dev_as->iommu_nodma, 0); + /* Build the Interrupt Remapping alias to shared memory */ + memory_region_init_alias(&amdvi_dev_as->iommu_ir, OBJECT(s), + "amdvi-ir", &s->mr_ir, 0, + memory_region_size(&s->mr_ir)); + memory_region_add_subregion_overlap(MEMORY_REGION(&amdvi_dev_as->i= ommu), + AMDVI_INT_ADDR_FIRST, + &amdvi_dev_as->iommu_ir, 1); =20 if (!x86_iommu->pt_supported) { memory_region_set_enabled(&amdvi_dev_as->iommu_nodma, false); @@ -1633,6 +1633,12 @@ static void amdvi_sysbus_realize(DeviceState *dev, E= rror **errp) memory_region_add_subregion_overlap(&s->mr_sys, 0, &s->mr_nodma, 0); =20 + /* set up the Interrupt Remapping memory region */ + memory_region_init_io(&s->mr_ir, OBJECT(s), &amdvi_ir_ops, + s, "amdvi-ir", AMDVI_INT_ADDR_SIZE); + memory_region_add_subregion_overlap(&s->mr_sys, AMDVI_INT_ADDR_FIRST, + &s->mr_ir, 1); + pci_setup_iommu(bus, &amdvi_iommu_ops, s); amdvi_init(s); } diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h index be417e51c4dc..e0dac4d9a96c 100644 --- a/hw/i386/amd_iommu.h +++ b/hw/i386/amd_iommu.h @@ -356,6 +356,7 @@ struct AMDVIState { MemoryRegion mr_mmio; /* MMIO region */ MemoryRegion mr_sys; MemoryRegion mr_nodma; + MemoryRegion mr_ir; uint8_t mmior[AMDVI_MMIO_SIZE]; /* read/write MMIO */ uint8_t w1cmask[AMDVI_MMIO_SIZE]; /* read/write 1 clear mask */ uint8_t romask[AMDVI_MMIO_SIZE]; /* MMIO read/only mask */ --=20 2.43.5 From nobody Sun Nov 24 02:27:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1726497211; cv=pass; d=zohomail.com; s=zohoarc; b=MWE/1VN1Ly/+wSi9AJpm+bR+W7G2DsR34NoAoqSQWYm5ES8Q9IBWOF7ijVBBfBZbdYo7znGAMaH1Y3AaANI2qlLv4xUYtGvFZBM5QE1Tz6wT7nfI5ZV0SWG3VOr+2qzFtKmXsSX1eGACVTN2YULPDkTRPf0fnsJlS2cLWS07704= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726497211; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Thsc4BaUbibLidZ5Vwyrbhj7vXoVogOHQfhGZsu9eBU=; b=Sgh8ky7EUO5lE+jPOJEV3/HVRxFby8VAJ9RxWRTMc3B4W+LlqAtfQt23dTmjklHYrD00uDkBKdEMG33+CqVTjuMuY54V55rXDk2L0h/5JHqFp2QHqI7afocD0enKnQYvRGSVV2LyIrVyimdzCAPknGfeP2GSB6fyA6r16AZeSD0= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1726497211061470.5822003545835; Mon, 16 Sep 2024 07:33:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqCmA-0003Lb-Gv; Mon, 16 Sep 2024 10:32:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqCm6-0003Gp-FA for qemu-devel@nongnu.org; Mon, 16 Sep 2024 10:32:22 -0400 Received: from mail-dm3nam02on20600.outbound.protection.outlook.com ([2a01:111:f403:2405::600] helo=NAM02-DM3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqCm4-0008T5-Cu for qemu-devel@nongnu.org; Mon, 16 Sep 2024 10:32:22 -0400 Received: from BYAPR08CA0048.namprd08.prod.outlook.com (2603:10b6:a03:117::25) by IA0PR12MB7675.namprd12.prod.outlook.com (2603:10b6:208:433::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.23; Mon, 16 Sep 2024 14:32:13 +0000 Received: from SJ5PEPF000001F5.namprd05.prod.outlook.com (2603:10b6:a03:117:cafe::88) by BYAPR08CA0048.outlook.office365.com (2603:10b6:a03:117::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.27 via Frontend Transport; Mon, 16 Sep 2024 14:32:13 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF000001F5.mail.protection.outlook.com (10.167.242.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Mon, 16 Sep 2024 14:32:12 +0000 Received: from volcano-ed17host-rhel.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 16 Sep 2024 09:32:12 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QaX59XyLOhMdtC0LuonesCRe8Z8CJjZSPSuWgkJReRQv5pfg5jZq2GF07CfMXU3BgqybPtwfERT3mM7lcuxKR959WFDX7mvLyxN0ip5jsqoKi7ac2xJizuQVaz/OdMCFkhAchT099AAyfJ21c+hTmLbY/cKK/r4Ew2w/pi8864OvSvT7bZgbIfmqBJTNwvlMqHb1WLsIcQ8yov8FC5+wxOwLzT+e2YOfCNZuHwBmUY8hFALLNqiIRCHXvbOt4LCZXg57jv+aKC6cNdXv/arrS80gcUTMu+rQTMp99jU/L3UrnyRnVltgh3WgQg6sB8FpOeHYBlOPUh8shv0EWMbUUA== 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=Thsc4BaUbibLidZ5Vwyrbhj7vXoVogOHQfhGZsu9eBU=; b=S/JXt4vT7QMPNnIXDhsPvKZRCJc5n5c03pfEsZZW3njgIb1+brWCsGOvYJO7VAZdqEYyupyqaNQx/oTankANs/ntk40m6s6ESLVQyBPby5mEVCPiORnh9vm8qdW+QK1upJs/YECU1o6DFLidppJUZq8x6ol9hXAvJKSR8tJJ2k6kUpCgrjW1U8LsOlQaIw8glrgp8ORJ4svkzbvHQ7T4fqoKbaUYFt9b7w5yNrjpHl3jjkiloEE1GkyE6w9GZzwJDtXgxfUHcFI25WB6aHGNPDNjEZO5sjiV+EjvAyZ9HAkL0g3vx4B57zNPGqrC+aiMFq692dWVeLEXDr96boEnJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.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) 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=Thsc4BaUbibLidZ5Vwyrbhj7vXoVogOHQfhGZsu9eBU=; b=CtGEXpvOe6tkJ+xDvLTaLXaCw753TqJ9GSf2CT/+/95vdDMYEhFXwpLNtWUqGQmb5N1SIFu0Ur5NLb9fGwYx81SHWrw0GSEr6Ac10rORjIlj2qk1prjrs6Hmih1WmQ56wNYJDGD5mcnJVTedmegAeYXKR2Qwj3uUoUYjF8JLRGI= X-MS-Exchange-Authentication-Results: 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=SATLEXMB04.amd.com; pr=C From: Santosh Shukla To: CC: , , , , , , Subject: [PATCH v2 4/5] amd_iommu: Send notification when invaldate interrupt entry cache Date: Mon, 16 Sep 2024 09:31:15 -0500 Message-ID: <20240916143116.169693-5-santosh.shukla@amd.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240916143116.169693-1-santosh.shukla@amd.com> References: <20240916143116.169693-1-santosh.shukla@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001F5:EE_|IA0PR12MB7675:EE_ X-MS-Office365-Filtering-Correlation-Id: 54f30eb4-4034-4b67-1dcc-08dcd65c5afe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|82310400026|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?DnwaETVQQLrSzzhZpW3g9z2AgWPGBOHee4LX6bPR6Iqvk7/yZp0T8Hcop27/?= =?us-ascii?Q?S15o/uTBP6WVs5nhKVgJIJxbHZhdLH6FjAgxK7m23TsARnk01pjvx/PMBq/Q?= =?us-ascii?Q?sbSiqMI2opFGhUIcrQ5nBI39D1YJNLzqeGCS2bnrYKwUeR7ao8BaSEu8Rof2?= =?us-ascii?Q?KE0BYAq6f4qHvSZ9YDfGE/UnUFOdwfCQQY/Npl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xfJXLGxFEiYJRNd4GhB6xHNn1zC+m0wBFg7RMux1+UJQC1JgzIDJvR?= =?us-ascii?Q?X07pGTDghDEKW0f8DJC5QIKq/KLAJgYrWm31bduvxpkmJZXhhOjURT13nhJy?= =?us-ascii?Q?JJrpjNMxADpBp9pIMwE2Sb59Zbxsed57uicY892/62643vjQIUlpMW/NO8/V?= =?us-ascii?Q?5B+fjFwmIvcnF+8vUGH4HF7bWmtooZhT5ZKEKR8AbASOd8wFNRwkeVB5xhH+?= =?us-ascii?Q?rUetELE+HPMR9qIgkPjHjT6WttrhPmcPvujRwHY0PutPmkqByFFtDfACYKxJ?= =?us-ascii?Q?zQYUunrgJtVC6UHfYZf39hIzyIrJ5l33DCA26rtLmr3xLDOQH1K9adIrds0O?= =?us-ascii?Q?2VdCFTN870ylJIZaLivTZlD983bDUTC+?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(82310400026)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2024 14:32:12.9987 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54f30eb4-4034-4b67-1dcc-08dcd65c5afe 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001F5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7675 Received-SPF: permerror client-ip=2a01:111:f403:2405::600; envelope-from=Santosh.Shukla@amd.com; helo=NAM02-DM3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1726497212510116600 Content-Type: text/plain; charset="utf-8" From: Suravee Suthikulpanit In order to support AMD IOMMU interrupt remapping emulation with PCI pass-through devices, QEMU needs to notify VFIO when guest IOMMU driver updates and invalidate the guest interrupt remapping table (IRT), and communicate information so that the host IOMMU driver can update the shadowed interrupt remapping table in the host IOMMU. Therefore, send notification when guet IOMMU emulates the IRT invalidation commands. Signed-off-by: Suravee Suthikulpanit Signed-off-by: Santosh Shukla Reviewed-by: Alejandro Jimenez --- hw/i386/amd_iommu.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 24fcd561345c..9095146525e6 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -431,6 +431,12 @@ static void amdvi_complete_ppr(AMDVIState *s, uint64_t= *cmd) trace_amdvi_ppr_exec(); } =20 +static void amdvi_intremap_inval_notify_all(AMDVIState *s, bool global, + uint32_t index, uint32_t mask) +{ + x86_iommu_iec_notify_all(X86_IOMMU_DEVICE(s), global, index, mask); +} + static void amdvi_inval_all(AMDVIState *s, uint64_t *cmd) { if (extract64(cmd[0], 0, 60) || cmd[1]) { @@ -438,6 +444,9 @@ static void amdvi_inval_all(AMDVIState *s, uint64_t *cm= d) s->cmdbuf + s->cmdbuf_head); } =20 + /* Notify global invalidation */ + amdvi_intremap_inval_notify_all(s, true, 0, 0); + amdvi_iotlb_reset(s); trace_amdvi_all_inval(); } @@ -486,6 +495,9 @@ static void amdvi_inval_inttable(AMDVIState *s, uint64_= t *cmd) return; } =20 + /* Notify global invalidation */ + amdvi_intremap_inval_notify_all(s, true, 0, 0); + trace_amdvi_intr_inval(); } =20 --=20 2.43.5 From nobody Sun Nov 24 02:27:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1726497203; cv=pass; d=zohomail.com; s=zohoarc; b=JF+Ldh9t62H1eOLgS8KIinqvTX62ilVvpd1Jo0FiLC8UXJOhXZRVUd3P+EMv9UMp/uCh2LQqfn3ClxtWYlSDVOe8smdFk/Xwyjjp9XOYnEa5zaHIVFbDDrWSqXMnkE/IExMpEwyJhk0+feauWOiLTUWzlP5LWK5JzqnZ7oYDowM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726497203; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=F4C7q8VTSEPI7Falt7FBjBqENOv47yHHkAjOETJGWI0=; b=IEPM6GOjJ3rNVnkq9LBGize1Pq93+soMpl0EMr/fh8H4n0cxh3rlyuLU9jogzeuRGFFaNvPtjHXtVa4Hv5pYd53O3FMEEcq/dkwlEHyNG8Vwhbkg4d3iDccUHzgiCA7C4aPYr3GnIpV4mVdjBmc3VrLkouRTUBkFVSheUrCUJbA= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1726497203035991.8047993649391; Mon, 16 Sep 2024 07:33:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqCmL-0003iN-5X; Mon, 16 Sep 2024 10:32:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqCmI-0003XV-Vv for qemu-devel@nongnu.org; Mon, 16 Sep 2024 10:32:35 -0400 Received: from mail-bn8nam11on2060f.outbound.protection.outlook.com ([2a01:111:f403:2414::60f] helo=NAM11-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqCmH-0008UN-3M for qemu-devel@nongnu.org; Mon, 16 Sep 2024 10:32:34 -0400 Received: from BYAPR08CA0070.namprd08.prod.outlook.com (2603:10b6:a03:117::47) by IA1PR12MB6409.namprd12.prod.outlook.com (2603:10b6:208:38b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.24; Mon, 16 Sep 2024 14:32:26 +0000 Received: from SJ5PEPF000001F5.namprd05.prod.outlook.com (2603:10b6:a03:117:cafe::5c) by BYAPR08CA0070.outlook.office365.com (2603:10b6:a03:117::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.25 via Frontend Transport; Mon, 16 Sep 2024 14:32:23 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF000001F5.mail.protection.outlook.com (10.167.242.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Mon, 16 Sep 2024 14:32:23 +0000 Received: from volcano-ed17host-rhel.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 16 Sep 2024 09:32:22 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bgmBQz13vXE0NJiQKX1KeaSrZEbkbADqcGn1BTm3dW4G79K/XC9cP9YwRvYXafwLMo8icTSU4q43AhbbG5sYThwDfe6OxJrv1WRxIZbhAawGOHr67arjRe/ibnK3wkDTkQq0SJFX4ZibiKIbMd6mUXJ2hX7IHcyPmyIE1xG4SNqPLZVijBqrRotoB4zOgnrQ0McMw6q6JT43NBvqj9HsXs2zWzS0SitD7AGyHJJat8YwG7JKNrQPqyu24pA0SJs/uRGE1/VUYmPN6zB/RPKVyzWhwDJtlSI9LZzMc7Iqd2L0RtQPxXT5Jl+jA+hLacRozkrx8tKPwE+AYw97uFcCew== 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=F4C7q8VTSEPI7Falt7FBjBqENOv47yHHkAjOETJGWI0=; b=tPMck11AmDboFJCQzdjZoPj6XqrCviy+fUHOJMiZxCPTe0O1gHbOhE/YlJsMJyAiM5SJWGjmVamAAQxIM0YrfSKSOh4Q6jMqKiQuBesq9OJv5kXs5VEeKCM4OV2AtR6SrjZAzyXwmg2GEMFIHcuTulxHqY2frr4WoR1OR+SgZnO56V5vwWV8H+IDvNQ4oMCdvYccJF1xM+ulvyr/sDksdQ1lyQSjpVIhbtuBwl1feltRm3TxDrS+FXitDzSoNxxfCoVjka25AAiJErfn3J+1c3L7C0pdV89dEFmhWp7u2FgaDJlo3idIXGxl6ElDh2HczYS9LmTZY2H4i1OxfudT2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.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) 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=F4C7q8VTSEPI7Falt7FBjBqENOv47yHHkAjOETJGWI0=; b=BhQ/mz8hVwZ4cT0kpRN5jjUMXdftLTRrbY1M0wF3ODpvQY50WYdQFaA/agcBBC7/BLnOYgSo/UXvZMRiz5TRTzQ/mlVGUXos4IgI3yIDygrnbVFiB+VDSKJ2PpS+SFWxuzFDktF2tNgo1pWAjVcPxlgJ8nzOrYzmUy1mxEjzxzk= X-MS-Exchange-Authentication-Results: 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=SATLEXMB04.amd.com; pr=C From: Santosh Shukla To: CC: , , , , , , Subject: [PATCH v2 5/5] amd_iommu: Check APIC ID > 255 for XTSup Date: Mon, 16 Sep 2024 09:31:16 -0500 Message-ID: <20240916143116.169693-6-santosh.shukla@amd.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240916143116.169693-1-santosh.shukla@amd.com> References: <20240916143116.169693-1-santosh.shukla@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001F5:EE_|IA1PR12MB6409:EE_ X-MS-Office365-Filtering-Correlation-Id: de38d6cc-d918-40e7-aaaa-08dcd65c6161 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?BYkJXDiy2HFsPdkSttTT4nM2WSN8+gEgskOHA1Wp/aFeimNcO+S2Bt9HYC6O?= =?us-ascii?Q?3XfUDDDl66DXOGolHK45yA4iaGMyGlC00eE7Qh5M1/AwrERzCgevuYfoiSVV?= =?us-ascii?Q?MyJXON4GIaU7X1xHKhTQ1A0MlfLqFg2qvgrHJS2doUQ80Rs9GPgacLnSg6xe?= =?us-ascii?Q?ga8yvAk2u7H157kEhKCKKAQpmkykX8AUaHX7QzVSu6cBIiscd2htSEPW+OrX?= =?us-ascii?Q?nkMj/n0b2iKUMJ5sfou1HNlviX/bsvWjCu6oRLBaeNC2HeYd9eT2DoIQ0veQ?= =?us-ascii?Q?Ig2ppoYquG1kVZEd/mVl/tDjQhAMNUbAHoAjlBMLd92YpqoYEejjkwIRuXcK?= =?us-ascii?Q?am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hwEGkXP88WZTd?= =?us-ascii?Q?+1FT6D60QNSLbgtfBWcm51BZY02Q5u39xicpb36jUB2BYuszG9Podnfxsrf3?= =?us-ascii?Q?WLnMKXUd0390I15PMTvc6sos6HcH7Lv+HJ1xtKH8GUv6FdVqSlct5cBDPZeD?= =?us-ascii?Q?qKVCYfErAS8zy50T7fQvHsMNDuyYyaiMb+98a3voe17hzrGaeCtZuHJ08R1I?= =?us-ascii?Q?TRYfgkjLU7cwVSA5KBaDi0nLsDrxmqg5?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2024 14:32:23.7331 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: de38d6cc-d918-40e7-aaaa-08dcd65c6161 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001F5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6409 Received-SPF: permerror client-ip=2a01:111:f403:2414::60f; envelope-from=Santosh.Shukla@amd.com; helo=NAM11-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1726497204448116600 Content-Type: text/plain; charset="utf-8" From: Suravee Suthikulpanit The XTSup mode enables x2APIC support for AMD IOMMU, which is needed to support vcpu w/ APIC ID > 255. Signed-off-by: Suravee Suthikulpanit Signed-off-by: Santosh Shukla Reviewed-by: Alejandro Jimenez --- v2: - Fixed non-kvm build issue by adding a check for kvm_irqchip_is_split() hw/i386/amd_iommu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 9095146525e6..24eebf053df0 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -32,6 +32,7 @@ #include "trace.h" #include "hw/i386/apic-msidef.h" #include "hw/qdev-properties.h" +#include "kvm/kvm_i386.h" =20 /* used AMD-Vi MMIO registers */ const char *amdvi_mmio_low[] =3D { @@ -1651,6 +1652,16 @@ static void amdvi_sysbus_realize(DeviceState *dev, E= rror **errp) memory_region_add_subregion_overlap(&s->mr_sys, AMDVI_INT_ADDR_FIRST, &s->mr_ir, 1); =20 + /* AMD IOMMU with x2APIC mode requires xtsup=3Don */ + if (x86ms->apic_id_limit > 255 && !s->xtsup) { + error_report("AMD IOMMU with x2APIC confguration requires xtsup=3D= on"); + exit(EXIT_FAILURE); + } + if (s->xtsup && kvm_irqchip_is_split() && !kvm_enable_x2apic()) { + error_report("AMD IOMMU xt=3Don requires support on the KVM side"); + exit(EXIT_FAILURE); + } + pci_setup_iommu(bus, &amdvi_iommu_ops, s); amdvi_init(s); } --=20 2.43.5