Skip to contentSkip to conversation

prepare XPC and XPNET to support SGI UV -v2

PATCH New Dean Nelson 1 participant 6 messages Mar 26, 2008 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

cover prepare XPC and XPNET to support SGI UV -v2

This set of five patches moves XPC and XPNET to drivers/misc/xp in preparation for enabling X86_64 support.

#1 lore raw

PATCH 1/5 add multi-page allocation to the uncached allocator -v2

Enable the uncached allocator to allocate multiple pages of contiguous uncached memory.

---

 arch/ia64/kernel/uncached.c |   21 ++++++++++++---------
 drivers/char/mspec.c        |   12 ++++++------
 include/asm-ia64/uncached.h |    4 ++--
 3 files changed, 20 insertions(+), 17 deletions(-)

Index: linux-2.6/arch/ia64/kernel/uncached.c
=================================--- linux-2.6.orig/arch/ia64/kernel/uncached.c 2007-10-04 06:52:20.000000000 -0500
+++ linux-2.6/arch/ia64/kernel/uncached.c 2007-11-08 12:14:31.408258515 -0600
@@ -177,12 +177,13 @@
* uncached_alloc_page
*
* @starting_nid: node id of node to start with, or -1
+ * @n_pages: number of contiguous pages to allocate
*
- * Allocate 1 uncached page. Allocates on the requested node. If no
- * uncached pages are available on the requested node, roundrobin starting
- * with the next higher node.
+ * Allocate the specified number of contiguous uncached pages on the
+ * the requested node. If not enough contiguous uncached pages are available
+ * on the requested node, roundrobin starting with the next higher node. */
-unsigned long uncached_alloc_page(int starting_nid)
+unsigned long uncached_alloc_page(int starting_nid, int n_pages)
{
unsigned long uc_addr;
struct uncached_pool *uc_pool;
@@ -202,7 +203,8 @@
if (uc_pool->pool = NULL)
continue;
do {
- uc_addr = gen_pool_alloc(uc_pool->pool, PAGE_SIZE);
+ uc_addr = gen_pool_alloc(uc_pool->pool,
+ n_pages * PAGE_SIZE);
if (uc_addr != 0)
return uc_addr;
} while (uncached_add_chunk(uc_pool, nid) = 0);
@@ -217,11 +219,12 @@
/*
* uncached_free_page
*
- * @uc_addr: uncached address of page to free
+ * @uc_addr: uncached address of first page to free
+ * @n_pages: number of contiguous pages to free
*
- * Free a single uncached page.
+ * Free the specified number of uncached pages.
*/
-void uncached_free_page(unsigned long uc_addr)
+void uncached_free_page(unsigned long uc_addr, int n_pages)
{
int nid = paddr_to_nid(uc_addr - __IA64_UNCACHED_OFFSET); struct gen_pool *pool = uncached_pools[nid].pool;
@@ -232,7 +235,7 @@
if ((uc_addr & (0XFUL << 60)) != __IA64_UNCACHED_OFFSET)
panic("uncached_free_page invalid address %lx\n", uc_addr);

- gen_pool_free(pool, uc_addr, PAGE_SIZE);
+ gen_pool_free(pool, uc_addr, n_pages * PAGE_SIZE);
}
EXPORT_SYMBOL(uncached_free_page);

Index: linux-2.6/drivers/char/mspec.c
=================================--- linux-2.6.orig/drivers/char/mspec.c 2007-10-04 06:52:21.000000000 -0500
+++ linux-2.6/drivers/char/mspec.c 2007-11-08 12:07:17.458415225 -0600
@@ -180,7 +180,7 @@
my_page = vdata->maddr[index]; vdata->maddr[index] = 0;
if (!mspec_zero_block(my_page, PAGE_SIZE))
- uncached_free_page(my_page);
+ uncached_free_page(my_page, 1);
else
printk(KERN_WARNING "mspec_close(): "
"failed to zero page %ld\n", my_page);
@@ -209,7 +209,7 @@
index = (address - vdata->vm_start) >> PAGE_SHIFT; maddr = (volatile unsigned long) vdata->maddr[index]; if (maddr = 0) {
- maddr = uncached_alloc_page(numa_node_id());
+ maddr = uncached_alloc_page(numa_node_id(), 1);
if (maddr = 0)
return NOPFN_OOM;

@@ -218,7 +218,7 @@
vdata->count++; vdata->maddr[index] = maddr;
} else {
- uncached_free_page(maddr);
+ uncached_free_page(maddr, 1);
maddr = vdata->maddr[index];
}
spin_unlock(&vdata->lock);
@@ -367,7 +367,7 @@
int nasid; unsigned long phys;

- scratch_page[nid] = uncached_alloc_page(nid);
+ scratch_page[nid] = uncached_alloc_page(nid, 1);
if (scratch_page[nid] = 0)
goto free_scratch_pages;
phys = __pa(scratch_page[nid]);
@@ -414,7 +414,7 @@
free_scratch_pages:
for_each_node(nid) {
if (scratch_page[nid] != 0)
- uncached_free_page(scratch_page[nid]);
+ uncached_free_page(scratch_page[nid], 1);
}
return ret;
}
@@ -431,7 +431,7 @@

for_each_node(nid) {
if (scratch_page[nid] != 0)
- uncached_free_page(scratch_page[nid]);
+ uncached_free_page(scratch_page[nid], 1);
}
}
}
Index: linux-2.6/include/asm-ia64/uncached.h
=================================--- linux-2.6.orig/include/asm-ia64/uncached.h 2007-10-04 06:52:25.000000000 -0500
+++ linux-2.6/include/asm-ia64/uncached.h 2007-11-08 12:05:00.633469891 -0600
@@ -8,5 +8,5 @@
* Prototypes for the uncached page allocator */

-extern unsigned long uncached_alloc_page(int nid); -extern void uncached_free_page(unsigned long); +extern unsigned long uncached_alloc_page(int, int); +extern void uncached_free_page(unsigned long, int);

#2 lore raw

PATCH 2/5 move XP and XPC to drivers/misc/xp -v2

In reply to Dean Nelson

Move XPC and XPNET from arch/ia64/sn to drivers/misc/xp.

---

 arch/ia64/Kconfig                                  |   11 -----------
 arch/ia64/sn/kernel/Makefile                       |    5 -----
 drivers/misc/Kconfig                               |   12 ++++++++++++
 drivers/misc/Makefile                              |    1 +
 drivers/misc/xp/Makefile                           |    9 +++++++++
 {include/asm-ia64/sn => drivers/misc/xp}/xp.h      |    0 
 {arch/ia64/sn/kernel => drivers/misc/xp}/xp_main.c |    0 
 .../sn/kernel => drivers/misc/xp}/xp_nofault.S     |    0 
 {include/asm-ia64/sn => drivers/misc/xp}/xpc.h     |    0 
 .../sn/kernel => drivers/misc/xp}/xpc_channel.c    |    0 
 .../ia64/sn/kernel => drivers/misc/xp}/xpc_main.c  |    0 
 .../sn/kernel => drivers/misc/xp}/xpc_partition.c  |    0 
 {arch/ia64/sn/kernel => drivers/misc/xp}/xpnet.c   |    0 
 13 files changed, 22 insertions(+), 16 deletions(-)
arch/ia64/Kconfig +0 -11
index 8fa3faf..c6adc39 100644
@@ -266,17 +266,6 @@ config IOSAPIC
 	depends on !IA64_HP_SIM
 	default y
 
-config IA64_SGI_SN_XP
-	tristate "Support communication between SGI SSIs"
-	depends on IA64_GENERIC || IA64_SGI_SN2
-	select IA64_UNCACHED_ALLOCATOR
-	help
-	  An SGI machine can be divided into multiple Single System
-	  Images which act independently of each other and have
-	  hardware based memory protection from the others.  Enabling
-	  this feature will allow for direct communication between SSIs
-	  based on a network adapter and DMA messaging.
-
 config FORCE_MAX_ZONEORDER
 	int "MAX_ORDER (11 - 17)"  if !HUGETLB_PAGE
 	range 11 17  if !HUGETLB_PAGE
arch/ia64/sn/kernel/Makefile +0 -5
index 688a3c2..2cc8ea6 100644
@@ -15,9 +15,4 @@ obj-y				+= setup.o bte.o bte_error.o irq.o mca.o idle.o \
 				   sn2/
 obj-$(CONFIG_IA64_GENERIC)      += machvec.o
 obj-$(CONFIG_SGI_TIOCX)		+= tiocx.o
-obj-$(CONFIG_IA64_SGI_SN_XP)	+= xp.o
-xp-y				:= xp_main.o xp_nofault.o
-obj-$(CONFIG_IA64_SGI_SN_XP)	+= xpc.o
-xpc-y				:= xpc_main.o xpc_channel.o xpc_partition.o
-obj-$(CONFIG_IA64_SGI_SN_XP)	+= xpnet.o
 obj-$(CONFIG_PCI_MSI)		+= msi_sn.o
drivers/misc/Kconfig +12 -0
index 962817e..9f45772 100644
@@ -327,4 +327,16 @@ config ENCLOSURE_SERVICES
 	  driver (SCSI/ATA) which supports enclosures
 	  or a SCSI enclosure device (SES) to use these services.
 
+config SGI_XP
+	tristate "Support communication between SGI SSIs"
+	depends on IA64_GENERIC || IA64_SGI_SN2
+	select IA64_UNCACHED_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2
+	select GENERIC_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2
+	---help---
+	  An SGI machine can be divided into multiple Single System
+	  Images which act independently of each other and have
+	  hardware based memory protection from the others.  Enabling
+	  this feature will allow for direct communication between SSIs
+	  based on a network adapter and DMA messaging.
+
 endif # MISC_DEVICES
drivers/misc/Makefile +1 -0
index 3b12f5d..743b245 100644
@@ -22,3 +22,4 @@ obj-$(CONFIG_FUJITSU_LAPTOP)	+= fujitsu-laptop.o
 obj-$(CONFIG_EEPROM_93CX6)	+= eeprom_93cx6.o
 obj-$(CONFIG_INTEL_MENLOW)	+= intel_menlow.o
 obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o
+obj-$(CONFIG_SGI_XP)		+= xp/
drivers/misc/xp/Makefile new file +9 -0
new file mode 100644
index 0000000..70dfdd3
@@ -0,0 +1,9 @@
+#
+# Makefile for XP devices.
+#
+
+obj-$(CONFIG_SGI_XP)		+= xp.o
+xp-y				:= xp_main.o xp_nofault.o
+obj-$(CONFIG_SGI_XP)		+= xpc.o
+xpc-y				:= xpc_main.o xpc_channel.o xpc_partition.o
+obj-$(CONFIG_SGI_XP)		+= xpnet.o
drivers/misc/xp/xp.h renamed from include/asm-ia64/sn/xp.h +0 -0
similarity index 100%
rename from include/asm-ia64/sn/xp.h
rename to drivers/misc/xp/xp.h
drivers/misc/xp/xp_main.c renamed from arch/ia64/sn/kernel/xp_main.c +0 -0
similarity index 100%
rename from arch/ia64/sn/kernel/xp_main.c
rename to drivers/misc/xp/xp_main.c
drivers/misc/xp/xp_nofault.S renamed from arch/ia64/sn/kernel/xp_nofault.S +0 -0
similarity index 100%
rename from arch/ia64/sn/kernel/xp_nofault.S
rename to drivers/misc/xp/xp_nofault.S
drivers/misc/xp/xpc.h renamed from include/asm-ia64/sn/xpc.h +0 -0
similarity index 100%
rename from include/asm-ia64/sn/xpc.h
rename to drivers/misc/xp/xpc.h
drivers/misc/xp/xpc_channel.c renamed from arch/ia64/sn/kernel/xpc_channel.c +0 -0
similarity index 100%
rename from arch/ia64/sn/kernel/xpc_channel.c
rename to drivers/misc/xp/xpc_channel.c
drivers/misc/xp/xpc_main.c renamed from arch/ia64/sn/kernel/xpc_main.c +0 -0
similarity index 100%
rename from arch/ia64/sn/kernel/xpc_main.c
rename to drivers/misc/xp/xpc_main.c
drivers/misc/xp/xpc_partition.c renamed from arch/ia64/sn/kernel/xpc_partition.c +0 -0
similarity index 100%
rename from arch/ia64/sn/kernel/xpc_partition.c
rename to drivers/misc/xp/xpc_partition.c
drivers/misc/xp/xpnet.c renamed from arch/ia64/sn/kernel/xpnet.c +0 -0
similarity index 100%
rename from arch/ia64/sn/kernel/xpnet.c
rename to drivers/misc/xp/xpnet.c
#3 lore raw

PATCH 3/5 prepare XPC and XPNET for future support of SGIs UV architecture -v2

In reply to Dean Nelson

Prepared XPC and XPNET for future support of SGI's UV architecture. Made changes so it compiles on x86_64. Added support for up to 256 partitions. Cleaned up BTE error conversion for is64 sn2.

---

 arch/ia64/sn/kernel/setup.c     |    4
 drivers/misc/Kconfig            |    2
 drivers/misc/xp/Makefile        |    5
 drivers/misc/xp/xp.h            |  382 ++++++++++----------
 drivers/misc/xp/xp_main.c       |  181 ++++++---
 drivers/misc/xp/xp_nofault.S    |    2
 drivers/misc/xp/xp_sn2.c        |  487 ++++++++++++++++++++++++++
 drivers/misc/xp/xp_uv.c         |  194 ++++++++++
 drivers/misc/xp/xpc.h           |  594 +++++++++++++++----------------
 drivers/misc/xp/xpc_channel.c   |  357 +++++++++----------
 drivers/misc/xp/xpc_main.c      |  273 +++++++-------
 drivers/misc/xp/xpc_partition.c |  670 +++++++++++++++---------------------
 drivers/misc/xp/xpnet.c         |  280 ++++++---------
 include/asm-ia64/sn/arch.h      |    5
 include/asm-ia64/sn/bte.h       |    5
 15 files changed, 2010 insertions(+), 1431 deletions(-)
drivers/misc/xp/xp.h +201 -183
Index: linux-2.6/drivers/misc/xp/xp.h
===================================================================
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2004-2005 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 2004-2008 Silicon Graphics, Inc. All rights reserved.
  */
 
 
@@ -12,15 +12,28 @@
  */
 
 
-#ifndef _ASM_IA64_SN_XP_H
-#define _ASM_IA64_SN_XP_H
+#ifndef _DRIVERS_MISC_XP_XP_H
+#define _DRIVERS_MISC_XP_XP_H
 
 
 #include <linux/cache.h>
 #include <linux/hardirq.h>
 #include <linux/mutex.h>
-#include <asm/sn/types.h>
-#include <asm/sn/bte.h>
+#ifdef CONFIG_IA64
+#include <asm/sn/arch.h>
+#endif
+
+/* >>> Add these two #defines to some linux header file some day. */
+#define BYTES_PER_WORD	sizeof(void *)
+#define BITS_PER_WORD	(BYTES_PER_WORD * BITS_PER_BYTE)
+
+#if defined(CONFIG_IA64)
+#define U64_ELL "l"
+#elif defined(CONFIG_X86_64)
+#define U64_ELL "ll"
+#else
+#error architecture is NOT supported
+#endif
 
 
 #ifdef USE_DBUG_ON
@@ -30,6 +43,23 @@
 #endif
 
 
