ppc64: Introduce Cell/BPA platform, v3
Subsystems (6)
Arnd Bergmann
maintainercover ppc64: Introduce Cell/BPA platform, v3
This series of patches add support for a fifth platform type in the ppc64 architecture tree. The Broadband Processor Architecture (BPA) is what machines using the Cell processor should be following and currently only prototype hardware exists for it.
Most of the functionality is the same as in the previous version. The main updates are:
- Fixes for the comments I got
- Added more patches for moving rtas related stuff around from pSeries, so we can use it from BPA as well
- Smaller bug fixes
- Lots of changes on the SPU file system (see the patch comments)
One thing that has happened is that the Cell Processor Based Blade has now been shown on E3 and the Power.org press summit and will also be on Linuxtag, so you can now see what kind of hardware this runs on.
This series does not include the libspu files, as we are doing some changes to the library right now. I'm also not including the driver for our network driver yet. It's working well, but I'm waiting for a cleanup patch and plan to submit it after Linuxtag.
Please forward these patches for inclusion in 2.6.13 if you are happy with them. The spufs code is still not ready for inclusion, but it could start a life in -mm to get a broader review at this point.
Arnd <><
Arnd Bergmann
maintainerPATCH 1/11 ppc64: consolidate calibrate_decr implementations
pSeries and maple have almost the same code for calibrate_decr, and BPA would need yet another copy. Instead, I'm moving the code to arch/ppc64/kernel/time.c.
Some of the related declarations were missing from header files, so I'm moving those as well.
It makes sense to merge this with the pmac function of the same name, so we end up having just one implemetation for iSeries and one for Open Firmware based machines.
---
arch/ppc64/kernel/iSeries_setup.c | 5 -- arch/ppc64/kernel/maple_setup.c | 2 - arch/ppc64/kernel/maple_time.c | 51 ---------------------------- arch/ppc64/kernel/pSeries_setup.c | 69 -------------------------------------- arch/ppc64/kernel/pmac_time.c | 8 ---- arch/ppc64/kernel/setup.c | 5 -- arch/ppc64/kernel/time.c | 63 ++++++++++++++++++++++++++++++++++ include/asm-ppc64/time.h | 9 ++++ 8 files changed, 76 insertions(+), 136 deletions(-)
arch/ppc64/kernel/iSeries_setup.c +0 -5
@@ -665,9 +665,6 @@ static void __init iSeries_bolt_kernel(u } } -extern unsigned long ppc_proc_freq; -extern unsigned long ppc_tb_freq; -/* * Document me. */
@@ -766,8 +763,6 @@ static void iSeries_halt(void)mf_power_off (); } -extern void setup_default_decr (void ); -/* * void __init iSeries_calibrate_decr() *
arch/ppc64/kernel/maple_setup.c +1 -1
@@ -235,6 +235,6 @@ struct machdep_calls __initdata maple_md .get_boot_time = maple_get_boot_time, .set_rtc_time = maple_set_rtc_time, .get_rtc_time = maple_get_rtc_time, - .calibrate_decr = maple_calibrate_decr, + .calibrate_decr = generic_calibrate_decr, .progress = maple_progress, };
arch/ppc64/kernel/maple_time.c +0 -51
62 lines not on this page · raw message
arch/ppc64/kernel/pSeries_setup.c +1 -68
87 lines not on this page · raw message
arch/ppc64/kernel/pmac_time.c +1 -7
@@ -40,11 +40,6 @@ #define DBG(x...)#endif -extern void setup_default_decr (void ); - -extern unsigned long ppc_tb_freq; -extern unsigned long ppc_proc_freq; -/* Apparently the RTC stores seconds since 1 Jan 1904 */ #define RTC_OFFSET 2082844800
@@ -161,8 +156,7 @@ void __init pmac_get_boot_time(struct rt/* * Query the OF and get the decr frequency. -* This was taken from the pmac time_init() when merging the prep/pmac -* time functions. +* FIXME: merge this with generic_calibrate_decr */ void __init pmac_calibrate_decr (void ) {
arch/ppc64/kernel/setup.c +1 -4
@@ -700,9 +700,6 @@ void machine_halt(void)EXPORT_SYMBOL (machine_halt); -unsigned long ppc_proc_freq; -unsigned long ppc_tb_freq; -static int ppc64_panic_event (struct notifier_block *this,unsigned long event,void *ptr) {
@@ -1116,7 +1113,7 @@ void ppc64_dump_msg(unsigned int src, co }/* This should only be called on processor 0 during calibrate decr */ -void setup_default_decr (void ) +void __init setup_default_decr (void ) {struct paca_struct *lpaca =get_paca ();
arch/ppc64/kernel/time.c +63 -0
75 lines not on this page · raw message
include/asm-ppc64/time.h +9 -0
@@ -34,6 +34,15 @@ struct rtc_time;extern void to_tm (int tim,struct rtc_time * tm);extern time_t last_rtc_update; +void generic_calibrate_decr (void ); +void setup_default_decr (void ); + +/* Some sane defaults: 125 MHz timebase, 1GHz processor */ +extern unsigned long ppc_proc_freq; +#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8) +extern unsigned long ppc_tb_freq; +#define DEFAULT_TB_FREQ 125000000UL +/* * By putting all of this stuff into a single struct we * reduce the number of cache lines touched by do_gettimeofday.
Arnd Bergmann
maintainerPATCH 2/11 ppc64: rename pSeries rtc functions into rtas_*
The rtc rtas functions are not pSeries specific but can also be used by BPA and other SLOF based platforms
--
arch/ppc64/kernel/pSeries_setup.c | 9 +++------ arch/ppc64/kernel/rtc.c | 6 +++--- include/asm-ppc64/rtas.h | 5 +++++ 3 files changed, 11 insertions(+), 9 deletions(-)
arch/ppc64/kernel/pSeries_setup.c +3 -6
@@ -73,9 +73,6 @@extern void pSeries_final_fixup (void ); -extern void pSeries_get_boot_time (struct rtc_time *rtc_time); -extern void pSeries_get_rtc_time (struct rtc_time *rtc_time); -extern int pSeries_set_rtc_time (struct rtc_time *rtc_time);extern void find_udbg_vterm (void );extern void system_reset_fwnmi (void );/* from head.S */ extern void machine_check_fwnmi (void );/* from head.S */
@@ -534,9 +531,9 @@ struct machdep_calls __initdata pSeries_ .halt = rtas_halt, .panic = rtas_os_term, .cpu_die = pSeries_mach_cpu_die, - .get_boot_time = pSeries_get_boot_time, - .get_rtc_time = pSeries_get_rtc_time, - .set_rtc_time = pSeries_set_rtc_time, + .get_boot_time = rtas_get_boot_time, + .get_rtc_time = rtas_get_rtc_time, + .set_rtc_time = rtas_set_rtc_time, .calibrate_decr = generic_calibrate_decr, .progress = pSeries_progress, .check_legacy_ioport = pSeries_check_legacy_ioport,
arch/ppc64/kernel/rtc.c +3 -3
@@ -303,7 +303,7 @@ void iSeries_get_boot_time(struct rtc_ti#ifdef CONFIG_PPC_RTAS #define MAX_RTC_WAIT 5000/* 5 sec */ #define RTAS_CLOCK_BUSY (-2) -void pSeries_get_boot_time (struct rtc_time *rtc_tm) +void rtas_get_boot_time (struct rtc_time *rtc_tm) {int ret[8 ];int error, wait_time;
@@ -338,7 +338,7 @@ void pSeries_get_boot_time(struct rtc_ti* and if a delay is needed to read the clock. In this case we just * silently return without updating rtc_tm. */ -void pSeries_get_rtc_time (struct rtc_time *rtc_tm) +void rtas_get_rtc_time (struct rtc_time *rtc_tm) {int ret[8 ];int error, wait_time;
@@ -373,7 +373,7 @@ void pSeries_get_rtc_time(struct rtc_tim rtc_tm->tm_year = ret[0 ] -1900 ; } -int pSeries_set_rtc_time (struct rtc_time *tm) +int rtas_set_rtc_time (struct rtc_time *tm) {int error, wait_time;unsigned long max_wait_tb;
include/asm-ppc64/rtas.h +5 -0
@@ -188,6 +188,11 @@ extern int rtas_set_power_level(int poweextern int rtas_set_indicator (int indicator,int index,int new_value);extern void rtas_initialize (void ); +struct rtc_time ; +extern void rtas_get_boot_time (struct rtc_time *rtc_time); +extern void rtas_get_rtc_time (struct rtc_time *rtc_time); +extern int rtas_set_rtc_time (struct rtc_time *rtc_time); +/* Given an RTAS status code of 9900..9905 compute the hinted delay */ unsigned int rtas_extended_busy_delay_time (int status);static inline int rtas_is_extended_busy (int status)
Arnd Bergmann
maintainerPATCH 3/11 ppc64: Split out generic rtas code from pSeries_pci.c.
BPA is using rtas for PCI but should not be confused by pSeries code. This also avoids some #ifdefs. Other platforms that want to use rtas_pci.c could create their own platform_pci.c with platform specific fixups.
--
Makefile | 3 mpic.h | 3 pSeries_pci.c | 476 ------------------------------------------------------- rtas_pci.c | 495 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 506 insertions(+), 471 deletions(-)
arch/ppc64/kernel/Makefile +2 -1
@@ -32,13 +32,14 @@ obj-$(CONFIG_PPC_MULTIPLATFORM) += nvram obj-$(CONFIG_PPC_PSERIES) += pSeries_pci.o pSeries_lpar.o pSeries_hvCall.o \ pSeries_nvram.o rtasd.o ras.o pSeries_reconfig.o \ - xics.o rtas.o pSeries_setup.o pSeries_iommu.o + xics.o pSeries_setup.o pSeries_iommu.o obj-$(CONFIG_EEH) += eeh.o obj-$(CONFIG_PROC_FS) += proc_ppc64.o obj-$(CONFIG_RTAS_FLASH) += rtas_flash.o obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_MODULES) += module.o ppc_ksyms.o +obj-$(CONFIG_PPC_RTAS) += rtas.o rtas_pci.o obj-$(CONFIG_RTAS_PROC) += rtas-proc.o obj-$(CONFIG_SCANLOG) += scanlog.o obj-$(CONFIG_VIOPATH) += viopath.o
arch/ppc64/kernel/mpic.h +3 -0
@@ -265,3 +265,6 @@ extern void mpic_send_ipi(unsigned int iextern int mpic_get_one_irq (struct mpic *mpic,struct pt_regs *regs);/* This one gets to the primary mpic */ extern int mpic_get_irq (struct pt_regs *regs); + +/* global mpic for pSeries */ +extern struct mpic *pSeries_mpic;
arch/ppc64/kernel/pSeries_pci.c +6 -470
512 lines not on this page · raw message
arch/ppc64/kernel/rtas_pci.c +495 -0
495 lines not on this page · raw message
Arnd Bergmann
maintainerPATCH 4/11 ppc64: pSeries_progress -> rtas_progress
The pSeries_progress function is called from some places in the rtas code, which may also be used by non-pSeries platforms.
Though pSeries is currently the only platform type that implements display-character, the code is actually generic enough to be part of the rtas subsystem.
I hit a bug here because the generic rtas code tried calling ppc_md.progress, which points to an __init function on most platforms.
We could also clear the ppc_md.progress pointer when freeing the init memory to make it more explicit that ppc_md.progress must not be called after bootup.
---
arch/ppc64/kernel/pSeries_setup.c | 103 ------------------------------------ arch/ppc64/kernel/rtas.c | 106 +++++++++++++++++++++++++++++++++++++- include/asm-ppc64/rtas.h | 1 3 files changed, 106 insertions(+), 104 deletions(-)
arch/ppc64/kernel/pSeries_setup.c +1 -102
@@ -375,107 +375,6 @@ static void __init pSeries_init_early(vo } -static void pSeries_progress (char *s,unsigned short hex) -{ -struct device_node *root; -int width, *p; -char *os; -static int display_character, set_indicator; -static int max_width; -static DEFINE_SPINLOCK (progress_lock); -static int pending_newline =0 ;/* did last write end with unprinted newline? */ - -if (!rtas.base) -return ; - -if (max_width ==0 ) { -if ((root =find_path_device ("/rtas" )) && - (p = (unsigned int *)get_property (root, -"ibm,display-line-length" , -NULL ))) - max_width = *p; -else - max_width =0x10 ; - display_character =rtas_token ("display-character" ); - set_indicator =rtas_token ("set-indicator" ); - } - -if (display_character ==RTAS_UNKNOWN_SERVICE ) { -/* use hex display if available */ -if (set_indicator !=RTAS_UNKNOWN_SERVICE ) -rtas_call (set_indicator,3 ,1 ,NULL ,6 ,0 , hex); -return ; - } - -spin_lock (&progress_lock); - -/* -* Last write ended with newline, but we didn't print it since -* it would just clear the bottom line of output. Print it now -* instead. -* -* If no newline is pending, print a CR to start output at the -* beginning of the line. -*/ -if (pending_newline) { -rtas_call (display_character,1 ,1 ,NULL ,'\r' ); -rtas_call (display_character,1 ,1 ,NULL ,'\n' ); - pending_newline =0 ; - }else { -rtas_call (display_character,1 ,1 ,NULL ,'\r' ); - } - - width = max_width; - os = s; -while (*os) { -if (*os =='\n' || *os =='\r' ) { -/* Blank to end of line. */ -while (width-- >0 ) -rtas_call (display_character,1 ,1 ,NULL ,' ' ); - -/* If newline is the last character, save it -* until next call to avoid bumping up the -* display output. -*/ -if (*os =='\n' && !os[1 ]) { - pending_newline =1 ; -spin_unlock (&progress_lock); -return ; - } - -/* RTAS wants CR-LF, not just LF */ - -if (*os =='\n' ) { -rtas_call (display_character,1 ,1 ,NULL ,'\r' ); -rtas_call (display_character,1 ,1 ,NULL ,'\n' ); - }else { -/* CR might be used to re-draw a line, so we'll -* leave it alone and not add LF. -*/ -rtas_call (display_character,1 ,1 ,NULL , *os); - } - - width = max_width; - }else { - width--; -rtas_call (display_character,1 ,1 ,NULL , *os); - } - - os++; - -/* if we overwrite the screen length */ -if (width <=0 ) -while ((*os !=0 ) && (*os !='\n' ) && (*os !='\r' )) - os++; - } - -/* Blank to end of line. */ -while (width-- >0 ) -rtas_call (display_character,1 ,1 ,NULL ,' ' ); - -spin_unlock (&progress_lock); -} -static int pSeries_check_legacy_ioport (unsigned int baseport) {struct device_node *np;
@@ -535,7 +434,7 @@ struct machdep_calls __initdata pSeries_ .get_rtc_time = rtas_get_rtc_time, .set_rtc_time = rtas_set_rtc_time, .calibrate_decr = generic_calibrate_decr, - .progress = pSeries_progress, + .progress = rtas_progress, .check_legacy_ioport = pSeries_check_legacy_ioport, .system_reset_exception = pSeries_system_reset_exception, .machine_check_exception = pSeries_machine_check_exception,
arch/ppc64/kernel/rtas-proc.c +2 -2
@@ -371,11 +371,11 @@ static ssize_t ppc_rtas_progress_write(s/* Lets see if the user passed hexdigits */ hex =simple_strtoul (progress_led,NULL ,10 ); - ppc_md.progress ((char *)progress_led, hex); +rtas_progress ((char *)progress_led, hex);return count;/* clear the line */ -/* ppc_md.progress(" ", 0xffff);*/ +/* rtas_progress(" ", 0xffff);*/ }/* ****************************************************************** */ static int ppc_rtas_progress_show (struct seq_file *m,void *v)
arch/ppc64/kernel/rtas.c +104 -2
118 lines not on this page · raw message
include/asm-ppc64/rtas.h +1 -0
@@ -186,6 +186,7 @@ extern int rtas_get_sensor(int sensor, iextern int rtas_get_power_level (int powerdomain,int *level);extern int rtas_set_power_level (int powerdomain,int level,int *setlevel);extern int rtas_set_indicator (int indicator,int index,int new_value); +extern void rtas_progress (char *s,unsigned short hex);extern void rtas_initialize (void );struct rtc_time ;
Arnd Bergmann
maintainerPATCH 5/11 ppc64: add a minimal nvram driver
The firmware provides the location and size of the nvram in the device tree, so it does not really contain any hardware specific bits and could be used on other machines as well.
From: Utz Bacher <[email protected]>
arch/ppc64/kernel/bpa_nvram.c new file +118 -0
@@ -0,0 +1,118 @@ +/* +* NVRAM for CPBW +* +* (C) Copyright IBM Corp. 2005 +* +* Authors : Utz Bacher <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2, or (at your option) +* any later version. +* +* This program 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/fs.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/spinlock.h> +#include <linux/types.h> + +#include <asm/machdep.h> +#include <asm/nvram.h> +#include <asm/prom.h> + +static void __iomem *bpa_nvram_start; +static long bpa_nvram_len; +static spinlock_t bpa_nvram_lock =SPIN_LOCK_UNLOCKED ; + +static ssize_t bpa_nvram_read (char *buf,size_t count,loff_t *index) +{ +unsigned long flags; + +if (*index >= bpa_nvram_len) +return 0 ; +if (*index + count > bpa_nvram_len) + count = bpa_nvram_len - *index; + +spin_lock_irqsave (&bpa_nvram_lock, flags); + +memcpy_fromio (buf, bpa_nvram_start + *index, count); + +spin_unlock_irqrestore (&bpa_nvram_lock, flags); + + *index += count; +return count; +} + +static ssize_t bpa_nvram_write (char *buf,size_t count,loff_t *index) +{ +unsigned long flags; + +if (*index >= bpa_nvram_len) +return 0 ; +if (*index + count > bpa_nvram_len) + count = bpa_nvram_len - *index; + +spin_lock_irqsave (&bpa_nvram_lock, flags); + +memcpy_toio (bpa_nvram_start + *index, buf, count); + +spin_unlock_irqrestore (&bpa_nvram_lock, flags); + + *index += count; +return count; +} + +static ssize_t bpa_nvram_get_size (void ) +{ +return bpa_nvram_len; +} + +int __init bpa_nvram_init (void ) +{ +struct device_node *nvram_node; +unsigned long *buffer; +int proplen; +unsigned long nvram_addr; +int ret; + + ret = -ENODEV ; + nvram_node =of_find_node_by_type (NULL ,"nvram" ); +if (!nvram_node) + goto out; + + ret = -EIO ; + buffer = (unsigned long *)get_property (nvram_node,"reg" , &proplen); +if (proplen !=2 *sizeof (unsigned long )) + goto out; + + ret = -ENODEV ; + nvram_addr = buffer[0 ]; + bpa_nvram_len = buffer[1 ]; +if ( (!bpa_nvram_len) || (!nvram_addr) ) + goto out; + + bpa_nvram_start =ioremap (nvram_addr, bpa_nvram_len); +if (!bpa_nvram_start) + goto out; + +printk (KERN_INFO "BPA NVRAM, %luk mapped to %p\n" , + bpa_nvram_len >>10 , bpa_nvram_start); + + ppc_md.nvram_read = bpa_nvram_read; + ppc_md.nvram_write = bpa_nvram_write; + ppc_md.nvram_size = bpa_nvram_get_size; + +out: +of_node_put (nvram_node); +return ret; +}
include/asm-ppc64/nvram.h +1 -0
@@ -70,6 +70,7 @@extern int pSeries_nvram_init (void );extern int pmac_nvram_init (void ); +extern int bpa_nvram_init (void );/* PowerMac specific nvram stuffs */
Arnd Bergmann
maintainerPATCH 6/11 ppc64: add a watchdog driver for rtas
Add a watchdog using the RTAS OS surveillance service. This is provided as a simpler alternative to rtasd. The added value is that it works with standard watchdog client programs and can therefore also do user space monitoring.
On BPA, rtasd is not really useful because the hardware does not have much to report with event-scan.
The driver should also work on other platforms that support the OS surveillance rtas calls.
From: Utz Bacher <[email protected]>
--
Kconfig | 10 Makefile | 1 wdrtas.c | 696 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 707 insertions(+)
drivers/char/watchdog/Kconfig +10 -0
@@ -414,6 +414,16 @@ config WATCHDOG_RIO machines. The watchdog timeout period is normally one minute but can be changed with a boot-time parameter. +# ppc64 RTAS watchdog +config WATCHDOG_RTAS + tristate "RTAS watchdog" + depends on WATCHDOG && PPC_RTAS + help + This driver adds watchdog support for the RTAS watchdog. + + To compile this driver as a module, choose M here. The module + will be called wdrtas. + # # ISA-based Watchdog Cards #
drivers/char/watchdog/Makefile +1 -0
@@ -33,6 +33,7 @@ obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb. obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o obj-$(CONFIG_IXP2000_WATCHDOG) += ixp2000_wdt.o obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o +obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o # Only one watchdog can succeed. We probe the hardware watchdog # drivers first, then the softdog driver. This means if your hardware
drivers/char/watchdog/wdrtas.c +696 -0
696 lines not on this page · raw message
Arnd Bergmann
maintainerPATCH 7/11 ppc64: add BPA platform type
This adds the basic support for running on BPA machines. So far, this is only the IBM workstation, and it will not run on others without a little more generalization.
It should be possible to configure a kernel for any combination of CONFIG_PPC_BPA with any of the other multiplatform targets.
--
MAINTAINERS | 7 + arch/ppc64/Kconfig | 6 + arch/ppc64/Makefile | 2 arch/ppc64/kernel/Makefile | 3 arch/ppc64/kernel/bpa_setup.c | 135 +++++++++++++++++++++++++++++++++++ arch/ppc64/kernel/cpu_setup_power4.S | 16 +++- arch/ppc64/kernel/cputable.c | 11 ++ arch/ppc64/kernel/irq.c | 3 arch/ppc64/kernel/proc_ppc64.c | 2 arch/ppc64/kernel/prom_init.c | 4 - arch/ppc64/kernel/setup.c | 4 + arch/ppc64/kernel/traps.c | 4 + include/asm-ppc64/mmu.h | 5 - include/asm-ppc64/processor.h | 15 +++ include/asm-ppc64/smp.h | 8 ++ 15 files changed, 216 insertions(+), 9 deletions(-)
MAINTAINERS +7 -0
@@ -499,6 +499,13 @@ L: [email protected] W: http://sourceforge.net/projects/bonding/ S: Supported +BROADBAND PROCESSOR ARCHITECTURE +P: Arnd Bergmann +M: [email protected] +L: [email protected] +W: http://linuxppc64.org +S: Supported + BTTV VIDEO4LINUX DRIVER P: Gerd Knorr M: [email protected]
arch/ppc64/Kconfig +5 -1
@@ -77,6 +77,10 @@ config PPC_PSERIES bool " IBM pSeries & new iSeries" default y +config PPC_BPA + bool " Broadband Processor Architecture" + depends on PPC_MULTIPLATFORM + config PPC_PMAC depends on PPC_MULTIPLATFORM bool " Apple G5 based machines"
@@ -256,7 +260,7 @@ config MSCHUNKS config PPC_RTAS bool - depends on PPC_PSERIES + depends on PPC_PSERIES || PPC_BPA default y config RTAS_PROC
arch/ppc64/Makefile +2 -0
@@ -90,12 +90,14 @@ boot := arch/ppc64/boot boottarget-$(CONFIG_PPC_PSERIES) := zImage zImage.initrd boottarget-$(CONFIG_PPC_MAPLE) := zImage zImage.initrd boottarget-$(CONFIG_PPC_ISERIES) := vmlinux.sminitrd vmlinux.initrd vmlinux.sm +boottarget-$(CONFIG_PPC_BPA) := zImage zImage.initrd $(boottarget-y): vmlinux $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage bootimage-$(CONFIG_PPC_PMAC) := vmlinux bootimage-$(CONFIG_PPC_MAPLE) := $(boot)/zImage +bootimage-$(CONFIG_PPC_BPA) := zImage bootimage-$(CONFIG_PPC_ISERIES) := vmlinux BOOTIMAGE := $(bootimage-y) install: vmlinux
arch/ppc64/kernel/Makefile +3 -0
@@ -34,6 +34,8 @@ obj-$(CONFIG_PPC_PSERIES) += pSeries_pci pSeries_nvram.o rtasd.o ras.o pSeries_reconfig.o \ xics.o pSeries_setup.o pSeries_iommu.o +obj-$(CONFIG_PPC_BPA) += bpa_setup.o bpa_nvram.o + obj-$(CONFIG_EEH) += eeh.o obj-$(CONFIG_PROC_FS) += proc_ppc64.o obj-$(CONFIG_RTAS_FLASH) += rtas_flash.o
@@ -60,6 +62,7 @@ ifdef CONFIG_SMP obj-$(CONFIG_PPC_PMAC) += pmac_smp.o smp-tbsync.o obj-$(CONFIG_PPC_ISERIES) += iSeries_smp.o obj-$(CONFIG_PPC_PSERIES) += pSeries_smp.o +obj-$(CONFIG_PPC_BPA) += pSeries_smp.o obj-$(CONFIG_PPC_MAPLE) += smp-tbsync.o endif
arch/ppc64/kernel/bpa_setup.c +135 -0
135 lines not on this page · raw message
arch/ppc64/kernel/cpu_setup_power4.S +15 -1
@@ -73,7 +73,21 @@ _GLOBAL(__970_cpu_preinit) _GLOBAL(__setup_cpu_power4) blr - + +_GLOBAL(__setup_cpu_be) + /* Set large page sizes LP=0: 16MB, LP=1: 64KB */ + addi r3, 0, 0 + ori r3, r3, HID6_LB + sldi r3, r3, 32 + nor r3, r3, r3 + mfspr r4, SPRN_HID6 + and r4, r4, r3 + addi r3, 0, 0x02000 + sldi r3, r3, 32 + or r4, r4, r3 + mtspr SPRN_HID6, r4 + blr + _GLOBAL(__setup_cpu_ppc970) mfspr r0,SPRN_HID0 li r11,5 /* clear DOZE and SLEEP */
arch/ppc64/kernel/cputable.c +11 -0
@@ -34,6 +34,7 @@ EXPORT_SYMBOL(cur_cpu_spec);extern void __setup_cpu_power3 (unsigned long offset,struct cpu_spec * spec);extern void __setup_cpu_power4 (unsigned long offset,struct cpu_spec * spec);extern void __setup_cpu_ppc970 (unsigned long offset,struct cpu_spec * spec); +extern void __setup_cpu_be (unsigned long offset,struct cpu_spec * spec);/* We only set the altivec features if the kernel was compiled with altivec
@@ -162,6 +163,16 @@ struct cpu_spec cpu_specs[] = { __setup_cpu_power4,COMMON_PPC64_FW }, + { /* BE DD1.x */ +0xffff0000 ,0x00700000 ,"Broadband Engine" , +CPU_FTR_SPLIT_ID_CACHE |CPU_FTR_USE_TB |CPU_FTR_HPTE_TABLE | +CPU_FTR_PPCAS_ARCH_V2 |CPU_FTR_ALTIVEC_COMP | +CPU_FTR_SMT , +COMMON_USER_PPC64 |PPC_FEATURE_HAS_ALTIVEC_COMP , +128 ,128 , + __setup_cpu_be, +COMMON_PPC64_FW + }, { /* default match */0x00000000 ,0x00000000 ,"POWER4 (compatible)" , CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
arch/ppc64/kernel/irq.c +3 -0
@@ -395,6 +395,9 @@ int virt_irq_create_mapping(unsigned intif (ppc64_interrupt_controller ==IC_OPEN_PIC )return real_irq;/* no mapping for openpic (for now) */ +if (ppc64_interrupt_controller ==IC_BPA_IIC ) +return real_irq;/* no mapping for iic either */ +/* don't map interrupts < MIN_VIRT_IRQ */ if (real_irq <MIN_VIRT_IRQ ) { virt_irq_to_real_map[real_irq] = real_irq;
arch/ppc64/kernel/proc_ppc64.c +1 -1
@@ -53,7 +53,7 @@ static int __init proc_ppc64_create(voidif (!root)return 1 ; -if (!(systemcfg->platform &PLATFORM_PSERIES )) +if (!(systemcfg->platform & (PLATFORM_PSERIES |PLATFORM_BPA )))return 0 ;if (!proc_mkdir ("rtas" , root))
arch/ppc64/kernel/prom_init.c +2 -2
@@ -1915,9 +1915,9 @@ unsigned long __init prom_init(unsignedprom_send_capabilities ();/* -* On pSeries, copy the CPU hold code +* On pSeries and BPA, copy the CPU hold code */ -if (RELOC (of_platform) &PLATFORM_PSERIES ) +if (RELOC (of_platform) & (PLATFORM_PSERIES |PLATFORM_BPA ))copy_and_flush (0 ,KERNELBASE - offset,0x100 ,0 );/*
arch/ppc64/kernel/setup.c +4 -0
@@ -343,6 +343,7 @@ static void __init setup_cpu_maps(void)extern struct machdep_calls pSeries_md;extern struct machdep_calls pmac_md;extern struct machdep_calls maple_md; +extern struct machdep_calls bpa_md;/* Ultimately, stuff them in an elf section like initcalls... */ static struct machdep_calls __initdata *machines[] = {
@@ -355,6 +356,9 @@ static struct machdep_calls __initdata *#ifdef CONFIG_PPC_MAPLE &maple_md,#endif /* CONFIG_PPC_MAPLE */ +#ifdef CONFIG_PPC_BPA + &bpa_md, +#endifNULL };
arch/ppc64/kernel/traps.c +4 -0
@@ -126,6 +126,10 @@ int die(const char *str, struct pt_regsprintk ("POWERMAC " ); nl =1 ;break ; +case PLATFORM_BPA : +printk ("BPA " ); + nl =1 ; +break ; }if (nl)printk ("\n" );
include/asm-ppc64/mmu.h +3 -2
@@ -47,9 +47,10 @@#define SLB_VSID_KS ASM_CONST(0x0000000000000800)#define SLB_VSID_KP ASM_CONST(0x0000000000000400)#define SLB_VSID_N ASM_CONST(0x0000000000000200)/* no-execute */ -#define SLB_VSID_L ASM_CONST(0x0000000000000100)/* largepage 16M */ +#define SLB_VSID_L ASM_CONST(0x0000000000000100)/* largepage */ #define SLB_VSID_C ASM_CONST(0x0000000000000080)/* class */ - +#define SLB_VSID_LS ASM_CONST(0x0000000000000070)/* size of largepage */ +#define SLB_VSID_KERNEL (SLB_VSID_KP|SLB_VSID_C)#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS)
include/asm-ppc64/processor.h +13 -2
@@ -138,8 +138,16 @@#define SPRN_NIADORM 0x3F3/* Hardware Implementation Register 2 */ #define SPRN_HID4 0x3F4/* 970 HID4 */ #define SPRN_HID5 0x3F6/* 970 HID5 */ -#define SPRN_TSC 0x3FD/* Thread switch control */ -#define SPRN_TST 0x3FC/* Thread switch timeout */ +#define SPRN_HID6 0x3F9/* BE HID 6 */ +#define HID6_LB (0x0F<<12)/* Concurrent Large Page Modes */ +#define HID6_DLP (1<<20)/* Disable all large page modes (4K only) */ +#define SPRN_TSCR 0x399/* Thread switch control on BE */ +#define SPRN_TTR 0x39A/* Thread switch timeout on BE */ +#define TSCR_DEC_ENABLE 0x200000/* Decrementer Interrupt */ +#define TSCR_EE_ENABLE 0x100000/* External Interrupt */ +#define TSCR_EE_BOOST 0x080000/* External Interrupt Boost */ +#define SPRN_TSC 0x3FD/* Thread switch control on others */ +#define SPRN_TST 0x3FC/* Thread switch timeout on others */ #define SPRN_L2CR 0x3F9/* Level 2 Cache Control Regsiter */ #define SPRN_LR 0x008/* Link Register */ #define SPRN_PIR 0x3FF/* Processor Identification Register */
@@ -259,6 +267,7 @@#define PV_970FX 0x003C#define PV_630 0x0040#define PV_630p 0x0041 +#define PV_BE 0x0070/* Platforms supported by PPC64 */ #define PLATFORM_PSERIES 0x0100
@@ -267,6 +276,7 @@#define PLATFORM_LPAR 0x0001#define PLATFORM_POWERMAC 0x0400#define PLATFORM_MAPLE 0x0500 +#define PLATFORM_BPA 0x1000/* Compatibility with drivers coming from PPC32 world */ #define _machine (systemcfg->platform)
@@ -278,6 +288,7 @@#define IC_INVALID 0#define IC_OPEN_PIC 1#define IC_PPC_XIC 2 +#define IC_BPA_IIC 3#define XGLUE (a,b) a##b#define GLUE (a,b) XGLUE(a,b)
include/asm-ppc64/smp.h +8 -0
@@ -85,6 +85,14 @@ extern void smp_generic_take_timebase(voextern struct smp_ops_t *smp_ops; +#ifdef CONFIG_PPC_PSERIES +void vpa_init (int cpu); +#else +static inline void vpa_init (int cpu) +{ +} +#endif /* CONFIG_PPC_PSERIES */ +#endif /* __ASSEMBLY__ */ #endif /* !(_PPC64_SMP_H) */
Arnd Bergmann
maintainerPATCH 8/11 ppc64: Add driver for BPA interrupt controllers
Add support for the integrated interrupt controller on BPA CPUs. There is one of those for each SMT thread.
The mapping of interrupt numbers to HW interrupt sources is described in arch/ppc64/kernel/bpa_iic.h.
This version hardcodes the 'Spider' chip as the secondary interrupt controller. That is not really generic for the architecture, but at the moment it is the only secondary PIC that exists.
A little more work will be needed on this as soon as we have boards with multiple external interrupt controllers.
--
Kconfig | 15 ++ kernel/Makefile | 8 - kernel/bpa_iic.c | 270 +++++++++++++++++++++++++++++++++++++++++++++++++++ kernel/bpa_iic.h | 62 +++++++++++ kernel/bpa_setup.c | 6 - kernel/pSeries_smp.c | 69 ++++++++++++- kernel/smp.c | 2 kernel/spider-pic.c | 191 ++++++++++++++++++++++++++++++++++++ 8 files changed, 613 insertions(+), 10 deletions(-)
arch/ppc64/Kconfig +15 -0
@@ -106,6 +106,21 @@ bool default y +config XICS + depends on PPC_PSERIES + bool + default y + +config MPIC + depends on PPC_PSERIES || PPC_PMAC || PPC_MAPLE + bool + default y + +config BPA_IIC + depends on PPC_BPA + bool + default y + # VMX is pSeries only for now until somebody writes the iSeries # exception vectors for it config ALTIVEC
arch/ppc64/kernel/Makefile +5 -3
@@ -28,13 +28,13 @@ mf.o HvLpEvent.o iSeries_proc.o iSeries_htab.o \ iSeries_iommu.o -obj-$(CONFIG_PPC_MULTIPLATFORM) += nvram.o i8259.o prom_init.o prom.o mpic.o +obj-$(CONFIG_PPC_MULTIPLATFORM) += nvram.o i8259.o prom_init.o prom.o obj-$(CONFIG_PPC_PSERIES) += pSeries_pci.o pSeries_lpar.o pSeries_hvCall.o \ pSeries_nvram.o rtasd.o ras.o pSeries_reconfig.o \ - xics.o pSeries_setup.o pSeries_iommu.o + pSeries_setup.o pSeries_iommu.o -obj-$(CONFIG_PPC_BPA) += bpa_setup.o bpa_nvram.o +obj-$(CONFIG_PPC_BPA) += bpa_setup.o bpa_nvram.o bpa_iic.o spider-pic.o obj-$(CONFIG_EEH) += eeh.o obj-$(CONFIG_PROC_FS) += proc_ppc64.o
@@ -50,6 +50,8 @@ obj-$(CONFIG_BOOTX_TEXT) += btext.o obj-$(CONFIG_HVCS) += hvcserver.o obj-$(CONFIG_IBMVIO) += vio.o +obj-$(CONFIG_XICS) += xics.o +obj-$(CONFIG_MPIC) += mpic.o obj-$(CONFIG_PPC_PMAC) += pmac_setup.o pmac_feature.o pmac_pci.o \ pmac_time.o pmac_nvram.o pmac_low_i2c.o
arch/ppc64/kernel/bpa_iic.c new file +270 -0
270 lines not on this page · raw message
arch/ppc64/kernel/bpa_iic.h new file +62 -0
62 lines not on this page · raw message
arch/ppc64/kernel/bpa_setup.c +5 -1
@@ -45,6 +45,7 @@#include <asm/cputable.h> #include "pci.h" +#include "bpa_iic.h" #ifdef DEBUG #define DBG(fmt...) udbg_printf(fmt)
@@ -143,6 +144,9 @@static void __init bpa_setup_arch (void ) { + ppc_md.init_IRQ = iic_init_IRQ; + ppc_md.get_irq = iic_get_irq; +#ifdef CONFIG_SMP smp_init_pSeries ();#endif
@@ -158,7 +162,7 @@/* Find and initialize PCI host bridges */ init_pci_config_tokens ();find_and_init_phbs (); - +spider_init_IRQ ();#ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con;#endif
arch/ppc64/kernel/pSeries_smp.c +64 -5
117 lines not on this page · raw message
arch/ppc64/kernel/smp.c +1 -1
@@ -71,7 +71,7 @@int smt_enabled_at_boot =1 ; -#ifdef CONFIG_PPC_MULTIPLATFORM +#if defined(CONFIG_PPC_PSERIES ) || defined(CONFIG_PPC_PMAC ) || defined(CONFIG_PPC_MAPLE )void smp_mpic_message_pass (int target,int msg) {/* make sure we're sending something that translates to an IPI */
arch/ppc64/kernel/spider-pic.c new file +191 -0
191 lines not on this page · raw message
Arnd Bergmann
maintainerPATCH 9/11 ppc64: Add driver for BPA iommu
Implementation of software load support for the BE iommu. This is very different from other iommu code on ppc64, since we only do a static mapping. The mapping is currently hardcoded but should really be read from the firmware, but they don't set up the device nodes yet. There is a single 512MB DMA window for PCI, USB and ethernet at 0x20000000 for our RAM.
The Cell processor can put the I/O page table either in memory like the hashed page table (hardware load) or have the operating system write the entries into memory mapped CPU registers (software load).
I use the software load mechanism because I know that all I/O page table entries for the amount of installed physical memory fit into the IO TLB cache. At the point when we get machines with more than 4GB of installed memory, we can either use hardware I/O page table access like the other platforms do or dynamically update the I/O TLB entries when a page fault occurs in the I/O subsystem.
The software load can then use the macros that I have implemented for the static mapping in order to do the TLB cache updates.
--
Makefile | 3 bpa_iommu.c | 377 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ bpa_iommu.h | 65 ++++++++++ bpa_setup.c | 3 4 files changed, 446 insertions(+), 2 deletions(-)
arch/ppc64/kernel/Makefile +2 -1
@@ -34,7 +34,8 @@ pSeries_nvram.o rtasd.o ras.o pSeries_reconfig.o \ pSeries_setup.o pSeries_iommu.o -obj-$(CONFIG_PPC_BPA) += bpa_setup.o bpa_nvram.o bpa_iic.o spider-pic.o +obj-$(CONFIG_PPC_BPA) += bpa_setup.o bpa_iommu.o bpa_nvram.o \ + bpa_iic.o spider-pic.o obj-$(CONFIG_EEH) += eeh.o obj-$(CONFIG_PROC_FS) += proc_ppc64.o
arch/ppc64/kernel/bpa_iommu.c new file +377 -0
377 lines not on this page · raw message
arch/ppc64/kernel/bpa_iommu.h new file +65 -0
65 lines not on this page · raw message
arch/ppc64/kernel/bpa_setup.c +2 -1
@@ -46,6 +46,7 @@#include "pci.h" #include "bpa_iic.h" +#include "bpa_iommu.h" #ifdef DEBUG #define DBG(fmt...) udbg_printf(fmt)
@@ -179,7 +180,7 @@hpte_init_native (); -pci_direct_iommu_init (); +bpa_init_iommu (); ppc64_interrupt_controller =IC_BPA_IIC ;
Arnd Bergmann
maintainerPATCH 10/11 ppc64: SPU file system
This is work-in-progess version of the SPU file system, which is used to run code on the Synergistic Processing Units of the Cell Processor, a.k.a. Broadband Engine.
The file system provides a name space similar to posix shared memory or message queues. Users that have write permissions on the file system can create directories in the spufs root.
Every directory represents an SPU context, which is currently mapped to a physical SPU, but that is going to change to a virtualization scheme in future updates.
An SPU context directory contains a predefined set of files used for manipulating the state of the logical SPU. Users can change permissions on those files, but not actually add or remove files without removing the complete directory.
The current set of files is:
/mem the contents of the local store memory of the SPU.
This can be accessed like a regular shared memory file and contains both code and data in the address space of the SPU.
The implemented file operations currently are read(), write() and mmap(). We will need our own address space operations as soon as we allow the SPU context to be scheduled away from the physical SPU into page cache.
/run A stub file that lets us do ioctl. The only ioctl
method we need is the spu_run() call. spu_run suspends the current thread from the host CPU and transfers the flow of execution to the SPU.
The ioctl call return to the calling thread when a state is entered that can not be handled by the kernel, e.g. an error in the SPU code or an exit() from it. When a signal is pending for the host CPU thread, the ioctl is interrupted and the SPU stopped in order to call the signal handler.
/mbox The first SPU to CPU communication mailbox. This file
is read-only and can be read in units of 32 bits. The file can only be used in non-blocking mode and it even poll() will not block on it.
When no data is available in the mailbox, read() returns EAGAIN.
/ibox The second SPU to CPU communication mailbox. This file
is similar to the first mailbox file, but can be read in blocking I/O mode, and the poll familiy of system calls can be used to wait for it.
/wbox The CPU to SPU communation mailbox. It is write-only
can can be written in units of 32 bits. If the mailbox is full, write() will block and poll can be used to wait for it becoming empty again.
Other files are planned but currently are not implemented or not functional.
Some of the changes against the previous version of this patch are:
- The file system code is split into separate files
- Mailboxes are actually working with interrupts
- We no longer oops on some bad DMA accesses
- Use of generic simple_attribute code
- Better initialization of SPE registers
--
arch/ppc64/kernel/Makefile | 1 arch/ppc64/kernel/spu_base.c | 678 +++++++++++++++++++++++++++++++++++++++++++ arch/ppc64/mm/hash_utils.c | 1 fs/Kconfig | 10 fs/Makefile | 1 fs/spufs/Makefile | 2 fs/spufs/file.c | 517 ++++++++++++++++++++++++++++++++ fs/spufs/inode.c | 378 +++++++++++++++++++++++ fs/spufs/spufs.h | 53 +++ include/asm-ppc64/spu.h | 468 +++++++++++++++++++++++++++++ mm/memory.c | 1 11 files changed, 2110 insertions(+)
arch/ppc64/kernel/Makefile +1 -0
@@ -53,6 +53,7 @@ obj-$(CONFIG_HVCS) += hvcserver.o obj-$(CONFIG_IBMVIO) += vio.o obj-$(CONFIG_XICS) += xics.o obj-$(CONFIG_MPIC) += mpic.o +obj-$(CONFIG_SPU_FS) += spu_base.o obj-$(CONFIG_PPC_PMAC) += pmac_setup.o pmac_feature.o pmac_pci.o \ pmac_time.o pmac_nvram.o pmac_low_i2c.o
arch/ppc64/kernel/spu_base.c +678 -0
678 lines not on this page · raw message
arch/ppc64/mm/hash_utils.c +1 -0
@@ -354,6 +354,7 @@ int hash_page(unsigned long ea, unsignedreturn ret; } +EXPORT_SYMBOL_GPL (hash_page);void flush_hash_page (unsigned long context,unsigned long ea,pte_t pte,int local)
fs/Kconfig +10 -0
@@ -853,6 +853,16 @@ config HUGETLBFS config HUGETLB_PAGE def_bool HUGETLBFS +config SPU_FS + tristate "SPU file system" + default m + depends on PPC_BPA + help + The SPU file system is used to access Synergistic Processing + Units on machines implementing the Broadband Processor + Architecture. + + config RAMFS bool default y
fs/Makefile +1 -0
@@ -95,3 +95,4 @@ obj-$(CONFIG_BEFS_FS) += befs/ obj-$(CONFIG_HOSTFS) += hostfs/ obj-$(CONFIG_HPPFS) += hppfs/ obj-$(CONFIG_DEBUG_FS) += debugfs/ +obj-$(CONFIG_SPU_FS) += spufs/
fs/spufs/Makefile +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_SPU_FS) += spufs.o +spufs-y += inode.o file.o
fs/spufs/file.c +507 -0
507 lines not on this page · raw message
fs/spufs/inode.c +378 -0
378 lines not on this page · raw message
fs/spufs/spufs.h +51 -0
51 lines not on this page · raw message
include/asm-ppc64/spu.h +468 -0
468 lines not on this page · raw message
mm/memory.c +1 -0
@@ -2201,6 +2201,7 @@ unsigned long vmalloc_to_pfn(void * vmal {return page_to_pfn (vmalloc_to_page (vmalloc_addr)); } +EXPORT_SYMBOL_GPL (handle_mm_fault);EXPORT_SYMBOL (vmalloc_to_pfn);
Re: [PATCH 10/11] ppc64: SPU file system
Quoted 1 line · Arnd Bergmann
+union
MFC_TagSizeClassCmd{
I think great effort has gone in to removing so-called "StudlyCaps" from the ppc64 iSeries code... :)
Also, I didn't see "MFC" defined anywhere... it's sort of a pet peeve, but could you make sure all your acronyms are defined? Most of them are described in spu.h, but a few slipped through I think (like "SMF").
And while a comment at the top of every file is great, ones like this:
Quoted 3 lines
+/*
+ * Low-level SPU handling
+ *
might be more helpful if they defined SPU and further mentioned it's the coprocessor in the Broadband Processor Architecture...
-Hollis
Arnd Bergmann
maintainerRe: [PATCH 10/11] ppc64: SPU file system
Quoted 6 lines · Hollis Blanchard
Quoted 1 line · Arnd Bergmann
+union
MFC_TagSizeClassCmd{I think great effort has gone in to removing so-called "StudlyCaps" from the ppc64 iSeries code... :)
Yes. I've been wanting to fix this one for ages, but it keeps slipping through. The file used to be shared with user space (bad idea) and the CPU simulator and I tried to at least keep the structure definitions compatible initially.
Quoted 3 lines
Also, I didn't see "MFC" defined anywhere... it's sort of a pet peeve, but could you make sure all your acronyms are defined? Most of them are described in
spu.h, but a few slipped through I think (like "SMF").
good point
Quoted 6 lines
And while a comment at the top of every file is great, ones like this:
Quoted 3 lines
+/*
+ * Low-level SPU handling
+ *might be more helpful if they defined SPU and further mentioned it's the coprocessor in the Broadband Processor Architecture...
Yes, all this is the sort of stuff you never notice unless you take while working on a piece of code for months.
Thanks,
Arnd <><
A message that is not in the archive (sent off-list or not yet received): [email protected]
Arnd Bergmann
maintainerPATCH 11/11 spufs: Use a system call instead of ioctl
This patch makes it possible to use a system call instead of an ioctl to run spu code on spufs.
This is mostly for review, to see how ugly it gets. I personally don't like the ioctl implementation very much, but haven't come up with the best solution. The system call doesn't appear to be much better than ioctl here.
One other solution that I haven't implemented yet would be an interface that returns a struct { __u32 npc; __u32 status; }; with the help of a read system call and uses lseek to update the npc value. That would require some knowledge about status code in the kernel if we want to avoid calling lseek every time an SPU does a callback that returns to the owning thread.
--
arch/ppc64/kernel/misc.S | 2 fs/spufs/Makefile | 3 + fs/spufs/file.c | 12 +++++ fs/spufs/spu_run.c | 96 +++++++++++++++++++++++++++++++++++++++++++++ fs/spufs/spufs.h | 2 include/asm-ppc/unistd.h | 3 - include/asm-ppc64/unistd.h | 3 - include/linux/syscalls.h | 3 + kernel/sys_ni.c | 1 9 files changed, 122 insertions(+), 3 deletions(-)
arch/ppc64/kernel/misc.S +2 -0
@@ -956,6 +956,7 @@ _GLOBAL(sys_call_table32) .llong .sys32_request_key .llong .compat_sys_keyctl .llong .compat_sys_waitid + .llong .sys_spu_run .balign 8 _GLOBAL(sys_call_table)
@@ -1232,3 +1233,4 @@ _GLOBAL(sys_call_table) .llong .sys_request_key /* 270 */ .llong .sys_keyctl .llong .sys_waitid + .llong .sys_spu_run
fs/spufs/Makefile +3 -0
@@ -1,2 +1,5 @@ obj-$(CONFIG_SPU_FS) += spufs.o +syscall-$(CONFIG_SPU_FS) += spu_run.o + +obj-y += $(syscall-y) $(syscall-m) spufs-y += inode.o file.o
fs/spufs/file.c +11 -1
@@ -343,6 +343,16 @@ out:return ret; } +static int spufs_run_open (struct inode *inode,struct file *file) +{ +struct spufs_inode_info *i =SPUFS_I (inode); + file->private_data = i->i_ctx; + + i->i_spu_run = spufs_run_spu; + +return nonseekable_open (inode, file); +} +struct spufs_run_arg {u32 npc;/* inout: Next Program Counter */ u32 status;/* out: SPU status */
@@ -371,7 +381,7 @@ static long spufs_run_ioctl(struct file }static struct file_operations spufs_run_fops = { - .open = spufs_pipe_open, + .open = spufs_run_open, .unlocked_ioctl = spufs_run_ioctl, .compat_ioctl = spufs_run_ioctl, };
fs/spufs/spu_run.c +96 -0
96 lines not on this page · raw message
fs/spufs/spufs.h +2 -0
@@ -42,6 +42,8 @@ struct spu_context {struct spufs_inode_info {struct spu_context *i_ctx; +long (*i_spu_run)(struct file *filp,struct spu_context *ctx, +u32 *npc,u32 *result);struct inode vfs_inode; };#define SPUFS_I (inode) container_of(inode, struct spufs_inode_info, vfs_inode)
include/asm-ppc/unistd.h +2 -1
@@ -277,8 +277,9 @@#define __NR_request_key 270#define __NR_keyctl 271#define __NR_waitid 272 +#define __NR_spu_run 273 -#define __NR_syscalls 273 +#define __NR_syscalls 274#define __NR (n) #n
include/asm-ppc64/unistd.h +2 -1
@@ -283,8 +283,9 @@#define __NR_request_key 270#define __NR_keyctl 271#define __NR_waitid 272 +#define __NR_spu_run 273 -#define __NR_syscalls 273 +#define __NR_syscalls 274#ifdef __KERNEL__#define NR_syscalls __NR_syscalls#endif
include/linux/syscalls.h +3 -0
@@ -505,4 +505,7 @@ asmlinkage long sys_request_key(const chasmlinkage long sys_keyctl (int cmd,unsigned long arg2,unsigned long arg3,unsigned long arg4,unsigned long arg5); +asmlinkage long sys_spu_run (int fd,__u32 __user *unpc, +__u32 __user *ustatus); +#endif
kernel/sys_ni.c +1 -0
@@ -85,3 +85,4 @@ cond_syscall(sys_pciconfig_iobase);cond_syscall (sys32_ipc);cond_syscall (sys32_sysctl);cond_syscall (ppc_rtas); +cond_syscall (sys_spu_run);
Re: [PATCH 7/11] ppc64: add BPA platform type
In reply to Arnd Bergmannarch/ppc64/kernel/bpa_setup.c line 95
Quoted 5 lines · Arnd Bergmann
arch/ppc64/kernel/bpa_setup.c +4
-0+static void __init bpa_setup_arch (void ) +{ +// bpa_nvram_init(); +}
I didn't look closely, but I didn't see this called elsewhere... so probably shouldn't be commented out here?
-Hollis
Arnd Bergmann
maintainerPATCH 1/1 ppc64: enable BPA nvram driver
Hollis Blanchard noticed that the initialization of the nvram driver was commented out in [PATCH 7/11] ppc64: add BPA platform type, which probably resulted from my reordering the patches incorrectly.
arch/ppc64/kernel/bpa_setup.c +1 -1
@@ -91,7 +91,7 @@ static void __init bpa_setup_arch(void) conswitchp = &dummy_con;#endif -// bpa_nvram_init(); +bpa_nvram_init (); }/*