From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6DD13E6398 for ; Tue, 14 Apr 2026 12:18:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776169118; cv=none; b=Hm1w5W81bk9BSrecvkPUehl37bBhBV/WjaIahyk3GR37t1+7PCv3hK6m5bc3HXtPtC65oC+qF1J/EIOEY/5fVmWvqJXJVzXeL86qT/ncTXMYNlh62URRKd3SGQ+dHTRa7HNY1AGv7sOwsL6sr21uVuLcCJVa2cIG8Ymv0+lPKkU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776169118; c=relaxed/simple; bh=MnGHHrPULjusC2Ko0o2DekT2/j7+qqDlEoSuWmAISm8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=AGSx+5mY4y4TSdfqPRF5nCayuZm++DcI2lIUROrIhf51E5LzbxngNySCo4caXGZLJhGBBGstF1LfW13ZR09mWMlxwjopru6H3nPdTkK8FYdSM+CWX7kqSliL0QEUC26HE4jQ60yrEow17ybCE+bd8IGcxDleLA/lrxaaOC6K7wY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B65BC19425; Tue, 14 Apr 2026 12:18:37 +0000 (UTC) Message-ID: Date: Tue, 14 Apr 2026 22:18:32 +1000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH] m68k: nommu: Fix behaviour of io macros on non-CF To: Daniel Palmer Cc: geert@linux-m68k.org, christoph.plattner@gmx.at, linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, arnd@kernel.org References: <20260404024658.2496519-1-daniel@0x0f.com> Content-Language: en-US From: Greg Ungerer In-Reply-To: <20260404024658.2496519-1-daniel@0x0f.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Daniel, On 4/4/26 12:46, Daniel Palmer wrote: > Currently for 68000 readl() and friends are broken in that they > return the value from the bus as-is but should be reading a little > endian value and swapping it to big endian. > > This was found using virtio-mmio on a 68000 virt machine. virtio-mmio > is little endian even if the emulated machine is big endian. This works > for MMU m68k because the io macros do what is expected there, but if > the kernel was built for nommu it breaks. > > Potentially this will break some stuff for nommu non-CF m68k users > but since there are probably 2 or 3 of us in the world I think we > can work it out. > > Suggested-by: Arnd Bergmann > Link: https://lore.kernel.org/lkml/ada73dc9-edf5-458c-8849-9f9db23ff304@app.fastmail.com/ > Signed-off-by: Daniel Palmer > --- > arch/m68k/include/asm/io_no.h | 9 --------- > 1 file changed, 9 deletions(-) > > diff --git a/arch/m68k/include/asm/io_no.h b/arch/m68k/include/asm/io_no.h > index 516371d5587a..c39db8798ef2 100644 > --- a/arch/m68k/include/asm/io_no.h > +++ b/arch/m68k/include/asm/io_no.h > @@ -96,15 +96,6 @@ static inline void writel(u32 value, volatile void __iomem *addr) > __raw_writel(swab32(value), addr); > } > > -#else > - > -#define readb __raw_readb > -#define readw __raw_readw > -#define readl __raw_readl > -#define writeb __raw_writeb > -#define writew __raw_writew > -#define writel __raw_writel > - > #endif /* IOMEMBASE */ > > #if defined(CONFIG_PCI) This change, in this form at least, breaks most of the non-MMU ColdFire targets. Try compiling any of m5208evb, m5249evb, m5272c3, m5275evb, m5307c3 or m5407c3 defconfigs and you get build failures. Targets that do not have a PCI bus and so do not define IOMEMBASE will fail, which is most of them. Maybe something like this might be better. I think this ends up giving you the same result for 68000 nommu targets. diff --git a/arch/m68k/include/asm/io_no.h b/arch/m68k/include/asm/io_no.h index 516371d5587a..b335fd4a18e9 100644 --- a/arch/m68k/include/asm/io_no.h +++ b/arch/m68k/include/asm/io_no.h @@ -33,7 +33,6 @@ #include #include #include -#endif /* CONFIG_COLDFIRE */ #if defined(IOMEMBASE) /* @@ -126,6 +125,7 @@ static inline void writel(u32 value, volatile void __iomem *addr) #define PCI_IOBASE ((void __iomem *) PCI_IO_PA) #define PCI_SPACE_LIMIT PCI_IO_MASK #endif /* CONFIG_PCI */ +#endif /* CONFIG_COLDFIRE */ #include #include Regards Greg