From patchwork Tue Oct 17 03:20:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Tina" X-Patchwork-Id: 153884 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3872480vqb; Mon, 16 Oct 2023 20:22:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNdD1bRZPLCH/2xMfKirl9QnDwJusC7XcbtLkrY01GKKHvY8reKbhZIyJw8CbPvSaggGTL X-Received: by 2002:a05:6808:2e90:b0:3ad:f525:52d5 with SMTP id gt16-20020a0568082e9000b003adf52552d5mr1499839oib.4.1697512942119; Mon, 16 Oct 2023 20:22:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697512942; cv=none; d=google.com; s=arc-20160816; b=jOcUOTzy1LxNHdIr8z/8Bqlzh0NhzVvGvnlkJjhFa/6ZLWRv3R85WboWkp/RwD93um Wh+7PZWqNP5JTmGzjGFuk6/ZzjjOM1fegmr2o4AESzfQ/HsshkgWNyfhkGh5HowI366v fi4KfWrW376nYurEIarB8UX7DgcUz3Zy+IC+dGS7crZXe2e7ZpH4rKRYCJmdzmbKCk/e UlUa1TJSBB//qQ8Lgb2LBGXhlvovSQwmDLxjZjLkSVqI8w2/9sKWmbGOWlZHDdAMSBSr plMBqwFUvAFeX40WkeCo4Z0pNNwN/P4k46FTY/2XT8JFBo466lfaP1e0YBSBaPcMKH3O Krbw== 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=a6N6DOE+uG8c9c6Pikv5VKW/B6kAmrHWkHTcAKLXRIQ=; fh=R49q8kPD/ziIvsyYshS2LccDCxkbN9TSdzSyy3EleF0=; b=GisesdFTWJg1nUPrk323t620MS246K2DmxRWoKJko/2ePIpTqW0whhF/nM8TKvB6w3 sWwBEtm1UPwK4dO4LZwa1ym3YKV4RL5FxBGFb5lZTB1aMztdSKTqPnrCfpvbeYEFP88W nciGUXDepW6p2A7/zDzmx88I7IIrcVpog6cbLMSlmHTsdIPxD8CZMym3Wgh097nJ1oGQ GQulZnUFmsrIBmrjLBXmqQ0ZfP8NlDiQkMPScKxJN4boq3iwo801kWJD0PG6pXYofxnG bTx1MpD0Ay+RwXmANfvQHZtO2f61wjD6aTbq78kMRWmywepgIGRz53U/uqnokKpj1cMq BuGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=embETSsF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id d188-20020a6336c5000000b0059c0f9ef964si772848pga.635.2023.10.16.20.22.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 20:22:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=embETSsF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 7D6D8801F996; Mon, 16 Oct 2023 20:22:19 -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 S234511AbjJQDVq (ORCPT + 19 others); Mon, 16 Oct 2023 23:21:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234428AbjJQDVb (ORCPT ); Mon, 16 Oct 2023 23:21:31 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D2FDE6; Mon, 16 Oct 2023 20:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697512881; x=1729048881; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2IR/Jycn4fYLDKkd/59DW5lTr+45wMYcYu8xOLtatO8=; b=embETSsFjWCJ5YZj/fU8Ti4VBoWrpxLNdFqycs0oyggUZql4iwEcBA7R hfEWOLENkcicAeJW/8q1XNVVYgInROAznJy11lHFYpgMW+3yVNRsBExjt Y//37INEHFhbPb8g5yfMYshEa/RPjAUWUu0LEMtySEbs+L5H7oIkbgaE2 wm8qMwda+/qUIvukiUOeYwSIE85XadE+Ml9f+60RH6+HQFZHOAE2uLKH9 FE3fild3KYxnO0k1ZLZVnw2F1vCDZifyFHAWywAA7RwSS490k7ZPm0Cqw p9fgN9bv7V3Ek8+X+1nFIzF3n2lpz1yt/wwmrp2kFSs712DbBFeDlNpJr Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="389560821" X-IronPort-AV: E=Sophos;i="6.03,231,1694761200"; d="scan'208";a="389560821" 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:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="826270040" X-IronPort-AV: E=Sophos;i="6.03,231,1694761200"; d="scan'208";a="826270040" 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:18 -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 04/12] iommu/vt-d: Make dev_to_intel_iommu() helper global Date: Tue, 17 Oct 2023 11:20:37 +0800 Message-Id: <20231017032045.114868-6-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:22:19 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779971320160410721 X-GMAIL-MSGID: 1779971331202892036 Make dev_to_intel_iommu() global so that it can be used by other files. Signed-off-by: Tina Zhang --- drivers/iommu/intel/iommu.c | 7 ------- drivers/iommu/intel/iommu.h | 6 ++++++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 3685ba90ec88..eeb658d3bc6e 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -3609,13 +3609,6 @@ void intel_iommu_shutdown(void) up_write(&dmar_global_lock); } -static inline struct intel_iommu *dev_to_intel_iommu(struct device *dev) -{ - struct iommu_device *iommu_dev = dev_to_iommu_device(dev); - - return container_of(iommu_dev, struct intel_iommu, iommu); -} - static ssize_t version_show(struct device *dev, struct device_attribute *attr, char *buf) { diff --git a/drivers/iommu/intel/iommu.h b/drivers/iommu/intel/iommu.h index 7dac94f62b4e..1e972e7edeca 100644 --- a/drivers/iommu/intel/iommu.h +++ b/drivers/iommu/intel/iommu.h @@ -842,6 +842,12 @@ void *alloc_pgtable_page(int node, gfp_t gfp); void free_pgtable_page(void *vaddr); void iommu_flush_write_buffer(struct intel_iommu *iommu); struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn); +static inline struct intel_iommu *dev_to_intel_iommu(struct device *dev) +{ + struct iommu_device *iommu_dev = dev_to_iommu_device(dev); + + return container_of(iommu_dev, struct intel_iommu, iommu); +} #ifdef CONFIG_INTEL_IOMMU_SVM void intel_svm_check(struct intel_iommu *iommu);