Re: [PATCH v2 5/5] hw/arm/aspeed: Check for CPU types in machine_run_board_init()

2024-01-24 Thread Gavin Shan
- hw/arm/aspeed_ast2600.c | 6 +- hw/arm/aspeed_soc_common.c | 5 - 6 files changed, 27 insertions(+), 6 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH v2 4/5] hw/arm/aspeed: Introduce aspeed_soc_cpu_type() helper

2024-01-24 Thread Gavin Shan
/arm/aspeed_ast10x0.c | 2 +- hw/arm/aspeed_ast2400.c | 3 ++- hw/arm/aspeed_ast2600.c | 3 ++- hw/arm/aspeed_soc_common.c | 5 + 5 files changed, 11 insertions(+), 3 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH v2 3/5] hw/arm/aspeed: Init CPU defaults in a common helper

2024-01-24 Thread Gavin Shan
insertions(+), 43 deletions(-) One nit needs to be addressed: Reviewed-by: Gavin Shan diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 5b01a4dd28..636a6269aa 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -1141,10 +1141,14 @@ static void aspeed_machine_class_props_init(ObjectClass *oc

Re: [PATCH v2 2/5] hw/arm/aspeed: Set default CPU count using aspeed_soc_num_cpus()

2024-01-24 Thread Gavin Shan
oc: Add AST1030 support") and supermicrox11-bmc (commit 40a38df55e "hw/arm/aspeed: Add board model for Supermicro X11 BMC") machines. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/aspeed.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) Reviewed-by: Gavin Shan

Re: [PATCH v2 1/5] hw/arm/aspeed: Remove dead code

2024-01-24 Thread Gavin Shan
On 1/24/24 08:48, Philippe Mathieu-Daudé wrote: Remove copy/paste typo from commit 6c323aba40 ("hw/arm/aspeed: Adding new machine Tiogapass in QEMU"). Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/aspeed.c | 1 - 1 file changed, 1 deletion(-) Reviewed-by: Gavin Shan

Re: [PATCH v2 6/6] hw/arm/zynq: Check for CPU types in machine_run_board_init()

2024-01-24 Thread Gavin Shan
On 1/24/24 08:25, Philippe Mathieu-Daudé wrote: Restrict MachineClass::valid_cpu_types[] to the single valid CPU type. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/xilinx_zynq.c | 5 + 1 file changed, 5 insertions(+) Reviewed-by: Gavin Shan

Re: [PATCH v2 5/6] hw/arm/vexpress: Check for CPU types in machine_run_board_init()

2024-01-24 Thread Gavin Shan
On 1/24/24 08:25, Philippe Mathieu-Daudé wrote: Restrict MachineClass::valid_cpu_types[] to the single valid CPU types. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/vexpress.c | 10 ++ 1 file changed, 10 insertions(+) Reviewed-by: Gavin Shan

Re: [PATCH v2 4/6] hw/arm/highbank: Check for CPU types in machine_run_board_init()

2024-01-24 Thread Gavin Shan
-Daudé --- hw/arm/highbank.c | 10 ++ 1 file changed, 10 insertions(+) Reviewed-by: Gavin Shan

Re: [PATCH v2 3/6] hw/arm/highbank: Add missing QOM parent for CPU cores

2024-01-24 Thread Gavin Shan
On 1/24/24 08:25, Philippe Mathieu-Daudé wrote: QDev objects created with qdev_new() need to manually add their parent relationship with object_property_add_child(). Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/highbank.c | 1 + 1 file changed, 1 insertion(+) Reviewed-by: Gavin Shan

Re: [PATCH v2 2/6] hw/arm/exynos: Check for CPU types in machine_run_board_init()

2024-01-24 Thread Gavin Shan
-by: Philippe Mathieu-Daudé --- hw/arm/exynos4_boards.c | 8 1 file changed, 8 insertions(+) Reviewed-by: Gavin Shan

Re: [PATCH v2 1/6] hw/arm/exynos: Add missing QOM parent for CPU cores

2024-01-24 Thread Gavin Shan
On 1/24/24 08:25, Philippe Mathieu-Daudé wrote: QDev objects created with qdev_new() need to manually add their parent relationship with object_property_add_child(). Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/exynos4210.c | 1 + 1 file changed, 1 insertion(+) Reviewed-by: Gavin

Re: [PATCH] hw/core: Handle cpu_model_from_type() returning NULL value

2024-01-11 Thread Gavin Shan
Hi Phil, On 1/11/24 18:21, Philippe Mathieu-Daudé wrote: On 11/1/24 08:30, Gavin Shan wrote: On 1/11/24 16:47, Philippe Mathieu-Daudé wrote: Per cpu_model_from_type() docstring (added in commit 445946f4dd):    * Returns: CPU model name or NULL if the CPU class doesn't exist We must check

Re: [PATCH] hw/core: Handle cpu_model_from_type() returning NULL value

2024-01-10 Thread Gavin Shan
Hi Phil, On 1/11/24 16:47, Philippe Mathieu-Daudé wrote: Per cpu_model_from_type() docstring (added in commit 445946f4dd): * Returns: CPU model name or NULL if the CPU class doesn't exist We must check the return value in order to avoid surprises, i.e.: $ qemu-system-arm -machine virt

Re: [PULL 29/71] hw/arm/virt: Check CPU type in machine_run_board_init()

2024-01-10 Thread Gavin Shan
Hi Peter, On 1/10/24 00:33, Peter Maydell wrote: On Fri, 5 Jan 2024 at 15:46, Philippe Mathieu-Daudé wrote: From: Gavin Shan Set mc->valid_cpu_types so that the user specified CPU type can be validated in machine_run_board_init(). We needn't to do the check by ourselves. Hi; af

[PATCH] hw/arm/virt: Consolidate valid CPU types

2024-01-10 Thread Gavin Shan
, cortex-a55, cortex-a72, cortex-a76, cortex-a710, a64fx, neoverse-n1, neoverse-v1, neoverse-n2, cortex-a53, cortex-a57, max Reported-by: Peter Maydell Fixes: fa8c617791 ("hw/arm/virt: Check CPU type in machine_run_board_init()") Signed-off-by: Gavin Shan --- hw/arm/virt.c | 8 ++-- 1 fi

Re: [PATCH v9 0/9] Unified CPU type check

2024-01-07 Thread Gavin Shan
Hi Phil, On 1/6/24 08:12, Philippe Mathieu-Daudé wrote: On 13/12/23 11:54, Gavin Shan wrote: On 12/13/23 20:08, Philippe Mathieu-Daudé wrote: On 12/12/23 05:55, Gavin Shan wrote: On 12/4/23 10:47, Gavin Shan wrote: This series bases on Phil's repository because the prepatory commits have

Re: [PATCH v9 3/9] machine: Improve is_cpu_type_supported()

2024-01-07 Thread Gavin Shan
On 1/6/24 08:09, Philippe Mathieu-Daudé wrote: On 4/12/23 01:47, Gavin Shan wrote: It's no sense to check the CPU type when mc->valid_cpu_types[0] is NULL, which is a program error. Raise an assert on this. A precise hint for the error message is given when mc->valid_cpu_types[0] is th

Re: [PATCH v9 1/9] machine: Use error handling when CPU type is checked

2024-01-07 Thread Gavin Shan
On 1/5/24 21:00, Philippe Mathieu-Daudé wrote: On 4/12/23 01:47, Gavin Shan wrote: Functions that use an Error **errp parameter to return errors should not also report them to the user, because reporting is the caller's job. The principle is violated by machine_run_board_init() because it calls

Re: [PATCH v9 0/9] Unified CPU type check

2023-12-13 Thread Gavin Shan
On 12/13/23 20:08, Philippe Mathieu-Daudé wrote: On 12/12/23 05:55, Gavin Shan wrote: On 12/4/23 10:47, Gavin Shan wrote: This series bases on Phil's repository because the prepatory commits have been queued to the branch.    https://gitlab.com/philmd/qemu.git (branch: cpus-next

Re: [PATCH v9 0/9] Unified CPU type check

2023-12-11 Thread Gavin Shan
Hi Phil, On 12/4/23 10:47, Gavin Shan wrote: This series bases on Phil's repository because the prepatory commits have been queued to the branch. https://gitlab.com/philmd/qemu.git (branch: cpus-next) There are two places where the user specified CPU type is checked to see if it's

Re: [PATCH v4] arm/kvm: Enable support for KVM_ARM_VCPU_PMU_V3_FILTER

2023-12-10 Thread Gavin Shan
Hi Shaoqin, On 12/7/23 20:36, Shaoqin Huang wrote: The KVM_ARM_VCPU_PMU_V3_FILTER provide the ability to let the VMM decide ^^^ provides which PMU events are provided to the guest. Add a new option `pmu-filter` as -accel

Re: [PATCH-for-9.0 24/25] hw/nvram: Simplify memory_region_init_rom_device() calls

2023-12-03 Thread Gavin Shan
+ !memory_region_init_rom_device(mr, owner, arg3, arg4, arg5, arg6, ) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé --- hw/nvram/nrf51_nvm.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 25/25] hw/pci-host/raven: Propagate error in raven_realize()

