From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Patch Tracking" <patches@linaro.org>,
"QEMU Developers" <qemu-devel@nongnu.org>,
qemu-arm <qemu-arm@nongnu.org>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH v2 09/19] exec.c: Use cpu_get_phys_page_attrs_debug
Date: Mon, 11 Jan 2016 15:59:26 +0100 [thread overview]
Message-ID: <5693C34E.1040204@redhat.com> (raw)
In-Reply-To: <CAFEAcA_L-QiV5Wbf6SVVnbKU06TC=VZUL-9SBGkOomqvb8QvOA@mail.gmail.com>
On 11/01/2016 15:18, Peter Maydell wrote:
> On 11 January 2016 at 13:47, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>
>>
>> On 16/11/2015 15:05, Peter Maydell wrote:
>>> - hwaddr phys = cpu_get_phys_page_debug(cpu, pc);
>>> + MemTxAttrs attrs = {};
>>> + hwaddr phys = cpu_get_phys_page_attrs_debug(cpu, pc, &attrs);
>>> + int asidx = cpu_asidx_from_attrs(cpu, attrs);
>>> if (phys != -1) {
>>> - tb_invalidate_phys_addr(cpu->as,
>>> + tb_invalidate_phys_addr(cpu->cpu_ases[asidx].as,
>>> phys | (pc & ~TARGET_PAGE_MASK));
>>> }
>>
>> The only question I have is whether it is right to have empty MemTxAttrs
>> here. Is there any way to use the MemTxAttrs for the "current state" of
>> the CPU, whatever that is (on x86 I have added cpu_get_mem_attrs to
>> target-i386/cpu.h)?
>
> That's what the call to cpu_get_phys_page_attrs_debug() does:
> it fills in the MemTxAttrs :secure and :user fields, and then
> cpu_asidx_from_attrs() uses the returned attributes to pick
> the right address space. (cpu_get_phys_page_attrs_debug()
> only fills in attribute fields it knows about, which is why
> we pass it an empty attrs struct to start with.)
Oops, that's not clear from the documentation in patch 4. But if that
was the case, shouldn't cpu_get_phys_page_attrs_debug leave *attrs
completely alone when using the fallback?
I think it's clearer if you pass uninitialized MemTxAttrs to
cpu_get_phys_page_attrs_debug, assuming you can do it. I can see why
the current semantics make sense for helper.c's get_phys_addr, but I
think they are confusing for the topmost function call.
Paolo
next prev parent reply other threads:[~2016-01-11 14:59 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-16 14:05 [Qemu-devel] [PATCH v2 00/19] Add support for multiple address spaces per CPU and use it for ARM TrustZone Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 01/19] exec.c: Don't set cpu->as until cpu_address_space_init Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 02/19] exec.c: Allow target CPUs to define multiple AddressSpaces Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 03/19] exec-all.h: Document tlb_set_page_with_attrs, tlb_set_page Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 04/19] include/qom/cpu.h: Add new get_phys_page_attrs_debug method Peter Maydell
2015-11-16 14:07 ` Andreas Färber
2015-11-16 14:22 ` Andreas Färber
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 05/19] include/qom/cpu.h: Add new asidx_from_attrs method Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 06/19] cputlb.c: Use correct address space when looking up MemoryRegionSection Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 07/19] exec.c: Pass MemTxAttrs to iotlb_to_region so it uses the right AS Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 08/19] exec.c: Add cpu_get_address_space() Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 09/19] exec.c: Use cpu_get_phys_page_attrs_debug Peter Maydell
2016-01-11 13:47 ` Paolo Bonzini
2016-01-11 14:18 ` Peter Maydell
2016-01-11 14:59 ` Paolo Bonzini [this message]
2016-01-11 15:04 ` Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 10/19] exec.c: Use correct AddressSpace in watch_mem_read and watch_mem_write Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 11/19] memory: Add address_space_init_shareable() Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 12/19] qom/cpu: Add MemoryRegion property Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 13/19] target-arm: Add QOM property for Secure memory region Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 14/19] target-arm: Implement asidx_from_attrs Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 15/19] target-arm: Implement cpu_get_phys_page_attrs_debug Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 16/19] target-arm: Support multiple address spaces in page table walks Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 17/19] hw/arm/virt: Wire up memory region to CPUs explicitly Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 18/19] [RFC] hw/arm/virt: add secure memory region and UART Peter Maydell
2015-12-08 16:55 ` [Qemu-devel] [Qemu-arm] " Peter Maydell
2015-11-16 14:05 ` [Qemu-devel] [PATCH v2 19/19] HACK: rearrange the virt memory map to suit OP-TEE Peter Maydell
2015-12-15 16:26 ` [Qemu-devel] [PATCH v2 00/19] Add support for multiple address spaces per CPU and use it for ARM TrustZone Peter Maydell
2016-01-11 13:04 ` Peter Maydell
2016-01-12 13:56 ` Edgar E. Iglesias
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=5693C34E.1040204@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=alex.bennee@linaro.org \
--cc=edgar.iglesias@gmail.com \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).