From: fred.konrad@greensocs.com
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, edgar.iglesias@xilinx.com,
alistair.francis@xilinx.com, pbonzini@redhat.com, clg@kaod.org,
mark.burton@greensocs.com, fred.konrad@greensocs.com
Subject: [Qemu-devel] [RFC 3/5] cputlb: fix the way get_page_addr_code fills the tlb
Date: Fri, 3 Feb 2017 18:06:35 +0100 [thread overview]
Message-ID: <1486141597-13941-4-git-send-email-fred.konrad@greensocs.com> (raw)
In-Reply-To: <1486141597-13941-1-git-send-email-fred.konrad@greensocs.com>
From: KONRAD Frederic <fred.konrad@greensocs.com>
get_page_addr_code(..) does a cpu_ldub_code to fill the tlb:
This can lead to some side effects if a device is mapped at this address.
So this patch replaces the cpu_memory_ld by a tlb_fill.
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
---
cputlb.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/cputlb.c b/cputlb.c
index b3a5f47..846341e 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -534,8 +534,10 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr)
index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
mmu_idx = cpu_mmu_index(env, true);
if (unlikely(env->tlb_table[mmu_idx][index].addr_code !=
- (addr & TARGET_PAGE_MASK))) {
- cpu_ldub_code(env, addr);
+ (addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK)))) {
+ if (!VICTIM_TLB_HIT(addr_read, addr)) {
+ tlb_fill(ENV_GET_CPU(env), addr, MMU_INST_FETCH, mmu_idx, 0);
+ }
}
iotlbentry = &env->iotlb[mmu_idx][index];
pd = iotlbentry->addr & ~TARGET_PAGE_MASK;
--
1.8.3.1
next prev parent reply other threads:[~2017-02-03 17:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-03 17:06 [Qemu-devel] [RFC 0/5] execute code from mmio area fred.konrad
2017-02-03 17:06 ` [Qemu-devel] [RFC 1/5] cputlb: cleanup get_page_addr_code to use VICTIM_TLB_HIT fred.konrad
2017-02-04 11:30 ` Edgar E. Iglesias
2017-02-04 12:16 ` Frederic Konrad
2017-02-03 17:06 ` [Qemu-devel] [RFC 2/5] cputlb: move get_page_addr_code fred.konrad
2017-02-03 17:06 ` fred.konrad [this message]
2017-02-03 17:06 ` [Qemu-devel] [RFC 4/5] exec: allow to get a pointer for some mmio memory region fred.konrad
2017-02-03 17:26 ` Paolo Bonzini
2017-02-03 21:09 ` Frederic Konrad
2017-02-04 12:41 ` Paolo Bonzini
2017-02-04 13:59 ` Frederic Konrad
2017-02-07 9:52 ` Frederic Konrad
2017-02-04 11:50 ` Edgar E. Iglesias
2017-02-03 17:06 ` [Qemu-devel] [RFC 5/5] xilinx_spips: allow mmio execution fred.konrad
2017-02-04 12:33 ` [Qemu-devel] [RFC 0/5] execute code from mmio area Peter Maydell
2017-02-04 12:52 ` Frederic Konrad
2017-02-04 13:17 ` Peter Maydell
2017-02-04 14:01 ` Frederic Konrad
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=1486141597-13941-4-git-send-email-fred.konrad@greensocs.com \
--to=fred.konrad@greensocs.com \
--cc=alistair.francis@xilinx.com \
--cc=clg@kaod.org \
--cc=edgar.iglesias@xilinx.com \
--cc=mark.burton@greensocs.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.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).