Add the memory management driver to RapidIO.
Subsystems (2)
PATCH 5/5 Add the memory management driver to RapidIO.
Add the memory management driver to RapidIO.
The RapidIO system size is changed to automatically detection. Add the memory mapping driver for RapidIO to RIO basic driver. Multi master ports are supported.
The simple Bitmap RIO space allocator driver is added.
Signed-off-by Zhang Wei <[email protected]>
--- drivers/net/rionet.c | 17 +- drivers/rapidio/Kconfig | 18 +- drivers/rapidio/Makefile | 1 + drivers/rapidio/rio-access.c | 10 +- drivers/rapidio/rio-scan.c | 53 +++-- drivers/rapidio/rio-sysfs.c | 3 +- drivers/rapidio/rio.c | 479 ++++++++++++++++++++++++++++++++++- drivers/rapidio/rio.h | 9 +- drivers/rapidio/sallocator/Kconfig | 9 + drivers/rapidio/sallocator/Makefile | 2 + drivers/rapidio/sallocator/bitmap.c | 384 ++++++++++++++++++++++++++++ include/linux/rio.h | 71 +++++- include/linux/rio_drv.h | 41 +++- 13 files changed, 1038 insertions(+), 59 deletions(-) create mode 100644 drivers/rapidio/sallocator/Kconfig create mode 100644 drivers/rapidio/sallocator/Makefile create mode 100644 drivers/rapidio/sallocator/bitmap.c
drivers/net/rionet.c +15 -2
@@ -78,7 +78,7 @@ static int rionet_capable = 1;* could be made into a hash table to save memory depending * on system trade-offs. */ -static struct rio_dev *rionet_active[RIO_MAX_ROUTE_ENTRIES ]; +static struct rio_dev **rionet_active;#define is_rionet_capable (pef, src_ops, dst_ops) \ ((pef & RIO_PEF_INB_MBOX) && \
@@ -115,6 +115,7 @@ static int rionet_rx_clean(struct net_device *ndev) rnet->rx_skb[i]->data = data;skb_put (rnet->rx_skb[i],RIO_MAX_MSG_SIZE ); + rnet->rx_skb[i]->dev = ndev; rnet->rx_skb[i]->protocol =eth_type_trans (rnet->rx_skb[i], ndev); error =netif_rx (rnet->rx_skb[i]);
@@ -202,7 +203,8 @@ static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev) }if (eth->h_dest[0 ] &0x01 ) { -for (i =0 ; i <RIO_MAX_ROUTE_ENTRIES ; i++) +for (i =0 ; i <RIO_MAX_ROUTE_ENTRIES (rnet->mport->sys_size); + i++)if (rionet_active[i])rionet_queue_tx_msg (skb, ndev, rionet_active[i]);
@@ -392,6 +394,8 @@ static void rionet_remove(struct rio_dev *rdev)struct net_device *ndev =NULL ;struct rionet_peer *peer, *tmp; +free_pages ((unsigned long )rionet_active, rdev->net->hport->sys_size ? +__ilog2 (sizeof (void *)) +4 :0 );unregister_netdev (ndev);kfree (ndev);
@@ -449,6 +453,15 @@ static int rionet_setup_netdev(struct rio_mport *mport) goto out; } +if (!(rionet_active = (struct rio_dev **)__get_free_pages (GFP_KERNEL , + mport->sys_size ?__ilog2 (sizeof (void *)) +4 + :0 ))) { + rc = -ENOMEM ; + goto out; + } +memset ((void *)rionet_active,0 ,sizeof (void *) * +RIO_MAX_ROUTE_ENTRIES (mport->sys_size)); +/* Set up private area */ rnet = (struct rionet_private *)ndev->priv; rnet->mport = mport;
drivers/rapidio/Kconfig +10 -8
@@ -1,14 +1,6 @@ # # RapidIO configuration # -config RAPIDIO_8_BIT_TRANSPORT - bool "8-bit transport addressing" - depends on RAPIDIO - ---help--- - By default, the kernel assumes a 16-bit addressed RapidIO - network. By selecting this option, the kernel will support - an 8-bit addressed network. - config RAPIDIO_DISC_TIMEOUT int "Discovery timeout duration (seconds)" depends on RAPIDIO
@@ -16,3 +8,13 @@ config RAPIDIO_DISC_TIMEOUT ---help--- Amount of time a discovery node waits for a host to complete enumeration before giving up. + +config RAPIDIO_PROC_FS + bool "I/O and Memory resource debug" + depends on RAPIDIO && PROC_FS + default y + ---help--- + Enable this option, it will create a /proc/riores node for + monitoring the RapidIO I/O and Memory resource. + +source "drivers/rapidio/sallocator/Kconfig"
drivers/rapidio/Makefile +1 -0
@@ -4,3 +4,4 @@ obj-y += rio.o rio-access.o rio-driver.o rio-scan.o rio-sysfs.o obj-$(CONFIG_RAPIDIO) += switches/ +obj-$(CONFIG_RAPIDIO) += sallocator/
drivers/rapidio/rio-access.c +5 -5
@@ -48,7 +48,7 @@ int __rio_local_read_config_##size \u32 data =0 ; \ if (RIO_##size##_BAD) return RIO_BAD_SIZE; \spin_lock_irqsave (&rio_config_lock, flags); \ - res = mport->ops->lcread (mport->id, offset, len, &data); \ + res = mport->ops->lcread (mport, mport->id, offset, len, &data); \ *value = (type )data; \spin_unlock_irqrestore (&rio_config_lock, flags); \return res; \
@@ -71,7 +71,7 @@ int __rio_local_write_config_##size \unsigned long flags; \ if (RIO_##size##_BAD) return RIO_BAD_SIZE; \spin_lock_irqsave (&rio_config_lock, flags); \ - res = mport->ops->lcwrite (mport->id, offset, len, value); \ + res = mport->ops->lcwrite (mport, mport->id, offset, len, value);\spin_unlock_irqrestore (&rio_config_lock, flags); \return res; \ }
@@ -108,7 +108,7 @@ int rio_mport_read_config_##size \u32 data =0 ; \ if (RIO_##size##_BAD) return RIO_BAD_SIZE; \spin_lock_irqsave (&rio_config_lock, flags); \ - res = mport->ops->cread (mport->id, destid, hopcount, offset, len, &data); \ + res = mport->ops->cread (mport, mport->id, destid, hopcount, offset, len, &data); \ *value = (type )data; \spin_unlock_irqrestore (&rio_config_lock, flags); \return res; \
@@ -131,7 +131,7 @@ int rio_mport_write_config_##size \unsigned long flags; \ if (RIO_##size##_BAD) return RIO_BAD_SIZE; \spin_lock_irqsave (&rio_config_lock, flags); \ - res = mport->ops->cwrite (mport->id, destid, hopcount, offset, len, value); \ + res = mport->ops->cwrite (mport, mport->id, destid, hopcount, offset, len, value); \spin_unlock_irqrestore (&rio_config_lock, flags); \return res; \ }
@@ -166,7 +166,7 @@ int rio_mport_send_doorbell(struct rio_mport *mport, u16 destid, u16 data)unsigned long flags;spin_lock_irqsave (&rio_doorbell_lock, flags); - res = mport->ops->dsend (mport->id, destid, data); + res = mport->ops->dsend (mport, mport->id, destid, data);spin_unlock_irqrestore (&rio_doorbell_lock, flags);return res;
drivers/rapidio/rio-scan.c +37 -16
149 lines not on this page · raw message
drivers/rapidio/rio-sysfs.c +2 -1
@@ -43,7 +43,8 @@ static ssize_t routes_show(struct device *dev, struct device_attribute *attr, chif (!rdev->rswitch) goto out; -for (i =0 ; i <RIO_MAX_ROUTE_ENTRIES ; i++) { +for (i =0 ; i <RIO_MAX_ROUTE_ENTRIES (rdev->net->hport->sys_size); + i++) {if (rdev->rswitch->route_table[i] ==RIO_INVALID_ROUTE )continue ; str +=
drivers/rapidio/rio.c +476 -3
516 lines not on this page · raw message
drivers/rapidio/rio.h +2 -7
@@ -51,10 +51,5 @@ extern struct rio_route_ops __end_rio_route_ops[]; DECLARE_RIO_ROUTE_SECTION(.rio_route_ops, \ vid, did, add_hook, get_hook) -#ifdef CONFIG_RAPIDIO_8_BIT_TRANSPORT -#define RIO_GET_DID (x) ((x & 0x00ff0000) >> 16) -#define RIO_SET_DID (x) ((x & 0x000000ff) << 16) -#else -#define RIO_GET_DID (x) (x & 0xffff) -#define RIO_SET_DID (x) (x & 0xffff) -#endif +#define RIO_GET_DID (size, x) (size ? (x & 0xffff) : ((x & 0x00ff0000) >> 16)) +#define RIO_SET_DID (size, x) (size ? (x & 0xffff) : ((x & 0x000000ff) << 16))
drivers/rapidio/sallocator/Kconfig new file +9 -0
@@ -0,0 +1,9 @@ +choice + prompt "Default RapidIO Space Allocator" + depends on RAPIDIO + default RIO_SA_DEFAULT_BITMAP + + config RIO_SA_DEFAULT_BITMAP + bool "Bitmap" + +endchoice
drivers/rapidio/sallocator/Makefile new file +2 -0
@@ -0,0 +1,2 @@ + +obj-$(CONFIG_RIO_SA_DEFAULT_BITMAP) += bitmap.o
drivers/rapidio/sallocator/bitmap.c new file +384 -0
384 lines not on this page · raw message
include/linux/rio.h +59 -12
129 lines not on this page · raw message
include/linux/rio_drv.h +36 -5
61 lines not on this page · raw message
Signature · 1 line
1.5.1