linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gabriele Paoloni <gabriele.paoloni@huawei.com>
To: "minyard@acm.org" <minyard@acm.org>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"will.deacon@arm.com" <will.deacon@arm.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"frowand.list@gmail.com" <frowand.list@gmail.com>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"rafael@kernel.org" <rafael@kernel.org>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"lorenzo.pieralisi@arm.com" <lorenzo.pieralisi@arm.com>
Cc: "mark.rutland@arm.com" <mark.rutland@arm.com>,
	"brian.starkey@arm.com" <brian.starkey@arm.com>,
	"olof@lixom.net" <olof@lixom.net>,
	"benh@kernel.crashing.org" <benh@kernel.crashing.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	Linuxarm <linuxarm@huawei.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	John Garry <john.garry@huawei.com>,
	"xuwei (O)" <xuwei5@hisilicon.com>,
	"zhichang.yuan" <yuanzhichang@hisilicon.com>
Subject: RE: [PATCH v10 1/9] LIB: Introduce a generic PIO mapping method
Date: Mon, 30 Oct 2017 15:31:21 +0000	[thread overview]
Message-ID: <EE11001F9E5DDD47B7634E2F8A612F2E40CAED4C@FRAEML521-MBX.china.huawei.com> (raw)
In-Reply-To: <49ac8217-1e89-bb4a-8592-9d57039f792c@acm.org>

Hi Corey

Many Thanks for your comments

[...]

> >   #define IO_SPACE_LIMIT 0xffff
> >   #endif
> >
> > +#include <linux/logic_pio.h>
> 
> This whole thing would be a lot simpler if you had:
> 
> #ifdef CONFIG_INDIRECT_PIO
> #define inb logic_inb
> #define outb logic outb
> .
> .
> #endif /* CONFIG_INDIRECT_PIO */
> 
> and let the "ifndef XXX" below handle not enabling the standard code.
> You could even put that in logic_pio.h to avoid polluting io.h.

Agreed. I'll move it into "logic_pio.h"

> 
> You might have to add "#ifndef inb", etc. above, but I still think it
> would
> be better.

Yes agreed also on adding the "#ifndef ***" around each function re-definition
in logic_pio.h

This will be fixed in v11

> 
> I'm not sure if this wouldn't be better done in arm64/include/asm/io.h,
> though.
> A specific machine may want to only do this in ranges, for instance.

No I don’t think so...this io functions re-0definition has nothing to do
with ARM architecture and I think it is better to keep everything in
logic_pio.h including the file from "include/asm-generic/io.h"

Cheers
Gab

> 
> -corey

[...]

> > --- a/lib/Kconfig
> > +++ b/lib/Kconfig
> > @@ -59,6 +59,32 @@ config ARCH_USE_CMPXCHG_LOCKREF
> >   config ARCH_HAS_FAST_MULTIPLIER
> >   	bool
> >
> > +config LOGIC_PIO
> > +	bool "Generic logical I/O management"
> > +	def_bool y if PCI && !X86 && !IA64 && !POWERPC
> > +	help
> > +	  For some architectures, there are no IO space. To support the
> > +	  accesses to legacy I/O devices on those architectures, kernel
> > +	  implemented the memory mapped I/O mechanism based on bridge bus
> > +	  supports. But for some buses which do not support MMIO, the
> > +	  peripherals there should be accessed with device-specific way.
> > +	  To abstract those different I/O accesses into unified I/O
> accessors,
> > +	  this option provide a generic I/O space management way after
> mapping
> > +	  the device I/O to system logical/fake I/O and help to hide all
> the
> > +	  hardware detail.
> > +
> > +config INDIRECT_PIO
> > +	bool "Access I/O in non-MMIO mode" if LOGIC_PIO
> > +	help
> > +	  On some platforms where no separate I/O space exist, there are
> I/O
> > +	  hosts which can not be accessed in MMIO mode. Based on
> LOGIC_PIO
> > +	  mechanism, the host-local I/O resource can be mapped into
> system
> > +	  logic PIO space shared with MMIO hosts, such as PCI/PCIE, then
> system
> > +	  can access the I/O devices with the mapped logic PIO through
> I/O
> > +	  accessors.
> > +	  This way has a little I/O performance cost. Please make sure
> your
> > +	  devices really need this configure item enabled.
> > +
> 
> If this is always available on the hisilicon chips, I think you would
> want to just always
> enable this on those chips.

