qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Anton Johansson <anjo@rev.ng>, qemu-devel@nongnu.org
Cc: ale@rev.ng, pbonzini@redhat.com, eduardo@habkost.net,
	philmd@linaro.org, marcel.apfelbaum@gmail.com,
	peter.maydell@linaro.org, wangyanan55@huawei.com
Subject: Re: [PATCH 4/9] include/hw: introduce CPU_MAX_NEGATIVE_ENV_OFFSET
Date: Fri, 30 Jun 2023 16:19:32 +0200	[thread overview]
Message-ID: <bd3618d9-549b-994d-55a9-d333e7f1a905@linaro.org> (raw)
In-Reply-To: <20230630122551.21766-5-anjo@rev.ng>

On 6/30/23 14:25, Anton Johansson wrote:
> For reasons related to code-generation quality, the offset of
> CPUTLBDescFast and IcountDecr from CPUArchState needs to fit within
> 11 bits of displacement (arm[32|64] and riscv addressing modes).
> 
> This commit introduces a new constant to store the maximum allowed
> negative offset, so it can be statically asserted to hold later on.
> 
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> ---
>   include/hw/core/cpu.h | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index c226d7263c..0377f74d48 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -259,6 +259,17 @@ struct qemu_work_item;
>   
>   #define CPU_UNSET_NUMA_NODE_ID -1
>   
> +/*
> + * For reasons related to code-generation quality the fast path
> + * CPUTLBDescFast array and IcountDecr fields need to be located within a
> + * small negative offset of CPUArchState.  This requirement comes from
> + * host-specific addressing modes of arm[32|64] and riscv which uses 12-
> + * and 11 bits of displacement respectively.
> + */
> +#define CPU_MIN_DISPLACEMENT_BITS 11
> +#define CPU_MAX_NEGATIVE_ENV_OFFSET \
> +    (-(1 << CPU_MIN_DISPLACEMENT_BITS))

You'd want 6 bits, for AArch64 LDP (7-bit signed immediate).


r~


  reply	other threads:[~2023-06-30 14:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30 12:25 [PATCH 0/9] Collapse CPUNegativeOffsetState into CPUState Anton Johansson via
2023-06-30 12:25 ` [PATCH 1/9] target/arm: Replace TARGET_PAGE_ENTRY_EXTRA Anton Johansson via
2023-06-30 12:25 ` [PATCH 2/9] include: Move MMUAccessType to tlb-common.h Anton Johansson via
2023-06-30 12:25 ` [PATCH 3/9] include/exec: Move CPUTLB and friends " Anton Johansson via
2023-06-30 12:25 ` [PATCH 4/9] include/hw: introduce CPU_MAX_NEGATIVE_ENV_OFFSET Anton Johansson via
2023-06-30 14:19   ` Richard Henderson [this message]
2023-07-04  8:49     ` Anton Johansson via
2023-06-30 12:25 ` [PATCH 5/9] accel: Move CPUTLB to CPUState and assert offset Anton Johansson via
2023-06-30 14:16   ` Richard Henderson
2023-07-04  8:45     ` Anton Johansson via
2023-06-30 12:25 ` [PATCH 6/9] Move IcountDecr " Anton Johansson via
2023-06-30 12:25 ` [PATCH 7/9] include/exec: Remove [cpu|env]_neg() functions Anton Johansson via
2023-06-30 12:25 ` [PATCH 8/9] target: Remove CPUNegativeOffsetState field from ArchCPU Anton Johansson via
2023-06-30 12:25 ` [PATCH 9/9] include/exec: Remove CPUNegativeOffsetState Anton Johansson via
2023-07-01  9:21 ` [PATCH 0/9] Collapse CPUNegativeOffsetState into CPUState Paolo Bonzini
2023-07-04  8:54   ` Anton Johansson via

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=bd3618d9-549b-994d-55a9-d333e7f1a905@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=ale@rev.ng \
    --cc=anjo@rev.ng \
    --cc=eduardo@habkost.net \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wangyanan55@huawei.com \
    /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).