Skip to content

Commit

Permalink
crypto: ccp - Update driver messages to remove some confusion
Browse files Browse the repository at this point in the history
The current content of some of the driver messages and the way that they
are issued results in some confusion, especially in the area of the PSP
as it relates to SEV support. If SEV is not supported, a message is issued
that says "psp initialization failed." This makes it seem like there was
a problem, when in fact, the PSP support is just disabled if SEV is not
supported.

Update the driver to check SEV support a bit earlier and issue a debug-
level message if SEV is not supported, followed by a debug-level message
that the PSP is disabled. This way you will only see PSP messages if SEV
is supported or if debug information is desired. Also, remove the overall
"enabled" and "disabled" messages for the driver and rely on the CCP and
PSP support to issue component-specific messages.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Lendacky, Thomas authored and Herbert Xu committed Feb 22, 2019
1 parent 333e664 commit 7df5218
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
19 changes: 14 additions & 5 deletions drivers/crypto/ccp/psp-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,15 +858,15 @@ static int sev_misc_init(struct psp_device *psp)
return 0;
}

static int sev_init(struct psp_device *psp)
static int psp_check_sev_support(struct psp_device *psp)
{
/* Check if device supports SEV feature */
if (!(ioread32(psp->io_regs + psp->vdata->feature_reg) & 1)) {
dev_dbg(psp->dev, "device does not support SEV\n");
return 1;
dev_dbg(psp->dev, "psp does not support SEV\n");
return -ENODEV;
}

return sev_misc_init(psp);
return 0;
}

int psp_dev_init(struct sp_device *sp)
Expand All @@ -891,6 +891,10 @@ int psp_dev_init(struct sp_device *sp)

psp->io_regs = sp->io_map;

ret = psp_check_sev_support(psp);
if (ret)
goto e_disable;

/* Disable and clear interrupts until ready */
iowrite32(0, psp->io_regs + psp->vdata->inten_reg);
iowrite32(-1, psp->io_regs + psp->vdata->intsts_reg);
Expand All @@ -902,7 +906,7 @@ int psp_dev_init(struct sp_device *sp)
goto e_err;
}

ret = sev_init(psp);
ret = sev_misc_init(psp);
if (ret)
goto e_irq;

Expand All @@ -923,6 +927,11 @@ int psp_dev_init(struct sp_device *sp)

dev_notice(dev, "psp initialization failed\n");

return ret;

e_disable:
sp->psp_data = NULL;

return ret;
}

Expand Down
4 changes: 0 additions & 4 deletions drivers/crypto/ccp/sp-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (ret)
goto e_err;

dev_notice(dev, "enabled\n");

return 0;

e_err:
Expand All @@ -246,8 +244,6 @@ static void sp_pci_remove(struct pci_dev *pdev)
sp_destroy(sp);

sp_free_irqs(sp);

dev_notice(dev, "disabled\n");
}

#ifdef CONFIG_PM
Expand Down

0 comments on commit 7df5218

Please sign in to comment.