All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suzuki.Poulose@arm.com (Suzuki K. Poulose)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: extract a field correctly in cpuid_feature_extract_field()
Date: Tue, 17 Nov 2015 09:27:19 +0000	[thread overview]
Message-ID: <564AF2F7.9030106@arm.com> (raw)
In-Reply-To: <CAKv+Gu9=zfocXVOsqHQHGu+afZisE_nZWCQ-bN5Fe_X=NacYHg@mail.gmail.com>

On 17/11/15 07:15, Ard Biesheuvel wrote:
> On 17 November 2015 at 06:05, AKASHI Takahiro
> <takahiro.akashi@linaro.org> wrote:
>> Basically, cpuid_feature_extract_field() does shift-left and then
>> shift-right to extract a specific field in an operand. But
>> a shift-left'ed value is casted to 's64' and so a succeeding shift-right
>> operation results in creating a sign-extended (and bogus) value.
>>
>
> This is intentional. This function was created specifically for
> extracting CPU feature fields, which are signed 4-bit quantities,
> where positive values represent incremental functionality, and
> negative values are reserved. This is poorly documented in the ARM ARM
> though.

Right. Akash's fix could break other pieces (like FP/ASIMD support in IDAA64PFR0
where, 0xf => function not implemented).

>
> Using this function for extracting 4-bit unsigned values is a mistake.
>

I will take a look at this one.

Thanks for pointing it out.

Suzuki

  reply	other threads:[~2015-11-17  9:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17  5:05 [PATCH] arm64: extract a field correctly in cpuid_feature_extract_field() AKASHI Takahiro
2015-11-17  7:15 ` Ard Biesheuvel
2015-11-17  9:27   ` Suzuki K. Poulose [this message]
2015-11-17 10:39     ` Suzuki K. Poulose
2015-11-18  7:04     ` AKASHI Takahiro
2015-11-18  7:26       ` Ard Biesheuvel
2015-11-18  8:08         ` AKASHI Takahiro

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=564AF2F7.9030106@arm.com \
    --to=suzuki.poulose@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.