Thread (22 messages) 22 messages, 5 authors, 2019-04-04

Re: [PATCH 0/4] mwifiex PCI/wake-up interrupt fixes

From: Ard Biesheuvel <hidden>
Date: 2019-02-27 10:16:27
Also in: linux-arm-kernel, linux-devicetree, linux-pm, linux-rockchip, linux-wireless, lkml

On Wed, 27 Feb 2019 at 11:02, Marc Zyngier [off-list ref] wrote:
+ Lorenzo

Hi Brian,

On 26/02/2019 23:28, Brian Norris wrote:
quoted
+ others

Hi Marc,

Thanks for the series. I have a few bits of history to add to this, and
some comments.

On Sun, Feb 24, 2019 at 02:04:22PM +0000, Marc Zyngier wrote:
quoted
For quite some time, I wondered why the PCI mwifiex device built in my
Chromebook was unable to use the good old legacy interrupts. But as MSIs
were working fine, I never really bothered investigating. I finally had a
look, and the result isn't very pretty.

On this machine (rk3399-based kevin), the wake-up interrupt is described as
such:

&pci_rootport {
     mvl_wifi: wifi@0,0 {
             compatible = "pci1b4b,2b42";
             reg = <0x83010000 0x0 0x00000000 0x0 0x00100000
                    0x83010000 0x0 0x00100000 0x0 0x00100000>;
             interrupt-parent = <&gpio0>;
             interrupts = <8 IRQ_TYPE_LEVEL_LOW>;
             pinctrl-names = "default";
             pinctrl-0 = <&wlan_host_wake_l>;
             wakeup-source;
     };
};

Note how the interrupt is part of the properties directly attached to the
PCI node. And yet, this interrupt has nothing to do with a PCI legacy
interrupt, as it is attached to the wake-up widget that bypasses the PCIe RC
altogether (Yay for the broken design!). This is in total violation of the
IEEE Std 1275-1994 spec[1], which clearly documents that such interrupt
specifiers describe the PCI device interrupts, and must obey the
INT-{A,B,C,D} mapping. Oops!
You're not the first person to notice this. All the motivations are not
necessarily painted clearly in their cover letter, but here are some
previous attempts at solving this problem:

[RFC PATCH v11 0/5] PCI: rockchip: Move PCIe WAKE# handling into pci core
https://lkml.kernel.org/lkml/20171225114742.18920-1-jeffy.chen@rock-chips.com/
http://lkml.kernel.org/lkml/20171226023646.17722-1-jeffy.chen@rock-chips.com/

As you can see by the 12th iteration, it wasn't left unsolved for lack
of trying...
I wasn't aware of this. That's definitely a better approach than my
hack, and I would really like this to be revived.
I don't think this approach is entirely sound either.

From the side of the PCI device, WAKE# is just a GPIO line, and how it
is wired into the system is an entirely separate matter. So I don't
think it is justified to overload the notion of legacy interrupts with
some other pin that may behave in a way that is vaguely similar to how
a true wake-up capable interrupt works.

So I'd argue that we should add an optional 'wake-gpio' DT property
instead to the generic PCI device binding, and leave the interrupt
binding and discovery alone.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help