qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Mark Burton" <mburton@qti.qualcomm.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Matheus Bernardino" <mathbern@qti.qualcomm.com>,
	"Sid Manning" <sidneym@quicinc.com>,
	"Brian Cain" <bcain@quicinc.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: Record AS in full tlb
Date: Thu, 11 Dec 2025 09:04:40 -0600	[thread overview]
Message-ID: <0d3b4338-2c31-4e42-8a8e-319f3ad4029f@linaro.org> (raw)
In-Reply-To: <A5D46F85-9B92-477C-B964-1DCE2A1CCF19@qti.qualcomm.com>

> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -269,6 +269,8 @@ struct CPUTLBEntryFull {
>              bool guarded;
>          } arm;
>      } extra;
> +
> +    AddressSpace *as;
>  };
...
> -MemoryRegionSection *iotlb_to_section(CPUState *cpu,
> +
> +MemoryRegionSection *iotlb_to_section(AddressSpace *as,
>                                        hwaddr index, MemTxAttrs attrs)
>  {
> -    int asidx = cpu_asidx_from_attrs(cpu, attrs);
> -    CPUAddressSpace *cpuas = &cpu->cpu_ases[asidx];
> -    AddressSpaceDispatch *d = address_space_to_dispatch(cpuas->as);
> +    assert(as);
> +    AddressSpaceDispatch *d = address_space_to_dispatch(as);
>      int section_index = index & ~TARGET_PAGE_MASK;

Adding the as to CPUTLBEntryFull is unnecessary because

(1) Each CPUTLB, and thus each CPUTLBEntryFull, is private to the cpu.
(2) Each CPUTLBEntryFull contains the MemTxAttrs for the access.

Thus the AddressSpace is purely a function of (cpu, attrs).

We can have a conversation about where this lookup happens, and whether or not particular 
functions should be passed a CPUState, but adding AddressSpace to full tlb is redundant.


r~


  parent reply	other threads:[~2025-12-11 15:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-09 10:47 Record AS in full tlb Mark Burton via
2025-12-09 12:14 ` Alex Bennée
2025-12-09 12:20   ` Alex Bennée
2025-12-09 12:22   ` Mark Burton
2025-12-09 12:43     ` Matheus Bernardino
2025-12-11 15:04 ` Richard Henderson [this message]
2025-12-11 18:49   ` Mark Burton
2025-12-11 19:24     ` Richard Henderson
2025-12-11 19:49       ` Mark Burton
2025-12-11 20:14         ` Richard Henderson
2025-12-11 20:35           ` Mark Burton

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=0d3b4338-2c31-4e42-8a8e-319f3ad4029f@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=bcain@quicinc.com \
    --cc=mathbern@qti.qualcomm.com \
    --cc=mburton@qti.qualcomm.com \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sidneym@quicinc.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).