DPDK patches and discussions
 help / color / mirror / Atom feed
From: Harman Kalra <hkalra@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>,
	Harman Kalra <hkalra@marvell.com>
Cc: <dev@dpdk.org>
Subject: [PATCH 2/5] common/cnxk: add CN20ka A0 model
Date: Mon, 2 Sep 2024 11:59:37 +0530	[thread overview]
Message-ID: <20240902062940.182273-3-hkalra@marvell.com> (raw)
In-Reply-To: <20240902062940.182273-1-hkalra@marvell.com>

Adding support for CN20ka A0 pass

Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
 drivers/common/cnxk/roc_model.c |  9 +++++--
 drivers/common/cnxk/roc_model.h | 48 ++++++++++++++++++++++++++++++---
 2 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/drivers/common/cnxk/roc_model.c b/drivers/common/cnxk/roc_model.c
index 6dc2afe7f0..0c50064815 100644
--- a/drivers/common/cnxk/roc_model.c
+++ b/drivers/common/cnxk/roc_model.c
@@ -16,7 +16,9 @@ struct roc_model *roc_model;
 #define VENDOR_CAVIUM 0x43 /* 'C' */
 
 #define SOC_PART_CN10K 0xD49
+#define SOC_PART_CN20K 0xD8E
 
+#define PART_206xx  0xA0
 #define PART_106xx  0xB9
 #define PART_105xx  0xBA
 #define PART_105xxN 0xBC
