Re: [RFC PATCH v2 2/6] kvm: arm64: Add support for get_cur_cpufreq service

From: Bagas Sanjaya
Date: Fri Mar 31 2023 - 23:16:50 EST


On Thu, Mar 30, 2023 at 06:43:46PM -0700, David Dai wrote:
> diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
> index 62de0768d6aa..b0ff0ad700bf 100644
> --- a/Documentation/virt/kvm/api.rst
> +++ b/Documentation/virt/kvm/api.rst
> @@ -8380,6 +8380,14 @@ structure.
> When getting the Modified Change Topology Report value, the attr->addr
> must point to a byte where the value will be stored or retrieved from.
>
> +8.40 KVM_CAP_GET_CUR_CPUFREQ
> +------------------------
> +
> +:Architectures: arm64
> +
> +This capability indicates that KVM supports getting the
> +frequency of the current CPU that the vCPU thread is running on.
> +
> 9. Known KVM API problems
> =========================
>
> diff --git a/Documentation/virt/kvm/arm/get_cur_cpufreq.rst b/Documentation/virt/kvm/arm/get_cur_cpufreq.rst
> new file mode 100644
> index 000000000000..06e0ed5b3868
> --- /dev/null
> +++ b/Documentation/virt/kvm/arm/get_cur_cpufreq.rst
> @@ -0,0 +1,21 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +get_cur_cpufreq support for arm/arm64
> +=============================
> +
> +Get_cur_cpufreq support is used to get current frequency(in KHz) of the
> +current CPU that the vCPU thread is running on.
> +
> +* ARM_SMCCC_VENDOR_HYP_KVM_GET_CUR_CPUFREQ_FUNC_ID: 0x86000040
> +
> +This hypercall uses the SMC32/HVC32 calling convention:
> +
> +ARM_SMCCC_VENDOR_HYP_KVM_GET_CUR_CPUFREQ_FUNC_ID
> + ============== ======== =====================================
> + Function ID: (uint32) 0x86000040
> + Return Values: (int32) NOT_SUPPORTED(-1) on error, or
> + (uint32) Frequency in KHz of current CPU that the
> + vCPU thread is running on.
> + Endianness: Must be the same endianness
> + as the host.
> + ============== ======== =====================================

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

8.40 KVM_CAP_GET_CUR_CPUFREQ
------------------------
/home/bagas/repo/linux-kernel/Documentation/virt/kvm/api.rst:8384: WARNING: Title underline too short.

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

I have applied the fixup:

---- >8 ----
diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
index 8f905456e2b4a1..baf8a4c43b5839 100644
--- a/Documentation/virt/kvm/api.rst
+++ b/Documentation/virt/kvm/api.rst
@@ -8381,7 +8381,7 @@ When getting the Modified Change Topology Report value, the attr->addr
must point to a byte where the value will be stored or retrieved from.

8.40 KVM_CAP_GET_CUR_CPUFREQ
-------------------------
+----------------------------

:Architectures: arm64

diff --git a/Documentation/virt/kvm/arm/get_cur_cpufreq.rst b/Documentation/virt/kvm/arm/get_cur_cpufreq.rst
index 06e0ed5b3868d7..76f112efb99f92 100644
--- a/Documentation/virt/kvm/arm/get_cur_cpufreq.rst
+++ b/Documentation/virt/kvm/arm/get_cur_cpufreq.rst
@@ -11,11 +11,12 @@ current CPU that the vCPU thread is running on.
This hypercall uses the SMC32/HVC32 calling convention:

ARM_SMCCC_VENDOR_HYP_KVM_GET_CUR_CPUFREQ_FUNC_ID
- ============== ======== =====================================
+
+ ============== ======== ========================================
Function ID: (uint32) 0x86000040
Return Values: (int32) NOT_SUPPORTED(-1) on error, or
(uint32) Frequency in KHz of current CPU that the
vCPU thread is running on.
Endianness: Must be the same endianness
as the host.
- ============== ======== =====================================
+ ============== ======== ========================================

Thanks.

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