Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1385782rdb; Wed, 6 Dec 2023 18:27:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEO8euQkNJToMC662Vz4pVEdnq4Zb0i0CbM2EcYwM5C9ksibSj/q3scmPl5QcXlzmQrD1Lh X-Received: by 2002:a05:6a20:7484:b0:18f:97c:b9ef with SMTP id p4-20020a056a20748400b0018f097cb9efmr1541482pzd.73.1701916037911; Wed, 06 Dec 2023 18:27:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701916037; cv=none; d=google.com; s=arc-20160816; b=N147zVIbI82APRYlGqLmWF+xVk/KrexkwVowGR7BJJDiyKHVNREbBvYDy0xO4Teq3k c9lUJr4iWXorVLyxAbl0mt9O7b6PZamqxJy5aOhtpTZqV6xYuj1JmMkNszChyKxynMHv VcKS69cCXtlY2vAyytx8KfMZ2dBE/3oIWT68AGyHlwJX3If0IowBBrKVGArGBC1AFvKm EvNTFE7qKVbSDd1UxTPYFn0UFCvLTkEuaGFFr90RBaD5O9DMKvKfENL58Bvylo6Upz6Z xj+ynspafqjuiIM2i40eO+fgjVcChSPOTMuokMUlCYDGVSeXc1bwgwW9sB8x3O6a1ziI Xfcg== 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=DVUJAfm4eJtFBt0LqI2ry2YIH1K/XbMMzQe6ErY9dhI=; fh=5K4v/0ku97kpa0vTvhWLyUEWwXZiIFVMmzwLLirrjJ4=; b=PelQ3EbfQB8RKPub2m4eEJKHVR/Gi5H+FPpwd1u2k53fhAGJ5zdkUH3tOaAu2B/4XR 5O2d+CgfBn0T2RHMlKCgsKvoj4ZC8Na01drPk/qLL/qcPtF/zQ5//dwbzleZIh0bABMN bmz+G5IFvVlnaCwz8VP1ZYEYpoAdSGW06YeDpnagg9lYS7J39cOwxHdxc0NQlorNcCAG OoRfX8Vf5VNN+EISEmrXK/TO7KULIChdczky7xGwSxYijTYlShl0Puu/alcYOS1dBL43 0ZFNP2/ebi6lS4usyTnyjsRTiZrF+LCVlbL+f6RmBByGU7Brxqkj5ahiBb3x+ufVuaE8 fNhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DcLqoK4u; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id f14-20020a170902ce8e00b001d003f8b649si264715plg.142.2023.12.06.18.27.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 18:27:17 -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=@intel.com header.s=Intel header.b=DcLqoK4u; 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; 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 lipwig.vger.email (Postfix) with ESMTP id A839480F5F27; Wed, 6 Dec 2023 18:27:15 -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 S1443019AbjLGCYM (ORCPT + 99 others); Wed, 6 Dec 2023 21:24:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230385AbjLGCYL (ORCPT ); Wed, 6 Dec 2023 21:24:11 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F0B5D5C for ; Wed, 6 Dec 2023 18:24:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701915858; x=1733451858; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=BlyFybv+wIkSnOIH0bgSDQUnQo1Qmc4Q1qqIz58xmyg=; b=DcLqoK4uqAI3ePp5gUDv8cm6mF0CGB6ehXBTMa8cy8SZTQAYPBNfbcvf xD/Hy4NxV0dxj0d3oU+GW5OEd9E9khrH0ONj1/SolBVLXxmwHdvuZ772C SOtgYJEgYG090IXdDCpDmxxLzVj0Q8Xg4v3Zbva1PKvlv10YXoW0fh9xy Fp8SRnFlH5nkZzNa06qKMsDBI51u6fQ39WjOTZPuCL68OX0ZapiFdPY2M G65JDkVszESdOOwseIyJHgGBRfy66ZOIWHSnaE2KGJzZJ5OBnPowqB8V+ Mreu8qk4wOnG/C7Ib6ULdS4d3HL9ibbhVjkSUCmnbeYHO1MP6//IMj1+g A==; X-IronPort-AV: E=McAfee;i="6600,9927,10916"; a="391331282" X-IronPort-AV: E=Sophos;i="6.04,256,1695711600"; d="scan'208";a="391331282" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2023 18:24:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10916"; a="805848827" X-IronPort-AV: E=Sophos;i="6.04,256,1695711600"; d="scan'208";a="805848827" Received: from allen-box.sh.intel.com ([10.239.159.127]) by orsmga001.jf.intel.com with ESMTP; 06 Dec 2023 18:24:15 -0800 From: Lu Baolu To: Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Kevin Tian Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH 1/1] iommu: Set owner token to sva and nested domains Date: Thu, 7 Dec 2023 10:19:38 +0800 Message-Id: <20231207021938.306738-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 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]); Wed, 06 Dec 2023 18:27:15 -0800 (PST) Commit a9c362db3920 ("iommu: Validate that devices match domains") added an owner token to an iommu_domain. This token is checked during domain attachment to RID or PASID through the generic iommu interfaces. The sva and nested domains are attached to device or PASID through the generic iommu interfaces. Therefore, they require the owner token to be set during allocation. Otherwise, they fail to attach. Set the owner token for sva and nested domains. Fixes: a9c362db3920 ("iommu: Validate that devices match domains") Cc: Robin Murphy Signed-off-by: Lu Baolu --- drivers/iommu/intel/nested.c | 1 + drivers/iommu/iommu.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/iommu/intel/nested.c b/drivers/iommu/intel/nested.c index b5a5563ab32c..014d4a4e7586 100644 --- a/drivers/iommu/intel/nested.c +++ b/drivers/iommu/intel/nested.c @@ -108,6 +108,7 @@ struct iommu_domain *intel_nested_domain_alloc(struct iommu_domain *parent, domain->s1_cfg = vtd; domain->domain.ops = &intel_nested_domain_ops; domain->domain.type = IOMMU_DOMAIN_NESTED; + domain->domain.owner = &intel_iommu_ops; INIT_LIST_HEAD(&domain->devices); INIT_LIST_HEAD(&domain->dev_pasids); spin_lock_init(&domain->lock); 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; -- 2.34.1