[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/5] target/arm: Introduce read_sys_reg32 for kv
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 3/5] target/arm: Introduce read_sys_reg32 for kvm32 |
Date: |
Fri, 2 Nov 2018 14:30:32 +0000 |
On 24 October 2018 at 12:37, Richard Henderson
<address@hidden> wrote:
> Assert that the value to be written is the correct size.
> No change in functionality here, just mirroring the same
> function from kvm64.
>
> Signed-off-by: Richard Henderson <address@hidden>
> ---
> target/arm/kvm32.c | 41 ++++++++++++++++-------------------------
> 1 file changed, 16 insertions(+), 25 deletions(-)
> - struct kvm_one_reg idregs[] = {
> - {
> - .id = KVM_REG_ARM | KVM_REG_SIZE_U32
> - | ENCODE_CP_REG(15, 0, 0, 0, 0, 0, 0),
> - .addr = (uintptr_t)&midr,
> - },
> - {
> - .id = KVM_REG_ARM | KVM_REG_SIZE_U32
> - | ENCODE_CP_REG(15, 0, 0, 0, 1, 0, 0),
> - .addr = (uintptr_t)&id_pfr0,
> - },
> - {
> - .id = KVM_REG_ARM | KVM_REG_SIZE_U32
> - | KVM_REG_ARM_VFP | KVM_REG_ARM_VFP_MVFR1,
> - .addr = (uintptr_t)&mvfr1,
> - },
> - };
>
> if (!kvm_arm_create_scratch_host_vcpu(cpus_to_try, fdarray, &init)) {
> return false;
> @@ -77,16 +69,15 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures
> *ahcf)
> */
> ahcf->dtb_compatible = "arm,arm-v7";
>
> - for (i = 0; i < ARRAY_SIZE(idregs); i++) {
> - ret = ioctl(fdarray[2], KVM_GET_ONE_REG, &idregs[i]);
> - if (ret) {
> - break;
> - }
> - }
> + err |= read_sys_reg32(fdarray[2], &midr, ARM_CP15_REG32(0, 0, 0, 0));
> + err |= read_sys_reg32(fdarray[2], &id_pfr0, ARM_CP15_REG32(0, 0, 1, 0));
Reviewed-by: Peter Maydell <address@hidden>
with the declaration of 'i' removed.
(Confusingly, ENCODE_CP_REG and ARM_CP15_REG32 take the
op1/crn/crm/op2 arguments in different orders.)
thanks
-- PMM
- Re: [Qemu-devel] [PATCH 3/5] target/arm: Introduce read_sys_reg32 for kvm32,
Peter Maydell <=