Some processors contain multiple CCPs with differing device IDs. Enable
the selection of specific devices based on ID. The parameter value is
a single PCI ID.
Signed-off-by: Gary R Hook <[email protected]>
---
drivers/crypto/ccp/sp-pci.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c
index 29177d113c90..b024b92fb749 100644
--- a/drivers/crypto/ccp/sp-pci.c
+++ b/drivers/crypto/ccp/sp-pci.c
@@ -36,6 +36,9 @@
/*
* Limit CCP use to a specifed number of queues per device.
*/
+static unsigned int pcidev;
+module_param(pcidev, uint, 0444);
+MODULE_PARM_DESC(pcidev, "Device number for a specific CCP");
static struct mutex devcount_mutex ____cacheline_aligned;
static unsigned int devcount = 0;
@@ -204,6 +207,10 @@ static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (maxdev && (devcount >= maxdev)) /* Too many devices? */
return 0;
+ /* If a specific device ID has been specified, filter for it */
+ if (pcidev && (pdev->device != pcidev))
+ return 0;
+
ret = -ENOMEM;
sp = sp_alloc_struct(dev);
if (!sp)
On 6/24/19 2:29 PM, Hook, Gary wrote:
> Some processors contain multiple CCPs with differing device IDs. Enable
> the selection of specific devices based on ID. The parameter value is
> a single PCI ID.
>
> Signed-off-by: Gary R Hook <[email protected]>
> ---
> drivers/crypto/ccp/sp-pci.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c
> index 29177d113c90..b024b92fb749 100644
> --- a/drivers/crypto/ccp/sp-pci.c
> +++ b/drivers/crypto/ccp/sp-pci.c
> @@ -36,6 +36,9 @@
> /*
> * Limit CCP use to a specifed number of queues per device.
> */
> +static unsigned int pcidev;
> +module_param(pcidev, uint, 0444);
> +MODULE_PARM_DESC(pcidev, "Device number for a specific CCP");
>
> static struct mutex devcount_mutex ____cacheline_aligned;
> static unsigned int devcount = 0;
> @@ -204,6 +207,10 @@ static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> if (maxdev && (devcount >= maxdev)) /* Too many devices? */
> return 0;
>
> + /* If a specific device ID has been specified, filter for it */
> + if (pcidev && (pdev->device != pcidev))
> + return 0;
> +
Again, this could interfere with devices that support the CCP and PSP, so
additional checking. You could get away with this check for the ccpv5b
device, but not the ccpv5a device.
Thanks,
Tom
> ret = -ENOMEM;
> sp = sp_alloc_struct(dev);
> if (!sp)
>