2015-06-26 19:58:52

by Tirumalesh Chalamarla

[permalink] [raw]
Subject: [PATCH] arm64: KVM: Enable minimalistic support for Thunder

In order to allow KVM to run on Thunder implementations, add the
minimal support required.

Signed-off-by: Tirumalesh Chalamarla <[email protected]>
---
arch/arm64/include/asm/cputype.h | 3 +++
arch/arm64/include/uapi/asm/kvm.h | 3 ++-
arch/arm64/kvm/guest.c | 6 ++++++
arch/arm64/kvm/sys_regs_generic_v8.c | 2 ++
4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
index a84ec60..f603dcd 100644
--- a/arch/arm64/include/asm/cputype.h
+++ b/arch/arm64/include/asm/cputype.h
@@ -63,6 +63,7 @@
((partnum) << MIDR_PARTNUM_SHIFT))

#define ARM_CPU_IMP_ARM 0x41
+#define ARM_CPU_IMP_CAVIUM 0x43
#define ARM_CPU_IMP_APM 0x50

#define ARM_CPU_PART_AEM_V8 0xD0F
@@ -72,6 +73,8 @@

#define APM_CPU_PART_POTENZA 0x000

+#define ARM_CPU_PART_THUNDER 0x0A1
+
#define ID_AA64MMFR0_BIGENDEL0_SHIFT 16
#define ID_AA64MMFR0_BIGENDEL0_MASK (0xf << ID_AA64MMFR0_BIGENDEL0_SHIFT)
#define ID_AA64MMFR0_BIGENDEL0(mmfr0) \
diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h
index d268320..6c4c556 100644
--- a/arch/arm64/include/uapi/asm/kvm.h
+++ b/arch/arm64/include/uapi/asm/kvm.h
@@ -59,8 +59,9 @@ struct kvm_regs {
#define KVM_ARM_TARGET_CORTEX_A57 2
#define KVM_ARM_TARGET_XGENE_POTENZA 3
#define KVM_ARM_TARGET_CORTEX_A53 4
+#define KVM_ARM_TARGET_CAVIUM_THUNDER 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..3751f37 100644
--- a/arch/arm64/kvm/guest.c
+++ b/arch/arm64/kvm/guest.c
@@ -291,6 +291,12 @@ int __attribute_const__ kvm_target_cpu(void)
return KVM_ARM_TARGET_XGENE_POTENZA;
};
break;
+ case ARM_CPU_IMP_CAVIUM:
+ switch (part_number) {
+ case ARM_CPU_PART_THUNDER:
+ return KVM_ARM_TARGET_CAVIUM_THUNDER;
+ };
+ break;
};

return -EINVAL;
diff --git a/arch/arm64/kvm/sys_regs_generic_v8.c b/arch/arm64/kvm/sys_regs_generic_v8.c
index 475fd29..0e48ee8 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_CAVIUM_THUNDER,
+ &genericv8_target_table);

return 0;
}
--
2.1.0


2015-06-29 08:53:51

by Marc Zyngier

[permalink] [raw]
Subject: Re: [PATCH] arm64: KVM: Enable minimalistic support for Thunder

On 26/06/15 20:51, Tirumalesh Chalamarla wrote:
> In order to allow KVM to run on Thunder implementations, add the
> minimal support required.
>
> Signed-off-by: Tirumalesh Chalamarla <[email protected]>

CCing the KVM/ARM maintainers should be the first course of action.

Also, you may want to try Suzuki's patch instead:

http://www.spinics.net/lists/kvm/msg117703.html

Constantly adding new CPUs without providing any insight as to how they
should be emulated only brings churn, and not much benefit.

Thanks,

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

2015-06-29 17:22:22

by Chalamarla, Tirumalesh

[permalink] [raw]
Subject: Re: [PATCH] arm64: KVM: Enable minimalistic support for Thunder


> On Jun 29, 2015, at 1:53 AM, Marc Zyngier <[email protected]> wrote:
>
> On 26/06/15 20:51, Tirumalesh Chalamarla wrote:
>> In order to allow KVM to run on Thunder implementations, add the
>> minimal support required.
>>
>> Signed-off-by: Tirumalesh Chalamarla <[email protected]>
>
> CCing the KVM/ARM maintainers should be the first course of action.
>
thanks.

