From: Liwei Song <liwei.song@windriver.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
Len Brown <lenb@kernel.org>,
linux-acpi <linux-acpi@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ACPI, APEI: Fixup incorrect 16-bit access width firmware bug
Date: Wed, 26 Jul 2017 14:16:02 +0800 [thread overview]
Message-ID: <597833A2.8090709@windriver.com> (raw)
In-Reply-To: <CAHp75Vf5wpM4BW3umG5c1gHgmBEgD_+paYyvo6NTLGeEr9JB_g@mail.gmail.com>
On 07/21/2017 05:56 PM, Andy Shevchenko wrote:
> On Fri, Jul 21, 2017 at 12:41 PM, Song liwei <liwei.song@windriver.com> wrote:
>
>> [Firmware Bug]: APEI: Invalid bit width + offset in GAR [0xb2/16/0/1/1]
>>
>> This is due to an 8-bit access width is specified for a 16-bit register,
>> Do bit_width check just like what the original commit have done.
>
>> else if (bit_width == 64 && bit_offset == 0 && (*paddr & 0x07) == 0 &&
>> *access_bit_width < 64)
>> *access_bit_width = 64;
>> + else if (bit_width == 16 && bit_offset == 0 && (*paddr & 0x01) == 0 &&
>> + *access_bit_width < 16)
>> + *access_bit_width = 16;
>
> Wouldn't be better to rearrange that it will go in a sequence
> (16,32,64 or 64,32,16) ?
>
> or move bit_offset == 0 into external condion
>
> /* Fixup common BIOS bug */
> if (bit_offset == 0) {
> if (bit_width == 16 && (*paddr & 0x01) == 0 && *access_bit_width < 16)
> *access_bit_width = 16;
> else if (bit_width == 32 && (*paddr & 0x03) == 0 &&
> *access_bit_width < 32)
> *access_bit_width = 32;
> else if (bit_width == 64 && (*paddr & 0x07) == 0 &&
> *access_bit_width < 64)
> *access_bit_width = 64;
> }
>
>
> It might be (I'm not sure it will make it better, just a side note)
> considered to convert each internal conditional to
>
> ...if (bit_width == XX && (*paddr & YY) == 0)
> *access_bit_width = max(*access_bit_width, bit_width);
Hi Andy,
Thanks for your suggestion, what about the condition like the following?
The main bug in bios is bit_width is not comfortable with access_bit_width
So check it first.
if (*access_bit_width < bit_width && bit_offset == 0) {
if ((bit_width == 16 && (*paddr & 0x01) == 0) ||
(bit_width == 32 && (*paddr & 0x03) == 0) ||
(bit_width == 64 && (*paddr & 0x07) == 0))
*access_bit_width = bit_width;
}
Thanks,
Liwei.
>
next prev parent reply other threads:[~2017-07-26 6:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-21 9:41 [PATCH] ACPI, APEI: Fixup incorrect 16-bit access width firmware bug Song liwei
2017-07-21 9:56 ` Andy Shevchenko
2017-07-26 6:16 ` Liwei Song [this message]
2017-07-26 10:44 ` Andy Shevchenko
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=597833A2.8090709@windriver.com \
--to=liwei.song@windriver.com \
--cc=andy.shevchenko@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/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.