All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Will.Deacon@arm.com, catalin.marinas@arm.com,
	bhelgaas@google.com, hanjun.guo@linaro.org, rrichter@cavium.com,
	Prasun.Kapoor@caviumnetworks.com, gpkulkarni@gmail.com
Subject: Re: [PATCH] arm64, pci, numa: Adding helper functions as required by pci
Date: Fri, 8 Jan 2016 12:01:31 -0600	[thread overview]
Message-ID: <20160108180131.GB5354@localhost> (raw)
In-Reply-To: <1450780730-13667-1-git-send-email-gkulkarni@caviumnetworks.com>

On Tue, Dec 22, 2015 at 04:08:50PM +0530, Ganapatrao Kulkarni wrote:
> Adding helper functions and necessary code to make
> pci driver(pci-host-generic) numa aware.
> 
> This patch is on top of arm64-numa v7.
> http://www.spinics.net/lists/arm-kernel/msg460813.html
> 
> Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
> ---
>  arch/arm64/include/asm/numa.h       | 8 +++++---
>  arch/arm64/kernel/pci.c             | 8 ++++++++
>  drivers/pci/host/pci-host-generic.c | 1 +
>  3 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/numa.h b/arch/arm64/include/asm/numa.h
> index b8c2a3f..1eca4db 100644
> --- a/arch/arm64/include/asm/numa.h
> +++ b/arch/arm64/include/asm/numa.h
> @@ -15,9 +15,11 @@
>  extern int __node_distance(int from, int to);
>  #define node_distance(a, b) __node_distance(a, b)
>  
> -/* dummy definitions for pci functions */
> -#define pcibus_to_node(node)	0
> -#define cpumask_of_pcibus(bus)	0
> +struct pci_bus;
> +extern int pcibus_to_node(struct pci_bus *bus);
> +#define cpumask_of_pcibus(bus)	(pcibus_to_node(bus) == -1 ?		\
> +				 cpu_all_mask :				\
> +				 cpumask_of_node(pcibus_to_node(bus)))

All the arch definitions of cpumask_of_pcibus() are pretty similar;
could they be made more generic?  At the very least, can you drop the
definition here and use the one in include/asm-generic/topology.h,
which is identical to what you're defining here?

>  extern int cpu_to_node_map[NR_CPUS];
>  extern nodemask_t numa_nodes_parsed __initdata;
> diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
> index b3d098b..37e2e9f 100644
> --- a/arch/arm64/kernel/pci.c
> +++ b/arch/arm64/kernel/pci.c
> @@ -84,3 +84,11 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
>  	return NULL;
>  }
>  #endif
> +
> +#ifdef CONFIG_NUMA
> +int pcibus_to_node(struct pci_bus *bus)
> +{
> +	return dev_to_node(&bus->dev);
> +}
> +EXPORT_SYMBOL(pcibus_to_node);
> +#endif
> diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c
> index 5434c90..a821e49 100644
> --- a/drivers/pci/host/pci-host-generic.c
> +++ b/drivers/pci/host/pci-host-generic.c
> @@ -230,6 +230,7 @@ static int gen_pci_probe(struct platform_device *pdev)
>  	of_pci_check_probe_only();
>  
>  	of_id = of_match_node(gen_pci_of_match, np);
> +	set_dev_node(dev, of_node_to_nid(np));
>  	pci->cfg.ops = (struct gen_pci_cfg_bus_ops *)of_id->data;
>  	pci->host.dev.parent = dev;
>  	INIT_LIST_HEAD(&pci->host.windows);
> -- 
> 1.8.1.4
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: helgaas@kernel.org (Bjorn Helgaas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64, pci, numa: Adding helper functions as required by pci
Date: Fri, 8 Jan 2016 12:01:31 -0600	[thread overview]
Message-ID: <20160108180131.GB5354@localhost> (raw)
In-Reply-To: <1450780730-13667-1-git-send-email-gkulkarni@caviumnetworks.com>

On Tue, Dec 22, 2015 at 04:08:50PM +0530, Ganapatrao Kulkarni wrote:
> Adding helper functions and necessary code to make
> pci driver(pci-host-generic) numa aware.
> 
> This patch is on top of arm64-numa v7.
> http://www.spinics.net/lists/arm-kernel/msg460813.html
> 
> Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
> ---
>  arch/arm64/include/asm/numa.h       | 8 +++++---
>  arch/arm64/kernel/pci.c             | 8 ++++++++
>  drivers/pci/host/pci-host-generic.c | 1 +
>  3 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/numa.h b/arch/arm64/include/asm/numa.h
> index b8c2a3f..1eca4db 100644
> --- a/arch/arm64/include/asm/numa.h
> +++ b/arch/arm64/include/asm/numa.h
> @@ -15,9 +15,11 @@
>  extern int __node_distance(int from, int to);
>  #define node_distance(a, b) __node_distance(a, b)
>  
> -/* dummy definitions for pci functions */
> -#define pcibus_to_node(node)	0
> -#define cpumask_of_pcibus(bus)	0
> +struct pci_bus;
> +extern int pcibus_to_node(struct pci_bus *bus);
> +#define cpumask_of_pcibus(bus)	(pcibus_to_node(bus) == -1 ?		\
> +				 cpu_all_mask :				\
> +				 cpumask_of_node(pcibus_to_node(bus)))

