Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7096548imu; Thu, 31 Jan 2019 05:01:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN4MCMMEHGVdhmRYuKezWqyxy3XGnbm82T9p+xGe8YhgvKi0zII+thzxqMw4DZ5TS93VkP3G X-Received: by 2002:a65:4946:: with SMTP id q6mr30558012pgs.201.1548939712594; Thu, 31 Jan 2019 05:01:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548939712; cv=none; d=google.com; s=arc-20160816; b=YeVPHBg3/oELWpHrVppSKxF7FUuq9/vLwNOA12I/OKMtyZXg697IBj7VxpXFgHT1RF 3HhBdl15OSKylk8/BBilt22vywCEZN/bsdkFmNxWk4PEGtJ+0aEOHwXrrqh0C+Spnq98 fE3l59narB0nLLLF9Mp5ZYSUpSQTp0JI4vYmcfvHx+YZ3cdBlxBRA9Nk5MypKIRMqIGU PUHr8gjvHLzPvKYr//vamfyh4SmeWybRggAJrQaI2sN83QM9YFBVMOYwg80eGz69778R gBa9s8XsDnd40/5pPY3GmwcNgLwMz5R/ubHFJPsVFYbV/b0md5mTsUudAS8XRVOBsFy/ 7PYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=0qtHcuvZFpgAiWOj6QOb6gKPj5TaFp1cnWJJv6JKMUA=; b=QQrB1NeC9ZOMd/qwY4oH/qFB1J42/hz7qiBTVKV6zR9yysoyQXAdoPfweLTyetWmSJ RZc2MjN2CPadtDqzG4fHVFe0V6Zjo6un+087kz+rO9ODVdMZ8o5wRR3SLWFb8EfX24Vd R4o9KMIu3GJ6O/QrRQNn9qH5glLhQRtoHHPF8wZaVPgKeqzejbrpiDdRPJOxOffdRpnG YgmC5OAr8ZXTPajyb47mAaGTl6lpYnQjCyre9Oq+YSZ4VVks8LbtyubLcqXaMXzYKqaO 8s6t+Tu7NqZBF6/9o4X4LW+6BCxuBJLpbdZGYZEWa5Ppl2+tQ1wAGv2LIN/MHAuZyH3x N+Sw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cd2si4950218plb.39.2019.01.31.05.01.36; Thu, 31 Jan 2019 05:01:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733217AbfAaNBa (ORCPT + 99 others); Thu, 31 Jan 2019 08:01:30 -0500 Received: from 8bytes.org ([81.169.241.247]:36214 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732280AbfAaNB3 (ORCPT ); Thu, 31 Jan 2019 08:01:29 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id AEA6B5F0; Thu, 31 Jan 2019 14:01:27 +0100 (CET) Date: Thu, 31 Jan 2019 14:01:27 +0100 From: Joerg Roedel To: Christoph Hellwig Cc: "Michael S . Tsirkin" , Jason Wang , Konrad Rzeszutek Wilk , Jens Axboe , virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, jfehlig@suse.com, jon.grimm@amd.com, brijesh.singh@amd.com, jroedel@suse.de, Thomas.Lendacky@amd.com Subject: [PATCH] dma: Uninline dma_max_mapping_size() Message-ID: <20190131130127.GP32526@8bytes.org> References: <20190130164007.26497-1-joro@8bytes.org> <20190130164007.26497-4-joro@8bytes.org> <20190131104129.GA9241@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190131104129.GA9241@lst.de> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 31, 2019 at 11:41:29AM +0100, Christoph Hellwig wrote: > Sorry for not noticing last time, but since 5.0 we keep all non-fast > path DMA mapping interfaces out of line, so this should move to > kernel/dma/mapping.c. Okay, attached patch does that. It applies on-top of this patch-set. Michael, feel free to either apply this on-top of the patch-set or merge the diff into patch 3, whatever you prefer. From 2bb95d2136280c79de9553852ee3370f6d42d7b3 Mon Sep 17 00:00:00 2001 From: Joerg Roedel Date: Thu, 31 Jan 2019 13:55:27 +0100 Subject: [PATCH] dma: Uninline dma_max_mapping_size() The function is not performance sensitive and doesn't need to be inlined at every call-site. Move it out of the header into the appropriate C source file. Signed-off-by: Joerg Roedel --- include/linux/dma-mapping.h | 18 +++++------------- kernel/dma/direct.c | 1 - kernel/dma/mapping.c | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index a3ca8a71a704..5b21f14802e1 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -443,19 +443,6 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) return 0; } -static inline size_t dma_max_mapping_size(struct device *dev) -{ - const struct dma_map_ops *ops = get_dma_ops(dev); - size_t size = SIZE_MAX; - - if (dma_is_direct(ops)) - size = dma_direct_max_mapping_size(dev); - else if (ops && ops->max_mapping_size) - size = ops->max_mapping_size(dev); - - return size; -} - void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs); void dma_free_attrs(struct device *dev, size_t size, void *cpu_addr, @@ -476,6 +463,7 @@ int dma_supported(struct device *dev, u64 mask); int dma_set_mask(struct device *dev, u64 mask); int dma_set_coherent_mask(struct device *dev, u64 mask); u64 dma_get_required_mask(struct device *dev); +size_t dma_max_mapping_size(struct device *dev); #else /* CONFIG_HAS_DMA */ static inline dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page, size_t offset, size_t size, @@ -577,6 +565,10 @@ static inline u64 dma_get_required_mask(struct device *dev) { return 0; } +static inline size_t dma_max_mapping_size(struct device *dev) +{ + return 0; +} #endif /* CONFIG_HAS_DMA */ static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 81ca8170b928..6310ad01f915 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -391,4 +391,3 @@ size_t dma_direct_max_mapping_size(struct device *dev) return size; } -EXPORT_SYMBOL(dma_direct_max_mapping_size); diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c index a11006b6d8e8..5753008ab286 100644 --- a/kernel/dma/mapping.c +++ b/kernel/dma/mapping.c @@ -357,3 +357,17 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size, ops->cache_sync(dev, vaddr, size, dir); } EXPORT_SYMBOL(dma_cache_sync); + +size_t dma_max_mapping_size(struct device *dev) +{ + const struct dma_map_ops *ops = get_dma_ops(dev); + size_t size = SIZE_MAX; + + if (dma_is_direct(ops)) + size = dma_direct_max_mapping_size(dev); + else if (ops && ops->max_mapping_size) + size = ops->max_mapping_size(dev); + + return size; +} +EXPORT_SYMBOL_GPL(dma_max_mapping_size); -- 2.16.4