From nobody Sun Nov 24 08:36:51 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=1725444287; cv=pass; d=zohomail.com; s=zohoarc; b=GDpd2Vk2JOnUFDFMv7YDIFZ0E7k4kCxqo23vveRmmu4AsAiCTjDh573Y2mggEskV3w0GfyODBSHoUrY3MbStf186sfJdnHR7JUAJYxCYyoLxLAHmjGilYICUWhuaJTsQIMYP7cfUXB6yzuxCZWtqt/Yb5QedZaQ0+niURLHXXVc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725444287; 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=+zWKDIse7CvL4yG6ZFopdMjmqXqgkuvCwLUX+oR0vfA=; b=Q7e61QVEbjNHBCrEzloMZB3LJcR0uVOhcn+4N8qCQl0Hh55AMWpi48zdi5U5QRkvX1QCI9rQmLS7DpUm2R6V1C7tIcP5K9JQeeLxhxnCKk1alg6IhSup2oODi6Wqn/WEpHkMETyhrR8UjLxGESy64BbOXdl9iFY92j5Z6CTN9MU= 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 1725444287231198.4108592875807; Wed, 4 Sep 2024 03:04:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1slmrS-0008WU-6g; Wed, 04 Sep 2024 06:03:38 -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 1slmrQ-0008Vx-J4 for qemu-devel@nongnu.org; Wed, 04 Sep 2024 06:03:36 -0400 Received: from mail-dm6nam04on20618.outbound.protection.outlook.com ([2a01:111:f403:2409::618] helo=NAM04-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 1slmrO-0005vQ-4E for qemu-devel@nongnu.org; Wed, 04 Sep 2024 06:03:36 -0400 Received: from BY3PR03CA0025.namprd03.prod.outlook.com (2603:10b6:a03:39a::30) by MN2PR12MB4269.namprd12.prod.outlook.com (2603:10b6:208:1d4::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.23; Wed, 4 Sep 2024 10:03:28 +0000 Received: from MWH0EPF000989E8.namprd02.prod.outlook.com (2603:10b6:a03:39a:cafe::25) by BY3PR03CA0025.outlook.office365.com (2603:10b6:a03:39a::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27 via Frontend Transport; Wed, 4 Sep 2024 10:03:28 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by MWH0EPF000989E8.mail.protection.outlook.com (10.167.241.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Wed, 4 Sep 2024 10:03:27 +0000 Received: from volcano-ed17host-rhel.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 4 Sep 2024 05:03:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ypp2bnUSeYScZT0rmVczMdnBIAIhA1o+HiIpnKBHTKV7DVpJqcw5nN0xIlPf85Hc6RfC/xddfYcVrsOGs7nI6MiSpqHT+u4xiYi0guhwLbCwOqVnct1GPW/091BEkpGNWgMHjkdAgqXS98pGtGwoUB0gjZ9KL5VLLovvdPfZ/vGhuC+Rs+QGwUu5/5sKi/iXLnO7vIzzH9Sanj5KMe5MRyiKo3QKEQmSQvnYoYcBQOIZy2A1aHQW76CmaciLfzw3dUeSNNOdCA3g5lf41yKTbEACRvU/PptQEKam46N6GtmXYMX9zsnM3+RSiE4bFWl6bZTT+GOu1Ht8sdqk1iNytA== 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=+zWKDIse7CvL4yG6ZFopdMjmqXqgkuvCwLUX+oR0vfA=; b=LoKmaPa0fGOewQ03B5tMWlC9CoosShey84MRFuKAZg2HLUAD87f85ycOpIChRQWa4L671UVOitm1L+T6vVn2D6U0B/sf3LFxw9Wghwzpp+gxGv/VASz554V8Xp2gn1q6eBC1eYN6rPJ9b5MQsKcvfjU6U9cDJOq6bdXBEsOjPU2zDJxtfYlBCYm9VCfz1ULJw1MJc/6aIPYo0Gd9Abg8dUpXxwv8PRJU5trCr9aHii9bC6C54cxqj8UypDtg8b2zt2R7zTRGvdLqn7T7hpytNmbAYs1ceXEFr3inTkPqoC9to3Culj9drMPwK5/VQmtxeXUpiPWmvrJzJMzwNVaBIw== 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=+zWKDIse7CvL4yG6ZFopdMjmqXqgkuvCwLUX+oR0vfA=; b=2geDHgMHAlqr/R8+1mQqL/LGBDxx1JstdK/ysuIR0akRIAhRW/04RZNGnO0AkGC/HJc6ttqbbMHhQLhB1aYKEVNUrQA8PoI1G2wvG8vR3dYqLlInEWtjBZJamWTpdreF1qibAsCmaZeqpW1mUOms4pWIv968F8BRC7aXhodVxzM= 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=SATLEXMB03.amd.com; pr=C From: Santosh Shukla To: CC: , , , , , , Subject: [PATCH 1/5] amd_iommu: Rename variable mmio to mr_mmio Date: Wed, 4 Sep 2024 05:02:53 -0500 Message-ID: <20240904100257.184851-2-santosh.shukla@amd.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240904100257.184851-1-santosh.shukla@amd.com> References: <20240904100257.184851-1-santosh.shukla@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E8:EE_|MN2PR12MB4269:EE_ X-MS-Office365-Filtering-Correlation-Id: 75994ff1-cd88-4e98-3a35-08dcccc8d268 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?j7k9A8W2UcgCT/p+dSwvXOTGUYX/MQqmynqID22aM0ZXoFYfUFRwJix7niLH?= =?us-ascii?Q?waBheOgO8b5+Ta9Z88NkG3a4icS5eNt31KGHWg58sY0MCs4un4TASHURsgmK?= =?us-ascii?Q?9fobL3h+NRXzUtf6WQ5tlJRpI0FRTuAAG2gNyv32MfGWh9YWMlyesz7cCcLl?= =?us-ascii?Q?Fw0touBPwny8DqqvkncwguSDdxui3nipXOlcLga8ceIdnNGaMviVq+knaMN2?= =?us-ascii?Q?/enbqZQVO5Ijjh299BogiyfLvHcKD7k/8zDdj9Fv65ESJqL95SElPbL/xN4F?= =?us-ascii?Q?IfjS5vGGIi0r/CtwSjpBMsLSXn7wQ494HGx+EVlq2KuaThfP+/uoEQVULjZt?= =?us-ascii?Q?nJovCA47Ngw012F7bq3mYde04sBP+2Lahyc2HZyuubFjcNc+ZJ2lGHVfWmIK?= =?us-ascii?Q?/93yp6WQDNgdZTrKwAzlYoFiZdeiofLfO9qE15p6OXN7g6kJya4D3F4+KpqE?= =?us-ascii?Q?+jmmBnNAw12RiwTwl8AAb4VMQTDjg6AeAV70curYJZK+pUrhGxmu4soO4wY/?= =?us-ascii?Q?cKND8QnRf7VvQkpiwKVtSRX9bTzzzRP6ghFzXU6EM9NDWM+J+CW6JGWT2lII?= =?us-ascii?Q?Zy3XQ3OpX9kmRI+IIzRK4ZR6qa8IFZtSptloFJDmjRg6pIT26WHKbYAjv4Yj?= =?us-ascii?Q?YiNjFj99J2zGiFP1DPzdGFHf6q4xO0isFMxneH3smuUP+Xdb0sFJ1a0XGEtg?= =?us-ascii?Q?SMRe78vrXVVKc1A57Eu1mAQH27+qjKacI359LXbm3fsbAR4z+gheoJUqFkIt?= =?us-ascii?Q?GxQdEY2JcG2TJQguGcp8b8ZlKLPodAzs7jpztBxFI/XoESspSOuRBjtM6AO7?= =?us-ascii?Q?uDiA8ShP/DsjqUapecCtrSJyDM4Oice2amzFKMa8daydtWrNDkn4Xbc0xDG/?= =?us-ascii?Q?6rQtAk8/NxXrPd+AITpNn2ILA2Y1wgwUDsZ6MwZgnH1RJ+Y1ygcgIPH3bcSP?= =?us-ascii?Q?8fUz/BVcpoL4w1h53ZYRmv7izKxRkHHfpLH8yd1P/pK+8KERFE4c3fo5aJEK?= =?us-ascii?Q?PLJo2nb92GVqvHeyBf71awMqV48twRdPVG8l1tDGjtGEzH49T8MxKtp+Az0Q?= =?us-ascii?Q?Uu7jNCI3DX58Y07rv4FT9lNH0UJSKnTMKuMYhJMNM2HemNWwJEuj+AC+qu60?= =?us-ascii?Q?QVHfl9Ut/OT5HaZdT6qIf+S87DSnS3jQTWtuUU1jUGMWK1BTbzxAN4AD3I38?= =?us-ascii?Q?xmCRBm8ul5JVPEkF7zusOZaVSM1aM87V86YqtmIBAY7an5SoCJElT58jdi/F?= =?us-ascii?Q?cBdQoP+OJP+VuKSBVNb8sCkI4D/u8EW6pFNZ4OiTUUvY9ZWVKtkNXP9mGaW3?= =?us-ascii?Q?usk0N+XJexu5jCvXAygYiUT33DlvAeL4EqoYj4VbFpKlL5lFv891bHqJviAU?= =?us-ascii?Q?pxG0qewJhcJAZ6FpJ4SEE/UqfJpfsJLsojbNQY9aC7T7N+PGSpKFlbWaDGrx?= =?us-ascii?Q?+RSEcrIrK3yEqgBRMPbKu9cVNQOSdZY2?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(1800799024)(376014)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2024 10:03:27.3308 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 75994ff1-cd88-4e98-3a35-08dcccc8d268 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989E8.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4269 Received-SPF: permerror client-ip=2a01:111:f403:2409::618; envelope-from=Santosh.Shukla@amd.com; helo=NAM04-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.142, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: 1725444288400116600 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 --- 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 5d4bd2b7106f..032fb1f904f7 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2397,7 +2397,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 */ @@ -2432,7 +2432,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 87643d28917d..148b5ee51dba 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 08:36:51 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=1725444337; cv=pass; d=zohomail.com; s=zohoarc; b=Vkqtsi177emFscgOKljO071yxIcAs0YSuykPui/SnuvzZIQSl1+OQsC8GiBzDUWYZl3xhKmpbMfmCEcsoAc8l0xiWHuScwooKVDFXc4KfXcmHHeTJVhXcoOVa/TpDkOrsACRtQSlw+C7TVNH0XFhMmjXeNMsMBr3dUMKY7piP/M= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725444337; 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=CEkPYhh9Ha0mFPI7Ylba9YXaKH/58LyVQUwhqZ6/xYw=; b=h7vNh4MYhhYsjsy1P8aWawrTxeeZnT4VQKMGrJQe/iKS0Kq1r30JFIEm0oPAB7OqvNZOMYkFk4mbZNODt1xhKtpQWnIhDSym63FXKPwmVBoHgKwaShbJXNmabowGUVLGKbI5RRmOKbERbWTazmsJ0uzFtxGP0etQibQ15DCv1Fw= 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 1725444337334881.923409725856; Wed, 4 Sep 2024 03:05:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1slmrj-0000Lb-U4; Wed, 04 Sep 2024 06:03:55 -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 1slmri-0000K3-Fr for qemu-devel@nongnu.org; Wed, 04 Sep 2024 06:03:54 -0400 Received: from mail-co1nam11on20624.outbound.protection.outlook.com ([2a01:111:f403:2416::624] helo=NAM11-CO1-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 1slmrf-0005zz-P4 for qemu-devel@nongnu.org; Wed, 04 Sep 2024 06:03:53 -0400 Received: from SJ0PR05CA0140.namprd05.prod.outlook.com (2603:10b6:a03:33d::25) by SJ0PR12MB7459.namprd12.prod.outlook.com (2603:10b6:a03:48d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Wed, 4 Sep 2024 10:03:43 +0000 Received: from MWH0EPF000989EC.namprd02.prod.outlook.com (2603:10b6:a03:33d:cafe::2e) by SJ0PR05CA0140.outlook.office365.com (2603:10b6:a03:33d::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.12 via Frontend Transport; Wed, 4 Sep 2024 10:03:43 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by MWH0EPF000989EC.mail.protection.outlook.com (10.167.241.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Wed, 4 Sep 2024 10:03:42 +0000 Received: from volcano-ed17host-rhel.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 4 Sep 2024 05:03:41 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dmfp14lzYm9mMdno2y2iV6ARlhH3i4I9rG6eRekEiNB+mndPMqm1f8b1t0Atl8CSWh3OVdPN1GNf7aZUhD3I4YDnbXax06+jn8ftH5UOADZXEG/Jr0jZAzLwOua1+/9LnK8cyBpdRemTMPAQdwjFrcZtGA06ntcqLZmJoROpG0J5mAjVvyLgTev167EiC+7zh7uEg7DuxQrx/hqmaQ+odi+xRXd/m5bKYNIaVJMyC4jozfDKYO0+xrfHIUB36jDo7UouxqX3hWuYKG5uYeKuEYty1G/MrT8wRnnz2v4y0kmghv7yOxQg6PeClU3n/G58Z1aQldvlks6eLjgLf3uS8g== 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=CEkPYhh9Ha0mFPI7Ylba9YXaKH/58LyVQUwhqZ6/xYw=; b=PgAl3ys9Rtcy+dxfLvQjHMUnMopExTNUJB3HwsySHTX+qZ+OR23TOoZR1vmOSdJe7RQzcGWza5lqTHVrmLm0fWR6kMNXTM/ioHUDukKkCjHb20Vincfev4dkJt2FlOJi4UE3Utaj1oaQd+StejpXgalqBrJLMKrLMDC6PlMeeKV9uUBGRSSJsDqJwr5VTSKVGdenWuBP7hZ/WwhH73HE8//7S59ma3Z7Pllo3iCUB8+8cYmQJr+ZuxECp8LRKLUmyMS3IQXVIyOjS6yZT+/+uOI+l15QzPwfFcQrkOdNdryZ0jMSN6MAF6ZoEjy2mZbTaW0dikXBWSiqo1A3tAYV+w== 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=CEkPYhh9Ha0mFPI7Ylba9YXaKH/58LyVQUwhqZ6/xYw=; b=tLBxU4SYKAEMtfFUQ8BiHbf6Sr0cIwEazDmRvz0DsZ5gzFmnTC1/rGNPKw5M8EFxEZJRuXOssSN3miq0RU/wohEtJKQ2GewIlRVWMyuUclZEG+yoUvt6JwV7PXdF9MW6c33eTv7+UO1bo4rS6YMtKMGDe+2udAbtL4iLkSGep18= 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=SATLEXMB03.amd.com; pr=C From: Santosh Shukla To: CC: , , , , , , Subject: [PATCH 2/5] amd_iommu: Add support for pass though mode Date: Wed, 4 Sep 2024 05:02:54 -0500 Message-ID: <20240904100257.184851-3-santosh.shukla@amd.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240904100257.184851-1-santosh.shukla@amd.com> References: <20240904100257.184851-1-santosh.shukla@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989EC:EE_|SJ0PR12MB7459:EE_ X-MS-Office365-Filtering-Correlation-Id: f05e22f8-ae55-4e4c-7804-08dcccc8db88 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?nvrHYElMf9VrG7IBFpcJZbcY84M/Ha6qCKXbCnn6wE7M2gXz08c4rtFf0pD/?= =?us-ascii?Q?rjN+kWBgrSAxw7Ir5y6wUEPrNrHvf//90pZlL79Fcb5W2vlL65jGc1oy7STG?= =?us-ascii?Q?2L1vcskMr4qBVdPLfBt2g6/Y2z78IFZTQHDKW7rpNy/aYaeHaebVX00J6P/Z?= =?us-ascii?Q?YgDK/xEZpzEbV7gE4E2mOcfHIVzR3y+swy29JKYB0ct3Svt9blDgyjAA+OV5?= =?us-ascii?Q?CknOQ0x+v/xGy4fEh+THTvCGBgPlzPpSLveuwLEY6ySJlQt+1lxGyQnm701s?= =?us-ascii?Q?ag/0t5MUXv005n/jP7pkvNiqAxjaoMIGHx5CIIqL8fhVNjfziUX6mVZdf9So?= =?us-ascii?Q?t8oy4O4XK3j6gNRFfETR7TcZ/EqrKAgvPRTZi1/MD8RuVaKhr9UZIjpk7V5X?= =?us-ascii?Q?mvxS8RJOnTK+TUFDTbkiz8xc4yuQakndLXibAedp9/8l5ZukxKhr4gfFkAfw?= =?us-ascii?Q?EK0GKryF8zMDVCSSN/1Phks6pAvAEZZ4tJn6CWhQA2Fy0okk5Bns0ahFYXeA?= =?us-ascii?Q?y2gDMcimKtI3CEHGXnBZ9RBHwHrk9R++UeTZSgIjXaeGAalK6fWuRksQdwHd?= =?us-ascii?Q?f0zLnO2rsMxLQU8HdOtITEKzHUIAlfJ8YpnQa2W02PmYu1muplxjku3XFZWs?= =?us-ascii?Q?Sg0vgSUcYGmVIYLPepV00SOC132JYo3pE90RAEQ6X8fDYiKOUGLr14eDeInD?= =?us-ascii?Q?fHaQgGpsqxeJQ5bR+ISFWbAiuMIwUsLARQ65KWfK2Cyi251LGkcj0xSwbT5V?= =?us-ascii?Q?2GvaUSnaydv/j26BUJZfZbBhnYb0Rd1qn9K6NJP6pjV22/V0zaxccdbIyxc+?= =?us-ascii?Q?Rnb5pcYp+lcP63fJlWRAX43YH58z44Bi8du9P69pGwtG1p4WTJwF/a/gJ5Af?= =?us-ascii?Q?K6EY6GCX5iS6p0VBLp5/rsYcsRUtbXSQVTWEnuU9jOHsW0gfjfTqpSuOWuac?= =?us-ascii?Q?E9SraigZ+rtFq0FD9BEHaXRMuEbAfwelv7PyGoj8oHAbQEbxQpMb7IQZDOeW?= =?us-ascii?Q?Xpt8PSYA0aHVCS/VyRRft+dp4dDLoJeeOGKhUTkNIlve2v4wUqO87CJs0iys?= =?us-ascii?Q?8cqo6Opb5H5maPz8ayDtTdrVcZLP1j0Tma8ja6kNBGzs26jLXhJpdhKeVk86?= =?us-ascii?Q?vIrK1k+cDA7B4/z3GXWz2gugk560Vbb3e7sZCoOwFtdhn8Zgs7ipQDW9ZyZt?= =?us-ascii?Q?Yl8ePgKOokXktOCqscnw/YvyD5YI/izTheg0BKvdFYpCn4LNiAspmiwNJ5dh?= =?us-ascii?Q?Cxay4KoPM9Jfl+XrPSXoXaTwGJVRV3dpGohsAkKB9dN17PPtSs3pDc+TdH5T?= =?us-ascii?Q?T3wshAVAj1Zmxgt5OqrEimfT5aRmbbAO5Dhh+9mT02J0ceiUUbjGRgzeAA74?= =?us-ascii?Q?c0tqnIKBB7dc3sdZqKkj9zZwjY9GuEM0pYZ1yZi2cPr3LBo4lF6egKup0VAI?= =?us-ascii?Q?Xf7CW1eiVgg5MskNssfmsvrxl5kFC9t1?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2024 10:03:42.6572 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f05e22f8-ae55-4e4c-7804-08dcccc8db88 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989EC.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB7459 Received-SPF: permerror client-ip=2a01:111:f403:2416::624; envelope-from=Santosh.Shukla@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.142, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: 1725444338403116600 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 --- 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 148b5ee51dba..8f7ebee16ac3 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 08:36:51 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=1725444337; cv=pass; d=zohomail.com; s=zohoarc; b=ZkaXBsfLzyaAlHvGYaUcIXmel9EdPYFipGciLlAs1GGnF3D6Sb0Id8zaCvTCb5VBcxLM9PIoOsFfFZJufTBkl2f0a/zQHw6TypGXPEZL6QPch9Qr4qF+4J1oZoTcPz+ne8xEJDPdQKNwLeT18vbhPj7U8lyl6QLb5QzPIAlQu9Y= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725444337; 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=KYd8tgMbNKETmbVXBwS9GrO/IQQ5w4s2aX4AonadlR0=; b=E7fqayYhjOcN09NHV1WblDYEJXtxhOKfj8iqDk89CiZkBde3B7ggknT8f9wxgGRXFUK5PM7+GgEkLmWmcsuViQWHLe+Gpk8npqoMXvPtZvTYZJJox4Fb6Y2CaEgtrzfGjf/r0rWnrZa8t2+Sm2pJFo4fOMkvOUx8kuNDnO8hqhg= 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 1725444337336144.92881565922642; Wed, 4 Sep 2024 03:05:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1slmrt-0000ZI-Vj; Wed, 04 Sep 2024 06:04: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 1slmrr-0000WY-JH for qemu-devel@nongnu.org; Wed, 04 Sep 2024 06:04:03 -0400 Received: from mail-mw2nam04on2060d.outbound.protection.outlook.com ([2a01:111:f403:240a::60d] helo=NAM04-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 1slmro-000639-VD for qemu-devel@nongnu.org; Wed, 04 Sep 2024 06:04:03 -0400 Received: from SJ0PR13CA0006.namprd13.prod.outlook.com (2603:10b6:a03:2c0::11) by CY8PR12MB8314.namprd12.prod.outlook.com (2603:10b6:930:7b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Wed, 4 Sep 2024 10:03:54 +0000 Received: from MWH0EPF000989E9.namprd02.prod.outlook.com (2603:10b6:a03:2c0:cafe::ed) by SJ0PR13CA0006.outlook.office365.com (2603:10b6:a03:2c0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.24 via Frontend Transport; Wed, 4 Sep 2024 10:03:54 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by MWH0EPF000989E9.mail.protection.outlook.com (10.167.241.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Wed, 4 Sep 2024 10:03:53 +0000 Received: from volcano-ed17host-rhel.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 4 Sep 2024 05:03:52 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jY/jgfkvoPTiz4DGGda32uVRE/WlmD03U1M3b90Rh3WJ+dFtZ+MNVibV3KJOmls5pcucczXCgzlhQXc7BIixyY9UmNnBpFmF3p+nSO+WDQmzyfGIZzYYv9rk9x3pZ2MRhXrKJAaguta43djhHvR6A+z7rkEynaQ53ckiki/xNkZLMxQWn2pZ2p5crI6jBBvt0CLLgmh8bmnTvaZUDGuYtUXFpkYXsoPuCG7+pPwYZMHQnydJ1/sOx0QlYrZNkKkuJOPJ0YF2iIm5En47+IiKOvvYOgeZY5vDLn78l1JyCRXGOuYksfUxj6vGlrNqVWwkgkoxnu9xEHdjx5aNoa/9Kw== 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=KYd8tgMbNKETmbVXBwS9GrO/IQQ5w4s2aX4AonadlR0=; b=GHLLGEPcDxA0OylmKyI4zixed+LVUUzBpkcj3ZkLB1YW/26Sl/8CrfZXgH3smANgVBO7QNs2kQBqEabj/hg7OQc+4Ui4KlS+0l7tAveMZLXPtvxRz7OKoq1kXXOSVFnMZXGkeJoCKz+p11geu/imz4dMtUOrr+6mbvtmDtdSZq96Gv9MZ+ugSzP6VSirzWprHBetz4zQjzLFp9bFwdnjqLRt3Q1Wf4z6udD/26e/85zSx3FDTIXZ12aNxMX5Jr0C5seZO4dOF90XfC8BrejSgjt7lx8ljudkeWM7FfCNHABi3XGSeIFVNknJGPL/2yWAAPnnIsnj/EpG/jYvRDUMBg== 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=KYd8tgMbNKETmbVXBwS9GrO/IQQ5w4s2aX4AonadlR0=; b=4pNLvJfYdL1kux6Tl1fIljmbvSAU7ejv0qKWpKzerxFjaM+ZUCt6Zw7HqMZSYpdLIkBOVYe/LZJhqTDN4FblKLnEdiiSi+9h557QDFPe0eIl+52N5vmUWqtG/KsLVrCxZMZVfBKaSzsm0JFx2qMeRRxgJ6C+9QEJdDNNNplOMO4= 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=SATLEXMB03.amd.com; pr=C From: Santosh Shukla To: CC: , , , , , , Subject: [PATCH 3/5] amd_iommu: Use shared memory region for Interrupt Remapping Date: Wed, 4 Sep 2024 05:02:55 -0500 Message-ID: <20240904100257.184851-4-santosh.shukla@amd.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240904100257.184851-1-santosh.shukla@amd.com> References: <20240904100257.184851-1-santosh.shukla@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E9:EE_|CY8PR12MB8314:EE_ X-MS-Office365-Filtering-Correlation-Id: d7f4bbd3-ca62-4f01-84af-08dcccc8e222 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?mBrETiISo6pLOLBXqhc4Bo0CnkpjagU3opKeiI1T8eSbg6KxjvYhcKADt4vH?= =?us-ascii?Q?46HTKFqBgF5ckxyio0m9HErLHrZvZqxN01/jOVOijCsZhrQ7xn5q3WDH26UX?= =?us-ascii?Q?cesvLh0xiPzeyp4pWGAb336pfGjRscm5uukQQEOoVxsHuiF+33tq7P3GMQQj?= =?us-ascii?Q?4P4DRI6fRNnO0jGKhdjMHPb16iXnGm3SCbLtW4g4aQ0lakXtyS19TC5m4L86?= =?us-ascii?Q?KqeEjCTw3Fm497aFOuZCnGf3CCIHWgpdfqj8v4ikcwDSYDdv2Qb1Ikfo30y1?= =?us-ascii?Q?SzWKUWNJww/GJr4gX+E3i9XEvq2Gsf1+gdtRJf2JFpP/MhUAe3B1I/XmWYAT?= =?us-ascii?Q?2XaUH9VhsDyPr2I15xWOAMkAkqmlwFT14dWl1my9VPMcI8P0TOoHhLL3ZB2n?= =?us-ascii?Q?/Pzmp3YKe16vxpV7sS1/SA8YoGb+yrT6mjGPGvSGPyCmOv+c31JD6P+V5BHj?= =?us-ascii?Q?B1mGCJuQIq5FLaQAx1Gbw2JfWC9a5djo6fqTpR9MxRLogmOWqT9Suxk5eiZH?= =?us-ascii?Q?410f16QlhYRDYMmbkToROKS1/GEaaBgJlbAjoBaw/u2PR4zuxnfVdNaj6olQ?= =?us-ascii?Q?lpHSXemju/hinwaxxTygERpSw8+SuqFphAttOzhgTB6CBY/b8Tbi4GtaLA4b?= =?us-ascii?Q?MTVYvVBz+vkxXg2PONQZ6p0J05Oqzxi2iYOwUcEhLczrPpAOo2mBsAZ7jxmv?= =?us-ascii?Q?2GjZJiVBkQ/mYnduHcgP0+vQvSmf6NN3qIM3Uo7Q5NEsjiYFP7DWFO4yJWdi?= =?us-ascii?Q?5QzdWxanS5ZRdYzTgpUc/liKrPiuuloD/jzm2xOOUOI8eG1BzhvTYotmijWs?= =?us-ascii?Q?z8sWVTH6hB1NKWvQq0AiFsuE5ujdKCFJd03UX5Q8alcbTmrfi09AjS7J0Fp/?= =?us-ascii?Q?sVD34O8TEBwgtfgWHU3pVlnTKEiSLJZEeO9a+Xqljky+eI6pvXFz2PPauLgP?= =?us-ascii?Q?DQY13J0JHsHZws5QNFgr6JzpzHJUlKLFPrULmXz79JnrNgXgbeWYG0P4IPun?= =?us-ascii?Q?n9wsZYCtfeiLyXZbqcJj2WxuRaf2ORJQmrKdDR0nmPbMHfG6B9N0pShQ15EU?= =?us-ascii?Q?IvPOAhRZ6GP0PMOwRyoOCukHrBkuPhCqx5U1ZUpzRjBnVHw9c37zN7jE1noG?= =?us-ascii?Q?fRKTK8xV9i6/lyIgQzwHwjwJVGDwAQDRzBa9k5zUL8IqhpV/nVaDpJECqoVU?= =?us-ascii?Q?LRpMM5tXReOT8ugh4vxkX9RDpIs+qKzHG6fG0DxIR46KhUtn/2HJQVAqzkmQ?= =?us-ascii?Q?3zJbHGl1cyHXNmJ5NY+/TeK7DCCwmn5Oe3PUrLYzEWO29siL6L9K0/CNG0u9?= =?us-ascii?Q?p/p0QhkMuXT4h1HoR/oIP6mGFpeTQmhTsEt0HFzxLdP+nyT++Sg8QeP5xEBX?= =?us-ascii?Q?scNIXpwl3ZahbTUhqAxb8x30lQ5ObzzF0U4wedF9MdldqrP3LiraQyqwicKR?= =?us-ascii?Q?h4yy2u9Fv4Mo96bR+zi6GzyVPeq2kjMA?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2024 10:03:53.7175 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d7f4bbd3-ca62-4f01-84af-08dcccc8e222 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989E9.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8314 Received-SPF: permerror client-ip=2a01:111:f403:240a::60d; envelope-from=Santosh.Shukla@amd.com; helo=NAM04-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.142, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: 1725444338368116600 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 --- 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 8f7ebee16ac3..ffe91dff3986 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 08:36:51 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=1725444328; cv=pass; d=zohomail.com; s=zohoarc; b=X3UhUODIZPZHHz+hHKzAW2WFQk32WNfvPMZVGPWuX2KCEpIV1Fc12cSJet7WUaPqsB/vxelJPLst2oa7QTPrqpytopYRPOJWlrZnnN1K7zqAYcT6yqwHanJURD3t4mr/RJhnghk3iKeXX5lGtbxrL7QzOYgXOgX1LHSZNVRJJNc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725444328; 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=0DlHsow6pooE0FOeI388EBmvdjDgAOq2ToelbU4aCWg=; b=PPpkVe7/s/6e0ZqvJOs5Tm8ILjZydDHH2yePEvWoLKyoVw2a51ALr4nWuo7mULfnPAN7F6541NRalX+qRRxAUM4dAOZGpGgu8Ako8h/5TcskBPvSh3J3NpCTOG4BE4dZEKtwu4TpIyFufL2tcNdZoAgd68zLzW1LodJluastAaA= 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 1725444328005218.5507435776126; Wed, 4 Sep 2024 03:05:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1slms8-0000or-Nz; Wed, 04 Sep 2024 06:04:20 -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 1slms4-0000jc-5X for qemu-devel@nongnu.org; Wed, 04 Sep 2024 06:04:16 -0400 Received: from mail-dm6nam11on20630.outbound.protection.outlook.com ([2a01:111:f403:2415::630] 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 1slms2-00067A-27 for qemu-devel@nongnu.org; Wed, 04 Sep 2024 06:04:15 -0400 Received: from BY3PR05CA0036.namprd05.prod.outlook.com (2603:10b6:a03:39b::11) by CYXPR12MB9428.namprd12.prod.outlook.com (2603:10b6:930:d5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.28; Wed, 4 Sep 2024 10:04:05 +0000 Received: from MWH0EPF000989E7.namprd02.prod.outlook.com (2603:10b6:a03:39b:cafe::4f) by BY3PR05CA0036.outlook.office365.com (2603:10b6:a03:39b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.14 via Frontend Transport; Wed, 4 Sep 2024 10:04:04 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by MWH0EPF000989E7.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Wed, 4 Sep 2024 10:04:04 +0000 Received: from volcano-ed17host-rhel.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 4 Sep 2024 05:04:03 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rroHRAyObnmrXukEzhBakA6VTefnRiIQ0CtZGzvgzsuUsWL3ETAqwDnrqo0ByK3ssw5/vzD5/rpMTNZ8n0H43XIWkfNfXRexMVTB6GJbhTf2wY6cyeLDXqzOhH9TU6ig43mrzqOprFhzkpbRs6vwqp5PICbX8lpe2aAAdWaoDgrsjK/v5wQipB3ralV0NG92erL6NUVisgM808vB0zYnIqKtE86A7gIrP9ab8TIL8ytUPswq3bf7w9ObT/P6kk5o7FI8brKA+nArbu3soxW5Ucj/PzskKKNYXSz1iCTAxNbktjc+GNHcxNq4gfKwAlgav/hvn+C533fr40S5VB7NuA== 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=0DlHsow6pooE0FOeI388EBmvdjDgAOq2ToelbU4aCWg=; b=NwaCV2zInoMike7vEfUnNnmivm1Kq1zXzdeS1SMzRcKez5xDMZEw+tnsxa1RpYFiyMchKLpXlqvPsTjCKWxtkBdf5lCGxFTBpsVlxce5pWZdcI7z6Kvd+xFy+Z8GZLntBC0Y9Hr8Sr36iPuBA5NLdx/Q4FZsIlq7pVP4J0WQ1Va+KGrsuJH6huhmvbc01seCUtlpaAdVQl9HQ3Z4IydT/+zKzcJW/4+3A99O9rJ3qjc7vI8oDCh/HwkbBOIHs/YSsYHBkePFC6UkxDJZApIkXSg6AzBSj6p5nPxOvPRV6Hfc2gY/QjJyHZdkJMY+UMg34dTfwy3azu+Q5jO/mqq6GA== 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=0DlHsow6pooE0FOeI388EBmvdjDgAOq2ToelbU4aCWg=; b=Oup1x2YtibMi6BkXAHSheWOhv/LEISPW8Gu8C3OUgyFIGpWAoUBlQdV24442LaMlWybhiJRO7l2xvgjc99MIgAalDOAldH6aqQavPw5LVMdz4TFP+V63S/LR9M642uvaDADwAwlTvdHEjwsnnum2Qsv1ll88As0f/OtVKVDThLg= 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=SATLEXMB03.amd.com; pr=C From: Santosh Shukla To: CC: , , , , , , Subject: [PATCH 4/5] amd_iommu: Send notification when invaldate interrupt entry cache Date: Wed, 4 Sep 2024 05:02:56 -0500 Message-ID: <20240904100257.184851-5-santosh.shukla@amd.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240904100257.184851-1-santosh.shukla@amd.com> References: <20240904100257.184851-1-santosh.shukla@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E7:EE_|CYXPR12MB9428:EE_ X-MS-Office365-Filtering-Correlation-Id: ac321275-4ead-4ae5-109c-08dcccc8e873 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?mAJimC1wfJ3fQpjQQf1gF5AEP5n6PxqTx+8kuAR/8FGXwhdiXdM4arxXK3ok?= =?us-ascii?Q?Usog4f/V2VygTDLP1pvlURNpbHtxsSaPgROJJDaAWCzviDVWduF60x2cFFTC?= =?us-ascii?Q?9l2C7P45Ok01zS95JIzEHXBo+UMtBJi8FNavAOSyQm/N4GTmXO1n7Ao+/IM+?= =?us-ascii?Q?IfGLQl7M7YfqK4RtjGCGic+7eZvjbOOZi4bGmasboUN3yI676T7DIfFNfnH8?= =?us-ascii?Q?7OgPFr+d54G8aXZD8WeQmUGqF86N0N9HJ2RFjxQlvP/L1ztfF/zgsjmkh2Rx?= =?us-ascii?Q?Fg2xxyo/2PMJvHUxT1lw9Ww5dFskQgGAqZ3mbDoPSvf1GaJbyYBRtMc9tpUw?= =?us-ascii?Q?a133hIrPp+cXQsWB/SLIqP61UAw0Z7y7GpzXQpbMMsX+nDFOqnwQVYD/NWxW?= =?us-ascii?Q?tm5Vphyn2YXtkwlYoZ7d/8ri90MEpu5XQnALkYjwR4bKDCVotk2msR6F7dLx?= =?us-ascii?Q?9JL20ZlNPDtZ94nWSzMrtq05HbsaYr6w5zwgIJ6ZHmRaScr9XCSgyijgZSEf?= =?us-ascii?Q?25fs+R3LunCL/hdV3fSIzJ7UxhcrL1OuomS7/xFKVAmXAjCS5KQdbO+MnUXB?= =?us-ascii?Q?yfHsx1IjhSKIjpG2qeGgRTlhDOod1ui3bEwn/5kYl1zh0NKVlyW98qTgLjXG?= =?us-ascii?Q?H+kgXfTfVBB1xoLkFyoKfAxmTUzM3mt9SL34U8Pp1xCOo8hygcqF1ZsfIWrK?= =?us-ascii?Q?75lCKelAXZHWeJINZJ8gysbbxM/QZIlylFU4ijAXBg6TU850vHCeZIkbaKj4?= =?us-ascii?Q?8gOdcJccpXq4BSA8wRoAefmfAo2LDw9qJrIglO69N8BWC+CAJZzf7onMD463?= =?us-ascii?Q?lmqeTA8M4nA5xHRhLER99rRnNLOCkzDkZVr5HAZmO1nnOmiwKVI93OtidMqX?= =?us-ascii?Q?9/o5QI/IAyazRmtx8jjgtN/2VywzFrmjxtIV+oOPEjHzNuCviHOnu0Fyt6U4?= =?us-ascii?Q?pJH9OxrwVyEjrYeceL63UenAr77MNkMdWYOYMMPrS9CmaFdyoQoJaNwHh0pc?= =?us-ascii?Q?8NWr2lj62+WB9EMXdSxhAC3lBwhb6B55UjRA6c1RqIyAnGJ1hbGG3YP4D64L?= =?us-ascii?Q?uL5oCs9w/dM9AggToAmQtrOKrtRKFfCW7w2ndtjpvsut6kdTD6fwLY3xOaj9?= =?us-ascii?Q?FtNQnx4dMqTi+HzujrYwgLk+z7lbL1d81gTtoBFdDmC4vAsNf7CwsjMh5bhj?= =?us-ascii?Q?kpUcf5BUQuGV1L0Oyhzf7Ydcb1otviXLtVEI3j8gDDMjcQbtBb0xCt9ApXdp?= =?us-ascii?Q?hr7LCjA5RRj2/KtMfKCOM4H3HRDSh8pAn0UO/V91xaKXmdApyp1n1AcB6CBK?= =?us-ascii?Q?hO0cPFpOjNW/F9kzspXymIr23OU/3HLmG66L071PYJMz5oA62pyJAM3SKSby?= =?us-ascii?Q?9TmCXTgHjrA4l2r3+qZpWKarK/TXSswotaW9E0WxIqzcJY90gs0Sjc/0brTS?= =?us-ascii?Q?+R1Q9eczbN7y+1NTCFtDeN8c/cPnRjvn?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(82310400026)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2024 10:04:04.3429 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac321275-4ead-4ae5-109c-08dcccc8e873 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR12MB9428 Received-SPF: permerror client-ip=2a01:111:f403:2415::630; envelope-from=Santosh.Shukla@amd.com; helo=NAM11-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.142, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: 1725444328291116600 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 --- 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 ffe91dff3986..5acb40fb909c 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 08:36:51 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=1725444329; cv=pass; d=zohomail.com; s=zohoarc; b=oEZjAnc2X0J5AAQTUVADJ+89ISwr4YAxGcEkDh0nrpsPIoIKUEKv3ExLAA6kDIuDVgY1FOZoqtT4AZYjG8JjGg5w4Od3NpjMcSWMlQlqvqaF6GwNfWZG9rjh4XDZ/p8KObnCoQcGPlRVD49azwpadP3d+cSkNtFq4AS049tLZ/E= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725444329; 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=yKpo5reCdMBQyVpNACQ5+3WJ3vz0OxoBeCAfX166Ppg=; b=Dc5cFY3DN/ytBtCj72Ky091THeaZ70diiLvWbkdTv6PDECWEM0ixCMaz1kXuULMLw4tVR7jGvBKmYnXAf8kIYr7G6t0kOFr/vo31Tsb5NySfPf4u9oojmuJoNR/N1Xxuo8LDjTHDNLWaI84xcTmUtcbYvTCJlLLkKOpJyG6zepA= 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 1725444329256784.1187474203789; Wed, 4 Sep 2024 03:05:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1slmsG-0001Ai-Cx; Wed, 04 Sep 2024 06:04:28 -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 1slmsD-00011S-HO for qemu-devel@nongnu.org; Wed, 04 Sep 2024 06:04:26 -0400 Received: from mail-dm6nam12on2060b.outbound.protection.outlook.com ([2a01:111:f403:2417::60b] helo=NAM12-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 1slmsA-0006AR-Ec for qemu-devel@nongnu.org; Wed, 04 Sep 2024 06:04:24 -0400 Received: from SJ0PR03CA0274.namprd03.prod.outlook.com (2603:10b6:a03:39e::9) by MW3PR12MB4473.namprd12.prod.outlook.com (2603:10b6:303:56::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.26; Wed, 4 Sep 2024 10:04:16 +0000 Received: from MWH0EPF000989EB.namprd02.prod.outlook.com (2603:10b6:a03:39e:cafe::da) by SJ0PR03CA0274.outlook.office365.com (2603:10b6:a03:39e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27 via Frontend Transport; Wed, 4 Sep 2024 10:04:16 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by MWH0EPF000989EB.mail.protection.outlook.com (10.167.241.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Wed, 4 Sep 2024 10:04:15 +0000 Received: from volcano-ed17host-rhel.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 4 Sep 2024 05:04:14 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PK/bdRNt0VffytBQtINObCPQIA6FgS8TzNfAp3sxLrKOq6js+qUZUG1LAhvIt5k0l2yX7SR8lAm/EKR800Zh3eo1H3yKWGlFNggnXzp973y7baPz4Pe4agENN2tcO/tZUzvQ9JJ5OGpTwxvTiLFfVhc8Smf3Ja5/ylskrK+5dioPg2ItU7GXtg6kIUlempcf+7gfo52pYMG1B8+JR/Sf17nEyvBdzyHNEwbvGoNx0GaYID9rKwWs8HIrBr1sYpIBzDxHiT5HyBNNz1ehG2DoZNZprsgQOJvE3wZAM8Hl8ym/5CkNmWhizNIDU82sP2+CSM6micwERG9MrEVOIkPGxg== 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=yKpo5reCdMBQyVpNACQ5+3WJ3vz0OxoBeCAfX166Ppg=; b=VVrKaEDxP12R/Y7kAVp+ZOd4KNBO4+9VCFxQwpCluG3v/OtsfaIMiH9cF7m12BtwgCNUCu80WEuz1vzaiqDqlQzRrXwcAKsGjT9bs3WQqoqWz6PtCACHDNyfPVvwVwx+dXMpp2qBbMwiSJYeYmxPrci5t0TMJXt6qXEa6Mm7AQ2zAJtg63cnfsRgbFP1FkbVWPoMKtXxEIliBt14rKwzwvCKlW1KYZrDTOey/JMLkKaEgUUhYTSaZkpvIpe0cfOjsbHRF2RJtWXVNxHXFHz4OLFpcDWiVuNdnAOZokREO5W8Qn8ZAyItOz/TqN9wrzO+ZYylQ6Q6qS7ChzIfNGPDEg== 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=yKpo5reCdMBQyVpNACQ5+3WJ3vz0OxoBeCAfX166Ppg=; b=rMUkjCSrViYatJ5AcEoMp4AUinbTK1KDK3UJfmttP3m7uzzfxzZVSlkgDH7i57L6Xyt7lcjRizH/WHNZzrdOlzR/RnYlM4p2kojzxo6LLIIANASCMamSe0TZJB2EbHn99UYHRoSD05oJpK2ROrBlR3w8UsLLn153XmgeV7pxzyk= 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=SATLEXMB03.amd.com; pr=C From: Santosh Shukla To: CC: , , , , , , Subject: [PATCH 5/5] amd_iommu: Check APIC ID > 255 for XTSup Date: Wed, 4 Sep 2024 05:02:57 -0500 Message-ID: <20240904100257.184851-6-santosh.shukla@amd.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240904100257.184851-1-santosh.shukla@amd.com> References: <20240904100257.184851-1-santosh.shukla@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989EB:EE_|MW3PR12MB4473:EE_ X-MS-Office365-Filtering-Correlation-Id: 982afda3-c009-4533-ae57-08dcccc8ef13 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?EwTiSnBb5b8+LYXuzOhXlWovcXtVItuh4OfcOQV7DGfD4yAmEIMW8VoBS5K6?= =?us-ascii?Q?S0n2BURJZ+8235EgLKkxuaxqyhMp4U8jiMMwryYhugs1CE5IZaYo/8XxK0YI?= =?us-ascii?Q?yU3NbCXSebb6k5NG8MkCwoegS+7X+nlAw+kR1WoGJqJNgltBE6Qw2WpUTWKt?= =?us-ascii?Q?Roqd5Kwd41MkOihrlKOOn26b/6aeeFEX51BpLI1pCXgGOHp1CFgmBbxZoE6T?= =?us-ascii?Q?xZZZQqt90oqJ2r9XKtFWPxgJa8BFZC3/RotZkU4ATk/D64BcqImiGnxSwFIM?= =?us-ascii?Q?xk/8XrfINIOo+xzsKPrCn6lBIMoRcwZ5pkW4/4TRe2ESUqhDiFdsDsH+mqVu?= =?us-ascii?Q?W8NC8mLCaoUBSSKT5O7k7XTBmxy4eNAaccxl5FCc4ioRDjbQ6CNjmscS6LqT?= =?us-ascii?Q?UV3SLgGVBP7c+zNXzMcKJ51yo/mKP9eUKc93qsn6DW7fY1UQY9yjWTbhJfPY?= =?us-ascii?Q?Fq8Ij44LCD9Al+2W07/yIobD+DA+7hwqLWRNnUz/ZvpVlGkv8Sdab0y6zCS/?= =?us-ascii?Q?Qq9e3GlUEVgyC91mIUdmMbf0Jes2ByXXf4gbIxxLDnKAntH4OgKEIbETLoG3?= =?us-ascii?Q?FwTEifzBXKAyCN6swGMIyOe/aTWzCmgq4sOwUGGPjifUWCmB+2WwfeZ+QeI2?= =?us-ascii?Q?LY1pc7MRZuhG9qXVbHGfmjrAip9+C45cwngO6kZK4YZiiiYquEqq0IEUf5x6?= =?us-ascii?Q?+6lKrlZ5M4LT8mFvCf8UbRKV5ZAsMFtHtLcYZN/XJi/GWo5ZqQYEQyqmkF6p?= =?us-ascii?Q?NwY/WE6eu4+FmRGhU3+Oy36MrkdD01IHP8hj/Ma7t2uIKsb1jYYSNoCXf84i?= =?us-ascii?Q?+7ZLYZ1dH9/Sx7tUMa1WUVTM3//u/gTX4A/6QMgum6/VpuOB/W3E/HjSk6k4?= =?us-ascii?Q?bdpP6wtFTU1Q+WjKlb3LI9B2iLT7qVG3/gsGiTs2cY36etCMXumOI22n5w13?= =?us-ascii?Q?ePTQzD4YCGzZHBlnAn7vllB+o/Br+U9eCXU1ElJNtwp8JlL6+XOrmHKIemcH?= =?us-ascii?Q?4mf1VQ3ztHWtzOFNAd7sFsboaxxp41AjMy4vLGFc4d4ReSSX9fkZz1Bd2qOO?= =?us-ascii?Q?pq9gL4gZyHG5NeO0kJmIz96b+6pneUQSR1MbR5k5QabxXGLUvzy+iFrro8yv?= =?us-ascii?Q?DWaJlikyt21mVpXpE9f6EvllLxIPH3K3rwdI0KApZ5QjSiJqGvgH6cvvT2fQ?= =?us-ascii?Q?gobaKUhY4TYg8k9iFtIvi9VPjFg8gZ5QxInnqdpQlAMy48OngjD1hgv+N1ZM?= =?us-ascii?Q?HpIVwCXTYz8rsaFRkWEStpzGUqWfcbB341/zZo0j4r+EyvZUo1nKC3ZKoBwt?= =?us-ascii?Q?ngUhYufwNBv8iXYAfZ/EK0qY7itAk2k5blkSsNfxS9DFUfODqtclEr5U8JuO?= =?us-ascii?Q?2tJG4jsrPRwpni4frd4aA7RjOorBoVACJwQJPgY5wk5r1PDvXX6SbvGaBdmj?= =?us-ascii?Q?GlYLzrMnexdlPKer24tY1Cbr1PdfnxZE?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(1800799024)(376014)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2024 10:04:15.4462 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 982afda3-c009-4533-ae57-08dcccc8ef13 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989EB.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4473 Received-SPF: permerror client-ip=2a01:111:f403:2417::60b; envelope-from=Santosh.Shukla@amd.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.142, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: 1725444330396116600 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 --- 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 5acb40fb909c..89d941fa4221 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_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