Line 0
Link Here
|
|
|
1 |
--- target/arm/helper.c.orig 2019-12-12 03:59:10.000000000 +0100 |
2 |
+++ target/arm/helper.c 2020-01-15 14:06:54.190516000 +0100 |
3 |
@@ -2919,7 +2919,7 @@ static uint64_t mpidr_read(CPUARMState *env, const ARM |
4 |
static const ARMCPRegInfo mpidr_cp_reginfo[] = { |
5 |
{ .name = "MPIDR", .state = ARM_CP_STATE_BOTH, |
6 |
.opc0 = 3, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 5, |
7 |
- .access = PL1_R, .readfn = mpidr_read, .type = ARM_CP_NO_RAW }, |
8 |
+ .access = PL0U_R, .readfn = mpidr_read, .type = ARM_CP_NO_RAW }, |
9 |
REGINFO_SENTINEL |
10 |
}; |
11 |
|
12 |
@@ -4601,6 +4601,7 @@ static uint64_t id_pfr1_read(CPUARMState *env, const A |
13 |
return pfr1; |
14 |
} |
15 |
|
16 |
+#ifndef CONFIG_USER_ONLY |
17 |
static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri) |
18 |
{ |
19 |
ARMCPU *cpu = arm_env_get_cpu(env); |
20 |
@@ -4611,6 +4612,7 @@ static uint64_t id_aa64pfr0_read(CPUARMState *env, con |
21 |
} |
22 |
return pfr0; |
23 |
} |
24 |
+#endif |
25 |
|
26 |
void register_cp_regs_for_features(ARMCPU *cpu) |
27 |
{ |
28 |
@@ -4759,18 +4761,25 @@ void register_cp_regs_for_features(ARMCPU *cpu) |
29 |
* define new registers here. |
30 |
*/ |
31 |
ARMCPRegInfo v8_idregs[] = { |
32 |
- /* ID_AA64PFR0_EL1 is not a plain ARM_CP_CONST because we don't |
33 |
- * know the right value for the GIC field until after we |
34 |
- * define these regs. |
35 |
+ /* ID_AA64PFR0_EL1 is not a plain ARM_CP_CONST for system |
36 |
+ * emulation because we don't know the right value for the |
37 |
+ * GIC field until after we define these regs. For |
38 |
+ * user-mode HWCAP_CPUID emulation the GIC bits are masked |
39 |
+ * anyway. |
40 |
*/ |
41 |
{ .name = "ID_AA64PFR0_EL1", .state = ARM_CP_STATE_AA64, |
42 |
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 0, |
43 |
+#ifndef CONFIG_USER_ONLY |
44 |
.access = PL1_R, .type = ARM_CP_NO_RAW, |
45 |
.readfn = id_aa64pfr0_read, |
46 |
- .writefn = arm_cp_write_ignore }, |
47 |
+#else |
48 |
+ .access = PL0U_R, .type = ARM_CP_CONST, |
49 |
+ .resetvalue = cpu->id_aa64pfr0 & 0x000f000f0ff0000ULL |
50 |
+#endif |
51 |
+ }, |
52 |
{ .name = "ID_AA64PFR1_EL1", .state = ARM_CP_STATE_AA64, |
53 |
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 1, |
54 |
- .access = PL1_R, .type = ARM_CP_CONST, |
55 |
+ .access = PL0U_R, .type = ARM_CP_CONST, |
56 |
.resetvalue = cpu->id_aa64pfr1}, |
57 |
{ .name = "ID_AA64PFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, |
58 |
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 2, |
59 |
@@ -4798,7 +4807,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) |
60 |
.resetvalue = 0 }, |
61 |
{ .name = "ID_AA64DFR0_EL1", .state = ARM_CP_STATE_AA64, |
62 |
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 0, |
63 |
- .access = PL1_R, .type = ARM_CP_CONST, |
64 |
+ .access = PL0U_R, .type = ARM_CP_CONST, |
65 |
.resetvalue = cpu->id_aa64dfr0 }, |
66 |
{ .name = "ID_AA64DFR1_EL1", .state = ARM_CP_STATE_AA64, |
67 |
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 1, |
68 |
@@ -4830,11 +4839,16 @@ void register_cp_regs_for_features(ARMCPU *cpu) |
69 |
.resetvalue = 0 }, |
70 |
{ .name = "ID_AA64ISAR0_EL1", .state = ARM_CP_STATE_AA64, |
71 |
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 0, |
72 |
- .access = PL1_R, .type = ARM_CP_CONST, |
73 |
- .resetvalue = cpu->id_aa64isar0 }, |
74 |
+ .access = PL0U_R, .type = ARM_CP_CONST, |
75 |
+#ifdef CONFIG_USER_ONLY |
76 |
+ .resetvalue = cpu->id_aa64isar0 & 0x000fffffff0ffff0ULL |
77 |
+#else |
78 |
+ .resetvalue = cpu->id_aa64isar0 |
79 |
+#endif |
80 |
+ }, |
81 |
{ .name = "ID_AA64ISAR1_EL1", .state = ARM_CP_STATE_AA64, |
82 |
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 1, |
83 |
- .access = PL1_R, .type = ARM_CP_CONST, |
84 |
+ .access = PL0U_R, .type = ARM_CP_CONST, |
85 |
.resetvalue = cpu->id_aa64isar1 }, |
86 |
{ .name = "ID_AA64ISAR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, |
87 |
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 2, |
88 |
@@ -4862,11 +4876,11 @@ void register_cp_regs_for_features(ARMCPU *cpu) |
89 |
.resetvalue = 0 }, |
90 |
{ .name = "ID_AA64MMFR0_EL1", .state = ARM_CP_STATE_AA64, |
91 |
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 0, |
92 |
- .access = PL1_R, .type = ARM_CP_CONST, |
93 |
+ .access = PL0U_R, .type = ARM_CP_CONST, |
94 |
.resetvalue = cpu->id_aa64mmfr0 }, |
95 |
{ .name = "ID_AA64MMFR1_EL1", .state = ARM_CP_STATE_AA64, |
96 |
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 1, |
97 |
- .access = PL1_R, .type = ARM_CP_CONST, |
98 |
+ .access = PL0U_R, .type = ARM_CP_CONST, |
99 |
.resetvalue = cpu->id_aa64mmfr1 }, |
100 |
{ .name = "ID_AA64MMFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, |
101 |
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 2, |
102 |
@@ -5160,7 +5174,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) |
103 |
ARMCPRegInfo id_v8_midr_cp_reginfo[] = { |
104 |
{ .name = "MIDR_EL1", .state = ARM_CP_STATE_BOTH, |
105 |
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 0, .opc2 = 0, |
106 |
- .access = PL1_R, .type = ARM_CP_NO_RAW, .resetvalue = cpu->midr, |
107 |
+ .access = PL0U_R, .type = ARM_CP_NO_RAW, .resetvalue = cpu->midr, |
108 |
.fieldoffset = offsetof(CPUARMState, cp15.c0_cpuid), |
109 |
.readfn = midr_read }, |
110 |
/* crn = 0 op1 = 0 crm = 0 op2 = 4,7 : AArch32 aliases of MIDR */ |
111 |
@@ -5172,7 +5186,13 @@ void register_cp_regs_for_features(ARMCPU *cpu) |
112 |
.access = PL1_R, .resetvalue = cpu->midr }, |
113 |
{ .name = "REVIDR_EL1", .state = ARM_CP_STATE_BOTH, |
114 |
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 0, .opc2 = 6, |
115 |
- .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = cpu->revidr }, |
116 |
+#ifdef CONFIG_USER_ONLY |
117 |
+ .access = PL0U_R, .type = ARM_CP_CONST, |
118 |
+ .resetvalue = 0 /* HW_CPUID IMPDEF fields are 0 */ }, |
119 |
+#else |
120 |
+ .access = PL1_R, .type = ARM_CP_CONST, |
121 |
+ .resetvalue = cpu->revidr }, |
122 |
+#endif |
123 |
REGINFO_SENTINEL |
124 |
}; |
125 |
ARMCPRegInfo id_cp_reginfo[] = { |