All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] KVM: arm64: Boring cosmetic patches
@ 2020-11-18 19:43 Will Deacon
  2020-11-18 19:44 ` [PATCH 1/3] KVM: arm64: Move 'struct kvm_arch_memory_slot' out of uapi/ Will Deacon
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Will Deacon @ 2020-11-18 19:43 UTC (permalink / raw)
  To: kvmarm, maz; +Cc: catalin.marinas, kernel-team, Will Deacon

Hi all,

Here are some desperately dull patches I cooked while working on pkvm
enablement. The latter isn't ready yet, but figured there wasn't much
point me sitting on these. Although they're boring, the first patch does
touch uapi/ so it's not completely trivial.

Cheers,

Will

--->8

Will Deacon (3):
  KVM: arm64: Move 'struct kvm_arch_memory_slot' out of uapi/
  KVM: arm64: Remove kvm_arch_vm_ioctl_check_extension()
  KVM: arm64: Remove unused __extended_idmap_trampoline() prototype

 arch/arm64/include/asm/cpufeature.h |  5 +++
 arch/arm64/include/asm/kvm_host.h   |  5 +--
 arch/arm64/include/uapi/asm/kvm.h   |  3 --
 arch/arm64/kvm/arm.c                | 31 +++++++++++++++--
 arch/arm64/kvm/reset.c              | 52 -----------------------------
 5 files changed, 37 insertions(+), 59 deletions(-)

-- 
2.29.2.299.gdc1121823c-goog

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] KVM: arm64: Move 'struct kvm_arch_memory_slot' out of uapi/
  2020-11-18 19:43 [PATCH 0/3] KVM: arm64: Boring cosmetic patches Will Deacon
@ 2020-11-18 19:44 ` Will Deacon
  2020-11-18 19:44 ` [PATCH 2/3] KVM: arm64: Remove kvm_arch_vm_ioctl_check_extension() Will Deacon
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Will Deacon @ 2020-11-18 19:44 UTC (permalink / raw)
  To: kvmarm, maz; +Cc: catalin.marinas, kernel-team, Will Deacon

'struct kvm_arch_memory_slot' isn't part of the user ABI, so move it out
of the uapi/ headers in case we start using it in future and accidentally
back ourselves into a corner.

Signed-off-by: Will Deacon <will@kernel.org>
---
 arch/arm64/include/asm/kvm_host.h | 3 +++
 arch/arm64/include/uapi/asm/kvm.h | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 0cd9f0f75c13..24cb00ce30dd 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -89,6 +89,9 @@ struct kvm_s2_mmu {
 	struct kvm *kvm;
 };
 
+struct kvm_arch_memory_slot {
+};
+
 struct kvm_arch {
 	struct kvm_s2_mmu mmu;
 
diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h
index 1c17c3a24411..24223adae150 100644
--- a/arch/arm64/include/uapi/asm/kvm.h
+++ b/arch/arm64/include/uapi/asm/kvm.h
@@ -156,9 +156,6 @@ struct kvm_sync_regs {
 	__u64 device_irq_level;
 };
 
-struct kvm_arch_memory_slot {
-};
-
 /*
  * PMU filter structure. Describe a range of events with a particular
  * action. To be used with KVM_ARM_VCPU_PMU_V3_FILTER.
-- 
2.29.2.299.gdc1121823c-goog

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] KVM: arm64: Remove kvm_arch_vm_ioctl_check_extension()
  2020-11-18 19:43 [PATCH 0/3] KVM: arm64: Boring cosmetic patches Will Deacon
  2020-11-18 19:44 ` [PATCH 1/3] KVM: arm64: Move 'struct kvm_arch_memory_slot' out of uapi/ Will Deacon
