All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Christoph Hellwig <hch@lst.de>
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Jens Axboe <axboe@kernel.dk>,
	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()
Date: Thu, 31 Jan 2019 14:01:27 +0100	[thread overview]
Message-ID: <20190131130127.GP32526@8bytes.org> (raw)
In-Reply-To: <20190131104129.GA9241@lst.de>

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 <jroedel@suse.de>
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 <jroedel@suse.de>
---
 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


WARNING: multiple messages have this Message-ID (diff)
From: Joerg Roedel <joro@8bytes.org>
To: Christoph Hellwig <hch@lst.de>
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Jens Axboe <axboe@kernel.dk>,
	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()
Date: Thu, 31 Jan 2019 14:01:27 +0100	[thread overview]
Message-ID: <20190131130127.GP32526@8bytes.org> (raw)
In-Reply-To: <20190131104129.GA9241@lst.de>

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 <jroedel@suse.de>
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 <jroedel@suse.de>
---
 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

  parent reply	other threads:[~2019-01-31 13:01 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30 16:40 [PATCH 0/5 v5] Fix virtio-blk issue with SWIOTLB Joerg Roedel
2019-01-30 16:40 ` [PATCH 1/5] swiotlb: Introduce swiotlb_max_mapping_size() Joerg Roedel
2019-01-30 16:40 ` Joerg Roedel
2019-01-30 16:40 ` [PATCH 2/5] swiotlb: Add is_swiotlb_active() function Joerg Roedel
2019-01-30 16:40 ` Joerg Roedel
2019-01-30 16:40 ` [PATCH 3/5] dma: Introduce dma_max_mapping_size() Joerg Roedel
2019-01-30 16:40 ` Joerg Roedel
2019-01-31 10:41   ` Christoph Hellwig
2019-01-31 10:41   ` Christoph Hellwig
2019-01-31 13:01     ` [PATCH] dma: Uninline dma_max_mapping_size() Joerg Roedel
2019-01-31 13:01     ` Joerg Roedel [this message]
2019-01-31 13:01       ` Joerg Roedel
2019-01-31 14:37       ` Christoph Hellwig
2019-01-31 14:37       ` Christoph Hellwig
2019-01-31 14:43         ` Michael S. Tsirkin
2019-01-31 16:34           ` Joerg Roedel
2019-01-31 16:34           ` Joerg Roedel
2019-01-31 14:43         ` Michael S. Tsirkin
2019-01-30 16:40 ` [PATCH 4/5] virtio: Introduce virtio_max_dma_size() Joerg Roedel
2019-01-30 16:40 ` Joerg Roedel
2019-01-30 16:40 ` [PATCH 5/5] virtio-blk: Consider virtio_max_dma_size() for maximum segment size Joerg Roedel
2019-01-30 16:40 ` Joerg Roedel
2019-01-30 18:11 ` [PATCH 0/5 v5] Fix virtio-blk issue with SWIOTLB Lendacky, Thomas
2019-01-30 18:11 ` Lendacky, Thomas
2019-01-30 18:35 ` Konrad Rzeszutek Wilk
2019-01-30 18:35 ` Konrad Rzeszutek Wilk
2019-01-30 21:59   ` Michael S. Tsirkin
2019-01-30 21:59     ` Michael S. Tsirkin
2019-01-30 21:59   ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190131130127.GP32526@8bytes.org \
    --to=joro@8bytes.org \
    --cc=Thomas.Lendacky@amd.com \
    --cc=axboe@kernel.dk \
    --cc=brijesh.singh@amd.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jasowang@redhat.com \
    --cc=jfehlig@suse.com \
    --cc=jon.grimm@amd.com \
    --cc=jroedel@suse.de \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.