Skip to contentSkip to conversation

KVM: arm64: Update kvm_arm_exception_class and esr_class_str for new EC

PATCH In review Zenghui Yu 2 participants 3 messages Jul 13, 2019 – Jul 27, 2019

Subsystems (2)
lore
Share & tools
lore

Zenghui Yu

author reviewer
#0 lore raw

PATCH 1/1 KVM: arm64: Update kvm_arm_exception_class and esr_class_str for new EC

We've added two ESR exception classes for new ARM hardware extensions:
ESR_ELx_EC_PAC and ESR_ELx_EC_SVE.

This patch updates "kvm_arm_exception_class" for these two EC, which the new EC will be parsed in kvm_exit trace events (for guest's usage of Pointer Authentication and Scalable Vector Extension). The same updates to "esr_class_str" for ESR_ELx_EC_PAC, by which we can get more accurate debug info. Trivial changes, update them in one go.

Cc Marc Zyngier <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Dave Martin <[email protected]>
---
 arch/arm64/include/asm/kvm_arm.h | 7 ++++---
 arch/arm64/kernel/traps.c        | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)
arch/arm64/include/asm/kvm_arm.h +4 -3
index a8b205e..ddf9d76 100644
@@ -316,9 +316,10 @@
 
 #define kvm_arm_exception_class \
 	ECN(UNKNOWN), ECN(WFx), ECN(CP15_32), ECN(CP15_64), ECN(CP14_MR), \
-	ECN(CP14_LS), ECN(FP_ASIMD), ECN(CP10_ID), ECN(CP14_64), ECN(SVC64), \
-	ECN(HVC64), ECN(SMC64), ECN(SYS64), ECN(IMP_DEF), ECN(IABT_LOW), \
-	ECN(IABT_CUR), ECN(PC_ALIGN), ECN(DABT_LOW), ECN(DABT_CUR), \
+	ECN(CP14_LS), ECN(FP_ASIMD), ECN(CP10_ID), ECN(PAC), ECN(CP14_64), \
+	ECN(SVC64), ECN(HVC64), ECN(SMC64), ECN(SYS64), ECN(SVE), \
+	ECN(IMP_DEF), ECN(IABT_LOW), ECN(IABT_CUR), \
+	ECN(PC_ALIGN), ECN(DABT_LOW), ECN(DABT_CUR), \
 	ECN(SP_ALIGN), ECN(FP_EXC32), ECN(FP_EXC64), ECN(SERROR), \
 	ECN(BREAKPT_LOW), ECN(BREAKPT_CUR), ECN(SOFTSTP_LOW), \
 	ECN(SOFTSTP_CUR), ECN(WATCHPT_LOW), ECN(WATCHPT_CUR), \
arch/arm64/kernel/traps.c +1 -0
index 8c03456..969e156 100644
@@ -734,6 +734,7 @@ asmlinkage void __exception do_sysinstr(unsigned int esr, struct pt_regs *regs)
 	[ESR_ELx_EC_CP14_LS]		= "CP14 LDC/STC",
 	[ESR_ELx_EC_FP_ASIMD]		= "ASIMD",
 	[ESR_ELx_EC_CP10_ID]		= "CP10 MRC/VMRS",
+	[ESR_ELx_EC_PAC]		= "PAC",
 	[ESR_ELx_EC_CP14_64]		= "CP14 MCRR/MRRC",
 	[ESR_ELx_EC_ILL]		= "PSTATE.IL",
 	[ESR_ELx_EC_SVC32]		= "SVC (AArch32)",
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 6 lines · Zenghui Yu

We've added two ESR exception classes for new ARM hardware extensions:
ESR_ELx_EC_PAC and ESR_ELx_EC_SVE.

This patch updates "kvm_arm_exception_class" for these two EC, which the

