From patchwork Fri Nov 29 07:43: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: 13888444 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 27A84D6EBE5 for ; Fri, 29 Nov 2024 07:44:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfS-0007xL-Nh; Fri, 29 Nov 2024 02:43:58 -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 1tGvfR-0007ww-I8 for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:43:57 -0500 Received: from smarthost1.eviden.com ([80.78.11.82]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfO-0002e4-Lf for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:43:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866235; x=1764402235; h=from:to:cc:subject:date:message-id:content-id: content-transfer-encoding:mime-version; bh=h4EbNeMAboflFm6fa9hcvPl2c8j8jg2W/TDqXg+OVCc=; b=g955eSRIVNk4QbezTZcrrH4XWomwUgWnpug8w9HAywdC1kb1Lxy5jybA B+ZkWVpz9OS12WYyNhbMtOfHVGFs3OeMRGCAx6hZMie3Nb724VkgRXVt/ YGBD2ToIQyQy59LeRwnKcYRyBUrrZ/APo+zQlAVv2hzqtmt98PHRhC19b wRQaj+tHJQ7THv2PoYSGFq2AnVtiu7fQXQ1AFvtNBcco5zS53eIeKo38j wH0rZLDIQ8bPDRFMKpScV8DfP1v+FiQ8txJnt478MO4dB0aglwzFymHM1 UIQMU7NHI69og5bwIPUBpkcnD0XAj8y8C0csTToHOa+IMmUuOz6ewcF2f w==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25664393" X-MGA-submission: MDFVGqWk1QitPo/KAbpxTyTrGeqSmGjK2sGc84vn1BlV1LWEaC3TQzpaHuCwef5WQ6Ny3YGSvH7jQvwmfrThyLw1emFd3nBXJnuCqHJGWg/wSExEIVsaYxI/H0Dth4iVy0HCwZD1ofSfoEdX9ki2DasBjpgEyqx3ZC6h+Pz3jyv+6w== Received: from mail-am6eur05lp2113.outbound.protection.outlook.com (HELO EUR05-AM6-obe.outbound.protection.outlook.com) ([104.47.18.113]) by smarthost1.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:43:50 +0100 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BnS80v9phdhxqCBXCGbCvYtGIEC8oI640BYpnxg9kRGcOFyOeTWfXoxSFZFiPbUlKnZdwqDWUEXi5Rs8o0XJP6xejuNZPslsZDbfJSrZmj4CNRO9mwI6+au0s2uFNXsQMcw2za7VOsSsY2nsdcayefM46mg9ZQene9T5o1uyThcSfNWFPx5ytWRpDYbUlhylucSJIwFagRiishKXs9Pr5aAj4zr9MSbxatHhThMYJR5Bhw/U43REV8R7vSHVwo7a2H03tqtfY6PCRaN7kQ9hBXDeLPvFVL8NI/hTdGCRo4+WC83L7P1TWcXP2f1kmzoZl1LOSLjdVq9Hywi09mmk8Q== 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=h4EbNeMAboflFm6fa9hcvPl2c8j8jg2W/TDqXg+OVCc=; b=F9SghizXq3BCIZbxSYJk/LYIrbBF83ZHZEcPiph5zRFIsUiXh97HYwNrt+LngJM0YBqNV8KBcWuvYyYQsq/GY666somTnFXKivTsAxpy2i+qLvG0PW40sHngP7W6HwkY6499hYlkKEJjiNMT8TXKCQPfSq4DJPFGxfDdEQ8PfYM7KLFPbNj2J5GD8VHpoJ5D+GLBr8dPbVZSkOuQ3tAd13p4G7CtMtbOz3y9hUqeiNfm3cuoOBmfgfoSSKS+4WAfAaeEV3jg7+yXacB0aS/N2ZuChc+6KLmzTIq3knMiUhYmRs/R+j5Nr6joiwHLtPUspIO8uzkSP4/bGsVCKAiVXQ== 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=h4EbNeMAboflFm6fa9hcvPl2c8j8jg2W/TDqXg+OVCc=; b=Dtkutwvopf19X2YCP8tU72H0JMnO4H4/P1GSohjNBbwLTkQd6d9M9iqcJ1jFc6y+dPk4NMCeZckbu9DIycrke1jOY3zgRtzsClFprykTaSDaMKs89bkPcsHLgatEGERJ+ldmMkrMZEb4TqouspmW0yVnNFg2NZScd/J/vCA4RWN7WZjd3sDmgWvLDZgrHrJ5vG2KeHuzq396yKlArsFacH5RmN5N3Wqj6rF7Uawmk5FoEZFEqn6C7vcc5Fc/ftJDPEkw3khop36UoSQumpzKFHUGQM7+q48fsNbbCis9vFXJPwmLGeOPIHyIKSGmyfv3p8Ki6aP33Ld/c6tqHHrqEw== Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AS8PR07MB7847.eurprd07.prod.outlook.com (2603:10a6:20b:39e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:43: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.8207.014; Fri, 29 Nov 2024 07:43: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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 00/19] Rebase ATS onto lastest Qemu mailing list state Thread-Topic: [PATCH v1 00/19] Rebase ATS onto lastest Qemu mailing list state Thread-Index: AQHbQjJtYMdLYHMoY0O5Ot5rnnEL+g== Date: Fri, 29 Nov 2024 07:43:48 +0000 Message-ID: <20241129074332.87535-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_|AS8PR07MB7847:EE_ x-ms-office365-filtering-correlation-id: b3838996-0be1-4834-b6a5-08dd10498f9f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|7416014|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?utf-8?q?ziYDoD+Nbt+7/S6PFvKOrz612dmBO3X?= =?utf-8?q?Z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?2w+WjZuMA53MSetS5VhsGJ0hboZUivI7XJT3Jcsrvs+mAE3fc1dHSrQADZcHUnDX6?= =?utf-8?q?OCtD0CFusLcptwtSz3HWqgNG0BGiHTexXmIbJwMCLi519ZFMDYCqEoa6peky+T5PP?= =?utf-8?q?rGw1Byuq3XZoOnane06eHQjytj0AwQBC4JRiL2QiwTvg0pfOpLlchAPffZxKzbeV4?= =?utf-8?q?I+pXlOh7ZS9jn86Yq603Lr680oDxdoVHDhuGFdl+afnofYeU0ZxXxiEq1jj0BEIuV?= =?utf-8?q?xBMcyDsG+RZdIXcTX+12nDLDjBDANg87ta5B/C5ZaCGMPw4XQBnGfw+TOxNy/jmov?= =?utf-8?q?4JiXmdy9FSMeMXmjCC+767YwN0mf2flSwzXgctdKdNlyIOA2kWKvvCqSC95yEFt7E?= =?utf-8?q?dlJ+BgyrO2Z75GIbvssMN+ioIdfjcffpBnOq4rgsLj8wfBoS7eznwZgyKgqfMhfFw?= =?utf-8?q?7jUXWi9scxO5WZEU3Y2lSiJ6JYbMJpjRsdauSjntn6HPApki8SUlL+g=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:(13230040)(366016)(7416014)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?ONZlGoE1Q5Oxwk9ZJBOoIPnLCsZa?= =?utf-8?q?QwjIlLGfzBBrCarXc0ZL0/Qv457RXLhtyBNo+PRYVprA7nPmr0z9vXx1kMepIjkz+?= =?utf-8?q?LAspIR3NR/XnN8hzVdCzb3JVGuH4DrEf5ngNEXjUEpyXxCI/jFF01NRFrfnWjD0Uv?= =?utf-8?q?XW1XitR/IYOZkw8BuWMWnmAbp+TQxXiSQ8K4y0kVXSguANe8T8fiOLtABjHWq5C0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8?q?6qo1rr0MA6rscxkFty/fHhveWBTWxllnKbZrzWdPnxqdzA/bv4CWp5eY76fWUAfLg?= =?utf-8?q?pA08d15ZI344svWVjTSherac5uWIRb0UzdTxozOmoesIhJdsObj/2j6vVzH0IW4Iy?= =?utf-8?q?bQG4jzLgcnkChCBn2FXy9/ptp7tL2OBiAiJKNduEQSJkyyuBx4wQrTB511wOf9MNc?= =?utf-8?q?Iv5sfvVpYoaeyFqdEDHXUclvWBGpDAapTbigoIxinYjFMKMhnj2nY7Gz+br2ocHHr?= =?utf-8?q?lMbcSpFo8zDdHFvhAmwmELnp0M+XF4yL4XlBtrLAyLimkHIAT9gHmTUIZEkjXgNLS?= =?utf-8?q?qbbFd7L5xg8bzMSrl3N775k9+CXfvJC8kfzpr7ncTLtFzQ3Ryk87xVwHaWB5MK2go?= =?utf-8?q?6Z+DWqc7ChtCIEAGsmCszTxGrfTi5Gk83gP/GicPN2HKriz1Mn9Ocg4SH69i6M6Tu?= =?utf-8?q?j7c06WyGXWVwhgVVNYJFKMv9eawFDvMQi/4M98suQ7iSuZKctk44VjE=3D?= Content-ID: <36AA97A15960CE478252283203F604C5@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: b3838996-0be1-4834-b6a5-08dd10498f9f X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:43:48.4671 (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: s9FfRAXKVjC/jwu96G4qB3JTCcXS1B+odEiOp+TwsHMdAS5sj7oCiZEE7xJRN1OpH3JMHXmdlfM4PMfdKPtc3sM+nZR5iky7E7HlSVvZeTGgZO3KLFaGcOm+thfpeirm X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7847 Received-SPF: pass client-ip=80.78.11.82; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost1.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: Clément Mathieu--Drif This series belongs to a list of series that add SVM support for VT-d. As a starting point, we use the series called 'intel_iommu: Enable stage-1 translation for emulated device' by Zhenzhong Duan and Yi Liu. Ref: https://github.com/yiliu1765/qemu/tree/zhenzhong/iommufd_stage1_emu_v5 Based-on: 20241111083457.2090664-1-zhenzhong.duan@intel.com 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 complicated 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│ │vVT-d │ │ │ pci_ats_request_│abstraction │ iommu_ats_ │ │ │ │ translation_ │ │ request_ │ │ │┌─────────┐│ pasid │ AS lookup │ translation │ │ ││Logic ││────────────────>│╶╶╶╶╶╶╶╶╶╶╶>│───────────────>│────────────────┐ │ │└─────────┘│<────────────────│<╶╶╶╶╶╶╶╶╶╶╶│<───────────────│<─────┐ ∨ │ │┌─────────┐│ │ │ │┌───────────────────────┐│ ││inv func ││<───────┐ │ │ ││Translation logic ││ │└─────────┘│ │ │ │ │└───────────────────────┘│ │ │ │ │ │ │ ┌─────────│<───────────┐ │ │ ∨ │ │ │ │ │ │ │ │ │┌─────────┐│ │ │ │ │ │┌───────────────────────┐│ ││ATC ││ │ │ │ │ ││ Invalidation queue ││ │└─────────┘│ │ │ │ │ │└───────────∧───────────┘│ └───────────┘ │ └────────────┘ │ └────────────┼────────────┘ │ │ │ └────────────────────────────┘ │ │ ┌────────────────────────┐ │Kernel driver │ │ │ └────────────────────────┘ Clément 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 | 128 ++++++-- 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 | 20 ++ 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, 1280 insertions(+), 31 deletions(-) create mode 100644 tests/unit/test-atc.c create mode 100644 util/atc.c create mode 100644 util/atc.h