linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: KVM: Enable support for Cortex-A72
@ 2016-08-24  7:21 Shannon Zhao
  2016-08-24  8:57 ` Suzuki K Poulose
  2016-08-24  9:23 ` Marc Zyngier
  0 siblings, 2 replies; 6+ messages in thread
From: Shannon Zhao @ 2016-08-24  7:21 UTC (permalink / raw)
  To: linux-arm-kernel

In order to allow KVM to run on Cortex-A72 physical cpus, enable KVM
support for Cortex-A72.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 arch/arm64/include/asm/cputype.h     | 1 +
 arch/arm64/include/uapi/asm/kvm.h    | 3 ++-
 arch/arm64/kvm/guest.c               | 2 ++
 arch/arm64/kvm/sys_regs_generic_v8.c | 2 ++
 4 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
index 9d9fd4b..cf1f638 100644
--- a/arch/arm64/include/asm/cputype.h
+++ b/arch/arm64/include/asm/cputype.h
@@ -76,6 +76,7 @@
 #define ARM_CPU_PART_FOUNDATION		0xD00
 #define ARM_CPU_PART_CORTEX_A57		0xD07
 #define ARM_CPU_PART_CORTEX_A53		0xD03
+#define ARM_CPU_PART_CORTEX_A72		0xD08
 
 #define APM_CPU_PART_POTENZA		0x000
 
diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h
index f209ea1..af8fbeb 100644
--- a/arch/arm64/include/uapi/asm/kvm.h
+++ b/arch/arm64/include/uapi/asm/kvm.h
@@ -65,8 +65,9 @@ struct kvm_regs {
 #define KVM_ARM_TARGET_CORTEX_A53	4
 /* Generic ARM v8 target */
 #define KVM_ARM_TARGET_GENERIC_V8	5
+#define KVM_ARM_TARGET_CORTEX_A72	6
 
-#define KVM_ARM_NUM_TARGETS		6
+#define KVM_ARM_NUM_TARGETS		7
 
 /* 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 32fad75..7eed92e 100644
--- a/arch/arm64/kvm/guest.c
+++ b/arch/arm64/kvm/guest.c
@@ -293,6 +293,8 @@ int __attribute_const__ kvm_target_cpu(void)
 			return KVM_ARM_TARGET_CORTEX_A53;
 		case ARM_CPU_PART_CORTEX_A57:
 			return KVM_ARM_TARGET_CORTEX_A57;
+		case ARM_CPU_PART_CORTEX_A72:
+			return KVM_ARM_TARGET_CORTEX_A72;
 		};
 		break;
 	case ARM_CPU_IMP_APM:
diff --git a/arch/arm64/kvm/sys_regs_generic_v8.c b/arch/arm64/kvm/sys_regs_generic_v8.c
index ed90578..cf823e1 100644
--- a/arch/arm64/kvm/sys_regs_generic_v8.c
+++ b/arch/arm64/kvm/sys_regs_generic_v8.c
@@ -92,6 +92,8 @@ static int __init sys_reg_genericv8_init(void)
 					  &genericv8_target_table);
 	kvm_register_target_sys_reg_table(KVM_ARM_TARGET_CORTEX_A57,
 					  &genericv8_target_table);
+	kvm_register_target_sys_reg_table(KVM_ARM_TARGET_CORTEX_A72,
+					  &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,
-- 
2.0.4

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

* [PATCH] arm64: KVM: Enable support for Cortex-A72
  2016-08-24  7:21 [PATCH] arm64: KVM: Enable support for Cortex-A72 Shannon Zhao
@ 2016-08-24  8:57 ` Suzuki K Poulose
  2016-08-24  9:23   ` Shannon Zhao
  2016-08-24  9:23 ` Marc Zyngier
  1 sibling, 1 reply; 6+ messages in thread
From: Suzuki K Poulose @ 2016-08-24  8:57 UTC (permalink / raw)
  To: linux-arm-kernel

On 24/08/16 08:21, Shannon Zhao wrote:
> In order to allow KVM to run on Cortex-A72 physical cpus, enable KVM
> support for Cortex-A72.

Do we really need this change ? Given that A72 is using the generic_v8 table,
it will automatically be supported via the GENERIC_V8 target. That was added
just for this purpose. The pre-existing targets were preserved so that
we don't break the ABI for older user space.

Suzuki

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

* [PATCH] arm64: KVM: Enable support for Cortex-A72
  2016-08-24  7:21 [PATCH] arm64: KVM: Enable support for Cortex-A72 Shannon Zhao
  2016-08-24  8:57 ` Suzuki K Poulose
@ 2016-08-24  9:23 ` Marc Zyngier
  1 sibling, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2016-08-24  9:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 24 Aug 2016 15:21:37 +0800
Shannon Zhao <zhaoshenglong@huawei.com> wrote:

Hi Shannon,

> In order to allow KVM to run on Cortex-A72 physical cpus, enable KVM
> support for Cortex-A72.
> 
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>

Why do we need any of this?

Since bca556ac468a ("arm64/kvm: Add generic v8 KVM target"), we support
any CPU that can run KVM without any change to the kernel, and I've
been running KVM on A72 for quite some time now (Juno r2, Armada 7040).

Am I missing something obvious?

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny.

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

* [PATCH] arm64: KVM: Enable support for Cortex-A72
  2016-08-24  8:57 ` Suzuki K Poulose
@ 2016-08-24  9:23   ` Shannon Zhao
  2016-08-24 10:19     ` Suzuki K Poulose
  0 siblings, 1 reply; 6+ messages in thread
From: Shannon Zhao @ 2016-08-24  9:23 UTC (permalink / raw)
  To: linux-arm-kernel



On 2016/8/24 16:57, Suzuki K Poulose wrote:
> On 24/08/16 08:21, Shannon Zhao wrote:
>> In order to allow KVM to run on Cortex-A72 physical cpus, enable KVM
>> support for Cortex-A72.
> 
> Do we really need this change ? Given that A72 is using the generic_v8
> table,
> it will automatically be supported via the GENERIC_V8 target. That was
> added
> just for this purpose. The pre-existing targets were preserved so that
> we don't break the ABI for older user space.
> 
Yes, this works for qemu with "-cpu host". But if it specifies the cpu
type with "-cpu cortex-a72". It will fail without this patch.

The corresponding qemu patches could be found at [1].
[1] https://lists.gnu.org/archive/html/qemu-devel/2016-08/msg03653.html

Thanks,
-- 
Shannon

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

* [PATCH] arm64: KVM: Enable support for Cortex-A72
  2016-08-24  9:23   ` Shannon Zhao
@ 2016-08-24 10:19     ` Suzuki K Poulose
  2016-08-24 10:54       ` Peter Maydell
  0 siblings, 1 reply; 6+ messages in thread
From: Suzuki K Poulose @ 2016-08-24 10:19 UTC (permalink / raw)
  To: linux-arm-kernel

On 24/08/16 10:23, Shannon Zhao wrote:
>
>
> On 2016/8/24 16:57, Suzuki K Poulose wrote:
>> On 24/08/16 08:21, Shannon Zhao wrote:
>>> In order to allow KVM to run on Cortex-A72 physical cpus, enable KVM
>>> support for Cortex-A72.
>>
>> Do we really need this change ? Given that A72 is using the generic_v8
>> table,
>> it will automatically be supported via the GENERIC_V8 target. That was
>> added
>> just for this purpose. The pre-existing targets were preserved so that
>> we don't break the ABI for older user space.
>>
> Yes, this works for qemu with "-cpu host". But if it specifies the cpu
> type with "-cpu cortex-a72". It will fail without this patch.

Thats because you specify the expected target from the kernel in Qemu.

I don't know what are the plans for Qemu. Are we going to add every single
ARM CPU released to the target list both in Kernel and Qemu ? e.g, what about
A35, A73 and others from the partners ?

Suzuki

>
> The corresponding qemu patches could be found at [1].
> [1] https://lists.gnu.org/archive/html/qemu-devel/2016-08/msg03653.html
>
> Thanks,
>

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

* [PATCH] arm64: KVM: Enable support for Cortex-A72
  2016-08-24 10:19     ` Suzuki K Poulose
@ 2016-08-24 10:54       ` Peter Maydell
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2016-08-24 10:54 UTC (permalink / raw)
  To: linux-arm-kernel

On 24 August 2016 at 11:19, Suzuki K Poulose <Suzuki.Poulose@arm.com> wrote:
> On 24/08/16 10:23, Shannon Zhao wrote:
>> Yes, this works for qemu with "-cpu host". But if it specifies the cpu
>> type with "-cpu cortex-a72". It will fail without this patch.
>
>
> Thats because you specify the expected target from the kernel in Qemu.

That's because if the user said "I really really want a cortex-A72 in
the guest" then we need to tell the kernel "really must be an A72"
(and the kernel can then fake it up in some hypothetical future world
where we can simulate A72 on non-A72 h/w). If the user is happy
with "whatever the kernel's best effort is" that's what -cpu host does.
If there's no way to tell the kernel "must be an A72" we fail the command
because we can't do what the user asked for.

thanks
-- PMM

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

end of thread, other threads:[~2016-08-24 10:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-24  7:21 [PATCH] arm64: KVM: Enable support for Cortex-A72 Shannon Zhao
2016-08-24  8:57 ` Suzuki K Poulose
2016-08-24  9:23   ` Shannon Zhao
2016-08-24 10:19     ` Suzuki K Poulose
2016-08-24 10:54       ` Peter Maydell
2016-08-24  9:23 ` Marc Zyngier

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).