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 X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E49D4C433DB for ; Tue, 12 Jan 2021 09:18:55 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9393F22D2A for ; Tue, 12 Jan 2021 09:18:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9393F22D2A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/Mq21J+Tgw0kPRs+lPGfcRVrqYEKCS78QV8rOgbhv8U=; b=msbjHBKIBF8IWlQkhl6CDo27u SVWj/6BXI9Rld+/Ui18MeNcDJyoDtPyErzvKrgHrlDcKZdaOFpQ86TtzHq1gEUMnd5y2f77PqsSnV lfzqvYBU8Qcl15bVuPnfweQP8qy/+BUxLXw9oWFZNuSeQJ3u9i6K5BqLHi/sEokQx0xryVXOTsYlT aCfDafOiTPsPn00CrnjEGA6lTmcI2cZcx7dXW33DMfVeAbo5mxsr78npC7Ikdaz7DacYNU4xftuas 8BuPIMeA/1SjGOnlgJIdoW7uWG6xyGxEhW+nJ+eM2HR3T+BXVrbcj29Hvj12A/fUUPjkn4draIJk4 xSBDz1c5A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kzFnO-0003HB-Rr; Tue, 12 Jan 2021 09:16:58 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kzFnJ-0003ED-LN for linux-arm-kernel@lists.infradead.org; Tue, 12 Jan 2021 09:16:55 +0000 Received: by mail-ed1-x535.google.com with SMTP id cm17so1489032edb.4 for ; Tue, 12 Jan 2021 01:16:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=V4Ma0KkD8d21UACM4ffQTckGsQRVOOOjeKQ7H9bkegg=; b=tqns5ex3W/22GNSQjU3yHEUq6Lx0NP96Ysb/ui4paO62uBN1fxSQTYwaE9hkYeZZQ3 +OsoewHGvx/NJl0tGOelIJS7NW25gPVldz3D+LhuhiHgp1kwFsnVxvo1AxoWnGvC0v7f fPLYq75eocGKThJXMhyHGVDEhGZUrQ9eq/oII/jJtfNIxEbXNRxcwJwgouUnjpfdx8ST T8G5xSxjsCNmIYPDPyBO2+ILzXpirbSIuxR6yIkNmsNpTohxn35Qd+ULH8Tbw3mA5P3b YBjYT2owuHJcg3U/sfVhyg9K17im8jtzLM3LMh81MoBbUZC0i4VOIwNQ9qdwdgdr35xk iDQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=V4Ma0KkD8d21UACM4ffQTckGsQRVOOOjeKQ7H9bkegg=; b=jfE7sB4dZnlfkvdCTZoKDstsldQzAhU2wFsG4nwpmzHNXyZGEy2iNClSPKrrQCZT4A eQW6uuvFpMo+UDUq3T/Zd7nL5e+lq2VUmoFYQfcb7xvmzd/VDjuc58nae4JuPkrIBtRo 2INkIpu7U4vy/+HjNLrbd4ATnjlULk2oWXBclcylUVwgskaAEo9LtyFKGQG4q7PZTcND U4p2kdU5XHLwgngJ9nTUuuiPTYIwHjMRTeerDHe0dFi3VR9DWuqUkW6jKIwXTiOyx8mP JhORauupGuKBc3ZYTjiG/EwCv8I48ltfGd7w3AnSzFDq6eCyVD81UyNcJjXJMBc9GSzE 05jw== X-Gm-Message-State: AOAM531ayBBJuj0RSrQ16OxB+sL7zy1qzrzbDTOm1W/ALpmzlQn/WlvK yRKsLtqYpV1ctA85qqfHMdK5OQ== X-Google-Smtp-Source: ABdhPJxkiyPcGha8EA9sg/7lQmn+O5OBib7oEZX270HhCUOKgigDK4OOnz98pAkIlqJKozflypcvug== X-Received: by 2002:a05:6402:895:: with SMTP id e21mr2679030edy.284.1610443010649; Tue, 12 Jan 2021 01:16:50 -0800 (PST) Received: from myrica ([2001:1715:4e26:a7e0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id m7sm934913eji.118.2021.01.12.01.16.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 01:16:50 -0800 (PST) Date: Tue, 12 Jan 2021 10:16:31 +0100 From: Jean-Philippe Brucker To: Lu Baolu Subject: Re: [PATCH v9 03/10] iommu: Separate IOMMU_DEV_FEAT_IOPF from IOMMU_DEV_FEAT_SVA Message-ID: References: <20210108145217.2254447-1-jean-philippe@linaro.org> <20210108145217.2254447-4-jean-philippe@linaro.org> <4de8ef03-a2ed-316e-d3e3-6b8474e20113@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4de8ef03-a2ed-316e-d3e3-6b8474e20113@linux.intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210112_041654_023392_13F3A59C X-CRM114-Status: GOOD ( 29.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kroah-Hartman , vivek.gautam@arm.com, guohanjun@huawei.com, will@kernel.org, lorenzo.pieralisi@arm.com, joro@8bytes.org, Zhou Wang , linux-acpi@vger.kernel.org, zhangfei.gao@linaro.org, lenb@kernel.org, devicetree@vger.kernel.org, "Tian, Kevin" , Arnd Bergmann , eric.auger@redhat.com, robh+dt@kernel.org, Jonathan.Cameron@huawei.com, linux-arm-kernel@lists.infradead.org, David Woodhouse , rjw@rjwysocki.net, shameerali.kolothum.thodi@huawei.com, iommu@lists.linux-foundation.org, sudeep.holla@arm.com, robin.murphy@arm.com, linux-accelerators@lists.ozlabs.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Baolu, On Tue, Jan 12, 2021 at 12:31:23PM +0800, Lu Baolu wrote: > Hi Jean, > > On 1/8/21 10:52 PM, Jean-Philippe Brucker wrote: > > Some devices manage I/O Page Faults (IOPF) themselves instead of relying > > on PCIe PRI or Arm SMMU stall. Allow their drivers to enable SVA without > > mandating IOMMU-managed IOPF. The other device drivers now need to first > > enable IOMMU_DEV_FEAT_IOPF before enabling IOMMU_DEV_FEAT_SVA. > > > > Signed-off-by: Jean-Philippe Brucker > > --- > > Cc: Arnd Bergmann > > Cc: David Woodhouse > > Cc: Greg Kroah-Hartman > > Cc: Joerg Roedel > > Cc: Lu Baolu > > Cc: Will Deacon > > Cc: Zhangfei Gao > > Cc: Zhou Wang > > --- > > include/linux/iommu.h | 20 +++++++++++++++++--- > > 1 file changed, 17 insertions(+), 3 deletions(-) > > > > diff --git a/include/linux/iommu.h b/include/linux/iommu.h > > index 583c734b2e87..701b2eeb0dc5 100644 > > --- a/include/linux/iommu.h > > +++ b/include/linux/iommu.h > > @@ -156,10 +156,24 @@ struct iommu_resv_region { > > enum iommu_resv_type type; > > }; > > -/* Per device IOMMU features */ > > +/** > > + * enum iommu_dev_features - Per device IOMMU features > > + * @IOMMU_DEV_FEAT_AUX: Auxiliary domain feature > > + * @IOMMU_DEV_FEAT_SVA: Shared Virtual Addresses > > + * @IOMMU_DEV_FEAT_IOPF: I/O Page Faults such as PRI or Stall. Generally using > > + * %IOMMU_DEV_FEAT_SVA requires %IOMMU_DEV_FEAT_IOPF, but > > + * some devices manage I/O Page Faults themselves instead > > + * of relying on the IOMMU. When supported, this feature > > + * must be enabled before and disabled after > > + * %IOMMU_DEV_FEAT_SVA. > > Is this only for SVA? We may see more scenarios of using IOPF. For > example, when passing through devices to user level, the user's pages > could be managed dynamically instead of being allocated and pinned > statically. Hm, isn't that precisely what SVA does? I don't understand the difference. That said FEAT_IOPF doesn't have to be only for SVA. It could later be used as a prerequisite some another feature. For special cases device drivers can always use the iommu_register_device_fault_handler() API and handle faults themselves. > If @IOMMU_DEV_FEAT_IOPF is defined as generic iopf support, the current > vendor IOMMU driver support may not enough. IOMMU_DEV_FEAT_IOPF on its own doesn't do anything useful, it's mainly a way for device drivers to probe the IOMMU capability. Granted in patch 10 the SMMU driver registers the IOPF queue on enable() but that could be done by FEAT_SVA enable() instead, if we ever repurpose FEAT_IOPF. Thanks, Jean _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel