- fix compile error on loongarch
- hw/loongarch: fix cpu hotplug reset
- hw/loongarch/boot: Use warn_report when no kernel filename
- hw/loongarch: clean code
- hw/loongarch: Add KVM pch msi device support
- hw/loongarch: Add KVM pch pic device support
- hw/loongarch: Add KVM extioi device support
- hw/loongarch: Add KVM IPI device support
- hw/loongarch/virt: Update the ACPI table for hotplug cpu
- hw/loongarch/virt: Add basic CPU plug support
- hw/loongarch/virt: Add CPU topology support
- accel/kvm/kvm-all: Fixes the missing break in vCPU unpark logic
- gdbstub: Add helper function to unregister GDB register space
- physmem: Add helper function to destroy CPU AddressSpace
- hw/acpi: Update CPUs AML with cpu-(ctrl)dev change
- hw/acpi: Update ACPI GED framework to support vCPU Hotplug
- hw/acpi: Move CPU ctrl-dev MMIO region len macro to common header file
- accel/kvm: Extract common KVM vCPU {creation,parking} code
- target/loongarch: Add steal time support on migration
- linux-headers: loongarch: Add kvm_para.h and unistd_64.h
- target/loongarch/kvm: Implement LoongArch PMU extension
- target/loongarch: Implement lbt registers save/restore function
- target/loongarch: Add loongson binary translation feature
- sync loongarch linux-headers
- target/loongarch: Avoid bits shift exceeding width of bool type
- target/loongarch: Use explicit little-endian LD/ST API
- target/loongarch: fix -Werror=maybe-uninitialized false-positive
- target/loongarch: Support QMP dump-guest-memory
- target/loongarch/kvm: Add vCPU reset function
- target/loongarch: Add compatible support about VM reboot
- target/loongarch: Fix cpu_reset set wrong CSR_CRMD
- target/loongarch: Set CSR_PRCFG1 and CSR_PRCFG2 values
- target/loongarch: Remove avail_64 in trans_srai_w() and simplify it
- target/loongarch/kvm: Add software breakpoint support
- target/loongarch: Add loongarch vector property unconditionally
- target/loongarch/kvm: Fix VM recovery from disk failures
- target/loongarch: Put cpucfg operation before CSR register
- target/loongarch: Add TCG macro in structure CPUArchState
- hw/arm/virt-acpi-build.c: Migrate SPCR creation to common location
- hw/loongarch/virt: Add FDT table support with acpi ged pm register
- hw/loongarch/virt: Add description for virt machine type
- hw/loongarch: Add acpi SPCR table support
- hw/loongarch: virt: pass random seed to fdt
- hw/loongarch: virt: support up to 4 serial ports
- hw/loongarch: Remove default enable with VIRTIO_VGA device
- hw/loongarch: Fix length for lowram in ACPI SRAT
- hw/loongarch/virt: Remove unused assignment
- hw/loongarch: Change the tpm support by default
- hw/loongarch/boot.c: fix out-of-bound reading
- hw/loongarch/virt: Use MemTxAttrs interface for misc ops
- tests/libqos: Add loongarch virt machine node
- hw/loongarch: Remove minimum and default memory size
- hw/loongarch: Refine system dram memory region
- hw/loongarch: Refine fwcfg memory map
- hw/loongarch: Refine fadt memory table for numa memory
- hw/loongarch: Refine acpi srat table for numa memory
- hw/loongarch: Add VM mode in IOCSR feature register in kvm mode
- hw/loongarch: Refine default numa id calculation
- hw/loongarch: Rename LoongArchMachineState with LoongArchVirtMachineState
- hw/loongarch: Rename LOONGARCH_MACHINE with LOONGARCH_VIRT_MACHINE
- hw/loongarch: move memory map to boot.c
- loongarch: switch boards to "default y"
- hw/loongarch: Add cells missing from rtc node
- hw/loongarch: Add cells missing from uart node
- hw/loongarch: fdt remove unused irqchip node
- hw/loongarch: fdt adds pcie irq_map node
- hw/loongarch: fdt adds pch_msi Controller
- hw/loongarch: fdt adds pch_pic Controller
- hw/loongarch: fdt adds Extend I/O Interrupt Controller
- hw/loongarch: fdt adds cpu interrupt controller node
- hw/loongarch: Init efi_fdt table
- hw/loongarch: Init efi_initrd table
- hw/loongarch: Init efi_boot_memmap table
- hw/loongarch: Init efi_system_table
- hw/loongarch: Add init_cmdline
- hw/loongarch: Add slave cpu boot_code
- hw/loongarch: Add load initrd
- hw/loongarch: Move boot functions to boot.c
Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
(cherry picked from commit 04ca9e6c8ff19630116722240ae0136cea831c5c)
94 lines
3.0 KiB
Diff
94 lines
3.0 KiB
Diff
From 7efd5d829730d0481659cda91f725df3b141f469 Mon Sep 17 00:00:00 2001
|
|
From: Salil Mehta <salil.mehta@huawei.com>
|
|
Date: Tue, 16 Jul 2024 12:15:01 +0100
|
|
Subject: [PATCH 66/78] physmem: Add helper function to destroy CPU
|
|
AddressSpace
|
|
|
|
Virtual CPU Hot-unplug leads to unrealization of a CPU object. This also
|
|
involves destruction of the CPU AddressSpace. Add common function to help
|
|
destroy the CPU AddressSpace.
|
|
|
|
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
|
|
Tested-by: Vishnu Pajjuri <vishnu@os.amperecomputing.com>
|
|
Reviewed-by: Gavin Shan <gshan@redhat.com>
|
|
Tested-by: Xianglai Li <lixianglai@loongson.cn>
|
|
Tested-by: Miguel Luis <miguel.luis@oracle.com>
|
|
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
|
|
Tested-by: Zhao Liu <zhao1.liu@intel.com>
|
|
Acked-by: Igor Mammedov <imammedo@redhat.com>
|
|
Message-Id: <20240716111502.202344-7-salil.mehta@huawei.com>
|
|
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
|
|
---
|
|
include/hw/core/cpu.h | 4 ++--
|
|
system/physmem.c | 18 +++++++++++-------
|
|
2 files changed, 13 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
|
|
index ee04ee44c2..37f3a469c8 100644
|
|
--- a/include/hw/core/cpu.h
|
|
+++ b/include/hw/core/cpu.h
|
|
@@ -495,8 +495,8 @@ struct CPUState {
|
|
QemuMutex work_mutex;
|
|
QSIMPLEQ_HEAD(, qemu_work_item) work_list;
|
|
|
|
- CPUAddressSpace *cpu_ases;
|
|
- int cpu_ases_ref_count;
|
|
+ struct CPUAddressSpace *cpu_ases;
|
|
+ int cpu_ases_count;
|
|
int num_ases;
|
|
AddressSpace *as;
|
|
MemoryRegion *memory;
|
|
diff --git a/system/physmem.c b/system/physmem.c
|
|
index 2c8b83f811..c50ac24786 100644
|
|
--- a/system/physmem.c
|
|
+++ b/system/physmem.c
|
|
@@ -761,7 +761,7 @@ void cpu_address_space_init(CPUState *cpu, int asidx,
|
|
|
|
if (!cpu->cpu_ases) {
|
|
cpu->cpu_ases = g_new0(CPUAddressSpace, cpu->num_ases);
|
|
- cpu->cpu_ases_ref_count = cpu->num_ases;
|
|
+ cpu->cpu_ases_count = cpu->num_ases;
|
|
}
|
|
|
|
newas = &cpu->cpu_ases[asidx];
|
|
@@ -779,24 +779,28 @@ void cpu_address_space_destroy(CPUState *cpu, int asidx)
|
|
{
|
|
CPUAddressSpace *cpuas;
|
|
|
|
- assert(asidx < cpu->num_ases);
|
|
- assert(asidx == 0 || !kvm_enabled());
|
|
assert(cpu->cpu_ases);
|
|
+ assert(asidx >= 0 && asidx < cpu->num_ases);
|
|
+ /* KVM cannot currently support multiple address spaces. */
|
|
+ assert(asidx == 0 || !kvm_enabled());
|
|
|
|
cpuas = &cpu->cpu_ases[asidx];
|
|
if (tcg_enabled()) {
|
|
memory_listener_unregister(&cpuas->tcg_as_listener);
|
|
}
|
|
|
|
- cpuas->as->free_in_rcu = true;
|
|
address_space_destroy(cpuas->as);
|
|
+ g_free_rcu(cpuas->as, rcu);
|
|
|
|
- if (cpu->cpu_ases_ref_count == 1) {
|
|
+ if (asidx == 0) {
|
|
+ /* reset the convenience alias for address space 0 */
|
|
+ cpu->as = NULL;
|
|
+ }
|
|
+
|
|
+ if (--cpu->cpu_ases_count == 0) {
|
|
g_free(cpu->cpu_ases);
|
|
cpu->cpu_ases = NULL;
|
|
}
|
|
-
|
|
- cpu->cpu_ases_ref_count--;
|
|
}
|
|
|
|
AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx)
|
|
--
|
|
2.39.1
|
|
|