All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] arm: check regime, not current state, for ATS write PAR format
@ 2017-11-03 14:36 Peter Maydell
  2017-11-03 17:36 ` Stefano Stabellini
  2017-11-06 16:10 ` [Qemu-devel] [Qemu-arm] " Alex Bennée
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Maydell @ 2017-11-03 14:36 UTC (permalink / raw)
  To: qemu-arm, qemu-devel
  Cc: patches, Edgar E. Iglesias, Julien Grall, Stefano Stabellini

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.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
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(-)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index 96113fe..37af750 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -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.
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] arm: check regime, not current state, for ATS write PAR format
  2017-11-03 14:36 [Qemu-devel] [PATCH] arm: check regime, not current state, for ATS write PAR format Peter Maydell
@ 2017-11-03 17:36 ` Stefano Stabellini
  2017-11-08 17:05   ` Edgar E. Iglesias
  2017-11-06 16:10 ` [Qemu-devel] [Qemu-arm] " Alex Bennée
  1 sibling, 1 reply; 4+ messages in thread
From: Stefano Stabellini @ 2017-11-03 17:36 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-arm, qemu-devel, Edgar E. Iglesias, Julien Grall,
	Stefano Stabellini, patches

On Fri, 3 Nov 2017, Peter Maydell wrote:
> 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.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Tested-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> 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(-)
> 
> diff --git a/target/arm/helper.c b/target/arm/helper.c
> index 96113fe..37af750 100644
> --- a/target/arm/helper.c
> +++ b/target/arm/helper.c
> @@ -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.
> -- 
> 2.7.4
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Qemu-arm] [PATCH] arm: check regime, not current state, for ATS write PAR format
  2017-11-03 14:36 [Qemu-devel] [PATCH] arm: check regime, not current state, for ATS write PAR format Peter Maydell
  2017-11-03 17:36 ` Stefano Stabellini
@ 2017-11-06 16:10 ` Alex Bennée
  1 sibling, 0 replies; 4+ messages in thread
From: Alex Bennée @ 2017-11-06 16:10 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-arm, qemu-devel, Julien Grall, Stefano Stabellini, patches


Peter Maydell <peter.maydell@linaro.org> writes:

> 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.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

As far as it goes it seems reasonable:

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
> 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(-)
>
> diff --git a/target/arm/helper.c b/target/arm/helper.c
> index 96113fe..37af750 100644
> --- a/target/arm/helper.c
> +++ b/target/arm/helper.c
> @@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] arm: check regime, not current state, for ATS write PAR format
  2017-11-03 17:36 ` Stefano Stabellini
@ 2017-11-08 17:05   ` Edgar E. Iglesias
  0 siblings, 0 replies; 4+ messages in thread
From: Edgar E. Iglesias @ 2017-11-08 17:05 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Peter Maydell, qemu-arm, qemu-devel, Julien Grall, patches

On Fri, Nov 03, 2017 at 10:36:37AM -0700, Stefano Stabellini wrote:
> On Fri, 3 Nov 2017, Peter Maydell wrote:
> > 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.
> > 
> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> 
> Tested-by: Stefano Stabellini <sstabellini@kernel.org>

Hi,

This looks like an OK workaround for the moment:
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>

Cheers,
Edgar

> 
> 
> > ---
> > 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(-)
> > 
> > diff --git a/target/arm/helper.c b/target/arm/helper.c
> > index 96113fe..37af750 100644
> > --- a/target/arm/helper.c
> > +++ b/target/arm/helper.c
> > @@ -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.
> > -- 
> > 2.7.4
> > 
> > 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-08 17:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-03 14:36 [Qemu-devel] [PATCH] arm: check regime, not current state, for ATS write PAR format Peter Maydell
2017-11-03 17:36 ` Stefano Stabellini
2017-11-08 17:05   ` Edgar E. Iglesias
2017-11-06 16:10 ` [Qemu-devel] [Qemu-arm] " Alex Bennée

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.