[PATCH v2 10/10] hw/intc/loongarch_extioi: Code cleanup about loongarch_extioi

2024-11-08 Thread Bibo Mao
Remove definition about LoongArchExtIOI and LOONGARCH_EXTIOI, and replace them with LoongArchExtIOICommonState and macro LOONGARCH_EXTIOI_COMMON separately. Also remove unnecessary header files. Signed-off-by: Bibo Mao --- hw/intc/loongarch_extioi.c | 31

[PATCH v2 07/10] hw/intc/loongarch_extioi: Add common file loongarch_extioi_common

2024-11-08 Thread Bibo Mao
Add new common file loongarch_extioi_common.c, and move vmstate and property structure to common file. Signed-off-by: Bibo Mao --- hw/intc/loongarch_extioi.c| 59 + hw/intc/loongarch_extioi_common.c | 63 +++ 2 files changed, 65

[PATCH v2 03/10] include: Rename LoongArchExtIOI with LoongArchExtIOICommonState

2024-11-08 Thread Bibo Mao
Rename structure LoongArchExtIOI with LoongArchExtIOICommonState, since it is defined in file loongarch_extioi_common.h Signed-off-by: Bibo Mao --- include/hw/intc/loongarch_extioi.h| 1 + include/hw/intc/loongarch_extioi_common.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion

[PATCH v2 00/10] hw/intc/loongarch_extioi: Split into common and extioi

2024-11-08 Thread Bibo Mao
LoongArch extioi kvm driver can inherit from extioi common driver. --- v1 ... v2: 1. Remove unused element parent_unrealize in structure LoongArchExtIOICommonClass to solve the compile and make check issue --- Bibo Mao (10): include: Add loongarch_extioi_common header file include: Move

[PATCH v2 05/10] hw/intc/loongarch_extioi: Add common realize interface

2024-11-08 Thread Bibo Mao
Add common realize function, it is only to check validity of property. Signed-off-by: Bibo Mao --- hw/intc/loongarch_extioi.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/hw/intc/loongarch_extioi.c b/hw/intc/loongarch_extioi.c index 409d4a85da

[PATCH v2 01/10] include: Add loongarch_extioi_common header file

2024-11-08 Thread Bibo Mao
Add common header file include/hw/intc/loongarch_extioi_common.h, and move some macro definition from include/hw/intc/loongarch_extioi.h to the common header file. Signed-off-by: Bibo Mao --- include/hw/intc/loongarch_extioi.h| 50 +-- include/hw/intc

[PATCH v2 08/10] hw/intc/loongarch_extioi: Inherit from loongarch_extioi_common

2024-11-08 Thread Bibo Mao
Set TYPE_LOONGARCH_EXTIOI inherit from TYPE_LOONGARCH_EXTIOI_COMMON object, it shares vmsate and property of TYPE_LOONGARCH_EXTIOI_COMMON, and has its own realize() function. Signed-off-by: Bibo Mao --- hw/intc/loongarch_extioi.c| 37 ++--- hw/intc

[PATCH v2 06/10] hw/intc/loongarch_extioi: Add unrealize interface

2024-11-08 Thread Bibo Mao
For loongarch extioi emulation driver, add unrealize interface and remove instance_finalize interface and move the code to unrealize interface. Signed-off-by: Bibo Mao --- hw/intc/loongarch_extioi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/intc

[PATCH v2 02/10] include: Move struct LoongArchExtIOI to header file loongarch_extioi_common

2024-11-08 Thread Bibo Mao
Move definiton of structure LoongArchExtIOI from header file loongarch_extioi.h to file loongarch_extioi_common.h. Signed-off-by: Bibo Mao --- include/hw/intc/loongarch_extioi.h| 26 -- include/hw/intc/loongarch_extioi_common.h | 27 +++ 2 files

[PATCH v2 04/10] hw/intc/loongarch_extioi: Rename LoongArchExtIOI with LoongArchExtIOICommonState

2024-11-08 Thread Bibo Mao
With some structure such as vmstate and property, rename LoongArchExtIOI with LoongArchExtIOICommonState, these common structure will be moved to common file. Signed-off-by: Bibo Mao --- hw/intc/loongarch_extioi.c | 41 +++--- 1 file changed, 25 insertions(+), 16

[PATCH v2 09/10] hw/intc/loongarch_extioi: Add pre_save interface

2024-11-08 Thread Bibo Mao
Add vmstate pre_save interface, which can be used extioi kvm driver in future. Signed-off-by: Bibo Mao --- hw/intc/loongarch_extioi_common.c | 13 + include/hw/intc/loongarch_extioi_common.h | 1 + 2 files changed, 14 insertions(+) diff --git a/hw/intc

[PATCH v3 4/5] hw/loongarch/virt: Update the ACPI table for hotplug cpu

2024-11-03 Thread Bibo Mao
On LoongArch virt machine, ACPI GED hardware is used for CPU hotplug handler, here CPU hotplug support feature is added based on GED handler, also CPU scan and reject method is added about CPU device in DSDT table. Co-developed-by: Xianglai Li Signed-off-by: Bibo Mao --- hw/loongarch/Kconfig

[PATCH v3 1/5] hw/loongarch/virt: Add CPU topology support

2024-11-03 Thread Bibo Mao
information. Co-developed-by: Xianglai Li Signed-off-by: Bibo Mao --- docs/system/loongarch/virt.rst | 31 hw/loongarch/virt.c| 67 -- target/loongarch/cpu.c | 12 ++ target/loongarch/cpu.h | 17 + 4 files

[PATCH v3 3/5] hw/loongarch/virt: Add generic function to init interrupt pin of CPU

2024-11-03 Thread Bibo Mao
Here generic function virt_init_cpu_irq() is added to init interrupt pin of CPU object, IPI and extioi interrupt controllers are connected to interrupt pin of CPU object. The generic function can be used to both cold-plug and hot-plug CPUs. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 76

[PATCH v3 2/5] hw/loongarch/virt: Implement cpu plug interface

2024-11-03 Thread Bibo Mao
Add cpu hotplug interface, however cpu hotplug feature is still disabled for the machine. When machine is on, all created vCPUs go through hotplug interface, and there is no remaining vCPU which can be hot-added after power on. Co-developed-by: Xianglai Li Signed-off-by: Bibo Mao --- hw

[PATCH v3 0/5] hw/loongarch/virt: Add cpu hotplug support

2024-11-03 Thread Bibo Mao
patches. --- Bibo Mao (5): hw/loongarch/virt: Add CPU topology support hw/loongarch/virt: Implement cpu plug interface hw/loongarch/virt: Add generic function to init interrupt pin of CPU hw/loongarch/virt: Update the ACPI table for hotplug cpu hw/loongarch/virt: Enable cpu hotplug

[PATCH v3 5/5] hw/loongarch/virt: Enable cpu hotplug feature on virt machine

2024-11-03 Thread Bibo Mao
Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 57 + include/hw/loongarch/virt.h | 2 ++ 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index e73f689c83..6673493109 100644 --- a/hw/loongarch

[PATCH] hw/loongarch/virt: Add reset interface for virt-machine

2024-10-31 Thread Bibo Mao
requirement is called. Signed-off-by: Bibo Mao --- hw/loongarch/boot.c | 9 + hw/loongarch/virt.c | 14 ++ include/hw/loongarch/boot.h | 1 + target/loongarch/cpu.c | 10 ++ 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/hw/loongarch

[PATCH v2 4/4] hw/loongarch/virt: Enable cpu hotplug feature on virt machine

2024-10-29 Thread Bibo Mao
Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 68 ++--- include/hw/loongarch/virt.h | 2 ++ 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index 655312b0fe..cecb12786b 100644 --- a/hw/loongarch

[PATCH v2 0/4] hw/loongarch/virt: Add cpu hotplug support

2024-10-29 Thread Bibo Mao
-added CPUs. The two properties can be generated from each other. 2. Use general hotplug api such as hotplug_handler_pre_plug etc 3. Reorganize the patch order, split the patch set into 4 small patches. --- Bibo Mao (4): hw/loongarch/virt: Add CPU topology support hw/loongarch/virt

[PATCH v2 1/4] hw/loongarch/virt: Add CPU topology support

2024-10-29 Thread Bibo Mao
Add topological relationship for Loongarch VCPU and initialize topology member variables, the topo information includes socket-id, core-id and thread-id. And its physical cpu id is calculated from topo information. Co-developed-by: Xianglai Li Signed-off-by: Bibo Mao --- docs/system/loongarch

[PATCH v2 3/4] hw/loongarch/virt: Update the ACPI table for hotplug cpu

2024-10-29 Thread Bibo Mao
On LoongArch virt machine, ACPI GED hardware is used for cpu hotplug, here cpu hotplug support feature is added on GED device, also cpu scan and reject method is added about CPU device in DSDT table. Co-developed-by: Xianglai Li Signed-off-by: Bibo Mao --- hw/loongarch/Kconfig| 1

[PATCH v2 2/4] hw/loongarch/virt: Implement cpu plug interface

2024-10-29 Thread Bibo Mao
Add cpu hotplug interface, however cpu hotplug feature is still disabled for the machine. When machine is on, all created vCPUs go through hotplug interface, and there is no remaining vCPU which can be hot-added after power on. Co-developed-by: Xianglai Li Signed-off-by: Bibo Mao --- hw

[PATCH v2] hw/intc/loongarch_ipi: Add safer check about cpu

2024-10-28 Thread Bibo Mao
, archid->cpu will be NULL. Signed-off-by: Bibo Mao --- v1 ... v2: 1. since physical cpuid is the same with cpu_index when cpu_index is set again as index of possible_cpus. Remove phy_id set about CSR_CPUID in function loongarch_cpu_reset_hold() --- hw/intc/loongarch_ipi.c

[PATCH v3 0/3] linux-headers: Update to Linux v6.12-rc5

2024-10-27 Thread Bibo Mao
to Linux v6.12-rc5 v1 ... v2: 1. update header files in directory linux-headers to v6.12-rc3 --- Bibo Mao (3): linux-headers: Add unistd_64.h linux-headers: loongarch: Add kvm_para.h linux-headers: Update to Linux v6.12-rc5 include/standard-headers/drm/drm_fourcc.h | 43 +++ include

[PATCH v3 2/3] linux-headers: loongarch: Add kvm_para.h

2024-10-27 Thread Bibo Mao
KVM LBT supports on LoongArch depends on the linux-header file kvm_para.h, add header file kvm_para.h here. Signed-off-by: Bibo Mao --- scripts/update-linux-headers.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh index

[PATCH v3 3/3] linux-headers: Update to Linux v6.12-rc5

2024-10-27 Thread Bibo Mao
update linux-headers to v6.12-rc5. Pass to compile on aarch64, arm, loongarch64, x86_64, i386, riscv64,riscv32 softmmu and linux-user. Signed-off-by: Bibo Mao --- include/standard-headers/drm/drm_fourcc.h | 43 +++ include/standard-headers/linux/const.h| 17 + include/standard

[PATCH v3 1/3] linux-headers: Add unistd_64.h

2024-10-27 Thread Bibo Mao
file or directory #include Signed-off-by: Bibo Mao --- scripts/update-linux-headers.sh | 6 ++ 1 file changed, 6 insertions(+) diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh index c34ac6454e..203f48d089 100755 --- a/scripts/update-linux-headers.sh +++ b

Re: [PULL 0/6] loongarch-to-apply queue

2024-10-26 Thread bibo mao
t; > > target/loongarch: Add steal time support on migration (2024-10-24 > > 17:27:55 +0800) > > > > ---- > > pull-loongarch-20241024 > > > > --

[PATCH 2/3] hw/loongarch/virt: Add basic CPU plug support

2024-10-23 Thread Bibo Mao
Implement interface for cpu hotplug function, and enable cpu hotplug feature on virt machine. Co-developed-by: Xianglai Li Signed-off-by: Bibo Mao --- hw/loongarch/Kconfig| 1 + hw/loongarch/virt.c | 191 +++- include/hw/loongarch/virt.h | 2

[PATCH 3/3] hw/loongarch/virt: Update the ACPI table for hotplug cpu

2024-10-23 Thread Bibo Mao
On LoongArch virt machine, ACPI GED hardware is used for cpu hotplug, here cpu hotplug support feature is added on GED device, also cpu scan and reject method is added about CPU device in DSDT table. Co-developed-by: Xianglai Li Signed-off-by: Bibo Mao --- hw/loongarch/acpi-build.c | 35

[PATCH 0/3] hw/loongarch/virt: Add cpu hotplug support

2024-10-23 Thread Bibo Mao
can be added or remove with hmp command: device_add la464-loongarch-cpu,socket-id=0,core-id=2,thread-id=0,id=cpu-2 device_del cpu-2 Bibo Mao (3): hw/loongarch/virt: Add CPU topology support hw/loongarch/virt: Add basic CPU plug support hw/loongarch/virt: Update the ACPI table for hotplug

[PATCH 1/3] hw/loongarch/virt: Add CPU topology support

2024-10-23 Thread Bibo Mao
Add topological relationships for Loongarch VCPU and initialize topology member variables. Also physical cpu id calculation method comes from its topo information. Co-developed-by: Xianglai Li Signed-off-by: Bibo Mao --- docs/system/loongarch/virt.rst | 31 + hw/loongarch/virt.c

[PATCH] target/loongarch: Use physical cpu id about CSR CPUID for sysemu

2024-10-22 Thread Bibo Mao
For user tcg, there is no physical cpu id provided and logic cpuid is used. For system emulation, physical cpu id is provided, initial value of register CSR CPUID can be set from physical cpu id. Signed-off-by: Bibo Mao --- hw/intc/loongarch_ipi.c | 3 ++- target/loongarch/cpu.c

[PATCH v2 2/2] linux-headers: Update to Linux v6.12-rc3

2024-10-16 Thread Bibo Mao
This update contains the required header changes for LoongArch KVM LBT feature. Signed-off-by: Bibo Mao --- include/standard-headers/drm/drm_fourcc.h | 43 +++ include/standard-headers/linux/const.h| 17 + include/standard-headers/linux/ethtool.h | 226 + include

[PATCH v2 0/2] linux-headers: loongarch: Add kvm_para.h and unistd_64.h

2024-10-16 Thread Bibo Mao
linux-headers/asm/unistd.h:3:10: fatal error: asm/unistd_64.h: No such file or directory #include Also update linux-headers to v6.12-rc3 --- v1 ... v2: 1. update header files in directory linux-headers to v6.12-rc3 --- Bibo Mao (2): linux-headers: loongarch: Add kvm_para.h and unistd_64.h

[PATCH v2 1/2] linux-headers: loongarch: Add kvm_para.h and unistd_64.h

2024-10-16 Thread Bibo Mao
Signed-off-by: Bibo Mao --- scripts/update-linux-headers.sh | 4 1 file changed, 4 insertions(+) diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh index c34ac6454e..3c411f0318 100755 --- a/scripts/update-linux-headers.sh +++ b/scripts/update-linux-headers.sh @@ -186,6

[PATCH v2] target/loongarch: Add steal time support on migration

2024-09-30 Thread Bibo Mao
With pv steal time supported, VM machine needs get physical address of each vcpu and notify new host during migration. Here two functions kvm_get_stealtime/kvm_set_stealtime, and guest steal time physical address is only updated on KVM_PUT_FULL_STATE stage. Signed-off-by: Bibo Mao --- v1 ... v2

