[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKv+Gu-hR=uieOeg7QheA5yfAycUoi2vjZsDUvROKVjW4eUNqw@mail.gmail.com>
Date: Mon, 21 Jan 2019 16:33:27 +0100
From: Ard Biesheuvel <ard.biesheuvel@...aro.org>
To: Christoph Hellwig <hch@...radead.org>
Cc: linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
dri-devel <dri-devel@...ts.freedesktop.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
amd-gfx@...ts.freedesktop.org,
Christian Koenig <christian.koenig@....com>,
Alex Deucher <alexander.deucher@....com>,
David Zhou <David1.Zhou@....com>,
Huang Rui <ray.huang@....com>,
Junwei Zhang <Jerry.Zhang@....com>,
Michel Daenzer <michel.daenzer@....com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <maxime.ripard@...tlin.com>,
Sean Paul <sean@...rly.run>,
Michael Ellerman <mpe@...erman.id.au>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Will Deacon <will.deacon@....com>
Subject: Re: [RFC PATCH] drm: disable WC optimization for cache coherent
devices on non-x86
On Mon, 21 Jan 2019 at 16:07, Christoph Hellwig <hch@...radead.org> wrote:
>
> > +#include <linux/dma-noncoherent.h>
>
> This header is not for usage in device drivers, but purely for
> dma-mapping implementations!
>
Is that documented anywhere?
> > +static inline bool drm_device_can_wc_memory(struct drm_device *ddev)
> > {
> > + if (IS_ENABLED(CONFIG_PPC))
> > + return IS_ENABLED(CONFIG_NOT_COHERENT_CACHE);
> > + else if (IS_ENABLED(CONFIG_MIPS))
> > + return !IS_ENABLED(CONFIG_CPU_LOONGSON3);
> > + else if (IS_ENABLED(CONFIG_X86))
> > + return true;
> > +
> > + return !dev_is_dma_coherent(ddev->dev);
>
> And even if something like this was valid to do, it would have to be
> a core function with an arch hook, and not hidden in a random driver.
Why would it not be valid to do? Is it wrong for a driver to be aware
of whether a device is cache coherent or not?
And in case it isn't, do you have an alternative suggestion on how to
fix this mess?
Powered by blists - more mailing lists