From patchwork Tue Oct 17 03:20:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Tina" X-Patchwork-Id: 153880 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3872311vqb; Mon, 16 Oct 2023 20:21:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHJ1U/pgrWo2t1zkZbaUmiwU5Iuc+Gu8LjqTmW8EcXYhsacMKEz39YZ1+limxW2PVeCtLS/ X-Received: by 2002:a17:90b:38cf:b0:27c:f88f:11a5 with SMTP id nn15-20020a17090b38cf00b0027cf88f11a5mr1114087pjb.2.1697512911507; Mon, 16 Oct 2023 20:21:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697512911; cv=none; d=google.com; s=arc-20160816; b=NO6qtKWKKo322MHLlRvFpsJfrnp2rJrEoQH6k4yMOdeYv5fn+3hfpzndHdSOtA9jOJ q/LUVXABe6mIIVEKSPtKiHLQvlJ+N+Izqwn6Qdf82V9XQIfJf3uQ3W9eGjB3pSAP9U9b nryNpmqM3FgRPU/r5QV5mEaV5wcn3mAU+volFQr3dxuu7/07e5wfi7K5P1GorgS+cWYJ qHtr8JOh/hX7xNrSQEVp3anc7sFPxLPYUqwFPKTyEOvvz2ERLLpmVdbVGhd4fsGIV5PG 0XDgOqMY57ZMusGWnF/ceWgjKwnoKdtK+2eIiMNosT0+jep7Ii38arfSDz8kdOK6etHT l0tA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FDYBH9afjeV3i4wsy3r8F/TSzv8Ph9NIKrw3RCnOYLs=; fh=R49q8kPD/ziIvsyYshS2LccDCxkbN9TSdzSyy3EleF0=; b=CdlCJyS5OdzBF87Ztou6zUKTo0uetW6RZ8BrI5zpdjbbv5MOWxaHqGxjDDSz1oqKNF OJFr7KDpgPFSHIyjkj02Pbt/cHFZZNgtM4zlC4Gve8gcq3ZfPUwIVc9I1w1V5I5b+Tb7 2bCdHoQTJbhUAGZzUh/PysKP9fYBxMoaBy6tZT4i2LOI2nuj8WKKi/CZfHJ+yjdb/fwt ILZezmyLdr5AQiB3VnUsrIQexxLA8O2BuYacsLHGrHOVg5usVPh56kWY270VtIkaLk/p URrl9nwWpYqwrXDliJ4sk8nMmNwQRB2c64hxvLUM3/Qpz/y+Defpohzl8Ltw92QuYVAo CX2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QwV9BNYu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id j7-20020a17090ae60700b002769b4b64e7si7396862pjy.20.2023.10.16.20.21.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 20:21:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QwV9BNYu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id D9992801F982; Mon, 16 Oct 2023 20:21:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234353AbjJQDV2 (ORCPT + 19 others); Mon, 16 Oct 2023 23:21:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234339AbjJQDVR (ORCPT ); Mon, 16 Oct 2023 23:21:17 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DDD7AB; Mon, 16 Oct 2023 20:21:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697512876; x=1729048876; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1Z6jX+P7MCIOfyMGIgtsB1mRLw9bjRzEbzGK7rvIIsU=; b=QwV9BNYusIctareYmJltCA4SYVQu8MYlyVAEI521PSQ7G1WFKqWIz6uB XxkHdY+MpiGUz2Od/v9J9ApyuQXcbvl1zN3Sp+NbrR2opy84MwSwTkwgw Pcexz+Z7EY8+eweucGe6cSEst5tHcwcV8wY+pLerWaLNOih5zlKvIhPPy QleqkFJ8jHJY/Pqb/gGSXJWQoWCMpHSHBrxcV8jJCOC5qlSRBOX0Wq0z1 whR5mh+H+y0/SUrBXO2UBO7CAb0JTF7OrvlvQNOzfGl6fT2nzip+H+Uvr h25aFc1KSkxKA9Iga8afuc/UfIgks+ExGyhLllAIRtU934ve3WhH+sulj g==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="389560795" X-IronPort-AV: E=Sophos;i="6.03,231,1694761200"; d="scan'208";a="389560795" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 20:21:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="826269962" X-IronPort-AV: E=Sophos;i="6.03,231,1694761200"; d="scan'208";a="826269962" Received: from sqa-gate.sh.intel.com (HELO spr-2s5.tsp.org) ([10.239.48.212]) by fmsmga004.fm.intel.com with ESMTP; 16 Oct 2023 20:21:13 -0700 From: Tina Zhang To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: David Woodhouse , Lu Baolu , Joerg Roedel , Jason Gunthorpe , Kevin Tian , Tina Zhang Subject: [RFC PATCH 03/12] iommu/vt-d: Retire intel_svm_bind_mm() Date: Tue, 17 Oct 2023 11:20:35 +0800 Message-Id: <20231017032045.114868-4-tina.zhang@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231017032045.114868-1-tina.zhang@intel.com> References: <20231017032045.114868-1-tina.zhang@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Mon, 16 Oct 2023 20:21:48 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779971298850376184 X-GMAIL-MSGID: 1779971298850376184 Refactor intel_svm_set_dev_pasid() by moving the logic from intel_svm_bind_mm() into intel_svm_set_dev_pasid() and retire intel_svm_bind_mm(). No functional change intended. The motivation is to let intel_iommu_set_dev_pasid() serve for both sva domain and default domain set_dev_pasid operation, instead of duplicating code for them. In latter patches, we will first do some refactoring to intel_svm_set_dev_pasid(), and then extend intel_iommu_set_dev_pasid() to support sva domain. After that, intel_svm_set_dev_pasid() will call intel_iommu_set_dev_pasid() for set_dev_pasid purpose. Signed-off-by: Tina Zhang --- drivers/iommu/intel/svm.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c index f9b1f13bd068..03406395ac5b 100644 --- a/drivers/iommu/intel/svm.c +++ b/drivers/iommu/intel/svm.c @@ -289,10 +289,11 @@ static int pasid_to_svm_sdev(struct device *dev, unsigned int pasid, return 0; } -static int intel_svm_bind_mm(struct intel_iommu *iommu, struct device *dev, - struct iommu_domain *domain, ioasid_t pasid) +static int intel_svm_set_dev_pasid(struct iommu_domain *domain, + struct device *dev, ioasid_t pasid) { struct device_domain_info *info = dev_iommu_priv_get(dev); + struct intel_iommu *iommu = info->iommu; struct mm_struct *mm = domain->mm; struct intel_svm_dev *sdev; struct intel_svm *svm; @@ -784,15 +785,6 @@ int intel_svm_page_response(struct device *dev, return ret; } -static int intel_svm_set_dev_pasid(struct iommu_domain *domain, - struct device *dev, ioasid_t pasid) -{ - struct device_domain_info *info = dev_iommu_priv_get(dev); - struct intel_iommu *iommu = info->iommu; - - return intel_svm_bind_mm(iommu, dev, domain, pasid); -} - static void intel_svm_domain_free(struct iommu_domain *domain) { kfree(to_dmar_domain(domain));