powerpc xmon: drop the option `i` in cacheflush
PATCH 1/1 powerpc xmon: drop the option `i` in cacheflush
Data Cache Block Invalidate (dcbi) instruction implemented in 32-bit designs prior to PowerPC architecture version 2.01 and got obsolete from version 2.01. Attempt to use of this illegal instruction results in a hypervisor emulation assistance interrupt. So, drop the option i in cacheflush xmon and continue using dcbf.
0:mon> fi
cpu 0x0: Vector: 700 (Program Check) at [c000000003be74a0]
pc: c000000000102030: cacheflush+0x180/0x1a0
lr: c000000000101f3c: cacheflush+0x8c/0x1a0
sp: c000000003be7730
msr: 8000000000081033
current = 0xc0000000035e5c00
paca = 0xc000000001910000 irqmask: 0x03 irq_happened: 0x01
pid = 1025, comm = bashLinux version 5.6.0-rc5-g5aa19adac (root@ltc-wspoon6) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #1 SMP Tue Mar 10 04:38:41 CDT 2020 cpu 0x0: Exception 700 (Program Check) in xmon, returning to main loop [c000000003be7c50] c00000000084abb0 __handle_sysrq+0xf0/0x2a0 [c000000003be7d00] c00000000084b3c0 write_sysrq_trigger+0xb0/0xe0 [c000000003be7d30] c0000000004d1edc proc_reg_write+0x8c/0x130 [c000000003be7d60] c00000000040dc7c __vfs_write+0x3c/0x70 [c000000003be7d80] c000000000410e70 vfs_write+0xd0/0x210 [c000000003be7dd0] c00000000041126c ksys_write+0xdc/0x130 [c000000003be7e20] c00000000000b9d0 system_call+0x5c/0x68 --- Exception: c01 (System Call) at 00007fffa345e420
SP (7ffff0b08ab0) is in userspace
--- arch/powerpc/xmon/xmon.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-)
arch/powerpc/xmon/xmon.c +2 -20
@@ -335,11 +335,6 @@ static inline void cflush(void *p) asmvolatile ("dcbf 0,%0; icbi 0,%0" : :"r" (p)); } -static inline void cinval (void *p) -{ - asmvolatile ("dcbi 0,%0; icbi 0,%0" : :"r" (p)); -} -/** * write_ciabr() - write the CIABR SPR * @ciabr: The value to write.
@@ -1791,29 +1786,16 @@ static void prregs(struct pt_regs *fp)static void cacheflush (void ) { -int cmd;unsigned long nflush; - cmd =inchar (); -if (cmd !='i' ) - termch = cmd; -scanhex ((void *)&adrs); -if (termch !='\n' ) - termch =0 ; nflush =1 ;scanhex (&nflush); nflush = (nflush +L1_CACHE_BYTES -1 ) /L1_CACHE_BYTES ;if (setjmp (bus_error_jmp) ==0 ) { catch_memory_errors =1 ;sync (); - -if (cmd !='i' ) { -for (; nflush >0 ; --nflush, adrs +=L1_CACHE_BYTES ) -cflush ((void *) adrs); - }else { -for (; nflush >0 ; --nflush, adrs +=L1_CACHE_BYTES ) -cinval ((void *) adrs); - } +for (; nflush >0 ; --nflush, adrs +=L1_CACHE_BYTES ) +cflush ((void *)adrs);sync ();/* wait a little while to see if we get a machine check */ __delay (200 );
base-commit: a87b93bdf800a4d7a42d95683624a4516e516b4f
Signature · 1 line
2.24.1
Quoted 3 lines · Balamuruhan S
Data Cache Block Invalidate (dcbi) instruction implemented in 32-bit designs prior to PowerPC architecture version 2.01 and got obsolete from version 2.01.
It was added back in 2.03. It also exists in 64-bit designs (using category embedded), in 2.07 still even.
Segher
Quoted 7 lines · Segher Boessenkool
Quoted 3 lines · Balamuruhan S
Data Cache Block Invalidate (dcbi) instruction implemented in 32-bit designs prior to PowerPC architecture version 2.01 and got obsolete from version 2.01.
It was added back in 2.03. It also exists in 64-bit designs (using category embedded), in 2.07 still even.
Indeed, it has been part of Book3e.
It isn't clear if this is still useful in this context (xmon) though, since 'dcbf' seems to be equivalent in most respects. At the very least, we should restrict this to Book3e, if it is of value there.
- Naveen
Michael Ellerman
reviewerQuoted 5 lines · Naveen N. Rao
Quoted 4 lines · Segher Boessenkool
Quoted 3 lines · Balamuruhan S
Data Cache Block Invalidate (dcbi) instruction implemented in 32-bit designs prior to PowerPC architecture version 2.01 and got obsolete from version 2.01.
We still support 32-bit ...
Quoted 8 lines
Quoted 2 lines
It was added back in 2.03. It also exists in 64-bit designs (using category embedded), in 2.07 still even.
Indeed, it has been part of Book3e.
It isn't clear if this is still useful in this context (xmon) though, since 'dcbf' seems to be equivalent in most respects. At the very least, we should restrict this to Book3e, if it is of value there.
Looking at the ISA it looks like dcbf is more or less equivalent and we could probably drop the explicit invalidate command.
But the simplest option is probably to just ifdef it out for PPC_BOOK3S_64.
cheers
Quoted 7 lines · Segher Boessenkool
Quoted 3 lines · Balamuruhan S
Data Cache Block Invalidate (dcbi) instruction implemented in 32-bit designs prior to PowerPC architecture version 2.01 and got obsolete from version 2.01.
It was added back in 2.03. It also exists in 64-bit designs (using category embedded), in 2.07 still even.
I got to know about the version from,
https://wiki.alcf.anl.gov/images/f/fb/PowerPC_-_Assembly_-_IBM_Programming_Environment_2.3.pdf
please correct me if I was looking into wrong one.
-- Bala
Quoted 3 lines
Segher
Quoted 8 lines · Michael Ellerman
Quoted 5 lines · Naveen N. Rao
Quoted 4 lines · Segher Boessenkool
Quoted 3 lines · Balamuruhan S
Data Cache Block Invalidate (dcbi) instruction implemented in 32-bit designs prior to PowerPC architecture version 2.01 and got obsolete from version 2.01.
We still support 32-bit ...
Okay, got it.
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines
It was added back in 2.03. It also exists in 64-bit designs (using category embedded), in 2.07 still even.
Indeed, it has been part of Book3e.
It isn't clear if this is still useful in this context (xmon) though, since 'dcbf' seems to be equivalent in most respects. At the very least, we should restrict this to Book3e, if it is of value there.
Quoted 5 lines
Looking at the ISA it looks like dcbf is more or less equivalent and we could probably drop the explicit invalidate command.
But the simplest option is probably to just ifdef it out for
PPC_BOOK3S_64.
Sure, I will make the changes as suggested.
Thank you!
-- Bala
Quoted 2 lines
cheers