lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 15 Jul 2019 18:45:51 -0700
From:   Andrey Smirnov <andrew.smirnov@...il.com>
To:     linux-crypto@...r.kernel.org
Cc:     Chris Spencer <christopher.spencer@....co.uk>,
        Cory Tusar <cory.tusar@....aero>,
        Chris Healy <cphealy@...il.com>,
        Lucas Stach <l.stach@...gutronix.de>,
        Horia Geantă <horia.geanta@....com>,
        Aymen Sghaier <aymen.sghaier@....com>,
        Leonard Crestez <leonard.crestez@....com>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 11/14] crypto: caam - don't hardcode inpentry size

On Mon, Jul 15, 2019 at 1:20 PM Andrey Smirnov <andrew.smirnov@...il.com> wrote:
>
> Using dma_addr_t for elements of JobR input ring is not appropriate on
> all 64-bit SoCs, some of which, like i.MX8MQ, use only 32-bit wide
> pointers there. Convert all of the code to use explicit helper
> function that can be later extended to support i.MX8MQ. No functional
> change intended.
>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@...il.com>
> Cc: Chris Spencer <christopher.spencer@....co.uk>
> Cc: Cory Tusar <cory.tusar@....aero>
> Cc: Chris Healy <cphealy@...il.com>
> Cc: Lucas Stach <l.stach@...gutronix.de>
> Cc: Horia Geantă <horia.geanta@....com>
> Cc: Aymen Sghaier <aymen.sghaier@....com>
> Cc: Leonard Crestez <leonard.crestez@....com>
> Cc: linux-crypto@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> ---
>  drivers/crypto/caam/intern.h | 3 ++-
>  drivers/crypto/caam/jr.c     | 2 +-
>  drivers/crypto/caam/regs.h   | 9 +++++++++
>  3 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/crypto/caam/intern.h b/drivers/crypto/caam/intern.h
> index 081805c0f88b..c00c7c84ec84 100644
> --- a/drivers/crypto/caam/intern.h
> +++ b/drivers/crypto/caam/intern.h
> @@ -55,7 +55,8 @@ struct caam_drv_private_jr {
>         spinlock_t inplock ____cacheline_aligned; /* Input ring index lock */
>         u32 inpring_avail;      /* Number of free entries in input ring */
>         int head;                       /* entinfo (s/w ring) head index */
> -       dma_addr_t *inpring;    /* Base of input ring, alloc DMA-safe */
> +       void *inpring;                  /* Base of input ring, alloc
> +                                        * DMA-safe */
>         int out_ring_read_index;        /* Output index "tail" */
>         int tail;                       /* entinfo (s/w ring) tail index */
>         void *outring;                  /* Base of output ring, DMA-safe */
> diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
> index 138f71adb7e6..4f06cc7eb6a4 100644
> --- a/drivers/crypto/caam/jr.c
> +++ b/drivers/crypto/caam/jr.c
> @@ -388,7 +388,7 @@ int caam_jr_enqueue(struct device *dev, u32 *desc,
>         head_entry->cbkarg = areq;
>         head_entry->desc_addr_dma = desc_dma;
>
> -       jrp->inpring[head] = cpu_to_caam_dma(desc_dma);
> +       jr_inpentry_set(jrp->inpring, head, cpu_to_caam_dma(desc_dma));
>
>         /*
>          * Guarantee that the descriptor's DMA address has been written to
> diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h
> index 0cc4a48dfc30..ec49f5ba9689 100644
> --- a/drivers/crypto/caam/regs.h
> +++ b/drivers/crypto/caam/regs.h
> @@ -244,6 +244,15 @@ static inline u32 jr_outentry_jrstatus(void *outring, int hw_idx)
>         return jrstatus;
>  }
>
> +static inline void jr_inpentry_set(void *inpring, int hw_idx, dma_addr_t val)
> +{
> +       dma_addr_t *inpentry = inpring;
> +
> +       inpentry[hw_idx] = val;
> +}
> +
> +#define SIZEOF_JR_INPENTRY     caam_ptr_sz
> +

Looks like I've lost the hunk actually using SIZEOF_JR_INPENTRY in v5.
Sorry about that. Will fix and resubmit v6 shortly.

Thanks,
Andrey Smirnov

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