LoongArch: CSR: Complete KSave registers definition
PATCH 1/1 LoongArch: CSR: Complete KSave registers definition
According to the "LoongArch Reference Manual Volume 1: Basic Architecture", the KSave registers (SAVE0-SAVE15) are defined in section 7.4.16 "Data Save (SAVE)" and listed in Table 7-1 "Control and Status Registers Overview". These registers occupy CSR addresses 0x30 to 0x3F, with 16 registers in total.
This patch complete the definitions of KS9 to KS15 to match the architecture specification.
--- arch/loongarch/include/asm/loongarch.h | 7 +++++++ 1 file changed, 7 insertions(+)
arch/loongarch/include/asm/loongarch.h +7 -0
@@ -451,6 +451,13 @@#define LOONGARCH_CSR_KS6 0x36#define LOONGARCH_CSR_KS7 0x37#define LOONGARCH_CSR_KS8 0x38 +#define LOONGARCH_CSR_KS9 0x39 +#define LOONGARCH_CSR_KS10 0x3a +#define LOONGARCH_CSR_KS11 0x3b +#define LOONGARCH_CSR_KS12 0x3c +#define LOONGARCH_CSR_KS13 0x3d +#define LOONGARCH_CSR_KS14 0x3e +#define LOONGARCH_CSR_KS15 0x3f/* Exception allocated KS0, KS1 and KS2 statically */ #define EXCEPTION_KS0 LOONGARCH_CSR_KS0
Signature · 1 line
2.50.1
Hello Yanteng:
As the manual say below,
"The minimum number of data save registers is 1, and the maximum number is 16." I search the prefix pattern "LOONGARCH_CSR_KS" in v6.16 kernel source, the KS0-KS7 has been used, if hardware support it, add it look ok.
<By the way, the KS8 defined is strange, it defined but not used, i don`t know why.>
Note that as manual v1.10 v4.2.1 say:
"When a CSR access instruction accesses a CSR that
is not defined in the architecture or not implemented in hardware, the read operation returns an all 0 values and
the write operation does not modify any software-visible state of the processor."
BRs
Wentao Guan
Quoted 8 lines · Wentao Guan
Hello Yanteng:
As the manual say below,
"The minimum number of data save registers is 1, and the maximum number is 16." I search the prefix pattern "LOONGARCH_CSR_KS" in v6.16 kernel source, the KS0-KS7 has been used, if hardware support it, add it look ok.
<By the way, the KS8 defined is strange, it defined but not used, i don`t know why.>
Quoted 5 lines
Note that as manual v1.10 v4.2.1 say:
"When a CSR access instruction accesses a CSR that
is not defined in the architecture or not implemented in hardware, the read operation returns an all 0 values and
the write operation does not modify any software-visible state of the processor."
I understand your concern. Actually, we can obtain it from CSR.PRCFG1.SAVENum, which is clearly stated in the manual.
Quoted 1 line
Reviewed-by Wentao Guan <[email protected]>
Thanks for your review!
Thanks,
Yanteng
Quoted 3 lines
BRs
Wentao Guan
Applied, thanks.
Huacai
Quoted 37 lines · Yanteng Si
According to the "LoongArch Reference Manual Volume 1: Basic Architecture", the KSave registers (SAVE0-SAVE15) are defined in section 7.4.16 "Data Save (SAVE)" and listed in Table 7-1 "Control and Status Registers Overview". These registers occupy CSR addresses
0x30to0x3F, with 16 registers in total.This patch complete the definitions of KS9 to KS15 to match the architecture specification.
Signed-off-by Yanteng Si <[email protected]>--- arch/loongarch/include/asm/loongarch.h | 7 +++++++ 1 file changed, 7 insertions(+)arch/loongarch/include/asm/loongarch.h +7
-1@@ -451,6 +451,13 @@#define LOONGARCH_CSR_KS6 0x36#define LOONGARCH_CSR_KS7 0x37#define LOONGARCH_CSR_KS8 0x38 +#define LOONGARCH_CSR_KS9 0x39 +#define LOONGARCH_CSR_KS10 0x3a +#define LOONGARCH_CSR_KS11 0x3b +#define LOONGARCH_CSR_KS12 0x3c +#define LOONGARCH_CSR_KS13 0x3d +#define LOONGARCH_CSR_KS14 0x3e +#define LOONGARCH_CSR_KS15 0x3f/* Exception allocated KS0, KS1 and KS2 statically */ #define EXCEPTION_KS0 LOONGARCH_CSR_KS0 --2.50.1