From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org
Cc: frederic.konrad@adacore.com, pbonzini@redhat.com,
rth@twiddle.net, edgar.iglesias@xilinx.com
Subject: [Qemu-devel] [PULL v2 3/7] cputlb: fix the way get_page_addr_code fills the tlb
Date: Tue, 27 Jun 2017 17:37:12 +0200 [thread overview]
Message-ID: <1498577836-25883-4-git-send-email-edgar.iglesias@gmail.com> (raw)
In-Reply-To: <1498577836-25883-1-git-send-email-edgar.iglesias@gmail.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.
Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
accel/tcg/cputlb.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 5d6c755..95265a0 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -849,8 +849,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;
--
2.7.4
next prev parent reply other threads:[~2017-06-27 16:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-27 15:37 [Qemu-devel] [PULL v2 0/7] MMIO Exec pull request Edgar E. Iglesias
2017-06-27 15:37 ` [Qemu-devel] [PULL v2 1/7] cputlb: cleanup get_page_addr_code to use VICTIM_TLB_HIT Edgar E. Iglesias
2017-06-27 15:37 ` [Qemu-devel] [PULL v2 2/7] cputlb: move get_page_addr_code Edgar E. Iglesias
2017-06-27 15:37 ` Edgar E. Iglesias [this message]
2017-06-27 15:37 ` [Qemu-devel] [PULL v2 4/7] qdev: add MemoryRegion property Edgar E. Iglesias
2017-06-27 15:37 ` [Qemu-devel] [PULL v2 5/7] introduce mmio_interface Edgar E. Iglesias
2017-06-27 15:37 ` [Qemu-devel] [PULL v2 6/7] exec: allow to get a pointer for some mmio memory region Edgar E. Iglesias
2017-08-10 12:56 ` Peter Maydell
2017-08-10 12:59 ` Paolo Bonzini
2017-08-10 13:23 ` KONRAD Frederic
2017-06-27 15:37 ` [Qemu-devel] [PULL v2 7/7] xilinx_spips: allow mmio execution Edgar E. Iglesias
2017-06-27 17:09 ` [Qemu-devel] [PULL v2 0/7] MMIO Exec pull request Peter Maydell
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=1498577836-25883-4-git-send-email-edgar.iglesias@gmail.com \
--to=edgar.iglesias@gmail.com \
--cc=edgar.iglesias@xilinx.com \
--cc=frederic.konrad@adacore.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).