From patchwork Mon Sep 16 14:31:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Shukla, Santosh" X-Patchwork-Id: 13805538 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B3063C3ABB2 for ; Mon, 16 Sep 2024 14:32:44 +0000 (UTC) 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 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= 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 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 (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 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 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 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: DA74l9tbU68n3g9CkTSzi9IY90NslqAuHecDi7Q7XlvDnYIZlkwG2fLsqoS6pvfMdhAuax54H1wSyUoITJz9mz6jO3KTSc3A7iJKe/xdl1sQ7PoyppSMFJKH44gIYQgA3Z1xLmoln0vP2OaClGSUL08/t5YYGIXeY5xeMuu5uoyggg6gGT2Ux5EXa4v7uYDEdlXmZoHFOaJTZ9PX1+r1UufnHjm1YafoALf9dsoFIqpkWeHlU6eJohnZ87w1Yfca2/kQOSPl/EYTfFhry1tRxNHdnjYyqdLB3luFdxCAs4ZHGVr+1d2qiyIK0OvA8QHVAx5aw1ZS7ExUnVOGebJ/hPnmhDmQ0pIPPcka3/eF6+feDmjiLmjz9NVE/7v3cNhtYeO9Pc2lSgG2yaRu78fDsK5zkKQlNxxFkANhSbL+d7UYi37nNNgJIkSUE1C0VufFZ0YyocLJmAvXN/iJMBcmlRwQdOdlvg2cJkV9FPEBXlBXWjIlrr4C/EAtkh1uRcsdieABpz5BYGhmPqDr7likJuBuoi0t3xdZjiFLw7MdyKbegaQBVyvCP3ZfuP8jNPgekQnOGzNrfD6kQg2TxR1w/iRaZDiAA2bUdMc+2+Mirsc5BY343fzRHI1JUtrE6jPhUzY5eg7b8Jd17bUOd5banpLp00ZGEnJieqgkD9uCJ/FQgfBgQx6UUKDr1+mulYwbFLr9bZTSfzxmk4BRHl2as80Xh3ahzbWqbxS1CfSvS2uPdxNjgtFAYXPc8XcliUKADfu2L4jA3p/TWzImXmEz8sG5TnkjtHuPB/MzNN3B2ZtGAWlS7oVczr0QD3pT/6SJ7nw+c2P2WsLDse87Ug4SS8EFp8FUeVseksRiSa9B4js+tNsHDRQWWXTCE+w6EKBq0rIzQ0Thdl+zUzybo0VZnF+9/aQG5EhNSJistSbnYRNlnlMC0xUy7XdPjI3/SZWGKQPEidNdNw556ReHcCR9mh9uQumR0/wdqLt5UcNa8GPzbNA6wfeElJu/Iv5wic5mjq10Dzn5M/OLWK3nt8JBBqLfARqL7s7cNV3VmTeZbi0M0Gc1htPKgFeZ2/84G7+Ui7EuQaTXDRNU3QJbX+KMlZYsb+Tpye706ceFpDXI+x3zf0N4Pdi5Blcuuc83spANofR1ySCSQO4P+Bilw7yPu0P3pmdhM4tQg4cfS1+ds9o7svatnZ0LoFRuBCYfaK+V+dNEGWlOgBFdkOQ2M8yQXLtkdyD5hPN4l1sjBhrcyinPPjkmEGxHerfI026r1H3TogRwQaZ1H9e97weem8msq4llkAN2AATMQXp2O9Kvo3z2siRZFveMl7gJCdnxFJ0K5q4UvnIn2HmT6d3lewuJCMFpdDPKTe3QhHqX+f1/Xq/TsE4fVijaf8LQk/6rKHAN+361moJwMZx6mj/Ob0B5nWIToO7B+3psn9IoT5zBl/RShjZojvT7cbYKY/1nQNw6 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)(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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 --- 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 *linker, 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 *linker, 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 = amdvi_host_dma_iommu(bus, s, AMDVI_IOAPIC_SB_DEVID); /* set up MMIO */ - memory_region_init_io(&s->mmio, OBJECT(s), &mmio_mem_ops, s, "amdvi-mmio", - 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 */ - 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 */ From patchwork Mon Sep 16 14:31:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Shukla, Santosh" X-Patchwork-Id: 13805539 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B2F40C3ABA2 for ; Mon, 16 Sep 2024 14:32:45 +0000 (UTC) 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 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= 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 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 (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 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 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 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: Yp6+7n1pPD8hsmrrr6mlUVJ/vCgVwBmcTPsuAx5SEU4UMcWVIGYYM9ADGtNxu6QQyWmq6VQT0SxRb6OeT3WbVf5zh91qEjyQgthXjypiiac9j7wVOhMjLRBwe/Pay0hbxjo8tro2umGwYQMup9S6eziXvKQKsQxk7paCaQz0Xp5u6t2iYwemmvXzjsYIIk2S/SKuUUdqbR7HI75xRPOiwt88+60MxhZ68vFpERrruWGz/PAiLAtZ3DG4lUSdcCjlH+/69zkRI3mA71tebbHjX/PQPKuSFCmI21EiM82rQxNrpbu3ceHId08vr1L9l5wsjmXmHrWDaDTt+vNa8QqoiwgYje+DbJ7gSw1xuxkBy/tMCbHY7r4o8AICUmpaqwGg6aNo/gGkeV0HxbRLq3Urc5HowiIi/K5TCPND1huHclH18fdB5nReYfe9i2fXgED4oo0XJbAzazrWVcSZ6S8sPHqCVF4ipSBPHBY60LNA3XscaLoTFgzfLsE/zXBFzv+ViQl6cUH9YFa2jx68SywBheJrDva/QAtRxek2KjPoxYBoqVkl/0Ago+0g0QofVHEbgTdfndNL/quG+NJdzGx8KYRY31duEq8eLWrSCep2vrJisYZt9CrNOYf+QqrR8oqHWIGPOVx/RwPSiJMkp+3b5gGAg4s8KD0ZwikQcQgcuiHWo+QqIEbHBxN8CZQlwurZ4eVvVItDyxakCkFh9Q3nGON2zfiqA3VnNSJ8nMTkErFbNpZxrrNimALspOJIcjJ3HOsMGjZVlwwLjbYGMHISl4MwKbN6Xyb36hZhCQ97bycR/BV7FJyJCVk/jsMF0aHZFtk8Jns3ROn90b87Ho8P6ktnjlPms4avC2PFVzL6WSQN8lm0uFACN5KhGgjK1Troa0Z05OvmIxwesqa5xFNgBBYiIvjQ5+/B1V0xQERWcqyWCXV1zyIHz4oadM45Kv1JubgSJwc1O6NCzl7HCpTyBjsrhRSvU6T50zneCQnkKdirbGPzAdWyfeMXgIGrlEWlHTuJcreRbs1aG8oRu0VsgbwUiacyUCNrvMfZfz0Fud1CHBBowUoSDZ442Jn6Cv7XW1FeMvjsMjKwpUwO2XSqs7vvq+eBNCrBM9W+HR5U9fCsnMmazB9f9eEk2V8jD4HL1TnZZtDAu4iab+LSjd2dmMh2pstrHDKmyG344pbvTgR2APpECEMS8SJ/Lr6f6C2BYWcKVJ0k87FevfB9w3Bgp2NKPyUy+rVZ6KEvO/RvRpXDoo/PCW4S8dLMTi/snl04URP7JmUlMxPWk3XoLJe/HJU+SGmgO1DG1cHFvH4BQdu8BywZdj/DFJAqOsxkWLC1pHngPGtDHxTSFbNIxLx9BeITh2fBMekgXCiHJLexdRHh2XZ9qE6WauwZdzqCbe2Vm5r/jZg2vylGNALYoWm7wRvk642ucap8fRNMx5JbvHCv3wROlg7Z+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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 --- 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 = opaque; AMDVIAddressSpace **iommu_as, *amdvi_dev_as; int bus_num = pci_bus_num(bus); + X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(s); iommu_as = s->address_spaces[bus_num]; @@ -1436,13 +1438,13 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, 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 *bus, void *opaque, int devfn) 64); memory_region_add_subregion_overlap(&amdvi_dev_as->root, 0, MEMORY_REGION(&amdvi_dev_as->iommu), - 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, Error **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 */ 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 */ From patchwork Mon Sep 16 14:31:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Shukla, Santosh" X-Patchwork-Id: 13805542 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DC562C3ABB2 for ; Mon, 16 Sep 2024 14:33:35 +0000 (UTC) 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 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= 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 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 (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 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 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 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: saqN4pTtxV3Cp6d1TDZPMhm7AWpNxUVRI/qdgF2qnKBxqcHSTylmizW8AjRquVVFc5SM+Av4jKjOm0Ssu6jNNjpdxwr+UT+1819y/wununYK8T6aeYOcv/wWn5sxBRWNsFv+6TqU2q6LbxCdb4wcuGuVWGRqPreK/KOkX923BGlNF8bW8enHn/ygbp6UNotnOcwEi+/ZlPnAPUVh0IMHSprtfmcGb5xjryCONFka89kf38yjCj+FJZmdL7YTPSCz2/QrWvSPrm7nG3G5UbCM0p/lvhYRSaLnr0w/ghKKKT6eKsOLZRrEK3CGJHVML1l/n0gDHrkH2dpjv+gUsMvDsRTZfyxxpATMobS4oOV6zfRoj9gXTwQ/o+YbU51dO6f1kSCB1QpSy1Btgf8dJ/61o/9qw44pUZer7+VAoL06Y/AT51ggPv1uZp/I2OkCCLwzMtZwp0wSpc6G3XI8bEX4xyvpKQKurp5JYvHL7Iglc35/7a6HT6E/Gzqz2Ug+vF1zFY254bGeCSE92QwNkDvBfEHtnAc0RbOuqp50mjUMgRTErzvAMZCa7IhxeNC8srP6J+Vvg8Um3OGdCGZgX6qnIR2f+j56XI968NTEKfNw17qx7IInc/MCvqEc6QLnM7cC7CMYLZq3lxw3d0SfuqjAUNZyHiIKGzfDKFonaXzBlCv5Y91Sm+CQoAl5EmkIJnfd0BVicYIRhIaBTwllQS/fv7EQicJ/61f0I8nXd1w5q4n3QuNolzY3Ysr0pYUr+AfAerxrSDzglVIN6MipHc9+F0rdl1iN9x1Pu4RxK8EJfiFWjSjZwGCBGYszR62TIje0CeSZ6k7ttpuL+z3wIAwvqfJflDdpqfVGK/iQsVe0WYIQOMDHRUOXZ+buR6v5AfsFgyXzL6NiDSgAaveaYUXpRPAJy5KPDdHQbxqwZX/kCIRB9c/yefyzv9tm+e5ZV8efZt2xYZ8Ixq2wnndRVUvG4nzm2n8pD8wl/nQRejVmYQsfkcMg7Bzg5SNTYsQZT6Yshdv1cRG7mYPRUfdjaBfvFPDG08xvRjrtD8zgNC+spCgOPdYLAfyJ0EtjAJRkoaS1zjTT3InRd9im1modl5+Jt4ZzphxI20+LopxxgpHWk7mjxg/NOPWo3l6P6i6uEnqNR6iL4fP/JmvOw0LlAQAmIL540vGHtEYsjDNqHkzazmq94FuRXNX0YD2dGDlnkxH02h4o5v81SfsPvQ7wT0GRcD/vv9B2pJwvJRKKiewNSSXae8KWbZcygW2Ba8uRS0u5a8hf1YJUpHFD69KdVj8E70ec+LMY0UV4pMFK+J7Q8hA5Cqqq10GA2MkK82wPgcZXq45rKwgJ8wlXk2/QLgDXDppJ2HvKtpvLqvcQu8ezyLfTqZ1n48io95weSWPdqvmIH/wD5LWuea7Yuzdt6mE5q0QDHo7sRNF9U3ANU2efYBHvbskZw6jfKhAtFKfX3PgA 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 --- 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 *bus, 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->iommu), 0); @@ -1472,6 +1465,13 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, 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->iommu), + AMDVI_INT_ADDR_FIRST, + &amdvi_dev_as->iommu_ir, 1); 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, Error **errp) memory_region_add_subregion_overlap(&s->mr_sys, 0, &s->mr_nodma, 0); + /* 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 */ From patchwork Mon Sep 16 14:31:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Shukla, Santosh" X-Patchwork-Id: 13805541 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E0941C3ABB2 for ; Mon, 16 Sep 2024 14:33:30 +0000 (UTC) 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 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= 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 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 (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 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 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 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: DnwaETVQQLrSzzhZpW3g9z2AgWPGBOHee4LX6bPR6Iqvk7/yZp0T8Hcop27/S15o/uTBP6WVs5nhKVgJIJxbHZhdLH6FjAgxK7m23TsARnk01pjvx/PMBq/QsbSiqMI2opFGhUIcrQ5nBI39D1YJNLzqeGCS2bnrYKwUeR7ao8BaSEu8Rof2KE0BYAq6f4qHvSZ9YDfGE/UnUFOdwfCQQY/NplPRrGrjIJ7xvVnODLFx3i1IdJWgnsN3OVhEWOLzY6RqEKd7IGnM6K08eMl/S1VjCr+W7ykR1ZMGX+wiIsrJ0S2mzDbXSkGzsieSMaLUqNQ5+gDNOUwYfdiBMesLXCFJ0e21c6BWhXqLoZqsgLitEVNBV5tkAa/YkLSW3mQqoEb/Tleu2fUQgVLvdNZ81+yDfmyP9LPWfVQKRwPMK4zPDdXphcuW/b6W7rr9eUjkbaCE0ibS60x7uUZprUOi/DQBBl3LtJNLcFjTnG4Iaw+Aydkc9jwqTGZeeA1c6JCwZElg28wIMHbRnHGAdHMMBOjWr1whsRSAflRBAbi8c2YWvkh6RK9muvylYCd9ztQD78ABVAH2MKRVMd6E1gg6jIZEmr26f2b9TFaoUbWg0Am+qdgX/50z4FQnwMd7mRBK2905dqTquuqkONE1QLMD9QRh3+3gzN/9BzbcIMl+I/yH11BZh0GucGAas9tpshapSreFeN8l0EntkwDWI7SbJ0IsP3dRf11W2+gGSJmGF6OjnHUgCJzlS8nXJxLryTot122Lnq1U38AsopI8WvEmBxD98alnvcgl7Y7GwBCD1XjH8GOiixj6iVI+3JARvf3tqfwQ9dsqCT09WTvftr36hsWMm12s9Ll1ebKPNw6QNUabeOgKw+GmJnbNu+xGJ0tiH23dz0+noIcbjd4oqMYA+b81XNqvtJUXz0sYdFk+CfHUoqXocL2tOpqRK1e+svFMBylPSs/PlLP8w82wS8ZAHnPU1wWlcDpTMtkL3BFjOloAEsUVZM60H8VLyLgHxhNGAmHS6W4uPfL7QPaGXXIUHLp94g4vbU1hRQ3CtuTcuqNQdSY4Gv+YgoZNKZ1VvKxfJXLGxFEiYJRNd4GhB6xHNn1zC+m0wBFg7RMux1+UJQC1JgzIDJvRX07pGTDghDEKW0f8DJC5QIKq/KLAJgYrWm31bduvxpkmJZXhhOjURT13nhJyJJrpjNMxADpBp9pIMwE2Sb59Zbxsed57uicY892/62643vjQIUlpMW/NO8/V5B+fjFwmIvcnF+8vUGH4HF7bWmtooZhT5ZKEKR8AbASOd8wFNRwkeVB5xhH+rUetELE+HPMR9qIgkPjHjT6WttrhPmcPvujRwHY0PutPmkqByFFtDfACYKxJzQYUunrgJtVC6UHfYZf39hIzyIrJ5l33DCA26rtLmr3xLDOQH1K9adIrds0O2VdCFTN870ylJIZaLivTZlD983bDUTC+ 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 --- 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(); } +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 *cmd) s->cmdbuf + s->cmdbuf_head); } + /* 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; } + /* Notify global invalidation */ + amdvi_intremap_inval_notify_all(s, true, 0, 0); + trace_amdvi_intr_inval(); } From patchwork Mon Sep 16 14:31:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Shukla, Santosh" X-Patchwork-Id: 13805540 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E368EC3ABB2 for ; Mon, 16 Sep 2024 14:33:22 +0000 (UTC) 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 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= 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 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 (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 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 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 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: BYkJXDiy2HFsPdkSttTT4nM2WSN8+gEgskOHA1Wp/aFeimNcO+S2Bt9HYC6O3XfUDDDl66DXOGolHK45yA4iaGMyGlC00eE7Qh5M1/AwrERzCgevuYfoiSVVMyJXON4GIaU7X1xHKhTQ1A0MlfLqFg2qvgrHJS2doUQ80Rs9GPgacLnSg6xega8yvAk2u7H157kEhKCKKAQpmkykX8AUaHX7QzVSu6cBIiscd2htSEPW+OrXnkMj/n0b2iKUMJ5sfou1HNlviX/bsvWjCu6oRLBaeNC2HeYd9eT2DoIQ0veQIg2ppoYquG1kVZEd/mVl/tDjQhAMNUbAHoAjlBMLd92YpqoYEejjkwIRuXcKamBAhncThPDbtbrhi/D4iKYcTgotL44q6bdqrQg2o2ZYLiUwZKtIVtsJCTbwvHTLJcWAYvqlhUiHXBcnvTfQcB4MZmoJK+XZf/7T3ugWkklbMKsu5tGffp4uvn3qEZIF5rZnqZ5iZAMoHN5Z1NcEcbcGJceIJHZO+Fn5K0BTWKPd3QjD0lUKIkdXUhUB01ZRx9GmUbMKlrkp0LghFsiw1pGi5kUrVOwqZauaUrz0k2p8cESCyJRgNEzgVLOpLxrayPy0zkWoM44BGLte3lGhNlavRQwLkLwXmaKOPdGoAXI8nx1cglxbkuxvXgwCQF1hnWD2ns/n1/0YSWJJkAWeENphK/aZS6tprXsW1rGzpGjakCQ+/MoV1jCWWh4QQSJHS40M7PfC4u7q/pK5tqBXXVc5HIL3rpxdOrQ55T/otMfdb7iCt1npimkMWMedXZVBuR0tA+BuARA8Ya0KeA1VRYlMBArswLHC9wsP6+VnLW08y5a5RH161Xpg7tNA5V4SQ4zuWMZv+cBzwzr0S//D2bM0yuSs7CGL4d2o5oAcTCfpruCT3bo7XmiIwrrJc51lyBRJmKvtSxIo09AtaxVLHZJ/zWSkz6QgRJIyXT50tIvxqz50c6ZT/H/asbjSdTVS7sHThvf4IuBc4VGM1B1dpQBgcD531SWcQuEuJYbK6r16P62A729LalrZVmgqXUcPMPjGg+HNfh3m3Y8IBBCjYQiMq/Y4emxD85qOiF8S673dKWiTU8/qi0uLJa9joFQuHgBRevv6CRVh0GmgDFvfqkhOp991KymPeaCHlz6NSY6xURlPpwnHkGFG/iTDR72mWfXZHTzQaYJ9XyzVQtFPxmwgw3XT9EMSItfid+TzxoOWNUNZHLAfUOPhwEGkXP88WZTd+1FT6D60QNSLbgtfBWcm51BZY02Q5u39xicpb36jUB2BYuszG9Podnfxsrf3WLnMKXUd0390I15PMTvc6sos6HcH7Lv+HJ1xtKH8GUv6FdVqSlct5cBDPZeDqKVCYfErAS8zy50T7fQvHsMNDuyYyaiMb+98a3voe17hzrGaeCtZuHJ08R1ITRYfgkjLU7cwVSA5KBaDi0nLsDrxmqg5 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 --- 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" /* used AMD-Vi MMIO registers */ const char *amdvi_mmio_low[] = { @@ -1651,6 +1652,16 @@ static void amdvi_sysbus_realize(DeviceState *dev, Error **errp) memory_region_add_subregion_overlap(&s->mr_sys, AMDVI_INT_ADDR_FIRST, &s->mr_ir, 1); + /* AMD IOMMU with x2APIC mode requires xtsup=on */ + if (x86ms->apic_id_limit > 255 && !s->xtsup) { + error_report("AMD IOMMU with x2APIC confguration requires xtsup=on"); + exit(EXIT_FAILURE); + } + if (s->xtsup && kvm_irqchip_is_split() && !kvm_enable_x2apic()) { + error_report("AMD IOMMU xt=on requires support on the KVM side"); + exit(EXIT_FAILURE); + } + pci_setup_iommu(bus, &amdvi_iommu_ops, s); amdvi_init(s); }