Skip to contentSkip to conversation

acpi-pm-tmr: allow 2-byte reads

PATCH In review Michael Tokarev 4 participants 6 messages Jul 14, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acpi-pm-tmr: allow 2-byte reads

As found in LP#964247, MacOS Catalina performs 2-byte reads on the acpi timer address space while the spec says it should be 4-byte. Allow 2-byte reads.

---
 hw/acpi/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

I'm applying this to debian qemu package, need the fix faster in order to release security updates for other branches.

hw/acpi/core.c +3 -1
index 45cbed49ab..9be38aa2ac 100644
@@ -530,7 +530,9 @@ 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,
+     /* at least MacOS Catalina reads 2 bytes and fails if it doesn't work */
+    .valid.min_access_size = 2,
     .valid.max_access_size = 4,
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
Signature · 1 line
2.20.1
#1 lore raw
Quoted 6 lines · Michael Tokarev

As found in LP#964247, MacOS Catalina performs 2-byte reads on the acpi timer address space while the spec says it should be 4-byte. Allow 2-byte reads.

After some thought, I think I'll do a 1-byte one the way Simon proposed. Just go back to behave the way it did. Will apply yours on top - Simon - could you try and send a tested-by tag please?

Quoted 25 lines
---
 hw/acpi/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

I'm applying this to debian qemu package, need the fix faster in order to release security updates for other branches.

hw/acpi/core.c +3 -1
index 45cbed49ab..9be38aa2ac 100644
@@ -530,7 +530,9 @@ 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,
+     /* at least MacOS Catalina reads 2 bytes and fails if it doesn't work */
+    .valid.min_access_size = 2,
     .valid.max_access_size = 4,
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
Signature · 1 line
2.20.1
#2 lore raw
In reply to Michael Tokarev
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [PATCH for-5.1] acpi-pm-tmr: allow 2-byte reads

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Switched to a new branch 'test'
b4f3ad8 acpi-pm-tmr: allow 2-byte reads

=== OUTPUT BEGIN ===
ERROR: The correct form is "Signed-off-by"
#12:

total: 1 errors, 0 warnings, 10 lines checked

Commit b4f3ad8f13df (acpi-pm-tmr: allow 2-byte reads) has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#3 lore raw
In reply to Michael Tokarev
Quoted 3 lines · Michael Tokarev

As found in LP#964247, MacOS Catalina performs 2-byte reads on the acpi timer address space while the spec says it should be 4-byte. Allow 2-byte reads.

https://bugs.launchpad.net/qemu/+bug/964247 is about Unity-2D shell...

What is the target hardware used here?

Quoted 27 lines
---
 hw/acpi/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

I'm applying this to debian qemu package, need the fix faster in order to release security updates for other branches.

hw/acpi/core.c +3 -1
index 45cbed49ab..9be38aa2ac 100644
@@ -530,7 +530,9 @@ 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,
+     /* at least MacOS Catalina reads 2 bytes and fails if it doesn't work */
+    .valid.min_access_size = 2,
     .valid.max_access_size = 4,
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
#4 lore raw

14.07.2020 13:26, Philippe Mathieu-Daudé пишет:

Quoted 6 lines · Michael Tokarev
Quoted 3 lines

As found in LP#964247, MacOS Catalina performs 2-byte reads on the acpi timer address space while the spec says it should be 4-byte. Allow 2-byte reads.

https://bugs.launchpad.net/qemu/+bug/964247 is about Unity-2D shell...

It's a debian bug# ( http://bugs.debian.org/964247 ), not LP, the right LP bug is LP#1886318 . Mixed the two wrongly, I'm sorry for that. I resent a v2, also allowing 1-byte access as suggested by mst.

Quoted 1 line

What is the target hardware used here?

It's x86.

Thanks,

/mjt

#5 lore raw
Quoted 10 lines · Michael Tokarev

14.07.2020 13:26, Philippe Mathieu-Daudé пишет:

Quoted 6 lines · Michael Tokarev
Quoted 3 lines

As found in LP#964247, MacOS Catalina performs 2-byte reads on the acpi timer address space while the spec says it should be 4-byte. Allow 2-byte reads.

https://bugs.launchpad.net/qemu/+bug/964247 is about Unity-2D shell...

It's a debian bug# ( http://bugs.debian.org/964247 ), not LP, the right LP bug is LP#1886318 . Mixed the two wrongly, I'm sorry for that.

Ah, no worry. Please include in the tags:

Quoted 10 lines

I resent a v2, also allowing 1-byte access as suggested by mst.

Quoted 1 line

What is the target hardware used here?

It's x86.

Thanks,

/mjt