On 10/1/25 09:08, Peter Maydell wrote:
On Wed, 1 Oct 2025 at 16:05, Philippe Mathieu-Daudé <[email protected]> wrote:

Instead of using the convenient @CPUState::as shortcut, use
cpu_get_address_space(asidx=0) to get the vCPU first address
space.

The goal is to reduce the risk of AS mis-use for targets
that uses multiple ASes per vCPU.

I'm not sure I agree with this. The cpu->as is handy for
the large number of targets which only use one AddressSpace:
which is everything except arm and x86 right now.

Targets that use multiple address spaces need to be careful
about which AS they use by definition. Unless we have a
track record of code in those targets carelessly using
cpu->as when it should do something else, I'm not sure
that there's a benefit that makes it worth making the
"use the one and only AS this CPU will ever have" more awkward.

I agree.

Moreover, '0' as a default is just as bad as cpu->as, because you're giving no thought to the selection. Similarly using MEMATTRS_UNSPECIFIED. When such things matter, we need the real attributes and/or as piped down from the proper memory reference.


r~

Reply via email to