public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Maule <maule@sgi.com>
To: "Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>
Cc: Greg KH <gregkh@suse.de>, Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org,
	shaohua.li@intel.com
Subject: Re: [PATCH] (-mm) drivers/pci/msi: explicit declaration of msi_register
Date: Thu, 16 Mar 2006 12:19:34 -0600	[thread overview]
Message-ID: <20060316181934.GM13666@sgi.com> (raw)
In-Reply-To: <44198210.6090109@ce.jp.nec.com>

On Thu, Mar 16, 2006 at 10:19:44AM -0500, Jun'ichi Nomura wrote:
> Greg KH wrote:
> >No, we don't need a linux/msi.h, these are core pci things that no one
> >else should care about.  The other arches handle this just fine, let's
> >not mess everything up just because ia64 can't get it right :)
> 
> Hmm, it sounds asm/msi.h shouldn't be included from common headers. :<
> I think the attached patch might be better. How about this?
> 
> Default msi_arch_init() looks sufficient for most ia64 platforms
> except for SGI SN2, which seems to need its special version.
> gregkh-pci-msi-vector-targeting-abstractions.patch used machvec
> to switch the functions between platforms.
> For that, it included asm/msi.h from asm/machvec.h and
> caused the warnings flood.
> The attached patch separates machvec function and the original
> inline function. So that we don't need to include asm/msi.h from
> common headers.
> 
> 
> There is another problem that CONFIG_IA64_GENERIC still doesn't
> build due to error in SGI SN specific code.
> It needs additional fix.
> 
> Thanks,
> -- 
> Jun'ichi Nomura, NEC Solutions (America), Inc.

Ok, looking back at some of my original patches, it seems like the
declaration of msi_ops got moved from pci.h to and some forward declarations
in ia64/msi.h were removed.  This patch corrects the build problems.

The reason for putting struct msi_ops in pci.h is so that msi code that
resides outside of drivers/pci can use the declaration without having to
reach down into drivers/pci.

If there's objectins to having struct msi_ops declared in pci.h, then I guess
we need to come up with another solution.

The following patch should correct the build problems on ia64.  I have not
yet checked other platforms.


Index: linux-2.6.16-rc6/include/asm-ia64/msi.h
===================================================================
--- linux-2.6.16-rc6.orig/include/asm-ia64/msi.h	2006-03-16 10:20:09.000000000 -0600
+++ linux-2.6.16-rc6/include/asm-ia64/msi.h	2006-03-16 12:18:23.615928436 -0600
@@ -16,6 +16,10 @@
 
 extern struct msi_ops msi_apic_ops;
 
+/* Ugly defs to avoid having to include pci.h in machvec.h */
+struct msi_ops;
+extern int msi_register(struct msi_ops *);
+
 /* default ia64 msi init routine */
 static inline int ia64_msi_init(void)
 {
Index: linux-2.6.16-rc6/drivers/pci/msi.h
===================================================================
--- linux-2.6.16-rc6.orig/drivers/pci/msi.h	2006-03-16 10:20:07.000000000 -0600
+++ linux-2.6.16-rc6/drivers/pci/msi.h	2006-03-16 12:02:33.276296521 -0600
@@ -83,61 +83,4 @@
 	struct pci_dev *dev;
 };
 
-/*
- * MSI operation vector.  Used by the msi core code (drivers/pci/msi.c)
- * to abstract platform-specific tasks relating to MSI address generation
- * and resource management.
- */
-struct msi_ops {
-	/**
-	 * setup - generate an MSI bus address and data for a given vector
-	 * @pdev: PCI device context (in)
-	 * @vector: vector allocated by the msi core (in)
-	 * @addr_hi: upper 32 bits of PCI bus MSI address (out)
-	 * @addr_lo: lower 32 bits of PCI bus MSI address (out)
-	 * @data: MSI data payload (out)
-	 *
-	 * Description: The setup op is used to generate a PCI bus addres and
-	 * data which the msi core will program into the card MSI capability
-	 * registers.  The setup routine is responsible for picking an initial
-	 * cpu to target the MSI at.  The setup routine is responsible for
-	 * examining pdev to determine the MSI capabilities of the card and
-	 * generating a suitable address/data.  The setup routine is
-	 * responsible for allocating and tracking any system resources it
-	 * needs to route the MSI to the cpu it picks, and for associating
-	 * those resources with the passed in vector.
-	 *
-	 * Returns 0 if the MSI address/data was successfully setup.
-	 */
-	int	(*setup)    (struct pci_dev *pdev, unsigned int vector,
-			     u32 *addr_hi, u32 *addr_lo, u32 *data);
-
-	/**
-	 * teardown - release resources allocated by setup
-	 * @vector: vector context for resources (in)
-	 *
-	 * Description:  The teardown op is used to release any resources
-	 * that were allocated in the setup routine associated with the passed
-	 * in vector.
-	 */
-	void	(*teardown) (unsigned int vector);
-
-	/**
-	 * target - retarget an MSI at a different cpu
-	 * @vector: vector context for resources (in)
-	 * @cpu:  new cpu to direct vector at (in)
-	 * @addr_hi: new value of PCI bus upper 32 bits (in/out)
-	 * @addr_lo: new value of PCI bus lower 32 bits (in/out)
-	 *
-	 * Description:  The target op is used to redirect an MSI vector
-	 * at a different cpu.  addr_hi/addr_lo coming in are the existing
-	 * values that the MSI core has programmed into the card.  The
-	 * target code is responsible for freeing any resources (if any)
-	 * associated with the old address, and generating a new PCI bus
-	 * addr_hi/addr_lo that will redirect the vector at the indicated cpu.
-	 */
-	void	(*target)   (unsigned int vector, unsigned int cpu,
-			     u32 *addr_hi, u32 *addr_lo);
-};
-
 #endif /* MSI_H */
