2020-10-29 09:06:10

by Tiezhu Yang

[permalink] [raw]
Subject: [PATCH 1/6] MIPS: Loongson64: Do not write the read only field LPA of CP0_CONFIG3

The field LPA of CP0_CONFIG3 register is read only for Loongson64, so the
write operations are meaningless, remove them.

Signed-off-by: Tiezhu Yang <[email protected]>
---
arch/mips/include/asm/mach-loongson64/kernel-entry-init.h | 8 --------
arch/mips/loongson64/numa.c | 3 ---
2 files changed, 11 deletions(-)

diff --git a/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h b/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
index 87a5bfb..e4d77f4 100644
--- a/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
+++ b/arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
@@ -19,10 +19,6 @@
.macro kernel_entry_setup
.set push
.set mips64
- /* Set LPA on LOONGSON3 config3 */
- mfc0 t0, CP0_CONFIG3
- or t0, (0x1 << 7)
- mtc0 t0, CP0_CONFIG3
/* Set ELPA on LOONGSON3 pagegrain */
mfc0 t0, CP0_PAGEGRAIN
or t0, (0x1 << 29)
@@ -54,10 +50,6 @@
.macro smp_slave_setup
.set push
.set mips64
- /* Set LPA on LOONGSON3 config3 */
- mfc0 t0, CP0_CONFIG3
- or t0, (0x1 << 7)
- mtc0 t0, CP0_CONFIG3
/* Set ELPA on LOONGSON3 pagegrain */
mfc0 t0, CP0_PAGEGRAIN
or t0, (0x1 << 29)
diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c
index cf9459f..c7e3cced 100644
--- a/arch/mips/loongson64/numa.c
+++ b/arch/mips/loongson64/numa.c
@@ -40,9 +40,6 @@ static void enable_lpa(void)
unsigned long value;

value = __read_32bit_c0_register($16, 3);
- value |= 0x00000080;
- __write_32bit_c0_register($16, 3, value);
- value = __read_32bit_c0_register($16, 3);
pr_info("CP0_Config3: CP0 16.3 (0x%lx)\n", value);

value = __read_32bit_c0_register($5, 1);
--
2.1.0


2020-10-30 04:04:20

by Jiaxun Yang

[permalink] [raw]
Subject: Re: [PATCH 1/6] MIPS: Loongson64: Do not write the read only field LPA of CP0_CONFIG3



?? 2020/10/29 16:02, Tiezhu Yang д??:
> The field LPA of CP0_CONFIG3 register is read only for Loongson64, so the
> write operations are meaningless, remove them.
>
> Signed-off-by: Tiezhu Yang <[email protected]>
> ---
> arch/mips/include/asm/mach-loongson64/kernel-entry-init.h | 8 --------
> arch/mips/loongson64/numa.c | 3 ---
> 2 files changed, 11 deletions(-)
Hi Tiezhu,

AFAIK it's not read only on 3A1000.
Have you check with hardware guys?

Thanks.

- Jiaxun

2020-10-30 06:24:41

by Tiezhu Yang

[permalink] [raw]
Subject: Re: [PATCH 1/6] MIPS: Loongson64: Do not write the read only field LPA of CP0_CONFIG3

On 10/30/2020 12:00 PM, Jiaxun Yang wrote:
>
>
> 在 2020/10/29 16:02, Tiezhu Yang 写道:
>> The field LPA of CP0_CONFIG3 register is read only for Loongson64, so
>> the
>> write operations are meaningless, remove them.
>>
>> Signed-off-by: Tiezhu Yang <[email protected]>
>> ---
>> arch/mips/include/asm/mach-loongson64/kernel-entry-init.h | 8 --------
>> arch/mips/loongson64/numa.c | 3 ---
>> 2 files changed, 11 deletions(-)
> Hi Tiezhu,
>
> AFAIK it's not read only on 3A1000.
> Have you check with hardware guys?

Hi Jiaxun,

