[PATCH] target/arm: Add Kunpeng-920

KevinZ posted 1 patch 4 years ago
Failed in applying to current master (apply log)
 target/arm/cpu64.c | 20 ++++++++++++++++++++
[PATCH] target/arm: Add Kunpeng-920
Posted by KevinZ 4 years ago
HiSilicon Kunpeng-920 CPU is one of the commonly used
data center CPUs, this patch adds it to target.

Signed-off-by: Zhenyu Zheng <zhengzhenyulixi@gmail.com&gt;

---
&nbsp;hw/arm/virt.c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp; 1 +
&nbsp;target/arm/cpu64.c | 20 ++++++++++++++++++++
&nbsp;2 files changed, 21 insertions(+)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 7dc96abf72..8457d9deee 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -197,6 +197,7 @@ static const char *valid_cpus[] = {
&nbsp;&nbsp;&nbsp;&nbsp; ARM_CPU_TYPE_NAME("cortex-a53"),
&nbsp;&nbsp;&nbsp;&nbsp; ARM_CPU_TYPE_NAME("cortex-a57"),
&nbsp;&nbsp;&nbsp;&nbsp; ARM_CPU_TYPE_NAME("cortex-a72"),
+&nbsp;&nbsp;&nbsp; ARM_CPU_TYPE_NAME("Kunpeng-920"),
&nbsp;&nbsp;&nbsp;&nbsp; ARM_CPU_TYPE_NAME("host"),
&nbsp;&nbsp;&nbsp;&nbsp; ARM_CPU_TYPE_NAME("max"),
&nbsp;};
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
index 62d36f9e8d..efe1676263 100644
--- a/target/arm/cpu64.c
+++ b/target/arm/cpu64.c
@@ -253,6 +253,25 @@ static void aarch64_a72_initfn(Object *obj)
&nbsp;&nbsp;&nbsp;&nbsp; define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo);
&nbsp;}
&nbsp;
+static void aarch64_kunpeng_920_initfn(Object *obj)
+{
+&nbsp;&nbsp;&nbsp; ARMCPU *cpu = ARM_CPU(obj);
+
+&nbsp;&nbsp;&nbsp; /*
+&nbsp;&nbsp;&nbsp;&nbsp; * HiSilicon Kunpeng-920 CPU is similar to cortex-a72,
+&nbsp;&nbsp;&nbsp;&nbsp; * so first initialize cpu data as cortex-a72 CPU,
+&nbsp;&nbsp;&nbsp;&nbsp; * and then update the corresponding registers.
+&nbsp;&nbsp;&nbsp;&nbsp; */
+&nbsp;&nbsp;&nbsp; aarch64_a72_initfn(obj);
+
+&nbsp;&nbsp;&nbsp; cpu-&gt;midr = 0x480fd010;
+&nbsp;&nbsp;&nbsp; cpu-&gt;ctr = 0x84448004;
+&nbsp;&nbsp;&nbsp; cpu-&gt;isar.id_aa64pfr0 = 0x11001111;
+&nbsp;&nbsp;&nbsp; cpu-&gt;isar.id_aa64dfr0 = 0x110305408;
+&nbsp;&nbsp;&nbsp; cpu-&gt;isar.id_aa64isar0 = 0x10211120;
+&nbsp;&nbsp;&nbsp; cpu-&gt;isar.id_aa64mmfr0 = 0x101125;
+}
+
&nbsp;void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp; /*
@@ -747,6 +766,7 @@ static const ARMCPUInfo aarch64_cpus[] = {
&nbsp;&nbsp;&nbsp;&nbsp; { .name = "cortex-a57",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .initfn = aarch64_a57_initfn },
&nbsp;&nbsp;&nbsp;&nbsp; { .name = "cortex-a53",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .initfn = aarch64_a53_initfn },
&nbsp;&nbsp;&nbsp;&nbsp; { .name = "cortex-a72",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .initfn = aarch64_a72_initfn },
+&nbsp;&nbsp;&nbsp; { .name = "Kunpeng-920",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .initfn = aarch64_kunpeng_920_initfn},
&nbsp;&nbsp;&nbsp;&nbsp; { .name = "max",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .initfn = aarch64_max_initfn },
&nbsp;&nbsp;&nbsp;&nbsp; { .name = NULL }
&nbsp;};
-- 
2.26.0.windows.1
Re: [PATCH] target/arm: Add Kunpeng-920
Posted by Peter Maydell 4 years ago
On Thu, 9 Apr 2020 at 14:17, KevinZ <zheng.zhenyu@foxmail.com> wrote:
>
> HiSilicon Kunpeng-920 CPU is one of the commonly used
> data center CPUs, this patch adds it to target.
>
> Signed-off-by: Zhenyu Zheng <zhengzhenyulixi@gmail.com>

Could you explain what this provides that you couldn't
get with either -cpu cortex-a72 or -cpu host ?

Also, is there a reference manual/datasheet for
this CPU to check whether we're implementing the
right set of features and ID register values?

thanks
-- PMM