mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-22 20:43:56 +08:00
crypto: ccp - Cleanup sp_dev_master in psp_dev_destroy()
Introduce clear_psp_master_device() to ensure that sp_dev_master gets
properly cleared on the release of a psp device.
Fixes: 2a6170dfe7
("crypto: ccp: Add Platform Security Processor (PSP) device support")
Signed-off-by: John Allen <john.allen@amd.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
1f14b57ffc
commit
15f7a4c652
@ -215,6 +215,9 @@ void psp_dev_destroy(struct sp_device *sp)
|
||||
tee_dev_destroy(psp);
|
||||
|
||||
sp_free_psp_irq(sp, psp);
|
||||
|
||||
if (sp->clear_psp_master_device)
|
||||
sp->clear_psp_master_device(sp);
|
||||
}
|
||||
|
||||
void psp_set_sev_irq_handler(struct psp_device *psp, psp_irq_handler_t handler,
|
||||
|
@ -90,6 +90,7 @@ struct sp_device {
|
||||
/* get and set master device */
|
||||
struct sp_device*(*get_psp_master_device)(void);
|
||||
void (*set_psp_master_device)(struct sp_device *);
|
||||
void (*clear_psp_master_device)(struct sp_device *);
|
||||
|
||||
bool irq_registered;
|
||||
bool use_tasklet;
|
||||
|
@ -146,6 +146,14 @@ static struct sp_device *psp_get_master(void)
|
||||
return sp_dev_master;
|
||||
}
|
||||
|
||||
static void psp_clear_master(struct sp_device *sp)
|
||||
{
|
||||
if (sp == sp_dev_master) {
|
||||
sp_dev_master = NULL;
|
||||
dev_dbg(sp->dev, "Cleared sp_dev_master\n");
|
||||
}
|
||||
}
|
||||
|
||||
static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
{
|
||||
struct sp_device *sp;
|
||||
@ -206,6 +214,7 @@ static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
pci_set_master(pdev);
|
||||
sp->set_psp_master_device = psp_set_master;
|
||||
sp->get_psp_master_device = psp_get_master;
|
||||
sp->clear_psp_master_device = psp_clear_master;
|
||||
|
||||
ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48));
|
||||
if (ret) {
|
||||
|
Loading…
Reference in New Issue
Block a user