* [PATCH] ACPI: GED: add support for _Exx / _Lxx handler methods
@ 2020-05-15 9:36 Ard Biesheuvel
2020-05-15 16:32 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2020-05-15 9:36 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arm-kernel, Ard Biesheuvel, Rafael J. Wysocki, Len Brown,
linux-acpi, stable
Per the ACPI spec, interrupts in the range [0, 255] may be handled
in AML using individual methods whose naming is based on the format
_Exx or _Lxx, where xx is the hex representation of the interrupt
index.
Add support for this missing feature to our ACPI GED driver.
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
Cc: <stable@vger.kernel.org> # v4.9+
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
drivers/acpi/evged.c | 22 +++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/evged.c b/drivers/acpi/evged.c
index aba0d0027586..6d7a522952bf 100644
--- a/drivers/acpi/evged.c
+++ b/drivers/acpi/evged.c
@@ -79,6 +79,8 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
struct resource r;
struct acpi_resource_irq *p = &ares->data.irq;
struct acpi_resource_extended_irq *pext = &ares->data.extended_irq;
+ char ev_name[5];
+ u8 trigger;
if (ares->type == ACPI_RESOURCE_TYPE_END_TAG)
return AE_OK;
@@ -87,14 +89,28 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
dev_err(dev, "unable to parse IRQ resource\n");
return AE_ERROR;
}
- if (ares->type == ACPI_RESOURCE_TYPE_IRQ)
+ if (ares->type == ACPI_RESOURCE_TYPE_IRQ) {
gsi = p->interrupts[0];
- else
+ trigger = p->triggering;
+ } else {
gsi = pext->interrupts[0];
+ trigger = p->triggering;
+ }
irq = r.start;
- if (ACPI_FAILURE(acpi_get_handle(handle, "_EVT", &evt_handle))) {
+ switch (gsi) {
+ case 0 ... 255:
+ sprintf(ev_name, "_%c%02hhX",
+ trigger == ACPI_EDGE_SENSITIVE ? 'E' : 'L', gsi);
+
+ if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle)))
+ break;
+ /* fall through */
+ default:
+ if (ACPI_SUCCESS(acpi_get_handle(handle, "_EVT", &evt_handle)))
+ break;
+
dev_err(dev, "cannot locate _EVT method\n");
return AE_ERROR;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ACPI: GED: add support for _Exx / _Lxx handler methods
2020-05-15 9:36 [PATCH] ACPI: GED: add support for _Exx / _Lxx handler methods Ard Biesheuvel
@ 2020-05-15 16:32 ` Rafael J. Wysocki
2020-05-26 11:12 ` Ard Biesheuvel
0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2020-05-15 16:32 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Linux Kernel Mailing List, Linux ARM, Rafael J. Wysocki,
Len Brown, ACPI Devel Maling List, Stable
On Fri, May 15, 2020 at 11:37 AM Ard Biesheuvel <ardb@kernel.org> wrote:
>
> Per the ACPI spec, interrupts in the range [0, 255] may be handled
> in AML using individual methods whose naming is based on the format
> _Exx or _Lxx, where xx is the hex representation of the interrupt
> index.
>
> Add support for this missing feature to our ACPI GED driver.
>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Len Brown <lenb@kernel.org>
> Cc: linux-acpi@vger.kernel.org
> Cc: <stable@vger.kernel.org> # v4.9+
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> drivers/acpi/evged.c | 22 +++++++++++++++++---
> 1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/evged.c b/drivers/acpi/evged.c
> index aba0d0027586..6d7a522952bf 100644
> --- a/drivers/acpi/evged.c
> +++ b/drivers/acpi/evged.c
> @@ -79,6 +79,8 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
> struct resource r;
> struct acpi_resource_irq *p = &ares->data.irq;
> struct acpi_resource_extended_irq *pext = &ares->data.extended_irq;
> + char ev_name[5];
> + u8 trigger;
>
> if (ares->type == ACPI_RESOURCE_TYPE_END_TAG)
> return AE_OK;
> @@ -87,14 +89,28 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
> dev_err(dev, "unable to parse IRQ resource\n");
> return AE_ERROR;
> }
> - if (ares->type == ACPI_RESOURCE_TYPE_IRQ)
> + if (ares->type == ACPI_RESOURCE_TYPE_IRQ) {
> gsi = p->interrupts[0];
> - else
> + trigger = p->triggering;
> + } else {
> gsi = pext->interrupts[0];
> + trigger = p->triggering;
> + }
>
> irq = r.start;
>
> - if (ACPI_FAILURE(acpi_get_handle(handle, "_EVT", &evt_handle))) {
> + switch (gsi) {
> + case 0 ... 255:
> + sprintf(ev_name, "_%c%02hhX",
> + trigger == ACPI_EDGE_SENSITIVE ? 'E' : 'L', gsi);
> +
> + if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle)))
> + break;
> + /* fall through */
> + default:
> + if (ACPI_SUCCESS(acpi_get_handle(handle, "_EVT", &evt_handle)))
> + break;
> +
> dev_err(dev, "cannot locate _EVT method\n");
> return AE_ERROR;
> }
> --
Applied as 5.8 material, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ACPI: GED: add support for _Exx / _Lxx handler methods
2020-05-15 16:32 ` Rafael J. Wysocki
@ 2020-05-26 11:12 ` Ard Biesheuvel
2020-05-26 14:04 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2020-05-26 11:12 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux Kernel Mailing List, Linux ARM, Rafael J. Wysocki,
Len Brown, ACPI Devel Maling List, Stable
Hello Rafael,
I spotted an issue with this patch. Please see below.
On Fri, 15 May 2020 at 18:32, Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Fri, May 15, 2020 at 11:37 AM Ard Biesheuvel <ardb@kernel.org> wrote:
> >
> > Per the ACPI spec, interrupts in the range [0, 255] may be handled
> > in AML using individual methods whose naming is based on the format
> > _Exx or _Lxx, where xx is the hex representation of the interrupt
> > index.
> >
> > Add support for this missing feature to our ACPI GED driver.
> >
> > Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> > Cc: Len Brown <lenb@kernel.org>
> > Cc: linux-acpi@vger.kernel.org
> > Cc: <stable@vger.kernel.org> # v4.9+
> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > ---
> > drivers/acpi/evged.c | 22 +++++++++++++++++---
> > 1 file changed, 19 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/acpi/evged.c b/drivers/acpi/evged.c
> > index aba0d0027586..6d7a522952bf 100644
> > --- a/drivers/acpi/evged.c
> > +++ b/drivers/acpi/evged.c
> > @@ -79,6 +79,8 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
> > struct resource r;
> > struct acpi_resource_irq *p = &ares->data.irq;
> > struct acpi_resource_extended_irq *pext = &ares->data.extended_irq;
> > + char ev_name[5];
> > + u8 trigger;
> >
> > if (ares->type == ACPI_RESOURCE_TYPE_END_TAG)
> > return AE_OK;
> > @@ -87,14 +89,28 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
> > dev_err(dev, "unable to parse IRQ resource\n");
> > return AE_ERROR;
> > }
> > - if (ares->type == ACPI_RESOURCE_TYPE_IRQ)
> > + if (ares->type == ACPI_RESOURCE_TYPE_IRQ) {
> > gsi = p->interrupts[0];
> > - else
> > + trigger = p->triggering;
> > + } else {
> > gsi = pext->interrupts[0];
> > + trigger = p->triggering;
This should be 'pext->triggering' instead.
In practice, it doesn't matter, since p and pext point to the same
union, and the 'triggering' field happens to be at the same offset.
But it should still be fixed, of course.
Would you prefer a followup patch? Or can you fix it locally?
> > + }
> >
> > irq = r.start;
> >
> > - if (ACPI_FAILURE(acpi_get_handle(handle, "_EVT", &evt_handle))) {
> > + switch (gsi) {
> > + case 0 ... 255:
> > + sprintf(ev_name, "_%c%02hhX",
> > + trigger == ACPI_EDGE_SENSITIVE ? 'E' : 'L', gsi);
> > +
> > + if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle)))
> > + break;
> > + /* fall through */
> > + default:
> > + if (ACPI_SUCCESS(acpi_get_handle(handle, "_EVT", &evt_handle)))
> > + break;
> > +
> > dev_err(dev, "cannot locate _EVT method\n");
> > return AE_ERROR;
> > }
> > --
>
> Applied as 5.8 material, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ACPI: GED: add support for _Exx / _Lxx handler methods
2020-05-26 11:12 ` Ard Biesheuvel
@ 2020-05-26 14:04 ` Rafael J. Wysocki
0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2020-05-26 14:04 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Rafael J. Wysocki, Linux Kernel Mailing List, Linux ARM,
Rafael J. Wysocki, Len Brown, ACPI Devel Maling List, Stable
On Tue, May 26, 2020 at 1:12 PM Ard Biesheuvel <ardb@kernel.org> wrote:
>
> Hello Rafael,
>
> I spotted an issue with this patch. Please see below.
>
>
> On Fri, 15 May 2020 at 18:32, Rafael J. Wysocki <rafael@kernel.org> wrote:
> >
> > On Fri, May 15, 2020 at 11:37 AM Ard Biesheuvel <ardb@kernel.org> wrote:
> > >
> > > Per the ACPI spec, interrupts in the range [0, 255] may be handled
> > > in AML using individual methods whose naming is based on the format
> > > _Exx or _Lxx, where xx is the hex representation of the interrupt
> > > index.
> > >
> > > Add support for this missing feature to our ACPI GED driver.
> > >
> > > Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> > > Cc: Len Brown <lenb@kernel.org>
> > > Cc: linux-acpi@vger.kernel.org
> > > Cc: <stable@vger.kernel.org> # v4.9+
> > > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > > ---
> > > drivers/acpi/evged.c | 22 +++++++++++++++++---
> > > 1 file changed, 19 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/acpi/evged.c b/drivers/acpi/evged.c
> > > index aba0d0027586..6d7a522952bf 100644
> > > --- a/drivers/acpi/evged.c
> > > +++ b/drivers/acpi/evged.c
> > > @@ -79,6 +79,8 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
> > > struct resource r;
> > > struct acpi_resource_irq *p = &ares->data.irq;
> > > struct acpi_resource_extended_irq *pext = &ares->data.extended_irq;
> > > + char ev_name[5];
> > > + u8 trigger;
> > >
> > > if (ares->type == ACPI_RESOURCE_TYPE_END_TAG)
> > > return AE_OK;
> > > @@ -87,14 +89,28 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
> > > dev_err(dev, "unable to parse IRQ resource\n");
> > > return AE_ERROR;
> > > }
> > > - if (ares->type == ACPI_RESOURCE_TYPE_IRQ)
> > > + if (ares->type == ACPI_RESOURCE_TYPE_IRQ) {
> > > gsi = p->interrupts[0];
> > > - else
> > > + trigger = p->triggering;
> > > + } else {
> > > gsi = pext->interrupts[0];
> > > + trigger = p->triggering;
>
> This should be 'pext->triggering' instead.
>
> In practice, it doesn't matter, since p and pext point to the same
> union, and the 'triggering' field happens to be at the same offset.
> But it should still be fixed, of course.
>
> Would you prefer a followup patch? Or can you fix it locally?
A followup, please.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-05-26 14:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-15 9:36 [PATCH] ACPI: GED: add support for _Exx / _Lxx handler methods Ard Biesheuvel
2020-05-15 16:32 ` Rafael J. Wysocki
2020-05-26 11:12 ` Ard Biesheuvel
2020-05-26 14:04 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).