@@ -59,6 +61,7 @@ static const struct model_db {
 	uint64_t flag;
 	char name[ROC_MODEL_STR_LEN_MAX];
 } model_db[] = {
+	{VENDOR_ARM, PART_206xx, 0, 0, ROC_MODEL_CN206xx_A0, "cn20ka_a0"},
 	{VENDOR_ARM, PART_106xx, 0, 0, ROC_MODEL_CN106xx_A0, "cn10ka_a0"},
 	{VENDOR_ARM, PART_106xx, 0, 1, ROC_MODEL_CN106xx_A1, "cn10ka_a1"},
 	{VENDOR_ARM, PART_106xx, 1, 0, ROC_MODEL_CN106xx_B0, "cn10ka_b0"},
@@ -187,8 +190,8 @@ populate_model(struct roc_model *model, uint32_t midr)
 	major = (midr >> MODEL_MAJOR_SHIFT) & MODEL_MAJOR_MASK;
 	minor = (midr >> MODEL_MINOR_SHIFT) & MODEL_MINOR_MASK;
 
-	/* Update part number for cn10k from device-tree */
-	if (part == SOC_PART_CN10K) {
+	/* Update part number from device-tree */
+	if (part == SOC_PART_CN10K || part == SOC_PART_CN20K) {
 		if (cn10k_part_pass_get(&part, &pass))
 			goto not_found;
 		/*
@@ -257,9 +260,11 @@ detect_invalid_config(void)
 {
 #ifdef ROC_PLATFORM_CN9K
 #ifdef ROC_PLATFORM_CN10K
+#ifdef ROC_PLATFORM_CN20K
 	PLT_STATIC_ASSERT(0);
 #endif
 #endif
+#endif
 }
 
 static uint64_t
diff --git a/drivers/common/cnxk/roc_model.h b/drivers/common/cnxk/roc_model.h
index b6dab4f64e..4e686bea2c 100644
--- a/drivers/common/cnxk/roc_model.h
+++ b/drivers/common/cnxk/roc_model.h
@@ -12,6 +12,7 @@
 extern struct roc_model *roc_model;
 
 struct roc_model {
+/* CN9k Models*/
 #define ROC_MODEL_CN96xx_A0    BIT_ULL(0)
 #define ROC_MODEL_CN96xx_B0    BIT_ULL(1)
 #define ROC_MODEL_CN96xx_C0    BIT_ULL(2)
@@ -24,6 +25,7 @@ struct roc_model {
 #define ROC_MODEL_CNF95xxN_B0  BIT_ULL(15)
 #define ROC_MODEL_CN98xx_A0    BIT_ULL(16)
 #define ROC_MODEL_CN98xx_A1    BIT_ULL(17)
+/* CN10k Models*/
 #define ROC_MODEL_CN106xx_A0   BIT_ULL(20)
 #define ROC_MODEL_CNF105xx_A0  BIT_ULL(21)
 #define ROC_MODEL_CNF105xxN_A0 BIT_ULL(22)
@@ -32,6 +34,9 @@ struct roc_model {
 #define ROC_MODEL_CNF105xx_A1  BIT_ULL(25)
 #define ROC_MODEL_CN106xx_B0   BIT_ULL(26)
 #define ROC_MODEL_CNF105xxN_B0 BIT_ULL(27)
+/* CN20k Models*/
+#define ROC_MODEL_CN206xx_A0   BIT_ULL(40)
+
 /* Following flags describe platform code is running on */
 #define ROC_ENV_HW   BIT_ULL(61)
 #define ROC_ENV_EMUL BIT_ULL(62)
@@ -43,6 +48,7 @@ struct roc_model {
 	char env[ROC_MODEL_STR_LEN_MAX];
 } __plt_cache_aligned;
 
+/* CN9K models */
 #define ROC_MODEL_CN96xx_Ax (ROC_MODEL_CN96xx_A0 | ROC_MODEL_CN96xx_B0)
 #define ROC_MODEL_CN98xx_Ax (ROC_MODEL_CN98xx_A0 | ROC_MODEL_CN98xx_A1)
 #define ROC_MODEL_CN9K                                                         \
@@ -56,6 +62,7 @@ struct roc_model {
 	 ROC_MODEL_CNF95xxN_A0 | ROC_MODEL_CNF95xxN_A1 |                       \
 	 ROC_MODEL_CNF95xxN_B0)
 
+/* CN10K models */
 #define ROC_MODEL_CN106xx   (ROC_MODEL_CN106xx_A0 | ROC_MODEL_CN106xx_A1 | ROC_MODEL_CN106xx_B0)
 #define ROC_MODEL_CNF105xx  (ROC_MODEL_CNF105xx_A0 | ROC_MODEL_CNF105xx_A1)
 #define ROC_MODEL_CNF105xxN (ROC_MODEL_CNF105xxN_A0 | ROC_MODEL_CNF105xxN_B0)
@@ -65,6 +72,10 @@ struct roc_model {
 	 ROC_MODEL_CN103xx)
 #define ROC_MODEL_CNF10K (ROC_MODEL_CNF105xx | ROC_MODEL_CNF105xxN)
 
+/* CN20K models */
+#define ROC_MODEL_CN206xx   (ROC_MODEL_CN206xx_A0)
+#define ROC_MODEL_CN20K     (ROC_MODEL_CN206xx)
+
 /* Runtime variants */
 static inline uint64_t
 roc_model_runtime_is_cn9k(void)
@@ -78,13 +89,32 @@ roc_model_runtime_is_cn10k(void)
 	return (roc_model->flag & (ROC_MODEL_CN10K));
 }
 
+static inline uint64_t
+roc_model_runtime_is_cn20k(void)
+{
+	return (roc_model->flag & (ROC_MODEL_CN20K));
+}
+
 /* Compile time variants */
 #ifdef ROC_PLATFORM_CN9K
 #define roc_model_constant_is_cn9k()  1
 #define roc_model_constant_is_cn10k() 0
-#else
+#define roc_model_constant_is_cn20k() 0
+#endif
+#ifdef ROC_PLATFORM_CN10K
 #define roc_model_constant_is_cn9k()  0
 #define roc_model_constant_is_cn10k() 1
+#define roc_model_constant_is_cn20k() 0
+#endif
+#ifdef ROC_PLATFORM_CN20K
+#define roc_model_constant_is_cn9k()  0
+#define roc_model_constant_is_cn10k() 0
+#define roc_model_constant_is_cn20k() 1
+#endif
+#if !defined(ROC_PLATFORM_CN9K) && !defined(ROC_PLATFORM_CN10K) && !defined(ROC_PLATFORM_CN20K)
+#define roc_model_constant_is_cn9k()  0
+#define roc_model_constant_is_cn10k() 0
+#define roc_model_constant_is_cn20k() 0
 #endif
 
 /*
@@ -97,7 +127,7 @@ roc_model_is_cn9k(void)
 #ifdef ROC_PLATFORM_CN9K
 	return 1;
 #endif
-#ifdef ROC_PLATFORM_CN10K
+#if defined(ROC_PLATFORM_CN10K) || defined(ROC_PLATFORM_CN20K)
 	return 0;
 #endif
 	return roc_model_runtime_is_cn9k();
@@ -109,12 +139,24 @@ roc_model_is_cn10k(void)
 #ifdef ROC_PLATFORM_CN10K
 	return 1;
 #endif
-#ifdef ROC_PLATFORM_CN9K
+#if defined(ROC_PLATFORM_CN9K) || defined(ROC_PLATFORM_CN20K)
 	return 0;
 #endif
 	return roc_model_runtime_is_cn10k();
 }
 
+static inline uint64_t
+roc_model_is_cn20k(void)
+{
+#ifdef ROC_PLATFORM_CN20K
+	return 1;
+#endif
+#if defined(ROC_PLATFORM_CN9K) || defined(ROC_PLATFORM_CN10K)
+	return 0;
+#endif
+	return roc_model_runtime_is_cn20k();
+}
+
 static inline uint64_t
 roc_model_is_cn98xx(void)
 {
-- 
2.25.1


  parent reply	other threads:[~2024-09-02  6:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-02  6:29 [PATCH 0/5] Marvell cn20K SOC base code Harman Kalra
2024-09-02  6:29 ` [PATCH 1/5] common/cnxk: define platform configuration Harman Kalra
2024-09-02  6:29 ` Harman Kalra [this message]
2024-09-02  6:29 ` [PATCH 3/5] common/cnxk: add cn20ka mbox support Harman Kalra
2024-09-02  6:29 ` [PATCH 4/5] common/cnxk: define PF VF bit encoding in pcifunc Harman Kalra
2024-09-02  6:29 ` [PATCH 5/5] common/cnxk: enable PF VF mbox Harman Kalra

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=20240902062940.182273-3-hkalra@marvell.com \
    --to=hkalra@marvell.com \
    --cc=dev@dpdk.org \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.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).