lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z5uifr5+JE0xSi2l@lizhi-Precision-Tower-5810>
Date: Thu, 30 Jan 2025 11:02:06 -0500
From: Frank Li <Frank.li@....com>
To: Bjorn Helgaas <helgaas@...nel.org>
Cc: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>,
	Jingoo Han <jingoohan1@...il.com>,
	Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
	Lorenzo Pieralisi <lpieralisi@...nel.org>,
	Krzysztof WilczyƄski <kw@...ux.com>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Richard Zhu <hongxing.zhu@....com>,
	Lucas Stach <l.stach@...gutronix.de>,
	Shawn Guo <shawnguo@...nel.org>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	Pengutronix Kernel Team <kernel@...gutronix.de>,
	Fabio Estevam <festevam@...il.com>, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, imx@...ts.linux.dev,
	Niklas Cassel <cassel@...nel.org>
Subject: Re: [PATCH v9 2/7] PCI: dwc: Rename cpu_addr to parent_bus_addr for
 ATU configuration

On Wed, Jan 29, 2025 at 05:23:50PM -0600, Bjorn Helgaas wrote:
> On Tue, Jan 28, 2025 at 05:07:35PM -0500, Frank Li wrote:
> > Rename `cpu_addr` to `parent_bus_addr` in the DesignWare ATU configuration.
> > The ATU translates parent bus addresses to PCI addresses, which are often
> > the same as CPU addresses but can differ in systems where the bus fabric
> > translates addresses before passing them to the PCIe controller. This
> > renaming clarifies the purpose and avoids confusion.
>
> Based on dw_pcie_ep_inbound_atu() below, I guess the ATU can also
> translate PCI addresses from incoming DMA to parent bus addresses?

Yes, but root complex don't use it. Only EP use it. because most PCI root
complex system doesn't transfer incoming address, which generally use iommu
to do that. Linux already allow a simple map by use dt's dma-ranges and dma
API already handle it.

previous 'cpu_addr' is actually 'dma_bus_addr'.

>
> It's worth noting here that this patch only renames the member, and
> IIUC, parent_bus_addr still incorrectly contains CPU physical
> addresses.

Anyway, call 'cpu_addr' for dw_pcie_ep_inbound_atu is wrong. Only one place
call dw_pcie_ep_inbound_atu(), that's dw_pcie_ep_set_bar(), which use
epf_bar->phys_addr, I think name 'phys_addr' is okay because most case it
is refer to dma address space.

Frank
>
> > +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c
> > @@ -128,7 +128,7 @@ static int dw_pcie_ep_write_header(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
> >  }
> >
> >  static int dw_pcie_ep_inbound_atu(struct dw_pcie_ep *ep, u8 func_no, int type,
> > -				  dma_addr_t cpu_addr, enum pci_barno bar,
> > +				  dma_addr_t parent_bus_addr, enum pci_barno bar,
> >  				  size_t size)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