+#ifndef is_shub1
+#define is_shub1()	0
+#endif
+
+#ifndef is_shub2
+#define is_shub2()	0
+#endif
+
+#ifndef is_shub
+#define is_shub()	0
+#endif
+
+#ifndef is_uv
+#define is_uv()		0
+#endif
+
+
 /*
  * Define the maximum number of logically defined partitions the system
  * can support. It is constrained by the maximum number of hardware
@@ -41,60 +71,15 @@
  * maximum number of nodes in the entire system divided by the minimum number
  * of nodes that comprise an access protection grouping.
  */
-#define XP_MAX_PARTITIONS	64
-
-
-/*
- * Define the number of u64s required to represent all the C-brick nasids
- * as a bitmap.  The cross-partition kernel modules deal only with
- * C-brick nasids, thus the need for bitmaps which don't account for
- * odd-numbered (non C-brick) nasids.
- */
-#define XP_MAX_PHYSNODE_ID	(MAX_NUMALINK_NODES / 2)
-#define XP_NASID_MASK_BYTES	((XP_MAX_PHYSNODE_ID + 7) / 8)
-#define XP_NASID_MASK_WORDS	((XP_MAX_PHYSNODE_ID + 63) / 64)
-
+#define XP_NPARTITIONS		64	/* #of partitions allowed */
+#define XP_MAX_NPARTITIONS	256	/* max #of partitions possible */
 
-/*
- * Wrapper for bte_copy() that should it return a failure status will retry
- * the bte_copy() once in the hope that the failure was due to a temporary
- * aberration (i.e., the link going down temporarily).
- *
- * 	src - physical address of the source of the transfer.
- *	vdst - virtual address of the destination of the transfer.
- *	len - number of bytes to transfer from source to destination.
- *	mode - see bte_copy() for definition.
- *	notification - see bte_copy() for definition.
- *
- * Note: xp_bte_copy() should never be called while holding a spinlock.
- */
-static inline bte_result_t
-xp_bte_copy(u64 src, u64 vdst, u64 len, u64 mode, void *notification)
-{
-	bte_result_t ret;
-	u64 pdst = ia64_tpa(vdst);
-
-
-	/*
-	 * Ensure that the physically mapped memory is contiguous.
-	 *
-	 * We do this by ensuring that the memory is from region 7 only.
-	 * If the need should arise to use memory from one of the other
-	 * regions, then modify the BUG_ON() statement to ensure that the
-	 * memory from that region is always physically contiguous.
-	 */
-	BUG_ON(REGION_NUMBER(vdst) != RGN_KERNEL);
-
-	ret = bte_copy(src, pdst, len, mode, notification);
-	if ((ret != BTE_SUCCESS) && BTE_ERROR_RETRY(ret)) {
-		if (!in_interrupt()) {
-			cond_resched();
-		}
-		ret = bte_copy(src, pdst, len, mode, notification);
-	}
+#if XP_NPARTITIONS > XP_MAX_NPARTITIONS
+#error  XP_NPARTITIONS exceeds MAXIMUM possible.
+#endif
 
-	return ret;
-}
+#define XP_MIN_PARTID		1			/* inclusive */
+#define XP_MAX_PARTID		(XP_NPARTITIONS - 1)	/* inclusive */
 
 
 /*
@@ -115,11 +100,11 @@ xp_bte_copy(u64 src, u64 vdst, u64 len, 
 #define XPC_MEM_CHANNEL		0	/* memory channel number */
 #define	XPC_NET_CHANNEL		1	/* network channel number */
 
-#define	XPC_NCHANNELS		2	/* #of defined channels */
-#define XPC_MAX_NCHANNELS	8	/* max #of channels allowed */
+#define	XPC_NCHANNELS		2	/* #of channels allowed */
+#define XPC_MAX_NCHANNELS	8	/* max #of channels possible */
 
 #if XPC_NCHANNELS > XPC_MAX_NCHANNELS
-#error	XPC_NCHANNELS exceeds MAXIMUM allowed.
+#error	XPC_NCHANNELS exceeds MAXIMUM possible.
 #endif
 
 