Yes, I checked it before send this patch, the field LPA of CP0_CONFIG3
on 3A1000 is also read only, we can see the related description in the
chapter 3.22 of Loongson_3A1000_cpu_user_2.

And also we can see the following description in the chapter
"9.45 Configuration Register 3 (CP0 Register 16, Select 3)" of
MD00091-2B-MIPS64PRA-AFP-05.04:
"The Config3 register encodes additional capabilities.
All fields in the Config3 register are read-only."

Thanks,
Tiezhu

>
> Thanks.
>
> - Jiaxun

2020-10-30 12:15:17

by Jiaxun Yang

[permalink] [raw]
Subject: Re: [PATCH 1/6] MIPS: Loongson64: Do not write the read only field LPA of CP0_CONFIG3



在 2020/10/30 14:22, Tiezhu Yang 写道:
> On 10/30/2020 12:00 PM, Jiaxun Yang wrote:
>>
>>
>> 在 2020/10/29 16:02, Tiezhu Yang 写道:
>>> The field LPA of CP0_CONFIG3 register is read only for Loongson64,
>>> so the
>>> write operations are meaningless, remove them.
>>>
>>> Signed-off-by: Tiezhu Yang <[email protected]>
>>> ---
>>>   arch/mips/include/asm/mach-loongson64/kernel-entry-init.h | 8
>>> --------
>>>   arch/mips/loongson64/numa.c                               | 3 ---
>>>   2 files changed, 11 deletions(-)
>> Hi Tiezhu,
>>
>> AFAIK it's not read only on 3A1000.
>> Have you check with hardware guys?
>
> Hi Jiaxun,
>
> Yes, I checked it before send this patch,  the field LPA of CP0_CONFIG3
> on 3A1000 is also read only,  we can see the related description in the
> chapter 3.22 of Loongson_3A1000_cpu_user_2.

On page 36, it said:
"能否写ELPA位依赖于Config3寄存器的LPA域 。当Config3的LPA位为0时,
PageGrain的ELPA位被置位。"

Don't know if it matters.

@Huacai, Any comments? Do you know why it exists here?

Thanks

- Jiaxun

2020-11-02 10:50:06

by Jiaxun Yang

[permalink] [raw]
Subject: Re: [PATCH 1/6] MIPS: Loongson64: Do not write the read only field LPA of CP0_CONFIG3



在 2020/10/30 20:13, Jiaxun Yang 写道:
>
>
> 在 2020/10/30 14:22, Tiezhu Yang 写道:
>> On 10/30/2020 12:00 PM, Jiaxun Yang wrote:
>>>
>>>
>>> 在 2020/10/29 16:02, Tiezhu Yang 写道:
>>>> The field LPA of CP0_CONFIG3 register is read only for Loongson64,
>>>> so the
>>>> write operations are meaningless, remove them.
>>>>
>>>> Signed-off-by: Tiezhu Yang <[email protected]>
>>>> ---
>>>>   arch/mips/include/asm/mach-loongson64/kernel-entry-init.h | 8
>>>> --------
>>>>   arch/mips/loongson64/numa.c | 3 ---
>>>>   2 files changed, 11 deletions(-)
>>> Hi Tiezhu,
>>>
>>> AFAIK it's not read only on 3A1000.
>>> Have you check with hardware guys?
>>
>> Hi Jiaxun,
>>
>> Yes, I checked it before send this patch,  the field LPA of CP0_CONFIG3
>> on 3A1000 is also read only,  we can see the related description in the
>> chapter 3.22 of Loongson_3A1000_cpu_user_2.
>
> On page 36, it said:
> "能否写ELPA位依赖于Config3寄存器的LPA域 。当Config3的LPA位为0时,
> PageGrain的ELPA位被置位。"
>
> Don't know if it matters.
>
> @Huacai, Any comments? Do you know why it exists here?

Confirmed by another rev of the manual that it's only a tip for implementer.
I guess my assumption was wrong.
LPA should be read-only though.....

Thanks
- Jiaxun

>
> Thanks
>
> - Jiaxun