On 04.10.20 2:00, Jan Kiszka wrote:
> From: Jan Kiszka <[email protected]>
>
> Array lookup is simpler, given this input-output mapping. Cover the
> 52-bit case as well at this chance. This also obsoletes a couple of
> PARANGE constants.
>
> Signed-off-by: Jan Kiszka <[email protected]>
> ---
> hypervisor/arch/arm64/include/asm/paging.h | 5 -----
> hypervisor/arch/arm64/paging.c | 19 +++----------------
> 2 files changed, 3 insertions(+), 21 deletions(-)
>
> diff --git a/hypervisor/arch/arm64/include/asm/paging.h
> b/hypervisor/arch/arm64/include/asm/paging.h
> index 67664efa..932dbb50 100644
> --- a/hypervisor/arch/arm64/include/asm/paging.h
> +++ b/hypervisor/arch/arm64/include/asm/paging.h
> @@ -101,11 +101,6 @@
> #define SL0_L02
> #define SL0_L11
> #define SL0_L20
> -#define PARANGE_32B0x0
> -#define PARANGE_36B0x1
> -#define PARANGE_40B0x2
> -#define PARANGE_42B0x3
> -#define PARANGE_44B0x4
> #define PARANGE_48B0x5
> #define TCR_RGN_NON_CACHEABLE0x0
> #define TCR_RGN_WB_WA0x1
> diff --git a/hypervisor/arch/arm64/paging.c b/hypervisor/arch/arm64/paging.c
> index db8314a6..cccce410 100644
> --- a/hypervisor/arch/arm64/paging.c
> +++ b/hypervisor/arch/arm64/paging.c
> @@ -26,6 +26,7 @@ unsigned int cpu_parange_encoded;
> */
> unsigned int get_cpu_parange(void)
> {
> +static const unsigned int pa_bits[] = { 32, 36, 40, 42, 44, 48, 52 };
Hi Jan,
I think it's safest and easiest to treat the 52-bit case as if it were
48-bit.
The 52-bit case is a bit trickier than the others in that it requires a
64KB translation granule. With a 4KB translation granule, the maximum
number of PA bits is 48; programming for 52-bit is treated as if it were
48-bit, so having this indicate that output addresses are 52-bit is a
bit misleading.
The real problem is that we set T0SZ such that the input address size is
the same as the output address size. When not using a 64KB translation
granule, programming a 52-bit input address size will result in
translation faults.
Chase
> unsigned int cpu;
>
> /* Larger than any possible value */
> @@ -42,20 +43,6 @@ unsigned int get_cpu_parange(void)
> (per_cpu(cpu)->id_aa64mmfr0 & 0xf) < cpu_parange_encoded)
> cpu_parange_encoded = per_cpu(cpu)->id_aa64mmfr0 & 0xf;
>
> -switch (cpu_parange_encoded) {
> -case PARANGE_32B:
> -return 32;
> -case PARANGE_36B:
> -return 36;
> -case PARANGE_40B:
> -return 40;
> -case PARANGE_42B:
> -return 42;
> -case PARANGE_44B:
> -return 44;
> -case PARANGE_48B:
> -return 48;
> -default:
> -return 0;
> -}
> +return cpu_parange_encoded < ARRAY_SIZE(pa_bits) ?
> +pa_bits[cpu_parange_encoded] : 0;
> }
> --
> 2.26.2
IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended recipient,
please notify the sender immediately and do not disclose the contents to any
other person, use it for any purpose, or store or copy the information in any
medium. Thank you.
--
You received this message because you are subscribed to the Google Groups
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jailhouse-dev/AF18C444-D146-4E7F-9D8B-F1DCBD161882%40arm.com.