Skip to content

Commit

Permalink
Added 2.3.0.135
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jul 13, 2020
1 parent 2a55256 commit ca4fdcc
Show file tree
Hide file tree
Showing 8 changed files with 149 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ PACKAGE := libspe2
VERSION := $(MAJOR_VERSION).$(MINOR_VERSION)
RELEASE := $(shell svnversion)
FULLNAME := $(PACKAGE)-$(VERSION)
PACKAGE_VER := $(FULLNAME)-$(RELEASE)
PACKAGE_VER := $(FULLNAME).$(RELEASE)
TARBALL := $(SOURCES)$(PACKAGE_VER).tar.gz
SOURCEFILES := $(TARBALL)

Expand Down
5 changes: 4 additions & 1 deletion libspe2-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,13 @@ enum ps_area { SPE_MSSYNC_AREA, SPE_MFC_COMMAND_AREA, SPE_CONTROL_AREA, SPE_SIG_
#define SPE_CALLBACK_UPDATE 2



#define SPE_COUNT_PHYSICAL_CPU_NODES 1
#define SPE_COUNT_PHYSICAL_SPES 2
#define SPE_COUNT_USABLE_SPES 3
#define SPE_CPU_TYPE 4

#define SPE_CPU_IS_CELLBE 1
#define SPE_CPU_IS_CELLEDP 2

/**
* Signal Targets
Expand Down
4 changes: 2 additions & 2 deletions libspe2.spec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
%define release %{_version}
%define build_all 1
Name: libspe2
Version: 2.2.80
Version: 2.3.0
Release: %{release}
License: LGPL
Group: System Environment/Base
URL: http://www.bsc.es/projects/deepcomputing/linuxoncell
Source: http://www.bsc.es/projects/deepcomputing/linuxoncell/development/release2.0/libspe/%{name}-%{version}-%{release}.tar.gz
Source: http://www.bsc.es/projects/deepcomputing/linuxoncell/development/release2.0/libspe/%{name}-%{version}.%{release}.tar.gz
Buildroot: %{_tmppath}/libspe
Exclusivearch: ppc ppc64 noarch
Summary: SPE Runtime Management Library
Expand Down
2 changes: 1 addition & 1 deletion make.defines
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ INSTALL_LINK := ln -sf
INSTALL_DIR := ${INSTALL} -d -m 755

MAJOR_VERSION := 2
MINOR_VERSION := 2.80
MINOR_VERSION := 3.0

libspe2_A := libspe2.a
libspe2_SO := libspe2.so.${MAJOR_VERSION}.${MINOR_VERSION}
Expand Down
21 changes: 21 additions & 0 deletions spebase/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,24 @@ int _base_spe_count_physical_spes(int cpu_node)
return ret;
}

/* Since there are no mixed-type CPU systems at this time the cpu node
* is currently ignored, and a result is generated that returns the
* feature set of the currently running CPU.
*/
int _base_spe_read_cpu_type(int cpu_node)
{
unsigned long pvr;
int i=0;

asm volatile ("mfpvr %0" : "=r"(pvr));

while (pvr_list_edp[i] != 0) {
if (pvr_list_edp[i++] == pvr)
return SPE_CPU_IS_CELLEDP;
}

return SPE_CPU_IS_CELLBE;
}

int _base_spe_cpu_info_get(int info_requested, int cpu_node) {
int ret = 0;
Expand All @@ -118,6 +136,9 @@ int _base_spe_cpu_info_get(int info_requested, int cpu_node) {
case SPE_COUNT_USABLE_SPES:
ret = _base_spe_count_usable_spes(cpu_node);
break;
case SPE_CPU_TYPE:
ret = _base_spe_read_cpu_type(cpu_node);
break;
default:
errno = EINVAL;
ret = -1;
Expand Down
7 changes: 7 additions & 0 deletions spebase/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,12 @@
int _base_spe_count_physical_cpus(int cpu_node);
int _base_spe_count_physical_spes(int cpu_node);
int _base_spe_count_usable_spes(int cpu_node);
int _base_spe_read_cpu_type(int cpu_node);

/* Here is a list of edp capable PVRs
* Known non-EDP are: 0x0070 0501 ( PS3, QS20, QS21 )
* Known EPD capable: 0x0070 3000 ( QS22 )
*/
unsigned long pvr_list_edp[] = {0x00703000, 0};

#endif
3 changes: 3 additions & 0 deletions tests/libspe2.run/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ main_progs = \
test_run_image.elf \
test_stop.elf \
test_multiple_context.elf \
test_nosched_context.elf \
test_single_gang_context.elf \
test_context_create_error.elf \
test_run_error.elf \
Expand Down Expand Up @@ -61,6 +62,8 @@ test_stop.elf: spu_stop.embed.o

test_multiple_context.elf: spu_arg.embed.o

test_nosched_context.elf: spu_arg.embed.o

test_single_gang_context.elf: spu_arg.embed.o

test_affinity.elf: spu_arg.embed.o
Expand Down
110 changes: 110 additions & 0 deletions tests/libspe2.run/test_nosched_context.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
* libspe2 - A wrapper library to adapt the JSRE SPU usage model to SPUFS
*
* Copyright (C) 2008 Sony Computer Entertainment Inc.
* Copyright 2008 Sony Corp.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

/* This test checks if multiple SPE contexts can be created and be run
* at the same time correctly.
*/

#include <stdio.h>
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <pthread.h>
#include <unistd.h>

#include "ppu_libspe2_test.h"

extern spe_program_handle_t spu_arg;

static int num_spes;

static void *spe_thread_proc(void *arg)
{
spe_context_ptr_t spe;
unsigned int entry = SPE_DEFAULT_ENTRY;
int ret;
spe_stop_info_t stop_info;

/* synchronize all threads to check whether the library is
* thread-safe.
*/
global_sync(num_spes);

spe = spe_context_create(SPE_NOSCHED, 0);
if (!spe) {
eprintf("spe_context_create(0, NULL): %s\n", strerror(errno));
fatal();
}

if (spe_program_load(spe, &spu_arg)) {
eprintf("spe_program_load(%p, &spu_arg): %s\n", spe, strerror(errno));
fatal();
}

ret = spe_context_run(spe, &entry, 0,
(void*)RUN_ARGP_DATA, (void*)RUN_ENVP_DATA, &stop_info);
if (ret == 0) {
if (check_exit_code(&stop_info, 0)) {
fatal();
}
}
else {
eprintf("spe_context_run(%p, ...): %s\n", spe, strerror(errno));
fatal();
}

ret = spe_context_destroy(spe);
if (ret) {
eprintf("spe_context_destroy(%p): %s\n", spe, strerror(errno));
fatal();
}

return NULL;
}

static int test(int argc, char **argv)
{
int ret;

num_spes = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
if (num_spes <= 0) {
eprintf("Could not get # of physical SPEs\n");
fatal();
}

/* this test case works only as root */
if (getuid() == 0) {
ret = ppe_thread_group_run(num_spes, spe_thread_proc, NULL, NULL);
if (ret) {
fatal();
}
}
else {
eprintf("Root privilege is required. Ignored.\n");
}

return 0;
}

int main(int argc, char **argv)
{
return ppu_main(argc, argv, test);
}

0 comments on commit ca4fdcc

Please sign in to comment.