Re: [RFC PATCH v2 4/6] kvm: arm64: Add support for get_freqtbl service

From: Bagas Sanjaya
Date: Fri Mar 31 2023 - 23:28:32 EST


On Thu, Mar 30, 2023 at 06:43:48PM -0700, David Dai wrote:
> diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
> index 38ce33564efc..8f905456e2b4 100644
> --- a/Documentation/virt/kvm/api.rst
> +++ b/Documentation/virt/kvm/api.rst
> @@ -8400,6 +8400,14 @@ after normalizing for architecture. This is useful when guests are tracking
> workload on its vCPUs. Util hints allow the host to make more accurate
> frequency selections and task placement for vCPU threads.
>
> +8.42 KVM_CAP_GET_CPUFREQ_TBL
> +---------------------------
> +
> +:Architectures: arm64
> +
> +This capability indicates that the KVM supports getting the
> +frequency table of the current CPU that the vCPU thread is running on.
> +
> 9. Known KVM API problems
> =========================
>
> diff --git a/Documentation/virt/kvm/arm/get_freqtbl.rst b/Documentation/virt/kvm/arm/get_freqtbl.rst
> new file mode 100644
> index 000000000000..f6832d7566e7
> --- /dev/null
> +++ b/Documentation/virt/kvm/arm/get_freqtbl.rst
> @@ -0,0 +1,23 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +get_freqtbl support for arm/arm64
> +=============================
> +
> +Allows guest to query the frequency(in KHz) table of the current CPU that
> +the vCPU thread is running on.
> +
> +* ARM_SMCCC_VENDOR_HYP_KVM_GET_CPUFREQ_TBL_FUNC_ID: 0x86000042
> +
> +This hypercall uses the SMC32/HVC32 calling convention:
> +
> +ARM_SMCCC_VENDOR_HYP_KVM_GET_CPUFREQ_TBL_FUNC_ID
> + ============== ======== =====================================
> + Function ID: (uint32) 0x86000042
> + Arguments: (uint32) index of the current CPU's frequency table
> + Return Values: (int32) NOT_SUPPORTED(-1) on error, or
> + (uint32) Frequency table entry of requested index
> + in KHz
> + of current CPU(r1)
> + Endianness: Must be the same endianness
> + as the host.
> + ============== ======== =====================================

Sphinx reports htmldocs warnings:
/home/bagas/repo/linux-kernel/Documentation/virt/kvm/api.rst:8404: WARNING: Title underline too short.

8.42 KVM_CAP_GET_CPUFREQ_TBL
---------------------------
/home/bagas/repo/linux-kernel/Documentation/virt/kvm/api.rst:8404: WARNING: Title underline too short.

8.42 KVM_CAP_GET_CPUFREQ_TBL
---------------------------
/home/bagas/repo/linux-kernel/Documentation/virt/kvm/arm/get_freqtbl.rst:4: WARNING: Title underline too short.

get_freqtbl support for arm/arm64
=============================

I have applied the fixup:

---- >8 ----
diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
index baf8a4c43b5839..3579c470375938 100644
--- a/Documentation/virt/kvm/api.rst
+++ b/Documentation/virt/kvm/api.rst
@@ -8401,7 +8401,7 @@ workload on its vCPUs. Util hints allow the host to make more accurate
frequency selections and task placement for vCPU threads.

8.42 KVM_CAP_GET_CPUFREQ_TBL
----------------------------
+----------------------------

:Architectures: arm64

diff --git a/Documentation/virt/kvm/arm/get_freqtbl.rst b/Documentation/virt/kvm/arm/get_freqtbl.rst
index f6832d7566e7e5..215bf0f653e461 100644
--- a/Documentation/virt/kvm/arm/get_freqtbl.rst
+++ b/Documentation/virt/kvm/arm/get_freqtbl.rst
@@ -1,7 +1,7 @@
.. SPDX-License-Identifier: GPL-2.0

get_freqtbl support for arm/arm64
-=============================
+=================================

Allows guest to query the frequency(in KHz) table of the current CPU that
the vCPU thread is running on.

Thanks.

--
An old man doll... just what I always wanted! - Clara