Skip to contentSkip to conversation

hw/misc: Fix the valid access size to the avr-power device

PATCH In review Thomas Huth 4 participants 5 messages Apr 21 – Apr 26

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/misc: Fix the valid access size to the avr-power device

From: Thomas Huth <[email protected]>

Accessing the device with in non-single byte mode currently causes QEMU to abort:

 $ echo "writew 0x800064 0x4142" | \
   ./qemu-system-avr -M mega2560 -display none -qtest stdio -accel qtest
 [I 0.000000] OPENED
 [R +0.001784] writew 0x800064 0x4142
 qemu-system-avr: ../../devel/qemu/hw/misc/avr_power.c:58: avr_mask_write:
  Assertion `offset == 0' failed.
 Aborted                    (core dumped)

Set the valid max access size to 1 to fix the problem.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3393

---
 hw/misc/avr_power.c | 3 +++
 1 file changed, 3 insertions(+)
hw/misc/avr_power.c +3 -0
index f42cf4fd906..42be2656911 100644
@@ -73,6 +73,9 @@ static const MemoryRegionOps avr_mask_ops = {
     .impl = {
         .max_access_size = 1,
     },
+    .valid = {
+        .max_access_size = 1,
+    },
 };
 
 static void avr_mask_init(Object *dev)
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Thomas Huth

From: Thomas Huth <[email protected]>

Accessing the device with in non-single byte mode currently causes QEMU to abort:

 $ echo "writew 0x800064 0x4142" | \
   ./qemu-system-avr -M mega2560 -display none -qtest stdio -accel qtest
 [I 0.000000] OPENED
 [R +0.001784] writew 0x800064 0x4142
 qemu-system-avr: ../../devel/qemu/hw/misc/avr_power.c:58: avr_mask_write:
  Assertion `offset == 0' failed.
 Aborted                    (core dumped)

Set the valid max access size to 1 to fix the problem.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3393

---
 hw/misc/avr_power.c | 3 +++
 1 file changed, 3 insertions(+)
hw/misc/avr_power.c +0 -0
index f42cf4fd906..42be2656911 100644

hw/misc/avr_power.c static const MemoryRegionOps avr_mask_ops = { · line 79

Quoted 7 lines
hw/misc/avr_power.c +3 -0
@@ -73,6 +73,9 @@ static const MemoryRegionOps avr_mask_ops = {
     .impl = {
         .max_access_size = 1,
     },
+    .valid = {
+        .max_access_size = 1,
+    },
 };

thanks
-- PMM

Reviewed-by on v1 1/1
#2 lore raw
In reply to Thomas Huth
Quoted 13 lines · Thomas Huth

From: Thomas Huth <[email protected]>

Accessing the device with in non-single byte mode currently causes QEMU to abort:

  $ echo "writew 0x800064 0x4142" | \
    ./qemu-system-avr -M mega2560 -display none -qtest stdio -accel qtest
  [I 0.000000] OPENED
  [R +0.001784] writew 0x800064 0x4142
  qemu-system-avr: ../../devel/qemu/hw/misc/avr_power.c:58: avr_mask_write:
   Assertion `offset == 0' failed.
  Aborted                    (core dumped)
Quoted 7 lines

Set the valid max access size to 1 to fix the problem.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3393

---
  hw/misc/avr_power.c | 3 +++
  1 file changed, 3 insertions(+)

and queued, thanks!

#3 lore raw
In reply to Thomas Huth
Quoted 13 lines · Thomas Huth

From: Thomas Huth <[email protected]>

Accessing the device with in non-single byte mode currently causes QEMU to abort:

  $ echo "writew 0x800064 0x4142" | \
    ./qemu-system-avr -M mega2560 -display none -qtest stdio -accel qtest
  [I 0.000000] OPENED
  [R +0.001784] writew 0x800064 0x4142
  qemu-system-avr: ../../devel/qemu/hw/misc/avr_power.c:58: avr_mask_write:
   Assertion `offset == 0' failed.
  Aborted                    (core dumped)
Quoted 4 lines

Set the valid max access size to 1 to fix the problem.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3393

This looks like a minor issue, yet it feels like this change is a good candidate for the current stable releases. Please let me know if it isn't.

Thanks,

/mjt

#4 lore raw
Quoted 15 lines · Michael Tokarev
Quoted 13 lines · Thomas Huth

From: Thomas Huth <[email protected]>

Accessing the device with in non-single byte mode currently causes QEMU to abort:

  $ echo "writew 0x800064 0x4142" | \
    ./qemu-system-avr -M mega2560 -display none -qtest stdio -accel qtest
  [I 0.000000] OPENED
  [R +0.001784] writew 0x800064 0x4142
  qemu-system-avr: ../../devel/qemu/hw/misc/avr_power.c:58: avr_mask_write:
   Assertion `offset == 0' failed.
  Aborted                    (core dumped)
Quoted 7 lines
Quoted 4 lines

Set the valid max access size to 1 to fix the problem.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3393

This looks like a minor issue, yet it feels like this change is a good candidate for the current stable releases. Please let me know if it isn't.

Yes, this is fine for stable.

-- PMM