Search Linux Wireless

Re: [PATCH wireless-drivers 1/2] mt76: mt76x2e: disable pcie_aspm by default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Lorenzo Bianconi <lorenzo@xxxxxxxxxx> writes:
> 
> > On same device (e.g. U7612E-H1) PCIE_ASPM causes continuous mcu hangs and
> > instability and so let's disable PCIE_ASPM by default. This patch has
> > been successfully tested on U7612E-H1 mini-pice card
> >
> > Signed-off-by: Felix Fietkau <nbd@xxxxxxxx>
> > Signed-off-by: Lorenzo Bianconi <lorenzo@xxxxxxxxxx>
> 
> [...]
> 
> > +void mt76_mmio_disable_aspm(struct pci_dev *pdev)
> > +{
> > +	struct pci_dev *parent = pdev->bus->self;
> > +	u16 aspm_conf, parent_aspm_conf = 0;
> > +
> > +	pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &aspm_conf);
> > +	aspm_conf &= PCI_EXP_LNKCTL_ASPMC;
> > +	if (parent) {
> > +		pcie_capability_read_word(parent, PCI_EXP_LNKCTL,
> > +					  &parent_aspm_conf);
> > +		parent_aspm_conf &= PCI_EXP_LNKCTL_ASPMC;
> > +	}
> > +
> > +	if (!aspm_conf && (!parent || !parent_aspm_conf)) {
> > +		/* aspm already disabled */
> > +		return;
> > +	}
> > +
> > +	dev_info(&pdev->dev, "disabling ASPM %s %s\n",
> > +		 (aspm_conf & PCI_EXP_LNKCTL_ASPM_L0S) ? "L0s" : "",
> > +		 (aspm_conf & PCI_EXP_LNKCTL_ASPM_L1) ? "L1" : "");
> > +
> > +#ifdef CONFIG_PCIEASPM
> > +	pci_disable_link_state(pdev, aspm_conf);
> > +
> > +	/* Double-check ASPM control.  If not disabled by the above, the
> > +	 * BIOS is preventing that from happening (or CONFIG_PCIEASPM is
> > +	 * not enabled); override by writing PCI config space directly.
> > +	 */
> > +	pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &aspm_conf);
> > +	if (!(aspm_conf & PCI_EXP_LNKCTL_ASPMC))
> > +		return;
> > +#endif /* CONFIG_PCIEASPM */
> 
> A minor comment, but 'if IS_ENABLED(CONFIG_PCIEASPM)' is preferred over
> #ifdef. Better compiler coverage and so on.

Hi Kalle,

ack, I will fix it in v2.

Regards,
Lorenzo

> 
> -- 
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux