From patchwork Tue Jul 11 01:06:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolu Lu X-Patchwork-Id: 11828 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp174685vqm; Mon, 10 Jul 2023 18:13:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlGLwKQRO7ST6HJ4bZIk2V0DABYJF+/4oUjFhx2xP2Ss4eBgZO8KYAREYRKQIowDurC/9iR/ X-Received: by 2002:aa7:c2d8:0:b0:51e:54d2:b52a with SMTP id m24-20020aa7c2d8000000b0051e54d2b52amr6428701edp.26.1689037980995; Mon, 10 Jul 2023 18:13:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689037980; cv=none; d=google.com; s=arc-20160816; b=pgu4sPGP90ymK3goTksxqBXd3mZFZcl7BvAiKdiWCFJefLB8sJYr4+D8t0uRcuqNab 5N+QCN4FjDj8Scc485fhECR23DgFwjvvr8rO+ng587602H+Xm/7X/VyJB3cFnwbz6tb0 kn9oKKuzp8QurNVfa8/LyDfApAuGpAgGjlG9kUls04hBtEHw2QPwgSVjhps1VLYuJa4y HWtS7MhfOtduRbI7AXqRvIv56GlGXUQLO/UpNCv/qYC8PyxOQ7eOO/a9kPaWcepB59jc MjRlI52gZB5/WcVH7Um61gelmfxE2DZoUXri303TrxzV1UN/m6E/rAxJXxdZpuh8eA0+ vNZg== 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=hdk35lbOddMqGi7i3a5OQIfpqEKsvd5wz7trwbBABOU=; fh=5v0QJkujOnxKSzhmeWiMX/0q9X35NwMz+SRMkKa4moc=; b=b0Z4TZTu39939b0qjv98fOExCswNV1zd6cUts7V8ELTyxDDNqjZvxLo3YuohbcdSp1 9tzKhtDycs92Pfjz9N2qP2fNtDhiFu9YBUA8VeN/8sSDq5yp9AQY5BNPtYTR1gjvuA89 KetISHrd6uk983U8lztVI9ASF6MbKmjB/CW1opGpUY6uRw9cMST1TMref+0KXMOhzGJe w/uM152js77JIfiQ7t8gzcp2reR6ophIY4A4CpjGYVnYP9rkWr1rLrKxT3AZP+ISmFFk DKXNllFvwO52FghoRLPU3q0FZBJ6zQKlOv/lYPU9SCP1i1KEqNNy7OK8bhNDrGi/6oiP urbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="B/oUzrvk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o12-20020aa7c50c000000b0051e57e864adsi840322edq.189.2023.07.10.18.12.38; Mon, 10 Jul 2023 18:13:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="B/oUzrvk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230476AbjGKBIi (ORCPT + 99 others); Mon, 10 Jul 2023 21:08:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230040AbjGKBIh (ORCPT ); Mon, 10 Jul 2023 21:08:37 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EC6A194; Mon, 10 Jul 2023 18:08:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689037716; x=1720573716; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=X6HARK8d7O3/CsqjXmQ+dxc6FJwEi+B6duwTtCj4/ZQ=; b=B/oUzrvksvmPaANnyqdUm2329rW6ukl7R/AnkPGVyZhs9ksuYlAhjOn5 RQY9cbOe8fNM4yFGp2qc1zh63H5QOwHbGjdkryBMRM5LXPTnBB2jiw9k4 r0Puv/H3/iIp4HWNrRRbiGO5xeRXTbMqe9XrgtSlaKaOQ91XxUNTxudYw BBYtJjt7AB+0uH4uKfp7ma67KtpIXhyPro85P5xZuPKVlabXUWHHZ5yPj 6iyYiwpuEOEwFlMPK4I2ovZ62bwCVNMnQhol/BuzBunPkdFUhkqnx9F4q dA0BhF7PcqKjObe3ZihFQM5Y6MfLRSorwgm0lYcK4adW7sZ7+9l2csePB g==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="344816038" X-IronPort-AV: E=Sophos;i="6.01,195,1684825200"; d="scan'208";a="344816038" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 18:08:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="810999790" X-IronPort-AV: E=Sophos;i="6.01,195,1684825200"; d="scan'208";a="810999790" Received: from allen-box.sh.intel.com ([10.239.159.127]) by FMSMGA003.fm.intel.com with ESMTP; 10 Jul 2023 18:08:32 -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 0/9] iommu: Prepare to deliver page faults to user space Date: Tue, 11 Jul 2023 09:06:33 +0800 Message-Id: <20230711010642.19707-1-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771084690128259489 X-GMAIL-MSGID: 1771084690128259489 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 have addressed in this series. The major refactoring includes: - Removing include/uapi/linux/iommu.h. - Removing iommu_[un]register_device_fault_handler(). - Making fault_param always available between iommu device probe and release. - Using fault cookie to store temporary data used for processing faults. 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-v1 Best regards, baolu Lu Baolu (9): iommu: Move iommu fault data to linux/iommu.h iommu: Add device parameter to iopf handler iommu: Add common code to handle IO page faults iommu: Change the return value of dev_iommu_get() iommu: Make fault_param generic iommu: Remove iommu_[un]register_device_fault_handler() iommu: Add helper to set iopf handler for domain iommu: Add iommu page fault cookie helpers iommu: Use fault cookie to store iopf_param include/linux/iommu.h | 206 +++++++++++++++--- drivers/iommu/iommu-sva.h | 8 +- include/uapi/linux/iommu.h | 161 -------------- .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 13 +- drivers/iommu/intel/iommu.c | 18 +- drivers/iommu/io-pgfault.c | 55 +++-- drivers/iommu/iommu-sva.c | 2 +- drivers/iommu/iommu.c | 199 ++++++++--------- MAINTAINERS | 1 - 9 files changed, 320 insertions(+), 343 deletions(-) delete mode 100644 include/uapi/linux/iommu.h