From patchwork Tue Oct 17 03:20:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Tina" X-Patchwork-Id: 13424391 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 53F00CDB465 for ; Tue, 17 Oct 2023 03:21:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234463AbjJQDVd (ORCPT ); Mon, 16 Oct 2023 23:21:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234357AbjJQDVU (ORCPT ); Mon, 16 Oct 2023 23:21:20 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5AF0EA; Mon, 16 Oct 2023 20:21:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697512879; x=1729048879; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2IR/Jycn4fYLDKkd/59DW5lTr+45wMYcYu8xOLtatO8=; b=L5nEBzZP8Sa5BemYhuj/6CHwaIq2WDhf2s5Is4TE0pZ0v2LnX874XJlY 1ssv+HXB7F//9yscwLd/NSrwcbog0nh2P6cs8zf9GV15+r1O4puz02OQr 72IkMRERBO9mdF6/TnQiYrb4AB8yCY+hzsL1yB8WUL5pExu62DQYjXwdK e3RxZ1dRUrXezgarJxN1LP2xYBxvwJH+gA+qsYztsilorZV7z2iz11ERi 27gKdaj8erAiyMi2k6KrtHEJZslMczbUxvlIxBoQuff5vjqayreT+Kfbt wTL7nTzn+k5q5N83QrvneO/lmWbYL5GMUKXjMICM/vExPeAf9/4cu+2MJ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="389560806" X-IronPort-AV: E=Sophos;i="6.03,231,1694761200"; d="scan'208";a="389560806" 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:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="826269997" X-IronPort-AV: E=Sophos;i="6.03,231,1694761200"; d="scan'208";a="826269997" 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:15 -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:36 +0800 Message-Id: <20231017032045.114868-5-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 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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);