arm: check regime, not current state, for ATS write PAR format
PATCH 1/1 arm: check regime, not current state, for ATS write PAR format
In do_ats_write(), rather than using extended_addresses_enabled() to decide whether the value we get back from get_phys_addr() is a 64-bit format PAR or a 32-bit one, use arm_s1_regime_using_lpae_format().
This is not really the correct answer, because the PAR format depends on the AT instruction being used, not just on the translation regime. However getting this correct requires a significant refactoring, so that get_phys_addr() returns raw information about the fault which the caller can then assemble into a suitable FSR/PAR/syndrome for its purposes, rather than get_phys_addr() returning a pre-formatted FSR.
However this change at least improves the situation by making the PAR work correctly for address translation operations done at AArch64 EL2 on the EL2 translation regime. In particular, this is necessary for Xen to be able to run in our emulation, so this seems like a safer interim fix given that we are in freeze.
---
I guess I should have a go at the "correct answer" I sketch above, but no promises about when I'll get time for that :-(
target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/helper.c +1 -1
@@ -2162,7 +2162,7 @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, ret =get_phys_addr (env, value, access_type, mmu_idx, &phys_addr, &attrs, &prot, &page_size, &fsr, &fi); -if (extended_addresses_enabled (env)) { +if (arm_s1_regime_using_lpae_format (env, mmu_idx)) {/* fsr is a DFSR/IFSR value for the long descriptor * translation table format, but with WnR always clear. * Convert it to a 64-bit PAR.
Signature · 1 line
2.7.4
Quoted 12 lines · Peter Maydell
In
do_ats_write(), rather than usingextended_addresses_enabled()to decide whether the value we get back fromget_phys_addr()is a 64-bit format PAR or a 32-bit one, usearm_s1_regime_using_lpae_format().This is not really the correct answer, because the PAR format depends on the AT instruction being used, not just on the translation regime. However getting this correct requires a significant refactoring, so that
get_phys_addr()returns raw information about the fault which the caller can then assemble into a suitable FSR/PAR/syndrome for its purposes, rather thanget_phys_addr()returning a pre-formatted FSR.
Quoted 7 lines
However this change at least improves the situation by making the PAR work correctly for address translation operations done at AArch64 EL2 on the EL2 translation regime. In particular, this is necessary for Xen to be able to run in our emulation, so this seems like a safer interim fix given that we are in freeze.
Signed-off-by Peter Maydell <[email protected]>
Quoted 24 lines
---
I guess I should have a go at the "correct answer" I sketch above, but no promises about when I'll get time for that :-(target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/arm/helper.c +1
-1@@ -2162,7 +2162,7 @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, ret =get_phys_addr (env, value, access_type, mmu_idx, &phys_addr, &attrs, &prot, &page_size, &fsr, &fi); -if (extended_addresses_enabled (env)) { +if (arm_s1_regime_using_lpae_format (env, mmu_idx)) {/* fsr is a DFSR/IFSR value for the long descriptor * translation table format, but with WnR always clear. * Convert it to a 64-bit PAR. Signature · 1 line
2.7.4
Edgar E. Iglesias
Reviewed-byQuoted 19 lines · Stefano Stabellini
Quoted 18 lines · Peter Maydell
In
do_ats_write(), rather than usingextended_addresses_enabled()to decide whether the value we get back fromget_phys_addr()is a 64-bit format PAR or a 32-bit one, usearm_s1_regime_using_lpae_format().This is not really the correct answer, because the PAR format depends on the AT instruction being used, not just on the translation regime. However getting this correct requires a significant refactoring, so that
get_phys_addr()returns raw information about the fault which the caller can then assemble into a suitable FSR/PAR/syndrome for its purposes, rather thanget_phys_addr()returning a pre-formatted FSR.However this change at least improves the situation by making the PAR work correctly for address translation operations done at AArch64 EL2 on the EL2 translation regime. In particular, this is necessary for Xen to be able to run in our emulation, so this seems like a safer interim fix given that we are in freeze.
Quoted 3 lines
Quoted 1 line
Signed-off-by Peter Maydell <[email protected]>Tested-by Stefano Stabellini <[email protected]>
Hi,
This looks like an OK workaround for the moment:
Cheers,
Edgar
Quoted 26 lines
Quoted 26 lines
---
I guess I should have a go at the "correct answer" I sketch above, but no promises about when I'll get time for that :-(target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/arm/helper.c +1
-1@@ -2162,7 +2162,7 @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, ret =get_phys_addr (env, value, access_type, mmu_idx, &phys_addr, &attrs, &prot, &page_size, &fsr, &fi); -if (extended_addresses_enabled (env)) { +if (arm_s1_regime_using_lpae_format (env, mmu_idx)) {/* fsr is a DFSR/IFSR value for the long descriptor * translation table format, but with WnR always clear. * Convert it to a 64-bit PAR. Signature · 1 line
2.7.4
Quoted 12 lines · Peter Maydell
In
do_ats_write(), rather than usingextended_addresses_enabled()to decide whether the value we get back fromget_phys_addr()is a 64-bit format PAR or a 32-bit one, usearm_s1_regime_using_lpae_format().This is not really the correct answer, because the PAR format depends on the AT instruction being used, not just on the translation regime. However getting this correct requires a significant refactoring, so that
get_phys_addr()returns raw information about the fault which the caller can then assemble into a suitable FSR/PAR/syndrome for its purposes, rather thanget_phys_addr()returning a pre-formatted FSR.
Quoted 7 lines
However this change at least improves the situation by making the PAR work correctly for address translation operations done at AArch64 EL2 on the EL2 translation regime. In particular, this is necessary for Xen to be able to run in our emulation, so this seems like a safer interim fix given that we are in freeze.
Signed-off-by Peter Maydell <[email protected]>
As far as it goes it seems reasonable:
Quoted 12 lines
---
I guess I should have a go at the "correct answer" I sketch above, but no promises about when I'll get time for that :-(target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/arm/helper.c +0
-0
target/arm/helper.c static uint64_t do_ats_write(CPUARMState *env, uint64_t value, · line 2168
Quoted 8 lines
target/arm/helper.c +1
-1@@ -2162,7 +2162,7 @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, ret =get_phys_addr (env, value, access_type, mmu_idx, &phys_addr, &attrs, &prot, &page_size, &fsr, &fi); -if (extended_addresses_enabled (env)) { +if (arm_s1_regime_using_lpae_format (env, mmu_idx)) {/* fsr is a DFSR/IFSR value for the long descriptor * translation table format, but with WnR always clear. * Convert it to a 64-bit PAR.
--
Alex Bennée