Official Gitbrew Forums
These forums cover all aspects of the Gitbrew biosphere. If you would like your development project to be based here, ask an admin.

Home » PS3 » OtherOS++ » Linux » spuisofs
spuisofs [message #735] Sun, 04 March 2012 14:56 Go to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Currently i'm studying Linux and FreeBSD VFS layer.
And need a small project, filesystem, to implement in order to test my new knowledge.
It would be nice to have a file system which allows to run isolated SPUs, no need for /proc hacks anymore like in spp_verifier_direct module. And we could load metldr and isolated SPUs directly from user space. Nice project Very Happy

[Updated on: Sun, 04 March 2012 14:57]

Report message to a moderator

Re: spuisofs [message #736 is a reply to message #735] Sun, 04 March 2012 15:01 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
A kernel module should register a new filesystem which is a memory filesystem.
The memory filesystem should use the shared 7th SPU of PS3, map its resources and create for each SPU resource a file
on the filesystem. Each file(resource) is accessible by user space. Resources are registers, local store and so on, just like in spufs from IBM.

[Updated on: Sun, 04 March 2012 15:02]

Report message to a moderator

Re: spuisofs [message #737 is a reply to message #736] Sun, 04 March 2012 15:06 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
One problem i encountered is that when we load metldr from user space, the SPU will use the page table of the current process.
What happens when the user process which loaded metldr into its memory address space is swapped out ? Have to check how spufs handles this problem.

[Updated on: Sun, 04 March 2012 15:08]

Report message to a moderator

Re: spuisofs [message #738 is a reply to message #737] Sun, 04 March 2012 16:27 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
One possible way to solve the problem is creating a buffer in kernel space where a user application can store metldr and isolated SPUs.
Memory space in kernel will not be swapped out and we are safe to run metldr even if our user process is swapped out. It solves the problem but only partially. The problem is still there in case we have to pass some data from PPE to SPU by pointer, e.g. in SPP verifier we are passing an encrypted profile to the SPU and the SPU decrypts it and stores the data back. As soon as the SPU tries to access the profile buffer, we will get data storage interrupt from the SPU and it will stop until we fix it.

[Updated on: Sun, 04 March 2012 16:33]

Report message to a moderator

Re: spuisofs [message #739 is a reply to message #738] Sun, 04 March 2012 16:36 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
So we need at least 2 buffers in kernel space which will be visible in spuisofs so user space applications can store metldr and isolated SPUs there. Max size of a buffer is 256kb because the locaal storage size is 256kb. A buffer may be noncontiguous even which simplifies a lot of things in kernel. Just allocate number of pages for each buffer.

[Updated on: Sun, 04 March 2012 16:36]

Report message to a moderator

Re: spuisofs [message #740 is a reply to message #739] Sun, 04 March 2012 16:43 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Hmm, another possible solution is to use mlock syscall and lock down metldr and isolated SPU buffers in user space.
Probably the best solution because then we can store everything in user space but mlock syscall can be used by root only but that's not a problem anyways.

[Updated on: Sun, 04 March 2012 16:43]

Report message to a moderator

Re: spuisofs [message #743 is a reply to message #740] Sun, 04 March 2012 17:10 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Another problem is how to get VSIDs of user process.

[Updated on: Sun, 04 March 2012 17:10]

Report message to a moderator

Re: spuisofs [message #1617 is a reply to message #743] Tue, 10 July 2012 20:55 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Another good and simple example of virtual filesystem is oprofilefs.

http://lxr.free-electrons.com/source/drivers/oprofile/oprofi lefs.c
Re: spuisofs [message #1618 is a reply to message #1617] Tue, 10 July 2012 21:07 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Some good stuff about memory mapping:

http://www.scs.ch/~frey/linux/memorymap.html
Re: spuisofs [message #1620 is a reply to message #1618] Wed, 11 July 2012 16:15 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Use vmalloc_user to allocate RAM for spu and parameters.
Map the memory with remap_vmalloc_range.
Re: spuisofs [message #1621 is a reply to message #1620] Wed, 11 July 2012 16:39 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Hugetlbfs is another good example.

http://lxr.free-electrons.com/source/fs/hugetlbfs/inode.c
Re: spuisofs [message #1630 is a reply to message #1621] Sat, 14 July 2012 19:51 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
And we will need some undocumented SPU LV1 calls.

New patch: http://gitbrew.org/~glevand/ps3/linux/linux-3/patches-3.4/01 80-lv1call-add-undocumented-spe-hvcalls.patch

I updated my Linux 3.4.4 kernel with this patch: http://gitbrew.org/~glevand/ps3/linux/linux-3/linux-3.4.4-bu ild.tar.bz2

[Updated on: Sat, 14 July 2012 21:25]

Report message to a moderator

Re: spuisofs [message #1631 is a reply to message #1630] Sat, 14 July 2012 20:52 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
First test version is here: http://gitbrew.org/~glevand/ps3/linux/linux-3/spuisofs/spuis ofs.tar.g z

It's not finished yet but it's a cool example how to implement virtual FS on Linux Smile

Mounting:
mount -t spuisofs none /mnt

[Updated on: Tue, 17 July 2012 20:31]

Report message to a moderator

Re: spuisofs [message #1633 is a reply to message #1631] Sat, 14 July 2012 21:09 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Next step is implementing mmap operation for SPE registerts and local storage.
Re: spuisofs [message #1635 is a reply to message #1633] Sun, 15 July 2012 10:01 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Layout of filesystem:

[glevand@arch ~]$ ls -l /mnt
total 0
-rw-rw-rw- 1 root root 1048576 Jul 15 10:17 app
-rw-rw-rw- 1 root root 1048576 Jul 15 10:17 arg1
-rw-rw-rw- 1 root root 1048576 Jul 15 10:17 arg2
-rw-rw-rw- 1 root root  262144 Jul 15 10:17 ls
-rw-rw-rw- 1 root root  131072 Jul 15 10:17 priv2
-rw-rw-rw- 1 root root  131072 Jul 15 10:17 problem
-r--r--r-- 1 root root    4096 Jul 15 10:17 shadow


And we need one file more which we can use to trigger the execution of an SPE application.

1MB for application, 1MB for argument1 and 1MB for argument2 should be more than enough.

kmalloc is not a good choice for memory buffers of size >= 128kb.
vmalloc has no problems with allocating 1MB buffer in kernel space.

[Updated on: Sun, 15 July 2012 12:49]

Report message to a moderator

Re: spuisofs [message #1636 is a reply to message #1635] Sun, 15 July 2012 12:05 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
In order to use SPE interrupts we need another patch: http://gitbrew.org/~glevand/ps3/linux/linux-3/patches-3.4/01 90-export-spe-irq-setup-destroy.patch

It exports ps3_spe_irq_setup and ps3_spe_irq_destroy.
Re: spuisofs [message #1639 is a reply to message #1636] Tue, 17 July 2012 18:08 Go to previous messageGo to next message
masterzorag is currently offline  masterzorag
Messages: 99
Registered: August 2011
Location: maiworld
Gitbrew Member
ready to test on FAT, Linux 3.4.5
[root@fedora_clone dev]# modinfo /home/testing_3.4.5/spuisofs.ko  
filename:       /home/testing_3.4.5/spuisofs.ko
license:        GPL
author:         glevand
description:    PS3 spuisofs
depends:        
vermagic:       3.4.5 SMP mod_unload 
parm:           spuisofs_spe_app_size:ulong
parm:           spuisofs_spe_arg1_size:ulong
parm:           spuisofs_spe_arg2_size:ulong
...
spusisofs: vas id 2
spusisofs: spe id 53
spusisofs: spe app ea d0000000008f0000 esid d000000008000000 vsid f09b89af5500
spusisofs: spe arg1 ea d0000000009f1000 esid d000000008000000 vsid f09b89af5500
spusisofs: spe arg2 ea d000000000af2000 esid d000000008000000 vsid f09b89af5500
...
-rw-rw-rw- 1 root root 1048576 Jul 16 13:08 app
-rw-rw-rw- 1 root root 1048576 Jul 16 13:08 arg1
-rw-rw-rw- 1 root root 1048576 Jul 16 13:08 arg2
-rw-rw-rw- 1 root root  262144 Jul 16 13:08 ls
-rw-rw-rw- 1 root root  131072 Jul 16 13:08 priv2
-rw-rw-rw- 1 root root  131072 Jul 16 13:08 problem
--w--w--w- 1 root root       8 Jul 16 13:08 run
-r--r--r-- 1 root root    4096 Jul 16 13:08 shadow

[Updated on: Tue, 17 July 2012 18:19]

Report message to a moderator

Re: spuisofs [message #1641 is a reply to message #1639] Tue, 17 July 2012 18:20 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
I'm still working on it.
Data segment and page faults are not handled properly yet.
Re: spuisofs [message #1642 is a reply to message #1641] Tue, 17 July 2012 18:22 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Here is how SPU data segment and page faults are handled in spufs:

http://lxr.free-electrons.com/source/arch/powerpc/platforms/ cell/spu_base.c
http://lxr.free-electrons.com/source/arch/powerpc/platforms/ ps3/spu.c

Really interesting stuff.

Re: spuisofs [message #1644 is a reply to message #1642] Tue, 17 July 2012 19:47 Go to previous messageGo to next message
zecoxao is currently offline  zecoxao
Messages: 24
Registered: April 2012
Location: Portugal
Gitbrew Noob
i have a problem with the mount command . everytime i try to mount the fs, i get a bus error, and if i try to mount again, it freezes. any help?
Re: spuisofs [message #1645 is a reply to message #1644] Tue, 17 July 2012 20:33 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Post dmesg here please.
Did you patch your kernel with new patches i uploaded here ?
Re: spuisofs [message #1646 is a reply to message #1645] Tue, 17 July 2012 21:01 Go to previous messageGo to next message
zecoxao is currently offline  zecoxao
Messages: 24
Registered: April 2012
Location: Portugal
Gitbrew Noob
yes, i patched the kernel, sucessfully compiled the module without warnings and sucessfully inserted module.
i'll post what error it gives me. how do i dmesg? do i type dmesg in the terminal?
Re: spuisofs [message #1647 is a reply to message #1645] Tue, 17 July 2012 21:03 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Mega cool Smile First working version of spuisofs released.
Now you can run your isolated apps without writing your own kernel modules.
Now it can be done from user space.
Currently no support for loading loaders like metldr or isoldr directly. For that purpose i will develop spuldrfs.

All tools you will find here: http://gitbrew.org/~glevand/ps3/linux/linux-3/spuisofs/

How to use it (example with spp_verifier.self):

First compile spuisofs kernel module
* http://gitbrew.org/~glevand/ps3/linux/linux-3/spuisofs/spuis ofs.tar.gz
You will need extra patches for kernel:
* http://gitbrew.org/~glevand/ps3/linux/linux-3/patches-3.4/01 80-lv1call-add-undocumented-spe-hvcalls.patch
* http://gitbrew.org/~glevand/ps3/linux/linux-3/patches-3.4/01 90-export-spe-irq-setup-destroy.patch

Load it:
insmod ./spuisofs.ko



Mount VFS:


mount -t spuisofs none /mnt



Layout of the filesystem:

[glevand@arch spp_verifier]$ ls -l /mnt/
total 0
-rw-rw-rw- 1 root root 1048576 Jul 17 21:35 app
-rw-rw-rw- 1 root root 1048576 Jul 17 21:35 arg1
-rw-rw-rw- 1 root root 1048576 Jul 17 21:35 arg2
--w--w--w- 1 root root       0 Jul 17 21:35 cont
-rw-rw-rw- 1 root root  262144 Jul 17 21:35 ls
-rw-rw-rw- 1 root root  131072 Jul 17 21:35 priv2
-rw-rw-rw- 1 root root  131072 Jul 17 21:35 problem
--w--w--w- 1 root root       8 Jul 17 21:35 run
-r--r--r-- 1 root root    4096 Jul 17 21:35 shadow


Compile spp_verifier application
* http://gitbrew.org/~glevand/ps3/linux/linux-3/spuisofs/spp_v erifier.tar.gz

And run it:

[glevand@arch spp_verifier]$ ./spp_verifier /mnt ../spp_verifier.self ../default.spp 
shadow: execution status 7
priv2: puint_mb_R 2
shadow: execution status b


dmesg output:

spusisofs: vas id 2
spusisofs: spe id 50
spusisofs: got class 1 irq
spusisofs: status 1
spusisofs: data segment fault at d000000002a39000
spusisofs: out interrupt mbox 2
spusisofs: got class 2 irq
spusisofs: status 12


Now see the result of it:

[glevand@arch spp_verifier]$ hexdump -C /mnt/arg1 | less
000004f0  2f 66 6c 68 2f 6f 73 2f  6c 76 32 5f 6b 65 72 6e  |/flh/os/lv2_kern|
00000500  65 6c 2e 73 65 6c 66 00  00 00 00 00 00 00 00 00  |el.self.........|
00000510  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000005f0  00 00 00 00 00 00 00 1b  00 00 00 00 00 00 00 00  |................|
00000600  00 00 00 00 00 00 00 01  00 00 00 00 00 00 00 01  |................|
00000610  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000710  00 00 00 00 0f 00 00 00  00 00 00 00 00 00 00 03  |................|
00000720  00 00 00 00 00 00 00 08  00 00 00 00 00 00 00 01  |................|
00000730  00 00 02 88 00 00 00 01  10 20 00 00 03 00 00 01  |......... ......|
00000740  00 00 00 00 00 00 00 00  50 53 32 5f 4c 50 41 52  |........PS2_LPAR|
00000750  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000760  00 00 00 00 00 00 00 00  00 00 00 06 00 00 02 50  |...............P|
00000770  10 20 00 00 03 00 00 01  2f 6c 6f 63 61 6c 5f 73  |. ....../local_s|
00000780  79 73 30 2f 70 73 32 65  6d 75 2f 70 73 32 5f 65  |ys0/ps2emu/ps2_e|
00000790  6d 75 2e 73 65 6c 66 00  00 00 00 00 00 00 00 00  |mu.self.........|
000007a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|


Note: the first release of spuisofs can run SELFS only once, after that you have t umount the filesystem, unload the module and redo everything. I will fix it in the next release.


That's it. Have fun and report bugs to me.
I will try to upload some more applications which use other SELFs.

[Updated on: Tue, 17 July 2012 21:14]

Report message to a moderator

Re: spuisofs [message #1648 is a reply to message #1647] Tue, 17 July 2012 21:11 Go to previous messageGo to next message
zecoxao is currently offline  zecoxao
Messages: 24
Registered: April 2012
Location: Portugal
Gitbrew Noob
spusisofs: vas id 2
spusisofs: spe id 50
spusisofs: spe app ea d000000000b9b000 esid d000000008000000 vsid f09b89af5500
spusisofs: spe arg1 ea d000000000c9c000 esid d000000008000000 vsid f09b89af5500
spusisofs: spe arg2 ea d000000000d9d000 esid d000000008000000 vsid f09b89af5500
------------[ cut here ]------------
WARNING: at fs/inode.c:336
Modules linked in: spuisofs(O) bnep rfcomm fuse vfat fat usb_storage evdev joydev usbhid ps3_jupiter_sta btusb bluetooth ps3_jupiter ohci_hcd ehci_hcd snd_ps3 snd_pcm usbcore snd_timer snd sg ps3flash ps3vram ps3_gelic soundcore ps3_disp_manager usb_common ps3rom ps3nflash ps3_lpm rtc_ps3 snd_page_alloc
NIP: c000000000121ef4 LR: d000000000b917fc CTR: c000000000121ee0
REGS: c00000000609b490 TRAP: 0700   Tainted: G           O  (3.4.4)
MSR: 8000000000028032 <SF,EE,IR,DR,RI>  CR: 84442482  XER: 20000000
SOFTE: 1
TASK = c000000006094440[1900] 'mount' THREAD: c000000006098000 CPU: 1
GPR00: 0000000000000001 c00000000609b710 c0000000006e3fd0 c000000006c12b00 
GPR04: 0000000000000001 c000000000121f84 0000000000000000 0000000000000000 
GPR08: 000000000002a148 0000000000000000 000000002cd29bfb 0000000000000001 
GPR12: d000000000b92510 c000000007ffe280 0000000000000000 0000000000000000 
GPR16: d000000000b93202 d000000000b93208 0000000000040000 d000080080680000 
GPR20: d0000800806c0000 d000080080700000 d00008008000e000 0000000000100000 
GPR24: d000000000b93888 0000000000100000 d000000000c9c000 ffffffffffff8000 
GPR28: c000000006c12b00 c00000000609b780 d000000000b9b508 c0000000067ef800 
NIP [c000000000121ef4] .inc_nlink+0x14/0x50
LR [d000000000b917fc] .spuisofs_fill_super+0x1e4/0x344 [spuisofs]
Call Trace:
[c00000000609b710] [d000000000b917dc] .spuisofs_fill_super+0x1c4/0x344 [spuisofs] (unreliable)
[c00000000609b970] [c00000000010833c] .mount_single+0xec/0x120
[c00000000609ba10] [d000000000b91140] .spuisofs_mount+0x20/0x38 [spuisofs]
[c00000000609ba90] [c0000000001085d8] .mount_fs+0x40/0xf0
[c00000000609bb20] [c00000000012823c] .vfs_kern_mount+0x6c/0xf0
[c00000000609bbd0] [c00000000012884c] .do_kern_mount+0x64/0x138
[c00000000609bc80] [c00000000012a9cc] .do_mount+0x5c4/0x8e8
[c00000000609bd70] [c00000000015e438] .compat_sys_mount+0x110/0x278
[c00000000609be30] [c0000000000097b4] syscall_exit+0x0/0x38
Instruction dump:
7c60512d 40a2fff4 7c0004ac 3863fc00 78630020 4bffffc0 60000000 81230040 
2f890000 7c000026 5400fffe 7c0b07b4 <0b000000> 2fab0000 409e0010 39290001 
---[ end trace 022c6541e7ab41c9 ]---
Unable to handle kernel paging request for unknown fault
Faulting instruction address: 0xc000000000121f14
Oops: Kernel access of bad area, sig: 7 [#1]
SMP NR_CPUS=2 PS3
Modules linked in: spuisofs(O) bnep rfcomm fuse vfat fat usb_storage evdev joydev usbhid ps3_jupiter_sta btusb bluetooth ps3_jupiter ohci_hcd ehci_hcd snd_ps3 snd_pcm usbcore snd_timer snd sg ps3flash ps3vram ps3_gelic soundcore ps3_disp_manager usb_common ps3rom ps3nflash ps3_lpm rtc_ps3 snd_page_alloc
NIP: c000000000121f14 LR: d000000000b917fc CTR: c000000000121ee0
REGS: c00000000609b490 TRAP: 0600   Tainted: G        W  O  (3.4.4)
MSR: 8000000000008032 <SF,EE,IR,DR,RI>  CR: 84442484  XER: 20000000
SOFTE: 1
DAR: 0000000000001687, DSISR: 40000000
TASK = c000000006094440[1900] 'mount' THREAD: c000000006098000 CPU: 1
GPR00: 0000000000001687 c00000000609b710 c0000000006e3fd0 c000000006c12b00 
GPR04: 0000000000000001 c000000000121f84 0000000000000000 0000000000000000 
GPR08: 000000000002a148 0000000000001067 000000002cd29bfb 0000000000000001 
GPR12: d000000000b92510 c000000007ffe280 0000000000000000 0000000000000000 
GPR16: d000000000b93202 d000000000b93208 0000000000040000 d000080080680000 
GPR20: d0000800806c0000 d000080080700000 d00008008000e000 0000000000100000 
GPR24: d000000000b93888 0000000000100000 d000000000c9c000 ffffffffffff8000 
GPR28: c000000006c12b00 c00000000609b780 d000000000b9b508 c0000000067ef800 
NIP [c000000000121f14] .inc_nlink+0x34/0x50
LR [d000000000b917fc] .spuisofs_fill_super+0x1e4/0x344 [spuisofs]
Call Trace:
[c00000000609b710] [d000000000b917dc] .spuisofs_fill_super+0x1c4/0x344 [spuisofs] (unreliable)
[c00000000609b970] [c00000000010833c] .mount_single+0xec/0x120
[c00000000609ba10] [d000000000b91140] .spuisofs_mount+0x20/0x38 [spuisofs]
[c00000000609ba90] [c0000000001085d8] .mount_fs+0x40/0xf0
[c00000000609bb20] [c00000000012823c] .vfs_kern_mount+0x6c/0xf0
[c00000000609bbd0] [c00000000012884c] .do_kern_mount+0x64/0x138
[c00000000609bc80] [c00000000012a9cc] .do_mount+0x5c4/0x8e8
[c00000000609bd70] [c00000000015e438] .compat_sys_mount+0x110/0x278
[c00000000609be30] [c0000000000097b4] syscall_exit+0x0/0x38
Instruction dump:
2f890000 7c000026 5400fffe 7c0b07b4 0b000000 2fab0000 409e0010 39290001 
91230040 4e800020 e9230028 38090620 <7d6000a8> 316bffff 7d6001ad 40a2fff4 
---[ end trace 022c6541e7ab41ca ]---


i guess this is what you're looking for Smile
Re: spuisofs [message #1649 is a reply to message #1648] Tue, 17 July 2012 21:25 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Which kernel version do you use ? And try my latest module version, i updated it.
Re: spuisofs [message #1650 is a reply to message #1649] Tue, 17 July 2012 21:31 Go to previous messageGo to next message
zecoxao is currently offline  zecoxao
Messages: 24
Registered: April 2012
Location: Portugal
Gitbrew Noob
i'm using your latest precompiled (3.4.4) from gitbrew. alright, i'll test and report back Smile
Re: spuisofs [message #1651 is a reply to message #1650] Tue, 17 July 2012 21:38 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
zecoxao wrote on Tue, 17 July 2012 19:31
i'm using your latest precompiled (3.4.4) from gitbrew. alright, i'll test and report back Smile


And where did you get the kernel module binary ? I didn't upload it.
Re: spuisofs [message #1653 is a reply to message #1651] Tue, 17 July 2012 21:57 Go to previous messageGo to next message
zecoxao is currently offline  zecoxao
Messages: 24
Registered: April 2012
Location: Portugal
Gitbrew Noob
you mean dtbImage? i'm not following sorry Sad . i got the precompiled kernel from the site, patched with patches 0180 and 0190, compiled the kernel with those patches, and compiled spuisofs . normally to test the kernel i add an entry to kboot.conf with vmlinux as image and copy all the contents of precompiled kernel to root.

[Updated on: Tue, 17 July 2012 21:58]

Report message to a moderator

Re: spuisofs [message #1654 is a reply to message #1653] Tue, 17 July 2012 22:02 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
zecoxao wrote on Tue, 17 July 2012 19:57
you mean dtbImage? i'm not following sorry Sad . i got the precompiled kernel from the site, patched with patches 0180 and 0190, compiled the kernel with those patches, and compiled spuisofs . normally to test the kernel i add an entry to kboot.conf with vmlinux as image and copy all the contents of precompiled kernel to root.


Shocked Shocked Shocked

Hmm, you should download vanilla kernel source from kernel.org, use my ps3 patches and compile it. Then compile spuisofs against the same kernel source.

My precompiled kernel is binary, it's not source code, you can not use patches on it.
Re: spuisofs [message #1655 is a reply to message #1654] Tue, 17 July 2012 22:04 Go to previous messageGo to next message
zecoxao is currently offline  zecoxao
Messages: 24
Registered: April 2012
Location: Portugal
Gitbrew Noob
ok thanks Smile i thought something was definitely wrong with it Very Happy . will compile and apply all necessary patches Smile
Re: spuisofs [message #1665 is a reply to message #1655] Wed, 18 July 2012 17:27 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Added new file to spuisofs: info.
You will see later why we need it.

It is read-only and shows virtual kernel addresess of arg1 and arg2 buffers.

[glevand@arch spp_verifier]$ cat /mnt/info 
arg1: d000000000a17000
arg2: d000000000b18000
[glevand@arch spp_verifier]$ 
Re: spuisofs [message #1679 is a reply to message #1665] Wed, 18 July 2012 18:53 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
lv1_undocumented_function_168(spuisofs_spe_id, 0x3000, 1ull << 32)


It restarts DMA controller of SPU after data segment/page fault.
The LV1 call modifies MFC_CNTL register.

[Updated on: Thu, 19 July 2012 22:09]

Report message to a moderator

Re: spuisofs [message #1691 is a reply to message #1679] Thu, 19 July 2012 05:35 Go to previous messageGo to next message
zecoxao is currently offline  zecoxao
Messages: 24
Registered: April 2012
Location: Portugal
Gitbrew Noob
YES!! Very Happy Managed to do it after 8 hours in front of the ps3 and pc. neat stuff glevand Smile
Re: spuisofs [message #1703 is a reply to message #1691] Thu, 19 July 2012 22:11 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
lv1_undocumented_function_201(spe_id)


It makes isolated SPU exit the isolated state and stop.

[Updated on: Thu, 19 July 2012 22:11]

Report message to a moderator

Re: spuisofs [message #1704 is a reply to message #1703] Thu, 19 July 2012 22:34 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Updated patch 0180-lv1call-add-undocumented-spe-hvcalls.patch with LV1 call 201.
Re: spuisofs [message #1705 is a reply to message #1704] Thu, 19 July 2012 22:47 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Cool Smile lv1_undocumented_function_201 does the trick !!!
Now you don't have to umount and unload the kernel module in order to run a SELF multiple times.
Updated all my tools. You have to patch your kernel again and add LV1 call 201.

This patch updated: http://gitbrew.org/~glevand/ps3/linux/linux-3/patches-3.4/01 80-lv1call-add-undocumented-spe-hvcalls.patch

Now it works without remounting:
[glevand@arch spp_verifier]$ ./spp_verifier /mnt ../spp_verifier.self ../default.spp 
shadow: spe_execution_status 7
priv2: puint_mb_R 2
shadow: spe_execution_status b
[glevand@arch spp_verifier]$ ./spp_verifier /mnt ../spp_verifier.self ../default.spp 
shadow: spe_execution_status 7
priv2: puint_mb_R 2
shadow: spe_execution_status b
[glevand@arch spp_verifier]$ ./spp_verifier /mnt ../spp_verifier.self ../default.spp 
shadow: spe_execution_status 7
priv2: puint_mb_R 2
shadow: spe_execution_status b
[glevand@arch spp_verifier]$ ./spp_verifier /mnt ../spp_verifier.self ../default.spp 
shadow: spe_execution_status 7
priv2: puint_mb_R 2
shadow: spe_execution_status b
[glevand@arch spp_verifier]$ ./spp_verifier /mnt ../spp_verifier.self ../default.spp 
shadow: spe_execution_status 7
priv2: puint_mb_R 2
shadow: spe_execution_status b

dmesg
...
spusisofs: vas id 2
spusisofs: spe id 49
spusisofs: lv1_undocumented_function_201 failed with -11
spusisofs: got class 1 irq
spusisofs: status 1
spusisofs: data segment fault at d0000000005fa000
spusisofs: puint_mb_R 2
spusisofs: got class 2 irq
spusisofs: status 12
spusisofs: spu_status_R 1000082
spusisofs: puint_mb_R 2
spusisofs: got class 2 irq
spusisofs: status 12
spusisofs: spu_status_R 1000082
spusisofs: puint_mb_R 2
spusisofs: got class 2 irq
spusisofs: status 12
spusisofs: spu_status_R 1000082
spusisofs: puint_mb_R 2
spusisofs: got class 2 irq
spusisofs: status 12
spusisofs: spu_status_R 1000082
...



Have fun.
In the next step i intend to implement AIM application which will run aim_module.self. That is where we will need data from info file.

Linux VFS is lots of fun Very Happy

[Updated on: Thu, 19 July 2012 22:54]

Report message to a moderator

Re: spuisofs [message #1706 is a reply to message #1705] Thu, 19 July 2012 22:52 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Another cool feature would be using LV1 call lv1_set_spe_transition_notifier.
This way we don't have to poll spe_execution_status from shadow area and just wait for an interrupt from LV1.

Another thing is why do i not get MBOX interrupt (class 2 spe interrupt) ??? Have to figure it out.

[Updated on: Thu, 19 July 2012 22:53]

Report message to a moderator

Re: spuisofs [message #1707 is a reply to message #1706] Thu, 19 July 2012 22:58 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
I uploaded here my latest (at this time) spuisofs.ko kernel module: http://gitbrew.org/~glevand/ps3/linux/linux-3/spuisofs/spuis ofs.ko

Just in case someone wants to try it out without compiling Linux kernel and the kernel module.


It will work only with MY precompiled Linux kernel 3.4.5 !!!


The Linux 3.4.5 kernel is here: http://gitbrew.org/~glevand/ps3/linux/linux-3/linux-3.4.5-bu ild.tar.bz2

Do not try to use this spuisofs.ko with your Linux kernel binary, that won't work.

[Updated on: Thu, 19 July 2012 22:59]

Report message to a moderator

Re: spuisofs [message #1713 is a reply to message #1707] Fri, 20 July 2012 15:25 Go to previous messageGo to next message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Next update Smile

We cannot use vmalloc for app, arg1 and arg2 buffers else we won't be able to mmap it from user-space.
Use vmalloc_user instead.

Chnaged interface to run file.
It expects 3 arguments: laid, arg1 size and arg2 size now.
You will see later why we need it when i test AIM SELF.
Re: spuisofs [message #1714 is a reply to message #1713] Fri, 20 July 2012 15:27 Go to previous messageGo to previous message
glevand is currently offline  glevand
Messages: 955
Registered: July 2011
Location: SONY
Gitbrew God
Ok, here is the second SELF application.
As promised here an example how to run aim_spu_module.self with spuisofs.

First you should update spuisofs.

[glevand@arch aim]$ make
gcc -O2 -Wall -c aim.c
gcc  -o aim aim.o
[glevand@arch aim]$ ./aim ../aim_spu_module.self ../eid0 1
spuisofs found at /mnt
arg1 kernel virtual address d000000001390000
shadow: spe_execution_status 7
priv2: puint_mb_R 2
shadow: spe_execution_status b
[glevand@arch aim]$
[glevand@arch aim]$ hexdump -C /mnt/arg1 | less
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 85  |................|
00000010  00 00 00 01 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000080  28 73 70 75 29 73 74 61  72 74 20 61 69 6d 20 73  |(spu)start aim s|
00000090  70 75 20 6d 6f 64 75 6c  65 21 0a 00 00 00 00 00  |pu module!......|
000000a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*


At offset 0x80 you see the debug buffer where aim_spu_module.self writes its messages.

When the application is done, first 0x10 bytes in arg1 is the result.

Here is the AIM application: http://gitbrew.org/~glevand/ps3/linux/linux-3/spuisofs/aim.t ar.gz

Have fun.


[Updated on: Fri, 20 July 2012 15:29]

Report message to a moderator

Previous Topic: petitboot is not reading kboot.conf from CDROM
Next Topic: Linux cold boot on PS3 Slim
Goto Forum:
  


Current Time: Thu Jun 20 06:46:01 CEST 2013

Total time taken to generate the page: 0.02918 seconds