Re: [PATCH v18 10/11] PCI/DPC: Add Error Disconnect Recover (EDR) support

From: Bjorn Helgaas
Date: Thu Mar 26 2020 - 18:36:41 EST


On Tue, Mar 24, 2020 at 06:00:31PM -0700, Kuppuswamy, Sathyanarayanan wrote:
> Hi Bjorn,
>
> On 3/24/20 2:37 PM, Bjorn Helgaas wrote:
> > This is really ugly. What's the story on this firmware? It sounds
> > defective to me.
>
> I think there is no defined standard for this. I have checked few
> _DSM implementations. Some of them return default value and some
> don't. But atleast in the test hardware I use, we need this check.

I agree that I don't see anything in the ACPI spec v6.3 about what
should happen if we supply a Function Index that isn't supported.
That looks like a hole in the spec.

> > Or is everybody that uses _DSM supposed to check before evaluating it?
>
> I think its safer to do this check.
>
> > E.g.,
> >
> > if (!acpi_check_dsm(...))
> > return -EINVAL;
> >
> > obj = acpi_evaluate_dsm(...);
> >
> > If everybody is supposed to do this, it seems like the check part
> > should be moved into acpi_evaluate_dsm().

So my question, and I guess this is really for Rafael, is that since
it seems like *everybody* needs to use acpi_check_dsm() in order to
use acpi_evaluate_dsm() safely, why don't we move the check *into*
acpi_evaluate_dsm()?

It's just error prone if we expect everybody to call both interfaces.

Bjorn