From: Joerg Roedel <joro@8bytes.org>
To: "Michael S . Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Christoph Hellwig <hch@lst.de>
Cc: 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, joro@8bytes.org,
jroedel@suse.de
Subject: [PATCH 2/5] swiotlb: Add is_swiotlb_active() function
Date: Wed, 23 Jan 2019 17:30:46 +0100 [thread overview]
Message-ID: <20190123163049.24863-3-joro@8bytes.org> (raw)
In-Reply-To: <20190123163049.24863-1-joro@8bytes.org>
From: Joerg Roedel <jroedel@suse.de>
This function will be used from dma_direct code to determine
the maximum segment size of a dma mapping.
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
include/linux/swiotlb.h | 6 ++++++
kernel/dma/swiotlb.c | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index ceb623321f38..5c087d330b4b 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -63,6 +63,7 @@ extern void swiotlb_tbl_sync_single(struct device *hwdev,
extern int
swiotlb_dma_supported(struct device *hwdev, u64 mask);
extern size_t swiotlb_max_mapping_size(struct device *dev);
+bool is_swiotlb_active(void);
#ifdef CONFIG_SWIOTLB
extern enum swiotlb_force swiotlb_force;
@@ -100,6 +101,11 @@ static inline size_t swiotlb_max_mapping_size(struct device *dev)
{
return SIZE_MAX;
}
+
+static inline bool is_swiotlb_active(void)
+{
+ return false;
+}
#endif /* CONFIG_SWIOTLB */
extern void swiotlb_print_info(void);
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 9cb21259cb0b..9fbd075081d9 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -667,3 +667,8 @@ size_t swiotlb_max_mapping_size(struct device *dev)
{
return ((size_t)1 << IO_TLB_SHIFT) * IO_TLB_SEGSIZE;
}
+
+bool is_swiotlb_active(void)
+{
+ return !no_iotlb_memory;
+}
--
2.17.1
next prev parent reply other threads:[~2019-01-23 16:30 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-23 16:30 [PATCH 0/5 v3] Fix virtio-blk issue with SWIOTLB Joerg Roedel
2019-01-23 16:30 ` [PATCH 1/5] swiotlb: Introduce swiotlb_max_mapping_size() Joerg Roedel
[not found] ` <20190123163049.24863-2-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2019-01-23 21:28 ` Christoph Hellwig
2019-01-24 8:24 ` Joerg Roedel
2019-01-24 8:47 ` Christoph Hellwig
2019-01-23 16:30 ` Joerg Roedel [this message]
2019-01-23 21:27 ` [PATCH 2/5] swiotlb: Add is_swiotlb_active() function Christoph Hellwig
2019-01-24 8:29 ` Joerg Roedel
[not found] ` <20190124082923.GI32526-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2019-01-24 8:41 ` Christoph Hellwig
2019-01-24 15:00 ` Joerg Roedel
2019-01-28 17:19 ` Michael S. Tsirkin
2019-01-23 16:30 ` [PATCH 3/5] dma: Introduce dma_max_mapping_size() Joerg Roedel
2019-01-23 21:29 ` Christoph Hellwig
2019-01-23 16:30 ` [PATCH 4/5] virtio: Introduce virtio_max_dma_size() Joerg Roedel
2019-01-23 16:30 ` [PATCH 5/5] virtio-blk: Consider virtio_max_dma_size() for maximum segment size Joerg Roedel
2019-01-23 21:31 ` Christoph Hellwig
2019-01-23 22:25 ` Michael S. Tsirkin
2019-01-24 8:40 ` Joerg Roedel
2019-01-24 8:42 ` Christoph Hellwig
[not found] ` <20190124084221.GB19441-jcswGhMUV9g@public.gmane.org>
2019-01-24 9:51 ` Joerg Roedel
2019-01-28 8:05 ` Christoph Hellwig
2019-01-28 17:14 ` Michael S. Tsirkin
2019-01-29 7:38 ` Christoph Hellwig
2019-01-23 17:09 ` [PATCH 0/5 v3] Fix virtio-blk issue with SWIOTLB Konrad Rzeszutek Wilk
2019-01-23 18:51 ` Michael S. Tsirkin
2019-01-23 21:14 ` Konrad Rzeszutek Wilk
2019-01-28 15:20 ` Michael S. Tsirkin
[not found] ` <20190128101852-mutt-send-email-mst-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2019-01-28 15:53 ` Konrad Rzeszutek Wilk
-- strict thread matches above, loose matches on Subject: below --
2019-01-29 8:43 [PATCH 0/5 v4] " Joerg Roedel
2019-01-29 8:43 ` [PATCH 2/5] swiotlb: Add is_swiotlb_active() function Joerg Roedel
2019-01-29 17:12 ` Christoph Hellwig
2019-01-30 16:40 [PATCH 0/5 v5] Fix virtio-blk issue with SWIOTLB Joerg Roedel
2019-01-30 16:40 ` [PATCH 2/5] swiotlb: Add is_swiotlb_active() function Joerg Roedel
2019-01-31 16:33 [PATCH 0/5 v6] Fix virtio-blk issue with SWIOTLB Joerg Roedel
2019-01-31 16:34 ` [PATCH 2/5] swiotlb: Add is_swiotlb_active() function Joerg Roedel
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=20190123163049.24863-3-joro@8bytes.org \
--to=joro@8bytes.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).