[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f89afd2c-8870-077c-b4b4-368784f6d54c@amd.com>
Date: Fri, 29 Sep 2023 15:03:35 +0530
From: Kishon Vijay Abraham I <kvijayab@....com>
To: Frank Li <Frank.Li@....com>, manivannan.sadhasivam@...aro.org
Cc: aisheng.dong@....com, bhelgaas@...gle.com,
devicetree@...r.kernel.org, festevam@...il.com,
imx@...ts.linux.dev, jdmason@...zu.us, kernel@...gutronix.de,
kishon@...nel.org, kw@...ux.com,
linux-arm-kernel@...ts.infradead.org, linux-imx@....com,
linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
lorenzo.pieralisi@....com, lpieralisi@...nel.org, maz@...nel.org,
s.hauer@...gutronix.de, shawnguo@...nel.org, tglx@...utronix.de
Subject: Re: [PATCH v2 3/5] PCI: endpoint: pci-epf-test: add doorbell test
Hi Frank,
On 9/12/2023 3:39 AM, Frank Li wrote:
> Add three register: doorbell_bar, doorbell_addr, doorbell_data,
> doorbell_done. Call pci_epf_alloc_doorbell() all a doorbell address space.
>
> Root complex(RC) side driver can trigger pci-epc-test's doorbell callback
> handler by write doorbell_data to mapped doorbell_bar's address space.
>
> pci-epc-test will set doorbell_done in doorbell callback.
>
> Signed-off-by: Frank Li <Frank.Li@....com>
> ---
> drivers/pci/endpoint/functions/pci-epf-test.c | 59 ++++++++++++++++++-
> 1 file changed, 58 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
> index 1f0d2b84296a3..566549919b87b 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> @@ -11,6 +11,7 @@
> #include <linux/dmaengine.h>
> #include <linux/io.h>
> #include <linux/module.h>
> +#include <linux/msi.h>
> #include <linux/slab.h>
> #include <linux/pci_ids.h>
> #include <linux/random.h>
> @@ -39,17 +40,21 @@
> #define STATUS_IRQ_RAISED BIT(6)
> #define STATUS_SRC_ADDR_INVALID BIT(7)
> #define STATUS_DST_ADDR_INVALID BIT(8)
> +#define STATUS_DOORBELL_SUCCESS BIT(9)
>
> #define FLAG_USE_DMA BIT(0)
>
> #define TIMER_RESOLUTION 1
>
> +#define MAGIC_VERSION_MASK GENMASK(7, 0)
> +
> static struct workqueue_struct *kpcitest_workqueue;
>
> struct pci_epf_test {
> void *reg[PCI_STD_NUM_BARS];
> struct pci_epf *epf;
> enum pci_barno test_reg_bar;
> + enum pci_barno doorbell_bar;
> size_t msix_table_offset;
> struct delayed_work cmd_handler;
> struct dma_chan *dma_chan_tx;
> @@ -74,6 +79,9 @@ struct pci_epf_test_reg {
> u32 irq_type;
> u32 irq_number;
> u32 flags;
> + u32 doorbell_bar;
You could extend test_reg_bar for doorbell to avoid using additional BAR.
> + u32 doorbell_addr;
> + u32 doorbell_data;
> } __packed;
>
Thanks,
Kishon
Powered by blists - more mailing lists