From: Kishon Vijay Abraham I <kishon@ti.com>
To: Alan Douglas <adouglas@cadence.com>, <bhelgaas@google.com>
Cc: <lorenzo.pieralisi@arm.com>, <linux-pci@vger.kernel.org>,
<gustavo.pimentel@synopsys.com>, <cyrille.pitchen@bootlin.com>,
<stelford@cadence.com>
Subject: Re: [PATCH v2 5/5] PCI: cadence: Add MSI-X capability to EP driver
Date: Tue, 4 Sep 2018 10:15:38 +0530 [thread overview]
Message-ID: <daa340ff-1860-dec4-a814-a0ba63227748@ti.com> (raw)
In-Reply-To: <1534340948-24093-1-git-send-email-adouglas@cadence.com>
Hi,
On Wednesday 15 August 2018 07:19 PM, Alan Douglas wrote:
> Add set_msix and get_msix functions to driver, and handle
> PCI_EPC_IRQ_MSIX request in raise_irq. BAR5 is used for
> the MSI-X vectors.
>
> Signed-off-by: Alan Douglas <adouglas@cadence.com>
> ---
> drivers/pci/controller/pcie-cadence-ep.c | 107 ++++++++++++++++++++++++++++++-
> drivers/pci/controller/pcie-cadence.h | 1 +
> 2 files changed, 107 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/pcie-cadence-ep.c b/drivers/pci/controller/pcie-cadence-ep.c
> index 1248d75..259b9a6 100644
> --- a/drivers/pci/controller/pcie-cadence-ep.c
> +++ b/drivers/pci/controller/pcie-cadence-ep.c
> @@ -16,6 +16,7 @@
> #define CDNS_PCIE_EP_MIN_APERTURE 128 /* 128 bytes */
> #define CDNS_PCIE_EP_IRQ_PCI_ADDR_NONE 0x1
> #define CDNS_PCIE_EP_IRQ_PCI_ADDR_LEGACY 0x3
> +#define CDNS_PCIE_EP_MSIX_BAR 0x5
>
> /**
> * struct cdns_pcie_ep - private data for this PCIe endpoint controller driver
> @@ -255,6 +256,43 @@ static int cdns_pcie_ep_get_msi(struct pci_epc *epc, u8 fn)
> return mme;
> }
>
> +static int cdns_pcie_ep_get_msix(struct pci_epc *epc, u8 func_no)
> +{
> + struct cdns_pcie_ep *ep = epc_get_drvdata(epc);
> + struct cdns_pcie *pcie = &ep->pcie;
> + u32 cap = CDNS_PCIE_EP_FUNC_MSIX_CAP_OFFSET;
> + u32 val, reg;
> +
> + reg = cap + PCI_MSIX_FLAGS;
> + val = cdns_pcie_ep_fn_readw(pcie, func_no, reg);
> + if (!(val & PCI_MSIX_FLAGS_ENABLE))
> + return -EINVAL;
> +
> + val &= PCI_MSIX_FLAGS_QSIZE;
> +
> + return val;
> +}
> +
> +static int cdns_pcie_ep_set_msix(struct pci_epc *epc, u8 fn, u16 interrupts)
> +{
> + struct cdns_pcie_ep *ep = epc_get_drvdata(epc);
> + struct cdns_pcie *pcie = &ep->pcie;
> + u32 cap = CDNS_PCIE_EP_FUNC_MSIX_CAP_OFFSET;
> + u32 val, reg;
> +
> + reg = cap + PCI_MSIX_FLAGS;
> + val = cdns_pcie_ep_fn_readw(pcie, fn, reg);
> + val &= ~PCI_MSIX_FLAGS_QSIZE;
> + val |= interrupts;
> + cdns_pcie_ep_fn_writew(pcie, fn, reg, val);
> + /* Set MSIX BAR and offset */
> + cdns_pcie_ep_fn_writel(pcie, fn, 0xb4, CDNS_PCIE_EP_MSIX_BAR);
Please add a macro for MSIX table offset.
I think it relies on endpoint function driver to invoke set_bar for
BAR5? It's possible a function driver can invoke set_msix without set_bar.
> + /* Set PBA BAR and offset. BAR must match MSIX BAR */
> + cdns_pcie_ep_fn_writel(pcie, fn, 0xb8, 0x10000 | CDNS_PCIE_EP_MSIX_BAR);
Here too add a macro for PBA.
How did you get the 0x10000?
Thanks
Kishon
next prev parent reply other threads:[~2018-09-04 9:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-15 13:49 [PATCH v2 5/5] PCI: cadence: Add MSI-X capability to EP driver Alan Douglas
2018-09-04 4:45 ` Kishon Vijay Abraham I [this message]
2018-09-04 9:32 ` Alan Douglas
2018-09-17 15:26 ` Lorenzo Pieralisi
2018-09-17 15:55 ` Alan Douglas
2018-09-17 15:55 ` Alan Douglas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=daa340ff-1860-dec4-a814-a0ba63227748@ti.com \
--to=kishon@ti.com \
--cc=adouglas@cadence.com \
--cc=bhelgaas@google.com \
--cc=cyrille.pitchen@bootlin.com \
--cc=gustavo.pimentel@synopsys.com \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=stelford@cadence.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).