2023-12-03 Thread Gavin Shan
changed, 4 insertions(+), 2 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 23/25] hw/misc: Simplify memory_region_init_ram_from_fd() calls

2023-12-03 Thread Gavin Shan
+ !memory_region_init_ram_from_fd(mr, owner, arg3, arg4, arg5, arg6, arg7, ) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé --- hw/misc/ivshmem.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) Reviewed-by: Gavin

Re: [PATCH-for-9.0 21/25] hw/arm: Simplify memory_region_init_rom() calls

2023-12-03 Thread Gavin Shan
(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 22/25] hw/sparc: Simplify memory_region_init_ram_nomigrate() calls

2023-12-03 Thread Gavin Shan
, arg4, ) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé --- hw/sparc/sun4m.c | 20 ++-- hw/sparc64/sun4u.c | 7 ++- 2 files changed, 8 insertions(+), 19 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 20/25] hw: Simplify memory_region_init_ram() calls

2023-12-03 Thread Gavin Shan
++ hw/arm/integratorcp.c | 7 ++- hw/arm/nrf51_soc.c | 7 ++- hw/ppc/rs6000_mc.c | 7 ++- 8 files changed, 16 insertions(+), 35 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 19/25] misc: Simplify qemu_prealloc_mem() calls

2023-12-03 Thread Gavin Shan
On 11/21/23 07:32, Philippe Mathieu-Daudé wrote: Signed-off-by: Philippe Mathieu-Daudé --- backends/hostmem.c | 22 +++--- hw/virtio/virtio-mem.c | 6 ++ 2 files changed, 9 insertions(+), 19 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 18/25] util/oslib: Have qemu_prealloc_mem() handler return a boolean

