From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AF103D9F for ; Mon, 6 Nov 2023 07:13:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="NQZxqehO" 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="10759036" X-IronPort-AV: E=Sophos;i="6.03,280,1694761200"; d="scan'208";a="10759036" 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 Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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