libspe for 2.6.14-rc5 spufs snapshot

Arnd Bergmann arnd at arndb.de
Tue Nov 8 02:19:04 EST 2005


On Dunnersdag 27 Oktober 2005 23:12, Arnd Bergmann wrote:
> This is the current snapshot of Dirk Herrendoerfers libspe, using
> the spufs interfaces from the patch set. After a series of incompatible
> versions, we will now maintain compatibility with the user interfaces
> in this version, and only serious bug fixes are included before the 1.0
> release.

Ok, it turned out that there were still some fixes needed,
the list follows:

- Bump version to 1.0
- add stubs for {get,set}context and {get,set}affinity calls,
  as they were documented, so they should at least be there.
- use correct name for struct spe_context.
- do not use obsolete <spe/mfc.h> definitions for DMA, but instead
  use intrinsics directly to make DMA test case build.
- make event test case build without warnings.
- make simple test case use the new library for building, not
  the installed one.

The patch to the previous version follows, the actual tarball
is attached as well.

	Arnd <><
---

diff -urN libspe-1.0pre1/Makefile libspe-1.0/Makefile
--- libspe-1.0pre1/Makefile	2005-10-28 05:04:50.000000000 +0200
+++ libspe-1.0/Makefile	2005-11-04 16:48:28.000000000 +0100
@@ -43,7 +43,7 @@
 INSTALL_DIR	:= ${INSTALL} -d -m 755
 
 MAJOR_VERSION	:= 1
-MINOR_VERSION	:= 0pre1
+MINOR_VERSION	:= 0
 
 libspe_SO	:= libspe.so.${MAJOR_VERSION}.${MINOR_VERSION}
 libspe_SONAME	:= libspe.so.${MAJOR_VERSION}
@@ -120,7 +120,7 @@
 FULLNAME	= $(PACKAGE)-$(MAJOR_VERSION).$(MINOR_VERSION)
 TARBALL		= $(SOURCES)$(FULLNAME).tar.gz
 SOURCEFILES	= $(TARBALL)
-RPMBUILD	= ppc rpmbuild
+RPMBUILD	= ppc rpmbuild --target=ppc
 # ../make.rules contains the local rpm build infrastructure in CVS
 -include ../make.rules
 
diff -urN libspe-1.0pre1/libspe.h libspe-1.0/libspe.h
--- libspe-1.0pre1/libspe.h	2005-10-17 19:19:08.000000000 +0200
+++ libspe-1.0/libspe.h	2005-11-04 16:47:55.000000000 +0100
@@ -37,7 +37,7 @@
 
 /* spe user context
  */