new EC will be parsed in kvm_exit trace events (for guest's usage of

new EC will be visible to user-space via kvm_exit() trace events... ?

Quoted 3 lines

Pointer Authentication and Scalable Vector Extension). The same updates to "esr_class_str" for ESR_ELx_EC_PAC, by which we can get more accurate debug info.

Its accurate either way round. This stops the trace-point print from printing the EC in hex, instead giving it a name, like we do for all the others.

Quoted 1 line

Trivial changes, update them in one go.

(I don't think this bit needs to go in the git-log!)

Quoted 8 lines
arch/arm64/include/asm/kvm_arm.h +0 -0
index a8b205e..ddf9d76 100644
@@ -316,9 +316,10 @@
 
 #define kvm_arm_exception_class \
 	ECN(UNKNOWN), ECN(WFx), ECN(CP15_32), ECN(CP15_64), ECN(CP14_MR), \

arch/arm64/include/asm/kvm_arm.h line 325

Quoted 10 lines
arch/arm64/include/asm/kvm_arm.h +4 -3
-	ECN(CP14_LS), ECN(FP_ASIMD), ECN(CP10_ID), ECN(CP14_64), ECN(SVC64), \
-	ECN(HVC64), ECN(SMC64), ECN(SYS64), ECN(IMP_DEF), ECN(IABT_LOW), \
-	ECN(IABT_CUR), ECN(PC_ALIGN), ECN(DABT_LOW), ECN(DABT_CUR), \
+	ECN(CP14_LS), ECN(FP_ASIMD), ECN(CP10_ID), ECN(PAC), ECN(CP14_64), \
+	ECN(SVC64), ECN(HVC64), ECN(SMC64), ECN(SYS64), ECN(SVE), \
+	ECN(IMP_DEF), ECN(IABT_LOW), ECN(IABT_CUR), \
+	ECN(PC_ALIGN), ECN(DABT_LOW), ECN(DABT_CUR), \
 	ECN(SP_ALIGN), ECN(FP_EXC32), ECN(FP_EXC64), ECN(SERROR), \
 	ECN(BREAKPT_LOW), ECN(BREAKPT_CUR), ECN(SOFTSTP_LOW), \
 	ECN(SOFTSTP_CUR), ECN(WATCHPT_LOW), ECN(WATCHPT_CUR), \

Do we need to add:
ESR_ELx_EC_ILL
ESR_ELx_EC_HVC32
ESR_ELx_EC_SMC32

(I don't see how any of the _CUR entries could ever happen as these EC originally come from ESR_EL2, but they're harmless)

arch/arm64/kernel/traps.c asmlinkage void __exception do_sysinstr(unsigned int esr, struct pt_regs *regs) · line 740

Quoted 12 lines
arch/arm64/kernel/traps.c +1 -0
index 8c03456..969e156 100644
@@ -734,6 +734,7 @@ asmlinkage void __exception do_sysinstr(unsigned int esr, struct pt_regs *regs)
 	[ESR_ELx_EC_CP14_LS]		= "CP14 LDC/STC",
 	[ESR_ELx_EC_FP_ASIMD]		= "ASIMD",
 	[ESR_ELx_EC_CP10_ID]		= "CP10 MRC/VMRS",
+	[ESR_ELx_EC_PAC]		= "PAC",
 	[ESR_ELx_EC_CP14_64]		= "CP14 MCRR/MRRC",
 	[ESR_ELx_EC_ILL]		= "PSTATE.IL",
 	[ESR_ELx_EC_SVC32]		= "SVC (AArch32)",

Thanks,

James

author reviewer
#2 lore raw

Hi,

I noticed Marc had applied this patch in his kvmarm tree, with the updated commit message. Thanks Marc :)

Quoted 13 lines · James Morse

Hi,

Quoted 6 lines · Zenghui Yu

We've added two ESR exception classes for new ARM hardware extensions:
ESR_ELx_EC_PAC and ESR_ELx_EC_SVE.

This patch updates "kvm_arm_exception_class" for these two EC, which the

