From patchwork Mon Jan 20 17:41:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: CLEMENT MATHIEU--DRIF X-Patchwork-Id: 13945420 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 6F1EEC02182 for ; Mon, 20 Jan 2025 17:42:01 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tZvmV-0004WD-Dh; Mon, 20 Jan 2025 12:41:47 -0500 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 1tZvmR-0004W0-Uh for qemu-devel@nongnu.org; Mon, 20 Jan 2025 12:41:44 -0500 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 1tZvmN-0000YG-2b for qemu-devel@nongnu.org; Mon, 20 Jan 2025 12:41:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1737394899; x=1768930899; h=from:to:cc:subject:date:message-id:content-id: content-transfer-encoding:mime-version; bh=7NAQVfC/tCfF1NWumohdksC3dlrErc2eAT14cFpCGqo=; b=M9Q6ZeK4fDqKh9X4uKiHgqIIlEIa8Xx2sFfwP9Cms/bwpzSJLcgD/Hgc 1tXTuZ4Rt3FbL+HzXnDvzhUTQ2hZaeq+XAJLH3+HqzikrAoGdv4V6Ewj+ imwpjnsvw9+O1xTEF78+uPm7kH3WKeQmbwU0vNEpBZ0m+FEjDQ4ZYG1/4 z8/ENR9iVtd77NKWRX9GWInhvGbHZu41Xt7HNsVi+0C6VwcoQf0CRIwJP QMlYm5PoZyCWG6E8U1BHEsOZaBNeqAhjN+RAKm9pdelym3KhniV/9MTK2 nI5Lws/reP/tomDK0DB/X+qoBgGL0UvpMTwU71SCdFmNhEFvK5LH7kFx+ w==; X-CSE-ConnectionGUID: bpdUAIagSXW6RENmRixUtw== X-CSE-MsgGUID: JOLxYnJaTQKVz4bZ0Ozp2w== X-IronPort-AV: E=Sophos;i="6.13,219,1732575600"; d="scan'208";a="29125391" X-MGA-submission: MDHn0GS+Y4TotkpRuY85A4TPLaASGkwYPTYQtAj7nxecD3DnFcQZOsvufHRAnv+q5WQE6MXOoUjgahbb8WJyW5hcHCBuFZND3uh0+Sr80/B3MY68N4sgDtIGaEKmFcSQxi4VwSI+GOCfq/40VwWmFhZdy1vAH/+pg9XI/7xJWZ7wLQ== Received: from mail-db8eur05lp2111.outbound.protection.outlook.com (HELO EUR05-DB8-obe.outbound.protection.outlook.com) ([104.47.17.111]) by smarthost3.eviden.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 20 Jan 2025 18:41:34 +0100 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kg4FtLg9WRxTUNWZjERzmA67Tvb1Cypo9sSFOU3NcIczrJ99WTEBf27ojBbraIamp8DboR6xqYAnr8tAnjjs6I5eM3bUKRoCSc13WIo8phXtlmKT10Eu3vd5/L51CgUiaA3mDKPA6UoV7WA8vDeQJvJFUlsZupEFDA1n+42WuhYlNDusfEjYHma3raTYWC5YZPwyczsXy5LwJbnDK3ckkNoQlGnJei1o3Hi4AMf55VsYSw8VqbsISK7Dm8DrEAGPBcY/p49z90VB2z79QWqzaQO4/kZjowdLWM1yELI6EJ/2roAwS6ZUqrNuglYALaq8xx59tJr4k84VfHUZjOGGHA== 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=7NAQVfC/tCfF1NWumohdksC3dlrErc2eAT14cFpCGqo=; b=sL+35wgwWuXDHsWaN4xZ+2983PIHqod9HwGFL/Rmsba2fMycsNEkeff8ytCbQyCZDxoJLck3dJ9i47fqNmWFj0cN//npbfuV4OLIBhxJCJjntajDjHj9icGWpUwvSJ/ZyJw5ITfMoOuqQ1FeOctl2APb8ZXbeMvtNZMVm1h+XMrNNuuS4t3yG0G8Jkzv/XkVORHJfbIllC3BX7I1oGqY/ZO0AEbEQXaz1yQj2dxzlceENWq4rdBnVYxbJCPMi111aTr/2pfwCYLfnIvU/ssJsRS3Bu7IEDImRyDOOyhVjIKW3skJyBOhPu6rOYJ1m6gDsClb9hRHETaHcH/id9N5MA== 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=7NAQVfC/tCfF1NWumohdksC3dlrErc2eAT14cFpCGqo=; b=VmSy9jTAcWHuSR2lUEpysY7sbY12bFJ0ngXDh26o2U29gUbAeB+tz5afd+VOT8uSIZ92UJrTurHVArYVn2llXNXMjYY3cMfwDBH7ZXzj5DCMGHW9DocmHRlYcQojVWmQs51r7SQzjiYur9Ua+3EgCzGrcfQbRRM1iCPTzj3bKA1TFi90wtEWFSy22azNFDjalV7c6QdYRz6RLu3L5Cnc4J8iPcZ5zYFRoKM5KujyULIfgDHozdI09/tGZEKORi10ePlkMPOq9VcqpjU0u1BJZwpQpqURxkiikAseObxb0jCes2evljAAO4ypmQvr0TgGcUJHuzVEsNK/D2K2hNl8BQ== Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by GVXPR07MB9869.eurprd07.prod.outlook.com (2603:10a6:150:121::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.20; Mon, 20 Jan 2025 17:41:32 +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.8356.020; Mon, 20 Jan 2025 17:41:32 +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" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v2 00/19] intel_iommu: Add ATS support Thread-Topic: [PATCH v2 00/19] intel_iommu: Add ATS support Thread-Index: AQHba2KLpfFmtaa6cE+9AckG9GvxYQ== Date: Mon, 20 Jan 2025 17:41:32 +0000 Message-ID: <20250120174033.308518-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_|GVXPR07MB9869:EE_ x-ms-office365-filtering-correlation-id: 95565f4e-63c3-4922-b2e1-08dd3979add4 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|1800799024|7416014|376014|38070700018; x-microsoft-antispam-message-info: =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2wfTKOkm6calAtqxKQCa2znH2hg8FpHO7LCiXQsXdV9?= =?utf-8?q?HF6daoa2jBo4yx6yB/3zl6umKMiWHouB3nOwELNWVSR1nj6sAmMEc0YTNjkKhx/vu?= =?utf-8?q?ltQLPQetjursVEDLNmNV187xN41jOz79/WI9cWP6lhQJGKXLc2U4KDppq6I5CzC5Q?= =?utf-8?q?JhijSZnpnjciwbDOtpt4sCQ137m7YLMsI+OgJ2sDskU3RRLKPocoMVrBTNJl4/Nhd?= =?utf-8?q?uYnZ2Orpi1jh7nNOG080UQMPRVhwaACfS7pQwRF/Puu6HtFMf1vcSdwl/4oOEvQ3h?= =?utf-8?q?QHclF8L+eNEqD+JreBVsuCcfzkhnU7D68H+1V33DpAgD/iJ+CAL1HH8R6bn57nCkH?= =?utf-8?q?xgpt3TlO9LpDfudCQREDmqTYYjx5ZOXla/AIUEOS5ZBnk+O2LFxDVLM8ykKDiAVdW?= =?utf-8?q?PyLJc6vZJfCAuR/57ivNg88K3cmJJe91go1qXQHxMMPa6akYzqns5aNZPzUdtFW8M?= =?utf-8?q?wJxBF9NKlBTXVtJ78i5UrqtTY6QYr3pvHh9S5nYBpLJeyeaafdidU+nqQCT0VAv/v?= =?utf-8?q?YLSjGODfLwp?= 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:(13230040)(366016)(1800799024)(7416014)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?aNoVGJXgAJpmugDyxuNwSJ9jrKo/?= =?utf-8?q?eTH4dw+Yr4jryv2spg5/LX4Y12WKGfc1sPhVKECYUs0pI2o+vVf0byyxto8+uXygc?= =?utf-8?q?mrdzaol3xxz4JRdkXqPJrc04taoyaiFCQtLgQQZZzsRaYGYcq+v/yXZcUHgJuLuR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nUmFLkQciK3QRf?= =?utf-8?q?OKkpZJxQSDAYFpAPXlfnjYfrCWYQY9M6NOPDzwPEaYjkNCKXxgx+BoZzsJcbaXwyp?= =?utf-8?q?H/AmG6umNw6wKMfl6k+Si2ZwbfJEMXGSam4huBrHpkla/63AjynTa3DsGmNtQqMfY?= =?utf-8?q?Y3nFPkLI9E0cdDLJfnFai4r3695Z2Ql6up+inn0y8wg5PNoH/5AgtlTHmPaW2U2Jo?= =?utf-8?q?fiLfYqD3nT+vH1ZFPgD4OM58dlpn82+5FBCMcFIvGdJZ2dFTZ0SBmY6Uud5KAaM3q?= =?utf-8?q?RixrLHm1VAizNtttwSkHXXHm4JRyAxqXO2LOm8sGJc+Fzc2RIpEpw1Sb0NsdJYhWx?= =?utf-8?q?xsQCTaoHVxCylyMC31ZPzVx8IWtGnopofxBGrxXLM5sp4kBpEkhQWzI5nQg1oop0n?= =?utf-8?q?++PemGJlzIJgBF+i1BgROz+B+mHwLC1hpwizpz3B1wgGXlyCW7VH1Pagp1hIK4Kkj?= =?utf-8?q?6/8coxrNKxbnuEXl482SAH8DuRBxiU2F+8MaGv3jUv+8kMHOXcui7fWLsgO9s4nxq?= =?utf-8?q?zmpiKT3IY4bu4IwUNw85tIdYR7MJs1PV7qEbzS+EwMlyBai8jNviqnA=3D?= Content-ID: <5353359807EB9249BA868B6147EAE69E@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: 95565f4e-63c3-4922-b2e1-08dd3979add4 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jan 2025 17:41:32.6522 (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: QEGWet+xIyxu8atVm5CZCC71JUUVTsvWLMrAsr84NSJV44nCx1zdWQLTPFhwFj9n2KsXx+MkZvSCIfdLjdc8fzTU8X3uXN+wjHN59n+vzlfs6hdP6ht87a1RP31YAXrx X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR07MB9869 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: Clement Mathieu--Drif This patch set belongs to a list of series that add SVM support for VT-d. Here we focus on implementing ATS support in the IOMMU and adding a PCI-level API to be used by virtual devices. This work is based on the VT-d specification version 4.1 (March 2023). Here is a link to our GitHub repository where you can find the following elements: - Qemu with all the patches for SVM - ATS - PRI - Device IOTLB invalidations - Requests with already pre-translated addresses - A demo device - A simple driver for the demo device - A userspace program (for testing and demonstration purposes) https://github.com/BullSequana/Qemu-in-guest-SVM-demo =============== Context and design notes '''''''''''''''''''''''' The main purpose of this work is to enable vVT-d users to make translation requests to the vIOMMU as described in the PCIe Gen 5.0 specification (section 10). Moreover, we aim to implement a PCI/Memory-level framework that could be used by other vIOMMUs to implement the same features. What is ATS? '''''''''''' ATS (Address Translation Service) is a PCIe-level protocol that enables PCIe devices to query an IOMMU for virtual to physical address translations in a specific address space (such as a userland process address space). When a device receives translation responses from an IOMMU, it may decide to store them in an internal cache, often known as "ATC" (Address Translation Cache) or "Device IOTLB". To keep page tables and caches consistent, the IOMMU is allowed to send asynchronous invalidation requests to its client devices. To avoid introducing an unnecessarily complex API, this series simply exposes 3 functions. The first 2 are a pair of setup functions that are called to install and remove the ATS invalidation callback during the initialization phase of a process. The third one will be used to request translations. The callback setup API introduced in this series calls the IOMMUNotifier API under the hood. API design '''''''''' - int pci_register_iommu_tlb_event_notifier(PCIDevice *dev, uint32_t pasid, IOMMUNotifier *n); - int pci_unregister_iommu_tlb_event_notifier(PCIDevice *dev, uint32_t pasid, IOMMUNotifier *n); - ssize_t pci_ats_request_translation_pasid(PCIDevice *dev, uint32_t pasid, bool priv_req, bool exec_req, hwaddr addr, size_t length, bool no_write, IOMMUTLBEntry *result, size_t result_length, uint32_t *err_count); Although device developers may want to implement custom ATC for testing or performance measurement purposes, we provide a generic implementation as a utility module. Overview '''''''' Here are the interactions between an ATS-capable PCIe device and the vVT-d: ┌───────────┐ ┌────────────┐ │Device │ │PCI / Memory│ │ │ pci_ats_request_│abstraction │ iommu_ats_ │ │ translation_ │ │ request_ │┌─────────┐│ pasid │ AS lookup │ translation ││Logic ││────────────────>│╶╶╶╶╶╶╶╶╶╶╶>│──────┐ │└─────────┘│<────────────────│<╶╶╶╶╶╶╶╶╶╶╶│<──┐ │ │┌─────────┐│ │ │ │ │ ││inv func ││<───────┐ │ │ │ │ │└─────────┘│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ∨ │ │ │ │ │ │ │┌─────────┐│ │ │ │ │ │ ││ATC ││ │ │ │ │ │ │└─────────┘│ │ │ │ │ │ └───────────┘ │ └────────────┘ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌────────────────────┼──┼─┐ │ │vVT-d │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ∨ │ │ │┌───────────────────────┐│ │ ││Translation logic ││ │ │└───────────────────────┘│ └────┼────────────┐ │ │ │ │ │┌───────────────────────┐│ ││ Invalidation queue ││ │└───────────∧───────────┘│ └────────────┼────────────┘ │ │ │ ┌────────────────────────┐ │Kernel driver │ │ │ └────────────────────────┘ v2 Rebase on master after merge of Zhenzhong's FLTS series Rename the series as it is now based on master. Changes after review by Michael: - Split long lines in memory.h - Change patch encoding (no UTF-8) Changes after review by Zhenzhong: - Rework "Fill the PASID field when creating an IOMMUTLBEntry" Clement Mathieu--Drif (19): memory: Add permissions in IOMMUAccessFlags intel_iommu: Declare supported PASID size memory: Allow to store the PASID in IOMMUTLBEntry intel_iommu: Fill the PASID field when creating an IOMMUTLBEntry pcie: Add helper to declare PASID capability for a pcie device pcie: Helper functions to check if PASID is enabled pcie: Helper function to check if ATS is enabled pci: Cache the bus mastering status in the device pci: Add IOMMU operations to get memory regions with PASID intel_iommu: Implement the get_memory_region_pasid iommu operation memory: Store user data pointer in the IOMMU notifiers pci: Add a pci-level initialization function for iommu notifiers atc: Generic ATC that can be used by PCIe devices that support SVM atc: Add unit tests memory: Add an API for ATS support pci: Add a pci-level API for ATS intel_iommu: Set address mask when a translation fails and adjust W permission intel_iommu: Return page walk level even when the translation fails intel_iommu: Add support for ATS hw/i386/intel_iommu.c | 122 ++++++-- hw/i386/intel_iommu_internal.h | 2 + hw/pci/pci.c | 111 ++++++- hw/pci/pcie.c | 42 +++ include/exec/memory.h | 51 +++- include/hw/i386/intel_iommu.h | 2 +- include/hw/pci/pci.h | 83 ++++++ include/hw/pci/pci_device.h | 1 + include/hw/pci/pcie.h | 9 +- include/hw/pci/pcie_regs.h | 5 + system/memory.c | 21 ++ tests/unit/meson.build | 1 + tests/unit/test-atc.c | 527 +++++++++++++++++++++++++++++++++ util/atc.c | 211 +++++++++++++ util/atc.h | 117 ++++++++ util/meson.build | 1 + 16 files changed, 1275 insertions(+), 31 deletions(-) create mode 100644 tests/unit/test-atc.c create mode 100644 util/atc.c create mode 100644 util/atc.h