linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64/cpuinfo: Show right CPU architecture information
@ 2021-01-19 10:55 Liguang Zhang
  2021-01-19 11:01 ` Will Deacon
  0 siblings, 1 reply; 4+ messages in thread
From: Liguang Zhang @ 2021-01-19 10:55 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon
  Cc: Anshuman Khandual, Suzuki K Poulose, Mark Brown, gustavoars,
	Vincenzo Frascino, Dave Martin, linux-arm-kernel, linux-kernel,
	Liguang Zhang

CPU architecture is assigned to be a fixed value, it should be obtained
from midr register.

Signed-off-by: Liguang Zhang <zhangliguang@linux.alibaba.com>
---
 arch/arm64/kernel/cpuinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index 77605aec25fe..0bd11e0fe9f2 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -191,7 +191,7 @@ static int c_show(struct seq_file *m, void *v)
 
 		seq_printf(m, "CPU implementer\t: 0x%02x\n",
 			   MIDR_IMPLEMENTOR(midr));
-		seq_printf(m, "CPU architecture: 8\n");
+		seq_printf(m, "CPU architecture: %d\n", MIDR_ARCHITECTURE(midr));
 		seq_printf(m, "CPU variant\t: 0x%x\n", MIDR_VARIANT(midr));
 		seq_printf(m, "CPU part\t: 0x%03x\n", MIDR_PARTNUM(midr));
 		seq_printf(m, "CPU revision\t: %d\n\n", MIDR_REVISION(midr));
-- 
2.19.1.6.gb485710b


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

* Re: [PATCH] arm64/cpuinfo: Show right CPU architecture information
  2021-01-19 10:55 [PATCH] arm64/cpuinfo: Show right CPU architecture information Liguang Zhang
@ 2021-01-19 11:01 ` Will Deacon
  2021-01-19 11:26   ` 乱石
  0 siblings, 1 reply; 4+ messages in thread
From: Will Deacon @ 2021-01-19 11:01 UTC (permalink / raw)
  To: Liguang Zhang
  Cc: Catalin Marinas, Anshuman Khandual, Suzuki K Poulose, Mark Brown,
	gustavoars, Vincenzo Frascino, Dave Martin, linux-arm-kernel,
	linux-kernel

On Tue, Jan 19, 2021 at 06:55:10PM +0800, Liguang Zhang wrote:
> CPU architecture is assigned to be a fixed value, it should be obtained
> from midr register.
> 
> Signed-off-by: Liguang Zhang <zhangliguang@linux.alibaba.com>
> ---
>  arch/arm64/kernel/cpuinfo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
> index 77605aec25fe..0bd11e0fe9f2 100644
> --- a/arch/arm64/kernel/cpuinfo.c
> +++ b/arch/arm64/kernel/cpuinfo.c
> @@ -191,7 +191,7 @@ static int c_show(struct seq_file *m, void *v)
>  
>  		seq_printf(m, "CPU implementer\t: 0x%02x\n",
>  			   MIDR_IMPLEMENTOR(midr));
> -		seq_printf(m, "CPU architecture: 8\n");
> +		seq_printf(m, "CPU architecture: %d\n", MIDR_ARCHITECTURE(midr));

Huh? Won't this always return 0xf?

Will

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

* Re: [PATCH] arm64/cpuinfo: Show right CPU architecture information
  2021-01-19 11:01 ` Will Deacon
@ 2021-01-19 11:26   ` 乱石
  2021-01-19 12:32     ` Catalin Marinas
  0 siblings, 1 reply; 4+ messages in thread
From: 乱石 @ 2021-01-19 11:26 UTC (permalink / raw)
  To: Will Deacon
  Cc: Catalin Marinas, Anshuman Khandual, Suzuki K Poulose, Mark Brown,
	gustavoars, Vincenzo Frascino, Dave Martin, linux-arm-kernel,
	linux-kernel

