From: Knut Omang Date: Fri, 22 Jul 2016 12:49:23 +0000 (+0200) Subject: sif: epsc: For Xen dom0 configure resources for all 32 VFs at driver load X-Git-Tag: v4.1.12-92~87^2~5 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=21305b26a7be289cd59bfbf246e7846df8da1b3a;p=users%2Fjedix%2Flinux-maple.git sif: epsc: For Xen dom0 configure resources for all 32 VFs at driver load 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 Reviewed-by: HÃ¥kon Bugge --- diff --git a/drivers/infiniband/hw/sif/sif_dev.h b/drivers/infiniband/hw/sif/sif_dev.h index e90ba1018b2f..01e848be9a86 100644 --- a/drivers/infiniband/hw/sif/sif_dev.h +++ b/drivers/infiniband/hw/sif/sif_dev.h @@ -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; diff --git a/drivers/infiniband/hw/sif/sif_epsc.c b/drivers/infiniband/hw/sif/sif_epsc.c index beefefb6fe5e..c7c95f29b39d 100644 --- a/drivers/infiniband/hw/sif/sif_epsc.c +++ b/drivers/infiniband/hw/sif/sif_epsc.c @@ -32,6 +32,7 @@ #include "sif_defs.h" #include #include +#include #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; diff --git a/drivers/infiniband/hw/sif/sif_hwi.c b/drivers/infiniband/hw/sif/sif_hwi.c index b01dcfc1c1d3..08f536ec0521 100644 --- a/drivers/infiniband/hw/sif/sif_hwi.c +++ b/drivers/infiniband/hw/sif/sif_hwi.c @@ -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; diff --git a/drivers/infiniband/hw/sif/sif_main.c b/drivers/infiniband/hw/sif/sif_main.c index e8c0d7debbc9..4a3fbcdf2740 100644 --- a/drivers/infiniband/hw/sif/sif_main.c +++ b/drivers/infiniband/hw/sif/sif_main.c @@ -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");