linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-mips@vger.kernel.org, chenhc@lemote.com, john.garry@huawei.com
Subject: Re: [PATCH RESEND v3 2/3] MIPS: Introduce PCI_IO_VMMAP
Date: Thu, 14 May 2020 22:56:41 +0800	[thread overview]
Message-ID: <8107C949-5CBE-48D3-837F-E0AFB9C58B77@flygoat.com> (raw)
In-Reply-To: <20200514142149.GA14003@alpha.franken.de>



于 2020年5月14日 GMT+08:00 下午10:21:49, Thomas Bogendoerfer <tsbogend@alpha.franken.de> 写到:
>On Sat, May 09, 2020 at 01:09:07AM +0800, Jiaxun Yang wrote:
>> 
>> 
>> 于 2020年5月9日 GMT+08:00 上午12:52:35, Thomas Bogendoerfer <tsbogend@alpha.franken.de> 写到:
>> >On Sat, May 09, 2020 at 12:22:25AM +0800, Jiaxun Yang wrote:
>> >> 
>> >> 
>> >> 于 2020年5月9日 GMT+08:00 上午12:11:02, Thomas Bogendoerfer <tsbogend@alpha.franken.de> 写到:
>> >> >On Fri, May 08, 2020 at 07:44:37PM +0800, Jiaxun Yang wrote:
>> >> >> Define PCI_IOBASE for MIPS at the strat of kernel mapping segment.
>> >> >> That would allow virt address of I/O ports to be dynamicly mapped.
>> >> >> So we'll be able to combine multiple MMIO ranges into I/O ports
>> >> >> and thus we can take advantage of logic_pio mechanism.
>> >> >
>> >> >What is the advantage ?
>> >> >
>> >> >From my point of view this will be slower because of TLB faults for
>> >> >PCI IO space accesses.
>> >> 
>> >> Advantage is we can use logic_pio to manage multiple I/O Port ranges.
>> >
>> >and what exactly does this buy us ? I looked at lib/logic_pio.c and
>> >there didn't appear anything in my mind other than yet another
>> >interface for doing the same thing...
>> 
>> With Logic_PIO subsystem, each I/O region will be registered
>> in logic_pio and being mapped in TLB, that means I/O regions can l
>> be sparsely layouted in MMIO.
>
>this isn't an advantage. You will get TLB miss exceptions, which you
>don't get when using XPHYS addresses, which the current code does.
>IMHO it you make more sense to use normal iomap/iounmap functions
>in logic_pio.c. With that you would get TLB less access for memory
>mapped PCI IO regions.
>
>> And device drivers are accessing in*/out* functions via ioport allocated by
>> logic_pio instead of the physical I/O ports.
>
>your current patches don't select INDIRECT_PIO, so you are still
>using the MIPS access methods just via the mapping from logic_pio. This
>works as long as you are using already mapped ranges. This is at least
>inconsistent.

Not exactly. I'm emulating the behaviour of Aarch64's PCI ioport handling.

And the mapping will done by pci_remap_iospace when adding resources
to PCI bridge.
PCI subsystem will ensure all the ioports they used is mapped so there won't be any inconsistent.
Except some legacy driver need to be converted.

Yeah, I was confused by logic_pio at very start and holded the same opinion
with you that it's totally misuse of MMIO ioports until John Garry
kindly explained [1] to me what it exactly did.

>
>If you really want to ignore the TLB miss problem, please drop
>patch 1 and 2 and use something like
>
>#define PCI_IOBASE	_AC(0xc000000000000000, UL)
>#define PCI_IOSIZE	SZ_16SM
>#define MAP_BASE	(PCI_IOBASE + PCI_IOSIZE)
>
>in arch/mips/include/asm/mach-loongson64/spaces.h
>
>That should do the trick without moving stuff around and it will
>keep it out of the normal MIPS stuff.

I do believe that similar to Aarch64 world, device with multiple PCIe
host bridge and sparsely layouted MMIO IOport range will appear very soon.

So I'm creating a general method for MIPS.
If that's inappropriate for you
I'll make it as Loongson only.

Thanks.

>
>Thomas.
>
[1]: https://lkml.org/lkml/2020/2/20/1207
-- 
Jiaxun Yang

  reply	other threads:[~2020-05-14 14:57 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-26 11:47 [PATCH 0/4] MIPS: Loongson64: Use logic_pio Jiaxun Yang
2020-04-26 11:47 ` [PATCH 1/4] MIPS: Massage address spaces headers Jiaxun Yang
2020-04-26 11:47 ` [PATCH 2/4] MIPS: Introduce PCI_IO_VMMAP Jiaxun Yang
2020-04-26 11:47 ` [PATCH 3/4] lib: logic_pio: Introduce MMIO_LOWER_RESERVED Jiaxun Yang
2020-04-27 10:43   ` John Garry
2020-04-27 11:03     ` Jiaxun Yang
2020-04-27 11:54       ` John Garry
2020-04-27 12:21         ` Jiaxun Yang
2020-04-26 11:47 ` [PATCH 4/4] MIPS: Loongson64: Enable PCI_IO_VMMAP Jiaxun Yang
2020-04-30  0:57 ` [PATCH v3 1/3] MIPS: Move VMALLOC_START into spaces.h Jiaxun Yang
2020-04-30  0:57   ` [PATCH v3 2/3] MIPS: Introduce PCI_IO_VMMAP Jiaxun Yang
2020-04-30  0:57   ` [PATCH v3 3/3] MIPS: Loongson64: Enable PCI_IO_VMMAP Jiaxun Yang
2020-05-08 11:44 ` [PATCH RESEND v3 1/3] MIPS: Move VMALLOC_START into spaces.h Jiaxun Yang
2020-05-08 11:44   ` [PATCH RESEND v3 2/3] MIPS: Introduce PCI_IO_VMMAP Jiaxun Yang
2020-05-08 16:11     ` Thomas Bogendoerfer
2020-05-08 16:22       ` Jiaxun Yang
2020-05-08 16:52         ` Thomas Bogendoerfer
2020-05-08 17:09           ` Jiaxun Yang
2020-05-14 14:21             ` Thomas Bogendoerfer
2020-05-14 14:56               ` Jiaxun Yang [this message]
2020-05-14 13:20     ` Jiaxun Yang
2020-05-08 11:44   ` [PATCH RESEND v3 3/3] MIPS: Loongson64: Enable PCI_IO_VMMAP Jiaxun Yang
2021-01-13 18:02     ` logical PIO code for mips question (was Re: [PATCH RESEND v3 3/3] MIPS: Loongson64: Enable PCI_IO_VMMAP) John Garry
2021-01-14  0:13       ` Jiaxun Yang
2021-01-14  9:18         ` John Garry
2021-01-14 11:10           ` Jiaxun Yang
2021-01-14 11:20             ` John Garry

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=8107C949-5CBE-48D3-837F-E0AFB9C58B77@flygoat.com \
    --to=jiaxun.yang@flygoat.com \
    --cc=chenhc@lemote.com \
    --cc=john.garry@huawei.com \
    --cc=linux-mips@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).