Skip to contentSkip to conversation

RapidIO support: core

PATCH In review Matt Porter 3 participants 9 messages Jun 1, 2005 – Jun 2, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 RapidIO support: core

Adds a RapidIO subsystem to the kernel. RIO is a switched fabric interconnect used in higher-end embedded applications. The curious can look at the specs over at http://www.rapidio.org

The core code implements enumeration/discovery, management of devices/resources, and interfaces for RIO drivers.

There's a lot more to do to take advantages of all the hardware features. However, this should provide a good base for folks with RIO hardware to start contributing.

Patch is 108KB and can be found here:
ftp://source.mvista.com/pub/rio/l26_rio_core.patch

-Matt

#1 lore raw

PATCH 2/3 RapidIO support: ppc32

Adds PPC32 RIO support. Init code for the MPC85xx RIO ports and glue for the STx GP3 board to use it.

arch/ppc/Kconfig (mode:100644) +8 -0
Index: arch/ppc/Kconfig
===================================================================
@@ -1177,6 +1177,14 @@
 
 source "drivers/pcmcia/Kconfig"
 
+config RAPIDIO
+	bool "RapidIO support" if MPC8540 || MPC8560
+	help
+	  If you say Y here, the kernel will include drivers and
+	  infrastructure code to support RapidIO interconnect devices.
+
+source "drivers/rio/Kconfig"
+
 endmenu
 
 menu "Advanced setup"
arch/ppc/configs/stx_gp3_defconfig (mode:100644) +52 -34

284 lines not on this page · raw message

arch/ppc/kernel/Makefile (mode:100644) +1 -0
Index: arch/ppc/kernel/Makefile
===================================================================
@@ -22,6 +22,7 @@
 obj-$(CONFIG_MODULES)		+= module.o ppc_ksyms.o
 obj-$(CONFIG_NOT_COHERENT_CACHE)	+= dma-mapping.o
 obj-$(CONFIG_PCI)		+= pci.o
+obj-$(CONFIG_RAPIDIO)		+= rio.o
 obj-$(CONFIG_KGDB)		+= ppc-stub.o
 obj-$(CONFIG_SMP)		+= smp.o smp-tbsync.o
 obj-$(CONFIG_TAU)		+= temp.o
arch/ppc/kernel/rio.c (mode:100644) renamed from dev/null (tree:750e10a6553cacbd2b92b52fe40afdc8062f4f78) +52 -0

52 lines not on this page · raw message

arch/ppc/platforms/85xx/stx_gp3.c (mode:100644) +14 -1
Index: arch/ppc/platforms/85xx/stx_gp3.c
===================================================================
@@ -38,6 +38,7 @@
 #include <linux/module.h>
 #include <linux/fsl_devices.h>
 #include <linux/interrupt.h>
+#include <linux/rio.h>
 
 #include <asm/system.h>
 #include <asm/pgtable.h>
@@ -59,6 +60,7 @@
 
 #include <syslib/cpm2_pic.h>
 #include <syslib/ppc85xx_common.h>
+#include <syslib/ppc85xx_rio.h>
 
 extern void cpm2_reset(void);
 
@@ -200,7 +202,6 @@
 static void __init
 gp3_init_IRQ(void)
 {
-	int i;
 	bd_t *binfo = (bd_t *) __res;
 
 	/*
@@ -297,6 +298,18 @@
 }
 #endif /* CONFIG_PCI */
 
+#ifdef CONFIG_RAPIDIO
+void
+platform_rio_init(void)
+{
+	/*
+	 * The STx firmware configures the RapidIO Local Access Window
+	 * at 0xc0000000 with a size of 512MB.
+	 */
+	mpc85xx_rio_setup(0xc0000000, 0x20000000);
+}
+#endif /* CONFIG_RAPIDIO */
+
 void __init
 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
 	      unsigned long r6, unsigned long r7)
arch/ppc/syslib/Makefile (mode:100644) +1 -0
Index: arch/ppc/syslib/Makefile
===================================================================
@@ -101,6 +101,7 @@
 					mpc85xx_devices.o
 ifeq ($(CONFIG_85xx),y)
 obj-$(CONFIG_PCI)		+= indirect_pci.o pci_auto.o
+obj-$(CONFIG_RAPIDIO)		+= ppc85xx_rio.o
 endif
 obj-$(CONFIG_83xx)		+= ipic.o ppc83xx_setup.o ppc_sys.o \
 					mpc83xx_sys.o mpc83xx_devices.o
