mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yijing Wang <wangyijing@huawei.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: <linux-pci@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Xinwei Hu <huxinwei@huawei.com>, Wuyun <wuyun.wu@huawei.com>,
	<linux-arm-kernel@lists.infradead.org>,
	Russell King <linux@arm.linux.org.uk>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	Yijing Wang <wangyijing@huawei.com>
Subject: [PATCH 03/10] arm/MSI: Save MSI controller in pci_sys_data
Date: Mon, 27 Oct 2014 15:48:40 +0800	[thread overview]
Message-ID: <1414396127-30023-4-git-send-email-wangyijing@huawei.com> (raw)
In-Reply-To: <1414396127-30023-1-git-send-email-wangyijing@huawei.com>

Saving msi controller in pci_sys_data make PCI bus and
devices don't need to know msi controller details. It also
make PCI enumeration code be decoupled from msi controller.
Currently, we associate msi controller and PCI bus by adding
.add_bus() in PCI host drivers, and assign parent PCI bus's
msi controller to child bus in pci_alloc_child_bus().
In fact, all PCI devices under the same PCI host bridge
share same msi controller. So msi controller should be seen
as one of resources or attributes to be initialized in pci host
bridge driver. Currently, pci hostbridge drivers create
pci_host_bridge in pci_create_root_bus(), and pass arch
specific pci sysdata to core pci scan functions. So pci
arch sysdata is good place to save msi controller. But this
is not the best solution, because we have to add arch spec
pcibios_msi_controller() to extract out msi_controller from
PCI sysdata.
A better approach is to make a generic pci_host_bridge,
save common info like msi controller, PCI domain, PCI hostbridge
resources into it, and pass the generic pci_host_bridge to PCI
scan functions. Then we can remove lots of arch spec functions.
But these changes are huge, so we plan to do it in another series.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 arch/arm/include/asm/mach/pci.h |    6 ++++++
 arch/arm/kernel/bios32.c        |   12 ++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h
index 7fc4278..8144d61 100644
--- a/arch/arm/include/asm/mach/pci.h
+++ b/arch/arm/include/asm/mach/pci.h
@@ -22,6 +22,9 @@ struct hw_pci {
 #ifdef CONFIG_PCI_DOMAINS
 	int		domain;
 #endif
+#ifdef CONFIG_PCI_MSI
+	struct msi_controller *msi_ctrl;
+#endif
 	struct pci_ops	*ops;
 	int		nr_controllers;
 	void		**private_data;
@@ -47,6 +50,9 @@ struct pci_sys_data {
 #ifdef CONFIG_PCI_DOMAINS
 	int		domain;
 #endif
+#ifdef CONFIG_PCI_MSI
+	struct msi_controller *msi_ctrl;
+#endif
 	struct list_head node;
 	int		busnr;		/* primary bus number			*/
 	u64		mem_offset;	/* bus->cpu memory mapping offset	*/
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 17a26c1..073229f 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -18,6 +18,15 @@
 
 static int debug_pci;
 
+#ifdef CONFIG_PCI_MSI
+struct msi_controller *pcibios_msi_controller(struct pci_bus *bus)
+{
+	struct pci_sys_data *sysdata = bus->sysdata;
+
+	return sysdata->msi_ctrl;
+}
+#endif
+
 /*
  * We can't use pci_get_device() here since we are
  * called from interrupt context.
@@ -471,6 +480,9 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
 #ifdef CONFIG_PCI_DOMAINS
 		sys->domain  = hw->domain;
 #endif
+#ifdef CONFIG_PCI_MSI
+		sys->msi_ctrl = hw->msi_ctrl;
+#endif
 		sys->busnr   = busnr;
 		sys->swizzle = hw->swizzle;
 		sys->map_irq = hw->map_irq;
-- 
1.7.1


  parent reply	other threads:[~2014-10-27  7:10 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27  7:48 [PATCH 00/10] Save MSI chip " Yijing Wang
2014-10-27  7:48 ` [PATCH 01/10] MSI: Rename msi_chip to msi_controller for better readability Yijing Wang
2014-10-27  7:48 ` [PATCH 02/10] PCI/MSI: Introduce weak pcibios_msi_controller() Yijing Wang
2014-10-27  7:48 ` Yijing Wang [this message]
2014-10-27  7:48 ` [PATCH 04/10] PCI: tegra: Save MSI controller in pci_sys_data Yijing Wang
2014-10-27  7:48 ` [PATCH 05/10] PCI: designware: " Yijing Wang
2014-10-27  7:48 ` [PATCH 06/10] PCI: rcar: " Yijing Wang
2014-10-27  7:48 ` [PATCH 07/10] PCI: mvebu: " Yijing Wang
2014-10-27  7:48 ` [PATCH 08/10] PCI: xilinx: " Yijing Wang
2014-10-27  7:48 ` [PATCH 09/10] arm/PCI: Clean unused pcibios_add_bus() and pcibios_remove_bus() Yijing Wang
2014-10-27  7:48 ` [PATCH 10/10] PCI/MSI: Remove useless bus->msi assignment Yijing Wang
2014-11-12  4:24   ` Bjorn Helgaas
2014-11-12  5:54     ` Yijing Wang
2014-11-12  4:23 ` [PATCH 00/10] Save MSI chip in pci_sys_data Bjorn Helgaas
2014-11-17  2:59   ` Bjorn Helgaas
2014-11-17  9:38     ` Thomas Gleixner
2014-11-17 16:54       ` Bjorn Helgaas
2014-11-17 21:02         ` Thomas Gleixner
2014-11-17 21:27           ` Bjorn Helgaas
2014-11-17 21:31             ` Thomas Gleixner
2014-11-18 17:53           ` Marc Zyngier
2014-11-21 17:20   ` Bjorn Helgaas
2014-11-22  2:58     ` Yijing Wang

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=1414396127-30023-4-git-send-email-wangyijing@huawei.com \
    --to=wangyijing@huawei.com \
    --cc=bhelgaas@google.com \
    --cc=huxinwei@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=tglx@linutronix.de \
    --cc=thierry.reding@gmail.com \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=wuyun.wu@huawei.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

all inboxes | Powered by JetHome®