From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
LAKML <linux-arm-kernel@lists.infradead.org>,
Linux PCI <linux-pci@vger.kernel.org>
Subject: Re: [PATCH RFC 2/2] arm: kernel: fix pci_mmap_page_range() offset calculation
Date: Thu, 16 Oct 2014 11:24:45 +0100 [thread overview]
Message-ID: <20141016102445.GA28187@red-moon> (raw)
In-Reply-To: <20141015222932.GL27405@n2100.arm.linux.org.uk>
Hi Russell,
thanks for having a look.
On Wed, Oct 15, 2014 at 11:29:32PM +0100, Russell King - ARM Linux wrote:
> On Wed, Oct 15, 2014 at 01:03:41PM +0100, Lorenzo Pieralisi wrote:
> > ARM relies on the standard implementation of pci_resource_to_user()
> > which actually is an identity map and exports to user space
> > PCI memory resources as they are stored in PCI devices resources (ie BARs)
> > which represent CPU physical addresses (fixed-up using BUS to CPU
> > address conversions) not PCI bus addresses.
>
> This paragraph seems wrong.
>
> It first says that PCI memory resources contain the same values that the
> PCI device has in its BAR. It then goes on to say that they are CPU
> physical addresses. That is not true.
>
> For example, DC21285 systems always have done this as: the PCI bars
> contain the _bus_ addresses, which tend to be in the range 0 to
> 0x7fffffff. These correspond with a CPU physical address of
> 0x80000000 to 0xffffffff. The PCI bus resources for IOMEM resources
> contains the CPU physical address of the mapping.
It is a commit log wording problem, I exactly meant what you said, I
will reword it (or remove "ie BARs" from it, since it is misleading).
I think that the word "BAR" is a bit misused in helpers function like:
pci_resource_{start/end/len}
too but as long as we all know what that means (and I write proper
commit logs :)) it is all fine.
> > On platforms where the mapping between CPU and BUS address is not a 1:1
> > mapping this is erroneous, in that an additional shift is applied to
> > an already fixed-up offset passed from userspace.
>
> Yes, I think this is a correct patch inspite of the description. :)
Great, I will reword it and wait for comments on patch 1 that changes
pci_mmap_fits() (it does not affect ARM, but would like to get both changes
in coherently - ie if I am asked to change patch 1 I will probably have
to change this patch too).
Thanks,
Lorenzo
WARNING: multiple messages have this Message-ID (diff)
From: lorenzo.pieralisi@arm.com (Lorenzo Pieralisi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC 2/2] arm: kernel: fix pci_mmap_page_range() offset calculation
Date: Thu, 16 Oct 2014 11:24:45 +0100 [thread overview]
Message-ID: <20141016102445.GA28187@red-moon> (raw)
In-Reply-To: <20141015222932.GL27405@n2100.arm.linux.org.uk>
Hi Russell,
thanks for having a look.
On Wed, Oct 15, 2014 at 11:29:32PM +0100, Russell King - ARM Linux wrote:
> On Wed, Oct 15, 2014 at 01:03:41PM +0100, Lorenzo Pieralisi wrote:
> > ARM relies on the standard implementation of pci_resource_to_user()
> > which actually is an identity map and exports to user space
> > PCI memory resources as they are stored in PCI devices resources (ie BARs)
> > which represent CPU physical addresses (fixed-up using BUS to CPU
> > address conversions) not PCI bus addresses.
>
> This paragraph seems wrong.
>
> It first says that PCI memory resources contain the same values that the
> PCI device has in its BAR. It then goes on to say that they are CPU
> physical addresses. That is not true.
>
> For example, DC21285 systems always have done this as: the PCI bars
> contain the _bus_ addresses, which tend to be in the range 0 to
> 0x7fffffff. These correspond with a CPU physical address of
> 0x80000000 to 0xffffffff. The PCI bus resources for IOMEM resources
> contains the CPU physical address of the mapping.
It is a commit log wording problem, I exactly meant what you said, I
will reword it (or remove "ie BARs" from it, since it is misleading).
I think that the word "BAR" is a bit misused in helpers function like:
pci_resource_{start/end/len}
too but as long as we all know what that means (and I write proper
commit logs :)) it is all fine.
> > On platforms where the mapping between CPU and BUS address is not a 1:1
> > mapping this is erroneous, in that an additional shift is applied to
> > an already fixed-up offset passed from userspace.
>
> Yes, I think this is a correct patch inspite of the description. :)
Great, I will reword it and wait for comments on patch 1 that changes
pci_mmap_fits() (it does not affect ARM, but would like to get both changes
in coherently - ie if I am asked to change patch 1 I will probably have
to change this patch too).
Thanks,
Lorenzo
next prev parent reply other threads:[~2014-10-16 10:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-15 12:03 [PATCH RFC 1/2] drivers: pci: fix pci_mmap_fits() implementation for procfs mmap Lorenzo Pieralisi
2014-10-15 12:03 ` Lorenzo Pieralisi
2014-10-15 12:03 ` [PATCH RFC 2/2] arm: kernel: fix pci_mmap_page_range() offset calculation Lorenzo Pieralisi
2014-10-15 12:03 ` Lorenzo Pieralisi
2014-10-15 12:03 ` Lorenzo Pieralisi
2014-10-15 22:29 ` Russell King - ARM Linux
2014-10-15 22:29 ` Russell King - ARM Linux
2014-10-16 10:24 ` Lorenzo Pieralisi [this message]
2014-10-16 10:24 ` Lorenzo Pieralisi
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=20141016102445.GA28187@red-moon \
--to=lorenzo.pieralisi@arm.com \
--cc=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
/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.