[PATCH] vmw_vmci: Fix irq allocation

2017-03-26 Thread Petr Vandrovec
From: Petr Vandrovec 

Change 3bb434 (vmw_vmci: switch to pci_irq_alloc_vectors) converted
vmw_vmci to use pci_irq_alloc_vectors.  Unfortunately for the code
pci_irq_alloc_vectors returns number of allocated vectors on success,
rather than zero.  So successful allocation was always treated as
an error, causing slew of warning messages, and then error that
device probe method returned unexpected value 2.

Checking that error is < 0 fixes problem.

While I was there, I've simplified allocation to do just one
pci_irq_alloc_vectors call: VMCI device currently supports only
two MSI-X vectors, so we either get two dedicated vectors, or
one shared vector.  Nothing else can happen.  So we can ask
for minimum=1, maximum=2, MSI-X | MSI | Legacy, and get back
best possible choice.

Signed-off-by: Petr Vandrovec 
Cc: Christoph Hellwig 
Cc: Greg Kroah-Hartman 
Fixes: 3bb434cdcc6a ("vmw_vmci: switch to pci_irq_alloc_vectors")
---
 drivers/misc/vmw_vmci/vmci_guest.c | 16 +---
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/misc/vmw_vmci/vmci_guest.c 
b/drivers/misc/vmw_vmci/vmci_guest.c
index 9d659542a335..6aea073841c8 100644
--- a/drivers/misc/vmw_vmci/vmci_guest.c
+++ b/drivers/misc/vmw_vmci/vmci_guest.c
@@ -464,7 +464,6 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
}
 
vmci_dev->dev = &pdev->dev;
-   vmci_dev->exclusive_vectors = false;
vmci_dev->iobase = iobase;
 
tasklet_init(&vmci_dev->datagram_tasklet,
@@ -564,16 +563,11 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
 * Enable interrupts.  Try MSI-X first, then MSI, and then fallback on
 * legacy interrupts.
 */
-   error = pci_alloc_irq_vectors(pdev, VMCI_MAX_INTRS, VMCI_MAX_INTRS,
-   PCI_IRQ_MSIX);
-   if (error) {
-   error = pci_alloc_irq_vectors(pdev, 1, 1,
-   PCI_IRQ_MSIX | PCI_IRQ_MSI | PCI_IRQ_LEGACY);
-   if (error)
-   goto err_remove_bitmap;
-   } else {
-   vmci_dev->exclusive_vectors = true;
-   }
+   error = pci_alloc_irq_vectors(pdev, 1, VMCI_MAX_INTRS,
+   PCI_IRQ_MSIX | PCI_IRQ_MSI | PCI_IRQ_LEGACY);
+   if (error < 0)
+   goto err_remove_bitmap;
+   vmci_dev->exclusive_vectors = error == VMCI_MAX_INTRS;
 
/*
 * Request IRQ for legacy or MSI interrupts, or for first
-- 
2.11.0



Re: [RFC] Add option to mount only a pids subset

2017-03-26 Thread Djalal Harouni
(Cc'ed Kees and Jann for the procfs stacking issue)


On Thu, Mar 23, 2017 at 11:07 PM, Alexey Gladkov
 wrote:
> On Thu, Mar 23, 2017 at 05:06:28PM +0100, Djalal Harouni wrote:
>> Hi Alexey,
>>
>> On Mon, Mar 20, 2017 at 1:58 PM, Alexey Gladkov
>>  wrote:
>> >
>> >
>> > Al Viro, this patch looks better ?
>> >
>> > == Overview ==
>> >
>> > Some of the container virtualization systems are mounted /proc inside
>> > the container. This is done in most cases to operate with information
>> > about the processes. Knowing that /proc filesystem is not fully
>> > virtualized they are mounted on top of dangerous places empty files or
>> > directories (for exmaple /proc/sys, /proc/kcore, /sys/firmware, etc.).
>> >
>> > The structure of this filesystem is dynamic and any module can create a
>> > new object which will not necessarily be virtualized. There are
>> > proprietary modules that aren't in the mainline whose work we can not
>> > verify.
>> >
>> > This opens up a potential threat to the system. The developers of the
>> > virtualization system can't predict all dangerous places in /proc by
>> > definition.
>> >
>> > A more effective solution would be to mount into the container only what
>> > is necessary and ignore the rest.
>> >
>> > Right now there is the opportunity to pass in the container any port of
>> > the /proc filesystem using mount --bind expect the pids.
>> >
>> > This patch allows to mount only the part of /proc related to pids without
>> > rest objects. Since this is an option for /proc, flags applied to /proc
>> > have an effect on this subset of filesystem.
>>
>> I just sent a patch that also has to deal with proc hidepid here:
>> https://lkml.org/lkml/2017/3/23/505
>
> I completely agree with you that it looks wrong when options of one
> mountpoint affect the others mountpoints.
>
>> I'm not sure if that's the right approach, it is still buggy, however
>> seems that your patch also stores the mount option inside the
>> pid_namespace which may get propagated to all mounts inside same pidns
>> ?
>
> I don't store 'pidonly' option in my current patch. I mean in:
> https://lkml.org/lkml/2017/3/20/363
>
> I parse options twice at first mount of procfs. It happens before
> the mounting /proc in userspace.
>
> I know it's bad, but I couldn't find place to store this option.

Ok, then maybe that approach of having a procfs struct holder instead
of using pid namespace may help!


>> I didn't have enough time but maybe if they are related we can work it
>> out together ?
>
> I don't have enough experience in kenrel hacking, but I would happily do
> my best :)

OK, let's sync on this then.

> I also tring to mention it in every patch, as my changes almost completely
> useless without the ability to use the overlayfs.
>
> Now if you remove the restriction:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/proc/inode.c#n497

This protection was introduced in e54ad7f1ee263

That's a security fix, ecryptfs seems to schedule some code through
kthreads which always run in the initial namespaces with full
capabilities, bypassing all security checks.

I don't know if overlayfs has something similar, if not then maybe if
it's possible in ecryptfs to check the lower mount and the fs type and
move this procfs there...  Cc'ed Jann in case he may comment.

> and mount procfs as lowerdir in overlayfs then you get NULL pointer
> dereference at:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/namei.c#n891
>
> I got it when I tried to do `ls -la /overlay/proc/self/`.
>
> --
> Rgrds, legion


Re: [PATCH v3 4/7] alpha: Add support for memset16

2017-03-26 Thread kbuild test robot
Hi Matthew,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Matthew-Wilcox/Add-memsetN-functions/20170326-140108
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=alpha 

All errors (new ones prefixed by >>):

   In file included from include/linux/string.h:18:0,
from include/linux/bitmap.h:8,
from include/linux/cpumask.h:11,
from include/linux/rcupdate.h:40,
from include/linux/rculist.h:10,
from include/linux/pid.h:4,
from include/linux/sched.h:13,
from arch/alpha/kernel/asm-offsets.c:9:
   arch/alpha/include/asm/string.h: In function 'memset16':
>> arch/alpha/include/asm/string.h:74:2: error: expected ';' before 'return'
 return __memset16(p, v, n * 2);
 ^~
   make[2]: *** [arch/alpha/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

vim +74 arch/alpha/include/asm/string.h

68  #define __HAVE_ARCH_MEMSET16
69  extern void * __memset16(void *dest, unsigned short, size_t count);
70  static inline void *memset16(uint16_t *p, uint16_t v, size_t n)
71  {
72  if (__builtin_constant_p(v))
73  return __constant_c_memset(p, 0x0001000100010001UL * v, 
n * 2)
  > 74  return __memset16(p, v, n * 2);
75  }
76  
77  #endif /* __KERNEL__ */

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH v3 3/7] x86: Implement memset16, memset32 & memset64

2017-03-26 Thread kbuild test robot
Hi Matthew,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Matthew-Wilcox/Add-memsetN-functions/20170326-140108
config: i386-randconfig-x077-201713 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

>> lib/string.c:733:7: error: redefinition of 'memset32'
void *memset32(uint32_t *s, uint32_t v, size_t count)
  ^~~~
   In file included from arch/x86/include/asm/string.h:2:0,
from include/linux/string.h:18,
from lib/string.c:23:
   arch/x86/include/asm/string_32.h:347:21: note: previous definition of 
'memset32' was here
static inline void *memset32(uint32_t *s, uint32_t v, size_t n)
^~~~

vim +/memset32 +733 lib/string.c

9114f9de Matthew Wilcox 2017-03-24  717 return s;
9114f9de Matthew Wilcox 2017-03-24  718  }
9114f9de Matthew Wilcox 2017-03-24  719  EXPORT_SYMBOL(memset16);
9114f9de Matthew Wilcox 2017-03-24  720  #endif
9114f9de Matthew Wilcox 2017-03-24  721  
9114f9de Matthew Wilcox 2017-03-24  722  #ifndef __HAVE_ARCH_MEMSET32
9114f9de Matthew Wilcox 2017-03-24  723  /**
9114f9de Matthew Wilcox 2017-03-24  724   * memset32() - Fill a memory area 
with a uint32_t
9114f9de Matthew Wilcox 2017-03-24  725   * @s: Pointer to the start of the 
area.
9114f9de Matthew Wilcox 2017-03-24  726   * @v: The value to fill the area with
9114f9de Matthew Wilcox 2017-03-24  727   * @count: The number of values to 
store
9114f9de Matthew Wilcox 2017-03-24  728   *
9114f9de Matthew Wilcox 2017-03-24  729   * Differs from memset() in that it 
fills with a uint32_t instead
9114f9de Matthew Wilcox 2017-03-24  730   * of a byte.  Remember that @count is 
the number of uint32_ts to
9114f9de Matthew Wilcox 2017-03-24  731   * store, not the number of bytes.
9114f9de Matthew Wilcox 2017-03-24  732   */
9114f9de Matthew Wilcox 2017-03-24 @733  void *memset32(uint32_t *s, uint32_t 
v, size_t count)
9114f9de Matthew Wilcox 2017-03-24  734  {
9114f9de Matthew Wilcox 2017-03-24  735 uint32_t *xs = s;
9114f9de Matthew Wilcox 2017-03-24  736  
9114f9de Matthew Wilcox 2017-03-24  737 while (count--)
9114f9de Matthew Wilcox 2017-03-24  738 *xs++ = v;
9114f9de Matthew Wilcox 2017-03-24  739 return s;
9114f9de Matthew Wilcox 2017-03-24  740  }
9114f9de Matthew Wilcox 2017-03-24  741  EXPORT_SYMBOL(memset32);

:: The code at line 733 was first introduced by commit
:: 9114f9de5005f9468370ed1cb1b5b841b10d3bad Add multibyte memset functions

:: TO: Matthew Wilcox 
:: CC: 0day robot 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH 4.10 00/27] 4.10.6-stable review

2017-03-26 Thread Greg Kroah-Hartman
On Fri, Mar 24, 2017 at 06:00:28PM -0600, Shuah Khan wrote:
> On 03/24/2017 11:58 AM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.10.6 release.
> > There are 27 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Sun Mar 26 15:12:13 UTC 2017.
> > Anything received after that time might be too late.
> > 
> > The whole patch series can be found in one patch at:
> > kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.10.6-rc1.gz
> > or in the git tree and branch at:
> >   git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> > linux-4.10.y
> > and the diffstat can be found below.
> > 
> > thanks,
> > 
> > greg k-h
> > 
> 
> Compiled and booted on my test system. No dmesg regression.

Thanks for testing all of these and letting me know.

greg k-h


Re: Splat during resume

2017-03-26 Thread Mike Galbraith
On Sat, 2017-03-25 at 22:46 +0100, Borislav Petkov wrote:
> On Sat, Mar 25, 2017 at 07:58:55PM +0100, Borislav Petkov wrote:
> > Hey Rafael,
> > 
> > have you seen this already (partial splat photo attached)? Happens
> > during resume from s2d. Judging by the timestamps, this looks like the
> > resume kernel before we switch to the original, boot one but I could be
> > mistaken.
> > 
> > This is -rc3+tip/master.
> > 
> > I can't catch a full splat because this is a laptop and it doesn't have
> > serial. netconsole is helping me for shit so we'd need some guess work.
> > 
> > So I'm open to suggestions.
> > 
> > Please don't say "bisect" yet ;-)))
> 
> No need, I found it. Reverting
> 
>   ea3b5e60ce80 ("x86/mm/ident_map: Add 5-level paging support")
> 
> makes the machine suspend and resume just fine again. Lemme add people to CC.

To be filed under "_maybe_ interesting", my tip-rt tree hits the below
on boot (survives), ONLY on vaporite (kvm), silicon boots clean, works
fine, hibernate/suspend gripe free.  The revert fixed up vaporite.

[   16.566554] BUG: unable to handle kernel paging request at c753f000f000
[   16.566562] IP: ident_pmd_init.isra.4+0x56/0xb0
[   16.566563] PGD 0 

