Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1651900

Re: [Q] What about PCI mmio access alignment?

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [Q] What about PCI mmio access alignment?
Date Sat, 27 May 2017 17:40:01 +0200
Message-ID <tLLYR-5OD-1@gated-at.bofh.it> (permalink)
References <tKY26-6Uq-5@gated-at.bofh.it>
X-Original-To "Du, Changbin" <changbin.du@intel.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=07oQ4ZSzCdw8VoFS85pWGfAL+tprbBicrQ3DAAdxNJU=; b=Chm6tonEqiMfC9gqwQ0WYKcdU93TU1JGaYFVJcchYYlZiMwMUndHJtI6rs2Rzv29Pi Ssm0J99nFCHHNmLq2RP8EbrHwwahJuWuQqaWwYpHmhkztHiqrFwivTnudthQQgygiyrv SL73AWUl/OC6D6Wif+Z8NZHOncwUVSemUQG3FleEzvvPdMIebvI/h56ctplhwEdoRRwN GrSqvMcV4yQPV/1ELUOlm2/c9QZ1pq1AdHEHdOhF8HRc3eIG2ag1xmnSOr+0qB9GULR3 SQjJEAdNQUE793bYovOWZzH3H6hkPnXSyVzON9WKuNrNDF+B5cpk6sbCTXFFjh30UNKS O4aQ==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=07oQ4ZSzCdw8VoFS85pWGfAL+tprbBicrQ3DAAdxNJU=; b=gBHEyjNg+fJGUpBcLinCZXy1j6SQVbqLx35/DR7I4B1bySk9i7LyKlx7chKMaEo9V4 wjOrivzIekxuJgjpVYJg/bnL0lzHLMzJ19M5xW6KJzlcbgMqd/IREZSLDXhxFiqLYBUs ifsBioAzkP5/aUIo5H96BKExhWj1JksU8grbOGiiKvxSZS4CDAVGA44RNfS34ukL1nfV uG30Ly/UZM52yvfSMReIucdk4tcDk3Kvvki8OR7Ne129LCpZCU4f1RG69HKvS3xklgWn XbshBqERpW9VV/XrIEtJ+MIybzqmoz4tuylHf37ty1he2Z21uIIy7zBP9xx+4NQ5Xru+ kl2w==
X-Gm-Message-State AODbwcB2m+CdP7AIEcttUnTfSSnLfxAAYRUHVY8mzG8ZVM3VcJ7kL4+E IwEuozqGP7WAhPW4mQsVJz9KEBLBlVZGfGo=
X-Received by 10.237.33.183 with SMTP id l52mr8661267qtc.165.1495899168674; Sat, 27 May 2017 08:32:48 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset="UTF-8"
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 28
Organization linux.* mail to news gateway
X-Original-Cc "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
X-Original-Date Sat, 27 May 2017 18:32:48 +0300
X-Original-Message-ID <CAHp75VcfYuDAO-1e0VHOmeudS2dDti1FM8+N+gNVEux-D8PMUQ@mail.gmail.com>
X-Original-References <20170525101256.GA12183@intel.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1651900

Show key headers only | View raw


On Thu, May 25, 2017 at 1:12 PM, Du, Changbin <changbin.du@intel.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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[Q] What about PCI mmio access alignment? "Du, Changbin" <changbin.du@intel.com> - 2017-05-25 12:20 +0200
  Re: [Q] What about PCI mmio access alignment? Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-05-27 17:40 +0200
    Re: [Q] What about PCI mmio access alignment? "Du, Changbin" <changbin.du@intel.com> - 2017-05-28 13:00 +0200

csiph-web