LKML Archive on
 help / color / Atom feed
From: Arnd Bergmann <>
To: Andy Shevchenko <>
Cc: "Michael S. Tsirkin" <>,
	"" <>,
	"" <>,
	"" <>,
	"" <>
Subject: Re: sparse warnings in vop
Date: Sun, 2 Aug 2020 12:48:33 +0200
Message-ID: <> (raw)
In-Reply-To: <>

On Sun, Aug 2, 2020 at 9:25 AM Andy Shevchenko
<> wrote:
> On Sunday, August 2, 2020, Michael S. Tsirkin <> wrote:
>> Hi!
>> Building vop with make C=1 produces the following:
>> CHECK   drivers/misc/mic/vop/vop_main.c
>> drivers/misc/mic/vop/vop_main.c:551:58: warning: incorrect type in argument 1 (different address spaces)
>> drivers/misc/mic/vop/vop_main.c:551:58:    expected void const volatile [noderef] __iomem *addr
>> drivers/misc/mic/vop/vop_main.c:551:58:    got restricted __le64 *
>> drivers/misc/mic/vop/vop_main.c:560:49: warning: incorrect type in argument 1 (different address spaces)
>> drivers/misc/mic/vop/vop_main.c:560:49:    expected struct mic_device_ctrl *dc
>> drivers/misc/mic/vop/vop_main.c:560:49:    got struct mic_device_ctrl [noderef] __iomem *dc
>> drivers/misc/mic/vop/vop_main.c:579:49: warning: incorrect type in argument 1 (different address spaces)
>> drivers/misc/mic/vop/vop_main.c:579:49:    expected struct mic_device_ctrl *dc
>> drivers/misc/mic/vop/vop_main.c:579:49:    got struct mic_device_ctrl [noderef] __iomem *dc
>> Would be nice to fix to silence the noise, but I'm not 100% sure
>> what the right thing to do here is. Tag struct members with __iomem or
>> cast with __force on use?
> Sounds right to me.

I don't think either of the above, adding __force is almost always wrong,
and __iomem never applies to struct members, only to pointers.

The first problem I see is with:

static struct _vop_vdev *vop_dc_to_vdev(struct mic_device_ctrl *dc)

The argument needs to be an __iomem pointer. In the structure, the
first member has type __le64, which gets mentioned in the warning.
We usually use __u64 instead (or don't use structures at all for __iomem
operations), but I don't think this would cause a warning if the argument
is fixed.

Then there is the question of why in the world you would have an MMIO
register contain a kernel pointer, but that is more a driver design question
than something that causes a warning.


  parent reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-02  4:57 Michael S. Tsirkin
     [not found] ` <>
2020-08-02 10:48   ` Arnd Bergmann [this message]
2020-08-02 23:31     ` Dixit, Ashutosh

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:

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

  git send-email \
    --in-reply-to='' \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on

Archives are clonable:
	git clone --mirror lkml/git/0.git
	git clone --mirror lkml/git/1.git
	git clone --mirror lkml/git/2.git
	git clone --mirror lkml/git/3.git
	git clone --mirror lkml/git/4.git
	git clone --mirror lkml/git/5.git
	git clone --mirror lkml/git/6.git
	git clone --mirror lkml/git/7.git
	git clone --mirror lkml/git/8.git
	git clone --mirror lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ \
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone