arm: Steps towards EL2 support round 5
cover arm: Steps towards EL2 support round 5
From: "Edgar E. Iglesias" <[email protected]>
Hi,
Another round of patches towards EL2 support. This one adds partial support for 2-stage MMU for AArch64. I've marked it RFC because I expect a few iterations. Once we can settle on the approach I'll add the AArch32 support (changes for arm_ldl_ptw etc). I've probably missed alot of details aswell.
Some of the details of error reporting are intentionally missing, I was thinking to add those incrementally as they get quite involved (e.g the register target and memory access size).
Some of the patches at the start of the series might be good already, please pick them up if you agree Peter!
Comments welcome!
Best regards,
Edgar
Edgar E. Iglesias (8):
target-arm: Add HPFAR_EL2
target-arm: Add computation of starting level for S2 PTW
target-arm: Add support for S2 page-table protection bits
target-arm: Avoid inline for get_phys_addr
target-arm: Add ARMMMUFaultInfo
target-arm: Add S2 translation support for S1 PTW
target-arm: Route S2 MMU faults to EL2
target-arm: Add support for S1 + S2 MMU translations
target-arm/cpu.h | 1 + target-arm/helper.c | 211 ++++++++++++++++++++++++++++++++++++++++--------- target-arm/internals.h | 10 ++- target-arm/op_helper.c | 17 ++-- 4 files changed, 197 insertions(+), 42 deletions(-)
Signature · 1 line
1.9.1
RFC PATCH 1/8 target-arm: Add HPFAR_EL2
From: "Edgar E. Iglesias" <[email protected]>
--- target-arm/cpu.h | 1 + target-arm/helper.c | 7 +++++++ 2 files changed, 8 insertions(+)
target-arm/cpu.h +1 -0
@@ -280,6 +280,7 @@ typedef struct CPUARMState { };uint64_t far_el[4 ]; }; +uint64_t hpfar_el2; union { /* Translation result. */ struct { uint64_t _unused_par_0;
target-arm/helper.c +7 -0
@@ -3221,6 +3221,9 @@ static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = { { .name = "CNTHP_CTL_EL2", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 2, .opc2 = 1, .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, + { .name = "HPFAR_EL2", .state = ARM_CP_STATE_BOTH, + .opc0 = 3, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 4, + .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, REGINFO_SENTINEL };
@@ -3442,6 +3445,10 @@ static const ARMCPRegInfo el2_cp_reginfo[] = { .resetvalue = 0, .writefn = gt_hyp_ctl_write, .raw_writefn = raw_write },#endif + { .name = "HPFAR_EL2", .state = ARM_CP_STATE_BOTH, + .opc0 = 3, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 4, + .access = PL2_RW, + .fieldoffset = offsetof(CPUARMState, cp15.hpfar_el2) }, REGINFO_SENTINEL };
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH RFC 1/8] target-arm: Add HPFAR_EL2
Quoted 35 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Signed-off-by Edgar E. Iglesias <[email protected]>--- target-arm/cpu.h | 1 + target-arm/helper.c | 7 +++++++ 2 files changed, 8 insertions(+)target-arm/cpu.h +1
-0@@ -280,6 +280,7 @@ typedef struct CPUARMState { };uint64_t far_el[4 ]; }; +uint64_t hpfar_el2; union { /* Translation result. */ struct { uint64_t _unused_par_0;target-arm/helper.c +3
-0@@ -3221,6 +3221,9 @@ static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = { { .name = "CNTHP_CTL_EL2", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 2, .opc2 = 1, .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, + { .name = "HPFAR_EL2", .state = ARM_CP_STATE_BOTH, + .opc0 = 3, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 4, + .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, REGINFO_SENTINEL };
target-arm/helper.c static const ARMCPRegInfo el2_cp_reginfo[] = { · line 3453
Quoted 9 lines
target-arm/helper.c +4
-0@@ -3442,6 +3445,10 @@ static const ARMCPRegInfo el2_cp_reginfo[] = { .resetvalue = 0, .writefn = gt_hyp_ctl_write, .raw_writefn = raw_write },#endif + { .name = "HPFAR_EL2", .state = ARM_CP_STATE_BOTH, + .opc0 = 3, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 4, + .access = PL2_RW, + .fieldoffset = offsetof(CPUARMState, cp15.hpfar_el2) }, REGINFO_SENTINEL }
Shouldn't these have the accessfn for "no access from 32-bit EL3 if SCR.NS is 0" ?
thanks
-- PMM
RFC PATCH 2/8 target-arm: Add computation of starting level for S2 PTW
In reply to Edgar E. IglesiasFrom: "Edgar E. Iglesias" <[email protected]>
The starting level for S2 pagetable walks is computed differently from the S1 starting level. Implement the S2 variant.
--- target-arm/helper.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)
target-arm/helper.c +20 -12
@@ -6542,18 +6542,26 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, goto do_fault; } -/* The starting level depends on the virtual address size (which can be -* up to 48 bits) and the translation granule size. It indicates the number -* of strides (granule_sz bits at a time) needed to consume the bits -* of the input address. In the pseudocode this is: -* level = 4 - RoundUp((inputsize - grainsize) / stride) -* where their 'inputsize' is our 'va_size - tsz', 'grainsize' is -* our 'granule_sz + 3' and 'stride' is our 'granule_sz'. -* Applying the usual "rounded up m/n is (m+n-1)/n" and simplifying: -* = 4 - (va_size - tsz - granule_sz - 3 + granule_sz - 1) / granule_sz -* = 4 - (va_size - tsz - 4) / granule_sz; -*/ - level =4 - (va_size - tsz -4 ) / granule_sz; +if (mmu_idx == ARMMMUIdx_S2NS) { +unsigned int startlevel =extract32 (tcr->raw_tcr,6 ,2 ); + level =3 - startlevel; +if (granule_sz ==9 ) { + level =2 - startlevel; + } + }else { +/* The starting level depends on the virtual address size (which can +* be up to 48 bits) and the translation granule size. It indicates +* the number of strides (granule_sz bits at a time) needed to +* consume the bits of the input address. In the pseudocode this is: +* level = 4 - RoundUp((inputsize - grainsize) / stride) +* where their 'inputsize' is our 'va_size - tsz', 'grainsize' is +* our 'granule_sz + 3' and 'stride' is our 'granule_sz'. +* Applying the usual "rounded up m/n is (m+n-1)/n" and simplifying: +* = 4 - (va_size - tsz - granule_sz - 3 + granule_sz - 1) / granule_sz +* = 4 - (va_size - tsz - 4) / granule_sz; +*/ + level =4 - (va_size - tsz -4 ) / granule_sz; + }/* Clear the vaddr bits which aren't part of the within-region address, * so that we don't have to special case things when calculating the
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH RFC 2/8] target-arm: Add computation of starting level for S2 PTW
Quoted 27 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
The starting level for S2 pagetable walks is computed differently from the S1 starting level. Implement the S2 variant.
Signed-off-by Edgar E. Iglesias <[email protected]>--- target-arm/helper.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)target-arm/helper.c +0
-8@@ -6542,18 +6542,26 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, goto do_fault; } -/* The starting level depends on the virtual address size (which can be -* up to 48 bits) and the translation granule size. It indicates the number -* of strides (granule_sz bits at a time) needed to consume the bits -* of the input address. In the pseudocode this is: -* level = 4 - RoundUp((inputsize - grainsize) / stride) -* where their 'inputsize' is our 'va_size - tsz', 'grainsize' is -* our 'granule_sz + 3' and 'stride' is our 'granule_sz'. -* Applying the usual "rounded up m/n is (m+n-1)/n" and simplifying:
target-arm/helper.c static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, · line 6550
Quoted 10 lines
target-arm/helper.c +6
-4-* = 4 - (va_size - tsz - granule_sz - 3 + granule_sz - 1) / granule_sz -* = 4 - (va_size - tsz - 4) / granule_sz; -*/ - level =4 - (va_size - tsz -4 ) / granule_sz; +if (mmu_idx == ARMMMUIdx_S2NS) { +unsigned int startlevel =extract32 (tcr->raw_tcr,6 ,2 ); + level =3 - startlevel; +if (granule_sz ==9 ) { + level =2 - startlevel; + }
I think this is right code-wise but we could make it read a little more
nicely: if you make the condition be "if (mmu_idx != ARMMUIdx_S2NS)" then the common case comes first and its long comment works as a description of what we're doing here. Then the else clause can just say
/* For stage 2 translations the starting level is specified by the
* VCTR_EL2.SL0 field (whose interpretation depends on the page size) */
I was pondering whether writing it as
if (granule_sz == 9) {
/* 4K pages */
level = 2 - startlevel;
} else {
/* 16K or 64K pages */
level = 3 - startlevel;
}would be slightly better, but it's marginal. Do add a "4K pages" comment in somewhere, though.
Quoted 18 lines
target-arm/helper.c +14
-1+ }else { +/* The starting level depends on the virtual address size (which can +* be up to 48 bits) and the translation granule size. It indicates +* the number of strides (granule_sz bits at a time) needed to +* consume the bits of the input address. In the pseudocode this is: +* level = 4 - RoundUp((inputsize - grainsize) / stride) +* where their 'inputsize' is our 'va_size - tsz', 'grainsize' is +* our 'granule_sz + 3' and 'stride' is our 'granule_sz'. +* Applying the usual "rounded up m/n is (m+n-1)/n" and simplifying: +* = 4 - (va_size - tsz - granule_sz - 3 + granule_sz - 1) / granule_sz +* = 4 - (va_size - tsz - 4) / granule_sz; +*/ + level =4 - (va_size - tsz -4 ) / granule_sz; + }/* Clear the vaddr bits which aren't part of the within-region address, * so that we don't have to special case things when calculating the --
Quoted 2 lines
1.9.1
thanks
-- PMM
RFC PATCH 3/8 target-arm: Add support for S2 page-table protection bits
In reply to Edgar E. IglesiasFrom: "Edgar E. Iglesias" <[email protected]>
--- target-arm/helper.c | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-)
target-arm/helper.c +45 -3
@@ -6008,6 +6008,38 @@ simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap)return simple_ap_to_rw_prot_is_user (ap,regime_is_user (env, mmu_idx)); } +/* Translate S2 section/page access permissions to protection flags +* +* @env: CPUARMState +* @ap: The 2-bit simple AP (AP[2:1]) +* @xn: XN (execute-never) bit +*/ +static int get_S2prot (CPUARMState *env,int ap,int xn) +{ +int prot_rw; + +switch (ap) { +default : +case 0 : + prot_rw =0 ; +break ; +case 1 : + prot_rw =PAGE_READ |PAGE_EXEC ; +break ; +case 2 : + prot_rw =PAGE_WRITE ; +break ; +case 3 : + prot_rw =PAGE_READ |PAGE_EXEC |PAGE_WRITE ; +break ; + } + +if (xn) { + prot_rw &= ~PAGE_EXEC ; + } +return prot_rw; +} +/* Translate section/page access permissions to protection flags * * @env: CPUARMState
@@ -6617,6 +6649,11 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,/* Extract attributes from the descriptor and merge with table attrs */ attrs =extract64 (descriptor,2 ,10 ) | (extract64 (descriptor,52 ,12 ) <<10 ); + +if (mmu_idx == ARMMMUIdx_S2NS) { +/* The following extractions do not apply to S2. */ +break ; + } attrs |=extract32 (tableattrs,0 ,2 ) <<11 ;/* XN, PXN */ attrs |=extract32 (tableattrs,3 ,1 ) <<5 ;/* APTable[1] => AP[2] */ /* The sense of AP[1] vs APTable[0] is reversed, as APTable[0] == 1
@@ -6638,11 +6675,16 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, } ap =extract32 (attrs,4 ,2 ); - ns =extract32 (attrs,3 ,1 ); xn =extract32 (attrs,12 ,1 ); - pxn =extract32 (attrs,11 ,1 ); - *prot =get_S1prot (env, mmu_idx, va_size ==64 , ap, ns, xn, pxn); +if (mmu_idx == ARMMMUIdx_S2NS) { + ns = true; + *prot =get_S2prot (env, ap, xn); + }else { + ns =extract32 (attrs,3 ,1 ); + pxn =extract32 (attrs,11 ,1 ); + *prot =get_S1prot (env, mmu_idx, va_size ==64 , ap, ns, xn, pxn); + } fault_type = permission_fault;if (!(*prot & (1 << access_type))) {
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH RFC 3/8] target-arm: Add support for S2 page-table protection bits
Quoted 12 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Signed-off-by Edgar E. Iglesias <[email protected]>--- target-arm/helper.c | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-)target-arm/helper.c +0
-0
target-arm/helper.c simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap) · line 6014
Quoted 7 lines
target-arm/helper.c +4
-0@@ -6008,6 +6008,38 @@ simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap)return simple_ap_to_rw_prot_is_user (ap,regime_is_user (env, mmu_idx)); } +/* Translate S2 section/page access permissions to protection flags +* +* @env: CPUARMState +* @ap: The 2-bit simple AP (AP[2:1])
I think this should read "The 2-bit stage2 access permissions (S2AP)". The interpretation of the field differs from the simple-AP bits. You could helpfully call the argument "s2ap" as well.
Quoted 15 lines
target-arm/helper.c +15
-0+* @xn: XN (execute-never) bit +*/ +static int get_S2prot (CPUARMState *env,int ap,int xn) +{ +int prot_rw; + +switch (ap) { +default : +case 0 : + prot_rw =0 ; +break ; +case 1 : + prot_rw =PAGE_READ |PAGE_EXEC ; +break ; +case 2 :
target-arm/helper.c simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap) · line 6039
Quoted 10 lines
target-arm/helper.c +10
-0+ prot_rw =PAGE_WRITE ; +break ; +case 3 : + prot_rw =PAGE_READ |PAGE_EXEC |PAGE_WRITE ; +break ; + } + +if (xn) { + prot_rw &= ~PAGE_EXEC ; + }
This isn't right -- the XN bit controls executability and the S2AP bits don't affect it at all. I think you want:
int prot_rw = 0;
if (s2ap & 1) {
prot_rw |= PAGE_READ;
}
if (s2ap & 2) {
prot_rw |= PAGE_WRITE;
}
if (!xn) {
prot_rw |= PAGE_EXEC;
}target-arm/helper.c static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, · line 6654
Quoted 13 lines
target-arm/helper.c +6
-0+return prot_rw; +} +/* Translate section/page access permissions to protection flags * * @env: CPUARMState @@ -6617,6 +6649,11 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,/* Extract attributes from the descriptor and merge with table attrs */ attrs =extract64 (descriptor,2 ,10 ) | (extract64 (descriptor,52 ,12 ) <<10 ); + +if (mmu_idx == ARMMMUIdx_S2NS) { +/* The following extractions do not apply to S2. */
I think it would be clearer to say
/* Stage 2 table descriptors do not include any attribute fields. */
target-arm/helper.c static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, · line 6656
Quoted 2 lines
target-arm/helper.c +2
-0+break ; + }
and then here put
/* Merge in attributes from table descriptors */
and delete the now-redundant "and merge with table attrs" part from the comment at the start of this hunk.
Quoted 24 lines
target-arm/helper.c +8
-4attrs |=extract32 (tableattrs,0 ,2 ) <<11 ;/* XN, PXN */ attrs |=extract32 (tableattrs,3 ,1 ) <<5 ;/* APTable[1] => AP[2] */ /* The sense of AP[1] vs APTable[0] is reversed, as APTable[0] == 1 @@ -6638,11 +6675,16 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, } ap =extract32 (attrs,4 ,2 ); - ns =extract32 (attrs,3 ,1 ); xn =extract32 (attrs,12 ,1 ); - pxn =extract32 (attrs,11 ,1 ); - *prot =get_S1prot (env, mmu_idx, va_size ==64 , ap, ns, xn, pxn); +if (mmu_idx == ARMMMUIdx_S2NS) { + ns = true; + *prot =get_S2prot (env, ap, xn); + }else { + ns =extract32 (attrs,3 ,1 ); + pxn =extract32 (attrs,11 ,1 ); + *prot =get_S1prot (env, mmu_idx, va_size ==64 , ap, ns, xn, pxn); + } fault_type = permission_fault;if (!(*prot & (1 << access_type))) { --
Quoted 2 lines
1.9.1
thanks
-- PMM
Re: [Qemu-devel] [PATCH RFC 3/8] target-arm: Add support for S2 page-table protection bits
Quoted 55 lines · Peter Maydell
Quoted 12 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Signed-off-by Edgar E. Iglesias <[email protected]>--- target-arm/helper.c | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-)target-arm/helper.c +0
-0target-arm/helper.c simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap) · line 6014
Quoted 7 lines
target-arm/helper.c +4
-0@@ -6008,6 +6008,38 @@ simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap)return simple_ap_to_rw_prot_is_user (ap,regime_is_user (env, mmu_idx)); } +/* Translate S2 section/page access permissions to protection flags +* +* @env: CPUARMState +* @ap: The 2-bit simple AP (AP[2:1]) I think this should read "The 2-bit stage2 access permissions (S2AP)". The interpretation of the field differs from the simple-AP bits. You could helpfully call the argument "s2ap" as well.
Quoted 15 lines
target-arm/helper.c +15
-0+* @xn: XN (execute-never) bit +*/ +static int get_S2prot (CPUARMState *env,int ap,int xn) +{ +int prot_rw; + +switch (ap) { +default : +case 0 : + prot_rw =0 ; +break ; +case 1 : + prot_rw =PAGE_READ |PAGE_EXEC ; +break ; +case 2 :target-arm/helper.c simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap) · line 6039
Quoted 10 lines
target-arm/helper.c +10
-0+ prot_rw =PAGE_WRITE ; +break ; +case 3 : + prot_rw =PAGE_READ |PAGE_EXEC |PAGE_WRITE ; +break ; + } + +if (xn) { + prot_rw &= ~PAGE_EXEC ; + }This isn't right -- the XN bit controls executability and the S2AP bits don't affect it at all. I think you want:
Quoted 10 lines
int prot_rw = 0;
if (s2ap & 1) {
prot_rw |= PAGE_READ;
}
if (s2ap & 2) {
prot_rw |= PAGE_WRITE;
}
if (!xn) {
prot_rw |= PAGE_EXEC;
}Thanks, this was the stuff I was worried about when we talked about it last time. I've got the following now which seems to be the same as you suggest:
static int get_S2prot(CPUARMState *env, int s2ap, int xn)
{
int prot;
prot = s2ap & 1 ? PAGE_READ : 0;
prot |= s2ap & 2 ? PAGE_WRITE : 0;
if (!xn) {
prot |= PAGE_EXEC;
}
return prot;
}I've also fixed up your other comments on this.
Thanks,
Edgar
Quoted 57 lines
Quoted 9 lines
target-arm/helper.c +3
-0+return prot_rw; +} +/* Translate section/page access permissions to protection flags * * @env: CPUARMState target-arm/helper.c static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, · line 6654
Quoted 6 lines
target-arm/helper.c +3
-0@@ -6617,6 +6649,11 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,/* Extract attributes from the descriptor and merge with table attrs */ attrs =extract64 (descriptor,2 ,10 ) | (extract64 (descriptor,52 ,12 ) <<10 ); + +if (mmu_idx == ARMMMUIdx_S2NS) { +/* The following extractions do not apply to S2. */ I think it would be clearer to say
/* Stage 2 table descriptors do not include any attribute fields. */target-arm/helper.c static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, · line 6656
Quoted 2 lines
target-arm/helper.c +2
-0+break ; + }and then here put
/* Merge in attributes from table descriptors */and delete the now-redundant "and merge with table attrs" part from the comment at the start of this hunk.
Quoted 24 lines
target-arm/helper.c +8
-4attrs |=extract32 (tableattrs,0 ,2 ) <<11 ;/* XN, PXN */ attrs |=extract32 (tableattrs,3 ,1 ) <<5 ;/* APTable[1] => AP[2] */ /* The sense of AP[1] vs APTable[0] is reversed, as APTable[0] == 1 @@ -6638,11 +6675,16 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, } ap =extract32 (attrs,4 ,2 ); - ns =extract32 (attrs,3 ,1 ); xn =extract32 (attrs,12 ,1 ); - pxn =extract32 (attrs,11 ,1 ); - *prot =get_S1prot (env, mmu_idx, va_size ==64 , ap, ns, xn, pxn); +if (mmu_idx == ARMMMUIdx_S2NS) { + ns = true; + *prot =get_S2prot (env, ap, xn); + }else { + ns =extract32 (attrs,3 ,1 ); + pxn =extract32 (attrs,11 ,1 ); + *prot =get_S1prot (env, mmu_idx, va_size ==64 , ap, ns, xn, pxn); + } fault_type = permission_fault;if (!(*prot & (1 << access_type))) { --Quoted 2 lines
1.9.1
thanks
-- PMM
Re: [Qemu-devel] [PATCH RFC 3/8] target-arm: Add support for S2 page-table protection bits
Quoted 21 lines · Edgar E. Iglesias
Quoted 13 lines · Peter Maydell
This isn't right -- the XN bit controls executability and the S2AP bits don't affect it at all. I think you want:
int prot_rw = 0; if (s2ap & 1) { prot_rw |= PAGE_READ; } if (s2ap & 2) { prot_rw |= PAGE_WRITE; } if (!xn) { prot_rw |= PAGE_EXEC; }Thanks, this was the stuff I was worried about when we talked about it last time. I've got the following now which seems to be the same as you suggest:
static int
get_S2prot(CPUARMState *env, int s2ap, int xn)
Quoted 10 lines
{
int prot;
prot = s2ap & 1 ? PAGE_READ : 0;
prot |= s2ap & 2 ? PAGE_WRITE : 0;
if (!xn) {
prot |= PAGE_EXEC;
}
return prot;
}Yep, that's the right logic, though it seems a bit odd not to consistently use either 'if' or '?:' for all 3 bits.
thanks
-- PMM
Re: [Qemu-devel] [PATCH RFC 3/8] target-arm: Add support for S2 page-table protection bits
Quoted 33 lines · Peter Maydell
Quoted 21 lines · Edgar E. Iglesias
Quoted 13 lines · Peter Maydell
This isn't right -- the XN bit controls executability and the S2AP bits don't affect it at all. I think you want:
int prot_rw = 0; if (s2ap & 1) { prot_rw |= PAGE_READ; } if (s2ap & 2) { prot_rw |= PAGE_WRITE; } if (!xn) { prot_rw |= PAGE_EXEC; }Thanks, this was the stuff I was worried about when we talked about it last time. I've got the following now which seems to be the same as you suggest:
static int
get_S2prot(CPUARMState *env, int s2ap, int xn)Quoted 10 lines
{ int prot; prot = s2ap & 1 ? PAGE_READ : 0; prot |= s2ap & 2 ? PAGE_WRITE : 0; if (!xn) { prot |= PAGE_EXEC; } return prot; }
Quoted 2 lines
Yep, that's the right logic, though it seems a bit odd not to consistently use either 'if' or '?:' for all 3 bits.
OK, that's true, I'll change it to all ifs.
Thanks,
Edgar
RFC PATCH 4/8 target-arm: Avoid inline for get_phys_addr
In reply to Edgar E. IglesiasFrom: "Edgar E. Iglesias" <[email protected]>
Avoid inline for get_phys_addr() to prepare for future recursive use.
--- target-arm/helper.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
target-arm/helper.c +5 -5
@@ -13,7 +13,7 @@#include "exec/semihost.h" #ifndef CONFIG_USER_ONLY -static inline bool get_phys_addr (CPUARMState *env,target_ulong address, +static bool get_phys_addr (CPUARMState *env,target_ulong address,int access_type,ARMMMUIdx mmu_idx,hwaddr *phys_ptr,MemTxAttrs *attrs,int *prot,target_ulong *page_size,uint32_t *fsr);
@@ -6967,10 +6967,10 @@ static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address,* @page_size: set to the size of the page containing phys_ptr * @fsr: set to the DFSR/IFSR value on failure */ -static inline bool get_phys_addr (CPUARMState *env,target_ulong address, -int access_type,ARMMMUIdx mmu_idx, -hwaddr *phys_ptr,MemTxAttrs *attrs,int *prot, -target_ulong *page_size,uint32_t *fsr) +static bool get_phys_addr (CPUARMState *env,target_ulong address, +int access_type,ARMMMUIdx mmu_idx, +hwaddr *phys_ptr,MemTxAttrs *attrs,int *prot, +target_ulong *page_size,uint32_t *fsr) {if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) {/* TODO: when we support EL2 we should here call ourselves recursively
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH RFC 4/8] target-arm: Avoid inline for get_phys_addr
Quoted 3 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Avoid inline for
get_phys_addr()to prepare for future recursive use.
Does the compiler actually complain?
In any case this function is a lot more complex than it used to be so we might as well just rely on the compiler's discretion about whether to bother inlining it or not.
Quoted 10 lines
Signed-off-by Edgar E. Iglesias <[email protected]>--- target-arm/helper.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)target-arm/helper.c +0
-0
target-arm/helper.c line 19
Quoted 8 lines
target-arm/helper.c +1
-1@@ -13,7 +13,7 @@#include "exec/semihost.h" #ifndef CONFIG_USER_ONLY -static inline bool get_phys_addr (CPUARMState *env,target_ulong address, +static bool get_phys_addr (CPUARMState *env,target_ulong address,int access_type,ARMMMUIdx mmu_idx,hwaddr *phys_ptr,MemTxAttrs *attrs,int *prot,target_ulong *page_size,uint32_t *fsr);
Might as well reindent these lines.
Quoted 16 lines
target-arm/helper.c +4
-5@@ -6967,10 +6967,10 @@ static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address,* @page_size: set to the size of the page containing phys_ptr * @fsr: set to the DFSR/IFSR value on failure */ -static inline bool get_phys_addr (CPUARMState *env,target_ulong address, -int access_type,ARMMMUIdx mmu_idx, -hwaddr *phys_ptr,MemTxAttrs *attrs,int *prot, -target_ulong *page_size,uint32_t *fsr) +static bool get_phys_addr (CPUARMState *env,target_ulong address, +int access_type,ARMMMUIdx mmu_idx, +hwaddr *phys_ptr,MemTxAttrs *attrs,int *prot, +target_ulong *page_size,uint32_t *fsr) {if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) {/* TODO: when we support EL2 we should here call ourselves recursively --
Quoted 2 lines
1.9.1
Otherwise:
thanks
-- PMM
Re: [Qemu-devel] [PATCH RFC 4/8] target-arm: Avoid inline for get_phys_addr
Quoted 7 lines · Peter Maydell
Quoted 3 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Avoid inline for
get_phys_addr()to prepare for future recursive use.Does the compiler actually complain?
Sorry for the late replies Peter...
Yes the compiler complains if we keep the inline. I'll fix the indentation.
Thanks,
Edgar
Quoted 50 lines
In any case this function is a lot more complex than it used to be so we might as well just rely on the compiler's discretion about whether to bother inlining it or not.
Quoted 10 lines
Signed-off-by Edgar E. Iglesias <[email protected]>--- target-arm/helper.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)target-arm/helper.c +0
-0target-arm/helper.c line 19
Quoted 8 lines
target-arm/helper.c +1
-1@@ -13,7 +13,7 @@#include "exec/semihost.h" #ifndef CONFIG_USER_ONLY -static inline bool get_phys_addr (CPUARMState *env,target_ulong address, +static bool get_phys_addr (CPUARMState *env,target_ulong address,int access_type,ARMMMUIdx mmu_idx,hwaddr *phys_ptr,MemTxAttrs *attrs,int *prot,target_ulong *page_size,uint32_t *fsr);Might as well reindent these lines.
Quoted 16 lines
target-arm/helper.c +4
-5@@ -6967,10 +6967,10 @@ static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address,* @page_size: set to the size of the page containing phys_ptr * @fsr: set to the DFSR/IFSR value on failure */ -static inline bool get_phys_addr (CPUARMState *env,target_ulong address, -int access_type,ARMMMUIdx mmu_idx, -hwaddr *phys_ptr,MemTxAttrs *attrs,int *prot, -target_ulong *page_size,uint32_t *fsr) +static bool get_phys_addr (CPUARMState *env,target_ulong address, +int access_type,ARMMMUIdx mmu_idx, +hwaddr *phys_ptr,MemTxAttrs *attrs,int *prot, +target_ulong *page_size,uint32_t *fsr) {if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) {/* TODO: when we support EL2 we should here call ourselves recursively -- Quoted 2 lines
1.9.1
Otherwise:
Reviewed-by Peter Maydell <[email protected]>thanks
-- PMM
RFC PATCH 5/8 target-arm: Add ARMMMUFaultInfo
In reply to Edgar E. IglesiasFrom: "Edgar E. Iglesias" <[email protected]>
Introduce ARMMMUFaultInfo to propagate MMU Fault information across the MMU translation code path. This is in preparation for adding State-2 translation.
No functional changes.
--- target-arm/helper.c | 22 ++++++++++++++-------- target-arm/internals.h | 10 +++++++++- target-arm/op_helper.c | 3 ++- 3 files changed, 25 insertions(+), 10 deletions(-)
target-arm/helper.c +14 -8
@@ -16,7 +16,8 @@static bool get_phys_addr (CPUARMState *env,target_ulong address,int access_type,ARMMMUIdx mmu_idx,hwaddr *phys_ptr,MemTxAttrs *attrs,int *prot, -target_ulong *page_size,uint32_t *fsr); +target_ulong *page_size,uint32_t *fsr, +ARMMMUFaultInfo *fi);/* Definitions for the PMCCNTR and PMCR registers */ #define PMCRD 0x8
@@ -1772,9 +1773,10 @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value,bool ret;uint64_t par64;MemTxAttrs attrs = {}; +ARMMMUFaultInfo fi = {}; ret =get_phys_addr (env, value, access_type, mmu_idx, - &phys_addr, &attrs, &prot, &page_size, &fsr); + &phys_addr, &attrs, &prot, &page_size, &fsr, &fi);if (extended_addresses_enabled (env)) {/* fsr is a DFSR/IFSR value for the long descriptor * translation table format, but with WnR always clear.
@@ -6434,7 +6436,8 @@ typedef enum {static bool get_phys_addr_lpae (CPUARMState *env,target_ulong address,int access_type,ARMMMUIdx mmu_idx,hwaddr *phys_ptr,MemTxAttrs *txattrs,int *prot, -target_ulong *page_size_ptr,uint32_t *fsr) +target_ulong *page_size_ptr,uint32_t *fsr, +ARMMMUFaultInfo *fi) {CPUState *cs =CPU (arm_env_get_cpu (env));/* Read an LPAE long-descriptor translation table. */
@@ -6970,7 +6973,8 @@ static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address,static bool get_phys_addr (CPUARMState *env,target_ulong address,int access_type,ARMMMUIdx mmu_idx,hwaddr *phys_ptr,MemTxAttrs *attrs,int *prot, -target_ulong *page_size,uint32_t *fsr) +target_ulong *page_size,uint32_t *fsr, +ARMMMUFaultInfo *fi) {if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) {/* TODO: when we support EL2 we should here call ourselves recursively
@@ -7029,7 +7033,7 @@ static bool get_phys_addr(CPUARMState *env, target_ulong address,if (regime_using_lpae_format (env, mmu_idx)) {return get_phys_addr_lpae (env, address, access_type, mmu_idx, phys_ptr, - attrs, prot, page_size, fsr); + attrs, prot, page_size, fsr, fi); }else if (regime_sctlr (env, mmu_idx) &SCTLR_XP ) {return get_phys_addr_v6 (env, address, access_type, mmu_idx, phys_ptr, attrs, prot, page_size, fsr);
@@ -7044,7 +7048,8 @@ static bool get_phys_addr(CPUARMState *env, target_ulong address,* fsr with ARM DFSR/IFSR fault register format value on failure. */ bool arm_tlb_fill (CPUState *cs,vaddr address, -int access_type,int mmu_idx,uint32_t *fsr) +int access_type,int mmu_idx,uint32_t *fsr, +ARMMMUFaultInfo *fi) {ARMCPU *cpu =ARM_CPU (cs);CPUARMState *env = &cpu->env;
@@ -7055,7 +7060,7 @@ bool arm_tlb_fill(CPUState *cs, vaddr address,MemTxAttrs attrs = {}; ret =get_phys_addr (env, address, access_type, mmu_idx, &phys_addr, - &attrs, &prot, &page_size, fsr); + &attrs, &prot, &page_size, fsr, fi);if (!ret) {/* Map a single [sub]page. */ phys_addr &=TARGET_PAGE_MASK ;
@@ -7078,9 +7083,10 @@ hwaddr arm_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)bool ret;uint32_t fsr;MemTxAttrs attrs = {}; +ARMMMUFaultInfo fi = {}; ret =get_phys_addr (env, addr,0 ,cpu_mmu_index (env, false), &phys_addr, - &attrs, &prot, &page_size, &fsr); + &attrs, &prot, &page_size, &fsr, &fi);if (ret) {return -1 ;
target-arm/internals.h +9 -1
@@ -389,8 +389,16 @@ bool arm_is_psci_call(ARMCPU *cpu, int excp_type);void arm_handle_psci_call (ARMCPU *cpu);#endif +typedef struct ARMMMUFaultInfo ARMMMUFaultInfo ; + +struct ARMMMUFaultInfo { +target_ulong s2addr; +bool stage2; +bool s1ptw; +}; +/* Do a page table walk and add page to TLB if possible */ bool arm_tlb_fill (CPUState *cpu,vaddr address,int rw,int mmu_idx, -uint32_t *fsr); +uint32_t *fsr,ARMMMUFaultInfo *fi);#endif
target-arm/op_helper.c +2 -1
@@ -83,8 +83,9 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx, {bool ret;uint32_t fsr =0 ; +struct ARMMMUFaultInfo fi = {0 }; - ret =arm_tlb_fill (cs, addr, is_write, mmu_idx, &fsr); + ret =arm_tlb_fill (cs, addr, is_write, mmu_idx, &fsr, &fi);if (unlikely (ret)) {ARMCPU *cpu =ARM_CPU (cs);CPUARMState *env = &cpu->env;
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH RFC 5/8] target-arm: Add ARMMMUFaultInfo
Quoted 9 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Introduce ARMMMUFaultInfo to propagate MMU Fault information across the MMU translation code path. This is in preparation for adding State-2 translation.
No functional changes.
Signed-off-by Edgar E. Iglesias <[email protected]>
OK I think, but maybe a comment on the definition of the ARMMMUFaultInfo struct describing its purpose and maybe the meaning of the fields would be useful?
thanks
-- PMM
RFC PATCH 6/8 target-arm: Add S2 translation support for S1 PTW
In reply to Edgar E. IglesiasFrom: "Edgar E. Iglesias" <[email protected]>
Add support for applying S2 translation to S1 page-table walks.
--- target-arm/helper.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- target-arm/op_helper.c | 4 ++-- 2 files changed, 50 insertions(+), 4 deletions(-)
target-arm/helper.c +48 -2
@@ -19,6 +19,12 @@ static bool get_phys_addr(CPUARMState *env, target_ulong address, target_ulong *page_size, uint32_t *fsr, ARMMMUFaultInfo *fi); +static bool get_phys_addr_lpae (CPUARMState *env,target_ulong address, +int access_type,ARMMMUIdx mmu_idx, +hwaddr *phys_ptr,MemTxAttrs *txattrs,int *prot, +target_ulong *page_size_ptr,uint32_t *fsr, +ARMMMUFaultInfo *fi); +/* Definitions for the PMCCNTR and PMCR registers */ #define PMCRD 0x8#define PMCRC 0x4
@@ -6146,6 +6152,32 @@ static bool get_level1_table_address(CPUARMState *env, ARMMMUIdx mmu_idx,return true; } +/* Translate a S1 pagetable walk through S2 if needed. */ +static hwaddr S1_ptw_translate (CPUARMState *env,ARMMMUIdx mmu_idx, +hwaddr addr,MemTxAttrs txattrs, +uint32_t *fsr, +ARMMMUFaultInfo *fi) +{ +if ((mmu_idx == ARMMMUIdx_S1NSE0 || mmu_idx == ARMMMUIdx_S1NSE1) && + !regime_translation_disabled (env, ARMMMUIdx_S2NS)) { +target_ulong s2size; +hwaddr s2pa; +int s2prot; +int ret; + + ret =get_phys_addr_lpae (env, addr,0 , ARMMMUIdx_S2NS, &s2pa, + &txattrs, &s2prot, &s2size, fsr, fi); +if (ret) { + fi->s2addr = addr; + fi->stage2 = true; + fi->s1ptw = true; +return ~0 ; + } + addr = s2pa; + } +return addr; +} +/* All loads done in the course of a page table walk go through here. * TODO: rather than ignoring errors from physical memory reads (which * are external aborts in ARM terminology) we should propagate this
@@ -6161,11 +6193,19 @@ static uint32_t arm_ldl_ptw(CPUState *cs, hwaddr addr, bool is_secure)return address_space_ldl (cs->as, addr, attrs,NULL ); } -static uint64_t arm_ldq_ptw (CPUState *cs,hwaddr addr,bool is_secure) +static uint64_t arm_ldq_ptw (CPUState *cs,hwaddr addr,bool is_secure, +ARMMMUIdx mmu_idx,uint32_t *fsr, +ARMMMUFaultInfo *fi) { +ARMCPU *cpu =ARM_CPU (cs); +CPUARMState *env = &cpu->env;MemTxAttrs attrs = {}; attrs.secure = is_secure; + addr =S1_ptw_translate (env, mmu_idx, addr, attrs, fsr, fi); +if (fi->s1ptw) { +return 0 ; + }return address_space_ldq (cs->as, addr, attrs,NULL ); }
@@ -6625,7 +6665,11 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, descaddr |= (address >> (granule_sz * (4 - level))) & descmask; descaddr &= ~7ULL ; nstable =extract32 (tableattrs,4 ,1 ); - descriptor =arm_ldq_ptw (cs, descaddr, !nstable); + descriptor =arm_ldq_ptw (cs, descaddr, !nstable, mmu_idx, fsr, fi); +if (fi->s1ptw) { + goto do_fault; + } +if (!(descriptor &1 ) || (!(descriptor &2 ) && (level ==3 ))) {/* Invalid, or the Reserved level 3 encoding */
@@ -6708,6 +6752,8 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, do_fault:/* Long-descriptor format IFSR/DFSR value */ *fsr = (1 <<9 ) | (fault_type <<2 ) | level; +/* Tag the error as S2 for failed S1 PTW at S2 or ordinary S2. */ + fi->stage2 = fi->s1ptw || (mmu_idx == ARMMMUIdx_S2NS);return true; }
target-arm/op_helper.c +2 -2
@@ -104,10 +104,10 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx,* information; this is always true for exceptions reported to EL1. */ if (is_write ==2 ) { - syn =syn_insn_abort (same_el,0 ,0 , syn); + syn =syn_insn_abort (same_el,0 , fi.s1ptw, syn); exc =EXCP_PREFETCH_ABORT ; }else { - syn =syn_data_abort (same_el,0 ,0 ,0 , is_write ==1 , syn); + syn =syn_data_abort (same_el,0 ,0 , fi.s1ptw, is_write ==1 , syn);if (is_write ==1 &&arm_feature (env,ARM_FEATURE_V6 )) { fsr |= (1 <<11 ); }
Signature · 1 line
1.9.1
RFC PATCH 7/8 target-arm: Route S2 MMU faults to EL2
In reply to Edgar E. IglesiasFrom: "Edgar E. Iglesias" <[email protected]>
--- target-arm/op_helper.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
target-arm/op_helper.c +8 -2
@@ -90,13 +90,19 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx,ARMCPU *cpu =ARM_CPU (cs);CPUARMState *env = &cpu->env;uint32_t syn, exc; -bool same_el = (arm_current_el (env) !=0 ); +unsigned int target_el; +bool same_el;if (retaddr) {/* now we have a real cpu fault */ cpu_restore_state (cs, retaddr); } + target_el =exception_target_el (env); +if (fi.stage2) { + target_el =2 ; + } + same_el =arm_current_el (env) == target_el;/* AArch64 syndrome does not have an LPAE bit */ syn = fsr & ~(1 <<9 );
@@ -116,7 +122,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int is_write, int mmu_idx, env->exception.vaddress = addr; env->exception.fsr = fsr; - raise_exception(env, exc, syn, exception_target_el(env)); + raise_exception(env, exc, syn, target_el); } }#endif
Signature · 1 line
1.9.1
RFC PATCH 8/8 target-arm: Add support for S1 + S2 MMU translations
In reply to Edgar E. IglesiasFrom: "Edgar E. Iglesias" <[email protected]>
--- target-arm/helper.c | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-)
target-arm/helper.c +37 -7
@@ -7023,14 +7023,44 @@ static bool get_phys_addr(CPUARMState *env, target_ulong address, ARMMMUFaultInfo *fi) {if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) { -/* TODO: when we support EL2 we should here call ourselves recursively -* to do the stage 1 and then stage 2 translations. The arm_ld*_ptw -* functions will also need changing to perform ARMMMUIdx_S2NS loads -* rather than direct physical memory loads when appropriate. -* For non-EL2 CPUs a stage1+stage2 translation is just stage 1. +/* Call ourselves recursively to do the stage 1 and then stage 2 +* translations. */ -assert (!arm_feature (env,ARM_FEATURE_EL2 )); - mmu_idx += ARMMMUIdx_S1NSE0; +if (arm_feature (env,ARM_FEATURE_EL2 )) { +hwaddr ipa; +int s2_prot; +int ret; + + ret =get_phys_addr (env, address, access_type, + mmu_idx + ARMMMUIdx_S1NSE0, &ipa, attrs, + prot, page_size, fsr, fi); + +/* If S1 fails or S2 is disabled, return early. */ +if (ret ||regime_translation_disabled (env, ARMMMUIdx_S2NS)) { +if (ret && fi->stage2) { +/* This is a S2 error while doing S1 PTW. */ + env->cp15.hpfar_el2 =extract64 (fi->s2addr,12 ,47 ) <<4 ; + } + *phys_ptr = ipa; +return ret; + } + +/* S1 is done. Now do S2 translation. */ + ret =get_phys_addr_lpae (env, ipa, access_type, ARMMMUIdx_S2NS, + phys_ptr, attrs, &s2_prot, + page_size, fsr, fi); +if (ret) { + env->cp15.hpfar_el2 =extract64 (ipa,12 ,47 ) <<4 ; + } +/* Combine the S1 and S2 perms. */ + *prot &= s2_prot; +return ret; + }else { +/* +* For non-EL2 CPUs a stage1+stage2 translation is just stage 1. +*/ + mmu_idx += ARMMMUIdx_S1NSE0; + } }/* The page table entries may downgrade secure to non-secure, but
Signature · 1 line
1.9.1
Quoted 9 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Hi,
Another round of patches towards EL2 support. This one adds partial support for 2-stage MMU for AArch64. I've marked it RFC because I expect a few iterations. Once we can settle on the approach I'll add the AArch32 support (changes for
arm_ldl_ptwetc). I've probably missed alot of details aswell.
Another note, the mem attributes handling is also not considered yet. For example the user attribute when doing S2 and so one.
It wasn't super clear to me howto reorg the code and how the specs works here so I will have to revisit that aswell. If you have comments on how it should work those are greatly appreciated :-)
Cheers,
Edgar
Quoted 32 lines
Some of the details of error reporting are intentionally missing, I was thinking to add those incrementally as they get quite involved (e.g the register target and memory access size).
Some of the patches at the start of the series might be good already, please pick them up if you agree Peter!
Comments welcome!
Best regards,
EdgarEdgar E. Iglesias (8):
target-arm: AddHPFAR_EL2
target-arm: Add computation of starting level for S2 PTW
target-arm: Add support for S2 page-table protection bits
target-arm: Avoid inline forget_phys_addr
target-arm: Add ARMMMUFaultInfo
target-arm: Add S2 translation support for S1 PTW
target-arm: Route S2 MMU faults to EL2
target-arm: Add support for S1 + S2 MMU translationstarget-arm/cpu.h | 1 + target-arm/helper.c | 211 ++++++++++++++++++++++++++++++++++++++++--------- target-arm/internals.h | 10 ++- target-arm/op_helper.c | 17 ++-- 4 files changed, 197 insertions(+), 42 deletions(-)Signature · 1 line
1.9.1
Quoted 22 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Hi,
Another round of patches towards EL2 support. This one adds partial support for 2-stage MMU for AArch64. I've marked it RFC because I expect a few iterations. Once we can settle on the approach I'll add the AArch32 support (changes for
arm_ldl_ptwetc). I've probably missed alot of details aswell.Some of the details of error reporting are intentionally missing, I was thinking to add those incrementally as they get quite involved (e.g the register target and memory access size).
Some of the patches at the start of the series might be good already, please pick them up if you agree Peter!
Comments welcome!
Best regards,
Edgar
Quoted 9 lines
Edgar E. Iglesias (8):
target-arm: AddHPFAR_EL2
target-arm: Add computation of starting level for S2 PTW
target-arm: Add support for S2 page-table protection bits
target-arm: Avoid inline forget_phys_addr
target-arm: Add ARMMMUFaultInfo
target-arm: Add S2 translation support for S1 PTW
target-arm: Route S2 MMU faults to EL2
target-arm: Add support for S1 + S2 MMU translations
I've reviewed the easy patches at the start of this series. IIRC you said you'd found some issues with it anyway and were planning to do a v2 in a bit, so I'll wait for that rather than trying to tackle the last few patches now.
thanks
-- PMM
Quoted 34 lines · Peter Maydell
Quoted 22 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Hi,
Another round of patches towards EL2 support. This one adds partial support for 2-stage MMU for AArch64. I've marked it RFC because I expect a few iterations. Once we can settle on the approach I'll add the AArch32 support (changes for
arm_ldl_ptwetc). I've probably missed alot of details aswell.Some of the details of error reporting are intentionally missing, I was thinking to add those incrementally as they get quite involved (e.g the register target and memory access size).
Some of the patches at the start of the series might be good already, please pick them up if you agree Peter!
Comments welcome!
Best regards,
EdgarQuoted 9 lines
Edgar E. Iglesias (8):
target-arm: AddHPFAR_EL2
target-arm: Add computation of starting level for S2 PTW
target-arm: Add support for S2 page-table protection bits
target-arm: Avoid inline forget_phys_addr
target-arm: Add ARMMMUFaultInfo
target-arm: Add S2 translation support for S1 PTW
target-arm: Route S2 MMU faults to EL2
target-arm: Add support for S1 + S2 MMU translations
Quoted 5 lines
I've reviewed the easy patches at the start of this series. IIRC you said you'd found some issues with it anyway and were planning to do a v2 in a bit, so I'll wait for that rather than trying to tackle the last few patches now.
Thanks Peter,
I'll fix up the stuff you commented on and post a v2.
Cheers,
Edgar