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: 153883 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3872424vqb; Mon, 16 Oct 2023 20:22:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFGUOQ+9mmazwP1preql8n43dB7YwFm+ORYJdUy3Sy/0a1+Ko911THJWRE7TgQW7M5la1ig X-Received: by 2002:a05:6a21:617:b0:159:f5fb:bf74 with SMTP id ll23-20020a056a21061700b00159f5fbbf74mr939815pzb.3.1697512932243; Mon, 16 Oct 2023 20:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697512932; cv=none; d=google.com; s=arc-20160816; b=Ky6fmjIYHu3465EZeyXG+/dDNhUJ4iYI8zrVIo3fVDkAFv0BY2ahiv4KrMX7ZXObfF x6dbFZY6Tg6HSD033pOceztg/xqJ7OX6FEMqVnOIqlXp8nmNQ8NTduB+aO2xvb9YA42/ VC3UVs7u5snHZfDBmIoUU0WOq5MOUwzYVd/msO8sREbJTL13ZrTy6GhGmP2ncGq5E+9Q MHvd/2dcZgHTj5AWfTT1L8OxN9MBtikZPgXqfJAs6PKACvyo0Wlnb3pDaaInP3Wvtv5E qA7QjTkYAxhQBggPw3WuKPxa7tv2wTRBhxzIA1PWFeHZey6/dY6+W5yNrRq7fzWEtSUo JPfg== 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=IDGBpBOwXiSzLKtwY3qxYBlW507D1qIrJpr5N3cWA379v5f1vjgz98NHKiYlw2NqGC PUr+Vsqegsx3/FH6NGIQ+1UJMv/2gbQEYYksBHZ36LYZ+vcTi23/Ea6sVCLldABQX/pO 6XAntRpD/RPyzuTpFWidPw13ZNhyiUgTa39KVsGJ03UXAjZbsJFaJD+A49q/rjx8v242 TC5qiD4xGduuTtM1fTDca27SMltn4NAnJUjGZyWoo4KdFnzgwSD13+BFHgePeAw534x2 3bB+S0YV+mIEKI48ip5kt+7TnHtiLllw+OOsUApOFesQYNL00C4kWRGBMNPitHsNHFHx ysnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=L5nEBzZP; 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 t1-20020a170902e84100b001bbca0a8393si889152plg.56.2023.10.16.20.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 20:22:12 -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=L5nEBzZP; 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 BF9C3801F988; Mon, 16 Oct 2023 20:22:09 -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 S234469AbjJQDVe (ORCPT + 19 others); Mon, 16 Oct 2023 23:21:34 -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 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:09 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779971320160410721 X-GMAIL-MSGID: 1779971320160410721 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);