From: Baorui.Liu <baorliu@amd.com>
To: <linux-pm@vger.kernel.org>
Cc: <rafael@kernel.org>, <viresh.kumar@linaro.org>,
<saravanak@kernel.org>, <mst@redhat.com>, <jasowangio@gmail.com>,
<eperezma@redhat.com>, <xuanzhuo@linux.alibaba.com>,
<virtualization@lists.linux.dev>, Baorui.Liu <baorliu@amd.com>
Subject: [RFC PATCH 0/1] cpufreq: virtio frontend to report host CPU frequency
Date: Wed, 16 Sep 2026 15:37:34 +0800 [thread overview]
Message-ID: <20260916073735.541-1-baorliu@amd.com> (raw)
This RFC adds a guest virtio-cpufreq frontend so a VM can read the
host frequency of the pCPU that currently runs a given vCPU.
Context
=======
Android batterystats needs cpufreq together with power_profile.xml.
A Xen Android guest cannot read host sysfs, so QEMU already has a
backend (virtio device id 42) that returns xc_get_cpufreq_avgfreq()
for the pinned pCPU. This patch is the Linux frontend.
Why not virtual-cpufreq.c
=========================
drivers/cpufreq/virtual-cpufreq.c is an MMIO guest driver. This
stack is virtio + Xen/QEMU, so a separate frontend is used. Feedback
on folding into or sharing infrastructure with virtual-cpufreq is
welcome.
Known RFC issues
================
- Virtio device id 42 is not allocated by the OASIS virtio spec.
- The OPP table is hardcoded (1400/1700/3000 kHz) for bring-up.
- The QEMU backend is a separate series (not this patch).
- .get() waits on a virtqueue and may sleep.
Please comment on the id allocation, protocol, and whether this
belongs in linux-pm as RFC before a formal PATCH.
Baorui.Liu (1):
cpufreq: virtio: add driver to report host frequency to guests
drivers/cpufreq/Kconfig | 14 ++
drivers/cpufreq/Makefile | 1 +
drivers/cpufreq/virtio-cpufreq.c | 235 +++++++++++++++++++++++++++++++
include/uapi/linux/virtio_ids.h | 1 +
4 files changed, 251 insertions(+)
create mode 100644 drivers/cpufreq/virtio-cpufreq.c
--
2.34.1
next reply other threads:[~2026-09-16 7:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 7:37 Baorui.Liu [this message]
2026-09-16 7:37 ` [RFC PATCH 1/1] cpufreq: virtio: add driver to report host frequency to guests Baorui.Liu
2026-09-16 7:49 ` sashiko-bot
2026-09-19 6:19 ` kernel test robot
2026-09-22 9:02 ` [RFC PATCH v2 0/1] cpufreq: virtio frontend to report host CPU frequency Baorui.Liu
2026-09-22 9:22 ` Michael S. Tsirkin
2026-09-22 9:02 ` [RFC PATCH v2 1/1] cpufreq: virtio: add driver to report host frequency to guests Baorui.Liu
2026-09-22 9:13 ` sashiko-bot
2026-09-24 7:18 ` Saravana Kannan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260916073735.541-1-baorliu@amd.com \
--to=baorliu@amd.com \
--cc=eperezma@redhat.com \
--cc=jasowangio@gmail.com \
--cc=linux-pm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=rafael@kernel.org \
--cc=saravanak@kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.