Index: linux-2.6.16-rc6/include/linux/pci.h
===================================================================
--- linux-2.6.16-rc6.orig/include/linux/pci.h	2006-03-16 10:20:10.000000000 -0600
+++ linux-2.6.16-rc6/include/linux/pci.h	2006-03-16 12:03:20.646663409 -0600
@@ -583,6 +583,63 @@
 	u16	entry;	/* driver uses to specify entry, OS writes */
 };
 
+/*
+ * MSI operation vector.  Used by the msi core code (drivers/pci/msi.c)
+ * to abstract platform-specific tasks relating to MSI address generation
+ * and resource management.
+ */
+struct msi_ops {
+	/**
+	 * setup - generate an MSI bus address and data for a given vector
+	 * @pdev: PCI device context (in)
+	 * @vector: vector allocated by the msi core (in)
+	 * @addr_hi: upper 32 bits of PCI bus MSI address (out)
+	 * @addr_lo: lower 32 bits of PCI bus MSI address (out)
+	 * @data: MSI data payload (out)
+	 *
+	 * Description: The setup op is used to generate a PCI bus addres and
+	 * data which the msi core will program into the card MSI capability
+	 * registers.  The setup routine is responsible for picking an initial
+	 * cpu to target the MSI at.  The setup routine is responsible for
+	 * examining pdev to determine the MSI capabilities of the card and
+	 * generating a suitable address/data.  The setup routine is
+	 * responsible for allocating and tracking any system resources it
+	 * needs to route the MSI to the cpu it picks, and for associating
+	 * those resources with the passed in vector.
+	 *
+	 * Returns 0 if the MSI address/data was successfully setup.
+	 */
+	int	(*setup)    (struct pci_dev *pdev, unsigned int vector,
+			     u32 *addr_hi, u32 *addr_lo, u32 *data);
+
+	/**
+	 * teardown - release resources allocated by setup
+	 * @vector: vector context for resources (in)
+	 *
+	 * Description:  The teardown op is used to release any resources
+	 * that were allocated in the setup routine associated with the passed
+	 * in vector.
+	 */
+	void	(*teardown) (unsigned int vector);
+
+	/**
+	 * target - retarget an MSI at a different cpu
+	 * @vector: vector context for resources (in)
+	 * @cpu:  new cpu to direct vector at (in)
+	 * @addr_hi: new value of PCI bus upper 32 bits (in/out)
+	 * @addr_lo: new value of PCI bus lower 32 bits (in/out)
+	 *
+	 * Description:  The target op is used to redirect an MSI vector
+	 * at a different cpu.  addr_hi/addr_lo coming in are the existing
+	 * values that the MSI core has programmed into the card.  The
+	 * target code is responsible for freeing any resources (if any)
+	 * associated with the old address, and generating a new PCI bus
+	 * addr_hi/addr_lo that will redirect the vector at the indicated cpu.
+	 */
+	void	(*target)   (unsigned int vector, unsigned int cpu,
+			     u32 *addr_hi, u32 *addr_lo);
+};
+
 #ifndef CONFIG_PCI_MSI
 static inline void pci_scan_msi_device(struct pci_dev *dev) {}
 static inline int pci_enable_msi(struct pci_dev *dev) {return -1;}

  reply	other threads:[~2006-03-16 18:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-14 21:01 [PATCH] (-mm) drivers/pci/msi: explicit declaration of msi_register Jun'ichi Nomura
2006-03-14 21:45 ` Andrew Morton
2006-03-14 21:59   ` Greg KH
2006-03-14 22:25     ` Matthew Wilcox
2006-03-15  0:51   ` Jun'ichi Nomura
2006-03-15 23:55     ` Greg KH
2006-03-16 15:19       ` Jun'ichi Nomura
2006-03-16 18:19         ` Mark Maule [this message]
2006-03-16 19:32           ` Jun'ichi Nomura
2006-03-16 19:41             ` Mark Maule
2006-03-16 23:28               ` Greg KH
2006-03-16 23:37                 ` Roland Dreier
2006-03-16 23:45                   ` Grant Grundler
2006-03-16 23:47                   ` Greg KH
2006-03-16 23:41           ` Grant Grundler
2006-03-16 23:49             ` Greg KH
2006-03-17  0:41               ` Grant Grundler
2006-03-17  1:18                 ` Mark Maule
2006-03-16 15:29       ` Jun'ichi Nomura
2006-03-14 21:57 ` Adrian Bunk
2006-03-14 23:55   ` Jun'ichi Nomura
2006-03-15  0:09     ` Mark Maule
2006-03-15  1:04       ` Jun'ichi Nomura

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=20060316181934.GM13666@sgi.com \
    --to=maule@sgi.com \
    --cc=akpm@osdl.org \
    --cc=gregkh@suse.de \
    --cc=j-nomura@ce.jp.nec.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shaohua.li@intel.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