Message ID | 20231020093719.18725-1-yi.l.liu@intel.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp933714vqb; Fri, 20 Oct 2023 02:37:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEl8jEA5obn0gj5xutYP7ZXFeMORB3QhndqmXhYT5J7sdGSoUb5ije/EInnqxXxEBoFHutL X-Received: by 2002:a05:6870:1707:b0:1bb:84af:bf8f with SMTP id h7-20020a056870170700b001bb84afbf8fmr1427887oae.58.1697794655091; Fri, 20 Oct 2023 02:37:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697794655; cv=none; d=google.com; s=arc-20160816; b=p9lGnJaQslLBEZ1w4OPZ0ARr7N1C7ytNqFgni4iTb5jj7MpSURNP10eCNIkVb4qIjF V+iZDuvCalNCslOaBZ1FBCOnfjcywbOeXpciQA3e+WkCWpVvsY4B7nbNwxS4+Ashb57q V+J5glyk9WnZHHkfILy8KqTLIO9epcMG1rMnfPLLeiM9NsuvK6W36Cumk96J5wStlGmF emDry+jH8HygBT7SqK8zTnUI+6ITuW80hB9eBz7x4VcWeDCAtMfMda9Vz3rac1gAlvZW 08ttHuxKmitgM8ezR8Kl85VdsFBzTX31w74IvcMzKc9NkXy8znIxb5Rt3T0zeLH694o3 jqfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Gq4ua/yJ/uA/bUF3Yp7KtCe6CYXHtTi1B779fLwvXik=; fh=AYfEg8UxxCZNlRHxnJWvHuqsheVQzM8ymhb/+J0VVdk=; b=bvmZHQ64jo2qyfZOO97TK8z3Mqixip57VIGSTLOucuGKVzvqWgm+vTXfp9SLTj+sOr 82OFuMaFu0eKUKsL+ZWszLBKr2PYeYYIzfvttj+9W0x6MNfbD+GpF1NK1aqB0M6qGpbT hrSgFFqdWgak6WF5z5XLi9WpwW82sDqXU4jcOZ0iIUbRu+/2Wemmzhb5KJaQ38eaGK++ 8z7X9Z8yIkU8TtSmdpyKWVi2+1gVtiv5YB9qSqKuWv171ekUjSL9cmBlhjuA7GHD625I NQzJr07RYgPmlC4cAwzDMZh2brXQjpKV6s5/IHGIpu12Qm+5STZqoquIhB9mWS9waR60 BD+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ElkBRYJV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id f22-20020a633816000000b0057de1fae0ccsi1576926pga.67.2023.10.20.02.37.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 02:37:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ElkBRYJV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 797A783741C9; Fri, 20 Oct 2023 02:37:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376700AbjJTJhY (ORCPT <rfc822;lkml4gm@gmail.com> + 25 others); Fri, 20 Oct 2023 05:37:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376629AbjJTJhW (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 20 Oct 2023 05:37:22 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDED2E8; Fri, 20 Oct 2023 02:37:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697794640; x=1729330640; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=l34rTdAv20yfi641LNZ0X91unwwdKcr1d5qJ7V//mws=; b=ElkBRYJVqEsQ7NzM2eUWXVknxz0PvUHx4ZdWnO8pAw0RvaUDxsSQDr1t cWYJuxO4e0qqXOeJnGS1p9oBY9YaI2CfPWFiStXpXKwpbMZ/WuoyXK5PK Q/94u4ZTag5Smsxcq/zrvTZV4jI+42DKt737XC63HmdYKBXdPU58ndZP2 IJBXzsyxe/AvxBUC+x8lG2x1OpvKHfF1eMZZGerYrUQeKt/+jVdu2iyho dwaw1WuXW3WtEc/c8LjETJxexCHvTWGrKptt4hP07bCVzGpNWfX7zvHbk OiP7umfk/gperpDHQLEFoBVsU+h9TGdB509ClKfcIkHi/QRz6yfQXdJpT A==; X-IronPort-AV: E=McAfee;i="6600,9927,10868"; a="385341706" X-IronPort-AV: E=Sophos;i="6.03,238,1694761200"; d="scan'208";a="385341706" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2023 02:37:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10868"; a="707181301" X-IronPort-AV: E=Sophos;i="6.03,238,1694761200"; d="scan'208";a="707181301" Received: from 984fee00a4c6.jf.intel.com ([10.165.58.231]) by orsmga003.jf.intel.com with ESMTP; 20 Oct 2023 02:37:19 -0700 From: Yi Liu <yi.l.liu@intel.com> To: joro@8bytes.org, alex.williamson@redhat.com, jgg@nvidia.com, kevin.tian@intel.com, robin.murphy@arm.com, baolu.lu@linux.intel.com Cc: cohuck@redhat.com, eric.auger@redhat.com, nicolinc@nvidia.com, kvm@vger.kernel.org, mjrosato@linux.ibm.com, chao.p.peng@linux.intel.com, yi.l.liu@intel.com, yi.y.sun@linux.intel.com, peterx@redhat.com, jasowang@redhat.com, shameerali.kolothum.thodi@huawei.com, lulu@redhat.com, suravee.suthikulpanit@amd.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, zhenzhong.duan@intel.com, joao.m.martins@oracle.com, xin.zeng@intel.com Subject: [PATCH v6 0/3] Add Intel VT-d nested translation (part 2/2) Date: Fri, 20 Oct 2023 02:37:15 -0700 Message-Id: <20231020093719.18725-1-yi.l.liu@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 20 Oct 2023 02:37:31 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780266727927056323 X-GMAIL-MSGID: 1780266727927056323 |
Series |
Add Intel VT-d nested translation (part 2/2)
|
|
Message
Yi Liu
Oct. 20, 2023, 9:37 a.m. UTC
This is the second part to add Intel VT-d nested translation based on IOMMUFD nesting infrastructure. As the iommufd nesting infrastructure series [1], iommu core supports new ops to invalidate the cache after the modifictions in stage-1 page table. So far, the cache invalidation data is vendor specific, the data_type (IOMMU_HWPT_DATA_VTD_S1) defined for the vendor specific HWPT allocation is reused in the cache invalidation path. User should provide the correct data_type that suit with the type used in HWPT allocation. IOMMU_HWPT_INVALIDATE iotcl returns an error in @out_driver_error_code. However Intel VT-d does not define error code so far, so it's not easy to pre-define it in iommufd neither. As a result, this field should just be ignored on VT-d platform. Complete code can be found in [2], corresponding QEMU could can be found in [3]. [1] https://lore.kernel.org/linux-iommu/20231020092426.13907-1-yi.l.liu@intel.com/ [2] https://github.com/yiliu1765/iommufd/tree/iommufd_nesting [3] https://github.com/yiliu1765/qemu/tree/zhenzhong/wip/iommufd_nesting_rfcv1 Change log: v6: - Address comments from Kevin - Split the VT-d nesting series into two parts (Jason) v5: https://lore.kernel.org/linux-iommu/20230921075431.125239-1-yi.l.liu@intel.com/ - Add Kevin's r-b for patch 2, 3 ,5 8, 10 - Drop enforce_cache_coherency callback from the nested type domain ops (Kevin) - Remove duplicate agaw check in patch 04 (Kevin) - Remove duplicate domain_update_iommu_cap() in patch 06 (Kevin) - Check parent's force_snooping to set pgsnp in the pasid entry (Kevin) - uapi data structure check (Kevin) - Simplify the errata handling as user can allocate nested parent domain v4: https://lore.kernel.org/linux-iommu/20230724111335.107427-1-yi.l.liu@intel.com/ - Remove ascii art tables (Jason) - Drop EMT (Tina, Jason) - Drop MTS and related definitions (Kevin) - Rename macro IOMMU_VTD_PGTBL_ to IOMMU_VTD_S1_ (Kevin) - Rename struct iommu_hwpt_intel_vtd_ to iommu_hwpt_vtd_ (Kevin) - Rename struct iommu_hwpt_intel_vtd to iommu_hwpt_vtd_s1 (Kevin) - Put the vendor specific hwpt alloc data structure before enuma iommu_hwpt_type (Kevin) - Do not trim the higher page levels of S2 domain in nested domain attachment as the S2 domain may have been used independently. (Kevin) - Remove the first-stage pgd check against the maximum address of s2_domain as hw can check it anyhow. It makes sense to check every pfns used in the stage-1 page table. But it cannot make it. So just leave it to hw. (Kevin) - Split the iotlb flush part into an order of uapi, helper and callback implementation (Kevin) - Change the policy of VT-d nesting errata, disallow RO mapping once a domain is used as parent domain of a nested domain. This removes the nested_users counting. (Kevin) - Minor fix for "make htmldocs" v3: https://lore.kernel.org/linux-iommu/20230511145110.27707-1-yi.l.liu@intel.com/ - Further split the patches into an order of adding helpers for nested domain, iotlb flush, nested domain attachment and nested domain allocation callback, then report the hw_info to userspace. - Add batch support in cache invalidation from userspace - Disallow nested translation usage if RO mappings exists in stage-2 domain due to errata on readonly mappings on Sapphire Rapids platform. v2: https://lore.kernel.org/linux-iommu/20230309082207.612346-1-yi.l.liu@intel.com/ - The iommufd infrastructure is split to be separate series. v1: https://lore.kernel.org/linux-iommu/20230209043153.14964-1-yi.l.liu@intel.com/ Regards, Yi Liu Yi Liu (3): iommufd: Add data structure for Intel VT-d stage-1 cache invalidation iommu/vt-d: Make iotlb flush helpers to be extern iommu/vt-d: Add iotlb flush for nested domain drivers/iommu/intel/iommu.c | 10 +++---- drivers/iommu/intel/iommu.h | 6 ++++ drivers/iommu/intel/nested.c | 54 ++++++++++++++++++++++++++++++++++++ include/uapi/linux/iommufd.h | 36 ++++++++++++++++++++++++ 4 files changed, 101 insertions(+), 5 deletions(-)