@ 2020-11-18 19:44 ` Will Deacon
  2020-11-18 19:44 ` [PATCH 3/3] KVM: arm64: Remove unused __extended_idmap_trampoline() prototype Will Deacon
  2020-11-27 19:00 ` [PATCH 0/3] KVM: arm64: Boring cosmetic patches Marc Zyngier
  3 siblings, 0 replies; 5+ messages in thread
From: Will Deacon @ 2020-11-18 19:44 UTC (permalink / raw)
  To: kvmarm, maz; +Cc: catalin.marinas, kernel-team, Will Deacon

kvm_arch_vm_ioctl_check_extension() is only called from
kvm_vm_ioctl_check_extension(), so we can inline it and remove the extra
function.

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
---
 arch/arm64/include/asm/cpufeature.h |  5 +++
 arch/arm64/include/asm/kvm_host.h   |  1 -
 arch/arm64/kvm/arm.c                | 31 +++++++++++++++--
 arch/arm64/kvm/reset.c              | 52 -----------------------------
 4 files changed, 34 insertions(+), 55 deletions(-)

diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
index da250e4741bd..461277ae7a48 100644
--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -699,6 +699,11 @@ static inline bool system_supports_generic_auth(void)
 		cpus_have_const_cap(ARM64_HAS_GENERIC_AUTH);
 }
 
+static inline bool system_has_full_ptr_auth(void)
+{
+	return system_supports_address_auth() && system_supports_generic_auth();
+}
+
 static __always_inline bool system_uses_irq_prio_masking(void)
 {
 	return IS_ENABLED(CONFIG_ARM64_PSEUDO_NMI) &&
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 24cb00ce30dd..eee58fdee705 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -58,7 +58,6 @@ int kvm_arm_init_sve(void);
 int __attribute_const__ kvm_target_cpu(void);
 int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
 void kvm_arm_vcpu_destroy(struct kvm_vcpu *vcpu);
-int kvm_arch_vm_ioctl_check_extension(struct kvm *kvm, long ext);
 void __extended_idmap_trampoline(phys_addr_t boot_pgd, phys_addr_t idmap_start);
 
 struct kvm_vmid {
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index c0ffb019ca8b..68c0cd320a7b 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -198,6 +198,8 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 	case KVM_CAP_ARM_IRQ_LINE_LAYOUT_2:
 	case KVM_CAP_ARM_NISV_TO_USER:
 	case KVM_CAP_ARM_INJECT_EXT_DABT:
+	case KVM_CAP_SET_GUEST_DEBUG:
+	case KVM_CAP_VCPU_ATTRIBUTES:
 		r = 1;
 		break;
 	case KVM_CAP_ARM_SET_DEVICE_ADDR:
@@ -229,10 +231,35 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 	case KVM_CAP_STEAL_TIME:
 		r = kvm_arm_pvtime_supported();
 		break;
-	default:
-		r = kvm_arch_vm_ioctl_check_extension(kvm, ext);
+	case KVM_CAP_ARM_EL1_32BIT:
+		r = cpus_have_const_cap(ARM64_HAS_32BIT_EL1);
+		break;
+	case KVM_CAP_GUEST_DEBUG_HW_BPS:
+		r = get_num_brps();
+		break;
+	case KVM_CAP_GUEST_DEBUG_HW_WPS:
+		r = get_num_wrps();
+		break;
+	case KVM_CAP_ARM_PMU_V3:
+		r = kvm_arm_support_pmu_v3();
+		break;
+	case KVM_CAP_ARM_INJECT_SERROR_ESR:
+		r = cpus_have_const_cap(ARM64_HAS_RAS_EXTN);
+		break;
+	case KVM_CAP_ARM_VM_IPA_SIZE:
+		r = get_kvm_ipa_limit();
 		break;
+	case KVM_CAP_ARM_SVE:
+		r = system_supports_sve();
+		break;
+	case KVM_CAP_ARM_PTRAUTH_ADDRESS:
+	case KVM_CAP_ARM_PTRAUTH_GENERIC:
+		r = system_has_full_ptr_auth();
+		break;
+	default:
+		r = 0;
 	}
+
 	return r;
 }
 
diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c
index f32490229a4c..c7985f4607a9 100644
--- a/arch/arm64/kvm/reset.c
+++ b/arch/arm64/kvm/reset.c
@@ -42,58 +42,6 @@ static u32 kvm_ipa_limit;
 #define VCPU_RESET_PSTATE_SVC	(PSR_AA32_MODE_SVC | PSR_AA32_A_BIT | \
 				 PSR_AA32_I_BIT | PSR_AA32_F_BIT)
 
-static bool system_has_full_ptr_auth(void)
-{
-	return system_supports_address_auth() && system_supports_generic_auth();
-}
-
-/**
- * kvm_arch_vm_ioctl_check_extension
- *
- * We currently assume that the number of HW registers is uniform
- * across all CPUs (see cpuinfo_sanity_check).
- */
-int kvm_arch_vm_ioctl_check_extension(struct kvm *kvm, long ext)
-{
-	int r;
-
-	switch (ext) {
-	case KVM_CAP_ARM_EL1_32BIT:
-		r = cpus_have_const_cap(ARM64_HAS_32BIT_EL1);
-		break;
-	case KVM_CAP_GUEST_DEBUG_HW_BPS:
-		r = get_num_brps();
-		break;
-	case KVM_CAP_GUEST_DEBUG_HW_WPS:
-		r = get_num_wrps();
-		break;
-	case KVM_CAP_ARM_PMU_V3:
-		r = kvm_arm_support_pmu_v3();
-		break;
-	case KVM_CAP_ARM_INJECT_SERROR_ESR:
-		r = cpus_have_const_cap(ARM64_HAS_RAS_EXTN);
-		break;
-	case KVM_CAP_SET_GUEST_DEBUG:
-	case KVM_CAP_VCPU_ATTRIBUTES:
-		r = 1;
-		break;
-	case KVM_CAP_ARM_VM_IPA_SIZE:
-		r = kvm_ipa_limit;
-		break;
-	case KVM_CAP_ARM_SVE:
-		r = system_supports_sve();
-		break;
-	case KVM_CAP_ARM_PTRAUTH_ADDRESS:
-	case KVM_CAP_ARM_PTRAUTH_GENERIC:
-		r = system_has_full_ptr_auth();
-		break;
-	default:
-		r = 0;
-	}
-
-	return r;
-}
-
 unsigned int kvm_sve_max_vl;
 
 int kvm_arm_init_sve(void)
-- 
2.29.2.299.gdc1121823c-goog

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] KVM: arm64: Remove unused __extended_idmap_trampoline() prototype
  2020-11-18 19:43 [PATCH 0/3] KVM: arm64: Boring cosmetic patches Will Deacon
  2020-11-18 19:44 ` [PATCH 1/3] KVM: arm64: Move 'struct kvm_arch_memory_slot' out of uapi/ Will Deacon
  2020-11-18 19:44 ` [PATCH 2/3] KVM: arm64: Remove kvm_arch_vm_ioctl_check_extension() Will Deacon
@ 2020-11-18 19:44 ` Will Deacon
  2020-11-27 19:00 ` [PATCH 0/3] KVM: arm64: Boring cosmetic patches Marc Zyngier
  3 siblings, 0 replies; 5+ messages in thread
From: Will Deacon @ 2020-11-18 19:44 UTC (permalink / raw)
  To: kvmarm, maz; +Cc: catalin.marinas, kernel-team, Will Deacon

__extended_idmap_trampoline() was removed a long time ago by
3421e9d88d7a ("arm64: KVM: Simplify HYP init/teardown") so remove the
unused function prototype.

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
---
 arch/arm64/include/asm/kvm_host.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index eee58fdee705..491f0239e3e0 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -58,7 +58,6 @@ int kvm_arm_init_sve(void);
 int __attribute_const__ kvm_target_cpu(void);
 int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
 void kvm_arm_vcpu_destroy(struct kvm_vcpu *vcpu);
-void __extended_idmap_trampoline(phys_addr_t boot_pgd, phys_addr_t idmap_start);
 
 struct kvm_vmid {
 	/* The VMID generation used for the virt. memory system */
-- 
2.29.2.299.gdc1121823c-goog

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] KVM: arm64: Boring cosmetic patches
  2020-11-18 19:43 [PATCH 0/3] KVM: arm64: Boring cosmetic patches Will Deacon
                   ` (2 preceding siblings ...)
  2020-11-18 19:44 ` [PATCH 3/3] KVM: arm64: Remove unused __extended_idmap_trampoline() prototype Will Deacon
@ 2020-11-27 19:00 ` Marc Zyngier
  3 siblings, 0 replies; 5+ messages in thread
