dmaengine: idxd: Set defaults for GRPCFG traffic class
authorDave Jiang <dave.jiang@intel.com>
Tue, 20 Jul 2021 20:42:10 +0000 (13:42 -0700)
committerVinod Koul <vkoul@kernel.org>
Wed, 28 Jul 2021 12:25:40 +0000 (17:55 +0530)
Set GRPCFG traffic class to value of 1 for best performance on current
generation of accelerators. Also add override option to allow experimentation.
Sysfs knobs are disabled for DSA/IAX gen1 devices.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/162681373005.1968485.3761065664382799202.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Documentation/admin-guide/kernel-parameters.txt
drivers/dma/idxd/idxd.h
drivers/dma/idxd/init.c
drivers/dma/idxd/registers.h
drivers/dma/idxd/sysfs.c

index bdb22006f713fd3ca8f3566376191f3ae200713f..ec5411cdec2089726c4176b56cd4c4360c1c0a63 100644 (file)
                        support for the idxd driver. By default it is set to
                        true (1).
 
+       idxd.tc_override= [HW]
+                       Format: <bool>
+                       Allow override of default traffic class configuration
+                       for the device. By default it is set to false (0).
+
        ieee754=        [MIPS] Select IEEE Std 754 conformance mode
                        Format: { strict | legacy | 2008 | relaxed }
                        Default: strict
index d0874d8877d9ee5834b334bab8ccb0fddc3470e0..4e4dc0110e773c0a77ed7ac010676a67cecd2583 100644 (file)
@@ -16,6 +16,7 @@
 #define IDXD_DRIVER_VERSION    "1.00"
 
 extern struct kmem_cache *idxd_desc_pool;
+extern bool tc_override;
 
 struct idxd_wq;
 struct idxd_dev;
index 8db56f98059f4bd315c29ff8e8495a1cc7e25237..eb09bc591c316a65b1967126f2765759bf508975 100644 (file)
@@ -32,6 +32,10 @@ static bool sva = true;
 module_param(sva, bool, 0644);
 MODULE_PARM_DESC(sva, "Toggle SVA support on/off");
 
+bool tc_override;
+module_param(tc_override, bool, 0644);
+MODULE_PARM_DESC(tc_override, "Override traffic class defaults");
+
 #define DRV_NAME "idxd"
 
 bool support_enqcmd;
@@ -336,8 +340,13 @@ static int idxd_setup_groups(struct idxd_device *idxd)
                }
 
                idxd->groups[i] = group;
-               group->tc_a = -1;
-               group->tc_b = -1;
+               if (idxd->hw.version < DEVICE_VERSION_2 && !tc_override) {
+                       group->tc_a = 1;
+                       group->tc_b = 1;
+               } else {
+                       group->tc_a = -1;
+                       group->tc_b = -1;
+               }
        }
 
        return 0;
index 7343a8f488193a65d44596f29e2c74b037057d5c..ffc7550a77eebc3630f32e7c344425fb3cfab5af 100644 (file)
@@ -7,6 +7,9 @@
 #define PCI_DEVICE_ID_INTEL_DSA_SPR0   0x0b25
 #define PCI_DEVICE_ID_INTEL_IAX_SPR0   0x0cfe
 
+#define DEVICE_VERSION_1               0x100
+#define DEVICE_VERSION_2               0x200
+
 #define IDXD_MMIO_BAR          0
 #define IDXD_WQ_BAR            2
 #define IDXD_PORTAL_SIZE       PAGE_SIZE
index b883e9f16e7f4d3fc43b3bad8cb2fc209ff654e3..881a12596d4bb1f4d50cfdd3e10f5dec6f1dacb7 100644 (file)
@@ -327,6 +327,9 @@ static ssize_t group_traffic_class_a_store(struct device *dev,
        if (idxd->state == IDXD_DEV_ENABLED)
                return -EPERM;
 
+       if (idxd->hw.version < DEVICE_VERSION_2 && !tc_override)
+               return -EPERM;
+
        if (val < 0 || val > 7)
                return -EINVAL;
 
@@ -366,6 +369,9 @@ static ssize_t group_traffic_class_b_store(struct device *dev,
        if (idxd->state == IDXD_DEV_ENABLED)
                return -EPERM;
 
+       if (idxd->hw.version < DEVICE_VERSION_2 && !tc_override)
+               return -EPERM;
+
        if (val < 0 || val > 7)
                return -EINVAL;