mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-18 07:18:27 +00:00
Qemu: Enable the vcpu-hotplug for arm
Initially enable vcpu hotplug in qemu for arm base on Salli's work[1]. Fixes:#3280 Signed-off-by: Huang Shijie <shijie8@gmail.com> [1] https://github.com/salil-mehta/qemu/tree/virt-cpuhp-armv8/rfc-v1
This commit is contained in:
@@ -0,0 +1,180 @@
|
||||
From ee68b08a7194ea9fefdf00ee57fa9edcb56b4359 Mon Sep 17 00:00:00 2001
|
||||
From: Huang Shijie <shijie8@gmail.com>
|
||||
Date: Wed, 8 Dec 2021 17:08:07 +0800
|
||||
Subject: [PATCH 25/28] cleanup code of arm cpu hotplug support
|
||||
|
||||
Signed-off-by: Huang Shijie <shijie8@gmail.com>
|
||||
Signed-off-by: Huang Shijie <shijie8@gmail.com>
|
||||
---
|
||||
hw/arm/virt.c | 136 +-------------------------------------------------
|
||||
1 file changed, 1 insertion(+), 135 deletions(-)
|
||||
|
||||
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
|
||||
index 3f4763367a..5c04abb352 100644
|
||||
--- a/hw/arm/virt.c
|
||||
+++ b/hw/arm/virt.c
|
||||
@@ -1585,38 +1585,6 @@ static void virt_remove_disabled_cpus(VirtMachineState *vms)
|
||||
}
|
||||
}
|
||||
|
||||
-/*static bool virt_pmu_init(VirtMachineState *vms)
|
||||
-{
|
||||
- CPUArchIdList *possible_cpus = vms->parent.possible_cpus;
|
||||
- ARMCPU *armcpu;
|
||||
- int n; */
|
||||
-
|
||||
- /*
|
||||
- * As of now KVM ensures that within the host all the vcpus have same
|
||||
- * features configured. This cannot be changed later and cannot be diferent
|
||||
- * for new vcpus being plugged in. Also, -cpu option/virt machine cpu-type
|
||||
- * ensures all the vcpus are identical.
|
||||
- */
|
||||
-/* for (n = 0; n < possible_cpus->len; n++) {
|
||||
- CPUState *cpu = qemu_get_possible_cpu(n);
|
||||
- armcpu = ARM_CPU(cpu);
|
||||
-
|
||||
- if (!arm_feature(&armcpu->env, ARM_FEATURE_PMU)) {
|
||||
- warn_report("Not all vcpus might have PMU initialized");
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- if (kvm_enabled()) {
|
||||
- if (kvm_irqchip_in_kernel()) {
|
||||
- kvm_arm_pmu_set_irq(cpu, PPI(VIRTUAL_PMU_IRQ));
|
||||
- }
|
||||
- kvm_arm_pmu_init(cpu);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return true;
|
||||
-}*/
|
||||
-
|
||||
static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
|
||||
{
|
||||
const VirtMachineState *board = container_of(binfo, VirtMachineState,
|
||||
@@ -2120,110 +2088,11 @@ static void machvirt_init(MachineState *machine)
|
||||
Object *cpuobj;
|
||||
CPUState *cs;
|
||||
|
||||
-/* if (n >= smp_cpus) {
|
||||
- break;
|
||||
- }
|
||||
-*/
|
||||
cpuobj = object_new(possible_cpus->cpus[n].type);
|
||||
cs = CPU(cpuobj);
|
||||
-/* object_property_set_int(cpuobj, "mp-affinity",
|
||||
- possible_cpus->cpus[n].arch_id, NULL);
|
||||
-
|
||||
- cs = CPU(cpuobj);
|
||||
- cs->cpu_index = n;
|
||||
-
|
||||
- numa_cpu_pre_plug(&possible_cpus->cpus[cs->cpu_index], DEVICE(cpuobj),
|
||||
- &error_fatal);
|
||||
-*/
|
||||
aarch64 &= object_property_get_bool(cpuobj, "aarch64", NULL);
|
||||
object_property_set_int(cpuobj, "core-id", n, NULL);
|
||||
|
||||
-/* if (!vms->secure) {
|
||||
- object_property_set_bool(cpuobj, "has_el3", false, NULL);
|
||||
- }
|
||||
-
|
||||
- if (!vms->virt && object_property_find(cpuobj, "has_el2")) {
|
||||
- object_property_set_bool(cpuobj, "has_el2", false, NULL);
|
||||
- }
|
||||
-
|
||||
- if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED) {
|
||||
- object_property_set_int(cpuobj, "psci-conduit", vms->psci_conduit,
|
||||
- NULL);
|
||||
-*/
|
||||
- /* Secondary CPUs start in PSCI powered-down state */
|
||||
-/* if (n > 0) {
|
||||
- object_property_set_bool(cpuobj, "start-powered-off", true,
|
||||
- NULL);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (vmc->kvm_no_adjvtime &&
|
||||
- object_property_find(cpuobj, "kvm-no-adjvtime")) {
|
||||
- object_property_set_bool(cpuobj, "kvm-no-adjvtime", true, NULL);
|
||||
- }
|
||||
-
|
||||
- if (vmc->no_kvm_steal_time &&
|
||||
- object_property_find(cpuobj, "kvm-steal-time")) {
|
||||
- object_property_set_bool(cpuobj, "kvm-steal-time", false, NULL);
|
||||
- }
|
||||
-
|
||||
- if (vmc->no_pmu && object_property_find(cpuobj, "pmu")) {
|
||||
- object_property_set_bool(cpuobj, "pmu", false, NULL);
|
||||
- }
|
||||
-
|
||||
- if (object_property_find(cpuobj, "reset-cbar")) {
|
||||
- object_property_set_int(cpuobj, "reset-cbar",
|
||||
- vms->memmap[VIRT_CPUPERIPHS].base,
|
||||
- &error_abort);
|
||||
- }
|
||||
-
|
||||
- object_property_set_link(cpuobj, "memory", OBJECT(sysmem),
|
||||
- &error_abort);
|
||||
- if (vms->secure) {
|
||||
- object_property_set_link(cpuobj, "secure-memory",
|
||||
- OBJECT(secure_sysmem), &error_abort);
|
||||
- }
|
||||
-*/
|
||||
-// if (vms->mte) {
|
||||
- /* Create the memory region only once, but link to all cpus. */
|
||||
-// if (!tag_sysmem) {
|
||||
- /*
|
||||
- * The property exists only if MemTag is supported.
|
||||
- * If it is, we must allocate the ram to back that up.
|
||||
- */
|
||||
-/* if (!object_property_find(cpuobj, "tag-memory")) {
|
||||
- error_report("MTE requested, but not supported "
|
||||
- "by the guest CPU");
|
||||
- exit(1);
|
||||
- }
|
||||
-
|
||||
- tag_sysmem = g_new(MemoryRegion, 1);
|
||||
- memory_region_init(tag_sysmem, OBJECT(machine),
|
||||
- "tag-memory", UINT64_MAX / 32);
|
||||
-
|
||||
- if (vms->secure) {
|
||||
- secure_tag_sysmem = g_new(MemoryRegion, 1);
|
||||
- memory_region_init(secure_tag_sysmem, OBJECT(machine),
|
||||
- "secure-tag-memory", UINT64_MAX / 32);
|
||||
-*/
|
||||
- /* As with ram, secure-tag takes precedence over tag. */
|
||||
-/* memory_region_add_subregion_overlap(secure_tag_sysmem, 0,
|
||||
- tag_sysmem, -1);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- object_property_set_link(cpuobj, "tag-memory", OBJECT(tag_sysmem),
|
||||
- &error_abort);
|
||||
- if (vms->secure) {
|
||||
- object_property_set_link(cpuobj, "secure-tag-memory",
|
||||
- OBJECT(secure_tag_sysmem),
|
||||
- &error_abort);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- qdev_realize(DEVICE(cpuobj), NULL, &error_fatal);
|
||||
- object_unref(cpuobj);
|
||||
-*/
|
||||
if (n < smp_cpus) {
|
||||
char *core_id = g_strdup_printf("core%d", n);
|
||||
qdev_set_id(DEVICE(cpuobj),core_id);
|
||||
@@ -2283,10 +2152,7 @@ static void machvirt_init(MachineState *machine)
|
||||
|
||||
virt_cpu_post_init(vms, sysmem);
|
||||
|
||||
-// if (!vmc->no_pmu && virt_pmu_init(vms)) {
|
||||
-// vms->pmu = true;
|
||||
- fdt_add_pmu_nodes(vms);
|
||||
-// }
|
||||
+ fdt_add_pmu_nodes(vms);
|
||||
create_uart(vms, VIRT_UART, sysmem, serial_hd(0));
|
||||
|
||||
if (vms->secure) {
|
||||
--
|
||||
2.30.2
|
||||
|
Reference in New Issue
Block a user