arm64: use readq() instead of readl() to read 64bit entry_point
PATCH 1/1 arm64: use readq() instead of readl() to read 64bit entry_point
Here the entrypoint, declared as a 64 bit integer, is read from a pointer to 64bit integer but the read is done via readl_relaxed() which is for 32bit quantities.
All the high bits will thus be lost which change the meaning of the test against zero done later.
Fix this by using readq_relaxed() instead as it should be for 64bit quantities.
---
!!! Warning !!!
I don't have the HW to test this, nor have I read the ACPI specs. This is only compile tested.
--- arch/arm64/kernel/acpi_parking_protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/acpi_parking_protocol.c +1 -1
@@ -125,7 +125,7 @@ static void acpi_parking_protocol_cpu_postboot(void)struct parking_protocol_mailbox __iomem *mailbox = cpu_entry->mailbox;__le64 entry_point; - entry_point =readl_relaxed (&mailbox->entry_point); + entry_point =readq_relaxed (&mailbox->entry_point);/* * Check if firmware has cleared the entry_point as expected * by the protocol specification.
Signature · 1 line
2.13.0
PATCH 1/1 arm64: use readq() instead of readl() to read 64bit entry_point
Quoted 10 lines · Luc Van Oostenryck
Here the entrypoint, declared as a 64 bit integer, is read from a pointer to 64bit integer but the read is done via
readl_relaxed()which is for 32bit quantities.All the high bits will thus be lost which change the meaning of the test against zero done later.
Fix this by using
readq_relaxed()instead as it should be for 64bit quantities.
Quoted 7 lines
Signed-off-by Luc Van Oostenryck <[email protected]>---
!!! Warning !!!
I don't have the HW to test this, nor have I read the ACPI specs. This is only compile tested.
This looks correct to me, but I'd like an Ack from Lorenzo before I take it because it's not clear to me what issues can arise if firmware only writes zero to the bottom 32 bits of the jump address and leaves the upper bits intact. If firmware does this, then this patch will result in a WARN, but I can't figure out what this part of the spec is trying to achieve.
Will
Quoted 20 lines
--- arch/arm64/kernel/acpi_parking_protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm64/kernel/acpi_parking_protocol.c +1
-1@@ -125,7 +125,7 @@ static void acpi_parking_protocol_cpu_postboot(void)struct parking_protocol_mailbox __iomem *mailbox = cpu_entry->mailbox;__le64 entry_point; - entry_point =readl_relaxed (&mailbox->entry_point); + entry_point =readq_relaxed (&mailbox->entry_point);/* * Check if firmware has cleared the entry_point as expected * by the protocol specification. Signature · 1 line
2.13.0
Mark Rutland
reviewerPATCH 1/1 arm64: use readq() instead of readl() to read 64bit entry_point
In reply to Luc Van Oostenryck[resending as I bungled modifying the Cc list]
Quoted 11 lines · Luc Van Oostenryck
Here the entrypoint, declared as a 64 bit integer, is read from a pointer to 64bit integer but the read is done via
readl_relaxed()which is for 32bit quantities.All the high bits will thus be lost which change the meaning of the test against zero done later.
Fix this by using
readq_relaxed()instead as it should be for 64bit quantities.Signed-off-by Luc Van Oostenryck <[email protected]>
This looks right per my reading of the spec. FWIW:
It would be good if someone could test this on HW implementing the parking protocol. I've Cc'd those who've given Tested-by in the past.
Thanks,
Mark.
Quoted 26 lines
---
!!! Warning !!!
I don't have the HW to test this, nor have I read the ACPI specs. This is only compile tested.--- arch/arm64/kernel/acpi_parking_protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm64/kernel/acpi_parking_protocol.c +1
-1@@ -125,7 +125,7 @@ static void acpi_parking_protocol_cpu_postboot(void)struct parking_protocol_mailbox __iomem *mailbox = cpu_entry->mailbox;__le64 entry_point; - entry_point =readl_relaxed (&mailbox->entry_point); + entry_point =readq_relaxed (&mailbox->entry_point);/* * Check if firmware has cleared the entry_point as expected * by the protocol specification. Signature · 1 line
2.13.0
PATCH 1/1 arm64: use readq() instead of readl() to read 64bit entry_point
In reply to Luc Van OostenryckQuoted 12 lines · Luc Van Oostenryck
Here the entrypoint, declared as a 64 bit integer, is read from a pointer to 64bit integer but the read is done via
readl_relaxed()which is for 32bit quantities.All the high bits will thus be lost which change the meaning of the test against zero done later.
Fix this by using
readq_relaxed()instead as it should be for 64bit quantities.Signed-off-by Luc Van Oostenryck <[email protected]>
Quoted 8 lines
---
!!! Warning !!!
I don't have the HW to test this, nor have I read the ACPI specs. This is only compile tested.--- arch/arm64/kernel/acpi_parking_protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Patch is correct but as Mark already mentioned I would like some testing done on systems that rely on the parking protocol (hopefully FW clears the entry point correctly but I want to understand if this patch would trigger regressions that would force us to add quirks around it - even if we know this patch does the right thing from a kernel perspective).
Quoted 16 lines
arch/arm64/kernel/acpi_parking_protocol.c +1
-1@@ -125,7 +125,7 @@ static void acpi_parking_protocol_cpu_postboot(void)struct parking_protocol_mailbox __iomem *mailbox = cpu_entry->mailbox;__le64 entry_point; - entry_point =readl_relaxed (&mailbox->entry_point); + entry_point =readq_relaxed (&mailbox->entry_point);/* * Check if firmware has cleared the entry_point as expected * by the protocol specification. Signature · 1 line
2.13.0
No subject
In reply to Luc Van OostenryckIt is good with X-Gene 1/2.
PATCH 1/1 arm64: use readq() instead of readl() to read 64bit entry_point
In reply to Luc Van OostenryckIt is good with X-Gene 1/2.