Skip to contentSkip to conversation

acpi: accept byte and word access to core ACPI registers

PATCH Applied Michael Tokarev 2 participants 4 messages Jul 20, 2020 – Jul 22, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acpi: accept byte and word access to core ACPI registers

All ISA registers should be accessible as bytes, words or dwords (if wide enough). Fix the access constraints for acpi-pm-evt, acpi-pm-tmr & acpi-cnt registers.

Fixes 5d971f9e67 (memory: Revert "memory: accept mismatching sizes in memory_region_access_valid")
Fixes afafe4bbe0 (apci: switch cnt to memory api)
Fixes 77d58b1e47 (apci: switch timer to memory api)
Fixes b5a7c024d2 (apci: switch evt to memory api)
---
 hw/acpi/core.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
hw/acpi/core.c +6 -3
index f6d9ec4f13..ac06db3450 100644
@@ -458,7 +458,8 @@ static void acpi_pm_evt_write(void *opaque, hwaddr addr, uint64_t val,
 static const MemoryRegionOps acpi_pm_evt_ops = {
     .read = acpi_pm_evt_read,
     .write = acpi_pm_evt_write,
-    .valid.min_access_size = 2,
+    .impl.min_access_size = 2,
+    .valid.min_access_size = 1,
     .valid.max_access_size = 2,
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
@@ -527,7 +528,8 @@ static void acpi_pm_tmr_write(void *opaque, hwaddr addr, uint64_t val,
 static const MemoryRegionOps acpi_pm_tmr_ops = {
     .read = acpi_pm_tmr_read,
     .write = acpi_pm_tmr_write,
-    .valid.min_access_size = 4,
+    .impl.min_access_size = 4,
+    .valid.min_access_size = 1,
     .valid.max_access_size = 4,
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
@@ -599,7 +601,8 @@ static void acpi_pm_cnt_write(void *opaque, hwaddr addr, uint64_t val,
 static const MemoryRegionOps acpi_pm_cnt_ops = {
     .read = acpi_pm_cnt_read,
     .write = acpi_pm_cnt_write,
-    .valid.min_access_size = 2,
+    .impl.min_access_size = 2,
+    .valid.min_access_size = 1,
     .valid.max_access_size = 2,
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
Signature · 1 line
2.20.1
#1 lore raw
Quoted 4 lines · Michael Tokarev

All ISA registers should be accessible as bytes, words or dwords (if wide enough). Fix the access constraints for acpi-pm-evt, acpi-pm-tmr & acpi-cnt registers.

Quoted 10 lines
Fixes 5d971f9e67 (memory: Revert "memory: accept mismatching sizes in memory_region_access_valid")
Fixes afafe4bbe0 (apci: switch cnt to memory api)
Fixes 77d58b1e47 (apci: switch timer to memory api)
Fixes b5a7c024d2 (apci: switch evt to memory api)

Queued, thanks!

Quoted 40 lines
---
 hw/acpi/core.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
hw/acpi/core.c +6 -3
index f6d9ec4f13..ac06db3450 100644
@@ -458,7 +458,8 @@ static void acpi_pm_evt_write(void *opaque, hwaddr addr, uint64_t val,
 static const MemoryRegionOps acpi_pm_evt_ops = {
     .read = acpi_pm_evt_read,
     .write = acpi_pm_evt_write,
-    .valid.min_access_size = 2,
+    .impl.min_access_size = 2,
+    .valid.min_access_size = 1,
     .valid.max_access_size = 2,
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
@@ -527,7 +528,8 @@ static void acpi_pm_tmr_write(void *opaque, hwaddr addr, uint64_t val,
 static const MemoryRegionOps acpi_pm_tmr_ops = {
     .read = acpi_pm_tmr_read,
     .write = acpi_pm_tmr_write,
-    .valid.min_access_size = 4,
+    .impl.min_access_size = 4,
+    .valid.min_access_size = 1,
     .valid.max_access_size = 4,
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
@@ -599,7 +601,8 @@ static void acpi_pm_cnt_write(void *opaque, hwaddr addr, uint64_t val,
 static const MemoryRegionOps acpi_pm_cnt_ops = {
     .read = acpi_pm_cnt_read,
     .write = acpi_pm_cnt_write,
-    .valid.min_access_size = 2,
+    .impl.min_access_size = 2,
+    .valid.min_access_size = 1,
     .valid.max_access_size = 2,
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
Signature · 1 line
2.20.1
#2 lore raw
Quoted 16 lines · Michael S. Tsirkin
Quoted 4 lines · Michael Tokarev

All ISA registers should be accessible as bytes, words or dwords (if wide enough). Fix the access constraints for acpi-pm-evt, acpi-pm-tmr & acpi-cnt registers.

Quoted 10 lines
Fixes 5d971f9e67 (memory: Revert "memory: accept mismatching sizes in memory_region_access_valid")
Fixes afafe4bbe0 (apci: switch cnt to memory api)
Fixes 77d58b1e47 (apci: switch timer to memory api)
Fixes b5a7c024d2 (apci: switch evt to memory api)
Quoted 1 line

Queued, thanks!

Michael, please add Cc: stable@ for this. Many people suffered due to this already, it's enough of that ;)

Thanks,

/mjt

#3 lore raw
Quoted 17 lines · Michael Tokarev
Quoted 16 lines · Michael S. Tsirkin
Quoted 14 lines · Michael Tokarev

All ISA registers should be accessible as bytes, words or dwords (if wide enough). Fix the access constraints for acpi-pm-evt, acpi-pm-tmr & acpi-cnt registers.

Fixes 5d971f9e67 (memory: Revert "memory: accept mismatching sizes in memory_region_access_valid")
Fixes afafe4bbe0 (apci: switch cnt to memory api)
Fixes 77d58b1e47 (apci: switch timer to memory api)
Fixes b5a7c024d2 (apci: switch evt to memory api)
Quoted 8 lines
Quoted 1 line

Queued, thanks!

Michael, please add Cc: stable@ for this. Many people suffered due to this already, it's enough of that ;)

Thanks,

/mjt

I did that, thanks!