LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: Generating elf kernel ?
From: tiejun.chen @ 2010-09-15  8:27 UTC (permalink / raw)
  To: Guillaume Dargaud; +Cc: linuxppc-dev
In-Reply-To: <201009151007.50706.dargaud@lpsc.in2p3.fr>

Guillaume Dargaud wrote:
>>> How do I generate an elf file ?
>> vmlinux?
> 
> Thanks.
> 
> The entry point address has change and I can't upload it:
> New (bad) one:
> $ readelf -h vmlinux
> ...
>   Entry point address:               0xc0000000
> 
> Old (good) one:
> $ readelf -h zImage.elf 
> ...
>   Entry point address:               0x400000
> 
> How can I change the entry point address ?

It's impossible to boot PPC vmlinux format directly if you only change the
original entry point address, 0xc0000000.

For kernel the following is as default:
v:0xc0000000 --> p:0x0

Please use simpleImage.<your target dts name>.elf.

Cheers
Tiejun

^ permalink raw reply

* Re: Generating elf kernel ?
From: Guillaume Dargaud @ 2010-09-15  8:07 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <20100914125713.GB5768@radix50.net>

> > How do I generate an elf file ?
> vmlinux?

Thanks.

The entry point address has change and I can't upload it:
New (bad) one:
$ readelf -h vmlinux
...
  Entry point address:               0xc0000000

Old (good) one:
$ readelf -h zImage.elf 
...
  Entry point address:               0x400000

How can I change the entry point address ?
-- 
Guillaume Dargaud
http://www.gdargaud.net/

^ permalink raw reply

* Re: linux-next: build warnings after merge of the final tree (tip treee related)
From: Stephen Rothwell @ 2010-09-15  5:00 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Peter Zijlstra, linux-kernel, linux-next, H. Peter Anvin,
	Ingo Molnar, ppc-dev, Thomas Gleixner
In-Reply-To: <4C8FFE76.8070801@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 829 bytes --]

Hi Yinghai,

On Tue, 14 Sep 2010 16:00:06 -0700 Yinghai Lu <yinghai@kernel.org> wrote:
>
> Also, we may need to remove all extern and __init and __initdata etc in .h files.
> 
> please check
> 
> [PATCH -v3] memblock: Fix section mismatch warning
> 
> Use __init_memblock to replace __init, and remove __init in memblock.h
> 
> -v2: more with memblock_is_meory()
> -v3: remove __init for function declaring in memblock.h. Pointed out by Stephen.
> 
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Yinghai Lu <Yinghai@kernel.org>

This version fixes all the warnings for me.  So if you put the "extern"s
back, you can add:

Tested-by: Stephen Rothwell <sfr@canb.auug.org.au>

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply

* Re: linux-next: build warnings after merge of the final tree (tip treee related)
From: Stephen Rothwell @ 2010-09-15  4:39 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Peter Zijlstra, linux-kernel, linux-next, H. Peter Anvin,
	Ingo Molnar, ppc-dev, Thomas Gleixner
In-Reply-To: <4C90226E.4050306@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 606 bytes --]

Hi Yinghai,

On Tue, 14 Sep 2010 18:33:34 -0700 Yinghai Lu <yinghai@kernel.org> wrote:
>
> On 09/14/2010 05:29 PM, Stephen Rothwell wrote:
> > 
> > Do not remove the "extern" key word.
> 
> why? you got another warning?

It is normal C coding practice to mark declarations in header files with
extern.  It probably doesn't strictly matter for functions, but I have
seen a case where not doing so to a variable lead to multiple definitions
of the variable.  Consistency is also good.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply

* Re: linux-next: build warnings after merge of the final tree (tip treee related)
From: Yinghai Lu @ 2010-09-15  1:33 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Peter Zijlstra, linux-kernel, linux-next, H. Peter Anvin,
	Ingo Molnar, ppc-dev, Thomas Gleixner
In-Reply-To: <20100915102930.5e4d59cb.sfr@canb.auug.org.au>

On 09/14/2010 05:29 PM, Stephen Rothwell wrote:
> Hi Yinghai,
> 
> On Tue, 14 Sep 2010 16:00:06 -0700 Yinghai Lu <yinghai@kernel.org> wrote:
>>
>> Also, we may need to remove all extern and __init and __initdata etc in .h files.
> 
> Do not remove the "extern" key word.
> 

why? you got another warning?

Yinghai

^ permalink raw reply

* Re: linux-next: build warnings after merge of the final tree (tip treee related)
From: Stephen Rothwell @ 2010-09-15  0:29 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Peter Zijlstra, linux-kernel, linux-next, H. Peter Anvin,
	Ingo Molnar, ppc-dev, Thomas Gleixner
In-Reply-To: <4C8FFE76.8070801@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 327 bytes --]

Hi Yinghai,

On Tue, 14 Sep 2010 16:00:06 -0700 Yinghai Lu <yinghai@kernel.org> wrote:
>
> Also, we may need to remove all extern and __init and __initdata etc in .h files.

Do not remove the "extern" key word.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply

* Re: linux-next: build warnings after merge of the final tree (tip treee related)
From: Yinghai Lu @ 2010-09-14 23:00 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Peter Zijlstra, linux-kernel, linux-next, H. Peter Anvin,
	Ingo Molnar, ppc-dev, Thomas Gleixner
In-Reply-To: <20100914145025.977ec2a6.sfr@canb.auug.org.au>

On 09/13/2010 09:50 PM, Stephen Rothwell wrote:
> Hi Yinghai,
> 
> On Mon, 13 Sep 2010 01:24:20 -0700 Yinghai Lu <yinghai@kernel.org> wrote:
>>
>> On 09/12/2010 09:39 PM, Stephen Rothwell wrote:
>>>
>>> Your patch fixes some of the warnings, but still leaves these for a
>>> powerpc allnoconfig build:
>>>
>>> WARNING: mm/built-in.o(.text+0x25d80): Section mismatch in reference from the function memblock_double_array() to the function .init.text:memblock_free()
>>> The function memblock_double_array() references
>>> the function __init memblock_free().
>>> This is often because memblock_double_array lacks a __init 
>>> annotation or the annotation of memblock_free is wrong.
>>>
>>> WARNING: mm/built-in.o(.text+0x26318): Section mismatch in reference from the function memblock_reserve_reserved_regions() to the function .init.text:memblock_reserve()
>>> The function memblock_reserve_reserved_regions() references
>>> the function __init memblock_reserve().
>>> This is often because memblock_reserve_reserved_regions lacks a __init 
>>> annotation or the annotation of memblock_reserve is wrong.
>>>
>>> WARNING: mm/built-in.o(.text+0x26490): Section mismatch in reference from the function memblock_free_reserved_regions() to the function .init.text:memblock_free()
>>> The function memblock_free_reserved_regions() references
>>> the function __init memblock_free().
>>> This is often because memblock_free_reserved_regions lacks a __init 
>>> annotation or the annotation of memblock_free is wrong.
>>
>> v1 already changed them all to __init_memblock, so we should not have those warnings.
> 
> They are still marked as __init in include/linux/memblock.h.  I don't
> think that they need to be marked at all there.

good,

Also, we may need to remove all extern and __init and __initdata etc in .h files.

please check

[PATCH -v3] memblock: Fix section mismatch warning

Use __init_memblock to replace __init, and remove __init in memblock.h

-v2: more with memblock_is_meory()
-v3: remove __init for function declaring in memblock.h. Pointed out by Stephen.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Yinghai Lu <Yinghai@kernel.org>

---
 include/linux/memblock.h |   44 ++++++++++++++++++++++----------------------
 mm/memblock.c            |   14 +++++++-------
 2 files changed, 29 insertions(+), 29 deletions(-)

Index: linux-2.6/mm/memblock.c
===================================================================
--- linux-2.6.orig/mm/memblock.c
+++ linux-2.6/mm/memblock.c
@@ -125,8 +125,8 @@ static phys_addr_t __init memblock_find_
 	return MEMBLOCK_ERROR;
 }
 
-static phys_addr_t __init memblock_find_base(phys_addr_t size, phys_addr_t align,
-					phys_addr_t start, phys_addr_t end)
+static phys_addr_t __init_memblock memblock_find_base(phys_addr_t size,
+			phys_addr_t align, phys_addr_t start, phys_addr_t end)
 {
 	long i;
 
@@ -439,12 +439,12 @@ long __init_memblock memblock_remove(phy
 	return __memblock_remove(&memblock.memory, base, size);
 }
 
-long __init memblock_free(phys_addr_t base, phys_addr_t size)
+long __init_memblock memblock_free(phys_addr_t base, phys_addr_t size)
 {
 	return __memblock_remove(&memblock.reserved, base, size);
 }
 
-long __init memblock_reserve(phys_addr_t base, phys_addr_t size)
+long __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size)
 {
 	struct memblock_type *_rgn = &memblock.reserved;
 
@@ -671,12 +671,12 @@ int __init memblock_is_reserved(phys_add
 	return memblock_search(&memblock.reserved, addr) != -1;
 }
 
-int memblock_is_memory(phys_addr_t addr)
+int __init_memblock memblock_is_memory(phys_addr_t addr)
 {
 	return memblock_search(&memblock.memory, addr) != -1;
 }
 
-int memblock_is_region_memory(phys_addr_t base, phys_addr_t size)
+int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size)
 {
 	int idx = memblock_search(&memblock.reserved, base);
 
@@ -693,7 +693,7 @@ int __init_memblock memblock_is_region_r
 }
 
 
-void __init memblock_set_current_limit(phys_addr_t limit)
+void __init_memblock memblock_set_current_limit(phys_addr_t limit)
 {
 	memblock.current_limit = limit;
 }
Index: linux-2.6/include/linux/memblock.h
===================================================================
--- linux-2.6.orig/include/linux/memblock.h
+++ linux-2.6/include/linux/memblock.h
@@ -51,46 +51,46 @@ u64 memblock_find_in_range(u64 start, u6
 int memblock_free_reserved_regions(void);
 int memblock_reserve_reserved_regions(void);
 
-extern void __init memblock_init(void);
-extern void __init memblock_analyze(void);
-extern long memblock_add(phys_addr_t base, phys_addr_t size);
-extern long memblock_remove(phys_addr_t base, phys_addr_t size);
-extern long __init memblock_free(phys_addr_t base, phys_addr_t size);
-extern long __init memblock_reserve(phys_addr_t base, phys_addr_t size);
+void memblock_init(void);
+void memblock_analyze(void);
+long memblock_add(phys_addr_t base, phys_addr_t size);
+long memblock_remove(phys_addr_t base, phys_addr_t size);
+long memblock_free(phys_addr_t base, phys_addr_t size);
+long memblock_reserve(phys_addr_t base, phys_addr_t size);
 
 /* The numa aware allocator is only available if
  * CONFIG_ARCH_POPULATES_NODE_MAP is set
  */
-extern phys_addr_t __init memblock_alloc_nid(phys_addr_t size, phys_addr_t align,
+phys_addr_t memblock_alloc_nid(phys_addr_t size, phys_addr_t align,
 					int nid);
-extern phys_addr_t __init memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align,
+phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align,
 					    int nid);
 
-extern phys_addr_t __init memblock_alloc(phys_addr_t size, phys_addr_t align);
+phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align);
 
 /* Flags for memblock_alloc_base() amd __memblock_alloc_base() */
 #define MEMBLOCK_ALLOC_ANYWHERE	(~(phys_addr_t)0)
 #define MEMBLOCK_ALLOC_ACCESSIBLE	0
 
