Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2769423rdb; Mon, 4 Dec 2023 07:08:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3iflawMS4WiL1/VIl1B1iCldk8aEm/Rco3wbfpjP2JowzSYf+sjy2KWESdALf2vvQ7hB/ X-Received: by 2002:a05:6a20:7fa8:b0:18b:47a9:66e9 with SMTP id d40-20020a056a207fa800b0018b47a966e9mr6138040pzj.40.1701702488845; Mon, 04 Dec 2023 07:08:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701702488; cv=none; d=google.com; s=arc-20160816; b=NE7D4ESW/nXR31DeJti0dGTm59e/r5nq7fvTk1xsHqnmsWwD3h/UfTozoZ0SnUVMay J1mcNaPyCFGaerg75XztND+1YkmEO7eSA+VXlsbHG1jmjyhLS4liahLk3z8Pl72za0Ux hJmheqgGqx4jlX9E/XONh/zOXhiNRJChrZ0WlHJMIk0m/o398IE+aISanOj5Jac9Z60+ i1sTm22dImrnTzZJY9Ac+hNakBJtvPRBhT2ryXaRd4WBc87ru/iM2pA9zwRM2TygIlhk dfPvjEXqb9s7wApEhuAgf/lzWXOn0TdPXJ3a4Ybu3+btUZIC7MrNO8edEs3Qc5qGlRG8 Hv5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:in-reply-to :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=UduKPnQm68cXoxlHdEmWZOKtyfnkbxFsmJeY5avud44=; fh=ueoX9QMQy36eQjlr+LTWdfxMIzFRaBj9ZhHH8GmTTyU=; b=G9sPWCHIlI6IPjvoW7uMHeNMofjeNfwrt58APHs2HGFlg79nYLJaP6c2/59kXQuboY AY4xlooORNa57xMad2OQzOUuGqxiVTqzK88v6IN8YFtYYmGNx/DGpWyo7S3TKrnHjRqZ RKiHeXVTMm/k9W1V+AejCt6LTXUQD9fZ5tkcnpCeyzAqqMwVVmkuOahDkv2J6Wnvv8Qm Rve41hUmWeSWOrc6cXwcV9v7wg3qiGrYlOZWFAHOKwxlPqZEcGxemXRGF63CW24rDOCn p+nPJsK6tMspPZXy59nb/hGUWLQTvA2fwsYUMPl9MuUvXinqu6vIrZBZxo7OXYzkHtLj e/yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=MM+RUq0U; 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=samsung.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id h23-20020a635317000000b005b86119661esi7827649pgb.86.2023.12.04.07.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 07:08:08 -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=@samsung.com header.s=mail20170921 header.b=MM+RUq0U; 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=samsung.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id E486A8053640; Mon, 4 Dec 2023 07:08:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233696AbjLDPHu (ORCPT + 99 others); Mon, 4 Dec 2023 10:07:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231594AbjLDPHr (ORCPT ); Mon, 4 Dec 2023 10:07:47 -0500 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0D6BC4; Mon, 4 Dec 2023 07:07:51 -0800 (PST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231204150748euoutp02612dc70d95eb7aa494fda7f09bc801a2~dqWECJvV02140321403euoutp02I; Mon, 4 Dec 2023 15:07:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231204150748euoutp02612dc70d95eb7aa494fda7f09bc801a2~dqWECJvV02140321403euoutp02I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1701702468; bh=UduKPnQm68cXoxlHdEmWZOKtyfnkbxFsmJeY5avud44=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=MM+RUq0UtMW7ws7H0S0Ou7vD5Bb+wBju4aAGFv4Kt7/pWjTu95F68zZDBmZ1ugg/U k/jFoeaGx2CjCIHbRFzDpe1BpW2vZ0XAkLZVShqt9wHehoNAoLx600dSQhE52i/PiN M8QwqPB9bqLZas0CYERPA4zKDRM0HZy4dTBNIhRA= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231204150747eucas1p26333e09142452af0e86679cdc4da337d~dqWDs4D2V2804828048eucas1p2u; Mon, 4 Dec 2023 15:07:47 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 8D.C6.09814.34BED656; Mon, 4 Dec 2023 15:07:47 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231204150747eucas1p2365e92a7ac33ba99b801d7c800acaf6a~dqWDIvRbe0222702227eucas1p23; Mon, 4 Dec 2023 15:07:47 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231204150747eusmtrp15777265caed2d957daeb1957804eccf0~dqWDIBHpR2293022930eusmtrp1Q; Mon, 4 Dec 2023 15:07:47 +0000 (GMT) X-AuditID: cbfec7f4-711ff70000002656-8f-656deb4362d0 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id B0.F6.09274.34BED656; Mon, 4 Dec 2023 15:07:47 +0000 (GMT) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20231204150747eusmtip12a603491717507856a186d16753c948c~dqWC6ygJe0939309393eusmtip1X; Mon, 4 Dec 2023 15:07:47 +0000 (GMT) Received: from localhost (106.110.32.133) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 4 Dec 2023 15:07:46 +0000 Date: Mon, 4 Dec 2023 16:07:44 +0100 From: Joel Granados To: Lu Baolu CC: Jason Gunthorpe , Kevin Tian , Joerg Roedel , Will Deacon , Robin Murphy , Jean-Philippe Brucker , Nicolin Chen , Yi Liu , Jacob Pan , , , , Subject: Re: [PATCH v2 0/6] IOMMUFD: Deliver IO page faults to user space Message-ID: <20231204150744.db3hfpq4v55cuavn@localhost> MIME-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="g7qzvqsc57itqwgz" Content-Disposition: inline In-Reply-To: <20231026024930.382898-1-baolu.lu@linux.intel.com> X-Originating-IP: [106.110.32.133] X-ClientProxiedBy: CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) To CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupkk+LI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tX/rzPlYP/oh4e368f61jPriUnzvnterehi+Tc 74fXKj5/frScj3vq3bxqBRtFltaJpyx9WkWrrzX26H2cIX+hjdn8gorbyq3X2c3KDuxKj605 eLbEtX7uLIcSxaqoS67X8jbaPtorvcRUYMIUmfLbWdESnMWPb1+885Tr0gsWnjfrVs713cLc d1z+0qEnOsuSwu3yH21mifNxkrnwteb+h0OXXqVc/Rbxz/Xi/nnM3x4Zr7l2PE2hZ5IPx5yz UaV8iberChceZfexXF2vxFKckWioxVxUnAgAWaTaSbkDAAA= X-CMS-MailID: 20231204150747eucas1p2365e92a7ac33ba99b801d7c800acaf6a X-Msg-Generator: CA X-RootMTR: 20231204150747eucas1p2365e92a7ac33ba99b801d7c800acaf6a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231204150747eucas1p2365e92a7ac33ba99b801d7c800acaf6a References: <20231026024930.382898-1-baolu.lu@linux.intel.com> 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,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]); Mon, 04 Dec 2023 07:08:06 -0800 (PST) --g7qzvqsc57itqwgz Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 26, 2023 at 10:49:24AM +0800, Lu Baolu wrote: > Hi folks, >=20 > This series implements the functionality of delivering IO page faults to > user space through the IOMMUFD framework for nested translation. Nested Does this mean the IOPF_CAPABLE HWPT needs to be parented by a HWPT created with IOMMU_HWPT_ALLOC_NEST_PARENT set? > translation is a hardware feature that supports two-stage translation > tables for IOMMU. The second-stage translation table is managed by the > host VMM, while the first-stage translation table is owned by user > space. This allows user space to control the IOMMU mappings for its > devices. >=20 > When an IO page fault occurs on the first-stage translation table, the > IOMMU hardware can deliver the page fault to user space through the > IOMMUFD framework. User space can then handle the page fault and respond > to the device top-down through the IOMMUFD. This allows user space to > implement its own IO page fault handling policies. >=20 > User space indicates its capability of handling IO page faults by > setting the IOMMU_HWPT_ALLOC_IOPF_CAPABLE flag when allocating a > hardware page table (HWPT). IOMMUFD will then set up its infrastructure > for page fault delivery. On a successful return of HWPT allocation, the > user can retrieve and respond to page faults by reading and writing to > the file descriptor (FD) returned in out_fault_fd. >=20 > The iommu selftest framework has been updated to test the IO page fault > delivery and response functionality. >=20 > This series is based on the latest implementation of nested translation > under discussion [1] and the page fault handling framework refactoring in > the IOMMU core [2]. >=20 > The series and related patches are available on GitHub: [3] >=20 > [1] https://lore.kernel.org/linux-iommu/20230921075138.124099-1-yi.l.liu@= intel.com/ > [2] https://lore.kernel.org/linux-iommu/20230928042734.16134-1-baolu.lu@l= inux.intel.com/ > [3] https://github.com/LuBaolu/intel-iommu/commits/iommufd-io-pgfault-del= ivery-v2 >=20 > Best regards, > baolu >=20 > Change log: > v2: > - Move all iommu refactoring patches into a sparated series and discuss > it in a different thread. The latest patch series [v6] is available at > https://lore.kernel.org/linux-iommu/20230928042734.16134-1-baolu.lu@li= nux.intel.com/ > - We discussed the timeout of the pending page fault messages. We > agreed that we shouldn't apply any timeout policy for the page fault > handling in user space. > https://lore.kernel.org/linux-iommu/20230616113232.GA84678@myrica/ > - Jason suggested that we adopt a simple file descriptor interface for > reading and responding to I/O page requests, so that user space > applications can improve performance using io_uring. > https://lore.kernel.org/linux-iommu/ZJWjD1ajeem6pK3I@ziepe.ca/ >=20 > v1: https://lore.kernel.org/linux-iommu/20230530053724.232765-1-baolu.lu@= linux.intel.com/ >=20 > Lu Baolu (6): > iommu: Add iommu page fault cookie helpers > iommufd: Add iommu page fault uapi data > iommufd: Initializing and releasing IO page fault data > iommufd: Deliver fault messages to user space > iommufd/selftest: Add IOMMU_TEST_OP_TRIGGER_IOPF test support > iommufd/selftest: Add coverage for IOMMU_TEST_OP_TRIGGER_IOPF >=20 > include/linux/iommu.h | 9 + > drivers/iommu/iommu-priv.h | 15 + > drivers/iommu/iommufd/iommufd_private.h | 12 + > drivers/iommu/iommufd/iommufd_test.h | 8 + > include/uapi/linux/iommufd.h | 65 +++++ > tools/testing/selftests/iommu/iommufd_utils.h | 66 ++++- > drivers/iommu/io-pgfault.c | 50 ++++ > drivers/iommu/iommufd/device.c | 69 ++++- > drivers/iommu/iommufd/hw_pagetable.c | 260 +++++++++++++++++- > drivers/iommu/iommufd/selftest.c | 56 ++++ > tools/testing/selftests/iommu/iommufd.c | 24 +- > .../selftests/iommu/iommufd_fail_nth.c | 2 +- > 12 files changed, 620 insertions(+), 16 deletions(-) >=20 > --=20 > 2.34.1 >=20 --=20 Joel Granados --g7qzvqsc57itqwgz Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEErkcJVyXmMSXOyyeQupfNUreWQU8FAmVt6zgACgkQupfNUreW QU/YxAv/amK6Yf/ek3gmC/YYj6UNyrZPgjipdI6JkSodKr8gwAAS/1zf9pAmXTwT 3REQr0utcNlpQ8kpoAEuuufpScq9cG3QiVMZfH3XggOywuWLv3nhPsiynQnkBauq 90r7lEUWUZd+fRZdM3IjaC96IqYDxQ1yKeIZ15ZJ3G5cf313NmTOP2nCUJoIb953 MMY8L9R0fCkYpFo8R1rIh0sDJKc9V4jD6nQfhfGWG4Ip1jKSoI4ZrGlSVX+Apnqd bv/4+n0pypUK6h6jfVTDH5WTN+gpHGK3JxMuYVOh27rnkzZc/W5t5gEdcYK12ZzV T60qTF2kGs6rCNveylvvV62fN7LofVfxsYcHiak9+He/W0C1PhHwfgp399315kKo cNtIK+bk1EKyQJqct9h89mWcYIXsXl2jBeXY8O57u+Q7IRxST5KXiWNkc5XJowJq hSnK4E6QPJ4gFF6Vq1MYhjdYZyDD2n+UHY4cfjO9HXEmZ8zUya61u18uPRdy0Ils VPflK8/n =5JsO -----END PGP SIGNATURE----- --g7qzvqsc57itqwgz--