lkml.org 
[lkml]   [2017]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v2 04/17] PCI: designware-ep: Pre-allocate memory for MSI in dw_pcie_ep_init
    From
    Date
    Hi Niklas,

    On Monday 30 October 2017 06:12 PM, Niklas Cassel wrote:
    > Certain SoCs need to map the MSI address in raise_irq.
    > To map an address, you first need to call pci_epc_mem_alloc_addr,
    > however, pci_epc_mem_alloc_addr calls ioremap (which can sleep).
    >
    > Since raise_irq is only called from atomic context, we can't call
    > pci_epc_mem_alloc_addr from raise_irq, instead we pre-allocate
    > a page in dw_pcie_ep_init, so this page can later be used to map/unmap
    > the MSI address in raise_irq.
    >
    > Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
    > ---
    > V2:
    > * No change.
    >
    > drivers/pci/dwc/pcie-designware-ep.c | 8 ++++++++
    > drivers/pci/dwc/pcie-designware.h | 2 ++
    > 2 files changed, 10 insertions(+)
    >
    > diff --git a/drivers/pci/dwc/pcie-designware-ep.c b/drivers/pci/dwc/pcie-designware-ep.c
    > index 3fb34be99715..c291da2a10ba 100644
    > --- a/drivers/pci/dwc/pcie-designware-ep.c
    > +++ b/drivers/pci/dwc/pcie-designware-ep.c
    > @@ -286,6 +286,8 @@ void dw_pcie_ep_exit(struct dw_pcie_ep *ep)
    > {
    > struct pci_epc *epc = ep->epc;
    >
    > + pci_epc_mem_free_addr(epc, ep->msi_mem_phys, ep->msi_mem, PAGE_SIZE);
    > +
    > pci_epc_mem_exit(epc);
    > }
    >
    > @@ -341,6 +343,12 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)
    > return ret;
    > }
    >
    > + ep->msi_mem = pci_epc_mem_alloc_addr(epc, &ep->msi_mem_phys, PAGE_SIZE);

    ep->page_size instead of PAGE_SIZE?

    Thanks
    Kishon

    \
     
     \ /
      Last update: 2017-10-31 07:02    [W:5.028 / U:0.248 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site