2023-12-03 Thread Gavin Shan
clude/qemu/osdep.h | 4 +++- util/oslib-posix.c | 7 +-- util/oslib-win32.c | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) s/cpu_exec_realizefn()/qemu_prealloc_mem() Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 17/25] backends: Reduce variable scope in host_memory_backend_memory_complete

2023-12-03 Thread Gavin Shan
On 11/21/23 07:32, Philippe Mathieu-Daudé wrote: Reduce the _err variable use and remove the 'out:' label. Signed-off-by: Philippe Mathieu-Daudé --- backends/hostmem.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 16/25] backends: Have HostMemoryBackendClass::alloc() handler return a boolean

2023-12-03 Thread Gavin Shan
deletions(-) s/cpu_exec_realizefn()/HostMemoryBackendClass::alloc() Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 15/25] backends: Simplify host_memory_backend_memory_complete()

2023-12-03 Thread Gavin Shan
ppe Mathieu-Daudé --- backends/hostmem.c | 133 +++-- 1 file changed, 67 insertions(+), 66 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 14/25] backends: Use g_autofree in HostMemoryBackendClass::alloc() handlers

2023-12-03 Thread Gavin Shan
-memfd.c | 3 +-- backends/hostmem-ram.c | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 13/25] memory: Have memory_region_init_ram_from_fd() handler return a boolean

2023-12-03 Thread Gavin Shan
clude/exec/memory.h | 4 +++- system/memory.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) s/cpu_exec_realizefn()/memory_region_init_ram_from_fd() Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 12/25] memory: Have memory_region_init_ram_from_file() handler return a boolean

2023-12-03 Thread Gavin Shan
clude/exec/memory.h | 4 +++- system/memory.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) s/cpu_exec_realizefn()/memory_region_init_ram_from_file() Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 11/25] memory: Have memory_region_init_resizeable_ram() return a boolean

2023-12-03 Thread Gavin Shan
clude/exec/memory.h | 4 +++- system/memory.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) s/cpu_exec_realizefn()/memory_region_init_resizeable_ram() Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 10/25] memory: Have memory_region_init_rom_device() handler return a boolean

