[PATCH v6 14/14] arm/kvm: use fd instead of fdarray[2]

Cornelia Huck posted 14 patches 9 months, 1 week ago
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Alexander Graf <agraf@csgraf.de>, Paolo Bonzini <pbonzini@redhat.com>
There is a newer version of this series
[PATCH v6 14/14] arm/kvm: use fd instead of fdarray[2]
Posted by Cornelia Huck 9 months, 1 week ago
We have fd, so might as well neaten things up.

Suggested-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
 target/arm/kvm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index abb63b7f617f..1ffd67a39056 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -387,11 +387,11 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
         err |= get_host_cpu_reg(fd, ahcf, ID_ISAR6_EL1_IDX);
         err |= get_host_cpu_reg(fd, ahcf, ID_MMFR4_EL1_IDX);
 
-        err |= read_sys_reg32(fdarray[2], &ahcf->isar.mvfr0,
+        err |= read_sys_reg32(fd, &ahcf->isar.mvfr0,
                               ARM64_SYS_REG(3, 0, 0, 3, 0));
-        err |= read_sys_reg32(fdarray[2], &ahcf->isar.mvfr1,
+        err |= read_sys_reg32(fd, &ahcf->isar.mvfr1,
                               ARM64_SYS_REG(3, 0, 0, 3, 1));
-        err |= read_sys_reg32(fdarray[2], &ahcf->isar.mvfr2,
+        err |= read_sys_reg32(fd, &ahcf->isar.mvfr2,
                               ARM64_SYS_REG(3, 0, 0, 3, 2));
         err |= get_host_cpu_reg(fd, ahcf, ID_PFR2_EL1_IDX);
         err |= get_host_cpu_reg(fd, ahcf, ID_DFR1_EL1_IDX);
@@ -429,7 +429,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
 
         if (pmu_supported) {
             /* PMCR_EL0 is only accessible if the vCPU has feature PMU_V3 */
-            err |= read_sys_reg64(fdarray[2], &ahcf->isar.reset_pmcr_el0,
+            err |= read_sys_reg64(fd, &ahcf->isar.reset_pmcr_el0,
                                   ARM64_SYS_REG(3, 3, 9, 12, 0));
         }
 
-- 
2.49.0
Re: [PATCH v6 14/14] arm/kvm: use fd instead of fdarray[2]
Posted by Eric Auger 9 months ago
Hi Connie,

On 5/6/25 10:52 AM, Cornelia Huck wrote:
> We have fd, so might as well neaten things up.
>
> Suggested-by: Eric Auger <eric.auger@redhat.com>
> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>

Cheers

Eric
> ---
>  target/arm/kvm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
> index abb63b7f617f..1ffd67a39056 100644
> --- a/target/arm/kvm.c
> +++ b/target/arm/kvm.c
> @@ -387,11 +387,11 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
>          err |= get_host_cpu_reg(fd, ahcf, ID_ISAR6_EL1_IDX);
>          err |= get_host_cpu_reg(fd, ahcf, ID_MMFR4_EL1_IDX);
>  
> -        err |= read_sys_reg32(fdarray[2], &ahcf->isar.mvfr0,
> +        err |= read_sys_reg32(fd, &ahcf->isar.mvfr0,
>                                ARM64_SYS_REG(3, 0, 0, 3, 0));
> -        err |= read_sys_reg32(fdarray[2], &ahcf->isar.mvfr1,
> +        err |= read_sys_reg32(fd, &ahcf->isar.mvfr1,
>                                ARM64_SYS_REG(3, 0, 0, 3, 1));
> -        err |= read_sys_reg32(fdarray[2], &ahcf->isar.mvfr2,
> +        err |= read_sys_reg32(fd, &ahcf->isar.mvfr2,
>                                ARM64_SYS_REG(3, 0, 0, 3, 2));
>          err |= get_host_cpu_reg(fd, ahcf, ID_PFR2_EL1_IDX);
>          err |= get_host_cpu_reg(fd, ahcf, ID_DFR1_EL1_IDX);
> @@ -429,7 +429,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
>  
>          if (pmu_supported) {
>              /* PMCR_EL0 is only accessible if the vCPU has feature PMU_V3 */
> -            err |= read_sys_reg64(fdarray[2], &ahcf->isar.reset_pmcr_el0,
> +            err |= read_sys_reg64(fd, &ahcf->isar.reset_pmcr_el0,
>                                    ARM64_SYS_REG(3, 3, 9, 12, 0));
>          }
>