Re: [PATCH v7 5/9] PCI: Add pci_iomap_wc() variants

From: Benjamin Herrenschmidt
Date: Wed Jun 24 2015 - 20:54:11 EST


On Thu, 2015-06-25 at 02:08 +0200, Luis R. Rodriguez wrote:
>
> OK thanks I'll proceed with these patches then.
>
> > As for user mappings,
>
> Which APIs were you considering in this regard BTW?

mmap of the generic /sys/bus/pci/.../resource*

> > maybe the right thing to do is to let us do what we do by
> > default with a quirk that can set a flag in pci_dev to disable that
> > behaviour (maybe on a per BAR basis ?).
>
> That might mean it could restrict userspace WC to require devices
> to have WC parts on a full PCI BAR. Although this is restrictive
> having reviewed most WC uses in the kernel I'd think this would be
> a fair compromise to make, but again, if things are still murky
> perhaps best we kiss this idea good bye for now and hope for it
> to come in on future buses or ammendments (if that's even possible?).
>
> > I think the common case is that WC works.
>
> If WC does not I will note one hack which migh be worth mentioning --
> just for
> the record, this was devised as a shortcoming of a device where they
> failed to
> split things properly and that *without* WC performance suffered quite
> a bit so
> they made one full PCI BAR WC and as a work around this:
>
> http://lkml.kernel.org/r/20150416041837.GA5712@hykim-PC
>
> That is for registers that needed it:
>
> write; wmb;
>
> Then if they wanted to wait till the NIC has seen the write, they did:
>
> write; wmb; read;
>

Right, and as I mentioned, on some archs like powerpc (and possibly
more), writel() and co contains an implicit mb()

> Luis--


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/