From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1CA9C7112F for ; Thu, 17 Aug 2023 23:44:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356170AbjHQXnz (ORCPT ); Thu, 17 Aug 2023 19:43:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349007AbjHQXn0 (ORCPT ); Thu, 17 Aug 2023 19:43:26 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 802782D64; Thu, 17 Aug 2023 16:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692315805; x=1723851805; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=3CR3oyO/mGcZM3mHjBnqHofn1DAFmkHUrhAS10kr7wU=; b=hM4hcXlSFjWVJF5ShjBVy4fuHzblWkDvBBNNsGNE7Y7d+dFdUmp/cxaW dAqEjqc+KW9g9kQKb7XyefTMES1OXqnwnZ7vB5QGtkUuYf7TeIsR4K8Ct fQD5hURMFRN4lYipW+1xib4mTQMx5sq4aq72H2mv9aNpTo6rEBKvYvFAS +JxkzGUI3v+QrzYHaUiU/jiyrRbxhuRNVtkpmH6pLhtcqgwr34Cj18R1W w6Wgl+Rh8s0DAUEmrwYIjYpdbX34P9SWtIA28kl5Bb3ENy7cpar2UnLfC yoIy6ooBdktn5sewe45pefLLzzfArwFZHaTuRPYakjWoE2nC8XzDHboLT Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10805"; a="352551927" X-IronPort-AV: E=Sophos;i="6.01,181,1684825200"; d="scan'208";a="352551927" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2023 16:43:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10805"; a="849051751" X-IronPort-AV: E=Sophos;i="6.01,181,1684825200"; d="scan'208";a="849051751" Received: from allen-box.sh.intel.com ([10.239.159.127]) by fmsmga002.fm.intel.com with ESMTP; 17 Aug 2023 16:43:20 -0700 From: Lu Baolu To: Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Kevin Tian , Jean-Philippe Brucker , Nicolin Chen Cc: Yi Liu , Jacob Pan , iommu@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH v3 00/11] iommu: Prepare to deliver page faults to user space Date: Fri, 18 Aug 2023 07:40:36 +0800 Message-Id: <20230817234047.195194-1-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a user-managed page table is attached to an IOMMU, it is necessary to deliver IO page faults to user space so that they can be handled appropriately. One use case for this is nested translation, which is currently being discussed in the mailing list. I have posted a RFC series [1] that describes the implementation of delivering page faults to user space through IOMMUFD. This series has received several comments on the IOMMU refactoring, which I am trying to address in this series. The major refactoring includes: - [PATCH 01 ~ 04] Move include/uapi/linux/iommu.h to include/linux/iommu.h. Remove the unrecoverable fault data definition. - [PATCH 05 ~ 06] Remove iommu_[un]register_device_fault_handler(). - [PATCH 07 ~ 11] Separate SVA and IOPF. Make IOPF a generic page fault handling framework. This is also available at github [2]. I would appreciate your feedback on this series. [1] https://lore.kernel.org/linux-iommu/20230530053724.232765-1-baolu.lu@linux.intel.com/ [2] https://github.com/LuBaolu/intel-iommu/commits/preparatory-io-pgfault-delivery-v3 Change log: v3: - Convert the fault data structures from uAPI to kAPI. - Merge iopf_device_param into iommu_fault_param. - Add debugging on domain lifetime for iopf. - Remove patch "iommu: Change the return value of dev_iommu_get()". - Remove patch "iommu: Add helper to set iopf handler for domain". - Misc code refactoring and refining. v2: https://lore.kernel.org/linux-iommu/20230727054837.147050-1-baolu.lu@linux.intel.com/ - Remove unrecoverable fault data definition as suggested by Kevin. - Drop the per-device fault cookie code considering that doesn't make much sense for SVA. - Make the IOMMU page fault handling framework generic. So that it can avaible for use cases other than SVA. v1: https://lore.kernel.org/linux-iommu/20230711010642.19707-1-baolu.lu@linux.intel.com/ Lu Baolu (11): iommu: Move iommu fault data to linux/iommu.h iommu/arm-smmu-v3: Remove unrecoverable faults reporting iommu: Remove unrecoverable fault data iommu: Cleanup iopf data structure definitions iommu: Merge iopf_device_param into iommu_fault_param iommu: Remove iommu_[un]register_device_fault_handler() iommu: Prepare for separating SVA and IOPF iommu: Move iopf_handler() to iommu-sva.c iommu: Make iommu_queue_iopf() more generic iommu: Add debugging on domain lifetime for iopf iommu: Separate SVA and IOPF in Makefile and Kconfig include/linux/iommu.h | 202 ++++++++++++++--- drivers/iommu/iommu-sva.h | 71 ------ include/uapi/linux/iommu.h | 161 -------------- .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 14 +- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 47 ++-- drivers/iommu/intel/iommu.c | 25 +-- drivers/iommu/intel/svm.c | 1 - drivers/iommu/io-pgfault.c | 208 ++++++++---------- drivers/iommu/iommu-sva.c | 49 ++++- drivers/iommu/iommu.c | 132 +++-------- MAINTAINERS | 1 - drivers/iommu/Kconfig | 4 + drivers/iommu/Makefile | 3 +- drivers/iommu/intel/Kconfig | 1 + 14 files changed, 362 insertions(+), 557 deletions(-) delete mode 100644 drivers/iommu/iommu-sva.h delete mode 100644 include/uapi/linux/iommu.h -- 2.34.1