2023-12-03 Thread Gavin Shan
clude/exec/memory.h | 4 +++- system/memory.c | 6 -- 2 files changed, 7 insertions(+), 3 deletions(-) With Peter Xu's comments addressed, to s/cpu_exec_realizefn()/memory_region_init_rom_device() in the commit messages. Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 09/25] memory: Simplify memory_region_init_rom_device_nomigrate() calls

2023-12-03 Thread Gavin Shan
+ !memory_region_init_rom_device_nomigrate(mr, owner, arg3, arg4, arg5, arg6, ) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé --- system/memory.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 08/25] memory: Have memory_region_init_rom_device_nomigrate() return a boolean

2023-12-03 Thread Gavin Shan
clude/exec/memory.h | 4 +++- system/memory.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) s/cpu_exec_realizefn()/memory_region_init_rom_device_nomigrate() Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 07/25] memory: Have memory_region_init_rom() handler return a boolean

2023-12-03 Thread Gavin Shan
clude/exec/memory.h | 4 +++- system/memory.c | 6 -- 2 files changed, 7 insertions(+), 3 deletions(-) s/cpu_exec_realizefn()/memory_region_init_rom() Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 06/25] memory: Have memory_region_init_ram() handler return a boolean

2023-12-03 Thread Gavin Shan
clude/exec/memory.h | 4 +++- system/memory.c | 6 -- 2 files changed, 7 insertions(+), 3 deletions(-) With Peter Xu's comments addressed: Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 05/25] memory: Simplify memory_region_init_ram_from_fd() calls

2023-12-03 Thread Gavin Shan
+ !memory_region_init_ram_from_fd(mr, owner, arg3, arg4, arg5, arg6, arg7, ) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé --- system/memory.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 04/25] memory: Simplify memory_region_init_rom_nomigrate() calls

2023-12-03 Thread Gavin Shan
, arg4, ) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé --- system/memory.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 03/25] memory: Have memory_region_init_rom_nomigrate() handler return a boolean

2023-12-03 Thread Gavin Shan
clude/exec/memory.h | 4 +++- system/memory.c | 8 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) s/cpu_exec_realizefn()/memory_region_init_rom_nomigrate() in the commit message, mentioned by Peter Xu. With this: Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 02/25] memory: Have memory_region_init_ram_nomigrate() handler return a boolean

2023-12-03 Thread Gavin Shan
clude/exec/memory.h | 4 +++- system/memory.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) s/cpu_exec_realizefn()/memory_region_init_ram_nomigrate() for the commit message, as mentioned by Peter Xu. Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 01/25] memory: Have memory_region_init_ram_flags_nomigrate() return a boolean

2023-12-03 Thread Gavin Shan
clude/exec/memory.h | 4 +++- system/memory.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) With Peter Xu's comments addressed, to replace cpu_exec_realizefn() with memory_region_init_ram_flags_nomigrate() in the commit log. Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 2/2] target/arm/kvm: Use generic kvm_supports_guest_debug()

2023-12-03 Thread Gavin Shan
On 12/2/23 00:32, Philippe Mathieu-Daudé wrote: Do not open-code the generic kvm_supports_guest_debug(). Signed-off-by: Philippe Mathieu-Daudé --- target/arm/kvm64.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 1/2] accel/kvm: Expose kvm_supports_guest_debug() prototype

2023-12-03 Thread Gavin Shan
On 12/2/23 00:32, Philippe Mathieu-Daudé wrote: kvm_supports_guest_debug() should be accessible by KVM implementations. Signed-off-by: Philippe Mathieu-Daudé --- accel/kvm/kvm-cpus.h | 1 - include/sysemu/kvm.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Gavin

[PATCH v9 6/9] hw/arm/virt: Check CPU type in machine_run_board_init()

2023-12-03 Thread Gavin Shan
Set mc->valid_cpu_types so that the user specified CPU type can be validated in machine_run_board_init(). We needn't to do the check by ourselves. Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/arm/virt.c |

[PATCH v9 3/9] machine: Improve is_cpu_type_supported()

2023-12-03 Thread Gavin Shan
ple valid entries there is avoided to increase the code readability, as suggested by Philippe Mathieu-Daudé. Besides, @cc comes from machine->cpu_type or mc->default_cpu_type. For the later case, it can be NULL and it's also a program error. We should use assert() in this case. Signed-off-by:

[PATCH v9 4/9] machine: Print CPU model name instead of CPU type

2023-12-03 Thread Gavin Shan
The names of supported CPU models instead of CPU types should be printed when the user specified CPU type isn't supported, to be consistent with the output from '-cpu ?'. Correct the error messages to print CPU model names instead of CPU type names. Signed-off-by: Gavin Shan Reviewed