All the arch definitions of cpumask_of_pcibus() are pretty similar;
could they be made more generic?  At the very least, can you drop the
definition here and use the one in include/asm-generic/topology.h,
which is identical to what you're defining here?

>  extern int cpu_to_node_map[NR_CPUS];
>  extern nodemask_t numa_nodes_parsed __initdata;
> diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
> index b3d098b..37e2e9f 100644
> --- a/arch/arm64/kernel/pci.c
> +++ b/arch/arm64/kernel/pci.c
> @@ -84,3 +84,11 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
>  	return NULL;
>  }
>  #endif
> +
> +#ifdef CONFIG_NUMA
> +int pcibus_to_node(struct pci_bus *bus)
> +{
> +	return dev_to_node(&bus->dev);
> +}
> +EXPORT_SYMBOL(pcibus_to_node);
> +#endif
> diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c
> index 5434c90..a821e49 100644
> --- a/drivers/pci/host/pci-host-generic.c
> +++ b/drivers/pci/host/pci-host-generic.c
> @@ -230,6 +230,7 @@ static int gen_pci_probe(struct platform_device *pdev)
>  	of_pci_check_probe_only();
>  
>  	of_id = of_match_node(gen_pci_of_match, np);
> +	set_dev_node(dev, of_node_to_nid(np));
>  	pci->cfg.ops = (struct gen_pci_cfg_bus_ops *)of_id->data;
>  	pci->host.dev.parent = dev;
>  	INIT_LIST_HEAD(&pci->host.windows);
> -- 
> 1.8.1.4
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2016-01-08 18:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22 10:38 [PATCH] arm64, pci, numa: Adding helper functions as required by pci Ganapatrao Kulkarni
2015-12-22 10:38 ` Ganapatrao Kulkarni
2016-01-08 18:01 ` Bjorn Helgaas [this message]
2016-01-08 18:01   ` Bjorn Helgaas
2016-01-08 18:06   ` Will Deacon
2016-01-08 18:06     ` Will Deacon
2016-01-09  6:05     ` Ganapatrao Kulkarni
2016-01-09  6:05       ` Ganapatrao Kulkarni
2016-01-09 15:24       ` Bjorn Helgaas
2016-01-09 15:24         ` Bjorn Helgaas
2016-01-09 15:35         ` Ganapatrao Kulkarni
2016-01-09 15:35           ` Ganapatrao Kulkarni
2016-01-11 17:12           ` Matthias Brugger
2016-01-11 17:12             ` Matthias Brugger
2016-01-11 17:26             ` Ganapatrao Kulkarni
2016-01-11 17:26               ` Ganapatrao Kulkarni
2016-01-15 23:38               ` Bjorn Helgaas
2016-01-15 23:38                 ` Bjorn Helgaas

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=20160108180131.GB5354@localhost \
    --to=helgaas@kernel.org \
    --cc=Prasun.Kapoor@caviumnetworks.com \
    --cc=Will.Deacon@arm.com \
    --cc=bhelgaas@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=gkulkarni@caviumnetworks.com \
    --cc=gpkulkarni@gmail.com \
    --cc=hanjun.guo@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rrichter@cavium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.