Skip to contentSkip to conversation

ps3/block: Replace mtd/ps3vram by block/ps3vram

PATCH New Geert Uytterhoeven 1 participant 1 message Feb 25, 2009

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ps3/block: Replace mtd/ps3vram by block/ps3vram

Convert the PS3 Video RAM Storage Driver from an MTD driver to a plain block device driver.

The ps3vram driver exposes unused video RAM on the PS3 as a block device suitable for storage or swap. Fast data transfer is achieved using a local cache in system RAM and DMA transfers via the GPU.

The new driver is ca. 50% faster for reading, and ca. 10% for writing.

Cc Arnd Bergmann <[email protected]>
Cc Jens Axboe <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Vivien Chappelier <[email protected]>
Cc Jim Paris <[email protected]>

---
The MTD-based PS3 Video RAM Storage Driver was integrated into the mainline kernel in 2.6.29-rc1.

Ideally, we think it would be best if the existing MTD-based ps3vram driver would be replaced by the new block-based ps3vram driver before 2.6.29 is released. This would relieve the burden of supporting two different swap space schemes on PS3 (swap on /dev/mtdblock0 vs. /dev/ps3vram) from the distro maintainer's shoulders, as in that case there would never have been a stable kernel version containing the MTD-based ps3vram driver.

Changes since previous submission (Wed, 4 Mar 2009 14:57:20 +0100 (CET)):
- Use blk_queue_make_request() to get rid of the thread
- Add a mutex (cfr. the old driver), as ps3vram_make_request() may be called concurrently
TO DO (after 2.6.29): use a spinlock and a list to queue requests while the driver is busy
- Remove the old MTD-based ps3vram driver and rename ps3vram-ng to ps3vram
- Make PS3_VRAM depend on FB_PS3=y and m for now
ps3vram relies on ps3fb being initialized first. The easiest way to do this is by making ps3vram modular, and ps3fb builtin
- Remove the dependency on ps3fb_videomemory.size
The loop to reduce ddr_size until it succeeds does the right thing anyway, and a few MiB of DDR RAM are reserved by the hypervisor
- lv1 return codes can be int
- Correct a few debug annotations

 arch/powerpc/platforms/ps3/Kconfig |    7 +
 drivers/block/Makefile             |    1 +
 drivers/block/ps3vram.c            |  865 ++++++++++++++++++++++++++++++++++++
 drivers/mtd/devices/Kconfig        |    7 -
 drivers/mtd/devices/Makefile       |    1 -
 drivers/mtd/devices/ps3vram.c      |  768 --------------------------------
 6 files changed, 873 insertions(+), 776 deletions(-)
 create mode 100644 drivers/block/ps3vram.c
 delete mode 100644 drivers/mtd/devices/ps3vram.c
arch/powerpc/platforms/ps3/Kconfig +7 -0
index 920cf7a..740ef56 100644
@@ -128,6 +128,13 @@ config PS3_FLASH
 	  be disabled on the kernel command line using "ps3flash=off", to
 	  not allocate this fixed buffer.
 
+config PS3_VRAM
+	tristate "PS3 Video RAM Storage Driver"
+	depends on FB_PS3=y && BLOCK && m
+	help
+	  This driver allows you to use excess PS3 video RAM as volatile
+	  storage or system swap.
+
 config PS3_LPM
 	tristate "PS3 Logical Performance Monitor support"
 	depends on PPC_PS3
drivers/block/Makefile +1 -0
index 204332b..87e120e 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_MAC_FLOPPY)	+= swim3.o
 obj-$(CONFIG_BLK_DEV_FD)	+= floppy.o
 obj-$(CONFIG_AMIGA_FLOPPY)	+= amiflop.o
 obj-$(CONFIG_PS3_DISK)		+= ps3disk.o
+obj-$(CONFIG_PS3_VRAM)		+= ps3vram.o
 obj-$(CONFIG_ATARI_FLOPPY)	+= ataflop.o
 obj-$(CONFIG_AMIGA_Z2RAM)	+= z2ram.o
 obj-$(CONFIG_BLK_DEV_RAM)	+= brd.o
drivers/block/ps3vram.c new file +865 -0

865 lines not on this page · raw message

drivers/mtd/devices/Kconfig +0 -7
index bc33200..6fde0a2 100644
@@ -120,13 +120,6 @@ config MTD_PHRAM
 	  doesn't have access to, memory beyond the mem=xxx limit, nvram,
 	  memory on the video card, etc...
 
-config MTD_PS3VRAM
-	tristate "PS3 video RAM"
-	depends on FB_PS3
-	help
-	  This driver allows you to use excess PS3 video RAM as volatile
-	  storage or system swap.
-
 config MTD_LART
 	tristate "28F160xx flash driver for LART"
 	depends on SA1100_LART
drivers/mtd/devices/Makefile +0 -1
index e51521d..0993d5c 100644
@@ -16,4 +16,3 @@ obj-$(CONFIG_MTD_LART)		+= lart.o
 obj-$(CONFIG_MTD_BLOCK2MTD)	+= block2mtd.o
 obj-$(CONFIG_MTD_DATAFLASH)	+= mtd_dataflash.o
 obj-$(CONFIG_MTD_M25P80)	+= m25p80.o
-obj-$(CONFIG_MTD_PS3VRAM)	+= ps3vram.o
drivers/mtd/devices/ps3vram.c deleted +0 -768

768 lines not on this page · raw message

Signature · 19 lines
1.6.0.4


With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village ? Da Vincilaan 7-D1 ? B-1935 Zaventem ? Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   Geert.Uytterhoeven at sonycom.com
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 ? RPR Brussels
Fortis ? BIC GEBABEBB ? IBAN BE41293037680010