dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: jglisse@redhat.com
Cc: lkml@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Ben Skeggs <bskeggs@redhat.com>,
	Daniel Vetter <daniel.vetter@intel.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Dave Airlie <airlied@redhat.com>
Subject: Re: [PATCH 1/6] swiotlb: Add helper to know if it is in use for a specific device.
Date: Wed, 26 Aug 2015 15:02:31 -0400	[thread overview]
Message-ID: <20150826190231.GA6627@l.oracle.com> (raw)
In-Reply-To: <1440615127-25834-2-git-send-email-jglisse@redhat.com>

On Wed, Aug 26, 2015 at 02:52:02PM -0400, jglisse@redhat.com wrote:
> From: Jérôme Glisse <jglisse@redhat.com>
> 
> Some device like GPU do things differently if swiotlb is in use. We
> use to rely on swiotlb_nr_tbl() to know if swiotlb was enabled or not
> but this is unreliable. Patch add a simple helpers to check if any of

Why is it unreliable?

> the dma_ops associated with a device points to the swiotlb functions,
> making swiotlb check reliable for a device.
> 
> Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: lkml@vger.kernel.org
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  include/linux/dma-mapping.h | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index ac07ff0..eac911e 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -314,4 +314,22 @@ static inline int dma_mmap_writecombine(struct device *dev,
>  #define dma_unmap_len_set(PTR, LEN_NAME, VAL)    do { } while (0)
>  #endif
>  
> +
> +#ifdef CONFIG_SWIOTLB
> +static inline bool swiotlb_in_use(struct device *dev)
> +{
> +	struct dma_map_ops *ops = get_dma_ops(dev);
> +
> +	return (ops->map_sg == swiotlb_map_sg_attrs ||
> +		ops->unmap_sg == swiotlb_unmap_sg_attrs ||
> +		ops->map_page == swiotlb_map_page);

That won't work. What if we use xen-swiotlb which has different function
names?

> +}
> +#else
> +static inline bool swiotlb_in_use(struct device *dev)
> +{
> +	return false;
> +}
> +#endif
> +
> +
>  #endif
> -- 
> 2.1.0
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-08-26 19:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-26 18:52 [PATCH 0/6] Properly detect swiotlb jglisse
2015-08-26 18:52 ` [PATCH 1/6] swiotlb: Add helper to know if it is in use for a specific device jglisse
2015-08-26 19:02   ` Konrad Rzeszutek Wilk [this message]
2015-08-26 19:26     ` Jerome Glisse
2015-08-26 19:44       ` Konrad Rzeszutek Wilk
2015-08-26 20:31         ` Jerome Glisse
2015-08-26 20:38           ` Konrad Rzeszutek Wilk
2015-08-26 21:10             ` Jerome Glisse
2015-08-26 18:52 ` [PATCH 2/6] drm/radeon: Use swiotlb_in_use() to know if swiotlb is enabled or not jglisse
2015-08-26 18:52 ` [PATCH 3/6] drm/nouveau: " jglisse
2015-08-26 18:52 ` [PATCH 4/6] drm/vmwgfx: Use swiotlb_in_use() to know if swiotlb is enabled jglisse
2015-08-26 18:52 ` [PATCH 5/6] drm/i915: " jglisse
2015-08-26 18:52 ` [PATCH 6/6] drm/amdgpu: " jglisse
2015-08-31 16:04 ` [PATCH 0/6] Properly detect swiotlb Alex Deucher

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=20150826190231.GA6627@l.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=airlied@redhat.com \
    --cc=alexander.deucher@amd.com \
    --cc=bskeggs@redhat.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jglisse@redhat.com \
    --cc=lkml@vger.kernel.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