From: Tomasz Duszynski <tduszynski@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>, Ray Kinsella <mdr@ashroe.eu>,
Neil Horman <nhorman@tuxdriver.com>
Cc: <thomas@monjalon.net>, <dev@dpdk.org>,
Tomasz Duszynski <tduszynski@marvell.com>,
Jakub Palider <jpalider@marvell.com>,
Jerin Jacob <jerinj@marvell.com>
Subject: [dpdk-dev] [PATCH v3 18/32] common/cnxk: support for retrieving irq stack
Date: Mon, 21 Jun 2021 17:04:35 +0200 [thread overview]
Message-ID: <20210621150449.19070-19-tduszynski@marvell.com> (raw)
In-Reply-To: <20210621150449.19070-1-tduszynski@marvell.com>
Add support for retrieving irq stack. If stack does not exist
then it gets created.
Signed-off-by: Jakub Palider <jpalider@marvell.com>
Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
---
drivers/common/cnxk/roc_bphy_irq.c | 62 ++++++++++++++++++++++++++++++
drivers/common/cnxk/roc_bphy_irq.h | 1 +
drivers/common/cnxk/version.map | 1 +
3 files changed, 64 insertions(+)
diff --git a/drivers/common/cnxk/roc_bphy_irq.c b/drivers/common/cnxk/roc_bphy_irq.c
index bea2b7f73..04ad129ac 100644
--- a/drivers/common/cnxk/roc_bphy_irq.c
+++ b/drivers/common/cnxk/roc_bphy_irq.c
@@ -2,12 +2,21 @@
* Copyright(C) 2021 Marvell.
*/
#include <fcntl.h>
+#include <pthread.h>
#include <sys/ioctl.h>
+#include <sys/queue.h>
#include <unistd.h>
#include "roc_api.h"
#include "roc_bphy_irq.h"
+struct roc_bphy_irq_stack {
+ STAILQ_ENTRY(roc_bphy_irq_stack) entries;
+ void *sp_buffer;
+ int cpu;
+ int inuse;
+};
+
#define ROC_BPHY_MEMZONE_NAME "roc_bphy_mz"
#define ROC_BPHY_CTR_DEV_PATH "/dev/otx-bphy-ctr"
@@ -15,6 +24,12 @@
#define ROC_BPHY_IOC_GET_BPHY_MAX_IRQ _IOR(ROC_BPHY_IOC_MAGIC, 3, uint64_t)
#define ROC_BPHY_IOC_GET_BPHY_BMASK_IRQ _IOR(ROC_BPHY_IOC_MAGIC, 4, uint64_t)
+static STAILQ_HEAD(slisthead, roc_bphy_irq_stack)
+ irq_stacks = STAILQ_HEAD_INITIALIZER(irq_stacks);
+
+/* Note: it is assumed that as for now there is no multiprocess support */
+static pthread_mutex_t stacks_mutex = PTHREAD_MUTEX_INITIALIZER;
+
struct roc_bphy_irq_chip *
roc_bphy_intr_init(void)
{
@@ -95,6 +110,53 @@ roc_bphy_intr_fini(struct roc_bphy_irq_chip *irq_chip)
plt_free(irq_chip);
}
+void *
+roc_bphy_irq_stack_get(int cpu)
+{
+#define ARM_STACK_ALIGNMENT (2 * sizeof(void *))
+#define IRQ_ISR_STACK_SIZE 0x200000
+
+ struct roc_bphy_irq_stack *curr_stack;
+ void *retval = NULL;
+
+ if (pthread_mutex_lock(&stacks_mutex))
+ return NULL;
+
+ STAILQ_FOREACH(curr_stack, &irq_stacks, entries) {
+ if (curr_stack->cpu == cpu) {
+ curr_stack->inuse++;
+ retval = ((char *)curr_stack->sp_buffer) +
+ IRQ_ISR_STACK_SIZE;
+ goto found_stack;
+ }
+ }
+
+ curr_stack = plt_zmalloc(sizeof(struct roc_bphy_irq_stack), 0);
+ if (curr_stack == NULL)
+ goto err_stack;
+
+ curr_stack->sp_buffer =
+ plt_zmalloc(IRQ_ISR_STACK_SIZE * 2, ARM_STACK_ALIGNMENT);
+ if (curr_stack->sp_buffer == NULL)
+ goto err_buffer;
+
+ curr_stack->cpu = cpu;
+ curr_stack->inuse = 0;
+ STAILQ_INSERT_TAIL(&irq_stacks, curr_stack, entries);
+ retval = ((char *)curr_stack->sp_buffer) + IRQ_ISR_STACK_SIZE;
+
+found_stack:
+ pthread_mutex_unlock(&stacks_mutex);
+ return retval;
+
+err_buffer:
+ plt_free(curr_stack);
+
+err_stack:
+ pthread_mutex_unlock(&stacks_mutex);
+ return NULL;
+}
+
bool
roc_bphy_intr_available(struct roc_bphy_irq_chip *irq_chip, int irq_num)
{
diff --git a/drivers/common/cnxk/roc_bphy_irq.h b/drivers/common/cnxk/roc_bphy_irq.h
index f481f4456..e66b2aa7c 100644
--- a/drivers/common/cnxk/roc_bphy_irq.h
+++ b/drivers/common/cnxk/roc_bphy_irq.h
@@ -23,6 +23,7 @@ struct roc_bphy_irq_chip {
__roc_api struct roc_bphy_irq_chip *roc_bphy_intr_init(void);
__roc_api void roc_bphy_intr_fini(struct roc_bphy_irq_chip *irq_chip);
+__roc_api void *roc_bphy_irq_stack_get(int cpu);
__roc_api bool roc_bphy_intr_available(struct roc_bphy_irq_chip *irq_chip,
int irq_num);
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index 427321c41..542364926 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -25,6 +25,7 @@ INTERNAL {
roc_bphy_intr_available;
roc_bphy_intr_fini;
roc_bphy_intr_init;
+ roc_bphy_irq_stack_get;
roc_clk_freq_get;
roc_error_msg_get;
roc_idev_lmt_base_addr_get;
--
2.25.1
next prev parent reply other threads:[~2021-06-21 15:07 UTC|newest]
Thread overview: 104+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-31 21:41 [dpdk-dev] [PATCH 00/28] add support for baseband phy Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 01/28] common/cnxk: add bphy cgx/rpm initialization and cleanup Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 02/28] common/cnxk: add support for communication with atf Tomasz Duszynski
2021-06-10 5:06 ` Jerin Jacob
2021-05-31 21:41 ` [dpdk-dev] [PATCH 03/28] common/cnxk: add support for getting link information Tomasz Duszynski
2021-06-10 5:09 ` Jerin Jacob
2021-05-31 21:41 ` [dpdk-dev] [PATCH 04/28] common/cnxk: add support for changing internal loopback Tomasz Duszynski
2021-06-10 6:19 ` Jerin Jacob
2021-05-31 21:41 ` [dpdk-dev] [PATCH 05/28] common/cnxk: add support for changing ptp mode Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 06/28] common/cnxk: add support for setting link mode Tomasz Duszynski
2021-06-10 6:21 ` Jerin Jacob
2021-05-31 21:41 ` [dpdk-dev] [PATCH 07/28] common/cnxk: add support for changing link state Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 08/28] common/cnxk: add support for lmac start/stop Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 09/28] raw/cnxk_bphy: add bphy cgx/rpm skeleton driver Tomasz Duszynski
2021-06-01 7:30 ` Thomas Monjalon
2021-06-10 6:40 ` Jerin Jacob
2021-05-31 21:41 ` [dpdk-dev] [PATCH 10/28] raw/cnxk_bphy: add support for reading queue configuration Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 11/28] raw/cnxk_bphy: add support for reading queue count Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 12/28] raw/cnxk_bphy: add support for enqueue operation Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 13/28] raw/cnxk_bphy: add support for dequeue operation Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 14/28] raw/cnxk_bphy: add support for performing selftest Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 15/28] common/cnxk: add support for device init and fini Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 16/28] common/cnxk: add support for baseband phy irq setup Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 17/28] common/cnxk: add support for checking irq availability Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 18/28] common/cnxk: add support for retrieving irq stack Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 19/28] common/cnxk: add support for removing " Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 20/28] common/cnxk: add support for setting bphy irq handler Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 21/28] common/cnxk: add support for clearing " Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 22/28] common/cnxk: add support for registering bphy irq Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 23/28] raw/cnxk_bphy: add baseband phy skeleton driver Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 24/28] raw/cnxk_bphy: add support for interrupt init and cleanup Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 25/28] raw/cnxk_bphy: add support for reading number of irqs Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 26/28] raw/cnxk_bphy: add support for retrieving device memory Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 27/28] raw/cnxk_bphy: add support for registering irq handlers Tomasz Duszynski
2021-05-31 21:41 ` [dpdk-dev] [PATCH 28/28] raw/cnxk_bphy: add support for selftest Tomasz Duszynski
2021-06-10 6:54 ` [dpdk-dev] [PATCH 00/28] add support for baseband phy Jerin Jacob
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 00/32] " Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 01/32] common/cnxk: add bphy cgx/rpm initialization and cleanup Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 02/32] common/cnxk: support for communication with atf Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 03/32] common/cnxk: support for getting link information Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 04/32] common/cnxk: support for changing internal loopback Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 05/32] common/cnxk: support for changing ptp mode Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 06/32] common/cnxk: support for setting link mode Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 07/32] common/cnxk: support for changing link state Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 08/32] common/cnxk: support for lmac start/stop Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 09/32] raw/cnxk_bphy: add bphy cgx/rpm skeleton driver Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 10/32] raw/cnxk_bphy: support for reading queue configuration Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 11/32] raw/cnxk_bphy: support for reading queue count Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 12/32] raw/cnxk_bphy: support for enqueue operation Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 13/32] raw/cnxk_bphy: support for dequeue operation Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 14/32] raw/cnxk_bphy: support for performing selftest Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 15/32] common/cnxk: support for device init and fini Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 16/32] common/cnxk: support for baseband PHY irq setup Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 17/32] common/cnxk: support for checking irq availability Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 18/32] common/cnxk: support for retrieving irq stack Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 19/32] common/cnxk: support for removing " Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 20/32] common/cnxk: support for setting bphy irq handler Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 21/32] common/cnxk: support for clearing " Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 22/32] common/cnxk: support for registering bphy irq Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 23/32] raw/cnxk_bphy: add baseband PHY skeleton driver Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 24/32] raw/cnxk_bphy: support for reading bphy queue configuration Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 25/32] raw/cnxk_bphy: support for reading bphy queue count Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 26/32] raw/cnxk_bphy: support for bphy enqueue operation Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 27/32] raw/cnxk_bphy: support for bphy dequeue operation Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 28/32] raw/cnxk_bphy: support for interrupt init and cleanup Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 29/32] raw/cnxk_bphy: support for reading number of bphy irqs Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 30/32] raw/cnxk_bphy: support for retrieving bphy device memory Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 31/32] raw/cnxk_bphy: support for registering bphy irq handlers Tomasz Duszynski
2021-06-15 11:03 ` [dpdk-dev] [PATCH v2 32/32] raw/cnxk_bphy: support for bphy selftest Tomasz Duszynski
2021-06-21 8:43 ` [dpdk-dev] [PATCH v2 00/32] add support for baseband phy Jerin Jacob
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 " Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 01/32] common/cnxk: add bphy cgx/rpm initialization and cleanup Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 02/32] common/cnxk: support for communication with atf Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 03/32] common/cnxk: support for getting link information Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 04/32] common/cnxk: support for changing internal loopback Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 05/32] common/cnxk: support for changing ptp mode Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 06/32] common/cnxk: support for setting link mode Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 07/32] common/cnxk: support for changing link state Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 08/32] common/cnxk: support for lmac start/stop Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 09/32] raw/cnxk_bphy: add bphy cgx/rpm skeleton driver Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 10/32] raw/cnxk_bphy: support for reading queue configuration Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 11/32] raw/cnxk_bphy: support for reading queue count Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 12/32] raw/cnxk_bphy: support for enqueue operation Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 13/32] raw/cnxk_bphy: support for dequeue operation Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 14/32] raw/cnxk_bphy: support for performing selftest Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 15/32] common/cnxk: support for device init and fini Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 16/32] common/cnxk: support for baseband PHY irq setup Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 17/32] common/cnxk: support for checking irq availability Tomasz Duszynski
2021-06-21 15:04 ` Tomasz Duszynski [this message]
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 19/32] common/cnxk: support for removing irq stack Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 20/32] common/cnxk: support for setting bphy irq handler Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 21/32] common/cnxk: support for clearing " Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 22/32] common/cnxk: support for registering bphy irq Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 23/32] raw/cnxk_bphy: add baseband PHY skeleton driver Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 24/32] raw/cnxk_bphy: support for reading bphy queue configuration Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 25/32] raw/cnxk_bphy: support for reading bphy queue count Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 26/32] raw/cnxk_bphy: support for bphy enqueue operation Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 27/32] raw/cnxk_bphy: support for bphy dequeue operation Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 28/32] raw/cnxk_bphy: support for interrupt init and cleanup Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 29/32] raw/cnxk_bphy: support for reading number of bphy irqs Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 30/32] raw/cnxk_bphy: support for retrieving bphy device memory Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 31/32] raw/cnxk_bphy: support for registering bphy irq handlers Tomasz Duszynski
2021-06-21 15:04 ` [dpdk-dev] [PATCH v3 32/32] raw/cnxk_bphy: support for bphy selftest Tomasz Duszynski
2021-07-05 21:12 ` [dpdk-dev] [PATCH v3 00/32] add support for baseband phy Thomas Monjalon
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=20210621150449.19070-19-tduszynski@marvell.com \
--to=tduszynski@marvell.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=jpalider@marvell.com \
--cc=kirankumark@marvell.com \
--cc=mdr@ashroe.eu \
--cc=ndabilpuram@marvell.com \
--cc=nhorman@tuxdriver.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.com \
--cc=thomas@monjalon.net \
/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).