Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3987860pxb; Tue, 25 Jan 2022 00:47:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJz6abrAMGwyNIyAL5xYZzg/JvQaVuRFmO/Brp8lNOVyoH3bwa8qKUfXbN2u8R0KkBPuL2WF X-Received: by 2002:a17:906:5d0f:: with SMTP id g15mr15219084ejt.670.1643100426203; Tue, 25 Jan 2022 00:47:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643100426; cv=none; d=google.com; s=arc-20160816; b=AAdB1tdOhE2gunmYhH5SMt1jxQjZj3aRJwFN8vqB+R+d7dLVd0/SnjW5FzVX6knaqv 7lgaL5r4emJCAbgg7Yrr4rrEW2ZsvQ0xUiMTSjw4KPiNu1o1QIlYnPmUnepBML9vWt+M QN7hTZuyJ6T9Mupe3UydpmY8gA6V5Eo1yf1muIXK1Bsw3xDuIWzAzdvoWIP0shBQHGjs jmSjZcupRLxQ2kL+9QDa6HMM+A3o5U8zIFSJ1wpVIZZgtXTPAqMY1fmXW4xGXyX7IUe2 zaTO7vSB2q43phvx3573zaVEa4cPB+XElQ0jUP6czGWr+PLxDrdW2W/UFEXUezfy4fR3 YIXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=vM8itP4ciaC5PduvHuqieYNB6/16ptDO7HAno7L6h4I=; b=WXlYFoGmEAGf5C2IBQAEiw1Z8A0UYEHltNlLkFieB+ijPjkNTA4EhnfcnNS0hRH2op q4j4r+J1s00K669ttoJ1TdGPsM85kWMysTnBkJnZrx5L5v0O8neCLEgdhmAI2NDZdhxb JRE63H0pz3tndcXTGD4yz6GHgzLepGEBmldAr1cBoTMnQkJnpUS/ycQYWo4at/RRyarH qQ6Gs4dOjDOfc6kVSUSIN5ujZX4nBjBAe0O7EUUdVePOWPTUGPWm6L937IZIupAvxXJ7 VFlR1L0gp3o0ahEGNtQmk3hyTHnBOfuAyk7YAR8aGaqTQcYBl0jj6slmKZ+0KOypirLn Wh5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qf21si10650031ejc.896.2022.01.25.00.46.38; Tue, 25 Jan 2022 00:47:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1318463AbiAYDFr (ORCPT + 99 others); Mon, 24 Jan 2022 22:05:47 -0500 Received: from foss.arm.com ([217.140.110.172]:34126 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S3415843AbiAYBwc (ORCPT ); Mon, 24 Jan 2022 20:52:32 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 792F51FB; Mon, 24 Jan 2022 17:52:31 -0800 (PST) Received: from [10.57.68.26] (unknown [10.57.68.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 55CAA3F766; Mon, 24 Jan 2022 17:52:29 -0800 (PST) Message-ID: Date: Tue, 25 Jan 2022 01:52:25 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 6/7] iommu: Use right way to retrieve iommu_ops Content-Language: en-GB To: "Tian, Kevin" , Jason Gunthorpe , Lu Baolu Cc: "Raj, Ashok" , David Airlie , Jonathan Hunter , Christoph Hellwig , Alex Williamson , Thierry Reding , Ben Skeggs , Daniel Vetter , Will Deacon , "linux-kernel@vger.kernel.org" , "Pan, Jacob jun" References: <20220124071103.2097118-1-baolu.lu@linux.intel.com> <20220124071103.2097118-7-baolu.lu@linux.intel.com> <20220124173650.GF966497@nvidia.com> From: Robin Murphy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-01-25 01:11, Tian, Kevin wrote: >> From: Jason Gunthorpe via iommu >> Sent: Tuesday, January 25, 2022 1:37 AM >>> @@ -1295,7 +1298,7 @@ int iommu_page_response(struct device *dev, >>> msg->pasid = 0; >>> } >>> >>> - ret = domain->ops->page_response(dev, evt, msg); >>> + ret = ops->page_response(dev, evt, msg); >>> list_del(&evt->list); >>> kfree(evt); >>> break; >> >> Feels weird that page_response is not connected to a domain, the fault >> originated from a domain after all. I would say this op should be >> moved to the domain and the caller should provide the a pointer to the >> domain that originated the fault. >> > > In concept yes. Not even that, really. It's true that the "fault" itself is logically associated with the domain, but we never see that - the ATS request and response which encapsulate it all happen automatically on the PCI side. It's the endpoint that then decides to handle ATS translation failure via PRI, so all we actually get is a page request message from a RID/PASID, which most definitely represents the "device" (and in fact having to work backwards from there to figure out which domain/context it is currently attached to can be a bit of a pain). Similarly the response is a message directly back to the device itself - an operation on a domain may (or may not) have happened off the back of receiving the initial request, but even if the content of the response is to reflect that, the operation of responding is clearly focused on the device. I fully agree that it's a weird-looking model, but that's how PCI SIG made it - and no IOMMU architecture seems to have tried to wrap it up in anything nicer either - so I don't see that we'd gain much from trying to pretend otherwise :) Robin. > But currently the entire sva path is not associated with domain. This was > one mistake as we discussed in the cover letter. Before extending iommu > domain to cover CPU page tables we may have to leave it in iommu_ops > given this series is just for cleanup... > > Thanks > Kevin