@@ -133,7 +118,7 @@ xp_bte_copy(u64 src, u64 vdst, u64 len, 
  *      +----------------------------------------+
  *      |     payload (user-defined message)     |
  *      |                                        |
- *         		:
+ *			:
  *      |                                        |
  *      +----------------------------------------+
  *
@@ -169,106 +154,103 @@ struct xpc_msg {
 /*
  * Define the return values and values passed to user's callout functions.
  * (It is important to add new value codes at the end just preceding
- * xpcUnknownReason, which must have the highest numerical value.)
+ * xpUnknownReason, which must have the highest numerical value.)
  */
-enum xpc_retval {
-	xpcSuccess = 0,
-
-	xpcNotConnected,	/*  1: channel is not connected */
-	xpcConnected,		/*  2: channel connected (opened) */
-	xpcRETIRED1,		/*  3: (formerly xpcDisconnected) */
-
-	xpcMsgReceived,		/*  4: message received */
-	xpcMsgDelivered,	/*  5: message delivered and acknowledged */
-
-	xpcRETIRED2,		/*  6: (formerly xpcTransferFailed) */
-
-	xpcNoWait,		/*  7: operation would require wait */
-	xpcRetry,		/*  8: retry operation */
-	xpcTimeout,		/*  9: timeout in xpc_allocate_msg_wait() */
-	xpcInterrupted,		/* 10: interrupted wait */
-
-	xpcUnequalMsgSizes,	/* 11: message size disparity between sides */
-	xpcInvalidAddress,	/* 12: invalid address */
+enum xp_retval {
+	xpSuccess = 0,
 
-	xpcNoMemory,		/* 13: no memory available for XPC structures */
-	xpcLackOfResources,	/* 14: insufficient resources for operation */
-	xpcUnregistered,	/* 15: channel is not registered */
-	xpcAlreadyRegistered,	/* 16: channel is already registered */
+	xpNotConnected,		/*  1: channel is not connected */
+	xpConnected,		/*  2: channel connected (opened) */
+	xpRETIRED1,		/*  3: (formerly xpDisconnected) */
 
-	xpcPartitionDown,	/* 17: remote partition is down */
-	xpcNotLoaded,		/* 18: XPC module is not loaded */
-	xpcUnloading,		/* 19: this side is unloading XPC module */
+	xpMsgReceived,		/*  4: message received */
+	xpMsgDelivered,		/*  5: message delivered and acknowledged */
 
-	xpcBadMagic,		/* 20: XPC MAGIC string not found */
+	xpRETIRED2,		/*  6: (formerly xpTransferFailed) */
 
-	xpcReactivating,	/* 21: remote partition was reactivated */
+	xpNoWait,		/*  7: operation would require wait */
+	xpRetry,		/*  8: retry operation */
+	xpTimeout,		/*  9: timeout in xpc_allocate_msg_wait() */
+	xpInterrupted,		/* 10: interrupted wait */
 
-	xpcUnregistering,	/* 22: this side is unregistering channel */
-	xpcOtherUnregistering,	/* 23: other side is unregistering channel */
+	xpUnequalMsgSizes,	/* 11: message size disparity between sides */
+	xpInvalidAddress,	/* 12: invalid address */
 
-	xpcCloneKThread,	/* 24: cloning kernel thread */
-	xpcCloneKThreadFailed,	/* 25: cloning kernel thread failed */
+	xpNoMemory,		/* 13: no memory available for XPC structures */
+	xpLackOfResources,	/* 14: insufficient resources for operation */
+	xpUnregistered,		/* 15: channel is not registered */
+	xpAlreadyRegistered,	/* 16: channel is already registered */
 
-	xpcNoHeartbeat,		/* 26: remote partition has no heartbeat */
+	xpPartitionDown,	/* 17: remote partition is down */
+	xpNotLoaded,		/* 18: XPC module is not loaded */
+	xpUnloading,		/* 19: this side is unloading XPC module */
 
-	xpcPioReadError,	/* 27: PIO read error */
-	xpcPhysAddrRegFailed,	/* 28: registration of phys addr range failed */
+	xpBadMagic,		/* 20: XPC MAGIC string not found */
 
-	xpcBteDirectoryError,	/* 29: maps to BTEFAIL_DIR */
-	xpcBtePoisonError,	/* 30: maps to BTEFAIL_POISON */
-	xpcBteWriteError,	/* 31: maps to BTEFAIL_WERR */
-	xpcBteAccessError,	/* 32: maps to BTEFAIL_ACCESS */
-	xpcBtePWriteError,	/* 33: maps to BTEFAIL_PWERR */
-	xpcBtePReadError,	/* 34: maps to BTEFAIL_PRERR */
-	xpcBteTimeOutError,	/* 35: maps to BTEFAIL_TOUT */
-	xpcBteXtalkError,	/* 36: maps to BTEFAIL_XTERR */
-	xpcBteNotAvailable,	/* 37: maps to BTEFAIL_NOTAVAIL */
-	xpcBteUnmappedError,	/* 38: unmapped BTEFAIL_ error */
+	xpReactivating,		/* 21: remote partition was reactivated */
 
-	xpcBadVersion,		/* 39: bad version number */
-	xpcVarsNotSet,		/* 40: the XPC variables are not set up */
-	xpcNoRsvdPageAddr,	/* 41: unable to get rsvd page's phys addr */
-	xpcInvalidPartid,	/* 42: invalid partition ID */
-	xpcLocalPartid,		/* 43: local partition ID */
+	xpUnregistering,	/* 22: this side is unregistering channel */
+	xpOtherUnregistering,	/* 23: other side is unregistering channel */
 
-	xpcOtherGoingDown,	/* 44: other side going down, reason unknown */
-	xpcSystemGoingDown,	/* 45: system is going down, reason unknown */
-	xpcSystemHalt,		/* 46: system is being halted */
-	xpcSystemReboot,	/* 47: system is being rebooted */
-	xpcSystemPoweroff,	/* 48: system is being powered off */
+	xpCloneKThread,		/* 24: cloning kernel thread */
+	xpCloneKThreadFailed,	/* 25: cloning kernel thread failed */
 
-	xpcDisconnecting,	/* 49: channel disconnecting (closing) */
+	xpNoHeartbeat,		/* 26: remote partition has no heartbeat */
 
-	xpcOpenCloseError,	/* 50: channel open/close protocol error */
+	xpPioReadError,		/* 27: PIO read error */
+	xpPhysAddrRegFailed,	/* 28: registration of phys addr range failed */
 
-	xpcDisconnected,	/* 51: channel disconnected (closed) */
+	xpRETIRED3,		/* 29: (formerly xpBteDirectoryError) */
+	xpRETIRED4,		/* 30: (formerly xpBtePoisonError) */
+	xpRETIRED5,		/* 31: (formerly xpBteWriteError) */
+	xpRETIRED6,		/* 32: (formerly xpBteAccessError) */
+	xpRETIRED7,		/* 33: (formerly xpBtePWriteError) */
+	xpRETIRED8,		/* 34: (formerly xpBtePReadError) */
+	xpRETIRED9,		/* 35: (formerly xpBteTimeOutError) */
+	xpRETIRED10,		/* 36: (formerly xpBteXtalkError) */
+	xpRETIRED11,		/* 37: (formerly xpBteNotAvailable) */
+	xpRETIRED12,		/* 38: (formerly xpBteUnmappedError) */
 
-	xpcBteSh2Start,		/* 52: BTE CRB timeout */
+	xpBadVersion,		/* 39: bad version number */
+	xpVarsNotSet,		/* 40: the XPC variables are not set up */
+	xpNoRsvdPageAddr,	/* 41: unable to get rsvd page's phys addr */
+	xpInvalidPartid,	/* 42: invalid partition ID */
+	xpLocalPartid,		/* 43: local partition ID */
 
-				/* 53: 0x1 BTE Error Response Short */
-	xpcBteSh2RspShort = xpcBteSh2Start + BTEFAIL_SH2_RESP_SHORT,
+	xpOtherGoingDown,	/* 44: other side going down, reason unknown */
+	xpSystemGoingDown,	/* 45: system is going down, reason unknown */
+	xpSystemHalt,		/* 46: system is being halted */
+	xpSystemReboot,		/* 47: system is being rebooted */
+	xpSystemPoweroff,	/* 48: system is being powered off */
 
-				/* 54: 0x2 BTE Error Response Long */
-	xpcBteSh2RspLong = xpcBteSh2Start + BTEFAIL_SH2_RESP_LONG,
+	xpDisconnecting,	/* 49: channel disconnecting (closing) */
 
-				/* 56: 0x4 BTE Error Response DSB */
-	xpcBteSh2RspDSB = xpcBteSh2Start + BTEFAIL_SH2_RESP_DSP,
+	xpOpenCloseError,	/* 50: channel open/close protocol error */
 
-				/* 60: 0x8 BTE Error Response Access */
-	xpcBteSh2RspAccess = xpcBteSh2Start + BTEFAIL_SH2_RESP_ACCESS,
+	xpDisconnected,		/* 51: channel disconnected (closed) */
 
-				/* 68: 0x10 BTE Error CRB timeout */
-	xpcBteSh2CRBTO = xpcBteSh2Start + BTEFAIL_SH2_CRB_TO,
+	xpBteCopyError,		/* 52: bte_copy() returned error */
+	xpSalError,		/* 53: sn SAL error */
+	xpNeedMoreInfo,		/* 54: more info is needed by SAL */
 
-				/* 84: 0x20 BTE Error NACK limit */
-	xpcBteSh2NACKLimit = xpcBteSh2Start + BTEFAIL_SH2_NACK_LIMIT,
+	xpUnsupported,		/* 55: unsupported functionality or resource */
+	xpUnknownReason		/* 56: unknown reason (must be last in list) */
+};
 
-				/* 115: BTE end */
-	xpcBteSh2End = xpcBteSh2Start + BTEFAIL_SH2_ALL,
 
-	xpcUnknownReason	/* 116: unknown reason -- must be last in list */
-};
+/* the following are valid xp_set_amo() ops */
+#define XP_AMO_OR	1	/* set variable to (variable | operand) */
+#define XP_AMO_AND	2	/* set variable to (variable & operand) */
+
+/* the following are valid xp_get_amo() ops */
+#define XP_AMO_LOAD	1	/* get variable contents */
+#define XP_AMO_CLEAR	2	/* get variable contents and clear variable */
+
+/* the following are valid xp_change_memprotect() ops */
+#define XP_MEMPROT_DISALLOW_ALL		0
+#define XP_MEMPROT_ALLOW_CPU_AMO	1
+#define XP_MEMPROT_ALLOW_CPU_MEM	2
+#define XP_MEMPROT_ALLOW_ALL		3	/* Shub 1.1 only */
 
 
 /*
@@ -302,83 +284,83 @@ enum xpc_retval {
  *
  * Reason Code          | Cause                          | Optional Data
  * =====================+================================+=====================
- * xpcConnected         | connection has been established| max #of entries
+ * xpConnected          | connection has been established| max #of entries
  *                      | to the specified partition on  | allowed in message
  *                      | the specified channel          | queue
  * ---------------------+--------------------------------+---------------------
- * xpcMsgReceived       | an XPC message arrived from    | address of payload
+ * xpMsgReceived        | an XPC message arrived from    | address of payload
  *                      | the specified partition on the |
  *                      | specified channel              | [the user must call
  *                      |                                | xpc_received() when
  *                      |                                | finished with the
  *                      |                                | payload]
  * ---------------------+--------------------------------+---------------------
- * xpcMsgDelivered      | notification that the message  | NA
+ * xpMsgDelivered       | notification that the message  | NA
  *                      | was delivered to the intended  |
  *                      | recipient and that they have   |
  *                      | acknowledged its receipt by    |
  *                      | calling xpc_received()         |
  * =====================+================================+=====================
- * xpcUnequalMsgSizes   | can't connect to the specified | NULL
+ * xpUnequalMsgSizes    | can't connect to the specified | NULL
  *                      | partition on the specified     |
  *                      | channel because of mismatched  |
  *                      | message sizes                  |
  * ---------------------+--------------------------------+---------------------
- * xpcNoMemory          | insufficient memory avaiable   | NULL
+ * xpNoMemory           | insufficient memory avaiable   | NULL
  *                      | to allocate message queue      |
  * ---------------------+--------------------------------+---------------------
- * xpcLackOfResources   | lack of resources to create    | NULL
+ * xpLackOfResources    | lack of resources to create    | NULL
  *                      | the necessary kthreads to      |
  *                      | support the channel            |
  * ---------------------+--------------------------------+---------------------
- * xpcUnregistering     | this side's user has           | NULL or NA
+ * xpUnregistering      | this side's user has           | NULL or NA
  *                      | unregistered by calling        |
  *                      | xpc_disconnect()               |
  * ---------------------+--------------------------------+---------------------
- * xpcOtherUnregistering| the other side's user has      | NULL or NA
+ * xpOtherUnregistering | the other side's user has      | NULL or NA
  *                      | unregistered by calling        |
  *                      | xpc_disconnect()               |
  * ---------------------+--------------------------------+---------------------
- * xpcNoHeartbeat       | the other side's XPC is no     | NULL or NA
+ * xpNoHeartbeat        | the other side's XPC is no     | NULL or NA
  *                      | longer heartbeating            |
  *                      |                                |
  * ---------------------+--------------------------------+---------------------
- * xpcUnloading         | this side's XPC module is      | NULL or NA
+ * xpUnloading          | this side's XPC module is      | NULL or NA
  *                      | being unloaded                 |
  *                      |                                |
  * ---------------------+--------------------------------+---------------------
- * xpcOtherUnloading    | the other side's XPC module is | NULL or NA
+ * xpOtherUnloading     | the other side's XPC module is | NULL or NA
  *                      | is being unloaded              |
  *                      |                                |
  * ---------------------+--------------------------------+---------------------
- * xpcPioReadError      | xp_nofault_PIOR() returned an  | NULL or NA
+ * xpPioReadError       | xp_nofault_PIOR() returned an  | NULL or NA
  *                      | error while sending an IPI     |
  *                      |                                |
  * ---------------------+--------------------------------+---------------------
- * xpcInvalidAddress    | the address either received or | NULL or NA
+ * xpInvalidAddress     | the address either received or | NULL or NA
  *                      | sent by the specified partition|
  *                      | is invalid                     |
  * ---------------------+--------------------------------+---------------------
- * xpcBteNotAvailable   | attempt to pull data from the  | NULL or NA
- * xpcBtePoisonError    | specified partition over the   |
- * xpcBteWriteError     | specified channel via a        |
- * xpcBteAccessError    | bte_copy() failed              |
- * xpcBteTimeOutError   |                                |
- * xpcBteXtalkError     |                                |
- * xpcBteDirectoryError |                                |
- * xpcBteGenericError   |                                |
- * xpcBteUnmappedError  |                                |
+ * xpBteNotAvailable    | attempt to pull data from the  | NULL or NA
+ * xpBtePoisonError     | specified partition over the   |
+ * xpBteWriteError      | specified channel via a        |
+ * xpBteAccessError     | bte_copy() failed              |
+ * xpBteTimeOutError    |                                |
+ * xpBteXtalkError      |                                |
+ * xpBteDirectoryError  |                                |
+ * xpBteGenericError    |                                |
+ * xpBteUnmappedError   |                                |
  * ---------------------+--------------------------------+---------------------
- * xpcUnknownReason     | the specified channel to the   | NULL or NA
+ * xpUnknownReason      | the specified channel to the   | NULL or NA
  *                      | specified partition was        |
  *                      | unavailable for unknown reasons|
  * =====================+================================+=====================
  */
 
-typedef void (*xpc_channel_func)(enum xpc_retval reason, partid_t partid,
+typedef void (*xpc_channel_func)(enum xp_retval reason, short partid,
 		int ch_number, void *data, void *key);
 
-typedef void (*xpc_notify_func)(enum xpc_retval reason, partid_t partid,
+typedef void (*xpc_notify_func)(enum xp_retval reason, short partid,
 		int ch_number, void *key);
 
 
@@ -418,12 +400,12 @@ struct xpc_registration {
 struct xpc_interface {
 	void (*connect)(int);
 	void (*disconnect)(int);
-	enum xpc_retval (*allocate)(partid_t, int, u32, void **);
-	enum xpc_retval (*send)(partid_t, int, void *);
-	enum xpc_retval (*send_notify)(partid_t, int, void *,
+	enum xp_retval (*allocate)(short, int, u32, void **);
+	enum xp_retval (*send)(short, int, void *);
+	enum xp_retval (*send_notify)(short, int, void *,
 						xpc_notify_func, void *);
-	void (*received)(partid_t, int, void *);
-	enum xpc_retval (*partid_to_nasids)(partid_t, void *);
+	void (*received)(short, int, void *);
+	enum xp_retval (*partid_to_nasids)(short, void *);
 };
 
 
@@ -431,55 +413,91 @@ extern struct xpc_interface xpc_interfac
 
 extern void xpc_set_interface(void (*)(int),
 		void (*)(int),
-		enum xpc_retval (*)(partid_t, int, u32, void **),
-		enum xpc_retval (*)(partid_t, int, void *),
-		enum xpc_retval (*)(partid_t, int, void *, xpc_notify_func,
+		enum xp_retval (*)(short, int, u32, void **),
+		enum xp_retval (*)(short, int, void *),
+		enum xp_retval (*)(short, int, void *, xpc_notify_func,
 								void *),
-		void (*)(partid_t, int, void *),
-		enum xpc_retval (*)(partid_t, void *));
+		void (*)(short, int, void *),
+		enum xp_retval (*)(short, void *));
 extern void xpc_clear_interface(void);
 
 
-extern enum xpc_retval xpc_connect(int, xpc_channel_func, void *, u16,
+extern enum xp_retval xpc_connect(int, xpc_channel_func, void *, u16,
 						u16, u32, u32);
 extern void xpc_disconnect(int);
 
-static inline enum xpc_retval
-xpc_allocate(partid_t partid, int ch_number, u32 flags, void **payload)
+static inline enum xp_retval
+xpc_allocate(short partid, int ch_number, u32 flags, void **payload)
 {
 	return xpc_interface.allocate(partid, ch_number, flags, payload);
 }
 
-static inline enum xpc_retval
-xpc_send(partid_t partid, int ch_number, void *payload)
+static inline enum xp_retval
+xpc_send(short partid, int ch_number, void *payload)
 {
 	return xpc_interface.send(partid, ch_number, payload);
 }
 
-static inline enum xpc_retval
-xpc_send_notify(partid_t partid, int ch_number, void *payload,
+static inline enum xp_retval
+xpc_send_notify(short partid, int ch_number, void *payload,
 			xpc_notify_func func, void *key)
 {
 	return xpc_interface.send_notify(partid, ch_number, payload, func, key);
 }
 
 static inline void
-xpc_received(partid_t partid, int ch_number, void *payload)
+xpc_received(short partid, int ch_number, void *payload)
 {
 	return xpc_interface.received(partid, ch_number, payload);
 }
 
-static inline enum xpc_retval
-xpc_partid_to_nasids(partid_t partid, void *nasids)
+static inline enum xp_retval
+xpc_partid_to_nasids(short partid, void *nasids)
 {
 	return xpc_interface.partid_to_nasids(partid, nasids);
 }
 
+extern short xp_partition_id;
+extern u8 xp_region_size;
+extern unsigned long xp_rtc_cycles_per_second;
+extern enum xp_retval (*xp_remote_memcpy)(void *, const void *, size_t);
+extern enum xp_retval (*xp_register_remote_amos)(u64, size_t);
+extern enum xp_retval (*xp_unregister_remote_amos)(u64, size_t);
+extern int xp_sizeof_nasid_mask;
+extern int xp_sizeof_amo;
+extern u64 *(*xp_alloc_amos)(int);
+extern void (*xp_free_amos)(u64 *, int);
+extern enum xp_retval (*xp_set_amo)(u64 *, int, u64, int);
+extern enum xp_retval (*xp_set_amo_with_interrupt)(u64 *, int, u64, int, int,
+						    int, int);
+extern enum xp_retval (*xp_get_amo)(u64 *, int, u64 *);
+extern enum xp_retval (*xp_get_partition_rsvd_page_pa)(u64, u64 *, u64 *,
+							size_t *);
+extern enum xp_retval (*xp_change_memprotect)(u64, size_t, int, u64 *);
+extern void (*xp_change_memprotect_shub_wars_1_1)(int);
+extern void (*xp_allow_IPI_ops)(void);
+extern void (*xp_disallow_IPI_ops)(void);
+
+extern int (*xp_cpu_to_nasid)(int);
+extern int (*xp_node_to_nasid)(int);
 
 extern u64 xp_nofault_PIOR_target;
 extern int xp_nofault_PIOR(void *);
 extern int xp_error_PIOR(void);
 
 
-#endif /* _ASM_IA64_SN_XP_H */
+static inline int
+xp_partid_mask_words(int npartitions)
+{
+	return DIV_ROUND_UP(npartitions, BITS_PER_WORD);
+}
+
+static inline int
+xp_nasid_mask_words(void)
+{
+	return DIV_ROUND_UP(xp_sizeof_nasid_mask, BYTES_PER_WORD);
+}
+
+
+#endif /* _DRIVERS_MISC_XP_XP_H */
 
drivers/misc/xp/xp_main.c +115 -72

297 lines not on this page · raw message

drivers/misc/xp/xpc.h +282 -316

930 lines not on this page · raw message

drivers/misc/xp/xpc_channel.c +178 -185

1,027 lines not on this page · raw message

drivers/misc/xp/xpc_main.c +149 -126

183 lines not on this page · raw message

drivers/misc/xp/xpc_partition.c +280 -390

670 lines not on this page · raw message

drivers/misc/xp/xpnet.c +122 -158

280 lines not on this page · raw message

drivers/misc/xp/Makefile +4 -1
Index: linux-2.6/drivers/misc/xp/Makefile
===================================================================

Lines of this file are not shown. View the raw message.

drivers/misc/xp/xp_nofault.S +1 -1
Index: linux-2.6/drivers/misc/xp/xp_nofault.S
===================================================================

Lines of this file are not shown. View the raw message.

include/asm-ia64/sn/bte.h +1 -4
Index: linux-2.6/include/asm-ia64/sn/bte.h
===================================================================

Lines of this file are not shown. View the raw message.

drivers/misc/xp/xp_uv.c new file +194 -0

194 lines not on this page · raw message

arch/ia64/sn/kernel/setup.c +2 -2
Index: linux-2.6/arch/ia64/sn/kernel/setup.c
===================================================================

Lines of this file are not shown. View the raw message.

include/asm-ia64/sn/arch.h +3 -2
Index: linux-2.6/include/asm-ia64/sn/arch.h
===================================================================

Lines of this file are not shown. View the raw message.

drivers/misc/xp/xp_sn2.c new file +487 -0

487 lines not on this page · raw message

drivers/misc/Kconfig +1 -1
Index: linux-2.6/drivers/misc/Kconfig
===================================================================

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#4 lore raw

PATCH 4/5 run drivers/misc/xp through scripts/Lindent -v2

In reply to Dean Nelson

Ran patches through scripts/Lindent.

---

 drivers/misc/xp/xp.h            |  115 ++++------
 drivers/misc/xp/xp_main.c       |  109 ++++------
 drivers/misc/xp/xp_sn2.c        |   52 ++--
 drivers/misc/xp/xp_uv.c         |    7
 drivers/misc/xp/xpc.h           |  368 ++++++++++++++--------------------
 drivers/misc/xp/xpc_channel.c   |  379 +++++++++++++-----------------------
 drivers/misc/xp/xpc_main.c      |  329 +++++++++++++------------------
 drivers/misc/xp/xpc_partition.c |  168 +++++----------
 drivers/misc/xp/xpnet.c         |   95 +++------
 9 files changed, 661 insertions(+), 961 deletions(-)
drivers/misc/xp/xp.h +50 -65
Index: linux-2.6/drivers/misc/xp/xp.h
===================================================================
@@ -6,16 +6,13 @@
  * Copyright (C) 2004-2008 Silicon Graphics, Inc. All rights reserved.
  */
 
-
 /*
  * External Cross Partition (XP) structures and defines.
  */
 
-
 #ifndef _DRIVERS_MISC_XP_XP_H
 #define _DRIVERS_MISC_XP_XP_H
 
-
 #include <linux/cache.h>
 #include <linux/hardirq.h>
 #include <linux/mutex.h>
@@ -35,14 +32,12 @@
 #error architecture is NOT supported
 #endif
 
-
 #ifdef USE_DBUG_ON
 #define DBUG_ON(condition)	BUG_ON(condition)
 #else
 #define DBUG_ON(condition)
 #endif
 
-
 #ifndef is_shub1
 #define is_shub1()	0
 #endif
@@ -59,7 +54,6 @@
 #define is_uv()		0
 #endif
 
-
 /*
  * Define the maximum number of logically defined partitions the system
  * can support. It is constrained by the maximum number of hardware
@@ -78,10 +72,9 @@
 #error  XP_NPARTITIONS exceeds MAXIMUM possible.
 #endif
 
-#define XP_MIN_PARTID		1			/* inclusive */
+#define XP_MIN_PARTID		1	/* inclusive */
 #define XP_MAX_PARTID		(XP_NPARTITIONS - 1)	/* inclusive */
 
-
 /*
  * XPC establishes channel connections between the local partition and any
  * other partition that is currently up. Over these channels, kernel-level
@@ -107,7 +100,6 @@
 #error	XPC_NCHANNELS exceeds MAXIMUM possible.
 #endif
 
-
 /*
  * The format of an XPC message is as follows:
  *
@@ -145,12 +137,10 @@ struct xpc_msg {
 	u64 payload;		/* user defined portion of message */
 };
 
-
 #define XPC_MSG_PAYLOAD_OFFSET	(u64) (&((struct xpc_msg *)0)->payload)
 #define XPC_MSG_SIZE(_payload_size) \
 		L1_CACHE_ALIGN(XPC_MSG_PAYLOAD_OFFSET + (_payload_size))
 
-
 /*
  * Define the return values and values passed to user's callout functions.
  * (It is important to add new value codes at the end just preceding
@@ -237,7 +227,6 @@ enum xp_retval {
 	xpUnknownReason		/* 56: unknown reason (must be last in list) */
 };
 
-
 /* the following are valid xp_set_amo() ops */
 #define XP_AMO_OR	1	/* set variable to (variable | operand) */
 #define XP_AMO_AND	2	/* set variable to (variable & operand) */
@@ -252,7 +241,6 @@ enum xp_retval {
 #define XP_MEMPROT_ALLOW_CPU_MEM	2
 #define XP_MEMPROT_ALLOW_ALL		3	/* Shub 1.1 only */
 
-
 /*
  * Define the callout function types used by XPC to update the user on
  * connection activity and state changes (via the user function registered by
@@ -357,12 +345,11 @@ enum xp_retval {
  * =====================+================================+=====================
  */
 
-typedef void (*xpc_channel_func)(enum xp_retval reason, short partid,
-		int ch_number, void *data, void *key);
-
-typedef void (*xpc_notify_func)(enum xp_retval reason, short partid,
-		int ch_number, void *key);
+typedef void (*xpc_channel_func) (enum xp_retval reason, short partid,
+				  int ch_number, void *data, void *key);
 
+typedef void (*xpc_notify_func) (enum xp_retval reason, short partid,
+				 int ch_number, void *key);
 
 /*
  * The following is a registration entry. There is a global array of these,
@@ -380,50 +367,45 @@ typedef void (*xpc_notify_func)(enum xp_
  */
 struct xpc_registration {
 	struct mutex mutex;
-	xpc_channel_func func;		/* function to call */
-	void *key;			/* pointer to user's key */
-	u16 nentries;			/* #of msg entries in local msg queue */
-	u16 msg_size;			/* message queue's message size */
-	u32 assigned_limit;		/* limit on #of assigned kthreads */
-	u32 idle_limit;			/* limit on #of idle kthreads */
+	xpc_channel_func func;	/* function to call */
+	void *key;		/* pointer to user's key */
+	u16 nentries;		/* #of msg entries in local msg queue */
+	u16 msg_size;		/* message queue's message size */
+	u32 assigned_limit;	/* limit on #of assigned kthreads */
+	u32 idle_limit;		/* limit on #of idle kthreads */
 } ____cacheline_aligned;
 
-
 #define XPC_CHANNEL_REGISTERED(_c)	(xpc_registrations[_c].func != NULL)
 
-
 /* the following are valid xpc_allocate() flags */
-#define XPC_WAIT	0		/* wait flag */
-#define XPC_NOWAIT	1		/* no wait flag */
-
+#define XPC_WAIT	0	/* wait flag */
+#define XPC_NOWAIT	1	/* no wait flag */
 
 struct xpc_interface {
-	void (*connect)(int);
-	void (*disconnect)(int);
-	enum xp_retval (*allocate)(short, int, u32, void **);
-	enum xp_retval (*send)(short, int, void *);
-	enum xp_retval (*send_notify)(short, int, void *,
-						xpc_notify_func, void *);
-	void (*received)(short, int, void *);
-	enum xp_retval (*partid_to_nasids)(short, void *);
+	void (*connect) (int);
+	void (*disconnect) (int);
+	enum xp_retval (*allocate) (short, int, u32, void **);
+	enum xp_retval (*send) (short, int, void *);
+	enum xp_retval (*send_notify) (short, int, void *,
+				       xpc_notify_func, void *);
+	void (*received) (short, int, void *);
+	enum xp_retval (*partid_to_nasids) (short, void *);
 };
 
-
 extern struct xpc_interface xpc_interface;
 
 extern void xpc_set_interface(void (*)(int),
-		void (*)(int),
-		enum xp_retval (*)(short, int, u32, void **),
-		enum xp_retval (*)(short, int, void *),
-		enum xp_retval (*)(short, int, void *, xpc_notify_func,
-								void *),
-		void (*)(short, int, void *),
-		enum xp_retval (*)(short, void *));
+			      void (*)(int),
+			      enum xp_retval (*)(short, int, u32, void **),
+			      enum xp_retval (*)(short, int, void *),
+			      enum xp_retval (*)(short, int, void *,
+						 xpc_notify_func, void *),
+			      void (*)(short, int, void *),
+			      enum xp_retval (*)(short, void *));
 extern void xpc_clear_interface(void);
 
-
 extern enum xp_retval xpc_connect(int, xpc_channel_func, void *, u16,
-						u16, u32, u32);
+				  u16, u32, u32);
 extern void xpc_disconnect(int);
 
 static inline enum xp_retval
@@ -440,7 +422,7 @@ xpc_send(short partid, int ch_number, vo
 
 static inline enum xp_retval
 xpc_send_notify(short partid, int ch_number, void *payload,
-			xpc_notify_func func, void *key)
+		xpc_notify_func func, void *key)
 {
 	return xpc_interface.send_notify(partid, ch_number, payload, func, key);
 }
@@ -460,31 +442,36 @@ xpc_partid_to_nasids(short partid, void 
 extern short xp_partition_id;
 extern u8 xp_region_size;
 extern unsigned long xp_rtc_cycles_per_second;
-extern enum xp_retval (*xp_remote_memcpy)(void *, const void *, size_t);
-extern enum xp_retval (*xp_register_remote_amos)(u64, size_t);
-extern enum xp_retval (*xp_unregister_remote_amos)(u64, size_t);
+extern enum xp_retval (*xp_remote_memcpy) (void *, const void *, size_t);
+extern enum xp_retval (*xp_register_remote_amos) (u64, size_t);
+extern enum xp_retval (*xp_unregister_remote_amos) (u64, size_t);
 extern int xp_sizeof_nasid_mask;
 extern int xp_sizeof_amo;
-extern u64 *(*xp_alloc_amos)(int);
-extern void (*xp_free_amos)(u64 *, int);
-extern enum xp_retval (*xp_set_amo)(u64 *, int, u64, int);
-extern enum xp_retval (*xp_set_amo_with_interrupt)(u64 *, int, u64, int, int,
+extern u64 *(*xp_alloc_amos) (int);
+extern void (*xp_free_amos) (u64 *, int);
+extern enum xp_retval (*xp_set_amo) (u64 *, int, u64, int);
+extern enum xp_retval (*xp_set_amo_with_interrupt) (u64 *, int, u64, int, int,
 						    int, int);
-extern enum xp_retval (*xp_get_amo)(u64 *, int, u64 *);
-extern enum xp_retval (*xp_get_partition_rsvd_page_pa)(u64, u64 *, u64 *,
+extern enum xp_retval (*xp_get_amo) (u64 *, int, u64 *);
+extern enum xp_retval (*xp_get_partition_rsvd_page_pa) (u64, u64 *, u64 *,
 							size_t *);
-extern enum xp_retval (*xp_change_memprotect)(u64, size_t, int, u64 *);
-extern void (*xp_change_memprotect_shub_wars_1_1)(int);
-extern void (*xp_allow_IPI_ops)(void);
-extern void (*xp_disallow_IPI_ops)(void);
+extern enum xp_retval (*xp_change_memprotect) (u64, size_t, int, u64 *);
+extern void (*xp_change_memprotect_shub_wars_1_1) (int);
+extern void (*xp_allow_IPI_ops) (void);
+extern void (*xp_disallow_IPI_ops) (void);
 
-extern int (*xp_cpu_to_nasid)(int);
-extern int (*xp_node_to_nasid)(int);
+extern int (*xp_cpu_to_nasid) (int);
+extern int (*xp_node_to_nasid) (int);
 
 extern u64 xp_nofault_PIOR_target;
 extern int xp_nofault_PIOR(void *);
 extern int xp_error_PIOR(void);
 
+extern struct device *xp;
+extern enum xp_retval xp_init_sn2(void);
+extern enum xp_retval xp_init_uv(void);
+extern void xp_exit_sn2(void);
+extern void xp_exit_uv(void);
 
 static inline int
 xp_partid_mask_words(int npartitions)
@@ -498,6 +485,4 @@ xp_nasid_mask_words(void)
 	return DIV_ROUND_UP(xp_sizeof_nasid_mask, BYTES_PER_WORD);
 }
 
-
 #endif /* _DRIVERS_MISC_XP_XP_H */
-
drivers/misc/xp/xp_main.c +52 -57

217 lines not on this page · raw message

drivers/misc/xp/xp_sn2.c +29 -23

132 lines not on this page · raw message

drivers/misc/xp/xp_uv.c +3 -4
Index: linux-2.6/drivers/misc/xp/xp_uv.c
===================================================================
@@ -154,8 +154,8 @@ xp_init_uv(void)
 {
 	BUG_ON(!is_uv());
 
-	xp_partition_id = 0;		/* >>> not correct value */
-	xp_region_size = 0;		/* >>> not correct value */
+	xp_partition_id = 0;	/* >>> not correct value */
+	xp_region_size = 0;	/* >>> not correct value */
 	xp_rtc_cycles_per_second = 0;	/* >>> not correct value */
 
 	xp_remote_memcpy = xp_remote_memcpy_uv;
@@ -174,7 +174,7 @@ xp_init_uv(void)
 
 	xp_change_memprotect = xp_change_memprotect_uv;
 	xp_change_memprotect_shub_wars_1_1 =
-				xp_change_memprotect_shub_wars_1_1_uv;
+	    xp_change_memprotect_shub_wars_1_1_uv;
 	xp_allow_IPI_ops = xp_allow_IPI_ops_uv;
 	xp_disallow_IPI_ops = xp_disallow_IPI_ops_uv;
 
@@ -191,4 +191,3 @@ xp_exit_uv(void)
 
 	xp_unregister_nofault_code_uv();
 }
-
drivers/misc/xp/xpc.h +150 -216

864 lines not on this page · raw message

drivers/misc/xp/xpc_channel.c +141 -234

1,349 lines not on this page · raw message

drivers/misc/xp/xpc_main.c +139 -190

180 lines not on this page · raw message

drivers/misc/xp/xpc_partition.c +62 -106

168 lines not on this page · raw message

drivers/misc/xp/xpnet.c +32 -63

95 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#5 lore raw

PATCH 5/5 run drivers/misc/xp through scripts/checkpatch.pl -v2

In reply to Dean Nelson

Addressed issues raised by scripts/checkpatch.pl. Removed unnecessary curly braces. Eliminated uses of volatiles and use of kernel_thread() and daemonize().

---

There are still a few false positives from checkpatch.pl concerning
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable

 drivers/misc/xp/xp_main.c       |   68 ++++------
 drivers/misc/xp/xp_sn2.c        |   23 +--
 drivers/misc/xp/xp_uv.c         |    2
 drivers/misc/xp/xpc.h           |  116 ++++++++---------
 drivers/misc/xp/xpc_channel.c   |  243 +++++++++++++++---------------------
 drivers/misc/xp/xpc_main.c      |  239 ++++++++++++-----------------------
 drivers/misc/xp/xpc_partition.c |   78 ++++-------
 drivers/misc/xp/xpnet.c         |   15 --
 8 files changed, 324 insertions(+), 460 deletions(-)
drivers/misc/xp/xpnet.c +6 -9
Index: linux-2.6/drivers/misc/xp/xpnet.c
===================================================================
@@ -84,8 +84,8 @@ struct xpnet_message {
 #define XPNET_VERSION_MAJOR(_v)		((_v) >> 4)
 #define XPNET_VERSION_MINOR(_v)		((_v) & 0xf)
 
-#define	XPNET_VERSION _XPNET_VERSION(1,0)	/* version 1.0 */
-#define	XPNET_VERSION_EMBED _XPNET_VERSION(1,1)	/* version 1.1 */
+#define	XPNET_VERSION _XPNET_VERSION(1, 0)	/* version 1.0 */
+#define	XPNET_VERSION_EMBED _XPNET_VERSION(1, 1)	/* version 1.1 */
 #define XPNET_MAGIC	0x88786984	/* "XNET" */
 
 #define XPNET_VALID_MSG(_m)						     \
@@ -571,9 +571,8 @@ xpnet_init(void)
 	short partid;
 	int result = -ENOMEM;
 
-	if (!is_shub() && !is_uv()) {
+	if (!is_shub() && !is_uv())
 		return -ENODEV;
-	}
 
 	dev_info(xpnet, "registering network device %s\n", XPNET_DEVICE_NAME);
 
@@ -583,9 +582,8 @@ xpnet_init(void)
 	 */
 	xpnet_device = alloc_netdev(sizeof(struct xpnet_dev_private),
 				    XPNET_DEVICE_NAME, ether_setup);
-	if (xpnet_device == NULL) {
+	if (xpnet_device == NULL)
 		return -ENOMEM;
-	}
 
 	netif_carrier_off(xpnet_device);
 
@@ -603,7 +601,7 @@ xpnet_init(void)
 	 * MAC addresses.  We chose the first octet of the MAC to be unlikely
 	 * to collide with any vendor's officially issued MAC.
 	 */
-	xpnet_device->dev_addr[0] = 0x02;	/* locally administered, no OUI */
+	xpnet_device->dev_addr[0] = 0x02;     /* locally administered, no OUI */
 
 	partid = xp_partition_id;
 
@@ -624,9 +622,8 @@ xpnet_init(void)
 	xpnet_device->features = NETIF_F_NO_CSUM;
 
 	result = register_netdev(xpnet_device);
-	if (result != 0) {
+	if (result != 0)
 		free_netdev(xpnet_device);
-	}
 
 	return result;
 }
drivers/misc/xp/xpc_partition.c +32 -46

220 lines not on this page · raw message

drivers/misc/xp/xpc_channel.c +102 -141

607 lines not on this page · raw message

drivers/misc/xp/xpc.h +57 -59

295 lines not on this page · raw message

drivers/misc/xp/xp_sn2.c +11 -12
Index: linux-2.6/drivers/misc/xp/xp_sn2.c
===================================================================
@@ -22,8 +22,6 @@
 #include <asm/sn/sn_sal.h>
 #include "xp.h"
 
-extern struct device *xp;
-
 /*
  * Register a nofault code region which performs a cross-partition PIO read.
  * If the PIO read times out, the MCA handler will consume the error and
@@ -187,10 +185,10 @@ xp_set_amo_sn2(u64 *amo_va, int op, u64 
 		 * it until the heartbeat times out.
 		 */
 		if (xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(amo_va),
-							   xp_nofault_PIOR_target))
-		    != 0)
+							xp_nofault_PIOR_target))
+		    != 0) {
 			ret = xpPioReadError;
-
+		}
 		local_irq_restore(irq_flags);
 	}
 
@@ -226,10 +224,10 @@ xp_set_amo_with_interrupt_sn2(u64 *amo_v
 		 * it until the heartbeat times out.
 		 */
 		if (xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(amo_va),
-							   xp_nofault_PIOR_target))
-		    != 0)
+							xp_nofault_PIOR_target))
+		    != 0) {
 			ret = xpPioReadError;
-
+		}
 		local_irq_restore(irq_flags);
 	}
 