[   16.566565] Oops:  [#1] PREEMPT SMP
[   16.566569] Dumping ftrace buffer:
[   16.566593](ftrace buffer empty)
[   16.566593] Modules linked in: nf_conntrack_ipv6(E) nf_defrag_ipv6(E) 
ip6table_raw(E) ipt_REJECT(E) iptable_raw(E) xt_CT(E) iptable_filter(E) 
ip6table_mangle(E) nf_conntrack_netbios_ns(E) nf_conntrack_broadcast(E) 
nf_conntrack_ipv4(E) nf_defrag_ipv4(E) ip_tables(E) xt_conntrack(E) 
nf_conntrack(E) libcrc32c(E) ip6table_filter(E) ip6_tables(E) x_tables(E) 
joydev(E) snd_hda_codec_generic(E) snd_hda_intel(E) snd_hda_codec(E) 
snd_hda_core(E) snd_hwdep(E) snd_pcm(E) snd_timer(E) snd(E) soundcore(E) 
8139too(E) i2c_piix4(E) virtio_balloon(E) crct10dif_pclmul(E) crc32_pclmul(E) 
ghash_clmulni_intel(E) pcbc(E) ppdev(E) aesni_intel(E) serio_raw(E) pcspkr(E) 
aes_x86_64(E) parport_pc(E) crypto_simd(E) parport(E) acpi_cpufreq(E) 
glue_helper(E) button(E) cryptd(E) nfsd(E) auth_rpcgss(E) nfs_acl(E) lockd(E) 
grace(E)
[   16.566611]  sunrpc(E) ext4(E) crc16(E) jbd2(E) mbcache(E) hid_generic(E) 
usbhid(E) sr_mod(E) cdrom(E) ata_generic(E) virtio_rng(E) virtio_blk(E) 
virtio_console(E) ata_piix(E) qxl(E) crc32c_intel(E) drm_kms_helper(E) 
syscopyarea(E) uhci_hcd(E) ehci_pci(E) sysfillrect(E) sysimgblt(E) ehci_hcd(E) 
fb_sys_fops(E) ahci(E) virtio_pci(E) libahci(E) ttm(E) virtio_ring(E) 8139cp(E) 
virtio(E) usbcore(E) drm(E) libata(E) mii(E) floppy(E) sg(E) scsi_mod(E) 
autofs4(E)
[   16.566625] CPU: 6 PID: 1295 Comm: kexec Tainted: GE   
4.11.0-rt12-tip-rt #80
[   16.566626] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
rel-1.8.1-0-g4adadbd-20161202_174313-build11a 04/01/2014
[   16.566626] task: 88022a3daf40 task.stack: c9000252
[   16.566628] RIP: 0010:ident_pmd_init.isra.4+0x56/0xb0
[   16.566628] RSP: 0018:c90002523da0 EFLAGS: 00010286
[   16.566629] RAX: c01f RBX:  RCX: 
[   16.566629] RDX: c753f000f000 RSI: c90002523e90 RDI: c90002523e88
[   16.566629] RBP: 4000 R08: 4000 R09: 35ff6fff
[   16.566630] R10: 2600 R11: 0009f000 R12: c01f
[   16.566630] R13: cfff R14: c753f000f000 R15: c90002523e88
[   16.566631] FS:  7f7ad2486700() GS:88023fd8() 
knlGS:
[   16.566631] CS:  0010 DS:  ES:  CR0: 80050033
[   16.566632] CR2: c753f000f000 CR3: 00023fd68000 CR4: 001406e0
[   16.566634] Call Trace:
[   16.566639]  ? ident_pud_init+0x7a/0x180
[   16.566641]  ? kernel_ident_mapping_init+0x152/0x1f0
[   16.566643]  ? machine_kexec_prepare+0xa7/0x470
[   16.566644]  ? kexec_mark_crashkres+0x70/0x70
[   16.566647]  ? SyS_kexec_file_load+0x2e4/0x6b0
[   16.566651]  ? do_sys_open+0x182/0x1e0
[   16.566655]  ? entry_SYSCALL_64_fastpath+0x1a/0xa5
[   16.566656] Code: 53 48 89 cb 48 81 e3 00 00 e0 ff 48 83 ec 08 4c 39 c3 48 
89 34 24 73 54 48 89 da 4c 89 e0 48 c1 ea 12 81 e2 f8 0f 00 00 4c 01 f2 <48> 8b 
0a f6 c1 80 49 0f 44 c5 48 21 c8 a9 81 01 00 00 75 21 48 
[   16.55] RIP: ident_pmd_init.isra.4+0x56/0xb0 RSP: c90002523da0
[   16.55] CR2: c753f000f000


Re: Still OOM problems with 4.9er/4.10er kernels

2017-03-26 Thread Gerhard Wiesinger

On 23.03.2017 09:38, Mike Galbraith wrote:

On Thu, 2017-03-23 at 08:16 +0100, Gerhard Wiesinger wrote:

On 21.03.2017 08:13, Mike Galbraith wrote:

On Tue, 2017-03-21 at 06:59 +0100, Gerhard Wiesinger wrote:


Is this the correct information?

Incomplete, but enough to reiterate cgroup_disable=memory
suggestion.


How to collect complete information?

If Michal wants specifics, I suspect he'll ask.  I posted only to pass
along a speck of information, and offer a test suggestion.. twice.


Still OOM with cgroup_disable=memory, kernel 
4.11.0-0.rc3.git0.2.fc26.x86_64,I set vm.min_free_kbytes = 10240 in 
these tests.

# Full config
grep "vm\." /etc/sysctl.d/*
/etc/sysctl.d/00-dirty_background_ratio.conf:vm.dirty_background_ratio = 3
/etc/sysctl.d/00-dirty_ratio.conf:vm.dirty_ratio = 15
/etc/sysctl.d/00-kernel-vm-min-free-kbyzes.conf:vm.min_free_kbytes = 10240
/etc/sysctl.d/00-overcommit_memory.conf:vm.overcommit_memory = 2
/etc/sysctl.d/00-overcommit_ratio.conf:vm.overcommit_ratio = 80
/etc/sysctl.d/00-swappiness.conf:vm.swappiness=10

[31880.623557] sa1: page allocation stalls for 10942ms, order:0, 
mode:0x14200ca(GFP_HIGHUSER_MOVABLE), nodemask=(null)

[31880.623623] sa1 cpuset=/ mems_allowed=0
[31880.623630] CPU: 1 PID: 17112 Comm: sa1 Not tainted 
4.11.0-0.rc3.git0.2.fc26.x86_64 #1
[31880.623724] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), 
BIOS 1.9.3 04/01/2014

[31880.623819] Call Trace:
[31880.623893]  dump_stack+0x63/0x84
[31880.623971]  warn_alloc+0x10c/0x1b0
[31880.624046]  __alloc_pages_slowpath+0x93d/0xe60
[31880.624142]  ? get_page_from_freelist+0x122/0xbf0
[31880.624225]  ? unmap_region+0xf7/0x130
[31880.624312]  __alloc_pages_nodemask+0x290/0x2b0
[31880.624388]  alloc_pages_vma+0xa0/0x2b0
[31880.624463]  __handle_mm_fault+0x4d0/0x1160
[31880.624550]  handle_mm_fault+0xb3/0x250
[31880.624628]  __do_page_fault+0x23f/0x4c0
[31880.624701]  trace_do_page_fault+0x41/0x120
[31880.624781]  do_async_page_fault+0x51/0xa0
[31880.624866]  async_page_fault+0x28/0x30
[31880.624941] RIP: 0033:0x7f9218d4914f
[31880.625032] RSP: 002b:7ffe0d1376a8 EFLAGS: 00010206
[31880.625153] RAX: 7f9218d2a314 RBX: 7f9218f4e658 RCX: 
7f9218d2a354
[31880.625235] RDX: 05ec RSI:  RDI: 
7f9218d2a314
[31880.625324] RBP: 7ffe0d137950 R08: 7f9218d2a900 R09: 
00027000
[31880.625423] R10: 7ffe0d1376e0 R11: 7f9218d2a900 R12: 
0003
[31880.625505] R13: 7ffe0d137a38 R14: fd01 R15: 
0002

[31880.625688] Mem-Info:
[31880.625762] active_anon:36671 inactive_anon:36711 isolated_anon:88
active_file:1399 inactive_file:1410 isolated_file:0
unevictable:0 dirty:5 writeback:15 unstable:0
slab_reclaimable:3099 slab_unreclaimable:3558
mapped:2037 shmem:3 pagetables:3340 bounce:0
free:2972 free_pcp:102 free_cma:0
[31880.627334] Node 0 active_anon:146684kB inactive_anon:146816kB 
active_file:5596kB inactive_file:5572kB unevictable:0kB 
isolated(anon):368kB isolated(file):0kB mapped:8044kB dirty:20kB 
writeback:136kB shmem:0kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 
12kB writeback_tmp:0kB unstable:0kB pages_scanned:82 all_unreclaimable? no
[31880.627606] Node 0 DMA free:1816kB min:440kB low:548kB high:656kB 
active_anon:5636kB inactive_anon:6844kB active_file:132kB 
inactive_file:148kB unevictable:0kB writepending:4kB present:15992kB 
managed:15908kB mlocked:0kB slab_reclaimable:284kB 
slab_unreclaimable:532kB kernel_stack:0kB pagetables:188kB bounce:0kB 
free_pcp:0kB local_pcp:0kB free_cma:0kB

[31880.627883] lowmem_reserve[]: 0 327 327 327 327
[31880.627959] Node 0 DMA32 free:10072kB min:9796kB low:12244kB 
high:14692kB active_anon:141048kB inactive_anon:14kB 
active_file:5432kB inactive_file:5444kB unevictable:0kB 
writepending:152kB present:376688kB managed:353760kB mlocked:0kB 
slab_reclaimable:12112kB slab_unreclaimable:13700kB kernel_stack:2464kB 
pagetables:13172kB bounce:0kB free_pcp:504kB local_pcp:272kB free_cma:0kB

[31880.628334] lowmem_reserve[]: 0 0 0 0 0
[31880.629882] Node 0 DMA: 33*4kB (UME) 24*8kB (UM) 26*16kB (UME) 4*32kB 
(UME) 5*64kB (UME) 1*128kB (E) 2*256kB (M) 0*512kB 0*1024kB 0*2048kB 
0*4096kB = 1828kB
[31880.632255] Node 0 DMA32: 174*4kB (UMEH) 107*8kB (UMEH) 96*16kB 
(UMEH) 59*32kB (UME) 30*64kB (UMEH) 8*128kB (UEH) 8*256kB (UMEH) 1*512kB 
(E) 0*1024kB 0*2048kB 0*4096kB = 10480kB
[31880.634344] Node 0 hugepages_total=0 hugepages_free=0 
hugepages_surp=0 hugepages_size=2048kB

[31880.634346] 7276 total pagecache pages
[31880.635277] 4367 pages in swap cache
[31880.636206] Swap cache stats: add 563, delete 5635551, find 
6573228/8496821

[31880.637145] Free swap  = 973736kB
[31880.638038] Total swap = 2064380kB
[31880.638988] 98170 pages RAM
[31880.640309] 0 pages HighMem/MovableOnly
[31880.641791] 5753 pages reserved
[31880.642908] 0 pages cma reserved
[31880.643978] 0 pages hwpoisoned

Will try your suggestion

Re: Splat during resume

2017-03-26 Thread Borislav Petkov
On Sun, Mar 26, 2017 at 10:25:43AM +0200, Mike Galbraith wrote:
> To be filed under "_maybe_ interesting", my tip-rt tree hits the below
> on boot (survives), ONLY on vaporite (kvm), silicon boots clean, works
> fine, hibernate/suspend gripe free.

Strange - I did boot fine but resume shit in its pants.

> The revert fixed up vaporite.

vaporite, haha, good one. I like that, let's do
s/vaporitization/virtualization/g from now on :-)

Btw, try the 6 patches here: https://marc.info/?l=linux-mm&m=148977696117208&w=2
ontop of tip. Should fix your vaporite too.

-- 
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.


Re: [PATCH v3 7/7] vga: Optimise console scrolling

2017-03-26 Thread kbuild test robot
Hi Matthew,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Matthew-Wilcox/Add-memsetN-functions/20170326-140108
config: sparc-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc 

All error/warnings (new ones prefixed by >>):

   In file included from include/video/vga.h:22:0,
from include/linux/vgaarb.h:34,
from drivers/gpu//drm/amd/amdgpu/amdgpu_device.c:35:
   arch/sparc/include/asm/vga.h: In function 'scr_memsetw':
>> arch/sparc/include/asm/vga.h:39:11: error: 's' undeclared (first use in this 
>> function)
 memset16(s, cpu_to_le16(v), n / 2);
  ^
   arch/sparc/include/asm/vga.h:39:11: note: each undeclared identifier is 
reported only once for each function it appears in
--
   In file included from include/video/vga.h:22:0,
from include/linux/vgaarb.h:34,
from drivers/gpu//drm/nouveau/nouveau_vga.c:1:
   arch/sparc/include/asm/vga.h: In function 'scr_memsetw':
>> arch/sparc/include/asm/vga.h:39:2: error: implicit declaration of function 
>> 'memset16' [-Werror=implicit-function-declaration]
 memset16(s, cpu_to_le16(v), n / 2);
 ^~~~
>> arch/sparc/include/asm/vga.h:39:11: error: 's' undeclared (first use in this 
>> function)
 memset16(s, cpu_to_le16(v), n / 2);
  ^
   arch/sparc/include/asm/vga.h:39:11: note: each undeclared identifier is 
reported only once for each function it appears in
   arch/sparc/include/asm/vga.h: In function 'scr_memcpyw':
>> arch/sparc/include/asm/vga.h:46:2: error: implicit declaration of function 
>> 'memcpy' [-Werror=implicit-function-declaration]
 memcpy(d, s, n);
 ^~
>> arch/sparc/include/asm/vga.h:46:2: warning: incompatible implicit 
>> declaration of built-in function 'memcpy'
   arch/sparc/include/asm/vga.h:46:2: note: include '' or provide a 
declaration of 'memcpy'
   arch/sparc/include/asm/vga.h: In function 'scr_memmovew':
>> arch/sparc/include/asm/vga.h:53:2: error: implicit declaration of function 
>> 'memmove' [-Werror=implicit-function-declaration]
 memmove(d, s, n);
 ^~~
>> arch/sparc/include/asm/vga.h:53:2: warning: incompatible implicit 
>> declaration of built-in function 'memmove'
   arch/sparc/include/asm/vga.h:53:2: note: include '' or provide a 
declaration of 'memmove'
   In file included from include/uapi/linux/uuid.h:21:0,
from include/linux/uuid.h:19,
from include/linux/mod_devicetable.h:12,
from include/linux/i2c.h:29,
from include/uapi/linux/fb.h:5,
from include/linux/fb.h:5,
from include/linux/vga_switcheroo.h:34,
from drivers/gpu//drm/nouveau/nouveau_vga.c:2:
   include/linux/string.h: At top level:
>> include/linux/string.h:104:14: error: conflicting types for 'memset16'
extern void *memset16(uint16_t *, uint16_t, __kernel_size_t);
 ^~~~
   In file included from include/video/vga.h:22:0,
from include/linux/vgaarb.h:34,
from drivers/gpu//drm/nouveau/nouveau_vga.c:1:
   arch/sparc/include/asm/vga.h:39:2: note: previous implicit declaration of 
'memset16' was here
 memset16(s, cpu_to_le16(v), n / 2);
 ^~~~
   cc1: some warnings being treated as errors

vim +/s +39 arch/sparc/include/asm/vga.h

33  }
34  
35  static inline void scr_memsetw(u16 *p, u16 v, unsigned int n)
36  {
37  BUG_ON((long) p >= 0);
38  
  > 39  memset16(s, cpu_to_le16(v), n / 2);
40  }
41  
42  static inline void scr_memcpyw(u16 *d, u16 *s, unsigned int n)
43  {
44  BUG_ON((long) d >= 0);
45  
  > 46  memcpy(d, s, n);
47  }
48  
49  static inline void scr_memmovew(u16 *d, u16 *s, unsigned int n)
50  {
51  BUG_ON((long) d >= 0);
52  
  > 53  memmove(d, s, n);
54  }
55  
56  #define VGA_MAP_MEM(x,s) (x)

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH v2 09/23] MAINTAINERS: Add file patterns for infiniband device tree bindings

2017-03-26 Thread Geert Uytterhoeven
Hi Doug,

On Sat, Mar 25, 2017 at 3:40 AM, Doug Ledford  wrote:
> On Sun, 2017-03-12 at 14:16 +0100, Geert Uytterhoeven wrote:
>> Submitters of device tree binding documentation may forget to CC
>> the subsystem maintainer if this is missing.
>>
>> Signed-off-by: Geert Uytterhoeven 
>> Cc: Doug Ledford 
>> Cc: Sean Hefty 
>> Cc: Hal Rosenstock 
>> Cc: linux-r...@vger.kernel.org
>> ---
>> Please apply this patch directly if you want to be involved in device
>> tree binding documentation for your subsystem.
>
> I assume this is going through someone else' tree since I only see

That wasn't my intention, though, cfr. the quoted paragraph above
("you" and "your subsystem").

> patch 09 of 23 and not the entire series.  But, for this specific
> patch:
>
> Acked-by: Doug Ledford 

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH 4.10 00/27] 4.10.6-stable review

2017-03-26 Thread Greg Kroah-Hartman
On Fri, Mar 24, 2017 at 09:18:32PM -0700, Guenter Roeck wrote:
> On 03/24/2017 10:58 AM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.10.6 release.
> > There are 27 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Sun Mar 26 15:12:13 UTC 2017.
> > Anything received after that time might be too late.
> > 
> 
> Build results:
>   total: 149 pass: 149 fail: 0
> Qemu test results:
>   total: 122 pass: 122 fail: 0
> 
> Details are available at http://kerneltests.org/builders.
> 
> Guenter
> 

Thanks for testing all of these and letting me know.

greg k-h


script to setup pipeline was Re: [PATCH v4 14/36] [media] v4l2-mc: add a function to inherit controls from a pipeline

2017-03-26 Thread Pavel Machek
Hi!

> > I do agree with you that MC places a lot of burden on the user to
> > attain a lot of knowledge of the system's architecture.
> 
> Setting up the pipeline is not the hard part. One could write a
> script to do that. 

Can you try to write that script? I believe it would solve big part of
the problem.

> > And my other point is, I think most people who have a need to work with
> > the media framework on a particular platform will likely already be
> > quite familiar with that platform.
> 
> I disagree. The most popular platform device currently is Raspberry PI.
> 
> I doubt that almost all owners of RPi + camera module know anything
> about MC. They just use Raspberry's official driver with just provides
> the V4L2 interface.
> 
> I have a strong opinion that, for hardware like RPi, just the V4L2
> API is enough for more than 90% of the cases.

Maybe V4L2 API is enough for 90% of the users. But I don't believe
that means that we should provide compatibility. V4L2 API is not good
enough for complex devices, and if we can make RPi people fix
userspace... that's a good thing.

> > The media graph for imx6 is fairly self-explanatory in my opinion.
> > Yes that graph has to be generated, but just with a simple 'media-ctl
> > --print-dot', I don't see how that is difficult for the user.
> 
> Again, IMHO, the problem is not how to setup the pipeline, but, instead,
> the need to forward controls to the subdevices.
> 
> To use a camera, the user needs to set up a set of controls for the
> image to make sense (bright, contrast, focus, etc). If the driver
> doesn't forward those controls to the subdevs, an application like
> "camorama" won't actually work for real, as the user won't be able
> to adjust those parameters via GUI.

I believe this can be fixed in libv4l2.
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature


Re: [PATCH 0/2] Move uart_register_driver call to device probe for pl010 and sh-sci

2017-03-26 Thread Geert Uytterhoeven
Hi Russell, Sjoerd,

On Fri, Mar 24, 2017 at 5:42 PM, Russell King - ARM Linux
 wrote:
> On Fri, Mar 24, 2017 at 05:26:32PM +0100, Sjoerd Simons wrote:
>> When testing on a Renesas board with the PL010 serial driver enabled
>> serial output broke. Turns out the minor device numbers for both
>> drivers happen to overlap, causing whichever driver happened to be the
>> second one to register to fail.
>
> How the  has the SH serial driver ended up with overlapping device
> numbers?

Interesting...

> What happened to our maintained list of allocated major/minor device
> numbers, which is supposed to stop crap like this happening?

AMBA PL010 has been assigned major 204, minors 16..31,
SCI has been assigned major 204, minors 8..11.

Over the years, Renesas SoCs have been gaining more and more serial
ports, leading to

#define SCI_NPORTS CONFIG_SERIAL_SH_SCI_NR_UARTS

with CONFIG_SERIAL_SH_SCI_NR_UARTS=20 in shmobile_defconfig and
multi_v7_defconfig (although the maximum value on any supported SoC is 18).

But once the value becomes 5 or more, it starts overflowing into the ttyFWx
and ttyAMx space.

How to solve this?
Time for the serial subsystem to switch to dynamic minors, and get rid of the
what-is-your-serial-port-called-again-on-this-platform
multi-million-euro question?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


[tip:locking/core] lockdep: Fix per-cpu static objects

2017-03-26 Thread tip-bot for Peter Zijlstra
Commit-ID:  4ef9ea9524c0015e551d062ac75ab9fd04365277
Gitweb: http://git.kernel.org/tip/4ef9ea9524c0015e551d062ac75ab9fd04365277
Author: Peter Zijlstra 
AuthorDate: Mon, 20 Mar 2017 12:26:55 +0100
Committer:  Thomas Gleixner 
CommitDate: Sun, 26 Mar 2017 11:27:42 +0200

lockdep: Fix per-cpu static objects

Since commit 383776fa7527 ("locking/lockdep: Handle statically initialized
PER_CPU locks properly") we try to collapse per-cpu locks into a single
class by giving them all the same key. For this key we choose the canonical
address of the per-cpu object, which would be the offset into the per-cpu
area.

This has two problems:

 - there is a case where we run !0 lock->key through static_obj() and
   expect this to pass; it doesn't for canonical pointers.

 - 0 is a valid canonical address.

Cure both issues by redefining the canonical address as the address of the
per-cpu variable on the boot CPU.

Since I didn't want to rely on CPU0 being the boot-cpu, or even existing at
all, track the boot CPU in a variable.

Fixes: 383776fa7527 ("locking/lockdep: Handle statically initialized PER_CPU 
locks properly")
Reported-by: kernel test robot 
Signed-off-by: Peter Zijlstra (Intel) 
Tested-by: Borislav Petkov 
Cc: Sebastian Andrzej Siewior 
Cc: linux...@kvack.org
Cc: w...@linux.intel.com
Cc: kernel test robot 
Cc: LKP 
Link: 
http://lkml.kernel.org/r/20170320114108.kbvcsuepem45j...@hirez.programming.kicks-ass.net
Signed-off-by: Thomas Gleixner 

---
 include/linux/smp.h | 12 
 kernel/cpu.c|  6 ++
 kernel/module.c |  5 -
 mm/percpu.c |  5 -
 4 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/include/linux/smp.h b/include/linux/smp.h
index 8e0cb7a..8d41185 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -120,6 +120,13 @@ extern unsigned int setup_max_cpus;
 extern void __init setup_nr_cpu_ids(void);
 extern void __init smp_init(void);
 
+extern int __boot_cpu_id;
+
+static inline int boot_cpu_id(void)
+{
+   return __boot_cpu_id;
+}
+
 #else /* !SMP */
 
 static inline void smp_send_stop(void) { }
@@ -158,6 +165,11 @@ static inline void smp_init(void) { up_late_init(); }
 static inline void smp_init(void) { }
 #endif
 
+static inline int boot_cpu_id(void)
+{
+   return 0;
+}
+
 #endif /* !SMP */
 
 /*
diff --git a/kernel/cpu.c b/kernel/cpu.c
index f7c0632..a795725 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1125,6 +1125,8 @@ core_initcall(cpu_hotplug_pm_sync_init);
 
 #endif /* CONFIG_PM_SLEEP_SMP */
 
+int __boot_cpu_id;
+
 #endif /* CONFIG_SMP */
 
 /* Boot processor state steps */
@@ -1815,6 +1817,10 @@ void __init boot_cpu_init(void)
set_cpu_active(cpu, true);
set_cpu_present(cpu, true);
set_cpu_possible(cpu, true);
+
+#ifdef CONFIG_SMP
+   __boot_cpu_id = cpu;
+#endif
 }
 
 /*
diff --git a/kernel/module.c b/kernel/module.c
index 5ef6181..043ca86 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -682,8 +682,11 @@ bool __is_module_percpu_address(unsigned long addr, 
unsigned long *can_addr)
void *va = (void *)addr;
 
if (va >= start && va < start + mod->percpu_size) {
-   if (can_addr)
+   if (can_addr) {
*can_addr = (unsigned long) (va - 
start);
+   *can_addr += (unsigned long)
+   per_cpu_ptr(mod->percpu, 
boot_cpu_id());
+   }
preempt_enable();
return true;
}
diff --git a/mm/percpu.c b/mm/percpu.c
index 7d3b728..c95b475 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1293,8 +1293,11 @@ bool __is_kernel_percpu_address(unsigned long addr, 
unsigned long *can_addr)
void *va = (void *)addr;
 
if (va >= start && va < start + static_size) {
-   if (can_addr)
+   if (can_addr) {
*can_addr = (unsigned long) (va - start);
+   *can_addr += (unsigned long)
+   per_cpu_ptr(base, boot_cpu_id());
+   }
return true;
}
}


Re: [PATCH v3 7/7] vga: Optimise console scrolling

2017-03-26 Thread kbuild test robot
Hi Matthew,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Matthew-Wilcox/Add-memsetN-functions/20170326-140108
config: mips-defconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   In file included from include/linux/selection.h:11:0,
from drivers/video/console/newport_con.c:16:
   include/linux/vt_buffer.h: In function 'scr_memsetw':
>> include/linux/vt_buffer.h:34:2: error: implicit declaration of function 
>> 'memset16' [-Werror=implicit-function-declaration]
 memset16(s, c, count / 2);
 ^~~~
   include/linux/vt_buffer.h: In function 'scr_memcpyw':
>> include/linux/vt_buffer.h:47:2: error: implicit declaration of function 
>> 'memcpy' [-Werror=implicit-function-declaration]
 memcpy(d, s, count);
 ^~
   include/linux/vt_buffer.h: In function 'scr_memmovew':
>> include/linux/vt_buffer.h:66:2: error: implicit declaration of function 
>> 'memmove' [-Werror=implicit-function-declaration]
 memmove(d, s, count);
 ^~~
   In file included from include/linux/string.h:18:0,
from include/linux/bitmap.h:8,
from include/linux/cpumask.h:11,
from arch/mips/include/asm/processor.h:15,
from arch/mips/include/asm/thread_info.h:15,
from include/linux/thread_info.h:25,
from include/asm-generic/preempt.h:4,
from ./arch/mips/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:80,
from include/linux/spinlock.h:50,
from include/linux/wait.h:8,
from include/linux/fs.h:5,
from include/linux/tty.h:4,
from include/linux/vt_kern.h:11,
from drivers/video/console/newport_con.c:18:
   arch/mips/include/asm/string.h: At top level:
>> arch/mips/include/asm/string.h:138:14: error: conflicting types for 'memcpy'
extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
 ^~
   In file included from include/linux/selection.h:11:0,
from drivers/video/console/newport_con.c:16:
   include/linux/vt_buffer.h:47:2: note: previous implicit declaration of 
'memcpy' was here
 memcpy(d, s, count);
 ^~
   In file included from include/linux/string.h:18:0,
from include/linux/bitmap.h:8,
from include/linux/cpumask.h:11,
from arch/mips/include/asm/processor.h:15,
from arch/mips/include/asm/thread_info.h:15,
from include/linux/thread_info.h:25,
from include/asm-generic/preempt.h:4,
from ./arch/mips/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:80,
from include/linux/spinlock.h:50,
from include/linux/wait.h:8,
from include/linux/fs.h:5,
from include/linux/tty.h:4,
from include/linux/vt_kern.h:11,
from drivers/video/console/newport_con.c:18:
>> arch/mips/include/asm/string.h:141:14: error: conflicting types for 'memmove'
extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
 ^~~
   In file included from include/linux/selection.h:11:0,
from drivers/video/console/newport_con.c:16:
   include/linux/vt_buffer.h:66:2: note: previous implicit declaration of 
'memmove' was here
 memmove(d, s, count);
 ^~~
   In file included from include/linux/bitmap.h:8:0,
from include/linux/cpumask.h:11,
from arch/mips/include/asm/processor.h:15,
from arch/mips/include/asm/thread_info.h:15,
from include/linux/thread_info.h:25,
from include/asm-generic/preempt.h:4,
from ./arch/mips/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:80,
from include/linux/spinlock.h:50,
from include/linux/wait.h:8,
from include/linux/fs.h:5,
from include/linux/tty.h:4,
from include/linux/vt_kern.h:11,
   

Re: [PATCH 0/2] Move uart_register_driver call to device probe for pl010 and sh-sci

2017-03-26 Thread Russell King - ARM Linux
On Sun, Mar 26, 2017 at 11:22:57AM +0200, Geert Uytterhoeven wrote:
> Time for the serial subsystem to switch to dynamic minors, and get rid of the
> what-is-your-serial-port-called-again-on-this-platform
> multi-million-euro question?

Dynamic device numbers are fine for those who use devtmpfs / udev, but I
would imagine that there are systems out there which don't, and if they
change, systems become inaccessible (the port becomes dead, even to
sysrq.)

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.


Re: Splat during resume

2017-03-26 Thread Mike Galbraith
On Sun, 2017-03-26 at 10:41 +0200, Borislav Petkov wrote:

> Btw, try the 6 patches here: 
> https://marc.info/?l=linux-mm&m=148977696117208&w=2
> ontop of tip. Should fix your vaporite too.

Yeah, silicon is still happy, vaporite boots gripe free.  Trying to
hibernate vaporite was a bad idea, but is unrelated to this thread.

-Mike


Re: [PATCH] blkcg: allocate struct blkcg_gq outside request queue spinlock

2017-03-26 Thread Julia Lawall
Is an unlock needed before line 848?  Or does blkg_lookup_check take care
of it?

julia

-- Forwarded message --
Date: Sun, 26 Mar 2017 07:50:17 +0800
From: kbuild test robot 
To: kbu...@01.org
Cc: Julia Lawall 
Subject: Re: [PATCH] blkcg: allocate struct blkcg_gq outside request queue
spinlock

CC: kbuild-...@01.org
In-Reply-To: <20170324215627.12831-1-tah...@google.com>
TO: Tahsin Erdogan 
CC: Tejun Heo , Jens Axboe , 
linux-bl...@vger.kernel.org, David Rientjes , 
linux-kernel@vger.kernel.org, Tahsin Erdogan 
CC: linux-bl...@vger.kernel.org, David Rientjes , 
linux-kernel@vger.kernel.org, Tahsin Erdogan 

Hi Tahsin,

[auto build test WARNING on block/for-next]
[also build test WARNING on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Tahsin-Erdogan/blkcg-allocate-struct-blkcg_gq-outside-request-queue-spinlock/20170326-020755
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 
for-next
:: branch date: 6 hours ago
:: commit date: 6 hours ago

>> block/blk-cgroup.c:901:1-7: preceding lock on line 839
   block/blk-cgroup.c:901:1-7: preceding lock on line 876

git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d6344a76907e470f483dcb19998d438d19f6432d
vim +901 block/blk-cgroup.c

d6344a76 Tahsin Erdogan 2017-03-24  833 goto fail;
5f6c2d2b Tejun Heo  2015-07-22  834 }
e56da7e2 Tejun Heo  2012-03-05  835
d6344a76 Tahsin Erdogan 2017-03-24  836 q = disk->queue;
d6344a76 Tahsin Erdogan 2017-03-24  837
e56da7e2 Tejun Heo  2012-03-05  838 rcu_read_lock();
d6344a76 Tahsin Erdogan 2017-03-24 @839 spin_lock_irq(q->queue_lock);
da8b0662 Tejun Heo  2012-04-13  840
d6344a76 Tahsin Erdogan 2017-03-24  841 blkg = blkg_lookup_check(blkcg, 
pol, q);
d6344a76 Tahsin Erdogan 2017-03-24  842 if (IS_ERR(blkg)) {
d6344a76 Tahsin Erdogan 2017-03-24  843 ret = PTR_ERR(blkg);
d6344a76 Tahsin Erdogan 2017-03-24  844 goto fail_unlock;
d6344a76 Tahsin Erdogan 2017-03-24  845 }
d6344a76 Tahsin Erdogan 2017-03-24  846
d6344a76 Tahsin Erdogan 2017-03-24  847 if (blkg)
d6344a76 Tahsin Erdogan 2017-03-24  848 goto success;
d6344a76 Tahsin Erdogan 2017-03-24  849
d6344a76 Tahsin Erdogan 2017-03-24  850 /*
d6344a76 Tahsin Erdogan 2017-03-24  851  * Create blkgs walking down 
from blkcg_root to @blkcg, so that all
d6344a76 Tahsin Erdogan 2017-03-24  852  * non-root blkgs have access 
to their parents.
d6344a76 Tahsin Erdogan 2017-03-24  853  */
d6344a76 Tahsin Erdogan 2017-03-24  854 while (true) {
d6344a76 Tahsin Erdogan 2017-03-24  855 struct blkcg *pos = 
blkcg;
d6344a76 Tahsin Erdogan 2017-03-24  856 struct blkcg *parent;
d6344a76 Tahsin Erdogan 2017-03-24  857 struct blkcg_gq 
*new_blkg;
e56da7e2 Tejun Heo  2012-03-05  858
d6344a76 Tahsin Erdogan 2017-03-24  859 parent = 
blkcg_parent(blkcg);
d6344a76 Tahsin Erdogan 2017-03-24  860 while (parent && 
!__blkg_lookup(parent, q, false)) {
d6344a76 Tahsin Erdogan 2017-03-24  861 pos = parent;
d6344a76 Tahsin Erdogan 2017-03-24  862 parent = 
blkcg_parent(parent);
d6344a76 Tahsin Erdogan 2017-03-24  863 }
d6344a76 Tahsin Erdogan 2017-03-24  864
d6344a76 Tahsin Erdogan 2017-03-24  865 /* Drop locks to do new 
blkg allocation with GFP_KERNEL. */
d6344a76 Tahsin Erdogan 2017-03-24  866 
spin_unlock_irq(q->queue_lock);
d6344a76 Tahsin Erdogan 2017-03-24  867 rcu_read_unlock();
d6344a76 Tahsin Erdogan 2017-03-24  868
d6344a76 Tahsin Erdogan 2017-03-24  869 new_blkg = 
blkg_alloc(pos, q, GFP_KERNEL);
d6344a76 Tahsin Erdogan 2017-03-24  870 if 
(unlikely(!new_blkg)) {
d6344a76 Tahsin Erdogan 2017-03-24  871 ret = -ENOMEM;
d6344a76 Tahsin Erdogan 2017-03-24  872 goto fail;
d6344a76 Tahsin Erdogan 2017-03-24  873 }
d6344a76 Tahsin Erdogan 2017-03-24  874
d6344a76 Tahsin Erdogan 2017-03-24  875 rcu_read_lock();
d6344a76 Tahsin Erdogan 2017-03-24  876 
spin_lock_irq(q->queue_lock);
d6344a76 Tahsin Erdogan 2017-03-24  877
d6344a76 Tahsin Erdogan 2017-03-24  878 blkg = 
blkg_lookup_check(pos, pol, q);
e56da7e2 Tejun Heo  2012-03-05  879 if (IS_ERR(blkg)) {
e56da7e2 Tejun Heo  2012-03-05  880 ret = 
PTR_ERR(blkg);
d6344a76 Tahsin Erdogan 2017-03-24  881 goto 
fail_unlock;
d6344a76 Tahsin Erdogan 2017-03-24  882 }
d6344a76 Tahsin Erdogan

Re: [PATCH v2 1/3] mfd: Add Cherry Trail Whiskey Cove PMIC driver

2017-03-26 Thread Hans de Goede

Hi,

On 23-03-17 17:44, Lee Jones wrote:

On Mon, 20 Mar 2017, Hans de Goede wrote:


Add mfd driver for Intel CHT Whiskey Cove PMIC, based on various non
upstreamed CHT Whiskey Cove PMIC patches.

This is a somewhat minimal version which adds irqchip support and cells
for: ACPI PMIC opregion support, the i2c-controller driving the external
charger irc and the pwrsrc/extcon block.

Further cells can be added in the future if/when drivers are upstreamed
for them.

Cc: Bin Gao 
Cc: Felipe Balbi 
Cc: Andy Shevchenko 
Signed-off-by: Hans de Goede 
Reviewed-by: Andy Shevchenko 
---
Changes in v2:
-Since this uses plain mfd and not the intel_soc_pmic stuff give it
 its own Kconfig and allow this to be built as a module
-Add missing #include 
Changes in v3:
-Drop #include  again, not the right fix for the build errors
-Error out when the upper byte of the register-address passed to the regmap
 functions is 0 rather then hardcoding an address in that case
-Various minor style tweaks / cleanups
-Move defines of regulator register addresses to intel_pmic_chtwc.c,
 it is the only place where they are used
-Drop now empty include/linux/mfd/intel_chtwc.h
-Rename intel_soc_pmic_chtwc.c to intel_cht_wc.c to match Kconfig option name
-Add irqchip support
-Add external charger cell
-Add pwrsrc cell
Changes in v4:
-Use PLATFORM_DEVID_NONE
---
 drivers/mfd/Kconfig|  11 ++
 drivers/mfd/Makefile   |   1 +
 drivers/mfd/intel_soc_pmic_chtwc.c | 244 +
 3 files changed, 256 insertions(+)
 create mode 100644 drivers/mfd/intel_soc_pmic_chtwc.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 55ecdfb..d427a10 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -437,6 +437,17 @@ config INTEL_SOC_PMIC
  thermal, charger and related power management functions
  on these systems.

+config INTEL_SOC_PMIC_CHTWC
+   tristate "Support for Intel Cherry Trail Whiskey Cove PMIC"
+   depends on ACPI
+   depends on I2C


Nit: Any reason why these can't be on one line?


No, fixed for v5.




+   select MFD_CORE
+   select REGMAP_I2C
+   select REGMAP_IRQ
+   help
+ Select this option to enable support for the Intel Cherry Trail
+ Whiskey Cove PMIC found on some Intel Cherry Trail systems.
+
 config MFD_INTEL_LPSS
tristate
select COMMON_CLK
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 31ce076..d2ca514 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -209,6 +209,7 @@ obj-$(CONFIG_MFD_SKY81452)  += sky81452.o
 intel-soc-pmic-objs:= intel_soc_pmic_core.o intel_soc_pmic_crc.o
 intel-soc-pmic-$(CONFIG_INTEL_PMC_IPC) += intel_soc_pmic_bxtwc.o
 obj-$(CONFIG_INTEL_SOC_PMIC)   += intel-soc-pmic.o
+obj-$(CONFIG_INTEL_SOC_PMIC_CHTWC) += intel_soc_pmic_chtwc.o
 obj-$(CONFIG_MFD_MT6397)   += mt6397-core.o

 obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o
diff --git a/drivers/mfd/intel_soc_pmic_chtwc.c 
b/drivers/mfd/intel_soc_pmic_chtwc.c
new file mode 100644
index 000..50aec44
--- /dev/null
+++ b/drivers/mfd/intel_soc_pmic_chtwc.c
@@ -0,0 +1,244 @@
+/*
+ * MFD core driver for Intel Cherrytrail Whiskey Cove PMIC
+ * Copyright (C) 2017 Hans de Goede 
+ *
+ * Based on various non upstream patches to support the CHT Whiskey Cove PMIC:
+ * Copyright (C) 2013-2015 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */


We have a shortened version of the licence now -- any reason why it
can't be used here?


No reason, fixed for v5.




+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* PMIC device registers */
+#define REG_OFFSET_MASKGENMASK(7, 0)
+#define REG_ADDR_MASK  GENMASK(15, 8)
+#define REG_ADDR_SHIFT 8
+
+#define CHT_WC_IRQLVL1 0x6e02
+#define CHT_WC_IRQLVL1_MASK0x6e0e
+
+/* Whiskey Cove PMIC share same ACPI ID between different platforms */
+#define CHT_WC_HRV 3
+
+/* Level 1 IRQs (level 2 IRQs are handled in the child device drivers) */
+enum {
+   CHT_WC_PWRSRC_IRQ = 0,
+   CHT_WC_THRM_IRQ,
+   CHT_WC_BCU_IRQ,
+   CHT_WC_ADC_IRQ,
+   CHT_WC_EXT_CHGR_IRQ,
+   CHT_WC_GPIO_IRQ,
+   /* There is no irq 6 */
+   CHT_WC_CRIT_IRQ = 7,
+};
+
+static struct resource cht_wc_pwrsrc_resources[] = {
+   DEFINE_RES_IRQ(CHT_WC_PWRSRC_IRQ),
+};
+
+static struct resource cht_wc_ext_charger_resources[] = {
+   DEFINE_RES_IRQ(CHT_WC_EXT_CHGR_IRQ),
+};
+
+stat

[GIT PULL] IIO driver fixes for 4.11-rc4

2017-03-26 Thread Greg KH
The following changes since commit 4495c08e84729385774601b5146d51d9e5849f81:

  Linux 4.11-rc2 (2017-03-12 14:47:08 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/ 
tags/staging-4.11-rc4

for you to fetch changes up to 43c49938bf72b2862aa12b5d66e710e15ce0f7b7:

  Merge tag 'iio-fixes-for-4.11c' of 
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus 
(2017-03-22 12:02:01 +0100)


IIO fixes for 4.11-rc4

Here are some small IIO driver fixes for 4.11-rc4 that resolve a number
of tiny reported issues.  All of these have been in linux-next for a
while with no reported issues.

Signed-off-by: Greg Kroah-Hartman 


Dmitry Torokhov (1):
  iio: magnetometer: ak8974: remove incorrect __exit markups

Greg Kroah-Hartman (1):
  Merge tag 'iio-fixes-for-4.11c' of git://git.kernel.org/.../jic23/iio 
into staging-linus

Lars-Peter Clausen (1):
  iio: sw-device: Fix config group initialization

Lorenzo Bianconi (1):
  iio: imu: st_lsm6dsx: fix FIFO_CTRL2 overwrite during watermark 
configuration

Michael Engl (1):
  iio: adc: ti_am335x_adc: fix fifo overrun recovery

Song Hongyan (1):
  iio: hid-sensor-trigger: Change get poll value function order to avoid 
sensor properties losing after resume from S3

 drivers/iio/adc/ti_am335x_adc.c | 13 -
 drivers/iio/common/hid-sensors/hid-sensor-trigger.c |  6 +++---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c  |  4 ++--
 drivers/iio/magnetometer/ak8974.c   |  4 ++--
 include/linux/iio/sw_device.h   |  2 +-
 5 files changed, 20 insertions(+), 9 deletions(-)


[GIT PULL] USB/PHY driver fixes for 4.11-rc4

2017-03-26 Thread Greg KH
The following changes since commit 97da3854c526d3a6ee05c849c96e48d21527606c:

  Linux 4.11-rc3 (2017-03-19 19:09:39 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ 
tags/usb-4.11-rc4

for you to fetch changes up to fd290e7096bd4441fdd61e241ee997b16e04afbd:

  Merge tag 'usb-serial-4.11-rc4' of 
git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus 
(2017-03-23 22:07:22 +0100)


USB/PHY fixes for 4.11-rc4

Here are a number of small USB and PHY driver fixes for 4.11-rc4.
Nothing major here, just an bunch of small fixes, and a handfull of good
fixes from Johan for devices with crazy descriptors.  There are a few
new device ids in here as well.

All of these have been in linux-next with no reported issues.

Signed-off-by: Greg Kroah-Hartman 


Bin Liu (3):
  usb: musb: cppi41: don't check early-TX-interrupt for Isoch transfer
  usb: musb: dsps: fix iounmap in error and exit paths
  usb: musb: fix possible spinlock deadlock

Bjørn Mork (1):
  USB: serial: qcserial: add Dell DW5811e

Dan Williams (1):
  USB: serial: option: add Quectel UC15, UC20, EC21, and EC25 modems

Greg Kroah-Hartman (3):
  Merge tag 'phy-for-4.11-rc' of git://git.kernel.org/.../kishon/linux-phy 
into usb-linus
  Merge tag 'fixes-for-v4.11-rc4' of git://git.kernel.org/.../balbi/usb 
into usb-linus
  Merge tag 'usb-serial-4.11-rc4' of 
git://git.kernel.org/.../johan/usb-serial into usb-linus

Guenter Roeck (1):
  usb: hub: Fix crash after failure to read BOS descriptor

Gustavo A. R. Silva (1):
  usb: gadget: udc: remove pointer dereference after free

Jaehoon Chung (1):
  phy: phy-exynos-pcie: fix the wrong error return

Janusz Dziedzic (1):
  usb: dwc3: gadget: delay unmap of bounced requests

Johan Hovold (8):
  USB: idmouse: fix NULL-deref at probe
  USB: lvtest: fix NULL-deref at probe
  USB: uss720: fix NULL-deref at probe
  USB: wusbcore: fix NULL-deref at probe
  uwb: hwa-rc: fix NULL-deref at probe
  uwb: i1480-dfu: fix NULL-deref at probe
  USB: usbtmc: add missing endpoint sanity check
  USB: usbtmc: fix probe error path

Krzysztof Opasiak (1):
  usb: gadget: f_hid: fix: Don't access hidg->req without spinlock held

Oliver Neukum (2):
  ACM gadget: fix endianness in notifications
  usb: gadget: acm: fix endianness in notifications

Rafał Miłecki (2):
  Revert "phy: Add USB3 PHY support for Broadcom NSP SoC"
  Revert "dt-bindings: phy: Add documentation for NSP USB3 PHY"

Roger Quadros (2):
  usb: gadget: f_uvc: Fix SuperSpeed companion descriptor's 
wBytesPerInterval
  usb: gadget: f_uvc: Sanity check wMaxPacketSize for SuperSpeed

Samuel Thibault (1):
  usb-core: Add LINEAR_FRAME_INTR_BINTERVAL USB quirk

Stephen Boyd (1):
  phy: qcom-usb-hs: Add depends on EXTCON

 .../devicetree/bindings/phy/brcm,nsp-usb3-phy.txt  |  39 -
 drivers/phy/Kconfig|   9 +-
 drivers/phy/Makefile   |   1 -
 drivers/phy/phy-bcm-nsp-usb3.c | 177 -
 drivers/phy/phy-exynos-pcie.c  |   4 +-
 drivers/usb/class/usbtmc.c |  18 ++-
 drivers/usb/core/config.c  |  10 ++
 drivers/usb/core/hub.c |   2 +-
 drivers/usb/core/quirks.c  |   8 +
 drivers/usb/dwc3/gadget.c  |  21 ++-
 drivers/usb/gadget/function/f_acm.c|   4 +-
 drivers/usb/gadget/function/f_hid.c|   8 +-
 drivers/usb/gadget/function/f_uvc.c|  10 +-
 drivers/usb/gadget/udc/pch_udc.c   |   1 -
 drivers/usb/misc/idmouse.c |   3 +
 drivers/usb/misc/lvstest.c |   4 +
 drivers/usb/misc/uss720.c  |   5 +
 drivers/usb/musb/musb_core.c   |   2 +-
 drivers/usb/musb/musb_cppi41.c |  23 ++-
 drivers/usb/musb/musb_dsps.c   |   5 +-
 drivers/usb/serial/option.c|  17 +-
 drivers/usb/serial/qcserial.c  |   2 +
 drivers/usb/wusbcore/wa-hc.c   |   3 +
 drivers/uwb/hwa-rc.c   |   3 +
 drivers/uwb/i1480/dfu/usb.c|   3 +
 include/linux/usb/quirks.h |   6 +
 26 files changed, 141 insertions(+), 247 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/phy/brcm,nsp-usb3-phy.txt
 delete mode 100644 drivers/phy/phy-bcm-nsp-usb3.c


[GIT PULL] TTY/Serial driver fixes for 4.11-rc4

2017-03-26 Thread Greg KH
The following changes since commit 4495c08e84729385774601b5146d51d9e5849f81:

  Linux 4.11-rc2 (2017-03-12 14:47:08 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git/ 
tags/tty-4.11-rc4

for you to fetch changes up to a4a3e061149f09c075f108b6f1cf04d9739a6bc2:

  tty: fix data race in tty_ldisc_ref_wait() (2017-03-17 14:07:10 +0900)


TTY/Serial driver fixes for 4.11-rc4

Here are some tty and serial driver fixes for 4.11-rc4.  One of these
fix a long-standing issue in the ldisc code that was found by Dmitry
Vyukov with his great fuzzing work.  The other fixes resolve other
reported issues, and there is one revert of a patch in 4.11-rc1 that
wasn't correct.

All of these have been in linux-next for a while with no reported
issues.

Signed-off-by: Greg Kroah-Hartman 


Aleksey Makarov (1):
  Revert "tty: serial: pl011: add ttyAMA for matching pl011 console"

Dmitry Vyukov (2):
  tty: don't panic on OOM in tty_set_ldisc()
  tty: fix data race in tty_ldisc_ref_wait()

Heiko Stuebner (1):
  serial: 8250_dw: Honor clk_round_rate errors in dw8250_set_termios

James Hogan (1):
  serial: 8250_dw: Fix breakage when HAVE_CLK=n

Timur Tabi (1):
  tty: acpi/spcr: QDF2400 E44 checks for wrong OEM revision

 drivers/acpi/spcr.c   |  2 +-
 drivers/tty/serial/8250/8250_dw.c |  9 +++-
 drivers/tty/serial/amba-pl011.c   |  2 +-
 drivers/tty/tty_ldisc.c   | 92 +--
 4 files changed, 30 insertions(+), 75 deletions(-)


[GIT PULL] Driver core fix for 4.11-rc4

2017-03-26 Thread Greg KH
The following changes since commit 4495c08e84729385774601b5146d51d9e5849f81:

  Linux 4.11-rc2 (2017-03-12 14:47:08 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/ 
tags/driver-core-4.11-rc4

for you to fetch changes up to 966fa72a716ceafc69de901a31f7cc1f52b35f81:

  kernfs: Check KERNFS_HAS_RELEASE before calling kernfs_release_file() 
(2017-03-17 10:25:59 +0900)


driver core fix for 4.11-rc4

Here is a single kernfs fix for 4.11-rc4 that resolves a reported issue.

It has been in linux-next with no reported issues.

Signed-off-by: Greg Kroah-Hartman 


Vaibhav Jain (1):
  kernfs: Check KERNFS_HAS_RELEASE before calling kernfs_release_file()

 fs/kernfs/file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


[GIT PULL] Char/Misc driver fixes for 4.11-rc4

2017-03-26 Thread Greg KH
The following changes since commit 4495c08e84729385774601b5146d51d9e5849f81:

  Linux 4.11-rc2 (2017-03-12 14:47:08 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/ 
tags/char-misc-4.11-rc4

for you to fetch changes up to 5c1724c42dc1d60addaa67106a4f25c2a9a140de:

  Merge tag 'extcon-fixes-for-4.11-rc3' of 
git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into 
char-misc-linus (2017-03-22 12:03:17 +0100)


Char/Misc driver fixes for 4.11-rc4

A smattering of different small fixes for some random driver subsystems.
Nothing all that major, just resolutions for reported issues and bugs.

All have been in linux-next with no reported issues.

Signed-off-by: Greg Kroah-Hartman 


Alexander Shishkin (3):
  intel_th: Don't leak module refcount on failure to activate
  intel_th: pci: Add Denverton SOC support
  intel_th: pci: Add Gemini Lake support

Alexander Usyskin (1):
  mei: don't wait for os version message reply

Andy Shevchenko (3):
  extcon: int3496: Propagate error code of gpiod_to_irq()
  extcon: int3496: Rename GPIO pins in accordance with binding
  extcon: int3496: Add GPIO ACPI mapping table

Christoph Hellwig (1):
  vmw_vmci: handle the return value from pci_alloc_irq_vectors correctly

Dexuan Cui (2):
  vmbus: remove hv_event_tasklet_disable/enable
  Drivers: hv: util: don't forget to init host_ts.lock

Dmitry Torokhov (1):
  auxdisplay: img-ascii-lcd: add missing sentinel entry in 
img_ascii_lcd_matches

Greg Kroah-Hartman (2):
  Merge tag 'stm-fixes-for-greg-20170315' of 
git://git.kernel.org/.../ash/stm into char-misc-linus
  Merge tag 'extcon-fixes-for-4.11-rc3' of 
git://git.kernel.org/.../chanwoo/extcon into char-misc-linus

Hans de Goede (2):
  extcon: int3496: Use gpiod_get instead of gpiod_get_index
  extcon: int3496: Set the id pin to direction-input if necessary

K. Y. Srinivasan (2):
  Drivers: hv: vmbus: Don't leak channel ids
  Drivers: hv: vmbus: Don't leak memory when a channel is rescinded

Peter Robinson (1):
  extcon: int3496: Add dependency on X86 as it's Intel specific

Stephen Hemminger (1):
  vmbus: use rcu for per-cpu channel list

Sudip Mukherjee (2):
  parport: fix attempt to write duplicate procfiles
  ppdev: fix registering same device name

Tomas Winkler (1):
  mei: fix deadlock on mei reset

Vitaly Kuznetsov (1):
  Drivers: hv: util: move waiting for release to hv_utils_transport itself

 Documentation/extcon/intel-int3496.txt |  5 +
 drivers/auxdisplay/img-ascii-lcd.c |  1 +
 drivers/char/ppdev.c   | 11 --
 drivers/extcon/Kconfig |  2 +-
 drivers/extcon/extcon-intel-int3496.c  | 39 --
 drivers/hv/channel.c   | 25 +++---
 drivers/hv/channel_mgmt.c  | 27 +--
 drivers/hv/hv_fcopy.c  |  4 
 drivers/hv/hv_kvp.c|  4 
 drivers/hv/hv_snapshot.c   |  4 
 drivers/hv/hv_util.c   |  2 ++
 drivers/hv/hv_utils_transport.c| 12 +++
 drivers/hv/hv_utils_transport.h|  1 +
 drivers/hv/vmbus_drv.c |  6 +-
 drivers/hwtracing/intel_th/core.c  |  4 +++-
 drivers/hwtracing/intel_th/pci.c   | 10 +
 drivers/misc/mei/bus-fixup.c   | 14 ++--
 drivers/misc/mei/init.c|  8 +--
 drivers/misc/vmw_vmci/vmci_guest.c |  4 ++--
 drivers/parport/share.c|  6 --
 include/linux/hyperv.h | 10 ++---
 21 files changed, 111 insertions(+), 88 deletions(-)


[PATCH v5] mfd: Add Cherry Trail Whiskey Cove PMIC driver

2017-03-26 Thread Hans de Goede
Add mfd driver for Intel CHT Whiskey Cove PMIC, based on various non
upstreamed CHT Whiskey Cove PMIC patches.

This is a somewhat minimal version which adds irqchip support and cells
for: ACPI PMIC opregion support, the i2c-controller driving the external
charger irc and the pwrsrc/extcon block.

Further cells can be added in the future if/when drivers are upstreamed
for them.

Cc: Bin Gao 
Cc: Felipe Balbi 
Cc: Andy Shevchenko 
Signed-off-by: Hans de Goede 
Reviewed-by: Andy Shevchenko 
---
Changes in v2:
-Since this uses plain mfd and not the intel_soc_pmic stuff give it
 its own Kconfig and allow this to be built as a module
-Add missing #include 
Changes in v3:
-Drop #include  again, not the right fix for the build errors
-Error out when the upper byte of the register-address passed to the regmap
 functions is 0 rather then hardcoding an address in that case
-Various minor style tweaks / cleanups
-Move defines of regulator register addresses to intel_pmic_chtwc.c,
 it is the only place where they are used
-Drop now empty include/linux/mfd/intel_chtwc.h
-Rename intel_soc_pmic_chtwc.c to intel_cht_wc.c to match Kconfig option name
-Add irqchip support
-Add external charger cell
-Add pwrsrc cell
Changes in v4:
-Use PLATFORM_DEVID_NONE
Changes in v5:
-Change Kconfig option from tristate to boolean and add a select for the
 i2c-bus driver, this is necessary because the chtwc PMIC provides an ACPI
 OPRegion handler, which must be available before other drivers using it
 are loaded, which can only be ensured if the mfd, opregion and i2c-bus
 drivers are built in. This fixes errors like these during boot:
 mmc0: SDHCI controller on ACPI [80860F14:00] using ADMA
 ACPI Error: No handler for Region [REGS] (93543b0cc3a8) 
[UserDefinedRegion] (20170119/evregion-166)
 ACPI Error: Region UserDefinedRegion (ID=143) has no handler 
(20170119/exfldio-299)
 ACPI Error: Method parse/execution failed [\_SB.PCI0.I2C7.PMI5.GET] (Node 
93543b0cde10), AE_NOT_EXIST (20170119/psparse-543)
 ACPI Error: Method parse/execution failed [\_SB.PCI0.SHC1._PS0] (Node 
93543b0b5cd0), AE_NOT_EXIST (20170119/psparse-543)
 acpi 80860F14:02: Failed to change power state to D0
-Some minor style and capitalization fixes from review by Lee Jones
---
 drivers/mfd/Kconfig|  13 ++
 drivers/mfd/Makefile   |   1 +
 drivers/mfd/intel_soc_pmic_chtwc.c | 239 +
 3 files changed, 253 insertions(+)
 create mode 100644 drivers/mfd/intel_soc_pmic_chtwc.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 55ecdfb..da37fe4 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -437,6 +437,19 @@ config INTEL_SOC_PMIC
  thermal, charger and related power management functions
  on these systems.
 
+config INTEL_SOC_PMIC_CHTWC
+   # This is a bool as it provides an ACPI Opregion which must be
+   # available as soon as possible
+   bool "Support for Intel Cherry Trail Whiskey Cove PMIC"
+   depends on ACPI && I2C
+   select MFD_CORE
+   select REGMAP_I2C
+   select REGMAP_IRQ
+   select I2C_DESIGNWARE_PLATFORM
+   help
+ Select this option to enable support for the Intel Cherry Trail
+ Whiskey Cove PMIC found on some Intel Cherry Trail systems.
+
 config MFD_INTEL_LPSS
tristate
select COMMON_CLK
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 31ce076..d2ca514 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -209,6 +209,7 @@ obj-$(CONFIG_MFD_SKY81452)  += sky81452.o
 intel-soc-pmic-objs:= intel_soc_pmic_core.o intel_soc_pmic_crc.o
 intel-soc-pmic-$(CONFIG_INTEL_PMC_IPC) += intel_soc_pmic_bxtwc.o
 obj-$(CONFIG_INTEL_SOC_PMIC)   += intel-soc-pmic.o
+obj-$(CONFIG_INTEL_SOC_PMIC_CHTWC) += intel_soc_pmic_chtwc.o
 obj-$(CONFIG_MFD_MT6397)   += mt6397-core.o
 
 obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o
diff --git a/drivers/mfd/intel_soc_pmic_chtwc.c 
b/drivers/mfd/intel_soc_pmic_chtwc.c
new file mode 100644
index 000..8665269
--- /dev/null
+++ b/drivers/mfd/intel_soc_pmic_chtwc.c
@@ -0,0 +1,239 @@
+/*
+ * MFD core driver for Intel Cherrytrail Whiskey Cove PMIC
+ * Copyright (C) 2017 Hans de Goede 
+ *
+ * Based on various non upstream patches to support the CHT Whiskey Cove PMIC:
+ * Copyright (C) 2013-2015 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* PMIC device registers */
+#define REG_OFFSET_MASKGENMASK(7, 0)
+#define REG_ADDR_MASK  GENMASK(15, 8)
+#define REG_ADDR_SHIFT 8
+
+#define CHT_WC_IRQLVL1 0x6e02
+#define CHT_WC_IRQLVL1_MASK0x6e0e
+
+/* Whiskey Cove PMIC share same ACPI ID betwe

Re: [PATCH 4.10 012/167] mmc: sdhci-acpi: support deferred probe

2017-03-26 Thread Andrey Utkin
On Fri, Mar 10, 2017 at 10:07:35AM +0100, Greg Kroah-Hartman wrote:
> 4.10-stable review patch.  If anyone has any objections, please let me know.
> 
> --
> 
> From: Zhang Rui 
> 
> commit e28d6f048799acb0014491e6b74e580d84bd7916 upstream.
> 
> With commit 67bf5156edc4 ("gpio / ACPI: fix returned error from
> acpi_dev_gpio_irq_get()"), mmc_gpiod_request_cd() returns -EPROBE_DEFER if
> GPIO is not ready when sdhci-acpi driver is probed, and sdhci-acpi driver
> should be probed again later in this case.
> 
> This fixes an order issue when both GPIO and sdhci-acpi drivers are built
> as modules.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=177101
> Tested-by: Jonas Aaberg 
> Signed-off-by: Zhang Rui 
> Acked-by: Adrian Hunter 
> Signed-off-by: Ulf Hansson 
> Signed-off-by: Greg Kroah-Hartman 
> 
> ---
>  drivers/mmc/host/sdhci-acpi.c |5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> --- a/drivers/mmc/host/sdhci-acpi.c
> +++ b/drivers/mmc/host/sdhci-acpi.c
> @@ -467,7 +467,10 @@ static int sdhci_acpi_probe(struct platf
>   if (sdhci_acpi_flag(c, SDHCI_ACPI_SD_CD)) {
>   bool v = sdhci_acpi_flag(c, SDHCI_ACPI_SD_CD_OVERRIDE_LEVEL);
>  
> - if (mmc_gpiod_request_cd(host->mmc, NULL, 0, v, 0, NULL)) {
> + err = mmc_gpiod_request_cd(host->mmc, NULL, 0, v, 0, NULL);
> + if (err) {
> + if (err == -EPROBE_DEFER)
> + goto err_free;
>   dev_warn(dev, "failed to setup card detect gpio\n");
>   c->use_runtime_pm = false;
>   }
> 
> 

Regression reported: https://bugzilla.kernel.org/show_bug.cgi?id=194871

Reverting this patch is said to fix the issue for 4.10.2.


[tip:locking/core 14/14] arch/sparc/include/asm/setup.h:17:22: error: 'boot_cpu_id' redeclared as different kind of symbol

2017-03-26 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core
head:   4ef9ea9524c0015e551d062ac75ab9fd04365277
commit: 4ef9ea9524c0015e551d062ac75ab9fd04365277 [14/14] lockdep: Fix per-cpu 
static objects
config: sparc-defconfig (attached as .config)
compiler: sparc-linux-gcc (GCC) 6.2.0
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 4ef9ea9524c0015e551d062ac75ab9fd04365277
# save the attached .config to linux build tree
make.cross ARCH=sparc 

All errors (new ones prefixed by >>):

   In file included from drivers/pci/pci.c:31:0:
>> arch/sparc/include/asm/setup.h:17:22: error: 'boot_cpu_id' redeclared as 
>> different kind of symbol
extern unsigned char boot_cpu_id;
 ^~~
   In file included from include/linux/topology.h:33:0,
from include/linux/gfp.h:8,
from include/linux/slab.h:14,
from include/linux/resource_ext.h:19,
from include/linux/acpi.h:26,
from drivers/pci/pci.c:10:
   include/linux/smp.h:168:19: note: previous definition of 'boot_cpu_id' was 
here
static inline int boot_cpu_id(void)
  ^~~

vim +/boot_cpu_id +17 arch/sparc/include/asm/setup.h

d550bbd4 David Howells2012-03-28  11  extern char reboot_command[];
d550bbd4 David Howells2012-03-28  12  
5fcafb7a Daniel Hellstrom 2011-04-21  13  #ifdef CONFIG_SPARC32
5fcafb7a Daniel Hellstrom 2011-04-21  14  /* The CPU that was used for booting
5fcafb7a Daniel Hellstrom 2011-04-21  15   * Only sun4d + leon may have 
boot_cpu_id != 0
5fcafb7a Daniel Hellstrom 2011-04-21  16   */
5fcafb7a Daniel Hellstrom 2011-04-21 @17  extern unsigned char boot_cpu_id;
d550bbd4 David Howells2012-03-28  18  
d550bbd4 David Howells2012-03-28  19  extern unsigned long empty_zero_page;
d550bbd4 David Howells2012-03-28  20  

:: The code at line 17 was first introduced by commit
:: 5fcafb7a23e35b2f1a5243f4dd536240f52c8ceb sparc32: always define 
boot_cpu_id

:: TO: Daniel Hellstrom 
:: CC: David S. Miller 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH v4] tpm_crb: request and relinquish locality 0

2017-03-26 Thread Jarkko Sakkinen
On Sat, Mar 25, 2017 at 09:52:11PM +0200, Jarkko Sakkinen wrote:
> On Fri, Mar 24, 2017 at 11:25:57AM -0700, Jerry Snitselaar wrote:
> > 
> > Jarkko Sakkinen @ 2017-03-24 10:10 GMT:
> > 
> > > This commit adds support for requesting and relinquishing locality 0 in
> > > tpm_crb for the course of command transmission.
> > >
> > > In order to achieve this, two new callbacks are added to struct
> > > tpm_class_ops:
> > >
> > > - request_locality
> > > - relinquish_locality
> > >
> > > With CRB interface you first set either requestAccess or relinquish bit
> > > from TPM_LOC_CTRL_x register and then wait for locAssigned and
> > > tpmRegValidSts bits to be set in the TPM_LOC_STATE_x register.
> > >
> > > The reason why were are doing this is to make sure that the driver
> > > will work properly with Intel TXT that uses locality 2. There's no
> > > explicit guarantee that it would relinquish this locality. In more
> > > general sense this commit enables tpm_crb to be a well behaving
> > > citizen in a multi locality environment.
> > >
> > > Signed-off-by: Jarkko Sakkinen 
> > 
> > Reviewed-by: Jerry Snitselaar 
> > Tested-by: Jerry Snitselaar 
> > 
> > Tested on kabylake system that was hitting issues with earlier
> > iteration. Still don't have platform to test it dealing with
> > multi-locality enviroment.
> 
> I believe Jimmy (Gang Wei) has done such testing. Jimmy can you confirm
> and possibly do re-test (there's a locality branch in my tree to ease
> the testing) so that we could land this one?
> 
> /Jarkko

I applied this to my master and next branches.

/Jarkko


Re: [PATCH] padata: avoid race in reordering

2017-03-26 Thread Jason A. Donenfeld
I've got a few other races in padata, I think, that I'm working on
fixing. If these pan out, I'll submit them exclusively to -crypto
instead of -netdev, to avoid this confusion next time. Of course, if
I'm able to fix these, then I'll probably be bald from pulling my hair
out during this insane debugging frenzy of the last few days...

Jason


Re: [PATCH v3 1/3] mfd: intel_soc_pmic: Fix a mess with compilation units

2017-03-26 Thread Andy Shevchenko
On Thu, 2017-03-23 at 12:12 +, Lee Jones wrote:
> On Fri, 17 Mar 2017, Andy Shevchenko wrote:
> 
> > Crystal Cove and Whiskey Cove are two different PMICs which are
> > installed on Intel Atom SoC based platforms.
> > 
> > Moreover there are two independent drivers that by some reason were
> > supposed (*) to get into one kernel module.
> > 
> > Fix the mess by clarifying Kconfig option for Crystal Cove and split
> > Whiskey Cove out of it.
> > 
> > (*) It looks like the configuration was never tested with
> > INTEL_SOC_PMIC=n. The line in Makefile is actually wrong.
> > 
> > Cc: "Rafael J. Wysocki"  (supporter:ACPI)
> > Cc: Linus Walleij  (maintainer:GPIO
> > SUBSYSTEM)
> > Cc: Zhang Rui  (supporter:THERMAL)
> > Cc: Eduardo Valentin  (supporter:THERMAL)
> > Signed-off-by: Andy Shevchenko 
> > ---
> > - make option visible
> > - fix dependencies
> >  drivers/acpi/Kconfig |  2 +-
> 
> This needs an ACPI Ack before I can do anything with it.

Rafael, can you give you tag?

> 
> >  drivers/gpio/Kconfig |  2 +-
> >  drivers/mfd/Kconfig  | 14 --
> >  drivers/mfd/Makefile |  2 +-
> >  drivers/platform/x86/Kconfig |  2 +-
> >  drivers/thermal/Kconfig  |  2 +-
> >  6 files changed, 17 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> > index 83e5f7e1a20d..03708e08fcb4 100644
> > --- a/drivers/acpi/Kconfig
> > +++ b/drivers/acpi/Kconfig
> > @@ -512,7 +512,7 @@ config XPOWER_PMIC_OPREGION
> >  
> >  config BXT_WC_PMIC_OPREGION
> >     bool "ACPI operation region support for BXT WhiskeyCove
> > PMIC"
> > -   depends on INTEL_SOC_PMIC
> > +   depends on INTEL_SOC_PMIC_BXTWC
> >     help
> >       This config adds ACPI operation region support for BXT
> > WhiskeyCove PMIC.
> >  
> > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> > index 05043071fc98..9b1bcb4d0df7 100644
> > --- a/drivers/gpio/Kconfig
> > +++ b/drivers/gpio/Kconfig
> > @@ -1054,7 +1054,7 @@ config GPIO_UCB1400
> >  
> >  config GPIO_WHISKEY_COVE
> >     tristate "GPIO support for Whiskey Cove PMIC"
> > -   depends on (X86 || COMPILE_TEST) && INTEL_SOC_PMIC
> > +   depends on (X86 || COMPILE_TEST) && INTEL_SOC_PMIC_BXTWC
> >     select GPIOLIB_IRQCHIP
> >     help
> >       Support for GPIO pins on Whiskey Cove PMIC.
> > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > index 55ecdfb74d31..e43afb8956ea 100644
> > --- a/drivers/mfd/Kconfig
> > +++ b/drivers/mfd/Kconfig
> > @@ -425,18 +425,28 @@ config LPC_SCH
> >       System Management Bus and General Purpose I/O.
> >  
> >  config INTEL_SOC_PMIC
> > -   bool "Support for Intel Atom SoC PMIC"
> > +   bool "Support for Crystal Cove PMIC"
> >     depends on GPIOLIB
> >     depends on I2C=y
> >     select MFD_CORE
> >     select REGMAP_I2C
> >     select REGMAP_IRQ
> >     help
> > -     Select this option to enable support for the PMIC device
> > +     Select this option to enable support for Crystal Cove
> > PMIC
> >       on some Intel SoC systems. The PMIC provides ADC, GPIO,
> >       thermal, charger and related power management functions
> >       on these systems.
> >  
> > +config INTEL_SOC_PMIC_BXTWC
> > +   tristate "Support for Intel Broxton Whiskey Cove PMIC"
> > +   select MFD_CORE
> > +   select REGMAP_IRQ
> > +   help
> > +     Select this option to enable support for Whiskey Cove
> > PMIC
> > +     on Intel Broxton systems. The PMIC provides ADC, GPIO,
> > +     thermal, charger and related power management functions
> > +     on these systems.
> > +
> >  config MFD_INTEL_LPSS
> >     tristate
> >     select COMMON_CLK
> > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> > index 31ce07611a6f..201aeaf5112a 100644
> > --- a/drivers/mfd/Makefile
> > +++ b/drivers/mfd/Makefile
> > @@ -207,8 +207,8 @@ obj-$(CONFIG_MFD_RT5033)+= rt5033.o
> >  obj-$(CONFIG_MFD_SKY81452) += sky81452.o
> >  
> >  intel-soc-pmic-objs:= intel_soc_pmic_core.o
> > intel_soc_pmic_crc.o
> > -intel-soc-pmic-$(CONFIG_INTEL_PMC_IPC) +=
> > intel_soc_pmic_bxtwc.o
> >  obj-$(CONFIG_INTEL_SOC_PMIC)   += intel-soc-pmic.o
> > +obj-$(CONFIG_INTEL_SOC_PMIC_BXTWC) += intel_soc_pmic_bxtwc.o
> >  obj-$(CONFIG_MFD_MT6397)   += mt6397-core.o
> >  
> >  obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o
> > diff --git a/drivers/platform/x86/Kconfig
> > b/drivers/platform/x86/Kconfig
> > index e1bffc9bb194..883fbe7a2466 100644
> > --- a/drivers/platform/x86/Kconfig
> > +++ b/drivers/platform/x86/Kconfig
> > @@ -1019,7 +1019,7 @@ config INTEL_PMC_IPC
> >  config INTEL_BXTWC_PMIC_TMU
> >     tristate "Intel BXT Whiskey Cove TMU Driver"
> >     depends on REGMAP
> > -   depends on INTEL_SOC_PMIC && INTEL_PMC_IPC
> > +   depends on INTEL_SOC_PMIC_BXTWC && INTEL_PMC_IPC
> >     ---help---
> >       Select this driver to use Intel BXT Whiskey Cove PMIC TMU
> > feature.
> >       This driver enables the alarm wakeup functionality in the
> > TMU unit
> > diff --git a/drivers/therm

Re: [PATCH v1] mfd: core: Preserve PLATFORM_DEVID_NONE

2017-03-26 Thread Andy Shevchenko
On Fri, 2017-03-24 at 11:35 +, Lee Jones wrote:
> On Thu, 23 Mar 2017, Andy Shevchenko wrote:
> 
> > On Thu, 2017-03-23 at 11:21 +, Lee Jones wrote:
> > > On Thu, 16 Mar 2017, Andy Shevchenko wrote:
> > > 
> > > > There is a potential flaw if cell has id > 0 and is going to be
> > > > registered with PLATFORM_DEVID_NONE.
> > > > 
> > > > Ignore if PLATFORM_DEVID_NONE is supplied.
> > > 
> > > This is a substantial change to a pretty tried and tested piece of
> > > sub-system code.  Can you put some more meat on the bones in the
> > > commit log, and include examples.
> > 
> > Example in pseudo code:
> > 
> > cells = {
> >  [0] = { .id = 0, .name = "moduleX", },
> >  [1] = { .id = 1, .name = "moduleY", },
> >  [2] = { .id = 2, .name = "moduleZ", },
> >  ...
> > };
> > 
> > mfd_add_devices(..., PLATFORM_DEVID_NONE, cells, ARRAY_SIZE(cells),
> > ...);
> > 
> > Output (names of the devices in the drivers):
> > "moduleX"
> > "moduleY.0"
> > "moduleX.1"
> > 
> > Desired output:
> > "moduleX"
> > "moduleY"
> > "moduleZ"
> 
> Then what would be your reason for populating the 'id' attribute?

That's a gray area. If I remember correctly I come to above patch
through looking some incremental change.

I'm fine with no patch applied if this is documented somewhere,
otherwise we might update documentation to cover such cases explicitly.

> 
> > Is it by design?
> > 
> > > 
> > > > Signed-off-by: Andy Shevchenko  > > > m>
> > > > ---
> > > >  drivers/mfd/mfd-core.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
> > > > index c57e407020f1..c9583f895058 100644
> > > > --- a/drivers/mfd/mfd-core.c
> > > > +++ b/drivers/mfd/mfd-core.c
> > > > @@ -149,7 +149,7 @@ static int mfd_add_device(struct device
> > > > *parent,
> > > > int id,
> > > >     int platform_id;
> > > >     int r;
> > > >  
> > > > -   if (id == PLATFORM_DEVID_AUTO)
> > > > +   if (id < 0)
> > > >     platform_id = id;
> > > >     else
> > > >     platform_id = id + cell->id;
> > > 
> > > 
> 
> 

-- 
Andy Shevchenko 
Intel Finland Oy


Re: [PATCH] selftests/futex: Fix build error with OUTPUT variable

2017-03-26 Thread Bamvor Zhang
Hi,

On Sat, Mar 25, 2017 at 12:18 AM, Darren Hart  wrote:
>
> The use of $$OUTPUT in the target shell commands resulted in an empty
> string followed by an absolute path for which mkdir failed:
>
> $ make -C tools/testing/selftests/futex
> make: Entering directory 
> '/home/dvhart/source/linux/linux-pdx86/tools/testing/selftests/futex'
> Makefile:36: warning: overriding recipe for target 'clean'
> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
> for DIR in functional; do   \
> BUILD_TARGET=$OUTPUT/$DIR;  \
> mkdir $BUILD_TARGET  -p;\
> make OUTPUT=$BUILD_TARGET -C $DIR all;\
> done
> mkdir: cannot create directory ‘/functional’: Permission denied
>
> Replace $$OUTPUT with $(OUTPUT) when referring to the Makefile OUTPUT
> variable. The above make command now completes successfully.
Test with native and cross-compiler build from selftests/futex or selftests,
the results are good.
Tested-by: Bamvor Jian Zhang 

Regards

Bamvor
>
> Fixes: a8ba798bc8ec ("selftests: enable O and KBUILD_OUTPUT")
> Signed-off-by: Darren Hart (VMware) 
> Cc: linux-kselft...@vger.kernel.org
> Cc: bamvor.zhangj...@huawei.com
> Cc: Shuah Khan 
> Cc:  # 4.10.x-
> ---
>  tools/testing/selftests/futex/Makefile | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/futex/Makefile 
> b/tools/testing/selftests/futex/Makefile
> index 653c5cd..c8095e6 100644
> --- a/tools/testing/selftests/futex/Makefile
> +++ b/tools/testing/selftests/futex/Makefile
> @@ -8,7 +8,7 @@ include ../lib.mk
>
>  all:
> for DIR in $(SUBDIRS); do   \
> -   BUILD_TARGET=$$OUTPUT/$$DIR;\
> +   BUILD_TARGET=$(OUTPUT)/$$DIR;   \
> mkdir $$BUILD_TARGET  -p;   \
> make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
> done
> @@ -22,7 +22,7 @@ override define INSTALL_RULE
> install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) 
> $(TEST_FILES)
>
> @for SUBDIR in $(SUBDIRS); do \
> -   BUILD_TARGET=$$OUTPUT/$$SUBDIR; \
> +   BUILD_TARGET=$(OUTPUT)/$$SUBDIR;\
> mkdir $$BUILD_TARGET  -p;   \
> $(MAKE) OUTPUT=$$BUILD_TARGET -C $$SUBDIR 
> INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \
> done;
> @@ -34,7 +34,7 @@ endef
>
>  clean:
> for DIR in $(SUBDIRS); do   \
> -   BUILD_TARGET=$$OUTPUT/$$DIR;\
> +   BUILD_TARGET=$(OUTPUT)/$$DIR;   \
> mkdir $$BUILD_TARGET  -p;   \
> make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
> done
> --
> 2.9.3
>
>
> --
> Darren Hart
> VMware Open Source Technology Center




-- 
-
   arm64, kernel. opensuse
   blog: http://aarch64.me
-


[tip:locking/core] lockdep: Fix per-cpu static objects

2017-03-26 Thread tip-bot for Peter Zijlstra
Commit-ID:  8ce371f9846ef1e8b3cc8f6865766cb5c1f17e40
Gitweb: http://git.kernel.org/tip/8ce371f9846ef1e8b3cc8f6865766cb5c1f17e40
Author: Peter Zijlstra 
AuthorDate: Mon, 20 Mar 2017 12:26:55 +0100
Committer:  Thomas Gleixner 
CommitDate: Sun, 26 Mar 2017 15:09:45 +0200

lockdep: Fix per-cpu static objects

Since commit 383776fa7527 ("locking/lockdep: Handle statically initialized
PER_CPU locks properly") we try to collapse per-cpu locks into a single
class by giving them all the same key. For this key we choose the canonical
address of the per-cpu object, which would be the offset into the per-cpu
area.

This has two problems:

 - there is a case where we run !0 lock->key through static_obj() and
   expect this to pass; it doesn't for canonical pointers.

 - 0 is a valid canonical address.

Cure both issues by redefining the canonical address as the address of the
per-cpu variable on the boot CPU.

Since I didn't want to rely on CPU0 being the boot-cpu, or even existing at
all, track the boot CPU in a variable.

Fixes: 383776fa7527 ("locking/lockdep: Handle statically initialized PER_CPU 
locks properly")
Reported-by: kernel test robot 
Signed-off-by: Peter Zijlstra (Intel) 
Tested-by: Borislav Petkov 
Cc: Sebastian Andrzej Siewior 
Cc: linux...@kvack.org
Cc: w...@linux.intel.com
Cc: kernel test robot 
Cc: LKP 
Link: 
http://lkml.kernel.org/r/20170320114108.kbvcsuepem45j...@hirez.programming.kicks-ass.net
Signed-off-by: Thomas Gleixner 

---
 include/linux/smp.h | 12 
 kernel/cpu.c|  6 ++
 kernel/module.c |  6 +-
 mm/percpu.c |  5 -
 4 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/include/linux/smp.h b/include/linux/smp.h
index 8e0cb7a..68123c1 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -120,6 +120,13 @@ extern unsigned int setup_max_cpus;
 extern void __init setup_nr_cpu_ids(void);
 extern void __init smp_init(void);
 
+extern int __boot_cpu_id;
+
+static inline int get_boot_cpu_id(void)
+{
+   return __boot_cpu_id;
+}
+
 #else /* !SMP */
 
 static inline void smp_send_stop(void) { }
@@ -158,6 +165,11 @@ static inline void smp_init(void) { up_late_init(); }
 static inline void smp_init(void) { }
 #endif
 
+static inline int get_boot_cpu_id(void)
+{
+   return 0;
+}
+
 #endif /* !SMP */
 
 /*
diff --git a/kernel/cpu.c b/kernel/cpu.c
index f7c0632..a795725 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1125,6 +1125,8 @@ core_initcall(cpu_hotplug_pm_sync_init);
 
 #endif /* CONFIG_PM_SLEEP_SMP */
 
+int __boot_cpu_id;
+
 #endif /* CONFIG_SMP */
 
 /* Boot processor state steps */
@@ -1815,6 +1817,10 @@ void __init boot_cpu_init(void)
set_cpu_active(cpu, true);
set_cpu_present(cpu, true);
set_cpu_possible(cpu, true);
+
+#ifdef CONFIG_SMP
+   __boot_cpu_id = cpu;
+#endif
 }
 
 /*
diff --git a/kernel/module.c b/kernel/module.c
index 5ef6181..6d99880 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -682,8 +682,12 @@ bool __is_module_percpu_address(unsigned long addr, 
unsigned long *can_addr)
void *va = (void *)addr;
 
if (va >= start && va < start + mod->percpu_size) {
-   if (can_addr)
+   if (can_addr) {
*can_addr = (unsigned long) (va - 
start);
+   *can_addr += (unsigned long)
+   per_cpu_ptr(mod->percpu,
+   get_boot_cpu_id());
+   }
preempt_enable();
return true;
}
diff --git a/mm/percpu.c b/mm/percpu.c
index 7d3b728..bd74167 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1293,8 +1293,11 @@ bool __is_kernel_percpu_address(unsigned long addr, 
unsigned long *can_addr)
void *va = (void *)addr;
 
if (va >= start && va < start + static_size) {
-   if (can_addr)
+   if (can_addr) {
*can_addr = (unsigned long) (va - start);
+   *can_addr += (unsigned long)
+   per_cpu_ptr(base, get_boot_cpu_id());
+   }
return true;
}
}


[PATCH] net: s390: qeth: use new api ethtool_{get|set}_link_ksettings

2017-03-26 Thread Philippe Reynes
The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes 
---
 drivers/s390/net/qeth_core.h  |3 +-
 drivers/s390/net/qeth_core_main.c |   45 
 drivers/s390/net/qeth_l2_main.c   |2 +-
 drivers/s390/net/qeth_l3_main.c   |2 +-
 4 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index e7addea..5da0319 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -973,7 +973,8 @@ void qeth_core_get_ethtool_stats(struct net_device *,
 void qeth_core_get_strings(struct net_device *, u32, u8 *);
 void qeth_core_get_drvinfo(struct net_device *, struct ethtool_drvinfo *);
 void qeth_dbf_longtext(debug_info_t *id, int level, char *text, ...);
-int qeth_core_ethtool_get_settings(struct net_device *, struct ethtool_cmd *);
+int qeth_core_ethtool_get_link_ksettings(struct net_device *netdev,
+struct ethtool_link_ksettings *ecmd);
 int qeth_set_access_ctrl_online(struct qeth_card *card, int fallback);
 int qeth_hdr_chk_and_bounce(struct sk_buff *, struct qeth_hdr **, int);
 int qeth_configure_cq(struct qeth_card *, enum qeth_cq);
diff --git a/drivers/s390/net/qeth_core_main.c 
b/drivers/s390/net/qeth_core_main.c
index 315d8a2..dced180 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -5899,10 +5899,11 @@ void qeth_core_get_drvinfo(struct net_device *dev,
 /* Autoneg and full-duplex are supported and advertized uncondionally.  */
 /* Always advertize and support all speeds up to specified, and only one */
 /* specified port type.
 */
-static void qeth_set_ecmd_adv_sup(struct ethtool_cmd *ecmd,
+static void qeth_set_ecmd_adv_sup(struct ethtool_link_ksettings *ecmd,
int maxspeed, int porttype)
 {
int port_sup, port_adv, spd_sup, spd_adv;
+   u32 supported, advertising;
 
switch (porttype) {
case PORT_TP:
@@ -5944,12 +5945,17 @@ static void qeth_set_ecmd_adv_sup(struct ethtool_cmd 
*ecmd,
spd_adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full;
WARN_ON_ONCE(1);
}
-   ecmd->advertising = ADVERTISED_Autoneg | port_adv | spd_adv;
-   ecmd->supported = SUPPORTED_Autoneg | port_sup | spd_sup;
+   advertising = ADVERTISED_Autoneg | port_adv | spd_adv;
+   supported = SUPPORTED_Autoneg | port_sup | spd_sup;
+
+   ethtool_convert_legacy_u32_to_link_mode(ecmd->link_modes.supported,
+   supported);
+   ethtool_convert_legacy_u32_to_link_mode(ecmd->link_modes.advertising,
+   advertising);
 }
 
-int qeth_core_ethtool_get_settings(struct net_device *netdev,
-   struct ethtool_cmd *ecmd)
+int qeth_core_ethtool_get_link_ksettings(struct net_device *netdev,
+struct ethtool_link_ksettings *ecmd)
 {
struct qeth_card *card = netdev->ml_priv;
enum qeth_link_types link_type;
@@ -5962,37 +5968,36 @@ int qeth_core_ethtool_get_settings(struct net_device 
*netdev,
else
link_type = card->info.link_type;
 
-   ecmd->transceiver = XCVR_INTERNAL;
-   ecmd->duplex = DUPLEX_FULL;
-   ecmd->autoneg = AUTONEG_ENABLE;
+   ecmd->base.duplex = DUPLEX_FULL;
+   ecmd->base.autoneg = AUTONEG_ENABLE;
 
switch (link_type) {
case QETH_LINK_TYPE_FAST_ETH:
case QETH_LINK_TYPE_LANE_ETH100:
qeth_set_ecmd_adv_sup(ecmd, SPEED_100, PORT_TP);
speed = SPEED_100;
-   ecmd->port = PORT_TP;
+   ecmd->base.port = PORT_TP;
break;
 
case QETH_LINK_TYPE_GBIT_ETH:
case QETH_LINK_TYPE_LANE_ETH1000:
qeth_set_ecmd_adv_sup(ecmd, SPEED_1000, PORT_FIBRE);
speed = SPEED_1000;
-   ecmd->port = PORT_FIBRE;
+   ecmd->base.port = PORT_FIBRE;
break;
 
case QETH_LINK_TYPE_10GBIT_ETH:
qeth_set_ecmd_adv_sup(ecmd, SPEED_1, PORT_FIBRE);
speed = SPEED_1;
-   ecmd->port = PORT_FIBRE;
+   ecmd->base.port = PORT_FIBRE;
break;
 
default:
qeth_set_ecmd_adv_sup(ecmd, SPEED_10, PORT_TP);
speed = SPEED_10;
-   ecmd->port = PORT_TP;
+   ecmd->base.port = PORT_TP;
}
-   ethtool_cmd_speed_set(ecmd, speed);
+   ecmd->base.speed = speed;
 
/* Check if we can obtain more accurate information. */
/* If QUERY_CARD_INFO command is not supported or fails, */

[PATCH] x86/apic/timer: set ->min_delta_ticks and ->max_delta_ticks

2017-03-26 Thread Nicolai Stange
In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the x86 arch's apic clockevent driver initialize these fields
properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange 
---

Notes:
(First test sending for 23 similar patches in different subsystems
 to follow.)

This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
  git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
  
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
  https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

 arch/x86/kernel/apic/apic.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 8ccb7ef512e0..875091d4609d 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -731,8 +731,10 @@ static int __init calibrate_APIC_clock(void)
TICK_NSEC, lapic_clockevent.shift);
lapic_clockevent.max_delta_ns =
clockevent_delta2ns(0x7F, &lapic_clockevent);
+   lapic_clockevent.max_delta_ticks = 0x7F;
lapic_clockevent.min_delta_ns =
clockevent_delta2ns(0xF, &lapic_clockevent);
+   lapic_clockevent.min_delta_ticks = 0xF;
lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY;
return 0;
}
@@ -778,8 +780,10 @@ static int __init calibrate_APIC_clock(void)
   lapic_clockevent.shift);
lapic_clockevent.max_delta_ns =
clockevent_delta2ns(0x7FFF, &lapic_clockevent);
+   lapic_clockevent.max_delta_ticks = 0x7FFF;
lapic_clockevent.min_delta_ns =
clockevent_delta2ns(0xF, &lapic_clockevent);
+   lapic_clockevent.min_delta_ticks = 0xF;
 
lapic_timer_frequency = (delta * APIC_DIVISOR) / LAPIC_CAL_LOOPS;
 
-- 
2.12.0



[PATCH] Documentation: Fix dead URLs to ftp.kernel.org

2017-03-26 Thread SeongJae Park
As ftp.kernel.org is closed [0], this commit fixes dead URLs in
documents to use www.kernel.org instead.

[0] https://www.kernel.org/shutting-down-ftp-services.html

Signed-off-by: SeongJae Park 
---
 Documentation/early-userspace/README   |  2 +-
 Documentation/filesystems/ext4.txt |  2 +-
 Documentation/filesystems/nfs/nfs-rdma.txt |  2 +-
 Documentation/networking/e100.txt  |  2 +-
 Documentation/networking/e1000.txt |  2 +-
 Documentation/networking/e1000e.txt|  2 +-
 Documentation/networking/igb.txt   |  2 +-
 Documentation/networking/igbvf.txt |  2 +-
 Documentation/networking/ixgb.txt  |  2 +-
 Documentation/networking/ixgbe.txt |  2 +-
 Documentation/process/applying-patches.rst | 12 +++-
 Documentation/process/changes.rst  | 10 +-
 12 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/Documentation/early-userspace/README 
b/Documentation/early-userspace/README
index 93e63a9af30b..2c00b072a4c8 100644
--- a/Documentation/early-userspace/README
+++ b/Documentation/early-userspace/README
@@ -86,7 +86,7 @@ early userspace useful.  The klibc distribution is currently
 maintained separately from the kernel.
 
 You can obtain somewhat infrequent snapshots of klibc from
-ftp://ftp.kernel.org/pub/linux/libs/klibc/
+https://www.kernel.org/pub/linux/libs/klibc/
 
 For active users, you are better off using the klibc git
 repository, at http://git.kernel.org/?p=libs/klibc/klibc.git
diff --git a/Documentation/filesystems/ext4.txt 
b/Documentation/filesystems/ext4.txt
index 3698ed3146e3..5a8f7f4d2bca 100644
--- a/Documentation/filesystems/ext4.txt
+++ b/Documentation/filesystems/ext4.txt
@@ -25,7 +25,7 @@ Note: More extensive information for getting started with 
ext4 can be

or
 
-ftp://ftp.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/
+https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/
 
or grab the latest git repository from:
 
diff --git a/Documentation/filesystems/nfs/nfs-rdma.txt 
b/Documentation/filesystems/nfs/nfs-rdma.txt
index 1e6564545edf..31b55fe434d3 100644
--- a/Documentation/filesystems/nfs/nfs-rdma.txt
+++ b/Documentation/filesystems/nfs/nfs-rdma.txt
@@ -113,7 +113,7 @@ Installation
 kernel version 2.6.25 and later. This and other versions of the 2.6 Linux
 kernel can be found at:
 
-ftp://ftp.kernel.org/pub/linux/kernel/v2.6/
+https://www.kernel.org/pub/linux/kernel/v2.6/
 
 Download the sources and place them in an appropriate location.
 
diff --git a/Documentation/networking/e100.txt 
b/Documentation/networking/e100.txt
index 42ddbd4b52a9..54810b82c01a 100644
--- a/Documentation/networking/e100.txt
+++ b/Documentation/networking/e100.txt
@@ -130,7 +130,7 @@ Additional Configurations
   version 1.6 or later is required for this functionality.
 
   The latest release of ethtool can be found from
-  http://ftp.kernel.org/pub/software/network/ethtool/
+  https://www.kernel.org/pub/software/network/ethtool/
 
   Enabling Wake on LAN* (WoL)
   ---
diff --git a/Documentation/networking/e1000.txt 
b/Documentation/networking/e1000.txt
index 437b2099cced..1f6ed848363d 100644
--- a/Documentation/networking/e1000.txt
+++ b/Documentation/networking/e1000.txt
@@ -435,7 +435,7 @@ Additional Configurations
   version 1.6 or later is required for this functionality.
 
   The latest release of ethtool can be found from
-  http://ftp.kernel.org/pub/software/network/ethtool/
+  https://www.kernel.org/pub/software/network/ethtool/
 
   Enabling Wake on LAN* (WoL)
   ---
diff --git a/Documentation/networking/e1000e.txt 
b/Documentation/networking/e1000e.txt
index ad2d9f38ce14..12089547baed 100644
--- a/Documentation/networking/e1000e.txt
+++ b/Documentation/networking/e1000e.txt
@@ -274,7 +274,7 @@ Additional Configurations
   diagnostics, as well as displaying statistical information.  We
   strongly recommend downloading the latest version of ethtool at:
 
-  http://ftp.kernel.org/pub/software/network/ethtool/
+  https://kernel.org/pub/software/network/ethtool/
 
   NOTE: When validating enable/disable tests on some parts (82578, for example)
   you need to add a few seconds between tests when working with ethtool.
diff --git a/Documentation/networking/igb.txt b/Documentation/networking/igb.txt
index 15534fdd09a8..f90643ef39c9 100644
--- a/Documentation/networking/igb.txt
+++ b/Documentation/networking/igb.txt
@@ -63,7 +63,7 @@ Additional Configurations
   diagnostics, as well as displaying statistical information. The latest
   version of ethtool can be found at:
 
-  http://ftp.kernel.org/pub/software/network/ethtool/
+  https://www.kernel.org/pub/software/network/ethtool/
 
   Enabling Wake on LAN* (WoL)
   ---
diff --git a/Documentation/networking/igbvf.txt 
b/Documentation/networking/igbvf.txt
index 40db17a6665b..bd404735fb46 100644
--- a/Documentation/networking/ig

[PATCH 3/5] drivers/rtc/rtc-pl031.c: Convert to use devm_*()

2017-03-26 Thread Leo Yan
Convert driver to use devm_*() APIs so rely on driver model core layer
to manage resources. This eliminates error path boilerplate and makes
code neat.

Signed-off-by: Leo Yan 
---
 drivers/rtc/rtc-pl031.c | 59 +
 1 file changed, 15 insertions(+), 44 deletions(-)

diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index e1687e1..1699a17 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -304,15 +304,8 @@ static int pl031_set_alarm(struct device *dev, struct 
rtc_wkalrm *alarm)
 
 static int pl031_remove(struct amba_device *adev)
 {
-   struct pl031_local *ldata = dev_get_drvdata(&adev->dev);
-
dev_pm_clear_wake_irq(&adev->dev);
device_init_wakeup(&adev->dev, false);
-   free_irq(adev->irq[0], ldata);
-   rtc_device_unregister(ldata->rtc);
-   iounmap(ldata->base);
-   kfree(ldata);
-   amba_release_regions(adev);
 
return 0;
 }
@@ -325,23 +318,15 @@ static int pl031_probe(struct amba_device *adev, const 
struct amba_id *id)
struct rtc_class_ops *ops = &vendor->ops;
unsigned long time, data;
 
-   ret = amba_request_regions(adev, NULL);
-   if (ret)
-   goto err_req;
+   ldata = devm_kzalloc(&adev->dev, sizeof(*ldata), GFP_KERNEL);
+   if (!ldata)
+   return -ENOMEM;
 
-   ldata = kzalloc(sizeof(struct pl031_local), GFP_KERNEL);
-   if (!ldata) {
-   ret = -ENOMEM;
-   goto out;
-   }
ldata->vendor = vendor;
 
-   ldata->base = ioremap(adev->res.start, resource_size(&adev->res));
-
-   if (!ldata->base) {
-   ret = -ENOMEM;
-   goto out_no_remap;
-   }
+   ldata->base = devm_ioremap_resource(&adev->dev, &adev->res);
+   if (IS_ERR(ldata->base))
+   return PTR_ERR(ldata->base);
 
amba_set_drvdata(adev, ldata);
 
@@ -374,32 +359,18 @@ static int pl031_probe(struct amba_device *adev, const 
struct amba_id *id)
}
 
device_init_wakeup(&adev->dev, true);
-   ldata->rtc = rtc_device_register("pl031", &adev->dev, ops,
-   THIS_MODULE);
-   if (IS_ERR(ldata->rtc)) {
-   ret = PTR_ERR(ldata->rtc);
-   goto out_no_rtc;
-   }
+   ldata->rtc = devm_rtc_device_register(&adev->dev, "pl031", ops,
+ THIS_MODULE);
+   if (IS_ERR(ldata->rtc))
+   return PTR_ERR(ldata->rtc);
+
+   ret = devm_request_irq(&adev->dev, adev->irq[0], pl031_interrupt,
+  vendor->irqflags, "rtc-pl031", ldata);
+   if (ret)
+   return ret;
 
-   if (request_irq(adev->irq[0], pl031_interrupt,
-   vendor->irqflags, "rtc-pl031", ldata)) {
-   ret = -EIO;
-   goto out_no_irq;
-   }
dev_pm_set_wake_irq(&adev->dev, adev->irq[0]);
return 0;
-
-out_no_irq:
-   rtc_device_unregister(ldata->rtc);
-out_no_rtc:
-   iounmap(ldata->base);
-out_no_remap:
-   kfree(ldata);
-out:
-   amba_release_regions(adev);
-err_req:
-
-   return ret;
 }
 
 /* Operations for the original ARM version */
-- 
2.7.4



[PATCH 2/5] drivers/rtc/rtc-pl030.c: Convert to use devm_*()

2017-03-26 Thread Leo Yan
Convert driver to use devm_*() APIs so rely on driver model core layer
to manage resources. This eliminates error path boilerplate and makes
code neat.

Signed-off-by: Leo Yan 
---
 drivers/rtc/rtc-pl030.c | 49 -
 1 file changed, 12 insertions(+), 37 deletions(-)

diff --git a/drivers/rtc/rtc-pl030.c b/drivers/rtc/rtc-pl030.c
index f85a1a9..372b1fd 100644
--- a/drivers/rtc/rtc-pl030.c
+++ b/drivers/rtc/rtc-pl030.c
@@ -102,49 +102,30 @@ static int pl030_probe(struct amba_device *dev, const 
struct amba_id *id)
struct pl030_rtc *rtc;
int ret;
 
-   ret = amba_request_regions(dev, NULL);
-   if (ret)
-   goto err_req;
-
rtc = devm_kzalloc(&dev->dev, sizeof(*rtc), GFP_KERNEL);
-   if (!rtc) {
-   ret = -ENOMEM;
-   goto err_rtc;
-   }
+   if (!rtc)
+   return -ENOMEM;
 
-   rtc->base = ioremap(dev->res.start, resource_size(&dev->res));
-   if (!rtc->base) {
-   ret = -ENOMEM;
-   goto err_rtc;
-   }
+   rtc->base = devm_ioremap_resource(&dev->dev, &dev->res);
+   if (IS_ERR(rtc->base))
+   return PTR_ERR(rtc->base);
 
__raw_writel(0, rtc->base + RTC_CR);
__raw_writel(0, rtc->base + RTC_EOI);
 
amba_set_drvdata(dev, rtc);
 
-   ret = request_irq(dev->irq[0], pl030_interrupt, 0,
- "rtc-pl030", rtc);
+   ret = devm_request_irq(&dev->dev, dev->irq[0], pl030_interrupt, 0,
+  "rtc-pl030", rtc);
if (ret)
-   goto err_irq;
+   return ret;
 
-   rtc->rtc = rtc_device_register("pl030", &dev->dev, &pl030_ops,
-  THIS_MODULE);
-   if (IS_ERR(rtc->rtc)) {
-   ret = PTR_ERR(rtc->rtc);
-   goto err_reg;
-   }
+   rtc->rtc = devm_rtc_device_register(&dev->dev, "pl030", &pl030_ops,
+   THIS_MODULE);
+   if (IS_ERR(rtc->rtc))
+   return PTR_ERR(rtc->rtc);
 
return 0;
-
- err_reg:
-   free_irq(dev->irq[0], rtc);
- err_irq:
-   iounmap(rtc->base);
- err_rtc:
-   amba_release_regions(dev);
- err_req:
-   return ret;
 }
 
 static int pl030_remove(struct amba_device *dev)
@@ -152,12 +133,6 @@ static int pl030_remove(struct amba_device *dev)
struct pl030_rtc *rtc = amba_get_drvdata(dev);
 
writel(0, rtc->base + RTC_CR);
-
-   free_irq(dev->irq[0], rtc);
-   rtc_device_unregister(rtc->rtc);
-   iounmap(rtc->base);
-   amba_release_regions(dev);
-
return 0;
 }
 
-- 
2.7.4



[PATCH 0/5] Convert to use devm_*() for amba attached modules

2017-03-26 Thread Leo Yan
When review device driver modules which attach to amba bus, found
several modules are not using devm_*() apis to manage resource. As
result, some drivers have memory leakage or missing iomem unmapping
when rmmod module. And the code has many "goto" tags to handle
different failures.

So this patch series is to convert to use devm_*() for moudules which
are attached to amba bus to manage resource and get more robust and
neat code.

Patch 0003 "drivers/rtc/rtc-pl031.c: Convert to use devm_*()" has been
verified on 96boards Hikey. Other patches can pass building but have
not really tested on hardware.


Leo Yan (5):
  Input: ambakmi - Convert to use devm_*()
  drivers/rtc/rtc-pl030.c: Convert to use devm_*()
  drivers/rtc/rtc-pl031.c: Convert to use devm_*()
  vfio: platform: Convert to use devm_*()
  ALSA: AACI: Convert to use devm_ioremap_resource()

 drivers/input/serio/ambakmi.c | 44 +++--
 drivers/rtc/rtc-pl030.c   | 49 
 drivers/rtc/rtc-pl031.c   | 59 ++-
 drivers/vfio/platform/vfio_amba.c | 25 ++---
 sound/arm/aaci.c  | 21 --
 5 files changed, 51 insertions(+), 147 deletions(-)

-- 
2.7.4



[PATCH 1/5] Input: ambakmi - Convert to use devm_*()

2017-03-26 Thread Leo Yan
Convert driver to use devm_*() APIs so rely on driver model core layer
to manage resources. This eliminates error path boilerplate and makes
code neat.

This patch also fixes the memory leakage for 'kmi->io' when remove
module.

Signed-off-by: Leo Yan 
---
 drivers/input/serio/ambakmi.c | 44 ++-
 1 file changed, 10 insertions(+), 34 deletions(-)

diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c
index c6606ca..d4814be 100644
--- a/drivers/input/serio/ambakmi.c
+++ b/drivers/input/serio/ambakmi.c
@@ -112,19 +112,11 @@ static int amba_kmi_probe(struct amba_device *dev,
 {
struct amba_kmi_port *kmi;
struct serio *io;
-   int ret;
-
-   ret = amba_request_regions(dev, NULL);
-   if (ret)
-   return ret;
-
-   kmi = kzalloc(sizeof(struct amba_kmi_port), GFP_KERNEL);
-   io = kzalloc(sizeof(struct serio), GFP_KERNEL);
-   if (!kmi || !io) {
-   ret = -ENOMEM;
-   goto out;
-   }
 
+   kmi = devm_kzalloc(&dev->dev, sizeof(*kmi), GFP_KERNEL);
+   io  = devm_kzalloc(&dev->dev, sizeof(*io), GFP_KERNEL);
+   if (!kmi || !io)
+   return -ENOMEM;
 
io->id.type = SERIO_8042;
io->write   = amba_kmi_write;
@@ -136,31 +128,19 @@ static int amba_kmi_probe(struct amba_device *dev,
io->dev.parent  = &dev->dev;
 
kmi->io = io;
-   kmi->base   = ioremap(dev->res.start, resource_size(&dev->res));
-   if (!kmi->base) {
-   ret = -ENOMEM;
-   goto out;
-   }
+   kmi->base   = devm_ioremap_resource(&dev->dev, &dev->res);
+   if (IS_ERR(kmi->base))
+   return PTR_ERR(kmi->base);
 
-   kmi->clk = clk_get(&dev->dev, "KMIREFCLK");
-   if (IS_ERR(kmi->clk)) {
-   ret = PTR_ERR(kmi->clk);
-   goto unmap;
-   }
+   kmi->clk = devm_clk_get(&dev->dev, "KMIREFCLK");
+   if (IS_ERR(kmi->clk))
+   return PTR_ERR(kmi->clk);
 
kmi->irq = dev->irq[0];
amba_set_drvdata(dev, kmi);
 
serio_register_port(kmi->io);
return 0;
-
- unmap:
-   iounmap(kmi->base);
- out:
-   kfree(kmi);
-   kfree(io);
-   amba_release_regions(dev);
-   return ret;
 }
 
 static int amba_kmi_remove(struct amba_device *dev)
@@ -168,10 +148,6 @@ static int amba_kmi_remove(struct amba_device *dev)
struct amba_kmi_port *kmi = amba_get_drvdata(dev);
 
serio_unregister_port(kmi->io);
-   clk_put(kmi->clk);
-   iounmap(kmi->base);
-   kfree(kmi);
-   amba_release_regions(dev);
return 0;
 }
 
-- 
2.7.4



[PATCH 4/5] vfio: platform: Convert to use devm_*()

2017-03-26 Thread Leo Yan
Convert driver to use devm_*() APIs so rely on driver model core layer
to manage resources. This eliminates error path boilerplate and makes
code neat.

This patch also renames amba_id structure, the old code used some code
which directly copied from other driver.

Signed-off-by: Leo Yan 
---
 drivers/vfio/platform/vfio_amba.c | 25 -
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/drivers/vfio/platform/vfio_amba.c 
b/drivers/vfio/platform/vfio_amba.c
index 31372fb..433db1f 100644
--- a/drivers/vfio/platform/vfio_amba.c
+++ b/drivers/vfio/platform/vfio_amba.c
@@ -53,15 +53,14 @@ static int vfio_amba_probe(struct amba_device *adev, const 
struct amba_id *id)
struct vfio_platform_device *vdev;
int ret;
 
-   vdev = kzalloc(sizeof(*vdev), GFP_KERNEL);
+   vdev = devm_kzalloc(&adev->dev, sizeof(*vdev), GFP_KERNEL);
if (!vdev)
return -ENOMEM;
 
-   vdev->name = kasprintf(GFP_KERNEL, "vfio-amba-%08x", adev->periphid);
-   if (!vdev->name) {
-   kfree(vdev);
+   vdev->name = devm_kasprintf(&adev->dev, GFP_KERNEL,
+   "vfio-amba-%08x", adev->periphid);
+   if (!vdev->name)
return -ENOMEM;
-   }
 
vdev->opaque = (void *) adev;
vdev->flags = VFIO_DEVICE_FLAGS_AMBA;
@@ -71,11 +70,6 @@ static int vfio_amba_probe(struct amba_device *adev, const 
struct amba_id *id)
vdev->reset_required = false;
 
ret = vfio_platform_probe_common(vdev, &adev->dev);
-   if (ret) {
-   kfree(vdev->name);
-   kfree(vdev);
-   }
-
return ret;
 }
 
@@ -84,25 +78,22 @@ static int vfio_amba_remove(struct amba_device *adev)
struct vfio_platform_device *vdev;
 
vdev = vfio_platform_remove_common(&adev->dev);
-   if (vdev) {
-   kfree(vdev->name);
-   kfree(vdev);
+   if (vdev)
return 0;
-   }
 
return -EINVAL;
 }
 
-static struct amba_id pl330_ids[] = {
+static struct amba_id vfio_ids[] = {
{ 0, 0 },
 };
 
-MODULE_DEVICE_TABLE(amba, pl330_ids);
+MODULE_DEVICE_TABLE(amba, vfio_ids);
 
 static struct amba_driver vfio_amba_driver = {
.probe = vfio_amba_probe,
.remove = vfio_amba_remove,
-   .id_table = pl330_ids,
+   .id_table = vfio_ids,
.drv = {
.name = "vfio-amba",
.owner = THIS_MODULE,
-- 
2.7.4



[PATCH 5/5] ALSA: AACI: Convert to use devm_ioremap_resource()

2017-03-26 Thread Leo Yan
Convert to use devm_ioremap_resource() in probe function, otherwise it's
missed to unremap this region if probe failed or rmmod module.

Signed-off-by: Leo Yan 
---
 sound/arm/aaci.c | 21 ++---
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 4140b1b..2078568 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -990,19 +990,13 @@ static int aaci_probe(struct amba_device *dev,
struct aaci *aaci;
int ret, i;
 
-   ret = amba_request_regions(dev, NULL);
-   if (ret)
-   return ret;
-
aaci = aaci_init_card(dev);
-   if (!aaci) {
-   ret = -ENOMEM;
-   goto out;
-   }
+   if (!aaci)
+   return -ENOMEM;
 
-   aaci->base = ioremap(dev->res.start, resource_size(&dev->res));
-   if (!aaci->base) {
-   ret = -ENOMEM;
+   aaci->base = devm_ioremap_resource(&dev->dev, &dev->res);
+   if (IS_ERR(aaci->base)) {
+   ret = PTR_ERR(aaci->base);
goto out;
}
 
@@ -1064,9 +1058,7 @@ static int aaci_probe(struct amba_device *dev,
}
 
  out:
-   if (aaci)
-   snd_card_free(aaci->card);
-   amba_release_regions(dev);
+   snd_card_free(aaci->card);
return ret;
 }
 
@@ -1079,7 +1071,6 @@ static int aaci_remove(struct amba_device *dev)
writel(0, aaci->base + AACI_MAINCR);
 
snd_card_free(card);
-   amba_release_regions(dev);
}
 
return 0;
-- 
2.7.4



Re: [PATCH 1/5] Input: ambakmi - Convert to use devm_*()

2017-03-26 Thread Russell King - ARM Linux
On Sun, Mar 26, 2017 at 10:41:50PM +0800, Leo Yan wrote:
> Convert driver to use devm_*() APIs so rely on driver model core layer
> to manage resources. This eliminates error path boilerplate and makes
> code neat.
> 
> This patch also fixes the memory leakage for 'kmi->io' when remove
> module.

No, it is not leaked, in fact, your patch introduces a use-after-free
bug.

kmi->io is of type "struct serio", and this structure has an embedded
"struct device".  The lifetime of any structure containing a "struct
device" is controlled by the lifetime of the struct device.

Once serio_register_port() has been called on it, it is up to the
serio layer to free this structure.

Therefore, your patch creates a bug, and so it gets a NAK.  There is no
resource leakage here.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.


Re: 0324 tree BUG at kernel/auditsc.c:1513!

2017-03-26 Thread Paul Moore
On Sat, Mar 25, 2017 at 12:47 AM, Xiong Zhou  wrote:
> [11230.930568] [ cut here ]
> [11230.953828] kernel BUG at kernel/auditsc.c:1513!
> [11230.976157] invalid opcode:  [#1] SMP
> [11230.995917] Modules linked in: btrfs xor raid6_pq ext2 dm_thin_pool 
> dm_persistent_data dm_bio_prison dm_bufio loop ext4 jbd2 mbcache xt_CHECKSUM 
> iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 
> nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT 
> nf_reject_ipv4 tun bridge stp llc ebtable_filter ebtables ip6table_filter 
> ip6_tables iptable_filter dm_mirror dm_region_hash dm_log dm_mod intel_rapl 
> sb_edac edac_core x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel 
> kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc 
> ipmi_ssif aesni_intel crypto_simd ipmi_si glue_helper iTCO_wdt ipmi_devintf 
> iTCO_vendor_support cryptd dax_pmem sg hpilo ipmi_msghandler hpwdt lpc_ich 
> pcc_cpufreq pcspkr dax ioatdma i2c_i801 wmi acpi_power_meter acpi_cpufreq
> [11231.318010]  dca shpchp nfsd auth_rpcgss nfs_acl lockd grace sunrpc 
> binfmt_misc ip_tables xfs libcrc32c sd_mod mgag200 i2c_algo_bit 
> drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm drm tg3 ptp 
> hpsa crc32c_intel nd_pmem serio_raw i2c_core pps_core scsi_transport_sas 
> [last unloaded: scsi_debug]
> [11231.440342] CPU: 24 PID: 15334 Comm: dio_truncate Not tainted 
> 4.11.0-rc3-linux-next-65b2dc3-next-20170324 #336
> [11231.488861] Hardware name: HP ProLiant DL360 Gen9, BIOS P89 05/06/2015
> [11231.521003] task: 9eb578bc5a00 task.stack: c277665d8000
> [11231.547477] RIP: 0010:__audit_syscall_entry+0xf0/0x100
> [11231.570495] RSP: 0018:c277665dbe90 EFLAGS: 00010206
> [11231.594551] RAX:  RBX: 9ebf2896a800 RCX: 
> 
> [11231.626815] RDX: 4000 RSI: 7ffe7a853c60 RDI: 
> 0002
> [11231.658965] RBP: c277665dbea0 R08: 7ffe7a853940 R09: 
> 9eb578bc5a00
> [11231.691211] R10: 7ffe7a853940 R11: 770b5a00 R12: 
> 
> [11231.723119] R13: 0002 R14:  R15: 
> 
> [11231.755258] FS:  7fdbdb18b740() GS:9ebf3fc0() 
> knlGS:
> [11231.791482] CS:  0010 DS:  ES:  CR0: 80050033
> [11231.817433] CR2: 7fff02451000 CR3: 00076082 CR4: 
> 001406e0
> [11231.849728] Call Trace:
> [11231.860748]  syscall_trace_enter+0x1d0/0x2b0
> [11231.880034]  ? __audit_syscall_exit+0x209/0x290
> [11231.900057]  do_syscall_64+0x155/0x180
> [11231.916776]  entry_SYSCALL64_slow_path+0x25/0x25
> [11231.937440] RIP: 0033:0x7fdbdad70c20
> [11231.953513] RSP: 002b:7ffe7a853c28 EFLAGS: 0246 ORIG_RAX: 
> 0002
> [11231.989037] RAX: ffda RBX: 7fdbdb18b6c0 RCX: 
> 7fdbdad70c20
> [11232.023770] RDX:  RSI: 4000 RDI: 
> 7ffe7a853c60
> [11232.059308] RBP: 7ffe7a853c60 R08:  R09: 
> 01a68010
> [11232.091419] R10: 7ffe7a853940 R11: 0246 R12: 
> 
> [11232.123493] R13: 7ffe7a854d50 R14:  R15: 
> 
> [11232.155457] Code: 02 00 00 00 00 00 00 5b 41 5c 5d c3 48 c7 43 50 00 00 00 
> 00 48 c7 c2 a0 f8 6f a6 48 89 de 4c 89 cf e8 05 f5 ff ff 41 89 c4 eb a9 <0f> 
> 0b 0f 1f 40 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00
> [11232.240315] RIP: __audit_syscall_entry+0xf0/0x100 RSP: c277665dbe90
> [11232.272441] BUG: unable to handle kernel paging request at 9ebf29362000
> [11232.272451] ---[ end trace 7e25ab22dc4e0f7a ]---

Can you elaborate a bit more on this?  For example, what were you
doing that caused this fault?  Is it easily reproduced?

I'm assuming based on the kernel name,
4.11.0-rc3-linux-next-65b2dc3-next-20170324, that this is linux-next
from March 24th.  Looking at that code it doesn't have that last big
pull request that Linus merged on Saturday, the 25th.  We did merge
some small changes into audit/next on Wednesday, the 22nd, and
Thursday, the 23rd, but nothing that should involve the syscall entry
code.  Hmmm.

-- 
paul moore
www.paul-moore.com


Re: [PATCH 5/5] ALSA: AACI: Convert to use devm_ioremap_resource()

2017-03-26 Thread Russell King - ARM Linux
On Sun, Mar 26, 2017 at 10:41:54PM +0800, Leo Yan wrote:
> Convert to use devm_ioremap_resource() in probe function, otherwise it's
> missed to unremap this region if probe failed or rmmod module.

Again, wrong - just because there's nothing in the cleanup paths does
not mean it doesn't clean up.

static void aaci_free_card(struct snd_card *card)
{
struct aaci *aaci = card->private_data;

iounmap(aaci->base);
}

This unmaps the mapping you claim it fails to do so.  So, your patch
actually _creates_ bugs that were not there before.

NAK.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.


Re: Audit fixes for v4.11 (#1)

2017-03-26 Thread Paul Moore
On Sat, Mar 25, 2017 at 6:23 PM, Linus Torvalds
 wrote:
> On Fri, Mar 24, 2017 at 2:39 PM, Paul Moore  wrote:
>>
>> This code has passed our testsuite without problem and it has held up
>> to my ad-hoc stress tests (arguably better than the existing code),
>> please consider pulling this as fix for the next v4.11-rcX tag.
>
> Ok, pulled. However, looking at the changes in the patch it becomes
> obvious that it is now completely bogus to inline the
> "audit_signal_info()" function.
>
> That silly inline in the header file now only generates bigger and
> slower code, since that inlined function now calls another function
> auditd_test_task() that is *not* inlined, so it ends up being a
> function call anyway.

Good catch.  I was so worried about the other issues in this patch I
missed this obvious point.

> It would be much better to just unlinline audit_signal_info(), move it
> into kernel/audit.c, and let the compiler then inline the
> __audit_signal_info() helper function (or just fold it into that
> function manually as part of the move).
>
> The whole reason for that inlined part, and the uninlined
> __audit_signal_info() helper was that the code *used* to be able to
> avoid a function call entirely. That reason is now gone.

Agreed.  Normally I would say let's just fix it in audit/next and I'll
send it to you during the next merge window; however, since we're
breaking the whole point of this inline in the -rcX stage, and the
uninline'ing patch would be rather trivial, would you prefer I send it
to you now for v4.11?

-- 
paul moore
security @ redhat


Re: [PATCH 0/5] Convert to use devm_*() for amba attached modules

2017-03-26 Thread Alexandre Belloni
On 26/03/2017 at 22:41:49 +0800, Leo Yan wrote:
> When review device driver modules which attach to amba bus, found
> several modules are not using devm_*() apis to manage resource. As
> result, some drivers have memory leakage or missing iomem unmapping
> when rmmod module. And the code has many "goto" tags to handle
> different failures.
> 
> So this patch series is to convert to use devm_*() for moudules which
> are attached to amba bus to manage resource and get more robust and
> neat code.
> 
> Patch 0003 "drivers/rtc/rtc-pl031.c: Convert to use devm_*()" has been
> verified on 96boards Hikey. Other patches can pass building but have
> not really tested on hardware.
> 

If your plan is to actually remove usage of
amba_request_regions() and amba_release_regions(), you should do so in
its own patch sets instead of hiding that in a useless cleanup series.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


Re: [PATCH v3 1/3] crypto: hw_random - Add new Exynos RNG driver

2017-03-26 Thread PrasannaKumar Muralidharan
.Have some minor comments. Please feel free to correct if I am wrong.

On 25 March 2017 at 21:56, Krzysztof Kozlowski  wrote:
> Replace existing hw_ranndom/exynos-rng driver with a new, reworked one.
> This is a driver for pseudo random number generator block which on
> Exynos4 chipsets must be seeded with some value.  On newer Exynos5420
> chipsets it might seed itself from true random number generator block
> but this is not implemented yet.
>
> New driver is a complete rework to use the crypto ALGAPI instead of
> hw_random API.  Rationale for the change:
> 1. hw_random interface is for true RNG devices.
> 2. The old driver was seeding itself with jiffies which is not a
>reliable source for randomness.
> 3. Device generates five random numbers in each pass but old driver was
>returning only one thus its performance was reduced.
>
> Compatibility with DeviceTree bindings is preserved.
>
> New driver does not use runtime power management but manually enables
> and disables the clock when needed.  This is preferred approach because
> using runtime PM just to toggle clock is huge overhead.
>
> Another difference is reseeding itself with generated random data
> periodically and during resuming from system suspend (previously driver
> was re-seeding itself again with jiffies).
>
> Signed-off-by: Krzysztof Kozlowski 
>
> ---
>  MAINTAINERS |   8 +
>  drivers/char/hw_random/Kconfig  |  14 --
>  drivers/char/hw_random/Makefile |   1 -
>  drivers/char/hw_random/exynos-rng.c | 231 -
>  drivers/crypto/Kconfig  |  15 ++
>  drivers/crypto/Makefile |   1 +
>  drivers/crypto/exynos-rng.c | 390 
> 
>  7 files changed, 414 insertions(+), 246 deletions(-)
>  delete mode 100644 drivers/char/hw_random/exynos-rng.c
>  create mode 100644 drivers/crypto/exynos-rng.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index affecc6d59f4..371fda859d43 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -10977,6 +10977,14 @@ L: alsa-de...@alsa-project.org (moderated for 
> non-subscribers)
>  S: Supported
>  F: sound/soc/samsung/
>
> +SAMSUNG EXYNOS PSEUDO RANDOM NUMBER GENERATOR (RNG) DRIVER
> +M: Krzysztof Kozlowski 
> +L: linux-cry...@vger.kernel.org
> +L: linux-samsung-...@vger.kernel.org
> +S: Maintained
> +F: drivers/crypto/exynos-rng.c
> +F: Documentation/devicetree/bindings/rng/samsung,exynos-rng4.txt
> +
>  SAMSUNG FRAMEBUFFER DRIVER
>  M: Jingoo Han 
>  L: linux-fb...@vger.kernel.org
> diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
> index 0cafe08919c9..bdae802e7154 100644
> --- a/drivers/char/hw_random/Kconfig
> +++ b/drivers/char/hw_random/Kconfig
> @@ -294,20 +294,6 @@ config HW_RANDOM_POWERNV
>
>   If unsure, say Y.
>
> -config HW_RANDOM_EXYNOS
> -   tristate "EXYNOS HW random number generator support"
> -   depends on ARCH_EXYNOS || COMPILE_TEST
> -   depends on HAS_IOMEM
> -   default HW_RANDOM
> -   ---help---
> - This driver provides kernel-side support for the Random Number
> - Generator hardware found on EXYNOS SOCs.
> -
> - To compile this driver as a module, choose M here: the
> - module will be called exynos-rng.
> -
> - If unsure, say Y.
> -
>  config HW_RANDOM_TPM
> tristate "TPM HW Random Number Generator support"
> depends on TCG_TPM
> diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile
> index 5f52b1e4e7be..6f1eecc2045c 100644
> --- a/drivers/char/hw_random/Makefile
> +++ b/drivers/char/hw_random/Makefile
> @@ -24,7 +24,6 @@ obj-$(CONFIG_HW_RANDOM_OCTEON) += octeon-rng.o
>  obj-$(CONFIG_HW_RANDOM_NOMADIK) += nomadik-rng.o
>  obj-$(CONFIG_HW_RANDOM_PSERIES) += pseries-rng.o
>  obj-$(CONFIG_HW_RANDOM_POWERNV) += powernv-rng.o
> -obj-$(CONFIG_HW_RANDOM_EXYNOS) += exynos-rng.o
>  obj-$(CONFIG_HW_RANDOM_HISI)   += hisi-rng.o
>  obj-$(CONFIG_HW_RANDOM_TPM) += tpm-rng.o
>  obj-$(CONFIG_HW_RANDOM_BCM2835) += bcm2835-rng.o
> diff --git a/drivers/char/hw_random/exynos-rng.c 
> b/drivers/char/hw_random/exynos-rng.c
> deleted file mode 100644
> index 23d358553b21..
> --- a/drivers/char/hw_random/exynos-rng.c
> +++ /dev/null
> @@ -1,231 +0,0 @@
> -/*
> - * exynos-rng.c - Random Number Generator driver for the exynos
> - *
> - * Copyright (C) 2012 Samsung Electronics
> - * Jonghwa Lee 
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation;
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public Lic

Re: [PATCH 1/5] Input: ambakmi - Convert to use devm_*()

2017-03-26 Thread Leo Yan
On Sun, Mar 26, 2017 at 03:50:24PM +0100, Russell King - ARM Linux wrote:
> On Sun, Mar 26, 2017 at 10:41:50PM +0800, Leo Yan wrote:
> > Convert driver to use devm_*() APIs so rely on driver model core layer
> > to manage resources. This eliminates error path boilerplate and makes
> > code neat.
> > 
> > This patch also fixes the memory leakage for 'kmi->io' when remove
> > module.
> 
> No, it is not leaked, in fact, your patch introduces a use-after-free
> bug.
> 
> kmi->io is of type "struct serio", and this structure has an embedded
> "struct device".  The lifetime of any structure containing a "struct
> device" is controlled by the lifetime of the struct device.
> 
> Once serio_register_port() has been called on it, it is up to the
> serio layer to free this structure.
> 
> Therefore, your patch creates a bug, and so it gets a NAK.  There is no
> resource leakage here.

Thanks for reviewing. Now I understood and please ignore this patch
and patch 0005.

Thanks,
Leo Yan


Re: [PATCH 0/5] Convert to use devm_*() for amba attached modules

2017-03-26 Thread Leo Yan
On Sun, Mar 26, 2017 at 05:20:50PM +0200, Alexandre Belloni wrote:
> On 26/03/2017 at 22:41:49 +0800, Leo Yan wrote:
> > When review device driver modules which attach to amba bus, found
> > several modules are not using devm_*() apis to manage resource. As
> > result, some drivers have memory leakage or missing iomem unmapping
> > when rmmod module. And the code has many "goto" tags to handle
> > different failures.
> > 
> > So this patch series is to convert to use devm_*() for moudules which
> > are attached to amba bus to manage resource and get more robust and
> > neat code.
> > 
> > Patch 0003 "drivers/rtc/rtc-pl031.c: Convert to use devm_*()" has been
> > verified on 96boards Hikey. Other patches can pass building but have
> > not really tested on hardware.
> > 
> 
> If your plan is to actually remove usage of
> amba_request_regions() and amba_release_regions(), you should do so in
> its own patch sets instead of hiding that in a useless cleanup series.

Just curious, from Russell's replying for patch 0005, IIUC we cannot
totally remove usage of amba_request_regions() and
amba_release_regions(), there have some coner case should use
amba_request_regions() + ioremap().

Does it make sense to remove most usage of amba_request_regions() and
amba_release_regions() but we still keep these two functions in the kernel?

Thanks,
Leo Yan


[RESEND] arm: ftrace: fix dynamic ftrace with DEBUG_RODATA and !FRAME_POINTER

2017-03-26 Thread Abel Vesa
The support for dynamic ftrace with CONFIG_DEBUG_RODATA involves
overriding the weak arch_ftrace_update_code() with a variant which makes
the kernel text writable around the patching.

This override was however added under the CONFIG_OLD_MCOUNT ifdef, and
CONFIG_OLD_MCOUNT is only enabled if frame pointers are enabled.

This leads to non-functional dynamic ftrace (ftrace triggers a
WARN_ON()) when CONFIG_DEBUG_RODATA is enabled and CONFIG_FRAME_POINTER
is not.

Move the override out of that ifdef and into the CONFIG_DYNAMIC_FTRACE
ifdef where it belongs.

Fixes: 80d6b0c2eed2a ("ARM: mm: allow text and rodata sections to be read-only")

Suggested-by: Nicolai Stange 
Suggested-by: Rabin Vincent 
Signed-off-by: Abel Vesa 
Acked-by: Rabin Vincent 
---
 arch/arm/kernel/ftrace.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c
index 3f17594..414e60e 100644
--- a/arch/arm/kernel/ftrace.c
+++ b/arch/arm/kernel/ftrace.c
@@ -29,11 +29,6 @@
 #endif
 
 #ifdef CONFIG_DYNAMIC_FTRACE
-#ifdef CONFIG_OLD_MCOUNT
-#define OLD_MCOUNT_ADDR((unsigned long) mcount)
-#define OLD_FTRACE_ADDR ((unsigned long) ftrace_caller_old)
-
-#defineOLD_NOP 0xe1a0  /* mov r0, r0 */
 
 static int __ftrace_modify_code(void *data)
 {
@@ -51,6 +46,12 @@ void arch_ftrace_update_code(int command)
stop_machine(__ftrace_modify_code, &command, NULL);
 }
 
+#ifdef CONFIG_OLD_MCOUNT
+#define OLD_MCOUNT_ADDR((unsigned long) mcount)
+#define OLD_FTRACE_ADDR ((unsigned long) ftrace_caller_old)
+
+#defineOLD_NOP 0xe1a0  /* mov r0, r0 */
+
 static unsigned long ftrace_nop_replace(struct dyn_ftrace *rec)
 {
return rec->arch.old_mcount ? OLD_NOP : NOP;
-- 
2.7.4



Re: [PATCH v3 1/3] crypto: hw_random - Add new Exynos RNG driver

2017-03-26 Thread Krzysztof Kozlowski
On Sun, Mar 26, 2017 at 08:50:42PM +0530, PrasannaKumar Muralidharan wrote:
> .Have some minor comments. Please feel free to correct if I am wrong.
> 
> On 25 March 2017 at 21:56, Krzysztof Kozlowski  wrote:
> > Replace existing hw_ranndom/exynos-rng driver with a new, reworked one.
> > This is a driver for pseudo random number generator block which on
> > Exynos4 chipsets must be seeded with some value.  On newer Exynos5420
> > chipsets it might seed itself from true random number generator block
> > but this is not implemented yet.
> >
> > New driver is a complete rework to use the crypto ALGAPI instead of
> > hw_random API.  Rationale for the change:
> > 1. hw_random interface is for true RNG devices.
> > 2. The old driver was seeding itself with jiffies which is not a
> >reliable source for randomness.
> > 3. Device generates five random numbers in each pass but old driver was
> >returning only one thus its performance was reduced.
> >
> > Compatibility with DeviceTree bindings is preserved.
> >
> > New driver does not use runtime power management but manually enables
> > and disables the clock when needed.  This is preferred approach because
> > using runtime PM just to toggle clock is huge overhead.
> >
> > Another difference is reseeding itself with generated random data
> > periodically and during resuming from system suspend (previously driver
> > was re-seeding itself again with jiffies).
> >
> > Signed-off-by: Krzysztof Kozlowski 
> >
> > ---
> >  MAINTAINERS |   8 +
> >  drivers/char/hw_random/Kconfig  |  14 --
> >  drivers/char/hw_random/Makefile |   1 -
> >  drivers/char/hw_random/exynos-rng.c | 231 -
> >  drivers/crypto/Kconfig  |  15 ++
> >  drivers/crypto/Makefile |   1 +
> >  drivers/crypto/exynos-rng.c | 390 
> > 
> >  7 files changed, 414 insertions(+), 246 deletions(-)
> >  delete mode 100644 drivers/char/hw_random/exynos-rng.c
> >  create mode 100644 drivers/crypto/exynos-rng.c
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index affecc6d59f4..371fda859d43 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -10977,6 +10977,14 @@ L: alsa-de...@alsa-project.org (moderated for 
> > non-subscribers)
> >  S: Supported
> >  F: sound/soc/samsung/
> >
> > +SAMSUNG EXYNOS PSEUDO RANDOM NUMBER GENERATOR (RNG) DRIVER
> > +M: Krzysztof Kozlowski 
> > +L: linux-cry...@vger.kernel.org
> > +L: linux-samsung-...@vger.kernel.org
> > +S: Maintained
> > +F: drivers/crypto/exynos-rng.c
> > +F: Documentation/devicetree/bindings/rng/samsung,exynos-rng4.txt
> > +
> >  SAMSUNG FRAMEBUFFER DRIVER
> >  M: Jingoo Han 
> >  L: linux-fb...@vger.kernel.org
> > diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
> > index 0cafe08919c9..bdae802e7154 100644
> > --- a/drivers/char/hw_random/Kconfig
> > +++ b/drivers/char/hw_random/Kconfig
> > @@ -294,20 +294,6 @@ config HW_RANDOM_POWERNV
> >
> >   If unsure, say Y.
> >
> > -config HW_RANDOM_EXYNOS
> > -   tristate "EXYNOS HW random number generator support"
> > -   depends on ARCH_EXYNOS || COMPILE_TEST
> > -   depends on HAS_IOMEM
> > -   default HW_RANDOM
> > -   ---help---
> > - This driver provides kernel-side support for the Random Number
> > - Generator hardware found on EXYNOS SOCs.
> > -
> > - To compile this driver as a module, choose M here: the
> > - module will be called exynos-rng.
> > -
> > - If unsure, say Y.
> > -
> >  config HW_RANDOM_TPM
> > tristate "TPM HW Random Number Generator support"
> > depends on TCG_TPM
> > diff --git a/drivers/char/hw_random/Makefile 
> > b/drivers/char/hw_random/Makefile
> > index 5f52b1e4e7be..6f1eecc2045c 100644
> > --- a/drivers/char/hw_random/Makefile
> > +++ b/drivers/char/hw_random/Makefile
> > @@ -24,7 +24,6 @@ obj-$(CONFIG_HW_RANDOM_OCTEON) += octeon-rng.o
> >  obj-$(CONFIG_HW_RANDOM_NOMADIK) += nomadik-rng.o
> >  obj-$(CONFIG_HW_RANDOM_PSERIES) += pseries-rng.o
> >  obj-$(CONFIG_HW_RANDOM_POWERNV) += powernv-rng.o
> > -obj-$(CONFIG_HW_RANDOM_EXYNOS) += exynos-rng.o
> >  obj-$(CONFIG_HW_RANDOM_HISI)   += hisi-rng.o
> >  obj-$(CONFIG_HW_RANDOM_TPM) += tpm-rng.o
> >  obj-$(CONFIG_HW_RANDOM_BCM2835) += bcm2835-rng.o
> > diff --git a/drivers/char/hw_random/exynos-rng.c 
> > b/drivers/char/hw_random/exynos-rng.c
> > deleted file mode 100644
> > index 23d358553b21..
> > --- a/drivers/char/hw_random/exynos-rng.c
> > +++ /dev/null
> > @@ -1,231 +0,0 @@
> > -/*
> > - * exynos-rng.c - Random Number Generator driver for the exynos
> > - *
> > - * Copyright (C) 2012 Samsung Electronics
> > - * Jonghwa Lee 
> > - *
> > - * This program is free software; you can redistribute it and/or modify
> > - * it under the terms of the GNU General Public License as published by
> > - * the Free Software Foundation;
> > - *
> > - * This progr

Re: [PATCH v3 1/3] crypto: hw_random - Add new Exynos RNG driver

2017-03-26 Thread Stephan Müller
Am Sonntag, 26. März 2017, 18:01:26 CEST schrieb Krzysztof Kozlowski:

Hi Krzysztof,

> > > +   if (slen < EXYNOS_RNG_SEED_SIZE) {
> > > +   dev_warn(rng->dev, "Seed too short (only %u bytes)\n",
> > > slen); +   return -EINVAL;
> > > +   }
> > 
> > Will it be helpful to print the required seed size?
> 
> It is in /proc/crypto... It is not a problem to print it but isn't that
> redundant?

You also get the information from crypto_user.

See [1] for a user space API.

[1] https://github.com/smuellerDD/libkcapi/commit/
f856e8c655b7e5c53f59ef8c5754ad59b196df08


Ciao
Stephan


Re: [PATCH v2] Documentation: Input: Add uinput documentation

2017-03-26 Thread Marcos Paulo de Souza
On Fri, Mar 24, 2017 at 02:39:13PM +1000, Peter Hutterer wrote:
> as usual, reading through these things multiple times means one spots a
> couple of different things. sorry about that.
> 
> On Fri, Mar 24, 2017 at 12:34:59AM -0300, Marcos Paulo de Souza wrote:
> > Signed-off-by: Marcos Paulo de Souza 
> > ---
> >  Documentation/input/uinput.rst | 196 
> > +
> >  1 file changed, 196 insertions(+)
> >  create mode 100644 Documentation/input/uinput.rst
> > 
> > diff --git a/Documentation/input/uinput.rst b/Documentation/input/uinput.rst
> > new file mode 100644
> > index 000..eb79b77
> > --- /dev/null
> > +++ b/Documentation/input/uinput.rst
> > @@ -0,0 +1,196 @@
> > +=
> > +uinput module
> > +=
> > +
> > +Introduction
> > +
> > +
> > +uinput is a kernel module that makes possible to create and handle input 
> > devices
> 
> typo: makes *it* possible.
> 
> replace "to create and handle" with "to emulate", the rest is in the next
> sentence anyway

Fixed.

> 
> > +from userspace. By writing to the module's /dev/uinput (or 
> > /dev/input/uinput), a
> > +process can create a virtual device with specific capabilities.
> > +Once created, the process can send events through that virtual device.
> > +
> > +Interface
> > +=
> > +
> > +::
> > +
> > +  linux/uinput.h
> > +
> > +The uinput header defines ioctls to create, setup and destroy virtual 
> > devices.
> > +
> > +libevdev
> > +
> > +
> > +libevdev is a wrapper library for evdev devices, making uinput setup easier
> > +by skipping a lot of ioctl calls. When dealing with uinput, libevdev is 
> > the best
> > +alternative over accessing uinput directly, and it is less error prone.
> 
> "libevdev is a wrapper library for evdev devices that provides interfaces to
> create uinput devices and send events. libevdev is less error-prone than
> accessing uinput directly and should be considered for new software".

Much better. Fixed.

> 
> > +
> > +For examples and more information about libevdev:
> > +https://cgit.freedesktop.org/libevdev
> > +
> 
> Please use https://www.freedesktop.org/software/libevdev/doc/latest/
> (which needs a link to the git repo, I'll fix that in a minute)

Fixed.

> 
> > +Examples
> > +
> > +
> > +1.0 Keyboard events
> > +---
> > +
> > +This first example shows how to create a new virtual device and how to 
> > send a
> > +key event. All default imports and error handlers were removed for the 
> > sake of
> > +simplicity.
> > +
> > +.. code-block:: c
> > +
> > +   #include 
> > +
> > +   int fd;
> > +
> > +   void emit(int type, int code, int val)
> > +   {
> > +struct input_event ie;
> > +
> > +ie.type = type;
> > +ie.code = code;
> > +ie.value = val;
> > +/* below timestamp values are ignored */
> > +ie.time.tv_sec = 0;
> > +ie.time.tv_usec = 0;
> > +
> > +write(fd, &ie, sizeof(ie));
> > +   }
> > +
> > +   int main() {
> > +struct uinput_setup usetup;
> > +
> > +fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);
> > +
> > +/* the ioctls below enables the to be created device to key
> > + * events, in this case the space key
> > + **/
> 
> the comment terminator doesn't look right

Fixed.

> 
> > +ioctl(fd, UI_SET_EVBIT, EV_KEY);
> > +ioctl(fd, UI_SET_KEYBIT, KEY_SPACE);
> > +
> > +memset(&usetup, 0, sizeof(usetup));
> > +usetup.id.bustype = BUS_USB;
> > +usetup.id.vendor = 0x1234; /* sample vendor */
> 
> add a sample product id too please
Added.

> 
> > +strcpy(usetup.name, "Example device");
> > +
> > +ioctl(fd, UI_DEV_SETUP, &usetup);
> > +ioctl(fd, UI_DEV_CREATE);
> > +
> > +/* UI_DEV_CREATE causes the kernel to create the device nodes for 
> > this
> 
> "On UI_DEV_CREATE the kernel creates the device nodes..."
Fixed.

> 
> > + * device. Insert a pause so that userspace has time to detect,
> > + * initialize the new device, and can start to listen to events 
> > from
> > + * this device
> > + **/
> 
> the comment terminator doesn't look right
> 
> note: the actual pause is missing now :)

I thought you wanted just the warning, but ok, I added back the sleep
call :)

> 
> > +
> > +/* key press, report the event, send key release, and report again 
> > */
> > +emit(EV_KEY, KEY_SPACE, 1);
> > +emit(EV_SYN, SYN_REPORT, 0);
> > +emit(EV_KEY, KEY_SPACE, 0);
> > +emit(EV_SYN, SYN_REPORT, 0);
> 
> come to think of it, you probably need a pause here too, iirc a caller may
> get ENODEV before reading the key events otherwise.

We need a sleep call after each emitted event?

> 
> > +
> > +ioctl(fd, UI_DEV_DESTROY);
> > +close(fd);
> > +
> > +return 0;
> > +   }
> > +
> > +2.0 Mouse movements
> > +---
> > +
> > +This example shows how to create a vi

[PATCH] cgroup: switch to BUG_ON()

2017-03-26 Thread Nicholas Mc Guire
Use BUG_ON() rather than an explicit if followed by BUG() for 
improved readability and also consistency.

Signed-off-by: Nicholas Mc Guire 
---

Found by coccinelle: bugon.cocci
./kernel/cgroup/cpuset.c:2125:2-5: WARNING: Use BUG_ON instead of if condition 
followed by BUG.
./kernel/cgroup/cpuset.c:2127:2-5: WARNING: Use BUG_ON instead of if condition 
followed by BUG.
./kernel/cgroup/cpuset.c:2143:2-5: WARNING: Use BUG_ON instead of if condition 
followed by BUG.

BUG_ON() wraps the explicit if condition and is actually in use for
all conditional BUG() cases in cpuset.c except in this one function.

Patch was compile-tested with: x86_64_defconfig (implies CONFIG_CPUSETS=y)
(checkpatch warnings for this patch seem to be false-positives - the 
 BUG_ON should be fine)

Patch is against 4.11-rc3 (localversion-next is next-20170324)

 kernel/cgroup/cpuset.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 0f41292..8b84db2 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2121,10 +2121,8 @@ int __init cpuset_init(void)
 {
int err = 0;
 
-   if (!alloc_cpumask_var(&top_cpuset.cpus_allowed, GFP_KERNEL))
-   BUG();
-   if (!alloc_cpumask_var(&top_cpuset.effective_cpus, GFP_KERNEL))
-   BUG();
+   BUG_ON(!alloc_cpumask_var(&top_cpuset.cpus_allowed, GFP_KERNEL));
+   BUG_ON(!alloc_cpumask_var(&top_cpuset.effective_cpus, GFP_KERNEL));
 
cpumask_setall(top_cpuset.cpus_allowed);
nodes_setall(top_cpuset.mems_allowed);
@@ -2139,8 +2137,7 @@ int __init cpuset_init(void)
if (err < 0)
return err;
 
-   if (!alloc_cpumask_var(&cpus_attach, GFP_KERNEL))
-   BUG();
+   BUG_ON(!alloc_cpumask_var(&cpus_attach, GFP_KERNEL));
 
return 0;
 }
-- 
2.1.4



Re: [PATCH v4] tpm_crb: request and relinquish locality 0

2017-03-26 Thread Jerry Snitselaar


- Original Message -
> From: "Jarkko Sakkinen" 
> To: "Jerry Snitselaar" , "gang wei" 
> Cc: "Jarkko Sakkinen" , 
> tpmdd-de...@lists.sourceforge.net,
> linux-security-mod...@vger.kernel.org, "Peter Huewe" , 
> "Marcel Selhorst" ,
> "Jason Gunthorpe" , "open list" 
> 
> Sent: Sunday, March 26, 2017 3:52:39 AM
> Subject: Re: [PATCH v4] tpm_crb: request and relinquish locality 0
> 
> On Sat, Mar 25, 2017 at 09:52:11PM +0200, Jarkko Sakkinen wrote:
> > On Fri, Mar 24, 2017 at 11:25:57AM -0700, Jerry Snitselaar wrote:
> > > 
> > > Jarkko Sakkinen @ 2017-03-24 10:10 GMT:
> > > 
> > > > This commit adds support for requesting and relinquishing locality 0 in
> > > > tpm_crb for the course of command transmission.
> > > >
> > > > In order to achieve this, two new callbacks are added to struct
> > > > tpm_class_ops:
> > > >
> > > > - request_locality
> > > > - relinquish_locality
> > > >
> > > > With CRB interface you first set either requestAccess or relinquish bit
> > > > from TPM_LOC_CTRL_x register and then wait for locAssigned and
> > > > tpmRegValidSts bits to be set in the TPM_LOC_STATE_x register.
> > > >
> > > > The reason why were are doing this is to make sure that the driver
> > > > will work properly with Intel TXT that uses locality 2. There's no
> > > > explicit guarantee that it would relinquish this locality. In more
> > > > general sense this commit enables tpm_crb to be a well behaving
> > > > citizen in a multi locality environment.
> > > >
> > > > Signed-off-by: Jarkko Sakkinen 
> > > 
> > > Reviewed-by: Jerry Snitselaar 
> > > Tested-by: Jerry Snitselaar 
> > > 
> > > Tested on kabylake system that was hitting issues with earlier
> > > iteration. Still don't have platform to test it dealing with
> > > multi-locality enviroment.
> > 
> > I believe Jimmy (Gang Wei) has done such testing. Jimmy can you confirm
> > and possibly do re-test (there's a locality branch in my tree to ease
> > the testing) so that we could land this one?
> > 
> > /Jarkko
> 
> I applied this to my master and next branches.
> 
> /Jarkko
> 

Hi Jarkko,

The patch applied to next and master doesn't have the assignment moved
inside the mutex.


Re: [PATCH v4 14/36] [media] v4l2-mc: add a function to inherit controls from a pipeline

2017-03-26 Thread Laurent Pinchart
Hi Hans,

On Tuesday 14 Mar 2017 08:55:36 Hans Verkuil wrote:
> On 03/14/2017 04:45 AM, Mauro Carvalho Chehab wrote:
> > Hi Sakari,
> > 
> > I started preparing a long argument about it, but gave up in favor of a
> > simpler one.
> > 
> > Em Mon, 13 Mar 2017 14:46:22 +0200 Sakari Ailus escreveu:
> >> Drivers are written to support hardware, not particular use case.
> > 
> > No, it is just the reverse: drivers and hardware are developed to
> > support use cases.
> > 
> > Btw, you should remember that the hardware is the full board, not just the
> > SoC. In practice, the board do limit the use cases: several provide a
> > single physical CSI connector, allowing just one sensor.
> > 
> >>> This situation is there since 2009. If I remember well, you tried to
> >>> write such generic plugin in the past, but never finished it, apparently
> >>> because it is too complex. Others tried too over the years.
> >> 
> >> I'd argue I know better what happened with that attempt than you do. I
> >> had a prototype of a generic pipeline configuration library but due to
> >> various reasons I haven't been able to continue working on that since
> >> around 2012.
> > ...
> > 
> >>> The last trial was done by Jacek, trying to cover just the exynos4
> >>> driver. Yet, even such limited scope plugin was not good enough, as it
> >>> was never merged upstream. Currently, there's no such plugins upstream.
> >>> 
> >>> If we can't even merge a plugin that solves it for just *one* driver,
> >>> I have no hope that we'll be able to do it for the generic case.
> >> 
> >> I believe Jacek ceased to work on that plugin in his day job; other than
> >> that, there are some matters left to be addressed in his latest patchset.
> > 
> > The two above basically summaries the issue: the task of doing a generic
> > plugin on userspace, even for a single driver is complex enough to
> > not cover within a reasonable timeline.
> > 
> > From 2009 to 2012, you were working on it, but didn't finish it.
> > 
> > Apparently, nobody worked on it between 2013-2014 (but I may be wrong, as
> > I didn't check when the generic plugin interface was added to libv4l).
> > 
> > In the case of Jacek's work, the first patch I was able to find was
> > 
> > written in Oct, 2014:
> > https://patchwork.kernel.org/patch/5098111/
> > (not sure what happened with the version 1).
> > 
> > The last e-mail about this subject was issued in Dec, 2016.
> > 
> > In summary, you had this on your task for 3 years for an OMAP3
> > plugin (where you have a good expertise), and Jacek for 2 years,
> > for Exynos 4, where he should also have a good knowledge.
> > 
> > Yet, with all that efforts, no concrete results were achieved, as none
> > of the plugins got merged.
> > 
> > Even if they were merged, if we keep the same mean time to develop a
> > libv4l plugin, that would mean that a plugin for i.MX6 could take 2-3
> > years to be developed.
> > 
> > There's a clear message on it:
> > - we shouldn't keep pushing for a solution via libv4l.
> 
> Or:
>   - userspace plugin development had a very a low priority and
> never got the attention it needed.
>
> I know that's *my* reason. I rarely if ever looked at it. I always assumed
> Sakari and/or Laurent would look at it. If this reason is also valid for
> Sakari and Laurent, then it is no wonder nothing has happened in all that
> time.

The reason is also valid for me. I'd really love to work on the userspace 
side, but I just can't find time at the moment.

> We're all very driver-development-driven, and userspace gets very little
> attention in general. So before just throwing in the towel we should take
> a good look at the reasons why there has been little or no development: is
> it because of fundamental design defects, or because nobody paid attention
> to it?
> 
> I strongly suspect it is the latter.
> 
> In addition, I suspect end-users of these complex devices don't really care
> about a plugin: they want full control and won't typically use generic
> applications. If they would need support for that, we'd have seen much more
> interest. The main reason for having a plugin is to simplify testing and
> if this is going to be used on cheap hobbyist devkits.
> 
> An additional complication is simply that it is hard to find fully supported
> MC hardware. omap3 boards are hard to find these days, renesas boards are
> not easy to get, freescale isn't the most popular either. Allwinner,
> mediatek, amlogic, broadcom and qualcomm all have closed source
> implementations or no implementation at all.
> 
> I know it took me a very long time before I had a working omap3.
> 
> So I am not at all surprised that little progress has been made.

-- 
Regards,

Laurent Pinchart



Re: [PATCH v3 1/3] crypto: hw_random - Add new Exynos RNG driver

2017-03-26 Thread PrasannaKumar Muralidharan
On 26 March 2017 at 21:31, Krzysztof Kozlowski  wrote:
> On Sun, Mar 26, 2017 at 08:50:42PM +0530, PrasannaKumar Muralidharan wrote:
>> .Have some minor comments. Please feel free to correct if I am wrong.
>>
>> On 25 March 2017 at 21:56, Krzysztof Kozlowski  wrote:
>> > diff --git a/drivers/crypto/exynos-rng.c b/drivers/crypto/exynos-rng.c
>> > new file mode 100644
>> > index ..d657b6243d0a
>> > --- /dev/null
>> > +++ b/drivers/crypto/exynos-rng.c
>> > @@ -0,0 +1,390 @@
>> > +/*
>> > + * exynos-rng.c - Random Number Generator driver for the Exynos
>> > + *
>> > + * Copyright (c) 2017 Krzysztof Kozlowski 
>> > + *
>> > + * Loosely based on old driver from drivers/char/hw_random/exynos-rng.c:
>> > + * Copyright (C) 2012 Samsung Electronics
>> > + * Jonghwa Lee 
>> > + *
>> > + * This program is free software; you can redistribute it and/or modify
>> > + * it under the terms of the GNU General Public License as published by
>> > + * the Free Software Foundation;
>> > + *
>> > + * This program is distributed in the hope that it will be useful,
>> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> > + * GNU General Public License for more details.
>> > + */
>> > +
>> > +#include 
>> > +#include 
>> > +#include 
>> > +#include 
>> > +#include 
>> > +#include 
>> > +
>> > +#include 
>> > +
>> > +#define EXYNOS_RNG_CONTROL 0x0
>> > +#define EXYNOS_RNG_STATUS  0x10
>> > +#define EXYNOS_RNG_SEED_BASE   0x140
>> > +#define EXYNOS_RNG_SEED(n) (EXYNOS_RNG_SEED_BASE + (n * 0x4))
>> > +#define EXYNOS_RNG_OUT_BASE0x160
>> > +#define EXYNOS_RNG_OUT(n)  (EXYNOS_RNG_OUT_BASE + (n * 0x4))
>> > +
>> > +/* EXYNOS_RNG_CONTROL bit fields */
>> > +#define EXYNOS_RNG_CONTROL_START   0x18
>> > +/* EXYNOS_RNG_STATUS bit fields */
>> > +#define EXYNOS_RNG_STATUS_SEED_SETTING_DONEBIT(1)
>> > +#define EXYNOS_RNG_STATUS_RNG_DONE BIT(5)
>> > +
>> > +/* Five seed and output registers, each 4 bytes */
>> > +#define EXYNOS_RNG_SEED_REGS   5
>> > +#define EXYNOS_RNG_SEED_SIZE   (EXYNOS_RNG_SEED_REGS * 4)
>> > +
>> > +/*
>> > + * Driver re-seeds itself with generated random numbers to increase
>> > + * the randomness.
>> > + *
>> > + * Time for next re-seed in ms.
>> > + */
>> > +#define EXYNOS_RNG_RESEED_TIME 100
>> > +/*
>> > + * In polling mode, do not wait infinitely for the engine to finish the 
>> > work.
>> > + */
>> > +#define EXYNOS_RNG_WAIT_RETRIES100
>> > +
>> > +/* Context for crypto */
>> > +struct exynos_rng_ctx {
>> > +   struct exynos_rng_dev   *rng;
>> > +};
>>
>> Is exynos_rng_ctx really necessary? Can't exynos_rng_dev be used directly?
>>
>
> I couldn't find a way to pass an instance of exynos_rng_dev to
> generate() and seed() calls.

While registering rng, sizeof exynos_rng_ctx is provided. Assumed that
the space allocated can be used instead of storing a reference to it.
Looking at crypto/rng.c I understand it could not be used.

>> > +/* Device associated memory */
>> > +struct exynos_rng_dev {
>> > +   struct device   *dev;
>> > +   struct exynos_rng_ctx   *ctx;
>> > +   void __iomem*mem;
>> > +   struct clk  *clk;
>> > +   /* Generated numbers stored for seeding during resume */
>> > +   u8  seed_save[EXYNOS_RNG_SEED_SIZE];
>> > +   unsigned intseed_save_len;
>> > +   /* Time of last seeding in jiffies */
>> > +   unsigned long   last_seeding;
>> > +};
>>
>> Wondering if storing 'ctx' is really necessary. Can that be eliminated?
>
> Yes, it can.
>
>> > +static struct exynos_rng_dev *exynos_rng_dev;
>>
>> Having an instance of exynos_rng_dev makes this driver to work with
>> only 1 rng hardware block. Is this desired?
>
> First of all, there is only one hardware block. ioremap_resource also
> ensures that. Second of all, how would you like to pass the
> platform device specific data to crypto calls?

Understood. See above.

>> Also having an instance of exynos_rng_dev seems unnecessary. Can it be 
>> removed?
>
> Why do you think it is unnecessary?

See above.

>>
>> > +static u32 exynos_rng_readl(struct exynos_rng_dev *rng, u32 offset)
>> > +{
>> > +   return readl_relaxed(rng->mem + offset);
>> > +}
>> > +
>> > +static void exynos_rng_writel(struct exynos_rng_dev *rng, u32 val, u32 
>> > offset)
>> > +{
>> > +   writel_relaxed(val, rng->mem + offset);
>> > +}
>> > +
>> > +static int exynos_rng_set_seed(struct exynos_rng_dev *rng,
>> > +  const u8 *seed, unsigned int slen)
>> > +{
>> > +   u32 val;
>> > +   int i;
>> > +
>> > +   dev_dbg(rng->dev, "Seeding with %u bytes\n", slen);
>>
>> This log can be put after the 'slen < EXYNOS_RNG_SEED_SIZE' condition check.
>
> It c

[PATCH v3] Adding uinput documentation

2017-03-26 Thread Marcos Paulo de Souza
Hi all,

this is the third version of the patchset, solved some typos and suggestions 
from
Peter and Jon Corbet.

Thanks for the suggestions. I hope this version is better than the last one.

Marcos Paulo de Souza (1):
  Documentation: Input: Add uinput documentation

 Documentation/input/uinput.rst | 207 +
 1 file changed, 207 insertions(+)
 create mode 100644 Documentation/input/uinput.rst

-- 
2.9.3



[PATCH v3] Documentation: Input: Add uinput documentation

2017-03-26 Thread Marcos Paulo de Souza
Signed-off-by: Marcos Paulo de Souza 
---
 v2 -> v3:
 Changes in libevdev's description (suggested by Peter)
 Added uinput version check when using the old interface (suggested by Peter)
 Removed section numbers from sections, sphinx creates these indexes
(suggestion by Jon)

 v1 -> v2:
 Changes all over the place, including better descriptions (suggested by Peter)
 Added comments about the need of a sleep call (suggested by Peter)
 

 Documentation/input/uinput.rst | 207 +
 1 file changed, 207 insertions(+)
 create mode 100644 Documentation/input/uinput.rst

diff --git a/Documentation/input/uinput.rst b/Documentation/input/uinput.rst
new file mode 100644
index 000..f606989
--- /dev/null
+++ b/Documentation/input/uinput.rst
@@ -0,0 +1,207 @@
+=
+uinput module
+=
+
+Introduction
+
+
+uinput is a kernel module that makes it possible to emulate input devices from
+userspace. By writing to the module's /dev/uinput (or /dev/input/uinput), a
+process can create a virtual device with specific capabilities.
+Once created, the process can send events through that virtual device.
+
+Interface
+=
+
+::
+
+  linux/uinput.h
+
+The uinput header defines ioctls to create, setup and destroy virtual devices.
+
+libevdev
+
+
+libevdev is a wrapper library for evdev devices that provides interfaces to
+create uinput devices and send events. libevdev is less error-prone than
+accessing uinput directly and should be considered for new software
+
+For examples and more information about libevdev:
+https://www.freedesktop.org/software/libevdev/doc/latest/
+
+Examples
+
+
+Keyboard events
+---
+
+This first example shows how to create a new virtual device and how to send a
+key event. All default imports and error handlers were removed for the sake of
+simplicity.
+
+.. code-block:: c
+
+   #include 
+
+   int fd;
+
+   void emit(int type, int code, int val)
+   {
+struct input_event ie;
+
+ie.type = type;
+ie.code = code;
+ie.value = val;
+/* below timestamp values are ignored */
+ie.time.tv_sec = 0;
+ie.time.tv_usec = 0;
+
+write(fd, &ie, sizeof(ie));
+   }
+
+   int main() {
+struct uinput_setup usetup;
+
+fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);
+
+/* the ioctls below enables the to be created device to key
+ * events, in this case the space key
+ */
+ioctl(fd, UI_SET_EVBIT, EV_KEY);
+ioctl(fd, UI_SET_KEYBIT, KEY_SPACE);
+
+memset(&usetup, 0, sizeof(usetup));
+usetup.id.bustype = BUS_USB;
+usetup.id.vendor = 0x1234; /* sample vendor */
+usetup.id.product = 0x5678; /* sample product */
+strcpy(usetup.name, "Example device");
+
+ioctl(fd, UI_DEV_SETUP, &usetup);
+ioctl(fd, UI_DEV_CREATE);
+
+/*
+ * On UI_DEV_CREATE the kernel creates the device nodes for this 
device.
+ * Insert a pause so that userspace has time to detect, initialize the
+ * new device, and can start to listen to events from this device
+ */
+sleep(1);
+
+/* key press, report the event, send key release, and report again */
+emit(EV_KEY, KEY_SPACE, 1);
+emit(EV_SYN, SYN_REPORT, 0);
+emit(EV_KEY, KEY_SPACE, 0);
+emit(EV_SYN, SYN_REPORT, 0);
+
+ioctl(fd, UI_DEV_DESTROY);
+close(fd);
+
+return 0;
+   }
+
+Mouse movements
+---
+
+This example shows how to create a virtual device that behaves like a physical
+mouse.
+
+.. code-block:: c
+
+#include 
+
+/* emit function is identical to of the first example */
+
+struct uinput_setup usetup;
+int i = 50;
+
+fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);
+
+/* enable mouse button left and relative events */
+ioctl(fd, UI_SET_EVBIT, EV_KEY);
+ioctl(fd, UI_SET_KEYBIT, BTN_LEFT);
+
+ioctl(fd, UI_SET_EVBIT, EV_REL);
+ioctl(fd, UI_SET_RELBIT, REL_X);
+ioctl(fd, UI_SET_RELBIT, REL_Y);
+
+memset(&usetup, 0, sizeof(usetup));
+usetup.id.bustype = BUS_USB;
+usetup.id.vendor = 0x1234; /* sample vendor */
+usetup.id.product = 0x5678; /* sample product */
+strcpy(usetup.name, "Example device");
+
+ioctl(fd, UI_DEV_SETUP, &usetup);
+ioctl(fd, UI_DEV_CREATE);
+
+/*
+ * On UI_DEV_CREATE the kernel creates the device nodes for this device.
+ * Insert a pause so that userspace has time to detect, initialize the
+ * new device, and can start to listen to events from this device
+ */
+sleep(1);
+
+/* moves the mouse diagonally, 5 units per axis */
+while (i--) {
+emit(EV_REL, REL_X, 5);
+emit(EV_REL, REL_Y, 5);
+emit(EV_SYN, SYN_REPORT, 0);
+usleep(15000);
+}
+
+ioctl(fd, UI_DEV_DESTROY);
+close(fd);
+
+return 0;
+
+uinput old interface
+
+
+Be

Re: [RFC v5 1/9] sched/deadline: track the active utilization

2017-03-26 Thread Mathieu Poirier
Hello Luca,

On 23 March 2017 at 21:52, luca abeni  wrote:
> From: Luca Abeni 
>
> Active utilization is defined as the total utilization of active
> (TASK_RUNNING) tasks queued on a runqueue. Hence, it is increased
> when a task wakes up and is decreased when a task blocks.
>
> When a task is migrated from CPUi to CPUj, immediately subtract the
> task's utilization from CPUi and add it to CPUj. This mechanism is
> implemented by modifying the pull and push functions.
> Note: this is not fully correct from the theoretical point of view
> (the utilization should be removed from CPUi only at the 0 lag
> time), a more theoretically sound solution will follow.
>
> Signed-off-by: Juri Lelli 
> Signed-off-by: Luca Abeni 
> Tested-by: Daniel Bristot de Oliveira 
> ---
>  kernel/sched/deadline.c | 61 
> ++---
>  kernel/sched/sched.h|  6 +
>  2 files changed, 64 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index a2ce590..cef9adb 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -43,6 +43,28 @@ static inline int on_dl_rq(struct sched_dl_entity *dl_se)
> return !RB_EMPTY_NODE(&dl_se->rb_node);
>  }
>
> +static inline
> +void add_running_bw(u64 dl_bw, struct dl_rq *dl_rq)
> +{
> +   u64 old = dl_rq->running_bw;
> +
> +   lockdep_assert_held(&(rq_of_dl_rq(dl_rq))->lock);
> +   dl_rq->running_bw += dl_bw;
> +   SCHED_WARN_ON(dl_rq->running_bw < old); /* overflow */
> +}
> +
> +static inline
> +void sub_running_bw(u64 dl_bw, struct dl_rq *dl_rq)
> +{
> +   u64 old = dl_rq->running_bw;
> +
> +   lockdep_assert_held(&(rq_of_dl_rq(dl_rq))->lock);
> +   dl_rq->running_bw -= dl_bw;
> +   SCHED_WARN_ON(dl_rq->running_bw > old); /* underflow */
> +   if (dl_rq->running_bw > old)
> +   dl_rq->running_bw = 0;
> +}
> +
>  static inline int is_leftmost(struct task_struct *p, struct dl_rq *dl_rq)
>  {
> struct sched_dl_entity *dl_se = &p->dl;
> @@ -946,8 +968,12 @@ enqueue_dl_entity(struct sched_dl_entity *dl_se,
>  * parameters of the task might need updating. Otherwise,
>  * we want a replenishment of its runtime.
>  */
> -   if (flags & ENQUEUE_WAKEUP)
> +   if (flags & ENQUEUE_WAKEUP) {
> +   struct dl_rq *dl_rq = dl_rq_of_se(dl_se);
> +
> +   add_running_bw(dl_se->dl_bw, dl_rq);
> update_dl_entity(dl_se, pi_se);
> +   }

What do we do for tasks that go from normal to dl?  Unless I'm
mistaking their utilisation won't be accounted for when they are first
enqueued.

> else if (flags & ENQUEUE_REPLENISH)
> replenish_dl_entity(dl_se, pi_se);
>
> @@ -998,14 +1024,25 @@ static void enqueue_task_dl(struct rq *rq, struct 
> task_struct *p, int flags)
> if (!p->dl.dl_throttled && dl_is_constrained(&p->dl))
> dl_check_constrained_dl(&p->dl);
>
> +   if (p->on_rq == TASK_ON_RQ_MIGRATING || flags & ENQUEUE_RESTORE)
> +   add_running_bw(p->dl.dl_bw, &rq->dl);
> +
> /*
> -* If p is throttled, we do nothing. In fact, if it exhausted
> +* If p is throttled, we do not enqueue it. In fact, if it exhausted
>  * its budget it needs a replenishment and, since it now is on
>  * its rq, the bandwidth timer callback (which clearly has not
>  * run yet) will take care of this.
> +* However, the active utilization does not depend on the fact
> +* that the task is on the runqueue or not (but depends on the
> +* task's state - in GRUB parlance, "inactive" vs "active 
> contending").
> +* In other words, even if a task is throttled its utilization must
> +* be counted in the active utilization; hence, we need to call
> +* add_running_bw().
>  */
> -   if (p->dl.dl_throttled && !(flags & ENQUEUE_REPLENISH))
> +   if (p->dl.dl_throttled && !(flags & ENQUEUE_REPLENISH)) {
> +   add_running_bw(p->dl.dl_bw, &rq->dl);
> return;
> +   }
>
> enqueue_dl_entity(&p->dl, pi_se, flags);
>
> @@ -1023,6 +1060,20 @@ static void dequeue_task_dl(struct rq *rq, struct 
> task_struct *p, int flags)
>  {
> update_curr_dl(rq);
> __dequeue_task_dl(rq, p, flags);
> +
> +   if (p->on_rq == TASK_ON_RQ_MIGRATING || flags & DEQUEUE_SAVE)
> +   sub_running_bw(p->dl.dl_bw, &rq->dl);
> +
> +   /*
> +* This check allows to decrease the active utilization in two cases:
> +* when the task blocks and when it is terminating
> +* (p->state == TASK_DEAD). We can handle the two cases in the same
> +* way, because from GRUB's point of view the same thing is happening
> +* (the task moves from "active contending" to "active non contending"
> +* or "inactive")
> +*/
> +   if (flags & DEQUEUE_SLEEP)
> +   sub_runni

Re: [PATCH v3 1/3] crypto: hw_random - Add new Exynos RNG driver

2017-03-26 Thread Stephan Müller
Am Sonntag, 26. März 2017, 18:46:02 CEST schrieb PrasannaKumar Muralidharan:

Hi  Krzysztof,

> >> > +   if (slen < EXYNOS_RNG_SEED_SIZE) {
> >> > +   dev_warn(rng->dev, "Seed too short (only %u bytes)\n",
> >> > slen); +   return -EINVAL;
> >> > +   }
> >> 
> >> Will it be helpful to print the required seed size?
> > 
> > It is in /proc/crypto... It is not a problem to print it but isn't that
> > redundant?
> 
> Not necessary if it is already available.

Maybe the dev_warn should be removed. Note, unprivileged user space can 
trigger this warning by simply invoking the seeding operation over and over 
again with an insufficient seed size. This would clutter the log.

Ciao
Stephan


Re: [PATCH v3 1/3] crypto: hw_random - Add new Exynos RNG driver

2017-03-26 Thread Stephan Müller
Am Samstag, 25. März 2017, 17:26:52 CEST schrieb Krzysztof Kozlowski:

Hi Krzysztof,

> +static int exynos_rng_set_seed(struct exynos_rng_dev *rng,
> +const u8 *seed, unsigned int slen)
> +{
> + u32 val;
> + int i;
> +
> + dev_dbg(rng->dev, "Seeding with %u bytes\n", slen);
> +
> + if (slen < EXYNOS_RNG_SEED_SIZE) {
> + dev_warn(rng->dev, "Seed too short (only %u bytes)\n", slen);
> + return -EINVAL;
> + }
> +
> + for (i = 0 ; i < EXYNOS_RNG_SEED_REGS ; i++) {
> + val = seed[i * 4] << 24;
> + val |= seed[i * 4 + 1] << 16;
> + val |= seed[i * 4 + 2] << 8;
> + val |= seed[i * 4 + 3] << 0;
> +
> + exynos_rng_writel(rng, val, EXYNOS_RNG_SEED(i));
> + }

Would it make sense to add another outer loop here to allow all of slen to be 
injected into the DRNG? Note, in some cases, a user wants to add more seed 
into the DRNG than the actual seed size. In this case, the DRNG acts as a 
compression operation of entropy. This is used when the entropy-to-data ratio 
is not 1:1. In a lot of cases, users have a seed which has less entropy in 
bits per data bit.

Ciao
Stephan


[PATCH v2 6/8] ARM64: dts: meson-gxbb: add spdif output pins

2017-03-26 Thread Jerome Brunet
Add EE and AO domains pins for the spdif output to the gxbb device tree.

Acked-by: Kevin Hilman 
Signed-off-by: Jerome Brunet 
---
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 21 +
 1 file changed, 21 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
index a9cacbd6a1d6..d1dc6a49df13 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
@@ -234,6 +234,20 @@
function = "i2s_out_ao";
};
};
+
+   spdif_out_ao_6_pins: spdif_out_ao_6 {
+   mux {
+   groups = "spdif_out_ao_6";
+   function = "spdif_out_ao";
+   };
+   };
+
+   spdif_out_ao_13_pins: spdif_out_ao_13 {
+   mux {
+   groups = "spdif_out_ao_13";
+   function = "spdif_out_ao";
+   };
+   };
};
 };
 
@@ -495,6 +509,13 @@
function = "i2s_out";
};
};
+
+   spdif_out_y_pins: spdif_out_y {
+   mux {
+   groups = "spdif_out_y";
+   function = "spdif_out";
+   };
+   };
};
 };
 
