linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64/kvm: Add generic v8 KVM target
@ 2015-06-17  9:00 Suzuki K. Poulose
  2015-06-19 20:31 ` Timur Tabi
  2015-06-22  8:44 ` Peter Maydell
  0 siblings, 2 replies; 30+ messages in thread
From: Suzuki K. Poulose @ 2015-06-17  9:00 UTC (permalink / raw)
  To: linux-arm-kernel

From: "Suzuki K. Poulose" <suzuki.poulose@arm.com>

This patch adds a generic ARM v8 KVM target cpu type for use
by the new CPUs which eventualy ends up using the common sys_reg
table. For backward compatibility the existing targets have been
preserved. Any new target CPU that can be covered by generic v8
sys_reg tables should make use of the new generic target.

Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Acked-by: Marc Zyngier <Marc.Zyngier@arm.com>
---
 arch/arm64/include/uapi/asm/kvm.h    |   10 ++++++++--
 arch/arm64/kvm/guest.c               |    3 ++-
 arch/arm64/kvm/sys_regs_generic_v8.c |    2 ++
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h
index d268320..f5de418 100644
--- a/arch/arm64/include/uapi/asm/kvm.h
+++ b/arch/arm64/include/uapi/asm/kvm.h
@@ -53,14 +53,20 @@ struct kvm_regs {
 	struct user_fpsimd_state fp_regs;
 };
 
-/* Supported Processor Types */
+/*
+ * Supported CPU Targets - Adding a new target type is not recommended,
+ * unless there are some special registers not supported by the
+ * genericv8 syreg table.
+ */
 #define KVM_ARM_TARGET_AEM_V8		0
 #define KVM_ARM_TARGET_FOUNDATION_V8	1
 #define KVM_ARM_TARGET_CORTEX_A57	2
 #define KVM_ARM_TARGET_XGENE_POTENZA	3
 #define KVM_ARM_TARGET_CORTEX_A53	4
+/* Generic ARM v8 target */
+#define KVM_ARM_TARGET_GENERIC_V8	5
 
-#define KVM_ARM_NUM_TARGETS		5
+#define KVM_ARM_NUM_TARGETS		6
 
 /* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */
 #define KVM_ARM_DEVICE_TYPE_SHIFT	0
diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
index 9535bd5..124aa57 100644
--- a/arch/arm64/kvm/guest.c
+++ b/arch/arm64/kvm/guest.c
@@ -293,7 +293,8 @@ int __attribute_const__ kvm_target_cpu(void)
 		break;
 	};
 
-	return -EINVAL;
+	/* Return a default generic target */
+	return KVM_ARM_TARGET_GENERIC_V8;
 }
 
 int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init)
diff --git a/arch/arm64/kvm/sys_regs_generic_v8.c b/arch/arm64/kvm/sys_regs_generic_v8.c
index 475fd29..1e45768 100644
--- a/arch/arm64/kvm/sys_regs_generic_v8.c
+++ b/arch/arm64/kvm/sys_regs_generic_v8.c
@@ -94,6 +94,8 @@ static int __init sys_reg_genericv8_init(void)
 					  &genericv8_target_table);
 	kvm_register_target_sys_reg_table(KVM_ARM_TARGET_XGENE_POTENZA,
 					  &genericv8_target_table);
+	kvm_register_target_sys_reg_table(KVM_ARM_TARGET_GENERIC_V8,
+					  &genericv8_target_table);
 
 	return 0;
 }
-- 
1.7.9.5

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

end of thread, other threads:[~2015-07-17 17:56 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-17  9:00 [PATCH] arm64/kvm: Add generic v8 KVM target Suzuki K. Poulose
2015-06-19 20:31 ` Timur Tabi
2015-06-22  6:47   ` Marc Zyngier
2015-06-22  8:44 ` Peter Maydell
2015-06-23 12:39   ` Christoffer Dall
2015-06-23 14:03     ` Suzuki K. Poulose
2015-06-23 14:16       ` Peter Maydell
2015-06-24  8:29   ` Marc Zyngier
2015-06-24  8:51     ` Christoffer Dall
2015-06-24  9:32       ` Marc Zyngier
2015-06-25 12:30         ` Christoffer Dall
2015-06-25 12:40           ` Marc Zyngier
2015-06-25 13:44             ` Marc Zyngier
2015-06-25 13:49               ` Peter Maydell
2015-06-26  9:53                 ` Christoffer Dall
2015-06-29 17:13                   ` Chalamarla, Tirumalesh
2015-06-29 17:30                     ` Marc Zyngier
2015-06-29 17:38                       ` Peter Maydell
2015-06-29 17:52                         ` Marc Zyngier
2015-06-29 18:39                           ` Chalamarla, Tirumalesh
     [not found]                             ` <D805D093-CCFE-4835-853A-B2654DAA10A1@caviumnetworks.com>
2015-07-03  8:08                               ` Marc Zyngier
2015-07-03  8:12                                 ` Peter Maydell
2015-07-03  8:28                                   ` Marc Zyngier
2015-07-03  9:34                                     ` Peter Maydell
2015-07-03 10:10                                       ` Marc Zyngier
2015-07-17  9:33                                         ` Christoffer Dall
2015-07-17  9:56                                           ` Marc Zyngier
2015-07-17 10:15                                             ` Christoffer Dall
2015-07-17 10:19                                               ` Marc Zyngier
2015-07-17 17:56                                                 ` Chalamarla, Tirumalesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).