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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VexiWMT+cW2nBm0DL8Hs6xOa5F9dBJuPCzLdt4PkSr9Yg@mail.gmail.com>
Date:   Sat, 27 May 2017 19:08:34 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Mika Westerberg <mika.westerberg@...ux.intel.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Andreas Noever <andreas.noever@...il.com>,
        Michael Jamet <michael.jamet@...el.com>,
        Yehezkel Bernat <yehezkel.bernat@...el.com>,
        Lukas Wunner <lukas@...ner.de>,
        Amir Levy <amir.jer.levy@...el.com>,
        Andy Lutomirski <luto@...nel.org>,
        Mario Limonciello <Mario.Limonciello@...l.com>,
        Jared.Dominguez@...l.com,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 22/27] thunderbolt: Add support for DMA configuration
 based mailbox

On Fri, May 26, 2017 at 7:09 PM, Mika Westerberg
<mika.westerberg@...ux.intel.com> wrote:
> The DMA (NHI) port of a switch provides access to the NVM of the host
> controller (and devices starting from Intel Alpine Ridge). The NVM
> contains also more complete DROM for the root switch including vendor
> and device identification strings.

> +               ret = dma_port_flash_read_block(dma, address, dma->buf,
> +                                               ALIGN(nbytes, 4));
> +               if (ret) {
> +                       if (ret == -ETIMEDOUT) {
> +                               if (retries--)
> +                                       continue;
> +                               ret = -EIO;
> +                       }
> +                       return ret;
> +               }
> +
> +               memcpy(buf, dma->buf + offset, nbytes);

> +       do {
> +               u32 nbytes = min_t(u32, size, MAIL_DATA_DWORDS * 4);
> +               int ret;
> +
> +               memcpy(dma->buf + offset, buf, nbytes);
> +
> +               ret = dma_port_flash_write_block(dma, address, buf, nbytes);
> +               if (ret) {
> +                       if (ret == -ETIMEDOUT) {
> +                               if (retries--)
> +                                       continue;
> +                               ret = -EIO;
> +                       }
> +                       return ret;
> +               }

Just to be sure I didn't miss anything.
Can't we just map buffer into DMA capable address space instead of memcpy()'ing?

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