Re: [PATCH v2 1/2] PCI: Initialize RCB from pci_configure_device
From: Haakon Bugge
Date: Wed Jan 21 2026 - 15:28:52 EST
> On Wed, Jan 21, 2026 at 12:35:40PM +0100, Håkon Bugge wrote:
> + if (pcie_cap_has_lnkctl(dev) &&
> + (pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT) &&
> + !dev->is_virtfn && pcie_root_rcb_set(dev)) {
> + u16 lnkctl;
> +
> + pcie_capability_read_word(dev, PCI_EXP_LNKCTL, &lnkctl);
> + if (lnkctl & PCI_EXP_LNKCTL_RCB)
> + return;
> +
> + pcie_capability_write_word(dev, PCI_EXP_LNKCTL, lnkctl | PCI_EXP_LNKCTL_RCB);
>
> You may want to use pcie_capability_set_word() for brevity.
Well, that would incur an additional pcie_capability_read_word(), so between brevity and performance, I chose performance. Another, probably better reason to use pcie_capability_set_word() is that it calls (for PCI_EXP_LNKCTL) pcie_capability_clear_and_set_word_locked(). However, I assume that during device probing, the locking is not needed.
Thxs, Håkon