> Also, you may want to try Suzuki's patch instead:
>
> http://www.spinics.net/lists/kvm/msg117703.html
>
will try with this.

> Constantly adding new CPUs without providing any insight as to how they
> should be emulated only brings churn, and not much benefit.
>
we are not planning(at this point) to emulate Thunder with QEMU/others.

> Thanks,
>
> M.
> --
> Jazz is not dead. It just smells funny...

2015-06-29 17:11:25

by Marc Zyngier

[permalink] [raw]
Subject: Re: [PATCH] arm64: KVM: Enable minimalistic support for Thunder

On 29/06/15 18:06, Chalamarla, Tirumalesh wrote:
>
>> On Jun 29, 2015, at 1:53 AM, Marc Zyngier <[email protected]> wrote:
>>
>> On 26/06/15 20:51, Tirumalesh Chalamarla wrote:
>>> In order to allow KVM to run on Thunder implementations, add the
>>> minimal support required.
>>>
>>> Signed-off-by: Tirumalesh Chalamarla <[email protected]>
>>
>> CCing the KVM/ARM maintainers should be the first course of action.
>>
> thanks.
>
>> Also, you may want to try Suzuki's patch instead:
>>
>> http://www.spinics.net/lists/kvm/msg117703.html
>>
> will try with this.
>
>> Constantly adding new CPUs without providing any insight as to how they
>> should be emulated only brings churn, and not much benefit.
>>
> we are not planning(at this point) to emulate Thunder with QEMU/others.

Fair enough. If cross-cpu VM migration is none of your concern, then
Suzuki's patch should be enough.

Thanks,

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

2015-06-29 17:18:17

by Peter Maydell

[permalink] [raw]
Subject: Re: [PATCH] arm64: KVM: Enable minimalistic support for Thunder

On 29 June 2015 at 18:11, Marc Zyngier <[email protected]> wrote:
> On 29/06/15 18:06, Chalamarla, Tirumalesh wrote:
>>
>>> On Jun 29, 2015, at 1:53 AM, Marc Zyngier <[email protected]> wrote:
>>> Constantly adding new CPUs without providing any insight as to how they
>>> should be emulated only brings churn, and not much benefit.
>>>
>> we are not planning(at this point) to emulate Thunder with QEMU/others.
>
> Fair enough. If cross-cpu VM migration is none of your concern, then
> Suzuki's patch should be enough.

"Emulate with QEMU" is a completely different thing from
"support cross-cpu VM migration" !

-- PMM

2015-07-16 17:40:47

by Chalamarla, Tirumalesh

[permalink] [raw]
Subject: Re: [PATCH] arm64: KVM: Enable minimalistic support for Thunder

the discussion on the generic cpu seems to be stuck, is there a possibility to take this patch. so that Thunder has a chance to run some KVM.

Thanks,
Tirumalesh.
> On Jun 29, 2015, at 10:11 AM, Marc Zyngier <[email protected]> wrote:
>
> On 29/06/15 18:06, Chalamarla, Tirumalesh wrote:
>>
>>> On Jun 29, 2015, at 1:53 AM, Marc Zyngier <[email protected]> wrote:
>>>
>>> On 26/06/15 20:51, Tirumalesh Chalamarla wrote:
>>>> In order to allow KVM to run on Thunder implementations, add the
>>>> minimal support required.
>>>>
>>>> Signed-off-by: Tirumalesh Chalamarla <[email protected]>
>>>
>>> CCing the KVM/ARM maintainers should be the first course of action.
>>>
>> thanks.
>>
>>> Also, you may want to try Suzuki's patch instead:
>>>
>>> http://www.spinics.net/lists/kvm/msg117703.html
>>>
>> will try with this.
>>
>>> Constantly adding new CPUs without providing any insight as to how they
>>> should be emulated only brings churn, and not much benefit.
>>>
>> we are not planning(at this point) to emulate Thunder with QEMU/others.
>
> Fair enough. If cross-cpu VM migration is none of your concern, then
> Suzuki's patch should be enough.
>
> Thanks,
>
> M.
> --
> Jazz is not dead. It just smells funny...