From: Marc Zyngier @ 2020-11-27 19:00 UTC (permalink / raw)
  To: Will Deacon, kvmarm; +Cc: catalin.marinas, kernel-team

On Wed, 18 Nov 2020 19:43:59 +0000, Will Deacon wrote:
> Here are some desperately dull patches I cooked while working on pkvm
> enablement. The latter isn't ready yet, but figured there wasn't much
> point me sitting on these. Although they're boring, the first patch does
> touch uapi/ so it's not completely trivial.
> 
> Cheers,
> 
> [...]

Applied to kvm-arm64/misc-5.11, thanks!

[1/3] KVM: arm64: Move 'struct kvm_arch_memory_slot' out of uapi/
      commit: 8d14797b53f044fda3ed42b5b6357c7622b8af58
[2/3] KVM: arm64: Remove kvm_arch_vm_ioctl_check_extension()
      commit: 36fb4cd55f626dff0f6e76bed14707fa00147b7f
[3/3] KVM: arm64: Remove unused __extended_idmap_trampoline() prototype
      commit: bf118a5cb7e6d17e7ec9492e4dc676e7e7b69d01

Cheers,

	M.
-- 
Without deviation from the norm, progress is not possible.


_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-27 19:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18 19:43 [PATCH 0/3] KVM: arm64: Boring cosmetic patches Will Deacon
2020-11-18 19:44 ` [PATCH 1/3] KVM: arm64: Move 'struct kvm_arch_memory_slot' out of uapi/ Will Deacon
2020-11-18 19:44 ` [PATCH 2/3] KVM: arm64: Remove kvm_arch_vm_ioctl_check_extension() Will Deacon
2020-11-18 19:44 ` [PATCH 3/3] KVM: arm64: Remove unused __extended_idmap_trampoline() prototype Will Deacon
2020-11-27 19:00 ` [PATCH 0/3] KVM: arm64: Boring cosmetic patches Marc Zyngier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.