All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Cyril Bur <cyrilbur@gmail.com>,
	jk@ozlabs.org, andrew@aj.id.au, openbmc@lists.ozlabs.org,
	joel@jms.id.au
Subject: Re: [PATCH v2] drivers/misc: Add ASpeed LPC control driver
Date: Mon, 16 Jan 2017 07:34:30 -0600	[thread overview]
Message-ID: <1484573670.11927.35.camel@kernel.crashing.org> (raw)
In-Reply-To: <20170116104537.GA29148@kroah.com>

On Mon, 2017-01-16 at 11:45 +0100, Greg KH wrote:
> For an ioctl structure like this, can you guarantee that the "padding"
> will always be the same?  Last time I looked, the C standard didn't say
> anything about that, so I would strongly recommend making it so that no
> padding is needed at all...

The implicit padding is a matter of ABI more than C standard, we
already rely on this in a bazillion of places but it *has* bitten us in
a few corner cases (mostly when u64 is involved due to ABI differences
between 32-bit and 64-bit), so explicit padding is indeed preferred.

Cyril can you respin with:

	struct aspeed_lpc_ctrl_mapping {
		__u8    window_type;
		__u8    window_id;
		__u16   pad;
		__u32   addr;
		__u32   offset;
		__u32   size;

I prefer that, it makes more sense to keep the window type/id at the
top. Alternatively call "pad", "flags", and describe that clients must
zero it, that way we can use it for future extensions of we ever have
to.

Also for mmap, you have:

       /* AHB accesses are not cache coherent */
       if (file->f_flags & O_DSYNC)
               prot = pgprot_noncached(prot);

Why the test for O_DSYNC ? I'd rather not make this a userspace
responsibility to get right... I'd have made it unconditional.

I notice ARM has pgprot_dmacoherent() that might just do what we want
here, ie, non-cachable if needed. Otherwise, I'd just unconditionally
set it to noncached, we can revisit that if Aspeed ever comes up with a
coherent SoC which I very much doubt but ...

Cheers,
Ben.

  reply	other threads:[~2017-01-16 13:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-13  7:47 [PATCH v2] drivers/misc: Add ASpeed LPC control driver Cyril Bur
2017-01-13 10:36 ` Greg KH
2017-01-15 22:43   ` Cyril Bur
2017-01-16  4:45     ` Benjamin Herrenschmidt
2017-01-16 10:45       ` Greg KH
2017-01-16 13:34         ` Benjamin Herrenschmidt [this message]
2017-01-18 22:47           ` Cyril Bur

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=1484573670.11927.35.camel@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=andrew@aj.id.au \
    --cc=cyrilbur@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jk@ozlabs.org \
    --cc=joel@jms.id.au \
    --cc=openbmc@lists.ozlabs.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.