qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Rémi Denis-Courmont" <remi@remlab.net>, qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] target/arm: fix AArch64 virtual address space size
Date: Fri, 25 Jan 2019 15:29:27 -0800	[thread overview]
Message-ID: <02a680e1-c20c-2ecb-2926-6250fddf9e76@linaro.org> (raw)
In-Reply-To: <20190125214926.3204-1-remi@remlab.net>

On 1/25/19 1:49 PM, Rémi Denis-Courmont wrote:
> From: Remi Denis-Courmont <remi.denis.courmont@huawei.com>
> 
> Since QEMU does not support the ARMv8.2-LVA, Large Virtual Address,
> extension (yet), the VA address space is signed 48-bits. User mode can
> only handle the positive half of the address space, so that makes a
> limit of 47 bits.
> 
> (With LVA, it would be 52 and 51 bits respectively.)
> 
> The incorrectly large address space conflicts with PAuth instructions,
> which bits 48-54 and 56-63 for the pointer authentication code. This
> also conflicts with (as yet unsupported by QEMU) data tagging and with
> the ARMv8.5-MTE extension.
> 
> Signed-off-by: Remi Denis-Courmont <remi.denis.courmont@huawei.com>
> ---
>  target/arm/cpu.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
> index ff81db420d..2ccd04b8f7 100644
> --- a/target/arm/cpu.h
> +++ b/target/arm/cpu.h
> @@ -2503,7 +2503,7 @@ bool write_cpustate_to_list(ARMCPU *cpu);
>  
>  #if defined(TARGET_AARCH64)
>  #  define TARGET_PHYS_ADDR_SPACE_BITS 48
> -#  define TARGET_VIRT_ADDR_SPACE_BITS 64
> +#  define TARGET_VIRT_ADDR_SPACE_BITS 47
>  #else
>  #  define TARGET_PHYS_ADDR_SPACE_BITS 40
>  #  define TARGET_VIRT_ADDR_SPACE_BITS 32
> 


This doesn't really conflict, as this doesn't affect much besides the sizing of
the PageDesc for page_find.

It's true adjusting this is worthwhile.  The current setting requires 7 levels
(6 * 10 bits + 1 * 4 bits), whereas a 48-bit address space only requires 5
levels (4 * 10 bits + 8 bits).  Even for LVA it will be (4 * 10 + 1 * 12 bits).

This will both save memory and reduce the time required for TranlationBlock
maintenance.

Your choice of 47 is wrong.  This value is also used for system mode, and the
kernel does use the negative half of the address space, so we need to have all
48 bits here.


r~

  reply	other threads:[~2019-01-25 23:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 21:48 [Qemu-devel] [PATCH 0/3] target/arm: fix PAuth in user mode Rémi Denis-Courmont
2019-01-25 21:49 ` [Qemu-devel] [PATCH 1/3] target/arm: fix AArch64 virtual address space size Rémi Denis-Courmont
2019-01-25 23:29   ` Richard Henderson [this message]
2019-01-26  6:36     ` [Qemu-devel] [Qemu-arm] " Rémi Denis-Courmont
2019-01-26  6:46       ` Rémi Denis-Courmont
2019-01-26 20:00       ` Richard Henderson
2019-01-25 21:49 ` [Qemu-devel] [PATCH 2/3] target/arm: actually enable PAuth in user mode Rémi Denis-Courmont
2019-01-25 23:34   ` Richard Henderson
2019-01-25 21:49 ` [Qemu-devel] [PATCH 3/3] target/arm: fix decoding of B{,L}RA{A,B} Rémi Denis-Courmont
2019-01-25 23:40   ` [Qemu-devel] [PATCH 3/3] target/arm: fix decoding of B{, L}RA{A, B} Richard Henderson
2019-01-27 19:06     ` Richard Henderson
2019-01-26  6:52 ` [Qemu-devel] [PATCHv2 1/3] target/arm: fix AArch64 virtual address space size Rémi Denis-Courmont
2019-01-27 18:47   ` Richard Henderson
2019-01-26  6:52 ` [Qemu-devel] [PATCHv2 2/3] target/arm: actually enable PAuth in user mode Rémi Denis-Courmont
2019-01-27 18:48   ` Richard Henderson
2019-02-01 15:27 ` [Qemu-devel] [Qemu-arm] [PATCH 0/3] target/arm: fix " Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=02a680e1-c20c-2ecb-2926-6250fddf9e76@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=remi@remlab.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).