From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Alex Bennée" <alex.bennee@linaro.org>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>,
qemu-riscv@nongnu.org,
Yoshinori Sato <ysato@users.sourceforge.jp>,
Sagar Karandikar <sagark@eecs.berkeley.edu>,
Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
qemu-devel@nongnu.org, Laurent Vivier <laurent@vivier.eu>,
qemu-arm@nongnu.org, Alistair Francis <Alistair.Francis@wdc.com>,
Claudio Fontana <cfontana@suse.de>,
Paolo Bonzini <pbonzini@redhat.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [RFC PATCH v2 5/6] accel/tcg: Refactor debugging tlb_assert_iotlb_entry_for_ptr_present()
Date: Mon, 8 Feb 2021 14:34:24 -0800 [thread overview]
Message-ID: <e79856a7-f437-df71-f557-b2ace11ffb3e@linaro.org> (raw)
In-Reply-To: <83c71866-2e28-2edb-d79d-f4f96bb765a1@amsat.org>
On 2/8/21 5:52 AM, Philippe Mathieu-Daudé wrote:
> On 2/8/21 9:42 AM, Alex Bennée wrote:
>>
>> Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
>>
>>> Refactor debug code as tlb_assert_iotlb_entry_for_ptr_present() helper.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> ---
>>> What this code does is out of my league, but refactoring it allow
>>> keeping tlb_addr_write() local to accel/tcg/cputlb.c in the next
>>> patch.
>>
>> The assertion that the table entry is current is just a simple
>> housekeeping one. The details of how the MTE implementation uses
>> (abuses?) the iotlb entries requires a closer reading of the code.
>>
>>> ---
>>> include/exec/exec-all.h | 9 +++++++++
>>> accel/tcg/cputlb.c | 14 ++++++++++++++
>>> target/arm/mte_helper.c | 11 ++---------
>>> target/arm/sve_helper.c | 10 ++--------
>>> 4 files changed, 27 insertions(+), 17 deletions(-)
>>>
>>> diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
>>> index f933c74c446..c5e8e355b7f 100644
>>> --- a/include/exec/exec-all.h
>>> +++ b/include/exec/exec-all.h
>>> @@ -296,6 +296,15 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr,
>>> void tlb_set_page(CPUState *cpu, target_ulong vaddr,
>>> hwaddr paddr, int prot,
>>> int mmu_idx, target_ulong size);
>>> +
>>> +/*
>>> + * Find the iotlbentry for ptr. This *must* be present in the TLB
>>> + * because we just found the mapping.
>>> + */
>>> +void tlb_assert_iotlb_entry_for_ptr_present(CPUArchState *env, int ptr_mmu_idx,
>>> + uint64_t ptr,
>>> + MMUAccessType ptr_access,
>>> + uintptr_t index);
>>
>> Probably worth making this an empty inline for the non CONFIG_DEBUG_TCG
>> case so we can eliminate the call to an empty function.
>
> But then we can't make tlb_addr_write() static (next patch) and
> we still have to include "tcg/tcg.h" for the TCG_OVERSIZED_GUEST
> definition...
Certainly you can, though it's not especially pretty:
#ifdef CONFIG_DEBUG_TCG
void tlb_assert_iotlb_entry_for_ptr_present
(CPUArchState *env, int ptr_mmu_idx,
uint64_t ptr, MMUAccessType ptr_access,
uintptr_t index);
#else
static inline void
tlb_assert_iotlb_entry_for_ptr_present
(CPUArchState *env, int ptr_mmu_idx,
uint64_t ptr, MMUAccessType ptr_access,
uintptr_t index)
{ }
#endif
r~
next prev parent reply other threads:[~2021-02-09 1:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-07 23:23 [RFC PATCH v2 0/6] exec: Remove "tcg/tcg.h" from "exec/cpu_ldst.h" Philippe Mathieu-Daudé
2021-02-07 23:23 ` [RFC PATCH v2 1/6] target: Replace tcg_debug_assert() by assert() Philippe Mathieu-Daudé
2021-02-08 13:54 ` Alex Bennée
2021-02-07 23:23 ` [PATCH v2 2/6] target/m68k: Include missing "tcg/tcg.h" header Philippe Mathieu-Daudé
2021-02-07 23:23 ` [PATCH v2 3/6] target/mips: " Philippe Mathieu-Daudé
2021-02-20 20:07 ` Philippe Mathieu-Daudé
2021-02-07 23:23 ` [PATCH v2 4/6] accel/tcg: " Philippe Mathieu-Daudé
2021-02-08 14:36 ` Alex Bennée
2021-02-07 23:23 ` [RFC PATCH v2 5/6] accel/tcg: Refactor debugging tlb_assert_iotlb_entry_for_ptr_present() Philippe Mathieu-Daudé
2021-02-08 8:42 ` Alex Bennée
2021-02-08 13:52 ` Philippe Mathieu-Daudé
2021-02-08 14:48 ` Alex Bennée
2021-02-08 22:34 ` Richard Henderson [this message]
2021-02-07 23:23 ` [PATCH v2 6/6] exec/cpu_ldst: Move tlb* declarations to "exec/exec-all.h" Philippe Mathieu-Daudé
2021-02-08 14:40 ` Alex Bennée
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=e79856a7-f437-df71-f557-b2ace11ffb3e@linaro.org \
--to=richard.henderson@linaro.org \
--cc=Alistair.Francis@wdc.com \
--cc=aleksandar.rikalo@syrmia.com \
--cc=alex.bennee@linaro.org \
--cc=aurelien@aurel32.net \
--cc=cfontana@suse.de \
--cc=f4bug@amsat.org \
--cc=kbastian@mail.uni-paderborn.de \
--cc=laurent@vivier.eu \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=sagark@eecs.berkeley.edu \
--cc=ysato@users.sourceforge.jp \
/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).