[PATCH v9 7/9] hw/arm/sbsa-ref: Check CPU type in machine_run_board_init()

2023-12-03 Thread Gavin Shan
Set mc->valid_cpu_types so that the user specified CPU type can be validated in machine_run_board_init(). We needn't to do it by ourselves. Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Leif Lindholm Reviewed-by: Richard Henderson --- hw/arm/sbsa-ref.c |

[PATCH v9 9/9] hw/riscv/shakti_c: Check CPU type in machine_run_board_init()

2023-12-03 Thread Gavin Shan
Set mc->valid_cpu_types so that the user specified CPU type can be validated in machine_run_board_init(). We needn't to do it by ourselves. Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé --- hw/riscv/shakti_c.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deleti

[PATCH v9 2/9] machine: Introduce helper is_cpu_type_supported()

2023-12-03 Thread Gavin Shan
of code. The comments are tweaked a bit either. No functional change intended. Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé --- hw/core/machine.c | 83 +-- 1 file changed, 45 insertions(+), 38 deletions(-) diff --git a/hw/core

[PATCH v9 8/9] hw/arm: Check CPU type in machine_run_board_init()

2023-12-03 Thread Gavin Shan
Set mc->valid_cpu_types so that the user specified CPU type can be validated in machine_run_board_init(). We needn't to do it by ourselves. Signed-off-by: Gavin Shan Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- hw/arm/bananapi_m2u.c | 12 ++-- hw/

[PATCH v9 5/9] hw/arm/virt: Hide host CPU model for tcg

2023-12-03 Thread Gavin Shan
. qemu-system-aarch64: Invalid CPU type: cortex-a8 The valid types are: cortex-a7, cortex-a15, cortex-a35, \ cortex-a55, cortex-a72, cortex-a76, cortex-a710, a64fx, \ neoverse-n1, neoverse-v1, neoverse-n2, cortex-a53, \ cortex-a57, max Signed-off-by: Gavin Shan Reviewed-by: Richard

[PATCH v9 0/9] Unified CPU type check

2023-12-03 Thread Gavin Shan
(Phil) * Clearer hint if only one CPU type is supported and have 'const MachineState *' in is_cpu_type_supported()(Phil) * Move valid_cpu_types[] to board's class_init() function (Phil) Gavin Shan (9): machine: Use error handling when CPU type is checked machine: Introdu

[PATCH v9 1/9] machine: Use error handling when CPU type is checked

