qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mikhail Tyutin <m.tyutin@yadro.com>
To: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Dmitriy Solovev <d.solovev@yadro.com>,
	<richard.henderson@linaro.org>, <pbonzini@redhat.com>
Subject: [PATCH] Fix SEGFAULT on getting physical address of MMIO region.
Date: Mon, 3 Jul 2023 19:16:55 +0300	[thread overview]
Message-ID: <ce64bf09-4d62-ee48-c1e1-dbd3641e023d@yadro.com> (raw)

The fix is to clear TLB_INVALID_MASK bit in tlb_addr, as it happens in 
other places e.g. load_helper().

Signed-off-by: Dmitriy Solovev <d.solovev@yadro.com>
Signed-off-by: Mikhail Tyutin <m.tyutin@yadro.com>
---
  accel/tcg/cputlb.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 5b51eff5a4..9045b6330a 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -1708,7 +1708,7 @@ bool tlb_plugin_lookup(CPUState *cpu, vaddr addr, 
int mmu_idx,
      uintptr_t index = tlb_index(env, mmu_idx, addr);
      uint64_t tlb_addr = is_store ? tlb_addr_write(tlbe) : tlbe->addr_read;
  -    if (likely(tlb_hit(tlb_addr, addr))) {
+    if (likely(tlb_hit(tlb_addr & ~TLB_INVALID_MASK, addr))) {
          /* We must have an iotlb entry for MMIO */
          if (tlb_addr & TLB_MMIO) {
              CPUTLBEntryFull *full;
-- 
2.34.1



             reply	other threads:[~2023-07-03 16:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03 16:16 Mikhail Tyutin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-08-02 13:08 [PATCH] Fix SEGFAULT on getting physical address of MMIO region Mikhail Tyutin
2023-08-02 16:09 ` Richard Henderson
2023-08-09 13:17   ` Mikhail Tyutin
2023-08-09 14:41     ` Richard Henderson

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=ce64bf09-4d62-ee48-c1e1-dbd3641e023d@yadro.com \
    --to=m.tyutin@yadro.com \
    --cc=d.solovev@yadro.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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).