[PATCH] linux-headers: loongarch: add kvm_para.h and unistd_64.h

2024-09-29 Thread Bibo Mao
KVM LBT supports on LoongArch requires the linux-header kvm_para.h, also unistd_64.h is required by unistd.h on LoongArch since 6.11 Signed-off-by: Bibo Mao --- scripts/update-linux-headers.sh | 4 1 file changed, 4 insertions(+) diff --git a/scripts/update-linux-headers.sh b/scripts

[PATCH v5 1/2] target/loongarch: Add loongson binary translation feature

2024-09-29 Thread Bibo Mao
is added with OnOffAuto type, If lbt feature is not supported with KVM host, it reports error if there is lbt=on command line. If there is no any command line about lbt parameter, it checks whether KVM host supports lbt feature and set the corresponding value in cpucfg. Signed-off-by: Bibo Mao

[PATCH v5 2/2] target/loongarch: Implement lbt registers save/restore function

2024-09-29 Thread Bibo Mao
Six registers scr0 - scr3, eflags and ftop are added in percpu vmstate. And two functions kvm_loongarch_get_lbt/kvm_loongarch_put_lbt are added to save/restore lbt registers. Signed-off-by: Bibo Mao --- target/loongarch/cpu.h | 12 target/loongarch/kvm/kvm.c | 62

[PATCH v5 0/2] target/loongarch: Add loongson binary translation feature

2024-09-29 Thread Bibo Mao
LBT register saving and restoring in vmstate 2. Add two pseudo feature flags: default_features and forced_features --- Bibo Mao (2): target/loongarch: Add loongson binary translation feature target/loongarch: Implement lbt registers save/restore function target/loongarch/cpu.c

[PATCH 00/10] hw/intc/loongarch_extioi: Split into extioi common and extioi

2024-09-20 Thread Bibo Mao
LoongArch extioi kvm driver can inherit from extioi common driver. Bibo Mao (10): include: Add loongarch_extioi_common header file include: Move struct LoongArchExtIOI to header file loongarch_extioi_common include: Rename LoongArchExtIOI with LoongArchExtIOICommonState hw/intc

[PATCH 04/10] hw/intc/loongarch_extioi: Rename LoongArchExtIOI with LoongArchExtIOICommonState

2024-09-20 Thread Bibo Mao
With some structure such as vmstate and property, rename LoongArchExtIOI with LoongArchExtIOICommonState, these common structure will be moved to common file. Signed-off-by: Bibo Mao --- hw/intc/loongarch_extioi.c | 41 +++--- 1 file changed, 25 insertions(+), 16

[PATCH 06/10] hw/intc/loongarch_extioi: Add unrealize interface

2024-09-20 Thread Bibo Mao
For loongarch extioi emulation driver, add unrealize interface and remove instance_finalize interface and move the code to unrealize interface. Signed-off-by: Bibo Mao --- hw/intc/loongarch_extioi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/intc

[PATCH 03/10] include: Rename LoongArchExtIOI with LoongArchExtIOICommonState

2024-09-20 Thread Bibo Mao
Rename structure LoongArchExtIOI with LoongArchExtIOICommonState, since it is defined in file loongarch_extioi_common.h Signed-off-by: Bibo Mao --- include/hw/intc/loongarch_extioi.h| 1 + include/hw/intc/loongarch_extioi_common.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion

[PATCH 10/10] hw/intc/loongarch_extioi: Code cleanup about loongarch_extioi

2024-09-20 Thread Bibo Mao
Remove definition about LoongArchExtIOI and LOONGARCH_EXTIOI, and replace them with LoongArchExtIOICommonState and macro LOONGARCH_EXTIOI_COMMON separately. Also remove unnecessary header files. Signed-off-by: Bibo Mao --- hw/intc/loongarch_extioi.c | 31

[PATCH 01/10] include: Add loongarch_extioi_common header file

2024-09-20 Thread Bibo Mao
Add common header file include/hw/intc/loongarch_extioi_common.h, and move some macro definition from include/hw/intc/loongarch_extioi.h to the common header file. Signed-off-by: Bibo Mao --- include/hw/intc/loongarch_extioi.h| 50 +-- include/hw/intc

[PATCH 08/10] hw/intc/loongarch_extioi: Inherit from loongarch_extioi_common

2024-09-20 Thread Bibo Mao
Set TYPE_LOONGARCH_EXTIOI inherit from TYPE_LOONGARCH_EXTIOI_COMMON object, it shares vmsate and property of TYPE_LOONGARCH_EXTIOI_COMMON, and has its own realize() function. Signed-off-by: Bibo Mao --- hw/intc/loongarch_extioi.c| 37 ++--- hw/intc

[PATCH 09/10] hw/intc/loongarch_extioi: Add pre_save interface

2024-09-20 Thread Bibo Mao
Add vmstate pre_save interface, which can be used extioi kvm driver in future. Signed-off-by: Bibo Mao --- hw/intc/loongarch_extioi_common.c | 13 + include/hw/intc/loongarch_extioi_common.h | 1 + 2 files changed, 14 insertions(+) diff --git a/hw/intc

