Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1070638rdb; Fri, 1 Dec 2023 06:24:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IHrH65H0S7JzNfWYIItFEOWebfAv6EGDZhlT66mlGl+14D2g7l5ru2cnj8ihXx3tszF7HEQ X-Received: by 2002:a05:6e02:2484:b0:35d:430e:464 with SMTP id bt4-20020a056e02248400b0035d430e0464mr6383836ilb.11.1701440690902; Fri, 01 Dec 2023 06:24:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701440690; cv=none; d=google.com; s=arc-20160816; b=PZeLdTlCrp36UyvjhkAcJtR2OZer/bC7jSuP04iroNvDvhH1M6hhwrBjahb1NK9/SV WFJLyuemPDgvIkgbiAGOKFi+Zk8DBRlXi2amTasngmr3tKOLY9kSXGuu9Qb6Qcb6wwAH TOCCNp/P+VJiT0yyk8M+vrVcgkGdO/9mg/WG6t4kvN0fFiuVin/0Qbf/ITnI4vCNBJCx ULHFhoe/75BN4563/SYTpQZnunXnyR5v4dO9vqdBjFMj14lOj4p7gVN0gMLRToO3W6Wb b/Cv40K1PeGzumIaLjG83NisjS9E/Kon7opBCNhUL+ggCg6hdAriDx0gzgKhuk27r1QN s+yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZBsvr3M7y7nivS2i0Ob2cINhbfVirpoyS0qfXlH/VdM=; fh=5XdFYx0/HmG08bd9P4gu2I6eqksyBIVTm667dkE3lh4=; b=w18g3g5l5bG5psBqCMlsj7MtKslvOmSmsbaHInen9/CLLCgi887ZwPgECuqMKiQnip o1lTWJQM8OQe5QZ7qGcoZFcH/TKNuGTFJVMBE4pDqPAxeMJjPQ22VDWYxAMXW+I3MXP4 7qnPf9KK6hOEgQb0abSWX469hm1EBUnczsU2xUMvVfMLr90cFXp6xMS5n67tqX16sx/7 z2Txo514OqrcoU4tnQGvFkkVsdH97OWKxyuUZLy74b/IWqj2LEiJNwenidQ7ookX18RR IGQVFVR6ZpuZc6P0C8EeiJmXBt+B+H6uwAxWIcGAyl+DEtrTmr7I/jqkpT/3nfgsRA03 s23Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=lJrLG8qL; 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 Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id bs126-20020a632884000000b005c219360d9csi3471454pgb.50.2023.12.01.06.24.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 06:24:50 -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=@ziepe.ca header.s=google header.b=lJrLG8qL; 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 Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 10C0081489C0; Fri, 1 Dec 2023 06:24:39 -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 S1379164AbjLAOYY (ORCPT + 99 others); Fri, 1 Dec 2023 09:24:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379143AbjLAOYX (ORCPT ); Fri, 1 Dec 2023 09:24:23 -0500 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 844B910F4 for ; Fri, 1 Dec 2023 06:24:29 -0800 (PST) Received: by mail-qk1-x735.google.com with SMTP id af79cd13be357-77dccb3e4baso116421185a.0 for ; Fri, 01 Dec 2023 06:24:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1701440668; x=1702045468; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ZBsvr3M7y7nivS2i0Ob2cINhbfVirpoyS0qfXlH/VdM=; b=lJrLG8qLCH75Njz6LiPzicDKXddlkerBMgdC1KrdE9grFXInDpr2+DLjkvWUgJ2pxh GT+OPqP4nP3gdWevqj9qqIaOySE05d2E9+ZODJu7GmTkUoX/y4SSH1Lp9OzSO7IgRCTn DLtWXmYG5Xa4YFTCs29BHVwHfmpyTbhn2CeeAT0I2ApXkDbmaDET4CI4pI6NLZMQ2A0a qvd9XiYEZm64jpHSegtX/Qasj6/xwasATwBmPF3mdUj5IjNLDgyJOrxLh+TOt9w68btU aCxchV+OPYXQZM9t6+AL2+SSTBjdpUpIKCcwOqjF6sxmesX35PLoxyq9yz8+r1vYr5kW J8rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701440668; x=1702045468; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ZBsvr3M7y7nivS2i0Ob2cINhbfVirpoyS0qfXlH/VdM=; b=kp5RDNTXW4hqiAIdDxlG7h29oJqN3AeiAzWtf1V5z0vK+bRhIICSglmr+ntRI/UHl1 lDGFJAth2P2wAlOhYPW8QQI2qqjkP7hvLhxh8fJXl8/GAzAOd2yr6V+6UsrjYh+Ajdw5 bM6H8r8mcjo1vNPTQE3uwMqpUdo30rgLHdH/BsewVqW+6Cx7ZWgZzrZxk+al4VrRbJSQ BMMbw9HkAPQo9d0ibhAoUsm2cJf5V26AWyBZZQbLFdUYE7//3XSL0lOsKlZ7xbOXsdHe wABVvSstrvo7aNoK0CKnqZKcsu796QLR8PllY/qq9IZFhwUJQJOsImHX3VcRoNU3xAW5 BZ1Q== X-Gm-Message-State: AOJu0YwaD61kvpV2aKri7ePIknFB5/I4Tzhv1DQ10ds+yepzZq7V6nMe a8qGdeiuqC0arZurQC4nhAYHWdaJDnKm2plVtoA= X-Received: by 2002:a05:620a:1daa:b0:779:deb9:72c6 with SMTP id pj42-20020a05620a1daa00b00779deb972c6mr24340270qkn.14.1701440668556; Fri, 01 Dec 2023 06:24:28 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-134-23-187.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.134.23.187]) by smtp.gmail.com with ESMTPSA id v15-20020a05620a122f00b0077d606bec92sm1519643qkj.108.2023.12.01.06.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 06:24:27 -0800 (PST) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1r94RP-006FTp-4e; Fri, 01 Dec 2023 10:24:27 -0400 Date: Fri, 1 Dec 2023 10:24:27 -0400 From: Jason Gunthorpe To: Lu Baolu Cc: Kevin Tian , Joerg Roedel , Will Deacon , Robin Murphy , Jean-Philippe Brucker , Nicolin Chen , Yi Liu , Jacob Pan , iommu@lists.linux.dev, linux-kselftest@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 0/6] IOMMUFD: Deliver IO page faults to user space Message-ID: <20231201142427.GJ1394392@ziepe.ca> References: <20231026024930.382898-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231026024930.382898-1-baolu.lu@linux.intel.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=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]); Fri, 01 Dec 2023 06:24:39 -0800 (PST) On Thu, Oct 26, 2023 at 10:49:24AM +0800, Lu Baolu wrote: > Hi folks, > > This series implements the functionality of delivering IO page faults to > user space through the IOMMUFD framework for nested translation. Nested > 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. > > 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. > > 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. This is probably backwards, userspace should allocate the FD with a dedicated ioctl and provide it during domain allocation. If the userspace wants a fd per domain then it should do that. If it wants to share fds between domains that should work too. Jason