-extern phys_addr_t __init memblock_alloc_base(phys_addr_t size,
+phys_addr_t memblock_alloc_base(phys_addr_t size,
 					 phys_addr_t align,
 					 phys_addr_t max_addr);
-extern phys_addr_t __init __memblock_alloc_base(phys_addr_t size,
+phys_addr_t __memblock_alloc_base(phys_addr_t size,
 					   phys_addr_t align,
 					   phys_addr_t max_addr);
-extern phys_addr_t __init memblock_phys_mem_size(void);
-extern phys_addr_t memblock_end_of_DRAM(void);
-extern void __init memblock_enforce_memory_limit(phys_addr_t memory_limit);
-extern int memblock_is_memory(phys_addr_t addr);
-extern int memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
-extern int __init memblock_is_reserved(phys_addr_t addr);
-extern int memblock_is_region_reserved(phys_addr_t base, phys_addr_t size);
+phys_addr_t memblock_phys_mem_size(void);
+phys_addr_t memblock_end_of_DRAM(void);
+void memblock_enforce_memory_limit(phys_addr_t memory_limit);
+int memblock_is_memory(phys_addr_t addr);
+int memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
+int memblock_is_reserved(phys_addr_t addr);
+int memblock_is_region_reserved(phys_addr_t base, phys_addr_t size);
 
-extern void memblock_dump_all(void);
+void memblock_dump_all(void);
 
 /* Provided by the architecture */
-extern phys_addr_t memblock_nid_range(phys_addr_t start, phys_addr_t end, int *nid);
-extern int memblock_memory_can_coalesce(phys_addr_t addr1, phys_addr_t size1,
+phys_addr_t memblock_nid_range(phys_addr_t start, phys_addr_t end, int *nid);
+int memblock_memory_can_coalesce(phys_addr_t addr1, phys_addr_t size1,
 				   phys_addr_t addr2, phys_addr_t size2);
 
 /**
@@ -99,7 +99,7 @@ extern int memblock_memory_can_coalesce(
  *                         accessible during boot
  * @limit: New limit value (physical address)
  */
-extern void memblock_set_current_limit(phys_addr_t limit);
+void memblock_set_current_limit(phys_addr_t limit);
 
 
 /*

^ permalink raw reply

* Re: [PATCH v2 09/10] RapidIO: Add support for IDT CPS Gen2 switches
From: Andrew Morton @ 2010-09-14 22:20 UTC (permalink / raw)
  To: Alexandre Bounine; +Cc: linux-kernel, Thomas Moll, linuxppc-dev
In-Reply-To: <1284476363-1677-10-git-send-email-alexandre.bounine@idt.com>

On Tue, 14 Sep 2010 10:59:22 -0400
Alexandre Bounine <alexandre.bounine@idt.com> wrote:

> +static int
> +idtg2_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
> +		       u16 table, u16 route_destid, u8 route_port)
> +{
> +	/*
> +	 * Select routing table to update
> +	 */
> +	if (table == RIO_GLOBAL_TABLE)
> +		table = 0;
> +	else
> +		table++;
> +
> +	rio_mport_write_config_32(mport, destid, hopcount,
> +				  LOCAL_RTE_CONF_DESTID_SEL, table);
> +
> +	/*
> +	 * Program destination port for the specified destID
> +	 */
> +	rio_mport_write_config_32(mport, destid, hopcount,
> +				  RIO_STD_RTE_CONF_DESTID_SEL_CSR,
> +				  (u32)route_destid);
> +
> +	rio_mport_write_config_32(mport, destid, hopcount,
> +				  RIO_STD_RTE_CONF_PORT_SEL_CSR,
> +				  (u32)route_port);
> +	udelay(10);
> +
> +	return 0;
> +}

The handling of `table' is strange.  One would expect the caller of
this function to provide the correct table index, and for the caller to
increment that index at an appropriate time.

So I take a look around but cannot find any means by which
->add_entry() is called with anything other than RIO_GLOBAL_TABLE. 
Maybe I missed something.  Is this all dead code?

^ permalink raw reply

* Re: [PATCH v2 03/10] RapidIO: Use stored ingress port number instead of register read
From: Andrew Morton @ 2010-09-14 22:12 UTC (permalink / raw)
  To: Alexandre Bounine; +Cc: linux-kernel, Thomas Moll, linuxppc-dev
In-Reply-To: <1284476363-1677-4-git-send-email-alexandre.bounine@idt.com>

On Tue, 14 Sep 2010 10:59:16 -0400
Alexandre Bounine <alexandre.bounine@idt.com> wrote:

> @@ -219,6 +219,7 @@ struct rio_net {
>  /**
>   * struct rio_switch - RIO switch info
>   * @node: Node in global list of switches
> + * @rdev: Associated RIO device structure
>   * @switchid: Switch ID that is unique across a network
>   * @hopcount: Hopcount to this switch
>   * @destid: Associated destid in the path
> @@ -234,6 +235,7 @@ struct rio_net {
>   */
>  struct rio_switch {
>  	struct list_head node;
> +	struct rio_dev *rdev;
>  	u16 switchid;
>  	u16 hopcount;
>  	u16 destid;

What is the locking for rdev?  In other patches I see pointer chases
with no obvious locking against concurrent changes?

^ permalink raw reply

* Re: [PATCH v2 06/10] RapidIO: Modify sysfs initialization for switches
From: Andrew Morton @ 2010-09-14 22:10 UTC (permalink / raw)
  To: Alexandre Bounine; +Cc: linux-kernel, Thomas Moll, linuxppc-dev
In-Reply-To: <1284476363-1677-7-git-send-email-alexandre.bounine@idt.com>

On Tue, 14 Sep 2010 10:59:19 -0400
Alexandre Bounine <alexandre.bounine@idt.com> wrote:

> 1. Change to create attribute "routes" only for switches.

This is also a non-back compatible userspace-visible change?

^ permalink raw reply

* Re: [PATCH v2 01/10] RapidIO: Fix RapidIO sysfs hierarchy
From: Andrew Morton @ 2010-09-14 22:04 UTC (permalink / raw)
  To: Alexandre Bounine; +Cc: linux-kernel, Thomas Moll, linuxppc-dev
In-Reply-To: <1284476363-1677-2-git-send-email-alexandre.bounine@idt.com>

On Tue, 14 Sep 2010 10:59:14 -0400
Alexandre Bounine <alexandre.bounine@idt.com> wrote:

> Make RapidIO devices appear in /sys/devices/rapidio directory instead of top
> of /sys/devices directory.

Non-backward compatible change?  What is the risk of breaking existing
setups with this change?

^ permalink raw reply

* [PATCH 00/15] change default_llseek action
From: Arnd Bergmann @ 2010-09-14 20:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: Stephen Rothwell, Samuel Ortiz, Arnd Bergmann, David Airlie,
	netdev, linux-wireless, dri-devel, Christoph Hellwig,
	linuxppc-dev, Tony Lindgren, Julia Lawall, Al Viro, linux-fsdevel,
	linux-omap, Linus Torvalds, Jeremy Kerr

The llseek file operations traditionally behaves differently
from all other file operations, the default being a generic
implementation of the call instead of a stub returning an
error.

This changes *all* instances of struct file_operations in
the kernel to have a .llseek operation and then changes
the default to no_llseek, which returns -ESPIPE, which
is what we had decided some time ago in a discussion
with Christoph Hellwig.

Where possible, the change is done automatically using
a semantic patch with coccinelle, the few cases where
an automatic conversion is not possible have separate
patches.

Finally, the default_llseek operation gets changed to
no longer require the big kernel lock. Since only
a few users are left using it, it can easily be shown
that none of them actually expects the big kernel lock
here.

I would like to get this into -next now, but will regenerate
the automatic mass-conversion part when this gets ready
for inclusion in 2.6.37, to accomodate any drivers
that got added without a .llseek method.

Stephen, please add
git+ssh://master.kernel.org/pub/scm/linux/kernel/git/arnd/bkl.git llseek

Arnd Bergmann (15):
  drm: use noop_llseek
  net/wireless: use generic_file_llseek in debugfs
  lkdtm: use generic_file_llseek in debugfs
  arm/omap: use generic_file_llseek in iommu_debug
  spufs: use llseek in all file operations
  ibmasmfs: use generic_file_llseek
  raw: use explicit llseek file operations
  irda/irnet: use noop_llseek
  viotape: use noop_llseek
  lirc: make chardev nonseekable
  mac80211: disallow seeks in minstrel debug code
  libfs: use generic_file_llseek for simple_attr
  llseek: automatically add .llseek fop
  vfs: don't use BKL in default_llseek
  vfs: make no_llseek the default

 Documentation/DocBook/drm.tmpl                   |    1 +
 arch/arm/kernel/etm.c                            |    1 +
 arch/arm/mach-msm/last_radio_log.c               |    3 +-
 arch/arm/mach-msm/smd_debug.c                    |    1 +
 arch/arm/plat-mxc/audmux-v2.c                    |    1 +
 arch/arm/plat-omap/iommu-debug.c                 |    2 +
 arch/avr32/boards/mimc200/fram.c                 |    1 +
 arch/blackfin/kernel/kgdb_test.c                 |    1 +
 arch/blackfin/mach-bf561/coreb.c                 |    1 +
 arch/cris/arch-v10/drivers/ds1302.c              |    1 +
 arch/cris/arch-v10/drivers/gpio.c                |    1 +
 arch/cris/arch-v10/drivers/i2c.c                 |    1 +
 arch/cris/arch-v10/drivers/pcf8563.c             |    1 +
 arch/cris/arch-v10/drivers/sync_serial.c         |    3 +-
 arch/cris/arch-v32/drivers/cryptocop.c           |    3 +-
 arch/cris/arch-v32/drivers/i2c.c                 |    1 +
 arch/cris/arch-v32/drivers/mach-a3/gpio.c        |    1 +
 arch/cris/arch-v32/drivers/mach-fs/gpio.c        |    1 +
 arch/cris/arch-v32/drivers/pcf8563.c             |    1 +
 arch/cris/arch-v32/drivers/sync_serial.c         |    3 +-
 arch/cris/kernel/profile.c                       |    1 +
 arch/ia64/kernel/salinfo.c                       |    2 +
 arch/ia64/sn/kernel/sn2/sn_hwperf.c              |    1 +
 arch/m68k/bvme6000/rtc.c                         |    1 +
 arch/m68k/mvme16x/rtc.c                          |    1 +
 arch/mips/kernel/rtlx.c                          |    3 +-
 arch/mips/kernel/vpe.c                           |    3 +-
 arch/mips/sibyte/common/sb_tbprof.c              |    1 +
 arch/powerpc/kernel/lparcfg.c                    |    1 +
 arch/powerpc/kernel/rtas_flash.c                 |    3 ++
 arch/powerpc/kernel/rtasd.c                      |    1 +
 arch/powerpc/platforms/cell/spufs/file.c         |   18 ++++++++++++
 arch/powerpc/platforms/iseries/mf.c              |    1 +
 arch/powerpc/platforms/pseries/reconfig.c        |    3 +-
 arch/powerpc/platforms/pseries/scanlog.c         |    1 +
 arch/s390/crypto/prng.c                          |    1 +
 arch/s390/hypfs/hypfs_diag.c                     |    1 +
 arch/s390/hypfs/hypfs_vm.c                       |    1 +
 arch/s390/hypfs/inode.c                          |    1 +
 arch/s390/kernel/debug.c                         |    1 +
 arch/sh/boards/mach-landisk/gio.c                |    1 +
 arch/sparc/kernel/apc.c                          |    1 +
 arch/sparc/kernel/mdesc.c                        |    1 +
 arch/tile/kernel/hardwall.c                      |    1 +
 arch/um/drivers/harddog_kern.c                   |    1 +
 arch/um/drivers/mconsole_kern.c                  |    1 +
 arch/um/drivers/mmapper_kern.c                   |    1 +
 arch/um/drivers/random.c                         |    1 +
 arch/x86/kernel/apm_32.c                         |    1 +
 arch/x86/kernel/cpu/mcheck/mce-severity.c        |    1 +
 arch/x86/kernel/cpu/mcheck/mce.c                 |    1 +
 arch/x86/kernel/kdebugfs.c                       |    1 +
 arch/x86/kernel/microcode_core.c                 |    1 +
 arch/x86/kernel/tlb_uv.c                         |    1 +
 arch/x86/xen/debugfs.c                           |    1 +
 block/bsg.c                                      |    1 +
 drivers/acpi/ec_sys.c                            |    1 +
 drivers/acpi/event.c                             |    1 +
 drivers/block/DAC960.c                           |    3 +-
 drivers/block/aoe/aoechr.c                       |    1 +
 drivers/block/paride/pg.c                        |    1 +
 drivers/block/paride/pt.c                        |    1 +
 drivers/block/pktcdvd.c                          |    1 +
 drivers/bluetooth/btmrvl_debugfs.c               |   10 ++++++
 drivers/bluetooth/hci_vhci.c                     |    1 +
 drivers/char/apm-emulation.c                     |    1 +
 drivers/char/bfin-otp.c                          |    1 +
 drivers/char/briq_panel.c                        |    1 +
 drivers/char/bsr.c                               |    1 +
 drivers/char/cs5535_gpio.c                       |    3 +-
 drivers/char/ds1302.c                            |    1 +
 drivers/char/ds1620.c                            |    1 +
 drivers/char/dsp56k.c                            |    1 +
 drivers/char/dtlk.c                              |    1 +
 drivers/char/genrtc.c                            |    1 +
 drivers/char/hw_random/core.c                    |    1 +
 drivers/char/ip2/ip2main.c                       |    1 +
 drivers/char/ipmi/ipmi_devintf.c                 |    1 +
 drivers/char/ipmi/ipmi_watchdog.c                |    1 +
 drivers/char/istallion.c                         |    1 +
 drivers/char/lp.c                                |    1 +
 drivers/char/mem.c                               |    3 ++
 drivers/char/misc.c                              |    1 +
 drivers/char/mmtimer.c                           |    1 +
 drivers/char/mspec.c                             |    9 ++++--
 drivers/char/mwave/mwavedd.c                     |    3 +-
 drivers/char/nwbutton.c                          |    1 +
 drivers/char/pc8736x_gpio.c                      |    1 +
 drivers/char/pcmcia/cm4000_cs.c                  |    1 +
 drivers/char/pcmcia/cm4040_cs.c                  |    1 +
 drivers/char/random.c                            |    2 +
 drivers/char/raw.c                               |    2 +
 drivers/char/rio/rio_linux.c                     |    1 +
 drivers/char/scx200_gpio.c                       |    1 +
 drivers/char/snsc.c                              |    1 +
 drivers/char/stallion.c                          |    1 +
 drivers/char/sx.c                                |    1 +
 drivers/char/sysrq.c                             |    1 +
 drivers/char/tb0219.c                            |    1 +
 drivers/char/tlclk.c                             |    1 +
 drivers/char/toshiba.c                           |    1 +
 drivers/char/uv_mmtimer.c                        |    1 +
 drivers/char/viotape.c                           |    1 +
 drivers/char/virtio_console.c                    |    3 ++
 drivers/char/xilinx_hwicap/xilinx_hwicap.c       |    1 +
 drivers/dma/coh901318.c                          |    1 +
 drivers/firewire/nosy.c                          |    1 +
 drivers/gpu/drm/drm_drv.c                        |    3 +-
 drivers/gpu/drm/i810/i810_dma.c                  |    1 +
 drivers/gpu/drm/i810/i810_drv.c                  |    1 +
 drivers/gpu/drm/i830/i830_dma.c                  |    1 +
 drivers/gpu/drm/i830/i830_drv.c                  |    1 +
 drivers/gpu/drm/i915/i915_debugfs.c              |    1 +
 drivers/gpu/drm/i915/i915_drv.c                  |    1 +
 drivers/gpu/drm/mga/mga_drv.c                    |    1 +
 drivers/gpu/drm/nouveau/nouveau_drv.c            |    1 +
 drivers/gpu/drm/r128/r128_drv.c                  |    1 +
 drivers/gpu/drm/radeon/radeon_drv.c              |    1 +
 drivers/gpu/drm/savage/savage_drv.c              |    1 +
 drivers/gpu/drm/sis/sis_drv.c                    |    1 +
 drivers/gpu/drm/tdfx/tdfx_drv.c                  |    1 +
 drivers/gpu/drm/via/via_drv.c                    |    1 +
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c              |    1 +
 drivers/gpu/vga/vgaarb.c                         |    1 +
 drivers/hid/hid-debug.c                          |    1 +
 drivers/hid/hid-roccat.c                         |    1 +
 drivers/hid/hidraw.c                             |    1 +
 drivers/hid/usbhid/hiddev.c                      |    1 +
 drivers/hwmon/asus_atk0110.c                     |    1 +
 drivers/ide/ide-tape.c                           |    1 +
 drivers/idle/i7300_idle.c                        |    1 +
 drivers/infiniband/hw/cxgb4/device.c             |    1 +
 drivers/infiniband/hw/ipath/ipath_diag.c         |    4 ++-
 drivers/infiniband/hw/ipath/ipath_file_ops.c     |    3 +-
 drivers/infiniband/hw/ipath/ipath_fs.c           |    3 ++
 drivers/infiniband/hw/qib/qib_diag.c             |    4 ++-
 drivers/infiniband/hw/qib/qib_file_ops.c         |    3 +-
 drivers/infiniband/hw/qib/qib_fs.c               |    1 +
 drivers/input/evdev.c                            |    3 +-
 drivers/input/input.c                            |    1 +
 drivers/input/joydev.c                           |    1 +
 drivers/input/misc/uinput.c                      |    1 +
 drivers/input/mousedev.c                         |    1 +
 drivers/input/serio/serio_raw.c                  |    1 +
 drivers/isdn/mISDN/timerdev.c                    |    1 +
 drivers/lguest/lguest_user.c                     |    1 +
 drivers/macintosh/ans-lcd.c                      |    1 +
 drivers/macintosh/via-pmu.c                      |    1 +
 drivers/md/dm-ioctl.c                            |    1 +
 drivers/media/IR/imon.c                          |    6 ++-
 drivers/media/IR/ir-lirc-codec.c                 |    1 +
 drivers/media/IR/lirc_dev.c                      |    3 ++
 drivers/media/dvb/bt8xx/dst_ca.c                 |    3 +-
 drivers/media/dvb/dvb-core/dmxdev.c              |    2 +
 drivers/media/dvb/dvb-core/dvb_ca_en50221.c      |    1 +
 drivers/media/dvb/dvb-core/dvb_frontend.c        |    3 +-
 drivers/media/dvb/dvb-core/dvb_net.c             |    1 +
 drivers/media/dvb/dvb-core/dvbdev.c              |    1 +
 drivers/media/dvb/firewire/firedtv-ci.c          |    1 +
 drivers/media/dvb/ttpci/av7110.c                 |    1 +
 drivers/media/dvb/ttpci/av7110_av.c              |    2 +
 drivers/media/dvb/ttpci/av7110_ca.c              |    1 +
 drivers/media/dvb/ttpci/av7110_ir.c              |    1 +
 drivers/mfd/ab3100-core.c                        |    1 +
 drivers/misc/hpilo.c                             |    1 +
 drivers/misc/ibmasm/ibmasmfs.c                   |    4 ++
 drivers/misc/iwmc3200top/debugfs.c               |    3 ++
 drivers/misc/lkdtm.c                             |    9 ++++++
 drivers/misc/phantom.c                           |    1 +
 drivers/misc/sgi-gru/grufile.c                   |    1 +
 drivers/mmc/core/debugfs.c                       |    1 +
 drivers/mtd/ubi/cdev.c                           |    1 +
 drivers/net/caif/caif_spi.c                      |    6 ++-
 drivers/net/cxgb4/cxgb4_main.c                   |    1 +
 drivers/net/ppp_generic.c                        |    3 +-
 drivers/net/wimax/i2400m/debugfs.c               |    2 +
 drivers/net/wireless/airo.c                      |   24 ++++++++++-----
 drivers/net/wireless/ath/ath5k/debug.c           |    7 ++++
 drivers/net/wireless/ath/ath9k/debug.c           |   33 ++++++++++++++-------
 drivers/net/wireless/ath/ath9k/htc_drv_main.c    |    9 ++++--
 drivers/net/wireless/b43/debugfs.c               |    1 +
 drivers/net/wireless/b43legacy/debugfs.c         |    1 +
 drivers/net/wireless/iwlwifi/iwl-3945-rs.c       |    1 +
 drivers/net/wireless/iwlwifi/iwl-agn-rs.c        |    3 ++
 drivers/net/wireless/iwlwifi/iwl-debugfs.c       |    3 ++
 drivers/net/wireless/iwmc3200wifi/debugfs.c      |    4 ++
 drivers/net/wireless/iwmc3200wifi/sdio.c         |    1 +
 drivers/net/wireless/libertas/debugfs.c          |    2 +
 drivers/net/wireless/ray_cs.c                    |    2 +
 drivers/net/wireless/rt2x00/rt2x00debug.c        |    5 +++
 drivers/net/wireless/wl12xx/wl1251_debugfs.c     |    4 ++
 drivers/net/wireless/wl12xx/wl1271_debugfs.c     |    6 +++-
 drivers/oprofile/oprofile_files.c                |    8 ++++-
 drivers/oprofile/oprofilefs.c                    |    3 ++
 drivers/pci/pcie/aer/aer_inject.c                |    1 +
 drivers/platform/x86/sony-laptop.c               |    1 +
 drivers/rtc/rtc-m41t80.c                         |    1 +
 drivers/s390/block/dasd_eer.c                    |    1 +
 drivers/s390/char/fs3270.c                       |    1 +
 drivers/s390/char/monreader.c                    |    1 +
 drivers/s390/char/monwriter.c                    |    1 +
 drivers/s390/char/tape_char.c                    |    1 +
 drivers/s390/char/vmcp.c                         |    1 +
 drivers/s390/char/vmlogrdr.c                     |    1 +
 drivers/s390/char/vmwatchdog.c                   |    1 +
 drivers/s390/char/zcore.c                        |    2 +
 drivers/s390/cio/chsc_sch.c                      |    1 +
 drivers/s390/cio/css.c                           |    1 +
 drivers/s390/crypto/zcrypt_api.c                 |    3 +-
 drivers/s390/scsi/zfcp_cfdc.c                    |    3 +-
 drivers/sbus/char/display7seg.c                  |    1 +
 drivers/sbus/char/envctrl.c                      |    1 +
 drivers/scsi/3w-9xxx.c                           |    3 +-
 drivers/scsi/3w-sas.c                            |    3 +-
 drivers/scsi/3w-xxxx.c                           |    3 +-
 drivers/scsi/aacraid/linit.c                     |    1 +
 drivers/scsi/ch.c                                |    1 +
 drivers/scsi/dpt_i2o.c                           |    1 +
 drivers/scsi/gdth.c                              |    1 +
 drivers/scsi/megaraid.c                          |    1 +
 drivers/scsi/megaraid/megaraid_mm.c              |    1 +
 drivers/scsi/megaraid/megaraid_sas.c             |    1 +
 drivers/scsi/mpt2sas/mpt2sas_ctl.c               |    1 +
 drivers/scsi/osd/osd_uld.c                       |    1 +
 drivers/scsi/pmcraid.c                           |    1 +
 drivers/scsi/qla2xxx/qla_os.c                    |    1 +
 drivers/scsi/scsi_tgt_if.c                       |    1 +
 drivers/scsi/sg.c                                |    1 +
 drivers/serial/mfd.c                             |    2 +
 drivers/spi/dw_spi.c                             |    1 +
 drivers/spi/spidev.c                             |    1 +
 drivers/staging/batman-adv/bat_debugfs.c         |    1 +
 drivers/staging/batman-adv/icmp_socket.c         |    1 +
 drivers/staging/comedi/comedi_fops.c             |    1 +
 drivers/staging/crystalhd/crystalhd_lnx.c        |    1 +
 drivers/staging/dream/camera/msm_camera.c        |    3 ++
 drivers/staging/dream/pmem.c                     |    2 +
 drivers/staging/dream/qdsp5/adsp_driver.c        |    1 +
 drivers/staging/dream/qdsp5/audio_aac.c          |    1 +
 drivers/staging/dream/qdsp5/audio_amrnb.c        |    1 +
 drivers/staging/dream/qdsp5/audio_evrc.c         |    1 +
 drivers/staging/dream/qdsp5/audio_in.c           |    2 +
 drivers/staging/dream/qdsp5/audio_mp3.c          |    1 +
 drivers/staging/dream/qdsp5/audio_out.c          |    2 +
 drivers/staging/dream/qdsp5/audio_qcelp.c        |    1 +
 drivers/staging/dream/qdsp5/evlog.h              |    1 +
 drivers/staging/dream/qdsp5/snd.c                |    1 +
 drivers/staging/frontier/alphatrack.c            |    1 +
 drivers/staging/frontier/tranzport.c             |    1 +
 drivers/staging/iio/industrialio-core.c          |    1 +
 drivers/staging/iio/industrialio-ring.c          |    1 +
 drivers/staging/lirc/lirc_imon.c                 |    3 +-
 drivers/staging/lirc/lirc_it87.c                 |    1 +
 drivers/staging/lirc/lirc_sasem.c                |    1 +
 drivers/staging/lirc/lirc_serial.c               |    1 +
 drivers/staging/lirc/lirc_sir.c                  |    1 +
 drivers/staging/memrar/memrar_handler.c          |    1 +
 drivers/staging/panel/panel.c                    |    1 +
 drivers/staging/tidspbridge/rmgr/drv_interface.c |    1 +
 drivers/telephony/ixj.c                          |    3 +-
 drivers/telephony/phonedev.c                     |    1 +
 drivers/uio/uio.c                                |    1 +
 drivers/usb/class/cdc-wdm.c                      |    3 +-
 drivers/usb/class/usblp.c                        |    1 +
 drivers/usb/class/usbtmc.c                       |    1 +
 drivers/usb/core/file.c                          |    1 +
 drivers/usb/gadget/f_hid.c                       |    1 +
 drivers/usb/gadget/printer.c                     |    3 +-
 drivers/usb/host/ehci-dbg.c                      |    4 ++
 drivers/usb/host/ohci-dbg.c                      |    3 ++
 drivers/usb/image/mdc800.c                       |    1 +
 drivers/usb/misc/adutux.c                        |    1 +
 drivers/usb/misc/idmouse.c                       |    1 +
 drivers/usb/misc/iowarrior.c                     |    1 +
 drivers/usb/misc/ldusb.c                         |    1 +
 drivers/usb/misc/rio500.c                        |    1 +
 drivers/usb/misc/usblcd.c                        |    1 +
 drivers/usb/usb-skeleton.c                       |    1 +
 drivers/vhost/net.c                              |    1 +
 drivers/video/fbmem.c                            |    1 +
 drivers/video/mbx/mbxdebugfs.c                   |    6 ++++
 drivers/watchdog/ar7_wdt.c                       |    1 +
 drivers/watchdog/cpwd.c                          |    1 +
 drivers/watchdog/ep93xx_wdt.c                    |    1 +
 drivers/watchdog/omap_wdt.c                      |    1 +
 drivers/xen/evtchn.c                             |    1 +
 drivers/xen/xenfs/super.c                        |    1 +
 drivers/xen/xenfs/xenbus.c                       |    1 +
 fs/afs/mntpt.c                                   |    1 +
 fs/autofs4/dev-ioctl.c                           |    1 +
 fs/binfmt_misc.c                                 |    3 ++
 fs/btrfs/super.c                                 |    1 +
 fs/cachefiles/daemon.c                           |    1 +
 fs/char_dev.c                                    |    1 +
 fs/coda/pioctl.c                                 |    1 +
 fs/coda/psdev.c                                  |    1 +
 fs/debugfs/file.c                                |    3 ++
 fs/dlm/debug_fs.c                                |    3 +-
 fs/dlm/plock.c                                   |    3 +-
 fs/dlm/user.c                                    |    3 ++
 fs/ecryptfs/file.c                               |    1 +
 fs/ecryptfs/miscdev.c                            |    1 +
 fs/eventfd.c                                     |    1 +
 fs/eventpoll.c                                   |    3 +-
 fs/fifo.c                                        |    1 +
 fs/fuse/control.c                                |    4 ++
 fs/fuse/cuse.c                                   |    1 +
 fs/gfs2/file.c                                   |    2 +
 fs/hppfs/hppfs.c                                 |    1 +
 fs/hugetlbfs/inode.c                             |    1 +
 fs/logfs/dir.c                                   |    1 +
 fs/nfsd/nfsctl.c                                 |    1 +
 fs/no-block.c                                    |    1 +
 fs/notify/fanotify/fanotify_user.c               |    1 +
 fs/notify/inotify/inotify_user.c                 |    1 +
 fs/ntfs/file.c                                   |    3 +-
 fs/ocfs2/dlmfs/dlmfs.c                           |    1 +
 fs/ocfs2/stack_user.c                            |    1 +
 fs/proc/base.c                                   |    8 +++++
 fs/proc/proc_sysctl.c                            |    1 +
 fs/proc/root.c                                   |    1 +
 fs/proc/task_mmu.c                               |    1 +
 fs/read_write.c                                  |    5 +--
 fs/romfs/super.c                                 |    1 +
 fs/signalfd.c                                    |    1 +
 fs/squashfs/dir.c                                |    3 +-
 fs/timerfd.c                                     |    1 +
 fs/ubifs/debug.c                                 |    1 +
 include/linux/fs.h                               |    1 +
 ipc/mqueue.c                                     |    1 +
 ipc/shm.c                                        |    2 +
 kernel/configs.c                                 |    1 +
 kernel/gcov/fs.c                                 |    1 +
 kernel/kprobes.c                                 |    1 +
 kernel/pm_qos_params.c                           |    1 +
 kernel/profile.c                                 |    1 +
 kernel/trace/blktrace.c                          |    2 +
 kernel/trace/ftrace.c                            |    2 +
 kernel/trace/ring_buffer.c                       |    1 +
 kernel/trace/trace_events.c                      |    6 ++++
 kernel/trace/trace_stack.c                       |    1 +
 lib/dma-debug.c                                  |    1 +
 net/atm/proc.c                                   |    1 +
 net/dccp/probe.c                                 |    1 +
 net/ipv4/tcp_probe.c                             |    1 +
 net/irda/irnet/irnet_ppp.h                       |    3 +-
 net/mac80211/debugfs.c                           |   21 ++++++++++----
 net/mac80211/debugfs_key.c                       |    2 +
 net/mac80211/debugfs_netdev.c                    |    1 +
 net/mac80211/debugfs_sta.c                       |    2 +
 net/mac80211/rate.c                              |    1 +
 net/mac80211/rc80211_minstrel_debugfs.c          |    1 +
 net/mac80211/rc80211_minstrel_ht_debugfs.c       |    3 +-
 net/mac80211/rc80211_pid_debugfs.c               |    1 +
 net/netfilter/xt_recent.c                        |    1 +
 net/nonet.c                                      |    1 +
 net/rfkill/core.c                                |    1 +
 net/sctp/probe.c                                 |    1 +
 net/socket.c                                     |    1 +
 net/sunrpc/cache.c                               |    2 +
 net/wireless/debugfs.c                           |    2 +
 samples/kfifo/bytestream-example.c               |    1 +
 samples/kfifo/inttype-example.c                  |    1 +
 samples/kfifo/record-example.c                   |    1 +
 samples/tracepoints/tracepoint-sample.c          |    1 +
 security/apparmor/apparmorfs.c                   |    9 ++++--
 security/inode.c                                 |    1 +
 security/smack/smackfs.c                         |    5 +++
 sound/core/seq/oss/seq_oss.c                     |    1 +
 sound/core/sound.c                               |    3 +-
 sound/oss/msnd_pinnacle.c                        |    1 +
 sound/oss/sh_dac_audio.c                         |    1 +
 sound/soc/soc-core.c                             |    1 +
 sound/soc/soc-dapm.c                             |    1 +
 sound/sound_core.c                               |    1 +
 virt/kvm/kvm_main.c                              |    3 ++
 376 files changed, 628 insertions(+), 79 deletions(-)

Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Cc: Jeremy Kerr <jk@ozlabs.org>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Julia Lawall <julia@diku.dk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-omap@vger.kernel.org
Cc: linuxppc-dev@ozlabs.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: Samuel Ortiz <samuel@sortiz.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Tony Lindgren <tony@atomide.com>

^ permalink raw reply

* [PATCH 05/15] spufs: use llseek in all file operations
From: Arnd Bergmann @ 2010-09-14 20:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: linuxppc-dev, Jeremy Kerr, Arnd Bergmann
In-Reply-To: <1284495763-7506-1-git-send-email-arnd@arndb.de>

The default for llseek is changing, so we need
explicit operations everywhere.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Jeremy Kerr <jk@ozlabs.org>
Cc: linuxppc-dev@ozlabs.org
---
 arch/powerpc/platforms/cell/spufs/file.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 1a40da9..02f7b11 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -154,6 +154,7 @@ static const struct file_operations __fops = {				\
 	.release = spufs_attr_release,					\
 	.read	 = spufs_attr_read,					\
 	.write	 = spufs_attr_write,					\
+	.llseek  = generic_file_llseek,					\
 };
 
 
@@ -521,6 +522,7 @@ static const struct file_operations spufs_cntl_fops = {
 	.release = spufs_cntl_release,
 	.read = simple_attr_read,
 	.write = simple_attr_write,
+	.llseek	= generic_file_llseek,
 	.mmap = spufs_cntl_mmap,
 };
 
@@ -714,6 +716,7 @@ static ssize_t spufs_mbox_read(struct file *file, char __user *buf,
 static const struct file_operations spufs_mbox_fops = {
 	.open	= spufs_pipe_open,
 	.read	= spufs_mbox_read,
+	.llseek	= no_llseek,
 };
 
 static ssize_t spufs_mbox_stat_read(struct file *file, char __user *buf,
@@ -743,6 +746,7 @@ static ssize_t spufs_mbox_stat_read(struct file *file, char __user *buf,
 static const struct file_operations spufs_mbox_stat_fops = {
 	.open	= spufs_pipe_open,
 	.read	= spufs_mbox_stat_read,
+	.llseek = no_llseek,
 };
 
 /* low-level ibox access function */
@@ -863,6 +867,7 @@ static const struct file_operations spufs_ibox_fops = {
 	.read	= spufs_ibox_read,
 	.poll	= spufs_ibox_poll,
 	.fasync	= spufs_ibox_fasync,
+	.llseek = no_llseek,
 };
 
 static ssize_t spufs_ibox_stat_read(struct file *file, char __user *buf,
@@ -890,6 +895,7 @@ static ssize_t spufs_ibox_stat_read(struct file *file, char __user *buf,
 static const struct file_operations spufs_ibox_stat_fops = {
 	.open	= spufs_pipe_open,
 	.read	= spufs_ibox_stat_read,
+	.llseek = no_llseek,
 };
 
 /* low-level mailbox write */
@@ -1011,6 +1017,7 @@ static const struct file_operations spufs_wbox_fops = {
 	.write	= spufs_wbox_write,
 	.poll	= spufs_wbox_poll,
 	.fasync	= spufs_wbox_fasync,
+	.llseek = no_llseek,
 };
 
 static ssize_t spufs_wbox_stat_read(struct file *file, char __user *buf,
@@ -1038,6 +1045,7 @@ static ssize_t spufs_wbox_stat_read(struct file *file, char __user *buf,
 static const struct file_operations spufs_wbox_stat_fops = {
 	.open	= spufs_pipe_open,
 	.read	= spufs_wbox_stat_read,
+	.llseek = no_llseek,
 };
 
 static int spufs_signal1_open(struct inode *inode, struct file *file)
@@ -1166,6 +1174,7 @@ static const struct file_operations spufs_signal1_fops = {
 	.read = spufs_signal1_read,
 	.write = spufs_signal1_write,
 	.mmap = spufs_signal1_mmap,
+	.llseek = no_llseek,
 };
 
 static const struct file_operations spufs_signal1_nosched_fops = {
@@ -1173,6 +1182,7 @@ static const struct file_operations spufs_signal1_nosched_fops = {
 	.release = spufs_signal1_release,
 	.write = spufs_signal1_write,
 	.mmap = spufs_signal1_mmap,
+	.llseek = no_llseek,
 };
 
 static int spufs_signal2_open(struct inode *inode, struct file *file)
@@ -1305,6 +1315,7 @@ static const struct file_operations spufs_signal2_fops = {
 	.read = spufs_signal2_read,
 	.write = spufs_signal2_write,
 	.mmap = spufs_signal2_mmap,
+	.llseek = no_llseek,
 };
 
 static const struct file_operations spufs_signal2_nosched_fops = {
@@ -1312,6 +1323,7 @@ static const struct file_operations spufs_signal2_nosched_fops = {
 	.release = spufs_signal2_release,
 	.write = spufs_signal2_write,
 	.mmap = spufs_signal2_mmap,
+	.llseek = no_llseek,
 };
 
 /*
@@ -1451,6 +1463,7 @@ static const struct file_operations spufs_mss_fops = {
 	.open	 = spufs_mss_open,
 	.release = spufs_mss_release,
 	.mmap	 = spufs_mss_mmap,
+	.llseek  = no_llseek,
 };
 
 static int
@@ -1508,6 +1521,7 @@ static const struct file_operations spufs_psmap_fops = {
 	.open	 = spufs_psmap_open,
 	.release = spufs_psmap_release,
 	.mmap	 = spufs_psmap_mmap,
+	.llseek  = no_llseek,
 };
 
 
@@ -1871,6 +1885,7 @@ static const struct file_operations spufs_mfc_fops = {
 	.fsync	 = spufs_mfc_fsync,
 	.fasync	 = spufs_mfc_fasync,
 	.mmap	 = spufs_mfc_mmap,
+	.llseek  = no_llseek,
 };
 
 static int spufs_npc_set(void *data, u64 val)
@@ -2246,6 +2261,7 @@ static ssize_t spufs_dma_info_read(struct file *file, char __user *buf,
 static const struct file_operations spufs_dma_info_fops = {
 	.open = spufs_info_open,
 	.read = spufs_dma_info_read,
+	.llseek = no_llseek,
 };
 
 static ssize_t __spufs_proxydma_info_read(struct spu_context *ctx,
@@ -2299,6 +2315,7 @@ static ssize_t spufs_proxydma_info_read(struct file *file, char __user *buf,
 static const struct file_operations spufs_proxydma_info_fops = {
 	.open = spufs_info_open,
 	.read = spufs_proxydma_info_read,
+	.llseek = no_llseek,
 };
 
 static int spufs_show_tid(struct seq_file *s, void *private)
@@ -2585,6 +2602,7 @@ static const struct file_operations spufs_switch_log_fops = {
 	.read		= spufs_switch_log_read,
 	.poll		= spufs_switch_log_poll,
 	.release	= spufs_switch_log_release,
+	.llseek		= no_llseek,
 };
 
 /**
-- 
1.7.1

^ permalink raw reply related

* Re: [PATCH] hvc_console: fix dropping of characters when output byte channel is full
From: Scott Wood @ 2010-09-14 20:05 UTC (permalink / raw)
  To: Alan Cox
  Cc: kumar.gala, linux-kernel, linuxppc-dev, amit.shah, Andrew Morton,
	Timur Tabi
In-Reply-To: <20100914204410.71942cdc@lxorguk.ukuu.org.uk>

On Tue, 14 Sep 2010 20:44:10 +0100
Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:

> > Yes, hvc_push() reschedules.  It doesn't sit in a tight loop burning
> > electrons!
> > 
> > Can we do something safer&smarter here?
> 
> 
> Its a printk handler - better to lose the bytes than hang the box. I
> think the current code is probably right.

Losing the bytes is unacceptable.  Even if an hvc backend erroneously
returns zero on a permanent error, the timeout should prevent hanging
the box for too long.

Though I suspect the right answer for us may be "don't use the hvc
layer".

-Scott

^ permalink raw reply

* [PATCH 0/7] BKL mass-conversion to mutex
From: Arnd Bergmann @ 2010-09-14 19:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: Corey Minyard, Stephen Rothwell, Arnd Bergmann, linux-scsi,
	Takashi Iwai, linuxppc-dev, James E.J. Bottomley, linux-mtd,
	Jens Axboe, Ingo Molnar, Linus Torvalds, openipmi-developer,
	David Woodhouse

This is one out of five topic branches in my BKL removal
series that I would like to get into linux-next as
a preparation for merging into 2.6.37.

Based on a discussion with Ingo Molnar, this series converts
many drivers that only have a single file using the BKL
to use a private mutex instead.  All these patches except for
the last two have been reviewed before.

This is safe because they all use the BKL only to protect
their basic file operations and they take it as the
outermost lock. Consequently, we do not run into lock-order
problem or recursion.

Using a script that works for all these drivers gives
me reasonable confidence in the approach, since it avoids
typos and other common mistakes from sloppiness.

Stephen, please add
git+ssh://master.kernel.org/pub/scm/linux/kernel/git/arnd/bkl.git trivial

Arnd Bergmann (7):
  scsi: autoconvert trivial BKL users to private mutex
  mtd: autoconvert trivial BKL users to private mutex
  mac: autoconvert trivial BKL users to private mutex
  ipmi: autoconvert trivial BKL users to private mutex
  drivers: autoconvert trivial BKL users to private mutex
  sound: autoconvert trivial BKL users to private mutex
  block: autoconvert trivial BKL users to private mutex

 block/bsg.c                                |    3 --
 drivers/block/DAC960.c                     |   11 ++++---
 drivers/block/amiflop.c                    |   19 ++++++------
 drivers/block/aoe/aoeblk.c                 |    9 +++--
 drivers/block/aoe/aoechr.c                 |    9 +++--
 drivers/block/ataflop.c                    |   15 +++++----
 drivers/block/brd.c                        |    7 ++--
 drivers/block/cciss.c                      |   14 ++++----
 drivers/block/cpqarray.c                   |   15 +++++----
 drivers/block/drbd/drbd_main.c             |   11 ++++---
 drivers/block/floppy.c                     |   16 +++++-----
 drivers/block/loop.c                       |   11 ++++---
 drivers/block/nbd.c                        |    7 ++--
 drivers/block/paride/pcd.c                 |   15 +++++----
 drivers/block/paride/pd.c                  |   15 +++++----
 drivers/block/paride/pf.c                  |   17 ++++++-----
 drivers/block/paride/pg.c                  |    7 ++--
 drivers/block/paride/pt.c                  |   19 ++++++------
 drivers/block/pktcdvd.c                    |   16 +++++-----
 drivers/block/swim.c                       |   15 +++++----
 drivers/block/swim3.c                      |   15 +++++----
 drivers/block/ub.c                         |   15 +++++----
 drivers/block/viodasd.c                    |   11 ++++---
 drivers/block/virtio_blk.c                 |    7 ++--
 drivers/block/xd.c                         |    7 ++--
 drivers/block/xen-blkfront.c               |   11 ++++---
 drivers/block/xsysace.c                    |   11 ++++---
 drivers/block/z2ram.c                      |   15 +++++----
 drivers/cdrom/gdrom.c                      |   15 +++++----
 drivers/cdrom/viocd.c                      |   15 +++++----
 drivers/char/apm-emulation.c               |   11 ++++---
 drivers/char/applicom.c                    |    9 +++--
 drivers/char/ds1302.c                      |   15 +++++----
 drivers/char/ds1620.c                      |    8 ++--
 drivers/char/dsp56k.c                      |   27 +++++++++--------
 drivers/char/dtlk.c                        |    8 ++--
 drivers/char/generic_nvram.c               |    7 ++--
 drivers/char/genrtc.c                      |   13 ++++----
 drivers/char/i8k.c                         |    7 ++--
 drivers/char/ip2/ip2main.c                 |    8 ++--
 drivers/char/ipmi/ipmi_devintf.c           |   14 ++++----
 drivers/char/ipmi/ipmi_watchdog.c          |    8 ++--
 drivers/char/lp.c                          |   15 +++++----
 drivers/char/mbcs.c                        |    8 ++--
 drivers/char/mmtimer.c                     |    7 ++--
 drivers/char/mwave/mwavedd.c               |   44 ++++++++++++++--------------
 drivers/char/nvram.c                       |   11 ++++---
 drivers/char/nwflash.c                     |   12 ++++----
 drivers/char/pcmcia/cm4000_cs.c            |   11 ++++---
 drivers/char/pcmcia/cm4040_cs.c            |    7 ++--
 drivers/char/ppdev.c                       |    8 ++--
 drivers/char/rio/rio_linux.c               |    7 ++--
 drivers/char/snsc.c                        |    9 +++--
 drivers/char/toshiba.c                     |    9 +++--
 drivers/char/viotape.c                     |   11 ++++---
 drivers/char/xilinx_hwicap/xilinx_hwicap.c |    6 ++--
 drivers/hwmon/fschmd.c                     |    6 ++--
 drivers/hwmon/w83793.c                     |    6 ++--
 drivers/ide/ide-cd.c                       |   14 ++++----
 drivers/ide/ide-disk_ioctl.c               |    7 ++--
 drivers/ide/ide-floppy_ioctl.c             |    7 ++--
 drivers/ide/ide-gd.c                       |   10 +++---
 drivers/ide/ide-tape.c                     |   19 ++++++------
 drivers/input/misc/hp_sdc_rtc.c            |    7 ++--
 drivers/macintosh/adb.c                    |   10 +++---
 drivers/macintosh/smu.c                    |    6 ++--
 drivers/macintosh/via-pmu.c                |   11 ++++---
 drivers/md/dm.c                            |   10 +++---
 drivers/md/md.c                            |   13 ++++----
 drivers/memstick/core/mspro_block.c        |   11 ++++---
 drivers/message/fusion/mptctl.c            |   15 +++++----
 drivers/message/i2o/i2o_block.c            |   15 +++++----
 drivers/message/i2o/i2o_config.c           |   23 +++++++-------
 drivers/misc/phantom.c                     |   11 ++++---
 drivers/mmc/card/block.c                   |   10 +++---
 drivers/mtd/mtd_blkdevs.c                  |   14 ++++----
 drivers/mtd/mtdchar.c                      |   15 +++++----
 drivers/pci/hotplug/cpqphp_sysfs.c         |   13 ++++----
 drivers/rtc/rtc-m41t80.c                   |   13 ++++----
 drivers/s390/char/tape_block.c             |   13 ++++----
 drivers/sbus/char/jsflash.c                |   24 ++++++++-------
 drivers/scsi/3w-9xxx.c                     |    7 ++--
 drivers/scsi/3w-sas.c                      |    7 ++--
 drivers/scsi/3w-xxxx.c                     |    9 ++---
 drivers/scsi/aacraid/linit.c               |   15 +++++----
 drivers/scsi/ch.c                          |    8 ++--
 drivers/scsi/dpt_i2o.c                     |   18 ++++++------
 drivers/scsi/gdth.c                        |   11 ++++---
 drivers/scsi/megaraid.c                    |    8 ++--
 drivers/scsi/megaraid/megaraid_mm.c        |    8 ++--
 drivers/scsi/megaraid/megaraid_sas.c       |    2 -
 drivers/scsi/mpt2sas/mpt2sas_ctl.c         |   11 ++++---
 drivers/scsi/osst.c                        |   15 +++++----
 drivers/scsi/scsi_tgt_if.c                 |    2 -
 drivers/scsi/sg.c                          |   11 ++++---
 drivers/scsi/sr.c                          |   14 ++++----
 drivers/scsi/st.c                          |   12 ++++----
 drivers/staging/hv/blkvsc_drv.c            |   11 ++++---
 drivers/staging/spectra/ffsport.c          |    7 ++--
 drivers/telephony/ixj.c                    |    7 ++--
 drivers/watchdog/cpwd.c                    |   15 +++++----
 fs/hfsplus/ioctl.c                         |   11 ++++---
 sound/oss/au1550_ac97.c                    |   30 +++++++++---------
 sound/oss/dmasound/dmasound_core.c         |   41 +++++++++++++------------
 sound/oss/msnd_pinnacle.c                  |   15 +++++----
 sound/oss/sh_dac_audio.c                   |   13 ++++----
 sound/oss/soundcard.c                      |   41 +++++++++++++------------
 sound/oss/swarm_cs4297a.c                  |   20 ++++++------
 sound/oss/vwsnd.c                          |   30 +++++++++---------
 109 files changed, 718 insertions(+), 657 deletions(-)

Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: linux-scsi@vger.kernel.org
Cc: "James E.J. Bottomley" <James.Bottomley@suse.de>
Cc: David Woodhouse <David.Woodhouse@intel.com>
Cc: linux-mtd@lists.infradead.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org
Cc: Corey Minyard <minyard@acm.org>
Cc: openipmi-developer@lists.sourceforge.net
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Jens Axboe <axboe@kernel.dk>

^ permalink raw reply

* [PATCH 3/7] mac: autoconvert trivial BKL users to private mutex
From: Arnd Bergmann @ 2010-09-14 19:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: Arnd Bergmann, linuxppc-dev
In-Reply-To: <1284494022-7346-1-git-send-email-arnd@arndb.de>

All these files use the big kernel lock in a trivial
way to serialize their private file operations,
typically resulting from an earlier semi-automatic
pushdown from VFS.

None of these drivers appears to want to lock against
other code, and they all use the BKL as the top-level
lock in their file operations, meaning that there
is no lock-order inversion problem.

Consequently, we can remove the BKL completely,
replacing it with a per-file mutex in every case.
Using a scripted approach means we can avoid
typos.

file=$1
name=$2
if grep -q lock_kernel ${file} ; then
    if grep -q 'include.*linux.mutex.h' ${file} ; then
            sed -i '/include.*<linux\/smp_lock.h>/d' ${file}
    else
            sed -i 's/include.*<linux\/smp_lock.h>.*$/include <linux\/mutex.h>/g' ${file}
    fi
    sed -i ${file} \
        -e "/^#include.*linux.mutex.h/,$ {
                1,/^\(static\|int\|long\)/ {
                     /^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);

} }"  \
    -e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
    -e '/[      ]*cycle_kernel_lock();/d'
else
    sed -i -e '/include.*\<smp_lock.h\>/d' ${file}  \
                -e '/cycle_kernel_lock()/d'
fi

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org
---
 drivers/macintosh/adb.c     |   10 +++++-----
 drivers/macintosh/smu.c     |    6 +++---
 drivers/macintosh/via-pmu.c |   11 ++++++-----
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 1c4ee6e..e75e3be 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -24,7 +24,6 @@
 #include <linux/fs.h>
 #include <linux/mm.h>
 #include <linux/sched.h>
-#include <linux/smp_lock.h>
 #include <linux/adb.h>
 #include <linux/cuda.h>
 #include <linux/pmu.h>
@@ -55,6 +54,7 @@ extern struct adb_driver adb_iop_driver;
 extern struct adb_driver via_pmu_driver;
 extern struct adb_driver macio_adb_driver;
 
+static DEFINE_MUTEX(adb_mutex);
 static struct adb_driver *adb_driver_list[] = {
 #ifdef CONFIG_ADB_MACII
 	&via_macii_driver,
@@ -647,7 +647,7 @@ static int adb_open(struct inode *inode, struct file *file)
 	struct adbdev_state *state;
 	int ret = 0;
 
-	lock_kernel();
+	mutex_lock(&adb_mutex);
 	if (iminor(inode) > 0 || adb_controller == NULL) {
 		ret = -ENXIO;
 		goto out;
@@ -665,7 +665,7 @@ static int adb_open(struct inode *inode, struct file *file)
 	state->inuse = 1;
 
 out:
-	unlock_kernel();
+	mutex_unlock(&adb_mutex);
 	return ret;
 }
 
@@ -674,7 +674,7 @@ static int adb_release(struct inode *inode, struct file *file)
 	struct adbdev_state *state = file->private_data;
 	unsigned long flags;
 
-	lock_kernel();
+	mutex_lock(&adb_mutex);
 	if (state) {
 		file->private_data = NULL;
 		spin_lock_irqsave(&state->lock, flags);
@@ -687,7 +687,7 @@ static int adb_release(struct inode *inode, struct file *file)
 			spin_unlock_irqrestore(&state->lock, flags);
 		}
 	}
-	unlock_kernel();
+	mutex_unlock(&adb_mutex);
 	return 0;
 }
 
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index e58c3d3..290cb32 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -19,7 +19,6 @@
  *    the userland interface
  */
 
-#include <linux/smp_lock.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/device.h>
@@ -97,6 +96,7 @@ struct smu_device {
  * I don't think there will ever be more than one SMU, so
  * for now, just hard code that
  */
+static DEFINE_MUTEX(smu_mutex);
 static struct smu_device	*smu;
 static DEFINE_MUTEX(smu_part_access);
 static int smu_irq_inited;
@@ -1095,12 +1095,12 @@ static int smu_open(struct inode *inode, struct file *file)
 	pp->mode = smu_file_commands;
 	init_waitqueue_head(&pp->wait);
 
-	lock_kernel();
+	mutex_lock(&smu_mutex);
 	spin_lock_irqsave(&smu_clist_lock, flags);
 	list_add(&pp->list, &smu_clist);
 	spin_unlock_irqrestore(&smu_clist_lock, flags);
 	file->private_data = pp;
-	unlock_kernel();
+	mutex_unlock(&smu_mutex);
 
 	return 0;
 }
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 2d17e76..7b8b1de 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -18,7 +18,7 @@
  *
  */
 #include <stdarg.h>
-#include <linux/smp_lock.h>
+#include <linux/mutex.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
@@ -73,6 +73,7 @@
 /* How many iterations between battery polls */
 #define BATTERY_POLLING_COUNT	2
 
+static DEFINE_MUTEX(pmu_info_proc_mutex);
 static volatile unsigned char __iomem *via;
 
 /* VIA registers - spaced 0x200 bytes apart */
@@ -2078,7 +2079,7 @@ pmu_open(struct inode *inode, struct file *file)
 	pp->rb_get = pp->rb_put = 0;
 	spin_lock_init(&pp->lock);
 	init_waitqueue_head(&pp->wait);
-	lock_kernel();
+	mutex_lock(&pmu_info_proc_mutex);
 	spin_lock_irqsave(&all_pvt_lock, flags);
 #if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT)
 	pp->backlight_locker = 0;
@@ -2086,7 +2087,7 @@ pmu_open(struct inode *inode, struct file *file)
 	list_add(&pp->list, &all_pmu_pvt);
 	spin_unlock_irqrestore(&all_pvt_lock, flags);
 	file->private_data = pp;
-	unlock_kernel();
+	mutex_unlock(&pmu_info_proc_mutex);
 	return 0;
 }
 
@@ -2343,9 +2344,9 @@ static long pmu_unlocked_ioctl(struct file *filp,
 {
 	int ret;
 
-	lock_kernel();
+	mutex_lock(&pmu_info_proc_mutex);
 	ret = pmu_ioctl(filp, cmd, arg);
-	unlock_kernel();
+	mutex_unlock(&pmu_info_proc_mutex);
 
 	return ret;
 }
-- 
1.7.1

^ permalink raw reply related

* Re: [PATCH] hvc_console: fix dropping of characters when output byte channel is full
From: Timur Tabi @ 2010-09-14 19:44 UTC (permalink / raw)
  To: Alan Cox; +Cc: kumar.gala, linux-kernel, linuxppc-dev, amit.shah, Andrew Morton
In-Reply-To: <20100914205246.0e35c9af@lxorguk.ukuu.org.uk>

Alan Cox wrote:
> If you want to make that change then I guess you need to audit every
> other hvc driver first.
> 
> But I never understood the point of the hvc layer anyway 8)

We've come to the same conclusion here.  I think we're just going to drop
the hvc layer and make the driver a standard console driver.

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply

* Re: [PATCH] hvc_console: fix dropping of characters when output byte channel is full
From: Alan Cox @ 2010-09-14 19:44 UTC (permalink / raw)
  To: Andrew Morton
  Cc: kumar.gala, linux-kernel, linuxppc-dev, amit.shah, Timur Tabi
In-Reply-To: <20100914121721.c8671ed8.akpm@linux-foundation.org>

> Yes, hvc_push() reschedules.  It doesn't sit in a tight loop burning
> electrons!
> 
> Can we do something safer&smarter here?


Its a printk handler - better to lose the bytes than hang the box. I
think the current code is probably right.

^ permalink raw reply

* Re: [PATCH] hvc_console: fix dropping of characters when output byte channel is full
From: Timur Tabi @ 2010-09-14 19:25 UTC (permalink / raw)
  To: Alan Cox; +Cc: kumar.gala, linux-kernel, linuxppc-dev, amit.shah, Andrew Morton
In-Reply-To: <20100914204410.71942cdc@lxorguk.ukuu.org.uk>

Alan Cox wrote:
> Its a printk handler - better to lose the bytes than hang the box. I
> think the current code is probably right.

What do you think about this change:

http://lists.ozlabs.org/pipermail/linuxppc-dev/2009-October/thread.html#76830

This is the original version of my patch.  In it, I simply allow drivers to
return 0 to indicate that they're too busy to accept data.  It works great
on the hvc driver that we have in-house today, but it might break other
drivers that return 0 to indicate error.

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply

* Re: [PATCH] hvc_console: fix dropping of characters when output byte channel is full
From: Scott Wood @ 2010-09-14 19:22 UTC (permalink / raw)
  To: Andrew Morton
  Cc: amit.shah, linuxppc-dev, kumar.gala, Timur Tabi, linux-kernel
In-Reply-To: <20100914121721.c8671ed8.akpm@linux-foundation.org>

On Tue, 14 Sep 2010 12:17:21 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Fri, 20 Aug 2010 13:45:21 -0500
> Timur Tabi <timur@freescale.com> wrote:
> 
> > hvc_console_print() calls the HVC client driver's put_chars() callback
> > to write some characters to the console.  If the callback returns 0, that
> > indicates that no characters were written (perhaps the output buffer is
> > full), but hvc_console_print() treats that as an error and discards the
> > rest of the buffer.
> > 
> > So change hvc_console_print() to just loop and call put_chars() again if it
> > returns a 0 return code.
> 
> Seems rather dangerous.  The upper layer will sit there chewing 100%
> CPU for as long as the lower layer is congested.

This is just for printk(), not user output.  This is exactly what
printk() has always done for real serial ports.

> > This change makes hvc_console_print() behave more like hvc_push(), which
> > does check for a 0 return code and re-schedules itself.
> 
> Yes, hvc_push() reschedules.

hvc_push() is not relevant to kernel console output.

hvc_console_write() currently does not reschedule anything.  It just
drops characters when busy.

-Scott

^ permalink raw reply

* Re: [PATCH] hvc_console: fix dropping of characters when output byte channel is full
From: Alan Cox @ 2010-09-14 19:52 UTC (permalink / raw)
  To: Timur Tabi
  Cc: kumar.gala, linux-kernel, linuxppc-dev, amit.shah, Andrew Morton
In-Reply-To: <4C8FCC2E.1020107@freescale.com>

On Tue, 14 Sep 2010 14:25:34 -0500
Timur Tabi <timur@freescale.com> wrote:

> Alan Cox wrote:
> > Its a printk handler - better to lose the bytes than hang the box. I
> > think the current code is probably right.
> 
> What do you think about this change:
> 
> http://lists.ozlabs.org/pipermail/linuxppc-dev/2009-October/thread.html#76830
> 
> This is the original version of my patch.  In it, I simply allow drivers to
> return 0 to indicate that they're too busy to accept data.  It works great
> on the hvc driver that we have in-house today, but it might break other
> drivers that return 0 to indicate error.

If you want to make that change then I guess you need to audit every
other hvc driver first.

But I never understood the point of the hvc layer anyway 8)

^ permalink raw reply

* Re: [PATCH] hvc_console: fix dropping of characters when output byte channel is full
From: Andrew Morton @ 2010-09-14 19:17 UTC (permalink / raw)
  To: Timur Tabi; +Cc: amit.shah, linuxppc-dev, kumar.gala, linux-kernel
In-Reply-To: <1282329921-24394-1-git-send-email-timur@freescale.com>

On Fri, 20 Aug 2010 13:45:21 -0500
Timur Tabi <timur@freescale.com> wrote:

> hvc_console_print() calls the HVC client driver's put_chars() callback
> to write some characters to the console.  If the callback returns 0, that
> indicates that no characters were written (perhaps the output buffer is
> full), but hvc_console_print() treats that as an error and discards the
> rest of the buffer.
> 
> So change hvc_console_print() to just loop and call put_chars() again if it
> returns a 0 return code.

Seems rather dangerous.  The upper layer will sit there chewing 100%
CPU for as long as the lower layer is congested.

> This change makes hvc_console_print() behave more like hvc_push(), which
> does check for a 0 return code and re-schedules itself.

Yes, hvc_push() reschedules.  It doesn't sit in a tight loop burning
electrons!

Can we do something safer&smarter here?

^ permalink raw reply

* Re: [PATCH] hvc_console: fix dropping of characters when output byte channel is full
From: Timur Tabi @ 2010-09-14 16:05 UTC (permalink / raw)
  To: Andrew Morton; +Cc: amit.shah, linuxppc-dev, kumar.gala, linux-kernel
In-Reply-To: <1282329921-24394-1-git-send-email-timur@freescale.com>

Andrew,

Would you please take a moment to review this patch I sent last month?
I'd like for it to be incorporated into 2.6.37, but I'm having a hard
time finding someone to consider it.

Thanks.

On Fri, Aug 20, 2010 at 1:45 PM, Timur Tabi <timur@freescale.com> wrote:
> hvc_console_print() calls the HVC client driver's put_chars() callback
> to write some characters to the console. =A0If the callback returns 0, th=
at
> indicates that no characters were written (perhaps the output buffer is
> full), but hvc_console_print() treats that as an error and discards the
> rest of the buffer.
>
> So change hvc_console_print() to just loop and call put_chars() again if =
it
> returns a 0 return code.
>
> This change makes hvc_console_print() behave more like hvc_push(), which
> does check for a 0 return code and re-schedules itself.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
> =A0drivers/char/hvc_console.c | =A0 19 ++++++++++++++++++-
> =A01 files changed, 18 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
> index fa27d16..b4deffd 100644
> --- a/drivers/char/hvc_console.c
> +++ b/drivers/char/hvc_console.c
> @@ -3,6 +3,7 @@
> =A0* Copyright (C) 2001 Paul Mackerras <paulus@au.ibm.com>, IBM
> =A0* Copyright (C) 2004 Benjamin Herrenschmidt <benh@kernel.crashing.org>=
, IBM Corp.
> =A0* Copyright (C) 2004 IBM Corporation
> + * Copyright 2009 Freescale Semiconductor, Inc.
> =A0*
> =A0* Additional Author(s):
> =A0* =A0Ryan S. Arnold <rsa@us.ibm.com>
> @@ -141,6 +142,7 @@ static void hvc_console_print(struct console *co, con=
st char *b,
> =A0 =A0 =A0 =A0char c[N_OUTBUF] __ALIGNED__;
> =A0 =A0 =A0 =A0unsigned i =3D 0, n =3D 0;
> =A0 =A0 =A0 =A0int r, donecr =3D 0, index =3D co->index;
> + =A0 =A0 =A0 unsigned int timeout =3D 1000000; /* Keep trying for up to =
one second */
>
> =A0 =A0 =A0 =A0/* Console access attempt outside of acceptable console ra=
nge. */
> =A0 =A0 =A0 =A0if (index >=3D MAX_NR_HVC_CONSOLES)
> @@ -152,6 +154,10 @@ static void hvc_console_print(struct console *co, co=
nst char *b,
>
> =A0 =A0 =A0 =A0while (count > 0 || i > 0) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (count > 0 && i < sizeof(c)) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* If the local buffer (c) =
is not full, then copy some
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* bytes from the input b=
uffer to it. We stop when the
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* local buffer is full. =
\n is converted to \r\n.
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (b[n] =3D=3D '\n' && !d=
onecr) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0c[i++] =3D=
 '\r';
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0donecr =3D=
 1;
> @@ -162,14 +168,25 @@ static void hvc_console_print(struct console *co, c=
onst char *b,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} else {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0r =3D cons_ops[index]->put=
_chars(vtermnos[index], c, i);
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (r <=3D 0) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (r < 0) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* throw a=
way chars on error */
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0i =3D 0;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} else if (r > 0) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0i -=3D r;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (i > 0)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0memmove(c, c+r, i);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* If r =3D=
=3D 0, then the client driver didn't do
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* anythi=
ng, so wait 1us and try again. =A0If we
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* time o=
ut, then just exit.
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!--time=
out)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 return;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 udelay(1);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 continue;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Reset the timeout */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 timeout =3D 1000000;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}
> =A0 =A0 =A0 =A0}
> =A0}
> --
> 1.7.0.1
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



--=20
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply

* [PATCH v2 09/10] RapidIO: Add support for IDT CPS Gen2 switches
From: Alexandre Bounine @ 2010-09-14 14:59 UTC (permalink / raw)
  To: akpm, linux-kernel, linuxppc-dev; +Cc: Alexandre Bounine, Thomas Moll
In-Reply-To: <1284476363-1677-1-git-send-email-alexandre.bounine@idt.com>

Add the RIO switch driver and definitions for IDT CPS-1848 and CPS-1616 Gen2
devices.

Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Thomas Moll <thomas.moll@sysgo.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Micha Nelissen <micha@neli.hopto.org>
---
 drivers/rapidio/switches/Kconfig    |    7 +
 drivers/rapidio/switches/Makefile   |    1 +
 drivers/rapidio/switches/idt_gen2.c |  447 +++++++++++++++++++++++++++++++++++
 include/linux/rio_ids.h             |    2 +
 include/linux/rio_regs.h            |    5 +
 5 files changed, 462 insertions(+), 0 deletions(-)
 create mode 100644 drivers/rapidio/switches/idt_gen2.c

diff --git a/drivers/rapidio/switches/Kconfig b/drivers/rapidio/switches/Kconfig
index 2b4e9b2..f47fee5 100644
--- a/drivers/rapidio/switches/Kconfig
+++ b/drivers/rapidio/switches/Kconfig
@@ -20,6 +20,13 @@ config RAPIDIO_TSI568
 	---help---
 	  Includes support for IDT Tsi568 serial RapidIO switch.
 
+config RAPIDIO_CPS_GEN2
+	bool "IDT CPS Gen.2 SRIO switch support"
+	depends on RAPIDIO
+	default n
+	---help---
+	  Includes support for ITD CPS Gen.2 serial RapidIO switches.
+
 config RAPIDIO_TSI500
 	bool "Tsi500 Parallel RapidIO switch support"
 	depends on RAPIDIO
diff --git a/drivers/rapidio/switches/Makefile b/drivers/rapidio/switches/Makefile
index fe4adc3..48d67a6 100644
--- a/drivers/rapidio/switches/Makefile
+++ b/drivers/rapidio/switches/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_RAPIDIO_TSI57X)	+= tsi57x.o
 obj-$(CONFIG_RAPIDIO_CPS_XX)	+= idtcps.o
 obj-$(CONFIG_RAPIDIO_TSI568)	+= tsi568.o
 obj-$(CONFIG_RAPIDIO_TSI500)	+= tsi500.o
+obj-$(CONFIG_RAPIDIO_CPS_GEN2)	+= idt_gen2.o
 
 ifeq ($(CONFIG_RAPIDIO_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
diff --git a/drivers/rapidio/switches/idt_gen2.c b/drivers/rapidio/switches/idt_gen2.c
new file mode 100644
index 0000000..0bb871c
--- /dev/null
+++ b/drivers/rapidio/switches/idt_gen2.c
@@ -0,0 +1,447 @@
+/*
+ * IDT CPS Gen.2 Serial RapidIO switch family support
+ *
+ * Copyright 2010 Integrated Device Technology, Inc.
+ * Alexandre Bounine <alexandre.bounine@idt.com>
+ *
+ * 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 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/rio.h>
+#include <linux/rio_drv.h>
+#include <linux/rio_ids.h>
+#include <linux/delay.h>
+#include "../rio.h"
+
+#define LOCAL_RTE_CONF_DESTID_SEL	0x010070
+#define LOCAL_RTE_CONF_DESTID_SEL_PSEL	0x0000001f
+
+#define IDT_LT_ERR_REPORT_EN	0x03100c
+
+#define IDT_PORT_ERR_REPORT_EN(n)	(0x031044 + (n)*0x40)
+#define IDT_PORT_ERR_REPORT_EN_BC	0x03ff04
+
+#define IDT_PORT_ISERR_REPORT_EN(n)	(0x03104C + (n)*0x40)
+#define IDT_PORT_ISERR_REPORT_EN_BC	0x03ff0c
+#define IDT_PORT_INIT_TX_ACQUIRED	0x00000020
+
+#define IDT_LANE_ERR_REPORT_EN(n)	(0x038010 + (n)*0x100)
+#define IDT_LANE_ERR_REPORT_EN_BC	0x03ff10
+
+#define IDT_DEV_CTRL_1		0xf2000c
+#define IDT_DEV_CTRL_1_GENPW		0x02000000
+#define IDT_DEV_CTRL_1_PRSTBEH		0x00000001
+
+#define IDT_CFGBLK_ERR_CAPTURE_EN	0x020008
+#define IDT_CFGBLK_ERR_REPORT		0xf20014
+#define IDT_CFGBLK_ERR_REPORT_GENPW		0x00000002
+
+#define IDT_AUX_PORT_ERR_CAP_EN	0x020000
+#define IDT_AUX_ERR_REPORT_EN	0xf20018
+#define IDT_AUX_PORT_ERR_LOG_I2C	0x00000002
+#define IDT_AUX_PORT_ERR_LOG_JTAG	0x00000001
+
+#define	IDT_ISLTL_ADDRESS_CAP	0x021014
+
+#define IDT_RIO_DOMAIN		0xf20020
+#define IDT_RIO_DOMAIN_MASK		0x000000ff
+
+#define IDT_PW_INFO_CSR		0xf20024
+
+#define IDT_SOFT_RESET		0xf20040
+#define IDT_SOFT_RESET_REQ		0x00030097
+
+#define IDT_I2C_MCTRL		0xf20050
+#define IDT_I2C_MCTRL_GENPW		0x04000000
+
+#define IDT_JTAG_CTRL		0xf2005c
+#define IDT_JTAG_CTRL_GENPW		0x00000002
+
+#define IDT_LANE_CTRL(n)	(0xff8000 + (n)*0x100)
+#define IDT_LANE_CTRL_BC	0xffff00
+#define IDT_LANE_CTRL_GENPW		0x00200000
+#define IDT_LANE_DFE_1_BC	0xffff18
+#define IDT_LANE_DFE_2_BC	0xffff1c
+
+#define IDT_PORT_OPS(n)		(0xf40004 + (n)*0x100)
+#define IDT_PORT_OPS_GENPW		0x08000000
+#define IDT_PORT_OPS_PL_ELOG		0x00000040
+#define IDT_PORT_OPS_LL_ELOG		0x00000020
+#define IDT_PORT_OPS_LT_ELOG		0x00000010
+#define IDT_PORT_OPS_BC		0xf4ff04
+
+#define IDT_PORT_ISERR_DET(n)	(0xf40008 + (n)*0x100)
+
+#define IDT_ERR_CAP		0xfd0000
+#define IDT_ERR_CAP_LOG_OVERWR		0x00000004
+
+#define IDT_ERR_RD		0xfd0004
+
+#define IDT_DEFAULT_ROUTE	0xde
+#define IDT_NO_ROUTE		0xdf
+
+static int
+idtg2_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
+		       u16 table, u16 route_destid, u8 route_port)
+{
+	/*
+	 * Select routing table to update
+	 */
+	if (table == RIO_GLOBAL_TABLE)
+		table = 0;
+	else
+		table++;
+
+	rio_mport_write_config_32(mport, destid, hopcount,
+				  LOCAL_RTE_CONF_DESTID_SEL, table);
+
+	/*
+	 * Program destination port for the specified destID
+	 */
+	rio_mport_write_config_32(mport, destid, hopcount,
+				  RIO_STD_RTE_CONF_DESTID_SEL_CSR,
+				  (u32)route_destid);
+
+	rio_mport_write_config_32(mport, destid, hopcount,
+				  RIO_STD_RTE_CONF_PORT_SEL_CSR,
+				  (u32)route_port);
+	udelay(10);
+
+	return 0;
+}
+
+static int
+idtg2_route_get_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
+		       u16 table, u16 route_destid, u8 *route_port)
+{
+	u32 result;
+
+	/*
+	 * Select routing table to read
+	 */
+	if (table == RIO_GLOBAL_TABLE)
+		table = 0;
+	else
+		table++;
+
+	rio_mport_write_config_32(mport, destid, hopcount,
+				  LOCAL_RTE_CONF_DESTID_SEL, table);
+
+	rio_mport_write_config_32(mport, destid, hopcount,
+				  RIO_STD_RTE_CONF_DESTID_SEL_CSR,
+				  route_destid);
+
+	rio_mport_read_config_32(mport, destid, hopcount,
+				 RIO_STD_RTE_CONF_PORT_SEL_CSR, &result);
+
+	if (IDT_DEFAULT_ROUTE == (u8)result || IDT_NO_ROUTE == (u8)result)
+		*route_port = RIO_INVALID_ROUTE;
+	else
+		*route_port = (u8)result;
+
+	return 0;
+}
+
+static int
+idtg2_route_clr_table(struct rio_mport *mport, u16 destid, u8 hopcount,
+		       u16 table)
+{
+	u32 i;
+
+	/*
+	 * Select routing table to read
+	 */
+	if (table == RIO_GLOBAL_TABLE)
+		table = 0;
+	else
+		table++;
+
+	rio_mport_write_config_32(mport, destid, hopcount,
+				  LOCAL_RTE_CONF_DESTID_SEL, table);
+
+	for (i = RIO_STD_RTE_CONF_EXTCFGEN;
+	     i <= (RIO_STD_RTE_CONF_EXTCFGEN | 0xff);) {
+		rio_mport_write_config_32(mport, destid, hopcount,
+			RIO_STD_RTE_CONF_DESTID_SEL_CSR, i);
+		rio_mport_write_config_32(mport, destid, hopcount,
+			RIO_STD_RTE_CONF_PORT_SEL_CSR,
+			(IDT_DEFAULT_ROUTE << 24) | (IDT_DEFAULT_ROUTE << 16) |
+			(IDT_DEFAULT_ROUTE << 8) | IDT_DEFAULT_ROUTE);
+		i += 4;
+	}
+
+	return 0;
+}
+
+
+static int
+idtg2_set_domain(struct rio_mport *mport, u16 destid, u8 hopcount,
+		       u8 sw_domain)
+{
+	/*
+	 * Switch domain configuration operates only at global level
+	 */
+	rio_mport_write_config_32(mport, destid, hopcount,
+				  IDT_RIO_DOMAIN, (u32)sw_domain);
+	return 0;
+}
+
+static int
+idtg2_get_domain(struct rio_mport *mport, u16 destid, u8 hopcount,
+		       u8 *sw_domain)
+{
+	u32 regval;
+
+	/*
+	 * Switch domain configuration operates only at global level
+	 */
+	rio_mport_read_config_32(mport, destid, hopcount,
+				IDT_RIO_DOMAIN, &regval);
+
+	*sw_domain = (u8)(regval & 0xff);
+
+	return 0;
+}
+
+static int
+idtg2_em_init(struct rio_dev *rdev)
+{
+	struct rio_mport *mport = rdev->net->hport;
+	u16 destid = rdev->rswitch->destid;
+	u8 hopcount = rdev->rswitch->hopcount;
+	u32 regval;
+	int i, tmp;
+
+	/*
+	 * This routine performs device-specific initialization only.
+	 * All standard EM configuration should be performed at upper level.
+	 */
+
+	pr_debug("RIO: %s [%d:%d]\n", __func__, destid, hopcount);
+
+	/* Set Port-Write info CSR: PRIO=3 and CRF=1 */
+	rio_mport_write_config_32(mport, destid, hopcount,
+			IDT_PW_INFO_CSR, 0x0000e000);
+
+	/*
+	 * Configure LT LAYER error reporting.
+	 */
+
+	/* Enable standard (RIO.p8) error reporting */
+	rio_mport_write_config_32(mport, destid, hopcount,
+			IDT_LT_ERR_REPORT_EN,
+			REM_LTL_ERR_ILLTRAN | REM_LTL_ERR_UNSOLR |
+			REM_LTL_ERR_UNSUPTR);
+
+	/* Use Port-Writes for LT layer error reporting.
+	 * Enable per-port reset
+	 */
+	rio_mport_read_config_32(mport, destid, hopcount,
+			IDT_DEV_CTRL_1, &regval);
+	rio_mport_write_config_32(mport, destid, hopcount,
+			IDT_DEV_CTRL_1,
+			regval | IDT_DEV_CTRL_1_GENPW | IDT_DEV_CTRL_1_PRSTBEH);
+
+	/*
+	 * Configure PORT error reporting.
+	 */
+
+	/* Report all RIO.p8 errors supported by device */
+	rio_mport_write_config_32(mport, destid, hopcount,
+			IDT_PORT_ERR_REPORT_EN_BC, 0x807e8037);
+
+	/* Configure reporting of implementation specific errors/events */
+	rio_mport_write_config_32(mport, destid, hopcount,
+			IDT_PORT_ISERR_REPORT_EN_BC, IDT_PORT_INIT_TX_ACQUIRED);
+
+	/* Use Port-Writes for port error reporting and enable error logging */
+	tmp = RIO_GET_TOTAL_PORTS(rdev->swpinfo);
+	for (i = 0; i < tmp; i++) {
+		rio_mport_read_config_32(mport, destid, hopcount,
+				IDT_PORT_OPS(i), &regval);
+		rio_mport_write_config_32(mport, destid, hopcount,
+				IDT_PORT_OPS(i), regval | IDT_PORT_OPS_GENPW |
+				IDT_PORT_OPS_PL_ELOG |
+				IDT_PORT_OPS_LL_ELOG |
+				IDT_PORT_OPS_LT_ELOG);
+	}
+	/* Overwrite error log if full */
+	rio_mport_write_config_32(mport, destid, hopcount,
+			IDT_ERR_CAP, IDT_ERR_CAP_LOG_OVERWR);
+
+	/*
+	 * Configure LANE error reporting.
+	 */
+
+	/* Disable line error reporting */
+	rio_mport_write_config_32(mport, destid, hopcount,
+			IDT_LANE_ERR_REPORT_EN_BC, 0);
+
+	/* Use Port-Writes for lane error reporting (when enabled)
+	 * (do per-lane update because lanes may have different configuration)
+	 */
+	tmp = (rdev->did == RIO_DID_IDTCPS1848) ? 48 : 16;
+	for (i = 0; i < tmp; i++) {
+		rio_mport_read_config_32(mport, destid, hopcount,
+				IDT_LANE_CTRL(i), &regval);
+		rio_mport_write_config_32(mport, destid, hopcount,
+				IDT_LANE_CTRL(i), regval | IDT_LANE_CTRL_GENPW);
+	}
+
+	/*
+	 * Configure AUX error reporting.
+	 */
+
+	/* Disable JTAG and I2C Error capture */
+	rio_mport_write_config_32(mport, destid, hopcount,
+			IDT_AUX_PORT_ERR_CAP_EN, 0);
+
+	/* Disable JTAG and I2C Error reporting/logging */
+	rio_mport_write_config_32(mport, destid, hopcount,
+			IDT_AUX_ERR_REPORT_EN, 0);
+
+	/* Disable Port-Write notification from JTAG */
+	rio_mport_write_config_32(mport, destid, hopcount,
+			IDT_JTAG_CTRL, 0);
+
+	/* Disable Port-Write notification from I2C */
+	rio_mport_read_config_32(mport, destid, hopcount,
+			IDT_I2C_MCTRL, &regval);
+	rio_mport_write_config_32(mport, destid, hopcount,
+			IDT_I2C_MCTRL,
+			regval & ~IDT_I2C_MCTRL_GENPW);
+
+	/*
+	 * Configure CFG_BLK error reporting.
+	 */
+
+	/* Disable Configuration Block error capture */
+	rio_mport_write_config_32(mport, destid, hopcount,
+			IDT_CFGBLK_ERR_CAPTURE_EN, 0);
+
+	/* Disable Port-Writes for Configuration Block error reporting */
+	rio_mport_read_config_32(mport, destid, hopcount,
+			IDT_CFGBLK_ERR_REPORT, &regval);
+	rio_mport_write_config_32(mport, destid, hopcount,
+			IDT_CFGBLK_ERR_REPORT,
+			regval & ~IDT_CFGBLK_ERR_REPORT_GENPW);
+
+	/* set TVAL = ~50us */
+	rio_mport_write_config_32(mport, destid, hopcount,
+		rdev->phys_efptr + RIO_PORT_LINKTO_CTL_CSR, 0x8e << 8);
+
+	return 0;
+}
+
+static int
+idtg2_em_handler(struct rio_dev *rdev, u8 portnum)
+{
+	struct rio_mport *mport = rdev->net->hport;
+	u16 destid = rdev->rswitch->destid;
+	u8 hopcount = rdev->rswitch->hopcount;
+	u32 regval, em_perrdet, em_ltlerrdet;
+
+	rio_mport_read_config_32(mport, destid, hopcount,
+		rdev->em_efptr + RIO_EM_LTL_ERR_DETECT, &em_ltlerrdet);
+	if (em_ltlerrdet) {
+		/* Service Logical/Transport Layer Error(s) */
+		if (em_ltlerrdet & REM_LTL_ERR_IMPSPEC) {
+			/* Implementation specific error reported */
+			rio_mport_read_config_32(mport, destid, hopcount,
+					IDT_ISLTL_ADDRESS_CAP, &regval);
+
+			pr_debug("RIO: %s Implementation Specific LTL errors" \
+				 " 0x%x @(0x%x)\n",
+				 rio_name(rdev), em_ltlerrdet, regval);
+
+			/* Clear implementation specific address capture CSR */
+			rio_mport_write_config_32(mport, destid, hopcount,
+					IDT_ISLTL_ADDRESS_CAP, 0);
+
+		}
+	}
+
+	rio_mport_read_config_32(mport, destid, hopcount,
+		rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum), &em_perrdet);
+	if (em_perrdet) {
+		/* Service Port-Level Error(s) */
+		if (em_perrdet & REM_PED_IMPL_SPEC) {
+			/* Implementation Specific port error reported */
+
+			/* Get IS errors reported */
+			rio_mport_read_config_32(mport, destid, hopcount,
+					IDT_PORT_ISERR_DET(portnum), &regval);
+
+			pr_debug("RIO: %s Implementation Specific Port" \
+				 " errors 0x%x\n", rio_name(rdev), regval);
+
+			/* Clear all implementation specific events */
+			rio_mport_write_config_32(mport, destid, hopcount,
+					IDT_PORT_ISERR_DET(portnum), 0);
+		}
+	}
+
+	return 0;
+}
+
+static ssize_t
+idtg2_show_errlog(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct rio_dev *rdev = to_rio_dev(dev);
+	struct rio_mport *mport = rdev->net->hport;
+	u16 destid = rdev->rswitch->destid;
+	u8 hopcount = rdev->rswitch->hopcount;
+	ssize_t len = 0;
+	u32 regval;
+
+	while (!rio_mport_read_config_32(mport, destid, hopcount,
+					 IDT_ERR_RD, &regval)) {
+		if (!regval)    /* 0 = end of log */
+			break;
+		len += snprintf(buf + len, PAGE_SIZE - len,
+					"%08x\n", regval);
+		if (len >= (PAGE_SIZE - 10))
+			break;
+	}
+
+	return len;
+}
+
+static DEVICE_ATTR(errlog, S_IRUGO, idtg2_show_errlog, NULL);
+
+static int idtg2_sysfs(struct rio_dev *rdev, int create)
+{
+	struct device *dev = &rdev->dev;
+	int err = 0;
+
+	if (create == RIO_SW_SYSFS_CREATE) {
+		/* Initialize sysfs entries */
+		err = device_create_file(dev, &dev_attr_errlog);
+		if (err)
+			dev_err(dev, "Unable create sysfs errlog file\n");
+	} else
+		device_remove_file(dev, &dev_attr_errlog);
+
+	return err;
+}
+
+static int idtg2_switch_init(struct rio_dev *rdev, int do_enum)
+{
+	pr_debug("RIO: %s for %s\n", __func__, rio_name(rdev));
+	rdev->rswitch->add_entry = idtg2_route_add_entry;
+	rdev->rswitch->get_entry = idtg2_route_get_entry;
+	rdev->rswitch->clr_table = idtg2_route_clr_table;
+	rdev->rswitch->set_domain = idtg2_set_domain;
+	rdev->rswitch->get_domain = idtg2_get_domain;
+	rdev->rswitch->em_init = idtg2_em_init;
+	rdev->rswitch->em_handle = idtg2_em_handler;
+	rdev->rswitch->sw_sysfs = idtg2_sysfs;
+
+	return 0;
+}
+
+DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTCPS1848, idtg2_switch_init);
+DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTCPS1616, idtg2_switch_init);
diff --git a/include/linux/rio_ids.h b/include/linux/rio_ids.h
index db50e1c..ee7b6ad 100644
--- a/include/linux/rio_ids.h
+++ b/include/linux/rio_ids.h
@@ -34,5 +34,7 @@
 #define RIO_DID_IDTCPS16		0x035b
 #define RIO_DID_IDTCPS6Q		0x035f
 #define RIO_DID_IDTCPS10Q		0x035e
+#define RIO_DID_IDTCPS1848		0x0374
+#define RIO_DID_IDTCPS1616		0x0379
 
 #endif				/* LINUX_RIO_IDS_H */
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h
index daa269d..a18b2e2 100644
--- a/include/linux/rio_regs.h
+++ b/include/linux/rio_regs.h
@@ -161,6 +161,7 @@
 #define RIO_COMPONENT_TAG_CSR	0x6c	/* [III] Component Tag CSR */
 
 #define RIO_STD_RTE_CONF_DESTID_SEL_CSR	0x70
+#define  RIO_STD_RTE_CONF_EXTCFGEN		0x80000000
 #define RIO_STD_RTE_CONF_PORT_SEL_CSR	0x74
 #define RIO_STD_RTE_DEFAULT_PORT	0x78
 
@@ -265,6 +266,10 @@
 #define RIO_EM_EFB_HEADER	0x000	/* Error Management Extensions Block Header */
 #define RIO_EM_LTL_ERR_DETECT	0x008	/* Logical/Transport Layer Error Detect CSR */
 #define RIO_EM_LTL_ERR_EN	0x00c	/* Logical/Transport Layer Error Enable CSR */
+#define  REM_LTL_ERR_ILLTRAN		0x08000000 /* Illegal Transaction decode */
+#define  REM_LTL_ERR_UNSOLR		0x00800000 /* Unsolicited Response */
+#define  REM_LTL_ERR_UNSUPTR		0x00400000 /* Unsupported Transaction */
+#define  REM_LTL_ERR_IMPSPEC		0x000000ff /* Implementation Specific */
 #define RIO_EM_LTL_HIADDR_CAP	0x010	/* Logical/Transport Layer High Address Capture CSR */
 #define RIO_EM_LTL_ADDR_CAP	0x014	/* Logical/Transport Layer Address Capture CSR */
 #define RIO_EM_LTL_DEVID_CAP	0x018	/* Logical/Transport Layer Device ID Capture CSR */
-- 
1.7.0.5

^ permalink raw reply related

* [PATCH v2 05/10] RapidIO: Add default handler for error-stopped state
From: Alexandre Bounine @ 2010-09-14 14:59 UTC (permalink / raw)
  To: akpm, linux-kernel, linuxppc-dev; +Cc: Alexandre Bounine, Thomas Moll
In-Reply-To: <1284476363-1677-1-git-send-email-alexandre.bounine@idt.com>

The default error-stopped state handler provides recovery mechanism as defined
by RIO specification.

Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Thomas Moll <thomas.moll@sysgo.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Micha Nelissen <micha@neli.hopto.org>
---
 drivers/rapidio/rio.c             |  218 +++++++++++++++++++++++++++++++-----
 drivers/rapidio/switches/idtcps.c |   10 ++
 drivers/rapidio/switches/tsi57x.c |    4 +
 include/linux/rio_regs.h          |    8 +-
 4 files changed, 206 insertions(+), 34 deletions(-)

diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c
index 74e9d22..77bd416 100644
--- a/drivers/rapidio/rio.c
+++ b/drivers/rapidio/rio.c
@@ -495,6 +495,148 @@ int rio_set_port_lockout(struct rio_dev *rdev, u32 pnum, int lock)
 }
 
 /**
+ * rio_get_input_status - Sends a Link-Request/Input-Status control symbol and
+ *                        returns link-response (if requested).
+ * @rdev: RIO devive to issue Input-status command
+ * @pnum: Device port number to issue the command
+ * @lnkresp: Response from a link partner
+ */
+static int
+rio_get_input_status(struct rio_dev *rdev, int pnum, u32 *lnkresp)
+{
+	struct rio_mport *mport = rdev->net->hport;
+	u16 destid = rdev->rswitch->destid;
+	u8 hopcount = rdev->rswitch->hopcount;
+	u32 regval;
+	int checkcount;
+
+	if (lnkresp) {
+		/* Read from link maintenance response register
+		 * to clear valid bit */
+		rio_mport_read_config_32(mport, destid, hopcount,
+			rdev->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(pnum),
+			&regval);
+		udelay(50);
+	}
+
+	/* Issue Input-status command */
+	rio_mport_write_config_32(mport, destid, hopcount,
+		rdev->phys_efptr + RIO_PORT_N_MNT_REQ_CSR(pnum),
+		RIO_MNT_REQ_CMD_IS);
+
+	/* Exit if the response is not expected */
+	if (lnkresp == NULL)
+		return 0;
+
+	checkcount = 3;
+	while (checkcount--) {
+		udelay(50);
+		rio_mport_read_config_32(mport, destid, hopcount,
+			rdev->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(pnum),
+			&regval);
+		if (regval & RIO_PORT_N_MNT_RSP_RVAL) {
+			*lnkresp = regval;
+			return 0;
+		}
+	}
+
+	return -EIO;
+}
+
+/**
+ * rio_clr_err_stopped - Clears port Error-stopped states.
+ * @rdev: Pointer to RIO device control structure
+ * @pnum: Switch port number to clear errors
+ * @err_status: port error status (if 0 reads register from device)
+ */
+static int rio_clr_err_stopped(struct rio_dev *rdev, u32 pnum, u32 err_status)
+{
+	struct rio_mport *mport = rdev->net->hport;
+	u16 destid = rdev->rswitch->destid;
+	u8 hopcount = rdev->rswitch->hopcount;
+	struct rio_dev *nextdev = rdev->rswitch->nextdev[pnum];
+	u32 regval;
+	u32 far_ackid, far_linkstat, near_ackid;
+
+	if (err_status == 0)
+		rio_mport_read_config_32(mport, destid, hopcount,
+			rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(pnum),
+			&err_status);
+
+	if (err_status & RIO_PORT_N_ERR_STS_PW_OUT_ES) {
+		pr_debug("RIO_EM: servicing Output Error-Stopped state\n");
+		/*
+		 * Send a Link-Request/Input-Status control symbol
+		 */
+		if (rio_get_input_status(rdev, pnum, &regval)) {
+			pr_debug("RIO_EM: Input-status response timeout\n");
+			goto rd_err;
+		}
+
+		pr_debug("RIO_EM: SP%d Input-status response=0x%08x\n",
+			 pnum, regval);
+		far_ackid = (regval & RIO_PORT_N_MNT_RSP_ASTAT) >> 5;
+		far_linkstat = regval & RIO_PORT_N_MNT_RSP_LSTAT;
+		rio_mport_read_config_32(mport, destid, hopcount,
+			rdev->phys_efptr + RIO_PORT_N_ACK_STS_CSR(pnum),
+			&regval);
+		pr_debug("RIO_EM: SP%d_ACK_STS_CSR=0x%08x\n", pnum, regval);
+		near_ackid = (regval & RIO_PORT_N_ACK_INBOUND) >> 24;
+		pr_debug("RIO_EM: SP%d far_ackID=0x%02x far_linkstat=0x%02x" \
+			 " near_ackID=0x%02x\n",
+			pnum, far_ackid, far_linkstat, near_ackid);
+
+		/*
+		 * If required, synchronize ackIDs of near and
+		 * far sides.
+		 */
+		if ((far_ackid != ((regval & RIO_PORT_N_ACK_OUTSTAND) >> 8)) ||
+		    (far_ackid != (regval & RIO_PORT_N_ACK_OUTBOUND))) {
+			/* Align near outstanding/outbound ackIDs with
+			 * far inbound.
+			 */
+			rio_mport_write_config_32(mport, destid,
+				hopcount, rdev->phys_efptr +
+					RIO_PORT_N_ACK_STS_CSR(pnum),
+				(near_ackid << 24) |
+					(far_ackid << 8) | far_ackid);
+			/* Align far outstanding/outbound ackIDs with
+			 * near inbound.
+			 */
+			far_ackid++;
+			if (nextdev)
+				rio_write_config_32(nextdev,
+					nextdev->phys_efptr +
+					RIO_PORT_N_ACK_STS_CSR(RIO_GET_PORT_NUM(nextdev->swpinfo)),
+					(far_ackid << 24) |
+					(near_ackid << 8) | near_ackid);
+			else
+				pr_debug("RIO_EM: Invalid nextdev pointer (NULL)\n");
+		}
+rd_err:
+		rio_mport_read_config_32(mport, destid, hopcount,
+			rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(pnum),
+			&err_status);
+		pr_debug("RIO_EM: SP%d_ERR_STS_CSR=0x%08x\n", pnum, err_status);
+	}
+
+	if ((err_status & RIO_PORT_N_ERR_STS_PW_INP_ES) && nextdev) {
+		pr_debug("RIO_EM: servicing Input Error-Stopped state\n");
+		rio_get_input_status(nextdev,
+				     RIO_GET_PORT_NUM(nextdev->swpinfo), NULL);
+		udelay(50);
+
+		rio_mport_read_config_32(mport, destid, hopcount,
+			rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(pnum),
+			&err_status);
+		pr_debug("RIO_EM: SP%d_ERR_STS_CSR=0x%08x\n", pnum, err_status);
+	}
+
+	return (err_status & (RIO_PORT_N_ERR_STS_PW_OUT_ES |
+			      RIO_PORT_N_ERR_STS_PW_INP_ES)) ? 1 : 0;
+}
+
+/**
  * rio_inb_pwrite_handler - process inbound port-write message
  * @pw_msg: pointer to inbound port-write message
  *
@@ -507,7 +649,7 @@ int rio_inb_pwrite_handler(union rio_pw_msg *pw_msg)
 	struct rio_mport *mport;
 	u8 hopcount;
 	u16 destid;
-	u32 err_status;
+	u32 err_status, em_perrdet, em_ltlerrdet;
 	int rc, portnum;
 
 	rdev = rio_get_comptag(pw_msg->em.comptag, NULL);
@@ -524,12 +666,11 @@ int rio_inb_pwrite_handler(union rio_pw_msg *pw_msg)
 	{
 	u32 i;
 	for (i = 0; i < RIO_PW_MSG_SIZE/sizeof(u32);) {
-			pr_debug("0x%02x: %08x %08x %08x %08x",
+			pr_debug("0x%02x: %08x %08x %08x %08x\n",
 				 i*4, pw_msg->raw[i], pw_msg->raw[i + 1],
 				 pw_msg->raw[i + 2], pw_msg->raw[i + 3]);
 			i += 4;
 	}
-	pr_debug("\n");
 	}
 #endif
 
@@ -573,29 +714,28 @@ int rio_inb_pwrite_handler(union rio_pw_msg *pw_msg)
 			&err_status);
 	pr_debug("RIO_PW: SP%d_ERR_STS_CSR=0x%08x\n", portnum, err_status);
 
-	if (pw_msg->em.errdetect) {
-		pr_debug("RIO_PW: RIO_EM_P%d_ERR_DETECT=0x%08x\n",
-			 portnum, pw_msg->em.errdetect);
-		/* Clear EM Port N Error Detect CSR */
-		rio_mport_write_config_32(mport, destid, hopcount,
-			rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum), 0);
-	}
+	if (err_status & RIO_PORT_N_ERR_STS_PORT_OK) {
 
-	if (pw_msg->em.ltlerrdet) {
-		pr_debug("RIO_PW: RIO_EM_LTL_ERR_DETECT=0x%08x\n",
-			 pw_msg->em.ltlerrdet);
-		/* Clear EM L/T Layer Error Detect CSR */
-		rio_mport_write_config_32(mport, destid, hopcount,
-			rdev->em_efptr + RIO_EM_LTL_ERR_DETECT, 0);
-	}
+		if (!(rdev->rswitch->port_ok & (1 << portnum))) {
+			rdev->rswitch->port_ok |= (1 << portnum);
+			rio_set_port_lockout(rdev, portnum, 0);
+			/* Schedule Insertion Service */
+			pr_debug("RIO_PW: Device Insertion on [%s]-P%d\n",
+			       rio_name(rdev), portnum);
+		}
 
-	/* Clear Port Errors */
-	rio_mport_write_config_32(mport, destid, hopcount,
-			rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(portnum),
-			err_status & RIO_PORT_N_ERR_STS_CLR_MASK);
+		/* Clear error-stopped states (if reported).
+		 * Depending on the link partner state, two attempts
+		 * may be needed for successful recovery.
+		 */
+		if (err_status & (RIO_PORT_N_ERR_STS_PW_OUT_ES |
+				  RIO_PORT_N_ERR_STS_PW_INP_ES)) {
+			if (rio_clr_err_stopped(rdev, portnum, err_status))
+				rio_clr_err_stopped(rdev, portnum, 0);
+		}
+	}  else { /* if (err_status & RIO_PORT_N_ERR_STS_PORT_UNINIT) */
 
-	if (rdev->rswitch->port_ok & (1 << portnum)) {
-		if (err_status & RIO_PORT_N_ERR_STS_PORT_UNINIT) {
+		if (rdev->rswitch->port_ok & (1 << portnum)) {
 			rdev->rswitch->port_ok &= ~(1 << portnum);
 			rio_set_port_lockout(rdev, portnum, 1);
 
@@ -608,17 +748,33 @@ int rio_inb_pwrite_handler(union rio_pw_msg *pw_msg)
 			pr_debug("RIO_PW: Device Extraction on [%s]-P%d\n",
 			       rio_name(rdev), portnum);
 		}
-	} else {
-		if (err_status & RIO_PORT_N_ERR_STS_PORT_OK) {
-			rdev->rswitch->port_ok |= (1 << portnum);
-			rio_set_port_lockout(rdev, portnum, 0);
+	}
 
-			/* Schedule Insertion Service */
-			pr_debug("RIO_PW: Device Insertion on [%s]-P%d\n",
-			       rio_name(rdev), portnum);
-		}
+	rio_mport_read_config_32(mport, destid, hopcount,
+		rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum), &em_perrdet);
+	if (em_perrdet) {
+		pr_debug("RIO_PW: RIO_EM_P%d_ERR_DETECT=0x%08x\n",
+			 portnum, em_perrdet);
+		/* Clear EM Port N Error Detect CSR */
+		rio_mport_write_config_32(mport, destid, hopcount,
+			rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum), 0);
 	}
 
+	rio_mport_read_config_32(mport, destid, hopcount,
+		rdev->em_efptr + RIO_EM_LTL_ERR_DETECT, &em_ltlerrdet);
+	if (em_ltlerrdet) {
+		pr_debug("RIO_PW: RIO_EM_LTL_ERR_DETECT=0x%08x\n",
+			 em_ltlerrdet);
+		/* Clear EM L/T Layer Error Detect CSR */
+		rio_mport_write_config_32(mport, destid, hopcount,
+			rdev->em_efptr + RIO_EM_LTL_ERR_DETECT, 0);
+	}
+
+	/* Clear remaining error bits */
+	rio_mport_write_config_32(mport, destid, hopcount,
+			rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(portnum),
+			err_status & RIO_PORT_N_ERR_STS_CLR_MASK);
+
 	/* Clear Port-Write Pending bit */
 	rio_mport_write_config_32(mport, destid, hopcount,
 			rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(portnum),
diff --git a/drivers/rapidio/switches/idtcps.c b/drivers/rapidio/switches/idtcps.c
index 2c790c1..fc9f637 100644
--- a/drivers/rapidio/switches/idtcps.c
+++ b/drivers/rapidio/switches/idtcps.c
@@ -117,6 +117,10 @@ idtcps_get_domain(struct rio_mport *mport, u16 destid, u8 hopcount,
 
 static int idtcps_switch_init(struct rio_dev *rdev, int do_enum)
 {
+	struct rio_mport *mport = rdev->net->hport;
+	u16 destid = rdev->rswitch->destid;
+	u8 hopcount = rdev->rswitch->hopcount;
+
 	pr_debug("RIO: %s for %s\n", __func__, rio_name(rdev));
 	rdev->rswitch->add_entry = idtcps_route_add_entry;
 	rdev->rswitch->get_entry = idtcps_route_get_entry;
@@ -126,6 +130,12 @@ static int idtcps_switch_init(struct rio_dev *rdev, int do_enum)
 	rdev->rswitch->em_init = NULL;
 	rdev->rswitch->em_handle = NULL;
 
+	if (do_enum) {
+		/* set TVAL = ~50us */
+		rio_mport_write_config_32(mport, destid, hopcount,
+			rdev->phys_efptr + RIO_PORT_LINKTO_CTL_CSR, 0x8e << 8);
+	}
+
 	return 0;
 }
 
diff --git a/drivers/rapidio/switches/tsi57x.c b/drivers/rapidio/switches/tsi57x.c
index d34df72..d9e9492 100644
--- a/drivers/rapidio/switches/tsi57x.c
+++ b/drivers/rapidio/switches/tsi57x.c
@@ -205,6 +205,10 @@ tsi57x_em_init(struct rio_dev *rdev)
 			portnum++;
 	}
 
+	/* set TVAL = ~50us */
+	rio_mport_write_config_32(mport, destid, hopcount,
+		rdev->phys_efptr + RIO_PORT_LINKTO_CTL_CSR, 0x9a << 8);
+
 	return 0;
 }
 
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h
index be80b1b..daa269d 100644
--- a/include/linux/rio_regs.h
+++ b/include/linux/rio_regs.h
@@ -224,15 +224,17 @@
 #define  RIO_PORT_GEN_MASTER		0x40000000
 #define  RIO_PORT_GEN_DISCOVERED	0x20000000
 #define RIO_PORT_N_MNT_REQ_CSR(x)	(0x0040 + x*0x20)	/* 0x0002 */
+#define  RIO_MNT_REQ_CMD_RD		0x03	/* Reset-device command */
+#define  RIO_MNT_REQ_CMD_IS		0x04	/* Input-status command */
 #define RIO_PORT_N_MNT_RSP_CSR(x)	(0x0044 + x*0x20)	/* 0x0002 */
 #define  RIO_PORT_N_MNT_RSP_RVAL	0x80000000 /* Response Valid */
 #define  RIO_PORT_N_MNT_RSP_ASTAT	0x000003e0 /* ackID Status */
 #define  RIO_PORT_N_MNT_RSP_LSTAT	0x0000001f /* Link Status */
 #define RIO_PORT_N_ACK_STS_CSR(x)	(0x0048 + x*0x20)	/* 0x0002 */
 #define  RIO_PORT_N_ACK_CLEAR		0x80000000
-#define  RIO_PORT_N_ACK_INBOUND		0x1f000000
-#define  RIO_PORT_N_ACK_OUTSTAND	0x00001f00
-#define  RIO_PORT_N_ACK_OUTBOUND	0x0000001f
+#define  RIO_PORT_N_ACK_INBOUND		0x3f000000
+#define  RIO_PORT_N_ACK_OUTSTAND	0x00003f00
+#define  RIO_PORT_N_ACK_OUTBOUND	0x0000003f
 #define RIO_PORT_N_ERR_STS_CSR(x)	(0x0058 + x*0x20)
 #define  RIO_PORT_N_ERR_STS_PW_OUT_ES	0x00010000 /* Output Error-stopped */
 #define  RIO_PORT_N_ERR_STS_PW_INP_ES	0x00000100 /* Input Error-stopped */
-- 
1.7.0.5

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox