Message ID | 20231208015314.320663-1-baolu.lu@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5188440vqy; Thu, 7 Dec 2023 17:58:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEdXwElFXvxNNIgNcWwnbws56+qFXLnIZURUlFO4NNOV5+em+7HaTBtdyfZMeJTFCzTEv+n X-Received: by 2002:a17:903:8cb:b0:1d0:6ffd:6108 with SMTP id lk11-20020a17090308cb00b001d06ffd6108mr242553plb.42.1702000684905; Thu, 07 Dec 2023 17:58:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702000684; cv=none; d=google.com; s=arc-20160816; b=aLT8O0TcHnUBLhPbSaf8Q26LJUlktGvV5iATcXsIvXCl6NOxDq2Y99QgeuTPsTcTaJ XjPFwJcqOZLA0Y1B2Kv7cP5dV7U/5HkzTr75gZ4hXQs8sD9ndVGdQ0KeH/Z0pAEe5621 fOgdGodVCsQwQc8H4qYk9dnR9a4tNcavUKy11tRPx2db0xlia5t4aJ1/aeoTUQhz5d9+ 3ReA5TbAqtn2GzCWow7rqeYupt1BG/91MI0BZDxgZ6gWFuMeMNjzhTIM/GiGRsx33E6E NqOQYr8uQ9yie37k9i0gMI0rhzA7Kh6a2i9ixpdYTm0Qz9JZukzEqsmqX82e0ZpaeY9z E0DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=c6fVF37t/f1Yp4dNti0MmcZwNSyTzDIyjg08F7XDy9Y=; fh=5K4v/0ku97kpa0vTvhWLyUEWwXZiIFVMmzwLLirrjJ4=; b=P4c9dyjARsSXEauW7jW6mopDvhPzZbH6movCpxKmNrfVALm9S7lXjZ7FHLUb0K7r7Q o9t/bSxtNnVLJ9wWyAa0p4+RmPUbZhbwMAtBRduxOpen4TxCa4IjLxXG/V74QAr1MFVv 7Zf9Yy9l+AaEAmXBjLWF0Z3JEYTQ0dkxzVy/sObAcEdqekG4s4R/VfD4tuAnwQP7nUoO hgjhR1vdAq1z6JEVx81t2uw3fnWwMF6Ik5gD4zRNLA7g4C9tt/HwyOCjlbaieuME3AMd jxGIY1yIQoliXzesDUycMoK6VxwidJAwfEETo2ppaeYBrgufWvHrq1VyqAlY/ITBCZcC aksw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=e94+XG1i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id be3-20020a170902aa0300b001c5e1c94588si655592plb.550.2023.12.07.17.58.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 17:58:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=e94+XG1i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 6814880FCCBA; Thu, 7 Dec 2023 17:57:59 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1572946AbjLHB5u (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Thu, 7 Dec 2023 20:57:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1572924AbjLHB5t (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 7 Dec 2023 20:57:49 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 811E21AD for <linux-kernel@vger.kernel.org>; Thu, 7 Dec 2023 17:57:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702000675; x=1733536675; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=un4XPFTzO6AWHemPtM6XczKOhQkrLlZxvkBGsGhl8F8=; b=e94+XG1ieN5kA1n0WdPt85tbl6JLm9A/vIaezWPpG+Ww0hewnCYOWHu8 CEIvxnRNSAuVlOIknxG73sBJqAXfvlMNRxqSBPxNgkU8QsDBm+gAb3JJz odRcYjGJ/JRmche81JD/dRXTthCsopy1G7WZOPfzZNv1a82+CKiZrZlcq 9+z6KbioXuprSDfensSztWMsrTbeE5MiE01UXOWJetxcY2t4ZM3yIMdpC bbeqq6NxcrHKadgMwGopn0dXcCh1P/ahSU/fiqOG9e+7IlNrZSMSS6639 tiooFt62pKFKWskodpZQgzL4mF3cn9+c87dtxDQx1T6HlYGPyy/cYoa2+ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10917"; a="397131259" X-IronPort-AV: E=Sophos;i="6.04,259,1695711600"; d="scan'208";a="397131259" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2023 17:57:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10917"; a="945266198" X-IronPort-AV: E=Sophos;i="6.04,259,1695711600"; d="scan'208";a="945266198" Received: from allen-box.sh.intel.com ([10.239.159.127]) by orsmga005.jf.intel.com with ESMTP; 07 Dec 2023 17:57:52 -0800 From: Lu Baolu <baolu.lu@linux.intel.com> To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>, Robin Murphy <robin.murphy@arm.com>, Jason Gunthorpe <jgg@ziepe.ca>, Kevin Tian <kevin.tian@intel.com> Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Lu Baolu <baolu.lu@linux.intel.com> Subject: [PATCH v2] iommu: Set owner token to SVA domain Date: Fri, 8 Dec 2023 09:53:14 +0800 Message-Id: <20231208015314.320663-1-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,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 fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 07 Dec 2023 17:57:59 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784677070030650880 X-GMAIL-MSGID: 1784677070030650880 |
Series |
[v2] iommu: Set owner token to SVA domain
|
|
Commit Message
Baolu Lu
Dec. 8, 2023, 1:53 a.m. UTC
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.
Fixes: a9c362db3920 ("iommu: Validate that devices match domains")
Cc: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
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/
Comments
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 <robin.murphy@arm.com> > Fixes: a9c362db3920 ("iommu: Validate that devices match domains") > Cc: Robin Murphy <robin.murphy@arm.com> > Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> > --- > 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; >
On Fri, Dec 08, 2023 at 09:53:14AM +0800, 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. > > Fixes: a9c362db3920 ("iommu: Validate that devices match domains") > Cc: Robin Murphy <robin.murphy@arm.com> > Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> > --- > drivers/iommu/iommu.c | 1 + > 1 file changed, 1 insertion(+) Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Jason
On Fri, Dec 08, 2023 at 09:53:14AM +0800, Lu Baolu wrote: > drivers/iommu/iommu.c | 1 + > 1 file changed, 1 insertion(+) Applied, thanks.
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;