diff mbox series

[1/5] x86/mm: account for the offset when performing subpage r/o MMIO access

Message ID 20250411105411.22334-2-roger.pau@citrix.com (mailing list archive)
State Superseded
Headers show
Series xen/x86: fix implementation of subpage r/o MMIO | expand

Commit Message

Roger Pau Monné April 11, 2025, 10:54 a.m. UTC
The current logic in subpage_mmio_write_emulate() doesn't take into account
the page offset, and always performs the writes at offset 0 (start of the
page).

Fix this by accounting for the offset before performing the write.

Fixes: 8847d6e23f97 ('x86/mm: add API for marking only part of a MMIO page read only')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Andrew Cooper April 11, 2025, noon UTC | #1
On 11/04/2025 11:54 am, Roger Pau Monne wrote:
> The current logic in subpage_mmio_write_emulate() doesn't take into account
> the page offset, and always performs the writes at offset 0 (start of the
> page).
>
> Fix this by accounting for the offset before performing the write.
>
> Fixes: 8847d6e23f97 ('x86/mm: add API for marking only part of a MMIO page read only')
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
diff mbox series

Patch

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 4fecd37aeca0..1cf236516789 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5131,6 +5131,7 @@  static void subpage_mmio_write_emulate(
         return;
     }
 
+    addr += offset;
     switch ( len )
     {
     case 1: