[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcfYuDAO-1e0VHOmeudS2dDti1FM8+N+gNVEux-D8PMUQ@mail.gmail.com>
Date: Sat, 27 May 2017 18:32:48 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: "Du, Changbin" <changbin.du@...el.com>
Cc: "linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [Q] What about PCI mmio access alignment?
On Thu, May 25, 2017 at 1:12 PM, Du, Changbin <changbin.du@...el.com> wrote:
> I have a basic quesion about the alignment when access PCI bar mmio space. Is
> the address accessed must be DW aligned and count must be DW aligned?
I guess the best answer is PCI architecture specification.
Book I have nearby tells me IIDnMS that yes, you have to follow alignment.
> As far as I know, The address field of TLB ignore lower 2 bits and the unit of
> length field also is DW. So does it mean above question is Yes? Else will CPU
> handle unaligned access for mmio space?
Here you perhaps meant the bus, not the CPU. PCI allows it as long as
actual device allows it.
(I recall patch series that tries to micro optimize PCI config space
access by grouping some bytes into words or even dwords, and it was
rejected).
> I want to know wether below access illegal or not:
> - readb(bar0)
> - readb(bar0 + 1)
> - readl(bar0)
It depends.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists