Skip to contentSkip to conversation

KVM: SVM: Code move follow-up

PATCH Applied Joerg Roedel 4 participants 9 messages Jun 25, 2020

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

cover KVM: SVM: Code move follow-up

From: Joerg Roedel <[email protected]>

Hi,

here is small series to follow-up on the review comments for moving the kvm-amd module code to its own sub-directory. The comments were only about renaming structs and symbols, so there are no functional changes in these patches.

The comments addressed here are all from [1].

Regards,

Joerg

[1] https://lore.kernel.org/lkml/[email protected]/

Joerg Roedel (4):
KVM: SVM: Rename struct nested_state to svm_nested_state
KVM: SVM: Add vmcb_ prefix to mark_*() functions
KVM: SVM: Add svm_ prefix to set/clr/is_intercept()
KVM: SVM: Rename svm_nested_virtualize_tpr() to
nested_svm_virtualize_tpr()

 arch/x86/kvm/svm/avic.c   |   2 +-
 arch/x86/kvm/svm/nested.c |   8 +--
 arch/x86/kvm/svm/sev.c    |   2 +-
 arch/x86/kvm/svm/svm.c    | 138 +++++++++++++++++++-------------------
 arch/x86/kvm/svm/svm.h    |  20 +++---
 5 files changed, 85 insertions(+), 85 deletions(-)
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/4 KVM: SVM: Rename struct nested_state to svm_nested_state

From: Joerg Roedel <[email protected]>

Renaming is only needed in the svm.h header file.

No functional changes.

---
 arch/x86/kvm/svm/svm.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/svm/svm.h +2 -2
index 6ac4c00a5d82..6a1864a1f029 100644
@@ -81,7 +81,7 @@ struct kvm_svm {
 
 struct kvm_vcpu;
 
-struct nested_state {
+struct svm_nested_state {
 	struct vmcb *hsave;
 	u64 hsave_msr;
 	u64 vm_cr_msr;
@@ -133,7 +133,7 @@ struct vcpu_svm {
 
 	ulong nmi_iret_rip;
 
-	struct nested_state nested;
+	struct svm_nested_state nested;
 
 	bool nmi_singlestep;
 	u64 nmi_singlestep_guest_rflags;
Signature · 1 line
2.27.0
#2 lore raw

PATCH 2/4 KVM: SVM: Add vmcb_ prefix to mark_*() functions

In reply to Joerg Roedel

From: Joerg Roedel <[email protected]>

Make it more clear what data structure these functions operate on.

No functional changes.

---
 arch/x86/kvm/svm/avic.c   |  2 +-
 arch/x86/kvm/svm/nested.c |  6 +++---
 arch/x86/kvm/svm/sev.c    |  2 +-
 arch/x86/kvm/svm/svm.c    | 44 +++++++++++++++++++--------------------
 arch/x86/kvm/svm/svm.h    |  8 +++----
 5 files changed, 31 insertions(+), 31 deletions(-)
arch/x86/kvm/svm/avic.c +1 -1
index e80daa98682f..ac830cd50830 100644
@@ -665,7 +665,7 @@ void svm_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu)
 	} else {
 		vmcb->control.int_ctl &= ~AVIC_ENABLE_MASK;
 	}
-	mark_dirty(vmcb, VMCB_AVIC);
+	vmcb_mark_dirty(vmcb, VMCB_AVIC);
 
 	svm_set_pi_irte_mode(vcpu, activated);
 }
arch/x86/kvm/svm/nested.c +3 -3
index 6bceafb19108..9845fab381bc 100644
@@ -106,7 +106,7 @@ void recalc_intercepts(struct vcpu_svm *svm)
 {
 	struct vmcb_control_area *c, *h, *g;
 
-	mark_dirty(svm->vmcb, VMCB_INTERCEPTS);
+	vmcb_mark_dirty(svm->vmcb, VMCB_INTERCEPTS);
 
 	if (!is_guest_mode(&svm->vcpu))
 		return;
@@ -375,7 +375,7 @@ static void nested_prepare_vmcb_control(struct vcpu_svm *svm)
 	 */
 	recalc_intercepts(svm);
 
-	mark_all_dirty(svm->vmcb);
+	vmcb_mark_all_dirty(svm->vmcb);
 }
 
 void enter_svm_guest_mode(struct vcpu_svm *svm, u64 vmcb_gpa,
@@ -598,7 +598,7 @@ int nested_svm_vmexit(struct vcpu_svm *svm)
 	svm->vmcb->save.cpl = 0;
 	svm->vmcb->control.exit_int_info = 0;
 
-	mark_all_dirty(svm->vmcb);
+	vmcb_mark_all_dirty(svm->vmcb);
 
 	trace_kvm_nested_vmexit_inject(nested_vmcb->control.exit_code,
 				       nested_vmcb->control.exit_info_1,
arch/x86/kvm/svm/sev.c +1 -1
index 5573a97f1520..5eebfdcdbf4c 100644
@@ -1186,5 +1186,5 @@ void pre_sev_run(struct vcpu_svm *svm, int cpu)
 	svm->last_cpu = cpu;
 	sd->sev_vmcbs[asid] = svm->vmcb;
 	svm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ASID;
-	mark_dirty(svm->vmcb, VMCB_ASID);
+	vmcb_mark_dirty(svm->vmcb, VMCB_ASID);
 }
arch/x86/kvm/svm/svm.c +22 -22

176 lines not on this page · raw message

arch/x86/kvm/svm/svm.h +4 -4
index 6a1864a1f029..76116f5b0d01 100644
@@ -188,18 +188,18 @@ static inline struct kvm_svm *to_kvm_svm(struct kvm *kvm)
 	return container_of(kvm, struct kvm_svm, kvm);
 }
 
-static inline void mark_all_dirty(struct vmcb *vmcb)
+static inline void vmcb_mark_all_dirty(struct vmcb *vmcb)
 {
 	vmcb->control.clean = 0;
 }
 
-static inline void mark_all_clean(struct vmcb *vmcb)
+static inline void vmcb_mark_all_clean(struct vmcb *vmcb)
 {
 	vmcb->control.clean = ((1 << VMCB_DIRTY_MAX) - 1)
 			       & ~VMCB_ALWAYS_DIRTY_MASK;
 }
 
-static inline void mark_dirty(struct vmcb *vmcb, int bit)
+static inline void vmcb_mark_dirty(struct vmcb *vmcb, int bit)
 {
 	vmcb->control.clean &= ~(1 << bit);
 }
@@ -420,7 +420,7 @@ extern int avic;
 static inline void avic_update_vapic_bar(struct vcpu_svm *svm, u64 data)
 {
 	svm->vmcb->control.avic_vapic_bar = data & VMCB_AVIC_APIC_BAR_MASK;
-	mark_dirty(svm->vmcb, VMCB_AVIC);
+	vmcb_mark_dirty(svm->vmcb, VMCB_AVIC);
 }
 
 static inline bool avic_vcpu_is_running(struct kvm_vcpu *vcpu)
Signature · 1 line
2.27.0
#3 lore raw

PATCH 3/4 KVM: SVM: Add svm_ prefix to set/clr/is_intercept()

In reply to Joerg Roedel

From: Joerg Roedel <[email protected]>

Make clear the symbols belong to the SVM code when they are built-in.

No functional changes.

---
 arch/x86/kvm/svm/nested.c |  2 +-
 arch/x86/kvm/svm/svm.c    | 88 +++++++++++++++++++--------------------
 arch/x86/kvm/svm/svm.h    |  6 +--
 3 files changed, 48 insertions(+), 48 deletions(-)
arch/x86/kvm/svm/nested.c +1 -1
index 9845fab381bc..8fc59ce75182 100644
@@ -258,7 +258,7 @@ void sync_nested_vmcb_control(struct vcpu_svm *svm)
 	/* Only a few fields of int_ctl are written by the processor.  */
 	mask = V_IRQ_MASK | V_TPR_MASK;
 	if (!(svm->nested.ctl.int_ctl & V_INTR_MASKING_MASK) &&
-	    is_intercept(svm, INTERCEPT_VINTR)) {
+	    svm_is_intercept(svm, INTERCEPT_VINTR)) {
 		/*
 		 * In order to request an interrupt window, L0 is usurping
 		 * svm->vmcb->control.int_ctl and possibly setting V_IRQ
arch/x86/kvm/svm/svm.c +44 -44

172 lines not on this page · raw message

arch/x86/kvm/svm/svm.h +3 -3
index 76116f5b0d01..003e89008331 100644
@@ -293,7 +293,7 @@ static inline void clr_exception_intercept(struct vcpu_svm *svm, int bit)
 	recalc_intercepts(svm);
 }
 
-static inline void set_intercept(struct vcpu_svm *svm, int bit)
+static inline void svm_set_intercept(struct vcpu_svm *svm, int bit)
 {
 	struct vmcb *vmcb = get_host_vmcb(svm);
 
@@ -302,7 +302,7 @@ static inline void set_intercept(struct vcpu_svm *svm, int bit)
 	recalc_intercepts(svm);
 }
 
-static inline void clr_intercept(struct vcpu_svm *svm, int bit)
+static inline void svm_clr_intercept(struct vcpu_svm *svm, int bit)
 {
 	struct vmcb *vmcb = get_host_vmcb(svm);
 
@@ -311,7 +311,7 @@ static inline void clr_intercept(struct vcpu_svm *svm, int bit)
 	recalc_intercepts(svm);
 }
 
-static inline bool is_intercept(struct vcpu_svm *svm, int bit)
+static inline bool svm_is_intercept(struct vcpu_svm *svm, int bit)
 {
 	return (svm->vmcb->control.intercept & (1ULL << bit)) != 0;
 }
Signature · 1 line
2.27.0
#4 lore raw

PATCH 4/4 KVM: SVM: Rename svm_nested_virtualize_tpr() to nested_svm_virtualize_tpr()

In reply to Joerg Roedel

From: Joerg Roedel <[email protected]>

Match the naming with other nested svm functions.

No functional changes.

---
 arch/x86/kvm/svm/svm.c | 6 +++---
 arch/x86/kvm/svm/svm.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/kvm/svm/svm.c +3 -3
index e0b0321d95d4..b0d551bcf2a0 100644
@@ -3040,7 +3040,7 @@ static void update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr)
 {
 	struct vcpu_svm *svm = to_svm(vcpu);
 
-	if (svm_nested_virtualize_tpr(vcpu))
+	if (nested_svm_virtualize_tpr(vcpu))
 		return;
 
 	clr_cr_intercept(svm, INTERCEPT_CR8_WRITE);
@@ -3234,7 +3234,7 @@ static inline void sync_cr8_to_lapic(struct kvm_vcpu *vcpu)
 {
 	struct vcpu_svm *svm = to_svm(vcpu);
 
-	if (svm_nested_virtualize_tpr(vcpu))
+	if (nested_svm_virtualize_tpr(vcpu))
 		return;
 
 	if (!is_cr_intercept(svm, INTERCEPT_CR8_WRITE)) {
@@ -3248,7 +3248,7 @@ static inline void sync_lapic_to_cr8(struct kvm_vcpu *vcpu)
 	struct vcpu_svm *svm = to_svm(vcpu);
 	u64 cr8;
 
-	if (svm_nested_virtualize_tpr(vcpu) ||
+	if (nested_svm_virtualize_tpr(vcpu) ||
 	    kvm_vcpu_apicv_active(vcpu))
 		return;
 
arch/x86/kvm/svm/svm.h +1 -1
index 003e89008331..8907efda0b0a 100644
@@ -365,7 +365,7 @@ void svm_set_gif(struct vcpu_svm *svm, bool value);
 #define NESTED_EXIT_DONE	1	/* Exit caused nested vmexit  */
 #define NESTED_EXIT_CONTINUE	2	/* Further checks needed      */
 
-static inline bool svm_nested_virtualize_tpr(struct kvm_vcpu *vcpu)
+static inline bool nested_svm_virtualize_tpr(struct kvm_vcpu *vcpu)
 {
 	struct vcpu_svm *svm = to_svm(vcpu);
 
Signature · 1 line
2.27.0
#5 lore raw

Re: [PATCH 4/4] KVM: SVM: Rename svm_nested_virtualize_tpr() to nested_svm_virtualize_tpr()

Quoted 48 lines · Joerg Roedel

From: Joerg Roedel <[email protected]>

Match the naming with other nested svm functions.

No functional changes.

---
  arch/x86/kvm/svm/svm.c | 6 +++---
  arch/x86/kvm/svm/svm.h | 2 +-
  2 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/kvm/svm/svm.c +3 -3
index e0b0321d95d4..b0d551bcf2a0 100644
@@ -3040,7 +3040,7 @@ static void update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr)
  {
  	struct vcpu_svm *svm = to_svm(vcpu);
 
-	if (svm_nested_virtualize_tpr(vcpu))
+	if (nested_svm_virtualize_tpr(vcpu))
  		return;
 
  	clr_cr_intercept(svm, INTERCEPT_CR8_WRITE);
@@ -3234,7 +3234,7 @@ static inline void sync_cr8_to_lapic(struct kvm_vcpu *vcpu)
  {
  	struct vcpu_svm *svm = to_svm(vcpu);
 
-	if (svm_nested_virtualize_tpr(vcpu))
+	if (nested_svm_virtualize_tpr(vcpu))
  		return;
 
  	if (!is_cr_intercept(svm, INTERCEPT_CR8_WRITE)) {
@@ -3248,7 +3248,7 @@ static inline void sync_lapic_to_cr8(struct kvm_vcpu *vcpu)
  	struct vcpu_svm *svm = to_svm(vcpu);
  	u64 cr8;
 
-	if (svm_nested_virtualize_tpr(vcpu) ||
+	if (nested_svm_virtualize_tpr(vcpu) ||
  	    kvm_vcpu_apicv_active(vcpu))
  		return;
 
arch/x86/kvm/svm/svm.h +0 -0
index 003e89008331..8907efda0b0a 100644

arch/x86/kvm/svm/svm.h void svm_set_gif(struct vcpu_svm *svm, bool value); · line 371

Quoted 8 lines
arch/x86/kvm/svm/svm.h +1 -1
@@ -365,7 +365,7 @@ void svm_set_gif(struct vcpu_svm *svm, bool value);
  #define NESTED_EXIT_DONE	1	/* Exit caused nested vmexit  */
  #define NESTED_EXIT_CONTINUE	2	/* Further checks needed      */
 
-static inline bool svm_nested_virtualize_tpr(struct kvm_vcpu *vcpu)
+static inline bool nested_svm_virtualize_tpr(struct kvm_vcpu *vcpu)
  {
  	struct vcpu_svm *svm = to_svm(vcpu);
 

Should the name be changed to svm_nested_virtualized_tpr ?  Because svm_nested_virtualize_tpr implies that the action of the function is to virtualize the TPR.

Reviewed-by on the v1 series
#6 lore raw
In reply to Joerg Roedel
Quoted 9 lines · Joerg Roedel

From: Joerg Roedel <[email protected]>

Hi,

here is small series to follow-up on the review comments for moving the kvm-amd module code to its own sub-directory. The comments were only about renaming structs and symbols, so there are no functional changes in these patches.

Quoted 8 lines

The comments addressed here are all from [1].

Regards,

Joerg

[1] https://lore.kernel.org/lkml/[email protected]/

Thank you for the follow-up!

Quoted 7 lines

Joerg Roedel (4):
KVM: SVM: Rename struct nested_state to svm_nested_state
KVM: SVM: Add vmcb_ prefix to mark_*() functions
KVM: SVM: Add svm_ prefix to set/clr/is_intercept()
KVM: SVM: Rename svm_nested_virtualize_tpr() to
nested_svm_virtualize_tpr()

Quoted 6 lines
 arch/x86/kvm/svm/avic.c   |   2 +-
 arch/x86/kvm/svm/nested.c |   8 +--
 arch/x86/kvm/svm/sev.c    |   2 +-
 arch/x86/kvm/svm/svm.c    | 138 +++++++++++++++++++-------------------
 arch/x86/kvm/svm/svm.h    |  20 +++---
 5 files changed, 85 insertions(+), 85 deletions(-)

Series:

Signature · 1 line
Vitaly
maintainer Applied
#7 lore raw
Quoted 11 lines · Vitaly Kuznetsov
Quoted 9 lines · Joerg Roedel

From: Joerg Roedel <[email protected]>

Hi,

here is small series to follow-up on the review comments for moving the kvm-amd module code to its own sub-directory. The comments were only about renaming structs and symbols, so there are no functional changes in these patches.

Quoted 8 lines
Quoted 8 lines

The comments addressed here are all from [1].

Regards,

Joerg

[1] https://lore.kernel.org/lkml/[email protected]/

Queued, thanks.

Paolo

Quoted 19 lines

Thank you for the follow-up!

Quoted 7 lines

Joerg Roedel (4):
KVM: SVM: Rename struct nested_state to svm_nested_state
KVM: SVM: Add vmcb_ prefix to mark_*() functions
KVM: SVM: Add svm_ prefix to set/clr/is_intercept()
KVM: SVM: Rename svm_nested_virtualize_tpr() to
nested_svm_virtualize_tpr()

Quoted 6 lines
 arch/x86/kvm/svm/avic.c   |   2 +-
 arch/x86/kvm/svm/nested.c |   8 +--
 arch/x86/kvm/svm/sev.c    |   2 +-
 arch/x86/kvm/svm/svm.c    | 138 +++++++++++++++++++-------------------
 arch/x86/kvm/svm/svm.h    |  20 +++---
 5 files changed, 85 insertions(+), 85 deletions(-)

Series:

Reviewed-by on the v1 series
#8 lore raw
In reply to Joerg Roedel
Quoted 24 lines · Joerg Roedel

From: Joerg Roedel <[email protected]>

Hi,

here is small series to follow-up on the review comments for moving the kvm-amd module code to its own sub-directory. The comments were only about renaming structs and symbols, so there are no functional changes in these patches.

The comments addressed here are all from [1].

Regards,

Joerg

[1] https://lore.kernel.org/lkml/[email protected]/

Joerg Roedel (4):
KVM: SVM: Rename struct nested_state to svm_nested_state
KVM: SVM: Add vmcb_ prefix to mark_*() functions
KVM: SVM: Add svm_ prefix to set/clr/is_intercept()
KVM: SVM: Rename svm_nested_virtualize_tpr() to
nested_svm_virtualize_tpr()

Quoted 7 lines
  arch/x86/kvm/svm/avic.c   |   2 +-
  arch/x86/kvm/svm/nested.c |   8 +--
  arch/x86/kvm/svm/sev.c    |   2 +-
  arch/x86/kvm/svm/svm.c    | 138 +++++++++++++++++++-------------------
  arch/x86/kvm/svm/svm.h    |  20 +++---
  5 files changed, 85 insertions(+), 85 deletions(-)