Re: [PATCH] ntb: idt: Set PCIe bus address to BARLIMITx

From: Logan Gunthorpe
Date: Wed Jul 11 2018 - 12:52:36 EST




On 11/07/18 10:32 AM, Serge Semin wrote:
> @@ -1320,7 +1321,9 @@ static int idt_ntb_peer_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx,
> idt_nt_write(ndev, bar->ltbase, (u32)addr);
> idt_nt_write(ndev, bar->utbase, (u32)(addr >> 32));
> /* Set the custom BAR aperture limit */
> - limit = pci_resource_start(ntb->pdev, mw_cfg->bar) + size;
> + pcibios_resource_to_bus(ntb->pdev->bus, &region,
> + &ntb->pdev->resource[mw_cfg->bar]);
> + limit = region.start + size;

You should use the pci_bus_address() helper instead. It's much simpler
and you don't need to delve into pci_dev internals to use it.

Logan