]> git.droids-corp.org - dpdk.git/commitdiff
common/cnxk: allow building for generic arm64
authorTomasz Duszynski <tduszynski@marvell.com>
Sat, 4 Jun 2022 16:31:57 +0000 (18:31 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 7 Jun 2022 18:49:20 +0000 (20:49 +0200)
Allow building generic arm64 target using config/arm/arm64_armv8_linux_*
config which works on both cn9k and cn10k by relaxing cache line size
requirements a bit.

While at it move cache line checks to common place.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
drivers/common/cnxk/roc_dev.c
drivers/event/cnxk/cn10k_eventdev.c
drivers/event/cnxk/cn9k_eventdev.c
drivers/net/cnxk/cn10k_ethdev.c
drivers/net/cnxk/cn9k_ethdev.c

index 9a869698c4cdbaa037c004e6e53c823b0ebed1d2..09199ac2fffe3830d43ce50e9e0d6c17905f2a70 100644 (file)
@@ -1094,6 +1094,29 @@ fail:
        return -errno;
 }
 
+static bool
+dev_cache_line_size_valid(void)
+{
+       if (roc_model_is_cn9k()) {
+               if (PLT_CACHE_LINE_SIZE != 128) {
+                       plt_err("Cache line size of %d is wrong for CN9K",
+                               PLT_CACHE_LINE_SIZE);
+                       return false;
+               }
+       } else if (roc_model_is_cn10k()) {
+               if (PLT_CACHE_LINE_SIZE == 128) {
+                       plt_warn("Cache line size of %d might affect performance",
+                                PLT_CACHE_LINE_SIZE);
+               } else if (PLT_CACHE_LINE_SIZE != 64) {
+                       plt_err("Cache line size of %d is wrong for CN10K",
+                               PLT_CACHE_LINE_SIZE);
+                       return false;
+               }
+       }
+
+       return true;
+}
+
 int
 dev_init(struct dev *dev, struct plt_pci_device *pci_dev)
 {
@@ -1102,6 +1125,9 @@ dev_init(struct dev *dev, struct plt_pci_device *pci_dev)
        uintptr_t vf_mbase = 0;
        uint64_t intr_offset;
 
+       if (!dev_cache_line_size_valid())
+               return -EFAULT;
+
        bar2 = (uintptr_t)pci_dev->mem_resource[2].addr;
        bar4 = (uintptr_t)pci_dev->mem_resource[4].addr;
        if (bar2 == 0 || bar4 == 0) {
index bf0a991cafbfb73adc9cd1f823af73a6e22968b6..0da809db29935ac175d952114f14383c39dc2ec2 100644 (file)
@@ -963,11 +963,6 @@ cn10k_sso_init(struct rte_eventdev *event_dev)
        struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
        int rc;
 
-       if (RTE_CACHE_LINE_SIZE != 64) {
-               plt_err("Driver not compiled for CN10K");
-               return -EFAULT;
-       }
-
        rc = roc_plt_init();
        if (rc < 0) {
                plt_err("Failed to initialize platform model");
index c3eb97c0a33ddc847a77eb084fbe4f05f77d7cb3..84347795f0fc66c6701d96d391c64cb2b3768c56 100644 (file)
@@ -1193,11 +1193,6 @@ cn9k_sso_init(struct rte_eventdev *event_dev)
        struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
        int rc;
 
-       if (RTE_CACHE_LINE_SIZE != 128) {
-               plt_err("Driver not compiled for CN9K");
-               return -EFAULT;
-       }
-
        rc = roc_plt_init();
        if (rc < 0) {
                plt_err("Failed to initialize platform model");
index 85be9066ce94bd78abab50ba6f078611f76fde1b..911a7d7aaf637ebf96f777b952d225e461c9c494 100644 (file)
@@ -759,11 +759,6 @@ cn10k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
        struct cnxk_eth_dev *dev;
        int rc;
 
-       if (RTE_CACHE_LINE_SIZE != 64) {
-               plt_err("Driver not compiled for CN10K");
-               return -EFAULT;
-       }
-
        rc = roc_plt_init();
        if (rc) {
                plt_err("Failed to initialize platform model, rc=%d", rc);
index 8459bc44b53638311b9e87fca12b60fa6feb1e88..2663aa6d8a955df3dd15221f64f15b1dd9dd375c 100644 (file)
@@ -689,11 +689,6 @@ cn9k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
        struct cnxk_eth_dev *dev;
        int rc;
 
-       if (RTE_CACHE_LINE_SIZE != 128) {
-               plt_err("Driver not compiled for CN9K");
-               return -EFAULT;
-       }
-
        rc = roc_plt_init();
        if (rc) {
                plt_err("Failed to initialize platform model, rc=%d", rc);