qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [PATCH] system/memory: Fix max access size
@ 2024-07-20  7:55 TaiseiIto
  2024-07-20 14:30 ` Peter Maydell
  0 siblings, 1 reply; 6+ messages in thread
From: TaiseiIto @ 2024-07-20  7:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, peterx, david, philmd, TaiseiIto

Before this commit, an HPET driver can not write correct values to
comparator registers of HPET timers. When I tested my HPET driver on QEMU, I
ovserved too early HPET interruptions. I investigated cause and found that
QEMU didn't write higher 32 bits of comparator registers of HPET timers even
though my HPET driver did 64 bits writing to the registers. When my HPET
driver wrote to an HPET timer comparator register with 64-bit access size,
QEMU divided once 64-bit writing into twice 32-bit writings because QEMU
allowed only up to 32-bit writing. In the twice 32-bit writings, first, QEMU
wrote lower 32 bits of the comparator register and immediately clear
HPET_TN_SETVAL flag which means whether a software can write the comparator
register of the HPET timer. Then, QEMU tried to write higher 32 bits of the
comparator register, but the writing is rejected because the HPET_TN_SETVAL
flag is already cleared. As a result, the comparator register of the HPET
timer had a incorrect value and generated too early HPET interruptions.
After this commit, QEMU allows 64-bit writings. So, once 64-bit writing to
HPET timer comparator register is not divided into twice 32-bit writings.
Therefore, the comparator register of the HPET timer has correct value. As
a result, the HPET timer generates interruptions at the correct time.

Signed-off-by: TaiseiIto <taisei1212@outlook.jp>
---
 system/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/system/memory.c b/system/memory.c
index 5e6eb459d5..985a5bd2bb 100644
--- a/system/memory.c
+++ b/system/memory.c
@@ -544,7 +544,7 @@ static MemTxResult access_with_adjusted_size(hwaddr addr,
         access_size_min = 1;
     }
     if (!access_size_max) {
-        access_size_max = 4;
+        access_size_max = 8;
     }
 
     /* Do not allow more than one simultaneous access to a device's IO Regions */
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-07-22 16:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-20  7:55 [PATCH] [PATCH] system/memory: Fix max access size TaiseiIto
2024-07-20 14:30 ` Peter Maydell
2024-07-22 11:53   ` Paolo Bonzini
2024-07-22 14:29     ` Philippe Mathieu-Daudé
2024-07-22 16:50       ` Paolo Bonzini
2024-07-22 16:57         ` Peter Maydell

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).