diff options
| author | Koichiro Den <den@valinux.co.jp> | 2026-02-02 23:54:07 +0900 |
|---|---|---|
| committer | Bjorn Helgaas <bhelgaas@google.com> | 2026-02-19 15:34:19 -0600 |
| commit | 8c746e22096579897d1f8f74dbb6b17a6862fb6d (patch) | |
| tree | 3991f8f87c86e87d866944e1524f6e9d3f1a367a /include/linux/pps_gen_kernel.h | |
| parent | 88a71941b90ddda44f4105e354e82a89b0389bc6 (diff) | |
PCI: dwc: ep: Always clear IB maps on BAR update
dw_pcie_ep_set_bar() currently tears down existing inbound mappings only
when either the previous or the new struct pci_epf_bar uses submaps
(num_submap != 0). If both the old and new mappings are BAR Match Mode,
reprogramming the same ATU index is sufficient, so no explicit teardown
was needed.
However, some callers may reuse the same struct pci_epf_bar instance and
update it in place before calling set_bar() again. In that case
ep_func->epf_bar[bar] and the passed-in epf_bar can point to the same
object, so we cannot reliably distinguish BAR Match Mode -> BAR Match Mode
from Address Match Mode -> BAR Match Mode. As a result, the conditional
teardown based on num_submap becomes unreliable and existing inbound maps
may be left active.
Call dw_pcie_ep_clear_ib_maps() unconditionally before reprogramming the
BAR so that in-place updates are handled correctly.
This introduces a behavioral change in a corner case: if a BAR
reprogramming attempt fails (especially for the long-standing BAR Match
Mode -> BAR Match Mode update case), the previously programmed inbound
mapping will already have been torn down. This should be acceptable, since
the caller observes the error and should not use the BAR for any real
transactions in that case.
While at it, document that the existing update parameter check is
best-effort for in-place updates.
Fixes: cc839bef7727 ("PCI: dwc: ep: Support BAR subrange inbound mapping via Address Match Mode iATU")
Signed-off-by: Koichiro Den <den@valinux.co.jp>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20260202145407.503348-3-den@valinux.co.jp
Diffstat (limited to 'include/linux/pps_gen_kernel.h')
0 files changed, 0 insertions, 0 deletions
