firmware: stratix10-svc: Add support for FCS
Extend Intel service layer driver to support FPGA Crypto service(FCS) features on Intel Soc platforms. Adding an additional channel and FCS platform driver ("intel_fcs") as part of the probe method. FCS driver uses the driver to send crypto operations' commands to the secure device manager(SDM) on Intel Soc platforms Stratix10 and Agilex. Signed-off-by: Ang Tien Sung <tien.sung.ang@intel.com> Signed-off-by: Dinh Nguyen <dinguyen@kernel.org> Link: https://lore.kernel.org/r/20220711223140.2307945-1-dinguyen@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6c93c6f3ba
commit
e6281c2667
|
@ -34,12 +34,13 @@
|
|||
* timeout is set to 30 seconds (30 * 1000) at Intel Stratix10 SoC.
|
||||
*/
|
||||
#define SVC_NUM_DATA_IN_FIFO 32
|
||||
#define SVC_NUM_CHANNEL 2
|
||||
#define SVC_NUM_CHANNEL 3
|
||||
#define FPGA_CONFIG_DATA_CLAIM_TIMEOUT_MS 200
|
||||
#define FPGA_CONFIG_STATUS_TIMEOUT_SEC 30
|
||||
|
||||
/* stratix10 service layer clients */
|
||||
#define STRATIX10_RSU "stratix10-rsu"
|
||||
#define INTEL_FCS "intel-fcs"
|
||||
|
||||
typedef void (svc_invoke_fn)(unsigned long, unsigned long, unsigned long,
|
||||
unsigned long, unsigned long, unsigned long,
|
||||
|
@ -53,6 +54,7 @@ struct stratix10_svc_chan;
|
|||
*/
|
||||
struct stratix10_svc {
|
||||
struct platform_device *stratix10_svc_rsu;
|
||||
struct platform_device *intel_svc_fcs;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1036,6 +1038,11 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
|
|||
chans[1].name = SVC_CLIENT_RSU;
|
||||
spin_lock_init(&chans[1].lock);
|
||||
|
||||
chans[2].scl = NULL;
|
||||
chans[2].ctrl = controller;
|
||||
chans[2].name = SVC_CLIENT_FCS;
|
||||
spin_lock_init(&chans[2].lock);
|
||||
|
||||
list_add_tail(&controller->node, &svc_ctrl);
|
||||
platform_set_drvdata(pdev, controller);
|
||||
|
||||
|
@ -1054,8 +1061,22 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
ret = platform_device_add(svc->stratix10_svc_rsu);
|
||||
if (ret)
|
||||
goto err_put_device;
|
||||
if (ret) {
|
||||
platform_device_put(svc->stratix10_svc_rsu);
|
||||
return ret;
|
||||
}
|
||||
|
||||
svc->intel_svc_fcs = platform_device_alloc(INTEL_FCS, 1);
|
||||
if (!svc->intel_svc_fcs) {
|
||||
dev_err(dev, "failed to allocate %s device\n", INTEL_FCS);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ret = platform_device_add(svc->intel_svc_fcs);
|
||||
if (ret) {
|
||||
platform_device_put(svc->intel_svc_fcs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
dev_set_drvdata(dev, svc);
|
||||
|
||||
|
@ -1063,8 +1084,6 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
|
|||
|
||||
return 0;
|
||||
|
||||
err_put_device:
|
||||
platform_device_put(svc->stratix10_svc_rsu);
|
||||
err_free_kfifo:
|
||||
kfifo_free(&controller->svc_fifo);
|
||||
return ret;
|
||||
|
@ -1075,6 +1094,7 @@ static int stratix10_svc_drv_remove(struct platform_device *pdev)
|
|||
struct stratix10_svc *svc = dev_get_drvdata(&pdev->dev);
|
||||
struct stratix10_svc_controller *ctrl = platform_get_drvdata(pdev);
|
||||
|
||||
platform_device_unregister(svc->intel_svc_fcs);
|
||||
platform_device_unregister(svc->stratix10_svc_rsu);
|
||||
|
||||
kfifo_free(&ctrl->svc_fifo);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
*/
|
||||
#define SVC_CLIENT_FPGA "fpga"
|
||||
#define SVC_CLIENT_RSU "rsu"
|
||||
#define SVC_CLIENT_FCS "fcs"
|
||||
|
||||
/*
|
||||
* Status of the sent command, in bit number
|
||||
|
|
Loading…
Reference in New Issue