2023-12-03 Thread Gavin Shan
the requested CPU type. Clean this up by using error_setg() and error_append_hint() instead. No functional change, as the only caller passes _fatal. Suggested-by: Igor Mammedov Signed-off-by: Gavin Shan Reviewed-by: Markus Armbruster --- v9: Improved change log (Markus

Re: [PATCH v8 3/9] machine: Improve is_cpu_type_supported()

2023-12-03 Thread Gavin Shan
Hi Phil, On 12/4/23 09:20, Gavin Shan wrote: On 12/1/23 20:57, Philippe Mathieu-Daudé wrote: On 29/11/23 05:20, Gavin Shan wrote: It's no sense to check the CPU type when mc->valid_cpu_types[0] is NULL. This case is a programming error, right? We should simply:   assert(

Re: [PATCH v8 3/9] machine: Improve is_cpu_type_supported()

2023-12-03 Thread Gavin Shan
Hi Phil On 12/1/23 20:57, Philippe Mathieu-Daudé wrote: On 29/11/23 05:20, Gavin Shan wrote: It's no sense to check the CPU type when mc->valid_cpu_types[0] is NULL. This case is a programming error, right? We should simply:  assert(!mc->valid_cpu_types || *mc->valid_cpu_types

Re: [PATCH v8 2/9] machine: Introduce helper is_cpu_type_supported()

2023-12-03 Thread Gavin Shan
Hi Phil, On 12/1/23 20:53, Philippe Mathieu-Daudé wrote: On 29/11/23 05:20, Gavin Shan wrote: The logic, to check if the specified CPU type is supported in machine_run_board_init(), is independent enough. Factor it out into helper is_cpu_type_supported(). machine_run_board_init() looks a bit

Re: [PATCH v3] arm/kvm: Enable support for KVM_ARM_VCPU_PMU_V3_FILTER

2023-11-30 Thread Gavin Shan
Hi Shaoqin, On 11/29/23 14:08, Shaoqin Huang wrote: The KVM_ARM_VCPU_PMU_V3_FILTER provide the ability to let the VMM decide which PMU events are provided to the guest. Add a new option `pmu-filter` as -accel sub-option to set the PMU Event Filtering. Without the filter, the KVM will expose all

Re: [PATCH v8 1/9] machine: Use error handling when CPU type is checked

2023-11-30 Thread Gavin Shan
Hi Markus, On 11/29/23 19:20, Markus Armbruster wrote: Gavin Shan writes: QEMU will be terminated if the specified CPU type isn't supported in machine_run_board_init(). The list of supported CPU type names is tracked by mc->valid_cpu_types. Suggest to drop the second sentence. Ind

[PATCH v8 7/9] hw/arm/sbsa-ref: Check CPU type in machine_run_board_init()

2023-11-28 Thread Gavin Shan
Set mc->valid_cpu_types so that the user specified CPU type can be validated in machine_run_board_init(). We needn't to do it by ourselves. Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Leif Lindholm Reviewed-by: Richard Henderson --- hw/arm/sbsa-ref.c |

[PATCH v8 9/9] hw/riscv/shakti_c: Check CPU type in machine_run_board_init()

2023-11-28 Thread Gavin Shan
Set mc->valid_cpu_types so that the user specified CPU type can be validated in machine_run_board_init(). We needn't to do it by ourselves. Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé --- hw/riscv/shakti_c.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deleti

[PATCH v8 5/9] hw/arm/virt: Hide host CPU model for tcg

2023-11-28 Thread Gavin Shan
. qemu-system-aarch64: Invalid CPU type: cortex-a8 The valid types are: cortex-a7, cortex-a15, cortex-a35, \ cortex-a55, cortex-a72, cortex-a76, cortex-a710, a64fx, \ neoverse-n1, neoverse-v1, neoverse-n2, cortex-a53, \ cortex-a57, max Signed-off-by: Gavin Shan Reviewed-by: Richard

[PATCH v8 2/9] machine: Introduce helper is_cpu_type_supported()

2023-11-28 Thread Gavin Shan
of code. The comments are tweaked a bit either. No functional change intended. Signed-off-by: Gavin Shan --- v8: Move the precise message hint to PATCH[v8 3/9](Gavin) --- hw/core/machine.c | 83 +-- 1 file changed, 45 insertions(+), 38

[PATCH v8 8/9] hw/arm: Check CPU type in machine_run_board_init()

2023-11-28 Thread Gavin Shan
Set mc->valid_cpu_types so that the user specified CPU type can be validated in machine_run_board_init(). We needn't to do it by ourselves. Signed-off-by: Gavin Shan Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- hw/arm/bananapi_m2u.c | 12 ++-- hw/

[PATCH v8 4/9] machine: Print CPU model name instead of CPU type

2023-11-28 Thread Gavin Shan
The names of supported CPU models instead of CPU types should be printed when the user specified CPU type isn't supported, to be consistent with the output from '-cpu ?'. Correct the error messages to print CPU model names instead of CPU type names. Signed-off-by: Gavin Shan --- v8: Use

[PATCH v8 3/9] machine: Improve is_cpu_type_supported()

2023-11-28 Thread Gavin Shan
esides, enumeration on mc->valid_cpu_types[0] when we have mutiple valid entries there is avoided to increase the code readability, as suggested by Philippe Mathieu-Daudé. Signed-off-by: Gavin Shan --- hw/core/machine.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions

[PATCH v8 6/9] hw/arm/virt: Check CPU type in machine_run_board_init()

2023-11-28 Thread Gavin Shan
Set mc->valid_cpu_types so that the user specified CPU type can be validated in machine_run_board_init(). We needn't to do the check by ourselves. Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/arm/virt.c |

[PATCH v8 1/9] machine: Use error handling when CPU type is checked

2023-11-28 Thread Gavin Shan
ons in the same function. No functional change intended. Suggested-by: Igor Mammedov Signed-off-by: Gavin Shan --- v8: Drop @local_err and use @errp to be compatible with ERRP_GUARD() (Phil) --- hw/core/machine.c | 13 +++-- 1 file changed

[PATCH v8 0/9] Unified CPU type check

2023-11-28 Thread Gavin Shan
'const MachineState *' in is_cpu_type_supported()(Phil) * Move valid_cpu_types[] to board's class_init() function (Phil) Gavin Shan (9): machine: Use error handling when CPU type is checked machine: Introduce helper is_cpu_type_supported() machine: Improve is_cpu_type_sup

Re: [PATCH v7 3/8] machine: Print CPU model name instead of CPU type

2023-11-28 Thread Gavin Shan
Hi Phil, On 11/28/23 20:55, Philippe Mathieu-Daudé wrote: On 27/11/23 00:12, Gavin Shan wrote: The names of supported CPU models instead of CPU types should be printed when the user specified CPU type isn't supported, to be consistent with the output from '-cpu ?'. Correct the error messages

Re: [PATCH v7 2/8] machine: Introduce helper is_cpu_type_supported()

2023-11-28 Thread Gavin Shan
Hi Phil, On 11/28/23 20:38, Philippe Mathieu-Daudé wrote: On 27/11/23 00:12, Gavin Shan wrote: The logic, to check if the specified CPU type is supported in machine_run_board_init(), is independent enough. Factor it out into helper is_cpu_type_supported(). machine_run_board_init() looks a bit

Re: [PATCH v7 1/8] machine: Use error handling when CPU type is checked

2023-11-28 Thread Gavin Shan
Hi Phil, On 11/28/23 20:43, Philippe Mathieu-Daudé wrote: On 27/11/23 00:12, Gavin Shan wrote: QEMU will be terminated if the specified CPU type isn't supported in machine_run_board_init(). The list of supported CPU type names is tracked by mc->valid_cpu_types. The error handling can be u

Re: [PATCH v7 5/8] hw/arm/virt: Check CPU type in machine_run_board_init()

2023-11-27 Thread Gavin Shan
On 11/27/23 21:13, Marcin Juszkiewicz wrote: W dniu 27.11.2023 o 00:12, Gavin Shan pisze: @@ -2939,6 +2900,28 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)   {   MachineClass *mc = MACHINE_CLASS(oc);   HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc

Re: [PATCH v7 0/8] Unified CPU type check

2023-11-27 Thread Gavin Shan
On 11/27/23 21:10, Marcin Juszkiewicz wrote: W dniu 27.11.2023 o 00:12, Gavin Shan pisze: After the series is applied:    [gshan@gshan q]$ ./build/qemu-system-aarch64 -M virt -cpu cortex-a8    qemu-system-aarch64: Invalid CPU type: cortex-a8    The valid types are: cortex-a7, cortex-a15

Re: [PATCH-for-9.0 16/16] target/arm/kvm: Have kvm_arm_hw_debug_active take a ARMCPU argument

2023-11-26 Thread Gavin Shan
target/arm/kvm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) With the following comments addressed: Reviewed-by: Gavin Shan diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 1f6da5529f..cbfea689cc 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -145

