public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Thomas Renninger <trenn@suse.de>
Cc: Myron Stowe <myron.stowe@redhat.com>,
	Len Brown <len.brown@intel.com>,
	bondd@us.ibm.com, lenb@kernel.org, linux-acpi@vger.kernel.org,
	ying.huang@intel.com, bhelgaas@google.com
Subject: Re: [PATCH 0/2] ACPI: Re-factor and remove ./drivers/acpi/atomicio.[ch]
Date: Sun, 6 Nov 2011 14:19:17 +0100	[thread overview]
Message-ID: <201111061419.17460.rjw@sisk.pl> (raw)
In-Reply-To: <201110280349.26410.trenn@suse.de>

On Friday, October 28, 2011, Thomas Renninger wrote:
> On Thursday 29 September 2011 23:59:08 Myron Stowe wrote:
> ..
> > Myron Stowe (2):
> >       ACPI: Convert acpi_pre_map_gar()/acpi_atomic_read() and remove ./drivers/acpi/atomicio.[ch]
> >       ACPI: Export interfaces for ioremapping/iounmapping ACPI registers
> 
> Would be great to know whether these are going to be accepted.
> If yes, this check should get removed as well:
> 
> drivers/acpi/acpica/hwregs.c:
> acpi_status
> acpi_hw_validate_register(struct acpi_generic_address *reg,
>                           u8 max_bit_width, u64 *address)
> {
> ...
>         if (reg->bit_offset != 0) {
>                 ACPI_WARNING((AE_INFO,
>                               "Unsupported register bit offset: 0x%X",
>                               reg->bit_offset));
>         }
> 
> because APEI GAR declarations do use bit_offset != 0.
> 
> There is another problem. Would be great to get some opinions/feedback
> on it already:
> APEI GAR entries seem to have invalid bit_width entries on some platforms.
> After looking at several tables, I expect that with APEI tables access width
> (in bytes) should get used instead, Windows seem to ignore bit width fields,
> at least for APEI tables.

There are a couple of things we could do.  First, ignore the widths as Windows
does (but that would make the code a bit fragile).  Second, replace the invalid
widths with something sane when (or right after) loading the APEI tables.

Is there any automatic check we can use to detect if the BIOS-provided widths
are invalid?

> I have patches but I need to know whether your patches are accepted.
> 
> There also is a problem with modifying GAR bit_width field to be able to
> pass it to the generic acpica functions (what your patches are doing).

What patches are you referring to, I don't see anything like this in [1/2]
and [2/2]?

> The problem is that the structures are located in reserved BIOS areas and
> they should be const and not get modified.

But we can cache them, can't we?

> I have 2 solutions for this:
>   1) Make apei_check_gar() pass 2 struct acpi_generic_address:
>      int apei_check_gar(struct acpi_generic_address *reg,
>                     const struct acpi_generic_address *orig, u64 *paddr)
>      orig -> is the one located in reserved mem area, mapped to virtual addr space
>      reg  -> will be a copy of it, possibly with bit_width adjusted which then
>             can be passed to acpi_memory_read/write and friends.
>   2) Allocate memory and copy whole APEI tables
> 
> 1. Should have the advantage of less memory waste
> 2. Should have the advantage of a bit nicer code (kalloc and memcpy per table) and
>    if more things like this happen, tables could get adjusted easily.
>    It also has the advantage that GAR structures do not need to get double
>    checked and eventually adjusted at runtime again.
> 
> Below is the first patch which goes for 1. More patches may be needed, but I
> as said, I need to know whether your patches get accepted.
> What do you think?

I'd go for 2.  Really, it's not like we have a shortage of memory on the
affected systems and it's so much simpler than the alternative that I'm
not sure if the alternative makes sense at all.

Thanks,
Rafael

  parent reply	other threads:[~2011-11-06 13:16 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-29 21:59 [PATCH 0/2] ACPI: Re-factor and remove ./drivers/acpi/atomicio.[ch] Myron Stowe
2011-09-29 21:59 ` [PATCH 1/2] ACPI: Export interfaces for ioremapping/iounmapping ACPI registers Myron Stowe
2011-11-06 12:49   ` Rafael J. Wysocki
2011-09-29 21:59 ` [PATCH 2/2] ACPI: Convert acpi_pre_map_gar()/acpi_atomic_read() and remove ./drivers/acpi/atomicio.[ch] Myron Stowe
2011-11-06 13:05   ` Rafael J. Wysocki
2011-10-28  1:49 ` [PATCH 0/2] ACPI: Re-factor " Thomas Renninger
2011-10-28 15:03   ` Bjorn Helgaas
2011-10-31 10:47     ` Thomas Renninger
2011-11-03  1:42       ` Myron Stowe
2011-11-06 13:30         ` Rafael J. Wysocki
2011-11-04 23:54       ` Myron Stowe
2011-11-05  2:42         ` Thomas Renninger
2011-11-06 13:42           ` Rafael J. Wysocki
2011-11-15 18:45         ` Bjorn Helgaas
2011-11-06 13:25       ` Rafael J. Wysocki
2011-11-06 13:23     ` Rafael J. Wysocki
2011-10-28 15:14   ` Bjorn Helgaas
2011-10-31 10:33     ` Thomas Renninger
2011-10-31 15:51       ` Bjorn Helgaas
2011-11-03  9:16         ` Thomas Renninger
2011-11-03 13:53           ` Bjorn Helgaas
2011-11-03 16:18             ` Thomas Renninger
2011-11-03 16:44               ` Myron Stowe
2011-11-04  2:16                 ` Thomas Renninger
2011-11-04  1:55                   ` Myron Stowe
2011-10-28 22:40   ` Myron Stowe
2011-11-06 13:19   ` Rafael J. Wysocki [this message]
2011-11-03 16:31 ` Thomas Renninger
2011-11-04  0:56   ` Huang Ying
2011-11-04  2:24     ` Thomas Renninger
2011-11-04  1:32       ` Huang Ying

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=201111061419.17460.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=bhelgaas@google.com \
    --cc=bondd@us.ibm.com \
    --cc=len.brown@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=myron.stowe@redhat.com \
    --cc=trenn@suse.de \
    --cc=ying.huang@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox