]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sif: epsc: For Xen dom0 configure resources for all 32 VFs at driver load
authorKnut Omang <knut.omang@oracle.com>
Fri, 22 Jul 2016 12:49:23 +0000 (14:49 +0200)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Fri, 12 Aug 2016 19:18:12 +0000 (12:18 -0700)
As of EPSC API version 2.9 firmware can distribute resources based on
the number of PCI functions the PF driver requests support for.
Older firmware will just ignore the value.

This commit enforces no VFs configured as the default setting
but enable all 32 VFs if a Xen PV domain is detected.

To allow overriding this behaviour we add a new module parameter
vf_max which can be used to override the number of VFs configured
for instance for use with other virtualization engines than Xen
and for debugging/tuning purposes. The vf_max parameter takes the
following values:

-2:  Use NVRAM configured firmware defaults (backward compat mode)
-1  (now default) : Exadata mode as described above
0-32:  Configure explicitly for that many VFs (only selected values
     are supported by firmware)

Orabug: 24424521

Signed-off-by: Knut Omang <knut.omang@oracle.com>
Reviewed-by: HÃ¥kon Bugge <haakon.bugge@oracle.com>
drivers/infiniband/hw/sif/sif_dev.h
drivers/infiniband/hw/sif/sif_epsc.c
drivers/infiniband/hw/sif/sif_hwi.c
drivers/infiniband/hw/sif/sif_main.c

index e90ba1018b2f66ab546ab4893e2005147cdc467c..01e848be9a86d0213eca7d0b1f93efb9fc5945d3 100644 (file)
@@ -705,6 +705,9 @@ extern uint sif_ki_spqp_size;
 /* Max number of collect buffers supported */
 extern uint sif_cb_max;
 
+/* Number of VFs to request firmware to configure, 0 = use driver defaults */
+extern int sif_vf_max;
+
 /* Initialized in init */
 extern struct kmem_cache *compl_cache;
 
index beefefb6fe5e0aa189810840000ab9b10fb2feba..c7c95f29b39d9109904de612a7a0f5893f295701 100644 (file)
@@ -32,6 +32,7 @@
 #include "sif_defs.h"
 #include <linux/bitmap.h>
 #include <linux/seq_file.h>
+#include <xen/xen.h>
 
 #define CSR_ONLINE_MASK 0x8000
 
@@ -696,6 +697,24 @@ int sif_eps_init(struct sif_dev *sdev, enum sif_tab_type type)
        lcqe.rsp = &lrsp;
        lcqe.need_complete = false;
 
+       if (!sdev->is_vf) {
+               /* PF only: If sif_vf_max is >= 0, enable that number of VFs.
+                * If vf_max == -1: enable Exadata mode as follows:
+                *    if Xen PV domain automatically enable all VFs,
+                *    otherwise enable no VFs - only physical function.
+                * If vf_max == -2: Default to NVRAM settings from firmware
+                *    = bw comp mode.
+                */
+               if (sif_vf_max >= 0)
+                       lconfig.num_ufs = min_t(int, pci_sriov_get_totalvfs(sdev->pdev),sif_vf_max) + 1;
+               else if (sif_vf_max == -2)
+                       lconfig.num_ufs = 0; /* Use firmware defaults */
+               else if (xen_pv_domain())
+                       lconfig.num_ufs = pci_sriov_get_totalvfs(sdev->pdev) + 1;
+               else
+                       lconfig.num_ufs = 1;
+       }
+
        lconfig.hwapi_major_ver = PSIF_MAJOR_VERSION;
        lconfig.hwapi_minor_ver = PSIF_MINOR_VERSION;
        lconfig.epsapi_major_ver = EPSC_MAJOR_VERSION;
index b01dcfc1c1d337a31796a2b5addcf19de106babc..08f536ec05218f85a8025a5dff208ae2e7519a27 100644 (file)
@@ -437,6 +437,7 @@ int sif_hw_init(struct sif_dev *sdev)
        if (ret)
                goto chip_init_failed;
 
+       /* Configure all the base tables with the EPSC */
        ret = sif_base_init(sdev);
        if (ret)
                goto base_failed;
index e8c0d7debbc924e6d2ed835fb63a54126166d2f7..4a3fbcdf2740874516b2428ee3057ee5cf5a4e78 100644 (file)
@@ -109,6 +109,10 @@ uint sif_cb_max = 100;
 module_param_named(cb_max, sif_cb_max, uint, S_IRUGO);
 MODULE_PARM_DESC(cb_max, "Upper limit on no. of CBs of each type to reserve for the kernel");
 
+int sif_vf_max = -1;
+module_param_named(vf_max, sif_vf_max, int, S_IRUGO);
+MODULE_PARM_DESC(vf_max, "Number of VFs to request firmware to configure, -1 = use driver defaults");
+
 uint sif_fmr_cache_flush_threshold = 512;
 module_param_named(fmr_cache_flush_threshold, sif_fmr_cache_flush_threshold, uint, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(fmr_cache_flush_threshold, "PF limit for when to use fast-path full MMU flush for FMR unmap");