lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <a98521a5-474a-44de-a95b-9a334b8f7fa4@app.fastmail.com>
Date:   Sat, 20 May 2023 17:13:35 +0200
From:   "Arnd Bergmann" <arnd@...db.de>
To:     "Maciej W. Rozycki" <macro@...am.me.uk>
Cc:     "Jiaxun Yang" <jiaxun.yang@...goat.com>,
        linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
        "Thomas Bogendoerfer" <tsbogend@...ha.franken.de>,
        Linux-Arch <linux-arch@...r.kernel.org>,
        "Baoquan He" <bhe@...hat.com>,
        "Huacai Chen" <chenhuacai@...nel.org>
Subject: Re: [PATCH v4] mips: add <asm-generic/io.h> including

On Sat, May 20, 2023, at 16:45, Maciej W. Rozycki wrote:
> 	if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \
> 		*__mem = __val;						\
> 	else if (cpu_has_64bits) {					\
> 		unsigned long __flags;					\
> 		type __tmp;						\
> 									\
> 		if (irq)						\
> 			local_irq_save(__flags);			\
> 		__asm__ __volatile__(					\
> 			".set	push"		"\t\t# __writeq""\n\t"	\
> 			".set	arch=r4000"			"\n\t"	\
> 			"dsll32 %L0, %L0, 0"			"\n\t"	\
> 			"dsrl32 %L0, %L0, 0"			"\n\t"	\
> 			"dsll32 %M0, %M0, 0"			"\n\t"	\
> 			"or	%L0, %L0, %M0"			"\n\t"	\
> 			"sd	%L0, %2"			"\n\t"	\
> 			".set	pop"				"\n"	\
> 			: "=r" (__tmp)					\
> 			: "0" (__val), "m" (*__mem));			\
> 		if (irq)						\
> 			local_irq_restore(__flags);			\
> 	} else								\
> 		BUG();							\
>
> etc. so we don't actually lose atomicity, because we always use 64-bit 
> operations (SD above, store-doubleword) and we BUG if they are not there 
> (i.e. with 32-bit hardware; not a build-time check as in principle the 
> same 32-bit kernel image ought to run just fine both on 32-bit and 64-bit 
> hardware).  A few MIPS platforms do use them, e.g. SB1250, which requires 
> 64-bit unswapped accesses to SoC registers.

Ok, makes sense.

     Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