Re: [PATCH-for-9.0 15/16] target/arm/kvm: Have kvm_arm_handle_debug take a ARMCPU argument

2023-11-26 Thread Gavin Shan
target/arm/kvm.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 14/16] target/arm/kvm: Have kvm_arm_handle_dabt_nisv take a ARMCPU argument

2023-11-26 Thread Gavin Shan
arget/arm/kvm.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 13/16] target/arm/kvm: Have kvm_arm_verify_ext_dabt_pending take a ARMCPU arg

2023-11-26 Thread Gavin Shan
target/arm/kvm.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 12/16] target/arm/kvm: Have kvm_arm_[get|put]_virtual_time take ARMCPU argument

2023-11-26 Thread Gavin Shan
arget/arm/kvm.c | 23 ++- 1 file changed, 10 insertions(+), 13 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 10/16] target/arm/kvm: Have kvm_arm_vcpu_init take a ARMCPU argument

2023-11-26 Thread Gavin Shan
arget/arm/kvm.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 11/16] target/arm/kvm: Have kvm_arm_vcpu_finalize take a ARMCPU argument

2023-11-26 Thread Gavin Shan
target/arm/kvm.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 10/16] target/arm/kvm: Have kvm_arm_vcpu_init take a ARMCPU argument

2023-11-26 Thread Gavin Shan
arget/arm/kvm.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 09/16] target/arm/kvm: Have kvm_arm_pmu_set_irq take a ARMCPU argument

2023-11-26 Thread Gavin Shan
et/arm/kvm_arm.h | 4 ++-- hw/arm/virt.c| 2 +- target/arm/kvm.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 08/16] target/arm/kvm: Have kvm_arm_pmu_init take a ARMCPU argument

