Re: [PATCH v4 0/3] PCI: pciehp: Do not turn off slot if presence comes up after link

From: Lukas Wunner
Date: Mon Feb 10 2020 - 23:49:53 EST


On Mon, Feb 10, 2020 at 06:08:16PM -0600, Bjorn Helgaas wrote:
> used ctrl_info() instead of pci_info() (I would actually like to change
> the whole driver to use pci_info(), but better to be consistent for now)

Most of the ctrl_info() calls prepend "Slot(%s): " to the message.
However that prefix can only be used once pci_hp_initialize() has
been called.

It would probably make sense to change ctrl_info() to always
include the prefix and change those invocations of ctrl_info()
which happen when the slot is not yet or no longer registered,
to pci_info().


> @@ -930,7 +940,7 @@ struct controller *pcie_init(struct pcie_device *dev)
> PCI_EXP_SLTSTA_MRLSC | PCI_EXP_SLTSTA_CC |
> PCI_EXP_SLTSTA_DLLSC | PCI_EXP_SLTSTA_PDC);
>
> - ctrl_info(ctrl, "Slot #%d AttnBtn%c PwrCtrl%c MRL%c AttnInd%c PwrInd%c HotPlug%c Surprise%c Interlock%c NoCompl%c LLActRep%c%s\n",
> + ctrl_info(ctrl, "Slot #%d AttnBtn%c PwrCtrl%c MRL%c AttnInd%c PwrInd%c HotPlug%c Surprise%c Interlock%c NoCompl%c IbPresDis%c LLActRep%c%s\n",
> (slot_cap & PCI_EXP_SLTCAP_PSN) >> 19,
> FLAG(slot_cap, PCI_EXP_SLTCAP_ABP),
> FLAG(slot_cap, PCI_EXP_SLTCAP_PCP),
> @@ -941,19 +951,10 @@ struct controller *pcie_init(struct pcie_device *dev)
> FLAG(slot_cap, PCI_EXP_SLTCAP_HPS),
> FLAG(slot_cap, PCI_EXP_SLTCAP_EIP),
> FLAG(slot_cap, PCI_EXP_SLTCAP_NCCS),
> + ctrl->inband_presence_disabled,
> FLAG(link_cap, PCI_EXP_LNKCAP_DLLLARC),
> pdev->broken_cmd_compl ? " (with Cmd Compl erratum)" : "");

I've just reviewed the resulting commits on pci/hotplug once more and
think there's a small issue here: If ctrl->inband_presence_disabled is 0,
the string will contain ASCII character 0 (end of string) and if it's 1
it will contain ASCII character 1 (start of header). A possible solution
would be FLAG(ctrl->inband_presence_disabled, 1).

(The real solution would probably to have a printk format for this kind
of thing.)

Thanks,

Lukas