From patchwork Fri Sep 27 17:29:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Shukla, Santosh" X-Patchwork-Id: 13814472 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 F1A28CDD1CD for ; Fri, 27 Sep 2024 17:30:48 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1suEmr-0006Ck-2y; Fri, 27 Sep 2024 13:29:49 -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 1suEmo-0006Ba-Sa for qemu-devel@nongnu.org; Fri, 27 Sep 2024 13:29:46 -0400 Received: from mail-bn8nam12on20612.outbound.protection.outlook.com ([2a01:111:f403:2418::612] helo=NAM12-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 1suEmn-0002eA-44 for qemu-devel@nongnu.org; Fri, 27 Sep 2024 13:29:46 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bwpbdGryz9nwn4no4ORTXP/z+iE+2tiJnXUIvsgQu/zKANNSp0pl/ef71sXLaDsfXAoDQWRWKx0+2LpuKyvdpMMQoPJ+Gq68noygYk6l1rMJDeaoltxGbEghMMw7PMWl3iV/OgJUNRV0u5WPPv9H2MKdYMju/dJ7nrpTNXB/CcaY2gnCOhk20bNYXzzipYgjMQUB1CAUet5hWE5hjOMD11/bWNrzWIg6kir9dWgQBAM0c5GsWo0rI1E7b1sGOs91dMRY538ITh8RoYkp2oO2vXpAJZsFR5q0gPqtj7woQ0smnCAOcQYfvm5qXcAHFxw8mBJ8J5ON6/xyGlaluDV5ww== 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=kbPagA3ro7p329hS9wZ6cPPM5pH1ke2fvkL4QxUmXzg=; b=MSC/utmNqj6clVcn5qqP5q6bZEK2OHWZH9cUV5mGU9HxSjXtSf6ofhfbhuXrk+ZnB/+ZQy1GWKXhAbZ/Je271LPpLu/7pJpUoJGs3dK7/YDUABsnrmgW5pwX4x7aNK/+l/v3vxFvQLKfE8SzqPouS+DESEAB2TqAkFT29O+oNQrLQhj10Ok/kEsdokVhC32G8L/A2A0P/bObD69cPg9Kr0FOu/oaA7gnLMGycjHrxYGHaAf+0yLNk7wMpuJ2FD0cXJ3SHFbEWVGtZJPb3esAQcewFD//QNPGdnkGAk3kj9oQsquWeYbo1U/8AfehvJGM3C0SxKEBCQk0blB2UhBA9Q== 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=kbPagA3ro7p329hS9wZ6cPPM5pH1ke2fvkL4QxUmXzg=; b=ibHV1xfPKunR4rlW6iPvTtNzkGgcFDzhrqGJKYmejDa5/Sb9zX7Mlcj2r3EmhvlPdTYderiTU0joLLQjW+0MO0jCNZgx+g7udMbllwH1c3SOWx5MnvluAS7iUynUimCpAjKJ9BGEhOare7PanNbS2Nd8gClLwCgJYjYvE4Jq6lk= Received: from CH2PR11CA0030.namprd11.prod.outlook.com (2603:10b6:610:54::40) by IA0PR12MB8983.namprd12.prod.outlook.com (2603:10b6:208:490::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.21; Fri, 27 Sep 2024 17:29:37 +0000 Received: from CH3PEPF00000015.namprd21.prod.outlook.com (2603:10b6:610:54:cafe::96) by CH2PR11CA0030.outlook.office365.com (2603:10b6:610:54::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.22 via Frontend Transport; Fri, 27 Sep 2024 17:29:37 +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 CH3PEPF00000015.mail.protection.outlook.com (10.167.244.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8026.0 via Frontend Transport; Fri, 27 Sep 2024 17:29:37 +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; Fri, 27 Sep 2024 12:29:36 -0500 From: Santosh Shukla To: CC: , , , , , , , , Subject: [PATCH v3 1/5] amd_iommu: Rename variable mmio to mr_mmio Date: Fri, 27 Sep 2024 12:29:09 -0500 Message-ID: <20240927172913.121477-2-santosh.shukla@amd.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240927172913.121477-1-santosh.shukla@amd.com> References: <20240927172913.121477-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: CH3PEPF00000015:EE_|IA0PR12MB8983:EE_ X-MS-Office365-Filtering-Correlation-Id: ad2ec6ff-4355-4bf2-41d6-08dcdf19f605 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: mfsC9yRZ0uoV4du6zmMsVhZVqofQyyM0/729+QKgl2BqcD4RlX46Juqau8FnUhCH0YaTAUP+8ABgUf7e9elG5CyrBLnngxKXkEZW889Ksq0bFgsM8nVZbKAMFYByxAo0UP4RUkYI6W+WKnq72jIel1U3MT5te8Rc3FSsiThEkcPdWCO+n/s+bzpsDtpU4b8IVy3gunUoYc0NjSFoU5Nj2hQCUOAD8N9H5M4fulE7Kso3u8XfPR58k0NrKdYcgHCRQrMKMoDJfNubUDCKCw6qrzbObCcXBKVWS1L9QvwiP0lEbFRwDjgF4apwWJx+P7K70mZ3Nuqs8Ogz1MmSXOLeFQmKbILvTZN9vdwSYrmUnpyon6JGRIf2IknPlsScNyIF3RKAZIt8tn+Fi01USCQNypo+atJphT6LCPlpLnGudnuH9F8XCLCdbsTejM0b9PxUXUWopMVK+X+TaNwLMDc4t81D6roeNfMaHTqDFBiA8a9n9rxFNI1UtmG30B6jwRsNWBsFC7o0fJe+MjCVOI3fWGbrNPd/r7EsOMmTpAjZZvu6nZUo8r/4oMsfxaTyCnhm6tcdUkU4Dp5GSupre8olVZ1HOWzmRbWXf9/yjEnGCiYTWYPIcVDiDVcTZ7pFrugSHEFmhsErN6qe4JAb7XxxzlkBu+NKRebudTaJB9KGQIX8leM/D6fVGtztJGSrZYW7kL4Yvg9uziYtJGfguzcvchoN9pxCjWNLyBeeLgDRIKmCOLn6ykIobZlvhq6nVtvZCd98Da9lWekaAJHcpqtkzqG2PxEd3H/tkjjeZU/Zgr4CImSegqPFm5ubomqQtB4wI8fckmF4Fq0/gJOooxOD5YA7a3UnHzORgNP3AjPPSh1wxUXVQNsWeS56tlK6xckfIqH1SzSr2gCLjhRyweizBchePehz+dsxktWY1LUs59NOAA+3xRaPhd9uLzzozpAkfi20nqoMfUES9YF8+3JHL+E1Bxa6NPTi3zSqUvEpmtTV0jFzwRGTXxTIt8AiqXKVH5aAeACLlCrhDMvU8ndbji0yRauacWb7HdOIoN8f5w52QPlXj7lRghlxEZvG8PG4pukAUQEPXPsqGp2tiK4uduHFMMbBukIkKGkuD5kjBE3UEO2596Wx32LEaoUjfM/xkL3Drc4QJArdVQlAWmijBJN3pM8zSIN7IrdrC5vYTyLcCMRrIbOwg41pOO+tD9QFi3yrot9QM5+JWSvbOSC9Q6+2tns1hhFXfuC0UOnKhvI1D9ZWWLwdNi+9QV4pL0Gd+xYFzRGw52M9yN6e/hswBcRuJ8JE0BW8WERF3fwh9JpCsWADNp7FUAvCHNEbhYYpcvYOhhA5LBm864Or75KTpmHC6Pdx5Sm97dGajWGFtMMeyQGwAdUkFEabVB5bUwX4oxY8DAMUowZHhoQZADNMEI92MLu8NfrMt7M6CtkB30VUMyq+9895UPmaNIHGWQHw 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)(376014)(1800799024)(82310400026)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2024 17:29:37.3702 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad2ec6ff-4355-4bf2-41d6-08dcdf19f605 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: CH3PEPF00000015.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8983 Received-SPF: permerror client-ip=2a01:111:f403:2418::612; envelope-from=Santosh.Shukla@amd.com; helo=NAM12-BN8-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.15, 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. Reviewed-by: Alejandro Jimenez 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 Fri Sep 27 17:29:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Shukla, Santosh" X-Patchwork-Id: 13814471 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 132A9CDD1CD for ; Fri, 27 Sep 2024 17:30:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1suEmz-0006Oy-LH; Fri, 27 Sep 2024 13:29:57 -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 1suEmx-0006NS-Uz for qemu-devel@nongnu.org; Fri, 27 Sep 2024 13:29:55 -0400 Received: from mail-bn8nam12on2061a.outbound.protection.outlook.com ([2a01:111:f403:2418::61a] helo=NAM12-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 1suEmw-0002eS-2S for qemu-devel@nongnu.org; Fri, 27 Sep 2024 13:29:55 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=B91jRYK5notV+HKWE6LNhuPdLCb8MKpiaBZ/rmZOOUMl2nMxNKQek/nRXvDNY2NJquIRx6aw3QvMS2QtOy+7kPr/xXft45hhW3oGjzeU++mfo2ShbDHTiV+QEhMT3jVwVE1CnAj3hM1V3BdygCBZA+L5wkTFjlHTkvVj/H6lvrgog7qF4fZGBWZLwOoxjNorkrt3gZuzx7PQpa6TaFpK7ex8betwy2xDFRFybSv4yzn36b3joc+PoBEbTbIZ+B/77447vnZe8bEnqtMTKhw3l3FIv4f3z5yOLk+yFlzkVMmauNgRjDP/gkBPsjCpGANheR4L8fD3k6nVNggEz0U1hA== 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=D3ErdNQw5r0Go8Ol4EVxRjdNp5E5Ifadu57g0Sh5KgU=; b=f4yt4TMpr+llYL0LTwzvE+oOsdhptjGrSvr2IaKxblwjH9x1TmhVqJ85CpuiPH0XeqLN7oAZ4iX4bDdVhwvAegw7wF0L7eT1oru3Ysq3aMlV6aH2yTr2T5IFwVAD3S9ZHwxouL4bzsid02swolX75XL1IbhSA2D2pPKdNFi+SlpupsHWP7dBi22adDGBmzroYIKp1X1QEyggo7RTwEShLibeMIeCbacCxHvgZLuk0ONWA+sgsDA27+xaXm5JosNYMBB/mAPb2eqRf85cAnHzFMFkaG7Mq/RIGagW1UXCrzo5RRDr2zHQNWuRI7ZKt50BbPUGko1P4wkEX3m7eE8gJA== 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=D3ErdNQw5r0Go8Ol4EVxRjdNp5E5Ifadu57g0Sh5KgU=; b=tIbLecORhbdWpvU1E+FVrqTBif73KyqNBEZYZnE6IP8BTvUfKLVEeUMN76eTlQYwPi/fYZ2DpnPw4Xc0Pe5j3OAYUcd4P3OytvKK+W+z3IWLCzcqrI5RM3Tn8tSOp3q/+94N/iIzUQLlC3f3bh8eUAmyEAyWBjPZ0ehKSIfORws= Received: from CH3P221CA0001.NAMP221.PROD.OUTLOOK.COM (2603:10b6:610:1e7::11) by PH7PR12MB6395.namprd12.prod.outlook.com (2603:10b6:510:1fd::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.22; Fri, 27 Sep 2024 17:29:49 +0000 Received: from CH3PEPF00000011.namprd21.prod.outlook.com (2603:10b6:610:1e7:cafe::4d) by CH3P221CA0001.outlook.office365.com (2603:10b6:610:1e7::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.22 via Frontend Transport; Fri, 27 Sep 2024 17:29:48 +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 CH3PEPF00000011.mail.protection.outlook.com (10.167.244.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8026.0 via Frontend Transport; Fri, 27 Sep 2024 17:29:48 +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; Fri, 27 Sep 2024 12:29:47 -0500 From: Santosh Shukla To: CC: , , , , , , , , Subject: [PATCH v3 2/5] amd_iommu: Add support for pass though mode Date: Fri, 27 Sep 2024 12:29:10 -0500 Message-ID: <20240927172913.121477-3-santosh.shukla@amd.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240927172913.121477-1-santosh.shukla@amd.com> References: <20240927172913.121477-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: CH3PEPF00000011:EE_|PH7PR12MB6395:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a8c2719-1995-4c88-c0fc-08dcdf19fcca 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: +v97zwDtJIoQblJak/eLq1d9hnhASxJk80oz4RhEg26oQl+XNrqd5nQl6Wo96i3F6pOBnaaV2eS/wX4+AtKcQvzc5IaHctUI5QxgAumh40jRk6XoAkNJrD8dFs+OH9aBW359xIG1yaYDFNmS/qRsbPDxKPcy18bd60XjrKMLo5gyQBeCDyrCs9S2maDuYbXdH7eE9F0rIZsqq3B6undTO2JLS6bOR3l3OvHLtuEHtA1GtHguXhmkfcwFctAYmAF+RKQ8S5h+ZY5JJ4lGWOO/uENZ/V91Mf+EyGudiiKTdEuqZ1mFzNcfK6NEoD8dB1EcdEklQrIZic4Stw9Y7D0GaGJSJJLbJrNrzpzNdazsQuYrmA1udV+wtNe0Ev+KjkF754W8hUPKOf/d+av44eLZk5BzrKCwY6Y9xKDhpJPfi5W1vMtTN2rYRwXAdZJO35mko2UdLI1FQXI/0clKjtsMjpzISwkpyxblyJ+3MQ9XKfcSYyBGpN9199zFbzUNuk/KDm8CRmok9VB/KZonhnAd5IDn1DCQ3VaP0XnnbzR+6W1UYIOFju1BT0WVox4c5/R3rMrXBtFv9l6mLl4oURL4UYgOp04K08NGl+ZlKB/acC7R4/S2zW5V7sa9WMoyCgZm7gzl9+d05ZtWOaVwhqp54odgCS1W7lBM9wALBtS5oVWJykvQgCRIEKAg68vw/zB1jjfak/jTUfUOlh3WawCM2F8ViwTP++bMDu/Ko5EJ+xSiEwM215xNLGuf7GuDyy+rjbLCuvwXIitWKO9mA2yVKTqT9soULRGzOk7vrNl7lbS6oifIuGOAdWlkQCI3cQwJM4GNwanI3BM60UTnHFiHQaKmyRwLcEsi2iQnLe55XE6hJvV/WfKq9V63y8hWcbdFOmJcNsm/EP0eIiEudUZZ10AwsU1dssgW+xg6jk5YGjPgROWZPjzWi4p8iF9b+hZrdhQJrZtL0PegMFfUsXhLjX6XFnbCNXlv3HxZB8Z6nRDQagiz8REVjRD/xDOnZc82+8XQw0M5ZuoOE0lpsMUo0j7eeWfvEM6SlFRxiLMDmOaszmlB04K7RCh/ru7qdw/i7m+VljNr+hfJY0RTz2uhojuz1eqKr2OmH1aAnEF78NtJsFUB+8DZTHkafDMDETitkBVNhSUG/5vX8TGzAPj4Ol88KhIDSQckWADp3a7d8S2L6h+Z9jIPys1g4GRRx16WlFBM88PX3qSFFRgV3aGC8kv+gqsXa3WrokCORTOrTBMogJf9IZc1iXb/z6DSd1j97a7vgoGyqr7K8O+P6sgxM49qAe5YV/jNRuHxYh6tXN0GxDiCQGZBzpQk0a4/ZGWgyrQjCPBQBwstVYSx/pLEQO+MeAGVbiKwYAeQR2prdt+bW9isvgSUN7yzeTgnlA3k4o3NcmVjWqGtoE5EDRYpbk1MxJwr1KHtEJAltI7MvmL1FZQkWnvL0NVHC0O9Eieg 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)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2024 17:29:48.7465 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9a8c2719-1995-4c88-c0fc-08dcdf19fcca 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: CH3PEPF00000011.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6395 Received-SPF: permerror client-ip=2a01:111:f403:2418::61a; envelope-from=Santosh.Shukla@amd.com; helo=NAM12-BN8-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.15, 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. Reviewed-by: Alejandro Jimenez Signed-off-by: Suravee Suthikulpanit Signed-off-by: Santosh Shukla --- v3: - Fixed the indentation of _nodma and _ir at comment section. 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..7c7760c57330 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 Fri Sep 27 17:29:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Shukla, Santosh" X-Patchwork-Id: 13814475 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 28DBFCDD1CD for ; Fri, 27 Sep 2024 17:31:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1suEnH-0007Jg-9X; Fri, 27 Sep 2024 13:30: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 1suEnD-00073S-5s for qemu-devel@nongnu.org; Fri, 27 Sep 2024 13:30:11 -0400 Received: from mail-bn8nam11on20609.outbound.protection.outlook.com ([2a01:111:f403:2414::609] 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 1suEn8-0002qv-R9 for qemu-devel@nongnu.org; Fri, 27 Sep 2024 13:30:10 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nMFdpn1KSrpIW98bjqiKlRcLqxuFQm6JhNijaX0jbgB/DKkZ3Syd65aSnHyGG74MaxpSKABJWk5rEoIzo2yQZCL4YFhYjJqpyt+Q+/WwhcqQnIDYzSIEhXrGT7Z2W11ocJ3X7VVjdx1BiVvD2dM2WQHQz1HypfL8wQ8TcsOBPVKHsaK2zmv9+f+xhs69n7pVPN13XNJHM8ioCBFtrLkv0gSa0lCnEG8iTFDURL3K/SXnO3nchqQXM4TDd7t8dRVShjl6yU0cbJLYeFJ0DYw2NDcaEaU1ao+f9ok2D1VrK7IXVCpqw4I4cMaPzDNQKEHzmh74ZrDI2QICo5jkOajFZA== 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=YaTEiFHA7ihOwUMOM6FQMFuNJn3la7pQKoPMESzJ5N0=; b=ZYk3fPlzmBndWgnXKwTcCzAuPEJ55XoAltSZteyia1xF5UrtnMoxtceYfx8rgV7gjALvloeBGM7oIE1zRiZg38v7UfH+wVU2AbtsRn839fGk1QT1Qfyo1z/MDFwkrgLkn78UEN612cSQy8e5TouJiYI8qGvcEhL+F9HpKgfZLcAH5wdLLXsV4SutBbmf5aiHnudr0AjA8DzSJVOYF4wf0tsAi1A/ptf5moimT115psquIfSIdPKVKLNkJnSowH6xQz5buxe3Fs/8d6hQjXn3e5BSBrmu/CQSZRQ75c3yLwcxIgA9rfKqEIOh3OlXhZBF3QB9grVQm9jrIlWynob0tw== 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=YaTEiFHA7ihOwUMOM6FQMFuNJn3la7pQKoPMESzJ5N0=; b=hs3K2N/aDux2ltaoO0/TDVqFoFlM7icCMjjwj80bkHyXUCcsYAHHWA61OM0Pe5wGMGvNFu5uDRvuKEGuMesDXBKO9kbl7/DsTjJJD8tdbBY/oI5dm6KDz96XccnPkk4YFQx6GXrS3bXUxtIMN1Ty1MKaqINqStk2UzwJGA/Qk64= Received: from CH2PR02CA0004.namprd02.prod.outlook.com (2603:10b6:610:4e::14) by CY8PR12MB8313.namprd12.prod.outlook.com (2603:10b6:930:7d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.22; Fri, 27 Sep 2024 17:30:00 +0000 Received: from CH3PEPF00000017.namprd21.prod.outlook.com (2603:10b6:610:4e:cafe::77) by CH2PR02CA0004.outlook.office365.com (2603:10b6:610:4e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.17 via Frontend Transport; Fri, 27 Sep 2024 17:30:00 +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 CH3PEPF00000017.mail.protection.outlook.com (10.167.244.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8026.0 via Frontend Transport; Fri, 27 Sep 2024 17:30:00 +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; Fri, 27 Sep 2024 12:29:59 -0500 From: Santosh Shukla To: CC: , , , , , , , , Subject: [PATCH v3 3/5] amd_iommu: Use shared memory region for Interrupt Remapping Date: Fri, 27 Sep 2024 12:29:11 -0500 Message-ID: <20240927172913.121477-4-santosh.shukla@amd.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240927172913.121477-1-santosh.shukla@amd.com> References: <20240927172913.121477-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: CH3PEPF00000017:EE_|CY8PR12MB8313:EE_ X-MS-Office365-Filtering-Correlation-Id: 90dab867-21d2-402f-aa67-08dcdf1a0395 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: QODd40mBWu6waPeoqAZaWmSshG4lRyhdWsl12dTht1qA4hZx+a2FImC6mJLHaCHEBvDoMBZV4S6tvcXwCKwsa6AKIVWDUJQR+P6jSmq3tekeRfXnLRTyDqx3LUbvHm+M75flg5hUmBOJV4KBuMT40ipuDawS3Lo5ky7OrpZbttlwTucaVy/+I9pFs+NBMDU1Hu7Lo/dg0EVrD1hAlkdVxgCm4xiI0kUtFBFqaZ1S9kbgKRELiO+c045aDQRjRd0klHSGsdu8O222GdlHEqi6EiVm2uWNlFOeBDOEgdVNsdVyiQBTA2/1d3vXdayvQu2h39xLbIqGIzGgyghcg38R/VNiHjoZUuyrptajrzoVDx9QwFPzluqaL5gXLUPl7ZaG+dd4RxwORk9HmBAZnmnnKHbm9DZ2jX/sqTCK3q9KngjFSBnJ6YYdVs5u4phjK/4rPxsayoCl6E7GRIGXPb7kzfjOvGMu+w1vhjDYQ0wNWKC/ME+z1rzfVBnLxIWvjkz6YE4ag4Buf4oPolR5ndISWkgzQeHN2DigryQ/Hf5Vl1m1GMz2D18kVB5HA6RnLDjwb3EdRv66TMH5A91nDwG540HfQHiLjF2bJNNyW3jofY9C6kwUq/KK17+axtD567t7BQSRW0OkAxcrnTsJq4uKaJUE2xjnupgfy8rmnfu/pCBijVLQVaLU/c/EQPI7GuZXmsL7SLXczoKB0nMYXaem7/tq+tNKddcuQ5WRJ+GyXt1UwRUTrtG4FNyyxkV5cFZ/g/V0PLQUv+ljsjR8ecV3rKQbDJLeT9TNrkueS7JcmicZqm0jzpmLquYZD3uJvCsJWi+YNrr6K9rZdf+skIef8Iybr7/fLl9OCAnC2OAHGMUj+at0JLjvBDYZ6dIpyVBA/j14cv3LwL5ldx3DwudQCFK7mybGwMegk2C477OjU/++5Y08X+CZlGWHduxqRpnqMXrZvjf+7hP9XkUcS/cCwlHUVAHSmTD9RFEObslfOBu8PDW59Ahsov5SjkhK2WlWwjIBpCaRRd1A14KNdkgFLX2dBPuKTPpqLqIZs91zyYlRLnbWI7KA4H4HCIq5R1G8EHsW5kUjW30K/KQWzxt11IkN7AQSoZZcqqoBRdG07iYBA1bDbeJ0UcHL6UdV2PB+ctg1v5AVlPP5JlccZ0DlXsJqfN4Eona8+dbCvH5/FiDuWta42YmH4dFu+15nmg/x7kV0F6Z/xkGZ9J8sKmV7gyQIBv58ZMhqeTDAhF02nk6g9h4jOn+pPNfdyumLFtzv98m98SYWpB8Fn3Wg68DVej6tksPYv2ZRr0k63aqYqEGVb+qGPet5iL4Gw3hjlMNtbMGc5188x2Bg4BPUDVUvoUG+pqVPR3z8PIpP3c9968qw42I+FnnOC8el9+FsKmL2Gr++yu8N5Re7Gb1v9T6K6yjxVczZYo3AwAIP7cSDxfnEeFCNiIR4ifdT+3zJRv5p 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)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2024 17:30:00.1270 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 90dab867-21d2-402f-aa67-08dcdf1a0395 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: CH3PEPF00000017.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8313 Received-SPF: permerror client-ip=2a01:111:f403:2414::609; envelope-from=Santosh.Shukla@amd.com; helo=NAM11-BN8-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.15, 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. Reviewed-by: Alejandro Jimenez 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 7c7760c57330..9b923f6eb482 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 Fri Sep 27 17:29: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: 13814473 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 DC36CCDD1CE for ; Fri, 27 Sep 2024 17:30:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1suEnW-0008SI-JU; Fri, 27 Sep 2024 13:30:30 -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 1suEnU-0008Jq-NN for qemu-devel@nongnu.org; Fri, 27 Sep 2024 13:30:28 -0400 Received: from mail-dm6nam04on20620.outbound.protection.outlook.com ([2a01:111:f403:2409::620] 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 1suEnR-0002rr-V6 for qemu-devel@nongnu.org; Fri, 27 Sep 2024 13:30:28 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nHalfYaSUESeWaqwoZeLCzYBfwfza3sRcUdH8bzJE/pgaH6vKjYF6sTLAzL4r41pmd8TtiUvZ0n9ukFloAjvSomt1WP7CEbZnjsOW+UE5PiK/rIVQCPNAOtDh6GP1jly8DGm3YID8555whGWh0QdX+iphJxgDeuXAwh0Imlef3cjVv965IvvhDgNk3Sqc6c0FY56jsRv1WY33nkdqC4PbTh7v0jy6ZdgGcozBhLY3g40thWZGbu7YWaAKJQ9KlYwMTzXGyhqWdb0o6uMJPn05aePmPnoWHZciz5TnGcez7lG/chBpyxpc6gvJY8TP3hg1btCJ+FPD8dILfMRXMf/wg== 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=fiUFtG59lhwAG6HF/G8uqYCoEBCj23N1msfxsyHPVus=; b=rCMdzLBZ/uR2UgEwok4HOvrjUgJFrmAKd6zcJ+TbLEHJoiCz9jFB1SQkX3ucz4TNhMlqKRNUix2FMNb+/UG8k4CFez1m7KrgFWB2RFfxuaql39b96O54o1/Br5w6kjWDv1M1yweqSN4gcP1FMyfFXrqTvyyIJze7tOMeiEaXoT28aax5lVqyCaGuO/lOOjWrxZG4J64WYTwKw0jfpP/jzsxufrSxQKa5Ok3uFSXUhOdF56Kv9U8i616QueQl5xmi3cjI+cJQImloHcX6W7JEfJxo8QS+zMpHDOFkIjs5XBct7ka2WSvXtxplnmQeUQdQV79bSpy5phKbxJ5MpBrNRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=temperror (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=temperror 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=fiUFtG59lhwAG6HF/G8uqYCoEBCj23N1msfxsyHPVus=; b=BgL1xRYFP2hv5bOeGoMFpHEMKkH8JIJu1Z+VskdqwdvIORlPGnJiKLnkyNaEWMzvq9k/k0hYJyRC8AxAYIEWFal8Gfmk8ZYcL+5J8YtW9YN5u8jB8snjWfgHSjaXEyTuKA2kXaZ/3sWCK5SVnUYJwvZLbhhcRdiHvo3gstZBKw0= Received: from SJ0PR03CA0144.namprd03.prod.outlook.com (2603:10b6:a03:33c::29) by DM4PR12MB6352.namprd12.prod.outlook.com (2603:10b6:8:a0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.28; Fri, 27 Sep 2024 17:30:14 +0000 Received: from SJ5PEPF000001EE.namprd05.prod.outlook.com (2603:10b6:a03:33c:cafe::d8) by SJ0PR03CA0144.outlook.office365.com (2603:10b6:a03:33c::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.19 via Frontend Transport; Fri, 27 Sep 2024 17:30:14 +0000 X-MS-Exchange-Authentication-Results: spf=temperror (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=temperror action=none header.from=amd.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of amd.com: DNS Timeout) Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF000001EE.mail.protection.outlook.com (10.167.242.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8005.15 via Frontend Transport; Fri, 27 Sep 2024 17:30: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; Fri, 27 Sep 2024 12:30:10 -0500 From: Santosh Shukla To: CC: , , , , , , , , Subject: [PATCH v3 4/5] amd_iommu: Send notification when invalidate interrupt entry cache Date: Fri, 27 Sep 2024 12:29:12 -0500 Message-ID: <20240927172913.121477-5-santosh.shukla@amd.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240927172913.121477-1-santosh.shukla@amd.com> References: <20240927172913.121477-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: SJ5PEPF000001EE:EE_|DM4PR12MB6352:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ce5044d-6ae9-4cfa-090e-08dcdf1a0b27 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: uQUqonsNO3UHrqV7ArciE0Da7ewrOTxOf1QfJXQK++TrJY9puB9LORVMVZQbHlUQctzUjg8MkqKN58mlaL+7UpIFU8CVREvlYaJOUjBKn6tkZ1rnfwik6sTc9zqxUJ3Y9gMJNeiH2qbDxHyOCGDxhWjzdub5ivgoUOIw8Js/K+O8Zl9Fr8n53p3ec1UzfpzhHehmS/Gr9IU5TR3qfKDKxbQb/v3KUewb3xeylaZOz4WJviBkmU//fh1zJgTpveFDbXkQkPr+3hurrQToYNukSEbaIbzeyTghnuVqxvEwxKU4WMehKHPGLHWz+JPzvMLHcPRGQlRf5bP443kHMKhGFxV6xwnWZMJAj3YFeDvj1tEXnx/59Ro6phGz0fyYo976+NtlW91eqQIEKGXHe1qOzkbg2ckzxPrNNPHBMpZzpfsJyvW4a7P2Xpf8kdtOrcjDsB4c4KfPqhl0fKPOURqMEcMqxSVYrtd6u6beQIg6pTBQoMg5b6I9brZf8ApPYjOITuYbESU2TgZGzSkTuUMZS651k/Jgxu8akkT3zEGShEdTe6vgYzsuMsSQAISMuo3UOWWqs4DEBJGz6HRk9EgK7WdT1+3Q7cJDXVcT9SfOgZKXx//OXZJcvT7TOnIPpVp5gqJ1Ab/fyjgen0YttRn4MEHxq5vanAsqOK6M1OHMBEk6AA3C1/5crSWQ0/HxJ520ntY0L3q+Wsrv36uu186p5RMm8WVKPr5cbxxo+URktdFhga9S3MQFyviLUwWog1ThFEawFseqnVe8ub/+isF+M4/mP1UOf8p9W9PCRIp5rivqxTZJcRmVqGb/CGLurSnioOPAMl4kBqF9Sg5Oj/yhhQUEIBUyqQn0DbsDxFj4ocKRxcdJVVEpsW4edf4pZAJSZc2hAplCs3ec0EcW7v319MHUAzklRQ2mzTwVNbmKPpAxcG0IGzYWXNMUTJPCNbgUhVWgoS43DLGpOAF7ZY2Z8OU68ntdY5J2etmfOF/ka5M6qzXHyD5GGUVry/faJDirsOd/5+C9FOsFWbB//o+Ypp1MHv/f6TeoCMrafdzpchim4ckSwWrNzQrmWl2H6DGZVQyFR7PdbvJ+s+EEp/QjeG5rlrdoPgdhL3uqInYwzaeM/vXV4EgZRNUe0s9enQVgNmSTSq5Zp/IpkbICkvPMl6hnPLGo9R/7eZwHGo4YiFUxrLvvVs7/FEz+/sbtP6yR5wItuTL+jJfD+w87hqEZLl6e7AevsARCrbyrLhkw3V9DDX1JtdSefRnzmmBBAMPDElfU1uohenEC6569sZevS/vXSdCikqr4Dosj8tOq+2kjWnnY45l6Sozq7eOKadZgpr6OwzQcD67IP0XHsgE/HMdAluggNbK9P9kCAFMRimjo/PRihW4CVsQfk4jz1a9VgswdvbA6oBx72vQZ3QCJ55iZK86vcCJYxpnWyk8nT7HV5S0Dd6TtYk2nqjTxNPNK 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)(82310400026)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2024 17:30:12.7612 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ce5044d-6ae9-4cfa-090e-08dcdf1a0b27 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: SJ5PEPF000001EE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6352 Received-SPF: permerror client-ip=2a01:111:f403:2409::620; 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.15, 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 guest IOMMU emulates the IRT invalidation commands. Reviewed-by: Alejandro Jimenez Signed-off-by: Suravee Suthikulpanit Signed-off-by: Santosh Shukla --- v3: - Fixed the typos in patch description. 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 9b923f6eb482..38297376e7a9 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 Fri Sep 27 17:29: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: 13814474 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 A8EA1CDD1CD for ; Fri, 27 Sep 2024 17:31:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1suEnm-00019u-DW; Fri, 27 Sep 2024 13:30:46 -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 1suEng-0000ig-Eq for qemu-devel@nongnu.org; Fri, 27 Sep 2024 13:30:40 -0400 Received: from mail-bn8nam11on20600.outbound.protection.outlook.com ([2a01:111:f403:2414::600] 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 1suEnV-0002vW-3o for qemu-devel@nongnu.org; Fri, 27 Sep 2024 13:30:40 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sh7m4UTr9w2F6bHShdPxtKqd4bJ6XzgHtNgGgOgT0bdXkeLc3Jpqvu9UuAyD11urfyYV3qMRNN+WSAXgndhOVBXXALaDlr9q8sfguQAJ/oUVqQAXyir5L6OnNX9Zw9R9dW4cH4eeUGPo7qdiSHTW23oO8mp1/HXvsCZwDhCcSHrH+WChPTWmlgzNg1noBEaN2e4uCN7wtutZ/WE5gb7ltXSbJSAxSzttgOnbA6ZtbwKuNg7LyYT3JjDs63hfOjrOgG8obqWFdlc9eBL8BnvW1nmrJ7UrXLLai1tixwnFpXQAAP7TVwV3bWgz3NEWnip4oWfv+mpJro+IR2tnC/YCsw== 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=qB4nL9do8VncuAP8fGf7RmTilnxf3oaNojoJJX9+JeQ=; b=c+IvBgYz5j/oIaRBDCMGy2eFQXys2Z4lUC6+al3kJF5d5G+WxLe82h0PnkAgUsUG6V9XlH7+7kSVQhExPqhc8ysHwh558Q54U5dAQ0Lug9LAeYFtpziw+pwmIUg5p+2828yB/a4XJZ4FwxLNWuAkzWL6aDl3okUoHOC3V1U4C9YyjE1qrD3uWr6S5tcCE70t0pYyXjxmOrr5W2x61PM6SzM+RZksuCB8j1JUsD4Zo6rLkxUnrVASjlUIDAg8QXK19pfQKcrrSTLwntfm74KJ3sSt0LajkoxFlGuExLUdHo3e5Em0+2KLoMfMKhsnJxx/orplfNKSu87kvK2umcE+ow== 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=qB4nL9do8VncuAP8fGf7RmTilnxf3oaNojoJJX9+JeQ=; b=VFrvg6ZuNHG19YLIO/JpgiX4XRWFqyyx88Bt6qORkXzcjoMpMaXSTJKG8bnMTxhz7RsMhvbgx8H5XIK+E7fdG2r7nGk+3fU/nJrV4uESfDTpfhtZAmcZ+TyfF1t3ILfiCQHa1Qy0ctxkzgDi53bpcgrFOkGZQ2ECAlMfFREX9RE= Received: from CH2PR20CA0014.namprd20.prod.outlook.com (2603:10b6:610:58::24) by CH2PR12MB4101.namprd12.prod.outlook.com (2603:10b6:610:a8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.24; Fri, 27 Sep 2024 17:30:23 +0000 Received: from CH3PEPF00000012.namprd21.prod.outlook.com (2603:10b6:610:58:cafe::36) by CH2PR20CA0014.outlook.office365.com (2603:10b6:610:58::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.22 via Frontend Transport; Fri, 27 Sep 2024 17:30: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 CH3PEPF00000012.mail.protection.outlook.com (10.167.244.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8026.0 via Frontend Transport; Fri, 27 Sep 2024 17:30:22 +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; Fri, 27 Sep 2024 12:30:21 -0500 From: Santosh Shukla To: CC: , , , , , , , , Subject: [PATCH v3 5/5] amd_iommu: Check APIC ID > 255 for XTSup Date: Fri, 27 Sep 2024 12:29:13 -0500 Message-ID: <20240927172913.121477-6-santosh.shukla@amd.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240927172913.121477-1-santosh.shukla@amd.com> References: <20240927172913.121477-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: CH3PEPF00000012:EE_|CH2PR12MB4101:EE_ X-MS-Office365-Filtering-Correlation-Id: b7a932e8-3f6d-4b35-edac-08dcdf1a10eb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: F6twd2G5ISZb5Vf9AEQ9AlRX8PKh2fqmE6m389bxcX3VxwQ053Z6vDAby8389WDD+yWPr+oJjVsYkZTKq1Bxpav7YDhk/5ZXkgNnzIfLyDbz/bArhklS67M5Fc7Oat/RiccCNV9SqjAuPp6/qJrtvJk2uLoQ1Hw4riZ375S/lIGUAqRuboJP+HiTB+bMNDSL29S/NiU02tgEwChKDjW5/hN4xR4OsuWNYaExWTpo8Py73EGRadxflFTU5e4vSWiRe/rC6f4Xg4GPfmMJWqUfnfdudygiLZlyjBZwr0JA71FvKGLOvUFxWb+7GDFTqEr7AKKekDN/TI56Z1MP8M3q2R3OJu+n5MM0B3k8oyYrxMBJEWoiZlWwdMVCV8rb7dZTUAqmw9I9psFa1pZOwSmtxang0o5icPT3+2kDnlJol+00T/CApr+qqq3Ej+L64lD4SuHxOcy0yqAw6esadM2T+kf2oweMdr9cMS6/zeHDrUNZgCeRp8xBOg69IfSroi+zSn2sVEekMKa5h1hl3IVtspHwDl1xUat+n6ilQl90E9g1ra0q1oLCjQMQ7bN6fx3Vbmn32qqFw/+XUSc7jQ7r5AxuIdlR/ffteL0fBmxAwqiULCRyimdrdrrq8lo/MoVXF9i8JjB70OT+KYyl608peVavwWnFXPu/Y4LW3idrspNEmJS6jaJstuSGYnSOIzdLb9jlLO6A+5A+SWrjgKlkqKPY9bHziyn9Cs8OQ9/8aN2loKWBAdIY7pqEJdm+LpjM7ppUic1G38lpAVmYIai/2alMd59+8zNh5URDIazJv9AOiGQ8biPoQ95qsLr6j9+abAzyJIeCBsfm3++iqf5GE+1KyuaR+JriuSGNF92mDKbXwZyQV9QRvG7E4oQbJFgOu184kZRVGWaOmHAzYn8CTz1MpFFAnMvmEIcYimIrFwM9MSYP5gZJMUfmz157EDVRndtrHSiy+8c8H0TGuTUOmPUKvjV0llHvrswEJSVh9BOm2vo9gvYp+fL3vMVb/am4BmmxEuQ2Q1yO6fMzZWmyZjuxmjEH5KM4DpTFTyiB7+OZc2sx0cfWoHZD3eVSLwxmgTeclZp7G28zXBLgp2t/1xpTtSN3f/Wbj8OK5pbMc85HbXUKnxtjU7izpZ2KYuVgDxWbHRUOYA9DshHm0HiRdB9n4crcQMI85oPSk13WcazHkOUK3SuSTptVOejUecpR0y3nlXXJAQldl9pZKP//rmaaNMMcq00B8A0zcfXzknirWHijiabTK/eIsApFqoRddPhYmqMUu1wxG1iGTZuG4B3JTn4V49IYY+3kfU8iSRcIuowfnXZP+bLG4fQziN1SfE6eBv7/7zwevcH81EIUUA2Ntx04cbiUTuI/dZEFD4k= 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)(376014)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2024 17:30:22.4871 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b7a932e8-3f6d-4b35-edac-08dcdf1a10eb 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: CH3PEPF00000012.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4101 Received-SPF: permerror client-ip=2a01:111:f403:2414::600; envelope-from=Santosh.Shukla@amd.com; helo=NAM11-BN8-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.15, 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. Reviewed-by: Alejandro Jimenez Signed-off-by: Suravee Suthikulpanit Signed-off-by: Santosh Shukla --- v3: - Fixed the typos: s/xt/xtsup at error_report() 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 38297376e7a9..13af7211e11d 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 xtsup=on requires support on the KVM side"); + exit(EXIT_FAILURE); + } + pci_setup_iommu(bus, &amdvi_iommu_ops, s); amdvi_init(s); }