hw/arm/smmuv3: Make TLB lookup work for stage-2
commitcd617556aded2528664a3673d66d5cd0864f5341
authorMostafa Saleh <smostafa@google.com>
Thu, 25 May 2023 09:37:50 +0000 (25 10:37 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 30 May 2023 14:50:16 +0000 (30 15:50 +0100)
tree4a2ee4ed3dcc90ee9ce34b586a9f60e3c7680afa
parent21eb5b5cde7f6f75751837d3082ce8b36070af33
hw/arm/smmuv3: Make TLB lookup work for stage-2

Right now, either stage-1 or stage-2 are supported, this simplifies
how we can deal with TLBs.
This patch makes TLB lookup work if stage-2 is enabled instead of
stage-1.
TLB lookup is done before a PTW, if a valid entry is found we won't
do the PTW.
To be able to do TLB lookup, we need the correct tagging info, as
granularity and input size, so we get this based on the supported
translation stage. The TLB entries are added correctly from each
stage PTW.

When nested translation is supported, this would need to change, for
example if we go with a combined TLB implementation, we would need to
use the min of the granularities in TLB.

As stage-2 shouldn't be tagged by ASID, it will be set to -1 if S1P
is not enabled.

Signed-off-by: Mostafa Saleh <smostafa@google.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Message-id: 20230516203327.2051088-7-smostafa@google.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/arm/smmuv3.c