Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp472980pxb; Tue, 9 Feb 2021 05:16:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwB8GVcBfOs2qKGtSOGXV6yYvr9qb0m66IOOzUgegqHd5Ld0fCIcVyMHe3cl7HD/g7QacFp X-Received: by 2002:a05:6402:2285:: with SMTP id cw5mr14727190edb.275.1612876578293; Tue, 09 Feb 2021 05:16:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612876578; cv=none; d=google.com; s=arc-20160816; b=N7Q8c3S5jm4q9dAZNWzUo6YpEn/lMdk44e2Ox5PRPdx33aknNOYfs4OjKy2axpaPF5 lrFdp8nbhZTRyRhQEnNB+yrgI0xn4s5ysB95PmJaTW5e9NEwyMx7d7+kU/ApE9vrWPSo yIFWmABTjNfOXxVnAIQg0Z1fAGlBn5Y+GJEvaX0TG/IUghBit2cRINXJtL6lqs05VoA0 7Xo7d3B06dEJnA4iE8pzbznhkAyQ37W1+7jtXgHPRAGql5fUVs/lQ3v9j22irpcR85tH 6hQQuD6RFScoWRMInS2lT/JyGubAwuiV+TI7A+A2JmY0A0X5Z0LuoV72b0Xo2nAt15se N85g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=wqyMI/F5du7jioADzOP1IyngBInxr+DH3mDGwiyh/28=; b=MFAREz8PPcDIpmS5cf2JYuEHeNbb8n7wiPhWOX+HrYjNOKWNF7FPLsk/N/DsZxIflo gV1MHzpsOYJ/li7fmFDuHNKKrxI7Ifq5yU24/ITnwySyMMESib3nEtdosC9pMfWkz/U0 t9pdADt70L20y2Q93pg0iKpxHioULh8DbJYUvyf1EvWUXn2YAWxHJ/LeFa6dvUmfG4+k t3L6wxMJnCeeSMMNYJdIlZyTkv3JPmqbtJv24QcY4SgvwJuC0A4blAPPDKD2DSqv2fO9 frwEHmnVD1v6PdPyp8f7k6sz/1Cq67oK9WImR0BcaYBgbGeai8Kqi3693OR+7t7TbHbi eduQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b4si12010542edn.586.2021.02.09.05.15.51; Tue, 09 Feb 2021 05:16:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231126AbhBINNt (ORCPT + 99 others); Tue, 9 Feb 2021 08:13:49 -0500 Received: from elvis.franken.de ([193.175.24.41]:36608 "EHLO elvis.franken.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230228AbhBINNb (ORCPT ); Tue, 9 Feb 2021 08:13:31 -0500 Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1l9Soz-0003io-01; Tue, 09 Feb 2021 14:12:49 +0100 Received: by alpha.franken.de (Postfix, from userid 1000) id 98BE5C0DC4; Tue, 9 Feb 2021 14:12:37 +0100 (CET) Date: Tue, 9 Feb 2021 14:12:37 +0100 From: Thomas Bogendoerfer To: Christoph Hellwig Cc: Greg Kroah-Hartman , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org Subject: Re: [PATCH 4/6] MIPS: refactor the maybe coherent DMA indicators Message-ID: <20210209131237.GB11915@alpha.franken.de> References: <20210208145024.3320420-1-hch@lst.de> <20210208145024.3320420-5-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210208145024.3320420-5-hch@lst.de> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 ]