All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Balbir Singh <bsingharora@gmail.com>,
	benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/mm: Move hpte encode routine to platform specific files
Date: Fri, 11 Nov 2016 07:04:58 +0530	[thread overview]
Message-ID: <878tsq23zx.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <8f4553b4-a943-bebd-3344-f4d833d32abe@gmail.com>

Balbir Singh <bsingharora@gmail.com> writes:

> On 11/11/16 10:54, Balbir Singh wrote:
>> 
>> 
>> On 10/11/16 20:24, Aneesh Kumar K.V wrote:
>>> They differ between powernv and pseries. While we are at it copy
>>> a version for ps3 too. For now this is same as what we have for pSeries.
>>>
>>> Fixes: 50de596de8be6 ("powerpc/mm/hash: Add support for Power9 Hash")
>>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>> 
>> 
>> I have not looked at the patch closely, but do we want all of this
>> duplication. I was wondering if instead of
>> 
>> cpu_has_feature() we could firmware_has_feature() for now
>> 
>
> Basically something like
>
> Not-yet-signed-off-by: Balbir Singh <bsingharora@gmail.com>
>
>
> diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
> index ac6d26e..2b23366 100644
> --- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h
> +++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
> @@ -282,7 +282,8 @@ static inline unsigned long hpte_encode_avpn(unsigned long vpn, int psize,
>  	 */
>  	v = (vpn >> (23 - VPN_SHIFT)) & ~(mmu_psize_defs[psize].avpnm);
>  	v <<= HPTE_V_AVPN_SHIFT;
> -	if (!cpu_has_feature(CPU_FTR_ARCH_300))
> +	if (!cpu_has_feature(CPU_FTR_ARCH_300) ||
> +		firmware_has_feature(FW_FEATURE_LPAR))
>  		v |= ((unsigned long) ssize) << HPTE_V_SSIZE_SHIFT;

I looked at this before and in the end decided to go otherwise. A large
part of that patch is comment duplication. My thinking was if the
encoding needs to be different, then it is better to have seperate
functions to do the encoding.

>  	return v;
>  }
> @@ -310,7 +311,8 @@ static inline unsigned long hpte_encode_r(unsigned long pa, int base_psize,
>  					  int actual_psize, int ssize)
>  {
>
> -	if (cpu_has_feature(CPU_FTR_ARCH_300))
> +	if (cpu_has_feature(CPU_FTR_ARCH_300) &&
> +		!firmware_has_feature(FW_FEATURE_LPAR))
>  		pa |= ((unsigned long) ssize) << HPTE_R_3_0_SSIZE_SHIFT;
>
>  	/* A 4K page needs no special encoding */

-aneesh

  reply	other threads:[~2016-11-11  1:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-10  9:24 [PATCH] powerpc/mm: Move hpte encode routine to platform specific files Aneesh Kumar K.V
2016-11-10 23:54 ` Balbir Singh
2016-11-11  1:11   ` Balbir Singh
2016-11-11  1:34     ` Aneesh Kumar K.V [this message]
2016-11-11  1:07 ` Paul Mackerras

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=878tsq23zx.fsf@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=bsingharora@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.