From 512f4f585ee6d51c2ee909ec9451b3137d5941df Mon Sep 17 00:00:00 2001 From: lijunwei Date: Tue, 1 Jul 2025 17:17:54 +0800 Subject: [PATCH 1/2] add support for Phytium 2000+ and Phytium S2500 --- hw/arm/virt.c | 2 ++ target/arm/cpu64.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index a43f18020c..2957b844d2 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -238,6 +238,8 @@ static const char *valid_cpus[] = { ARM_CPU_TYPE_NAME("cortex-a53"), ARM_CPU_TYPE_NAME("cortex-a57"), ARM_CPU_TYPE_NAME("Kunpeng-920"), + ARM_CPU_TYPE_NAME("FT-2000+"), + ARM_CPU_TYPE_NAME("Tengyun-S2500"), ARM_CPU_TYPE_NAME("host"), ARM_CPU_TYPE_NAME("max"), }; diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 6eca55ac29..4a1d2daeb6 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -799,6 +799,34 @@ static void aarch64_host_initfn(Object *obj) #endif } +static void aarch64_max_ft2000plus_initfn(Object *obj) +{ + ARMCPU *cpu = ARM_CPU(obj); + + if (kvm_enabled()) { + kvm_arm_set_cpu_features_from_host(cpu); + } else { + aarch64_a72_initfn(obj); + cpu->midr = 0x70186622; + } + aarch64_add_sve_properties(obj); + aarch64_add_pauth_properties(obj); +} + +static void aarch64_max_tengyun_s2500_initfn(Object *obj) +{ + ARMCPU *cpu = ARM_CPU(obj); + + if (kvm_enabled()) { + kvm_arm_set_cpu_features_from_host(cpu); + } else { + aarch64_a72_initfn(obj); + cpu->midr = 0x70186632; + } + aarch64_add_sve_properties(obj); + aarch64_add_pauth_properties(obj); +} + static void aarch64_max_initfn(Object *obj) { if (kvm_enabled() || hvf_enabled()) { @@ -821,6 +849,8 @@ static const ARMCPUInfo aarch64_cpus[] = { { .name = "cortex-a57", .initfn = aarch64_a57_initfn }, { .name = "cortex-a53", .initfn = aarch64_a53_initfn }, { .name = "Kunpeng-920", .initfn = aarch64_kunpeng_920_initfn}, + { .name = "FT-2000+", .initfn = aarch64_max_ft2000plus_initfn }, + { .name = "Tengyun-S2500", .initfn = aarch64_max_tengyun_s2500_initfn }, { .name = "max", .initfn = aarch64_max_initfn }, #if defined(CONFIG_KVM) || defined(CONFIG_HVF) { .name = "host", .initfn = aarch64_host_initfn }, -- Gitee From 4bfb3158b99bbcdba9466f628cb0989a3d36fd2b Mon Sep 17 00:00:00 2001 From: lijunwei Date: Tue, 1 Jul 2025 17:50:10 +0800 Subject: [PATCH 2/2] virtio-net: Fix num_buffers for version 1 --- hw/net/virtio-net.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 7184c9c526..25044385dc 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1996,7 +1996,9 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, sg, elem->in_num, offsetof(typeof(mhdr), num_buffers), sizeof(mhdr.num_buffers)); - } + }else { + mhdr.num_buffers = cpu_to_le16(1); + } receive_header(n, sg, elem->in_num, buf, size); if (n->rss_data.populate_hash) { -- Gitee