arch/ppc/syslib/ppc85xx_rio.c (mode:100644) renamed from dev/null (tree:750e10a6553cacbd2b92b52fe40afdc8062f4f78) +867 -0

867 lines not on this page · raw message

arch/ppc/syslib/ppc85xx_rio.h (mode:100644) renamed from dev/null (tree:750e10a6553cacbd2b92b52fe40afdc8062f4f78) +21 -0
Index: arch/ppc/syslib/ppc85xx_rio.h
===================================================================
@@ -0,0 +1,21 @@
+/*
+ * MPC85xx RapidIO definitions
+ *
+ * Copyright 2005 MontaVista Software, Inc.
+ * Matt Porter <[email protected]>
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#ifndef __PPC_SYSLIB_PPC85XX_RIO_H
+#define __PPC_SYSLIB_PPC85XX_RIO_H
+
+#include <linux/config.h>
+#include <linux/init.h>
+
+extern void mpc85xx_rio_setup(int law_start, int law_size);
+
+#endif				/* __PPC_SYSLIB_PPC85XX_RIO_H */
include/asm-ppc/rio.h (mode:100644) renamed from dev/null (tree:750e10a6553cacbd2b92b52fe40afdc8062f4f78) +18 -0
Index: include/asm-ppc/rio.h
===================================================================
@@ -0,0 +1,18 @@
+/*
+ * RapidIO architecture support
+ *
+ * Copyright 2005 MontaVista Software, Inc.
+ * Matt Porter <[email protected]>
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#ifndef ASM_PPC_RIO_H
+#define ASM_PPC_RIO_H
+
+extern void platform_rio_init(void);
+
+#endif				/* ASM_PPC_RIO_H */
#2 lore raw

PATCH 3/3 RapidIO support: net driver over messaging

Adds an "Ethernet" driver which sends Ethernet packets over the standard RapidIO messaging. This depends on the core RIO patch for mailbox/doorbell access.

drivers/net/Kconfig (mode:100644) +14 -0
Index: drivers/net/Kconfig
===================================================================
@@ -2185,6 +2185,20 @@
 	tristate "iSeries Virtual Ethernet driver support"
 	depends on NETDEVICES && PPC_ISERIES
 
+config RIONET
+	tristate "RapidIO Ethernet over messaging driver support"
+	depends on NETDEVICES && RAPIDIO
+
+config RIONET_TX_SIZE
+	int "Number of outbound queue entries"
+	depends on RIONET
+	default "128"
+
+config RIONET_RX_SIZE
+	int "Number of inbound queue entries"
+	depends on RIONET
+	default "128"
+
 config FDDI
 	bool "FDDI driver support"
 	depends on NETDEVICES && (PCI || EISA)
drivers/net/Makefile (mode:100644) +1 -0
Index: drivers/net/Makefile
===================================================================
@@ -58,6 +58,7 @@
 obj-$(CONFIG_VIA_RHINE) += via-rhine.o
 obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o
 obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o
+obj-$(CONFIG_RIONET) += rionet.o
 
 #
 # end link order section
drivers/net/rionet.c (mode:100644) renamed from dev/null (tree:f0bf7810dbe8c4073832d6c3785364084e9523a7) +622 -0

622 lines not on this page · raw message

#3 lore raw
In reply to Matt Porter

Quick review comments:

1. Why hack up vmlinux.lds.h? wouldn't declaring rio_route_ops to be a constant do what you want?

2. Unnecessary initializers

