qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: YeeLi <seven.yi.lee@gmail.com>
To: mst@redhat.com, jasowang@redhat.com
Cc: pbonzini@redhat.com, richard.henderson@linaro.org,
	eduardo@habkost.net, qemu-devel@nongnu.org,
	yeeli <seven.yi.lee@gmail.com>
Subject: [PATCH] intel-iommu: fix Read DMAR IQA REG DW
Date: Thu,  4 Jul 2024 11:53:02 +0800	[thread overview]
Message-ID: <20240704035302.306244-1-seven.yi.lee@gmail.com> (raw)

From: yeeli <seven.yi.lee@gmail.com>

When dmar_readq or devmem2 read the DW of IQA always 0UL because
"& VTD_IQA_QS". So, try to fix it.

case:
after vtd_mem_write
IQA val: 0x100206801

after vtd_mem_read
IQA val: 0x100206001

Signed-off-by: yeeli <seven.yi.lee@gmail.com>
---
 hw/i386/intel_iommu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 37c21a0aec..e230a45940 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -2938,7 +2938,8 @@ static uint64_t vtd_mem_read(void *opaque, hwaddr addr, unsigned size)
 
     /* Invalidation Queue Address Register, 64-bit */
     case DMAR_IQA_REG:
-        val = s->iq | (vtd_get_quad(s, DMAR_IQA_REG) & VTD_IQA_QS);
+        val = s->iq | (vtd_get_quad(s, DMAR_IQA_REG) & VTD_IQA_QS
+                | VTD_IQA_DW_MASK);
         if (size == 4) {
             val = val & ((1ULL << 32) - 1);
         }
-- 
2.34.1



             reply	other threads:[~2024-07-04  4:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04  3:53 YeeLi [this message]
2024-07-04  6:54 ` [PATCH] intel-iommu: fix Read DMAR IQA REG DW Yee Li
2024-07-20 18:28   ` Michael S. Tsirkin
2024-07-20 18:29 ` Michael S. Tsirkin
2024-07-23  2:40   ` Yee Li
2024-07-23  3:02     ` Yee Li
2024-07-23  8:05     ` Yi Liu
2024-07-24  6:34       ` Yee Li

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=20240704035302.306244-1-seven.yi.lee@gmail.com \
    --to=seven.yi.lee@gmail.com \
    --cc=eduardo@habkost.net \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.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).