Displaying 20 results from an estimated 191 matches for "gfp_dma".
2019 May 08
3
[PATCH 06/10] s390/cio: add basic protected virtualization support
On Fri, 26 Apr 2019, Halil Pasic wrote:
> static struct ccw_device * io_subchannel_allocate_dev(struct subchannel *sch)
> {
[..]
> + cdev->private = kzalloc(sizeof(struct ccw_device_private),
> + GFP_KERNEL | GFP_DMA);
Do we still need GFP_DMA here (since we now have cdev->private->dma_area)?
> @@ -1062,6 +1082,14 @@ static int io_subchannel_probe(struct subchannel *sch)
> if (!io_priv)
> goto out_schedule;
>
> + io_priv->dma_area = dma_alloc_coherent(&sch->dev,
> +...
2019 May 08
3
[PATCH 06/10] s390/cio: add basic protected virtualization support
On Fri, 26 Apr 2019, Halil Pasic wrote:
> static struct ccw_device * io_subchannel_allocate_dev(struct subchannel *sch)
> {
[..]
> + cdev->private = kzalloc(sizeof(struct ccw_device_private),
> + GFP_KERNEL | GFP_DMA);
Do we still need GFP_DMA here (since we now have cdev->private->dma_area)?
> @@ -1062,6 +1082,14 @@ static int io_subchannel_probe(struct subchannel *sch)
> if (!io_priv)
> goto out_schedule;
>
> + io_priv->dma_area = dma_alloc_coherent(&sch->dev,
> +...
2007 Apr 03
2
linux: GFP_DMA/GFP_DMA32
While I have a patch queued to address related issues in intel-agp, a quick scan
of the Linux tree seems to reveal several more cases where assumptions are
being made on GFP_DMA{,32} allocations - either the result (even properly
passed through virt_to_bus()) is put into hardware registers (with no
guarantee that it fits the width required by those registers or fields thereof),
or page-crossing arithmetic is being done (explicitly or implicitly). All this is set
to cause d...
2019 Apr 26
0
[PATCH 09/10] virtio/s390: use DMA memory for ccw I/O and classic notifiers
...ueue *vq, struct airq_info *info)
{
unsigned long i, flags;
@@ -335,8 +355,7 @@ static void virtio_ccw_drop_indicator(struct virtio_ccw_device *vcdev,
struct airq_info *airq_info = vcdev->airq_info;
if (vcdev->is_thinint) {
- thinint_area = kzalloc(sizeof(*thinint_area),
- GFP_DMA | GFP_KERNEL);
+ vc_dma_alloc_struct(&vcdev->vdev, thinint_area);
if (!thinint_area)
return;
thinint_area->summary_indicator =
@@ -347,8 +366,8 @@ static void virtio_ccw_drop_indicator(struct virtio_ccw_device *vcdev,
ccw->cda = (__u32)(unsigned long) thinint_area;
} el...
2019 May 23
0
[PATCH v2 7/8] virtio/s390: use DMA memory for ccw I/O and classic notifiers
...ueue *vq, struct airq_info *info)
{
unsigned long i, flags;
@@ -336,8 +356,7 @@ static void virtio_ccw_drop_indicator(struct virtio_ccw_device *vcdev,
struct airq_info *airq_info = vcdev->airq_info;
if (vcdev->is_thinint) {
- thinint_area = kzalloc(sizeof(*thinint_area),
- GFP_DMA | GFP_KERNEL);
+ vc_dma_alloc_struct(&vcdev->vdev, thinint_area);
if (!thinint_area)
return;
thinint_area->summary_indicator =
@@ -348,8 +367,8 @@ static void virtio_ccw_drop_indicator(struct virtio_ccw_device *vcdev,
ccw->cda = (__u32)(unsigned long) thinint_area;
} el...
2019 May 29
0
[PATCH v3 7/8] virtio/s390: use DMA memory for ccw I/O and classic notifiers
...ueue *vq, struct airq_info *info)
{
unsigned long i, flags;
@@ -336,8 +356,7 @@ static void virtio_ccw_drop_indicator(struct virtio_ccw_device *vcdev,
struct airq_info *airq_info = vcdev->airq_info;
if (vcdev->is_thinint) {
- thinint_area = kzalloc(sizeof(*thinint_area),
- GFP_DMA | GFP_KERNEL);
+ vc_dma_alloc_struct(&vcdev->vdev, thinint_area);
if (!thinint_area)
return;
thinint_area->summary_indicator =
@@ -348,8 +367,8 @@ static void virtio_ccw_drop_indicator(struct virtio_ccw_device *vcdev,
ccw->cda = (__u32)(unsigned long) thinint_area;
} el...
2019 Jun 06
0
[PATCH v4 7/8] virtio/s390: use DMA memory for ccw I/O and classic notifiers
...;dma_area->indicators2;
}
struct vq_info_block_legacy {
@@ -336,8 +340,8 @@ static void virtio_ccw_drop_indicator(struct virtio_ccw_device *vcdev,
struct airq_info *airq_info = vcdev->airq_info;
if (vcdev->is_thinint) {
- thinint_area = kzalloc(sizeof(*thinint_area),
- GFP_DMA | GFP_KERNEL);
+ thinint_area = ccw_device_dma_zalloc(vcdev->cdev,
+ sizeof(*thinint_area));
if (!thinint_area)
return;
thinint_area->summary_indicator =
@@ -348,8 +352,8 @@ static void virtio_ccw_drop_indicator(struct virtio_ccw_device *vcdev,
ccw->cda = (__u32)(un...
2019 Jun 12
0
[PATCH v5 7/8] virtio/s390: use DMA memory for ccw I/O and classic notifiers
...;dma_area->indicators2;
}
struct vq_info_block_legacy {
@@ -336,8 +340,8 @@ static void virtio_ccw_drop_indicator(struct virtio_ccw_device *vcdev,
struct airq_info *airq_info = vcdev->airq_info;
if (vcdev->is_thinint) {
- thinint_area = kzalloc(sizeof(*thinint_area),
- GFP_DMA | GFP_KERNEL);
+ thinint_area = ccw_device_dma_zalloc(vcdev->cdev,
+ sizeof(*thinint_area));
if (!thinint_area)
return;
thinint_area->summary_indicator =
@@ -348,8 +352,8 @@ static void virtio_ccw_drop_indicator(struct virtio_ccw_device *vcdev,
ccw->cda = (__u32)(un...
2019 Jul 03
3
[PATCH v2 06/35] crypto: Use kmemdup rather than duplicating its implementation
...c.c
index fe24485274e1..a03464b4c019 100644
--- a/drivers/crypto/caam/caampkc.c
+++ b/drivers/crypto/caam/caampkc.c
@@ -816,7 +816,7 @@ static int caam_rsa_set_pub_key(struct crypto_akcipher *tfm, const void *key,
return ret;
/* Copy key in DMA zone */
- rsa_key->e = kzalloc(raw_key.e_sz, GFP_DMA | GFP_KERNEL);
+ rsa_key->e = kmemdup(raw_key.e, raw_key.e_sz, GFP_DMA | GFP_KERNEL);
if (!rsa_key->e)
goto err;
@@ -838,8 +838,6 @@ static int caam_rsa_set_pub_key(struct crypto_akcipher *tfm, const void *key,
rsa_key->e_sz = raw_key.e_sz;
rsa_key->n_sz = raw_key.n_sz;
- m...
2019 Jul 03
3
[PATCH v2 06/35] crypto: Use kmemdup rather than duplicating its implementation
...c.c
index fe24485274e1..a03464b4c019 100644
--- a/drivers/crypto/caam/caampkc.c
+++ b/drivers/crypto/caam/caampkc.c
@@ -816,7 +816,7 @@ static int caam_rsa_set_pub_key(struct crypto_akcipher *tfm, const void *key,
return ret;
/* Copy key in DMA zone */
- rsa_key->e = kzalloc(raw_key.e_sz, GFP_DMA | GFP_KERNEL);
+ rsa_key->e = kmemdup(raw_key.e, raw_key.e_sz, GFP_DMA | GFP_KERNEL);
if (!rsa_key->e)
goto err;
@@ -838,8 +838,6 @@ static int caam_rsa_set_pub_key(struct crypto_akcipher *tfm, const void *key,
rsa_key->e_sz = raw_key.e_sz;
rsa_key->n_sz = raw_key.n_sz;
- m...
2019 Jul 03
0
[PATCH 05/30] crypto: Use kmemdup rather than duplicating its implementation
...c.c
index fe24485274e1..a03464b4c019 100644
--- a/drivers/crypto/caam/caampkc.c
+++ b/drivers/crypto/caam/caampkc.c
@@ -816,7 +816,7 @@ static int caam_rsa_set_pub_key(struct crypto_akcipher *tfm, const void *key,
return ret;
/* Copy key in DMA zone */
- rsa_key->e = kzalloc(raw_key.e_sz, GFP_DMA | GFP_KERNEL);
+ rsa_key->e = kmemdup(raw_key.e, raw_key.e_sz, GFP_DMA | GFP_KERNEL);
if (!rsa_key->e)
goto err;
@@ -838,8 +838,6 @@ static int caam_rsa_set_pub_key(struct crypto_akcipher *tfm, const void *key,
rsa_key->e_sz = raw_key.e_sz;
rsa_key->n_sz = raw_key.n_sz;
- m...
2019 Jul 03
0
[PATCH v2 06/35] crypto: Use kmemdup rather than duplicating its implementation
...9 100644
> --- a/drivers/crypto/caam/caampkc.c
> +++ b/drivers/crypto/caam/caampkc.c
> @@ -816,7 +816,7 @@ static int caam_rsa_set_pub_key(struct crypto_akcipher *tfm, const void *key,
> return ret;
>
> /* Copy key in DMA zone */
> - rsa_key->e = kzalloc(raw_key.e_sz, GFP_DMA | GFP_KERNEL);
> + rsa_key->e = kmemdup(raw_key.e, raw_key.e_sz, GFP_DMA | GFP_KERNEL);
> if (!rsa_key->e)
> goto err;
>
> @@ -838,8 +838,6 @@ static int caam_rsa_set_pub_key(struct crypto_akcipher *tfm, const void *key,
> rsa_key->e_sz = raw_key.e_sz;
> rsa...
2014 Dec 09
2
[PATCH v3 3/6] virtio: allow finalize_features to fail
..._ccw_finalize_features(struct virtio_device *vdev)
> {
> struct virtio_ccw_device *vcdev = to_vc_device(vdev);
> struct virtio_feature_desc *features;
> @@ -760,7 +760,7 @@ static void virtio_ccw_finalize_features(struct virtio_device *vdev)
>
> ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL);
> if (!ccw)
> - return;
> + return 0;
I think we'll want to return an error in this case as well to fail
probing. Also for the other places where something can go wrong.
Something like this:
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c...
2014 Dec 09
2
[PATCH v3 3/6] virtio: allow finalize_features to fail
..._ccw_finalize_features(struct virtio_device *vdev)
> {
> struct virtio_ccw_device *vcdev = to_vc_device(vdev);
> struct virtio_feature_desc *features;
> @@ -760,7 +760,7 @@ static void virtio_ccw_finalize_features(struct virtio_device *vdev)
>
> ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL);
> if (!ccw)
> - return;
> + return 0;
I think we'll want to return an error in this case as well to fail
probing. Also for the other places where something can go wrong.
Something like this:
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c...
2020 Apr 13
0
[PATCH 2/2] crypto: Remove unnecessary memzero_explicit()
...key,
dev_dbg(ce->dev, "ERROR: Invalid keylen %u\n", keylen);
return -EINVAL;
}
- if (op->key) {
- memzero_explicit(op->key, op->keylen);
- kfree(op->key);
- }
+ kfree_sensitive(op->key);
op->keylen = keylen;
op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA);
if (!op->key)
@@ -416,10 +410,7 @@ int sun8i_ce_des3_setkey(struct crypto_skcipher *tfm, const u8 *key,
if (err)
return err;
- if (op->key) {
- memzero_explicit(op->key, op->keylen);
- kfree(op->key);
- }
+ free_sensitive(op->key, op->keylen);
op->keylen = key...
2019 May 08
0
[PATCH 06/10] s390/cio: add basic protected virtualization support
...ebott at linux.ibm.com> wrote:
>
> On Fri, 26 Apr 2019, Halil Pasic wrote:
> > static struct ccw_device * io_subchannel_allocate_dev(struct subchannel *sch)
> > {
> [..]
> > + cdev->private = kzalloc(sizeof(struct ccw_device_private),
> > + GFP_KERNEL | GFP_DMA);
>
> Do we still need GFP_DMA here (since we now have cdev->private->dma_area)?
>
We probably do not. I kept it GFP_DMA to keep changes to the
minimum. Should changing this in your opinion be a part of this patch?
> > @@ -1062,6 +1082,14 @@ static int io_subchannel_probe(s...
2020 Apr 13
0
[PATCH v2 2/2] crypto: Remove unnecessary memzero_explicit()
...key,
dev_dbg(ce->dev, "ERROR: Invalid keylen %u\n", keylen);
return -EINVAL;
}
- if (op->key) {
- memzero_explicit(op->key, op->keylen);
- kfree(op->key);
- }
- op->keylen = keylen;
+ kfree_sensitive(op->key);
op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA);
if (!op->key)
return -ENOMEM;
+ op->keylen = keylen;
crypto_sync_skcipher_clear_flags(op->fallback_tfm, CRYPTO_TFM_REQ_MASK);
crypto_sync_skcipher_set_flags(op->fallback_tfm, tfm->base.crt_flags & CRYPTO_TFM_REQ_MASK);
@@ -416,14 +410,11 @@ int sun8i_ce_des3_setkey(s...
2020 Apr 14
3
[PATCH v2 2/2] crypto: Remove unnecessary memzero_explicit()
...keylen %u\n", keylen);
> return -EINVAL;
> }
> - if (op->key) {
> - memzero_explicit(op->key, op->keylen);
> - kfree(op->key);
> - }
> - op->keylen = keylen;
> + kfree_sensitive(op->key);
> op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA);
> if (!op->key)
> return -ENOMEM;
> + op->keylen = keylen;
Does it matter at all to ensure op->keylen is not set when of->key is
NULL ? I'm not sure.
But if it does, then op->keylen should be set to 0 when freeing op->key.
>
> crypto_sync_skci...
2020 Apr 14
3
[PATCH v2 2/2] crypto: Remove unnecessary memzero_explicit()
...keylen %u\n", keylen);
> return -EINVAL;
> }
> - if (op->key) {
> - memzero_explicit(op->key, op->keylen);
> - kfree(op->key);
> - }
> - op->keylen = keylen;
> + kfree_sensitive(op->key);
> op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA);
> if (!op->key)
> return -ENOMEM;
> + op->keylen = keylen;
Does it matter at all to ensure op->keylen is not set when of->key is
NULL ? I'm not sure.
But if it does, then op->keylen should be set to 0 when freeing op->key.
>
> crypto_sync_skci...
2019 May 25
1
[PATCH v2 3/8] s390/cio: add basic protected virtualization support
...e * io_subchannel_allocate_dev(struct subchannel *sch)
> {
> struct ccw_device *cdev;
> + struct gen_pool *dma_pool;
>
> cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
> - if (cdev) {
> - cdev->private = kzalloc(sizeof(struct ccw_device_private),
> - GFP_KERNEL | GFP_DMA);
> - if (cdev->private)
> - return cdev;
> - }
> + if (!cdev)
> + goto err_cdev;
> + cdev->private = kzalloc(sizeof(struct ccw_device_private),
> + GFP_KERNEL | GFP_DMA);
> + if (!cdev->private)
> + goto err_priv;
> + cdev->dev.coherent_dma_mask =...