netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: sshah@solarflare.com
Cc: netdev@vger.kernel.org, linux-net-drivers@solarflare.com
Subject: Re: [PATCH net v3 1/2] sfc: use 64-bit writes for PIO.
Date: Sun, 01 Jun 2014 22:25:34 -0700 (PDT)	[thread overview]
Message-ID: <20140601.222534.1375636710740653884.davem@davemloft.net> (raw)
In-Reply-To: <538709E6.7080108@solarflare.com>

From: Shradha Shah <sshah@solarflare.com>
Date: Thu, 29 May 2014 11:20:22 +0100

> +/* Copy in explicit 64-bit writes. */
> +static void efx_memcpy_64(void *dest, void *src, size_t len)
> +{
> +	uint64_t *src64 = src, *dest64 = dest;
> +	size_t i, l64 = len / 8;
> +
> +	WARN_ON_ONCE(len % 8 != 0);
> +	WARN_ON_ONCE(((u8 *)dest - (u8 *)0) % 8 != 0);
> +	BUILD_BUG_ON(sizeof(uint64_t) != 8);
> +
> +	for(i = 0; i < l64; ++i)
> +		dest64[i] = src64[i];
> +}

You absolutely, positively, cannot do this.

I/O memory pointers aren't pointers, they are opaque addresses, sparse
should have given you a loud warning about this.

On some platforms they are physical addresses, or some other special
value.

Therefore you cannot directly dereference them.

You _must_ use the io.h accessors.

  reply	other threads:[~2014-06-02  5:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-29 10:18 [PATCH net v3 0/2] sfc: Restrict PIO for 64bit arch in order to avoid data corruption Shradha Shah
2014-05-29 10:20 ` [PATCH net v3 1/2] sfc: use 64-bit writes for PIO Shradha Shah
2014-06-02  5:25   ` David Miller [this message]
2014-05-29 10:20 ` [PATCH net v3 2/2] sfc: Restrict PIO to 64-bit architectures Shradha Shah

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=20140601.222534.1375636710740653884.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=linux-net-drivers@solarflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=sshah@solarflare.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).