[PATCH 05/10] hw/intc/loongarch_extioi: Add common realize interface

2024-09-20 Thread Bibo Mao
Add common realize function, it is only to check validity of property. Signed-off-by: Bibo Mao --- hw/intc/loongarch_extioi.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hw/intc/loongarch_extioi.c b/hw/intc/loongarch_extioi.c index 409d4a85da

[PATCH 07/10] hw/intc/loongarch_extioi: Add common file loongarch_extioi_common

2024-09-20 Thread Bibo Mao
Add new common file loongarch_extioi_common.c, and move vmstate and property structure to common file. Signed-off-by: Bibo Mao --- hw/intc/loongarch_extioi.c| 60 + hw/intc/loongarch_extioi_common.c | 63 +++ 2 files changed, 65

[PATCH 02/10] include: Move struct LoongArchExtIOI to header file loongarch_extioi_common

2024-09-20 Thread Bibo Mao
Move definiton of structure LoongArchExtIOI from header file loongarch_extioi.h to file loongarch_extioi_common.h. Signed-off-by: Bibo Mao --- include/hw/intc/loongarch_extioi.h| 26 -- include/hw/intc/loongarch_extioi_common.h | 27 +++ 2 files

[PATCH] target/loongarch/kvm: Implement LoongArch PMU extension

2024-09-18 Thread Bibo Mao
the PMU Feature and set the corresponding value in cpucfg. This patch is based on lbt patch located at https://lore.kernel.org/qemu-devel/20240904061859.86615-1-maob...@loongson.cn Co-developed-by: Song Gao Signed-off-by: Bibo Mao --- target/loongarch/cpu.c| 19

[PATCH v2 4/8] hw/intc/loongarch_pch: Rename LoongArchPCHPIC with LoongArchPICCommonState

2024-09-17 Thread Bibo Mao
With pic vmstate, rename structure name vmstate_loongarch_pch_pic with vmstate_loongarch_pic_common, and with pic property rename loongarch_pch_pic_properties with loongarch_pic_common_properties. Signed-off-by: Bibo Mao --- hw/intc/loongarch_pch_pic.c | 52

[PATCH v2 2/8] include: Move struct LoongArchPCHPIC to loongarch_pic_common header file

2024-09-17 Thread Bibo Mao
Move structure LoongArchPCHPIC from header file loongarch_pch_pic.h to file loongarch_pic_common.h, and rename structure name with LoongArchPICCommonState. Signed-off-by: Bibo Mao --- include/hw/intc/loongarch_pch_pic.h| 27 + include/hw/intc/loongarch_pic_common.h

[PATCH v2 5/8] hw/intc/loongarch_pch: Move some functions to file loongarch_pic_common

2024-09-17 Thread Bibo Mao
Move some common functions to file loongarch_pic_common.c, the common functions include loongarch_pic_common_realize(), property structure loongarch_pic_common_properties and vmstate structure vmstate_loongarch_pic_common. Signed-off-by: Bibo Mao --- hw/intc/loongarch_pch_pic.c| 37

[PATCH v2 7/8] hw/intc/loongarch_pch: Add pre_save and post_load interfaces

2024-09-17 Thread Bibo Mao
Add vmstate pre_save and post_load interfaces, which can be used by pic kvm driver in future. Signed-off-by: Bibo Mao --- hw/intc/loongarch_pic_common.c | 26 ++ include/hw/intc/loongarch_pic_common.h | 2 ++ 2 files changed, 28 insertions(+) diff --git a/hw

[PATCH v2 6/8] hw/intc/loongarch_pch: Inherit from loongarch_pic_common

2024-09-17 Thread Bibo Mao
Set TYPE_LOONGARCH_PIC inherit from TYPE_LOONGARCH_PIC_COMMON object, it shares vmsate and property of TYPE_LOONGARCH_PIC_COMMON, and has its own realize() function. Signed-off-by: Bibo Mao --- hw/intc/loongarch_pch_pic.c| 38 -- hw/intc

[PATCH v2 1/8] include: Add loongarch_pic_common header file

2024-09-17 Thread Bibo Mao
Add common header file hw/intc/loongarch_pic_common.h, and move some macro definition from hw/intc/loongarch_pch_pic.h to the common header file. Signed-off-by: Bibo Mao --- include/hw/intc/loongarch_pch_pic.h| 36 +++--- include/hw/intc/loongarch_pic_common.h | 42

[PATCH v2 8/8] hw/intc/loongarch_pch: Code cleanup about loongarch_pch_pic

2024-09-17 Thread Bibo Mao
Remove definition about LoongArchPCHPIC and LOONGARCH_PCH_PIC, and replace them with LoongArchPICCommonState and LOONGARCH_PIC_COMMON separately. Also remove unnecessary header files. Signed-off-by: Bibo Mao --- hw/intc/loongarch_pch_pic.c | 24 ++-- hw/loongarch

[PATCH v2 0/8] hw/intc/loongarch_pch: Split into pic common and pic

2024-09-17 Thread Bibo Mao
driver can inherit from pic common driver. --- v1 ... v2: 1. Reorganize the patchset, put macro and structure moving patch as first one 2. Split the patchset with smaller patch, so that it is easier to review --- Bibo Mao (8): include: Add loongarch_pic_common header file include: Move

