arm64/kvm: Make use of the system wide safe values
authorSuzuki K. Poulose <suzuki.poulose@arm.com>
Mon, 19 Oct 2015 13:24:55 +0000 (14:24 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 21 Oct 2015 14:35:59 +0000 (15:35 +0100)
Use the system wide safe value from the new API for safer
decisions

Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Christoffer Dall <christoffer.dall@linaro.org>
Cc: kvmarm@lists.cs.columbia.edu
Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Tested-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kvm/reset.c
arch/arm64/kvm/sys_regs.c

index 91cf5350b3283232cd6d88aca9af669ce972c697..f34745cb3d236fe0a4731f8d02031f8ff764d69c 100644 (file)
@@ -53,7 +53,7 @@ static bool cpu_has_32bit_el1(void)
 {
        u64 pfr0;
 
-       pfr0 = read_cpuid(ID_AA64PFR0_EL1);
+       pfr0 = read_system_reg(SYS_ID_AA64PFR0_EL1);
        return !!(pfr0 & 0x20);
 }
 
index d03d3af17e7eef784d528479e2f4fed305ee5f75..87a64e8db04c4dac07a5d289ad0c2dd22860f0e2 100644 (file)
@@ -693,13 +693,13 @@ static bool trap_dbgidr(struct kvm_vcpu *vcpu,
        if (p->is_write) {
                return ignore_write(vcpu, p);
        } else {
-               u64 dfr = read_cpuid(ID_AA64DFR0_EL1);
-               u64 pfr = read_cpuid(ID_AA64PFR0_EL1);
-               u32 el3 = !!((pfr >> 12) & 0xf);
+               u64 dfr = read_system_reg(SYS_ID_AA64DFR0_EL1);
+               u64 pfr = read_system_reg(SYS_ID_AA64PFR0_EL1);
+               u32 el3 = !!cpuid_feature_extract_field(pfr, ID_AA64PFR0_EL3_SHIFT);
 
-               *vcpu_reg(vcpu, p->Rt) = ((((dfr >> 20) & 0xf) << 28) |
-                                         (((dfr >> 12) & 0xf) << 24) |
-                                         (((dfr >> 28) & 0xf) << 20) |
+               *vcpu_reg(vcpu, p->Rt) = ((((dfr >> ID_AA64DFR0_WRPS_SHIFT) & 0xf) << 28) |
+                                         (((dfr >> ID_AA64DFR0_BRPS_SHIFT) & 0xf) << 24) |
+                                         (((dfr >> ID_AA64DFR0_CTX_CMPS_SHIFT) & 0xf) << 20) |
                                          (6 << 16) | (el3 << 14) | (el3 << 12));
                return true;
        }