a question in pcie-designware-ep.c, can't find where a variable has been set.

Chan Kim ckim at etri.re.kr
Tue Jan 31 07:01:34 EST 2023


Hello kernel users and experts,

With linux-5.15.68, I was analyzing function dw_plat_pcie_probe in file
drivers/pci/controller/dwc/pcie-designware-plat.c.
This function creates struct dw_pcie and it has struct dw_pcie_ep embedded
in it as member 'ep'.
When it's endpoint, it calls dw_pcie_ep_init(&pci->ep).
(
https://elixir.bootlin.com/linux/v5.15.68/source/drivers/pci/controller/dwc/
pcie-designware-plat.c#L166 )

return dw_pcie_ep_init(&pci->ep);

Now in the dw_pcie_ep_init function,
(drivers/pci/controller/dwc/pcie-designware-ep.c)
It creates dw_pcie_epc and calls pci_epc_mem_init function like this. 
(
https://elixir.bootlin.com/linux/v5.15.68/source/drivers/pci/controller/dwc/
pcie-designware-ep.c#L770 )

ret = pci_epc_mem_init(epc, ep->phys_base, ep->addr_size,
                   ep->page_size);

But I can't find where ep->page_size was assigned earlier. (ep is the
pointer to the struct dw_pcie_ep).
Can anyone tell me where it was assigned?

And I'm not clear in this struct pci_epc_mem_window, the unit of size.(in
include/linux/pci-epc.h)

struct pci_epc_mem_window {
    phys_addr_t phys_base;
    size_t      size;
    size_t      page_size;
};

Is the size in byte unit? Or is it number of pages?

Thank you.

Chan Kim






More information about the Kernelnewbies mailing list