[PATCH] i386/cpu: Don't emulate L3 cache on 8000_001D if l3-cache is disabled

2023-05-31 Thread Yanan Wang via
Currently, we only avoid emulating L3 cache properties for AMD CPU when l3-cache is off, but failed to consider this case on CPUID 8000_001D. This result in a fact that we will still have L3 caches in the VM although we pass "host-cache-info=off,l3-cache=off" CLI to qemu. Fixes: 8f4202fb108 ("i386

[PATCH] softmmu/device_tree: Remove redundant pointer assignment

2022-01-10 Thread Yanan Wang via
The pointer assignment "const char *p = path;" in function qemu_fdt_add_path is unnecessary. Let's remove it and just use the "path" passed in. No functional change. Suggested-by: Richard Henderson Signed-off-by: Yanan Wang --- Based on: softmmu/device_tree: Silence compiler warning with --enabl

[PATCH v7 3/6] hw/acpi/aml-build: Improve scalability of PPTT generation

2022-01-07 Thread Yanan Wang via
Use g_queue APIs to reduce the nested loops and code indentation with the processor hierarchy levels increasing. Consenquently, it's more scalable to add new topology level to build_pptt. No functional change intended. Signed-off-by: Yanan Wang Reviewed-by: Andrew Jones --- hw/acpi/aml-build.c

[PATCH v7 4/6] tests/acpi/bios-tables-test: Allow changes to virt/PPTT file

2022-01-07 Thread Yanan Wang via
List test/data/acpi/virt/PPTT as the expected files allowed to be changed in tests/qtest/bios-tables-test-allowed-diff.h Signed-off-by: Yanan Wang Acked-by: Ani Sinha --- tests/qtest/bios-tables-test-allowed-diff.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/bios-tables-test

[PATCH v7 6/6] tests/acpi/bios-table-test: Update expected virt/PPTT file

2022-01-07 Thread Yanan Wang via
Run ./tests/data/acpi/rebuild-expected-aml.sh from build directory to update PPTT binary. Also empty bios-tables-test-allowed-diff.h. The disassembled differences between actual and expected PPTT: /* * Intel ACPI Component Architecture * AML/ASL+ Disassembler version 20200528 (64-bit version

[PATCH v7 1/6] hw/arm/virt: Support CPU cluster on ARM virt machine

2022-01-07 Thread Yanan Wang via
ARM64 machines like Kunpeng Family Server Chips have a level of hardware topology in which a group of CPU cores share L3 cache tag or L2 cache. For example, Kunpeng 920 typically has 6 or 8 clusters in each NUMA node (also represent range of CPU die), and each cluster has 4 CPU cores. All clusters

[PATCH v7 5/6] hw/acpi/aml-build: Support cluster level in PPTT generation

2022-01-07 Thread Yanan Wang via
Support CPU cluster topology level in generation of ACPI Processor Properties Topology Table (PPTT). Signed-off-by: Yanan Wang Reviewed-by: Andrew Jones --- hw/acpi/aml-build.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c inde

[PATCH v7 2/6] hw/arm/virt: Support cluster level in DT cpu-map

2022-01-07 Thread Yanan Wang via
Support one cluster level between core and physical package in the cpu-map of Arm/virt devicetree. This is also consistent with Linux Doc "Documentation/devicetree/bindings/cpu/cpu-topology.txt". Signed-off-by: Yanan Wang Reviewed-by: Andrew Jones --- hw/arm/virt.c | 15 --- 1 file

[PATCH v7 0/6] ARM virt: Support CPU cluster topology

2022-01-07 Thread Yanan Wang via
This v7 series enables the support for CPU cluster topology on ARM virt machines. The generic infrastructure for CPU cluster parameter has been in upstream. Background and descriptions: The new Cluster-Aware Scheduling support has landed in Linux 5.16, which has been proved to benefit the scheduli

[PATCH v6 6/7] hw/arm/virt-acpi-build: Support cluster level in PPTT generation

2022-01-03 Thread Yanan Wang via
Support cluster level in generation of ACPI Processor Properties Topology Table (PPTT) for ARM virt machines. Signed-off-by: Yanan Wang --- hw/arm/virt-acpi-build.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 3ce7

[PATCH v6 5/7] tests/acpi/bios-tables-test: Allow changes to virt/PPTT file

2022-01-03 Thread Yanan Wang via
List test/data/acpi/virt/PPTT as the expected files allowed to be changed in tests/qtest/bios-tables-test-allowed-diff.h Signed-off-by: Yanan Wang --- tests/qtest/bios-tables-test-allowed-diff.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/te

[PATCH v6 7/7] tests/acpi/bios-table-test: Update expected virt/PPTT file

2022-01-03 Thread Yanan Wang via
Run ./tests/data/acpi/rebuild-expected-aml.sh from build directory to update PPTT binary. Also empty bios-tables-test-allowed-diff.h. The disassembled differences between actual and expected PPTT: /* * Intel ACPI Component Architecture * AML/ASL+ Disassembler version 20180810 (64-bit version

[PATCH v6 2/7] hw/arm/virt: Support cluster level in DT cpu-map

2022-01-03 Thread Yanan Wang via
Support one cluster level between core and physical package in the cpu-map of Arm/virt devicetree. This is also consistent with Linux Doc "Documentation/devicetree/bindings/cpu/cpu-topology.txt". Signed-off-by: Yanan Wang --- hw/arm/virt.c | 15 --- 1 file changed, 8 insertions(+), 7

[PATCH v6 3/7] hw/acpi/aml-build: Improve scalability of PPTT generation

2022-01-03 Thread Yanan Wang via
Currently we generate a PPTT table of n-level processor hierarchy with n-level loops in build_pptt(). It works fine as now there are only three CPU topology parameters. But the code may become less scalable with the processor hierarchy levels increasing. This patch only improves the scalability of

[PATCH v6 0/7] ARM virt: Support CPU cluster topology

2022-01-03 Thread Yanan Wang via
This v6 series enables the support for CPU cluster topology on ARM virt machines. The generic infrastructure for CPU cluster parameter now is in upstream. Background and descriptions: The new Cluster-Aware Scheduling support has landed in Linux 5.16, which has been proved to benefit the scheduling

[PATCH v6 4/7] hw/arm/virt-acpi-build: Make an ARM specific PPTT generator

2022-01-03 Thread Yanan Wang via
We have a generic build_pptt() in hw/acpi/aml-build.c but it's currently only used in ARM acpi initialization. Now we are going to support the new CPU cluster parameter which is currently only supported by ARM, it won't be a very good idea to add it to the generic build_pptt() as it will make the c

[PATCH v6 1/7] hw/arm/virt: Support CPU cluster on ARM virt machine

2022-01-03 Thread Yanan Wang via
ARM64 machines like Kunpeng Family Server Chips have a level of hardware topology in which a group of CPU cores share L3 cache tag or L2 cache. For example, Kunpeng 920 typically has 6 or 8 clusters in each NUMA node (also represent range of CPU die), and each cluster has 4 CPU cores. All clusters

[PATCH v5 12/14] tests/acpi/bios-tables-test: Allow changes to virt/PPTT file

2021-12-28 Thread Yanan Wang via
List test/data/acpi/virt/PPTT as the expected files allowed to be changed in tests/qtest/bios-tables-test-allowed-diff.h Signed-off-by: Yanan Wang --- tests/qtest/bios-tables-test-allowed-diff.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/te

[PATCH v5 14/14] tests/acpi/bios-table-test: Update expected virt/PPTT file

2021-12-28 Thread Yanan Wang via
Run ./tests/data/acpi/rebuild-expected-aml.sh from build directory to update PPTT binary. Also empty bios-tables-test-allowed-diff.h. The disassembled differences between actual and expected PPTT: /* * Intel ACPI Component Architecture * AML/ASL+ Disassembler version 20180810 (64-bit version

[PATCH v5 13/14] hw/arm/virt-acpi-build: Support cluster level in PPTT generation

2021-12-28 Thread Yanan Wang via
Support cluster level in generation of ACPI Processor Properties Topology Table (PPTT) for ARM virt machines. Signed-off-by: Yanan Wang --- hw/arm/virt-acpi-build.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 3ce7

[PATCH v5 11/14] hw/arm/virt-acpi-build: Make an ARM specific PPTT generator

2021-12-28 Thread Yanan Wang via
We have a generic build_pptt() in hw/acpi/aml-build.c but it's currently only used in ARM acpi initialization. Now we are going to support the new CPU cluster parameter which is currently only supported by ARM, it won't be a very good idea to add it to the generic build_pptt() as it will make the c

[PATCH v5 08/14] hw/arm/virt: Support clusters on ARM virt machines

2021-12-28 Thread Yanan Wang via
In implementations of ARM64 architecture, at most there could be a CPU topology hierarchy like "sockets/dies/clusters/cores/threads" defined. For example, some ARM64 server chip Kunpeng 920 totally has 2 sockets, 2 NUMA nodes (also represent CPU dies range) in each socket, 6 clusters in each NUMA n

[PATCH v5 10/14] hw/acpi/aml-build: Improve scalability of PPTT generation

2021-12-28 Thread Yanan Wang via
Currently we generate a PPTT table of n-level processor hierarchy with n-level loops in build_pptt(). It works fine as now there are only three CPU topology parameters. But the code may become less scalable with the processor hierarchy levels increasing. This patch only improves the scalability of

[PATCH v5 05/14] tests/unit/test-smp-parse: No need to explicitly zero MachineClass members

2021-12-28 Thread Yanan Wang via
The default value of the MachineClass members is 0, which means we don't have to explicitly zero them. Also the value of "mc->smp_props.prefer_sockets" will be taken care of by smp_parse_test(), we don't necessarily need the statement in machine_base_class_init() either. Signed-off-by: Yanan Wang

[PATCH v5 07/14] MAINTAINERS: Self-recommended as reviewer of "Machine core"

2021-12-28 Thread Yanan Wang via
I've built interests in the generic machine subsystem and have also been working on projects related to this part, self-recommand myself as a reviewer so that I can help to review some patches familiar to me, and have a chance to learn more continuously. Signed-off-by: Yanan Wang --- MAINTAINERS

[PATCH v5 09/14] hw/arm/virt: Support cluster level in DT cpu-map

2021-12-28 Thread Yanan Wang via
Support one cluster level between core and physical package in the cpu-map of Arm/virt devicetree. This is also consistent with Linux Doc "Documentation/devicetree/bindings/cpu/cpu-topology.txt". Signed-off-by: Yanan Wang --- hw/arm/virt.c | 15 --- 1 file changed, 8 insertions(+), 7

[PATCH v5 06/14] tests/unit/test-smp-parse: Keep default MIN/MAX CPUs in machine_base_class_init

2021-12-28 Thread Yanan Wang via
Most machine types in test-smp-parse will be OK to have the default MIN/MAX CPUs except "smp-generic-invalid", let's keep the default values in machine_base_class_init which will be inherited. And if we hope a different value for a specific machine, modify it in its own initialization function. Si

[PATCH v5 03/14] hw/core/machine: Wrap target specific parameters together

2021-12-28 Thread Yanan Wang via
Wrap the CPU target specific parameters together into a single variable except generic sockets/cores/threads, to make related code lines shorter and more concise. No functional change intended. Signed-off-by: Yanan Wang --- hw/core/machine-smp.c | 17 ++--- 1 file changed, 10 insert

[PATCH v5 01/14] qemu-options: Improve readability of SMP related Docs

2021-12-28 Thread Yanan Wang via
We have a description in qemu-options.hx for each CPU topology parameter to explain what it exactly means, and also an extra declaration for the target-specific one, e.g. "for PC only" when describing "dies", and "for PC, it's on one die" when describing "cores". Now we are going to introduce one

[PATCH v5 04/14] tests/unit/test-smp-parse: Add testcases for CPU clusters

2021-12-28 Thread Yanan Wang via
Add testcases for parsing of the four-level CPU topology hierarchy, ie sockets/clusters/cores/threads, which will be supported on ARM virt machines. Signed-off-by: Yanan Wang --- tests/unit/test-smp-parse.c | 130 ++-- 1 file changed, 123 insertions(+), 7 deletion

[PATCH v5 02/14] hw/core/machine: Introduce CPU cluster topology support

2021-12-28 Thread Yanan Wang via
The new Cluster-Aware Scheduling support has landed in Linux 5.16, which has been proved to benefit the scheduling performance (e.g. load balance and wake_affine strategy) on both x86_64 and AArch64. So now in Linux 5.16 we have four-level arch-neutral CPU topology definition like below and a new

[PATCH v5 00/14] ARM virt: Introduce CPU clusters topology support

2021-12-28 Thread Yanan Wang via
Hi, This series introduces the new CPU clusters topology parameter and enable the support for it on ARM virt machines. Background and descriptions: The new Cluster-Aware Scheduling support has landed in Linux 5.16, which has been proved to benefit the scheduling performance (e.g. load balance and

[PATCH for-6.2] qapi/machine.json: Fix incorrect description for die-id

2021-11-21 Thread Yanan Wang via
In terms of scope, die-id should mean "the die number within socket the CPU belongs to" instead of "the die number within node/board the CPU belongs to". Fix it to avoid confusing the Doc reader. Fixes: 176d2cda0d ("i386/cpu: Consolidate die-id validity in smp context") Signed-off-by: Yanan Wang

[PATCH v4 06/10] hw/acpi/aml-build: Improve scalability of PPTT generation

2021-11-21 Thread Yanan Wang via
Currently we generate a PPTT table of n-level processor hierarchy with n-level loops in build_pptt(). It works fine as now there are only three CPU topology parameters. But the code may become less scalable with the processor hierarchy levels increasing. This patch only improves the scalability of

[PATCH v4 07/10] hw/arm/virt-acpi-build: Make an ARM specific PPTT generator

2021-11-21 Thread Yanan Wang via
We have a generic build_pptt() in hw/acpi/aml-build.c but it's currently only used in ARM acpi initialization. Now we are going to support the new CPU cluster parameter which is currently only supported by ARM, it won't be a very good idea to add it to the generic build_pptt() as it will make the c

[PATCH v4 08/10] tests/acpi/bios-tables-test: Allow changes to virt/PPTT file

2021-11-21 Thread Yanan Wang via
List test/data/acpi/virt/PPTT as the expected files allowed to be changed in tests/qtest/bios-tables-test-allowed-diff.h Signed-off-by: Yanan Wang --- tests/qtest/bios-tables-test-allowed-diff.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/te

[PATCH v4 01/10] qemu-options: Improve readability of SMP related Docs

2021-11-21 Thread Yanan Wang via
We have a description in qemu-options.hx for each CPU topology parameter to explain what it exactly means, and also an extra declaration for the target-specific one, e.g. "for PC only" when describing "dies", and "for PC, it's on one die" when describing "cores". Now we are going to introduce one

[PATCH v4 10/10] tests/acpi/bios-table-test: Update expected virt/PPTT file

2021-11-21 Thread Yanan Wang via
Run ./tests/data/acpi/rebuild-expected-aml.sh from build directory to update PPTT binary. Also empty bios-tables-test-allowed-diff.h. The disassembled differences between actual and expected PPTT: /* * Intel ACPI Component Architecture * AML/ASL+ Disassembler version 20180810 (64-bit version

[PATCH v4 03/10] hw/core/machine: Wrap target specific parameters together

2021-11-21 Thread Yanan Wang via
Wrap the CPU target specific parameters together into a single variable, so that we don't need to update the other lines but a single line when new topology parameters are introduced. No functional change intended. Signed-off-by: Yanan Wang --- hw/core/machine-smp.c | 17 ++--- 1 fi

[PATCH v4 02/10] hw/core/machine: Introduce CPU cluster topology support

2021-11-21 Thread Yanan Wang via
The new Cluster-Aware Scheduling support has landed in Linux 5.16, which has been proved to benefit the scheduling performance (e.g. load balance and wake_affine strategy) on both x86_64 and AArch64. So now in Linux 5.16 we have four-level arch-neutral CPU topology definition like below and a new

[PATCH v4 00/10] ARM virt: Introduce CPU clusters topology support

2021-11-21 Thread Yanan Wang via
Hi, This series introduces the new CPU clusters topology parameter and enable the support for it on ARM virt machines. Background and descriptions: The new Cluster-Aware Scheduling support has landed in Linux 5.16, which has been proved to benefit the scheduling performance (e.g. load balance and

[PATCH v4 05/10] hw/arm/virt: Support cluster level in DT cpu-map

2021-11-21 Thread Yanan Wang via
Support one cluster level between core and physical package in the cpu-map of Arm/virt devicetree. This is also consistent with Linux Doc "Documentation/devicetree/bindings/cpu/cpu-topology.txt". Signed-off-by: Yanan Wang --- hw/arm/virt.c | 15 --- 1 file changed, 8 insertions(+), 7

[PATCH v4 09/10] hw/acpi/virt-acpi-build: Support cluster level in PPTT generation

2021-11-21 Thread Yanan Wang via
Support cluster level in generation of ACPI Processor Properties Topology Table (PPTT) for ARM virt machines. Signed-off-by: Yanan Wang --- hw/arm/virt-acpi-build.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index bef7

[PATCH v4 04/10] hw/arm/virt: Support clusters on ARM virt machines

2021-11-21 Thread Yanan Wang via
In implementations of ARM64 architecture, at most there could be a CPU topology hierarchy like "sockets/dies/clusters/cores/threads" defined. For example, some ARM64 server chip Kunpeng 920 totally has 2 sockets, 2 NUMA nodes (also represent CPU dies range) in each socket, 6 clusters in each NUMA n