2023-11-26 Thread Gavin Shan
target/arm/kvm_arm.h | 4 ++-- hw/arm/virt.c| 2 +- target/arm/kvm.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) One nit below, but I guess it doesn't matter. Reviewed-by: Gavin Shan diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h index 0e12a008a

Re: [PATCH-for-9.0 07/16] target/arm/kvm: Have kvm_arm_pvtime_init take a ARMCPU argument

2023-11-26 Thread Gavin Shan
et/arm/kvm_arm.h | 6 +++--- hw/arm/virt.c| 5 +++-- target/arm/kvm.c | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 06/16] target/arm/kvm: Have kvm_arm_set_device_attr take a ARMCPU argument

2023-11-26 Thread Gavin Shan
arget/arm/kvm.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 05/16] target/arm/kvm: Have kvm_arm_sve_get_vls take a ARMCPU argument

2023-11-26 Thread Gavin Shan
Hi Phil, On 11/24/23 05:35, Philippe Mathieu-Daudé wrote: Unify the "kvm_arm.h" API: All functions related to ARM vCPUs take a ARMCPU* argument. Use the CPU() QOM cast macro When calling the generic vCPU API from "sysemu/kvm.h". Signed-off-by: Philippe Mathieu-Daudé --- target/arm/kvm_arm.h

Re: [PATCH-for-9.0 04/16] target/arm/kvm: Have kvm_arm_sve_set_vls take a ARMCPU argument

2023-11-26 Thread Gavin Shan
target/arm/kvm.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 03/16] target/arm/kvm: Have kvm_arm_add_vcpu_properties take a ARMCPU argument

2023-11-26 Thread Gavin Shan
target/arm/kvm_arm.h | 4 ++-- target/arm/cpu.c | 2 +- target/arm/kvm.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) With the following comments resolved: Reviewed-by: Gavin Shan diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h index 50967f4ae9..6fb8a5f67e

Re: [PATCH-for-9.0 02/16] target/arm/kvm: Remove unused includes

2023-11-26 Thread Gavin Shan
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote: Both MemoryRegion and Error types are forward declared in "qemu/typedefs.h". Signed-off-by: Philippe Mathieu-Daudé --- target/arm/kvm_arm.h | 2 -- 1 file changed, 2 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH-for-9.0 01/16] hw/intc/arm_gicv3: Include missing 'qemu/error-report.h' header

2023-11-26 Thread Gavin Shan
On 11/24/23 05:35, Philippe Mathieu-Daudé wrote: kvm_arm_its_reset_hold() calls warn_report(), itself declared in "qemu/error-report.h". Signed-off-by: Philippe Mathieu-Daudé --- hw/intc/arm_gicv3_its_kvm.c | 1 + 1 file changed, 1 insertion(+) Reviewed-by: Gavin Shan

Re: [PATCH 21/21] target/arm/kvm: Unexport kvm_arm_vm_state_change

2023-11-26 Thread Gavin Shan
On 11/23/23 15:42, Richard Henderson wrote: Signed-off-by: Richard Henderson --- target/arm/kvm_arm.h | 2 -- target/arm/kvm.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH 20/21] target/arm/kvm: Unexport and tidy kvm_arm_sync_mpstate_to_{kvm, qemu}

2023-11-26 Thread Gavin Shan
deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH 19/21] target/arm/kvm: Unexport kvm_{get,put}_vcpu_events

2023-11-26 Thread Gavin Shan
On 11/23/23 15:42, Richard Henderson wrote: Signed-off-by: Richard Henderson --- target/arm/kvm_arm.h | 20 target/arm/kvm.c | 20 ++-- 2 files changed, 18 insertions(+), 22 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH 18/21] target/arm/kvm: Init cap_has_inject_serror_esr in kvm_arch_init

2023-11-26 Thread Gavin Shan
changed, 4 insertions(+), 17 deletions(-) Reviewed-by: Gavin Shan

Re: [PATCH 17/21] target/arm/kvm: Unexport kvm_arm_init_cpreg_list

2023-11-26 Thread Gavin Shan
On 11/23/23 15:42, Richard Henderson wrote: Signed-off-by: Richard Henderson --- target/arm/kvm_arm.h | 12 target/arm/kvm.c | 10 -- 2 files changed, 8 insertions(+), 14 deletions(-) Reviewed-by: Gavin Shan

  1   2   3   4   5   6   7   8   9   10   >