Skip to content

Commit 07ded64

Browse files
author
Herton R. Krzesinski
committed
Merge: crypto: ccp: update ccp driver upto v6.2-rc6
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/1943 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2130715 Bring in important CCP driver patches and fixes from upstream upto v6.2-rc6. All the patches apply cleanly. Signed-off-by: Vladis Dronov <vdronov@redhat.com> Approved-by: Ondrej Mosnáček <omosnacek@gmail.com> Approved-by: Phil Auld <pauld@redhat.com> Approved-by: Herbert Xu <zxu@redhat.com> Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2 parents 9de1daf + b57bf2f commit 07ded64

File tree

4 files changed

+37
-15
lines changed

4 files changed

+37
-15
lines changed

drivers/crypto/ccp/ccp-crypto-main.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,6 @@ struct ccp_crypto_cmd {
7878
int ret;
7979
};
8080

81-
struct ccp_crypto_cpu {
82-
struct work_struct work;
83-
struct completion completion;
84-
struct ccp_crypto_cmd *crypto_cmd;
85-
int err;
86-
};
87-
8881
static inline bool ccp_crypto_success(int err)
8982
{
9083
if (err && (err != -EINPROGRESS) && (err != -EBUSY))
@@ -400,7 +393,7 @@ static void ccp_unregister_algs(void)
400393
}
401394
}
402395

403-
static int ccp_crypto_init(void)
396+
static int __init ccp_crypto_init(void)
404397
{
405398
int ret;
406399

@@ -421,7 +414,7 @@ static int ccp_crypto_init(void)
421414
return ret;
422415
}
423416

424-
static void ccp_crypto_exit(void)
417+
static void __exit ccp_crypto_exit(void)
425418
{
426419
ccp_unregister_algs();
427420
}

drivers/crypto/ccp/ccp-dmaengine.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -642,14 +642,26 @@ static void ccp_dma_release(struct ccp_device *ccp)
642642
chan = ccp->ccp_dma_chan + i;
643643
dma_chan = &chan->dma_chan;
644644

645-
if (dma_chan->client_count)
646-
dma_release_channel(dma_chan);
647-
648645
tasklet_kill(&chan->cleanup_tasklet);
649646
list_del_rcu(&dma_chan->device_node);
650647
}
651648
}
652649

650+
static void ccp_dma_release_channels(struct ccp_device *ccp)
651+
{
652+
struct ccp_dma_chan *chan;
653+
struct dma_chan *dma_chan;
654+
unsigned int i;
655+
656+
for (i = 0; i < ccp->cmd_q_count; i++) {
657+
chan = ccp->ccp_dma_chan + i;
658+
dma_chan = &chan->dma_chan;
659+
660+
if (dma_chan->client_count)
661+
dma_release_channel(dma_chan);
662+
}
663+
}
664+
653665
int ccp_dmaengine_register(struct ccp_device *ccp)
654666
{
655667
struct ccp_dma_chan *chan;
@@ -770,8 +782,9 @@ void ccp_dmaengine_unregister(struct ccp_device *ccp)
770782
if (!dmaengine)
771783
return;
772784

773-
ccp_dma_release(ccp);
785+
ccp_dma_release_channels(ccp);
774786
dma_async_device_unregister(dma_dev);
787+
ccp_dma_release(ccp);
775788

776789
kmem_cache_destroy(ccp->dma_desc_cache);
777790
kmem_cache_destroy(ccp->dma_cmd_cache);

drivers/crypto/ccp/sev-dev.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,14 @@ static int sev_ioctl_do_get_id2(struct sev_issue_cmd *argp)
881881
input_address = (void __user *)input.address;
882882

883883
if (input.address && input.length) {
884-
id_blob = kzalloc(input.length, GFP_KERNEL);
884+
/*
885+
* The length of the ID shouldn't be assumed by software since
886+
* it may change in the future. The allocation size is limited
887+
* to 1 << (PAGE_SHIFT + MAX_ORDER - 1) by the page allocator.
888+
* If the allocation fails, simply return ENOMEM rather than
889+
* warning in the kernel log.
890+
*/
891+
id_blob = kzalloc(input.length, GFP_KERNEL | __GFP_NOWARN);
885892
if (!id_blob)
886893
return -ENOMEM;
887894

drivers/crypto/ccp/sp-pci.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,15 @@ static const struct psp_vdata pspv3 = {
381381
.inten_reg = 0x10690,
382382
.intsts_reg = 0x10694,
383383
};
384+
385+
static const struct psp_vdata pspv4 = {
386+
.sev = &sevv2,
387+
.tee = &teev1,
388+
.feature_reg = 0x109fc,
389+
.inten_reg = 0x10690,
390+
.intsts_reg = 0x10694,
391+
};
392+
384393
#endif
385394

386395
static const struct sp_dev_vdata dev_vdata[] = {
@@ -426,7 +435,7 @@ static const struct sp_dev_vdata dev_vdata[] = {
426435
{ /* 5 */
427436
.bar = 2,
428437
#ifdef CONFIG_CRYPTO_DEV_SP_PSP
429-
.psp_vdata = &pspv2,
438+
.psp_vdata = &pspv4,
430439
#endif
431440
},
432441
{ /* 6 */

0 commit comments

Comments
 (0)