In patch 6/9 we have 

+config HISILICON_LPC
+	bool "Support for ISA I/O space on Hisilicon Hip0X"
+	depends on (ARM64 && (ARCH_HISI || COMPILE_TEST))
+	select LOGIC_PIO
+	select INDIRECT_PIO

So the LPC host controller driver is selecting INDIRECT_PIO...

> 
> -corey
> 

Cheers
Gab

  reply	other threads:[~2017-10-30 15:31 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-27 16:11 [PATCH v10 0/9] LPC: legacy ISA I/O support Gabriele Paoloni
2017-10-27 16:11 ` [PATCH v10 1/9] LIB: Introduce a generic PIO mapping method Gabriele Paoloni
2017-10-27 18:32   ` Corey Minyard
2017-10-30 15:31     ` Gabriele Paoloni [this message]
2017-10-27 16:11 ` [PATCH v10 2/9] PCI: remove unused __weak attribute in pci_register_io_range() Gabriele Paoloni
2017-11-07  0:23   ` Bjorn Helgaas
2017-11-07 10:50     ` Gabriele Paoloni
2017-11-07  0:25   ` Bjorn Helgaas
2017-11-07 10:50     ` Gabriele Paoloni
2017-10-27 16:11 ` [PATCH v10 3/9] PCI: add fwnode handler as input param of pci_register_io_range() Gabriele Paoloni
2017-10-27 16:11 ` [PATCH v10 4/9] PCI: Apply the new generic I/O management on PCI IO hosts Gabriele Paoloni
2017-10-27 16:11 ` [PATCH v10 5/9] OF: Add missing I/O range exception for indirect-IO devices Gabriele Paoloni
2017-10-27 16:11 ` [PATCH v10 6/9] LPC: Support the LPC host on Hip06/Hip07 with DT bindings Gabriele Paoloni
2017-10-27 16:44   ` Randy Dunlap
2017-10-30 15:55     ` Gabriele Paoloni
2017-11-09  0:46   ` dann frazier
2017-11-09 10:05     ` Gabriele Paoloni
2017-10-27 16:11 ` [PATCH v10 7/9] ACPI: Translate the I/O range of non-MMIO devices before scanning Gabriele Paoloni
2017-10-27 16:11 ` [PATCH v10 8/9] LPC: Add the ACPI LPC support Gabriele Paoloni
2017-10-27 16:11 ` [PATCH v10 9/9] MANTAINERS: Add maintainer for HiSilicon LPC driver Gabriele Paoloni
2017-11-07  0:21   ` Bjorn Helgaas
2017-11-07 10:49     ` Gabriele Paoloni
2017-10-27 16:45 ` [PATCH v10 0/9] LPC: legacy ISA I/O support David Laight
2017-10-30 11:32   ` Gabriele Paoloni
2017-11-09 16:16 ` dann frazier
2017-11-09 16:18   ` Gabriele Paoloni

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=EE11001F9E5DDD47B7634E2F8A612F2E40CAED4C@FRAEML521-MBX.china.huawei.com \
    --to=gabriele.paoloni@huawei.com \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=brian.starkey@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=frowand.list@gmail.com \
    --cc=john.garry@huawei.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=minyard@acm.org \
    --cc=olof@lixom.net \
    --cc=rafael@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=will.deacon@arm.com \
    --cc=xuwei5@hisilicon.com \
    --cc=yuanzhichang@hisilicon.com \
    /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).