Skip to contentSkip to conversation

KVM: SVM,VMX: Use %rip-relative addressing to access kvm_rebooting

PATCH Applied Uros Bizjak 2 participants 2 messages Oct 31, 2023 – Dec 1, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: SVM,VMX: Use %rip-relative addressing to access kvm_rebooting

Instruction with %rip-relative address operand is one byte shorter than its absolute address counterpart and is also compatible with position independent executable (-fpie) build.

No functional changes intended.

Cc Sean Christopherson <[email protected]>
Cc Paolo Bonzini <[email protected]>
---
 arch/x86/kvm/svm/vmenter.S | 10 +++++-----
 arch/x86/kvm/vmx/vmenter.S |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/x86/kvm/svm/vmenter.S +5 -5
index ef2ebabb059c..9499f9c6b077 100644
@@ -270,16 +270,16 @@ SYM_FUNC_START(__svm_vcpu_run)
 	RESTORE_GUEST_SPEC_CTRL_BODY
 	RESTORE_HOST_SPEC_CTRL_BODY
 
-10:	cmpb $0, kvm_rebooting
+10:	cmpb $0, _ASM_RIP(kvm_rebooting)
 	jne 2b
 	ud2
-30:	cmpb $0, kvm_rebooting
+30:	cmpb $0, _ASM_RIP(kvm_rebooting)
 	jne 4b
 	ud2
-50:	cmpb $0, kvm_rebooting
+50:	cmpb $0, _ASM_RIP(kvm_rebooting)
 	jne 6b
 	ud2
-70:	cmpb $0, kvm_rebooting
+70:	cmpb $0, _ASM_RIP(kvm_rebooting)
 	jne 8b
 	ud2
 
@@ -381,7 +381,7 @@ SYM_FUNC_START(__svm_sev_es_vcpu_run)
 	RESTORE_GUEST_SPEC_CTRL_BODY
 	RESTORE_HOST_SPEC_CTRL_BODY
 
-3:	cmpb $0, kvm_rebooting
+3:	cmpb $0, _ASM_RIP(kvm_rebooting)
 	jne 2b
 	ud2
 
arch/x86/kvm/vmx/vmenter.S +1 -1
index be275a0410a8..906ecd001511 100644
@@ -289,7 +289,7 @@ SYM_INNER_LABEL_ALIGN(vmx_vmexit, SYM_L_GLOBAL)
 	RET
 
 .Lfixup:
-	cmpb $0, kvm_rebooting
+	cmpb $0, _ASM_RIP(kvm_rebooting)
 	jne .Lvmfail
 	ud2
 .Lvmfail:
Signature · 1 line
2.41.0
maintainer Applied
#1 lore raw
Quoted 8 lines · Uros Bizjak

Instruction with %rip-relative address operand is one byte shorter than its absolute address counterpart and is also compatible with position independent executable (-fpie) build.

No functional changes intended.

[...]

Applied to kvm-x86 misc, thanks!

[1/1] KVM: SVM,VMX: Use %rip-relative addressing to access kvm_rebooting

      https://github.com/kvm-x86/linux/commit/15223c4f973a

--
https://github.com/kvm-x86/linux/tree/next