[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZebgdpKt7x2hDivM@fedora>
Date: Tue, 5 Mar 2024 09:05:59 +0000
From: Niklas Cassel <Niklas.Cassel@....com>
To: Frank Li <Frank.Li@....com>
CC: "bhelgaas@...gle.com" <bhelgaas@...gle.com>,
"gustavo.pimentel@...opsys.com" <gustavo.pimentel@...opsys.com>,
"imx@...ts.linux.dev" <imx@...ts.linux.dev>, "jdmason@...zu.us"
<jdmason@...zu.us>, "jingoohan1@...il.com" <jingoohan1@...il.com>,
"kw@...ux.com" <kw@...ux.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "linux-pci@...r.kernel.org"
<linux-pci@...r.kernel.org>, "lpieralisi@...nel.org" <lpieralisi@...nel.org>,
"mani@...nel.org" <mani@...nel.org>, "robh@...nel.org" <robh@...nel.org>
Subject: Re: [PATCH v2 1/1] PCI: dwc: Fix index 0 incorrectly being
interpreted as a free ATU slot
On Mon, Mar 04, 2024 at 05:46:16PM -0500, Frank Li wrote:
> dw_pcie_ep_inbound_atu()
> {
> ...
> if (!ep->bar_to_atu[bar])
> free_win = find_first_zero_bit(ep->ib_window_map, pci->num_ib_windows);
> else
> free_win = ep->bar_to_atu[bar];
> ...
> }
>
> The atu index 0 is valid case for atu number. The find_first_zero_bit()
> will return 6 when second time call into this function if atu is 0. Suppose
> it should use branch 'free_win = ep->bar_to_atu[bar]'.
>
> Change 'bar_to_atu' to free_win + 1. Initialize bar_to_atu as 0 to indicate
> it have not allocate atu to the bar.
>
> Reported-by: Niklas Cassel <Niklas.Cassel@....com>
> Closes: https://lore.kernel.org/linux-pci/ZXt2A+Fusfz3luQV@x1-carbon/T/#u
> Fixes: 4284c88fff0e ("PCI: designware-ep: Allow pci_epc_set_bar() update inbound map address")
> Reviewed-by: Niklas Cassel <niklas.cassel@....com>
> Signed-off-by: Frank Li <Frank.Li@....com>
Tested-by: Niklas Cassel <niklas.cassel@....com>
Powered by blists - more mailing lists