[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3zbztusceiv2imwfj4t3xxju4ht2s2xlkxjv3ncrjmfkl5g6z2@ulqbr6aspryn>
Date: Fri, 9 Jan 2026 01:39:15 +0900
From: Koichiro Den <den@...inux.co.jp>
To: Niklas Cassel <cassel@...nel.org>
Cc: jingoohan1@...il.com, mani@...nel.org, lpieralisi@...nel.org,
kwilczynski@...nel.org, robh@...nel.org, bhelgaas@...gle.com, Frank.Li@....com,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 1/2] PCI: endpoint: Add BAR subrange mapping support
On Thu, Jan 08, 2026 at 10:59:30AM +0100, Niklas Cassel wrote:
> On Thu, Jan 08, 2026 at 10:37:35AM +0100, Niklas Cassel wrote:
> > The memcpy in dw_pcie_ep_get_features() is a bit ugly.
> > I guess the alternative is to change all the DWC based glue drivers
> > to return a "struct pci_epc_features*" instead of a "const struct pci_epc_features*"
> > such that dw_pcie_ep_get_features() can simply set subrange_mapping = true in the
> > struct pci_epc_features returned by the glue driver.
>
> I think the best way it probably to create another patch,
> that will be patch 2 out of 3 in the series, which changes:
> https://github.com/torvalds/linux/blob/v6.19-rc4/drivers/pci/controller/dwc/pcie-designware.h#L449
>
> from:
> const struct pci_epc_features* (*get_features)(struct dw_pcie_ep *ep);
>
> to:
> struct pci_epc_features* (*get_features)(struct dw_pcie_ep *ep);
>
> and which does the equivalent change in all the DWC based glue drivers.
>
> That way, dw_pcie_ep_get_features() can simply set subrange_mapping = true
> in the struct pci_epc_features returned by the glue driver.
>
>
>
> Note that the function dw_pcie_ep_get_features() itself should still return:
> "static const struct pci_epc_features*"
>
> (Since this represents the DWC midlayer driver level.)
>
> It is only the DWC based glue drivers (lower level drivers) that should drop
> the const.
Hi Niklas,
Thanks again for the detailed feedback. I agree we should not let
controllers that do not support subrange mapping silently ignore
epf_bar->use_submap, as that could potentially lead to an unexpected and
hard-to-debug state without returning an error.
Adding a subrange_mapping bit to struct pci_epc_features makes sense.
I also considered setting .subrange_mapping = 1 in every DWC-based glue
driver and keeping the const qualifiers, but that would duplicate the
same information across drivers and add unnecessary maintenance burden.
So I'll follow your suggestion and drop const only at the glue-driver
level. I'll send v5 shortly.
Thanks,
Koichiro
>
>
> Kind regards,
> Niklas
Powered by blists - more mailing lists