[PATCH] KVM: arm64: Consolidate functions to skip an instruction into skip_instr.h

Alexandru Elisei alexandru.elisei at arm.com
Mon May 17 09:05:45 PDT 2021


The function prototype kvm_skip_instr32() is used only by the hyp code, so
it makes more sense to live in the hyp specific header file adjust_pc.h.
Since __adjust_pc() has been moved to kvm_asm.h so it can be used by the
generic code, rename adjust_pc.h -> skip_instr.h to avoid confusion and to
better reflect the purpose of the remaining functions.

Signed-off-by: Alexandru Elisei <alexandru.elisei at arm.com>
---
Based on git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git
tags/kvmarm-fixes-5.13-1

 arch/arm64/include/asm/kvm_emulate.h                        | 1 -
 arch/arm64/kvm/hyp/aarch32.c                                | 1 +
 arch/arm64/kvm/hyp/exception.c                              | 2 +-
 .../arm64/kvm/hyp/include/hyp/{adjust_pc.h => skip_instr.h} | 6 ++++--
 arch/arm64/kvm/hyp/include/hyp/switch.h                     | 2 +-
 arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c                    | 2 +-
 arch/arm64/kvm/hyp/vgic-v3-sr.c                             | 2 +-
 7 files changed, 9 insertions(+), 7 deletions(-)
 rename arch/arm64/kvm/hyp/include/hyp/{adjust_pc.h => skip_instr.h} (90%)

diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
index f612c090f2e4..436b77e6d1e8 100644
--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -34,7 +34,6 @@ enum exception_type {
 };
 
 bool kvm_condition_valid32(const struct kvm_vcpu *vcpu);
-void kvm_skip_instr32(struct kvm_vcpu *vcpu);
 
 void kvm_inject_undefined(struct kvm_vcpu *vcpu);
 void kvm_inject_vabt(struct kvm_vcpu *vcpu);
diff --git a/arch/arm64/kvm/hyp/aarch32.c b/arch/arm64/kvm/hyp/aarch32.c
index f98cbe2626a1..65ea395d81f3 100644
--- a/arch/arm64/kvm/hyp/aarch32.c
+++ b/arch/arm64/kvm/hyp/aarch32.c
@@ -10,6 +10,7 @@
  * Author: Christoffer Dall <c.dall at virtualopensystems.com>
  */
 
+#include <hyp/skip_instr.h>
 #include <linux/kvm_host.h>
 #include <asm/kvm_emulate.h>
 #include <asm/kvm_hyp.h>
diff --git a/arch/arm64/kvm/hyp/exception.c b/arch/arm64/kvm/hyp/exception.c
index 11541b94b328..ac03ad63c1b4 100644
--- a/arch/arm64/kvm/hyp/exception.c
+++ b/arch/arm64/kvm/hyp/exception.c
@@ -10,7 +10,7 @@
  * Author: Christoffer Dall <c.dall at virtualopensystems.com>
  */
 
-#include <hyp/adjust_pc.h>
+#include <hyp/skip_instr.h>
 #include <linux/kvm_host.h>
 #include <asm/kvm_emulate.h>
 
diff --git a/arch/arm64/kvm/hyp/include/hyp/adjust_pc.h b/arch/arm64/kvm/hyp/include/hyp/skip_instr.h
similarity index 90%
rename from arch/arm64/kvm/hyp/include/hyp/adjust_pc.h
rename to arch/arm64/kvm/hyp/include/hyp/skip_instr.h
index 4fdfeabefeb4..d3ece9a90751 100644
--- a/arch/arm64/kvm/hyp/include/hyp/adjust_pc.h
+++ b/arch/arm64/kvm/hyp/include/hyp/skip_instr.h
@@ -7,12 +7,14 @@
  * Author: Marc Zyngier <maz at kernel.org>
  */
 
-#ifndef __ARM64_KVM_HYP_ADJUST_PC_H__
-#define __ARM64_KVM_HYP_ADJUST_PC_H__
+#ifndef __ARM64_KVM_HYP_SKIP_INSTR_H__
+#define __ARM64_KVM_HYP_SKIP_INSTR_H__
 
 #include <asm/kvm_emulate.h>
 #include <asm/kvm_host.h>
 
+void kvm_skip_instr32(struct kvm_vcpu *vcpu);
+
 static inline void kvm_skip_instr(struct kvm_vcpu *vcpu)
 {
 	if (vcpu_mode_is_32bit(vcpu)) {
diff --git a/arch/arm64/kvm/hyp/include/hyp/switch.h b/arch/arm64/kvm/hyp/include/hyp/switch.h
index e4a2f295a394..13578c1e91a6 100644
--- a/arch/arm64/kvm/hyp/include/hyp/switch.h
+++ b/arch/arm64/kvm/hyp/include/hyp/switch.h
@@ -7,7 +7,7 @@
 #ifndef __ARM64_KVM_HYP_SWITCH_H__
 #define __ARM64_KVM_HYP_SWITCH_H__
 
-#include <hyp/adjust_pc.h>
+#include <hyp/skip_instr.h>
 
 #include <linux/arm-smccc.h>
 #include <linux/kvm_host.h>
diff --git a/arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c b/arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c
index 87a54375bd6e..a11790cc42b4 100644
--- a/arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c
+++ b/arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c
@@ -4,7 +4,7 @@
  * Author: Marc Zyngier <marc.zyngier at arm.com>
  */
 
-#include <hyp/adjust_pc.h>
+#include <hyp/skip_instr.h>
 
 #include <linux/compiler.h>
 #include <linux/irqchip/arm-gic.h>
diff --git a/arch/arm64/kvm/hyp/vgic-v3-sr.c b/arch/arm64/kvm/hyp/vgic-v3-sr.c
index 39f8f7f9227c..756cde8125ef 100644
--- a/arch/arm64/kvm/hyp/vgic-v3-sr.c
+++ b/arch/arm64/kvm/hyp/vgic-v3-sr.c
@@ -4,7 +4,7 @@
  * Author: Marc Zyngier <marc.zyngier at arm.com>
  */
 
-#include <hyp/adjust_pc.h>
+#include <hyp/skip_instr.h>
 
 #include <linux/compiler.h>
 #include <linux/irqchip/arm-gic-v3.h>
-- 
2.31.1




More information about the linux-arm-kernel mailing list