Re: i915: pipe state still does not match
On Thu, Nov 28, 2013 at 09:08:45PM +0100, Jan Engelhardt wrote: > On Wednesday 2013-11-27 12:08, Chris Wilson wrote: > >On Wed, Nov 27, 2013 at 11:59:56AM +0100, Jan Engelhardt wrote: > >> > >> Despite the i915/drm fixes added in v3.11.8, the X server still > >> terminates due to some pipe state bug in 3.11.9. > > > >X terminating is entirely unconnected with that *ERROR*. > > Are you sure? Whenever X crashed, that inteldrv kernel message > was showing up in dmesg. > Affected versions: > xorg-x11-server-1.14.3.901 > xf86-video-intel-2.99.906-4.1.x86_64 > Working versions: > xorg-x11-server-1.13.2 > xf86-video-intel-2.20.19 For the ERROR the kernel is the important part. I can be that it's triggered by userspace doing something funny (and likely, sinc there's a good chance you're hitting a less well tested path when crashing). But it's a kernel issue. To track the kernel issue down can you please boot with drm.debug=0xe added to your bootline, reproduce the issue and then attach the complete dmesg? Thanks, Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v6 0/6] gpio: daVinci: cleanup and feature enhancement
On Thu, Nov 21, 2013 at 7:15 PM, Prabhakar Lad wrote: > From: "Lad, Prabhakar" > > This patch series does the following > 1> Ports the driver to use irqdomain. > 2> Adds dt binding support for gpio-davinci. > 3> Adds DA850 dt support goio. > > Changes for v6: > 1: GPIO driver now migrated to irq domain legacy. > 2: Fixed review comments pointed by Grygorii. > 3: Included Ack's. This series is looking nice, I assume that Sekhar will take this through the DaVinci tree once he's happy with it. I think I've ACKed all relevant patches, else tell me. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[GIT PULL] s390 patches for 3.13-rc2
Hi Linus, please pull from the 'for-linus' branch of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git for-linus to receive the following updates: One performance improvement and a few bug fixes. Two of the fixes deal with the clock related problems we have seen on recent kernels. Heiko Carstens (2): s390/mm: optimize copy_page s390/uaccess: add missing page table walk range check Hendrik Brueckner (1): s390/signal: always restore saved runtime instrumentation psw bit Martin Schwidefsky (3): s390/time,vdso: convert to the new update_vsyscall interface s390,time: revert direct ktime path for s390 clockevent device s390/mm: handle asce-type exceptions as normal page fault Stefan Weinhuber (1): s390/dasd: validate request size before building CCW/TCW request arch/s390/Kconfig |2 +- arch/s390/include/asm/page.h| 38 + arch/s390/include/asm/vdso.h|5 ++-- arch/s390/kernel/asm-offsets.c |3 +- arch/s390/kernel/compat_signal.c|2 +- arch/s390/kernel/pgm_check.S|2 +- arch/s390/kernel/signal.c |2 +- arch/s390/kernel/time.c | 46 +++ arch/s390/kernel/vdso32/clock_gettime.S | 30 ++-- arch/s390/kernel/vdso32/gettimeofday.S |9 +++--- arch/s390/kernel/vdso64/clock_gettime.S | 22 --- arch/s390/kernel/vdso64/gettimeofday.S |9 +++--- arch/s390/lib/uaccess_pt.c |3 ++ drivers/s390/block/dasd_eckd.c |2 ++ 14 files changed, 87 insertions(+), 88 deletions(-) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 314fced..5877e71 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -101,7 +101,7 @@ config S390 select GENERIC_CPU_DEVICES if !SMP select GENERIC_FIND_FIRST_BIT select GENERIC_SMP_IDLE_THREAD - select GENERIC_TIME_VSYSCALL_OLD + select GENERIC_TIME_VSYSCALL select HAVE_ALIGNED_STRUCT_PAGE if SLUB select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 select HAVE_ARCH_SECCOMP_FILTER diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h index 316c850..114258e 100644 --- a/arch/s390/include/asm/page.h +++ b/arch/s390/include/asm/page.h @@ -48,33 +48,21 @@ static inline void clear_page(void *page) : "memory", "cc"); } +/* + * copy_page uses the mvcl instruction with 0xb0 padding byte in order to + * bypass caches when copying a page. Especially when copying huge pages + * this keeps L1 and L2 data caches alive. + */ static inline void copy_page(void *to, void *from) { - if (MACHINE_HAS_MVPG) { - register unsigned long reg0 asm ("0") = 0; - asm volatile( - " mvpg%0,%1" - : : "a" (to), "a" (from), "d" (reg0) - : "memory", "cc"); - } else - asm volatile( - " mvc 0(256,%0),0(%1)\n" - " mvc 256(256,%0),256(%1)\n" - " mvc 512(256,%0),512(%1)\n" - " mvc 768(256,%0),768(%1)\n" - " mvc 1024(256,%0),1024(%1)\n" - " mvc 1280(256,%0),1280(%1)\n" - " mvc 1536(256,%0),1536(%1)\n" - " mvc 1792(256,%0),1792(%1)\n" - " mvc 2048(256,%0),2048(%1)\n" - " mvc 2304(256,%0),2304(%1)\n" - " mvc 2560(256,%0),2560(%1)\n" - " mvc 2816(256,%0),2816(%1)\n" - " mvc 3072(256,%0),3072(%1)\n" - " mvc 3328(256,%0),3328(%1)\n" - " mvc 3584(256,%0),3584(%1)\n" - " mvc 3840(256,%0),3840(%1)\n" - : : "a" (to), "a" (from) : "memory"); + register void *reg2 asm ("2") = to; + register unsigned long reg3 asm ("3") = 0x1000; + register void *reg4 asm ("4") = from; + register unsigned long reg5 asm ("5") = 0xb0001000; + asm volatile( + " mvcl2,4" + : "+d" (reg2), "+d" (reg3), "+d" (reg4), "+d" (reg5) + : : "memory", "cc"); } #define clear_user_page(page, vaddr, pg) clear_page(page) diff --git a/arch/s390/include/asm/vdso.h b/arch/s390/include/asm/vdso.h index a73eb2e..bc9746a 100644 --- a/arch/s390/include/asm/vdso.h +++ b/arch/s390/include/asm/vdso.h @@ -26,8 +26,9 @@ struct vdso_data { __u64 wtom_clock_nsec; /* 0x28 */ __u32 tz_minuteswest; /* Minutes west of Greenwich0x30 */ __u32 tz_dsttime; /* Type of dst
Re: [PATCH v6 4/6] gpio: davinci: add OF support
On Tue, Nov 26, 2013 at 6:12 PM, Sekhar Nori wrote: > On Tuesday 26 November 2013 06:03 PM, Grygorii Strashko wrote: >> Actually, the same was proposed by Linus, but we've tried avoid such huge >> rework - >> by switching to one irq_domain per all banks for example. > > I didn't really read that proposal from Linus so if two people > independently suggested the same thing, there must be something worth > considering there :) >From a GPIO POV it's not such a big deal really, this approach is fine and the important thing is that we progress toward a more standard driver... it's more a question for the DT people IMO. I really like the current patch set. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v6 3/6] gpio: davinci: remove unused variable intc_irq_num
On Thu, Nov 21, 2013 at 7:15 PM, Prabhakar Lad wrote: > From: "Lad, Prabhakar" > > As the davinci-gpio driver is migrated to use irqdomain > there is no need to pass the irq base for the gpio driver. > This patch removes this variable from davinci_gpio_platform_data > and also the refrences from the machine file. > > Signed-off-by: Lad, Prabhakar Acked-by: Linus Walleij *Very* nice patch! Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] include/linux/kernel.h: Make might_fault to be a nop for !MMU
No fault if !MUU, thus make might_fault to be a nop for !MMU. This fixes below build error if !CONFIG_MMU && (CONFIG_PROVE_LOCKING=y || CONFIG_DEBUG_ATOMIC_SLEEP=y): arch/arm/kernel/built-in.o: In function `arch_ptrace': arch/arm/kernel/ptrace.c:852: undefined reference to `might_fault' arch/arm/kernel/built-in.o: In function `restore_sigframe': arch/arm/kernel/signal.c:173: undefined reference to `might_fault' arch/arm/kernel/signal.c:174: undefined reference to `might_fault' arch/arm/kernel/signal.c:175: undefined reference to `might_fault' arch/arm/kernel/signal.c:176: undefined reference to `might_fault' arch/arm/kernel/built-in.o:arch/arm/kernel/signal.c:177: more undefined references to `might_fault' follow make: *** [vmlinux] Error 1 Signed-off-by: Axel Lin Cc: Michael S. Tsirkin Cc: Peter Zijlstra --- include/linux/kernel.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 2ac0277..8b0ad48 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -193,7 +193,8 @@ extern int _cond_resched(void); (__x < 0) ? -__x : __x; \ }) -#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP) +#if defined(CONFIG_MMU) && \ + (defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP)) void might_fault(void); #else static inline void might_fault(void) { } -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: page fault deadlock
On Fri, Nov 29, 2013 at 3:17 AM, Greg KH wrote: > On Thu, Nov 28, 2013 at 03:28:39PM +0800, Xiaotian Feng wrote: >> On Thu, Nov 28, 2013 at 12:11 PM, Greg KH wrote: >> > On Thu, Nov 28, 2013 at 11:25:32AM +0800, Xiaotian Feng wrote: >> >> Hi, >> >> >> >> When I upgrade to latest kernel, I found my system hang there. It >> >> is reproducible on my virtualbox, and I found each time I mounted my >> >> RAID6 partition and tried to vi or build kernel, my whole system >> >> lockup very soon. >> >> >> >> After turning on lockdep, I found following lockdep warning: >> >> >> >> [ 27.848462] >> >> [ 27.848471] == >> >> [ 27.848477] [ INFO: possible circular locking dependency detected ] >> >> [ 27.848484] 3.13.0-rc1+ #1 Tainted: GF W >> >> [ 27.848490] --- >> >> [ 27.848496] Xorg/1268 is trying to acquire lock: >> >> [ 27.848501] (>mutex){+.+.+.}, at: [] >> >> sysfs_bin_mmap+0x4f/0x120 >> >> [ 27.848516] >> >> [ 27.848516] but task is already holding lock: >> >> [ 27.848521] (>mmap_sem){++}, at: [] >> >> vm_mmap_pgoff+0x6f/0xc0 >> >> [ 27.848534] >> >> [ 27.848534] which lock already depends on the new lock. >> >> [ 27.848534] >> >> [ 27.848541] >> >> [ 27.848541] the existing dependency chain (in reverse order) is: >> >> [ 27.848547] >> >> [ 27.848547] -> #2 (>mmap_sem){++}: >> >> [ 27.848556][] lock_acquire+0xb0/0x160 >> >> [ 27.848564][] might_fault+0x8c/0xb0 >> >> [ 27.848572][] md_ioctl+0xa78/0x19b0 >> >> [ 27.848580][] blkdev_ioctl+0x234/0x840 >> >> [ 27.848588][] block_ioctl+0x41/0x50 >> >> [ 27.848597][] do_vfs_ioctl+0x300/0x520 >> >> [ 27.848605][] SyS_ioctl+0x81/0xa0 >> >> [ 27.848613][] tracesys+0xe1/0xe6 >> >> [ 27.848622] >> >> [ 27.848622] -> #1 (>reconfig_mutex){+.+.+.}: >> >> [ 27.848630][] lock_acquire+0xb0/0x160 >> >> [ 27.848637][] >> >> mutex_lock_interruptible_nested+0x78/0x610 >> >> [ 27.848646][] rdev_attr_show+0x40/0x90 >> >> [ 27.848654][] sysfs_seq_show+0xda/0x170 >> >> [ 27.848662][] seq_read+0x164/0x3e0 >> >> [ 27.848671][] vfs_read+0x95/0x160 >> >> [ 27.848680][] SyS_read+0x49/0xa0 >> >> [ 27.848687][] tracesys+0xe1/0xe6 >> >> [ 27.848695] >> >> [ 27.848695] -> #0 (>mutex){+.+.+.}: >> >> [ 27.848703][] __lock_acquire+0x1587/0x1ca0 >> >> [ 27.848711][] lock_acquire+0xb0/0x160 >> >> [ 27.848718][] mutex_lock_nested+0x68/0x510 >> >> [ 27.848725][] sysfs_bin_mmap+0x4f/0x120 >> >> [ 27.848732][] mmap_region+0x3ed/0x5d0 >> >> [ 27.848741][] do_mmap_pgoff+0x34e/0x3d0 >> >> [ 27.848748][] vm_mmap_pgoff+0x90/0xc0 >> >> [ 27.848755][] SyS_mmap_pgoff+0x1d5/0x270 >> >> [ 27.848763][] SyS_mmap+0x22/0x30 >> >> [ 27.848771][] tracesys+0xe1/0xe6 >> >> [ 27.848778] >> >> [ 27.848778] other info that might help us debug this: >> >> [ 27.848778] >> >> [ 27.848785] Chain exists of: >> >> [ 27.848785] >mutex --> >reconfig_mutex --> >mmap_sem >> >> [ 27.848785] >> >> [ 27.848795] Possible unsafe locking scenario: >> >> [ 27.848795] >> >> [ 27.848800]CPU0CPU1 >> >> [ 27.848805] >> >> [ 27.848810] lock(>mmap_sem); >> >> [ 27.848817] >> >> lock(>reconfig_mutex); >> >> [ 27.848824]lock(>mmap_sem); >> >> [ 27.848830] lock(>mutex); >> >> [ 27.848837] >> >> [ 27.848837] *** DEADLOCK *** >> >> [ 27.848837] >> >> [ 27.848844] 1 lock held by Xorg/1268: >> >> [ 27.848849] #0: (>mmap_sem){++}, at: [] >> >> vm_mmap_pgoff+0x6f/0xc0 >> >> [ 27.848861] >> >> [ 27.848861] stack backtrace: >> >> [ 27.848868] CPU: 1 PID: 1268 Comm: Xorg Tainted: GF W >> >> 3.13.0-rc1+ #1 >> >> [ 27.848873] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS >> >> VirtualBox 12/01/2006 >> >> [ 27.848879] 822daa00 8800d0371bc8 817725f7 >> >> 822cbdc0 >> >> [ 27.848901] 8800d0371c08 8176d9eb 8800d0371c60 >> >> 880115b42a78 >> >> [ 27.848909] 880115b42a78 880115b422a0 >> >> 0001 >> >> [ 27.848918] Call Trace: >> >> [ 27.848930] [] dump_stack+0x4e/0x7a >> >> [ 27.848942] [] print_circular_bug+0x1f9/0x208 >> >> [ 27.848952] [] __lock_acquire+0x1587/0x1ca0 >> >> [ 27.848964] [] ? print_context_stack+0x8f/0x100 >> >> [ 27.848975] [] lock_acquire+0xb0/0x160 >> >> [ 27.848986] [] ? sysfs_bin_mmap+0x4f/0x120 >> >> [ 27.848996] [] ? sysfs_bin_mmap+0x4f/0x120 >> >> [ 27.849007] [] mutex_lock_nested+0x68/0x510 >> >> [ 27.849016] [] ? sysfs_bin_mmap+0x4f/0x120 >> >> [ 27.849027] [] ? kmemleak_alloc+0x4e/0xb0 >>
Re: still running into WARNING: CPU: at fs/ext4/inode.c:230 ext4_evict_inode+0x4a6/0x4e0
On Wed 16-10-13 20:38:07, Jan Kara wrote: > On Wed 16-10-13 08:56:07, Davidlohr Bueso wrote: > > On Wed, 2013-10-16 at 14:50 +0200, Jan Kara wrote: > > > On Tue 15-10-13 19:02:04, Davidlohr Bueso wrote: > > > > Hello Jan, > > > > > > > > Just wanted to let you know I hit this[1] again on Linus' latest. The > > > > setup/workload is *identical* to the reported one a few months ago. > > > > > > > > [1] https://lkml.org/lkml/2013/8/1/532 > > > > > > > > Here's the complete output, I hope it helps... > > > Thanks for the headup. Last time I wasn't able to reproduce this and > > > eventually forgot about the problem. Can I send you a debug patch and you > > > would run a kernel with it? Thanks. > > > > Sure. > OK, attached is the debug patch. Please apply it and send dmesg when the > problem reproduces. Also please attach System.map so that I can map the > 'created at' addresses to symbols. Thanks. Ping? Any luck with the debug patch? Honza > From 1411960edc40abe5db5344fed04bf6370dc432e8 Mon Sep 17 00:00:00 2001 > From: Jan Kara > Date: Wed, 16 Oct 2013 20:32:58 +0200 > Subject: [PATCH] ext4: Debug outstanding io_ends > > Signed-off-by: Jan Kara > --- > fs/ext4/ext4.h| 3 +++ > fs/ext4/inode.c | 24 ++-- > fs/ext4/page-io.c | 11 +++ > 3 files changed, 36 insertions(+), 2 deletions(-) > > diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h > index af815ea9d7cc..82333b4ba7bf 100644 > --- a/fs/ext4/ext4.h > +++ b/fs/ext4/ext4.h > @@ -187,6 +187,7 @@ struct ext4_map_blocks { > */ > typedef struct ext4_io_end { > struct list_headlist; /* per-file finished IO list */ > + struct list_headfull_list; > handle_t*handle;/* handle reserved for extent >* conversion */ > struct inode*inode; /* file being written to */ > @@ -196,6 +197,7 @@ typedef struct ext4_io_end { > loff_t offset; /* offset in the file */ > ssize_t size; /* size of the extent */ > atomic_tcount; /* reference counter */ > + unsigned long created_at; > } ext4_io_end_t; > > struct ext4_io_submit { > @@ -907,6 +909,7 @@ struct ext4_inode_info { >* transaction reserved >*/ > struct list_head i_rsv_conversion_list; > + struct list_head i_ioend_list; > /* >* Completed IOs that need unwritten extents handling and don't have >* transaction reserved > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c > index e7e5b3d8f002..c053e977caa1 100644 > --- a/fs/ext4/inode.c > +++ b/fs/ext4/inode.c > @@ -176,6 +176,20 @@ int ext4_truncate_restart_trans(handle_t *handle, struct > inode *inode, > return ret; > } > > +static void dump_ioends(struct inode *inode, struct list_head *head) > +{ > + ext4_io_end_t *io; > + unsigned long flags; > + > + spin_lock_irqsave(_I(inode)->i_completed_io_lock, flags); > + list_for_each_entry(io, head, full_list) { > + printk("ioend %p, created at 0x%lx: handle=%p, bio=%p, flag=%u, > offset=%lu, len=%u, count=%d\n", > + io, io->created_at, io->handle, io->bio, io->flag, > (unsigned long)io->offset, > + (unsigned)io->size, (int)atomic_read(>count)); > + } > + spin_unlock_irqrestore(_I(inode)->i_completed_io_lock, flags); > +} > + > /* > * Called at the last iput() if i_nlink is zero. > */ > @@ -216,7 +230,10 @@ void ext4_evict_inode(struct inode *inode) > } > truncate_inode_pages(>i_data, 0); > > - WARN_ON(atomic_read(_I(inode)->i_ioend_count)); > + if (WARN_ON(atomic_read(_I(inode)->i_ioend_count))) { > + printk("ioend_count=%d, i_unwritten=%d\n", > (int)atomic_read(_I(inode)->i_ioend_count), > (int)atomic_read(_I(inode)->i_unwritten)); > + dump_ioends(inode, _I(inode)->i_ioend_list); > + } > goto no_delete; > } > > @@ -227,7 +244,10 @@ void ext4_evict_inode(struct inode *inode) > ext4_begin_ordered_truncate(inode, 0); > truncate_inode_pages(>i_data, 0); > > - WARN_ON(atomic_read(_I(inode)->i_ioend_count)); > + if (WARN_ON(atomic_read(_I(inode)->i_ioend_count))) { > + printk("ioend_count=%d, i_unwritten=%d\n", > (int)atomic_read(_I(inode)->i_ioend_count), > (int)atomic_read(_I(inode)->i_unwritten)); > + dump_ioends(inode, _I(inode)->i_ioend_list); > + } > if (is_bad_inode(inode)) > goto no_delete; > > diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c > index d488f80ee32d..8cce9abf9d31 100644 > --- a/fs/ext4/page-io.c > +++ b/fs/ext4/page-io.c > @@ -110,6 +110,7 @@ static void ext4_finish_bio(struct bio *bio) > static void
[PATCH 3/3 v2] usb: chipidea: hw_phymode_configure moved before ci_usb_phy_init
usb: chipidea: hw_phymode_configure moved before ci_usb_phy_init hw_phymode_configure configures the PORTSC registers and allow the following phy_inits to operate on the right parameters. This fix a problem where the UPLI (ISP1504) could not detected, because the Viewport was not available and returns 0's only. Signed-off-by: Chris Ruehl Acked-by: Peter Chen --- drivers/usb/chipidea/core.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 1a6010e..f915538 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -566,6 +566,8 @@ static int ci_hdrc_probe(struct platform_device *pdev) return -ENODEV; } + hw_phymode_configure(ci); + ret = ci_usb_phy_init(ci); if (ret) { dev_err(dev, "unable to init phy: %d\n", ret); @@ -583,8 +585,6 @@ static int ci_hdrc_probe(struct platform_device *pdev) ci_get_otg_capable(ci); - hw_phymode_configure(ci); - dr_mode = ci->platdata->dr_mode; /* initialize role(s) before the interrupt is requested */ if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) { -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/3 v2] usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag
usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag * init the sts flag to 0 (missed) * set the sts flag only if not 0 Signed-off-by: Chris Ruehl --- drivers/usb/chipidea/core.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 5075407..1a6010e 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -245,6 +245,8 @@ static void hw_phymode_configure(struct ci_hdrc *ci) { u32 portsc, lpm, sts = 0; switch (ci->platdata->phy_mode) { case USBPHY_INTERFACE_MODE_UTMI: portsc = PORTSC_PTS(PTS_UTMI); @@ -273,10 +275,12 @@ static void hw_phymode_configure(struct ci_hdrc *ci) if (ci->hw_bank.lpm) { hw_write(ci, OP_DEVLC, DEVLC_PTS(7) | DEVLC_PTW, lpm); - hw_write(ci, OP_DEVLC, DEVLC_STS, sts); + if (sts) + hw_write(ci, OP_DEVLC, DEVLC_STS, sts); } else { hw_write(ci, OP_PORTSC, PORTSC_PTS(7) | PORTSC_PTW, portsc); - hw_write(ci, OP_PORTSC, PORTSC_STS, sts); + if ( sts ) + hw_write(ci, OP_PORTSC, PORTSC_STS, sts); } } -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3 v2] usb: chipidea: Reallocate regmap only if lpm is detected
usb: chipidea: Reallocate regmap only if lpm is detected The regmap only needs to reallocate if the hw_read on the CAP register shows lpm is used. Therefore the if() statement check the change. Signed-off-by: Chris Ruehl --- drivers/usb/chipidea/core.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 5d8981c..5075407 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -208,7 +208,8 @@ static int hw_device_init(struct ci_hdrc *ci, void __iomem *base) reg = hw_read(ci, CAP_HCCPARAMS, HCCPARAMS_LEN) >> __ffs(HCCPARAMS_LEN); ci->hw_bank.lpm = reg; - hw_alloc_regmap(ci, !!reg); + if (reg) + hw_alloc_regmap(ci, !!reg); ci->hw_bank.size = ci->hw_bank.op - ci->hw_bank.abs; ci->hw_bank.size += OP_LAST; ci->hw_bank.size /= sizeof(u32); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/6][v3] phylib: Support attaching to generic 10g driver
From: Andy Fleming phy_attach_direct() may now attach to a generic 10G driver. It can also be used exactly as phy_connect_direct(), which will be useful when using of_mdio, as phy_connect (and therefore of_phy_connect) start the PHY state machine, which is currently irrelevant for 10G PHYs. Signed-off-by: Andy Fleming Signed-off-by: Shaohui Xie Acked-by: Florian Fainelli --- v3 changes: use constant indices. drivers/net/phy/phy_device.c | 20 include/linux/phy.h | 2 ++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 79142de..7fb9935 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -67,9 +67,6 @@ extern void mdio_bus_exit(void); static LIST_HEAD(phy_fixup_list); static DEFINE_MUTEX(phy_fixup_lock); -static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, -u32 flags, phy_interface_t interface); - /* * Creates a new phy_fixup and adds it to the list * @bus_id: A string which matches phydev->dev.bus_id (or PHY_ANY_ID) @@ -527,12 +524,12 @@ int phy_init_hw(struct phy_device *phydev) * * Description: Called by drivers to attach to a particular PHY * device. The phy_device is found, and properly hooked up - * to the phy_driver. If no driver is attached, then the - * genphy_driver is used. The phy_device is given a ptr to + * to the phy_driver. If no driver is attached, then a + * generic driver is used. The phy_device is given a ptr to * the attaching device, and given a callback for link status * change. The phy_device is returned to the attaching driver. */ -static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, +int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, u32 flags, phy_interface_t interface) { struct device *d = >dev; @@ -541,12 +538,10 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, /* Assume that if there is no driver, that it doesn't * exist, and we should use the genphy driver. */ if (NULL == d->driver) { - if (phydev->is_c45) { - pr_err("No driver for phy %x\n", phydev->phy_id); - return -ENODEV; - } - - d->driver = _driver[GENPHY_DRV_1G].driver; + if (phydev->is_c45) + d->driver = _driver[GENPHY_DRV_10G].driver; + else + d->driver = _driver[GENPHY_DRV_1G].driver; err = d->driver->probe(d); if (err >= 0) @@ -579,6 +574,7 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, return err; } +EXPORT_SYMBOL(phy_attach_direct); /** * phy_attach - attach a network device to a particular PHY device diff --git a/include/linux/phy.h b/include/linux/phy.h index 9144061..61dcafd 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -581,6 +581,8 @@ int phy_init_hw(struct phy_device *phydev); struct phy_device * phy_attach(struct net_device *dev, const char *bus_id, phy_interface_t interface); struct phy_device *phy_find_first(struct mii_bus *bus); +int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, +u32 flags, phy_interface_t interface); int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, void (*handler)(struct net_device *), phy_interface_t interface); -- 1.8.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 6/6][v3] phylib: Add of_phy_attach
From: Andy Fleming 10G PHYs don't currently support running the state machine, which is implicitly setup via of_phy_connect(). Therefore, it is necessary to implement an OF version of phy_attach(), which does everything except start the state machine. Signed-off-by: Andy Fleming Signed-off-by: Shaohui Xie Acked-by: Florian Fainelli --- v3: no changes. drivers/of/of_mdio.c| 19 +++ include/linux/of_mdio.h | 9 + 2 files changed, 28 insertions(+) diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index d5a57a9..21076ac 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -247,3 +247,22 @@ struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, return IS_ERR(phy) ? NULL : phy; } EXPORT_SYMBOL(of_phy_connect_fixed_link); + +/** + * of_phy_attach - Attach to a PHY without starting the state machine + * @dev: pointer to net_device claiming the phy + * @phy_np: Node pointer for the PHY + * @flags: flags to pass to the PHY + * @iface: PHY data interface type + */ +struct phy_device *of_phy_attach(struct net_device *dev, + struct device_node *phy_np, u32 flags, phy_interface_t iface) +{ + struct phy_device *phy = of_phy_find_device(phy_np); + + if (!phy) + return NULL; + + return phy_attach_direct(dev, phy, flags, iface) ? NULL : phy; +} +EXPORT_SYMBOL(of_phy_attach); diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h index 8163107..108583a 100644 --- a/include/linux/of_mdio.h +++ b/include/linux/of_mdio.h @@ -19,6 +19,9 @@ extern struct phy_device *of_phy_connect(struct net_device *dev, struct device_node *phy_np, void (*hndlr)(struct net_device *), u32 flags, phy_interface_t iface); +struct phy_device *of_phy_attach(struct net_device *dev, +struct device_node *phy_np, u32 flags, +phy_interface_t iface); extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, void (*hndlr)(struct net_device *), phy_interface_t iface); @@ -44,6 +47,12 @@ static inline struct phy_device *of_phy_connect(struct net_device *dev, return NULL; } +static inline struct phy_device *of_phy_attach(struct net_device *dev, + struct device_node *phy_np, u32 flags, phy_interface_t iface) +{ + return NULL; +} + static inline struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, void (*hndlr)(struct net_device *), phy_interface_t iface) -- 1.8.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/6][v3] phylib: Add generic 10G driver
From: Andy Fleming Very incomplete, but will allow for binding an ethernet controller to it. Signed-off-by: Andy Fleming Signed-off-by: Shaohui Xie --- v3 changes: splitted from v2 patch 3/5. drivers/net/phy/phy_device.c | 80 1 file changed, 80 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index a5926a6..79142de 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -55,6 +56,7 @@ static void phy_device_release(struct device *dev) enum genphy_driver { GENPHY_DRV_1G, + GENPHY_DRV_10G, GENPHY_DRV_MAX }; @@ -697,6 +699,12 @@ static int genphy_config_advert(struct phy_device *phydev) return changed; } +int gen10g_config_advert(struct phy_device *dev) +{ + return 0; +} +EXPORT_SYMBOL(gen10g_config_advert); + /** * genphy_setup_forced - configures/forces speed/duplex from @phydev * @phydev: target phy_device struct @@ -750,6 +758,11 @@ int genphy_restart_aneg(struct phy_device *phydev) } EXPORT_SYMBOL(genphy_restart_aneg); +int gen10g_restart_aneg(struct phy_device *phydev) +{ + return 0; +} +EXPORT_SYMBOL(gen10g_restart_aneg); /** * genphy_config_aneg - restart auto-negotiation or write BMCR @@ -792,6 +805,12 @@ int genphy_config_aneg(struct phy_device *phydev) } EXPORT_SYMBOL(genphy_config_aneg); +int gen10g_config_aneg(struct phy_device *phydev) +{ + return 0; +} +EXPORT_SYMBOL(gen10g_config_aneg); + /** * genphy_update_link - update link status in @phydev * @phydev: target phy_device struct @@ -921,6 +940,34 @@ int genphy_read_status(struct phy_device *phydev) } EXPORT_SYMBOL(genphy_read_status); +int gen10g_read_status(struct phy_device *phydev) +{ + int devad, reg; + u32 mmd_mask = phydev->c45_ids.devices_in_package; + + phydev->link = 1; + + /* For now just lie and say it's 10G all the time */ + phydev->speed = SPEED_1; + phydev->duplex = DUPLEX_FULL; + + for (devad = 0; mmd_mask; devad++, mmd_mask = mmd_mask >> 1) { + if (!(mmd_mask & 1)) + continue; + + /* Read twice because link state is latched and a +* read moves the current state into the register +*/ + phy_read_mmd(phydev, devad, MDIO_STAT1); + reg = phy_read_mmd(phydev, devad, MDIO_STAT1); + if (reg < 0 || !(reg & MDIO_STAT1_LSTATUS)) + phydev->link = 0; + } + + return 0; +} +EXPORT_SYMBOL(gen10g_read_status); + static int genphy_config_init(struct phy_device *phydev) { int val; @@ -967,6 +1014,16 @@ static int genphy_config_init(struct phy_device *phydev) return 0; } + +static int gen10g_config_init(struct phy_device *phydev) +{ + /* Temporarily just say we support everything */ + phydev->supported = SUPPORTED_1baseT_Full; + phydev->advertising = SUPPORTED_1baseT_Full; + + return 0; +} + int genphy_suspend(struct phy_device *phydev) { int value; @@ -982,6 +1039,12 @@ int genphy_suspend(struct phy_device *phydev) } EXPORT_SYMBOL(genphy_suspend); +int gen10g_suspend(struct phy_device *phydev) +{ + return 0; +} +EXPORT_SYMBOL(gen10g_suspend); + int genphy_resume(struct phy_device *phydev) { int value; @@ -997,6 +1060,12 @@ int genphy_resume(struct phy_device *phydev) } EXPORT_SYMBOL(genphy_resume); +int gen10g_resume(struct phy_device *phydev) +{ + return 0; +} +EXPORT_SYMBOL(gen10g_resume); + /** * phy_probe - probe and init a PHY device * @dev: device to probe and init @@ -1136,6 +1205,17 @@ static struct phy_driver genphy_driver[] = { .suspend= genphy_suspend, .resume = genphy_resume, .driver = {.owner= THIS_MODULE, }, +}, { + .phy_id = 0x, + .phy_id_mask= 0x, + .name = "Generic 10G PHY", + .config_init= gen10g_config_init, + .features = 0, + .config_aneg= gen10g_config_aneg, + .read_status= gen10g_read_status, + .suspend= gen10g_suspend, + .resume = gen10g_resume, + .driver = {.owner = THIS_MODULE, }, } }; static int __init phy_init(void) -- 1.8.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/6] phylib: turn genphy_driver to an array
From: Shaohui Xie Then other generic phy driver such as generic 10g phy driver can join it. Signed-off-by: Shaohui Xie --- Splitted from previous v2 patch 3/5. drivers/net/phy/phy_device.c | 27 +++ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index d6447b3..a5926a6 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -53,7 +53,12 @@ static void phy_device_release(struct device *dev) kfree(to_phy_device(dev)); } -static struct phy_driver genphy_driver; +enum genphy_driver { + GENPHY_DRV_1G, + GENPHY_DRV_MAX +}; + +static struct phy_driver genphy_driver[GENPHY_DRV_MAX]; extern int mdio_bus_init(void); extern void mdio_bus_exit(void); @@ -539,7 +544,7 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, return -ENODEV; } - d->driver = _driver.driver; + d->driver = _driver[GENPHY_DRV_1G].driver; err = d->driver->probe(d); if (err >= 0) @@ -613,6 +618,7 @@ EXPORT_SYMBOL(phy_attach); */ void phy_detach(struct phy_device *phydev) { + int i; phydev->attached_dev->phydev = NULL; phydev->attached_dev = NULL; @@ -620,8 +626,10 @@ void phy_detach(struct phy_device *phydev) * was using the generic driver), we unbind the device * from the generic driver so that there's a chance a * real driver could be loaded */ - if (phydev->dev.driver == _driver.driver) - device_release_driver(>dev); + for (i = 0; i < ARRAY_SIZE(genphy_driver); i++) { + if (phydev->dev.driver == _driver[i].driver) + device_release_driver(>dev); + } } EXPORT_SYMBOL(phy_detach); @@ -1116,7 +1124,8 @@ void phy_drivers_unregister(struct phy_driver *drv, int n) } EXPORT_SYMBOL(phy_drivers_unregister); -static struct phy_driver genphy_driver = { +static struct phy_driver genphy_driver[] = { +{ .phy_id = 0x, .phy_id_mask= 0x, .name = "Generic PHY", @@ -1127,7 +1136,7 @@ static struct phy_driver genphy_driver = { .suspend= genphy_suspend, .resume = genphy_resume, .driver = {.owner= THIS_MODULE, }, -}; +} }; static int __init phy_init(void) { @@ -1137,7 +1146,8 @@ static int __init phy_init(void) if (rc) return rc; - rc = phy_driver_register(_driver); + rc = phy_drivers_register(genphy_driver, + ARRAY_SIZE(genphy_driver)); if (rc) mdio_bus_exit(); @@ -1146,7 +1156,8 @@ static int __init phy_init(void) static void __exit phy_exit(void) { - phy_driver_unregister(_driver); + phy_drivers_unregister(genphy_driver, + ARRAY_SIZE(genphy_driver)); mdio_bus_exit(); } -- 1.8.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/6][v3] phylib: Add Clause 45 read/write functions
From: Andy Fleming Need an extra parameter to read or write Clause 45 PHYs, so need a different API with the extra parameter. Signed-off-by: Andy Fleming Signed-off-by: Shaohui Xie --- v3 changes: add C45 check. include/linux/phy.h | 39 +++ 1 file changed, 39 insertions(+) diff --git a/include/linux/phy.h b/include/linux/phy.h index 48a4dc3..0ff2476 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -498,6 +498,24 @@ static inline int phy_read(struct phy_device *phydev, u32 regnum) } /** + * phy_read_mmd - Convenience function for reading a register + * from an MMD on a given PHY. + * @phydev: The phy_device struct + * @devad: The MMD to read from + * @regnum: The register on the MMD to read + * + * Same rules as for phy_read(); + */ +static inline int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum) +{ + if (!phydev->is_c45) + return -EOPNOTSUPP; + + return mdiobus_read(phydev->bus, phydev->addr, + MII_ADDR_C45 | (devad << 16) | (regnum & 0x)); +} + +/** * phy_write - Convenience function for writing a given PHY register * @phydev: the phy_device struct * @regnum: register number to write @@ -533,6 +551,27 @@ static inline bool phy_is_internal(struct phy_device *phydev) return phydev->is_internal; } +/** + * phy_write_mmd - Convenience function for writing a register + * on an MMD on a given PHY. + * @phydev: The phy_device struct + * @devad: The MMD to read from + * @regnum: The register on the MMD to read + * @val: value to write to @regnum + * + * Same rules as for phy_write(); + */ +static inline int phy_write_mmd(struct phy_device *phydev, int devad, + u32 regnum, u16 val) +{ + if (!phydev->is_c45) + return -EOPNOTSUPP; + + regnum = MII_ADDR_C45 | ((devad & 0x1f) << 16) | (regnum & 0x); + + return mdiobus_write(phydev->bus, phydev->addr, regnum, val); +} + struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, bool is_c45, struct phy_c45_device_ids *c45_ids); struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); -- 1.8.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/6][v3] phylib: introduce PHY_INTERFACE_MODE_XGMII for 10G PHY
From: Shaohui Xie Signed-off-by: Andy Fleming Signed-off-by: Shaohui Xie Acked-by: Florian Fainelli --- v3: no changes. drivers/of/of_net.c | 1 + include/linux/phy.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c index 8f9be2e..a208a45 100644 --- a/drivers/of/of_net.c +++ b/drivers/of/of_net.c @@ -30,6 +30,7 @@ static const char *phy_modes[] = { [PHY_INTERFACE_MODE_RGMII_TXID] = "rgmii-txid", [PHY_INTERFACE_MODE_RTBI] = "rtbi", [PHY_INTERFACE_MODE_SMII] = "smii", + [PHY_INTERFACE_MODE_XGMII] = "xgmii", }; /** diff --git a/include/linux/phy.h b/include/linux/phy.h index fbe334d..9144061 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -66,6 +66,7 @@ typedef enum { PHY_INTERFACE_MODE_RGMII_TXID, PHY_INTERFACE_MODE_RTBI, PHY_INTERFACE_MODE_SMII, + PHY_INTERFACE_MODE_XGMII, } phy_interface_t; -- 1.8.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCHv6 1/4] pwm: Add Freescale FTM PWM driver support
> > +#define FTM_CNTIN_VAL 0x00 > > Do we really need this? > Maybe not, I think that the initial value maybe modified in the future. And this can be more easy to ajust it. > > + period_cycles = fsl_rate_to_cycles(fpc, period_ns); > > + if (period_cycles > 0x) { > > + dev_err(chip->dev, "required PWM period cycles(%lu) overflow " > > + "16-bits counter!\n", period_cycles); > > + return -EINVAL; > > + } > > + > > + duty_cycles = fsl_rate_to_cycles(fpc, duty_ns); > > + if (duty_cycles >= 0x) { > > + dev_err(chip->dev, "required PWM duty cycles(%lu) overflow " > > + "16-bits counter!\n", duty_cycles); > > + return -EINVAL; > > + } > > I'm not sure the error messages are all that useful. A -EINVAL error > code should make it pretty clear what the problem is. > Yes, these could be absent. > > + writel(FTMCnSC_MSB | FTMCnSC_ELSB, fpc->base + FTM_CSC(pwm->hwpwm)); > > + > > + writel(0xF0, fpc->base + FTM_OUTMASK); > > + writel(0x0F, fpc->base + FTM_OUTINIT); > > The purpose of this eludes me. These seem to be global (not specific to > channel pwm->hwpwm) registers, so why are they updated whenever a single > channel is reconfigured? > Well, certainly there has one way to update per channel's configuration about this. I will revise it then. > > + writel(period_cycles + cntin - 1, fpc->base + FTM_MOD); > > + writel(duty_cycles + cntin, fpc->base + FTM_CV(pwm->hwpwm)); > > And these: > > writel(period - 1, fpc->base + FTM_MOD); > writel(duty, fpc->base + FTM_CV(pwm->hwpwm)); > > Although now that I think about it, this seems broken. The period is set > in a global register, so I assume it is valid for all channels. What if > you want to use different periods for individual channels? The way I > read this the last one to be configured will win and change the period > to whatever it wants. Other channels won't even notice. > That's right. And all the 8 channels share the same period settings. > Is there a way to set the period per channel? > Not yet. Only could we do is to set the duty value individually for each channel. So here is a limitation for the cusumers that all the 8 channels' period values should be the same. > > +static int fsl_counter_clock_enable(struct fsl_pwm_chip *fpc) > > +{ > > + int ret; > > + unsigned long reg; > > + > > + if (fpc->counter_clk_enable++) > > + return 0; > > Are you sure this is safe? I think you'll need to use either an atomic > or a mutex to lock this. > Maybe a mutex lock is a good choice. > > + ret = clk_prepare_enable(fpc->counter_clk); > > + if (ret) > > + return ret; > > In case clk_prepare_enable() fails, the counter_clk_enable will need to > be decremented in order to track the state correctly, doesn't it? > Yes, it should be. > > +static int fsl_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) > > +{ > > + struct fsl_pwm_chip *fpc; > > + > > + fpc = to_fsl_chip(chip); > > + > > + fsl_counter_clock_enable(fpc); > > This can fail. Should the error be propagated? > That's better. > > +static void fsl_pwm_disable(struct pwm_chip *chip, struct pwm_device > *pwm) > > +{ > > + struct fsl_pwm_chip *fpc; > > + > > + fpc = to_fsl_chip(chip); > > + > > + fsl_counter_clock_disable(fpc); > > +} > > Same here. Since you can't propagate the error, perhaps an error message > would be appropriate here? > Well, in fsl_counter_clock_disable(fpc); only '0' could be returned, maybe let it a void type value to return is better. Just like: static void fsl_counter_clock_disable(struct fsl_pwm_chip *fpc) {} > Also for the locking above, perhaps a good solution would be to acquire > the lock around the calls to fsl_counter_clock_{enable,disable}() so > that they can safely assume that they are called with the lock held, > which will make their implementation a lot simpler. > > So what you could do is this: > > static int fsl_pwm_enable(struct pwm_chip *chip, struct pwm_device > *pwm) > { > struct fsl_pwm_chip *fpc = to_fsl_chip(chip); > int ret; > > mutex_lock(>lock); > ret = fsl_counter_clock_enable(fpc); > mutex_unlock(>lock); > > return ret; > } > > And analogously for fsl_pwm_disable(). > I will think about this. > > > +static int fsl_pwm_calculate_ps(struct fsl_pwm_chip *fpc) > > +{ > > + unsigned long long sys_rate, counter_rate, ratio; > > + > > + sys_rate = clk_get_rate(fpc->sys_clk); > > + if (!sys_rate) > > + return -EINVAL; > > + > > + counter_rate = clk_get_rate(fpc->counter_clk); > > + if (!counter_rate) { > > + fpc->counter_clk = fpc->sys_clk; > > + fpc->counter_clk_select = VF610_CLK_FTM0; > > + dev_warn(fpc->chip.dev, > > + "the counter source clock is a dummy clock,
Re: [PATCH 20/29] tools lib traceevent: Remove malloc_or_die from plugin_function.c
Hi Jiri, On Thu, 28 Nov 2013 12:33:19 +0100, Jiri Olsa wrote: > Removing malloc_or_die calls from plugin_function.c, > replacing them with standard malloc and error path. > > Suggested-by: Namhyung Kim > Signed-off-by: Jiri Olsa > Cc: Corey Ashford > Cc: Frederic Weisbecker > Cc: Ingo Molnar > Cc: Namhyung Kim > Cc: Paul Mackerras > Cc: Peter Zijlstra > Cc: Arnaldo Carvalho de Melo > Cc: Steven Rostedt > Cc: David Ahern > --- > tools/lib/traceevent/plugin_function.c | 15 +-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/tools/lib/traceevent/plugin_function.c > b/tools/lib/traceevent/plugin_function.c > index 87acf9c..328d17d 100644 > --- a/tools/lib/traceevent/plugin_function.c > +++ b/tools/lib/traceevent/plugin_function.c > @@ -44,10 +44,16 @@ static void add_child(struct func_stack *stack, const > char *child, int pos) > free(stack->stack[pos]); > else { > if (!stack->stack) > - stack->stack = malloc_or_die(sizeof(char *) * STK_BLK); > + stack->stack = malloc(sizeof(char *) * STK_BLK); > else > stack->stack = realloc(stack->stack, sizeof(char *) * > (stack->size + STK_BLK)); I think single realloc() can handle both cases. And this code has a problem that it overwrites stack->stack to NULL in case of error so that we cannot point original region anymore. You'd better to use a temp variable IMHO. > + > + if (!stack->stack) { > + warning("could not allocate plugin memory\n"); > + return; > + } > + > for (i = stack->size; i < stack->size + STK_BLK; i++) > stack->stack[i] = NULL; > stack->size += STK_BLK; > @@ -67,7 +73,12 @@ static int add_and_get_index(const char *parent, const > char *child, int cpu) > if (fstack) > fstack = realloc(fstack, sizeof(*fstack) * (cpu + 1)); > else > - fstack = malloc_or_die(sizeof(*fstack) * (cpu + 1)); > + fstack = malloc(sizeof(*fstack) * (cpu + 1)); Ditto. Thanks, Namhyung > + > + if (!fstack) { > + warning("could not allocate plugin memory\n"); > + return 0; > + } > > /* Account for holes in the cpu count */ > for (i = cpus + 1; i <= cpu; i++) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Q: use vlan in container
On 2013/11/29 13:05, Serge Hallyn wrote: > Quoting Libo Chen (clbchenlibo.c...@huawei.com): >> Hello LXC experts, >> >> I meet a problem. When using vlan as network device in suse11 system >> container, >> I can not use halt to stop this container. It hung on "eth0 is still used >> from interfaces eth0" in cycle. >> >> The config file: >> >> lxc.network.type = vlan >> lxc.network.flags = up >> lxc.network.link = eth0 >> lxc.network.name = eth0 >> lxc.network.vlan.id = 1301 >> lxc.network.ipv4 = 128.5.131.100/24 >> >> >> The reason is in the shell command /sbin/ifdown, see below: >> >> ## >> # Shut down depending interfaces >> # >> # Check if there are interfaces which depend on this interface. If yes these >> # have to be shut down first. >> # For example these might be bonding or vlan interfaces. Note that we don't >> # catch all types of depending interfaces currently. See function >> # 'get_depending_ifaces' in file 'functions' for details. >> # >> test "$SCRIPTNAME" = ifdown && DEP_IFACES=`get_depending_ifaces $INTERFACE` >> if [ "$?" = 0 -a "$NODEPS" != yes ] ; then >> message "`printf "%-9s is still used from interfaces %s" \ >> $INTERFACE "$DEP_IFACES"`" >> for DI in $DEP_IFACES; do > > Should the proper fix be to fix this script so that it doesn't call > ifdown recursively if $DI = $INTERFACE ? Hi Serge, yes, I had try this way before as below: for DI in $DEP_IFACES; do if [ "$DI" != "$INTERFACE" ] ; then ifdown $DI -o $OPTIONS fi done It works well, but I have no idea it is safe enough and no side effects? Thanks, Libo > >> ifdown $DI -o $OPTIONS >> done >> >> message "`printf "%-9s now going down itself" $INTERFACE`" >> # check if iface is (still) avaliable >> # [bonding master may go down itself >> # while the last slave gets removed] >> if ! is_iface_available $INTERFACE; then >> exit $R_SUCCESS >> fi >> fi >> >> >> $DEP_IFACES is also eth0 in this scene, so ifdown will call ifdown again and >> again. >> >> if we set lxc.network.name = eth1, it will be ok, so can we add a judgment >> to make >> lxc.network.link and lxc.network.name are not equal in lxc-start command. >> >> simple implement like: >> >> if [ lxc.network.type == vlan ] ; then >> if [ lxc.network.link == lxc.network.name ] ; then >> return false >> fi >> fi >> >> >> Is it reasonable? or any other way to achieve this? >> >> >> > > . > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] gpio: better lookup method for platform GPIOs
> On Thu, Nov 28, 2013 at 10:46 AM, Alexandre Courbot > wrote: One missed, but not least, thing. >> +static struct gpiod_lookup_table *gpiod_find_lookup_table(struct device >> *dev) >> { >> const char *dev_id = dev ? dev_name(dev) : NULL; >> - struct gpio_desc *desc = ERR_PTR(-ENODEV); >> - unsigned int match, best = 0; >> - struct gpiod_lookup *p; >> + struct gpiod_lookup_table *table; >> >> mutex_lock(_lookup_lock); >> >> - list_for_each_entry(p, _lookup_list, list) { >> - match = 0; >> + list_for_each_entry(table, _lookup_list, list) { [] >> + if (dev_id != table->dev_id) >> + continue; >> >> - match += 2; >> - } >> + return table; > > What about > > if (dev_id == table->dev_id) > return table; > > ? And unlock mutex, of course! It seems you missed this in the first place. > >> + } >> >> - if (p->con_id) { >> - if (!con_id || strcmp(p->con_id, con_id)) >> - continue; >> + mutex_unlock(_lookup_lock); >> >> - match += 1; >> - } >> + return NULL; >> +} -- With Best Regards, Andy Shevchenko -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH] ath6kl: sdio: fix system panic when doing wifi stress test
> -Original Message- > From: Kalle Valo [mailto:kv...@qca.qualcomm.com] > Sent: Tuesday, November 26, 2013 6:40 PM > To: Liu Hui-R64343 > Cc: linux-arm-ker...@lists.infradead.org; linvi...@tuxdriver.com; linux- > wirel...@vger.kernel.org; net...@vger.kernel.org; linux- > ker...@vger.kernel.org; ath6kl-de...@qca.qualcomm.com > Subject: Re: [PATCH] ath6kl: sdio: fix system panic when doing wifi > stress test > > Hi Jason, > > Jason Liu writes: > > > When did the wifi iperf test, meet one following kernel panic: > > command: iperf -c $TARGET_IP -i 5 -t 50 -w 1M > > > > Unable to handle kernel paging request at virtual address 1a48 pgd > > = 80004000 [1a48] *pgd= Internal error: Oops: 805 [#1] SMP > > ARM > > [...] > > > The kernel panic is caused by the sg_buf is not set correctly with the > > following code when compiled with Yocto GCC 4.8.1: > > > > drivers/net/wireless/ath/ath6kl/hif.h: > > struct hif_scatter_req { > > struct list_head list; > > /* address for the read/write operation */ > > u32 addr; > > ... > > > > /* bounce buffer for upper layers to copy to/from */ > > u8 *virt_dma_buf; > > > > struct hif_scatter_item scat_list[1]; > > > > u32 scat_q_depth; > > }; > > > > (Note: the scat_req.scat_list[] will dynamiclly grow with run-time) > > There's actually a major bug right there, scat_list can corrupt > scat_q_depth. > > > The GCC 4.8.1 compiler will not do the for-loop till scat_entries, > > instead, it only run one round loop. This may be caused by that the > > GCC 4.8.1 thought that the scat_list only have one item and then no > > need to do full iteration, but this is simply wrong by looking at the > > assebly code. This will cause the sg buffer not get set when > scat_entries > 1 and thus lead to kernel panic. > > > > This patch is a workaround to the GCC 4.8.1 complier issue by passing > > the entry address of the scat_req->scat_list to the for-loop and > > interate it, then, GCC 4.8.1 will do the full for-loop correctly. > > (Note: This issue not observed with GCC 4.7.2, only found on the GCC > > 4.8.1) > > > > This patch does not change any function logic and no any performance > downgrade. > > [...] > > > + scat_list = _req->scat_list[0]; > > + > > /* assemble SG list */ > > - for (i = 0; i < scat_req->scat_entries; i++, sg++) { > > + for (i = 0; i < scat_req->scat_entries; i++, sg++, scat_list++) { > > ath6kl_dbg(ATH6KL_DBG_SCATTER, "%d: addr:0x%p, len:%d\n", > > - i, scat_req->scat_list[i].buf, > > - scat_req->scat_list[i].len); > > + i, scat_list->buf, scat_list->len); > > > > - sg_set_buf(sg, scat_req->scat_list[i].buf, > > - scat_req->scat_list[i].len); > > + sg_set_buf(sg, scat_list->buf, scat_list->len); > > } > > Working around the problem by adding a temporary variable makes me a bit > worried, I would rather fix the root cause. Is the root cause by that we > define the field with scat_list[1]? Yes, this is what I assumed. > > Does the patch below help? It would also fix the corruption with > scat_q_depth. Please note that I have only compile tested it. And I might > have also missed something important, so please review it carefully. Yes, Firstly, I have looked at the asm code and the compiler(gcc 4.8.1) works correctly after applying the following patch. Secondly, I have tested the patch with compiler(gcc 4.8.1) on the real HW, and it works fine too. Without the patch, the kernel crash will happen 100%. Thus, for the patch: Acked-by: Jason Liu Tested-by: Jason Liu Jason Liu > > --- a/drivers/net/wireless/ath/ath6kl/hif.h > +++ b/drivers/net/wireless/ath/ath6kl/hif.h > @@ -197,9 +197,9 @@ struct hif_scatter_req { > /* bounce buffer for upper layers to copy to/from */ > u8 *virt_dma_buf; > > - struct hif_scatter_item scat_list[1]; > - > u32 scat_q_depth; > + > + struct hif_scatter_item scat_list[0]; > }; > > struct ath6kl_irq_proc_registers { > diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c > b/drivers/net/wireless/ath/ath6kl/sdio.c > index 7126bdd..6bf15a3 100644 > --- a/drivers/net/wireless/ath/ath6kl/sdio.c > +++ b/drivers/net/wireless/ath/ath6kl/sdio.c > @@ -348,7 +348,7 @@ static int ath6kl_sdio_alloc_prep_scat_req(struct > ath6kl_sdio *ar_sdio, > int i, scat_req_sz, scat_list_sz, size; > u8 *virt_buf; > > - scat_list_sz = (n_scat_entry - 1) * sizeof(struct hif_scatter_item); > + scat_list_sz = n_scat_entry * sizeof(struct hif_scatter_item); > scat_req_sz = sizeof(*s_req) + scat_list_sz; > > if (!virt_scat) > > > -- > Kalle Valo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCHv6 1/4] pwm: Add Freescale FTM PWM driver support
Hi Thierry, Thanks for your detail comments. > > + switch (fpc->counter_clk_select) { > > + case VF610_CLK_FTM0: > > + reg |= FTMSC_CLKSYS; > > + break; > > + case VF610_CLK_FTM0_FIX_SEL: > > + reg |= FTMSC_CLKFIX; > > + break; > > + case VF610_CLK_FTM0_EXT_SEL: > > + reg |= FTMSC_CLKEXT; > > + break; > > + default: > > + break; > > + } > > + reg |= fpc->clk_ps; > > And another one above this line. > > > + writel(reg, fpc->base + FTM_SC); > > I think with the proper locking in place what you should do is increment > counter_clk_enable only here. That makes avoids having to decrement the > count on error. > > Similarly in fsl_counter_clock_disable() you can postpone decrementing > the count until the very end. > As the other mails we have talked about this that there are 8 channels supported, but they share the same counter clock source. So we need to make sure that when one channel is calling fsl_counter_clock_disable() it shouldn't disable the counter clock if any other channel is still enabled. Similary in fsl_counter clock_enable(). This is why I set counter_clk_enable property here. -- Best Regards, -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] update consumers of MSG_MORE to recognize MSG_SENDPAGE_NOTLAST
On Sun, Nov 24, 2013 at 10:36:28PM -0800, Shawn Landden wrote: > Commit 35f9c09fe (tcp: tcp_sendpages() should call tcp_push() once) > added an internal flag MSG_SENDPAGE_NOTLAST, similar to > MSG_MORE. > > algif_hash, algif_skcipher, and udp used MSG_MORE from tcp_sendpages() > and need to see the new flag as identical to MSG_MORE. > > This fixes sendfile() on AF_ALG. > > v3: also fix udp The UDP bits look fine to me. Greetings, Hannes -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3] cpufreq: exynos: Convert exynos-cpufreq to platform driver
On 28 November 2013 18:12, Lukasz Majewski wrote: > To make the driver multiplatform-friendly, unconditional initialization > in an initcall is replaced with a platform driver probed only if > respective platform device is registered. > > Tested at: Exynos4210 (TRATS) and Exynos4412 (TRATS2) > > Signed-off-by: Lukasz Majewski > Signed-off-by: Tomasz Figa > Signed-off-by: Kyungmin Park Looks good to me. Reviewed-by: Sachin Kamat Tested on Exynos5250 board. Tested-by: Sachin Kamat Btw, Lukasz, can you please review my patch [1] which is similar to your changes done for 4210/4412. [1] http://www.spinics.net/lists/linux-samsung-soc/msg24397.html -- With warm regards, Sachin -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ipv6: fix possible seqlock deadlock in ip6_finish_output2
IPv6 stats are 64 bits and thus are protected with a seqlock. By not disabling bottom-half we could deadlock here if we don't disable bh and a softirq reentrantly updates the same mib. Cc: Eric Dumazet Signed-off-by: Hannes Frederic Sowa --- net/ipv6/ip6_output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 59df872..4acdb63 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -116,8 +116,8 @@ static int ip6_finish_output2(struct sk_buff *skb) } rcu_read_unlock_bh(); - IP6_INC_STATS_BH(dev_net(dst->dev), -ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); + IP6_INC_STATS(dev_net(dst->dev), + ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); kfree_skb(skb); return -EINVAL; } -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Q: use vlan in container
Quoting Libo Chen (clbchenlibo.c...@huawei.com): > Hello LXC experts, > > I meet a problem. When using vlan as network device in suse11 system > container, > I can not use halt to stop this container. It hung on "eth0 is still used > from interfaces eth0" in cycle. > > The config file: > > lxc.network.type = vlan > lxc.network.flags = up > lxc.network.link = eth0 > lxc.network.name = eth0 > lxc.network.vlan.id = 1301 > lxc.network.ipv4 = 128.5.131.100/24 > > > The reason is in the shell command /sbin/ifdown, see below: > > ## > # Shut down depending interfaces > # > # Check if there are interfaces which depend on this interface. If yes these > # have to be shut down first. > # For example these might be bonding or vlan interfaces. Note that we don't > # catch all types of depending interfaces currently. See function > # 'get_depending_ifaces' in file 'functions' for details. > # > test "$SCRIPTNAME" = ifdown && DEP_IFACES=`get_depending_ifaces $INTERFACE` > if [ "$?" = 0 -a "$NODEPS" != yes ] ; then > message "`printf "%-9s is still used from interfaces %s" \ > $INTERFACE "$DEP_IFACES"`" > for DI in $DEP_IFACES; do Should the proper fix be to fix this script so that it doesn't call ifdown recursively if $DI = $INTERFACE ? > ifdown $DI -o $OPTIONS > done > > message "`printf "%-9s now going down itself" $INTERFACE`" > # check if iface is (still) avaliable > # [bonding master may go down itself > # while the last slave gets removed] > if ! is_iface_available $INTERFACE; then > exit $R_SUCCESS > fi > fi > > > $DEP_IFACES is also eth0 in this scene, so ifdown will call ifdown again and > again. > > if we set lxc.network.name = eth1, it will be ok, so can we add a judgment to > make > lxc.network.link and lxc.network.name are not equal in lxc-start command. > > simple implement like: > > if [ lxc.network.type == vlan ] ; then > if [ lxc.network.link == lxc.network.name ] ; then > return false > fi > fi > > > Is it reasonable? or any other way to achieve this? > > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/3] makedumpfile: hugepage filtering for vmcore dump
(2013/11/29 13:23), Atsushi Kumagai wrote: > On 2013/11/29 12:24:45, kexec wrote: >> (2013/11/29 12:02), Atsushi Kumagai wrote: >>> On 2013/11/28 16:50:21, kexec wrote: >> ping, in case you overlooked this... > > Sorry for the delayed response, I prioritize the release of v1.5.5 now. > > Thanks for your advice, check_cyclic_buffer_overrun() should be fixed > as you said. In addition, I'm considering other way to address such case, > that is to bring the number of "overflowed pages" to the next cycle and > exclude them at the top of __exclude_unnecessary_pages() like below: > > /* >* The pages which should be excluded still remain. >*/ > if (remainder >= 1) { > int i; > unsigned long tmp; > for (i = 0; i < remainder; ++i) { > if > (clear_bit_on_2nd_bitmap_for_kernel(pfn + i)) { > pfn_user++; > tmp++; > } > } > pfn += tmp; > remainder -= tmp; > mem_map += (tmp - 1) * SIZE(page); > continue; > } > > If this way works well, then aligning info->buf_size_cyclic will be > unnecessary. > I selected the current implementation of changing cyclic buffer size becuase I thought it was simpler than carrying over remaining filtered pages to next cycle in that there was no need to add extra code in filtering processing. I guess the reason why you think this is better now is how to detect maximum order of huge page is hard in some way, right? >>> >>> The maximum order will be gotten from HUGETLB_PAGE_ORDER or HPAGE_PMD_ORDER, >>> so I don't say it's hard. However, the carrying over method doesn't depend >>> on >>> such kernel symbols, so I think it's robuster. >>> >> >> Then, it's better to remove check_cyclic_buffer_overrun() and rewrite part >> of free page >> filtering in __exclude_unnecessary_pages(). Could you do that too? > > Sure, I'll modify it too. > This is a suggestion from different point of view... In general, data on crash dump can be corrupted. Thus, order contained in a page descriptor can also be corrupted. For example, if the corrupted value were a huge number, wide range of pages after buddy page would be filtered falsely. So, actually we should sanity check data in crash dump before using them for application level feature. I've picked up order contained in page descriptor, so there would be other data used in makedumpfile that are not checked. Unlike diskdump, we no longer need to care about kernel/hardware level data integrity outside of user-land, but we still care about data its own integrity. On the other hand, if we do it, we might face some difficulty, for example, hardness of maintenance or performance bottleneck; it might be the reason why we don't see sanity check in makedumpfile now. -- Thanks. HATAYAMA, Daisuke -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH 2/3] usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag
> > On Friday, November 29, 2013 11:27 AM, Peter Chen wrote: > > > >> * init the sts flag to 0 (missed) > >> * set the sts flag only if not 0 > >> > > does PORTSC_STS bit as 1 or 0 affect your case? > > If not, please remove hw_write(ci, OP_DEVLC, DEVLC_STS, sts), > > since it is useless at current code logic. > > > > Peter > > Peter, > > in the switch statement sts is set to 1 therefore I think its used. > > case USBPHY_INTERFACE_MODE_SERIAL: > portsc = PORTSC_PTS(PTS_SERIAL); > lpm = DEVLC_PTS(PTS_SERIAL); > sts = 1; > break; > > Regards > Chris > > Yes, you are right. It is just not showed at the patch. Would you move the sts = 0 to sts declaration, it can reduce the code line. u32 portsc, lpm, sts = 0; > > > >> Signed-off-by: Chris Ruehl > >> --- > >> drivers/usb/chipidea/core.c |8 ++-- > >> 1 file changed, 6 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c > >> index 5075407..1a6010e 100644 > >> --- a/drivers/usb/chipidea/core.c > >> +++ b/drivers/usb/chipidea/core.c > >> @@ -245,6 +245,8 @@ static void hw_phymode_configure(struct ci_hdrc > *ci) > >> { > >>u32 portsc, lpm, sts; > >> > >> + sts = 0; > >> + > >>switch (ci->platdata->phy_mode) { > >>case USBPHY_INTERFACE_MODE_UTMI: > >>portsc = PORTSC_PTS(PTS_UTMI); > >> @@ -273,10 +275,12 @@ static void hw_phymode_configure(struct ci_hdrc > *ci) > >> > >>if (ci->hw_bank.lpm) { > >>hw_write(ci, OP_DEVLC, DEVLC_PTS(7) | DEVLC_PTW, lpm); > >> - hw_write(ci, OP_DEVLC, DEVLC_STS, sts); > >> + if (sts) > >> + hw_write(ci, OP_DEVLC, DEVLC_STS, sts); > >>} else { > >>hw_write(ci, OP_PORTSC, PORTSC_PTS(7) | PORTSC_PTW, portsc); > >> - hw_write(ci, OP_PORTSC, PORTSC_STS, sts); > >> + if ( sts ) > >> + hw_write(ci, OP_PORTSC, PORTSC_STS, sts); > >>} > >> } > >> > >> -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] ARM: davinci: aemif: get rid of davinci-nand driver dependency on aemif
On Wednesday 27 November 2013 08:01 PM, Ivan Khoronzhuk wrote: > The problem that the set timings code contains the call of Davinci > platform function davinci_aemif_setup_timing() which is not > accessible if kernel is built for another platform like Keystone. > > The Keysone platform is going to use TI AEMIF driver. > If TI AEMIF is used we don't need to set timings and bus width. > It is done by AEMIF driver. > > To get rid of davinci-nand driver dependency on aemif platform code > we moved aemif code to davinci platform. > > The platform AEMIF code (aemif.c) has to be removed once Davinci > will be converted to DT and use ti-aemif.c driver. > > The long device name "davinci_ntosd2_nandflash_device" was renamed > to "ntosd2_nandflash" as requested by Sekhar Nori, because after > adding changes the line is so broken that its almost unreadable. > > Signed-off-by: Ivan Khoronzhuk This patch can be simplified in some places. > --- > v2..v1: > - enabled AEMIF clock > - removed EXPORT_SYMBOL(davinci_aemif_setup) > - renamed ugly name davinci_ntosd2_nandflash_device > > CC: > Sekhar Nori > > arch/arm/mach-davinci/aemif.c | 89 > ++- > arch/arm/mach-davinci/board-da830-evm.c |3 + > arch/arm/mach-davinci/board-da850-evm.c |3 + > arch/arm/mach-davinci/board-dm355-evm.c |5 ++ > arch/arm/mach-davinci/board-dm355-leopard.c |5 ++ > arch/arm/mach-davinci/board-dm365-evm.c |4 + > arch/arm/mach-davinci/board-dm644x-evm.c|5 ++ > arch/arm/mach-davinci/board-dm646x-evm.c|3 + > arch/arm/mach-davinci/board-mityomapl138.c |3 + > arch/arm/mach-davinci/board-neuros-osd2.c | 13 +++- > arch/arm/mach-davinci/devices-tnetv107x.c |3 + > drivers/mtd/nand/davinci_nand.c | 23 -- > include/linux/platform_data/mtd-davinci-aemif.h |5 +- Most of these boards dont really have a timing structure defined. Instead of blindly calling AEMIF setup on all boards, it can be done only on boards that actually need it. > /* > * aemif_calc_rate - calculate timing data. > * @wanted: The cycle time needed in nanoseconds. > @@ -86,7 +98,7 @@ static int aemif_calc_rate(int wanted, unsigned long clk, > int max) > * > * Returns 0 on success, else negative errno. > */ > -int davinci_aemif_setup_timing(struct davinci_aemif_timing *t, > +static int davinci_aemif_setup_timing(struct davinci_aemif_timing *t, passing the clkrate to this function helps avoid a repeated clk_get(). I made these changes locally and here is the updated patch: ---8<--- >From cdea7d6f753db09447fe2232959864ab999fe565 Mon Sep 17 00:00:00 2001 From: Ivan Khoronzhuk Date: Wed, 27 Nov 2013 16:31:34 +0200 Subject: [PATCH 1/1] ARM: davinci: aemif: get rid of davinci-nand driver dependency on aemif The problem that the set timings code contains the call of Davinci platform function davinci_aemif_setup_timing() which is not accessible if kernel is built for another platform like Keystone. The Keysone platform is going to use TI AEMIF driver. If TI AEMIF is used we don't need to set timings and bus width. It is done by AEMIF driver. The TI AEMIF driver cannot be used on all current DaVinci platforms since it is DT-only. To get rid of davinci-nand driver dependency on aemif platform code we moved aemif code to davinci platform. The platform AEMIF code (aemif.c) has to be removed once Davinci will be converted to DT and use ti-aemif.c driver. Signed-off-by: Ivan Khoronzhuk Signed-off-by: Sekhar Nori --- arch/arm/mach-davinci/aemif.c | 106 --- arch/arm/mach-davinci/board-da830-evm.c |3 + arch/arm/mach-davinci/board-da850-evm.c |3 + arch/arm/mach-davinci/board-dm644x-evm.c|5 ++ arch/arm/mach-davinci/board-dm646x-evm.c|3 + drivers/mtd/nand/davinci_nand.c | 23 - include/linux/platform_data/mtd-davinci-aemif.h |5 +- 7 files changed, 112 insertions(+), 36 deletions(-) diff --git a/arch/arm/mach-davinci/aemif.c b/arch/arm/mach-davinci/aemif.c index f091a90..e6dfc58 100644 --- a/arch/arm/mach-davinci/aemif.c +++ b/arch/arm/mach-davinci/aemif.c @@ -15,6 +15,7 @@ #include #include +#include #include /* Timing value configuration */ @@ -43,6 +44,17 @@ WSTROBE(WSTROBE_MAX) | \ WSETUP(WSETUP_MAX)) +static inline unsigned int davinci_aemif_readl(void __iomem *base, int offset) +{ + return readl_relaxed(base + offset); +} + +static inline void davinci_aemif_writel(void __iomem *base, + int offset, unsigned long value) +{ + writel_relaxed(value, base + offset); +} + /* * aemif_calc_rate - calculate timing data. * @wanted: The cycle time needed in nanoseconds. @@ -76,6 +88,7 @@ static int aemif_calc_rate(int wanted, unsigned long clk, int max)
Re: [PATCH 2/3] usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag
On Friday, November 29, 2013 11:27 AM, Peter Chen wrote: * init the sts flag to 0 (missed) * set the sts flag only if not 0 does PORTSC_STS bit as 1 or 0 affect your case? If not, please remove hw_write(ci, OP_DEVLC, DEVLC_STS, sts), since it is useless at current code logic. Peter Peter, in the switch statement sts is set to 1 therefore I think its used. case USBPHY_INTERFACE_MODE_SERIAL: portsc = PORTSC_PTS(PTS_SERIAL); lpm = DEVLC_PTS(PTS_SERIAL); sts = 1; break; Regards Chris Signed-off-by: Chris Ruehl --- drivers/usb/chipidea/core.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 5075407..1a6010e 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -245,6 +245,8 @@ static void hw_phymode_configure(struct ci_hdrc *ci) { u32 portsc, lpm, sts; + sts = 0; + switch (ci->platdata->phy_mode) { case USBPHY_INTERFACE_MODE_UTMI: portsc = PORTSC_PTS(PTS_UTMI); @@ -273,10 +275,12 @@ static void hw_phymode_configure(struct ci_hdrc *ci) if (ci->hw_bank.lpm) { hw_write(ci, OP_DEVLC, DEVLC_PTS(7) | DEVLC_PTW, lpm); - hw_write(ci, OP_DEVLC, DEVLC_STS, sts); + if (sts) + hw_write(ci, OP_DEVLC, DEVLC_STS, sts); } else { hw_write(ci, OP_PORTSC, PORTSC_PTS(7) | PORTSC_PTW, portsc); - hw_write(ci, OP_PORTSC, PORTSC_STS, sts); + if ( sts ) + hw_write(ci, OP_PORTSC, PORTSC_STS, sts); } } -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ARM : unwinder : Prevent data abort due to stack overflow in unwind_exec_insn Signed-off-by: Anurag Aggarwal
Hi Dave, I aplogize for wrong formatting of multiline comments. > I really think this shouldn't be separated out in this way, because it > means the decoder has to be implemented twice, and moving the checks far > away from the code that the checks need to match. I believe that you are right in this case, it requires decoder to be implemented twice. I will seperate the function and correct comments and send a new patch. >Although this appears safe, I wonder whether it just creates additional >ways for the code to be wrong, without providing much optimisation. >(For example, the maximum number of registers that can be read is >not actually TOTAL_REGISTERS.) In this case I believe that for the instructions that can cause data abort are reading at max 13 registers (which is less than TOTAL_REGISTERS) currently this is what I was able to understand from the documentation I could find and t he current code written. So I believe that this condition will provide good optimization and will not create additional ways for the code to go wrong Regards Anurag Aggarwal --- Original Message --- Sender : Dave Martin Date : Nov 29, 2013 01:54 (GMT+05:30) Title : Re: [PATCH] ARM : unwinder : Prevent data abort due to stack overflow in unwind_exec_insn Signed-off-by: Anurag Aggarwal On Thu, Nov 28, 2013 at 03:57:19PM +0530, Anurag Aggarwal wrote: > While executing some unwind instructions stack overflow can cause a data abort > when area beyond stack is not mapped to physical memory. > > To prevent the data abort check whether it is possible to execute > these instructions before unwinding the stack > --- > arch/arm/kernel/unwind.c | 59 > +- > 1 files changed, 58 insertions(+), 1 deletions(-) > > diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c > index 00df012..3777cd7 100644 > --- a/arch/arm/kernel/unwind.c > +++ b/arch/arm/kernel/unwind.c > @@ -49,6 +49,8 @@ > #include > #include > > +#define TOTAL_REGISTERS 16 > + > /* Dummy functions to avoid linker complaints */ > void __aeabi_unwind_cpp_pr0(void) > { > @@ -66,7 +68,7 @@ void __aeabi_unwind_cpp_pr2(void) > EXPORT_SYMBOL(__aeabi_unwind_cpp_pr2); > > struct unwind_ctrl_block { > - unsigned long vrs[16]; /* virtual register set */ > + unsigned long vrs[TOTAL_REGISTERS]; /* virtual register set */ > const unsigned long *insn; /* pointer to the current instructions word */ > int entries; /* number of entries left to interpret */ > int byte; /* current byte number in the instructions word */ > @@ -235,6 +237,58 @@ static unsigned long unwind_get_byte(struct > unwind_ctrl_block *ctrl) > return ret; > } > > +/* check whether there is enough space on stack to execute instructions > + that can cause a data abort*/ Nit: strange comment formatting in all your multi-line comments. /* * Please format multi-line comments * like this. */ > +static int unwind_check_insn(struct unwind_ctrl_block *ctrl, unsigned long > insn) > +{ I really think this shouldn't be separated out in this way, because it means the decoder has to be implemented twice, and moving the checks far away from the code that the checks need to match. Maybe you could refactor the code so that each insn has its own function, including the check and the execution. Then > + unsigned long high, low; > + int required_stack = 0; > + > + low = ctrl->vrs[SP]; > + high = ALIGN(low, THREAD_SIZE); > + > + /* check whether we have enough space to extract > + atleast one set of registers*/ > + if ((high - low) > TOTAL_REGISTERS) > + return URC_OK; Although this appears safe, I wonder whether it just creates additional ways for the code to be wrong, without providing much optimisation. (For example, the maximum number of registers that can be read is not actually TOTAL_REGISTERS.) Cheers ---Dave > + > + if ((insn & 0xf0) == 0x80) { > + unsigned long mask; > + insn = (insn << 8) | unwind_get_byte(ctrl); > + mask = insn & 0x0fff; > + if (mask == 0) { > + pr_warning("unwind: 'Refuse to unwind' instruction %04lx\n", > + insn); > + return -URC_FAILURE; > + } > + while (mask) { > + if (mask & 1) > + required_stack++; > + mask >>= 1; > + } > + } else if ((insn & 0xf0) == 0xa0) { > + required_stack += insn & 7; > + required_stack += (insn & 0x80) ? 1 : 0; > + } else if (insn == 0xb1) { > + unsigned long mask = unwind_get_byte(ctrl); > + if (mask == 0 || mask & 0xf0) { > + pr_warning("unwind: Spare encoding %04lx\n", > + (insn << 8) | mask); > + return -URC_FAILURE; > + } > + while (mask) { > + if (mask & 1) > + required_stack++; > + mask >>= 1; > + } > + } > + > + if ((high - low) < required_stack) > + return -URC_FAILURE; > + > + return URC_OK; > +} > + > /* > * Execute the current unwind instruction. > */ > @@ -244,6 +298,9 @@ static int unwind_exec_insn(struct unwind_ctrl_block > *ctrl) > > pr_debug("%s: insn = %08lx\n", __func__, insn); > > + if (unwind_check_insn(ctrl, insn) < 0) > + return
Re: [PATCH 0/3] makedumpfile: hugepage filtering for vmcore dump
On 2013/11/29 12:24:45, kexec wrote: > (2013/11/29 12:02), Atsushi Kumagai wrote: > > On 2013/11/28 16:50:21, kexec wrote: > ping, in case you overlooked this... > >>> > >>> Sorry for the delayed response, I prioritize the release of v1.5.5 now. > >>> > >>> Thanks for your advice, check_cyclic_buffer_overrun() should be fixed > >>> as you said. In addition, I'm considering other way to address such case, > >>> that is to bring the number of "overflowed pages" to the next cycle and > >>> exclude them at the top of __exclude_unnecessary_pages() like below: > >>> > >>> /* > >>> * The pages which should be excluded still remain. > >>> */ > >>> if (remainder >= 1) { > >>> int i; > >>> unsigned long tmp; > >>> for (i = 0; i < remainder; ++i) { > >>> if > >>> (clear_bit_on_2nd_bitmap_for_kernel(pfn + i)) { > >>> pfn_user++; > >>> tmp++; > >>> } > >>> } > >>> pfn += tmp; > >>> remainder -= tmp; > >>> mem_map += (tmp - 1) * SIZE(page); > >>> continue; > >>> } > >>> > >>> If this way works well, then aligning info->buf_size_cyclic will be > >>> unnecessary. > >>> > >> > >> I selected the current implementation of changing cyclic buffer size > >> becuase > >> I thought it was simpler than carrying over remaining filtered pages to > >> next cycle > >> in that there was no need to add extra code in filtering processing. > >> > >> I guess the reason why you think this is better now is how to detect > >> maximum order of > >> huge page is hard in some way, right? > > > > The maximum order will be gotten from HUGETLB_PAGE_ORDER or HPAGE_PMD_ORDER, > > so I don't say it's hard. However, the carrying over method doesn't depend > > on > > such kernel symbols, so I think it's robuster. > > > > Then, it's better to remove check_cyclic_buffer_overrun() and rewrite part of > free page > filtering in __exclude_unnecessary_pages(). Could you do that too? Sure, I'll modify it too. Thanks Atsushi Kumagai -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V3 2/2] cpufreq: Mark x86 drivers with CPUFREQ_SKIP_INITIAL_FREQ_CHECK flag
On some systems we can't really say what frequency we're running at the moment and so for these we shouldn't check if we are running at a frequency present in frequency table. For now mark all x86 drivers with this flag: CPUFREQ_SKIP_INITIAL_FREQ_CHECK. Signed-off-by: Viresh Kumar --- Rafael, Please check if I have missed any driver or added an extra one. drivers/cpufreq/acpi-cpufreq.c | 1 + drivers/cpufreq/cpufreq-nforce2.c| 1 + drivers/cpufreq/e_powersaver.c | 1 + drivers/cpufreq/elanfreq.c | 1 + drivers/cpufreq/gx-suspmod.c | 1 + drivers/cpufreq/ia64-acpi-cpufreq.c | 1 + drivers/cpufreq/intel_pstate.c | 2 +- drivers/cpufreq/longhaul.c | 1 + drivers/cpufreq/longrun.c| 2 +- drivers/cpufreq/p4-clockmod.c| 1 + drivers/cpufreq/pcc-cpufreq.c| 2 +- drivers/cpufreq/powernow-k6.c| 1 + drivers/cpufreq/powernow-k7.c| 1 + drivers/cpufreq/powernow-k8.c| 3 ++- drivers/cpufreq/sc520_freq.c | 1 + drivers/cpufreq/speedstep-centrino.c | 1 + drivers/cpufreq/speedstep-ich.c | 1 + drivers/cpufreq/speedstep-smi.c | 1 + 18 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index caf41eb..b8e4f79 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -903,6 +903,7 @@ static struct freq_attr *acpi_cpufreq_attr[] = { }; static struct cpufreq_driver acpi_cpufreq_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .verify = cpufreq_generic_frequency_table_verify, .target_index = acpi_cpufreq_target, .bios_limit = acpi_processor_get_bios_limit, diff --git a/drivers/cpufreq/cpufreq-nforce2.c b/drivers/cpufreq/cpufreq-nforce2.c index a05b876..b3222f6 100644 --- a/drivers/cpufreq/cpufreq-nforce2.c +++ b/drivers/cpufreq/cpufreq-nforce2.c @@ -370,6 +370,7 @@ static int nforce2_cpu_exit(struct cpufreq_policy *policy) } static struct cpufreq_driver nforce2_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .name = "nforce2", .verify = nforce2_verify, .target = nforce2_target, diff --git a/drivers/cpufreq/e_powersaver.c b/drivers/cpufreq/e_powersaver.c index 9012b8b..0826bda 100644 --- a/drivers/cpufreq/e_powersaver.c +++ b/drivers/cpufreq/e_powersaver.c @@ -389,6 +389,7 @@ static int eps_cpu_exit(struct cpufreq_policy *policy) } static struct cpufreq_driver eps_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .verify = cpufreq_generic_frequency_table_verify, .target_index = eps_target, .init = eps_cpu_init, diff --git a/drivers/cpufreq/elanfreq.c b/drivers/cpufreq/elanfreq.c index de08acf..426d14d 100644 --- a/drivers/cpufreq/elanfreq.c +++ b/drivers/cpufreq/elanfreq.c @@ -194,6 +194,7 @@ __setup("elanfreq=", elanfreq_setup); static struct cpufreq_driver elanfreq_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .get= elanfreq_get_cpu_frequency, .verify = cpufreq_generic_frequency_table_verify, .target_index = elanfreq_target, diff --git a/drivers/cpufreq/gx-suspmod.c b/drivers/cpufreq/gx-suspmod.c index d83e826..7bfad48 100644 --- a/drivers/cpufreq/gx-suspmod.c +++ b/drivers/cpufreq/gx-suspmod.c @@ -438,6 +438,7 @@ static int cpufreq_gx_cpu_init(struct cpufreq_policy *policy) * MediaGX/Geode GX initialize cpufreq driver */ static struct cpufreq_driver gx_suspmod_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .get= gx_get_cpuspeed, .verify = cpufreq_gx_verify, .target = cpufreq_gx_target, diff --git a/drivers/cpufreq/ia64-acpi-cpufreq.c b/drivers/cpufreq/ia64-acpi-cpufreq.c index 53c6ac6..907bf9a 100644 --- a/drivers/cpufreq/ia64-acpi-cpufreq.c +++ b/drivers/cpufreq/ia64-acpi-cpufreq.c @@ -344,6 +344,7 @@ acpi_cpufreq_cpu_exit ( static struct cpufreq_driver acpi_cpufreq_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .verify = cpufreq_generic_frequency_table_verify, .target_index = acpi_cpufreq_target, .get= acpi_cpufreq_get, diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 5f1cbae..6c8f5d3 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -725,7 +725,7 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy) } static struct cpufreq_driver intel_pstate_driver = { - .flags = CPUFREQ_CONST_LOOPS, + .flags = CPUFREQ_CONST_LOOPS | CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .verify = intel_pstate_verify_policy, .setpolicy = intel_pstate_set_policy, .get= intel_pstate_get, diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c index 45bafdd..16c0a37
[PATCH V3 1/2] cpufreq: Make sure CPU is running on a freq from freq-table
Sometimes boot loaders set CPU frequency to a value outside of frequency table present with cpufreq core. In such cases CPU might be unstable if it has to run on that frequency for long duration of time and so its better to set it to a frequency which is specified in freq-table. This also makes cpufreq stats inconsistent as cpufreq-stats would fail to register because current frequency of CPU isn't found in freq-table. Because we don't want this change to effect boot process badly, we go for the next freq which is >= policy->cur ('cur' must be set by now, otherwise we will end up setting freq to lowest of the table as 'cur' is initialized to zero). In case current frequency doesn't match any frequency from freq-table, we throw warnings to user, so that user can get this fixed in their bootloaders or freq-tables. On some systems we can't really say what frequency we're running at the moment and so for these we have added another flag: CPUFREQ_SKIP_INITIAL_FREQ_CHECK. Reported-by: Carlos Hernandez Reported-and-tested-by: Nishanth Menon Signed-off-by: Viresh Kumar --- V2->V3: - Minor cleanups suggested by Rafael - New patch: 2/2 (cpufreq: Mark x86 drivers with CPUFREQ_SKIP_INITIAL_FREQ_CHECK flag) - Rebased on PM/bleeding-edge drivers/cpufreq/cpufreq.c| 40 drivers/cpufreq/freq_table.c | 22 ++ include/linux/cpufreq.h | 11 +++ 3 files changed, 73 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 606224a..f13320a 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1042,6 +1042,46 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, } } + /* +* Sometimes boot loaders set CPU frequency to a value outside of +* frequency table present with cpufreq core. In such cases CPU might be +* unstable if it has to run on that frequency for long duration of time +* and so its better to set it to a frequency which is specified in +* freq-table. This also makes cpufreq stats inconsistent as +* cpufreq-stats would fail to register because current frequency of CPU +* isn't found in freq-table. +* +* Because we don't want this change to effect boot process badly, we go +* for the next freq which is >= policy->cur ('cur' must be set by now, +* otherwise we will end up setting freq to lowest of the table as 'cur' +* is initialized to zero). +* +* We are passing target-freq as "policy->cur - 1" otherwise +* __cpufreq_driver_target() would simply fail, as policy->cur will be +* equal to target-freq. +*/ + if (!(cpufreq_driver->flags & CPUFREQ_SKIP_INITIAL_FREQ_CHECK) + && has_target()) { + /* Are we running at unknown frequency ? */ + ret = cpufreq_frequency_table_get_index(policy, policy->cur); + if (ret == -EINVAL) { + /* Warn user and fix it */ + pr_warn("%s: CPU%d: Running at unlisted freq: %u KHz\n", + __func__, policy->cpu, policy->cur); + ret = __cpufreq_driver_target(policy, policy->cur - 1, + CPUFREQ_RELATION_L); + + /* +* Reaching here after boot in a few seconds may not +* mean that system will remain stable at "unknown" +* frequency for longer duration. Hence, a BUG_ON(). +*/ + BUG_ON(ret); + pr_warn("%s: CPU%d: Unlisted initial frequency changed to: %u KHz\n", + __func__, policy->cpu, policy->cur); + } + } + /* related cpus should atleast have policy->cpus */ cpumask_or(policy->related_cpus, policy->related_cpus, policy->cpus); diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index 3458d27..a8ac042 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c @@ -178,7 +178,29 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy, } EXPORT_SYMBOL_GPL(cpufreq_frequency_table_target); +int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy, + unsigned int freq) +{ + struct cpufreq_frequency_table *table; + int i; + + table = cpufreq_frequency_get_table(policy->cpu); + if (unlikely(!table)) { + pr_debug("%s: Unable to find frequency table\n", __func__); + return -ENOENT; + } + + for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) { + if (table[i].frequency == freq) + return i; + } + + return -EINVAL; +} +EXPORT_SYMBOL_GPL(cpufreq_frequency_table_get_index); + static
Re: [PATCH v2] arch: hexagon: kernel: hexagon_ksyms.c: export related symbols which various modules need
After this patch, excluding the VGA_CONSOLE issue, the hexagon can pass allmodconfig. :-) Please help check all related patches when you have time. Thanks. On 11/29/2013 12:01 PM, Chen Gang wrote: > Need export all related functions and symbols for various modules with > allmodconfig. The related errors: > > MODPOST 2879 modules > ERROR: "__vmyield" [sound/sound_firmware.ko] undefined! > ERROR: "__phys_offset" [sound/drivers/snd-dummy.ko] undefined! > ERROR: "ioremap_nocache" [drivers/char/ipmi/ipmi_si.ko] undefined! > ERROR: "__iounmap" [drivers/char/ipmi/ipmi_si.ko] undefined! > ... > > Signed-off-by: Chen Gang > --- > arch/hexagon/kernel/hexagon_ksyms.c | 27 +++ > 1 files changed, 23 insertions(+), 4 deletions(-) > > diff --git a/arch/hexagon/kernel/hexagon_ksyms.c > b/arch/hexagon/kernel/hexagon_ksyms.c > index 32b1379..3188de4 100644 > --- a/arch/hexagon/kernel/hexagon_ksyms.c > +++ b/arch/hexagon/kernel/hexagon_ksyms.c > @@ -20,6 +20,9 @@ > > #include > #include > +#include > +#include > +#include > > EXPORT_SYMBOL(__copy_from_user_hexagon); > EXPORT_SYMBOL(__copy_to_user_hexagon); > @@ -28,13 +31,29 @@ EXPORT_SYMBOL(__vmsetie); > EXPORT_SYMBOL(memcpy); > EXPORT_SYMBOL(memset); > > +/* Additional functions */ > +EXPORT_SYMBOL(__strnlen_user); > +EXPORT_SYMBOL(__vmyield); > +EXPORT_SYMBOL(__iounmap); > +EXPORT_SYMBOL(__clear_user_hexagon); > +EXPORT_SYMBOL(ioremap_nocache); > +EXPORT_SYMBOL(empty_zero_page); > + > +/* Additional variables */ > +EXPORT_SYMBOL(_dflt_cache_att); > +EXPORT_SYMBOL(__phys_offset); > +EXPORT_SYMBOL(bad_dma_address); > + > #define DECLARE_EXPORT(name) \ > extern void name(void); EXPORT_SYMBOL(name) > > /* Symbols found in libgcc that assorted kernel modules need */ > DECLARE_EXPORT(__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes); > > -DECLARE_EXPORT(__hexagon_divsi3); > -DECLARE_EXPORT(__hexagon_modsi3); > -DECLARE_EXPORT(__hexagon_udivsi3); > -DECLARE_EXPORT(__hexagon_umodsi3); > +DECLARE_EXPORT(__divsi3); > +DECLARE_EXPORT(__modsi3); > +DECLARE_EXPORT(__udivsi3); > +DECLARE_EXPORT(__umodsi3); > + > +/* Additional functions */ > +DECLARE_EXPORT(csum_tcpudp_magic); > -- Chen Gang -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] arch: hexagon: kernel: reset.c: use function pointer instead of function for pm_power_off and export it
'pm_power_off' is a function pointer, not a function, so need change its type, and also need export it, or can not pass compiling with allmodconfig. The related error: MODPOST 2879 modules ERROR: "pm_power_off" [drivers/char/ipmi/ipmi_poweroff.ko] undefined! Signed-off-by: Chen Gang --- arch/hexagon/kernel/reset.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/hexagon/kernel/reset.c b/arch/hexagon/kernel/reset.c index 6aeabc9..76483c1 100644 --- a/arch/hexagon/kernel/reset.c +++ b/arch/hexagon/kernel/reset.c @@ -33,6 +33,5 @@ void machine_restart(char *cmd) { } -void pm_power_off(void) -{ -} +void (*pm_power_off)(void) = NULL; +EXPORT_SYMBOL(pm_power_off); -- 1.7.7.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] arch: hexagon: kernel: hexagon_ksyms.c: export related symbols which various modules need
Need export all related functions and symbols for various modules with allmodconfig. The related errors: MODPOST 2879 modules ERROR: "__vmyield" [sound/sound_firmware.ko] undefined! ERROR: "__phys_offset" [sound/drivers/snd-dummy.ko] undefined! ERROR: "ioremap_nocache" [drivers/char/ipmi/ipmi_si.ko] undefined! ERROR: "__iounmap" [drivers/char/ipmi/ipmi_si.ko] undefined! ... Signed-off-by: Chen Gang --- arch/hexagon/kernel/hexagon_ksyms.c | 27 +++ 1 files changed, 23 insertions(+), 4 deletions(-) diff --git a/arch/hexagon/kernel/hexagon_ksyms.c b/arch/hexagon/kernel/hexagon_ksyms.c index 32b1379..3188de4 100644 --- a/arch/hexagon/kernel/hexagon_ksyms.c +++ b/arch/hexagon/kernel/hexagon_ksyms.c @@ -20,6 +20,9 @@ #include #include +#include +#include +#include EXPORT_SYMBOL(__copy_from_user_hexagon); EXPORT_SYMBOL(__copy_to_user_hexagon); @@ -28,13 +31,29 @@ EXPORT_SYMBOL(__vmsetie); EXPORT_SYMBOL(memcpy); EXPORT_SYMBOL(memset); +/* Additional functions */ +EXPORT_SYMBOL(__strnlen_user); +EXPORT_SYMBOL(__vmyield); +EXPORT_SYMBOL(__iounmap); +EXPORT_SYMBOL(__clear_user_hexagon); +EXPORT_SYMBOL(ioremap_nocache); +EXPORT_SYMBOL(empty_zero_page); + +/* Additional variables */ +EXPORT_SYMBOL(_dflt_cache_att); +EXPORT_SYMBOL(__phys_offset); +EXPORT_SYMBOL(bad_dma_address); + #define DECLARE_EXPORT(name) \ extern void name(void); EXPORT_SYMBOL(name) /* Symbols found in libgcc that assorted kernel modules need */ DECLARE_EXPORT(__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes); -DECLARE_EXPORT(__hexagon_divsi3); -DECLARE_EXPORT(__hexagon_modsi3); -DECLARE_EXPORT(__hexagon_udivsi3); -DECLARE_EXPORT(__hexagon_umodsi3); +DECLARE_EXPORT(__divsi3); +DECLARE_EXPORT(__modsi3); +DECLARE_EXPORT(__udivsi3); +DECLARE_EXPORT(__umodsi3); + +/* Additional functions */ +DECLARE_EXPORT(csum_tcpudp_magic); -- 1.7.7.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH 3/3] usb: chipidea: hw_phymode_configure moved before ci_usb_phy_init
> > hw_phymode_configure configures the PORTSC registers and allow the > following phy_inits to operate on the right parameters. This fix a > problem > where the UPLI (ISP1504) could not detected, because the Viewport was not > available and returns 0's only. > > Signed-off-by: Chris Ruehl > --- > drivers/usb/chipidea/core.c |4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c > index 1a6010e..f915538 100644 > --- a/drivers/usb/chipidea/core.c > +++ b/drivers/usb/chipidea/core.c > @@ -566,6 +566,8 @@ static int ci_hdrc_probe(struct platform_device *pdev) > return -ENODEV; > } > > + hw_phymode_configure(ci); > + > ret = ci_usb_phy_init(ci); > if (ret) { > dev_err(dev, "unable to init phy: %d\n", ret); > @@ -583,8 +585,6 @@ static int ci_hdrc_probe(struct platform_device *pdev) > > ci_get_otg_capable(ci); > > - hw_phymode_configure(ci); > - > dr_mode = ci->platdata->dr_mode; > /* initialize role(s) before the interrupt is requested */ > if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) { > -- > 1.7.10.4 > > -- Acked-by: Peter Chen Peter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH 2/3] usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag
> > * init the sts flag to 0 (missed) > * set the sts flag only if not 0 > does PORTSC_STS bit as 1 or 0 affect your case? If not, please remove hw_write(ci, OP_DEVLC, DEVLC_STS, sts), since it is useless at current code logic. Peter > Signed-off-by: Chris Ruehl > --- > drivers/usb/chipidea/core.c |8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c > index 5075407..1a6010e 100644 > --- a/drivers/usb/chipidea/core.c > +++ b/drivers/usb/chipidea/core.c > @@ -245,6 +245,8 @@ static void hw_phymode_configure(struct ci_hdrc *ci) > { > u32 portsc, lpm, sts; > > + sts = 0; > + > switch (ci->platdata->phy_mode) { > case USBPHY_INTERFACE_MODE_UTMI: > portsc = PORTSC_PTS(PTS_UTMI); > @@ -273,10 +275,12 @@ static void hw_phymode_configure(struct ci_hdrc *ci) > > if (ci->hw_bank.lpm) { > hw_write(ci, OP_DEVLC, DEVLC_PTS(7) | DEVLC_PTW, lpm); > - hw_write(ci, OP_DEVLC, DEVLC_STS, sts); > + if (sts) > + hw_write(ci, OP_DEVLC, DEVLC_STS, sts); > } else { > hw_write(ci, OP_PORTSC, PORTSC_PTS(7) | PORTSC_PTW, portsc); > - hw_write(ci, OP_PORTSC, PORTSC_STS, sts); > + if ( sts ) > + hw_write(ci, OP_PORTSC, PORTSC_STS, sts); > } > } > > -- > 1.7.10.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH V4] cpufreq: suspend governors on system suspend/hibernate
On 29 November 2013 01:59, Rafael J. Wysocki wrote: > So I'm reading this as "the version of the patch in bleeding-edge is OK". > > I hope that really is the case. :-) Yeah, that's correct. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/3] makedumpfile: hugepage filtering for vmcore dump
(2013/11/29 12:02), Atsushi Kumagai wrote: > On 2013/11/28 16:50:21, kexec wrote: ping, in case you overlooked this... >>> >>> Sorry for the delayed response, I prioritize the release of v1.5.5 now. >>> >>> Thanks for your advice, check_cyclic_buffer_overrun() should be fixed >>> as you said. In addition, I'm considering other way to address such case, >>> that is to bring the number of "overflowed pages" to the next cycle and >>> exclude them at the top of __exclude_unnecessary_pages() like below: >>> >>> /* >>> * The pages which should be excluded still remain. >>> */ >>> if (remainder >= 1) { >>> int i; >>> unsigned long tmp; >>> for (i = 0; i < remainder; ++i) { >>> if (clear_bit_on_2nd_bitmap_for_kernel(pfn >>> + i)) { >>> pfn_user++; >>> tmp++; >>> } >>> } >>> pfn += tmp; >>> remainder -= tmp; >>> mem_map += (tmp - 1) * SIZE(page); >>> continue; >>> } >>> >>> If this way works well, then aligning info->buf_size_cyclic will be >>> unnecessary. >>> >> >> I selected the current implementation of changing cyclic buffer size becuase >> I thought it was simpler than carrying over remaining filtered pages to next >> cycle >> in that there was no need to add extra code in filtering processing. >> >> I guess the reason why you think this is better now is how to detect maximum >> order of >> huge page is hard in some way, right? > > The maximum order will be gotten from HUGETLB_PAGE_ORDER or HPAGE_PMD_ORDER, > so I don't say it's hard. However, the carrying over method doesn't depend on > such kernel symbols, so I think it's robuster. > Then, it's better to remove check_cyclic_buffer_overrun() and rewrite part of free page filtering in __exclude_unnecessary_pages(). Could you do that too? -- Thanks. HATAYAMA, Daisuke -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH 1/3] usb: chipidea: Reallocate regmap only if lpm is detected
> > Signed-off-by: Chris Ruehl > --- > drivers/usb/chipidea/core.c |3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c > index 5d8981c..5075407 100644 > --- a/drivers/usb/chipidea/core.c > +++ b/drivers/usb/chipidea/core.c > @@ -208,7 +208,8 @@ static int hw_device_init(struct ci_hdrc *ci, void > __iomem *base) > reg = hw_read(ci, CAP_HCCPARAMS, HCCPARAMS_LEN) >> > __ffs(HCCPARAMS_LEN); > ci->hw_bank.lpm = reg; > - hw_alloc_regmap(ci, !!reg); > + if (reg) > + hw_alloc_regmap(ci, !!reg); > ci->hw_bank.size = ci->hw_bank.op - ci->hw_bank.abs; > ci->hw_bank.size += OP_LAST; > ci->hw_bank.size /= sizeof(u32); > -- Please add description at commit log -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] PCI: export MSI mode using attributes, not kobjects
On Wed, Nov 27, 2013 at 10:46:52AM -0800, Greg Kroah-Hartman wrote: > From: Greg Kroah-Hartman > > The PCI MSI sysfs code is a mess with kobjects for things that don't > really need to be kobjects. This patch creates attributes dynamically > for the MSI interrupts instead of using kobjects. > > Note, this removes a directory from the current MSI interrupt sysfs > code: > > old MSI kobjects: > pci_device >└── msi_irqs >   └── 40 >   └── mode > > new MSI attributes: > pci_device >└── msi_irqs >   └── 40 > > As there was only one file "mode" with the kobject model, the interrupt > number is now a file that returns the "mode" of the interrupt (msi vs. > msix). > > Signed-off-by: Greg Kroah-Hartman > > --- > > Neil, can you test this patch to see if irqbalance works as-is or not? > ACK, Testing with git-head irqbalance on F19 with this patch and it works fine. Thanks! Acked-by: Neil Horman -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/6] kexec: A new system call, kexec_file_load, for in kernel kexec
On 11/20/13 at 12:50pm, Vivek Goyal wrote: > diff --git a/arch/x86/kernel/machine_kexec_64.c > b/arch/x86/kernel/machine_kexec_64.c > index 4eabc16..fb41b73 100644 > --- a/arch/x86/kernel/machine_kexec_64.c > +++ b/arch/x86/kernel/machine_kexec_64.c > @@ -22,6 +22,13 @@ > #include > #include > > +/* arch dependent functionality related to kexec file based syscall */ > +static struct kexec_file_type kexec_file_type[]={ > + {"", NULL, NULL, NULL, NULL}, > +}; > + > + > +void *arch_kexec_kernel_image_load(struct kimage *image, char *kernel, > + unsigned long kernel_len, char *initrd, > + unsigned long initrd_len, char *cmdline, > + unsigned long cmdline_len) > +{ > + int idx = image->file_handler_idx; > + > + if (idx < 0) > + return ERR_PTR(-ENOEXEC); > + > + return kexec_file_type[idx].load(image, kernel, kernel_len, initrd, > + initrd_len, cmdline, cmdline_len); > +} > + > +int arch_image_file_post_load_cleanup(struct kimage *image) > +{ Hi Vivek, This function is defined as one of arch specific fucntion set, why don't we name it in a unified prefix as others. And name of the default dummy function in kernel/kexec.c is not consistent with the arch specific one, so currently arch_image_file_post_load_cleanup of x86 arch is not called. Please consider wihch one need be changed. > + > +void __attribute__ ((weak)) > +arch_kimage_file_post_load_cleanup(struct kimage *image) > +{ > + return; > +} > + -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/3] makedumpfile: hugepage filtering for vmcore dump
On 2013/11/28 16:50:21, kexec wrote: > >> ping, in case you overlooked this... > > > > Sorry for the delayed response, I prioritize the release of v1.5.5 now. > > > > Thanks for your advice, check_cyclic_buffer_overrun() should be fixed > > as you said. In addition, I'm considering other way to address such case, > > that is to bring the number of "overflowed pages" to the next cycle and > > exclude them at the top of __exclude_unnecessary_pages() like below: > > > > /* > > * The pages which should be excluded still remain. > > */ > > if (remainder >= 1) { > > int i; > > unsigned long tmp; > > for (i = 0; i < remainder; ++i) { > > if (clear_bit_on_2nd_bitmap_for_kernel(pfn > > + i)) { > > pfn_user++; > > tmp++; > > } > > } > > pfn += tmp; > > remainder -= tmp; > > mem_map += (tmp - 1) * SIZE(page); > > continue; > > } > > > > If this way works well, then aligning info->buf_size_cyclic will be > > unnecessary. > > > > I selected the current implementation of changing cyclic buffer size becuase > I thought it was simpler than carrying over remaining filtered pages to next > cycle > in that there was no need to add extra code in filtering processing. > > I guess the reason why you think this is better now is how to detect maximum > order of > huge page is hard in some way, right? The maximum order will be gotten from HUGETLB_PAGE_ORDER or HPAGE_PMD_ORDER, so I don't say it's hard. However, the carrying over method doesn't depend on such kernel symbols, so I think it's robuster. Thanks Atsushi Kumagai > -- > Thanks. > HATAYAMA, Daisuke > > > ___ > kexec mailing list > ke...@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/kexec > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] arch: hexagon: kernel: hexagon_ksyms.c remove useless __hexagon_*i3()
On 11/29/2013 10:29 AM, Chen Gang wrote: > Only find "DECLARE_EXPORT(__hexagon_*i3)", no related implementations > and callers, so remove them, or will cause ld issue with allmodconfig, > the related error: > > LD init/built-in.o > arch/hexagon/kernel/built-in.o:(___ksymtab+__hexagon_umodsi3+0x0): > undefined reference to `__hexagon_umodsi3' > arch/hexagon/kernel/built-in.o:(___ksymtab+__hexagon_udivsi3+0x0): > undefined reference to `__hexagon_udivsi3' > arch/hexagon/kernel/built-in.o:(___ksymtab+__hexagon_modsi3+0x0): undefined > reference to `__hexagon_modsi3' > arch/hexagon/kernel/built-in.o:(___ksymtab+__hexagon_divsi3+0x0): undefined > reference to `__hexagon_divsi3' > Oh, sorry, this patch need improved, we can not only remove them simply (although really no related callers and implementations), I will send patch v2 later when finish allmodconfig. Thanks. > > Signed-off-by: Chen Gang > --- > arch/hexagon/kernel/hexagon_ksyms.c |5 - > 1 files changed, 0 insertions(+), 5 deletions(-) > > diff --git a/arch/hexagon/kernel/hexagon_ksyms.c > b/arch/hexagon/kernel/hexagon_ksyms.c > index 32b1379..1257c85 100644 > --- a/arch/hexagon/kernel/hexagon_ksyms.c > +++ b/arch/hexagon/kernel/hexagon_ksyms.c > @@ -33,8 +33,3 @@ EXPORT_SYMBOL(memset); > > /* Symbols found in libgcc that assorted kernel modules need */ > DECLARE_EXPORT(__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes); > - > -DECLARE_EXPORT(__hexagon_divsi3); > -DECLARE_EXPORT(__hexagon_modsi3); > -DECLARE_EXPORT(__hexagon_udivsi3); > -DECLARE_EXPORT(__hexagon_umodsi3); > -- Chen Gang -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
linux-next: Tree for Nov 29
Hi all, Changes since 20131128: The slave-dma tree gained conflicts against the imx-mxs tree. The sound-asoc tree gained a build failure so I used teh version from next-20131128. Non-merge commits (relative to Linus' tree): 1585 1774 files changed, 68549 insertions(+), 33718 deletions(-) I have created today's linux-next tree at git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git (patches at http://www.kernel.org/pub/linux/kernel/next/ ). If you are tracking the linux-next tree using git, you should not use "git pull" to do so as that will try to merge the new linux-next release with the old one. You should use "git fetch" as mentioned in the FAQ on the wiki (see below). You can see which trees have been included by looking in the Next/Trees file in the source. There are also quilt-import.log and merge.log files in the Next directory. Between each merge, the tree was built with a ppc64_defconfig for powerpc and an allmodconfig for x86_64 and a multi_v7_defconfig for arm. After the final fixups (if any), it is also built with powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig and allyesconfig (minus CONFIG_PROFILE_ALL_BRANCHES - this fails its final link) and i386, sparc, sparc64 and arm defconfig. These builds also have CONFIG_ENABLE_WARN_DEPRECATED, CONFIG_ENABLE_MUST_CHECK and CONFIG_DEBUG_INFO disabled when necessary. Below is a summary of the state of the merge. I am currently merging 210 trees (counting Linus' and 29 trees of patches pending for Linus' tree). Stats about the size of the tree over time can be seen at http://neuling.org/linux-next-size.html . Status of my local build tests will be at http://kisskb.ellerman.id.au/linux-next . If maintainers want to give advice about cross compilers/configs that work, we are always open to add more builds. Thanks to Randy Dunlap for doing many randconfig builds. And to Paul Gortmaker for triage and bug fixes. There is a wiki covering stuff to do with linux-next at http://linux.f-seidel.de/linux-next/pmwiki/ . Thanks to Frank Seidel. -- Cheers, Stephen Rothwells...@canb.auug.org.au $ git checkout master $ git reset --hard stable Merging origin/master (dda9cc3a1451 Merge tag 'gpio-v3.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio) Merging fixes/master (8ae516aa8b81 Merge tag 'trace-fixes-v3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace) Merging kbuild-current/rc-fixes (19514fc665ff arm, kbuild: make "make install" not depend on vmlinux) Merging arc-current/for-curr (da990a4f2d5a ARC: [perf] Fix a few thinkos) Merging arm-current/fixes (476d1c03d202 ARM: dma-mapping: check DMA mask against available memory) Merging m68k-current/for-linus (77a42796786c m68k: Remove deprecated IRQF_DISABLED) Merging metag-fixes/fixes (3b2f64d00c46 Linux 3.11-rc2) Merging powerpc-merge/merge (721cb59e9d95 powerpc/windfarm: Fix XServe G5 fan control Makefile issue) Merging sparc/master (b4789b8e6be3 aacraid: prevent invalid pointer dereference) Merging net/master (2c7a9dc16416 be2net: Avoid programming permenant MAC by BE3-R VFs) Merging ipsec/master (be408cd3e1fe Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net) Merging sound-current/for-linus (eb9ca3ab2194 ALSA: hda - Add LFE chmap to ASUS ET2700) Merging pci-current/for-linus (4bff6749905d PCI: Move device_del() from pci_stop_dev() to pci_destroy_dev()) Merging wireless/master (d5aedd7e1b2f Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211) Merging driver-core.current/driver-core-linus (81440e737444 Revert "sysfs: handle duplicate removal attempts in sysfs_remove_group()") Merging tty.current/tty-linus (c42b4e6501cd Revert "n_gsm: race between ld close and gsmtty open") Merging usb.current/usb-linus (c24cb6c8b501 Merge tag 'fixes-for-v3.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus) Merging staging.current/staging-linus (930ba4a374b9 Staging: tidspbridge: disable driver) Merging char-misc.current/char-misc-linus (d0b00d3fb96d Merge tag 'extcon-linus-for-3.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into char-misc-linus) Merging input-current/for-linus (358f24704f2f Input: add key code for ambient light sensor button) Merging md-current/for-linus (d47648fcf061 raid5: avoid finding "discard" stripe) Merging crypto-current/master (8ec25c512916 crypto: testmgr - fix sglen in test_aead for case 'dst != src') Merging ide/master (c2f7d1e103ef ide: pmac: remove unnecessary pci_set_drvdata()) Merging dwmw2/master (5950f0803ca9 pcmcia: remove RPX board stuff) Merging sh-current/sh-fixes-for-linus (44033109e99c SH: Convert out[bwl] macros to inline functions) Merging devicetree-current/devicetree/merge (1931ee143b0a Revert "drivers: of: add ini
Re: [PATCH 7/10] ACPI / hotplug: Move container-specific code out of the core
Hi Rafael, Replying to this mail may be wrong. Do you remember following your patch? http://lkml.org/lkml/2013/2/23/97 I want to add autoeject variable in acpi_hotplug_profile structure and set autoecjet of container device "false". Currently, I have a problem on ejecting container device. Since linux-3.12, container device is removed by acpi_scan_hot_remove. I think this has two problems. 1. easily fail My container device has CPU device and Memory device, and maximum size of memory is 3Tbyte. In my environment, hot removing container device fails on offlining memory if memory is used by application. I think if offlininig memory, we must retly to offline memory several times. 2. cannot work with userland's application Hot removing CPU and memory on container device, we need take care of userland application. Before linux-3.12, container device just notifies KOBJ_OFFLINE to udev. So by using udev, if application binds to removed CPU or node, applications can change them before hot removing container device. Currently, KOBJ_OFFLINE is notified to udev. But acpi_scan_hot_remove also runs simultaneously for hot removing container device. So when applications runs for corresponding to the deletion of the devices, the devices may have been deleted. I don't know what devices are on hotpluggable conatainer device of other vendors. At least, my container device cannot be hot removed correctly. Then I want to add autoeject variable in acpi_hotplug_profile so that user can change the parameter to "true" or "false". Thanks, Yasuaki Ishimatsu (2013/11/18 1:36), Rafael J. Wysocki wrote: From: Rafael J. Wysocki Move container-specific uevents from the core hotplug code to the container scan handler's .attach() and .detach() callbacks. This way the core will not have to special-case containers and the uevents will be guaranteed to happen every time a container is either scanned or trimmed as appropriate. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/container.c | 11 --- drivers/acpi/scan.c |8 +--- include/acpi/acpi_bus.h |7 --- 3 files changed, 9 insertions(+), 17 deletions(-) Index: linux-pm/drivers/acpi/container.c === --- linux-pm.orig/drivers/acpi/container.c +++ linux-pm/drivers/acpi/container.c @@ -44,19 +44,24 @@ static const struct acpi_device_id conta {"", 0}, }; -static int container_device_attach(struct acpi_device *device, +static int container_device_attach(struct acpi_device *adev, const struct acpi_device_id *not_used) { - /* This is necessary for container hotplug to work. */ + kobject_uevent(>dev.kobj, KOBJ_ONLINE); return 1; } +static void container_device_detach(struct acpi_device *adev) +{ + kobject_uevent(>dev.kobj, KOBJ_OFFLINE); +} + static struct acpi_scan_handler container_handler = { .ids = container_device_ids, .attach = container_device_attach, + .detach = container_device_detach, .hotplug = { .enabled = true, - .mode = AHM_CONTAINER, }, }; Index: linux-pm/drivers/acpi/scan.c === --- linux-pm.orig/drivers/acpi/scan.c +++ linux-pm/drivers/acpi/scan.c @@ -206,9 +206,6 @@ static int acpi_scan_hot_remove(struct a acpi_status status; unsigned long long sta; - if (device->handler && device->handler->hotplug.mode == AHM_CONTAINER) - kobject_uevent(>dev.kobj, KOBJ_OFFLINE); - /* * Carry out two passes here and ignore errors in the first pass, * because if the devices in question are memory blocks and @@ -288,10 +285,7 @@ static int acpi_scan_device_check(struct dev_warn(>dev, "Namespace scan failure\n"); return error; } - if (adev->handler) { - if (adev->handler->hotplug.mode == AHM_CONTAINER) - kobject_uevent(>dev.kobj, KOBJ_ONLINE); - } else { + if (!adev->handler) { dev_warn(>dev, "Enumeration failure\n"); return -ENODEV; } Index: linux-pm/include/acpi/acpi_bus.h === --- linux-pm.orig/include/acpi/acpi_bus.h +++ linux-pm/include/acpi/acpi_bus.h @@ -91,16 +91,9 @@ struct acpi_device; * - */ -enum acpi_hotplug_mode { - AHM_GENERIC = 0, - AHM_CONTAINER, - AHM_COUNT -}; - struct acpi_hotplug_profile { struct kobject kobj; bool enabled:1; - enum acpi_hotplug_mode mode; int (*scan_dependent)(struct acpi_device *adev); }; -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majord...@vger.kernel.org More majordomo info
Re: [PATCH 3/3] usb: chipidea: hw_phymode_configure moved before ci_usb_phy_init
On Fri, Nov 29, 2013 at 12:29 AM, Chris Ruehl wrote: > yeah, the hw_phymode_configure() was in the probe but not called before the > ci_usb_phy_init(ci) which triggers the inits in phy-generic.c (in my case) > > My pending patches relay on this. > > Did you move the hw_phy before the ci_usb_phy_init too ? Ah, ok. It is a different issue then. Sorry for the noise. Regards, Fabio Estevam -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/3] usb: chipidea: hw_phymode_configure moved before ci_usb_phy_init
Hi Fabio On Friday, November 29, 2013 10:14 AM, Fabio Estevam wrote: Hi Chris, On Fri, Nov 29, 2013 at 12:08 AM, Chris Ruehl wrote: hw_phymode_configure configures the PORTSC registers and allow the following phy_inits to operate on the right parameters. This fix a problem where the UPLI (ISP1504) could not detected, because the Viewport was not available and returns 0's only. Signed-off-by: Chris Ruehl I have already fixed this issue. It is in mainline now: yeah, the hw_phymode_configure() was in the probe but not called before the ci_usb_phy_init(ci) which triggers the inits in phy-generic.c (in my case) My pending patches relay on this. Did you move the hw_phy before the ci_usb_phy_init too ? Chris commit 03779f05be6dfc48de99763f6c845a003e1e40f3 Author: Fabio Estevam Date: Wed Aug 14 12:43:56 2013 +0300 usb: chipidea: move hw_phymode_configure() into probe Currently hw_phymode_configure() is located inside hw_device_reset(), which only called by chipidea udc driver. When operating in host mode, we also need to call hw_phymode_configure() in order to properly configure the PHY mode, so move this function into probe. After this change, USB Host1 port on mx53qsb board is functional. Signed-off-by: Fabio Estevam Tested-by: Arnaud Patard Reviewed-by: Peter Chen Signed-off-by: Alexander Shishkin Signed-off-by: Greg Kroah-Hartman Regards, Fabio Estevam -- GTSYS Limited RFID Technology A01 24/F Gold King Industrial Bld 35-41 Tai Lin Pai Road, Kwai Chung, Hong Kong Fax (852) 8167 4060 - Tel (852) 3598 9488 Disclaimer: http://www.gtsys.com.hk/email/classified.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] arch: hexagon: kernel: hexagon_ksyms.c remove useless __hexagon_*i3()
Only find "DECLARE_EXPORT(__hexagon_*i3)", no related implementations and callers, so remove them, or will cause ld issue with allmodconfig, the related error: LD init/built-in.o arch/hexagon/kernel/built-in.o:(___ksymtab+__hexagon_umodsi3+0x0): undefined reference to `__hexagon_umodsi3' arch/hexagon/kernel/built-in.o:(___ksymtab+__hexagon_udivsi3+0x0): undefined reference to `__hexagon_udivsi3' arch/hexagon/kernel/built-in.o:(___ksymtab+__hexagon_modsi3+0x0): undefined reference to `__hexagon_modsi3' arch/hexagon/kernel/built-in.o:(___ksymtab+__hexagon_divsi3+0x0): undefined reference to `__hexagon_divsi3' Signed-off-by: Chen Gang --- arch/hexagon/kernel/hexagon_ksyms.c |5 - 1 files changed, 0 insertions(+), 5 deletions(-) diff --git a/arch/hexagon/kernel/hexagon_ksyms.c b/arch/hexagon/kernel/hexagon_ksyms.c index 32b1379..1257c85 100644 --- a/arch/hexagon/kernel/hexagon_ksyms.c +++ b/arch/hexagon/kernel/hexagon_ksyms.c @@ -33,8 +33,3 @@ EXPORT_SYMBOL(memset); /* Symbols found in libgcc that assorted kernel modules need */ DECLARE_EXPORT(__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes); - -DECLARE_EXPORT(__hexagon_divsi3); -DECLARE_EXPORT(__hexagon_modsi3); -DECLARE_EXPORT(__hexagon_udivsi3); -DECLARE_EXPORT(__hexagon_umodsi3); -- 1.7.7.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/3] ACPI / bind: Use struct acpi_device pointers instead of ACPI handles
On 2013年11月29日 08:36, Rafael J. Wysocki wrote: > Hi, > > Now that we store a pointer to struct acpi_device as the ACPI companion in > struct device, the code making associations between "physical" devices and > ACPI device objects can be modified to work with struct acpi_device pointers > instead of ACPI handles too. The first two of the following patches make > these > changes and the third one is just a related cleanup. > > [1/3] ACPI / bind: Replace .find_device in struct acpi_bus_type with > .find_companion > [2/3] ACPI / bind: Modify acpi_bind_one() to take a struct acpi_device > pointer as > the second argument. > [3/3] ACPI / bind: Move acpi_get_child() to ide-acpi.c which is the only > remaining > user of that function. > Test usb/ACPI bind part, it works normally. Tested-by: Lan Tianyu > The patches are on top of linux-pm.git/linux-next. Please let me know if you > see > any problems in them. > > Thanks! > -- Best regards Tianyu Lan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/3] usb: chipidea: hw_phymode_configure moved before ci_usb_phy_init
hw_phymode_configure configures the PORTSC registers and allow the following phy_inits to operate on the right parameters. This fix a problem where the UPLI (ISP1504) could not detected, because the Viewport was not available and returns 0's only. Signed-off-by: Chris Ruehl --- drivers/usb/chipidea/core.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 1a6010e..f915538 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -566,6 +566,8 @@ static int ci_hdrc_probe(struct platform_device *pdev) return -ENODEV; } + hw_phymode_configure(ci); + ret = ci_usb_phy_init(ci); if (ret) { dev_err(dev, "unable to init phy: %d\n", ret); @@ -583,8 +585,6 @@ static int ci_hdrc_probe(struct platform_device *pdev) ci_get_otg_capable(ci); - hw_phymode_configure(ci); - dr_mode = ci->platdata->dr_mode; /* initialize role(s) before the interrupt is requested */ if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) { -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/3] usb: chipidea: hw_phymode_configure moved before ci_usb_phy_init
Hi Chris, On Fri, Nov 29, 2013 at 12:08 AM, Chris Ruehl wrote: > hw_phymode_configure configures the PORTSC registers and allow the > following phy_inits to operate on the right parameters. This fix a problem > where the UPLI (ISP1504) could not detected, because the Viewport was not > available and returns 0's only. > > Signed-off-by: Chris Ruehl I have already fixed this issue. It is in mainline now: commit 03779f05be6dfc48de99763f6c845a003e1e40f3 Author: Fabio Estevam Date: Wed Aug 14 12:43:56 2013 +0300 usb: chipidea: move hw_phymode_configure() into probe Currently hw_phymode_configure() is located inside hw_device_reset(), which only called by chipidea udc driver. When operating in host mode, we also need to call hw_phymode_configure() in order to properly configure the PHY mode, so move this function into probe. After this change, USB Host1 port on mx53qsb board is functional. Signed-off-by: Fabio Estevam Tested-by: Arnaud Patard Reviewed-by: Peter Chen Signed-off-by: Alexander Shishkin Signed-off-by: Greg Kroah-Hartman Regards, Fabio Estevam -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/3] usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag
* init the sts flag to 0 (missed) * set the sts flag only if not 0 Signed-off-by: Chris Ruehl --- drivers/usb/chipidea/core.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 5075407..1a6010e 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -245,6 +245,8 @@ static void hw_phymode_configure(struct ci_hdrc *ci) { u32 portsc, lpm, sts; + sts = 0; + switch (ci->platdata->phy_mode) { case USBPHY_INTERFACE_MODE_UTMI: portsc = PORTSC_PTS(PTS_UTMI); @@ -273,10 +275,12 @@ static void hw_phymode_configure(struct ci_hdrc *ci) if (ci->hw_bank.lpm) { hw_write(ci, OP_DEVLC, DEVLC_PTS(7) | DEVLC_PTW, lpm); - hw_write(ci, OP_DEVLC, DEVLC_STS, sts); + if (sts) + hw_write(ci, OP_DEVLC, DEVLC_STS, sts); } else { hw_write(ci, OP_PORTSC, PORTSC_PTS(7) | PORTSC_PTW, portsc); - hw_write(ci, OP_PORTSC, PORTSC_STS, sts); + if ( sts ) + hw_write(ci, OP_PORTSC, PORTSC_STS, sts); } } -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] usb: chipidea: Reallocate regmap only if lpm is detected
Signed-off-by: Chris Ruehl --- drivers/usb/chipidea/core.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 5d8981c..5075407 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -208,7 +208,8 @@ static int hw_device_init(struct ci_hdrc *ci, void __iomem *base) reg = hw_read(ci, CAP_HCCPARAMS, HCCPARAMS_LEN) >> __ffs(HCCPARAMS_LEN); ci->hw_bank.lpm = reg; - hw_alloc_regmap(ci, !!reg); + if (reg) + hw_alloc_regmap(ci, !!reg); ci->hw_bank.size = ci->hw_bank.op - ci->hw_bank.abs; ci->hw_bank.size += OP_LAST; ci->hw_bank.size /= sizeof(u32); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH] Fix race between oom kill and task exit
We will do more stress test in more machine at the same time -Original Message- From: Ma, Xindong Sent: Friday, November 29, 2013 10:06 AM To: Oleg Nesterov; Michal Hocko Cc: William Dauchy; Johannes Weiner; a...@linux-foundation.org; rient...@google.com; ru...@rustcorp.com.au; linux...@kvack.org; linux-kernel@vger.kernel.org; Peter Zijlstra; gre...@linuxfoundation.org; Tu, Xiaobing; azurIt; Sameer Nanda Subject: RE: [PATCH] Fix race between oom kill and task exit > From: Oleg Nesterov [mailto:o...@redhat.com] > Sent: Friday, November 29, 2013 2:39 AM > To: Michal Hocko > Cc: William Dauchy; Johannes Weiner; Ma, Xindong; > a...@linux-foundation.org; rient...@google.com; ru...@rustcorp.com.au; > linux...@kvack.org; linux-kernel@vger.kernel.org; Peter Zijlstra; > gre...@linuxfoundation.org; Tu, Xiaobing; azurIt; Sameer Nanda > Subject: Re: [PATCH] Fix race between oom kill and task exit > > On 11/28, Michal Hocko wrote: > > > > They are both trying to solve the same issue. Neither of them is > > optimal unfortunately. > > yes, but this one doesn't look right. > > > Oleg said he would look into this and I have seen some patches but > > didn't geto check them. > > Only preparations so far. > > Oleg. I was not aware there's a long story for this issue. I hit this issue a lot of times during stress test and root caused it. After applying my patch, I did extensive test on 5 machines for a long time, it does not reproduced anymore so I submitted the patch. I will do more research on this issue. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] inet: fix possible seqlock deadlocks
-- Original Message --- Sender : Eric Dumazet Date : 2013-11-29 02:51 (GMT+09:00) Title : [PATCH v2] inet: fix possible seqlock deadlocks > > From: Eric Dumazet > > In commit c9e9042994d3 ("ipv4: fix possible seqlock deadlock") I left > another places where IP_INC_STATS_BH() were improperly used. > > udp_sendmsg(), ping_v4_sendmsg() and tcp_v4_connect() are called from > process context, not from softirq context. > > This was detected by lockdep seqlock support. > > Reported-by: jongman heo > Fixes: 584bdf8cbdf6 ("[IPV4]: Fix "ipOutNoRoutes" counter error for TCP and > UDP") > Fixes: c319b4d76b9e ("net: ipv4: add IPPROTO_ICMP socket kind") > Signed-off-by: Eric Dumazet > Cc: Hannes Frederic Sowa > --- > net/ipv4/ping.c |2 +- > net/ipv4/tcp_ipv4.c |2 +- > net/ipv4/udp.c |2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c > index 840cf1b9e6ee..242e7f4ed6f4 100644 > --- a/net/ipv4/ping.c > +++ b/net/ipv4/ping.c > @@ -772,7 +772,7 @@ int ping_v4_sendmsg(struct kiocb *iocb, struct sock *sk, > struct msghdr *msg, > err = PTR_ERR(rt); > rt = NULL; > if (err == -ENETUNREACH) > - IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); > + IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES); > goto out; > } > > diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c > index 59a6f8b90cd9..067213924751 100644 > --- a/net/ipv4/tcp_ipv4.c > +++ b/net/ipv4/tcp_ipv4.c > @@ -177,7 +177,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr > *uaddr, int addr_len) > if (IS_ERR(rt)) { > err = PTR_ERR(rt); > if (err == -ENETUNREACH) > - IP_INC_STATS_BH(sock_net(sk), IPSTATS_MIB_OUTNOROUTES); > + IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTNOROUTES); > return err; > } > > diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c > index 44dfaa09b584..44e3884f9e4c 100644 > --- a/net/ipv4/udp.c > +++ b/net/ipv4/udp.c > @@ -999,7 +999,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, > struct msghdr *msg, > err = PTR_ERR(rt); > rt = NULL; > if (err == -ENETUNREACH) > - IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); > + IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES); > goto out; > } > Hi, Eric, I've applied your patch, and will let you know the result, after a full day or half day test. Usually the issue happens within 10 minutes after boot, but to be sure... Regards, Jongman Heo.
[no subject]
-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH] Fix race between oom kill and task exit
> From: Oleg Nesterov [mailto:o...@redhat.com] > Sent: Friday, November 29, 2013 2:39 AM > To: Michal Hocko > Cc: William Dauchy; Johannes Weiner; Ma, Xindong; > a...@linux-foundation.org; rient...@google.com; ru...@rustcorp.com.au; > linux...@kvack.org; linux-kernel@vger.kernel.org; Peter Zijlstra; > gre...@linuxfoundation.org; Tu, Xiaobing; azurIt; Sameer Nanda > Subject: Re: [PATCH] Fix race between oom kill and task exit > > On 11/28, Michal Hocko wrote: > > > > They are both trying to solve the same issue. Neither of them is > > optimal unfortunately. > > yes, but this one doesn't look right. > > > Oleg said he would look into this and I have seen some patches but > > didn't geto check them. > > Only preparations so far. > > Oleg. I was not aware there's a long story for this issue. I hit this issue a lot of times during stress test and root caused it. After applying my patch, I did extensive test on 5 machines for a long time, it does not reproduced anymore so I submitted the patch. I will do more research on this issue. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/3] ACPI / bind: Rework struct acpi_bus_type
On 2013年11月29日 08:37, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Replace the .find_device function pointer in struct acpi_bus_type > with a new one, .find_copmanion, that is supposed to point to a -^ A typo > function returning struct acpi_device pointer (instead of an int) > and takes one argument (instead of two). This way the role of > this callback is more clear and the implementation of it can > be more straightforward. > > Update all of the users of struct acpi_bus_type (PCI, PNP/ACPI and > USB) to reflect the structure change. > > Signed-off-by: Rafael J. Wysocki > --- > drivers/acpi/glue.c | 12 +++- > drivers/pci/pci-acpi.c | 12 +++- > drivers/pnp/pnpacpi/core.c | 19 +-- > drivers/usb/core/usb-acpi.c | 40 > include/acpi/acpi_bus.h |2 +- > 5 files changed, 36 insertions(+), 49 deletions(-) > > Index: linux-pm/include/acpi/acpi_bus.h > === > --- linux-pm.orig/include/acpi/acpi_bus.h > +++ linux-pm/include/acpi/acpi_bus.h > @@ -414,7 +414,7 @@ struct acpi_bus_type { > struct list_head list; > const char *name; > bool (*match)(struct device *dev); > - int (*find_device) (struct device *, acpi_handle *); > + struct acpi_device * (*find_companion)(struct device *); > void (*setup)(struct device *); > void (*cleanup)(struct device *); > }; > Index: linux-pm/drivers/acpi/glue.c > === > --- linux-pm.orig/drivers/acpi/glue.c > +++ linux-pm/drivers/acpi/glue.c > @@ -37,7 +37,7 @@ int register_acpi_bus_type(struct acpi_b > { > if (acpi_disabled) > return -ENODEV; > - if (type && type->match && type->find_device) { > + if (type && type->match && type->find_companion) { > down_write(_type_sem); > list_add_tail(>list, _type_list); > up_write(_type_sem); > @@ -302,17 +302,19 @@ EXPORT_SYMBOL_GPL(acpi_unbind_one); > static int acpi_platform_notify(struct device *dev) > { > struct acpi_bus_type *type = acpi_get_bus_type(dev); > - acpi_handle handle; > int ret; > > ret = acpi_bind_one(dev, NULL); > if (ret && type) { > - ret = type->find_device(dev, ); > - if (ret) { > + struct acpi_device *adev; > + > + adev = type->find_companion(dev); > + if (!adev) { > DBG("Unable to get handle for %s\n", dev_name(dev)); > + ret = -ENODEV; > goto out; > } > - ret = acpi_bind_one(dev, handle); > + ret = acpi_bind_one(dev, adev->handle); > if (ret) > goto out; > } > Index: linux-pm/drivers/pci/pci-acpi.c > === > --- linux-pm.orig/drivers/pci/pci-acpi.c > +++ linux-pm/drivers/pci/pci-acpi.c > @@ -306,10 +306,9 @@ void acpi_pci_remove_bus(struct pci_bus > } > > /* ACPI bus type */ > -static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) > +static struct acpi_device *acpi_pci_find_companion(struct device *dev) > { > struct pci_dev *pci_dev = to_pci_dev(dev); > - struct acpi_device *adev; > bool check_children; > u64 addr; > > @@ -322,13 +321,8 @@ static int acpi_pci_find_device(struct d > || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS; > /* Please ref to ACPI spec for the syntax of _ADR */ > addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); > - adev = acpi_find_child_device(ACPI_COMPANION(dev->parent), addr, > + return acpi_find_child_device(ACPI_COMPANION(dev->parent), addr, > check_children); > - if (adev) { > - *handle = adev->handle; > - return 0; > - } > - return -ENODEV; > } > > static void pci_acpi_setup(struct device *dev) > @@ -368,7 +362,7 @@ static bool pci_acpi_bus_match(struct de > static struct acpi_bus_type acpi_pci_bus = { > .name = "PCI", > .match = pci_acpi_bus_match, > - .find_device = acpi_pci_find_device, > + .find_companion = acpi_pci_find_companion, > .setup = pci_acpi_setup, > .cleanup = pci_acpi_cleanup, > }; > Index: linux-pm/drivers/pnp/pnpacpi/core.c > === > --- linux-pm.orig/drivers/pnp/pnpacpi/core.c > +++ linux-pm/drivers/pnp/pnpacpi/core.c > @@ -329,20 +329,11 @@ static int __init acpi_pnp_match(struct > && compare_pnp_id(pnp->id, acpi_device_hid(acpi)); > } > > -static int __init acpi_pnp_find_device(struct device *dev, acpi_handle * > handle) > +static struct acpi_device * __init acpi_pnp_find_companion(struct device > *dev) > {
Re: [PATCH] crypto: remove unnecessary includes
On Thu, Nov 28, 2013 at 07:16:27PM +0200, Cristian Stoica wrote: > Signed-off-by: Cristian Stoica > --- > crypto/authenc.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/crypto/authenc.c b/crypto/authenc.c > index 1875e70..7d4bfaa 100644 > --- a/crypto/authenc.c > +++ b/crypto/authenc.c > @@ -17,11 +17,8 @@ > #include > #include > #include > -#include > #include > #include > -#include > -#include > > typedef u8 *(*authenc_ahash_t)(struct aead_request *req, unsigned int flags); Why are these includes unnecessary? -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 6/8] perf sched: Introduce timehist command
On 11/28/13, 5:48 PM, Namhyung Kim wrote: Do we really need to look up the callchain to find out an idle thread? $ perf sched script | grep swapper | head swapper 0 [001] 4294177.326996: sched:sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=Xorg next_pid=1094 next_prio=120 swapper 0 [010] 4294177.327019: sched:sched_switch: prev_comm=swapper/10 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=perf next_pid=13902 next_prio=120 perf 13901 [002] 4294177.327074: sched:sched_switch: prev_comm=perf prev_pid=13901 prev_prio=120 prev_state=S ==> next_comm=swapper/2 next_pid=0 next_prio=120 swapper 0 [004] 4294177.327096: sched:sched_switch: prev_comm=swapper/4 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=synergys next_pid=1521 next_prio=120 swapper 0 [000] 4294177.327102: sched:sched_switch: prev_comm=swapper/0 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=gnome-terminal next_pid=2392 next_prio=120 Xorg 1094 [001] 4294177.327112: sched:sched_switch: prev_comm=Xorg prev_pid=1094 prev_prio=120 prev_state=S ==> next_comm=swapper/1 next_pid=0 next_prio=120 swapper 0 [007] 4294177.327122: sched:sched_switch: prev_comm=swapper/7 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=perf next_pid=13902 next_prio=120 migration/1058 [010] 4294177.327124: sched:sched_switch: prev_comm=migration/10 prev_pid=58 prev_prio=0 prev_state=S ==> next_comm=swapper/10 next_pid=0 next_prio=120 synergys 1521 [004] 4294177.327144: sched:sched_switch: prev_comm=synergys prev_pid=1521 prev_prio=120 prev_state=S ==> next_comm=swapper/4 next_pid=0 next_prio=120 gnome-terminal 2392 [000] 4294177.327286: sched:sched_switch: prev_comm=gnome-terminal prev_pid=2392 prev_prio=120 prev_state=S ==> next_comm=swapper/0 next_pid=0 next_prio=120 It seems every idle/swapper thread for each cpu has a pid of 0. The command was developed using context-switch events. Try the next patch and use: perf record -e cs -c 1 -ag perf sched timehist David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 07/12] thunderbolt: Enable plug events
Thunderbolt switches have a plug events capability. This patch adds the tb_plug_events_active method and uses it to activate plug events on switch allocation. Signed-off-by: Andreas Noever --- drivers/thunderbolt/tb.c | 49 +++- drivers/thunderbolt/tb.h | 1 + 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c index 943842b..3837f1a 100644 --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c @@ -192,6 +192,41 @@ int tb_find_cap(struct tb_port *port, enum tb_cfg_space space, enum tb_cap cap) return -EIO; } + +/* thunderbolt switch utility functions */ + +/** + * tb_plug_events_active() - enable/disable plug events on a switch + * + * Also configures a sane plug_events_delay of 255ms. + * + * Return: Returns 0 on success or an error code on failure. + */ +static int tb_plug_events_active(struct tb_switch *sw, bool active) +{ + u32 data; + int res; + + sw->config.plug_events_delay = 0xff; + res = tb_sw_write(sw, ((u32 *) >config) + 4, TB_CFG_SWITCH, 4, 1); + if (res) + return res; + + res = tb_sw_read(sw, , TB_CFG_SWITCH, sw->cap_plug_events + 1, 1); + if (res) + return res; + + if (active) { + data = data & 0xFF83; + if (sw->config.device_id == 0x1547) + data |= 4; + } else { + data = data | 0x7c; + } + return tb_sw_write(sw, , TB_CFG_SWITCH, + sw->cap_plug_events + 1, 1); +} + /* switch/port allocation & initialization */ /** @@ -236,6 +271,7 @@ static void tb_switch_free(struct tb_switch *sw) static struct tb_switch *tb_switch_alloc(struct tb *tb, u64 route) { int i; + int cap; struct tb_switch *sw; int upstream_port = tb_cfg_get_upstream_port(tb->cfg, route); if (upstream_port < 0) @@ -296,6 +332,16 @@ static struct tb_switch *tb_switch_alloc(struct tb *tb, u64 route) /* TODO: I2C, IECS, EEPROM, link controller */ + cap = tb_find_cap(>ports[0], TB_CFG_SWITCH, TB_CAP_PLUG_EVENTS); + if (cap < 0) { + tb_sw_WARN(sw, "cannot find TB_CAP_PLUG_EVENTS aborting\n"); + goto err; + } + sw->cap_plug_events = cap; + + if (tb_plug_events_active(sw, true)) + goto err; + return sw; err: kfree(sw->ports); @@ -401,7 +447,8 @@ void thunderbolt_shutdown_and_free(struct tb *tb) /** * thunderbolt_alloc_and_start() - setup the thunderbolt bus * - * Allocates a tb_cfg control channel and initializes the root switch. + * Allocates a tb_cfg control channel, initializes the root switch and enables + * plug events. * * Return: Returns NULL on error. */ diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h index e81c63a..2ada42a 100644 --- a/drivers/thunderbolt/tb.h +++ b/drivers/thunderbolt/tb.h @@ -22,6 +22,7 @@ struct tb_switch { struct tb_regs_switch_header config; struct tb_port *ports; struct tb *tb; + int cap_plug_events; /* offset, zero if not found */ bool invalid; /* unplugged, will go away */ }; -- 1.8.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 09/12] thunderbolt: Handle hotplug events
We reveive a plug event callback whenever a thunderbolt device is added or removed. This patch fills in the tb_handle_hotplug method and starts reacting to these events by adding/removing switches from the hierarchy. Signed-off-by: Andreas Noever --- drivers/thunderbolt/tb.c | 83 +++- 1 file changed, 82 insertions(+), 1 deletion(-) diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c index 9daff7b..d9bce38 100644 --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c @@ -108,6 +108,22 @@ static int tb_route_length(u64 route) return (fls64(route) + TB_ROUTE_SHIFT - 1) / TB_ROUTE_SHIFT; } +static struct tb_switch *get_switch_at_route(struct tb_switch *sw, u64 route) +{ + u8 next_port = route & TB_PORT_MASK; + if (route == 0) + return sw; + if (next_port > sw->config.max_port_number) + return 0; + if (tb_is_upstream_port(>ports[next_port])) + return 0; + if (!sw->ports[next_port].remote) + return 0; + return get_switch_at_route(sw->ports[next_port].remote->sw, + route >> TB_ROUTE_SHIFT); +} + + /* thunderbolt capability lookup */ @@ -527,6 +543,27 @@ static void tb_scan_port(struct tb_port *port) tb_scan_ports(sw); } +/** + * tb_invalidate_below() - recursively invalidate all ports below a given port + */ +static void tb_invalidate_below(struct tb_port *port) +{ + struct tb_switch *sw; + int i; + if (tb_is_upstream_port(port)) { + tb_port_WARN(port, "trying to invalidate an upstream port.\n"); + return; + } + if (!port->remote) + return; + sw = port->remote->sw; + for (i = 0; i <= sw->config.max_port_number; i++) { + sw->ports[i].invalid = true; + if (!tb_is_upstream_port(>ports[i])) + tb_invalidate_below(>ports[i]); + } +} + struct tb_hotplug_event { struct work_struct work; struct tb *tb; @@ -544,10 +581,54 @@ static void tb_handle_hotplug(struct work_struct *work) { struct tb_hotplug_event *ev = container_of(work, typeof(*ev), work); struct tb *tb = ev->tb; + struct tb_switch *sw; + struct tb_port *port; mutex_lock(>lock); if (tb->shutdown) goto out; - /* do nothing for now */ + + sw = get_switch_at_route(tb->root_switch, ev->route); + if (!sw) { + tb_WARN(tb, + "hotplug event for non existent switch %llx:%x (unplug: %d)\n", + ev->route, + ev->port, + ev->unplug) + goto out; + } + if (sw->config.max_port_number < ev->port) { + tb_WARN(tb, + "hotplug event for non existent port %llx:%x (unplug: %d)\n", + ev->route, + ev->port, + ev->unplug) + goto out; + } + port = >ports[ev->port]; + if (tb_is_upstream_port(port)) { + tb_WARN(tb, + "hotplug event for upstream port %llx:%x (unplug: %d)\n", + ev->route, + ev->port, + ev->unplug) + goto out; + } + if (ev->unplug) { + if (port->remote) { + tb_port_info(port, "unplugged\n"); + tb_invalidate_below(port); + tb_switch_free(port->remote->sw); + port->remote = NULL; + } else { + tb_port_info(port, +"got unplug event for disconnected port\n"); + } + } else { + tb_port_info(port, "hotplug: scanning\n"); + tb_scan_port(port); + if (!port->remote) + tb_port_info(port, "hotplug: no switch found\n"); + } out: mutex_unlock(>lock); kfree(ev); -- 1.8.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 03/12] thunderbolt: Setup configuration channel
Add struct tb which will contain our view of the thunderbolt bus. For now it just contains a pointer to the configuration channel and a workqueue for hotplug events. Add thunderbolt_alloc_and_start() and thunderbolt_shutdown_and_free() which are responsible for setup and teardown of struct tb. Signed-off-by: Andreas Noever --- drivers/thunderbolt/Makefile | 2 +- drivers/thunderbolt/dsl3510.c | 18 +- drivers/thunderbolt/tb.c | 124 ++ drivers/thunderbolt/tb.h | 34 4 files changed, 175 insertions(+), 3 deletions(-) create mode 100644 drivers/thunderbolt/tb.c create mode 100644 drivers/thunderbolt/tb.h diff --git a/drivers/thunderbolt/Makefile b/drivers/thunderbolt/Makefile index f486295..7c5b811 100644 --- a/drivers/thunderbolt/Makefile +++ b/drivers/thunderbolt/Makefile @@ -1,3 +1,3 @@ obj-${CONFIG_THUNDERBOLT} := thunderbolt.o -thunderbolt-objs := dsl3510.o tb_cfg.o +thunderbolt-objs := dsl3510.o tb_cfg.o tb.o diff --git a/drivers/thunderbolt/dsl3510.c b/drivers/thunderbolt/dsl3510.c index 2a326f6..434812b 100644 --- a/drivers/thunderbolt/dsl3510.c +++ b/drivers/thunderbolt/dsl3510.c @@ -12,6 +12,7 @@ #include "dsl3510.h" #include "dsl3510_regs.h" +#include "tb.h" #define RING_TYPE(ring) ((ring)->is_tx ? "TX ring" : "RX ring") @@ -481,6 +482,7 @@ static void dsl3510_shutdown(struct tb_nhi *nhi) static int dsl3510_probe(struct pci_dev *pdev, const struct pci_device_id *id) { struct tb_nhi *nhi; + struct tb *tb; int res; res = pcim_enable_device(pdev); @@ -543,14 +545,26 @@ static int dsl3510_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* magic value - clock related? */ iowrite32(3906250 / 1, nhi->iobase + 0x38c00); - pci_set_drvdata(pdev, nhi); /* for dsl3510_remove only */ + dev_info(>pdev->dev, "NHI initialized, starting thunderbolt\n"); + tb = thunderbolt_alloc_and_start(nhi); + if (!tb) { + /* +* At this point the RX/TX rings might already have been +* activated. Do a proper shutdown. +*/ + dsl3510_shutdown(nhi); + return -EIO; + } + pci_set_drvdata(pdev, tb); /* for dsl3510_remove only */ return 0; } static void dsl3510_remove(struct pci_dev *pdev) { - struct tb_nhi *nhi = pci_get_drvdata(pdev); + struct tb *tb = pci_get_drvdata(pdev); + struct tb_nhi *nhi = tb->nhi; + thunderbolt_shutdown_and_free(tb); dsl3510_shutdown(nhi); } diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c new file mode 100644 index 000..64deb7b --- /dev/null +++ b/drivers/thunderbolt/tb.c @@ -0,0 +1,124 @@ +/* + * Device independent Thunderbolt bus logic + * + * Copyright (c) 2013 Andreas Noever + */ + +#include +#include +#include + +#include "tb.h" + +struct tb_hotplug_event { + struct work_struct work; + struct tb *tb; + u64 route; + u8 port; + bool unplug; +}; + +/** + * tb_handle_hotplug() - handle hotplug event + * + * Executes on the tb->wq. + */ +static void tb_handle_hotplug(struct work_struct *work) +{ + struct tb_hotplug_event *ev = container_of(work, typeof(*ev), work); + struct tb *tb = ev->tb; + mutex_lock(>lock); + if (tb->shutdown) + goto out; + /* do nothing for now */ +out: + mutex_unlock(>lock); + kfree(ev); +} + +/** + * tb_schedule_hotplug_handler() - callback function for the config channel + * + * Delegates to tb_handle_hotplug. + */ +static void tb_schedule_hotplug_handler(void *data, u64 route, u8 port, + bool unplug) +{ + struct tb *tb = data; + struct tb_hotplug_event *ev = kmalloc(sizeof(*ev), GFP_KERNEL); + if (!ev) + return; + INIT_WORK(>work, tb_handle_hotplug); + ev->tb = tb; + ev->route = route; + ev->port = port; + ev->unplug = unplug; + queue_work(tb->wq, >work); +} + +/** + * thunderbolt_shutdown_and_free() - shutdown everything + * + * Free the config channel. + */ +void thunderbolt_shutdown_and_free(struct tb *tb) +{ + mutex_lock(>lock); + tb->shutdown = true; /* signal tb_handle_hotplug to quit */ + + if (tb->cfg) + tb_cfg_free(tb->cfg); + tb->cfg = NULL; + + /* allow tb_handle_hotplug to acquire the lock */ + mutex_unlock(>lock); + if (tb->wq) { + flush_workqueue(tb->wq); + destroy_workqueue(tb->wq); + tb->wq = NULL; + } + mutex_destroy(>lock); + kfree(tb); +} + +/** + * thunderbolt_alloc_and_start() - setup the thunderbolt bus + * + * Allocates a tb_cfg control channel. + * + * Return: Returns NULL on error. + */ +struct tb *thunderbolt_alloc_and_start(struct tb_nhi *nhi) +{ + struct tb *tb; + + tb =
[PATCH 04/12] thunderbolt: Add tb_regs.h
Every thunderbolt device consists (logically) of a switch with multiple ports. Every port contains multiple config regions (HOPS, PORT, SWITCH, COUNTERS) which are used to configure the device. The tb_regs.h file contains all known registers and capabilities from these config regions. Signed-off-by: Andreas Noever --- drivers/thunderbolt/tb_regs.h | 187 ++ 1 file changed, 187 insertions(+) create mode 100644 drivers/thunderbolt/tb_regs.h diff --git a/drivers/thunderbolt/tb_regs.h b/drivers/thunderbolt/tb_regs.h new file mode 100644 index 000..bd3ad67 --- /dev/null +++ b/drivers/thunderbolt/tb_regs.h @@ -0,0 +1,187 @@ +/* + * Thunderbolt Port/Switch config area registers + * + * Copyright (c) 2013 Andreas Noever + */ + +#ifndef _TB_REGS +#define _TB_REGS + +#include + +/* + * TODO: should be 63? But we do not know how to receive frames larger than 256 + * bytes. (header + checksum = 16, 60*4 = 240) + */ +#define TB_MAX_CONFIG_RW_LENGTH 60 + +enum tb_cap { + TB_CAP_PHY = 0x0001, + TB_CAP_TIME1= 0x0003, + TB_CAP_PCIE = 0x0004, + TB_CAP_I2C = 0x0005, + TB_CAP_PLUG_EVENTS = 0x0105, /* also EEPROM */ + TB_CAP_TIME2= 0x0305, + TB_CAL_IECS = 0x0405, + TB_CAP_LINK_CONTROLLER = 0x0605, /* also IECS */ +}; + +enum tb_port_state { + TB_PORT_DISABLED= 0, /* tb_cap_phy.disable == 1 */ + TB_PORT_CONNECTING = 1, /* retry */ + TB_PORT_UP = 2, + TB_PORT_UNPLUGGED = 7, +}; + +/* capability headers */ + +struct tb_cap_basic { + u8 next; + /* enum tb_cap cap:8; prevent "narrower than values of its type" */ + u8 cap; /* if cap == 0x05 then we have a extended capability */ +} __packed; + +struct tb_cap_extended_short { + u8 next; /* if next and length are zero then we have a long cap */ + enum tb_cap cap:16; + u8 length; +} __packed; + +struct tb_cap_extended_long { + u8 zero1; + enum tb_cap cap:16; + u8 zero2; + u16 next; + u16 length; +} __packed; + +/* capabilities */ + +struct tb_cap_link_controller { + struct tb_cap_extended_long cap_header; + u32 count:4; /* number of link controllers */ + u32 unknown1:4; + u32 base_offset:8; /* + * offset (into this capability) of the configuration + * area of the first link controller + */ + u32 length:12; /* link controller configuration area length */ + u32 unknown2:4; /* TODO check that length is correct */ +} __packed; + +struct tb_cap_phy { + struct tb_cap_basic cap_header; + u32 unknown1:16; + u32 unknown2:14; + bool disable:1; + u32 unknown3:11; + enum tb_port_state state:4; + u32 unknown4:2; +} __packed; + +struct tb_cap_plug_events { + struct tb_cap_extended_short cap_header; + u32 __unknown1:2; + u32 plug_events:5; + u32 __unknown2:25; +} __packed; + +/* device headers */ + +/* Present on port 0 in TB_CFG_SWITCH at address zero. */ +struct tb_regs_switch_header { + /* DWORD 0 */ + u16 vendor_id; + u16 device_id; + /* DWORD 1 */ + u32 first_cap_offset:8; + u32 upstream_port_number:6; + u32 max_port_number:6; + u32 depth:3; + u32 __unknown1:1; + u32 revision:8; + /* DWORD 2 */ + u32 route_lo; + /* DWORD 3 */ + u32 route_hi:31; + bool enabled:1; + /* DWORD 4 */ + u32 plug_events_delay:8; /* + * RW, pause between plug events in + * milliseconds. Writing 0x00 is interpreted + * as 255ms. + */ + u32 __unknown4:16; + u32 thunderbolt_version:8; +} __packed; + +enum tb_port_type { + TB_TYPE_INACTIVE= 0x00, + TB_TYPE_PORT= 0x01, + TB_TYPE_NHI = 0x02, + /* TB_TYPE_ETHERNET = 0x02, lower order bits are not known */ + /* TB_TYPE_SATA = 0x08, lower order bits are not known */ + TB_TYPE_DP_HDMI_IN = 0x0e0101, + TB_TYPE_DP_HDMI_OUT = 0x0e0102, + TB_TYPE_PCIE_DOWN = 0x100101, + TB_TYPE_PCIE_UP = 0x100102, + /* TB_TYPE_USB = 0x20, lower order bits are not known */ +}; + +/* Present on every port in TB_CF_PORT at address zero. */ +struct tb_regs_port_header { + /* DWORD 0 */ + u16 vendor_id; + u16 device_id; + /* DWORD 1 */ + u32 first_cap_offset:8; + u32 __unknown1:16; + u32 revision:8; + /* DWORD 2 */ + enum tb_port_type type:24; + u32 thunderbolt_version:8; + /* DWORD 3 */ + u32 __unknown2:20; + u32 port_number:6; + u32 __unknown3:6; +
[PATCH 08/12] thunderbolt: Scan for downstream switches
Add utility methods tb_port_state and tb_wait_for_port. Add tb_scan_port which checks whether a port is connected and if so allocates a downstream switch. Signed-off-by: Andreas Noever --- drivers/thunderbolt/tb.c | 160 +++ drivers/thunderbolt/tb.h | 17 + 2 files changed, 177 insertions(+) diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c index 3837f1a..9daff7b 100644 --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c @@ -84,6 +84,25 @@ static void tb_dump_port(struct tb *tb, struct tb_regs_port_header *port) port->nfc_credits); } + +/** + * tb_downstream_route() - get route to downstream switch + * + * Port must not be the upstream port (otherwise a loop is created). + * + * Return: Returns a route to the switch behind @port. + */ +static u64 tb_downstream_route(struct tb_port *port) +{ + return tb_route(port->sw) + | ((u64) port->port << (port->sw->config.depth * 8)); +} + +static bool tb_is_upstream_port(struct tb_port *port) +{ + return port == tb_upstream_port(port->sw); +} + static int tb_route_length(u64 route) { return (fls64(route) + TB_ROUTE_SHIFT - 1) / TB_ROUTE_SHIFT; @@ -192,6 +211,84 @@ int tb_find_cap(struct tb_port *port, enum tb_cfg_space space, enum tb_cap cap) return -EIO; } +/* thunderbolt port utility functions */ + +/** + * tb_port_state() - get connectedness state of a port + * + * The port must have a TB_CAP_PHY (i.e. it should be a real port). + * + * Return: Returns a tb_port_state on success or an error code on failure. + */ +static enum tb_port_state tb_port_state(struct tb_port *port) +{ + struct tb_cap_phy phy; + int res; + if (port->cap_phy == 0) { + tb_port_WARN(port, "does not have a PHY\n"); + return -EINVAL; + } + res = tb_port_read(port, , TB_CFG_PORT, port->cap_phy, 2); + if (res) + return res; + return phy.state; +} + +/** + * tb_wait_for_port() - wait for a port to become ready + * + * Check if the port is connected but not up. If so we wait for some + * time to see whether it comes up. + * + * Return: Returns an error code on failure. Returns 0 if the port is not + * connected or failed to reach state TB_PORT_UP within one second. Returns 1 + * if the port is connected and in state TB_PORT_UP. + */ +static int tb_wait_for_port(struct tb_port *port) +{ + int retries = 10; + enum tb_port_state state; + if (!port->cap_phy) { + tb_port_WARN(port, "does not have PHY\n"); + return -EINVAL; + } + if (tb_is_upstream_port(port)) { + tb_port_WARN(port, "is the upstream port\n"); + return -EINVAL; + } + + while (retries--) { + state = tb_port_state(port); + if (state < 0) + return state; + if (state == TB_PORT_DISABLED) { + tb_port_info(port, "is disabled (state: 0)\n"); + return 0; + } + if (state == TB_PORT_UNPLUGGED) { + tb_port_info(port, "is unplugged (state: 7)\n"); + return 0; + } + if (state == TB_PORT_UP) { + tb_port_info(port, +"is connected, link is up (state: 2)\n"); + return 1; + } + + /* +* After plug-in the state is TB_PORT_CONNECTING. Give it some +* time. +*/ + tb_port_info(port, +"is connected, link is not up (state: %d), retrying...\n", +state); + msleep(100); + } + tb_port_WARN(port, +"failed to reach state TB_PORT_UP. Ignoring port...\n"); + return 0; +} + /* thunderbolt switch utility functions */ @@ -240,13 +337,25 @@ static int tb_plug_events_active(struct tb_switch *sw, bool active) static int tb_init_port(struct tb_switch *sw, u8 port_nr) { int res; + int cap; struct tb_port *port = >ports[port_nr]; port->sw = sw; port->port = port_nr; + port->remote = NULL; res = tb_port_read(port, >config, TB_CFG_PORT, 0, 8); if (res) return res; + /* Port 0 is the switch itself and has no PHY. */ + if (port->config.type == TB_TYPE_PORT && port_nr != 0) { + cap = tb_find_cap(port, TB_CFG_PORT, TB_CAP_PHY); + + if (cap > 0) + port->cap_phy = cap; + else + tb_port_WARN(port, "non switch port without a PHY\n"); + } + tb_dump_port(sw->tb, >config); /* TODO: Read dual link port, DP port and more from EEPROM. */ @@ -259,6 +368,14 @@ static int tb_init_port(struct
[PATCH 05/12] thunderbolt: Initialize root switch and ports
This patch adds the structures tb_switch and tb_port as well as code to reset and configure the root switch. Signed-off-by: Andreas Noever --- drivers/thunderbolt/tb.c | 229 ++- drivers/thunderbolt/tb.h | 113 +++ 2 files changed, 340 insertions(+), 2 deletions(-) diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c index 64deb7b..d2df3be 100644 --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c @@ -8,7 +8,217 @@ #include #include +#include "dsl3510.h" #include "tb.h" +#include "tb_regs.h" + +/* utility functions */ + +static void tb_dump_switch(struct tb *tb, struct tb_regs_switch_header *sw) +{ + tb_info(tb, + " Switch: %x:%x (Revision: %d, TB Version: %d)\n", + sw->vendor_id, + sw->device_id, + sw->revision, + sw->thunderbolt_version); + tb_info(tb, " Max Port Number: %d\n", sw->max_port_number); + tb_info(tb, " Config:\n"); + tb_info(tb, + " Upstream Port Number: %d Depth: %d Route String: %#llx Enabled: %d, PlugEventsDelay: %dms\n", + sw->upstream_port_number, + sw->depth, + (((u64) sw->route_hi) << 32) | sw->route_lo, + sw->enabled, + sw->plug_events_delay); + tb_info(tb, + " unknown1: %#x unknown4: %#x\n", + sw->__unknown1, + sw->__unknown4); +} + +static char *tb_port_type(struct tb_regs_port_header *port) +{ + switch (port->type >> 16) { + case 0: + switch ((u8) port->type) { + case 0: + return "Inactive"; + case 1: + return "Port"; + case 2: + return "NHI"; + default: + return "unknown"; + } + case 0x2: + return "Ethernet"; + case 0x8: + return "SATA"; + case 0xe: + return "DP/HDMI"; + case 0x10: + return "PCIe"; + case 0x20: + return "USB"; + default: + return "unknown"; + } +} + +static void tb_dump_port(struct tb *tb, struct tb_regs_port_header *port) +{ + tb_info(tb, + " Port %d: %x:%x (Revision: %d, TB Version: %d, Type: %s (%#x))\n", + port->port_number, + port->vendor_id, + port->device_id, + port->revision, + port->thunderbolt_version, + tb_port_type(port), + port->type); + tb_info(tb, + " Max hop id (in/out): %d/%d, NFC Credits: %#x\n", + port->max_in_hop_id, + port->max_out_hop_id, + port->nfc_credits); +} + +static int tb_route_length(u64 route) +{ + return (fls64(route) + TB_ROUTE_SHIFT - 1) / TB_ROUTE_SHIFT; +} + +/* switch/port allocation & initialization */ + +/** + * tb_init_port() - initialize a port + * + * This is a helper method for tb_switch_alloc. Does not check or initialize + * any downstream switches. + * + * Return: Returns 0 on success or an error code on failure. + */ +static int tb_init_port(struct tb_switch *sw, u8 port_nr) +{ + int res; + struct tb_port *port = >ports[port_nr]; + port->sw = sw; + port->port = port_nr; + res = tb_port_read(port, >config, TB_CFG_PORT, 0, 8); + if (res) + return res; + + tb_dump_port(sw->tb, >config); + + /* TODO: Read dual link port, DP port and more from EEPROM. */ + return 0; + +} + +/** + * tb_switch_free() - free a tb_switch and all downstream switches + */ +static void tb_switch_free(struct tb_switch *sw) +{ + kfree(sw->ports); + kfree(sw); +} + +/** + * tb_switch_alloc() - allocate and initialize a switch + * + * Return: Returns a NULL on failure. + */ +static struct tb_switch *tb_switch_alloc(struct tb *tb, u64 route) +{ + int i; + struct tb_switch *sw; + int upstream_port = tb_cfg_get_upstream_port(tb->cfg, route); + if (upstream_port < 0) + return NULL; + + sw = kzalloc(sizeof(*sw), GFP_KERNEL); + if (!sw) + return NULL; + + sw->tb = tb; + if (tb_cfg_read(tb->cfg, >config, route, 0, 2, 0, 5)) + goto err; + tb_info(tb, + "initializing Switch at %#llx (depth: %d, up port: %d)\n", + route, + tb_route_length(route), + upstream_port); + tb_info(tb, "old switch config:\n"); + tb_dump_switch(tb, >config); + + /* configure switch */ + sw->config.upstream_port_number = upstream_port; + sw->config.depth = tb_route_length(route); + sw->config.route_lo = route; + sw->config.route_hi = route >> 32; + sw->config.enabled = 1; + /* from here on
[PATCH 11/12] thunderbolt: Add support for simple pci tunnels.
A pci downstream and pci upstream port can be connected through a tunnel. To establish the tunnel we have to setup two unidirectional paths between the two ports. Right now we only support paths with two hops (i.e. no chaining) and at most one pci device per thunderbolt device. Signed-off-by: Andreas Noever --- drivers/thunderbolt/Makefile | 2 +- drivers/thunderbolt/tb.c | 27 ++ drivers/thunderbolt/tb.h | 2 + drivers/thunderbolt/tb_pci.c | 215 +++ drivers/thunderbolt/tb_pci.h | 29 ++ 5 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 drivers/thunderbolt/tb_pci.c create mode 100644 drivers/thunderbolt/tb_pci.h diff --git a/drivers/thunderbolt/Makefile b/drivers/thunderbolt/Makefile index 7c5b811..35f2147 100644 --- a/drivers/thunderbolt/Makefile +++ b/drivers/thunderbolt/Makefile @@ -1,3 +1,3 @@ obj-${CONFIG_THUNDERBOLT} := thunderbolt.o -thunderbolt-objs := dsl3510.o tb_cfg.o tb.o +thunderbolt-objs := dsl3510.o tb_cfg.o tb.o tb_pci.o diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c index 0fea997..9f25935 100644 --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c @@ -11,6 +11,7 @@ #include "dsl3510.h" #include "tb.h" #include "tb_regs.h" +#include "tb_pci.h" /* utility functions */ @@ -824,6 +825,19 @@ static void tb_invalidate_below(struct tb_port *port) } } +static void destroy_invalid_tunnels(struct tb *tb) +{ + struct tb_pci_tunnel *tunnel; + struct tb_pci_tunnel *n; + list_for_each_entry_safe(tunnel, n, >tunnel_list, list) + { + if (tb_pci_is_invalid(tunnel)) { + tb_pci_deactivate(tunnel); + tb_pci_free(tunnel); + } + } +} + struct tb_hotplug_event { struct work_struct work; struct tb *tb; @@ -877,6 +891,7 @@ static void tb_handle_hotplug(struct work_struct *work) if (port->remote) { tb_port_info(port, "unplugged\n"); tb_invalidate_below(port); + destroy_invalid_tunnels(tb); tb_switch_free(port->remote->sw); port->remote = NULL; } else { @@ -918,12 +933,23 @@ static void tb_schedule_hotplug_handler(void *data, u64 route, u8 port, * thunderbolt_shutdown_and_free() - shutdown everything * * Free all switches and the config channel. + * + * Only tb->lock and tb->tunnel_list must be initialized. If tb->tunnel_list + * is populated then we assume that tb->cfg is setup. */ void thunderbolt_shutdown_and_free(struct tb *tb) { + struct tb_pci_tunnel *tunnel; + struct tb_pci_tunnel *n; + mutex_lock(>lock); tb->shutdown = true; /* signal tb_handle_hotplug to quit */ + list_for_each_entry_safe(tunnel, n, >tunnel_list, list) { + tb_pci_deactivate(tunnel); + tb_pci_free(tunnel); + } + if (tb->root_switch) tb_switch_free(tb->root_switch); tb->root_switch = NULL; @@ -966,6 +992,7 @@ struct tb *thunderbolt_alloc_and_start(struct tb_nhi *nhi) tb->nhi = nhi; mutex_init(>lock); mutex_lock(>lock); + INIT_LIST_HEAD(>tunnel_list); tb->wq = alloc_ordered_workqueue("thunderbolt", 0); if (!tb->wq) diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h index cc1f079..bb9a9de 100644 --- a/drivers/thunderbolt/tb.h +++ b/drivers/thunderbolt/tb.h @@ -104,10 +104,12 @@ struct tb { struct tb_cfg *cfg; struct workqueue_struct *wq; /* ordered workqueue for plug events */ struct tb_switch *root_switch; + struct list_head tunnel_list; /* list of active PCIe tunnels */ bool shutdown; /* * Once this is set tb_handle_hotplug will exit (once it * can aquire lock at least once). Used to drain wq. */ + }; /** diff --git a/drivers/thunderbolt/tb_pci.c b/drivers/thunderbolt/tb_pci.c new file mode 100644 index 000..42a173b --- /dev/null +++ b/drivers/thunderbolt/tb_pci.c @@ -0,0 +1,215 @@ +/* + * Thunderbolt PCIe tunnel + * + * Copyright (c) 2013 Andreas Noever + */ + +#include +#include + +#include "tb_pci.h" +#include "tb.h" + +#define __TB_TUNNEL_PRINT(level, tunnel, fmt, arg...) \ + do {\ + struct tb_pci_tunnel *__tunnel = (tunnel); \ + level(__tunnel->tb, "%llx:%x <-> %llx:%x (PCI): " fmt, \ + tb_route(__tunnel->down_port->sw),\ + __tunnel->down_port->port,\ + tb_route(__tunnel->up_port->sw), \ + __tunnel->up_port->port, \ + ## arg);
[PATCH 10/12] thunderbolt: Add path setup code.
A thunderbolt path is a unidirectional channel between two thunderbolt ports. Two such paths are needed to establish a pci tunnel. This patch introduces struct tb_path as well as a set of tb_path_* methods which are used do activate & deactive paths. Signed-off-by: Andreas Noever --- drivers/thunderbolt/tb.c | 260 +++ drivers/thunderbolt/tb.h | 60 +++ 2 files changed, 320 insertions(+) diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c index d9bce38..0fea997 100644 --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c @@ -84,6 +84,35 @@ static void tb_dump_port(struct tb *tb, struct tb_regs_port_header *port) port->nfc_credits); } +static void tb_dump_hop(struct tb_port *port, struct tb_regs_hop *hop) +{ + tb_port_info(port, +" Hop through port %d to hop %d (%s)\n", +hop->out_port, +hop->next_hop, +hop->enable ? "enabled" : "disabled"); + tb_port_info(port, +" Weight: %d Priority: %d Credits: %d Drop: %d\n", +hop->weight, +hop->priority, +hop->initial_credits, +hop->drop_packages); + tb_port_info(port, +" Counter enabled: %d Counter index: %d\n", +hop->counter_enable, +hop->counter); + tb_port_info(port, +" Flow Control (In/Eg): %d/%d Shared Buffer (In/Eg): %d/%d\n", +hop->ingress_fc, +hop->egress_fc, +hop->ingress_shared_buffer, +hop->egress_shared_buffer); + tb_port_info(port, +" Unknown1: %#x Unknown2: %#x Unknown3: %#x\n", +hop->unknown1, +hop->unknown2, +hop->unknown3); +} /** * tb_downstream_route() - get route to downstream switch @@ -305,6 +334,40 @@ static int tb_wait_for_port(struct tb_port *port) return 0; } +/** + * tb_port_add_nfc_credits() - add/remove non flow controlled credits to port + * + * Change the number of NFC credits allocated to @port by @credits. To remove + * NFC credits pass a negative amount of credits. + * + * Return: Returns 0 on success or an error code on failure. + */ +static int tb_port_add_nfc_credits(struct tb_port *port, int credits) +{ + if (credits == 0) + return 0; + tb_port_info(port, +"adding %#x NFC credits (%#x -> %#x)", +credits, +port->config.nfc_credits, +port->config.nfc_credits + credits); + port->config.nfc_credits += credits; + return tb_port_write(port, >config.nfc_credits, +TB_CFG_PORT, 4, 1); +} + +/** + * tb_port_clear_counter() - clear a counter in TB_CFG_COUNTER + * + * Return: Returns 0 on success or an error code on failure. + */ +static int tb_port_clear_counter(struct tb_port *port, int counter) +{ + u32 zero[3] = { 0, 0, 0 }; + tb_port_info(port, "clearing counter %d\n", counter); + return tb_port_write(port, zero, TB_CFG_COUNTERS, 3 * counter, 3); +} + /* thunderbolt switch utility functions */ @@ -482,6 +545,203 @@ err: return NULL; } +/* thunderbolt path handling */ + +/** + * tb_path_alloc() - allocate a thunderbolt path + * + * Return: Returns a tb_path on success or an error code on failure. + */ +struct tb_path *tb_path_alloc(struct tb *tb, int num_hops) +{ + struct tb_path *path = kzalloc(sizeof(*path), GFP_KERNEL); + if (!path) + return NULL; + path->hops = kcalloc(num_hops, sizeof(*path->hops), GFP_KERNEL); + if (!path->hops) { + kfree(path); + return NULL; + } + path->tb = tb; + path->path_length = num_hops; + return path; +} + +/** + * tb_path_free() - free a deactivated path + */ +void tb_path_free(struct tb_path *path) +{ + if (path->activated) { + tb_WARN(path->tb, "trying to free an activated path\n") + return; + } + kfree(path->hops); + kfree(path); +} + +static void __tb_path_deallocate_nfc(struct tb_path *path, int first_hop) +{ + int i, res; + for (i = first_hop; i < path->path_length; i++) { + res = tb_port_add_nfc_credits(path->hops[i].in_port, + -path->nfc_credits); + if (res) + tb_port_warn(path->hops[i].in_port, +"nfc credits deallocation failed for hop %d\n", +i); + } +} + +static void __tb_path_deactivate_hops(struct tb_path *path, int first_hop) +{ + int i, res; + struct tb_regs_hop hop = { }; + for (i = first_hop; i < path->path_length;
[PATCH 12/12] thunderbolt: Scan and activate one PCI device
Use the tb_pci_* methods introduces in the last patch to activate a the first PCI device on every plugged in thunderbolt device. Signed-off-by: Andreas Noever --- drivers/thunderbolt/tb.c | 118 +-- 1 file changed, 115 insertions(+), 3 deletions(-) diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c index 9f25935..0e82afd 100644 --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c @@ -838,6 +838,109 @@ static void destroy_invalid_tunnels(struct tb *tb) } } +/** + * find_pci_up_port() - return the first PCIe up port on @sw + */ +static struct tb_port *find_pci_up_port(struct tb_switch *sw) +{ + int i; + for (i = 1; i <= sw->config.max_port_number; i++) + if (sw->ports[i].config.type == TB_TYPE_PCIE_UP) + return >ports[i]; + return NULL; +} + +/** + * find_unused_down_port() - return the first inactive PCIe down port on @sw + */ +static struct tb_port *find_unused_down_port(struct tb_switch *sw) +{ + int i; + int cap; + int res; + int data; + for (i = 1; i <= sw->config.max_port_number; i++) { + if (tb_is_upstream_port(>ports[i])) + continue; + if (sw->ports[i].config.type != TB_TYPE_PCIE_DOWN) + continue; + cap = tb_find_cap(>ports[i], TB_CFG_PORT, TB_CAP_PCIE); + if (cap <= 0) + continue; + res = tb_port_read(>ports[i], , TB_CFG_PORT, cap, 1); + if (res < 0) + continue; + if (data & 0x8000) + continue; + return >ports[i]; + } + return NULL; +} + +/** + * tb_activate_pcie_devices() - scan for and activate PCIe devices + * + * This method is somewhat ad hoc. For now it only supports one device + * per port and only devices at depth 1. + */ +static void tb_activate_pcie_devices(struct tb *tb) +{ + int i; + int cap; + u32 data; + struct tb_switch *sw; + struct tb_port *up_port; + struct tb_port *down_port; + struct tb_pci_tunnel *tunnel; + /* scan for pcie devices at depth 1*/ + for (i = 1; i <= tb->root_switch->config.max_port_number; i++) { + if (tb_is_upstream_port(>root_switch->ports[i])) + continue; + if (tb->root_switch->ports[i].config.type != TB_TYPE_PORT) + continue; + if (!tb->root_switch->ports[i].remote) + continue; + sw = tb->root_switch->ports[i].remote->sw; + up_port = find_pci_up_port(sw); + if (!up_port) { + tb_sw_info(sw, "no PCIe devices found, aborting\n"); + continue; + } + + /* check whether port is already activated */ + cap = tb_find_cap(up_port, TB_CFG_PORT, TB_CAP_PCIE); + if (cap <= 0) + continue; + if (tb_port_read(up_port, , TB_CFG_PORT, cap, 1)) + continue; + if (data & 0x8000) { + tb_port_info(up_port, +"PCIe port already activated, aborting\n"); + continue; + } + + down_port = find_unused_down_port(tb->root_switch); + if (!down_port) { + tb_port_info(up_port, +"All PCIe down ports are occupied, aborting\n"); + continue; + } + tunnel = tb_pci_alloc(tb, up_port, down_port); + if (!tunnel) { + tb_port_info(up_port, +"PCIe tunnel allocation failed, aborting\n"); + continue; + } + + if (tb_pci_activate(tunnel)) { + tb_port_info(up_port, +"PCIe tunnel activation failed, aborting\n"); + tb_pci_free(tunnel); + } + + } +} + struct tb_hotplug_event { struct work_struct work; struct tb *tb; @@ -901,8 +1004,16 @@ static void tb_handle_hotplug(struct work_struct *work) } else { tb_port_info(port, "hotplug: scanning\n"); tb_scan_port(port); - if (!port->remote) + if (!port->remote) { tb_port_info(port, "hotplug: no switch found\n"); + } else if (port->remote->sw->config.depth > 1) { + tb_sw_warn(port->remote->sw, + "hotplug: chaining not supported\n"); + } else { + tb_sw_info(port->remote->sw, + "hotplug: activating pcie devices\n"); +
[PATCH 01/12] thunderbolt: Add initial cactus ridge NHI support
Thunderbolt hotplug is supposed to be handled by the firmware. But Apple decided to implement thunderbolt at the operating system level. The firmare only initializes thunderbolt devices that are present at boot time. This driver enables hotplug of thunderbolt of non-chained thunderbolt devices on Apple systems. This first patch adds the Kconfig file as well the parts of the driver which talk directly to the hardware (that is pci device setup, interrupt handling and RX/TX ring management). Signed-off-by: Andreas Noever --- drivers/Kconfig| 2 + drivers/Makefile | 1 + drivers/thunderbolt/Kconfig| 12 + drivers/thunderbolt/Makefile | 3 + drivers/thunderbolt/dsl3510.c | 591 + drivers/thunderbolt/dsl3510.h | 116 drivers/thunderbolt/dsl3510_regs.h | 102 +++ 7 files changed, 827 insertions(+) create mode 100644 drivers/thunderbolt/Kconfig create mode 100644 drivers/thunderbolt/Makefile create mode 100644 drivers/thunderbolt/dsl3510.c create mode 100644 drivers/thunderbolt/dsl3510.h create mode 100644 drivers/thunderbolt/dsl3510_regs.h diff --git a/drivers/Kconfig b/drivers/Kconfig index b3138fb..c242b6c 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -170,4 +170,6 @@ source "drivers/phy/Kconfig" source "drivers/powercap/Kconfig" +source "drivers/thunderbolt/Kconfig" + endmenu diff --git a/drivers/Makefile b/drivers/Makefile index 3cc8214..0062353 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -155,3 +155,4 @@ obj-$(CONFIG_IPACK_BUS) += ipack/ obj-$(CONFIG_NTB) += ntb/ obj-$(CONFIG_FMC) += fmc/ obj-$(CONFIG_POWERCAP) += powercap/ +obj-$(CONFIG_THUNDERBOLT) += thunderbolt/ diff --git a/drivers/thunderbolt/Kconfig b/drivers/thunderbolt/Kconfig new file mode 100644 index 000..281787a --- /dev/null +++ b/drivers/thunderbolt/Kconfig @@ -0,0 +1,12 @@ +menuconfig THUNDERBOLT + tristate "Apple Thunderbolt hotplug support" + default no + help + Cactus Ridge Thunderbolt Controller driver + This driver is required if you want to hotplug Thunderbolt devices on + Apple hardware. + + Device chaining is currently not supported. + + To compile this driver a module, choose M here. The module will be + called thunderbolt. diff --git a/drivers/thunderbolt/Makefile b/drivers/thunderbolt/Makefile new file mode 100644 index 000..32b0504 --- /dev/null +++ b/drivers/thunderbolt/Makefile @@ -0,0 +1,3 @@ +obj-${CONFIG_THUNDERBOLT} := thunderbolt.o +thunderbolt-objs := dsl3510.o + diff --git a/drivers/thunderbolt/dsl3510.c b/drivers/thunderbolt/dsl3510.c new file mode 100644 index 000..2a326f6 --- /dev/null +++ b/drivers/thunderbolt/dsl3510.c @@ -0,0 +1,591 @@ +/* + * Cactus Ridge NHI driver + * + * Copyright (c) 2013 Andreas Noever + */ + +#include +#include +#include +#include +#include + +#include "dsl3510.h" +#include "dsl3510_regs.h" + +#define RING_TYPE(ring) ((ring)->is_tx ? "TX ring" : "RX ring") + +static int get_interrupt_index(struct tb_ring *ring) +{ + int bit = ring->hop; + if (!ring->is_tx) + bit += ring->nhi->hop_count; + return bit; +} + +/** + * interrupt_active() - activate/deactivate interrupts for a single ring + * + * ring->nhi->lock must be held. + */ +static void interrupt_active(struct tb_ring *ring, bool active) +{ + int reg = get_interrupt_index(ring) / 32 + REG_RING_INTERRUPT_BASE; + int bit = get_interrupt_index(ring) & 31; + u32 value; + value = ioread32(ring->nhi->iobase + reg); + if (active) { + if (value & (1 << bit)) { + dev_WARN(>nhi->pdev->dev, +"interrupt for %s %d is already enabled\n", +RING_TYPE(ring), +ring->hop); + } + value |= 1 << bit; + } else { + if (!(value & (1 << bit))) { + dev_WARN(>nhi->pdev->dev, +"interrupt for %s %d is already disabled\n", +RING_TYPE(ring), +ring->hop); + } + value &= ~(1 << bit); + } + dev_info(>nhi->pdev->dev, +"%s interrupt at register %#x bit %d (new value: %#x)\n", +active ? "enabling" : "disabling", +reg, +bit, +value); + iowrite32(value, ring->nhi->iobase + reg); +} + +/** + * dsl3510_disable_interrupts() - disable interrupts for all rings + */ +static void dsl3510_disable_interrupts(struct tb_nhi *nhi) +{ + int i = 0; + /* disable interrupts */ + for (i = 0; i < RING_INTERRUPT_REG_COUNT(nhi); i++) + iowrite32(0, nhi->iobase + REG_RING_INTERRUPT_BASE + 4 * i); + +
[PATCH 02/12] thunderbolt: Add configuration channel interface
Thunderbolt devices are configured by reading/writing into their configuration space (similar to pci). This is done by sending packets through the NHI (native host interface) onto the configuration channel. This patch handles the low level packet based protocol and exposes higher level operations like tb_cfg_read/tb_cfg_write. Signed-off-by: Andreas Noever --- drivers/thunderbolt/Makefile | 2 +- drivers/thunderbolt/tb_cfg.c | 649 +++ drivers/thunderbolt/tb_cfg.h | 67 + 3 files changed, 717 insertions(+), 1 deletion(-) create mode 100644 drivers/thunderbolt/tb_cfg.c create mode 100644 drivers/thunderbolt/tb_cfg.h diff --git a/drivers/thunderbolt/Makefile b/drivers/thunderbolt/Makefile index 32b0504..f486295 100644 --- a/drivers/thunderbolt/Makefile +++ b/drivers/thunderbolt/Makefile @@ -1,3 +1,3 @@ obj-${CONFIG_THUNDERBOLT} := thunderbolt.o -thunderbolt-objs := dsl3510.o +thunderbolt-objs := dsl3510.o tb_cfg.o diff --git a/drivers/thunderbolt/tb_cfg.c b/drivers/thunderbolt/tb_cfg.c new file mode 100644 index 000..bb958d5 --- /dev/null +++ b/drivers/thunderbolt/tb_cfg.c @@ -0,0 +1,649 @@ +/* + * Thunderbolt configuration channel + * + * Copyright (c) 2013 Andreas Noever + */ + +#include +#include +#include +#include +#include + +#include "tb_cfg.h" +#include "dsl3510.h" + + +/* config packet definitions */ + +enum tb_cfg_pkg_type { + TB_CFG_PKG_READ = 1, + TB_CFG_PKG_WRITE = 2, + TB_CFG_PKG_ERROR = 3, + TB_CFG_PKG_NOTIFY_ACK = 4, + TB_CFG_PKG_EVENT = 5, + TB_CFG_PKG_XDOMAIN_REQ = 6, + TB_CFG_PKG_XDOMAIN_RESP = 7, + TB_CFG_PKG_OVERRIDE = 8, + TB_CFG_PKG_RESET = 9, + TB_CFG_PKG_PREPARE_TO_SLEEP = 0xd, +}; + +enum tb_cfg_error { + TB_CFG_ERROR_PORT_NOT_CONNECTED = 0, + TB_CFG_ERROR_INVALID_CONFIG_SPACE = 2, + TB_CFG_ERROR_NO_SUCH_PORT = 4, + TB_CFG_ERROR_ACK_PLUG_EVENT = 7, + TB_CFG_ERROR_LOOP = 8, +}; + +struct tb_cfg_header { + u32 route_hi:18; + u32 unknown:14; /* highest order bit is set on replies */ + u32 route_lo; +} __packed; + +struct tb_cfg_address { + u32 offset:13; /* in dwords */ + u32 length:6; /* in dwords */ + u32 port:6; + enum tb_cfg_space space:2; + u32 zero:5; +} __packed; + +struct cfg_reset_pkg { + struct tb_cfg_header header; +} __packed; + +struct cfg_error_pkg { + struct tb_cfg_header header; + enum tb_cfg_error error:4; + u32 zero1:4; + u32 port:6; + u32 zero2:2; /* Both should be zero, still they are different fields. */ + u32 zero3:16; +} __packed; + +struct cfg_plug_pkg { + struct tb_cfg_header header; + u32 port:6; + u32 zero:25; + bool unplug:1; +} __packed; + +struct cfg_read_pkg { + struct tb_cfg_header header; + struct tb_cfg_address addr; +} __packed; + +struct cfg_write_pkg { + struct tb_cfg_header header; + struct tb_cfg_address addr; + u32 data[64]; /* tb_cfg_address.length has 6 bits */ +} __packed; + +/* helper methods */ + +static u64 get_route(struct tb_cfg_header header) +{ + return (u64) header.route_hi << 32 | header.route_lo; +} + +static struct tb_cfg_header make_header(u64 route) +{ + struct tb_cfg_header header = { + .route_hi = route >> 32, + .route_lo = route, + }; + /* check for overflow */ + WARN_ON(get_route(header) != route); + return header; +} + +static int decode_error(struct ring_packet *response) +{ + struct cfg_error_pkg *pkg = response->buffer; + u32 raw; + WARN_ON(response->eof != TB_CFG_PKG_ERROR); + if (WARN_ON(response->size != sizeof(*pkg))) + return -EIO; + raw = *(u32 *) (response->buffer + 8); + WARN_ON(pkg->zero1); + WARN_ON(pkg->zero2); + WARN_ON(pkg->zero3); + WARN_ON(pkg->header.unknown != 1 << 13); + switch (pkg->error) { + case TB_CFG_ERROR_PORT_NOT_CONNECTED: + /* Port is not connected. This can happen during surprise +* removal. Do not warn. */ + return -ENODEV; + case TB_CFG_ERROR_INVALID_CONFIG_SPACE: + /* +* Invalid cfg_space/offset/length combination in +* cfg_read/cfg_write. +*/ + WARN(1, +"CFG_ERROR(raw: %#x route: %#llx port: %d): Invalid config space of offset\n", +raw, +get_route(pkg->header), +pkg->port); + return -ENXIO; + case TB_CFG_ERROR_NO_SUCH_PORT: + /* +* - The route contains a non-existent port. +* - The route contains a non-PHY port (e.g. PCIe). +* - The port in cfg_read/cfg_write does not exist. +*/ + WARN(1, +"CFG_ERROR(raw: %#x route:
[PATCH 06/12] thunderbolt: Add thunderbolt capability handling
Thunderbolt config areas contain capability lists similar to those found on pci devices. This patch introduces a tb_find_cap utility method to search for capabilities. Signed-off-by: Andreas Noever --- drivers/thunderbolt/tb.c | 103 +++ drivers/thunderbolt/tb.h | 2 + 2 files changed, 105 insertions(+) diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c index d2df3be..943842b 100644 --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c @@ -89,6 +89,109 @@ static int tb_route_length(u64 route) return (fls64(route) + TB_ROUTE_SHIFT - 1) / TB_ROUTE_SHIFT; } + +/* thunderbolt capability lookup */ + +struct tb_cap_any { + union { + struct tb_cap_basic basic; + struct tb_cap_extended_short extended_short; + struct tb_cap_extended_long extended_long; + }; +} __packed; + +static bool tb_cap_is_basic(struct tb_cap_any *cap) +{ + /* basic.cap is u8. This checks only the lower 8 bit of cap. */ + return cap->basic.cap != 5; +} + +static bool tb_cap_is_long(struct tb_cap_any *cap) +{ + return !tb_cap_is_basic(cap) + && cap->extended_short.next == 0 + && cap->extended_short.length == 0; +} + +static enum tb_cap tb_cap(struct tb_cap_any *cap) +{ + if (tb_cap_is_basic(cap)) + return cap->basic.cap; + else + /* extended_short/long have cap at the same position. */ + return cap->extended_short.cap; +} + +static u32 tb_cap_next(struct tb_cap_any *cap, u32 offset) +{ + int next; + if (offset == 1) { + /* +* The first pointer is part of the switch header and always +* a simple pointer. +*/ + next = cap->basic.next; + } else { + if (tb_cap_is_basic(cap)) + next = cap->basic.next; + /* "255 byte config areas should be enough for anybody." */ + else if (!tb_cap_is_long(cap)) + next = cap->extended_short.next; + /* +* "Also we should have at least three types of capability +* headers in version 1." +*/ + else + next = cap->extended_long.next; + } + /* +* "Hey, we could terminate some capability lists with a null offset +* and others with a pointer to the last element." - "Great idea!" +*/ + if (next == offset) + return 0; + return next; +} + +/** + * tb_find_cap() - find a capability + * + * Return: Returns a positive offset if the capability was found and 0 if not. + * Returns an error code on failure. + */ +int tb_find_cap(struct tb_port *port, enum tb_cfg_space space, enum tb_cap cap) +{ + u32 offset = 1; + struct tb_cap_any header; + int res; + int retries = 10; + while (retries--) { + res = tb_port_read(port, , space, offset, 1); + if (res) { + /* Intel needs some help with linked lists. */ + if (space == TB_CFG_PORT + && offset == 0xa + && port->config.type == TB_TYPE_DP_HDMI_OUT) { + offset = 0x39; + continue; + } + return res; + } + if (offset != 1 && tb_cap() == cap) + return offset; + offset = tb_cap_next(, offset); + if (!offset) + return 0; + continue; + } + tb_port_WARN(port, +"could not find cap %#x in config space %d, last offset: %#x\n", +cap, +space, +offset); + return -EIO; +} + /* switch/port allocation & initialization */ /** diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h index 4000f2b..e81c63a 100644 --- a/drivers/thunderbolt/tb.h +++ b/drivers/thunderbolt/tb.h @@ -144,4 +144,6 @@ static inline int tb_port_write(struct tb_port *port, void *buffer, struct tb *thunderbolt_alloc_and_start(struct tb_nhi *nhi); void thunderbolt_shutdown_and_free(struct tb *tb); +int tb_find_cap(struct tb_port *port, enum tb_cfg_space space, u32 value); + #endif -- 1.8.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 00/12] Thunderbolt hotplug support for Apple hardware (testers needed)
Thunderbolt hotplug is supposed to be implemented by the firmware. But Apple's firmeware only initializes devices during boot and ignores hotplugged devices. This patch series adds a driver for the Intel Cactus Ridge Thunderbolt controller. The driver supports hotplug operations of simple (one PCI device, no chaining) thunderbolt devices. The patches in this series are self contained and I have tried to sort them (roughly) from lowest to highest level of abstraction. They all compile but only the final driver has been tested. The driver works on my MacBookPro10,1 with two Thunderbolt ethernet adapters. The system contains the Cactus Ridge C4 TB controller (device id 0x1547). I could not run tests on other systems, but there is a good chance that the driver will work on other models as well. If something is controller specific then it should be confined to patch 01. There are still a number of limitations: (1) The system must be booted with acpi_osi=Darwin. Otherwise ACPI will cut power to the controller. (2) After suspend the controller is gone. I think that ACPI thinks that we are Windows and cuts power, even with acpi_osi=Darwin. (3) No support for chaining. Also the driver only activates the first PCI device found on a Thunderbolt device. (4) Rapidly replugging a device confuses pciehp. (1) and (2) should be solveable given some time. I also have a pretty good idea on how chaining should work. The main problem is that I have yet to see any Thunderbolt device besides the Apple ethernet adapter. If someone with a MacBook and access to more complicated TB hardware is willing to run some tests: Please contact me. I will try to debug (4) further and write a seperate bug report for the issue. Andreas -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] serial: 8250_pci: use DEFINE_PCI_DEVICE_TABLE macro
On Thursday, November 28, 2013 3:24 PM, Joe Perches wrote: >On Wed, 2013-11-27 at 21:53 -0800, 'Greg Kroah-Hartman' wrote: >>On Wed, Nov 27, 2013 at 09:40:13PM -0800, Joe Perches wrote: >>>On Thu, 2013-11-28 at 14:29 +0900, Jingoo Han wrote: On Thursday, November 28, 2013 1:08 PM, Greg Kroah-Hartman wrote: >On Thu, Nov 28, 2013 at 10:55:35AM +0900, Jingoo Han wrote: >> This macro is used to create a struct pci_device_id array. > > Yeah, and it's a horrid macro that deserves to be removed, please don't > use it in more places. > > Actually, if you could just remove it, that would be best, sorry, I'm > not going to take these patches. (+cc Joe Perches, Andrew Morton, Andy Whitcroft) Hi Joe Perches, Would you fix checkpatch.pl about DEFINE_PCI_DEVICE_TABLE? Currently, checkpatch.pl guides to use DEFINE_PCI_DEVICE_TABLE as below. WARNING: Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id #331: FILE: drivers/usb/host/ehci-pci.c:331: +static const struct pci_device_id pci_ids [] = { { However, Greg Kroah-Hartman mentioned that DEFINE_PCI_DEVICE_TABLE shouldn't be used anymore. So, would you change checkpatch.pl in order to guide to use struct pci_device_id instead of DEFINE_PCI_DEVICE_TABLE? For example, WARNING: Use struct pci_device_id instead of DEFINE_PCI_DEVICE_TABLE >>> >>> The documentation doesn't agree with Greg. >[] >> I say just remove it, I should have done that years ago when I was the >> PCI maintainer, just never got around to it. No other bus has something >> like this for their device ids, why should PCI be "special"? > >Anyone else have an opinion? > >I don't care one way or another, but please, one way >not two. (+cc Bjorn Helgaas, linux-pci) Then, how about the following steps? 1. Fix ./Documentation/PCI/pci.txt as below. (Jingoo Han) The ID table is an array of struct pci_device_id entries ending with an -all-zero entry; use of the macro DEFINE_PCI_DEVICE_TABLE is the preferred -method of declaring the table. Each entry consists of: +all-zero entry; Each entry consists of: 2. Fix ./scripts/checkpatch.pl in order to guide to use struct pci_device_id instead of DEFINE_PCI_DEVICE_TABLE. (Joe Perches) 3. Replace DEFINE_PCI_DEVICE_TABLE of ./drivers/* with 'const struct pci_device_id'. (Jingoo Han) 4. These patches will be merged through 'driver-core.git' with 'Acked-by' of each subsystem maintainer. (Greg Kroah-Hartman) Best regards, Jingoo Han >Changing checkpatch is a trifle, but there are a _lot_ >of maintainers to work through if it's to be removed. > >It'll probably take several releases. > >$ git grep --name-only -w DEFINE_PCI_DEVICE_TABLE | \ > cut -f1,2 -d/ | uniq -c > 1 Documentation/PCI > 1 arch/x86 > 1 drivers/bcma > 3 drivers/block > 1 drivers/char > 1 drivers/cpufreq > 2 drivers/dma > 18 drivers/edac > 6 drivers/gpio > 6 drivers/gpu > 6 drivers/hwmon > 20 drivers/i2c > 2 drivers/infiniband > 1 drivers/ipack > 1 drivers/leds > 3 drivers/media > 10 drivers/mfd > 2 drivers/misc > 1 drivers/mmc > 1 drivers/mtd >132 drivers/net > 1 drivers/ntb > 1 drivers/pci > 5 drivers/pcmcia > 2 drivers/platform > 1 drivers/ptp > 1 drivers/rapidio > 7 drivers/scsi > 3 drivers/spi > 65 drivers/staging > 3 drivers/tty > 1 drivers/uio > 5 drivers/usb > 1 drivers/video > 1 drivers/virtio > 3 drivers/vme > 9 drivers/watchdog > 1 drivers/xen > 1 include/linux > 1 scripts/checkpatch.pl > 1 scripts/tags.sh > 1 sound/oss > 67 sound/pci -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v11 7/7] ARM: tegra: support Trusted Foundations by default
On 11/29/2013 04:47 AM, Dave Martin wrote: On Thu, Nov 28, 2013 at 04:58:33PM +, Stephen Warren wrote: On 11/27/2013 11:02 PM, Alexandre Courbot wrote: On Wed, Nov 27, 2013 at 1:47 AM, Dave Martin wrote: On Tue, Nov 26, 2013 at 10:35:58AM +0900, Alexandre Courbot wrote: On Tue, Nov 26, 2013 at 9:06 AM, Olof Johansson wrote: On Sun, Nov 24, 2013 at 03:30:52PM +0900, Alexandre Courbot wrote: Support for Trusted Foundations is light and allows the kernel to run on a wider range of devices, so enable it by default. Signed-off-by: Alexandre Courbot Reviewed-by: Tomasz Figa Reviewed-by: Stephen Warren --- arch/arm/configs/tegra_defconfig | 1 + 1 file changed, 1 insertion(+) I think we want this enabled on multi_v7_defconfig too? Send a separate patch for that once this is merged though. Will do. Should it just be default y if one of the relevant CONFIG_ARCH_TEGRA_*_SOC is selected? That way, it's automatically included if relevant, and automatically excluded if not -- regardless of whether the kernel is multiplatform or not. So basically, that would mean setting the default to 'y' since the option is not available unless a supported platform is included? I'm fine this way too, if Stephen also agrees. Fine by me. Sure, as long as the result is right, that should be fine. Ok, then please ignore this patch in this series and I will send a new one that changes the CONFIG_TRUSTED_FOUNDATION's default setting once we have confirmation from Russell that this series can be merged. Thanks, Alex. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
linux-next: build failure after merge of the sound-asoc tree
Hi all, After merging the sound-asoc tree, today's linux-next build (x86_64 allmodconfig) failed like this: sound/soc/codecs/cs42l52.c: In function 'cs42l52_i2c_probe': sound/soc/codecs/cs42l52.c:1235:10: error: 'struct cs42l52_platform_data' has no member named 'chgfreq_divisor' pdata->chgfreq_divisor = val32; ^ Caused by commit 391fc59db876 ("ASoC: cs42l52: Add devicetree support for CS42L52"). I have used the sound-asoc tree from next-20131128 for today. -- Cheers, Stephen Rothwells...@canb.auug.org.au pgpTCRaRuWOyY.pgp Description: PGP signature
Re: [PATCH 6/8] perf sched: Introduce timehist command
Hi David, On Thu, 28 Nov 2013 09:01:23 -0700, David Ahern wrote: > On 11/28/13, 8:38 AM, Namhyung Kim wrote: >> On Tue, Nov 19, 2013 at 5:32 AM, David Ahern wrote: >> >> [SNIP] >>> +static bool is_idle_sample(struct perf_sample *sample, >>> + struct perf_evsel *evsel, >>> + struct machine *machine) >>> +{ >>> + struct thread *thread; >>> + struct callchain_cursor *cursor = _cursor; >>> + struct callchain_cursor_node *node; >>> + struct addr_location al; >>> + int iter = 5; >> >> Shouldn't it be sched->max_stack somehow? > > max_stack is used to dump callstack to the user. In this case we are > walking the stack looking for an idle symbol. Do we really need to look up the callchain to find out an idle thread? $ perf sched script | grep swapper | head swapper 0 [001] 4294177.326996: sched:sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=Xorg next_pid=1094 next_prio=120 swapper 0 [010] 4294177.327019: sched:sched_switch: prev_comm=swapper/10 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=perf next_pid=13902 next_prio=120 perf 13901 [002] 4294177.327074: sched:sched_switch: prev_comm=perf prev_pid=13901 prev_prio=120 prev_state=S ==> next_comm=swapper/2 next_pid=0 next_prio=120 swapper 0 [004] 4294177.327096: sched:sched_switch: prev_comm=swapper/4 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=synergys next_pid=1521 next_prio=120 swapper 0 [000] 4294177.327102: sched:sched_switch: prev_comm=swapper/0 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=gnome-terminal next_pid=2392 next_prio=120 Xorg 1094 [001] 4294177.327112: sched:sched_switch: prev_comm=Xorg prev_pid=1094 prev_prio=120 prev_state=S ==> next_comm=swapper/1 next_pid=0 next_prio=120 swapper 0 [007] 4294177.327122: sched:sched_switch: prev_comm=swapper/7 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=perf next_pid=13902 next_prio=120 migration/1058 [010] 4294177.327124: sched:sched_switch: prev_comm=migration/10 prev_pid=58 prev_prio=0 prev_state=S ==> next_comm=swapper/10 next_pid=0 next_prio=120 synergys 1521 [004] 4294177.327144: sched:sched_switch: prev_comm=synergys prev_pid=1521 prev_prio=120 prev_state=S ==> next_comm=swapper/4 next_pid=0 next_prio=120 gnome-terminal 2392 [000] 4294177.327286: sched:sched_switch: prev_comm=gnome-terminal prev_pid=2392 prev_prio=120 prev_state=S ==> next_comm=swapper/0 next_pid=0 next_prio=120 It seems every idle/swapper thread for each cpu has a pid of 0. > >> >>> + >>> + /* pid 0 == swapper == idle task */ >>> + if (sample->pid == 0) >>> + return true; >>> + >>> + /* want main thread for process - has maps */ >>> + thread = machine__findnew_thread(machine, sample->pid, sample->pid); >>> + if (thread == NULL) { >>> + pr_debug("Failed to get thread for pid %d.\n", sample->pid); >>> + return false; >>> + } >>> + >>> + if (!symbol_conf.use_callchain || sample->callchain == NULL) >>> + return false; >>> + >>> + if (machine__resolve_callchain(machine, evsel, thread, >>> + sample, NULL, , >>> PERF_MAX_STACK_DEPTH) != 0) { >>> + if (verbose) >>> + error("Failed to resolve callchain. Skipping\n"); >>> + >>> + return false; >>> + } >> >> I think this callchain resolving logic should be moved to the >> beginning of perf_hist__process_sample() like other commands do. It's >> not for idle threads only. > > I'll see what can be done. > >> >> And it also needs to pass sched->max_stack. > > Per above, max_stack has a different purpose Hmm.. anyway I don't think we need to pass PERF_MAX_STACK_DEPTH for machine__resolve_callchain() as we'll only look up to max_stack entries. Thanks, Namhyung -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
linux-next: manual merge of the slave-dma tree with the imx-mxs tree
Hi Vinod, Today's linux-next merge of the slave-dma tree got a conflict in arch/arm/boot/dts/imx53.dtsi between commit a0cd556100d0 ("ARM: imx53: use clock defines in DTS files") from the imx-mxs tree and commit 786f0db6d439 ("ARM: dts: imx: use dual-fifo sdma script for ssi") from the slave-dma tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au diff --cc arch/arm/boot/dts/imx53.dtsi index 4b2053b585d1,7208fde9bc16.. --- a/arch/arm/boot/dts/imx53.dtsi +++ b/arch/arm/boot/dts/imx53.dtsi @@@ -173,9 -152,9 +173,9 @@@ compatible = "fsl,imx53-ssi", "fsl,imx21-ssi"; reg = <0x50014000 0x4000>; interrupts = <30>; - clocks = < 49>; + clocks = < IMX5_CLK_SSI2_IPG_GATE>; - dmas = < 24 1 0>, - < 25 1 0>; + dmas = < 24 22 0>, + < 25 22 0>; dma-names = "rx", "tx"; fsl,fifo-depth = <15>; fsl,ssi-dma-events = <25 24 23 22>; /* TX0 RX0 TX1 RX1 */ pgpP2LQjUe0t7.pgp Description: PGP signature
linux-next: manual merge of the slave-dma tree with the imx-mxs tree
Hi Vinod, Today's linux-next merge of the slave-dma tree got a conflict in arch/arm/boot/dts/imx51.dtsi between commit 975bbc1e679b ("ARM: imx51: use clock defines in DTS files") from the imx-mxs tree and commit 786f0db6d439 ("ARM: dts: imx: use dual-fifo sdma script for ssi") from the slave-dma tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au $ git checkout master $ git reset --hard stable Merging origin/master (dda9cc3a1451 Merge tag 'gpio-v3.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio) Merging fixes/master (8ae516aa8b81 Merge tag 'trace-fixes-v3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace) Merging kbuild-current/rc-fixes (19514fc665ff arm, kbuild: make "make install" not depend on vmlinux) Merging arc-current/for-curr (da990a4f2d5a ARC: [perf] Fix a few thinkos) Merging arm-current/fixes (476d1c03d202 ARM: dma-mapping: check DMA mask against available memory) Merging m68k-current/for-linus (77a42796786c m68k: Remove deprecated IRQF_DISABLED) Merging metag-fixes/fixes (3b2f64d00c46 Linux 3.11-rc2) Merging powerpc-merge/merge (721cb59e9d95 powerpc/windfarm: Fix XServe G5 fan control Makefile issue) Merging sparc/master (b4789b8e6be3 aacraid: prevent invalid pointer dereference) Merging net/master (2c7a9dc16416 be2net: Avoid programming permenant MAC by BE3-R VFs) Merging ipsec/master (be408cd3e1fe Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net) Merging sound-current/for-linus (eb9ca3ab2194 ALSA: hda - Add LFE chmap to ASUS ET2700) Merging pci-current/for-linus (4bff6749905d PCI: Move device_del() from pci_stop_dev() to pci_destroy_dev()) Merging wireless/master (d5aedd7e1b2f Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211) Merging driver-core.current/driver-core-linus (81440e737444 Revert "sysfs: handle duplicate removal attempts in sysfs_remove_group()") Merging tty.current/tty-linus (c42b4e6501cd Revert "n_gsm: race between ld close and gsmtty open") Merging usb.current/usb-linus (c24cb6c8b501 Merge tag 'fixes-for-v3.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus) Merging staging.current/staging-linus (930ba4a374b9 Staging: tidspbridge: disable driver) Merging char-misc.current/char-misc-linus (d0b00d3fb96d Merge tag 'extcon-linus-for-3.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into char-misc-linus) Merging input-current/for-linus (358f24704f2f Input: add key code for ambient light sensor button) Merging md-current/for-linus (d47648fcf061 raid5: avoid finding "discard" stripe) Merging crypto-current/master (8ec25c512916 crypto: testmgr - fix sglen in test_aead for case 'dst != src') Merging ide/master (c2f7d1e103ef ide: pmac: remove unnecessary pci_set_drvdata()) Merging dwmw2/master (5950f0803ca9 pcmcia: remove RPX board stuff) Merging sh-current/sh-fixes-for-linus (44033109e99c SH: Convert out[bwl] macros to inline functions) Merging devicetree-current/devicetree/merge (1931ee143b0a Revert "drivers: of: add initialization code for dma reserved memory") Merging rr-fixes/fixes (f6537f2f0eba scripts/kallsyms: filter symbols not in kernel address space) Merging mfd-fixes/master (88ec6a4d8369 Merge tag 'mfd-lee-3.13-fixes-1' of git://git.linaro.org/people/ljones/mfd) Merging vfio-fixes/for-linus (d93b3ac0edb8 VFIO: vfio_iommu_type1: fix bug caused by break in nested loop) Merging drm-intel-fixes/for-linux-next-fixes (32cf0cb02948 drm/i915: Fix pipe CSC post offset calculation) Merging asm-generic/master (fb9de7ebc3a2 xtensa: Use generic asm/mmu.h for nommu) Merging arc/for-next (418556e7743b ARC: [SMP] optimize IPI send and receive) Merging arm/for-next (e69662a3b19d Merge branches 'fixes', 'kees' and 'misc' into for-next) Merging arm-perf/for-next/perf (6ce4eac1f600 Linux 3.13-rc1) Merging arm-soc/for-next (9f6f9eb67d48 Merge branch 'fixes' into for-next) Merging arm-v7-cache-opt/v7-cache-opt (e11d68fee368 arm: mm: refactor v7 cache cleaning ops to use way/index sequence) Merging bcm2835/for-next (7d132055814e Linux 3.10-rc6) Merging cortex-m/for-next (9c031a483646 ARM: v7-M: drop using mach/entry-macro.S) Merging ep93xx/ep93xx-for-next (bfb0709fd17b Merge branch 'ep93xx-fixes' into ep93xx-for-next) Merging imx-mxs/for-next (8bb2a9b78b11 Merge branches 'imx/soc' and 'imx/dt' into for-next) Merging ixp4xx/next (19f949f52599 Linux 3.8) Merging msm/for-next (81cf1e061d00 ARM: msm: Rename msm devicetrees to have standard 'qcom' prefix) Merging mvebu/for-next (e210fca4aaf9 Merge branch 'mvebu/dt' into for-next) Merging renesas/next (4c92422b0a8c Merge tag 'renesas-clocksource-for-v3.13' into devel) Merging samsung/for-next (6ce4eac1f600 Linux 3.13-rc1) Merging tegra/for-next (6ce4eac1f600 Linux 3.13-rc1) Merging arm64/upstream (67317c268956 ARM64: /proc/interrupts: display IPIs of
[PATCH 1/3] ACPI / bind: Rework struct acpi_bus_type
From: Rafael J. Wysocki Replace the .find_device function pointer in struct acpi_bus_type with a new one, .find_copmanion, that is supposed to point to a function returning struct acpi_device pointer (instead of an int) and takes one argument (instead of two). This way the role of this callback is more clear and the implementation of it can be more straightforward. Update all of the users of struct acpi_bus_type (PCI, PNP/ACPI and USB) to reflect the structure change. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/glue.c | 12 +++- drivers/pci/pci-acpi.c | 12 +++- drivers/pnp/pnpacpi/core.c | 19 +-- drivers/usb/core/usb-acpi.c | 40 include/acpi/acpi_bus.h |2 +- 5 files changed, 36 insertions(+), 49 deletions(-) Index: linux-pm/include/acpi/acpi_bus.h === --- linux-pm.orig/include/acpi/acpi_bus.h +++ linux-pm/include/acpi/acpi_bus.h @@ -414,7 +414,7 @@ struct acpi_bus_type { struct list_head list; const char *name; bool (*match)(struct device *dev); - int (*find_device) (struct device *, acpi_handle *); + struct acpi_device * (*find_companion)(struct device *); void (*setup)(struct device *); void (*cleanup)(struct device *); }; Index: linux-pm/drivers/acpi/glue.c === --- linux-pm.orig/drivers/acpi/glue.c +++ linux-pm/drivers/acpi/glue.c @@ -37,7 +37,7 @@ int register_acpi_bus_type(struct acpi_b { if (acpi_disabled) return -ENODEV; - if (type && type->match && type->find_device) { + if (type && type->match && type->find_companion) { down_write(_type_sem); list_add_tail(>list, _type_list); up_write(_type_sem); @@ -302,17 +302,19 @@ EXPORT_SYMBOL_GPL(acpi_unbind_one); static int acpi_platform_notify(struct device *dev) { struct acpi_bus_type *type = acpi_get_bus_type(dev); - acpi_handle handle; int ret; ret = acpi_bind_one(dev, NULL); if (ret && type) { - ret = type->find_device(dev, ); - if (ret) { + struct acpi_device *adev; + + adev = type->find_companion(dev); + if (!adev) { DBG("Unable to get handle for %s\n", dev_name(dev)); + ret = -ENODEV; goto out; } - ret = acpi_bind_one(dev, handle); + ret = acpi_bind_one(dev, adev->handle); if (ret) goto out; } Index: linux-pm/drivers/pci/pci-acpi.c === --- linux-pm.orig/drivers/pci/pci-acpi.c +++ linux-pm/drivers/pci/pci-acpi.c @@ -306,10 +306,9 @@ void acpi_pci_remove_bus(struct pci_bus } /* ACPI bus type */ -static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) +static struct acpi_device *acpi_pci_find_companion(struct device *dev) { struct pci_dev *pci_dev = to_pci_dev(dev); - struct acpi_device *adev; bool check_children; u64 addr; @@ -322,13 +321,8 @@ static int acpi_pci_find_device(struct d || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS; /* Please ref to ACPI spec for the syntax of _ADR */ addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); - adev = acpi_find_child_device(ACPI_COMPANION(dev->parent), addr, + return acpi_find_child_device(ACPI_COMPANION(dev->parent), addr, check_children); - if (adev) { - *handle = adev->handle; - return 0; - } - return -ENODEV; } static void pci_acpi_setup(struct device *dev) @@ -368,7 +362,7 @@ static bool pci_acpi_bus_match(struct de static struct acpi_bus_type acpi_pci_bus = { .name = "PCI", .match = pci_acpi_bus_match, - .find_device = acpi_pci_find_device, + .find_companion = acpi_pci_find_companion, .setup = pci_acpi_setup, .cleanup = pci_acpi_cleanup, }; Index: linux-pm/drivers/pnp/pnpacpi/core.c === --- linux-pm.orig/drivers/pnp/pnpacpi/core.c +++ linux-pm/drivers/pnp/pnpacpi/core.c @@ -329,20 +329,11 @@ static int __init acpi_pnp_match(struct && compare_pnp_id(pnp->id, acpi_device_hid(acpi)); } -static int __init acpi_pnp_find_device(struct device *dev, acpi_handle * handle) +static struct acpi_device * __init acpi_pnp_find_companion(struct device *dev) { - struct device *adev; - struct acpi_device *acpi; - - adev = bus_find_device(_bus_type, NULL, - to_pnp_dev(dev), acpi_pnp_match); - if (!adev) - return
[PATCH 0/3] ACPI / bind: Use struct acpi_device pointers instead of ACPI handles
Hi, Now that we store a pointer to struct acpi_device as the ACPI companion in struct device, the code making associations between "physical" devices and ACPI device objects can be modified to work with struct acpi_device pointers instead of ACPI handles too. The first two of the following patches make these changes and the third one is just a related cleanup. [1/3] ACPI / bind: Replace .find_device in struct acpi_bus_type with .find_companion [2/3] ACPI / bind: Modify acpi_bind_one() to take a struct acpi_device pointer as the second argument. [3/3] ACPI / bind: Move acpi_get_child() to ide-acpi.c which is the only remaining user of that function. The patches are on top of linux-pm.git/linux-next. Please let me know if you see any problems in them. Thanks! -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/3] ACPI / bind: Pass struct acpi_device pointer to acpi_bind_one()
From: Rafael J. Wysocki There is no reason to pass an ACPI handle to acpi_bind_one() instead of a struct acpi_device pointer to the target device object, so modify that function to take a struct acpi_device pointer as its second argument and update all code depending on it accordingly. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/acpi_memhotplug.c | 15 +++ drivers/acpi/acpi_processor.c |2 +- drivers/acpi/glue.c|9 +++-- drivers/acpi/internal.h|2 +- 4 files changed, 12 insertions(+), 16 deletions(-) Index: linux-pm/drivers/acpi/glue.c === --- linux-pm.orig/drivers/acpi/glue.c +++ linux-pm/drivers/acpi/glue.c @@ -172,9 +172,8 @@ static void acpi_physnode_link_name(char strcpy(buf, PHYSICAL_NODE_STRING); } -int acpi_bind_one(struct device *dev, acpi_handle handle) +int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev) { - struct acpi_device *acpi_dev = NULL; struct acpi_device_physical_node *physical_node, *pn; char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; struct list_head *physnode_list; @@ -182,14 +181,12 @@ int acpi_bind_one(struct device *dev, ac int retval = -EINVAL; if (ACPI_COMPANION(dev)) { - if (handle) { + if (acpi_dev) { dev_warn(dev, "ACPI companion already set\n"); return -EINVAL; } else { acpi_dev = ACPI_COMPANION(dev); } - } else { - acpi_bus_get_device(handle, _dev); } if (!acpi_dev) return -EINVAL; @@ -314,7 +311,7 @@ static int acpi_platform_notify(struct d ret = -ENODEV; goto out; } - ret = acpi_bind_one(dev, adev->handle); + ret = acpi_bind_one(dev, adev); if (ret) goto out; } Index: linux-pm/drivers/acpi/internal.h === --- linux-pm.orig/drivers/acpi/internal.h +++ linux-pm/drivers/acpi/internal.h @@ -86,7 +86,7 @@ void acpi_init_device_object(struct acpi int type, unsigned long long sta); void acpi_device_add_finalize(struct acpi_device *device); void acpi_free_pnp_ids(struct acpi_device_pnp *pnp); -int acpi_bind_one(struct device *dev, acpi_handle handle); +int acpi_bind_one(struct device *dev, struct acpi_device *adev); int acpi_unbind_one(struct device *dev); bool acpi_device_is_present(struct acpi_device *adev); Index: linux-pm/drivers/acpi/acpi_processor.c === --- linux-pm.orig/drivers/acpi/acpi_processor.c +++ linux-pm/drivers/acpi/acpi_processor.c @@ -395,7 +395,7 @@ static int acpi_processor_add(struct acp goto err; } - result = acpi_bind_one(dev, pr->handle); + result = acpi_bind_one(dev, device); if (result) goto err; Index: linux-pm/drivers/acpi/acpi_memhotplug.c === --- linux-pm.orig/drivers/acpi/acpi_memhotplug.c +++ linux-pm/drivers/acpi/acpi_memhotplug.c @@ -180,14 +180,14 @@ static unsigned long acpi_meminfo_end_pf static int acpi_bind_memblk(struct memory_block *mem, void *arg) { - return acpi_bind_one(>dev, (acpi_handle)arg); + return acpi_bind_one(>dev, arg); } static int acpi_bind_memory_blocks(struct acpi_memory_info *info, - acpi_handle handle) + struct acpi_device *adev) { return walk_memory_range(acpi_meminfo_start_pfn(info), -acpi_meminfo_end_pfn(info), (void *)handle, +acpi_meminfo_end_pfn(info), adev, acpi_bind_memblk); } @@ -197,8 +197,7 @@ static int acpi_unbind_memblk(struct mem return 0; } -static void acpi_unbind_memory_blocks(struct acpi_memory_info *info, - acpi_handle handle) +static void acpi_unbind_memory_blocks(struct acpi_memory_info *info) { walk_memory_range(acpi_meminfo_start_pfn(info), acpi_meminfo_end_pfn(info), NULL, acpi_unbind_memblk); @@ -242,9 +241,9 @@ static int acpi_memory_enable_device(str if (result && result != -EEXIST) continue; - result = acpi_bind_memory_blocks(info, handle); + result = acpi_bind_memory_blocks(info, mem_device->device); if (result) { - acpi_unbind_memory_blocks(info, handle); + acpi_unbind_memory_blocks(info); return -ENODEV; } @@ -285,7 +284,7 @@ static void
[PATCH 3/3] ACPI / bind: Move acpi_get_child() to drivers/ide/ide-acpi.c
From: Rafael J. Wysocki Since drivers/ide/ide-acpi.c is the only remaining user of acpi_get_child(), move that function into that file as a static routine. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/glue.c | 12 drivers/ide/ide-acpi.c | 11 +++ include/acpi/acpi_bus.h |1 - 3 files changed, 11 insertions(+), 13 deletions(-) Index: linux-pm/drivers/acpi/glue.c === --- linux-pm.orig/drivers/acpi/glue.c +++ linux-pm/drivers/acpi/glue.c @@ -151,18 +151,6 @@ struct acpi_device *acpi_find_child_devi } EXPORT_SYMBOL_GPL(acpi_find_child_device); -acpi_handle acpi_get_child(acpi_handle handle, u64 addr) -{ - struct acpi_device *adev; - - if (!handle || acpi_bus_get_device(handle, )) - return NULL; - - adev = acpi_find_child_device(adev, addr, false); - return adev ? adev->handle : NULL; -} -EXPORT_SYMBOL_GPL(acpi_get_child); - static void acpi_physnode_link_name(char *buf, unsigned int node_id) { if (node_id > 0) Index: linux-pm/drivers/ide/ide-acpi.c === --- linux-pm.orig/drivers/ide/ide-acpi.c +++ linux-pm/drivers/ide/ide-acpi.c @@ -98,6 +98,17 @@ bool ide_port_acpi(ide_hwif_t *hwif) return ide_noacpi == 0 && hwif->acpidata; } +static acpi_handle acpi_get_child(acpi_handle handle, u64 addr) +{ + struct acpi_device *adev; + + if (!handle || acpi_bus_get_device(handle, )) + return NULL; + + adev = acpi_find_child_device(adev, addr, false); + return adev ? adev->handle : NULL; +} + /** * ide_get_dev_handle - finds acpi_handle and PCI device.function * @dev: device to locate Index: linux-pm/include/acpi/acpi_bus.h === --- linux-pm.orig/include/acpi/acpi_bus.h +++ linux-pm/include/acpi/acpi_bus.h @@ -436,7 +436,6 @@ struct acpi_pci_root { struct acpi_device *acpi_find_child_device(struct acpi_device *parent, u64 address, bool check_children); -acpi_handle acpi_get_child(acpi_handle handle, u64 addr); int acpi_is_root_bridge(acpi_handle); struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH/RFC 17/17] tracing/uprobes: Add @+file_offset fetch method
Hi Oleg, On Thu, 28 Nov 2013 17:31:48 +0100, Oleg Nesterov wrote: > On 11/28, Namhyung Kim wrote: >> >> I thought we need a fetch_param anyway if we will add support for >> cross-fetch later. But I won't insist it strongly, I can delay it to >> later work and make current code simpler if you want. :) > > OK, great, So do you want me to change to make it simpler without a fetch_param? > >> >> static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs >> >> *regs) >> >> { >> >> struct trace_uprobe *tu; >> >> + struct uprobe_task *utask; >> >> int ret = 0; >> >> >> >> tu = container_of(con, struct trace_uprobe, consumer); >> >> tu->nhit++; >> >> >> >> + utask = current->utask; >> >> + if (utask == NULL) >> >> + return UPROBE_HANDLER_REMOVE; >> > >> > Hmm, why? The previous change ensures ->utask is not NULL? If we hit >> > NULL we have a bug, we should not remove this uprobe. >> >> Yes, I just want to be defensive. :) >> >> So do you suggest to add BUG_ON()? > > We are going to crash with the same effect if it is NULL ;) I see. I'll just get rid of the if (...) part. > >> And can I convert or remove a >> similar check in uprobes.c:pre_ssout() too? > > Well, yes, we _can_ do this. But unless you have the strong opinion > I'd suggest to not do this. At least right now. > > To remind, perhaps we can revert the previous patch later if we find > a better solution (placeholder). OK, I'll just leave it as is. > > And. Note that we will change this code in any case. I suggested to > use ->vaddr to avoid the other (potentially conflicting) changes in > uprobes.h. Even if we use current->utask, we should add another member > into the union. But again, it would be better to do this later, and > the change will be trivial. Got it. Thank you for the explanation. Thanks, Namhyung -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH v2 5/5] mfd: sec: Constify regmap configs and regmap irqs
On Friday, November 29, 2013 2:15 AM, Mark Brown wrote: > > Add "const" to "static struct regmap_irq" and "static struct > > regmap_config". > > Reviewed-by: Mark Brown Acked-by: Sangbeom Kim Thanks, Sangbeom. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH v2 4/5] rtc: s5m: Enable IRQ wake during suspend
On Thursday, November 28, 2013 5:10 PM, Krzysztof Kozlowski wrote: > Add PM suspend/resume ops to rtc-s5m driver and enable IRQ wake during > suspend so the RTC would act like a wake up source. This allows waking > up from suspend to RAM on RTC alarm interrupt. > > Signed-off-by: Krzysztof Kozlowski > Signed-off-by: Kyungmin Park Acked-by: Sangbeom Kim Thanks, Sangbeom. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/4] ACPI / bind: Simplify child devices lookup
On Wednesday, November 27, 2013 02:58:54 AM Rafael J. Wysocki wrote: > On Tuesday, November 26, 2013 06:40:28 PM Toshi Kani wrote: [...] > > > > Yes, the system booted fine with 3/4 & 4/4. :-) > > Thanks for the verification! In fact, I've made one more mistake in that patch. Namely, acpi_find_child() has to return an ACPI handle and it returned a pointer to struct acpi_device after it. That has been fixed in my tree already, but the updated patch follows for completness (it requires patch [3/4] to be changed, but that is just a trivial rebase, so I don't think it is necessary to resend it too). Thanks, Rafael --- From: Rafael J. Wysocki Subject: ACPI / bind: Simplify child device lookups Now that we create a struct acpi_device object for every ACPI namespace node representing a device, it is not necessary to use acpi_walk_namespace() for child device lookup in acpi_find_child() any more. Instead, we can simply walk the list of children of the given struct acpi_device object and return the matching one (or the one which is the best match if there are more of them). The checks done during the matching loop can be simplified too so that the secondary namespace walks in find_child_checks() are not necessary any more. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/glue.c | 135 +++- include/acpi/acpi_bus.h |3 + 2 files changed, 57 insertions(+), 81 deletions(-) Index: linux-pm/drivers/acpi/glue.c === --- linux-pm.orig/drivers/acpi/glue.c +++ linux-pm/drivers/acpi/glue.c @@ -82,107 +82,80 @@ static struct acpi_bus_type *acpi_get_bu #define FIND_CHILD_MIN_SCORE 1 #define FIND_CHILD_MAX_SCORE 2 -static acpi_status acpi_dev_present(acpi_handle handle, u32 lvl_not_used, - void *not_used, void **ret_p) -{ - struct acpi_device *adev = NULL; - - acpi_bus_get_device(handle, ); - if (adev) { - *ret_p = handle; - return AE_CTRL_TERMINATE; - } - return AE_OK; -} - -static int do_find_child_checks(acpi_handle handle, bool is_bridge) +static int find_child_checks(struct acpi_device *adev, bool check_children) { bool sta_present = true; unsigned long long sta; acpi_status status; - status = acpi_evaluate_integer(handle, "_STA", NULL, ); + status = acpi_evaluate_integer(adev->handle, "_STA", NULL, ); if (status == AE_NOT_FOUND) sta_present = false; else if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED)) return -ENODEV; - if (is_bridge) { - void *test = NULL; + if (check_children && list_empty(>children)) + return -ENODEV; - /* Check if this object has at least one child device. */ - acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, - acpi_dev_present, NULL, NULL, ); - if (!test) - return -ENODEV; - } return sta_present ? FIND_CHILD_MAX_SCORE : FIND_CHILD_MIN_SCORE; } -struct find_child_context { - u64 addr; - bool is_bridge; - acpi_handle ret; - int ret_score; -}; - -static acpi_status do_find_child(acpi_handle handle, u32 lvl_not_used, -void *data, void **not_used) +struct acpi_device *acpi_find_child_device(struct acpi_device *parent, + u64 address, bool check_children) { - struct find_child_context *context = data; - unsigned long long addr; - acpi_status status; - int score; + struct acpi_device *adev, *ret = NULL; + int ret_score = 0; - status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, ); - if (ACPI_FAILURE(status) || addr != context->addr) - return AE_OK; - - if (!context->ret) { - /* This is the first matching object. Save its handle. */ - context->ret = handle; - return AE_OK; - } - /* -* There is more than one matching object with the same _ADR value. -* That really is unexpected, so we are kind of beyond the scope of the -* spec here. We have to choose which one to return, though. -* -* First, check if the previously found object is good enough and return -* its handle if so. Second, check the same for the object that we've -* just found. -*/ - if (!context->ret_score) { - score = do_find_child_checks(context->ret, context->is_bridge); - if (score == FIND_CHILD_MAX_SCORE) - return AE_CTRL_TERMINATE; - else - context->ret_score = score; - } - score = do_find_child_checks(handle, context->is_bridge); - if (score ==
RE: [PATCH v2 3/5] rtc: s5m: Limit endless loop waiting for register update
On Thursday, November 28, 2013 10:48 PM, Mark Brown wrote: > > After setting alarm or time the driver is waiting for UDR register to be > > cleared indicating that registers data have been transferred. > > > > Limit the endless loop to only 5 retries. > > Reviwed-by: Mark Brown Acked-by: Sangbeom Kim Thanks, Sangbeom. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH v2 2/5] rtc: s5m: Fix unsuccesful IRQ request during probe
On Thursday, November 28, 2013 10:47 PM, Mark Brown wrote: > > Fix rtc-s5m interrupt request by using regmap_irq_get_virq() for mapping > > the IRQ. > > Reviwed-by: Mark Brown Acked-by: Sangbeom Kim Thanks, Sangbeom. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH v2 1/5] mfd/rtc: s5m: Fix register updating by adding regmap for RTC
On Thursday, November 28, 2013 10:51 PM, Mark Brown wrote: > > On S5M8767A registers were not properly updated and read due to usage > > of the same regmap as the PMIC. This could be observed in various > > hangs, e.g. in infinite loop during waiting for UDR field change. > > Reviwed-by: Mark Brown Acked-by: Sangbeom Kim Thanks, Sangbeom. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] ARM: pxa: Move iotable mapping inside vmalloc region
In order to remove the following ugly message: BUG: mapping for 0x at 0xff00 out of vmalloc space the iotable mappings should be re-located inside the vmalloc region. Such move was introduced at commit: commit 0536bdf33faff4d940ac094c77998cfac368cfff Author: Nicolas Pitre Date: Thu Aug 25 00:35:59 2011 -0400 ARM: move iotable mappings within the vmalloc region While at it, condition the mapping to PXA25x and PXA27x, which are the only platforms where it's used. Cc: Nicolas Pitre Cc: Russell King - ARM Linux Cc: David Heidelberger Signed-off-by: Ezequiel Garcia --- David, Is it possible for you to give this a try on your board? arch/arm/mach-pxa/generic.c | 6 -- arch/arm/mach-pxa/include/mach/hardware.h | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c index 4225417..3c1b4fa 100644 --- a/arch/arm/mach-pxa/generic.c +++ b/arch/arm/mach-pxa/generic.c @@ -83,11 +83,13 @@ static struct map_desc common_io_desc[] __initdata = { .pfn= __phys_to_pfn(0x4000), .length = 0x0200, .type = MT_DEVICE +#if defined(CONFIG_PXA25x) || defined(CONFIG_PXA27x) }, {/* UNCACHED_PHYS_0 */ - .virtual= 0xff00, + .virtual= UNCACHED_PHYS_0, .pfn= __phys_to_pfn(0x), - .length = 0x0010, + .length = UNCACHED_SIZE, .type = MT_DEVICE +#endif } }; diff --git a/arch/arm/mach-pxa/include/mach/hardware.h b/arch/arm/mach-pxa/include/mach/hardware.h index ccb06e4..b365a72 100644 --- a/arch/arm/mach-pxa/include/mach/hardware.h +++ b/arch/arm/mach-pxa/include/mach/hardware.h @@ -14,13 +14,14 @@ #define __ASM_ARCH_HARDWARE_H #include +#include /* * Workarounds for at least 2 errata so far require this. * The mapping is set in mach-pxa/generic.c. */ -#define UNCACHED_PHYS_00xff00 -#define UNCACHED_ADDR UNCACHED_PHYS_0 +#define UNCACHED_PHYS_0(VMALLOC_END - UNCACHED_SIZE) +#define UNCACHED_SIZE SZ_1M /* * Intel PXA2xx internal register mapping: -- 1.8.1.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/1] xen-netback: include definition of csum_ipv6_magic
From: Andy Whitcroft Date: Mon, 25 Nov 2013 16:52:34 + > We are now using csum_ipv6_magic, include the appropriate header. > Avoids the following error: > > drivers/net/xen-netback/netback.c:1313:4: error: implicit declaration of > function 'csum_ipv6_magic' [-Werror=implicit-function-declaration] > tcph->check = ~csum_ipv6_magic(>saddr, > > Signed-off-by: Andy Whitcroft Applied, thank you. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 1/6] net: MOXA ART: clear TX descriptor length bits between sends
Some of the patches in this series add new features, therefore please this series when the net-next tree opens back up. Thank you. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH net] macvtap: fix tx_dropped counting error
From: Jason Wang Date: Mon, 25 Nov 2013 17:19:04 +0800 > After commit 8ffab51b3dfc54876f145f15b351c41f3f703195 > (macvlan: lockless tx path), tx stat counter were converted to percpu stat > structure. So we need use to this also for tx_dropped in macvtap. Otherwise, > the > management won't notice the dropping packet in macvtap tx path. > > Cc: Michael S. Tsirkin > Cc: Vlad Yasevich > Cc: Eric Dumazet > Signed-off-by: Jason Wang Applied, thanks Jason. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] phy: Add Vitesse 8514 phy ID
From: Date: Mon, 25 Nov 2013 12:40:49 +0800 > From: Shaohui Xie > > Phy is compatible with Vitesse 82xx > > Signed-off-by: Shaohui Xie Applied, thank you. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [V2 PATCH] sctp: Restore 'resent' bit to avoid retransmitted chunks for RTT measurements
From: Xufeng Zhang Date: Mon, 25 Nov 2013 11:26:57 +0800 > Currently retransmitted DATA chunks could also be used for > RTT measurements since there are no flag to identify whether > the transmitted DATA chunk is a new one or a retransmitted one. > This problem is introduced by commit ae19c5486 ("sctp: remove > 'resent' bit from the chunk") which inappropriately removed the > 'resent' bit completely, instead of doing this, we should set > the resent bit only for the retransmitted DATA chunks. > > Signed-off-by: Xufeng Zhang > --- > v1->v2: > Rmoved initialization for resent bit. > Combined two if clause Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/