在 2021/1/19 19:01, Will Deacon 写道:
> On Tue, Jan 19, 2021 at 06:55:10PM +0800, Liguang Zhang wrote:
>> CPU architecture is assigned to be a fixed value, it should be obtained
>> from midr register.
>>
>> Signed-off-by: Liguang Zhang <zhangliguang@linux.alibaba.com>
>> ---
>>   arch/arm64/kernel/cpuinfo.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
>> index 77605aec25fe..0bd11e0fe9f2 100644
>> --- a/arch/arm64/kernel/cpuinfo.c
>> +++ b/arch/arm64/kernel/cpuinfo.c
>> @@ -191,7 +191,7 @@ static int c_show(struct seq_file *m, void *v)
>>   
>>   		seq_printf(m, "CPU implementer\t: 0x%02x\n",
>>   			   MIDR_IMPLEMENTOR(midr));
>> -		seq_printf(m, "CPU architecture: 8\n");
>> +		seq_printf(m, "CPU architecture: %d\n", MIDR_ARCHITECTURE(midr));
> Huh? Won't this always return 0xf?

Hi Will,

I'm not sure. My platform return 0xf, but /proc/cpuinfo show 8. Why we 
assign a fixed

value to cpu architecture?

Regards

Liguang Zhang

>
> Will

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

* Re: [PATCH] arm64/cpuinfo: Show right CPU architecture information
  2021-01-19 11:26   ` 乱石
@ 2021-01-19 12:32     ` Catalin Marinas
  0 siblings, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2021-01-19 12:32 UTC (permalink / raw)
  To: 乱石
  Cc: Will Deacon, Anshuman Khandual, Suzuki K Poulose, Mark Brown,
	gustavoars, Vincenzo Frascino, Dave Martin, linux-arm-kernel,
	linux-kernel

On Tue, Jan 19, 2021 at 07:26:31PM +0800, 乱石 wrote:
> 锟斤拷 2021/1/19 19:01, Will Deacon 写锟斤拷:
> > On Tue, Jan 19, 2021 at 06:55:10PM +0800, Liguang Zhang wrote:
> > > CPU architecture is assigned to be a fixed value, it should be obtained
> > > from midr register.
> > > 
> > > Signed-off-by: Liguang Zhang <zhangliguang@linux.alibaba.com>
> > > ---
> > >   arch/arm64/kernel/cpuinfo.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
> > > index 77605aec25fe..0bd11e0fe9f2 100644
> > > --- a/arch/arm64/kernel/cpuinfo.c
> > > +++ b/arch/arm64/kernel/cpuinfo.c
> > > @@ -191,7 +191,7 @@ static int c_show(struct seq_file *m, void *v)
> > >   		seq_printf(m, "CPU implementer\t: 0x%02x\n",
> > >   			   MIDR_IMPLEMENTOR(midr));
> > > -		seq_printf(m, "CPU architecture: 8\n");
> > > +		seq_printf(m, "CPU architecture: %d\n", MIDR_ARCHITECTURE(midr));
> > Huh? Won't this always return 0xf?
> 
> Hi Will,
> 
> I'm not sure. My platform return 0xf, but /proc/cpuinfo show 8. Why we
> assign a fixed
> 
> value to cpu architecture?

Because 0xf first appeared on some ARMv6 CPUs (1176, 11MPcore and some
newer revisions of 1136). A field value of 0xf means don't bother with
architecture version but rather check the CPUID information for the
features you need. We decided to call it 8 here with 64-bit as that was
announced as ARMv8. A 32-bit kernel running on ARMv8 hardware would
report 7 (as it would on some ARMv6 hardware like 1176 etc.)

-- 
Catalin

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

end of thread, other threads:[~2021-01-19 12:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19 10:55 [PATCH] arm64/cpuinfo: Show right CPU architecture information Liguang Zhang
2021-01-19 11:01 ` Will Deacon
2021-01-19 11:26   ` 乱石
2021-01-19 12:32     ` Catalin Marinas

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