All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: use readq() instead of readl() to read 64bit entry_point
Date: Mon, 26 Jun 2017 14:31:00 +0100	[thread overview]
Message-ID: <20170626133059.GK1691@arm.com> (raw)
In-Reply-To: <20170626131625.79059-1-luc.vanoostenryck@gmail.com>

On Mon, Jun 26, 2017 at 03:16:25PM +0200, Luc Van Oostenryck wrote:
> 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 <luc.vanoostenryck@gmail.com>
> 
> ---
> 
> !!! 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

> ---
>  arch/arm64/kernel/acpi_parking_protocol.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kernel/acpi_parking_protocol.c b/arch/arm64/kernel/acpi_parking_protocol.c
> index 1f5655cd9..f35e80aad 100644
> --- a/arch/arm64/kernel/acpi_parking_protocol.c
> +++ b/arch/arm64/kernel/acpi_parking_protocol.c
> @@ -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.
> -- 
> 2.13.0
> 

  reply	other threads:[~2017-06-26 13:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-26 13:16 [PATCH] arm64: use readq() instead of readl() to read 64bit entry_point Luc Van Oostenryck
2017-06-26 13:31 ` Will Deacon [this message]
2017-06-26 13:31 ` Mark Rutland
2017-07-03  9:44 ` Lorenzo Pieralisi
2017-07-03 23:46 ` No subject Khuong Dinh
2017-07-04  0:07 ` [PATCH] arm64: use readq() instead of readl() to read 64bit entry_point Khuong Dinh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170626133059.GK1691@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.