From patchwork Tue May 21 13:11:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: CLEMENT MATHIEU--DRIF X-Patchwork-Id: 13669452 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 65B9AC25B7A for ; Tue, 21 May 2024 13:16:33 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PI7-0008MC-TY; Tue, 21 May 2024 09:12:32 -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 1s9PHk-00080I-Rh for qemu-devel@nongnu.org; Tue, 21 May 2024 09:12:09 -0400 Received: from smarthost3.eviden.com ([80.78.11.84]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHX-0001aP-Jn for qemu-devel@nongnu.org; Tue, 21 May 2024 09:12:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297115; x=1747833115; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=DCiJkhq21aLilYfmazBpuY1RUfcOG8K07TIGqnYLIIA=; b=xO/veNJoRZ7S6utpdlVBTLEGHsnWnPAZiiJeVv40Xghcb95Cq/wf3m0P AUT4o8zfv7jemswo8pMhGbTSRvGJyKDLDm8WURxoFbW1BR55qcx7RHnQw nc+7UFBe3QzEihKxc5mRtPn08ivj04fNbr4LEaWoR1ZnTa38TqgJSxlo/ I/1qt13yZHR5ZWB80VjcFvmvM7LAnUYWZBZgoDhpsyo1tLrCG5xhC2Eqj tTAJUOku4FZG9L4L4ioRPd/KW/bC0iMF5JjvUPArBn1kie5MWPPWaAHav 7rz/4ZMNsZ8Eeo/+RESJqZGcWpRCyOuVGYRiSgrd9tApt3UTaT5L0hNdG A==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13008007" X-MGA-submission: MDHmFhhalvjWrzQ0fRygSkGcqSE7GLc4sCcutQk7xsrOgK8IdFXakGlcISYnQoECxYBVQ+UAbsWCKiy4I9G9BddpY+JtayA0odMub8+ii9bIIp3wSJb+0mBUHT808JcQEypRk8YQtExHPyMwqVWTEIMQTkHo531AGoHheBWssESfmQ== Received: from mail-dbaeur03lp2169.outbound.protection.outlook.com (HELO EUR03-DBA-obe.outbound.protection.outlook.com) ([104.47.51.169]) by smarthost3.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:49 +0200 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kSurGjSpYJECA4rF5phkaFv9S5/FehR9YSEOqmG5dvKKHbD9BAS/mABy+m6fcEOm1BPA4tndT/dvdjQQtwd3Da2L48oWAoJORhzA9i3NTIZBxR2yHOWQiVE/IGPbgTy3Bl5spj//EoxwS8zFGN3mve6DVuf16TBIJbngxVkd2xPuyWSmCJqlr8mMziuDiVx6IF9cyYnoLWahQpep20ymEk0ze05pQHwuOXR58DILg/ZfXRLpao+QQtU0l6VemYpqaAGwX9mut4brCuebMGvSH/Pq0IZEU+Drto6f3OhwiVySW7uSk3DcyzwmAyhgeDIlSnCQVe95gz4ip5VQtfUaUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=DCiJkhq21aLilYfmazBpuY1RUfcOG8K07TIGqnYLIIA=; b=Zi8MhFCYW6HjQO4INFy51gKSThX8dMshjGCDe10c1qD8awmJ6phoHvOi1BnCuhhQ6ySPSO9i8aMs+fNff4pQvarjiSFzb5jQUKkkDD7zz9v1eR9DOhQcIG9unbijMgck/HoOd4vKESn6biAQcXgfuaFezVJTmFCwqb83n3vAqwKS2zfK/xNU5tsX6RKvPlyHJMbF5OeutvKflFIn03gpOgoCHtiPyeMmTy1DDtsQrlTDJgvBJNtV4h9lWErh63TaWS4zAg2EfzYPBD588RY+SRQDMVTjVzM8BA5JqMVNhAcpK3TxEn9ZkM3abTu3wt8C6d9bdeMnWJbQPEjBMmPsvg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=eviden.com; dmarc=pass action=none header.from=eviden.com; dkim=pass header.d=eviden.com; arc=none Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by DB8PR07MB6249.eurprd07.prod.outlook.com (2603:10a6:10:140::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Tue, 21 May 2024 13:11:48 +0000 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com ([fe80::fbd7:ca71:b636:6f9d]) by AM8PR07MB7602.eurprd07.prod.outlook.com ([fe80::fbd7:ca71:b636:6f9d%5]) with mapi id 15.20.7587.035; Tue, 21 May 2024 13:11:48 +0000 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 14/22] intel_iommu: implement the get_memory_region_pasid iommu operation Thread-Topic: [PATCH ats_vtd 14/22] intel_iommu: implement the get_memory_region_pasid iommu operation Thread-Index: AQHaq4BvLD9RdICWlkC5j/mZ2ctG3w== Date: Tue, 21 May 2024 13:11:48 +0000 Message-ID: <20240521130946.117849-15-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> Accept-Language: en-GB, fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=eviden.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM8PR07MB7602:EE_|DB8PR07MB6249:EE_ x-ms-office365-filtering-correlation-id: b29a5b42-be93-4a89-b206-08dc79979241 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?q?/gga3QJDVB1z9VB8dmfPa13wNPV0qMl?= =?utf-8?q?UpmNd5LS2dmzm2dzrjjHV5ZO4b6Wk7JoypG9+Q5uD8eR+wQ+d5VM5knVB+a9CjVlw?= =?utf-8?q?nzArK69lmJhaKCP+nLXh2NBkVJhys4yw5+1slCEdh+y+rKFccILHZDAxdE/UFAAVz?= =?utf-8?q?fJNxv8xEsMkjAivDsBvE8fziOfhu1TLkXA+Igt5nEc4IzMHRiMgsYXJztgYlPpKkS?= =?utf-8?q?TgDN0U4f30ZmRobI1+daRYVwtikFYTjndcvMytWp5AOlVZohnkGNIWZk55qXpxUFF?= =?utf-8?q?MKHYF9cnmS8AalwJ9075FvbksKHdMepwcbbIrTbfr7/N3uvlDqP78hkas9TwnwIwi?= =?utf-8?q?gUnpFXXnH+f32zMs6ThflN7eWLt5zLfLDpcEhwknYogk4Xg+nmqx53JxsMEs6Om/Z?= =?utf-8?q?UhCl/FUeE+rIbt2IwI3Vg7eP5/PKMG8Qlh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forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?/2iGzzmvzC2rvh466I9+rJIEJoF2?= =?utf-8?q?tQd9LqRdSXVWR81d+7VPNhLDsp7PJdiPbvBXEnM5nZy0iIMC7U2R3jmcN4WJMyNUR?= =?utf-8?q?JZwsgV+LxkFFBt0ajviCBjZSYy6GaIUBWsDnOH++rrTZJdFkwSBKMQ5sKUNOOZ/38?= =?utf-8?q?IOsFAthc10XEurMEDAc3Q+TQvx4vu/SbNMVJEgZlzvxbhBkyyuQrk7/1Y+1gaWBCz?= =?utf-8?q?qKmp/GYhqI8QTr2W4QSZtymSpYv6MxRZXtHPs6cvJ5YWM3GsdxbBn6ZeHQHbaT0bL?= =?utf-8?q?1bOB9GNZFzWbwdK49dVSQMJmmrO6gKebp2BNv9qokc/BIUSpbYu/tgCtmL1Hta9tV?= =?utf-8?q?ZHY/PzUJxX9cOObDxDxAo6nMFQRxG2WVBllEzJTbxbS59RHLfM6JBCbx6J2D3t3oU?= =?utf-8?q?EYZ7oZDx3BqAcb3Ut6Vq7PnG4h6JK5+m5ZdG0CwbwIFyc2WG8Ia0nYDMmFXDMdh9d?= =?utf-8?q?7WMJyTeMvLwAtbuTvlRJFYNxaYpC2ZcSiVD4Ei+Ja9T8qK4qW/Bg2ybC5xM9oWeVc?= =?utf-8?q?3jEdcXdp8vaCPcQWdj70rjtyRKUqjmTN8t2PD8Fp9fasHFZ9K86OLsZBqt/xvRsNo?= =?utf-8?q?qgXye7reRC/ciC+0eJvwPnMh3q93dNce3jIp2YMGCK4lkvdjminDCX53LXYAr0zos?= =?utf-8?q?xm20ELbDkrn6EfOQc8nB0T9Yvk+TX0u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6ttIQ=3D?= Content-ID: <6DFD8BD61FA9454FA18183404D15A7F7@eurprd07.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: eviden.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM8PR07MB7602.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b29a5b42-be93-4a89-b206-08dc79979241 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:48.0177 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 7d1c7785-2d8a-437d-b842-1ed5d8fbe00a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: zdTMM+A4ni+KszHu0fn/fP/DiRR2EJ9Avw+YVmdIZfn6n82KWjyfrk2hwc496CoFaucBcJSCFsIJhXE3ZGLqYaloTlgevq7JRl+OOnChKB2AEI7aYMZKq4VzsVTg+xpS X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR07MB6249 Received-SPF: pass client-ip=80.78.11.84; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost3.eviden.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, 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 Signed-off-by: Clément Mathieu--Drif --- hw/i386/intel_iommu.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index e83985f2f7..a42938aacd 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -5975,9 +5975,24 @@ static AddressSpace *vtd_host_dma_iommu(PCIBus *bus, void *opaque, int devfn) return vtd_host_dma_iommu_pasid(bus, opaque, devfn, PCI_NO_PASID); } +static IOMMUMemoryRegion *vtd_get_memory_region_pasid(PCIBus *bus, + void *opaque, + int devfn, + uint32_t pasid) +{ + IntelIOMMUState *s = opaque; + VTDAddressSpace *vtd_as; + + assert(0 <= devfn && devfn < PCI_DEVFN_MAX); + + vtd_as = vtd_find_add_as(s, bus, devfn, pasid); + return &vtd_as->iommu; +} + static PCIIOMMUOps vtd_iommu_ops = { .get_address_space = vtd_host_dma_iommu, .get_address_space_pasid = vtd_host_dma_iommu_pasid, + .get_memory_region_pasid = vtd_get_memory_region_pasid, .set_iommu_device = vtd_dev_set_iommu_device, .unset_iommu_device = vtd_dev_unset_iommu_device, };