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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E137C10DCE for ; Fri, 8 Dec 2023 11:15:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573605AbjLHLP3 (ORCPT ); Fri, 8 Dec 2023 06:15:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235902AbjLHLPN (ORCPT ); Fri, 8 Dec 2023 06:15:13 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B42751BE8 for ; Fri, 8 Dec 2023 03:15:04 -0800 (PST) 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 69E4411FB; Fri, 8 Dec 2023 03:15:48 -0800 (PST) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D89AB3F762; Fri, 8 Dec 2023 03:15:01 -0800 (PST) Message-ID: <4fb1b999-7b1b-4d54-a0ca-87b596458ba0@arm.com> Date: Fri, 8 Dec 2023 11:15:00 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] iommu: Set owner token to SVA domain Content-Language: en-GB To: Lu Baolu , Joerg Roedel , Will Deacon , Jason Gunthorpe , Kevin Tian Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org References: <20231208015314.320663-1-baolu.lu@linux.intel.com> From: Robin Murphy In-Reply-To: <20231208015314.320663-1-baolu.lu@linux.intel.com> 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 08/12/2023 1:53 am, Lu Baolu wrote: > Commit a9c362db3920 ("iommu: Validate that devices match domains") added > an owner token to the iommu_domain. This token is checked during domain > attachment to RID or PASID through the generic iommu interfaces. > > The SVA domains are attached to PASIDs through those iommu interfaces. > Therefore, they require the owner token to be set during allocation. > Otherwise, they fail to attach. > > Set the owner token for SVA domains. Reviewed-by: Robin Murphy > Fixes: a9c362db3920 ("iommu: Validate that devices match domains") > Cc: Robin Murphy > Signed-off-by: Lu Baolu > --- > drivers/iommu/iommu.c | 1 + > 1 file changed, 1 insertion(+) > > Change log: > v2: > - The user domain allocation path does the right thing. Hence no need > to fix anything. > v1: > - https://lore.kernel.org/linux-iommu/20231207021938.306738-1-baolu.lu@linux.intel.com/ > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 0d25468d53a6..d0a28667479a 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -3617,6 +3617,7 @@ struct iommu_domain *iommu_sva_domain_alloc(struct device *dev, > domain->type = IOMMU_DOMAIN_SVA; > mmgrab(mm); > domain->mm = mm; > + domain->owner = ops; > domain->iopf_handler = iommu_sva_handle_iopf; > domain->fault_data = mm; >