Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu: "This fixes regressions in the crypto ccp driver and the hwrng drivers for amd and geode" * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: hwrng: geode - Revert managed API changes hwrng: amd - Revert managed API changes crypto: ccp - Assign DMA commands to the channel's CCP
This commit is contained in:
commit
e8fe23ffc9
|
@ -55,6 +55,7 @@ MODULE_DEVICE_TABLE(pci, pci_tbl);
|
|||
struct amd768_priv {
|
||||
void __iomem *iobase;
|
||||
struct pci_dev *pcidev;
|
||||
u32 pmbase;
|
||||
};
|
||||
|
||||
static int amd_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
|
||||
|
@ -148,33 +149,58 @@ found:
|
|||
if (pmbase == 0)
|
||||
return -EIO;
|
||||
|
||||
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
||||
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
if (!devm_request_region(&pdev->dev, pmbase + PMBASE_OFFSET,
|
||||
PMBASE_SIZE, DRV_NAME)) {
|
||||
if (!request_region(pmbase + PMBASE_OFFSET, PMBASE_SIZE, DRV_NAME)) {
|
||||
dev_err(&pdev->dev, DRV_NAME " region 0x%x already in use!\n",
|
||||
pmbase + 0xF0);
|
||||
return -EBUSY;
|
||||
err = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
priv->iobase = devm_ioport_map(&pdev->dev, pmbase + PMBASE_OFFSET,
|
||||
PMBASE_SIZE);
|
||||
priv->iobase = ioport_map(pmbase + PMBASE_OFFSET, PMBASE_SIZE);
|
||||
if (!priv->iobase) {
|
||||
pr_err(DRV_NAME "Cannot map ioport\n");
|
||||
return -ENOMEM;
|
||||
err = -EINVAL;
|
||||
goto err_iomap;
|
||||
}
|
||||
|
||||
amd_rng.priv = (unsigned long)priv;
|
||||
priv->pmbase = pmbase;
|
||||
priv->pcidev = pdev;
|
||||
|
||||
pr_info(DRV_NAME " detected\n");
|
||||
return devm_hwrng_register(&pdev->dev, &amd_rng);
|
||||
err = hwrng_register(&amd_rng);
|
||||
if (err) {
|
||||
pr_err(DRV_NAME " registering failed (%d)\n", err);
|
||||
goto err_hwrng;
|
||||
}
|
||||
return 0;
|
||||
|
||||
err_hwrng:
|
||||
ioport_unmap(priv->iobase);
|
||||
err_iomap:
|
||||
release_region(pmbase + PMBASE_OFFSET, PMBASE_SIZE);
|
||||
out:
|
||||
kfree(priv);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void __exit mod_exit(void)
|
||||
{
|
||||
struct amd768_priv *priv;
|
||||
|
||||
priv = (struct amd768_priv *)amd_rng.priv;
|
||||
|
||||
hwrng_unregister(&amd_rng);
|
||||
|
||||
ioport_unmap(priv->iobase);
|
||||
|
||||
release_region(priv->pmbase + PMBASE_OFFSET, PMBASE_SIZE);
|
||||
|
||||
kfree(priv);
|
||||
}
|
||||
|
||||
module_init(mod_init);
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/pci.h>
|
||||
|
||||
|
||||
#define PFX KBUILD_MODNAME ": "
|
||||
|
||||
#define GEODE_RNG_DATA_REG 0x50
|
||||
#define GEODE_RNG_STATUS_REG 0x54
|
||||
|
||||
|
@ -82,6 +85,7 @@ static struct hwrng geode_rng = {
|
|||
|
||||
static int __init mod_init(void)
|
||||
{
|
||||
int err = -ENODEV;
|
||||
struct pci_dev *pdev = NULL;
|
||||
const struct pci_device_id *ent;
|
||||
void __iomem *mem;
|
||||
|
@ -89,27 +93,43 @@ static int __init mod_init(void)
|
|||
|
||||
for_each_pci_dev(pdev) {
|
||||
ent = pci_match_id(pci_tbl, pdev);
|
||||
if (ent) {
|
||||
rng_base = pci_resource_start(pdev, 0);
|
||||
if (rng_base == 0)
|
||||
return -ENODEV;
|
||||
|
||||
mem = devm_ioremap(&pdev->dev, rng_base, 0x58);
|
||||
if (!mem)
|
||||
return -ENOMEM;
|
||||
geode_rng.priv = (unsigned long)mem;
|
||||
|
||||
pr_info("AMD Geode RNG detected\n");
|
||||
return devm_hwrng_register(&pdev->dev, &geode_rng);
|
||||
}
|
||||
if (ent)
|
||||
goto found;
|
||||
}
|
||||
|
||||
/* Device not found. */
|
||||
return -ENODEV;
|
||||
goto out;
|
||||
|
||||
found:
|
||||
rng_base = pci_resource_start(pdev, 0);
|
||||
if (rng_base == 0)
|
||||
goto out;
|
||||
err = -ENOMEM;
|
||||
mem = ioremap(rng_base, 0x58);
|
||||
if (!mem)
|
||||
goto out;
|
||||
geode_rng.priv = (unsigned long)mem;
|
||||
|
||||
pr_info("AMD Geode RNG detected\n");
|
||||
err = hwrng_register(&geode_rng);
|
||||
if (err) {
|
||||
pr_err(PFX "RNG registering failed (%d)\n",
|
||||
err);
|
||||
goto err_unmap;
|
||||
}
|
||||
out:
|
||||
return err;
|
||||
|
||||
err_unmap:
|
||||
iounmap(mem);
|
||||
goto out;
|
||||
}
|
||||
|
||||
static void __exit mod_exit(void)
|
||||
{
|
||||
void __iomem *mem = (void __iomem *)geode_rng.priv;
|
||||
|
||||
hwrng_unregister(&geode_rng);
|
||||
iounmap(mem);
|
||||
}
|
||||
|
||||
module_init(mod_init);
|
||||
|
|
|
@ -283,11 +283,14 @@ EXPORT_SYMBOL_GPL(ccp_version);
|
|||
*/
|
||||
int ccp_enqueue_cmd(struct ccp_cmd *cmd)
|
||||
{
|
||||
struct ccp_device *ccp = ccp_get_device();
|
||||
struct ccp_device *ccp;
|
||||
unsigned long flags;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
/* Some commands might need to be sent to a specific device */
|
||||
ccp = cmd->ccp ? cmd->ccp : ccp_get_device();
|
||||
|
||||
if (!ccp)
|
||||
return -ENODEV;
|
||||
|
||||
|
|
|
@ -390,6 +390,7 @@ static struct ccp_dma_desc *ccp_create_desc(struct dma_chan *dma_chan,
|
|||
goto err;
|
||||
|
||||
ccp_cmd = &cmd->ccp_cmd;
|
||||
ccp_cmd->ccp = chan->ccp;
|
||||
ccp_pt = &ccp_cmd->u.passthru_nomap;
|
||||
ccp_cmd->flags = CCP_CMD_MAY_BACKLOG;
|
||||
ccp_cmd->flags |= CCP_CMD_PASSTHRU_NO_DMA_MAP;
|
||||
|
|
|
@ -556,7 +556,7 @@ enum ccp_engine {
|
|||
* struct ccp_cmd - CCP operation request
|
||||
* @entry: list element (ccp driver use only)
|
||||
* @work: work element used for callbacks (ccp driver use only)
|
||||
* @ccp: CCP device to be run on (ccp driver use only)
|
||||
* @ccp: CCP device to be run on
|
||||
* @ret: operation return code (ccp driver use only)
|
||||
* @flags: cmd processing flags
|
||||
* @engine: CCP operation to perform
|
||||
|
|
Loading…
Reference in New Issue