From patchwork Mon Jun 3 05:59:49 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: 13683276 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 EA164C25B76 for ; Mon, 3 Jun 2024 06:02:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sE0js-0006r0-Dq; Mon, 03 Jun 2024 02:00:12 -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 1sE0jf-0006io-UA for qemu-devel@nongnu.org; Mon, 03 Jun 2024 01:59:59 -0400 Received: from smarthost2.eviden.com ([80.78.11.83]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sE0je-00072f-1A for qemu-devel@nongnu.org; Mon, 03 Jun 2024 01:59:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1717394398; x=1748930398; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=PaF1jpNiXIxhEHv7houvHLORN0+AzjnvPV8H0KLGjak=; b=SfdeZq2lzx7odD7PogofDUtKkY9Xjeux92n/LqvZBzOtTKzaTBb4e4hT +6zZoKWS9g7vVn2KA4xNmtlKlIT1l/ncFgTkGTj8hh1HHo2jfed/WOMo3 j7xmsXSKbSXjnP2UI3fZzAG84ThYBTUlskjI55YGEc9YAkdegkepv3i88 8c7ismJllWXBS5ir60o0Sovixz/uXiMInEKDMxbXP0Ch0c+AJueFo9h2d l2FTNQ6xZWRtPEoAH3KgFR4ATQhYyY6tWwYZGE5UyYZ/xbjYPCBZmWWdg 7Kv3u5Vcy48ZYmDYw1OhREOqfFoYDRWa4NqW6V3NBJcmHoCL5ZUVQkOft Q==; X-IronPort-AV: E=Sophos;i="6.08,210,1712613600"; d="scan'208";a="13763249" X-MGA-submission: MDH9/EM0uA47Z5iTqrPJktTNnXEoVdPDxPLTNAmdU2MNkbrMYYOz25F0JVjCucDMDXzDpo7ubXl4Guvi8FmWacw/8jDHBC9JPoUH7InMC8sykaTpd3G+naGRPE7zqmeWJlFPrWOXTEEonLQEuo+bKcYyzVmgxzpc39A7q15qZTBeFw== Received: from mail-he1eur01lp2051.outbound.protection.outlook.com (HELO EUR01-HE1-obe.outbound.protection.outlook.com) ([104.47.0.51]) by smarthost2.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2024 07:59:54 +0200 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e4hrMpKpsYxawJUHBdxw/6uZRXs4xzzFgzE3kwk3QwDZD4u9CGmwcJBL7oJTo825Vp0z0T/f+N7n2zVSFOM7Wa8c9VEpTE0Z40pGH/NQKZvgHcvV2KKnm7v8lp9qR0jcLb/JepVzD1VD0hdAgIDTsknhV9CX4Cprzh4s4fV2tbiMHHy44NPz4YiEd2YUQkNYuRYxr2HMPMhXrFKvC28OxYRmp9AIGKBqD71Ee5WB7MK/9qxwl3v3l7glchlKqbI7Onwy5m2TnAFNKECIWP4eXLeHAt4hipzM1P2TJUIhx43tNrWey+7HjmWXP2FMTEOvODSRJnI2je7rrA4aCV/4cA== 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=PaF1jpNiXIxhEHv7houvHLORN0+AzjnvPV8H0KLGjak=; b=DXG9aGivBdzSS8WOw2L1jjOfgvxwqAaOaSERd0jA6JT8ChqMDWoUv/VgK3c2RD16jk1ow3cdT8bBS5BS5wSipNQx6d3OA43J5jX/vJ6odDpWefdLjD2wwXvX3Pv868/S1HEIjrgFbYZPXBOHGI3z6tBqoaOLEfZZHWl0GIXCYJcYMuWe5D0okkK3Qq4NUIm7qiYoKcY4zk3nIx9A4NGp4JvgNww8jcdHVkdn8u3QmfmkM8T9gWJJ3vzJ2I1WOFny0Xb0wYZsEWqL3R3X+ZwNknufiiQpzKtPbR356Yx2AZ1WhXxJG6zN3iJsaMob9mn3PNOKhNjvT7M4GdD16S10kQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PaF1jpNiXIxhEHv7houvHLORN0+AzjnvPV8H0KLGjak=; b=e1OctJ2GpU6oUQCUum6j57jxrhD0YhTdjto1OpYoEsaDbuM+iN12gRPcbFKja5r1bMNl3vWnbEcLjkqoyJsnybY/GUeTUOyecyofUf9UzkTa1QEESm/O66m4l5xh+rEYfrbYOpHnojykn05UjdJPRDjISHKb5j4wRBc9a/6PbX5/M1R0mkCu4dLYtOqR5nMSSS74atsEatK106HbGrBCN0m5V+8uqqllet7eObVBfZJKRemlpH6XjRcMW+50Ov5W0fjMYnidhCaPoWJKomreZVdLQgNFw6I41Q0VxyvtNQ0pODyPX4N7ItsW8kX2VOSIMBv+Tu042SQx/aV69iFL7A== Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by VI1PR07MB6238.eurprd07.prod.outlook.com (2603:10a6:800:136::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.21; Mon, 3 Jun 2024 05:59:49 +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.7633.021; Mon, 3 Jun 2024 05:59:49 +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" , "mst@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd v5 14/22] intel_iommu: implement the get_memory_region_pasid iommu operation Thread-Topic: [PATCH ats_vtd v5 14/22] intel_iommu: implement the get_memory_region_pasid iommu operation Thread-Index: AQHatXs+MAXYJyAioUmyLyGhw2C/bw== Date: Mon, 3 Jun 2024 05:59:49 +0000 Message-ID: <20240603055917.18735-15-clement.mathieu--drif@eviden.com> References: <20240603055917.18735-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240603055917.18735-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_|VI1PR07MB6238:EE_ x-ms-office365-filtering-correlation-id: 40c55032-d11f-43d0-9c61-08dc8392611a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|376005|366007|1800799015|38070700009; x-microsoft-antispam-message-info: =?ut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st8PCkLCp7sytD4dU92rj?= =?utf-8?q?VezaP3IKkfmJSwYmchtYXRO3q1uvdUXd/8U4dZgcmgRnC5dYrVtABut/9Mpc+W8Kv?= =?utf-8?q?MN9mO47eGQlkHBYCRXRZtzUJbgOyiVHWwDW9tgbr5Auq4iktZxPj16Ai7+l14Cn0c?= =?utf-8?q?sMnbpbWSJ4l4qQc8/zvd38coJwr0K5t8o+Ew6g9DRu4sQ+y2g9zrNNziRS7d7muKg?= =?utf-8?q?VCtYPWCgsscAO0lVYZVz89HgM+GQ1d/rBcUuu4JtMi/uvr63IqZNreo6dxEe44s4l?= =?utf-8?q?zKqKAmp1ZRPsu2cLY5xvCoSJcp+zoP5dmUEFFXIHDU0Zvmzarz+FtEGRVcMa52Jxj?= =?utf-8?q?GZLHGCghVEit4Gqq6iVJPrl8Of5Yl7vTP5GQCOlYZrqBDP06Guoaq92CY6opdSuVY?= =?utf-8?q?P0iD3DMoZ0KzgTtNJ38KfV+a2Y4xqMzvmjg=3D=3D?= x-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)(376005)(366007)(1800799015)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?VWX7INkr5MTycma/XMzwzA7qKZb1?= =?utf-8?q?P9FtKke7/q7rXrFuUVq37xViFrw3eT1alvCFSBQ0bvcLYLPiszlcvFJUTUcarjd+s?= =?utf-8?q?QyPTwFnF3MtD24luf63jE78upUfxjcDVmsji7fsjpiiH+1IPAbr7m9WA3XmWCqr5Z?= =?utf-8?q?uLFnnAJ6sHG7JPKCsVzsSc2+zE6lhcdxeV/rgGc+r2fp+awskoRP3ZhLg3jdxd3LO?= =?utf-8?q?d3Dl0gbgMgEElUyt5egT3wNXnC/sgpLUjRcbg5ujtXL7AeT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fAY3HbSWIsBBRHnypYehmGGU?= =?utf-8?q?2hYCFdUCBMM5+Z/uvX3aS6kGM2tgaLBsWakDAsR/TVjH/o849eD92MEoU7mY/yXEI?= =?utf-8?q?vVxr4iaqG0r1IeeFePODqOpuQm1ZXVD5W5PDkntnaUD5AQrSePRvdwQloLFTsEMPF?= =?utf-8?q?conZZ8RnQK6TAoIuitQvvPPVNHGEhDNwPF3ltFPeEstrcsBKV3cvdPRNqH3ZA9kQQ?= =?utf-8?q?tFbQyA9DV7GiQ/6U1pyQuVkzaZO4k0EOJTvzjTtSOI4+csfanfPNaDc1aqF8AX1Ys?= =?utf-8?q?xXwSsCzG0C4KjZ1RnxHo4xexVW0iuPkVnSAslBIfOhchd/McHPStC09uRU50aVUUV?= =?utf-8?q?yCAQfQhDOd7yeVjBws+1AtHxbw5Oh11vtwmndYt9E+AprdFUJkDNTJtDcK8mi42YC?= =?utf-8?q?ZjaD8Af+6nB9lgiv6Kr7HFRMOGADxPbPBKOYclNWNjTPOfcr5t2gJko=3D?= Content-ID: <65A60D98503C274F85AC23DE05819053@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: 40c55032-d11f-43d0-9c61-08dc8392611a X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jun 2024 05:59:49.6871 (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: j/fGCMZmCF8sDiQ90fg4Lt+UuwEfO/ZselZYk8NvGN8IFtqM11c3GYXUcaGpWlHlgMI3weR98N/cqITqVhu6ugKm6dgdINgB87OAfPZz7hmtU2RwdY8bqiRvJKd2anaE X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6238 Received-SPF: pass client-ip=80.78.11.83; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost2.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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Clément Mathieu--Drif 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 6a68df0154..d607562de2 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, };