[PATCH 0/4] arm64: Add the cpufreq device to show cpufreq info to guest

Ying Fang posted 4 patches 1 week ago
Test docker-quick@centos7 passed
Test FreeBSD passed
Test docker-mingw@fedora failed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200213023532.902-1-fangying1@huawei.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Shannon Zhao <shannon.zhaosl@gmail.com>, Peter Maydell <peter.maydell@linaro.org>
default-configs/aarch64-softmmu.mak |   1 +
hw/acpi/Kconfig                     |   4 +
hw/acpi/Makefile.objs               |   1 +
hw/acpi/aml-build.c                 |  22 +++
hw/acpi/cpufreq.c                   | 247 ++++++++++++++++++++++++++++
hw/arm/virt-acpi-build.c            |  74 ++++++++-
hw/arm/virt.c                       |  14 ++
include/hw/acpi/acpi-defs.h         |  32 ++++
include/hw/acpi/aml-build.h         |   3 +
include/hw/arm/virt.h               |   1 +
10 files changed, 397 insertions(+), 2 deletions(-)
create mode 100644 hw/acpi/cpufreq.c

[PATCH 0/4] arm64: Add the cpufreq device to show cpufreq info to guest

Posted by Ying Fang 1 week ago
On ARM64 platform, cpu frequency is retrieved via ACPI CPPC.
A virtual cpufreq device based on ACPI CPPC is created to
present cpu frequency info to the guest.

The default frequency is set to host cpu nominal frequency,
which is obtained from the host CPPC sysfs. Other performance
data are set to the same value, since we don't support guest
performance scaling here.

Performance counters are also not emulated and they simply
return 1 if read, and guest should fallback to use desired
performance value as the current performance.

Guest kernel version above 4.18 is required to make it work.

Ying Fang (4):
  acpi: add aml_generic_register
  acpi/cppc: add ACPI CPPC registers
  arm_virt: add the cpufreq device model
  arm_virt: create the cpufreq device

 default-configs/aarch64-softmmu.mak |   1 +
 hw/acpi/Kconfig                     |   4 +
 hw/acpi/Makefile.objs               |   1 +
 hw/acpi/aml-build.c                 |  22 +++
 hw/acpi/cpufreq.c                   | 247 ++++++++++++++++++++++++++++
 hw/arm/virt-acpi-build.c            |  74 ++++++++-
 hw/arm/virt.c                       |  14 ++
 include/hw/acpi/acpi-defs.h         |  32 ++++
 include/hw/acpi/aml-build.h         |   3 +
 include/hw/arm/virt.h               |   1 +
 10 files changed, 397 insertions(+), 2 deletions(-)
 create mode 100644 hw/acpi/cpufreq.c

-- 
2.19.1



Re: [PATCH 0/4] arm64: Add the cpufreq device to show cpufreq info to guest

Posted by no-reply@patchew.org 1 week ago
Patchew URL: https://patchew.org/QEMU/20200213023532.902-1-fangying1@huawei.com/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#! /bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-mingw@fedora J=14 NETWORK=1
=== TEST SCRIPT END ===

  CC      hw/acpi/cpufreq.o
  CC      hw/acpi/ipmi.o
/tmp/qemu-test/src/hw/acpi/cpufreq.c: In function 'cpufreq_read':
/tmp/qemu-test/src/hw/acpi/cpufreq.c:71:47: error: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'hwaddr' {aka 'long long unsigned int'} [-Werror=format=]
         warn_report("cpufreq_read: offset 0x%lx out of range", offset);
                                             ~~^                ~~~~~~
                                             %llx
/tmp/qemu-test/src/hw/acpi/cpufreq.c:127:52: error: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'hwaddr' {aka 'long long unsigned int'} [-Werror=format=]
         error_printf("cpufreq_read: Bad offset 0x%lx\n", offset);
                                                  ~~^     ~~~~~~
                                                  %llx
/tmp/qemu-test/src/hw/acpi/cpufreq.c: In function 'cpufreq_write':
/tmp/qemu-test/src/hw/acpi/cpufreq.c:143:49: error: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'hwaddr' {aka 'long long unsigned int'} [-Werror=format=]
         error_printf("cpufreq_write: offset 0x%lx out of range", offset);
                                               ~~^                ~~~~~~
                                               %llx
/tmp/qemu-test/src/hw/acpi/cpufreq.c:153:53: error: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'hwaddr' {aka 'long long unsigned int'} [-Werror=format=]
         error_printf("cpufreq_write: Bad offset 0x%lx\n", offset);
                                                   ~~^     ~~~~~~
                                                   %llx
/tmp/qemu-test/src/hw/acpi/cpufreq.c: In function 'CPPC_Read':
/tmp/qemu-test/src/hw/acpi/cpufreq.c:176:44: error: passing argument 4 of 'qemu_strtoul' from incompatible pointer type [-Werror=incompatible-pointer-types]
     ret = qemu_strtoul(buffer, &endptr, 0, &hz);
                                            ^~~
In file included from /tmp/qemu-test/src/hw/acpi/cpufreq.c:30:
---
                  unsigned long *result);
                  ~~~~~~~~~~~~~~~^~~~~~
cc1: all warnings being treated as errors
make: *** [/tmp/qemu-test/src/rules.mak:69: hw/acpi/cpufreq.o] Error 1
make: *** Waiting for unfinished jobs....
Traceback (most recent call last):
  File "./tests/docker/docker.py", line 664, in <module>
---
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=9698cb6880c44cb0984a842b2be0fc70', '-u', '1001', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-_sia_b3d/src/docker-src.2020-02-12-22.07.28.16853:/var/tmp/qemu:z,ro', 'qemu:fedora', '/var/tmp/qemu/run', 'test-mingw']' returned non-zero exit status 2.
filter=--filter=label=com.qemu.instance.uuid=9698cb6880c44cb0984a842b2be0fc70
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-_sia_b3d/src'
make: *** [docker-run-test-mingw@fedora] Error 2

real    2m6.980s
user    0m8.259s


The full log is available at
http://patchew.org/logs/20200213023532.902-1-fangying1@huawei.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com