+struct bus_type rio_bus_type = {
+ .name = "rapidio",
+ .match = rio_match_bus,
+ .suspend = NULL,
+ .resume = NULL,

NULL is unnecessary here.

3. Use existing macro's

+#define DEBUG
+
+#ifdef DEBUG
+#define DBG(x...) printk(x)
+#else
+#define DBG(x...)
+#endif
+

Use pr_debug() and isn't this debugged yet?

4. Lists should be static if possible

+
+LIST_HEAD(rio_mports);
static LIST_HEAD(rio_mports)

5. rio_nets defined but not used (if it is used later then make it visible to only that code.)

6. rio_net_lock does it need to be global. also maybe a name change to rio_global_list_lock

#4 lore raw
Quoted 1 line · Stephen Hemminger

Quick review comments:

Thanks for taking the time to look at this.

Quoted 2 lines

1. Why hack up vmlinux.lds.h? wouldn't declaring rio_route_ops to be a constant do what you want?

There are more switch devices to be added. That is, each vendor has their own way to set/get route table entries. This approach makes it easy to add a fooswitch.c without adding an entry to a separate constant table as we support additional switches (at least 5 vendors so far). I originally looked at how PCI was using a section for quirks and figured that was OK to copy. I can see how PCI might justify it a bit more since it is allowing arch-specific quirks to be registered without modifying a generic PCI table of quirks. If it's a concern, I can make a constant table but it's not as nice IMHO.

FWIW, I was going to expand usage of RIO-specific sections a bit more, so I'd like to see what the consensus is on using sections to generate tables at build time. Specifically, support for MMIO regions requires node specific operations (specific to each vendor device) as RIO neglected to standardize something like BARs a la PCI. My intention was to put some device-specific ops to get the size of active MMIO regions etc. with the same approach as the switch ops.

Quoted 9 lines

2. Unnecessary initializers

(quoted diff) +5 -0
+struct bus_type rio_bus_type = {
+	.name = "rapidio",
+	.match = rio_match_bus,
+	.suspend = NULL,
+	.resume = NULL,

NULL is unnecessary here.

I'll drop those.

Quoted 11 lines

3. Use existing macro's

(quoted diff) +8 -0
+#define DEBUG
+
+#ifdef DEBUG
+#define DBG(x...) printk(x)
+#else
+#define DBG(x...)
+#endif
+
Quoted 1 line

Use pr_debug() and isn't this debugged yet?

That was to control debug info per-file, but can be changed. It's debugged to a certain level, but some network configuration are going to expose corner cases that I haven't noticed while testing with 2-3 boards on the 1st gen hardware. Same reason there are still debug statements riddled throughout the PCI code...there's always more bugs. :)

Quoted 5 lines

4. Lists should be static if possible

(quoted diff) +2 -0
+
+LIST_HEAD(rio_mports);

static LIST_HEAD(rio_mports)

Ok, will do.

Quoted 2 lines

5. rio_nets defined but not used (if it is used later then make it visible to only that code.)

That was supposed to be removed as I don't yet have a use for it. I'll remove it.

Quoted 2 lines

6. rio_net_lock does it need to be global. also maybe a name change to rio_global_list_lock

It is taken outside of rio-scan.c while searching lists so it can't be static. The name does suck, though. I'll change it to something like that.

-Matt

#5 lore raw
In reply to Matt Porter
Quoted 6 lines · Matt Porter

Adds a RapidIO subsystem to the kernel. RIO is a switched fabric interconnect used in higher-end embedded applications. The curious can look at the specs over at http://www.rapidio.org

The core code implements enumeration/discovery, management of devices/resources, and interfaces for RIO drivers.

I'm also hacking on a rioutils package (derived from pciutils) that has a lsrio that works pretty much like the familiar lspci tool. The initial release can be grabbed from:
ftp://source.mvista.com/pub/rio/rioutils-0.10.tar.bz2

-Matt

#6 lore raw
In reply to Matt Porter
Quoted 7 lines · Matt Porter

Adds a RapidIO subsystem to the kernel. RIO is a switched fabric interconnect used in higher-end embedded applications. The curious can look at the specs over at http://www.rapidio.org

The core code implements enumeration/discovery, management of devices/resources, and interfaces for RIO drivers.

Quoted 8 lines

There's a lot more to do to take advantages of all the hardware features. However, this should provide a good base for folks with RIO hardware to start contributing.

Patch is 108KB and can be found here:
ftp://source.mvista.com/pub/rio/l26_rio_core.patch

Care to split it up into logical sections and post it? It should be small enough to do so that way.

thanks,

greg k-h

#7 lore raw
Quoted 3 lines · Greg KH
Quoted 2 lines · Matt Porter

Adds a RapidIO subsystem to the kernel. RIO is a switched fabric interconnect used in higher-end embedded applications.

<snip>

Quoted 6 lines
Quoted 3 lines

The curious can look at the specs over at http://www.rapidio.org
Patch is 108KB and can be found here:
ftp://source.mvista.com/pub/rio/l26_rio_core.patch

Care to split it up into logical sections and post it? It should be small enough to do so that way.

Ok.

My gut told me to not trust SubmittingPatches but I did it anyway. :) A new 5 part patch series is going out now with current comments incorporated.

-Matt

#8 lore raw
In reply to Matt Porter
Quoted 2 lines · Matt Porter

Patch is 108KB and can be found here:
ftp://source.mvista.com/pub/rio/l26_rio_core.patch

register_driver() does not return the number of devices bound to the driver. So your comment in rio_register_driver() is incorrect. Just return count.

Hm, if the patch was inline it would be easier to comment on stuff like this, I'll wait till then for the rest :)

thanks,

greg k-h