Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp709486pxv; Fri, 9 Jul 2021 07:19:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxO8b2PQbWTRA0eLYfQqJtgUSeGvRPw+Ku5lq6C9yy+oLNJZvfHsArklOhxqW6PpnA0diRQ X-Received: by 2002:aa7:dd57:: with SMTP id o23mr47063733edw.6.1625840355304; Fri, 09 Jul 2021 07:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625840355; cv=none; d=google.com; s=arc-20160816; b=AVYB2QleN9UIC30RDwKSWMB6L/jEyuLm9Ab0HkTOoAdAnuQ8vU4ZtJnpB5qFarVFvK xy6PVewf9TdP5YkbOSpqYRH4NjeXbZtMIbLaI46LwCtq8ig3ndB2Tw9dce+pPPAiWvoa KO06sXQ/RaGJC3eNrA8/t9S+rJkxcrcYtDqPMcJjesLTXWwxlXTeQ/kqZjcC/L53GfLU ghr2ChEa2AkNEfgSZ4XC0AT/cwM2XCYaqaArZuBPN1KJp77Rq5HWgU48OdXOZ4JnFFlJ QyMkPOiQBXZjWneqS33eRUASjVmBjHGDgqTKvlVsAknkRLlHa53CSJ2KHLcm/7UefkVC Wd3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:cc; bh=3azn3V14t3hVl8XzoS1d14z2hv9mfHXMOxVPvQQjX/o=; b=s9Qx5tuBt0w+aAm7WmiUorrSa3lIIciYZG2JUCAyh48ulzWtjqHEEte4FqJGb2ahDB bR4wCR0Ko7by4nTZI/bkCSpPuVnmkBDh+PuaNGcKBS+BXLz0v4vw36juNAfDu/uh5TNb 5c1iS2i1htBhe9mIB8aYC+pAdG1uD2c/Y1vkVSokaN0AHieWrCeMH6hDBZP0BCfiUb9O eXCFMohqYaQH9FL11DW/fINK/ojNWyPuA9PaJVG2ssajR7EQ8Z6xgb7+1LH6gEc1+S7n h+2KLM86cwDkGhJFuQGRMfP5e+m+eS3nex+T06TbobdMwTD91WHwNHi25w9i4On4HA7P 86uA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si7671745edr.183.2021.07.09.07.18.51; Fri, 09 Jul 2021 07:19:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232018AbhGIOUT (ORCPT + 99 others); Fri, 9 Jul 2021 10:20:19 -0400 Received: from mga04.intel.com ([192.55.52.120]:35272 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231797AbhGIOUT (ORCPT ); Fri, 9 Jul 2021 10:20:19 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10039"; a="207882068" X-IronPort-AV: E=Sophos;i="5.84,226,1620716400"; d="scan'208";a="207882068" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jul 2021 07:17:32 -0700 X-IronPort-AV: E=Sophos;i="5.84,226,1620716400"; d="scan'208";a="488060340" Received: from blu2-mobl3.ccr.corp.intel.com (HELO [10.254.208.213]) ([10.254.208.213]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jul 2021 07:17:28 -0700 Cc: baolu.lu@linux.intel.com, virtualization@lists.linux-foundation.org, Linux Kernel List , Michael Kelley , Vineeth Pillai , Sunil Muthuswamy , Nuno Das Neves , kumarpraveen@linux.microsoft.com, pasha.tatashin@soleen.com, David Woodhouse , Joerg Roedel , Will Deacon , "open list:INTEL IOMMU (VT-d)" Subject: Re: [RFC v1 4/8] intel/vt-d: export intel_iommu_get_resv_regions To: Wei Liu , Linux on Hyper-V List References: <20210709114339.3467637-1-wei.liu@kernel.org> <20210709114339.3467637-5-wei.liu@kernel.org> From: Lu Baolu Message-ID: Date: Fri, 9 Jul 2021 22:17:25 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210709114339.3467637-5-wei.liu@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/7/9 19:43, Wei Liu wrote: > When Microsoft Hypervisor runs on Intel platforms it needs to know the > reserved regions to program devices correctly. There is no reason to > duplicate intel_iommu_get_resv_regions. Export it. Why not using iommu_get_resv_regions()? Best regards, baolu > > Signed-off-by: Wei Liu > --- > drivers/iommu/intel/iommu.c | 5 +++-- > include/linux/intel-iommu.h | 4 ++++ > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c > index a4294d310b93..01973bc20080 100644 > --- a/drivers/iommu/intel/iommu.c > +++ b/drivers/iommu/intel/iommu.c > @@ -5176,8 +5176,8 @@ static void intel_iommu_probe_finalize(struct device *dev) > set_dma_ops(dev, NULL); > } > > -static void intel_iommu_get_resv_regions(struct device *device, > - struct list_head *head) > +void intel_iommu_get_resv_regions(struct device *device, > + struct list_head *head) > { > int prot = DMA_PTE_READ | DMA_PTE_WRITE; > struct iommu_resv_region *reg; > @@ -5232,6 +5232,7 @@ static void intel_iommu_get_resv_regions(struct device *device, > return; > list_add_tail(®->list, head); > } > +EXPORT_SYMBOL_GPL(intel_iommu_get_resv_regions); > > int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct device *dev) > { > diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h > index 03faf20a6817..f91869f765bc 100644 > --- a/include/linux/intel-iommu.h > +++ b/include/linux/intel-iommu.h > @@ -814,6 +814,8 @@ extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu); > extern int dmar_disabled; > extern int intel_iommu_enabled; > extern int intel_iommu_gfx_mapped; > +extern void intel_iommu_get_resv_regions(struct device *device, > + struct list_head *head); > #else > static inline int iommu_calculate_agaw(struct intel_iommu *iommu) > { > @@ -825,6 +827,8 @@ static inline int iommu_calculate_max_sagaw(struct intel_iommu *iommu) > } > #define dmar_disabled (1) > #define intel_iommu_enabled (0) > +static inline void intel_iommu_get_resv_regions(struct device *device, > + struct list_head *head) {} > #endif > > #endif >