[PATCH v2 3/8] hw/intc/loongarch_pch: Merge instance_init() into realize()

2024-09-17 Thread Bibo Mao
Memory region is created in instance_init(), merge it into function realize(). There is no special class_init() for loongarch_pch object. Signed-off-by: Bibo Mao --- hw/intc/loongarch_pch_pic.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/hw/intc

[PATCH v3 0/2] Add FDT table support with acpi ged pm register

2024-09-17 Thread Bibo Mao
: 1. Modify name of macro for acpi ged register from ACPI spec, and also add comments for macro definition. --- Bibo Mao (2): acpi: ged: Add macro for acpi sleep control register hw/loongarch/virt: Add FDT table support with acpi ged pm register hw/acpi/generic_event_device.c

[PATCH v3 1/2] acpi: ged: Add macro for acpi sleep control register

2024-09-17 Thread Bibo Mao
Macro definition is added for acpi sleep control register, ged emulation driver can use the macro , also it can be used in FDT table if ged is exposed with FDT table. Signed-off-by: Bibo Mao --- hw/acpi/generic_event_device.c | 6 +++--- include/hw/acpi/generic_event_device.h | 7

[PATCH v3 2/2] hw/loongarch/virt: Add FDT table support with acpi ged pm register

2024-09-17 Thread Bibo Mao
syscon method in FDT table, only that acpi ged pm register is accessed with 8-bit mode, rather with 32-bit mode. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 39 +++ 1 file changed, 39 insertions(+) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index

[PATCH v2] target/loongarch: Avoid bits shift exceeding width of bool type

2024-09-13 Thread Bibo Mao
ump fp registers into coredump note segment. Resolves: Coverity CID 1561133 Signed-off-by: Bibo Mao Reviewed-by: Richard Henderson --- target/loongarch/arch_dump.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/target/loongarch/arch_dump.c b/target/loongarch/arch_dum

[PATCH] target/loongarch: Avoid shifting with bool type variable

2024-09-13 Thread Bibo Mao
Variable env->cf[i] is defined as bool type, it cannot be used with left shifting operation. There is existing api read_fcc(), it can be used when dumping fp registers into coredump note segment. Resolves: Coverity CID 1561133 Signed-off-by: Bibo Mao --- target/loongarch/arch_dump.c

[PATCH] hw/loongarch/virt: Add description for virt machine type

