LinuxPPC-Dev Archive on lore.kernel.org
 help / color / Atom feed
From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Balamuruhan S <bala24@linux.ibm.com>, mpe@ellerman.id.au
Cc: ravi.bangoria@linux.ibm.com, jniethe5@gmail.com,
	paulus@samba.org, sandipan@linux.ibm.com,
	naveen.n.rao@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2] powerpc xmon: use `dcbf` inplace of `dcbi` instruction for 64bit Book3S
Date: Fri, 27 Mar 2020 07:48:07 +0100
Message-ID: <caf285b1-172e-7116-b2ed-3645f36264ed@c-s.fr> (raw)
In-Reply-To: <20200326061522.33123-1-bala24@linux.ibm.com>



Le 26/03/2020 à 07:15, Balamuruhan S a écrit :
> Data Cache Block Invalidate (dcbi) instruction was implemented back in PowerPC
> architecture version 2.03. It is obsolete and attempt to use of this illegal
> instruction results in a hypervisor emulation assistance interrupt. So, ifdef
> it out the option `i` in xmon for 64bit Book3S.

I don't understand. You say two contradictory things:
1/ You say it _was_ added back.
2/ You say it _is_ obsolete.

How can it be obsolete if it was added back ?

[...]

> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index 0ec9640335bb..bfd5a97689cd 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -335,10 +335,12 @@ static inline void cflush(void *p)
>   	asm volatile ("dcbf 0,%0; icbi 0,%0" : : "r" (p));
>   }
>   
> +#ifndef CONFIG_PPC_BOOK3S_64

You don't need that #ifndef. Keeping it should be harmless.

>   static inline void cinval(void *p)
>   {
>   	asm volatile ("dcbi 0,%0; icbi 0,%0" : : "r" (p));
>   }
> +#endif
>   
>   /**
>    * write_ciabr() - write the CIABR SPR
> @@ -1791,8 +1793,9 @@ static void prregs(struct pt_regs *fp)
>   
>   static void cacheflush(void)
>   {
> -	int cmd;
>   	unsigned long nflush;
> +#ifndef CONFIG_PPC_BOOK3S_64

Don't make it so complex, see below

> +	int cmd;
>   
>   	cmd = inchar();
>   	if (cmd != 'i')
> @@ -1800,13 +1803,14 @@ static void cacheflush(void)
>   	scanhex((void *)&adrs);
>   	if (termch != '\n')
>   		termch = 0;
> +#endif
>   	nflush = 1;
>   	scanhex(&nflush);
>   	nflush = (nflush + L1_CACHE_BYTES - 1) / L1_CACHE_BYTES;
>   	if (setjmp(bus_error_jmp) == 0) {
>   		catch_memory_errors = 1;
>   		sync();
> -
> +#ifndef CONFIG_PPC_BOOK3S_64

You don't need that ifndef, just ensure below that regardless of cmd, 
book3s/64 calls cflush and not cinval.

>   		if (cmd != 'i') {

The only thing you have to do is to replace the above test by:

		if (cmd != 'i' || IS_ENABLED(CONFIG_PPC_BOOK3S_64)) {

>   			for (; nflush > 0; --nflush, adrs += L1_CACHE_BYTES)
>   				cflush((void *) adrs);
> @@ -1814,6 +1818,10 @@ static void cacheflush(void)
>   			for (; nflush > 0; --nflush, adrs += L1_CACHE_BYTES)
>   				cinval((void *) adrs);
>   		}
> +#else

Don't need that at all, it's a duplication of the above.

> +		for (; nflush > 0; --nflush, adrs += L1_CACHE_BYTES)
> +			cflush((void *)adrs);
> +#endif
>   		sync();
>   		/* wait a little while to see if we get a machine check */
>   		__delay(200);
> 
> base-commit: a87b93bdf800a4d7a42d95683624a4516e516b4f
> 

Christophe

  reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26  6:15 Balamuruhan S
2020-03-27  6:48 ` Christophe Leroy [this message]
2020-03-27  9:03   ` Balamuruhan S
2020-03-27 15:12     ` Christophe Leroy
2020-03-27 18:19       ` Segher Boessenkool
2020-03-27 19:40         ` Christophe Leroy
2020-03-28  8:03       ` Balamuruhan S

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=caf285b1-172e-7116-b2ed-3645f36264ed@c-s.fr \
    --to=christophe.leroy@c-s.fr \
    --cc=bala24@linux.ibm.com \
    --cc=jniethe5@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=paulus@samba.org \
    --cc=ravi.bangoria@linux.ibm.com \
    --cc=sandipan@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LinuxPPC-Dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linuxppc-dev/0 linuxppc-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linuxppc-dev linuxppc-dev/ https://lore.kernel.org/linuxppc-dev \
		linuxppc-dev@lists.ozlabs.org linuxppc-dev@ozlabs.org
	public-inbox-index linuxppc-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linuxppc-dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git