From: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Liviu Dudau <Liviu.Dudau-5wv7dgnIgG8@public.gmane.org>
Cc: Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Catalin Marinas <Catalin.Marinas-5wv7dgnIgG8@public.gmane.org>,
Will Deacon <Will.Deacon-5wv7dgnIgG8@public.gmane.org>,
Benjamin Herrenschmidt
<benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>,
Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
Tanmay Inamdar <tinamdar-qTEPVZfXA3Y@public.gmane.org>,
Grant Likely
<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
Sinan Kaya <okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
Kukjin Kim <kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
Suravee Suthikulanit
<suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>,
linux-pci <linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-arch <linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Device Tree ML
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
LAKML
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH v9 12/12] PCI: Introduce pci_remap_iospace() for remapping PCI I/O bus resources into CPU space
Date: Thu, 21 Aug 2014 23:16:16 -0500 [thread overview]
Message-ID: <CAL_JsqK6XiuS7OJ_2F16ySA8oj9AHqP0fAft21AOtJxXP2SqnQ@mail.gmail.com> (raw)
In-Reply-To: <1407860725-25202-13-git-send-email-Liviu.Dudau-5wv7dgnIgG8@public.gmane.org>
On Tue, Aug 12, 2014 at 11:25 AM, Liviu Dudau <Liviu.Dudau-5wv7dgnIgG8@public.gmane.org> wrote:
> Introduce a default implementation for remapping PCI bus I/O resources
> onto the CPU address space. Architectures with special needs may
> provide their own version, but most should be able to use this one.
>
> Cc: Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> Cc: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Signed-off-by: Liviu Dudau <Liviu.Dudau-5wv7dgnIgG8@public.gmane.org>
Reviewed-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
However, I would like to see ARM pci_ioremap_io converted over to this function.
Rob
> ---
> drivers/pci/pci.c | 33 +++++++++++++++++++++++++++++++++
> include/linux/pci.h | 3 +++
> 2 files changed, 36 insertions(+)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 29d1775..76d21b6 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -2707,6 +2707,39 @@ int pci_request_regions_exclusive(struct pci_dev *pdev, const char *res_name)
> }
> EXPORT_SYMBOL(pci_request_regions_exclusive);
>
> +/**
> + * pci_remap_iospace - Remap the memory mapped I/O space
> + * @res: Resource describing the I/O space
> + * @phys_addr: physical address where the range will be mapped.
> + *
> + * Remap the memory mapped I/O space described by the @res
> + * into the CPU physical address space. Only architectures
> + * that have memory mapped IO defined (and hence PCI_IOBASE)
> + * should call this function.
> + */
> +int __weak pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr)
> +{
> + int err = -ENODEV;
> +
> +#ifdef PCI_IOBASE
> + if (!(res->flags & IORESOURCE_IO))
> + return -EINVAL;
> +
> + if (res->end > IO_SPACE_LIMIT)
> + return -EINVAL;
> +
> + err = ioremap_page_range(res->start + (unsigned long)PCI_IOBASE,
> + res->end + 1 + (unsigned long)PCI_IOBASE,
> + phys_addr, pgprot_device(PAGE_KERNEL));
> +#else
> + /* this architecture does not have memory mapped I/O space,
> + so this function should never be called */
> + WARN_ON(1);
> +#endif
> +
> + return err;
> +}
> +
> static void __pci_set_master(struct pci_dev *dev, bool enable)
> {
> u16 old_cmd, cmd;
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index e1e0d80..988c2f5 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1098,6 +1098,9 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
> resource_size_t),
> void *alignf_data);
>
> +
> +int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr);
> +
> static inline dma_addr_t pci_bus_address(struct pci_dev *pdev, int bar)
> {
> struct pci_bus_region region;
> --
> 2.0.4
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Rob Herring <robherring2@gmail.com>
To: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Catalin Marinas <Catalin.Marinas@arm.com>,
Will Deacon <Will.Deacon@arm.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Arnd Bergmann <arnd@arndb.de>,
Russell King <linux@arm.linux.org.uk>,
Tanmay Inamdar <tinamdar@apm.com>,
Grant Likely <grant.likely@secretlab.ca>,
Sinan Kaya <okaya@codeaurora.org>,
Jingoo Han <jg1.han@samsung.com>,
Kukjin Kim <kgene.kim@samsung.com>,
Suravee Suthikulanit <suravee.suthikulpanit@amd.com>,
linux-pci <linux-pci@vger.kernel.org>,
linux-arch <linux-arch@vger.kernel.org>,
Device Tree ML <devicetree@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
LAKML <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v9 12/12] PCI: Introduce pci_remap_iospace() for remapping PCI I/O bus resources into CPU space
Date: Thu, 21 Aug 2014 23:16:16 -0500 [thread overview]
Message-ID: <CAL_JsqK6XiuS7OJ_2F16ySA8oj9AHqP0fAft21AOtJxXP2SqnQ@mail.gmail.com> (raw)
Message-ID: <20140822041616.iHFsJPjs9zGgnTXu2Rtvpibv_TfIlgqWlgwnXESyDAY@z> (raw)
In-Reply-To: <1407860725-25202-13-git-send-email-Liviu.Dudau@arm.com>
On Tue, Aug 12, 2014 at 11:25 AM, Liviu Dudau <Liviu.Dudau@arm.com> wrote:
> Introduce a default implementation for remapping PCI bus I/O resources
> onto the CPU address space. Architectures with special needs may
> provide their own version, but most should be able to use this one.
>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Rob Herring <robh+dt@kernel.org>
> Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Reviewed-by: Rob Herring <robh@kernel.org>
However, I would like to see ARM pci_ioremap_io converted over to this function.
Rob
> ---
> drivers/pci/pci.c | 33 +++++++++++++++++++++++++++++++++
> include/linux/pci.h | 3 +++
> 2 files changed, 36 insertions(+)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 29d1775..76d21b6 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -2707,6 +2707,39 @@ int pci_request_regions_exclusive(struct pci_dev *pdev, const char *res_name)
> }
> EXPORT_SYMBOL(pci_request_regions_exclusive);
>
> +/**
> + * pci_remap_iospace - Remap the memory mapped I/O space
> + * @res: Resource describing the I/O space
> + * @phys_addr: physical address where the range will be mapped.
> + *
> + * Remap the memory mapped I/O space described by the @res
> + * into the CPU physical address space. Only architectures
> + * that have memory mapped IO defined (and hence PCI_IOBASE)
> + * should call this function.
> + */
> +int __weak pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr)
> +{
> + int err = -ENODEV;
> +
> +#ifdef PCI_IOBASE
> + if (!(res->flags & IORESOURCE_IO))
> + return -EINVAL;
> +
> + if (res->end > IO_SPACE_LIMIT)
> + return -EINVAL;
> +
> + err = ioremap_page_range(res->start + (unsigned long)PCI_IOBASE,
> + res->end + 1 + (unsigned long)PCI_IOBASE,
> + phys_addr, pgprot_device(PAGE_KERNEL));
> +#else
> + /* this architecture does not have memory mapped I/O space,
> + so this function should never be called */
> + WARN_ON(1);
> +#endif
> +
> + return err;
> +}
> +
> static void __pci_set_master(struct pci_dev *dev, bool enable)
> {
> u16 old_cmd, cmd;
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index e1e0d80..988c2f5 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1098,6 +1098,9 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
> resource_size_t),
> void *alignf_data);
>
> +
> +int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr);
> +
> static inline dma_addr_t pci_bus_address(struct pci_dev *pdev, int bar)
> {
> struct pci_bus_region region;
> --
> 2.0.4
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2014-08-22 4:16 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-12 16:25 [PATCH v9 00/12] Support for creating generic PCI host bridges from DT Liviu Dudau
2014-08-12 16:25 ` Liviu Dudau
2014-08-12 16:25 ` [PATCH v9 01/12] Fix ioport_map() for !CONFIG_GENERIC_IOMAP cases Liviu Dudau
2014-08-12 16:25 ` Liviu Dudau
2014-08-12 16:25 ` [PATCH v9 02/12] PCI: OF: Parse and map the IRQ when adding the PCI device Liviu Dudau
2014-08-12 16:25 ` Liviu Dudau
2014-08-14 14:58 ` Wei Yang
2014-08-14 15:49 ` Liviu Dudau
2014-08-14 15:49 ` Liviu Dudau
2014-08-15 8:56 ` Wei Yang
2014-08-15 8:56 ` Wei Yang
2014-08-15 10:30 ` Liviu Dudau
2014-08-15 10:30 ` Liviu Dudau
2014-08-18 1:44 ` Wei Yang
2014-08-18 1:44 ` Wei Yang
2014-08-18 21:26 ` Liviu Dudau
2014-08-18 14:25 ` Catalin Marinas
2014-08-18 14:25 ` Catalin Marinas
2014-08-18 21:30 ` Liviu Dudau
2014-08-18 22:09 ` Catalin Marinas
2014-08-19 12:39 ` Arnd Bergmann
2014-08-19 12:39 ` Arnd Bergmann
2014-08-19 1:44 ` Wei Yang
2014-08-19 1:44 ` Wei Yang
2014-08-19 12:05 ` Liviu Dudau
2014-08-12 16:25 ` [PATCH v9 03/12] PCI: Introduce helper functions to deal with PCI I/O ranges Liviu Dudau
2014-08-12 16:25 ` Liviu Dudau
[not found] ` <1407860725-25202-4-git-send-email-Liviu.Dudau-5wv7dgnIgG8@public.gmane.org>
2014-08-18 14:26 ` Catalin Marinas
2014-08-18 14:26 ` Catalin Marinas
2014-08-18 21:34 ` Liviu Dudau
2014-08-18 21:52 ` Catalin Marinas
2014-08-22 4:59 ` Rob Herring
2014-08-22 4:59 ` Rob Herring
2014-09-02 3:43 ` Yijing Wang
2014-08-12 16:25 ` [PATCH v9 04/12] PCI: OF: Fix the conversion of IO ranges into IO resources Liviu Dudau
2014-08-12 16:25 ` Liviu Dudau
[not found] ` <1407860725-25202-5-git-send-email-Liviu.Dudau-5wv7dgnIgG8@public.gmane.org>
2014-08-22 4:08 ` Rob Herring
2014-08-22 4:08 ` Rob Herring
2014-08-22 13:06 ` Liviu Dudau
2014-08-24 23:27 ` Rob Herring
2014-09-05 22:11 ` Bjorn Helgaas
2014-09-05 22:11 ` Bjorn Helgaas
2014-08-12 16:25 ` [PATCH v9 05/12] ARM: Define PCI_IOBASE as the base of virtual PCI IO space Liviu Dudau
2014-08-12 16:25 ` Liviu Dudau
2014-08-12 16:25 ` [PATCH v9 06/12] ARM: integrator: Correct usage of of_pci_range_to_resource() Liviu Dudau
2014-08-12 16:25 ` Liviu Dudau
2014-09-05 22:08 ` Bjorn Helgaas
2014-09-05 22:08 ` Bjorn Helgaas
2014-09-08 12:25 ` Liviu Dudau
2014-09-22 12:47 ` Linus Walleij
2014-09-22 13:36 ` Liviu Dudau
2014-09-22 13:36 ` Liviu Dudau
2014-08-12 16:25 ` [PATCH v9 07/12] PCI: Create pci_host_bridge before its associated bus in pci_create_root_bus Liviu Dudau
2014-08-12 16:25 ` Liviu Dudau
2014-08-12 16:25 ` [PATCH v9 08/12] PCI: Introduce generic domain handling for PCI busses Liviu Dudau
2014-08-12 16:25 ` Liviu Dudau
2014-08-12 16:25 ` [PATCH v9 09/12] OF: Introduce helper function for getting PCI domain_nr Liviu Dudau
2014-08-12 16:25 ` Liviu Dudau
2014-08-12 16:25 ` [PATCH v9 10/12] OF: PCI: Add support for creating a generic host_bridge from DT Liviu Dudau
2014-08-12 16:25 ` Liviu Dudau
2014-08-12 16:25 ` [PATCH v9 11/12] arm64: Add pgprot_device() interface for device mappings Liviu Dudau
2014-08-12 16:25 ` Liviu Dudau
2014-08-13 9:59 ` Catalin Marinas
2014-08-13 9:59 ` Catalin Marinas
2014-08-12 16:25 ` [PATCH v9 12/12] PCI: Introduce pci_remap_iospace() for remapping PCI I/O bus resources into CPU space Liviu Dudau
2014-08-12 16:25 ` Liviu Dudau
2014-08-13 10:01 ` Catalin Marinas
2014-08-13 10:33 ` Liviu Dudau
2014-08-13 10:33 ` Liviu Dudau
2014-08-13 10:53 ` Catalin Marinas
[not found] ` <1407860725-25202-13-git-send-email-Liviu.Dudau-5wv7dgnIgG8@public.gmane.org>
2014-08-22 4:16 ` Rob Herring [this message]
2014-08-22 4:16 ` Rob Herring
2014-08-22 12:43 ` Liviu Dudau
[not found] ` <20140822124326.GL13147-hOhETlTuV5niMG9XS5x8Mg@public.gmane.org>
2014-08-23 16:57 ` Rob Herring
2014-08-23 16:57 ` Rob Herring
2014-08-18 14:26 ` [PATCH v9 00/12] Support for creating generic PCI host bridges from DT Catalin Marinas
2014-08-18 14:26 ` Catalin Marinas
2014-08-18 21:35 ` Liviu Dudau
[not found] ` <1407860725-25202-1-git-send-email-Liviu.Dudau-5wv7dgnIgG8@public.gmane.org>
2014-08-27 16:24 ` Robert Richter
2014-08-27 16:24 ` Robert Richter
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=CAL_JsqK6XiuS7OJ_2F16ySA8oj9AHqP0fAft21AOtJxXP2SqnQ@mail.gmail.com \
--to=robherring2-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=Catalin.Marinas-5wv7dgnIgG8@public.gmane.org \
--cc=Liviu.Dudau-5wv7dgnIgG8@public.gmane.org \
--cc=Will.Deacon-5wv7dgnIgG8@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org \
--cc=bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
--cc=linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org \
--cc=tinamdar-qTEPVZfXA3Y@public.gmane.org \
/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).