lkml.org 
[lkml]   [2021]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/6] MIPS: refactor the maybe coherent DMA indicators
On Mon, Feb 08, 2021 at 03:50:22PM +0100, Christoph Hellwig wrote:
> Replace the global coherentio enum, and the hw_coherentio (fake) boolean
> variables with a single boolean dma_default_coherent flag. Only the
> malta setup code needs two additional local boolean variables to
> preserved the command line overrides.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> arch/mips/alchemy/common/setup.c | 3 +--
> arch/mips/include/asm/dma-coherence.h | 24 ++++--------------------
> arch/mips/kernel/setup.c | 8 +++-----
> arch/mips/mm/c-r4k.c | 8 ++------
> arch/mips/mti-malta/malta-setup.c | 24 ++++++++++++++----------
> arch/mips/pci/pci-alchemy.c | 5 ++---
> 6 files changed, 26 insertions(+), 46 deletions(-)
>
> diff --git a/arch/mips/alchemy/common/setup.c b/arch/mips/alchemy/common/setup.c
> index c2da68e7984450..39e5b9cd882b10 100644
> --- a/arch/mips/alchemy/common/setup.c
> +++ b/arch/mips/alchemy/common/setup.c
> @@ -65,8 +65,7 @@ void __init plat_mem_setup(void)
> /* Clear to obtain best system bus performance */
> clear_c0_config(1 << 19); /* Clear Config[OD] */
>
> - coherentio = alchemy_dma_coherent() ?
> - IO_COHERENCE_ENABLED : IO_COHERENCE_DISABLED;
> + dma_default_coherent = alchemy_dma_coherent();
>
> board_setup(); /* board specific setup */
>
> diff --git a/arch/mips/include/asm/dma-coherence.h b/arch/mips/include/asm/dma-coherence.h
> index 5eaa1fcc878a88..846c5ade30d12d 100644
> --- a/arch/mips/include/asm/dma-coherence.h
> +++ b/arch/mips/include/asm/dma-coherence.h
> @@ -9,30 +9,14 @@
> #ifndef __ASM_DMA_COHERENCE_H
> #define __ASM_DMA_COHERENCE_H
>
> -enum coherent_io_user_state {
> - IO_COHERENCE_DEFAULT,
> - IO_COHERENCE_ENABLED,
> - IO_COHERENCE_DISABLED,
> -};
> -
> -#if defined(CONFIG_DMA_PERDEV_COHERENT)
> -/* Don't provide (hw_)coherentio to avoid misuse */
> -#elif defined(CONFIG_DMA_MAYBE_COHERENT)
> -extern enum coherent_io_user_state coherentio;
> -extern int hw_coherentio;
> -
> +#ifdef CONFIG_DMA_MAYBE_COHERENT
> +extern bool dma_default_coherent;
> static inline bool dev_is_dma_coherent(struct device *dev)
> {
> - return coherentio == IO_COHERENCE_ENABLED ||
> - (coherentio == IO_COHERENCE_DEFAULT && hw_coherentio);
> + return dma_default_coherent;

this breaks overriding of coherentio via command line. plat_mem_setup/
plat_setup_iocoherency is called before earlyparams are handled. So
changing coherentio after that doesn't have any effect.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]

\
 
 \ /
  Last update: 2021-02-09 14:15    [W:0.115 / U:0.672 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site