2024-09-13 Thread Bibo Mao
ngArch IPI) Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index 29040422aa..8e80110b24 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -1390,6 +1390,7 @@ static void virt_class_init(Objec

[PATCH 2/5] hw/intc/loongarch_pch: Merge instance_init() into realize()

2024-09-11 Thread Bibo Mao
From: bibo mao Memory region is created in instance_init(), merge it into function realize(). There is no special class_init() for loongarch_pch object. Signed-off-by: Bibo Mao --- hw/intc/loongarch_pch_pic.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git

[PATCH 5/5] hw/intc/loongarch_pch: Cleanup loongarch_pch_pic

2024-09-11 Thread Bibo Mao
From: bibo mao Remove definition about LoongArchPCHPIC and LOONGARCH_PCH_PIC, and replace them with LoongArchPICCommonState and LOONGARCH_PIC_COMMON separately. Also remove unnecessary header files. Signed-off-by: Bibo Mao --- hw/intc/loongarch_pch_pic.c | 24

[PATCH 0/5] hw/intc/loongarch_pch: Split into pic common and

2024-09-11 Thread Bibo Mao
driver can inherit from pic common driver. bibo mao (5): hw/intc/loongarch_pic: Add loongarch pch pic common driver hw/intc/loongarch_pch: Merge instance_init() into realize() include: Add loongarch_pic_common header file hw/intc/loongarch_pch: Inherit from loongarch_pic_common hw/intc

[PATCH 4/5] hw/intc/loongarch_pch: Inherit from loongarch_pic_common

2024-09-11 Thread Bibo Mao
From: bibo mao Set TYPE_LOONGARCH_PIC inherit from TYPE_LOONGARCH_PIC_COMMON object, it shares vmsate and property of TYPE_LOONGARCH_PIC_COMMON, and has its own realize() function. Signed-off-by: Bibo Mao --- hw/intc/loongarch_pch_pic.c | 65 + hw/intc

[PATCH 3/5] include: Add loongarch_pic_common header file

2024-09-11 Thread Bibo Mao
From: bibo mao For header file hw/intc/loongarch_pch_pic.h, add common file hw/intc/loongarch_pic_common.h and remove duplicated macro definition in file loongarch_pch_pic.h Signed-off-by: Bibo Mao --- include/hw/intc/loongarch_pch_pic.h | 36 + 1 file changed, 6

[PATCH 1/5] hw/intc/loongarch_pic: Add loongarch pch pic common driver

2024-09-11 Thread Bibo Mao
From: bibo mao Add pch pic common driver, so that it can be shared with KVM and TCG driver, put vmstate and property, vmstate load and store interface in this pic common driver. Signed-off-by: Bibo Mao --- hw/intc/loongarch_pic_common.c | 97 ++ include/hw/intc

[PATCH v2 0/2] Add FDT table support with acpi ged pm register

2024-09-10 Thread Bibo Mao
syscon method in FDT table, only that acpi ged pm register is accessed with 8-bit mode, rather with 32-bit mode. --- v1 ... v2: 1. Modify name of macro for acpi ged register from ACPI spec, and also add comments for macro definition. --- Bibo Mao (2): acpi: ged: Add macro for acpi sleep control

[PATCH v2 2/2] hw/loongarch/virt: Add FDT table support with acpi ged pm register

2024-09-10 Thread Bibo Mao
syscon method in FDT table, only that acpi ged pm register is accessed with 8-bit mode, rather with 32-bit mode. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 39 +++ 1 file changed, 39 insertions(+) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index

[PATCH v2 1/2] acpi: ged: Add macro for acpi sleep control register

2024-09-10 Thread Bibo Mao
Macro definition is added for acpi sleep control register, so that ged emulation driver can use this, also it can be used in FDT table if ged is exposed with FDT table. Signed-off-by: Bibo Mao --- hw/acpi/generic_event_device.c | 6 +++--- hw/i386/acpi-microvm.c | 2

[PATCH] hw/loongarch: Add acpi SPCR table support

2024-09-07 Thread Bibo Mao
Signed-off-by: Bibo Mao --- hw/loongarch/acpi-build.c | 40 +++ 1 file changed, 40 insertions(+) diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c index 2638f87434..3912c8d307 100644 --- a/hw/loongarch/acpi-build.c +++ b/hw/loongarch/acpi-build.c

[PATCH 0/2] Add FDT table support with acpi ged pm register

2024-09-05 Thread Bibo Mao
syscon method in FDT table, only that acpi ged pm register is accessed with 8-bit mode, rather in 32-bit mode. Bibo Mao (2): acpi: ged: Add macro for acpi ged sleep register hw/loongarch/virt: Add FDT table support with acpi ged pm register hw/acpi/generic_event_device.c | 6 ++-- hw

[PATCH 1/2] acpi: ged: Add macro for acpi ged sleep register

2024-09-05 Thread Bibo Mao
Macro definition is added for acpi ged sleep register, so that ged emulation driver can use this, also it can be used in FDT table if ged is exposed with FDT table. Signed-off-by: Bibo Mao --- hw/acpi/generic_event_device.c | 6 +++--- include/hw/acpi/generic_event_device.h | 3 +++ 2

[PATCH 2/2] hw/loongarch/virt: Add FDT table support with acpi ged pm register

2024-09-05 Thread Bibo Mao
syscon method in FDT table, only that acpi ged pm register is accessed with 8-bit mode, rather in 32-bit mode. Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 39 +++ 1 file changed, 39 insertions(+) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index

[PATCH v4 1/2] target/loongarch: Add loongson binary translation feature

2024-09-03 Thread Bibo Mao
is added with OnOffAuto type, If lbt feature is not supported with KVM host, it reports error if there is lbt=on command line. If there is no any command line about lbt parameter, it checks whether KVM host supports lbt feature and set the corresponding value in cpucfg. Signed-off-by: Bibo Mao

[PATCH v4 0/2] target/loongarch: Add loongson binary translation feature

2024-09-03 Thread Bibo Mao
LBT register saving and restoring in vmstate 2. Add two pseudo feature flags: default_features and forced_features --- Bibo Mao (2): target/loongarch: Add loongson binary translation feature target/loongarch: Implement lbt registers save/restore function target/loongarch/cpu.c

[PATCH v4 2/2] target/loongarch: Implement lbt registers save/restore function

2024-09-03 Thread Bibo Mao
Six registers scr0 - scr3, eflags and ftop are added in percpu vmstate. And two functions kvm_loongarch_get_lbt/kvm_loongarch_put_lbt are added to save/restore lbt registers. Signed-off-by: Bibo Mao --- target/loongarch/cpu.h | 12 target/loongarch/kvm/kvm.c | 60

[PATCH] target/loongarch: Add compatible support about VM reboot

2024-08-26 Thread Bibo Mao
loongarch_cpu_reset_hold(), so that VM can reboot with edk2-stable202408 UEFI bios. Signed-off-by: Bibo Mao --- target/loongarch/cpu.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 5e85b9dbef..2f4d635d03 100644 --- a/target

[PATCH] hw/loongarch: Remove default enable with VIRTIO_VGA device

2024-08-23 Thread Bibo Mao
VIRTIO_VGA device, VIRTIO_GPU is prefered on LoongArch system. For frame buffer video card support, standard VGA can be used. Signed-off-by: Bibo Mao --- hw/loongarch/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/loongarch/Kconfig b/hw/loongarch/Kconfig index 0de713a439..9c69170968

[PATCH] target/loongarch: Support QMP dump-guest-memory

2024-08-21 Thread Bibo Mao
Add the support needed for creating prstatus elf notes. This allows us to use QMP dump-guest-memory. Now ELF notes of LoongArch only supports general elf notes, LSX and LASX is not supported, since it is mainly used to dump guest memory. Signed-off-by: Bibo Mao --- target/loongarch/arch_dump.c

[PATCH] target/loongarch/kvm: Add vCPU reset function

2024-08-21 Thread Bibo Mao
KVM provides interface KVM_REG_LOONGARCH_VCPU_RESET to reset vCPU, it can be used to clear internal state about kvm kernel. vCPU reset function is added here for kvm mode. Signed-off-by: Bibo Mao --- target/loongarch/cpu.c | 2 +- target/loongarch/kvm/kvm.c | 5

[PATCH v2 2/4] hw/intc/loongarch_ipi: Add loongarch ipi support

2024-07-03 Thread Bibo Mao
Loongarch ipi is added herei, it inherits from class TYPE_LOONGSON_IPI_COMMON, and two interfaces get_iocsr_as() and cpu_by_arch_id() are added for Loongarch 3A5000 machine. It can be used when ipi is emulated in userspace with kvm mode. Signed-off-by: Bibo Mao --- hw/intc/loongarch_ipi.c

[PATCH v2 3/4] hw/loongarch/virt: Replace loongson ipi with loongarch ipi

2024-07-03 Thread Bibo Mao
Loongarch ipi inherits from class LoongsonIPICommonClass, and it only contains Loongarch 3A5000 virt machine specific interfaces, rather than mix different machine implementations together. Signed-off-by: Bibo Mao --- hw/intc/Kconfig | 3 +++ hw/intc/meson.build | 1 + hw

[PATCH v2 4/4] hw/intc/loongson_ipi: reconstruct driver inherit from common class

2024-07-03 Thread Bibo Mao
Like loongarch ipi, reconstruct this driver by inheriting class LoongsonIPICommonClass. Add extra function loongson_ipi_realize() to implement mmio memory region. Signed-off-by: Bibo Mao --- hw/intc/loongson_ipi.c | 330 +++-- hw/intc/meson.build

[PATCH v2 1/4] hw/intc/loongson_ipi_common: Add loongson ipi common class

2024-07-03 Thread Bibo Mao
other search methods such binary searching method. Signed-off-by: Bibo Mao --- hw/intc/loongson_ipi_common.c | 394 ++ include/hw/intc/loongson_ipi_common.h | 77 + 2 files changed, 471 insertions(+) create mode 100644 hw/intc/loongson_ipi_common.c create mode

[PATCH v2 0/4] Reconstruct loongson ipi driver

2024-07-03 Thread Bibo Mao
3A5000 irqchip in kernel mode soon. Also Loongarch ipi and loongson ipi device are added here, it inherits from base class TYPE_LOONGSON_IPI_COMMON. Loongarch ipi is tested, loongson ipi device only passes to compile and make check, it is not tested. Bibo Mao (4): hw/intc/loongson_ipi_common: Add

[PATCH 2/3] hw/intc/loongarch_ipi: Add loongarch ipi support

2024-07-02 Thread Bibo Mao
Loongarch ipi is added here and ipi is emulated in userspace when running in kvm mode. It inherits from TYPE_LOONGSON_IPI_COMMON class, and two interfaces get_iocsr_as() and cpu_by_arch_id() is added for Loongarch 3A5000 machine. Signed-off-by: Bibo Mao --- hw/intc/loongarch_ipi.c | 80

[PATCH 3/3] hw/loongarch/virt: Replace loongson ipi with loongarch ipi

2024-07-02 Thread Bibo Mao
Loongarch ipi inherits from class LoongsonIPICommonClass, and it only contains Loongarch 3A5000 virt machine specific interfaces, rather than mix different machine implementations together. Signed-off-by: Bibo Mao --- hw/intc/Kconfig | 3 +++ hw/intc/meson.build | 1 + hw

[PATCH 0/3] Replace loongson ipi with loongarch ipi

2024-07-02 Thread Bibo Mao
base class TYPE_LOONGSON_IPI_COMMON. Bibo Mao (3): hw/intc/loongson_ipi_common: Add loongson ipi common class hw/intc/loongarch_ipi: Add loongarch ipi support hw/loongarch/virt: Replace loongson ipi with loongarch ipi hw/intc/Kconfig | 3 + hw/intc/loongarch_ipi.c

[PATCH 1/3] hw/intc/loongson_ipi_common: Add loongson ipi common class

2024-07-02 Thread Bibo Mao
another search method such binary searching method. Signed-off-by: Bibo Mao --- hw/intc/loongson_ipi_common.c | 394 ++ include/hw/intc/loongson_ipi_common.h | 71 + 2 files changed, 465 insertions(+) create mode 100644 hw/intc/loongson_ipi_common.c create mode

[PATCH] hw/loongarch/virt: Remove unused assignment

2024-06-11 Thread Bibo Mao
There is abuse usage about local variable gap. Remove duplicated assignment and solve Coverity reported error. Resolves: Coverity CID 1546441 Fixes: 3cc451cbce ("hw/loongarch: Refine fwcfg memory map") Signed-off-by: Bibo Mao --- hw/loongarch/virt.c | 15 +++ 1 file

[PATCH v3] target/loongarch/kvm: Add software breakpoint support

2024-06-06 Thread Bibo Mao
software breakpoint is supported, and it is allowed to insert/remove software breakpoint. We can debug guest kernel with gdb method after kernel is loaded, hardware breakpoint will be added in later. Signed-off-by: Bibo Mao --- v2 ... v3: 1. Refresh patch based on the latest version, succeed in

  1   2   3   >