-struct spu_ucontext {				
+struct spe_ucontext {				
 	unsigned int 	gprs[128][4];
 	unsigned int 	fpcr[4];
 	unsigned int 	decr;
@@ -108,6 +108,13 @@
 extern int spe_group_defaults(int policy, int priority, int spe_events);
 extern int spe_get_threads(spe_gid_t gid, speid_t *spe_ids);
 
+/* Currently without implementation or support
+ */
+extern int spe_get_affinity( speid_t speid, unsigned long *mask);
+extern int spe_set_affinity(speid_t speid, unsigned long mask);
+extern int spe_get_context(speid_t speid, struct spe_ucontext *uc);
+extern int spe_set_context(speid_t speid, struct spe_ucontext *uc);
+
 /* APIs for loading SPE images
  */
 extern spe_program_handle_t *spe_open_image(const char *filename);
diff -urN libspe-1.0pre1/libspe.spec libspe-1.0/libspe.spec
--- libspe-1.0pre1/libspe.spec	2005-10-28 05:05:03.000000000 +0200
+++ libspe-1.0/libspe.spec	2005-11-04 16:48:28.000000000 +0100
@@ -1,5 +1,5 @@
 Name: libspe
-Version: 1.0pre1
+Version: 1.0
 Release: 1
 License: LGPL
 Group: System Environment/Base
diff -urN libspe-1.0pre1/spe.c libspe-1.0/spe.c
--- libspe-1.0pre1/spe.c	2005-10-27 20:44:12.000000000 +0200
+++ libspe-1.0/spe.c	2005-11-07 13:56:31.000000000 +0100
@@ -1467,6 +1467,42 @@
 	return speid;
 }
 
+int
+spe_get_affinity( speid_t speid, unsigned long *mask)
+{
+	printf("spe_get_affinity: not implemented in this release.\n");
+
+	errno=ENOSYS;
+	return -1;
+}
+
+int
+spe_set_affinity(speid_t speid, unsigned long mask)
+{
+	printf("spe_set_affinity: not implemented in this release.\n");
+
+	errno=ENOSYS;
+	return -1;
+}
+
+int
+spe_get_context(speid_t speid, struct spe_ucontext *uc)
+{
+	printf("spe_get_context: not implemented in this release.\n");
+
+	errno=ENOSYS;
+	return -1;
+}
+
+int
+spe_set_context(speid_t speid, struct spe_ucontext *uc)
+{
+	printf("spe_set_context: not implemented in this release.\n");
+
+	errno=ENOSYS;
+	return -1;
+}
+
 /*
  * mfc.h direct call-ins
  *
@@ -1546,7 +1582,13 @@
 	struct thread_store *thread_store = spu_ps_addr;
 	int rc;
 
-	rc = write(thread_store->fd_sig1, &data, 4);
+	if (signal_reg == SPE_SIG_NOTIFY_REG_1)
+		rc = write(thread_store->fd_sig1, &data, 4);
+	else if (signal_reg == SPE_SIG_NOTIFY_REG_2)
+		rc = write(thread_store->fd_sig2, &data, 4);
+	else
+		return -1;
+	
 	if (rc == 4)
 		rc = 0;
 
diff -urN libspe-1.0pre1/tests/dma/Makefile libspe-1.0/tests/dma/Makefile
--- libspe-1.0pre1/tests/dma/Makefile	2005-10-17 19:19:09.000000000 +0200
+++ libspe-1.0/tests/dma/Makefile	2005-11-07 15:59:54.000000000 +0100
@@ -22,7 +22,7 @@
 CTAGS = ctags
 
 CFLAGS := -O2 -m32 -Wall -I../.. -I../../include -g
-SPECFLAGS := -O2 -Wall -I../../include
+SPECFLAGS := -O2 -Wall -I../../include -Wno-main
 
 LDFLAGS := -m32
 LIBS := -L../.. -lspe -lpthread
diff -urN libspe-1.0pre1/tests/dma/spe-dma-read.c libspe-1.0/tests/dma/spe-dma-read.c
--- libspe-1.0pre1/tests/dma/spe-dma-read.c	2005-10-17 19:19:09.000000000 +0200
+++ libspe-1.0/tests/dma/spe-dma-read.c	2005-11-07 13:55:32.000000000 +0100
@@ -1,4 +1,4 @@
-#include <spe/mfc.h>
+#include <spu_intrinsics.h>
 
 typedef union {
         unsigned long long      ull;
@@ -13,9 +13,11 @@
 
         /* Write to specified address */
         result = 23;
-        _set_mfc_tagmask(1);
-        _read_mfc((void*)&result, argAddress, 4, 0, 0, 0);
-        _wait_mfc_tags_all();
+
+        __builtin_si_wrch((22), __builtin_si_from_uint(1));
+        spu_mfcdma32((void *) &result, argAddress, 4, 0,
+                     (((0) << 24) | ((0) << 16) | (0x40)));
+        spu_mfcstat(0x2);
 
         /* Done */
         return result;
diff -urN libspe-1.0pre1/tests/dma/spe-dma-write.c libspe-1.0/tests/dma/spe-dma-write.c
--- libspe-1.0pre1/tests/dma/spe-dma-write.c	2005-10-17 19:19:09.000000000 +0200
+++ libspe-1.0/tests/dma/spe-dma-write.c	2005-11-07 13:54:52.000000000 +0100
@@ -1,4 +1,3 @@
-#include <spe/mfc.h>
 #include "spu_intrinsics.h"
 
 typedef union {
@@ -15,9 +14,10 @@
         /* Write to specified address */
         result = 42;
 
-        _write_mfc(argAddress, &result, 4, 0, 0, 0);
-        _set_mfc_tagmask(1);
-        _wait_mfc_tags_all();
+        spu_mfcdma32 (&result, argAddress, 4, 0,
+                     (((0) << 24) | ((0) << 16) | (0x20)));
+        __builtin_si_wrch((22),__builtin_si_from_uint(1));
+        spu_mfcstat(0x2);
 
         /* Done */
         return 0;
diff -urN libspe-1.0pre1/tests/event/ppe-start-stop.c libspe-1.0/tests/event/ppe-start-stop.c
--- libspe-1.0pre1/tests/event/ppe-start-stop.c	2005-10-25 21:29:17.000000000 +0200
+++ libspe-1.0/tests/event/ppe-start-stop.c	2005-11-07 15:59:54.000000000 +0100
@@ -81,7 +81,7 @@
 		else
 		{
 			printf("get_event: revents=0x%04x\n",myevent.revents);
-			printf("get_event: data=0x%04x\n",myevent.data);
+			printf("get_event: data=0x%04lx\n",myevent.data);
 			printf("get_event: speid=%p\n",myevent.speid);
 
 			spe_kill(myevent.speid,SIGCONT);
@@ -105,7 +105,7 @@
 		myevent[1].gid = spe_group;
 		myevent[1].events = SPE_EVENT_MAILBOX;
 		
-		ret = spe_get_event( &myevent,2, 100);
+		ret = spe_get_event(&myevent[0], 2, 100);
 		
 		if (!ret)
 		{
@@ -116,11 +116,11 @@
 			printf("get_event: Got %i events.\n",ret);
 			
 			printf("get_event[0]: revents=0x%04x\n",myevent[0].revents);
-			printf("get_event[0]: data=0x%04x\n",myevent[0].data);
+			printf("get_event[0]: data=0x%04lx\n",myevent[0].data);
 			printf("get_event[0]: speid=%p\n",myevent[0].speid);
 
 			printf("get_event[1]: revents=0x%04x\n",myevent[1].revents);
-			printf("get_event[1]: data=0x%04x\n",myevent[1].data);
+			printf("get_event[1]: data=0x%04lx\n",myevent[1].data);
 			printf("get_event[1]: speid=%p\n",myevent[1].speid);
 			
 			if (myevent[0].revents == SPE_EVENT_STOP)
diff -urN libspe-1.0pre1/tests/start-stop/Makefile libspe-1.0/tests/start-stop/Makefile
--- libspe-1.0pre1/tests/start-stop/Makefile	2005-10-17 19:19:09.000000000 +0200
+++ libspe-1.0/tests/start-stop/Makefile	2005-11-04 16:47:55.000000000 +0100
@@ -21,11 +21,11 @@
 SPECC := spu-gcc
 CTAGS = ctags
 
-CFLAGS := -O2 -m32 -Wall -g
+CFLAGS := -O2 -m32 -Wall -g -I../..
 SPECFLAGS := -O2 -Wall 
 
-LDFLAGS := -m32
-LIBS := -lspe 
+LDFLAGS := -m32 
+LIBS := -L../.. -lspe -lpthread
 
 SPE_OBJS := spe-start-stop
 OBJS := ppe-start-stop
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libspe-1.0.tar.gz
Type: application/x-tgz
Size: 34369 bytes
Desc: not available
Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20051107/522a0ef6/attachment.bin 


More information about the Linuxppc64-dev mailing list