-- 
2.9.3



[PATCH v2 4/8] pinctrl: meson: gxl: add spdif output pins

2017-03-26 Thread Jerome Brunet
Add EE and AO domains pins for the spdif output.

Acked-by: Kevin Hilman 
Signed-off-by: Jerome Brunet 
---
 drivers/pinctrl/meson/pinctrl-meson-gxl.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxl.c 
b/drivers/pinctrl/meson/pinctrl-meson-gxl.c
index e472213fd673..998210eacf37 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-gxl.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-gxl.c
@@ -232,6 +232,8 @@ static const unsigned int i2s_out_ch23_z_pins[] = { 
PIN(GPIOZ_5, EE_OFF) };
 static const unsigned int i2s_out_ch45_z_pins[]= { PIN(GPIOZ_6, 
EE_OFF) };
 static const unsigned int i2s_out_ch67_z_pins[]= { PIN(GPIOZ_7, 
EE_OFF) };
 
+static const unsigned int spdif_out_h_pins[]   = { PIN(GPIOH_4, EE_OFF) };
+
 static const struct pinctrl_pin_desc meson_gxl_aobus_pins[] = {
MESON_PIN(GPIOAO_0, 0),
MESON_PIN(GPIOAO_1, 0),
@@ -272,6 +274,9 @@ static const unsigned int pwm_ao_b_6_pins[] = { 
PIN(GPIOAO_6, 0) };
 static const unsigned int i2s_out_ch23_ao_pins[] = { PIN(GPIOAO_8, EE_OFF) };
 static const unsigned int i2s_out_ch45_ao_pins[] = { PIN(GPIOAO_9, EE_OFF) };
 
+static const unsigned int spdif_out_ao_6_pins[]= { PIN(GPIOAO_6, 
EE_OFF) };
+static const unsigned int spdif_out_ao_9_pins[]= { PIN(GPIOAO_9, 
EE_OFF) };
+
 static struct meson_pmx_group meson_gxl_periphs_groups[] = {
GPIO_GROUP(GPIOZ_0, EE_OFF),
GPIO_GROUP(GPIOZ_1, EE_OFF),
@@ -429,6 +434,7 @@ static struct meson_pmx_group meson_gxl_periphs_groups[] = {
GROUP(i2s_out_ao_clk,   6,  25),
GROUP(i2s_out_lr_clk,   6,  24),
GROUP(i2s_out_ch01, 6,  23),
+   GROUP(spdif_out_h,  6,  28),
 
/* Bank DV */
GROUP(uart_tx_b,2,  16),
@@ -510,6 +516,8 @@ static struct meson_pmx_group meson_gxl_aobus_groups[] = {
GROUP(pwm_ao_b, 0,  3),
GROUP(i2s_out_ch23_ao,  1,  0),
GROUP(i2s_out_ch45_ao,  1,  1),
+   GROUP(spdif_out_ao_6,   0,  16),
+   GROUP(spdif_out_ao_9,   0,  4),
 };
 
 static const char * const gpio_periphs_groups[] = {
@@ -635,6 +643,10 @@ static const char * const i2s_out_groups[] = {
"i2s_out_ch01", "i2s_out_ch23_z", "i2s_out_ch45_z", "i2s_out_ch67_z",
 };
 
+static const char * const spdif_out_groups[] = {
+   "spdif_out_h",
+};
+
 static const char * const gpio_aobus_groups[] = {
"GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", "GPIOAO_4",
"GPIOAO_5", "GPIOAO_6", "GPIOAO_7", "GPIOAO_8", "GPIOAO_9",
@@ -673,6 +685,10 @@ static const char * const i2s_out_ao_groups[] = {
"i2s_out_ch23_ao", "i2s_out_ch45_ao",
 };
 
+static const char * const spdif_out_ao_groups[] = {
+   "spdif_out_ao_6", "spdif_out_ao_9",
+};
+
 static struct meson_pmx_func meson_gxl_periphs_functions[] = {
FUNCTION(gpio_periphs),
FUNCTION(emmc),
@@ -696,6 +712,7 @@ static struct meson_pmx_func meson_gxl_periphs_functions[] 
= {
FUNCTION(hdmi_hpd),
FUNCTION(hdmi_i2c),
FUNCTION(i2s_out),
+   FUNCTION(spdif_out),
 };
 
 static struct meson_pmx_func meson_gxl_aobus_functions[] = {
@@ -708,6 +725,7 @@ static struct meson_pmx_func meson_gxl_aobus_functions[] = {
FUNCTION(pwm_ao_a),
FUNCTION(pwm_ao_b),
FUNCTION(i2s_out_ao),
+   FUNCTION(spdif_out_ao),
 };
 
 static struct meson_bank meson_gxl_periphs_banks[] = {
-- 
2.9.3



[PATCH v2 0/8] pinctrl: meson: add audio output pins

2017-03-26 Thread Jerome Brunet
This patchset adds the pinctrl definition and the related device-tree
bindings of the i2s output and spdif output pins on the meson gxbb and
gxl SoCs.

This is part of the ongoing work to bring audio output support on the
meson family. It was tested on the gxbb p200 and gxl p230.

Changes since v1: [0]
* add a few comments in the changelog
* patched rebased on pinctrl/for-next + Neil patch on missing pins [1]

[0]: https://marc.info/?i=20170323165101.29262-1-jbrunet%40baylibre.com
[1]: https://marc.info/?i=20170323104112.16558-2-narmstrong%40baylibre.com

Jerome Brunet (8):
  pinctrl: meson: gxbb: add i2s output pins
  pinctrl: meson: gxbb: add spdif output pins
  pinctrl: meson: gxl: add i2s output pins
  pinctrl: meson: gxl: add spdif output pins
  ARM64: dts: meson-gxbb: add i2s output pins
  ARM64: dts: meson-gxbb: add spdif output pins
  ARM64: dts: meson-gxl: add i2s output pins
  ARM64: dts: meson-gxl: add spdif output pins

 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 84 +
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi  | 83 
 drivers/pinctrl/meson/pinctrl-meson-gxbb.c  | 49 +
 drivers/pinctrl/meson/pinctrl-meson-gxl.c   | 49 +
 4 files changed, 265 insertions(+)

-- 
2.9.3



[PATCH v2 2/8] pinctrl: meson: gxbb: add spdif output pins

2017-03-26 Thread Jerome Brunet
Add EE and AO domains pins for the spdif output.

Acked-by: Kevin Hilman 
Signed-off-by: Jerome Brunet 
---
 drivers/pinctrl/meson/pinctrl-meson-gxbb.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c 
b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c
index b9772a124a82..9b00be15d258 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c
@@ -240,6 +240,8 @@ static const unsigned int i2s_out_ch23_y_pins[] = { 
PIN(GPIOY_8, EE_OFF) };
 static const unsigned int i2s_out_ch45_y_pins[]= { PIN(GPIOY_9, 
EE_OFF) };
 static const unsigned int i2s_out_ch67_y_pins[]= { PIN(GPIOY_10, 
EE_OFF) };
 
+static const unsigned int spdif_out_y_pins[]   = { PIN(GPIOY_12, EE_OFF) };
+
 static const struct pinctrl_pin_desc meson_gxbb_aobus_pins[] = {
MESON_PIN(GPIOAO_0, 0),
MESON_PIN(GPIOAO_1, 0),
@@ -285,6 +287,9 @@ static const unsigned int i2s_out_ch01_ao_pins[] = { 
PIN(GPIOAO_11, 0) };
 static const unsigned int i2s_out_ch23_ao_pins[] = { PIN(GPIOAO_12, 0) };
 static const unsigned int i2s_out_ch45_ao_pins[] = { PIN(GPIOAO_13, 0) };
 
+static const unsigned int spdif_out_ao_6_pins[]= { PIN(GPIOAO_6, 0) };
+static const unsigned int spdif_out_ao_13_pins[] = { PIN(GPIOAO_13, 0) };
+
 static struct meson_pmx_group meson_gxbb_periphs_groups[] = {
GPIO_GROUP(GPIOZ_0, EE_OFF),
GPIO_GROUP(GPIOZ_1, EE_OFF),
@@ -440,6 +445,7 @@ static struct meson_pmx_group meson_gxbb_periphs_groups[] = 
{
GROUP(i2s_out_ch23_y,   1,  5),
GROUP(i2s_out_ch45_y,   1,  6),
GROUP(i2s_out_ch67_y,   1,  7),
+   GROUP(spdif_out_y,  1,  9),
 
/* Bank Z */
GROUP(eth_mdio, 6,  1),
@@ -543,6 +549,8 @@ static struct meson_pmx_group meson_gxbb_aobus_groups[] = {
GROUP(i2s_out_ch01_ao,  0,  27),
GROUP(i2s_out_ch23_ao,  1,  0),
GROUP(i2s_out_ch45_ao,  1,  1),
+   GROUP(spdif_out_ao_6,   0,  16),
+   GROUP(spdif_out_ao_13,  0,  4),
 };
 
 static const char * const gpio_periphs_groups[] = {
@@ -676,6 +684,10 @@ static const char * const i2s_out_groups[] = {
"i2s_out_ch23_y", "i2s_out_ch45_y", "i2s_out_ch67_y",
 };
 
+static const char * const spdif_out_groups[] = {
+   "spdif_out_y",
+};
+
 static const char * const gpio_aobus_groups[] = {
"GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", "GPIOAO_4",
"GPIOAO_5", "GPIOAO_6", "GPIOAO_7", "GPIOAO_8", "GPIOAO_9",
@@ -723,6 +735,10 @@ static const char * const i2s_out_ao_groups[] = {
"i2s_out_ch01_ao", "i2s_out_ch23_ao", "i2s_out_ch45_ao",
 };
 
+static const char * const spdif_out_ao_groups[] = {
+   "spdif_out_ao_6", "spdif_out_ao_13",
+};
+
 static struct meson_pmx_func meson_gxbb_periphs_functions[] = {
FUNCTION(gpio_periphs),
FUNCTION(emmc),
@@ -747,6 +763,7 @@ static struct meson_pmx_func meson_gxbb_periphs_functions[] 
= {
FUNCTION(hdmi_hpd),
FUNCTION(hdmi_i2c),
FUNCTION(i2s_out),
+   FUNCTION(spdif_out),
 };
 
 static struct meson_pmx_func meson_gxbb_aobus_functions[] = {
@@ -761,6 +778,7 @@ static struct meson_pmx_func meson_gxbb_aobus_functions[] = 
{
FUNCTION(pwm_ao_a_12),
FUNCTION(pwm_ao_b),
FUNCTION(i2s_out_ao),
+   FUNCTION(spdif_out_ao),
 };
 
 static struct meson_bank meson_gxbb_periphs_banks[] = {
-- 
2.9.3



[PATCH v2 3/8] pinctrl: meson: gxl: add i2s output pins

2017-03-26 Thread Jerome Brunet
Add EE and AO domains pins for the i2s output clocks and data.
I2S output channel 6/7 on TEST_N pin is missing from this patch and will
be added later on.

Acked-by: Kevin Hilman 
Signed-off-by: Jerome Brunet 
---
 drivers/pinctrl/meson/pinctrl-meson-gxl.c | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxl.c 
b/drivers/pinctrl/meson/pinctrl-meson-gxl.c
index 6c2a15dde99f..e472213fd673 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-gxl.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-gxl.c
@@ -224,6 +224,14 @@ static const unsigned int hdmi_hpd_pins[]  = { 
PIN(GPIOH_0, EE_OFF) };
 static const unsigned int hdmi_sda_pins[]  = { PIN(GPIOH_1, EE_OFF) };
 static const unsigned int hdmi_scl_pins[]  = { PIN(GPIOH_2, EE_OFF) };
 
+static const unsigned int i2s_am_clk_pins[]= { PIN(GPIOH_6, EE_OFF) };
+static const unsigned int i2s_out_ao_clk_pins[]= { PIN(GPIOH_7, 
EE_OFF) };
+static const unsigned int i2s_out_lr_clk_pins[]= { PIN(GPIOH_8, 
EE_OFF) };
+static const unsigned int i2s_out_ch01_pins[]  = { PIN(GPIOH_9, EE_OFF) };
+static const unsigned int i2s_out_ch23_z_pins[]= { PIN(GPIOZ_5, 
EE_OFF) };
+static const unsigned int i2s_out_ch45_z_pins[]= { PIN(GPIOZ_6, 
EE_OFF) };
+static const unsigned int i2s_out_ch67_z_pins[]= { PIN(GPIOZ_7, 
EE_OFF) };
+
 static const struct pinctrl_pin_desc meson_gxl_aobus_pins[] = {
MESON_PIN(GPIOAO_0, 0),
MESON_PIN(GPIOAO_1, 0),
@@ -261,6 +269,9 @@ static const unsigned int pwm_ao_a_8_pins[] = { 
PIN(GPIOAO_8, 0) };
 static const unsigned int pwm_ao_b_pins[]  = { PIN(GPIOAO_9, 0) };
 static const unsigned int pwm_ao_b_6_pins[]= { PIN(GPIOAO_6, 0) };
 
+static const unsigned int i2s_out_ch23_ao_pins[] = { PIN(GPIOAO_8, EE_OFF) };
+static const unsigned int i2s_out_ch45_ao_pins[] = { PIN(GPIOAO_9, EE_OFF) };
+
 static struct meson_pmx_group meson_gxl_periphs_groups[] = {
GPIO_GROUP(GPIOZ_0, EE_OFF),
GPIO_GROUP(GPIOZ_1, EE_OFF),
@@ -406,11 +417,18 @@ static struct meson_pmx_group meson_gxl_periphs_groups[] 
= {
GROUP(eth_txd2, 4,  11),
GROUP(eth_txd3, 4,  10),
GROUP(pwm_c,3,  20),
+   GROUP(i2s_out_ch23_z,   3,  26),
+   GROUP(i2s_out_ch45_z,   3,  25),
+   GROUP(i2s_out_ch67_z,   3,  24),
 
/* Bank H */
GROUP(hdmi_hpd, 6,  31),
GROUP(hdmi_sda, 6,  30),
GROUP(hdmi_scl, 6,  29),
+   GROUP(i2s_am_clk,   6,  26),
+   GROUP(i2s_out_ao_clk,   6,  25),
+   GROUP(i2s_out_lr_clk,   6,  24),
+   GROUP(i2s_out_ch01, 6,  23),
 
/* Bank DV */
GROUP(uart_tx_b,2,  16),
@@ -490,6 +508,8 @@ static struct meson_pmx_group meson_gxl_aobus_groups[] = {
GROUP(pwm_ao_b_6,   0,  18),
GROUP(pwm_ao_a_8,   0,  17),
GROUP(pwm_ao_b, 0,  3),
+   GROUP(i2s_out_ch23_ao,  1,  0),
+   GROUP(i2s_out_ch45_ao,  1,  1),
 };
 
 static const char * const gpio_periphs_groups[] = {
@@ -610,6 +630,11 @@ static const char * const hdmi_i2c_groups[] = {
"hdmi_sda", "hdmi_scl",
 };
 
+static const char * const i2s_out_groups[] = {
+   "i2s_am_clk", "i2s_out_ao_clk", "i2s_out_lr_clk",
+   "i2s_out_ch01", "i2s_out_ch23_z", "i2s_out_ch45_z", "i2s_out_ch67_z",
+};
+
 static const char * const gpio_aobus_groups[] = {
"GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", "GPIOAO_4",
"GPIOAO_5", "GPIOAO_6", "GPIOAO_7", "GPIOAO_8", "GPIOAO_9",
@@ -644,6 +669,10 @@ static const char * const pwm_ao_b_groups[] = {
"pwm_ao_b", "pwm_ao_b_6",
 };
 
+static const char * const i2s_out_ao_groups[] = {
+   "i2s_out_ch23_ao", "i2s_out_ch45_ao",
+};
+
 static struct meson_pmx_func meson_gxl_periphs_functions[] = {
FUNCTION(gpio_periphs),
FUNCTION(emmc),
@@ -666,6 +695,7 @@ static struct meson_pmx_func meson_gxl_periphs_functions[] 
= {
FUNCTION(pwm_f),
FUNCTION(hdmi_hpd),
FUNCTION(hdmi_i2c),
+   FUNCTION(i2s_out),
 };
 
 static struct meson_pmx_func meson_gxl_aobus_functions[] = {
@@ -677,6 +707,7 @@ static struct meson_pmx_func meson_gxl_aobus_functions[] = {
FUNCTION(remote_input_ao),
FUNCTION(pwm_ao_a),
FUNCTION(pwm_ao_b),
+   FUNCTION(i2s_out_ao),
 };
 
 static struct meson_bank meson_gxl_periphs_banks[] = {
-- 
2.9.3



[PATCH v2 7/8] ARM64: dts: meson-gxl: add i2s output pins

2017-03-26 Thread Jerome Brunet
Add EE and AO domains pins for the i2s output clocks and data the gxl
device tree

Acked-by: Kevin Hilman 
Signed-off-by: Jerome Brunet 
---
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 62 ++
 1 file changed, 62 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
index 269458b05fd4..3dde55856234 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
@@ -160,6 +160,20 @@
function = "pwm_ao_b";
};
};
+
+   i2s_out_ch23_ao_pins: i2s_out_ch23_ao {
+   mux {
+   groups = "i2s_out_ch23_ao";
+   function = "i2s_out_ao";
+   };
+   };
+
+   i2s_out_ch45_ao_pins: i2s_out_ch45_ao {
+   mux {
+   groups = "i2s_out_ch45_ao";
+   function = "i2s_out_ao";
+   };
+   };
};
 };
 
@@ -385,6 +399,54 @@
function = "hdmi_i2c";
};
};
+
+   i2s_am_clk_pins: i2s_am_clk {
+   mux {
+   groups = "i2s_am_clk";
+   function = "i2s_out";
+   };
+   };
+
+   i2s_out_ao_clk_pins: i2s_out_ao_clk {
+   mux {
+   groups = "i2s_out_ao_clk";
+   function = "i2s_out";
+   };
+   };
+
+   i2s_out_lr_clk_pins: i2s_out_lr_clk {
+   mux {
+   groups = "i2s_out_lr_clk";
+   function = "i2s_out";
+   };
+   };
+
+   i2s_out_ch01_pins: i2s_out_ch01 {
+   mux {
+   groups = "i2s_out_ch01";
+   function = "i2s_out";
+   };
+   };
+   i2sout_ch23_z_pins: i2sout_ch23_z {
+   mux {
+   groups = "i2sout_ch23_z";
+   function = "i2s_out";
+   };
+   };
+
+   i2sout_ch45_z_pins: i2sout_ch45_z {
+   mux {
+   groups = "i2sout_ch45_z";
+   function = "i2s_out";
+   };
+   };
+
+   i2sout_ch67_z_pins: i2sout_ch67_z {
+   mux {
+   groups = "i2sout_ch67_z";
+   function = "i2s_out";
+   };
+   };
};
 
eth-phy-mux {
-- 
2.9.3



[PATCH v2 5/8] ARM64: dts: meson-gxbb: add i2s output pins

2017-03-26 Thread Jerome Brunet
Add EE and AO domains pins for the i2s output clocks and data to the gxbb
device tree.

Acked-by: Kevin Hilman 
Signed-off-by: Jerome Brunet 
---
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 63 +
 1 file changed, 63 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
index 34168a3b0dd1..a9cacbd6a1d6 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
@@ -192,6 +192,48 @@
function = "pwm_ao_b";
};
};
+
+   i2s_am_clk_pins: i2s_am_clk {
+   mux {
+   groups = "i2s_am_clk";
+   function = "i2s_out_ao";
+   };
+   };
+
+   i2s_out_ao_clk_pins: i2s_out_ao_clk {
+   mux {
+   groups = "i2s_out_ao_clk";
+   function = "i2s_out_ao";
+   };
+   };
+
+   i2s_out_lr_clk_pins: i2s_out_lr_clk {
+   mux {
+   groups = "i2s_out_lr_clk";
+   function = "i2s_out_ao";
+   };
+   };
+
+   i2s_out_ch01_ao_pins: i2s_out_ch01_ao {
+   mux {
+   groups = "i2s_out_ch01_ao";
+   function = "i2s_out_ao";
+   };
+   };
+
+   i2s_out_ch23_ao_pins: i2s_out_ch23_ao {
+   mux {
+   groups = "i2s_out_ch23_ao";
+   function = "i2s_out_ao";
+   };
+   };
+
+   i2s_out_ch45_ao_pins: i2s_out_ch45_ao {
+   mux {
+   groups = "i2s_out_ch45_ao";
+   function = "i2s_out_ao";
+   };
+   };
};
 };
 
@@ -432,6 +474,27 @@
function = "hdmi_i2c";
};
};
+
+   i2sout_ch23_y_pins: i2sout_ch23_y {
+   mux {
+   groups = "i2sout_ch23_y";
+   function = "i2s_out";
+   };
+   };
+
+   i2sout_ch45_y_pins: i2sout_ch45_y {
+   mux {
+   groups = "i2sout_ch45_y";
+   function = "i2s_out";
+   };
+   };
+
+   i2sout_ch67_y_pins: i2sout_ch67_y {
+   mux {
+   groups = "i2sout_ch67_y";
+   function = "i2s_out";
+   };
+   };
};
 };
 
-- 
2.9.3



[PATCH v2 2/6] ARM: sun7i: Convert to CCU

2017-03-26 Thread Priit Laes
Convert sun7i-a20.dtsi to new CCU driver.

Signed-off-by: Priit Laes 
---
 arch/arm/boot/dts/sun7i-a20.dtsi | 717 +++-
 1 file changed, 85 insertions(+), 632 deletions(-)

diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 2db97fc..9521194 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -47,7 +47,8 @@
 #include 
 #include 
 
-#include 
+#include 
+#include 
 #include 
 #include 
 
@@ -67,9 +68,9 @@
compatible = "allwinner,simple-framebuffer",
 "simple-framebuffer";
allwinner,pipeline = "de_be0-lcd0-hdmi";
-   clocks = <&ahb_gates 36>, <&ahb_gates 43>,
-<&ahb_gates 44>, <&de_be0_clk>,
-<&tcon0_ch1_clk>, <&dram_gates 26>;
+   clocks = <&ccu CLK_AHB_LCD0>, <&ccu CLK_AHB_HDMI1>,
+<&ccu CLK_AHB_DE_BE0>, <&ccu CLK_DE_BE0>,
+<&ccu CLK_TCON0_CH1>, <&ccu CLK_DRAM_DE_BE0>;
status = "disabled";
};
 
@@ -77,9 +78,9 @@
compatible = "allwinner,simple-framebuffer",
 "simple-framebuffer";
allwinner,pipeline = "de_be0-lcd0";
-   clocks = <&ahb_gates 36>, <&ahb_gates 44>,
-<&de_be0_clk>, <&tcon0_ch0_clk>,
-<&dram_gates 26>;
+   clocks = <&ccu CLK_AHB_LCD0>, <&ccu CLK_AHB_DE_BE0>,
+<&ccu CLK_DE_BE0>, <&ccu CLK_TCON0_CH0>,
+<&ccu CLK_DRAM_DE_BE0>;
status = "disabled";
};
 
@@ -87,10 +88,10 @@
compatible = "allwinner,simple-framebuffer",
 "simple-framebuffer";
allwinner,pipeline = "de_be0-lcd0-tve0";
-   clocks = <&ahb_gates 34>, <&ahb_gates 36>,
-<&ahb_gates 44>,
-<&de_be0_clk>, <&tcon0_ch1_clk>,
-<&dram_gates 5>, <&dram_gates 26>;
+   clocks = <&ccu CLK_AHB_TVE0>, <&ccu CLK_AHB_LCD0>,
+<&ccu CLK_AHB_DE_BE0>,
+<&ccu CLK_DE_BE0>, <&ccu CLK_TCON0_CH1>,
+<&ccu CLK_DRAM_TVE0>, <&ccu CLK_DRAM_DE_BE0>;
status = "disabled";
};
};
@@ -103,7 +104,7 @@
compatible = "arm,cortex-a7";
device_type = "cpu";
reg = <0>;
-   clocks = <&cpu>;
+   clocks = <&ccu CLK_CPU>;
clock-latency = <244144>; /* 8 32k periods */
operating-points = <
/* kHzuV */
@@ -184,21 +185,11 @@
 
osc24M: clk@01c20050 {
#clock-cells = <0>;
-   compatible = "allwinner,sun4i-a10-osc-clk";
-   reg = <0x01c20050 0x4>;
+   compatible = "fixed-clock";
clock-frequency = <2400>;
clock-output-names = "osc24M";
};
 
-   osc3M: osc3M_clk {
-   #clock-cells = <0>;
-   compatible = "fixed-factor-clock";
-   clock-div = <8>;
-   clock-mult = <1>;
-   clocks = <&osc24M>;
-   clock-output-names = "osc3M";
-   };
-
osc32k: clk@0 {
#clock-cells = <0>;
compatible = "fixed-clock";
@@ -206,528 +197,6 @@
clock-output-names = "osc32k";
};
 
-   pll1: clk@01c2 {
-   #clock-cells = <0>;
-   compatible = "allwinner,sun4i-a10-pll1-clk";
-   reg = <0x01c2 0x4>;
-   clocks = <&osc24M>;
-   clock-output-names = "pll1";
-   };
-
-   pll2: clk@01c20008 {
-   #clock-cells = <1>;
-   compatible = "allwinner,sun4i-a10-pll2-clk";
-   reg = <0x01c20008 0x8>;
-   clocks = <&osc24M>;
-   clock-output-names = "pll2-1x", "pll2-2x",
-"pll2-4x", "pll2-8x";
-   };
-
-   pll3: clk@01c20010 {
-   #clock-cells = <0>;
-   compatible = "allwinner,sun4i-a10-pll3-clk";
-   reg = <0x01c20010 0x4>;
-   clo

Re: Audit fixes for v4.11 (#1)

2017-03-26 Thread Linus Torvalds
On Sun, Mar 26, 2017 at 8:18 AM, Paul Moore  wrote:
> On Sat, Mar 25, 2017 at 6:23 PM, Linus Torvalds
>  wrote:
>> The whole reason for that inlined part, and the uninlined
>> __audit_signal_info() helper was that the code *used* to be able to
>> avoid a function call entirely. That reason is now gone.
>
> Agreed.  Normally I would say let's just fix it in audit/next and I'll
> send it to you during the next merge window; however, since we're
> breaking the whole point of this inline in the -rcX stage, and the
> uninline'ing patch would be rather trivial, would you prefer I send it
> to you now for v4.11?

It's fine if it does into some "next" branch for 4.12, I don't think
there is any hurry as long as this gets fixed eventually.

But I'll take the obvious cleanup for 4.11 too if you end up having
other things coming my way.

  Linus


[PATCH v2 3/6] ARM: sun4i: Convert to CCU

2017-03-26 Thread Priit Laes
Convert sun4i-a10.dtsi to new CCU driver.

Signed-off-by: Priit Laes 
---
 arch/arm/boot/dts/sun4i-a10.dtsi | 636 
 1 file changed, 82 insertions(+), 554 deletions(-)

diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index ba20b48..0d8320a 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -45,7 +45,8 @@
 
 #include 
 
-#include 
+#include 
+#include 
 #include 
 #include 
 
@@ -65,9 +66,9 @@
compatible = "allwinner,simple-framebuffer",
 "simple-framebuffer";
allwinner,pipeline = "de_be0-lcd0-hdmi";
-   clocks = <&ahb_gates 36>, <&ahb_gates 43>,
-<&ahb_gates 44>, <&de_be0_clk>,
-<&tcon0_ch1_clk>, <&dram_gates 26>;
+   clocks = <&ccu CLK_AHB_LCD0>, <&ccu CLK_AHB_HDMI1>,
+<&ccu CLK_AHB_DE_BE0>, <&ccu CLK_DE_BE0>,
+<&ccu CLK_TCON0_CH1>, <&ccu CLK_DRAM_DE_BE0>;
status = "disabled";
};
 
@@ -75,10 +76,11 @@
compatible = "allwinner,simple-framebuffer",
 "simple-framebuffer";
allwinner,pipeline = "de_fe0-de_be0-lcd0-hdmi";
-   clocks = <&ahb_gates 36>, <&ahb_gates 43>,
-<&ahb_gates 44>, <&ahb_gates 46>,
-<&de_be0_clk>, <&de_fe0_clk>, <&tcon0_ch1_clk>,
-<&dram_gates 25>, <&dram_gates 26>;
+   clocks = <&ccu CLK_AHB_LCD0>, <&ccu CLK_AHB_HDMI1>,
+<&ccu CLK_AHB_DE_BE0>, <&ccu CLK_AHB_DE_FE0>,
+<&ccu CLK_DE_BE0>, <&ccu CLK_DE_FE0>,
+<&ccu CLK_TCON0_CH1>,
+<&ccu CLK_DRAM_DE_FE0>, <&ccu CLK_DRAM_DE_BE0>;
status = "disabled";
};
 
@@ -86,9 +88,10 @@
compatible = "allwinner,simple-framebuffer",
 "simple-framebuffer";
allwinner,pipeline = "de_fe0-de_be0-lcd0";
-   clocks = <&ahb_gates 36>, <&ahb_gates 44>, <&ahb_gates 
46>,
-<&de_be0_clk>, <&de_fe0_clk>, <&tcon0_ch0_clk>,
-<&dram_gates 25>, <&dram_gates 26>;
+   clocks = <&ccu CLK_AHB_LCD0>, <&ccu CLK_AHB_DE_BE0>,
+<&ccu CLK_AHB_DE_FE0>, <&ccu CLK_DE_BE0>,
+<&ccu CLK_DE_FE0>, <&ccu CLK_TCON0_CH1>,
+<&ccu CLK_DRAM_DE_FE0>, <&ccu CLK_DRAM_DE_BE0>;
status = "disabled";
};
 
@@ -96,11 +99,11 @@
compatible = "allwinner,simple-framebuffer",
 "simple-framebuffer";
allwinner,pipeline = "de_fe0-de_be0-lcd0-tve0";
-   clocks = <&ahb_gates 34>, <&ahb_gates 36>,
-<&ahb_gates 44>, <&ahb_gates 46>,
-<&de_be0_clk>, <&de_fe0_clk>,
-<&tcon0_ch1_clk>, <&dram_gates 5>,
-<&dram_gates 25>, <&dram_gates 26>;
+   clocks = <&ccu CLK_AHB_TVE0>, <&ccu CLK_AHB_LCD0>,
+<&ccu CLK_AHB_DE_BE0>, <&ccu CLK_AHB_DE_FE0>,
+<&ccu CLK_DE_BE0>, <&ccu CLK_DE_FE0>,
+<&ccu CLK_TCON0_CH1>, <&ccu CLK_DRAM_TVE0>,
+<&ccu CLK_DRAM_DE_FE0>, <&ccu CLK_DRAM_DE_BE0>;
status = "disabled";
};
};
@@ -112,7 +115,7 @@
device_type = "cpu";
compatible = "arm,cortex-a8";
reg = <0x0>;
-   clocks = <&cpu>;
+   clocks = <&ccu CLK_CPU>;
clock-latency = <244144>; /* 8 32k periods */
operating-points = <
/* kHzuV */
@@ -168,18 +171,6 @@
#size-cells = <1>;
ranges;
 
-   /*
-* This is a dummy clock, to be used as placeholder on
-* other mux clocks when a specific parent clock is not
-* yet implemented. It should be dropped when the driver
-* is complete.
-*/
-   dummy: dummy {
-   #clock-cells = <0>;
-   compatible = "fixed-clock";
-   clock-frequency = <0>;
-   };
-
osc24M: clk@01c20050 {
#clock-cel

[PATCH v2 8/8] ARM64: dts: meson-gxl: add spdif output pins

2017-03-26 Thread Jerome Brunet
Add EE and AO domains pins for the spdif output to the gxl device tree.

Acked-by: Kevin Hilman 
Signed-off-by: Jerome Brunet 
---
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 21 +
 1 file changed, 21 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
index 3dde55856234..8a08ad552e7a 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
@@ -174,6 +174,20 @@
function = "i2s_out_ao";
};
};
+
+   spdif_out_ao_6_pins: spdif_out_ao_6 {
+   mux {
+   groups = "spdif_out_ao_6";
+   function = "spdif_out_ao";
+   };
+   };
+
+   spdif_out_ao_9_pins: spdif_out_ao_9 {
+   mux {
+   groups = "spdif_out_ao_9";
+   function = "spdif_out_ao";
+   };
+   };
};
 };
 