new EC will be parsed in kvm_exit trace events (for guest's usage of

new EC will be visible to user-space via kvm_exit() trace events... ?

Quoted 6 lines
Quoted 3 lines

Pointer Authentication and Scalable Vector Extension). The same updates to "esr_class_str" for ESR_ELx_EC_PAC, by which we can get more accurate debug info.

Its accurate either way round. This stops the trace-point print from printing the EC in hex, instead giving it a name, like we do for all the others.

So this should be "readable".

Quoted 20 lines
Quoted 1 line

Trivial changes, update them in one go.

(I don't think this bit needs to go in the git-log!)

Quoted 15 lines
arch/arm64/include/asm/kvm_arm.h +4 -3
index a8b205e..ddf9d76 100644
@@ -316,9 +316,10 @@
 
  #define kvm_arm_exception_class \
  	ECN(UNKNOWN), ECN(WFx), ECN(CP15_32), ECN(CP15_64), ECN(CP14_MR), \
-	ECN(CP14_LS), ECN(FP_ASIMD), ECN(CP10_ID), ECN(CP14_64), ECN(SVC64), \
-	ECN(HVC64), ECN(SMC64), ECN(SYS64), ECN(IMP_DEF), ECN(IABT_LOW), \
-	ECN(IABT_CUR), ECN(PC_ALIGN), ECN(DABT_LOW), ECN(DABT_CUR), \
+	ECN(CP14_LS), ECN(FP_ASIMD), ECN(CP10_ID), ECN(PAC), ECN(CP14_64), \
+	ECN(SVC64), ECN(HVC64), ECN(SMC64), ECN(SYS64), ECN(SVE), \
+	ECN(IMP_DEF), ECN(IABT_LOW), ECN(IABT_CUR), \
+	ECN(PC_ALIGN), ECN(DABT_LOW), ECN(DABT_CUR), \
Quoted 8 lines

arch/arm64/include/asm/kvm_arm.h line 325

Quoted 3 lines
arch/arm64/include/asm/kvm_arm.h +0 -0
  	ECN(SP_ALIGN), ECN(FP_EXC32), ECN(FP_EXC64), ECN(SERROR), \
  	ECN(BREAKPT_LOW), ECN(BREAKPT_CUR), ECN(SOFTSTP_LOW), \
  	ECN(SOFTSTP_CUR), ECN(WATCHPT_LOW), ECN(WATCHPT_CUR), \

Do we need to add:
ESR_ELx_EC_ILL
ESR_ELx_EC_HVC32
ESR_ELx_EC_SMC32

I think they're needed. But these three EC are not included into kvm_arm_exception_class at the time it was introduced, I don't know the reason.

Quoted 2 lines

(I don't see how any of the _CUR entries could ever happen as these EC originally come from ESR_EL2, but they're harmless)

(I agree with you.)

Quoted 7 lines
Quoted 7 lines
arch/arm64/kernel/traps.c +0 -0
index 8c03456..969e156 100644
@@ -734,6 +734,7 @@ asmlinkage void __exception do_sysinstr(unsigned int esr, struct pt_regs *regs)
  	[ESR_ELx_EC_CP14_LS]		= "CP14 LDC/STC",
  	[ESR_ELx_EC_FP_ASIMD]		= "ASIMD",
Quoted 8 lines

arch/arm64/kernel/traps.c asmlinkage void __exception do_sysinstr(unsigned int esr, struct pt_regs *regs) · line 740

Quoted 5 lines
arch/arm64/kernel/traps.c +1 -0
  	[ESR_ELx_EC_CP10_ID]		= "CP10 MRC/VMRS",
+	[ESR_ELx_EC_PAC]		= "PAC",
  	[ESR_ELx_EC_CP14_64]		= "CP14 MCRR/MRRC",
  	[ESR_ELx_EC_ILL]		= "PSTATE.IL",
  	[ESR_ELx_EC_SVC32]		= "SVC (AArch32)",

Thanks for your reviewing!

Zenghui