All of lore.kernel.org
 help / color / mirror / Atom feed
* acpi_os_read_memory() from interrupt context
@ 2010-08-04 17:19 ` Bjorn Helgaas
  0 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2010-08-04 17:19 UTC (permalink / raw)
  To: linux-acpi, devel

Linux reads some ACPI registers from interrupt context.  For example,
we read the PM1 Status register in the SCI interrupt handler via
this path:

    acpi_irq
      acpi_ev_sci_xrupt_handler
        acpi_ev_fixed_event_detect
          acpi_hw_register_read
            acpi_hw_read_multiple
              acpi_read

But acpi_read() takes a generic address structure, and if that
address happens to be in memory space (not I/O port space), we use
acpi_os_read_memory().  In Linux, that uses ioremap() to map the
address, and that doesn't work from interrupt context.

I can imagine fixing this by doing the ioremap() at boot-time
rather than at interrupt-time, but most of this interrupt path
is in the ACPI CA, not in Linux itself, so it would probably
require some redesign in the CA.

Any suggestions?

Bjorn

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Devel] acpi_os_read_memory() from interrupt context
@ 2010-08-04 17:19 ` Bjorn Helgaas
  0 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2010-08-04 17:19 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 837 bytes --]

Linux reads some ACPI registers from interrupt context.  For example,
we read the PM1 Status register in the SCI interrupt handler via
this path:

    acpi_irq
      acpi_ev_sci_xrupt_handler
        acpi_ev_fixed_event_detect
          acpi_hw_register_read
            acpi_hw_read_multiple
              acpi_read

But acpi_read() takes a generic address structure, and if that
address happens to be in memory space (not I/O port space), we use
acpi_os_read_memory().  In Linux, that uses ioremap() to map the
address, and that doesn't work from interrupt context.

I can imagine fixing this by doing the ioremap() at boot-time
rather than at interrupt-time, but most of this interrupt path
is in the ACPI CA, not in Linux itself, so it would probably
require some redesign in the CA.

Any suggestions?

Bjorn

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [Devel] acpi_os_read_memory() from interrupt context
@ 2010-08-04 22:26   ` Moore, Robert
  0 siblings, 0 replies; 6+ messages in thread
From: Moore, Robert @ 2010-08-04 22:26 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-acpi, devel

If you need to pre-map the ACPI registers, I would expect the host to build a list of these during initialization as you mention, then lookup and use the appropriate mapping in acpi_os_read_memory.  The acpi_os memory interfaces are not generic memory interfaces; they are only used for memory-mapped ACPI registers, so it is entirely appropriate to do whatever you need to do to obtain a mapping for the registers when at interrupt level.



>-----Original Message-----
>From: devel-bounces@acpica.org [mailto:devel-bounces@acpica.org] On Behalf
>Of Bjorn Helgaas
>Sent: Wednesday, August 04, 2010 10:19 AM
>To: linux-acpi@vger.kernel.org; devel@acpica.org
>Subject: [Devel] acpi_os_read_memory() from interrupt context
>
>Linux reads some ACPI registers from interrupt context.  For example,
>we read the PM1 Status register in the SCI interrupt handler via
>this path:
>
>    acpi_irq
>      acpi_ev_sci_xrupt_handler
>        acpi_ev_fixed_event_detect
>          acpi_hw_register_read
>            acpi_hw_read_multiple
>              acpi_read
>
>But acpi_read() takes a generic address structure, and if that
>address happens to be in memory space (not I/O port space), we use
>acpi_os_read_memory().  In Linux, that uses ioremap() to map the
>address, and that doesn't work from interrupt context.
>
>I can imagine fixing this by doing the ioremap() at boot-time
>rather than at interrupt-time, but most of this interrupt path
>is in the ACPI CA, not in Linux itself, so it would probably
>require some redesign in the CA.
>
>Any suggestions?
>
>Bjorn
>_______________________________________________
>Devel mailing list
>Devel@acpica.org
>http://lists.acpica.org/listinfo/devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Devel] acpi_os_read_memory() from interrupt context
@ 2010-08-04 22:26   ` Moore, Robert
  0 siblings, 0 replies; 6+ messages in thread
From: Moore, Robert @ 2010-08-04 22:26 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 1736 bytes --]

If you need to pre-map the ACPI registers, I would expect the host to build a list of these during initialization as you mention, then lookup and use the appropriate mapping in acpi_os_read_memory.  The acpi_os memory interfaces are not generic memory interfaces; they are only used for memory-mapped ACPI registers, so it is entirely appropriate to do whatever you need to do to obtain a mapping for the registers when at interrupt level.



>-----Original Message-----
>From: devel-bounces(a)acpica.org [mailto:devel-bounces(a)acpica.org] On Behalf
>Of Bjorn Helgaas
>Sent: Wednesday, August 04, 2010 10:19 AM
>To: linux-acpi(a)vger.kernel.org; devel(a)acpica.org
>Subject: [Devel] acpi_os_read_memory() from interrupt context
>
>Linux reads some ACPI registers from interrupt context.  For example,
>we read the PM1 Status register in the SCI interrupt handler via
>this path:
>
>    acpi_irq
>      acpi_ev_sci_xrupt_handler
>        acpi_ev_fixed_event_detect
>          acpi_hw_register_read
>            acpi_hw_read_multiple
>              acpi_read
>
>But acpi_read() takes a generic address structure, and if that
>address happens to be in memory space (not I/O port space), we use
>acpi_os_read_memory().  In Linux, that uses ioremap() to map the
>address, and that doesn't work from interrupt context.
>
>I can imagine fixing this by doing the ioremap() at boot-time
>rather than at interrupt-time, but most of this interrupt path
>is in the ACPI CA, not in Linux itself, so it would probably
>require some redesign in the CA.
>
>Any suggestions?
>
>Bjorn
>_______________________________________________
>Devel mailing list
>Devel(a)acpica.org
>http://lists.acpica.org/listinfo/devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: acpi_os_read_memory() from interrupt context
@ 2010-08-11  9:25   ` Andi Kleen
  0 siblings, 0 replies; 6+ messages in thread
From: Andi Kleen @ 2010-08-11  9:25 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-acpi, devel, ying.huang

Bjorn Helgaas <bjorn.helgaas@hp.com> writes:
> require some redesign in the CA.
>
> Any suggestions?

pre-map. Ying developed a pre map infrastructure for this for the ERST
code. You could probably reuse that.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Devel] acpi_os_read_memory() from interrupt context
@ 2010-08-11  9:25   ` Andi Kleen
  0 siblings, 0 replies; 6+ messages in thread
From: Andi Kleen @ 2010-08-11  9:25 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 286 bytes --]

Bjorn Helgaas <bjorn.helgaas(a)hp.com> writes:
> require some redesign in the CA.
>
> Any suggestions?

pre-map. Ying developed a pre map infrastructure for this for the ERST
code. You could probably reuse that.

-Andi

-- 
ak(a)linux.intel.com -- Speaking for myself only.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-08-11  9:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-04 17:19 acpi_os_read_memory() from interrupt context Bjorn Helgaas
2010-08-04 17:19 ` [Devel] " Bjorn Helgaas
2010-08-04 22:26 ` Moore, Robert
2010-08-04 22:26   ` Moore, Robert
2010-08-11  9:25 ` Andi Kleen
2010-08-11  9:25   ` [Devel] " Andi Kleen

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.