@@ -447,6 +461,13 @@
function = "i2s_out";
};
};
+
+   spdif_out_h_pins: spdif_out_ao_h {
+   mux {
+   groups = "spdif_out_h";
+   function = "spdif_out";
+   };
+   };
};
 
eth-phy-mux {
-- 
2.9.3



Re: [RFC v5 2/9] sched/deadline: improve the tracking of active utilization

2017-03-26 Thread Mathieu Poirier
On 23 March 2017 at 21:52, luca abeni  wrote:
> From: Luca Abeni 
>
> This patch implements a more theoretically sound algorithm for
> tracking active utilization: instead of decreasing it when a
> task blocks, use a timer (the "inactive timer", named after the
> "Inactive" task state of the GRUB algorithm) to decrease the
> active utilization at the so called "0-lag time".
>
> Signed-off-by: Luca Abeni 
> Tested-by: Claudio Scordino 
> Tested-by: Daniel Bristot de Oliveira 
> ---
>  include/linux/sched.h   |  17 
>  kernel/sched/core.c |   3 +
>  kernel/sched/deadline.c | 208 
> 
>  kernel/sched/sched.h|   2 +
>  4 files changed, 215 insertions(+), 15 deletions(-)
>
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index d67eee8..952cac8 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -445,16 +445,33 @@ struct sched_dl_entity {
>  *
>  * @dl_yielded tells if task gave up the CPU before consuming
>  * all its available runtime during the last job.
> +*
> +* @dl_non_contending tells if task is inactive while still
> +* contributing to the active utilization. In other words, it
> +* indicates if the inactive timer has been armed and its handler
> +* has not been executed yet. This flag is useful to avoid race
> +* conditions between the inactive timer handler and the wakeup
> +* code.
>  */
> int dl_throttled;
> int dl_boosted;
> int dl_yielded;
> +   int dl_non_contending;
>
> /*
>  * Bandwidth enforcement timer. Each -deadline task has its
>  * own bandwidth to be enforced, thus we need one timer per task.
>  */
> struct hrtimer  dl_timer;
> +
> +   /*
> +* Inactive timer, responsible for decreasing the active utilization
> +* at the "0-lag time". When a -deadline task blocks, it contributes
> +* to GRUB's active utilization until the "0-lag time", hence a
> +* timer is needed to decrease the active utilization at the correct
> +* time.
> +*/
> +   struct hrtimer inactive_timer;
>  };
>
>  union rcu_special {
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 6d6cad9..bf0b0b9 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -2165,6 +2165,7 @@ void __dl_clear_params(struct task_struct *p)
>
> dl_se->dl_throttled = 0;
> dl_se->dl_yielded = 0;
> +   dl_se->dl_non_contending = 0;
>  }
>
>  /*
> @@ -2196,6 +2197,7 @@ static void __sched_fork(unsigned long clone_flags, 
> struct task_struct *p)
>
> RB_CLEAR_NODE(&p->dl.rb_node);
> init_dl_task_timer(&p->dl);
> +   init_inactive_task_timer(&p->dl);
> __dl_clear_params(p);
>
> INIT_LIST_HEAD(&p->rt.run_list);
> @@ -2518,6 +2520,7 @@ static int dl_overflow(struct task_struct *p, int 
> policy,
>!__dl_overflow(dl_b, cpus, p->dl.dl_bw, new_bw)) {
> __dl_clear(dl_b, p->dl.dl_bw);
> __dl_add(dl_b, new_bw);
> +   dl_change_utilization(p, new_bw);
> err = 0;
> } else if (!dl_policy(policy) && task_has_dl_policy(p)) {
> __dl_clear(dl_b, p->dl.dl_bw);
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index cef9adb..86aed82 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -65,6 +65,107 @@ void sub_running_bw(u64 dl_bw, struct dl_rq *dl_rq)
> dl_rq->running_bw = 0;
>  }
>
> +void dl_change_utilization(struct task_struct *p, u64 new_bw)
> +{
> +   if (!task_on_rq_queued(p)) {
> +   struct rq *rq = task_rq(p);
> +
> +   if (p->dl.dl_non_contending) {
> +   sub_running_bw(p->dl.dl_bw, &rq->dl);
> +   p->dl.dl_non_contending = 0;
> +   /*
> +* If the timer handler is currently running and the
> +* timer cannot be cancelled, inactive_task_timer()
> +* will see that dl_not_contending is not set, and
> +* will not touch the rq's active utilization,
> +* so we are still safe.
> +*/
> +   if (hrtimer_try_to_cancel(&p->dl.inactive_timer) == 1)
> +   put_task_struct(p);
> +   }
> +   }
> +}
> +
> +static void task_non_contending(struct task_struct *p)
> +{
> +   struct sched_dl_entity *dl_se = &p->dl;
> +   struct hrtimer *timer = &dl_se->inactive_timer;
> +   struct dl_rq *dl_rq = dl_rq_of_se(dl_se);
> +   struct rq *rq = rq_of_dl_rq(dl_rq);
> +   s64 zerolag_time;
> +
> +   /*
> +* If 

[PATCH v2 0/6] ARM: sunxi: Convert sun4i/sun7i series SoCs to sunxi-ng

2017-03-26 Thread Priit Laes
Hi,

This serie brings A10 (sun4i) and A20 (sun7i) SoCs into the
sunxi-ng world.

As mentioned in sun5i conversion, this is pretty much standard
stuff as all the required clocks were already implemented in
the sunxi-ng framework.

Unfortunately there's an issue with LVDS reset control that
causes issues with LVDS displays unless 'clk_ignore_unused'
option is used.

Need help with that :(

Changes from v1:
 - Drop useless comments
 - Add support for A10 / sun4i.
 - Rename driver to sunxi-a10-a20.
 - Add previously unimplemented clocks.
 - Document the audio pll hardcoded post-divider
 - Add Acked-by: Rob Herring  on patch 4

Priit Laes (6):
  clk: sunxi-ng: Add sun4i/sun7i CCU driver
  ARM: sun7i: Convert to CCU
  ARM: sun4i: Convert to CCU
  dt-bindings: List devicetree binding for the CCU of Allwinner A20
  dt-bindings: List devicetree binding for the CCU of Allwinner A10
  clk: sunxi-ng: Display index when clock registration fails

 Documentation/devicetree/bindings/clock/sunxi-ccu.txt |2 +-
 arch/arm/boot/dts/sun4i-a10.dtsi  |  636 +
 arch/arm/boot/dts/sun7i-a20.dtsi  |  717 +-
 drivers/clk/sunxi-ng/Kconfig  |   13 +-
 drivers/clk/sunxi-ng/Makefile |1 +-
 drivers/clk/sunxi-ng/ccu-sunxi-a10-a20.c  | 1532 ++-
 drivers/clk/sunxi-ng/ccu-sunxi-a10-a20.h  |   59 +-
 drivers/clk/sunxi-ng/ccu_common.c |4 +-
 include/dt-bindings/clock/sunxi-a10-a20-ccu.h |  208 +-
 include/dt-bindings/reset/sunxi-a10-a20-ccu.h |   66 +-
 10 files changed, 2050 insertions(+), 1188 deletions(-)
 create mode 100644 drivers/clk/sunxi-ng/ccu-sunxi-a10-a20.c
 create mode 100644 drivers/clk/sunxi-ng/ccu-sunxi-a10-a20.h
 create mode 100644 include/dt-bindings/clock/sunxi-a10-a20-ccu.h
 create mode 100644 include/dt-bindings/reset/sunxi-a10-a20-ccu.h

base-commit: 8e19fb843be8934d48b31fafbb32a4176f7feb65
-- 
git-series 0.9.1


[PATCH v2 4/6] dt-bindings: List devicetree binding for the CCU of Allwinner A20

2017-03-26 Thread Priit Laes
Allwinner A20 is now driven by sunxi-ng CCU driver.

Add devicetree binding for it.

Acked-by: Rob Herring 
Signed-off-by: Priit Laes 
---
 Documentation/devicetree/bindings/clock/sunxi-ccu.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/clock/sunxi-ccu.txt 
b/Documentation/devicetree/bindings/clock/sunxi-ccu.txt
index 68512aa..de90988 100644
--- a/Documentation/devicetree/bindings/clock/sunxi-ccu.txt
+++ b/Documentation/devicetree/bindings/clock/sunxi-ccu.txt
@@ -4,6 +4,7 @@ Allwinner Clock Control Unit Binding
 Required properties :
 - compatible: must contain one of the following compatibles:
- "allwinner,sun6i-a31-ccu"
+   - "allwinner,sun7i-a20-ccu"
- "allwinner,sun8i-a23-ccu"
- "allwinner,sun8i-a33-ccu"
- "allwinner,sun8i-h3-ccu"
-- 
git-series 0.9.1


Re: [PATCH v2] staging: media: omap4iss: Replace a bit shift by a use of BIT.

2017-03-26 Thread Laurent Pinchart
Hi Arushi,

Thank you for the patch.

On Friday 24 Mar 2017 21:31:45 Arushi Singhal wrote:
> This patch replaces bit shifting on 1 with the BIT(x) macro.
> This was done with coccinelle:
> @@
> constant c;
> @@
> 
> -1 << c
> +BIT(c)
> 
> Signed-off-by: Arushi Singhal 

Acked-by: Laurent Pinchart 

Greg, as this is a staging driver, do you want to merge the patch through your 
tree ?

> ---
> changes in v2
>  -Remove unnecessary parenthesis
> 
>  drivers/staging/media/omap4iss/iss_csi2.c| 2 +-
>  drivers/staging/media/omap4iss/iss_ipipe.c   | 2 +-
>  drivers/staging/media/omap4iss/iss_ipipeif.c | 2 +-
>  drivers/staging/media/omap4iss/iss_resizer.c | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/media/omap4iss/iss_csi2.c
> b/drivers/staging/media/omap4iss/iss_csi2.c index
> f71d5f2f179f..f6acc541e8a2 100644
> --- a/drivers/staging/media/omap4iss/iss_csi2.c
> +++ b/drivers/staging/media/omap4iss/iss_csi2.c
> @@ -1268,7 +1268,7 @@ static int csi2_init_entities(struct iss_csi2_device
> *csi2, const char *subname) snprintf(name, sizeof(name), "CSI2%s",
> subname);
>   snprintf(sd->name, sizeof(sd->name), "OMAP4 ISS %s", name);
> 
> - sd->grp_id = 1 << 16;   /* group ID for iss subdevs */
> + sd->grp_id = BIT(16);   /* group ID for iss subdevs */
>   v4l2_set_subdevdata(sd, csi2);
>   sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> 
> diff --git a/drivers/staging/media/omap4iss/iss_ipipe.c
> b/drivers/staging/media/omap4iss/iss_ipipe.c index
> d38782e8e84c..d86ef8a031f2 100644
> --- a/drivers/staging/media/omap4iss/iss_ipipe.c
> +++ b/drivers/staging/media/omap4iss/iss_ipipe.c
> @@ -508,7 +508,7 @@ static int ipipe_init_entities(struct iss_ipipe_device
> *ipipe) v4l2_subdev_init(sd, &ipipe_v4l2_ops);
>   sd->internal_ops = &ipipe_v4l2_internal_ops;
>   strlcpy(sd->name, "OMAP4 ISS ISP IPIPE", sizeof(sd->name));
> - sd->grp_id = 1 << 16;   /* group ID for iss subdevs */
> + sd->grp_id = BIT(16);   /* group ID for iss subdevs */
>   v4l2_set_subdevdata(sd, ipipe);
>   sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> 
> diff --git a/drivers/staging/media/omap4iss/iss_ipipeif.c
> b/drivers/staging/media/omap4iss/iss_ipipeif.c index
> 23de8330731d..cb88b2bd0d82 100644
> --- a/drivers/staging/media/omap4iss/iss_ipipeif.c
> +++ b/drivers/staging/media/omap4iss/iss_ipipeif.c
> @@ -739,7 +739,7 @@ static int ipipeif_init_entities(struct
> iss_ipipeif_device *ipipeif) v4l2_subdev_init(sd, &ipipeif_v4l2_ops);
>   sd->internal_ops = &ipipeif_v4l2_internal_ops;
>   strlcpy(sd->name, "OMAP4 ISS ISP IPIPEIF", sizeof(sd->name));
> - sd->grp_id = 1 << 16;   /* group ID for iss subdevs */
> + sd->grp_id = BIT(16);   /* group ID for iss subdevs */
>   v4l2_set_subdevdata(sd, ipipeif);
>   sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> 
> diff --git a/drivers/staging/media/omap4iss/iss_resizer.c
> b/drivers/staging/media/omap4iss/iss_resizer.c index
> f1d352c711d5..4bbfa20b3c38 100644
> --- a/drivers/staging/media/omap4iss/iss_resizer.c
> +++ b/drivers/staging/media/omap4iss/iss_resizer.c
> @@ -782,7 +782,7 @@ static int resizer_init_entities(struct
> iss_resizer_device *resizer) v4l2_subdev_init(sd, &resizer_v4l2_ops);
>   sd->internal_ops = &resizer_v4l2_internal_ops;
>   strlcpy(sd->name, "OMAP4 ISS ISP resizer", sizeof(sd->name));
> - sd->grp_id = 1 << 16;   /* group ID for iss subdevs */
> + sd->grp_id = BIT(16);   /* group ID for iss subdevs */
>   v4l2_set_subdevdata(sd, resizer);
>   sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;

-- 
Regards,

Laurent Pinchart



Re: [PATCH v3 1/3] crypto: hw_random - Add new Exynos RNG driver

2017-03-26 Thread Krzysztof Kozlowski
On Sun, Mar 26, 2017 at 07:11:28PM +0200, Stephan Müller wrote:
> Am Samstag, 25. März 2017, 17:26:52 CEST schrieb Krzysztof Kozlowski:
> > +static int exynos_rng_set_seed(struct exynos_rng_dev *rng,
> > +  const u8 *seed, unsigned int slen)
> > +{
> > +   u32 val;
> > +   int i;
> > +
> > +   dev_dbg(rng->dev, "Seeding with %u bytes\n", slen);
> > +
> > +   if (slen < EXYNOS_RNG_SEED_SIZE) {
> > +   dev_warn(rng->dev, "Seed too short (only %u bytes)\n", slen);
> > +   return -EINVAL;
> > +   }
> > +
> > +   for (i = 0 ; i < EXYNOS_RNG_SEED_REGS ; i++) {
> > +   val = seed[i * 4] << 24;
> > +   val |= seed[i * 4 + 1] << 16;
> > +   val |= seed[i * 4 + 2] << 8;
> > +   val |= seed[i * 4 + 3] << 0;
> > +
> > +   exynos_rng_writel(rng, val, EXYNOS_RNG_SEED(i));
> > +   }
> 
> Would it make sense to add another outer loop here to allow all of slen to be 
> injected into the DRNG? Note, in some cases, a user wants to add more seed 
> into the DRNG than the actual seed size. In this case, the DRNG acts as a 
> compression operation of entropy. This is used when the entropy-to-data ratio 
> is not 1:1. In a lot of cases, users have a seed which has less entropy in 
> bits per data bit.

Hi,

I do not know whether this would have any benefit on hardware. The
datasheet is not describing too much here. It is actually saying only:
1. Write SEED to each register (five in total).
2. Confirm that STATUS register says seeding done.
3. Start RNG engine.
4. Wait for engine finish (another bit in STATUS - clear it then).
5. Read the randoms.

I would guess that the hardware will ignore all previously written seeds
and use the last one. Maybe the hardware will use all of the seeds
written as you imply. It is just a guessing.

Best regards,
Krzysztof



[PATCH v2 6/6] clk: sunxi-ng: Display index when clock registration fails

2017-03-26 Thread Priit Laes
Add clock index to clock registration failure message.

Signed-off-by: Priit Laes 
---
 drivers/clk/sunxi-ng/ccu_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu_common.c 
b/drivers/clk/sunxi-ng/ccu_common.c
index 8a47baf..188fa50 100644
--- a/drivers/clk/sunxi-ng/ccu_common.c
+++ b/drivers/clk/sunxi-ng/ccu_common.c
@@ -63,8 +63,8 @@ int sunxi_ccu_probe(struct device_node *node, void __iomem 
*reg,
 
ret = clk_hw_register(NULL, hw);
if (ret) {
-   pr_err("Couldn't register clock %s\n",
-  clk_hw_get_name(hw));
+   pr_err("Couldn't register clock %d - %s\n",
+  i, clk_hw_get_name(hw));
goto err_clk_unreg;
}
}
-- 
git-series 0.9.1


Re: [PATCH v3 1/3] crypto: hw_random - Add new Exynos RNG driver

2017-03-26 Thread Krzysztof Kozlowski
On Sun, Mar 26, 2017 at 07:05:48PM +0200, Stephan Müller wrote:
> Am Sonntag, 26. März 2017, 18:46:02 CEST schrieb PrasannaKumar Muralidharan:
> 
> HiKrzysztof,
> 
> > >> > +   if (slen < EXYNOS_RNG_SEED_SIZE) {
> > >> > +   dev_warn(rng->dev, "Seed too short (only %u bytes)\n",
> > >> > slen); +   return -EINVAL;
> > >> > +   }
> > >> 
> > >> Will it be helpful to print the required seed size?
> > > 
> > > It is in /proc/crypto... It is not a problem to print it but isn't that
> > > redundant?
> > 
> > Not necessary if it is already available.
> 
> Maybe the dev_warn should be removed. Note, unprivileged user space can 
> trigger this warning by simply invoking the seeding operation over and over 
> again with an insufficient seed size. This would clutter the log.

Makes sense. The generic dev_dbg() before would bring enough
information.

Best regards,
Krzysztof



[PATCH v2 1/6] clk: sunxi-ng: Add sun4i/sun7i CCU driver

2017-03-26 Thread Priit Laes
Introduce a clock controller driver for sun4i A10 and sun7i A20
series SoCs.

Signed-off-by: Priit Laes 
---
 drivers/clk/sunxi-ng/Kconfig  |   13 +-
 drivers/clk/sunxi-ng/Makefile |1 +-
 drivers/clk/sunxi-ng/ccu-sunxi-a10-a20.c  | 1532 ++-
 drivers/clk/sunxi-ng/ccu-sunxi-a10-a20.h  |   59 +-
 include/dt-bindings/clock/sunxi-a10-a20-ccu.h |  208 ++-
 include/dt-bindings/reset/sunxi-a10-a20-ccu.h |   66 +-
 6 files changed, 1879 insertions(+)
 create mode 100644 drivers/clk/sunxi-ng/ccu-sunxi-a10-a20.c
 create mode 100644 drivers/clk/sunxi-ng/ccu-sunxi-a10-a20.h
 create mode 100644 include/dt-bindings/clock/sunxi-a10-a20-ccu.h
 create mode 100644 include/dt-bindings/reset/sunxi-a10-a20-ccu.h

diff --git a/drivers/clk/sunxi-ng/Kconfig b/drivers/clk/sunxi-ng/Kconfig
index 213cf64..abed614 100644
--- a/drivers/clk/sunxi-ng/Kconfig
+++ b/drivers/clk/sunxi-ng/Kconfig
@@ -65,6 +65,19 @@ config SUN50I_A64_CCU
default ARM64 && ARCH_SUNXI
depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
 
+config SUNXI_A10_A20_CCU
+   bool "Support for the Allwinner A10/A20 CCU"
+   select SUNXI_CCU_DIV
+   select SUNXI_CCU_MULT
+   select SUNXI_CCU_NK
+   select SUNXI_CCU_NKM
+   select SUNXI_CCU_NM
+   select SUNXI_CCU_MP
+   select SUNXI_CCU_PHASE
+   default MACH_SUN4I
+   default MACH_SUN7I
+   depends on MACH_SUN4I || MACH_SUN7I || COMPILE_TEST
+
 config SUN5I_CCU
bool "Support for the Allwinner sun5i family CCM"
select SUNXI_CCU_DIV
diff --git a/drivers/clk/sunxi-ng/Makefile b/drivers/clk/sunxi-ng/Makefile
index 6feaac0..90bab0e 100644
--- a/drivers/clk/sunxi-ng/Makefile
+++ b/drivers/clk/sunxi-ng/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_SUNXI_CCU_MP)+= ccu_mp.o
 obj-$(CONFIG_SUN50I_A64_CCU)   += ccu-sun50i-a64.o
 obj-$(CONFIG_SUN5I_CCU)+= ccu-sun5i.o
 obj-$(CONFIG_SUN6I_A31_CCU)+= ccu-sun6i-a31.o
+obj-$(CONFIG_SUNXI_A10_A20_CCU)+= ccu-sunxi-a10-a20.o
 obj-$(CONFIG_SUN8I_A23_CCU)+= ccu-sun8i-a23.o
 obj-$(CONFIG_SUN8I_A33_CCU)+= ccu-sun8i-a33.o
 obj-$(CONFIG_SUN8I_H3_CCU) += ccu-sun8i-h3.o
diff --git a/drivers/clk/sunxi-ng/ccu-sunxi-a10-a20.c 
b/drivers/clk/sunxi-ng/ccu-sunxi-a10-a20.c
new file mode 100644
index 000..1884f5f
--- /dev/null
+++ b/drivers/clk/sunxi-ng/ccu-sunxi-a10-a20.c
@@ -0,0 +1,1532 @@
+/*
+ * Copyright (c) 2017 Priit Laes. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+
+#include "ccu_common.h"
+#include "ccu_reset.h"
+
+#include "ccu_div.h"
+#include "ccu_gate.h"
+#include "ccu_mp.h"
+#include "ccu_mult.h"
+#include "ccu_nk.h"
+#include "ccu_nkm.h"
+#include "ccu_nkmp.h"
+#include "ccu_nm.h"
+#include "ccu_phase.h"
+
+#include "ccu-sunxi-a10-a20.h"
+
+static struct ccu_nkmp pll_core_clk = {
+   .enable = BIT(31),
+   .n  = _SUNXI_CCU_MULT_OFFSET(8, 5, 0),
+   .k  = _SUNXI_CCU_MULT(4, 2),
+   .m  = _SUNXI_CCU_DIV(0, 2),
+   .p  = _SUNXI_CCU_DIV(16, 2),
+   .common = {
+   .reg= 0x000,
+   .hw.init= CLK_HW_INIT("pll-core",
+ "hosc",
+ &ccu_nkmp_ops,
+ 0),
+   },
+};
+
+/*
+ * The Audio PLL is supposed to have 4 outputs: 3 fixed factors from
+ * the base (2x, 4x and 8x), and one variable divider (the one true
+ * pll audio).
+ *
+ * We don't have any need for the variable divider for now, so we just
+ * hardcode it to match with the clock names.
+ */
+#define SUN4I_PLL_AUDIO_REG0x008
+static struct ccu_nm pll_audio_base_clk = {
+   .enable = BIT(31),
+   .n  = _SUNXI_CCU_MULT_OFFSET(8, 7, 0),
+   .m  = _SUNXI_CCU_DIV_OFFSET(0, 5, 0),
+   .common = {
+   .reg= 0x008,
+   .hw.init= CLK_HW_INIT("pll-audio-base",
+ "hosc",
+ &ccu_nm_ops,
+ 0),
+   },
+
+};
+
+static struct ccu_mult pll_video0_clk = {
+   .enable = BIT(31),
+   .mult   = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(0, 7, 0, 9, 127),
+   .frac   = _SUNXI_CCU_FRAC(BIT(15), BIT(14),
+ 27000, 29700),
+   .common = {
+   

[PATCH] kernel: pid_namespace.c: Fix line over 80 characters

2017-03-26 Thread Arushi Singhal
Break lines so that they do not exceed
80 characters. Problem found using checkpatch.

Signed-off-by: Arushi Singhal 
---
 kernel/pid_namespace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
index de461aa0bf9a..850a87a1de2a 100644
--- a/kernel/pid_namespace.c
+++ b/kernel/pid_namespace.c
@@ -75,7 +75,8 @@ static struct kmem_cache *create_pid_cachep(int nr_ids)
 
 static void proc_cleanup_work(struct work_struct *work)
 {
-   struct pid_namespace *ns = container_of(work, struct pid_namespace, 
proc_work);
+   struct pid_namespace *ns = container_of(work, struct pid_namespace,
+   proc_work);
pid_ns_release_proc(ns);
 }
 
-- 
2.11.0



Re: [PATCH v2] staging: media: omap4iss: Replace a bit shift by a use of BIT.

2017-03-26 Thread Mauro Carvalho Chehab
Em Sun, 26 Mar 2017 20:57:02 +0300
Laurent Pinchart  escreveu:

> Hi Arushi,
> 
> Thank you for the patch.
> 
> On Friday 24 Mar 2017 21:31:45 Arushi Singhal wrote:
> > This patch replaces bit shifting on 1 with the BIT(x) macro.
> > This was done with coccinelle:
> > @@
> > constant c;
> > @@
> > 
> > -1 << c
> > +BIT(c)
> > 
> > Signed-off-by: Arushi Singhal   
> 
> Acked-by: Laurent Pinchart 
> 
> Greg, as this is a staging driver, do you want to merge the patch through 
> your 
> tree ?

As this is at staging/media, better to merge via my tree.

Regards,
Mauro

> 
> > ---
> > changes in v2
> >  -Remove unnecessary parenthesis
> > 
> >  drivers/staging/media/omap4iss/iss_csi2.c| 2 +-
> >  drivers/staging/media/omap4iss/iss_ipipe.c   | 2 +-
> >  drivers/staging/media/omap4iss/iss_ipipeif.c | 2 +-
> >  drivers/staging/media/omap4iss/iss_resizer.c | 2 +-
> >  4 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/staging/media/omap4iss/iss_csi2.c
> > b/drivers/staging/media/omap4iss/iss_csi2.c index
> > f71d5f2f179f..f6acc541e8a2 100644
> > --- a/drivers/staging/media/omap4iss/iss_csi2.c
> > +++ b/drivers/staging/media/omap4iss/iss_csi2.c
> > @@ -1268,7 +1268,7 @@ static int csi2_init_entities(struct iss_csi2_device
> > *csi2, const char *subname) snprintf(name, sizeof(name), "CSI2%s",
> > subname);
> > snprintf(sd->name, sizeof(sd->name), "OMAP4 ISS %s", name);
> > 
> > -   sd->grp_id = 1 << 16;   /* group ID for iss subdevs */
> > +   sd->grp_id = BIT(16);   /* group ID for iss subdevs */
> > v4l2_set_subdevdata(sd, csi2);
> > sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> > 
> > diff --git a/drivers/staging/media/omap4iss/iss_ipipe.c
> > b/drivers/staging/media/omap4iss/iss_ipipe.c index
> > d38782e8e84c..d86ef8a031f2 100644
> > --- a/drivers/staging/media/omap4iss/iss_ipipe.c
> > +++ b/drivers/staging/media/omap4iss/iss_ipipe.c
> > @@ -508,7 +508,7 @@ static int ipipe_init_entities(struct iss_ipipe_device
> > *ipipe) v4l2_subdev_init(sd, &ipipe_v4l2_ops);
> > sd->internal_ops = &ipipe_v4l2_internal_ops;
> > strlcpy(sd->name, "OMAP4 ISS ISP IPIPE", sizeof(sd->name));
> > -   sd->grp_id = 1 << 16;   /* group ID for iss subdevs */
> > +   sd->grp_id = BIT(16);   /* group ID for iss subdevs */
> > v4l2_set_subdevdata(sd, ipipe);
> > sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> > 
> > diff --git a/drivers/staging/media/omap4iss/iss_ipipeif.c
> > b/drivers/staging/media/omap4iss/iss_ipipeif.c index
> > 23de8330731d..cb88b2bd0d82 100644
> > --- a/drivers/staging/media/omap4iss/iss_ipipeif.c
> > +++ b/drivers/staging/media/omap4iss/iss_ipipeif.c
> > @@ -739,7 +739,7 @@ static int ipipeif_init_entities(struct
> > iss_ipipeif_device *ipipeif) v4l2_subdev_init(sd, &ipipeif_v4l2_ops);
> > sd->internal_ops = &ipipeif_v4l2_internal_ops;
> > strlcpy(sd->name, "OMAP4 ISS ISP IPIPEIF", sizeof(sd->name));
> > -   sd->grp_id = 1 << 16;   /* group ID for iss subdevs */
> > +   sd->grp_id = BIT(16);   /* group ID for iss subdevs */
> > v4l2_set_subdevdata(sd, ipipeif);
> > sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> > 
> > diff --git a/drivers/staging/media/omap4iss/iss_resizer.c
> > b/drivers/staging/media/omap4iss/iss_resizer.c index
> > f1d352c711d5..4bbfa20b3c38 100644
> > --- a/drivers/staging/media/omap4iss/iss_resizer.c
> > +++ b/drivers/staging/media/omap4iss/iss_resizer.c
> > @@ -782,7 +782,7 @@ static int resizer_init_entities(struct
> > iss_resizer_device *resizer) v4l2_subdev_init(sd, &resizer_v4l2_ops);
> > sd->internal_ops = &resizer_v4l2_internal_ops;
> > strlcpy(sd->name, "OMAP4 ISS ISP resizer", sizeof(sd->name));
> > -   sd->grp_id = 1 << 16;   /* group ID for iss subdevs */
> > +   sd->grp_id = BIT(16);   /* group ID for iss subdevs */
> > v4l2_set_subdevdata(sd, resizer);
> > sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;  
> 



Thanks,
Mauro


[PATCH] kernel: pid_namespace.c: Remove spaces before tabs

2017-03-26 Thread Arushi Singhal
This patch is to remove unneeded spaces before tabs so as to
follow kernel coding conventions.

Signed-off-by: Arushi Singhal 
---
 kernel/pid_namespace.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
index 850a87a1de2a..8ea1dc6ed25b 100644
--- a/kernel/pid_namespace.c
+++ b/kernel/pid_namespace.c
@@ -229,11 +229,11 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
 * to exit.
 *
 * Note:  This signals each threads in the namespace - even those that
-*belong to the same thread group, To avoid this, we would have
-*to walk the entire tasklist looking a processes in this
-*namespace, but that could be unnecessarily expensive if the
-*pid namespace has just a few processes. Or we need to
-*maintain a tasklist for each pid namespace.
+*belong to the same thread group, To avoid this, we would have
+*to walk the entire tasklist looking a processes in this
+*namespace, but that could be unnecessarily expensive if the
+*pid namespace has just a few processes. Or we need to
+*maintain a tasklist for each pid namespace.
 *
 */
read_lock(&tasklist_lock);
-- 
2.11.0



[PATCH v2 5/6] dt-bindings: List devicetree binding for the CCU of Allwinner A10

2017-03-26 Thread Priit Laes
Allwinner A10 is now driven by sunxi-ng CCU driver.

Add devicetree binding for it.

Signed-off-by: Priit Laes 
---
 Documentation/devicetree/bindings/clock/sunxi-ccu.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/clock/sunxi-ccu.txt 
b/Documentation/devicetree/bindings/clock/sunxi-ccu.txt
index de90988..db49cbc 100644
--- a/Documentation/devicetree/bindings/clock/sunxi-ccu.txt
+++ b/Documentation/devicetree/bindings/clock/sunxi-ccu.txt
@@ -3,6 +3,7 @@ Allwinner Clock Control Unit Binding
 
 Required properties :
 - compatible: must contain one of the following compatibles:
+   - "allwinner,sun4i-a10-ccu"
- "allwinner,sun6i-a31-ccu"
- "allwinner,sun7i-a20-ccu"
- "allwinner,sun8i-a23-ccu"
-- 
git-series 0.9.1


[PATCH v2 1/8] pinctrl: meson: gxbb: add i2s output pins

2017-03-26 Thread Jerome Brunet
Add EE and AO domains pins for the i2s output clocks and data.
I2S output channel 6/7 on TEST_N pin is missing from this patch and will
be added later on.

Acked-by: Kevin Hilman 
Signed-off-by: Jerome Brunet 
---
 drivers/pinctrl/meson/pinctrl-meson-gxbb.c | 31 ++
 1 file changed, 31 insertions(+)

diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c 
b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c
index 31a3a98d067c..b9772a124a82 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c
@@ -236,6 +236,10 @@ static const unsigned int hdmi_hpd_pins[]  = { 
PIN(GPIOH_0, EE_OFF) };
 static const unsigned int hdmi_sda_pins[]  = { PIN(GPIOH_1, EE_OFF) };
 static const unsigned int hdmi_scl_pins[]  = { PIN(GPIOH_2, EE_OFF) };
 
+static const unsigned int i2s_out_ch23_y_pins[]= { PIN(GPIOY_8, 
EE_OFF) };
+static const unsigned int i2s_out_ch45_y_pins[]= { PIN(GPIOY_9, 
EE_OFF) };
+static const unsigned int i2s_out_ch67_y_pins[]= { PIN(GPIOY_10, 
EE_OFF) };
+
 static const struct pinctrl_pin_desc meson_gxbb_aobus_pins[] = {
MESON_PIN(GPIOAO_0, 0),
MESON_PIN(GPIOAO_1, 0),
@@ -274,6 +278,13 @@ static const unsigned int pwm_ao_a_6_pins[]= { 
PIN(GPIOAO_6, 0) };
 static const unsigned int pwm_ao_a_12_pins[]   = { PIN(GPIOAO_12, 0) };
 static const unsigned int pwm_ao_b_pins[]  = { PIN(GPIOAO_13, 0) };
 
+static const unsigned int i2s_am_clk_pins[] = { PIN(GPIOAO_8, 0) };
+static const unsigned int i2s_out_ao_clk_pins[] = { PIN(GPIOAO_9, 0) };
+static const unsigned int i2s_out_lr_clk_pins[] = { PIN(GPIOAO_10, 0) 
};
+static const unsigned int i2s_out_ch01_ao_pins[] = { PIN(GPIOAO_11, 0) };
+static const unsigned int i2s_out_ch23_ao_pins[] = { PIN(GPIOAO_12, 0) };
+static const unsigned int i2s_out_ch45_ao_pins[] = { PIN(GPIOAO_13, 0) };
+
 static struct meson_pmx_group meson_gxbb_periphs_groups[] = {
GPIO_GROUP(GPIOZ_0, EE_OFF),
GPIO_GROUP(GPIOZ_1, EE_OFF),
@@ -426,6 +437,9 @@ static struct meson_pmx_group meson_gxbb_periphs_groups[] = 
{
GROUP(uart_rx_c,1,  16),
GROUP(pwm_a_y,  1,  21),
GROUP(pwm_f_y,  1,  20),
+   GROUP(i2s_out_ch23_y,   1,  5),
+   GROUP(i2s_out_ch45_y,   1,  6),
+   GROUP(i2s_out_ch67_y,   1,  7),
 
/* Bank Z */
GROUP(eth_mdio, 6,  1),
@@ -523,6 +537,12 @@ static struct meson_pmx_group meson_gxbb_aobus_groups[] = {
GROUP(pwm_ao_a_6,   0,  18),
GROUP(pwm_ao_a_12,  0,  17),
GROUP(pwm_ao_b, 0,  3),
+   GROUP(i2s_am_clk,   0,  30),
+   GROUP(i2s_out_ao_clk,   0,  29),
+   GROUP(i2s_out_lr_clk,   0,  28),
+   GROUP(i2s_out_ch01_ao,  0,  27),
+   GROUP(i2s_out_ch23_ao,  1,  0),
+   GROUP(i2s_out_ch45_ao,  1,  1),
 };
 
 static const char * const gpio_periphs_groups[] = {
@@ -652,6 +672,10 @@ static const char * const hdmi_i2c_groups[] = {
"hdmi_sda", "hdmi_scl",
 };
 
+static const char * const i2s_out_groups[] = {
+   "i2s_out_ch23_y", "i2s_out_ch45_y", "i2s_out_ch67_y",
+};
+
 static const char * const gpio_aobus_groups[] = {
"GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", "GPIOAO_4",
"GPIOAO_5", "GPIOAO_6", "GPIOAO_7", "GPIOAO_8", "GPIOAO_9",
@@ -694,6 +718,11 @@ static const char * const pwm_ao_b_groups[] = {
"pwm_ao_b",
 };
 
+static const char * const i2s_out_ao_groups[] = {
+   "i2s_am_clk", "i2s_out_ao_clk", "i2s_out_lr_clk",
+   "i2s_out_ch01_ao", "i2s_out_ch23_ao", "i2s_out_ch45_ao",
+};
+
 static struct meson_pmx_func meson_gxbb_periphs_functions[] = {
FUNCTION(gpio_periphs),
FUNCTION(emmc),
@@ -717,6 +746,7 @@ static struct meson_pmx_func meson_gxbb_periphs_functions[] 
= {
FUNCTION(pwm_f_y),
FUNCTION(hdmi_hpd),
FUNCTION(hdmi_i2c),
+   FUNCTION(i2s_out),
 };
 
 static struct meson_pmx_func meson_gxbb_aobus_functions[] = {
@@ -730,6 +760,7 @@ static struct meson_pmx_func meson_gxbb_aobus_functions[] = 
{
FUNCTION(pwm_ao_a_6),
FUNCTION(pwm_ao_a_12),
FUNCTION(pwm_ao_b),
+   FUNCTION(i2s_out_ao),
 };
 
 static struct meson_bank meson_gxbb_periphs_banks[] = {
-- 
2.9.3



[PATCH v2 5/7] Change k_clock clock_set() to use timespec64

2017-03-26 Thread Deepa Dinamani
struct timespec is not y2038 safe on 32 bit machines.
Replace uses of struct timespec with struct timespec64
in the kernel.

The syscall interfaces themselves will be changed
in a separate series.

Signed-off-by: Deepa Dinamani 
---
 drivers/char/mmtimer.c |  2 +-
 include/linux/posix-timers.h   |  2 +-
 kernel/time/posix-clock.c  |  5 ++---
 kernel/time/posix-cpu-timers.c |  2 +-
 kernel/time/posix-timers.c | 11 +--
 5 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c
index 79d8ada..ba1b892 100644
--- a/drivers/char/mmtimer.c
+++ b/drivers/char/mmtimer.c
@@ -489,7 +489,7 @@ static int sgi_clock_get(clockid_t clockid, struct 
timespec64 *tp)
return 0;
 };
 
-static int sgi_clock_set(const clockid_t clockid, const struct timespec *tp)
+static int sgi_clock_set(const clockid_t clockid, const struct timespec64 *tp)
 {
 
u64 nsec;
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index dd05b49..7825e24 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -89,7 +89,7 @@ struct k_itimer {
 struct k_clock {
int (*clock_getres) (const clockid_t which_clock, struct timespec64 
*tp);
int (*clock_set) (const clockid_t which_clock,
- const struct timespec *tp);
+ const struct timespec64 *tp);
int (*clock_get) (const clockid_t which_clock, struct timespec64 *tp);
int (*clock_adj) (const clockid_t which_clock, struct timex *tx);
int (*timer_create) (struct k_itimer *timer);
diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c
index af91031..3807a34 100644
--- a/kernel/time/posix-clock.c
+++ b/kernel/time/posix-clock.c
@@ -335,9 +335,8 @@ static int pc_clock_getres(clockid_t id, struct timespec64 
*ts)
return err;
 }
 
-static int pc_clock_settime(clockid_t id, const struct timespec *ts)
+static int pc_clock_settime(clockid_t id, const struct timespec64 *ts)
 {
-   struct timespec64 ts64 = timespec_to_timespec64(*ts);
struct posix_clock_desc cd;
int err;
 
@@ -351,7 +350,7 @@ static int pc_clock_settime(clockid_t id, const struct 
timespec *ts)
}
 
if (cd.clk->ops.clock_settime)
-   err = cd.clk->ops.clock_settime(cd.clk, &ts64);
+   err = cd.clk->ops.clock_settime(cd.clk, ts);
else
err = -EOPNOTSUPP;
 out:
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index 37ce9ed..2cd4428 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -135,7 +135,7 @@ posix_cpu_clock_getres(const clockid_t which_clock, struct 
timespec64 *tp)
 }
 
 static int
-posix_cpu_clock_set(const clockid_t which_clock, const struct timespec *tp)
+posix_cpu_clock_set(const clockid_t which_clock, const struct timespec64 *tp)
 {
/*
 * You can never reset a CPU clock, but we check for other errors
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index f67dae9..7742da8 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -212,12 +212,9 @@ static int posix_clock_realtime_get(clockid_t which_clock, 
struct timespec64 *tp
 
 /* Set clock_realtime */
 static int posix_clock_realtime_set(const clockid_t which_clock,
-   const struct timespec *tp)
+   const struct timespec64 *tp)
 {
-   struct timespec64 tp64;
-
-   tp64 = timespec_to_timespec64(*tp);
-   return do_sys_settimeofday64(&tp64, NULL);
+   return do_sys_settimeofday64(tp, NULL);
 }
 
 static int posix_clock_realtime_adj(const clockid_t which_clock,
@@ -1017,6 +1014,7 @@ SYSCALL_DEFINE2(clock_settime, const clockid_t, 
which_clock,
const struct timespec __user *, tp)
 {
struct k_clock *kc = clockid_to_kclock(which_clock);
+   struct timespec64 new_tp64;
struct timespec new_tp;
 
if (!kc || !kc->clock_set)
@@ -1024,8 +1022,9 @@ SYSCALL_DEFINE2(clock_settime, const clockid_t, 
which_clock,
 
if (copy_from_user(&new_tp, tp, sizeof (*tp)))
return -EFAULT;
+   new_tp64 = timespec_to_timespec64(new_tp);
 
-   return kc->clock_set(which_clock, &new_tp);
+   return kc->clock_set(which_clock, &new_tp64);
 }
 
 SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
-- 
2.7.4



[PATCH v2 0/7] Change k_clock interfaces to use timespec64

2017-03-26 Thread Deepa Dinamani
The series is aimed at replacing struct timespec which is not
y2038 safe with y2038 safe struct timespec64 for k_clock interfaces.
The series also replaces struct itimerspec which uses struct timespec
internally with struct itimerspec64 for the k_clock interfaces.

The series does not change the syscall interface.
This will be done in a follow up series.

A few existing checkpatch-noted style issues, such as the 80 line
character limit, have been left as-is to facilitate easier review.

Changes since v1:
* Address review comments for change logs and coding style.
* Fix kbuild test error for alpha.

Deepa Dinamani (7):
  time: Delete do_sys_setimeofday()
  time: Change posix clocks ops interfaces to use timespec64
  Change k_clock clock_get() to use timespec64
  Change k_clock clock_getres() to use timespec64
  Change k_clock clock_set() to use timespec64
  Change k_clock timer_set() and timer_get() to use timespec64
  Change k_clock nsleep() to use timespec64

 arch/alpha/kernel/osf_sys.c|  4 +-
 drivers/char/mmtimer.c | 28 ++---
 drivers/ptp/ptp_clock.c| 18 
 include/linux/hrtimer.h|  2 +-
 include/linux/posix-clock.h| 10 ++---
 include/linux/posix-timers.h   | 20 -
 include/linux/timekeeping.h| 20 +++--
 kernel/compat.c| 10 +++--
 kernel/time/alarmtimer.c   | 24 +--
 kernel/time/hrtimer.c  | 10 +++--
 kernel/time/posix-clock.c  | 10 ++---
 kernel/time/posix-cpu-timers.c | 66 +++--
 kernel/time/posix-stubs.c  | 20 ++---
 kernel/time/posix-timers.c | 95 --
 kernel/time/time.c |  4 +-
 15 files changed, 179 insertions(+), 162 deletions(-)

-- 
2.7.4

Cc: Richard Cochran 
Cc: linux-al...@vger.kernel.org
Cc: net...@vger.kernel.org


[PATCH v2 7/7] Change k_clock nsleep() to use timespec64

2017-03-26 Thread Deepa Dinamani
struct timespec is not y2038 safe on 32 bit machines.
Replace uses of struct timespec with struct timespec64
in the kernel.

The syscall interfaces themselves will be changed
in a separate series.

Note that the restart_block parameter for nanosleep has
also been left unchanged and will be part of syscall
series noted above.

Signed-off-by: Deepa Dinamani 
---
 include/linux/hrtimer.h|  2 +-
 include/linux/posix-timers.h   |  2 +-
 kernel/compat.c|  6 --
 kernel/time/alarmtimer.c   |  4 ++--
 kernel/time/hrtimer.c  | 10 ++
 kernel/time/posix-cpu-timers.c | 36 ++--
 kernel/time/posix-stubs.c  |  6 --
 kernel/time/posix-timers.c | 10 ++
 8 files changed, 42 insertions(+), 34 deletions(-)

diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 23d58fc..8c5b10e 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -452,7 +452,7 @@ static inline u64 hrtimer_forward_now(struct hrtimer *timer,
 }
 
 /* Precise sleep: */
-extern long hrtimer_nanosleep(struct timespec *rqtp,
+extern long hrtimer_nanosleep(struct timespec64 *rqtp,
  struct timespec __user *rmtp,
  const enum hrtimer_mode mode,
  const clockid_t clockid);
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index ebc4c494..8c1e43a 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -94,7 +94,7 @@ struct k_clock {
int (*clock_adj) (const clockid_t which_clock, struct timex *tx);
int (*timer_create) (struct k_itimer *timer);
int (*nsleep) (const clockid_t which_clock, int flags,
-  struct timespec *, struct timespec __user *);
+  struct timespec64 *, struct timespec __user *);
long (*nsleep_restart) (struct restart_block *restart_block);
int (*timer_set) (struct k_itimer *timr, int flags,
  struct itimerspec64 *new_setting,
diff --git a/kernel/compat.c b/kernel/compat.c
index e29a01a..8ec15d1 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -240,18 +240,20 @@ COMPAT_SYSCALL_DEFINE2(nanosleep, struct compat_timespec 
__user *, rqtp,
   struct compat_timespec __user *, rmtp)
 {
struct timespec tu, rmt;
+   struct timespec64 tu64;
mm_segment_t oldfs;
long ret;
 
if (compat_get_timespec(&tu, rqtp))
return -EFAULT;
 
-   if (!timespec_valid(&tu))
+   tu64 = timespec_to_timespec64(tu);
+   if (!timespec64_valid(&tu64))
return -EINVAL;
 
oldfs = get_fs();
set_fs(KERNEL_DS);
-   ret = hrtimer_nanosleep(&tu,
+   ret = hrtimer_nanosleep(&tu64,
rmtp ? (struct timespec __user *)&rmt : NULL,
HRTIMER_MODE_REL, CLOCK_MONOTONIC);
set_fs(oldfs);
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index 81db6df..cc20417 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -790,7 +790,7 @@ static long __sched alarm_timer_nsleep_restart(struct 
restart_block *restart)
  * Handles clock_nanosleep calls against _ALARM clockids
  */
 static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
-struct timespec *tsreq, struct timespec __user *rmtp)
+struct timespec64 *tsreq, struct timespec __user *rmtp)
 {
enum  alarmtimer_type type = clock2alarm(which_clock);
struct alarm alarm;
@@ -809,7 +809,7 @@ static int alarm_timer_nsleep(const clockid_t which_clock, 
int flags,
 
alarm_init(&alarm, type, alarmtimer_nsleep_wakeup);
 
-   exp = timespec_to_ktime(*tsreq);
+   exp = timespec64_to_ktime(*tsreq);
/* Convert (if necessary) to absolute time */
if (flags != TIMER_ABSTIME) {
ktime_t now = alarm_bases[type].gettime();
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 1ef82cd..a756012 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1503,7 +1503,7 @@ long __sched hrtimer_nanosleep_restart(struct 
restart_block *restart)
return ret;
 }
 
-long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
+long hrtimer_nanosleep(struct timespec64 *rqtp, struct timespec __user *rmtp,
   const enum hrtimer_mode mode, const clockid_t clockid)
 {
struct restart_block *restart;
@@ -1516,7 +1516,7 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct 
timespec __user *rmtp,
slack = 0;
 
hrtimer_init_on_stack(&t.timer, clockid, mode);
-   hrtimer_set_expires_range_ns(&t.timer, timespec_to_ktime(*rqtp), slack);
+   hrtimer_set_expires_range_ns(&t.timer, timespec64_to_ktime(*rqtp), 
slack);
if (do_nanosleep(&t, mode))
goto out;
 
@@ -1547,15 +1547,17 @@ long

[PATCH v2 2/7] time: Change posix clocks ops interfaces to use timespec64

2017-03-26 Thread Deepa Dinamani
struct timespec is not y2038 safe on 32 bit machines.

The posix clocks apis use struct timespec directly and
through struct itimerspec.

Replace the posix clock interfaces to use
struct timespec64 and struct itimerspec64 instead.
Also fix up their implementations accordingly.

Note that the clock_getres() interface has also been changed
to use timespec64 even though this particular interface is
not affected by the y2038 problem. This helps verification for
internal kernel code for y2038 readiness by getting rid of
time_t/ timeval/ timespec.

Signed-off-by: Deepa Dinamani 
Cc: Richard Cochran 
Cc: net...@vger.kernel.org
---
 drivers/ptp/ptp_clock.c | 18 +++---
 include/linux/posix-clock.h | 10 +-
 kernel/time/posix-clock.c   | 34 --
 3 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index e814280..b774357 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -97,30 +97,26 @@ static s32 scaled_ppm_to_ppb(long ppm)
 
 /* posix clock implementation */
 
-static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp)
+static int ptp_clock_getres(struct posix_clock *pc, struct timespec64 *tp)
 {
tp->tv_sec = 0;
tp->tv_nsec = 1;
return 0;
 }
 
-static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp)
+static int ptp_clock_settime(struct posix_clock *pc, const struct timespec64 
*tp)
 {
struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
-   struct timespec64 ts = timespec_to_timespec64(*tp);
 
-   return  ptp->info->settime64(ptp->info, &ts);
+   return  ptp->info->settime64(ptp->info, tp);
 }
 
-static int ptp_clock_gettime(struct posix_clock *pc, struct timespec *tp)
+static int ptp_clock_gettime(struct posix_clock *pc, struct timespec64 *tp)
 {
struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
-   struct timespec64 ts;
int err;
 
-   err = ptp->info->gettime64(ptp->info, &ts);
-   if (!err)
-   *tp = timespec64_to_timespec(ts);
+   err = ptp->info->gettime64(ptp->info, tp);
return err;
 }
 
@@ -133,7 +129,7 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct 
timex *tx)
ops = ptp->info;
 
if (tx->modes & ADJ_SETOFFSET) {
-   struct timespec ts;
+   struct timespec64 ts;
ktime_t kt;
s64 delta;
 
@@ -146,7 +142,7 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct 
timex *tx)
if ((unsigned long) ts.tv_nsec >= NSEC_PER_SEC)
return -EINVAL;
 
-   kt = timespec_to_ktime(ts);
+   kt = timespec64_to_ktime(ts);
delta = ktime_to_ns(kt);
err = ops->adjtime(ops, delta);
} else if (tx->modes & ADJ_FREQUENCY) {
diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h
index 34c4498..83b22ae 100644
--- a/include/linux/posix-clock.h
+++ b/include/linux/posix-clock.h
@@ -59,23 +59,23 @@ struct posix_clock_operations {
 
int  (*clock_adjtime)(struct posix_clock *pc, struct timex *tx);
 
-   int  (*clock_gettime)(struct posix_clock *pc, struct timespec *ts);
+   int  (*clock_gettime)(struct posix_clock *pc, struct timespec64 *ts);
 
-   int  (*clock_getres) (struct posix_clock *pc, struct timespec *ts);
+   int  (*clock_getres) (struct posix_clock *pc, struct timespec64 *ts);
 
int  (*clock_settime)(struct posix_clock *pc,
- const struct timespec *ts);
+ const struct timespec64 *ts);
 
int  (*timer_create) (struct posix_clock *pc, struct k_itimer *kit);
 
int  (*timer_delete) (struct posix_clock *pc, struct k_itimer *kit);
 
void (*timer_gettime)(struct posix_clock *pc,
- struct k_itimer *kit, struct itimerspec *tsp);
+ struct k_itimer *kit, struct itimerspec64 *tsp);
 
int  (*timer_settime)(struct posix_clock *pc,
  struct k_itimer *kit, int flags,
- struct itimerspec *tsp, struct itimerspec *old);
+ struct itimerspec64 *tsp, struct itimerspec64 
*old);
/*
 * Optional character device methods:
 */
diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c
index 9cff0ab..e24008c 100644
--- a/kernel/time/posix-clock.c
+++ b/kernel/time/posix-clock.c
@@ -300,14 +300,17 @@ static int pc_clock_adjtime(clockid_t id, struct timex 
*tx)
 static int pc_clock_gettime(clockid_t id, struct timespec *ts)
 {
struct posix_clock_desc cd;
+   struct timespec64 ts64;
int err;
 
err = get_clock_desc(id, &cd);
if (err)
return err;
 
-   if (cd.clk->ops.clock_gettime)
-   err = cd.clk->ops.cloc

[PATCH v2 6/7] Change k_clock timer_set() and timer_get() to use timespec64

2017-03-26 Thread Deepa Dinamani
struct timespec is not y2038 safe on 32 bit machines.
Replace uses of struct timespec with struct timespec64
in the kernel.

struct itimerspec internally uses struct timespec.
Use struct itimerspec64 which uses struct timespec64.

The syscall interfaces themselves will be changed
in a separate series.

Signed-off-by: Deepa Dinamani 
---
 drivers/char/mmtimer.c | 20 ++--
 include/linux/posix-timers.h   | 12 ++--
 kernel/time/alarmtimer.c   | 14 +++---
 kernel/time/posix-clock.c  | 21 +++--
 kernel/time/posix-cpu-timers.c | 28 
 kernel/time/posix-timers.c | 35 ---
 6 files changed, 66 insertions(+), 64 deletions(-)

diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c
index ba1b892..0e7fcb0 100644
--- a/drivers/char/mmtimer.c
+++ b/drivers/char/mmtimer.c
@@ -657,7 +657,7 @@ static int sgi_timer_del(struct k_itimer *timr)
 }
 
 /* Assumption: it_lock is already held with irq's disabled */
-static void sgi_timer_get(struct k_itimer *timr, struct itimerspec 
*cur_setting)
+static void sgi_timer_get(struct k_itimer *timr, struct itimerspec64 
*cur_setting)
 {
 
if (timr->it.mmtimer.clock == TIMER_OFF) {
@@ -668,14 +668,14 @@ static void sgi_timer_get(struct k_itimer *timr, struct 
itimerspec *cur_setting)
return;
}
 
-   cur_setting->it_interval = ns_to_timespec(timr->it.mmtimer.incr * 
sgi_clock_period);
-   cur_setting->it_value = ns_to_timespec((timr->it.mmtimer.expires - 
rtc_time()) * sgi_clock_period);
+   cur_setting->it_interval = ns_to_timespec64(timr->it.mmtimer.incr * 
sgi_clock_period);
+   cur_setting->it_value = ns_to_timespec64((timr->it.mmtimer.expires - 
rtc_time()) * sgi_clock_period);
 }
 
 
 static int sgi_timer_set(struct k_itimer *timr, int flags,
-   struct itimerspec * new_setting,
-   struct itimerspec * old_setting)
+   struct itimerspec64 *new_setting,
+   struct itimerspec64 *old_setting)
 {
unsigned long when, period, irqflags;
int err = 0;
@@ -687,8 +687,8 @@ static int sgi_timer_set(struct k_itimer *timr, int flags,
sgi_timer_get(timr, old_setting);
 
sgi_timer_del(timr);
-   when = timespec_to_ns(&new_setting->it_value);
-   period = timespec_to_ns(&new_setting->it_interval);
+   when = timespec64_to_ns(&new_setting->it_value);
+   period = timespec64_to_ns(&new_setting->it_interval);
 
if (when == 0)
/* Clear timer */
@@ -699,11 +699,11 @@ static int sgi_timer_set(struct k_itimer *timr, int flags,
return -ENOMEM;
 
if (flags & TIMER_ABSTIME) {
-   struct timespec n;
+   struct timespec64 n;
unsigned long now;
 
-   getnstimeofday(&n);
-   now = timespec_to_ns(&n);
+   getnstimeofday64(&n);
+   now = timespec64_to_ns(&n);
if (when > now)
when -= now;
else
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 7825e24..ebc4c494 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -96,13 +96,13 @@ struct k_clock {
int (*nsleep) (const clockid_t which_clock, int flags,
   struct timespec *, struct timespec __user *);
long (*nsleep_restart) (struct restart_block *restart_block);
-   int (*timer_set) (struct k_itimer * timr, int flags,
- struct itimerspec * new_setting,
- struct itimerspec * old_setting);
-   int (*timer_del) (struct k_itimer * timr);
+   int (*timer_set) (struct k_itimer *timr, int flags,
+ struct itimerspec64 *new_setting,
+ struct itimerspec64 *old_setting);
+   int (*timer_del) (struct k_itimer *timr);
 #define TIMER_RETRY 1
-   void (*timer_get) (struct k_itimer * timr,
-  struct itimerspec * cur_setting);
+   void (*timer_get) (struct k_itimer *timr,
+  struct itimerspec64 *cur_setting);
 };
 
 extern struct k_clock clock_posix_cpu;
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index e8a45e2..81db6df 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -598,19 +598,19 @@ static int alarm_timer_create(struct k_itimer *new_timer)
  * Copies out the current itimerspec data
  */
 static void alarm_timer_get(struct k_itimer *timr,
-   struct itimerspec *cur_setting)
+   struct itimerspec64 *cur_setting)
 {
ktime_t relative_expiry_time =
alarm_expires_remaining(&(timr->it.alarm.alarmtimer));
 
if (ktime_to_ns(relative_expiry_time) > 0) {
-   cur_setting->it_value = ktime_to_timespec(relative_expiry_time);
+   cur_setting->it_value =

Re: [PATCH] Documentation: Fix dead URLs to ftp.kernel.org

2017-03-26 Thread Jonathan Corbet
On Sun, 26 Mar 2017 23:25:50 +0900
SeongJae Park  wrote:

CC += davem

If nobody objects, I'll just take this through the docs tree.

Thanks,

jon

> As ftp.kernel.org is closed [0], this commit fixes dead URLs in
> documents to use www.kernel.org instead.
> 
> [0] https://www.kernel.org/shutting-down-ftp-services.html
> 
> Signed-off-by: SeongJae Park 
> ---
>  Documentation/early-userspace/README   |  2 +-
>  Documentation/filesystems/ext4.txt |  2 +-
>  Documentation/filesystems/nfs/nfs-rdma.txt |  2 +-
>  Documentation/networking/e100.txt  |  2 +-
>  Documentation/networking/e1000.txt |  2 +-
>  Documentation/networking/e1000e.txt|  2 +-
>  Documentation/networking/igb.txt   |  2 +-
>  Documentation/networking/igbvf.txt |  2 +-
>  Documentation/networking/ixgb.txt  |  2 +-
>  Documentation/networking/ixgbe.txt |  2 +-
>  Documentation/process/applying-patches.rst | 12 +++-
>  Documentation/process/changes.rst  | 10 +-
>  12 files changed, 18 insertions(+), 24 deletions(-)
> 
> diff --git a/Documentation/early-userspace/README 
> b/Documentation/early-userspace/README
> index 93e63a9af30b..2c00b072a4c8 100644
> --- a/Documentation/early-userspace/README
> +++ b/Documentation/early-userspace/README
> @@ -86,7 +86,7 @@ early userspace useful.  The klibc distribution is currently
>  maintained separately from the kernel.
>  
>  You can obtain somewhat infrequent snapshots of klibc from
> -ftp://ftp.kernel.org/pub/linux/libs/klibc/
> +https://www.kernel.org/pub/linux/libs/klibc/
>  
>  For active users, you are better off using the klibc git
>  repository, at http://git.kernel.org/?p=libs/klibc/klibc.git
> diff --git a/Documentation/filesystems/ext4.txt 
> b/Documentation/filesystems/ext4.txt
> index 3698ed3146e3..5a8f7f4d2bca 100644
> --- a/Documentation/filesystems/ext4.txt
> +++ b/Documentation/filesystems/ext4.txt
> @@ -25,7 +25,7 @@ Note: More extensive information for getting started with 
> ext4 can be
>   
>   or
>  
> -ftp://ftp.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/
> +https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/
>  
>   or grab the latest git repository from:
>  
> diff --git a/Documentation/filesystems/nfs/nfs-rdma.txt 
> b/Documentation/filesystems/nfs/nfs-rdma.txt
> index 1e6564545edf..31b55fe434d3 100644
> --- a/Documentation/filesystems/nfs/nfs-rdma.txt
> +++ b/Documentation/filesystems/nfs/nfs-rdma.txt
> @@ -113,7 +113,7 @@ Installation
>  kernel version 2.6.25 and later. This and other versions of the 2.6 Linux
>  kernel can be found at:
>  
> -ftp://ftp.kernel.org/pub/linux/kernel/v2.6/
> +https://www.kernel.org/pub/linux/kernel/v2.6/
>  
>  Download the sources and place them in an appropriate location.
>  
> diff --git a/Documentation/networking/e100.txt 
> b/Documentation/networking/e100.txt
> index 42ddbd4b52a9..54810b82c01a 100644
> --- a/Documentation/networking/e100.txt
> +++ b/Documentation/networking/e100.txt
> @@ -130,7 +130,7 @@ Additional Configurations
>version 1.6 or later is required for this functionality.
>  
>The latest release of ethtool can be found from
> -  http://ftp.kernel.org/pub/software/network/ethtool/
> +  https://www.kernel.org/pub/software/network/ethtool/
>  
>Enabling Wake on LAN* (WoL)
>---
> diff --git a/Documentation/networking/e1000.txt 
> b/Documentation/networking/e1000.txt
> index 437b2099cced..1f6ed848363d 100644
> --- a/Documentation/networking/e1000.txt
> +++ b/Documentation/networking/e1000.txt
> @@ -435,7 +435,7 @@ Additional Configurations
>version 1.6 or later is required for this functionality.
>  
>The latest release of ethtool can be found from
> -  http://ftp.kernel.org/pub/software/network/ethtool/
> +  https://www.kernel.org/pub/software/network/ethtool/
>  
>Enabling Wake on LAN* (WoL)
>---
> diff --git a/Documentation/networking/e1000e.txt 
> b/Documentation/networking/e1000e.txt
> index ad2d9f38ce14..12089547baed 100644
> --- a/Documentation/networking/e1000e.txt
> +++ b/Documentation/networking/e1000e.txt
> @@ -274,7 +274,7 @@ Additional Configurations
>diagnostics, as well as displaying statistical information.  We
>strongly recommend downloading the latest version of ethtool at:
>  
> -  http://ftp.kernel.org/pub/software/network/ethtool/
> +  https://kernel.org/pub/software/network/ethtool/
>  
>NOTE: When validating enable/disable tests on some parts (82578, for 
> example)
>you need to add a few seconds between tests when working with ethtool.
> diff --git a/Documentation/networking/igb.txt 
> b/Documentation/networking/igb.txt
> index 15534fdd09a8..f90643ef39c9 100644
> --- a/Documentation/networking/igb.txt
> +++ b/Documentation/networking/igb.txt
> @@ -63,7 +63,7 @@ Additional Configurations
>diagnostics, as well as displaying statistical information. The latest
>  

[PATCH v2 1/7] time: Delete do_sys_setimeofday()

2017-03-26 Thread Deepa Dinamani
struct timespec is not y2038 safe on 32 bit machines
and needs to be replaced with struct timespec64.

do_sys_timeofday() is just a wrapper function.
Replace all calls to this function with direct
calls to do_sys_timeofday64() instead and delete
do_sys_timeofday().

Signed-off-by: Deepa Dinamani 
Cc: linux-al...@vger.kernel.org
---
 arch/alpha/kernel/osf_sys.c |  4 +++-
 include/linux/timekeeping.h | 15 ---
 kernel/compat.c |  4 ++--
 kernel/time/posix-stubs.c   |  5 -
 kernel/time/posix-timers.c  |  5 -
 kernel/time/time.c  |  4 ++--
 6 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 0b96109..9de47a9 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -1016,6 +1016,7 @@ SYSCALL_DEFINE2(osf_gettimeofday, struct timeval32 __user 
*, tv,
 SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 __user *, tv,
struct timezone __user *, tz)
 {
+   struct timespec64 kts64;
struct timespec kts;
struct timezone ktz;
 
@@ -1023,13 +1024,14 @@ SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 
__user *, tv,
if (get_tv32((struct timeval *)&kts, tv))
return -EFAULT;
kts.tv_nsec *= 1000;
+   kts64 = timespec_to_timespec64(kts);
}
if (tz) {
if (copy_from_user(&ktz, tz, sizeof(*tz)))
return -EFAULT;
}
 
-   return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
+   return do_sys_settimeofday64(tv ? &kts64 : NULL, tz ? &ktz : NULL);
 }
 
 asmlinkage long sys_ni_posix_timers(void);
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index b598cbc..3617a78 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -19,21 +19,6 @@ extern void do_gettimeofday(struct timeval *tv);
 extern int do_settimeofday64(const struct timespec64 *ts);
 extern int do_sys_settimeofday64(const struct timespec64 *tv,
 const struct timezone *tz);
-static inline int do_sys_settimeofday(const struct timespec *tv,
- const struct timezone *tz)
-{
-   struct timespec64 ts64;
-
-   if (!tv)
-   return do_sys_settimeofday64(NULL, tz);
-
-   if (!timespec_valid(tv))
-   return -EINVAL;
-
-   ts64 = timespec_to_timespec64(*tv);
-   return do_sys_settimeofday64(&ts64, tz);
-}
-
 /*
  * Kernel time accessors
  */
diff --git a/kernel/compat.c b/kernel/compat.c
index 19aec5d..e29a01a 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -109,7 +109,7 @@ COMPAT_SYSCALL_DEFINE2(settimeofday, struct compat_timeval 
__user *, tv,
   struct timezone __user *, tz)
 {
struct timeval user_tv;
-   struct timespec new_ts;
+   struct timespec64 new_ts;
struct timezone new_tz;
 
if (tv) {
@@ -123,7 +123,7 @@ COMPAT_SYSCALL_DEFINE2(settimeofday, struct compat_timeval 
__user *, tv,
return -EFAULT;
}
 
-   return do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
+   return do_sys_settimeofday64(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
 }
 
 static int __compat_get_timeval(struct timeval *tv, const struct 
compat_timeval __user *ctv)
diff --git a/kernel/time/posix-stubs.c b/kernel/time/posix-stubs.c
index cd6716e..95a1b1f 100644
--- a/kernel/time/posix-stubs.c
+++ b/kernel/time/posix-stubs.c
@@ -49,13 +49,16 @@ SYS_NI(alarm);
 SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
const struct timespec __user *, tp)
 {
+   struct timespec64 new_tp64;
struct timespec new_tp;
 
if (which_clock != CLOCK_REALTIME)
return -EINVAL;
if (copy_from_user(&new_tp, tp, sizeof (*tp)))
return -EFAULT;
-   return do_sys_settimeofday(&new_tp, NULL);
+
+   new_tp64 = timespec_to_timespec64(new_tp);
+   return do_sys_settimeofday64(&new_tp64, NULL);
 }
 
 SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index 50a6a47..f215ef7 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -214,7 +214,10 @@ static int posix_clock_realtime_get(clockid_t which_clock, 
struct timespec *tp)
 static int posix_clock_realtime_set(const clockid_t which_clock,
const struct timespec *tp)
 {
-   return do_sys_settimeofday(tp, NULL);
+   struct timespec64 tp64;
+
+   tp64 = timespec_to_timespec64(*tp);
+   return do_sys_settimeofday64(&tp64, NULL);
 }
 
 static int posix_clock_realtime_adj(const clockid_t which_clock,
diff --git a/kernel/time/time.c b/kernel/time/time.c
index 25bdd25..6574bba 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -193,8 +193,8 @@ int do_sys_settimeofday64(co

[PATCH v2 3/7] Change k_clock clock_get() to use timespec64

2017-03-26 Thread Deepa Dinamani
struct timespec is not y2038 safe on 32 bit machines.
Replace uses of struct timespec with struct timespec64
in the kernel.

The syscall interfaces themselves will be changed
in a separate series.

Signed-off-by: Deepa Dinamani 
---
 drivers/char/mmtimer.c |  4 ++--
 include/linux/posix-timers.h   |  2 +-
 include/linux/timekeeping.h|  5 +
 kernel/time/alarmtimer.c   |  4 ++--
 kernel/time/posix-clock.c  |  9 +++--
 kernel/time/posix-cpu-timers.c | 10 +-
 kernel/time/posix-stubs.c  |  9 ++---
 kernel/time/posix-timers.c | 32 +---
 8 files changed, 41 insertions(+), 34 deletions(-)

diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c
index b708c85..40d880b 100644
--- a/drivers/char/mmtimer.c
+++ b/drivers/char/mmtimer.c
@@ -478,13 +478,13 @@ static int sgi_clock_period;
 static struct timespec sgi_clock_offset;
 static int sgi_clock_period;
 
-static int sgi_clock_get(clockid_t clockid, struct timespec *tp)
+static int sgi_clock_get(clockid_t clockid, struct timespec64 *tp)
 {
u64 nsec;
 
nsec = rtc_time() * sgi_clock_period
+ sgi_clock_offset.tv_nsec;
-   *tp = ns_to_timespec(nsec);
+   *tp = ns_to_timespec64(nsec);
tp->tv_sec += sgi_clock_offset.tv_sec;
return 0;
 };
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 64aa189..0688f39 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -90,7 +90,7 @@ struct k_clock {
int (*clock_getres) (const clockid_t which_clock, struct timespec *tp);
int (*clock_set) (const clockid_t which_clock,
  const struct timespec *tp);
-   int (*clock_get) (const clockid_t which_clock, struct timespec * tp);
+   int (*clock_get) (const clockid_t which_clock, struct timespec64 *tp);
int (*clock_adj) (const clockid_t which_clock, struct timex *tx);
int (*timer_create) (struct k_itimer *timer);
int (*nsleep) (const clockid_t which_clock, int flags,
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 3617a78..ddc229f 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -258,6 +258,11 @@ static inline void timekeeping_clocktai(struct timespec 
*ts)
*ts = ktime_to_timespec(ktime_get_clocktai());
 }
 
+static inline void timekeeping_clocktai64(struct timespec64 *ts)
+{
+   *ts = ktime_to_timespec64(ktime_get_clocktai());
+}
+
 /*
  * RTC specific
  */
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index ce3a31e..944ca6e 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -558,14 +558,14 @@ static int alarm_clock_getres(const clockid_t 
which_clock, struct timespec *tp)
  *
  * Provides the underlying alarm base time.
  */
-static int alarm_clock_get(clockid_t which_clock, struct timespec *tp)
+static int alarm_clock_get(clockid_t which_clock, struct timespec64 *tp)
 {
struct alarm_base *base = &alarm_bases[clock2alarm(which_clock)];
 
if (!alarmtimer_get_rtcdev())
return -EINVAL;
 
-   *tp = ktime_to_timespec(base->gettime());
+   *tp = ktime_to_timespec64(base->gettime());
return 0;
 }
 
diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c
index e24008c..fab6bd3 100644
--- a/kernel/time/posix-clock.c
+++ b/kernel/time/posix-clock.c
@@ -297,20 +297,17 @@ static int pc_clock_adjtime(clockid_t id, struct timex 
*tx)
return err;
 }
 
-static int pc_clock_gettime(clockid_t id, struct timespec *ts)
+static int pc_clock_gettime(clockid_t id, struct timespec64 *ts)
 {
struct posix_clock_desc cd;
-   struct timespec64 ts64;
int err;
 
err = get_clock_desc(id, &cd);
if (err)
return err;
 
-   if (cd.clk->ops.clock_gettime) {
-   err = cd.clk->ops.clock_gettime(cd.clk, &ts64);
-   *ts = timespec64_to_timespec(ts64);
-   }
+   if (cd.clk->ops.clock_gettime)
+   err = cd.clk->ops.clock_gettime(cd.clk, ts);
else
err = -EOPNOTSUPP;
 
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index 76bea3a..082231c 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -261,7 +261,7 @@ static int cpu_clock_sample_group(const clockid_t 
which_clock,
 
 static int posix_cpu_clock_get_task(struct task_struct *tsk,
const clockid_t which_clock,
-   struct timespec *tp)
+   struct timespec64 *tp)
 {
int err = -EINVAL;
u64 rtn;
@@ -275,13 +275,13 @@ static int posix_cpu_clock_get_task(struct task_struct 
*tsk,
}
 
if (!err)
-   *tp = ns_to_timespec(rtn);
+   *tp = ns_to_timespec64(rtn);
 
return err;
 }
 
 
-static int posix_cpu_clock_get(c

[PATCH v2 4/7] Change k_clock clock_getres() to use timespec64

2017-03-26 Thread Deepa Dinamani
struct timespec is not y2038 safe on 32 bit machines.
Replace uses of struct timespec with struct timespec64
in the kernel.

The syscall interfaces themselves will be changed
in a separate series.

Note that the clock_getres() interface has also been changed
to use timespec64 even though this particular interface is
not affected by the y2038 problem. This helps verification for
internal kernel code for y2038 readiness by getting rid of
time_t/ timeval/ timespec.

Signed-off-by: Deepa Dinamani 
---
 drivers/char/mmtimer.c |  2 +-
 include/linux/posix-timers.h   |  2 +-
 kernel/time/alarmtimer.c   |  2 +-
 kernel/time/posix-clock.c  |  9 +++--
 kernel/time/posix-cpu-timers.c |  6 +++---
 kernel/time/posix-timers.c | 10 ++
 6 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c
index 40d880b..79d8ada 100644
--- a/drivers/char/mmtimer.c
+++ b/drivers/char/mmtimer.c
@@ -765,7 +765,7 @@ static int sgi_timer_set(struct k_itimer *timr, int flags,
return err;
 }
 
-static int sgi_clock_getres(const clockid_t which_clock, struct timespec *tp)
+static int sgi_clock_getres(const clockid_t which_clock, struct timespec64 *tp)
 {
tp->tv_sec = 0;
tp->tv_nsec = sgi_clock_period;
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 0688f39..dd05b49 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -87,7 +87,7 @@ struct k_itimer {
 };
 
 struct k_clock {
-   int (*clock_getres) (const clockid_t which_clock, struct timespec *tp);
+   int (*clock_getres) (const clockid_t which_clock, struct timespec64 
*tp);
int (*clock_set) (const clockid_t which_clock,
  const struct timespec *tp);
int (*clock_get) (const clockid_t which_clock, struct timespec64 *tp);
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index 944ca6e..e8a45e2 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -541,7 +541,7 @@ static enum alarmtimer_restart alarm_handle_timer(struct 
alarm *alarm,
  *
  * Returns the granularity of underlying alarm base clock
  */
-static int alarm_clock_getres(const clockid_t which_clock, struct timespec *tp)
+static int alarm_clock_getres(const clockid_t which_clock, struct timespec64 
*tp)
 {
if (!alarmtimer_get_rtcdev())
return -EINVAL;
diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c
index fab6bd3..af91031 100644
--- a/kernel/time/posix-clock.c
+++ b/kernel/time/posix-clock.c
@@ -316,20 +316,17 @@ static int pc_clock_gettime(clockid_t id, struct 
timespec64 *ts)
return err;
 }
 
-static int pc_clock_getres(clockid_t id, struct timespec *ts)
+static int pc_clock_getres(clockid_t id, struct timespec64 *ts)
 {
struct posix_clock_desc cd;
-   struct timespec64 ts64;
int err;
 
err = get_clock_desc(id, &cd);
if (err)
return err;
 
-   if (cd.clk->ops.clock_getres) {
-   err = cd.clk->ops.clock_getres(cd.clk, &ts64);
-   *ts = timespec64_to_timespec(ts64);
-   }
+   if (cd.clk->ops.clock_getres)
+   err = cd.clk->ops.clock_getres(cd.clk, ts);
else
err = -EOPNOTSUPP;
 
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index 082231c..37ce9ed 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -116,7 +116,7 @@ static inline u64 virt_ticks(struct task_struct *p)
 }
 
 static int
-posix_cpu_clock_getres(const clockid_t which_clock, struct timespec *tp)
+posix_cpu_clock_getres(const clockid_t which_clock, struct timespec64 *tp)
 {
int error = check_clock(which_clock);
if (!error) {
@@ -1369,7 +1369,7 @@ static long posix_cpu_nsleep_restart(struct restart_block 
*restart_block)
 #define THREAD_CLOCK   MAKE_THREAD_CPUCLOCK(0, CPUCLOCK_SCHED)
 
 static int process_cpu_clock_getres(const clockid_t which_clock,
-   struct timespec *tp)
+   struct timespec64 *tp)
 {
return posix_cpu_clock_getres(PROCESS_CLOCK, tp);
 }
@@ -1394,7 +1394,7 @@ static long process_cpu_nsleep_restart(struct 
restart_block *restart_block)
return -EINVAL;
 }
 static int thread_cpu_clock_getres(const clockid_t which_clock,
-  struct timespec *tp)
+  struct timespec64 *tp)
 {
return posix_cpu_clock_getres(THREAD_CLOCK, tp);
 }
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index 6817064..f67dae9 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -258,9 +258,9 @@ static int posix_get_monotonic_coarse(clockid_t which_clock,
return 0;
 }
 
-static int posix_get_coarse_res(const clockid_t which_clock, struct timespec 
*tp)
+static int posix_get_coarse_res(const clockid_t whic

Re: [PATCH v4 1/4] i2c: designware: wait for disable/enable only if necessary

2017-03-26 Thread Andrey Utkin
On Tue, Aug 23, 2016 at 07:18:53PM -0300, Lucas De Marchi wrote:
> From: José Roberto de Souza 
> 
> If we aren't going to continue using the controller we can just disable
> it instead of waiting for it to complete. The biggest improvement here
> is when a I2C transaction is completed and it doesn't block until
> the adapter is disabled. When a new transfer is needed we will disable
> and wait for its completion.
> 
> This way the adapter will continue changing its state in parallel to the
> execution of the thread that requested the I2C transaction saving most
> of the time 25~250 usec per I2C transaction.
> 
> A simple program doing a register read (1 byte write, 1 byte read)
> alternating on 2 different slaves repeated 25k times for each and
> measurements taken 4 times we get:
> 
> perf stat -r4 chrt -f 10 ./i2c-test /dev/i2c-1 25000 0x40 0x6 0x1e 0x00
> 
> Before:
>   30.879317977 seconds time elapsed ( +- 14.83% )
> After:
>   8.638705161 seconds time elapsed  ( +-  5.90% )
> 
> Signed-off-by: José Roberto de Souza 
> Signed-off-by: Lucas De Marchi 
> ---
>  drivers/i2c/busses/i2c-designware-core.c | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-core.c 
> b/drivers/i2c/busses/i2c-designware-core.c
> index 99b54be..2c61585 100644
> --- a/drivers/i2c/busses/i2c-designware-core.c
> +++ b/drivers/i2c/busses/i2c-designware-core.c
> @@ -252,10 +252,15 @@ static u32 i2c_dw_scl_lcnt(u32 ic_clk, u32 tLOW, u32 
> tf, int offset)
>  
>  static void __i2c_dw_enable(struct dw_i2c_dev *dev, bool enable)
>  {
> + dw_writel(dev, enable, DW_IC_ENABLE);
> +}
> +
> +static void __i2c_dw_enable_and_wait(struct dw_i2c_dev *dev, bool enable)
> +{
>   int timeout = 100;
>  
>   do {
> - dw_writel(dev, enable, DW_IC_ENABLE);
> + __i2c_dw_enable(dev, enable);
>   if ((dw_readl(dev, DW_IC_ENABLE_STATUS) & 1) == enable)
>   return;
>  
> @@ -321,7 +326,7 @@ int i2c_dw_init(struct dw_i2c_dev *dev)
>   }
>  
>   /* Disable the adapter */
> - __i2c_dw_enable(dev, false);
> + __i2c_dw_enable_and_wait(dev, false);
>  
>   /* set standard and fast speed deviders for high/low periods */
>  
> @@ -414,7 +419,7 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)
>   u32 ic_con, ic_tar = 0;
>  
>   /* Disable the adapter */
> - __i2c_dw_enable(dev, false);
> + __i2c_dw_enable_and_wait(dev, false);
>  
>   /* if the slave address is ten bit address, enable 10BITADDR */
>   ic_con = dw_readl(dev, DW_IC_CON);
> @@ -833,7 +838,7 @@ tx_aborted:
>  void i2c_dw_disable(struct dw_i2c_dev *dev)
>  {
>   /* Disable controller */
> - __i2c_dw_enable(dev, false);
> + __i2c_dw_enable_and_wait(dev, false);
>  
>   /* Disable all interupts */
>   dw_writel(dev, 0, DW_IC_INTR_MASK);
> -- 
> 2.7.4
> 

Regression reported: https://bugzilla.kernel.org/show_bug.cgi?id=194969


Re: [PATCH v4] tpm_crb: request and relinquish locality 0

2017-03-26 Thread Jarkko Sakkinen
On Sun, Mar 26, 2017 at 12:39:29PM -0400, Jerry Snitselaar wrote:
> 
> 
> - Original Message -
> > From: "Jarkko Sakkinen" 
> > To: "Jerry Snitselaar" , "gang wei" 
> > 
> > Cc: "Jarkko Sakkinen" , 
> > tpmdd-de...@lists.sourceforge.net,
> > linux-security-mod...@vger.kernel.org, "Peter Huewe" , 
> > "Marcel Selhorst" ,
> > "Jason Gunthorpe" , "open list" 
> > 
> > Sent: Sunday, March 26, 2017 3:52:39 AM
> > Subject: Re: [PATCH v4] tpm_crb: request and relinquish locality 0
> > 
> > On Sat, Mar 25, 2017 at 09:52:11PM +0200, Jarkko Sakkinen wrote:
> > > On Fri, Mar 24, 2017 at 11:25:57AM -0700, Jerry Snitselaar wrote:
> > > > 
> > > > Jarkko Sakkinen @ 2017-03-24 10:10 GMT:
> > > > 
> > > > > This commit adds support for requesting and relinquishing locality 0 
> > > > > in
> > > > > tpm_crb for the course of command transmission.
> > > > >
> > > > > In order to achieve this, two new callbacks are added to struct
> > > > > tpm_class_ops:
> > > > >
> > > > > - request_locality
> > > > > - relinquish_locality
> > > > >
> > > > > With CRB interface you first set either requestAccess or relinquish 
> > > > > bit
> > > > > from TPM_LOC_CTRL_x register and then wait for locAssigned and
> > > > > tpmRegValidSts bits to be set in the TPM_LOC_STATE_x register.
> > > > >
> > > > > The reason why were are doing this is to make sure that the driver
> > > > > will work properly with Intel TXT that uses locality 2. There's no
> > > > > explicit guarantee that it would relinquish this locality. In more
> > > > > general sense this commit enables tpm_crb to be a well behaving
> > > > > citizen in a multi locality environment.
> > > > >
> > > > > Signed-off-by: Jarkko Sakkinen 
> > > > 
> > > > Reviewed-by: Jerry Snitselaar 
> > > > Tested-by: Jerry Snitselaar 
> > > > 
> > > > Tested on kabylake system that was hitting issues with earlier
> > > > iteration. Still don't have platform to test it dealing with
> > > > multi-locality enviroment.
> > > 
> > > I believe Jimmy (Gang Wei) has done such testing. Jimmy can you confirm
> > > and possibly do re-test (there's a locality branch in my tree to ease
> > > the testing) so that we could land this one?
> > > 
> > > /Jarkko
> > 
> > I applied this to my master and next branches.
> > 
> > /Jarkko
> > 
> 
> Hi Jarkko,
> 
> The patch applied to next and master doesn't have the assignment moved
> inside the mutex.

WTF, I applied old patch version by mistake. Sorry about that and
thanks for spotting that out. Better?

/Jarkko


[PATCH] net: tehuti: use new api ethtool_{get|set}_link_ksettings

2017-03-26 Thread Philippe Reynes
The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes 
---
 drivers/net/ethernet/tehuti/tehuti.c |   43 ++---
 1 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ethernet/tehuti/tehuti.c 
b/drivers/net/ethernet/tehuti/tehuti.c
index f864fd0..711fbbb 100644
--- a/drivers/net/ethernet/tehuti/tehuti.c
+++ b/drivers/net/ethernet/tehuti/tehuti.c
@@ -2124,33 +2124,26 @@ static void bdx_tx_push_desc_safe(struct bdx_priv 
*priv, void *data, int size)
 };
 
 /*
- * bdx_get_settings - get device-specific settings
+ * bdx_get_link_ksettings - get device-specific settings
  * @netdev
  * @ecmd
  */
-static int bdx_get_settings(struct net_device *netdev, struct ethtool_cmd 
*ecmd)
-{
-   u32 rdintcm;
-   u32 tdintcm;
-   struct bdx_priv *priv = netdev_priv(netdev);
-
-   rdintcm = priv->rdintcm;
-   tdintcm = priv->tdintcm;
-
-   ecmd->supported = (SUPPORTED_1baseT_Full | SUPPORTED_FIBRE);
-   ecmd->advertising = (ADVERTISED_1baseT_Full | ADVERTISED_FIBRE);
-   ethtool_cmd_speed_set(ecmd, SPEED_1);
-   ecmd->duplex = DUPLEX_FULL;
-   ecmd->port = PORT_FIBRE;
-   ecmd->transceiver = XCVR_EXTERNAL;  /* what does it mean? */
-   ecmd->autoneg = AUTONEG_DISABLE;
-
-   /* PCK_TH measures in multiples of FIFO bytes
-  We translate to packets */
-   ecmd->maxtxpkt =
-   ((GET_PCK_TH(tdintcm) * PCK_TH_MULT) / BDX_TXF_DESC_SZ);
-   ecmd->maxrxpkt =
-   ((GET_PCK_TH(rdintcm) * PCK_TH_MULT) / sizeof(struct rxf_desc));
+static int bdx_get_link_ksettings(struct net_device *netdev,
+ struct ethtool_link_ksettings *ecmd)
+{
+   ethtool_link_ksettings_zero_link_mode(ecmd, supported);
+   ethtool_link_ksettings_add_link_mode(ecmd, supported,
+1baseT_Full);
+   ethtool_link_ksettings_add_link_mode(ecmd, supported, FIBRE);
+   ethtool_link_ksettings_zero_link_mode(ecmd, advertising);
+   ethtool_link_ksettings_add_link_mode(ecmd, advertising,
+1baseT_Full);
+   ethtool_link_ksettings_add_link_mode(ecmd, advertising, FIBRE);
+
+   ecmd->base.speed = SPEED_1;
+   ecmd->base.duplex = DUPLEX_FULL;
+   ecmd->base.port = PORT_FIBRE;
+   ecmd->base.autoneg = AUTONEG_DISABLE;
 
return 0;
 }
@@ -2384,7 +2377,6 @@ static void bdx_get_ethtool_stats(struct net_device 
*netdev,
 static void bdx_set_ethtool_ops(struct net_device *netdev)
 {
static const struct ethtool_ops bdx_ethtool_ops = {
-   .get_settings = bdx_get_settings,
.get_drvinfo = bdx_get_drvinfo,
.get_link = ethtool_op_get_link,
.get_coalesce = bdx_get_coalesce,
@@ -2394,6 +2386,7 @@ static void bdx_set_ethtool_ops(struct net_device *netdev)
.get_strings = bdx_get_strings,
.get_sset_count = bdx_get_sset_count,
.get_ethtool_stats = bdx_get_ethtool_stats,
+   .get_link_ksettings = bdx_get_link_ksettings,
};
 
netdev->ethtool_ops = &bdx_ethtool_ops;
-- 
1.7.4.4



Re: [RFC PATCH 1/1] tpm_tis: convert to using locality callbacks

2017-03-26 Thread Jason Gunthorpe
On Sat, Mar 25, 2017 at 01:05:21PM -0700, Jerry Snitselaar wrote:

> @@ -672,7 +658,7 @@ void tpm_tis_remove(struct tpm_chip *chip)
>   interrupt = 0;
>  
>   tpm_tis_write32(priv, reg, ~TPM_GLOBAL_INT_ENABLE & interrupt);
> - release_locality(chip, priv->locality, 1);
> + release_locality(chip, priv->locality);

Why is this done during remove? The tpm core should now keep things so
that there is not a requested locality except during command so execution
we should not get here with a requested locality..

Jason


  1   2   3   >