linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc xmon: drop the option `i` in cacheflush
@ 2020-03-23 11:25 Balamuruhan S
  2020-03-23 12:46 ` Segher Boessenkool
  0 siblings, 1 reply; 6+ messages in thread
From: Balamuruhan S @ 2020-03-23 11:25 UTC (permalink / raw)
  To: mpe
  Cc: ravi.bangoria, jniethe5, Balamuruhan S, paulus, sandipan,
	naveen.n.rao, linuxppc-dev

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 = bash
Linux 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

Signed-off-by: Balamuruhan S <bala24@linux.ibm.com>
---
 arch/powerpc/xmon/xmon.c | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 0ec9640335bb..d287bf2a54be 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -335,11 +335,6 @@ static inline void cflush(void *p)
 	asm volatile ("dcbf 0,%0; icbi 0,%0" : : "r" (p));
 }
 
-static inline void cinval(void *p)
-{
-	asm volatile ("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
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc xmon: drop the option `i` in cacheflush
  2020-03-23 11:25 [PATCH] powerpc xmon: drop the option `i` in cacheflush Balamuruhan S
@ 2020-03-23 12:46 ` Segher Boessenkool
  2020-03-23 13:22   ` Naveen N. Rao
  2020-03-24  6:08   ` Balamuruhan S
  0 siblings, 2 replies; 6+ messages in thread
From: Segher Boessenkool @ 2020-03-23 12:46 UTC (permalink / raw)
  To: Balamuruhan S
  Cc: ravi.bangoria, paulus, sandipan, jniethe5, naveen.n.rao, linuxppc-dev

On Mon, Mar 23, 2020 at 04:55:48PM +0530, Balamuruhan S wrote:
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc xmon: drop the option `i` in cacheflush
  2020-03-23 12:46 ` Segher Boessenkool
@ 2020-03-23 13:22   ` Naveen N. Rao
  2020-03-24  3:52     ` Michael Ellerman
  2020-03-24  6:08   ` Balamuruhan S
  1 sibling, 1 reply; 6+ messages in thread
From: Naveen N. Rao @ 2020-03-23 13:22 UTC (permalink / raw)
  To: Balamuruhan S, Segher Boessenkool
  Cc: ravi.bangoria, jniethe5, paulus, sandipan, linuxppc-dev

Segher Boessenkool wrote:
> On Mon, Mar 23, 2020 at 04:55:48PM +0530, Balamuruhan S wrote:
>> 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc xmon: drop the option `i` in cacheflush
  2020-03-23 13:22   ` Naveen N. Rao
@ 2020-03-24  3:52     ` Michael Ellerman
  2020-03-24  6:15       ` Balamuruhan S
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Ellerman @ 2020-03-24  3:52 UTC (permalink / raw)
  To: Naveen N. Rao, Balamuruhan S, Segher Boessenkool
  Cc: jniethe5, linuxppc-dev, sandipan, paulus, ravi.bangoria

"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> writes:
> Segher Boessenkool wrote:
>> On Mon, Mar 23, 2020 at 04:55:48PM +0530, Balamuruhan S wrote:
>>> 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 ...

>> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc xmon: drop the option `i` in cacheflush
  2020-03-23 12:46 ` Segher Boessenkool
  2020-03-23 13:22   ` Naveen N. Rao
@ 2020-03-24  6:08   ` Balamuruhan S
  1 sibling, 0 replies; 6+ messages in thread
From: Balamuruhan S @ 2020-03-24  6:08 UTC (permalink / raw)
  To: Segher Boessenkool
  Cc: ravi.bangoria, paulus, sandipan, jniethe5, naveen.n.rao, linuxppc-dev

On Mon, 2020-03-23 at 07:46 -0500, Segher Boessenkool wrote:
> On Mon, Mar 23, 2020 at 04:55:48PM +0530, Balamuruhan S wrote:
> > 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 
> 
> 
> Segher


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc xmon: drop the option `i` in cacheflush
  2020-03-24  3:52     ` Michael Ellerman
@ 2020-03-24  6:15       ` Balamuruhan S
  0 siblings, 0 replies; 6+ messages in thread
From: Balamuruhan S @ 2020-03-24  6:15 UTC (permalink / raw)
  To: Michael Ellerman, Naveen N. Rao, Segher Boessenkool
  Cc: jniethe5, linuxppc-dev, sandipan, paulus, ravi.bangoria

On Tue, 2020-03-24 at 14:52 +1100, Michael Ellerman wrote:
> "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> writes:
> > Segher Boessenkool wrote:
> > > On Mon, Mar 23, 2020 at 04:55:48PM +0530, Balamuruhan S wrote:
> > > > 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.

> 
> > > 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.

Sure, I will make the changes as suggested.

Thank you!

-- Bala
> 
> cheers


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-24  6:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23 11:25 [PATCH] powerpc xmon: drop the option `i` in cacheflush Balamuruhan S
2020-03-23 12:46 ` Segher Boessenkool
2020-03-23 13:22   ` Naveen N. Rao
2020-03-24  3:52     ` Michael Ellerman
2020-03-24  6:15       ` Balamuruhan S
2020-03-24  6:08   ` Balamuruhan S

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).