mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Koenig, Christian" <Christian.Koenig@amd.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"Zhou, David(ChunMing)" <David1.Zhou@amd.com>,
	"Huang, Ray" <Ray.Huang@amd.com>,
	"Zhang, Jerry" <Jerry.Zhang@amd.com>,
	"Daenzer, Michel" <Michel.Daenzer@amd.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Sean Paul <sean@poorly.run>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Will Deacon <will.deacon@arm.com>,
	Christoph Hellwig <hch@infradead.org>,
	Robin Murphy <robin.murphy@arm.com>,
	amd-gfx list <amd-gfx@lists.freedesktop.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Carsten Haitzler <Carsten.Haitzler@arm.com>
Subject: Re: [PATCH] drm: enable uncached DMA optimization for ARM and arm64
Date: Thu, 24 Jan 2019 12:31:33 +0000	[thread overview]
Message-ID: <3cca35a9-c71c-a100-b29d-31ba0d1d10b1@amd.com> (raw)
In-Reply-To: <20190124120658.30288-1-ard.biesheuvel@linaro.org>

Am 24.01.19 um 13:06 schrieb Ard Biesheuvel:
> The DRM driver stack is designed to work with cache coherent devices
> only, but permits an optimization to be enabled in some cases, where
> for some buffers, both the CPU and the GPU use uncached mappings,
> removing the need for DMA snooping and allocation in the CPU caches.
>
> The use of uncached GPU mappings relies on the correct implementation
> of the PCIe NoSnoop TLP attribute by the platform, otherwise the GPU
> will use cached mappings nonetheless. On x86 platforms, this does not
> seem to matter, as uncached CPU mappings will snoop the caches in any
> case. However, on ARM and arm64, enabling this optimization on a
> platform where NoSnoop is ignored results in loss of coherency, which
> breaks correct operation of the device. Since we have no way of
> detecting whether NoSnoop works or not, just disable this
> optimization entirely for ARM and arm64.
>
> Cc: Christian Koenig <christian.koenig@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: David Zhou <David1.Zhou@amd.com>
> Cc: Huang Rui <ray.huang@amd.com>
> Cc: Junwei Zhang <Jerry.Zhang@amd.com>
> Cc: Michel Daenzer <michel.daenzer@amd.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Christoph Hellwig <hch@infradead.org>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Cc: amd-gfx list <amd-gfx@lists.freedesktop.org>
> Cc: dri-devel <dri-devel@lists.freedesktop.org>
> Reported-by: Carsten Haitzler <Carsten.Haitzler@arm.com>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

The subject line should probably read "disable uncached...".

With that fixed the patch is Reviewed-by: Christian König 
<christian.koenig@amd.com>.

Regards,
Christian.

> ---
>   include/drm/drm_cache.h | 18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)
>
> diff --git a/include/drm/drm_cache.h b/include/drm/drm_cache.h
> index bfe1639df02d..97fc498dc767 100644
> --- a/include/drm/drm_cache.h
> +++ b/include/drm/drm_cache.h
> @@ -47,6 +47,24 @@ static inline bool drm_arch_can_wc_memory(void)
>   	return false;
>   #elif defined(CONFIG_MIPS) && defined(CONFIG_CPU_LOONGSON3)
>   	return false;
> +#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64)
> +	/*
> +	 * The DRM driver stack is designed to work with cache coherent devices
> +	 * only, but permits an optimization to be enabled in some cases, where
> +	 * for some buffers, both the CPU and the GPU use uncached mappings,
> +	 * removing the need for DMA snooping and allocation in the CPU caches.
> +	 *
> +	 * The use of uncached GPU mappings relies on the correct implementation
> +	 * of the PCIe NoSnoop TLP attribute by the platform, otherwise the GPU
> +	 * will use cached mappings nonetheless. On x86 platforms, this does not
> +	 * seem to matter, as uncached CPU mappings will snoop the caches in any
> +	 * case. However, on ARM and arm64, enabling this optimization on a
> +	 * platform where NoSnoop is ignored results in loss of coherency, which
> +	 * breaks correct operation of the device. Since we have no way of
> +	 * detecting whether NoSnoop works or not, just disable this
> +	 * optimization entirely for ARM and arm64.
> +	 */
> +	return false;
>   #else
>   	return true;
>   #endif


  reply	other threads:[~2019-01-24 12:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 12:06 Ard Biesheuvel
2019-01-24 12:31 ` Koenig, Christian [this message]
2019-01-24 12:32   ` Ard Biesheuvel
2019-01-24 14:01     ` Alex Deucher
2019-01-25  8:43       ` Ard Biesheuvel
2019-01-25 11:30         ` Christian König
2019-01-25 11:35           ` Ard Biesheuvel
2019-02-06 17:23             ` Ard Biesheuvel
2019-02-06 18:38               ` Christian König
2019-02-07 15:20                 ` Ard Biesheuvel
2019-02-07 15:33                   ` Alex Deucher
2019-02-07 16:01                     ` Ard Biesheuvel

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=3cca35a9-c71c-a100-b29d-31ba0d1d10b1@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Carsten.Haitzler@arm.com \
    --cc=David1.Zhou@amd.com \
    --cc=Jerry.Zhang@amd.com \
    --cc=Michel.Daenzer@amd.com \
    --cc=Ray.Huang@amd.com \
    --cc=airlied@linux.ie \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=ard.biesheuvel@linaro.org \
    --cc=benh@kernel.crashing.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hch@infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=mpe@ellerman.id.au \
    --cc=robin.murphy@arm.com \
    --cc=sean@poorly.run \
    --cc=will.deacon@arm.com \
    /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

all inboxes | Powered by JetHome®