Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1953571rdf; Sun, 5 Nov 2023 23:14:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsKEMWPbBHKqk2TtFNIs16AUTWScKqTFXLY8K18PW/HeCuGkyGAJ0Aton+QnVfkG0OAcxu X-Received: by 2002:a54:418f:0:b0:3b2:d9d8:4039 with SMTP id 15-20020a54418f000000b003b2d9d84039mr31966173oiy.24.1699254880118; Sun, 05 Nov 2023 23:14:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699254880; cv=none; d=google.com; s=arc-20160816; b=AkMJTj75VTO74gETTxEywBOejDALFyz/tGh5RfZglRJUG9qG97JyzCkv0Ac1hAk3hy Oc8Y/xCMve6K9ntOUviWp6s1Y0VJv5VTWb6CULk1+ZLcgCtF89FJYqetYnb2rOlndNqJ iPvZPhur/uittvK4EU0KoCnj7rsC3C2wNyTOER/1xPJMxbt4QIS2Dmze6A+v+ydPK9e4 mH7JkkR9uVwGiLVrz0K8dCmZOBpm4e7kFk+r0zFNztqwEfK9qb//HGIU+V2EPPFRDEEV iQYOPEg0StB1XGaeWhC+Q8+P7DNZw/YOq3ZdPumwNl8P17Qu5rFz5RqKlGREpGDBtgJk 3qjg== 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=QF7KP9oottkShut6lXi56dMrgj5i6q2hwKzIZiAMkvQ=; fh=Q9/c0/1s/r5nQXfLb7W3lFTON2d/CYIL48MtbxJzpb8=; b=R+mDfcldAmvnK4E5Sw0fiWNIs2fxKSvB6FOhJMuHia4WNCCcdxpSZ0+FZs2Edj2bAL BuMDUJv6NHnOvHte84YQSF9GP4Is1L4WkbVM81yw5+P0otYqqm6tsEPXdGY+h9whKXJp G7G6Xl+aY7TDXGUUdtAE2k7g8S8bFFwjq4+OgpVfXaZmyS1Tx0UkKKKlrXnMDtZCe7lg L/WuBFgvXs0Nw1gjigcbFztQiHTSuM9PFMlb/CSOihBeo9MJEJFWK4D8i+NhO9L7O/Hz l8p8s5fJJvhvJyhX+jL0z9A9p/5ZFtHGPr0rGoe6uriMypPs8H6L99LbonXFuedt4Jzg amhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NQZxqehO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id fm12-20020a056a002f8c00b0068e3f550763si7169540pfb.101.2023.11.05.23.14.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 23:14:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NQZxqehO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id AEC3F804C18C; Sun, 5 Nov 2023 23:14:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229875AbjKFHOF (ORCPT + 99 others); Mon, 6 Nov 2023 02:14:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229563AbjKFHOD (ORCPT ); Mon, 6 Nov 2023 02:14:03 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC7D5CC for ; Sun, 5 Nov 2023 23:13:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699254839; x=1730790839; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=E6/kgqA9Lo5JBiyk0XaJAk9Nzct4odqOsifYkRlm8ZI=; b=NQZxqehOr5giCw/JVIsO+cd6Gz6KO3yg5FbgSEA2VP51gXj5nU8zDfFq cBFIEbCFUl3KLgnwpi/TmHfwYN9G9NPLiR9D1l5H/erbJE9Vn4N1EhRhV /VyvTosKJvaGSg5VWA2dr8Cs/0Qp4O26dComYRLJfHsSFSQ0hq/0R8jTk wCGTGDu5KR4ECfTcfnnJWGQLWXjQHv1Hh+TwEVxsxKYWRm1w8pqp2Vi1G C1zGNZMg+lJureajyEe0rEKMAkTVz/B3Eq80EpHtxEw7IrjszU5t/ROFw +oepM/bzHkqyVZ03nqIDpE0nAtgoSpLF1uGIBKgwdF5OZ5x8eDkWtQLp7 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10885"; a="10759035" X-IronPort-AV: E=Sophos;i="6.03,280,1694761200"; d="scan'208";a="10759035" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2023 23:13:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10885"; a="1093690826" X-IronPort-AV: E=Sophos;i="6.03,280,1694761200"; d="scan'208";a="1093690826" Received: from sqa-gate.sh.intel.com (HELO localhost.localdomain) ([10.239.48.212]) by fmsmga005.fm.intel.com with ESMTP; 05 Nov 2023 23:13:55 -0800 From: Tina Zhang To: Jean-Philippe Brucker , Kevin Tian , Lu Baolu , joro@8bytes.org, will@kernel.org, Yi Liu Cc: virtualization@lists.linux-foundation.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Tina Zhang Subject: [RFC PATCH 0/5] virtio-iommu: Add VT-d IO page table Date: Mon, 6 Nov 2023 02:12:21 -0500 Message-Id: <20231106071226.9656-1-tina.zhang@intel.com> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.4 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,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sun, 05 Nov 2023 23:14:37 -0800 (PST) The proposal about virtio-iommu support page tables is being discussed in the virtio-comment mailing list[1]. This patch-set based on Jean's virtio-iommu/pgtables branch[2] tries to follow the proposal and add the basic VT-d IO page table support to virtio-iommu. On Intel platform with VT-d nested translation enabled, there are two main benefits for enabling virtual IOMMU support VT-d IO page table: 1) Allowing vSVM (aka vSVA) usage. Virtual Shared Virtual Addressing (vSVA) allows the virtual processor and virtual device to use the same virtual addresses. 2) Accelerating DMA buffer map operation for vIOVA usage by removing the context switch on DMA buffer map operation. (Note: this patch-set doesn't include the whole patch-set for enabling vSVM on virtio-iommu, only includes the part for vIOVA case. However, the vSVM enabling patch-set needs to base on this patch-set.) There are three changes in this patch-set: 1) The first patch is a bug fixing patch that tries to resolve an issue about IOTLB invalidation request with incorrect page size. 2) The next 3 patches are about adding generic IO page table support to VT-d driver. 3) The last one introduces the VT-d page format table to virtio-iommu driver. The patch-set is also available at github: https://github.com/TinaZhangZW/linux/tree/vt-d-pgtable The QEMU part is available here: https://github.com/TinaZhangZW/qemu/tree/virtio-iommu/vt-d-pgtable [1]:https://lists.oasis-open.org/archives/virtio-comment/202310/msg00018.html [2]:https://jpbrucker.net/git/linux/log/?h=virtio-iommu/pgtables Tina Zhang (5): iommu/virtio-iommu: Correct the values of granule and nr_pages iommu/vt-d: Add generic IO page table support iommu/io-pgtable: Introduce struct vtd_cfg iommu/vt-d: Adapt alloc_pgtable interface to be used by others iommu/virtio-iommu: Support attaching VT-d IO pgtable drivers/iommu/intel/Kconfig | 1 + drivers/iommu/intel/iommu.c | 157 ++++++++++++++++++++++++++++++ drivers/iommu/intel/iommu.h | 7 ++ drivers/iommu/io-pgtable.c | 3 + drivers/iommu/virtio-iommu.c | 27 ++++- include/linux/io-pgtable.h | 7 ++ include/uapi/linux/virtio_iommu.h | 26 +++++ 7 files changed, 226 insertions(+), 2 deletions(-) -- 2.39.3