@@ -323,10 +321,10 @@ xp_change_memprotect_shub_wars_1_1_sn2(i
 			/* save current protection values */
 			xpc_prot_vec[node] =
 			    (u64)HUB_L((u64 *)GLOBAL_MMR_ADDR(nasid,
-							      SH1_MD_DQLP_MMR_DIR_PRIVEC0));
+						  SH1_MD_DQLP_MMR_DIR_PRIVEC0));
 			/* open up everything */
 			HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid,
-						     SH1_MD_DQLP_MMR_DIR_PRIVEC0),
+						   SH1_MD_DQLP_MMR_DIR_PRIVEC0),
 			      -1UL);
 			HUB_S((u64 *)
 			      GLOBAL_MMR_ADDR(nasid,
@@ -338,15 +336,16 @@ xp_change_memprotect_shub_wars_1_1_sn2(i
 			nasid = cnodeid_to_nasid(node);
 			/* restore original protection values */
 			HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid,
-						     SH1_MD_DQLP_MMR_DIR_PRIVEC0),
+						   SH1_MD_DQLP_MMR_DIR_PRIVEC0),
 			      xpc_prot_vec[node]);
 			HUB_S((u64 *)
 			      GLOBAL_MMR_ADDR(nasid,
 					      SH1_MD_DQRP_MMR_DIR_PRIVEC0),
 			      xpc_prot_vec[node]);
 		}
-	} else
+	} else {
 		BUG();
+	}
 }
 
 /* SH_IPI_ACCESS shub register value on startup */
drivers/misc/xp/xp_main.c +29 -39

168 lines not on this page · raw message

drivers/misc/xp/xp_uv.c +0 -2
Index: linux-2.6/drivers/misc/xp/xp_uv.c
===================================================================
@@ -18,8 +18,6 @@
 #include <linux/device.h>
 #include "xp.h"
 
-extern struct device *xp;
-
 static enum xp_retval
 xp_register_nofault_code_uv(void)
 {