All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Daney <ddaney@caviumnetworks.com>
To: Ulf Hansson <ulf.hansson@linaro.org>, Jan Glauber <jglauber@cavium.com>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Steven J . Hill" <Steven.Hill@cavium.com>,
	David Daney <david.daney@cavium.com>
Subject: Re: [PATCH v12 4/9] mmc: cavium: Work-around hardware bug on cn6xxx and cnf7xxx
Date: Mon, 20 Mar 2017 13:45:25 -0700	[thread overview]
Message-ID: <6dc8a2a3-ca79-745a-c716-2188319b9378@caviumnetworks.com> (raw)
In-Reply-To: <CAPDyKFrbAUoYk7h8XmYdwiyr8QZXA0WTyFVw3EVFQ8UK71cwOw@mail.gmail.com>

On 03/17/2017 07:13 AM, Ulf Hansson wrote:
> On 10 March 2017 at 14:25, Jan Glauber <jglauber@cavium.com> wrote:
>> Prevent data corruption on cn6xxx and cnf7xxx.
>> Due to an imperfection in the design of the MMC bus hardware,
>> the 2nd to last cache block of a DMA read must be locked into the L2
>> cache.
>>
[...]
>> +/**
>> + * Unlock a memory region in the L2 cache
>> + *
>> + * @start - start address to unlock
>> + * @len - length to unlock in bytes
>> + */
>> +void l2c_unlock_mem_region(u64 start, u64 len)
>> +{
>> +       u64 end;
>> +
>> +       /* Round start/end to cache line boundaries */
>> +       end = ALIGN(start + len - 1, CVMX_CACHE_LINE_SIZE);
>> +       start = ALIGN(start, CVMX_CACHE_LINE_SIZE);
>> +
>> +       while (start <= end) {
>> +               l2c_unlock_line(start);
>> +               start += CVMX_CACHE_LINE_SIZE;
>> +       }
>> +}
>> +EXPORT_SYMBOL_GPL(l2c_unlock_mem_region);
>
> It seems like we should be able to implement these functions in the
> octeon mmc driver, instead of having to export some SoC specific APIs.
> You only need to figure out how to find the correct CACHE_LINE_SIZE,
> but that should be possible to fix.

It doesn't matter which source file the code lives in.  If you are happy 
having it in drivers/mmc/host/cavium-pltfm-octeon.c (or whatever we end 
up calling the file), it could be put there.

CVMX_CACHE_LINE_SIZE == 128.  It will never change.


>
> My point is really that we should avoid exporting SoC specific APIs
> which shall be called from drivers. This is old fashion.

Some people find it objectionable to see 1-off architecture specific 
in-line asm in a driver file, but I agree that putting it as close to 
the user as possible makes sense.

David Daney

  parent reply	other threads:[~2017-03-20 20:45 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-10 13:24 [PATCH v12 0/9] Cavium MMC driver Jan Glauber
2017-03-10 13:24 ` [PATCH v12 1/9] dt-bindings: mmc: Add Cavium SOCs MMC bindings Jan Glauber
2017-03-17  8:31   ` Ulf Hansson
2017-03-17 10:51     ` Jan Glauber
2017-03-17 10:51       ` Jan Glauber
2017-03-10 13:25 ` [PATCH v12 2/9] mmc: cavium: Add core MMC driver for Cavium SOCs Jan Glauber
2017-03-17 11:24   ` Ulf Hansson
2017-03-17 13:34     ` Jan Glauber
2017-03-17 13:47       ` Ulf Hansson
2017-03-10 13:25 ` [PATCH v12 3/9] mmc: cavium: Add MMC platform driver for Octeon SOCs Jan Glauber
2017-03-17 13:35   ` Ulf Hansson
2017-03-20 14:40     ` Jan Glauber
2017-03-20 15:19       ` Ulf Hansson
2017-03-10 13:25 ` [PATCH v12 4/9] mmc: cavium: Work-around hardware bug on cn6xxx and cnf7xxx Jan Glauber
2017-03-17 14:13   ` Ulf Hansson
2017-03-20 20:34     ` Arnd Bergmann
2017-03-20 20:45     ` David Daney [this message]
2017-03-21  8:58       ` Arnd Bergmann
2017-03-21 15:19         ` David Daney
2017-03-21 19:49           ` Arnd Bergmann
2017-03-21 20:22             ` David Daney
2017-03-22 10:00               ` Jan Glauber
2017-03-10 13:25 ` [PATCH v12 5/9] mmc: cavium: Add support for Octeon cn7890 Jan Glauber
2017-03-10 13:25 ` [PATCH v12 6/9] mmc: cavium: Add MMC PCI driver for ThunderX SOCs Jan Glauber
2017-03-17 14:58   ` Ulf Hansson
2017-03-23  8:58     ` Jan Glauber
2017-03-23  9:28       ` Ulf Hansson
2017-03-23 17:41         ` David Daney
2017-03-10 13:25 ` [PATCH v12 7/9] mmc: cavium: Add scatter-gather DMA support Jan Glauber
2017-03-10 13:25 ` [PATCH v12 8/9] mmc: cavium: Support DDR mode for eMMC devices Jan Glauber
2017-03-10 13:25 ` [PATCH v12 9/9] MAINTAINERS: Add entry for Cavium MMC driver Jan Glauber
2017-03-15 15:57 ` [PATCH v12 0/9] " Arnd Bergmann
2017-03-15 16:20   ` Jan Glauber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6dc8a2a3-ca79-745a-c716-2188319b9378@caviumnetworks.com \
    --to=ddaney@caviumnetworks.com \
    --cc=Steven.Hill@cavium.com \
    --cc=david.daney@cavium.com \
    --cc=jglauber@cavium.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.