first pass at iSeries io rewrite
RFC PATCH 1/1 first pass at iSeries io rewrite
We would like to reduce the special casing of things for legacy iSeries generally. This patch starts the work on iSeries i/o. This changes the i/o so that iSeries will take a fault if any i/o is attempted and the appripriate instructions are emulated. To make this easier, some of the i/o primitives have been modified to use a simple set of load/store instructions with the target or source fixed to r0.
This also (strangely) shrinks a normal pSeries built kernel text by about 130 bytes (but adds 256 bytes to its data).
Before this change, typical outw() took about 1650 - 2740 cycles and afterward about 2190 - 9020 cycles. The variablilty is interesting and is probably not only due to these changes.
This does not yet handle memset_io, memcopy_fromio and memcpy_toio.
Some possibilities:
try to shorten the fault path
doing a fixup on the fist trap
Suggestions? Comments?
Signature · 13 lines
Cheers, Stephen Rothwell [email protected] --- arch/powerpc/mm/fault.c | 8 ++ arch/powerpc/platforms/iseries/pci.c | 139 +++++++++++++++++++----------- include/asm-powerpc/io.h | 81 +++++------------ include/asm-powerpc/iseries/iseries_io.h | 19 ---- include/asm-powerpc/ppc-pci.h | 11 ++ 5 files changed, 128 insertions(+), 130 deletions(-) 51ff17bea4b0434067e0d3b2fa58493227619baa
arch/powerpc/mm/fault.c +7 -1
@@ -39,6 +39,8 @@#include <asm/tlbflush.h> #include <asm/kdebug.h> #include <asm/siginfo.h> +#include <asm/firmware.h> +#include <asm/ppc-pci.h> /* * Check whether the instruction at regs->nip is a store using
@@ -152,8 +154,12 @@ int __kprobes do_page_fault(struct pt_re }/* On a kernel SLB miss we can only check for a valid exception entry */ -if (!user_mode (regs) && (address >=TASK_SIZE )) +if (!user_mode (regs) && (address >=TASK_SIZE )) { +if (firmware_has_feature (FW_FEATURE_ISERIES ) && +iseries_handle_io_fault (regs, address)) +return 0 ;return SIGSEGV ; + }#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE ))if (error_code &DSISR_DABRMATCH ) {
arch/powerpc/platforms/iseries/pci.c +87 -52
206 lines not on this page · raw message
include/asm-powerpc/io.h +23 -58
156 lines not on this page · raw message
include/asm-powerpc/iseries/iseries_io.h +0 -19
@@ -1,8 +1,6 @@#ifndef _ASM_POWERPC_ISERIES_ISERIES_IO_H#define _ASM_POWERPC_ISERIES_ISERIES_IO_H -#include <linux/config.h> -#ifdef CONFIG_PPC_ISERIES #include <linux/types.h> /*
@@ -33,28 +31,11 @@*/ #ifdef CONFIG_PCI -extern u8 iSeries_Read_Byte (const volatile void __iomem * IoAddress); -extern u16 iSeries_Read_Word (const volatile void __iomem * IoAddress); -extern u32 iSeries_Read_Long (const volatile void __iomem * IoAddress); -extern void iSeries_Write_Byte (u8 IoData,volatile void __iomem * IoAddress); -extern void iSeries_Write_Word (u16 IoData,volatile void __iomem * IoAddress); -extern void iSeries_Write_Long (u32 IoData,volatile void __iomem * IoAddress); -extern void iSeries_memset_io (volatile void __iomem *dest,char x,size_t n);extern void iSeries_memcpy_toio (volatile void __iomem *dest,void *source,size_t n);extern void iSeries_memcpy_fromio (void *dest,const volatile void __iomem *source,size_t n); -#else -static inline u8 iSeries_Read_Byte (const volatile void __iomem *IoAddress) -{ -return 0xff ; -} - -static inline void iSeries_Write_Byte (u8 IoData, -volatile void __iomem *IoAddress) -{ -}#endif /* CONFIG_PCI */ #endif /* CONFIG_PPC_ISERIES */
include/asm-powerpc/ppc-pci.h +11 -0
@@ -51,6 +51,17 @@ extern void pSeries_irq_bus_setup(structextern unsigned long pci_probe_only; +/* From platforms/iseries/pci.c */ +#if defined(CONFIG_PPC_ISERIES ) && defined(CONFIG_PCI ) +extern int iseries_handle_io_fault (struct pt_regs *regs,unsigned long address); +#else +static inline int iseries_handle_io_fault (struct pt_regs *regs, +unsigned long address) +{ +return 0 ; +} +#endif +/* ---- EEH internal-use-only related routines ---- */ #ifdef CONFIG_EEH
Signature · 1 line
1.2.4