Re: cross compilers [was build failure of sorts]

2016-06-20 Thread Vineet Gupta
On Saturday 18 June 2016 03:47 PM, Peter Zijlstra wrote:
> As you can see, arc doesn't even build upstream binutils :/
> (binutils-2_26-branch as of today).

Hmm - we are still in fight w.r.t. upstreaming gcc fully (ARCv2 gcc support)
although ARCompact has been there for some time. binutils upstream should work -
I'll check why the buildall stuff fails.

We currently have our tools on github but presume that won't work for you due to
non canonical location / version !

-Vineet


Re: cross compilers [was build failure of sorts]

2016-06-20 Thread Vineet Gupta
On Saturday 18 June 2016 03:47 PM, Peter Zijlstra wrote:
> As you can see, arc doesn't even build upstream binutils :/
> (binutils-2_26-branch as of today).

Hmm - we are still in fight w.r.t. upstreaming gcc fully (ARCv2 gcc support)
although ARCompact has been there for some time. binutils upstream should work -
I'll check why the buildall stuff fails.

We currently have our tools on github but presume that won't work for you due to
non canonical location / version !

-Vineet


Re: [alsa-devel] [very-RFC 0/8] TSN driver for the kernel

2016-06-20 Thread Takashi Iwai
On Mon, 20 Jun 2016 17:21:26 +0200,
Richard Cochran wrote:
> 
> On Mon, Jun 20, 2016 at 02:31:48PM +0200, Richard Cochran wrote:
> > Where is this "audio_time" program of which you speak?
> 
> Never mind, found it in alsa-lib.
> 
> I still would appreciate an answer to my other questions, though...

Currently HD-audio (both ASoC and legacy ones) are the only drivers
providing the link timestamp.  In the recent code, it's PCM
get_time_info ops, so you can easily grep it.


HTH,

Takashi


Re: [alsa-devel] [very-RFC 0/8] TSN driver for the kernel

2016-06-20 Thread Takashi Iwai
On Mon, 20 Jun 2016 17:21:26 +0200,
Richard Cochran wrote:
> 
> On Mon, Jun 20, 2016 at 02:31:48PM +0200, Richard Cochran wrote:
> > Where is this "audio_time" program of which you speak?
> 
> Never mind, found it in alsa-lib.
> 
> I still would appreciate an answer to my other questions, though...

Currently HD-audio (both ASoC and legacy ones) are the only drivers
providing the link timestamp.  In the recent code, it's PCM
get_time_info ops, so you can easily grep it.


HTH,

Takashi


Re: [PATCH v8 2/3] CMDQ: Mediatek CMDQ driver

2016-06-20 Thread Horng-Shyang Liao
On Fri, 2016-06-17 at 17:57 +0200, Matthias Brugger wrote:
> 
> On 17/06/16 10:28, Horng-Shyang Liao wrote:
> > Hi Matthias,
> >
> > On Tue, 2016-06-14 at 20:07 +0800, Horng-Shyang Liao wrote:
> >> Hi Matthias,
> >>
> >> On Tue, 2016-06-14 at 12:17 +0200, Matthias Brugger wrote:
> >>>
> >>> On 14/06/16 09:44, Horng-Shyang Liao wrote:
>  Hi Matthias,
> 
>  On Wed, 2016-06-08 at 17:35 +0200, Matthias Brugger wrote:
> >
> > On 08/06/16 14:25, Horng-Shyang Liao wrote:
> >> Hi Matthias,
> >>
> >> On Wed, 2016-06-08 at 12:45 +0200, Matthias Brugger wrote:
> >>>
> >>> On 08/06/16 07:40, Horng-Shyang Liao wrote:
>  Hi Matthias,
> 
>  On Tue, 2016-06-07 at 18:59 +0200, Matthias Brugger wrote:
> >
> > On 03/06/16 15:11, Matthias Brugger wrote:
> >>
> >>
> > [...]
> >
> >>> +
> >>> +smp_mb(); /* modify jump before enable 
> >>> thread */
> >>> +}
> >>> +
> >>> +cmdq_thread_writel(thread, task->pa_base +
> >>> task->command_size,
> >>> +   CMDQ_THR_END_ADDR);
> >>> +cmdq_thread_resume(thread);
> >>> +}
> >>> +list_move_tail(>list_entry, 
> >>> >task_busy_list);
> >>> +spin_unlock_irqrestore(>exec_lock, flags);
> >>> +}
> >>> +
> >>> +static void cmdq_handle_error_done(struct cmdq *cmdq,
> >>> +   struct cmdq_thread *thread, u32 
> >>> irq_flag)
> >>> +{
> >>> +struct cmdq_task *task, *tmp, *curr_task = NULL;
> >>> +u32 curr_pa;
> >>> +struct cmdq_cb_data cmdq_cb_data;
> >>> +bool err;
> >>> +
> >>> +if (irq_flag & CMDQ_THR_IRQ_ERROR)
> >>> +err = true;
> >>> +else if (irq_flag & CMDQ_THR_IRQ_DONE)
> >>> +err = false;
> >>> +else
> >>> +return;
> >>> +
> >>> +curr_pa = cmdq_thread_readl(thread, 
> >>> CMDQ_THR_CURR_ADDR);
> >>> +
> >>> +list_for_each_entry_safe(task, tmp, 
> >>> >task_busy_list,
> >>> + list_entry) {
> >>> +if (curr_pa >= task->pa_base &&
> >>> +curr_pa < (task->pa_base + 
> >>> task->command_size))
> >>
> >> What are you checking here? It seems as if you make some 
> >> implcit
> >> assumptions about pa_base and the order of execution of
> >> commands in the
> >> thread. Is it save to do so? Does dma_alloc_coherent give 
> >> any
> >> guarantees
> >> about dma_handle?
> >
> > 1. Check what is the current running task in this GCE 
> > thread.
> > 2. Yes.
> > 3. Yes, CMDQ doesn't use iommu, so physical address is 
> > continuous.
> >
> 
>  Yes, physical addresses might be continous, but AFAIK there 
>  is no
>  guarantee that the dma_handle address is steadily growing, 
>  when
>  calling
>  dma_alloc_coherent. And if I understand the code correctly, 
>  you
>  use this
>  assumption to decide if the task picked from task_busy_list 
>  is
>  currently
>  executing. So I think this mecanism is not working.
> >>>
> >>> I don't use dma_handle address, and just use physical 
> >>> addresses.
> >>>From CPU's point of view, tasks are linked by the busy 
> >>> list.
> >>>From GCE's point of view, tasks are linked by the JUMP 
> >>> command.
> >>>
>  In which cases does the HW thread raise an interrupt.
>  In case of error. When does CMDQ_THR_IRQ_DONE get raised?
> >>>
> >>> GCE will raise interrupt if any task is done or error.
> >>> However, GCE is fast, so CPU may get multiple done tasks
> >>> when it is running ISR.
> >>>
> >>> In case of error, that GCE thread will pause and raise 
> >>> interrupt.
> >>> So, CPU may get multiple done tasks and one error task.
> >>>
> >>
> 

Re: [PATCH v8 2/3] CMDQ: Mediatek CMDQ driver

2016-06-20 Thread Horng-Shyang Liao
On Fri, 2016-06-17 at 17:57 +0200, Matthias Brugger wrote:
> 
> On 17/06/16 10:28, Horng-Shyang Liao wrote:
> > Hi Matthias,
> >
> > On Tue, 2016-06-14 at 20:07 +0800, Horng-Shyang Liao wrote:
> >> Hi Matthias,
> >>
> >> On Tue, 2016-06-14 at 12:17 +0200, Matthias Brugger wrote:
> >>>
> >>> On 14/06/16 09:44, Horng-Shyang Liao wrote:
>  Hi Matthias,
> 
>  On Wed, 2016-06-08 at 17:35 +0200, Matthias Brugger wrote:
> >
> > On 08/06/16 14:25, Horng-Shyang Liao wrote:
> >> Hi Matthias,
> >>
> >> On Wed, 2016-06-08 at 12:45 +0200, Matthias Brugger wrote:
> >>>
> >>> On 08/06/16 07:40, Horng-Shyang Liao wrote:
>  Hi Matthias,
> 
>  On Tue, 2016-06-07 at 18:59 +0200, Matthias Brugger wrote:
> >
> > On 03/06/16 15:11, Matthias Brugger wrote:
> >>
> >>
> > [...]
> >
> >>> +
> >>> +smp_mb(); /* modify jump before enable 
> >>> thread */
> >>> +}
> >>> +
> >>> +cmdq_thread_writel(thread, task->pa_base +
> >>> task->command_size,
> >>> +   CMDQ_THR_END_ADDR);
> >>> +cmdq_thread_resume(thread);
> >>> +}
> >>> +list_move_tail(>list_entry, 
> >>> >task_busy_list);
> >>> +spin_unlock_irqrestore(>exec_lock, flags);
> >>> +}
> >>> +
> >>> +static void cmdq_handle_error_done(struct cmdq *cmdq,
> >>> +   struct cmdq_thread *thread, u32 
> >>> irq_flag)
> >>> +{
> >>> +struct cmdq_task *task, *tmp, *curr_task = NULL;
> >>> +u32 curr_pa;
> >>> +struct cmdq_cb_data cmdq_cb_data;
> >>> +bool err;
> >>> +
> >>> +if (irq_flag & CMDQ_THR_IRQ_ERROR)
> >>> +err = true;
> >>> +else if (irq_flag & CMDQ_THR_IRQ_DONE)
> >>> +err = false;
> >>> +else
> >>> +return;
> >>> +
> >>> +curr_pa = cmdq_thread_readl(thread, 
> >>> CMDQ_THR_CURR_ADDR);
> >>> +
> >>> +list_for_each_entry_safe(task, tmp, 
> >>> >task_busy_list,
> >>> + list_entry) {
> >>> +if (curr_pa >= task->pa_base &&
> >>> +curr_pa < (task->pa_base + 
> >>> task->command_size))
> >>
> >> What are you checking here? It seems as if you make some 
> >> implcit
> >> assumptions about pa_base and the order of execution of
> >> commands in the
> >> thread. Is it save to do so? Does dma_alloc_coherent give 
> >> any
> >> guarantees
> >> about dma_handle?
> >
> > 1. Check what is the current running task in this GCE 
> > thread.
> > 2. Yes.
> > 3. Yes, CMDQ doesn't use iommu, so physical address is 
> > continuous.
> >
> 
>  Yes, physical addresses might be continous, but AFAIK there 
>  is no
>  guarantee that the dma_handle address is steadily growing, 
>  when
>  calling
>  dma_alloc_coherent. And if I understand the code correctly, 
>  you
>  use this
>  assumption to decide if the task picked from task_busy_list 
>  is
>  currently
>  executing. So I think this mecanism is not working.
> >>>
> >>> I don't use dma_handle address, and just use physical 
> >>> addresses.
> >>>From CPU's point of view, tasks are linked by the busy 
> >>> list.
> >>>From GCE's point of view, tasks are linked by the JUMP 
> >>> command.
> >>>
>  In which cases does the HW thread raise an interrupt.
>  In case of error. When does CMDQ_THR_IRQ_DONE get raised?
> >>>
> >>> GCE will raise interrupt if any task is done or error.
> >>> However, GCE is fast, so CPU may get multiple done tasks
> >>> when it is running ISR.
> >>>
> >>> In case of error, that GCE thread will pause and raise 
> >>> interrupt.
> >>> So, CPU may get multiple done tasks and one error task.
> >>>
> >>
> 

Re: [PATCH v4 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system

2016-06-20 Thread kbuild test robot
Hi,

[auto build test ERROR on tip/x86/core]
[also build test ERROR on v4.7-rc4 next-20160620]
[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/Tan-Jui-Nee/pinctrl-broxton-enable-platform-device-in-the-absent-of-ACPI-enumeration/20160621-132027
config: x86_64-randconfig-i0-201625 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/mfd/lpc_ich.c:175:23: error: invalid application of 'sizeof' to 
incomplete type 'struct pinctrl_pin_desc'
  .pdata_size = sizeof(apl_pinctrl_pdata),
  ^
   drivers/mfd/lpc_ich.c:184:23: error: invalid application of 'sizeof' to 
incomplete type 'struct pinctrl_pin_desc'
  .pdata_size = sizeof(apl_pinctrl_pdata),
  ^
   drivers/mfd/lpc_ich.c:193:23: error: invalid application of 'sizeof' to 
incomplete type 'struct pinctrl_pin_desc'
  .pdata_size = sizeof(apl_pinctrl_pdata),
  ^
   drivers/mfd/lpc_ich.c:202:23: error: invalid application of 'sizeof' to 
incomplete type 'struct pinctrl_pin_desc'
  .pdata_size = sizeof(apl_pinctrl_pdata),
  ^
   drivers/mfd/lpc_ich.c: In function 'lpc_ich_misc':
   drivers/mfd/lpc_ich.c:1154:3: error: invalid use of undefined type 'struct 
pinctrl_pin_desc'
  apl_pinctrl_pdata.name = kasprintf(GFP_KERNEL, "%u",
  ^
   drivers/mfd/lpc_ich.c:1154:3: warning: statement with no effect 
[-Wunused-value]
   drivers/mfd/lpc_ich.c:1158:2: error: invalid use of undefined type 'struct 
pinctrl_pin_desc'
 if (apl_pinctrl_pdata.name)
 ^~
   drivers/mfd/lpc_ich.c:1169:5: error: invalid use of undefined type 'struct 
pinctrl_pin_desc'
apl_pinctrl_pdata.name, ret);
^
   drivers/mfd/lpc_ich.c:1168:37: warning: format '%s' expects argument of type 
'char *', but argument 3 has type 'struct mfd_cell *' [-Wformat=]
   "Failed to add Apollo Lake GPIO %s: %d\n",
^
   drivers/mfd/lpc_ich.c:1171:2: error: invalid use of undefined type 'struct 
pinctrl_pin_desc'
 kfree(apl_pinctrl_pdata.name);
 ^
   drivers/mfd/lpc_ich.c: At top level:
>> drivers/mfd/lpc_ich.c:167:32: error: storage size of 'apl_pinctrl_pdata' 
>> isn't known
static struct pinctrl_pin_desc apl_pinctrl_pdata;
   ^
   drivers/mfd/lpc_ich.c:1131:12: warning: 'lpc_ich_misc' defined but not used 
[-Wunused-function]
static int lpc_ich_misc(struct pci_dev *dev, enum lpc_chipsets chipset)
   ^~~~

vim +167 drivers/mfd/lpc_ich.c

   161  APL_GPIO_WEST_NPIN * SZ_8, "apl_pinctrl_w"),
   162  DEFINE_RES_MEM_NAMED(APL_GPIO_SOUTHWEST_OFFSET,
   163  APL_GPIO_SOUTHWEST_NPIN * SZ_8, "apl_pinctrl_sw"),
   164  DEFINE_RES_IRQ(APL_GPIO_IRQ),
   165  };
   166  
 > 167  static struct pinctrl_pin_desc apl_pinctrl_pdata;
   168  
   169  static struct mfd_cell apl_gpio_devices[] = {
   170  {

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


.config.gz
Description: Binary data


[PATCH 3/6] kexec_file: Allow skipping checksum calculation for some segments.

2016-06-20 Thread Thiago Jung Bauermann
Adds checksum argument to kexec_add_buffer specifying whether the given
segment should be part of the checksum calculation.

The next patch will add a way to update segments after a kimage is loaded.
Segments that will be updated in this way should not be checksummed,
otherwise they will cause the purgatory checksum verification to fail
when the machine is rebooted.

As a bonus, we don't need to special-case the purgatory segment anymore
to avoid checksumming it.

Adjust call sites for the new argument.

Signed-off-by: Thiago Jung Bauermann 
---
 arch/powerpc/kernel/kexec_elf_64.c |  6 +++---
 arch/x86/kernel/crash.c|  4 ++--
 arch/x86/kernel/kexec-bzimage64.c  |  6 +++---
 include/linux/kexec.h  |  7 +--
 kernel/kexec_file.c| 22 +++---
 5 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/kernel/kexec_elf_64.c 
b/arch/powerpc/kernel/kexec_elf_64.c
index 5d2b7036fee7..abbad484d7b2 100644
--- a/arch/powerpc/kernel/kexec_elf_64.c
+++ b/arch/powerpc/kernel/kexec_elf_64.c
@@ -311,7 +311,7 @@ static int elf_exec_load(struct kimage *image, struct 
elfhdr *ehdr,
   (char *) elf_info->buffer + 
phdr->p_offset,
   size, phdr->p_memsz, phdr->p_align,
   phdr->p_paddr + base, ppc64_rma_size,
-  false, _addr);
+  false, true, _addr);
if (ret)
goto out;
 
@@ -487,7 +487,7 @@ void *elf64_load(struct kimage *image, char *kernel_buf,
if (initrd != NULL) {
ret = kexec_add_buffer(image, initrd, initrd_len, initrd_len,
   PAGE_SIZE, 0, ppc64_rma_size, false,
-  _load_addr);
+  true, _load_addr);
if (ret)
goto out;
 
@@ -564,7 +564,7 @@ void *elf64_load(struct kimage *image, char *kernel_buf,
fdt_pack(fdt);
 
ret = kexec_add_buffer(image, fdt, fdt_size, fdt_size, PAGE_SIZE, 0,
-  ppc64_rma_size, true, _load_addr);
+  ppc64_rma_size, true, true, _load_addr);
if (ret)
goto out;
 
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 9ef978d69c22..c8b16f2ca321 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -643,7 +643,7 @@ int crash_load_segments(struct kimage *image)
 */
ret = kexec_add_buffer(image, (char *)_zero_bytes,
   sizeof(crash_zero_bytes), src_sz,
-  PAGE_SIZE, 0, -1, 0,
+  PAGE_SIZE, 0, -1, false, true,
   >arch.backup_load_addr);
if (ret)
return ret;
@@ -660,7 +660,7 @@ int crash_load_segments(struct kimage *image)
image->arch.elf_headers_sz = elf_sz;
 
ret = kexec_add_buffer(image, (char *)elf_addr, elf_sz, elf_sz,
-   ELF_CORE_HEADER_ALIGN, 0, -1, 0,
+   ELF_CORE_HEADER_ALIGN, 0, -1, false, true,
>arch.elf_load_addr);
if (ret) {
vfree((void *)image->arch.elf_headers);
diff --git a/arch/x86/kernel/kexec-bzimage64.c 
b/arch/x86/kernel/kexec-bzimage64.c
index f2356bda2b05..f9016be44da6 100644
--- a/arch/x86/kernel/kexec-bzimage64.c
+++ b/arch/x86/kernel/kexec-bzimage64.c
@@ -420,7 +420,7 @@ static void *bzImage64_load(struct kimage *image, char 
*kernel,
 
ret = kexec_add_buffer(image, (char *)params, params_misc_sz,
   params_misc_sz, 16, MIN_BOOTPARAM_ADDR,
-  ULONG_MAX, 1, _load_addr);
+  ULONG_MAX, true, true, _load_addr);
if (ret)
goto out_free_params;
pr_debug("Loaded boot_param, command line and misc at 0x%lx bufsz=0x%lx 
memsz=0x%lx\n",
@@ -434,7 +434,7 @@ static void *bzImage64_load(struct kimage *image, char 
*kernel,
 
ret = kexec_add_buffer(image, kernel_buf,
   kernel_bufsz, kernel_memsz, kernel_align,
-  MIN_KERNEL_LOAD_ADDR, ULONG_MAX, 1,
+  MIN_KERNEL_LOAD_ADDR, ULONG_MAX, true, true,
   _load_addr);
if (ret)
goto out_free_params;
@@ -446,7 +446,7 @@ static void *bzImage64_load(struct kimage *image, char 
*kernel,
if (initrd) {
ret = kexec_add_buffer(image, initrd, initrd_len, initrd_len,
   PAGE_SIZE, MIN_INITRD_LOAD_ADDR,
-  ULONG_MAX, 1, _load_addr);
+  ULONG_MAX, 

[PATCH 3/6] kexec_file: Allow skipping checksum calculation for some segments.

2016-06-20 Thread Thiago Jung Bauermann
Adds checksum argument to kexec_add_buffer specifying whether the given
segment should be part of the checksum calculation.

The next patch will add a way to update segments after a kimage is loaded.
Segments that will be updated in this way should not be checksummed,
otherwise they will cause the purgatory checksum verification to fail
when the machine is rebooted.

As a bonus, we don't need to special-case the purgatory segment anymore
to avoid checksumming it.

Adjust call sites for the new argument.

Signed-off-by: Thiago Jung Bauermann 
---
 arch/powerpc/kernel/kexec_elf_64.c |  6 +++---
 arch/x86/kernel/crash.c|  4 ++--
 arch/x86/kernel/kexec-bzimage64.c  |  6 +++---
 include/linux/kexec.h  |  7 +--
 kernel/kexec_file.c| 22 +++---
 5 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/kernel/kexec_elf_64.c 
b/arch/powerpc/kernel/kexec_elf_64.c
index 5d2b7036fee7..abbad484d7b2 100644
--- a/arch/powerpc/kernel/kexec_elf_64.c
+++ b/arch/powerpc/kernel/kexec_elf_64.c
@@ -311,7 +311,7 @@ static int elf_exec_load(struct kimage *image, struct 
elfhdr *ehdr,
   (char *) elf_info->buffer + 
phdr->p_offset,
   size, phdr->p_memsz, phdr->p_align,
   phdr->p_paddr + base, ppc64_rma_size,
-  false, _addr);
+  false, true, _addr);
if (ret)
goto out;
 
@@ -487,7 +487,7 @@ void *elf64_load(struct kimage *image, char *kernel_buf,
if (initrd != NULL) {
ret = kexec_add_buffer(image, initrd, initrd_len, initrd_len,
   PAGE_SIZE, 0, ppc64_rma_size, false,
-  _load_addr);
+  true, _load_addr);
if (ret)
goto out;
 
@@ -564,7 +564,7 @@ void *elf64_load(struct kimage *image, char *kernel_buf,
fdt_pack(fdt);
 
ret = kexec_add_buffer(image, fdt, fdt_size, fdt_size, PAGE_SIZE, 0,
-  ppc64_rma_size, true, _load_addr);
+  ppc64_rma_size, true, true, _load_addr);
if (ret)
goto out;
 
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 9ef978d69c22..c8b16f2ca321 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -643,7 +643,7 @@ int crash_load_segments(struct kimage *image)
 */
ret = kexec_add_buffer(image, (char *)_zero_bytes,
   sizeof(crash_zero_bytes), src_sz,
-  PAGE_SIZE, 0, -1, 0,
+  PAGE_SIZE, 0, -1, false, true,
   >arch.backup_load_addr);
if (ret)
return ret;
@@ -660,7 +660,7 @@ int crash_load_segments(struct kimage *image)
image->arch.elf_headers_sz = elf_sz;
 
ret = kexec_add_buffer(image, (char *)elf_addr, elf_sz, elf_sz,
-   ELF_CORE_HEADER_ALIGN, 0, -1, 0,
+   ELF_CORE_HEADER_ALIGN, 0, -1, false, true,
>arch.elf_load_addr);
if (ret) {
vfree((void *)image->arch.elf_headers);
diff --git a/arch/x86/kernel/kexec-bzimage64.c 
b/arch/x86/kernel/kexec-bzimage64.c
index f2356bda2b05..f9016be44da6 100644
--- a/arch/x86/kernel/kexec-bzimage64.c
+++ b/arch/x86/kernel/kexec-bzimage64.c
@@ -420,7 +420,7 @@ static void *bzImage64_load(struct kimage *image, char 
*kernel,
 
ret = kexec_add_buffer(image, (char *)params, params_misc_sz,
   params_misc_sz, 16, MIN_BOOTPARAM_ADDR,
-  ULONG_MAX, 1, _load_addr);
+  ULONG_MAX, true, true, _load_addr);
if (ret)
goto out_free_params;
pr_debug("Loaded boot_param, command line and misc at 0x%lx bufsz=0x%lx 
memsz=0x%lx\n",
@@ -434,7 +434,7 @@ static void *bzImage64_load(struct kimage *image, char 
*kernel,
 
ret = kexec_add_buffer(image, kernel_buf,
   kernel_bufsz, kernel_memsz, kernel_align,
-  MIN_KERNEL_LOAD_ADDR, ULONG_MAX, 1,
+  MIN_KERNEL_LOAD_ADDR, ULONG_MAX, true, true,
   _load_addr);
if (ret)
goto out_free_params;
@@ -446,7 +446,7 @@ static void *bzImage64_load(struct kimage *image, char 
*kernel,
if (initrd) {
ret = kexec_add_buffer(image, initrd, initrd_len, initrd_len,
   PAGE_SIZE, MIN_INITRD_LOAD_ADDR,
-  ULONG_MAX, 1, _load_addr);
+  ULONG_MAX, true, true, 
_load_addr);
   

Re: [PATCH v4 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system

2016-06-20 Thread kbuild test robot
Hi,

[auto build test ERROR on tip/x86/core]
[also build test ERROR on v4.7-rc4 next-20160620]
[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/Tan-Jui-Nee/pinctrl-broxton-enable-platform-device-in-the-absent-of-ACPI-enumeration/20160621-132027
config: x86_64-randconfig-i0-201625 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/mfd/lpc_ich.c:175:23: error: invalid application of 'sizeof' to 
incomplete type 'struct pinctrl_pin_desc'
  .pdata_size = sizeof(apl_pinctrl_pdata),
  ^
   drivers/mfd/lpc_ich.c:184:23: error: invalid application of 'sizeof' to 
incomplete type 'struct pinctrl_pin_desc'
  .pdata_size = sizeof(apl_pinctrl_pdata),
  ^
   drivers/mfd/lpc_ich.c:193:23: error: invalid application of 'sizeof' to 
incomplete type 'struct pinctrl_pin_desc'
  .pdata_size = sizeof(apl_pinctrl_pdata),
  ^
   drivers/mfd/lpc_ich.c:202:23: error: invalid application of 'sizeof' to 
incomplete type 'struct pinctrl_pin_desc'
  .pdata_size = sizeof(apl_pinctrl_pdata),
  ^
   drivers/mfd/lpc_ich.c: In function 'lpc_ich_misc':
   drivers/mfd/lpc_ich.c:1154:3: error: invalid use of undefined type 'struct 
pinctrl_pin_desc'
  apl_pinctrl_pdata.name = kasprintf(GFP_KERNEL, "%u",
  ^
   drivers/mfd/lpc_ich.c:1154:3: warning: statement with no effect 
[-Wunused-value]
   drivers/mfd/lpc_ich.c:1158:2: error: invalid use of undefined type 'struct 
pinctrl_pin_desc'
 if (apl_pinctrl_pdata.name)
 ^~
   drivers/mfd/lpc_ich.c:1169:5: error: invalid use of undefined type 'struct 
pinctrl_pin_desc'
apl_pinctrl_pdata.name, ret);
^
   drivers/mfd/lpc_ich.c:1168:37: warning: format '%s' expects argument of type 
'char *', but argument 3 has type 'struct mfd_cell *' [-Wformat=]
   "Failed to add Apollo Lake GPIO %s: %d\n",
^
   drivers/mfd/lpc_ich.c:1171:2: error: invalid use of undefined type 'struct 
pinctrl_pin_desc'
 kfree(apl_pinctrl_pdata.name);
 ^
   drivers/mfd/lpc_ich.c: At top level:
>> drivers/mfd/lpc_ich.c:167:32: error: storage size of 'apl_pinctrl_pdata' 
>> isn't known
static struct pinctrl_pin_desc apl_pinctrl_pdata;
   ^
   drivers/mfd/lpc_ich.c:1131:12: warning: 'lpc_ich_misc' defined but not used 
[-Wunused-function]
static int lpc_ich_misc(struct pci_dev *dev, enum lpc_chipsets chipset)
   ^~~~

vim +167 drivers/mfd/lpc_ich.c

   161  APL_GPIO_WEST_NPIN * SZ_8, "apl_pinctrl_w"),
   162  DEFINE_RES_MEM_NAMED(APL_GPIO_SOUTHWEST_OFFSET,
   163  APL_GPIO_SOUTHWEST_NPIN * SZ_8, "apl_pinctrl_sw"),
   164  DEFINE_RES_IRQ(APL_GPIO_IRQ),
   165  };
   166  
 > 167  static struct pinctrl_pin_desc apl_pinctrl_pdata;
   168  
   169  static struct mfd_cell apl_gpio_devices[] = {
   170  {

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


.config.gz
Description: Binary data


[RFC][PATCH] arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL

2016-06-20 Thread Seung-Woo Kim
To enable UBSAN on arm, this patch enables ARCH_HAS_UBSAN_SANITIZE_ALL
from arm confiuration. Basic kernel booting is tested on arm kernel
enabled CONFIG_UBSAN_SANITIZE_ALL from Exynos5422 based Odroid-XU3
board.

Signed-off-by: Seung-Woo Kim 
---
Because I tested only with specific soc board, so I am not sure the ubsan is
fine for all other cases. So, I send this patch as a RFC.
---
 arch/arm/Kconfig  |1 +
 arch/arm/boot/compressed/Makefile |1 +
 arch/arm/vdso/Makefile|1 +
 3 files changed, 3 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 90542db..3a9af80 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -7,6 +7,7 @@ config ARM
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
select ARCH_HAVE_CUSTOM_GPIO_H
select ARCH_HAS_GCOV_PROFILE_ALL
+   select ARCH_HAS_UBSAN_SANITIZE_ALL
select ARCH_MIGHT_HAVE_PC_PARPORT
select ARCH_SUPPORTS_ATOMIC_RMW
select ARCH_USE_BUILTIN_BSWAP
diff --git a/arch/arm/boot/compressed/Makefile 
b/arch/arm/boot/compressed/Makefile
index d50430c..883374f 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -23,6 +23,7 @@ OBJS  += hyp-stub.o
 endif
 
 GCOV_PROFILE   := n
+UBSAN_SANITIZE := n
 
 #
 # Architecture dependencies
diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
index 59a8fa7..cb90e59 100644
--- a/arch/arm/vdso/Makefile
+++ b/arch/arm/vdso/Makefile
@@ -28,6 +28,7 @@ CFLAGS_vgettimeofday.o = -O2
 
 # Disable gcov profiling for VDSO code
 GCOV_PROFILE := n
+UBSAN_SANITIZE := n
 
 # Force dependency
 $(obj)/vdso.o : $(obj)/vdso.so
-- 
1.7.9.5



[RFC][PATCH] arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL

2016-06-20 Thread Seung-Woo Kim
To enable UBSAN on arm, this patch enables ARCH_HAS_UBSAN_SANITIZE_ALL
from arm confiuration. Basic kernel booting is tested on arm kernel
enabled CONFIG_UBSAN_SANITIZE_ALL from Exynos5422 based Odroid-XU3
board.

Signed-off-by: Seung-Woo Kim 
---
Because I tested only with specific soc board, so I am not sure the ubsan is
fine for all other cases. So, I send this patch as a RFC.
---
 arch/arm/Kconfig  |1 +
 arch/arm/boot/compressed/Makefile |1 +
 arch/arm/vdso/Makefile|1 +
 3 files changed, 3 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 90542db..3a9af80 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -7,6 +7,7 @@ config ARM
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
select ARCH_HAVE_CUSTOM_GPIO_H
select ARCH_HAS_GCOV_PROFILE_ALL
+   select ARCH_HAS_UBSAN_SANITIZE_ALL
select ARCH_MIGHT_HAVE_PC_PARPORT
select ARCH_SUPPORTS_ATOMIC_RMW
select ARCH_USE_BUILTIN_BSWAP
diff --git a/arch/arm/boot/compressed/Makefile 
b/arch/arm/boot/compressed/Makefile
index d50430c..883374f 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -23,6 +23,7 @@ OBJS  += hyp-stub.o
 endif
 
 GCOV_PROFILE   := n
+UBSAN_SANITIZE := n
 
 #
 # Architecture dependencies
diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
index 59a8fa7..cb90e59 100644
--- a/arch/arm/vdso/Makefile
+++ b/arch/arm/vdso/Makefile
@@ -28,6 +28,7 @@ CFLAGS_vgettimeofday.o = -O2
 
 # Disable gcov profiling for VDSO code
 GCOV_PROFILE := n
+UBSAN_SANITIZE := n
 
 # Force dependency
 $(obj)/vdso.o : $(obj)/vdso.so
-- 
1.7.9.5



Re: [PATCH] ALSA: hda - Remove compilation warning

2016-06-20 Thread Takashi Iwai
On Mon, 20 Jun 2016 21:42:31 +0200,
Helen Koike wrote:
> 
> Remove the warning:
> warning: ‘err’ may be used uninitialized in this function 
> [-Wmaybe-uninitialized]

It's a false positive, a compiler problem.


Takashi

> 
> Signed-off-by: Helen Koike 
> ---
>  sound/hda/hdac_regmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/hda/hdac_regmap.c b/sound/hda/hdac_regmap.c
> index 87041dd..7be6ca1 100644
> --- a/sound/hda/hdac_regmap.c
> +++ b/sound/hda/hdac_regmap.c
> @@ -279,7 +279,7 @@ static int hda_reg_write(void *context, unsigned int reg, 
> unsigned int val)
>  {
>   struct hdac_device *codec = context;
>   unsigned int verb;
> - int i, bytes, err;
> + int i, bytes, err = 0;
>   int pm_lock = 0;
>  
>   if (codec->caps_overwriting)
> -- 
> 1.9.1
> 
> 


Re: [PATCH] ALSA: hda - Remove compilation warning

2016-06-20 Thread Takashi Iwai
On Mon, 20 Jun 2016 21:42:31 +0200,
Helen Koike wrote:
> 
> Remove the warning:
> warning: ‘err’ may be used uninitialized in this function 
> [-Wmaybe-uninitialized]

It's a false positive, a compiler problem.


Takashi

> 
> Signed-off-by: Helen Koike 
> ---
>  sound/hda/hdac_regmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/hda/hdac_regmap.c b/sound/hda/hdac_regmap.c
> index 87041dd..7be6ca1 100644
> --- a/sound/hda/hdac_regmap.c
> +++ b/sound/hda/hdac_regmap.c
> @@ -279,7 +279,7 @@ static int hda_reg_write(void *context, unsigned int reg, 
> unsigned int val)
>  {
>   struct hdac_device *codec = context;
>   unsigned int verb;
> - int i, bytes, err;
> + int i, bytes, err = 0;
>   int pm_lock = 0;
>  
>   if (codec->caps_overwriting)
> -- 
> 1.9.1
> 
> 


[PATCH 24/27] Add support for AT_ARM64_MIDR.

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

Signed-off-by: Yury Norov 
---
 elf/dl-sysdep.c |  1 +
 elf/elf.h   |  3 +++
 sysdeps/unix/sysv/linux/aarch64/dl-auxv.h   | 25 +
 sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c |  5 +
 4 files changed, 34 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/dl-auxv.h
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c

diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c
index eaa7155..88b7dd7 100644
--- a/elf/dl-sysdep.c
+++ b/elf/dl-sysdep.c
@@ -307,6 +307,7 @@ _dl_show_auxv (void)
  [AT_SYSINFO_EHDR - 2] =   { "SYSINFO_EHDR: 0x", hex },
  [AT_RANDOM - 2] = { "RANDOM:   0x", hex },
  [AT_HWCAP2 - 2] = { "HWCAP2:   0x", hex },
+ [AT_ARM64_MIDR - 2] = { "MIDR: 0x", hex },
};
   unsigned int idx = (unsigned int) (av->a_type - 2);
 
diff --git a/elf/elf.h b/elf/elf.h
index 15f5a75..c05bc23 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -1058,6 +1058,9 @@ typedef struct
 #define AT_L2_CACHESHAPE   36
 #define AT_L3_CACHESHAPE   37
 
+/* AARCH64 MIDR system register. */
+#define AT_ARM64_MIDR  38
+
 /* Note section contents.  Each entry in the note section begins with
a header of a fixed form.  */
 
diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-auxv.h 
b/sysdeps/unix/sysv/linux/aarch64/dl-auxv.h
new file mode 100644
index 000..290753d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/dl-auxv.h
@@ -0,0 +1,25 @@
+/* Auxiliary vector processing for Linux/AARCH64.
+   Copyright (C) 2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   .  */
+
+
+extern int __libc_arm64_midr;
+
+#define DL_PLATFORM_AUXV   \
+  case AT_ARM64_MIDR:  \
+   __libc_arm64_midr = av->a_un.a_val; \
+   break;
diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c 
b/sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c
new file mode 100644
index 000..ca3ec28
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c
@@ -0,0 +1,5 @@
+#include "dl-auxv.h"
+
+int __libc_arm64_midr = -1;
+
+#include 
-- 
2.7.4



[PATCH 22/27] [AARCH64] ILP32: support stat syscall family

2016-06-20 Thread Yury Norov
From: Yury Norov 

stat and statfs structures has their layouts identical to lp64
after changing off_t, ino_t etc sizes to 64-bit. It means we can
pass it to kernel same way as lp64 does.

Signed-off-by: Yury Norov 
---
 sysdeps/unix/sysv/linux/aarch64/bits/stat.h| 195 +
 sysdeps/unix/sysv/linux/aarch64/bits/statfs.h  |  72 
 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs.c|  29 +++
 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c  |  72 
 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c |  51 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c   |  54 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c   |  48 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c |  52 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c |  47 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c |  30 
 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c   |  29 +++
 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c  |  47 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c|  47 +
 13 files changed, 773 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/stat.h
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/statfs.h
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c

diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/stat.h 
b/sysdeps/unix/sysv/linux/aarch64/bits/stat.h
new file mode 100644
index 000..eec6789
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/stat.h
@@ -0,0 +1,195 @@
+/* Copyright (C) 1992-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   .  */
+
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
+# error "Never include  directly; use  instead."
+#endif
+
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H   1
+
+/* Versions of the `struct stat' data structure.  */
+#define _STAT_VER_KERNEL   0
+#define _STAT_VER_LINUX0
+#define _STAT_VER  _STAT_VER_KERNEL
+
+/* Versions of the `xmknod' interface.  */
+#define _MKNOD_VER_LINUX   0
+
+#ifdef __ILP32__
+#include 
+struct __kernel_timespec
+  {
+unsigned long long tv_sec; /* Seconds.  */
+long long tv_nsec; /* Nanoseconds.  */
+  };
+#define conv_timespec(u, k) do {   \
+   (u)->tv_sec = (k)->tv_sec;  \
+   (u)->tv_nsec = (k)->tv_nsec;\
+} while (0)
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define __type3264(type, name) \
+   type (name); type name##_pad
+#else
+#define __type3264(type, name) \
+   type name##_pad; type name
+#endif
+
+#else
+#define __kernel_timespec timespec
+#define conv_timespec(u, k)
+#define __type3264(type, name) type name
+#endif /* __ILP32__ */
+
+struct stat
+  {
+__dev_t st_dev;/* Device.  */
+__ino_t st_ino;/* File serial number.  */
+__mode_t st_mode;  /* File mode.  */
+__nlink_t st_nlink;/* Link count.  */
+__uid_t st_uid;/* User ID of the file's owner. */
+__gid_t st_gid;/* Group ID of the file's group.*/
+__dev_t st_rdev;   /* Device number, if device.  */
+__dev_t __pad1;
+__off_t st_size;   /* Size of file, in bytes.  */
+__blksize_t st_blksize;/* Optimal block size for I/O.  */
+int __pad2;
+
+__blkcnt_t st_blocks;  /* Number 512-byte blocks allocated. */
+#ifdef __USE_XOPEN2K8
+/* Nanosecond resolution timestamps are stored in a format
+   

[PATCH 15/27] [AARCH64] Add support to ldconfig for ILP32 and libilp32

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

This patch adds support to ldconfig for libilp32 which is used by
ILP32.

* sysdeps/generic/ldconfig.h (FLAG_AARCH64_LIB32): New define.
* elf/cache.c (print_entry): Handle FLAG_AARCH64_LIB32.
* sysdeps/unix/sysv/linux/aarch64/dl-cache.h (_DL_CACHE_DEFAULT_ID):
Define it to be the FLAG_AARCH64_LIB32 if compiling for ILP32.
(add_system_dir): Add libilp32 to the list of system directories.
* sysdeps/unix/sysv/linux/arm/readelflib.c (process_elf_file):
Handle ILP32 elf binaries.

Signed-off-by: Yury Norov 
---
 elf/cache.c|  2 ++
 sysdeps/generic/ldconfig.h |  1 +
 sysdeps/unix/sysv/linux/aarch64/dl-cache.h | 13 -
 sysdeps/unix/sysv/linux/arm/readelflib.c   |  4 +++-
 4 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/elf/cache.c b/elf/cache.c
index fbee172..cbc6162 100644
--- a/elf/cache.c
+++ b/elf/cache.c
@@ -101,6 +101,8 @@ print_entry (const char *lib, int flag, unsigned int 
osversion,
 case FLAG_AARCH64_LIB64:
   fputs (",AArch64", stdout);
   break;
+case FLAG_AARCH64_LIB32:
+  fputs (",ILP32", stdout);
 /* Uses the ARM soft-float ABI.  */
 case FLAG_ARM_LIBSF:
   fputs (",soft-float", stdout);
diff --git a/sysdeps/generic/ldconfig.h b/sysdeps/generic/ldconfig.h
index 07600b7..8150227 100644
--- a/sysdeps/generic/ldconfig.h
+++ b/sysdeps/generic/ldconfig.h
@@ -42,6 +42,7 @@
 #define FLAG_MIPS_LIB32_NAN20080x0c00
 #define FLAG_MIPS64_LIBN32_NAN2008 0x0d00
 #define FLAG_MIPS64_LIBN64_NAN2008 0x0e00
+#define FLAG_AARCH64_LIB32 0x0f00
 
 /* Name of auxiliary cache.  */
 #define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache"
diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-cache.h 
b/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
index 9c7b271..044fdba 100644
--- a/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
+++ b/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
@@ -18,7 +18,11 @@
 
 #include 
 
+#ifdef __LP64__
 #define _DL_CACHE_DEFAULT_ID(FLAG_AARCH64_LIB64 | FLAG_ELF_LIBC6)
+#else
+#define _DL_CACHE_DEFAULT_ID(FLAG_AARCH64_LIB32 | FLAG_ELF_LIBC6)
+#endif
 
 #define _dl_cache_check_flags(flags)\
   ((flags) == _DL_CACHE_DEFAULT_ID)
@@ -27,18 +31,25 @@
   do   \
 {  \
   size_t len = strlen (dir);   \
-  char path[len + 3];  \
+  char path[len + 6];  \
   memcpy (path, dir, len + 1); \
   if (len >= 6 && ! memcmp (path + len - 6, "/lib64", 6))  \
{   \
  len -= 2; \
  path[len] = '\0'; \
}   \
+  if (len >= 9 && ! memcmp (path + len - 9, "/libilp32", 9))\
+   {   \
+ len -= 5; \
+ path[len] = '\0'; \
+   }   \
   add_dir (path);  \
   if (len >= 4 && ! memcmp (path + len - 4, "/lib", 4))\
{   \
  memcpy (path + len, "64", 3); \
  add_dir (path);   \
+ memcpy (path + len, "ilp32", 6);  \
+ add_dir (path);   \
}   \
 } while (0)
 
diff --git a/sysdeps/unix/sysv/linux/arm/readelflib.c 
b/sysdeps/unix/sysv/linux/arm/readelflib.c
index e6ae72e..ddbad25 100644
--- a/sysdeps/unix/sysv/linux/arm/readelflib.c
+++ b/sysdeps/unix/sysv/linux/arm/readelflib.c
@@ -41,7 +41,9 @@ process_elf_file (const char *file_name, const char *lib, int 
*flag,
   ret = process_elf32_file (file_name, lib, flag, osversion, soname,
file_contents, file_length);
 
-  if (!ret && EF_ARM_EABI_VERSION (elf32_header->e_flags) == 
EF_ARM_EABI_VER5)
+  if (!ret && elf_header->e_machine == EM_AARCH64)
+   *flag = FLAG_AARCH64_LIB32|FLAG_ELF_LIBC6;
+  else if (!ret && EF_ARM_EABI_VERSION (elf32_header->e_flags) == 
EF_ARM_EABI_VER5)
{
  if (elf32_header->e_flags & EF_ARM_ABI_FLOAT_HARD)
*flag = FLAG_ARM_LIBHF|FLAG_ELF_LIBC6;
-- 
2.7.4



[PATCH 24/27] Add support for AT_ARM64_MIDR.

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

Signed-off-by: Yury Norov 
---
 elf/dl-sysdep.c |  1 +
 elf/elf.h   |  3 +++
 sysdeps/unix/sysv/linux/aarch64/dl-auxv.h   | 25 +
 sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c |  5 +
 4 files changed, 34 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/dl-auxv.h
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c

diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c
index eaa7155..88b7dd7 100644
--- a/elf/dl-sysdep.c
+++ b/elf/dl-sysdep.c
@@ -307,6 +307,7 @@ _dl_show_auxv (void)
  [AT_SYSINFO_EHDR - 2] =   { "SYSINFO_EHDR: 0x", hex },
  [AT_RANDOM - 2] = { "RANDOM:   0x", hex },
  [AT_HWCAP2 - 2] = { "HWCAP2:   0x", hex },
+ [AT_ARM64_MIDR - 2] = { "MIDR: 0x", hex },
};
   unsigned int idx = (unsigned int) (av->a_type - 2);
 
diff --git a/elf/elf.h b/elf/elf.h
index 15f5a75..c05bc23 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -1058,6 +1058,9 @@ typedef struct
 #define AT_L2_CACHESHAPE   36
 #define AT_L3_CACHESHAPE   37
 
+/* AARCH64 MIDR system register. */
+#define AT_ARM64_MIDR  38
+
 /* Note section contents.  Each entry in the note section begins with
a header of a fixed form.  */
 
diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-auxv.h 
b/sysdeps/unix/sysv/linux/aarch64/dl-auxv.h
new file mode 100644
index 000..290753d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/dl-auxv.h
@@ -0,0 +1,25 @@
+/* Auxiliary vector processing for Linux/AARCH64.
+   Copyright (C) 2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   .  */
+
+
+extern int __libc_arm64_midr;
+
+#define DL_PLATFORM_AUXV   \
+  case AT_ARM64_MIDR:  \
+   __libc_arm64_midr = av->a_un.a_val; \
+   break;
diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c 
b/sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c
new file mode 100644
index 000..ca3ec28
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/dl-sysdep.c
@@ -0,0 +1,5 @@
+#include "dl-auxv.h"
+
+int __libc_arm64_midr = -1;
+
+#include 
-- 
2.7.4



[PATCH 22/27] [AARCH64] ILP32: support stat syscall family

2016-06-20 Thread Yury Norov
From: Yury Norov 

stat and statfs structures has their layouts identical to lp64
after changing off_t, ino_t etc sizes to 64-bit. It means we can
pass it to kernel same way as lp64 does.

Signed-off-by: Yury Norov 
---
 sysdeps/unix/sysv/linux/aarch64/bits/stat.h| 195 +
 sysdeps/unix/sysv/linux/aarch64/bits/statfs.h  |  72 
 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs.c|  29 +++
 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c  |  72 
 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c |  51 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c   |  54 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c   |  48 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c |  52 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c |  47 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c |  30 
 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c   |  29 +++
 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c  |  47 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c|  47 +
 13 files changed, 773 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/stat.h
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/statfs.h
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c

diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/stat.h 
b/sysdeps/unix/sysv/linux/aarch64/bits/stat.h
new file mode 100644
index 000..eec6789
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/stat.h
@@ -0,0 +1,195 @@
+/* Copyright (C) 1992-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   .  */
+
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
+# error "Never include  directly; use  instead."
+#endif
+
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H   1
+
+/* Versions of the `struct stat' data structure.  */
+#define _STAT_VER_KERNEL   0
+#define _STAT_VER_LINUX0
+#define _STAT_VER  _STAT_VER_KERNEL
+
+/* Versions of the `xmknod' interface.  */
+#define _MKNOD_VER_LINUX   0
+
+#ifdef __ILP32__
+#include 
+struct __kernel_timespec
+  {
+unsigned long long tv_sec; /* Seconds.  */
+long long tv_nsec; /* Nanoseconds.  */
+  };
+#define conv_timespec(u, k) do {   \
+   (u)->tv_sec = (k)->tv_sec;  \
+   (u)->tv_nsec = (k)->tv_nsec;\
+} while (0)
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define __type3264(type, name) \
+   type (name); type name##_pad
+#else
+#define __type3264(type, name) \
+   type name##_pad; type name
+#endif
+
+#else
+#define __kernel_timespec timespec
+#define conv_timespec(u, k)
+#define __type3264(type, name) type name
+#endif /* __ILP32__ */
+
+struct stat
+  {
+__dev_t st_dev;/* Device.  */
+__ino_t st_ino;/* File serial number.  */
+__mode_t st_mode;  /* File mode.  */
+__nlink_t st_nlink;/* Link count.  */
+__uid_t st_uid;/* User ID of the file's owner. */
+__gid_t st_gid;/* Group ID of the file's group.*/
+__dev_t st_rdev;   /* Device number, if device.  */
+__dev_t __pad1;
+__off_t st_size;   /* Size of file, in bytes.  */
+__blksize_t st_blksize;/* Optimal block size for I/O.  */
+int __pad2;
+
+__blkcnt_t st_blocks;  /* Number 512-byte blocks allocated. */
+#ifdef __USE_XOPEN2K8
+/* Nanosecond resolution timestamps are stored in a format
+   equivalent to 'struct timespec'.  This is the 

[PATCH 15/27] [AARCH64] Add support to ldconfig for ILP32 and libilp32

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

This patch adds support to ldconfig for libilp32 which is used by
ILP32.

* sysdeps/generic/ldconfig.h (FLAG_AARCH64_LIB32): New define.
* elf/cache.c (print_entry): Handle FLAG_AARCH64_LIB32.
* sysdeps/unix/sysv/linux/aarch64/dl-cache.h (_DL_CACHE_DEFAULT_ID):
Define it to be the FLAG_AARCH64_LIB32 if compiling for ILP32.
(add_system_dir): Add libilp32 to the list of system directories.
* sysdeps/unix/sysv/linux/arm/readelflib.c (process_elf_file):
Handle ILP32 elf binaries.

Signed-off-by: Yury Norov 
---
 elf/cache.c|  2 ++
 sysdeps/generic/ldconfig.h |  1 +
 sysdeps/unix/sysv/linux/aarch64/dl-cache.h | 13 -
 sysdeps/unix/sysv/linux/arm/readelflib.c   |  4 +++-
 4 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/elf/cache.c b/elf/cache.c
index fbee172..cbc6162 100644
--- a/elf/cache.c
+++ b/elf/cache.c
@@ -101,6 +101,8 @@ print_entry (const char *lib, int flag, unsigned int 
osversion,
 case FLAG_AARCH64_LIB64:
   fputs (",AArch64", stdout);
   break;
+case FLAG_AARCH64_LIB32:
+  fputs (",ILP32", stdout);
 /* Uses the ARM soft-float ABI.  */
 case FLAG_ARM_LIBSF:
   fputs (",soft-float", stdout);
diff --git a/sysdeps/generic/ldconfig.h b/sysdeps/generic/ldconfig.h
index 07600b7..8150227 100644
--- a/sysdeps/generic/ldconfig.h
+++ b/sysdeps/generic/ldconfig.h
@@ -42,6 +42,7 @@
 #define FLAG_MIPS_LIB32_NAN20080x0c00
 #define FLAG_MIPS64_LIBN32_NAN2008 0x0d00
 #define FLAG_MIPS64_LIBN64_NAN2008 0x0e00
+#define FLAG_AARCH64_LIB32 0x0f00
 
 /* Name of auxiliary cache.  */
 #define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache"
diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-cache.h 
b/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
index 9c7b271..044fdba 100644
--- a/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
+++ b/sysdeps/unix/sysv/linux/aarch64/dl-cache.h
@@ -18,7 +18,11 @@
 
 #include 
 
+#ifdef __LP64__
 #define _DL_CACHE_DEFAULT_ID(FLAG_AARCH64_LIB64 | FLAG_ELF_LIBC6)
+#else
+#define _DL_CACHE_DEFAULT_ID(FLAG_AARCH64_LIB32 | FLAG_ELF_LIBC6)
+#endif
 
 #define _dl_cache_check_flags(flags)\
   ((flags) == _DL_CACHE_DEFAULT_ID)
@@ -27,18 +31,25 @@
   do   \
 {  \
   size_t len = strlen (dir);   \
-  char path[len + 3];  \
+  char path[len + 6];  \
   memcpy (path, dir, len + 1); \
   if (len >= 6 && ! memcmp (path + len - 6, "/lib64", 6))  \
{   \
  len -= 2; \
  path[len] = '\0'; \
}   \
+  if (len >= 9 && ! memcmp (path + len - 9, "/libilp32", 9))\
+   {   \
+ len -= 5; \
+ path[len] = '\0'; \
+   }   \
   add_dir (path);  \
   if (len >= 4 && ! memcmp (path + len - 4, "/lib", 4))\
{   \
  memcpy (path + len, "64", 3); \
  add_dir (path);   \
+ memcpy (path + len, "ilp32", 6);  \
+ add_dir (path);   \
}   \
 } while (0)
 
diff --git a/sysdeps/unix/sysv/linux/arm/readelflib.c 
b/sysdeps/unix/sysv/linux/arm/readelflib.c
index e6ae72e..ddbad25 100644
--- a/sysdeps/unix/sysv/linux/arm/readelflib.c
+++ b/sysdeps/unix/sysv/linux/arm/readelflib.c
@@ -41,7 +41,9 @@ process_elf_file (const char *file_name, const char *lib, int 
*flag,
   ret = process_elf32_file (file_name, lib, flag, osversion, soname,
file_contents, file_length);
 
-  if (!ret && EF_ARM_EABI_VERSION (elf32_header->e_flags) == 
EF_ARM_EABI_VER5)
+  if (!ret && elf_header->e_machine == EM_AARCH64)
+   *flag = FLAG_AARCH64_LIB32|FLAG_ELF_LIBC6;
+  else if (!ret && EF_ARM_EABI_VERSION (elf32_header->e_flags) == 
EF_ARM_EABI_VER5)
{
  if (elf32_header->e_flags & EF_ARM_ABI_FLOAT_HARD)
*flag = FLAG_ARM_LIBHF|FLAG_ELF_LIBC6;
-- 
2.7.4



linux-next: Tree for Jun 21

2016-06-20 Thread Stephen Rothwell
Hi all,

Changes since 20160620:

The net-next tree gained conflicts against the arm-doc tree.

The akpm-current tree gained a conflict against the arm-soc tree.

Non-merge commits (relative to Linus' tree): 4462
 4490 files changed, 203456 insertions(+), 78511 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc and an allmodconfig (with
CONFIG_BUILD_DOCSRC=n) for x86_64, a multi_v7_defconfig for arm and a
native build of tools/perf. After the final fixups (if any), I do an
x86_64 modules_install followed by builds for x86_64 allnoconfig,
powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig, allyesconfig
(this fails its final link) and pseries_le_defconfig and i386, sparc
and sparc64 defconfig.

Below is a summary of the state of the merge.

I am currently merging 234 trees (counting Linus' and 34 trees of patches
pending for Linus' tree).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (67016f6cdfd0 Merge branch 'for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs)
Merging fixes/master (5edb56491d48 Linux 4.7-rc3)
Merging kbuild-current/rc-fixes (b36fad65d61f kbuild: Initialize exported 
variables)
Merging arc-current/for-curr (5edb56491d48 Linux 4.7-rc3)
Merging arm-current/fixes (56530f5d2ddc ARM: 8579/1: mm: Fix definition of 
pmd_mknotpresent)
Merging m68k-current/for-linus (9a6462763b17 m68k/mvme16x: Include generic 
)
Merging metag-fixes/fixes (0164a711c97b metag: Fix ioremap_wc/ioremap_cached 
build errors)
Merging powerpc-fixes/fixes (8550e2fa34f0 powerpc/mm/hash: Use the correct PPP 
mask when updating HPTE)
Merging powerpc-merge-mpe/fixes (bc0195aad0da Linux 4.2-rc2)
Merging sparc/master (6b15d6650c53 Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging net/master (ab522fd68bc7 Merge branch 'qed-fixes')
Merging ipsec/master (d6af1a31cc72 vti: Add pmtu handling to vti_xmit.)
Merging ipvs/master (50219538ffc0 vmxnet3: segCnt can be 1 for LRO packets)
Merging wireless-drivers/master (034fdd4a17ff Merge ath-current from ath.git)
Merging mac80211/master (3d5fdff46c4b wext: Fix 32 bit iwpriv compatibility 
issue with 64 bit Kernel)
Merging sound-current/for-linus (8198868f0a28 ALSA: hdac_regmap - fix the 
register access for runtime PM)
Merging pci-current/for-linus (ef0dab4aae14 PCI: Fix unaligned accesses in VC 
code)
Merging driver-core.current/driver-core-linus (e80dac114c63 Merge tag 
'usb-4.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb)
Merging tty.current/tty-linus (33688abb2802 Linux 4.7-rc4)
Merging usb.current/usb-linus (33688abb2802 Linux 4.7-rc4)
Merging usb-gadget-fixes/fixes (50c763f8c1ba usb: dwc3: Set the ClearPendIN bit 
on Clear Stall EP command)
Merging usb-serial-fixes/usb-linus (33688abb2802 Linux 4.7-rc4)
Merging usb-chipidea-fixes/ci-for-usb-stable (ea1d39a31d3b usb: common: 
otg-fsm: add license to usb-otg-fsm)
Merging staging.current/staging-linus (33688abb2802 Linux 4.7-rc4)
Merging char-misc.current/char-misc-linus (e80dac114c63 Merge tag 'usb-4.7-rc4' 
of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb)
Merging input-current/for-linus (30172936eefb MAINTAINERS: add Pali Rohár as 
reviewer of ALPS PS/2 touchpad driver)
Merging crypto-current/master (19ced623db2f crypto: ux500 - memmove the right 
size)
Merging ide/master (1993b176a822 Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide)
Merging rr-fixes/fixes (8244062ef1e5 modules: fix longstanding /proc/kallsyms 
vs module insertion race.)
Merging vfio-fixes/for-linus (ce7585f3c4d7 vfio/pci: Allow VPD short read)
Merging kselftest-fixes/fixes (f80eb4289491 selftests/exec: Makefile is a 
run-time dependency, add it to the install list)
Merging backlight-fixes/for-backlight-fixes (68feaca0b13e backlight: pwm: 
Handle EPROBE_DEFER while requesting the PWM)
Merging ftrace-fixes/for-next-urgent (6224be

linux-next: Tree for Jun 21

2016-06-20 Thread Stephen Rothwell
Hi all,

Changes since 20160620:

The net-next tree gained conflicts against the arm-doc tree.

The akpm-current tree gained a conflict against the arm-soc tree.

Non-merge commits (relative to Linus' tree): 4462
 4490 files changed, 203456 insertions(+), 78511 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc and an allmodconfig (with
CONFIG_BUILD_DOCSRC=n) for x86_64, a multi_v7_defconfig for arm and a
native build of tools/perf. After the final fixups (if any), I do an
x86_64 modules_install followed by builds for x86_64 allnoconfig,
powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig, allyesconfig
(this fails its final link) and pseries_le_defconfig and i386, sparc
and sparc64 defconfig.

Below is a summary of the state of the merge.

I am currently merging 234 trees (counting Linus' and 34 trees of patches
pending for Linus' tree).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (67016f6cdfd0 Merge branch 'for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs)
Merging fixes/master (5edb56491d48 Linux 4.7-rc3)
Merging kbuild-current/rc-fixes (b36fad65d61f kbuild: Initialize exported 
variables)
Merging arc-current/for-curr (5edb56491d48 Linux 4.7-rc3)
Merging arm-current/fixes (56530f5d2ddc ARM: 8579/1: mm: Fix definition of 
pmd_mknotpresent)
Merging m68k-current/for-linus (9a6462763b17 m68k/mvme16x: Include generic 
)
Merging metag-fixes/fixes (0164a711c97b metag: Fix ioremap_wc/ioremap_cached 
build errors)
Merging powerpc-fixes/fixes (8550e2fa34f0 powerpc/mm/hash: Use the correct PPP 
mask when updating HPTE)
Merging powerpc-merge-mpe/fixes (bc0195aad0da Linux 4.2-rc2)
Merging sparc/master (6b15d6650c53 Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging net/master (ab522fd68bc7 Merge branch 'qed-fixes')
Merging ipsec/master (d6af1a31cc72 vti: Add pmtu handling to vti_xmit.)
Merging ipvs/master (50219538ffc0 vmxnet3: segCnt can be 1 for LRO packets)
Merging wireless-drivers/master (034fdd4a17ff Merge ath-current from ath.git)
Merging mac80211/master (3d5fdff46c4b wext: Fix 32 bit iwpriv compatibility 
issue with 64 bit Kernel)
Merging sound-current/for-linus (8198868f0a28 ALSA: hdac_regmap - fix the 
register access for runtime PM)
Merging pci-current/for-linus (ef0dab4aae14 PCI: Fix unaligned accesses in VC 
code)
Merging driver-core.current/driver-core-linus (e80dac114c63 Merge tag 
'usb-4.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb)
Merging tty.current/tty-linus (33688abb2802 Linux 4.7-rc4)
Merging usb.current/usb-linus (33688abb2802 Linux 4.7-rc4)
Merging usb-gadget-fixes/fixes (50c763f8c1ba usb: dwc3: Set the ClearPendIN bit 
on Clear Stall EP command)
Merging usb-serial-fixes/usb-linus (33688abb2802 Linux 4.7-rc4)
Merging usb-chipidea-fixes/ci-for-usb-stable (ea1d39a31d3b usb: common: 
otg-fsm: add license to usb-otg-fsm)
Merging staging.current/staging-linus (33688abb2802 Linux 4.7-rc4)
Merging char-misc.current/char-misc-linus (e80dac114c63 Merge tag 'usb-4.7-rc4' 
of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb)
Merging input-current/for-linus (30172936eefb MAINTAINERS: add Pali Rohár as 
reviewer of ALPS PS/2 touchpad driver)
Merging crypto-current/master (19ced623db2f crypto: ux500 - memmove the right 
size)
Merging ide/master (1993b176a822 Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide)
Merging rr-fixes/fixes (8244062ef1e5 modules: fix longstanding /proc/kallsyms 
vs module insertion race.)
Merging vfio-fixes/for-linus (ce7585f3c4d7 vfio/pci: Allow VPD short read)
Merging kselftest-fixes/fixes (f80eb4289491 selftests/exec: Makefile is a 
run-time dependency, add it to the install list)
Merging backlight-fixes/for-backlight-fixes (68feaca0b13e backlight: pwm: 
Handle EPROBE_DEFER while requesting the PWM)
Merging ftrace-fixes/for-next-urgent (6224be

[PATCH 18/27] [AARCH64] Add kernel_sigaction.h for AARCH64 ILP32

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

In ILP32, the sigaction struct is the same as AARCH64 so we need
the header file kernel_sigaction.h.  To allow for this to work,
we use a long long fields and then add extra casts when converting
between the user exposed struct and the kernel exposed struct.

* sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h: New file.
* sysdeps/unix/sysv/linux/aarch64/sigaction.c (__libc_sigaction):
Add cast here it is necessary.

Signed-off-by: Yury Norov 
---
 sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h | 12 
 sysdeps/unix/sysv/linux/aarch64/sigaction.c| 10 ++
 2 files changed, 18 insertions(+), 4 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h

diff --git a/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h 
b/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h
new file mode 100644
index 000..7b3023b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h
@@ -0,0 +1,12 @@
+
+#define HAVE_SA_RESTORER
+
+/* This is the sigaction structure in aarch64 kernel.
+   Note the ILP32 struct uses the same struct as LP64
+   which is why the fields are 64bit in size. */
+struct kernel_sigaction {
+   unsigned long long k_sa_handler;
+   unsigned long long sa_flags;
+   unsigned long long sa_restorer;
+   sigset_t sa_mask;
+};
diff --git a/sysdeps/unix/sysv/linux/aarch64/sigaction.c 
b/sysdeps/unix/sysv/linux/aarch64/sigaction.c
index 3291924..40a327f 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sigaction.c
+++ b/sysdeps/unix/sysv/linux/aarch64/sigaction.c
@@ -39,15 +39,17 @@ __libc_sigaction (int sig, const struct sigaction *act, 
struct sigaction *oact)
 
   if (act)
 {
-  kact.k_sa_handler = act->sa_handler;
+  kact.k_sa_handler = (unsigned long long)(uintptr_t)act->sa_handler;
   memcpy (_mask, >sa_mask, sizeof (sigset_t));
   kact.sa_flags = act->sa_flags;
 #ifdef HAVE_SA_RESTORER
   if (kact.sa_flags & SA_RESTORER)
-   kact.sa_restorer = act->sa_restorer;
+   kact.sa_restorer = (unsigned long long)(uintptr_t)act->sa_restorer;
 #endif
 }
 
+  /* This is needed for ILP32 as the structures are two different sizes due to
+ using the LP64 structure.  */
   result = INLINE_SYSCALL (rt_sigaction, 4, sig,
   act ?  : NULL,
   oact ?  : NULL, _NSIG / 8);
@@ -55,11 +57,11 @@ __libc_sigaction (int sig, const struct sigaction *act, 
struct sigaction *oact)
 {
   if (oact && result >= 0)
{
- oact->sa_handler = koact.k_sa_handler;
+ oact->sa_handler = (void*)(uintptr_t)koact.k_sa_handler;
  memcpy (>sa_mask, _mask, sizeof (sigset_t));
  oact->sa_flags = koact.sa_flags;
 #ifdef HAVE_SA_RESTORER
- oact->sa_restorer = koact.sa_restorer;
+ oact->sa_restorer = (void*)(uintptr_t)koact.sa_restorer;
 #endif
}
 }
-- 
2.7.4



[PATCH 14/27] [AARCH64] Add ILP32 to makefiles

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

This patch adds ilp32 and ilp32_be as abi variants to the aarch64 linux
makefile.

* sysdeps/unix/sysv/linux/aarch64/Makefile (abi-variants): Add ilp32
and ilp32_be.
(abi-lp64-options): Add defining of LP64 and undef of ILP32 macros.
(abi-lp64-condition): Check word size macro also.
(abi-lp64_be-options): Add defining of LP64 and undef of ILP32 macros.
(abi-lp64_be-condition): Check word size macro also.
(abi-ilp32-options): Define.
(abi-ilp32-condition): Likewise.
(abi-ilp32_be-options): Define.
(abi-ilp32_be-condition): Likewise.

Signed-off-by: Yury Norov 
---
 sysdeps/unix/sysv/linux/aarch64/Makefile | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/aarch64/Makefile 
b/sysdeps/unix/sysv/linux/aarch64/Makefile
index 6b4e620..67619f5 100644
--- a/sysdeps/unix/sysv/linux/aarch64/Makefile
+++ b/sysdeps/unix/sysv/linux/aarch64/Makefile
@@ -23,13 +23,21 @@ endif
 
 abi-variants := lp64
 abi-variants += lp64_be
+abi-variants += ilp32
+abi-variants += ilp32_be
 
 ifeq (,$(filter $(default-abi),$(abi-variants)))
 Unknown ABI, must be one of $(abi-variants)
 endif
 
-abi-lp64-options := -U__AARCH64EB__
-abi-lp64-condition := !defined __AARCH64EB__
+abi-lp64-options := -U__AARCH64EB__ -D__LP64__ -U__ILP32__
+abi-lp64-condition := __WORDSIZE == 64 && !defined __AARCH64EB__
 
-abi-lp64_be-options := -D__AARCH64EB__
-abi-lp64_be-condition := defined __AARCH64EB__
+abi-lp64_be-options := -D__AARCH64EB__ -D__LP64__ -U__ILP32__
+abi-lp64_be-condition := __WORDSIZE == 64 && defined __AARCH64EB__
+
+abi-ilp32-options := -U__AARCH64EB__ -U__LP64__ -D__ILP32__
+abi-ilp32-condition := __WORDSIZE == 32 && !defined __AARCH64EB__
+
+abi-ilp32_be-options := -D__AARCH64EB__ -U__LP64__ -D__ILP32__
+abi-ilp32_be-condition := __WORDSIZE == 32 && defined __AARCH64EB__
-- 
2.7.4



[PATCH 18/27] [AARCH64] Add kernel_sigaction.h for AARCH64 ILP32

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

In ILP32, the sigaction struct is the same as AARCH64 so we need
the header file kernel_sigaction.h.  To allow for this to work,
we use a long long fields and then add extra casts when converting
between the user exposed struct and the kernel exposed struct.

* sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h: New file.
* sysdeps/unix/sysv/linux/aarch64/sigaction.c (__libc_sigaction):
Add cast here it is necessary.

Signed-off-by: Yury Norov 
---
 sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h | 12 
 sysdeps/unix/sysv/linux/aarch64/sigaction.c| 10 ++
 2 files changed, 18 insertions(+), 4 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h

diff --git a/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h 
b/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h
new file mode 100644
index 000..7b3023b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h
@@ -0,0 +1,12 @@
+
+#define HAVE_SA_RESTORER
+
+/* This is the sigaction structure in aarch64 kernel.
+   Note the ILP32 struct uses the same struct as LP64
+   which is why the fields are 64bit in size. */
+struct kernel_sigaction {
+   unsigned long long k_sa_handler;
+   unsigned long long sa_flags;
+   unsigned long long sa_restorer;
+   sigset_t sa_mask;
+};
diff --git a/sysdeps/unix/sysv/linux/aarch64/sigaction.c 
b/sysdeps/unix/sysv/linux/aarch64/sigaction.c
index 3291924..40a327f 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sigaction.c
+++ b/sysdeps/unix/sysv/linux/aarch64/sigaction.c
@@ -39,15 +39,17 @@ __libc_sigaction (int sig, const struct sigaction *act, 
struct sigaction *oact)
 
   if (act)
 {
-  kact.k_sa_handler = act->sa_handler;
+  kact.k_sa_handler = (unsigned long long)(uintptr_t)act->sa_handler;
   memcpy (_mask, >sa_mask, sizeof (sigset_t));
   kact.sa_flags = act->sa_flags;
 #ifdef HAVE_SA_RESTORER
   if (kact.sa_flags & SA_RESTORER)
-   kact.sa_restorer = act->sa_restorer;
+   kact.sa_restorer = (unsigned long long)(uintptr_t)act->sa_restorer;
 #endif
 }
 
+  /* This is needed for ILP32 as the structures are two different sizes due to
+ using the LP64 structure.  */
   result = INLINE_SYSCALL (rt_sigaction, 4, sig,
   act ?  : NULL,
   oact ?  : NULL, _NSIG / 8);
@@ -55,11 +57,11 @@ __libc_sigaction (int sig, const struct sigaction *act, 
struct sigaction *oact)
 {
   if (oact && result >= 0)
{
- oact->sa_handler = koact.k_sa_handler;
+ oact->sa_handler = (void*)(uintptr_t)koact.k_sa_handler;
  memcpy (>sa_mask, _mask, sizeof (sigset_t));
  oact->sa_flags = koact.sa_flags;
 #ifdef HAVE_SA_RESTORER
- oact->sa_restorer = koact.sa_restorer;
+ oact->sa_restorer = (void*)(uintptr_t)koact.sa_restorer;
 #endif
}
 }
-- 
2.7.4



[PATCH 14/27] [AARCH64] Add ILP32 to makefiles

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

This patch adds ilp32 and ilp32_be as abi variants to the aarch64 linux
makefile.

* sysdeps/unix/sysv/linux/aarch64/Makefile (abi-variants): Add ilp32
and ilp32_be.
(abi-lp64-options): Add defining of LP64 and undef of ILP32 macros.
(abi-lp64-condition): Check word size macro also.
(abi-lp64_be-options): Add defining of LP64 and undef of ILP32 macros.
(abi-lp64_be-condition): Check word size macro also.
(abi-ilp32-options): Define.
(abi-ilp32-condition): Likewise.
(abi-ilp32_be-options): Define.
(abi-ilp32_be-condition): Likewise.

Signed-off-by: Yury Norov 
---
 sysdeps/unix/sysv/linux/aarch64/Makefile | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/aarch64/Makefile 
b/sysdeps/unix/sysv/linux/aarch64/Makefile
index 6b4e620..67619f5 100644
--- a/sysdeps/unix/sysv/linux/aarch64/Makefile
+++ b/sysdeps/unix/sysv/linux/aarch64/Makefile
@@ -23,13 +23,21 @@ endif
 
 abi-variants := lp64
 abi-variants += lp64_be
+abi-variants += ilp32
+abi-variants += ilp32_be
 
 ifeq (,$(filter $(default-abi),$(abi-variants)))
 Unknown ABI, must be one of $(abi-variants)
 endif
 
-abi-lp64-options := -U__AARCH64EB__
-abi-lp64-condition := !defined __AARCH64EB__
+abi-lp64-options := -U__AARCH64EB__ -D__LP64__ -U__ILP32__
+abi-lp64-condition := __WORDSIZE == 64 && !defined __AARCH64EB__
 
-abi-lp64_be-options := -D__AARCH64EB__
-abi-lp64_be-condition := defined __AARCH64EB__
+abi-lp64_be-options := -D__AARCH64EB__ -D__LP64__ -U__ILP32__
+abi-lp64_be-condition := __WORDSIZE == 64 && defined __AARCH64EB__
+
+abi-ilp32-options := -U__AARCH64EB__ -U__LP64__ -D__ILP32__
+abi-ilp32-condition := __WORDSIZE == 32 && !defined __AARCH64EB__
+
+abi-ilp32_be-options := -D__AARCH64EB__ -U__LP64__ -D__ILP32__
+abi-ilp32_be-condition := __WORDSIZE == 32 && defined __AARCH64EB__
-- 
2.7.4



[PATCH 20/27] [AARCH64] Make lp64 and ilp32 directories.

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

The patch makes the ilp32 and lp64 have their own directory under aarch64.
Since ILP32 uses most of the same system calls as LP64 and has a 64bit
off_t, we need make the functions that end in 64 the same as the ones without.
We also need not to special case ioctl or use the already provided mmap.c file.

Signed-off-by: Yury Norov 
---
 sysdeps/aarch64/Implies|  6 --
 sysdeps/aarch64/ilp32/Implies  |  6 ++
 sysdeps/aarch64/lp64/Implies   |  7 ++
 sysdeps/unix/sysv/linux/aarch64/Implies|  2 -
 sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h   |  6 +-
 sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h   | 26 ++--
 sysdeps/unix/sysv/linux/aarch64/ilp32/Implies  |  4 ++
 .../unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c  |  6 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/dl-xstat64.c |  6 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c   | 78 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek64.c|  0
 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/msgctl.c | 32 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c   |  5 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev.c|  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c  |  5 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/readdir64.c  |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c | 53 +++
 .../unix/sysv/linux/aarch64/ilp32/shlib-versions   |  7 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/shmctl.c | 32 +
 .../unix/sysv/linux/aarch64/ilp32/syscalls.list|  0
 sysdeps/unix/sysv/linux/aarch64/ioctl.S| 31 -
 sysdeps/unix/sysv/linux/aarch64/lp64/Implies   |  4 ++
 sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S   | 31 +
 sysdeps/unix/sysv/linux/aarch64/lp64/mmap.c| 34 ++
 .../unix/sysv/linux/aarch64/lp64/shlib-versions|  7 ++
 sysdeps/unix/sysv/linux/aarch64/mmap.c | 34 --
 sysdeps/unix/sysv/linux/aarch64/shlib-versions |  7 --
 30 files changed, 346 insertions(+), 88 deletions(-)
 delete mode 100644 sysdeps/aarch64/Implies
 create mode 100644 sysdeps/aarch64/ilp32/Implies
 create mode 100644 sysdeps/aarch64/lp64/Implies
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/Implies
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/dl-xstat64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/msgctl.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/readdir64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/shmctl.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
 delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ioctl.S
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/Implies
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/mmap.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions
 delete mode 100644 sysdeps/unix/sysv/linux/aarch64/mmap.c
 delete mode 100644 sysdeps/unix/sysv/linux/aarch64/shlib-versions

diff --git a/sysdeps/aarch64/Implies b/sysdeps/aarch64/Implies
deleted file mode 100644
index e5adf4d..000
--- a/sysdeps/aarch64/Implies
+++ /dev/null
@@ -1,6 +0,0 @@
-wordsize-64
-ieee754/ldbl-128
-ieee754/dbl-64/wordsize-64
-ieee754/dbl-64
-ieee754/flt-32
-aarch64/soft-fp
diff --git a/sysdeps/aarch64/ilp32/Implies b/sysdeps/aarch64/ilp32/Implies
new file mode 100644
index 000..705bc5b
--- /dev/null
+++ b/sysdeps/aarch64/ilp32/Implies
@@ -0,0 +1,6 @@
+aarch64
+wordsize-32
+ieee754/ldbl-128
+ieee754/dbl-64
+ieee754/flt-32
+aarch64/soft-fp
diff --git a/sysdeps/aarch64/lp64/Implies b/sysdeps/aarch64/lp64/Implies
new file mode 100644
index 000..d2fbde7
--- /dev/null
+++ b/sysdeps/aarch64/lp64/Implies
@@ -0,0 +1,7 @@
+aarch64
+wordsize-64
+ieee754/ldbl-128
+ieee754/dbl-64/wordsize-64
+ieee754/dbl-64
+ieee754/flt-32
+aarch64/soft-fp
diff --git 

[PATCH 16/27] [AARCH64] Add ILP32 ld.so to the known interpreter names.

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

This patch adds ILP32 ld.so names to the known interpreter names.

* sysdeps/unix/sysv/linux/aarch64/ldconfig.h (SYSDEP_KNOWN_INTERPRETER_NAMES):
Add ilp32 ld.so names.

Signed-off-by: Yury Norov 
---
 sysdeps/unix/sysv/linux/aarch64/ldconfig.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h 
b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
index ee91ef8..ac84194 100644
--- a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
@@ -21,6 +21,8 @@
 #define SYSDEP_KNOWN_INTERPRETER_NAMES \
   { "/lib/ld-linux-aarch64.so.1", FLAG_ELF_LIBC6 }, \
   { "/lib/ld-linux-aarch64_be.so.1", FLAG_ELF_LIBC6 }, \
+  { "/lib/ld-linux-aarch64_ilp32.so.1", FLAG_ELF_LIBC6 }, \
+  { "/lib/ld-linux-aarch64_be_ilp32.so.1", FLAG_ELF_LIBC6 }, \
   { "/lib/ld-linux.so.3", FLAG_ELF_LIBC6 }, \
   { "/lib/ld-linux-armhf.so.3", FLAG_ELF_LIBC6 },
 #define SYSDEP_KNOWN_LIBRARY_NAMES \
-- 
2.7.4



[PATCH 20/27] [AARCH64] Make lp64 and ilp32 directories.

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

The patch makes the ilp32 and lp64 have their own directory under aarch64.
Since ILP32 uses most of the same system calls as LP64 and has a 64bit
off_t, we need make the functions that end in 64 the same as the ones without.
We also need not to special case ioctl or use the already provided mmap.c file.

Signed-off-by: Yury Norov 
---
 sysdeps/aarch64/Implies|  6 --
 sysdeps/aarch64/ilp32/Implies  |  6 ++
 sysdeps/aarch64/lp64/Implies   |  7 ++
 sysdeps/unix/sysv/linux/aarch64/Implies|  2 -
 sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h   |  6 +-
 sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h   | 26 ++--
 sysdeps/unix/sysv/linux/aarch64/ilp32/Implies  |  4 ++
 .../unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c  |  6 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/dl-xstat64.c |  6 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c   | 78 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek64.c|  0
 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/msgctl.c | 32 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c   |  5 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev.c|  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c  |  5 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/readdir64.c  |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c | 53 +++
 .../unix/sysv/linux/aarch64/ilp32/shlib-versions   |  7 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/shmctl.c | 32 +
 .../unix/sysv/linux/aarch64/ilp32/syscalls.list|  0
 sysdeps/unix/sysv/linux/aarch64/ioctl.S| 31 -
 sysdeps/unix/sysv/linux/aarch64/lp64/Implies   |  4 ++
 sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S   | 31 +
 sysdeps/unix/sysv/linux/aarch64/lp64/mmap.c| 34 ++
 .../unix/sysv/linux/aarch64/lp64/shlib-versions|  7 ++
 sysdeps/unix/sysv/linux/aarch64/mmap.c | 34 --
 sysdeps/unix/sysv/linux/aarch64/shlib-versions |  7 --
 30 files changed, 346 insertions(+), 88 deletions(-)
 delete mode 100644 sysdeps/aarch64/Implies
 create mode 100644 sysdeps/aarch64/ilp32/Implies
 create mode 100644 sysdeps/aarch64/lp64/Implies
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/Implies
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/dl-fxstatat64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/dl-xstat64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/getdents64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/msgctl.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/preadv64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwritev64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/readdir64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/semctl.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/shlib-versions
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/shmctl.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/syscalls.list
 delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ioctl.S
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/Implies
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/ioctl.S
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/mmap.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/lp64/shlib-versions
 delete mode 100644 sysdeps/unix/sysv/linux/aarch64/mmap.c
 delete mode 100644 sysdeps/unix/sysv/linux/aarch64/shlib-versions

diff --git a/sysdeps/aarch64/Implies b/sysdeps/aarch64/Implies
deleted file mode 100644
index e5adf4d..000
--- a/sysdeps/aarch64/Implies
+++ /dev/null
@@ -1,6 +0,0 @@
-wordsize-64
-ieee754/ldbl-128
-ieee754/dbl-64/wordsize-64
-ieee754/dbl-64
-ieee754/flt-32
-aarch64/soft-fp
diff --git a/sysdeps/aarch64/ilp32/Implies b/sysdeps/aarch64/ilp32/Implies
new file mode 100644
index 000..705bc5b
--- /dev/null
+++ b/sysdeps/aarch64/ilp32/Implies
@@ -0,0 +1,6 @@
+aarch64
+wordsize-32
+ieee754/ldbl-128
+ieee754/dbl-64
+ieee754/flt-32
+aarch64/soft-fp
diff --git a/sysdeps/aarch64/lp64/Implies b/sysdeps/aarch64/lp64/Implies
new file mode 100644
index 000..d2fbde7
--- /dev/null
+++ b/sysdeps/aarch64/lp64/Implies
@@ -0,0 +1,7 @@
+aarch64
+wordsize-64
+ieee754/ldbl-128
+ieee754/dbl-64/wordsize-64
+ieee754/dbl-64
+ieee754/flt-32
+aarch64/soft-fp
diff --git a/sysdeps/unix/sysv/linux/aarch64/Implies 

[PATCH 16/27] [AARCH64] Add ILP32 ld.so to the known interpreter names.

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

This patch adds ILP32 ld.so names to the known interpreter names.

* sysdeps/unix/sysv/linux/aarch64/ldconfig.h (SYSDEP_KNOWN_INTERPRETER_NAMES):
Add ilp32 ld.so names.

Signed-off-by: Yury Norov 
---
 sysdeps/unix/sysv/linux/aarch64/ldconfig.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h 
b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
index ee91ef8..ac84194 100644
--- a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
@@ -21,6 +21,8 @@
 #define SYSDEP_KNOWN_INTERPRETER_NAMES \
   { "/lib/ld-linux-aarch64.so.1", FLAG_ELF_LIBC6 }, \
   { "/lib/ld-linux-aarch64_be.so.1", FLAG_ELF_LIBC6 }, \
+  { "/lib/ld-linux-aarch64_ilp32.so.1", FLAG_ELF_LIBC6 }, \
+  { "/lib/ld-linux-aarch64_be_ilp32.so.1", FLAG_ELF_LIBC6 }, \
   { "/lib/ld-linux.so.3", FLAG_ELF_LIBC6 }, \
   { "/lib/ld-linux-armhf.so.3", FLAG_ELF_LIBC6 },
 #define SYSDEP_KNOWN_LIBRARY_NAMES \
-- 
2.7.4



[PATCH 19/27] [AARCH64] Add typesizes.h for ILP32

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

The generic typesizes does not work for ILP32 as the kernel long type
needs to be long long (quad).  time_t, off_t, clock_t, suseconds_t,
ino_t, rlim_t are 64bits.
FDSET bitmask is a 64bit type.

* sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h: New file.

Signed-off-by: Yury Norov 
---
 sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h | 79 
 sysdeps/unix/sysv/linux/sysdep-vdso.h|  4 +-
 2 files changed, 81 insertions(+), 2 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h

diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h 
b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
new file mode 100644
index 000..844da49
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
@@ -0,0 +1,79 @@
+/* bits/typesizes.h -- underlying types for *_t.  Linux/AARCh64 version.
+   Copyright (C) 2011-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   .  */
+
+#ifndef _BITS_TYPES_H
+# error "Never include  directly; use  instead."
+#endif
+
+#ifndef_BITS_TYPESIZES_H
+#define_BITS_TYPESIZES_H   1
+
+/* See  for the meaning of these macros.  This file exists so
+   that  need not vary across different GNU platforms.  */
+
+#define __DEV_T_TYPE   __UQUAD_TYPE
+#define __UID_T_TYPE   __U32_TYPE
+#define __GID_T_TYPE   __U32_TYPE
+#define __INO_T_TYPE   __ULONGWORD_TYPE
+#define __INO64_T_TYPE __UQUAD_TYPE
+#define __MODE_T_TYPE  __U32_TYPE
+#define __NLINK_T_TYPE __U32_TYPE
+#define __OFF_T_TYPE   __SQUAD_TYPE
+#define __OFF64_T_TYPE __SQUAD_TYPE
+#define __PID_T_TYPE   __S32_TYPE
+#define __RLIM_T_TYPE  __ULONGWORD_TYPE
+#define __RLIM64_T_TYPE__UQUAD_TYPE
+#define__BLKCNT_T_TYPE __SLONGWORD_TYPE
+#define__BLKCNT64_T_TYPE   __SQUAD_TYPE
+#define__FSBLKCNT_T_TYPE   __ULONGWORD_TYPE
+#define__FSBLKCNT64_T_TYPE __UQUAD_TYPE
+#define__FSFILCNT_T_TYPE   __ULONGWORD_TYPE
+#define__FSFILCNT64_T_TYPE __UQUAD_TYPE
+#define__FSWORD_T_TYPE __SWORD_TYPE
+#define__ID_T_TYPE __U32_TYPE
+#define __CLOCK_T_TYPE __SLONGWORD_TYPE
+#define __TIME_T_TYPE  __SLONGWORD_TYPE
+#define __USECONDS_T_TYPE  __U32_TYPE
+#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
+#define __DADDR_T_TYPE __S32_TYPE
+#define __KEY_T_TYPE   __S32_TYPE
+#define __CLOCKID_T_TYPE   __S32_TYPE
+#define __TIMER_T_TYPE void *
+#define __BLKSIZE_T_TYPE   __S32_TYPE
+#define __FSID_T_TYPE  struct { int __val[2]; }
+/* ssize_t is always singed long in both ABIs. */
+#define __SSIZE_T_TYPE __SLONGWORD_TYPE
+#define __SYSCALL_SLONG_TYPE   __SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE   __ULONGWORD_TYPE
+#define __CPU_MASK_TYPE __ULONGWORD_TYPE
+
+#ifdef __LP64__
+/* Tell the libc code that off_t and off64_t are actually the same type
+   for all ABI purposes, even if possibly expressed as different base types
+   for C type-checking purposes.  */
+# define __OFF_T_MATCHES_OFF64_T   1
+
+/* Same for ino_t and ino64_t.  */
+# define __INO_T_MATCHES_INO64_T   1
+#endif
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define__FD_SETSIZE1024
+
+
+#endif /* bits/typesizes.h */
diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h 
b/sysdeps/unix/sysv/linux/sysdep-vdso.h
index e8c4a7b..351d6bb 100644
--- a/sysdeps/unix/sysv/linux/sysdep-vdso.h
+++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h
@@ -37,7 +37,7 @@
 __label__ out;   \
 __label__ iserr; \
 INTERNAL_SYSCALL_DECL (sc_err);  \
-long int sc_ret; \
+__syscall_slong_t sc_ret;\
  \
 __typeof (__vdso_##name) vdsop = __vdso_##name;  \
 PTR_DEMANGLE 

[PATCH 19/27] [AARCH64] Add typesizes.h for ILP32

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

The generic typesizes does not work for ILP32 as the kernel long type
needs to be long long (quad).  time_t, off_t, clock_t, suseconds_t,
ino_t, rlim_t are 64bits.
FDSET bitmask is a 64bit type.

* sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h: New file.

Signed-off-by: Yury Norov 
---
 sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h | 79 
 sysdeps/unix/sysv/linux/sysdep-vdso.h|  4 +-
 2 files changed, 81 insertions(+), 2 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h

diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h 
b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
new file mode 100644
index 000..844da49
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h
@@ -0,0 +1,79 @@
+/* bits/typesizes.h -- underlying types for *_t.  Linux/AARCh64 version.
+   Copyright (C) 2011-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   .  */
+
+#ifndef _BITS_TYPES_H
+# error "Never include  directly; use  instead."
+#endif
+
+#ifndef_BITS_TYPESIZES_H
+#define_BITS_TYPESIZES_H   1
+
+/* See  for the meaning of these macros.  This file exists so
+   that  need not vary across different GNU platforms.  */
+
+#define __DEV_T_TYPE   __UQUAD_TYPE
+#define __UID_T_TYPE   __U32_TYPE
+#define __GID_T_TYPE   __U32_TYPE
+#define __INO_T_TYPE   __ULONGWORD_TYPE
+#define __INO64_T_TYPE __UQUAD_TYPE
+#define __MODE_T_TYPE  __U32_TYPE
+#define __NLINK_T_TYPE __U32_TYPE
+#define __OFF_T_TYPE   __SQUAD_TYPE
+#define __OFF64_T_TYPE __SQUAD_TYPE
+#define __PID_T_TYPE   __S32_TYPE
+#define __RLIM_T_TYPE  __ULONGWORD_TYPE
+#define __RLIM64_T_TYPE__UQUAD_TYPE
+#define__BLKCNT_T_TYPE __SLONGWORD_TYPE
+#define__BLKCNT64_T_TYPE   __SQUAD_TYPE
+#define__FSBLKCNT_T_TYPE   __ULONGWORD_TYPE
+#define__FSBLKCNT64_T_TYPE __UQUAD_TYPE
+#define__FSFILCNT_T_TYPE   __ULONGWORD_TYPE
+#define__FSFILCNT64_T_TYPE __UQUAD_TYPE
+#define__FSWORD_T_TYPE __SWORD_TYPE
+#define__ID_T_TYPE __U32_TYPE
+#define __CLOCK_T_TYPE __SLONGWORD_TYPE
+#define __TIME_T_TYPE  __SLONGWORD_TYPE
+#define __USECONDS_T_TYPE  __U32_TYPE
+#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
+#define __DADDR_T_TYPE __S32_TYPE
+#define __KEY_T_TYPE   __S32_TYPE
+#define __CLOCKID_T_TYPE   __S32_TYPE
+#define __TIMER_T_TYPE void *
+#define __BLKSIZE_T_TYPE   __S32_TYPE
+#define __FSID_T_TYPE  struct { int __val[2]; }
+/* ssize_t is always singed long in both ABIs. */
+#define __SSIZE_T_TYPE __SLONGWORD_TYPE
+#define __SYSCALL_SLONG_TYPE   __SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE   __ULONGWORD_TYPE
+#define __CPU_MASK_TYPE __ULONGWORD_TYPE
+
+#ifdef __LP64__
+/* Tell the libc code that off_t and off64_t are actually the same type
+   for all ABI purposes, even if possibly expressed as different base types
+   for C type-checking purposes.  */
+# define __OFF_T_MATCHES_OFF64_T   1
+
+/* Same for ino_t and ino64_t.  */
+# define __INO_T_MATCHES_INO64_T   1
+#endif
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define__FD_SETSIZE1024
+
+
+#endif /* bits/typesizes.h */
diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h 
b/sysdeps/unix/sysv/linux/sysdep-vdso.h
index e8c4a7b..351d6bb 100644
--- a/sysdeps/unix/sysv/linux/sysdep-vdso.h
+++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h
@@ -37,7 +37,7 @@
 __label__ out;   \
 __label__ iserr; \
 INTERNAL_SYSCALL_DECL (sc_err);  \
-long int sc_ret; \
+__syscall_slong_t sc_ret;\
  \
 __typeof (__vdso_##name) vdsop = __vdso_##name;  \
 PTR_DEMANGLE (vdsop);   

[PATCH 12/27] [AARCH64] Add ILP32 support to elf_machine_load_address.

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

This adds ILP32 support to elf_machine_load_address.
Since elf_machine_load_address depends on the static address being
found without relocations, we need to use 16bit relocation which gets
resolved at link time for ILP32.  This is just like how the 32bit
relocation gets resolved at link time for LP64.

* sysdeps/aarch64/dl-machine.h (elf_machine_load_address): Add support
for ILP32.

Signed-off-by: Yury Norov 
---
 sysdeps/aarch64/dl-machine.h | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
index 7a49852..771b0c6 100644
--- a/sysdeps/aarch64/dl-machine.h
+++ b/sysdeps/aarch64/dl-machine.h
@@ -54,19 +54,33 @@ elf_machine_load_address (void)
  by constructing a non GOT reference to the symbol, the dynamic
  address of the symbol we compute using adrp/add to compute the
  symbol's address relative to the PC.
- This depends on 32bit relocations being resolved at link time
- and that the static address fits in the 32bits.  */
+ This depends on 32/16bit relocations being resolved at link time
+ and that the static address fits in the 32/16 bits.  */
 
   ElfW(Addr) static_addr;
   ElfW(Addr) dynamic_addr;
 
   asm ("   \n"
 "  adrp%1, _dl_start;  \n"
+#ifdef __LP64__
 "  add %1, %1, #:lo12:_dl_start\n"
+#else
+"  add %w1, %w1, #:lo12:_dl_start  \n"
+#endif
 "  ldr %w0, 1f \n"
 "  b   2f  \n"
 "1:\n"
+#ifdef __LP64__
 "  .word   _dl_start   \n"
+#else
+# ifdef __AARCH64EB__
+"  .short  0   \n"
+# endif
+"  .short  _dl_start   \n"
+# ifndef __AARCH64EB__
+"  .short  0   \n"
+# endif
+#endif
 "2:\n"
 : "=r" (static_addr),  "=r" (dynamic_addr));
   return dynamic_addr - static_addr;
-- 
2.7.4



[PATCH 17/27] [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

To be support multi-lib with ldd, we need to add a ldd-rewrite.sed file
to rewrite RTLDLIST to include both ld.so's.

* sysdeps/unix/sysv/linux/aarch64/configure.ac (ldd_rewrite_script):
Set.
* sysdeps/unix/sysv/linux/aarch64/configure: Regenerate.
* sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed: New file.

Signed-off-by: Yury Norov 
---
 sysdeps/unix/sysv/linux/aarch64/configure   | 2 ++
 sysdeps/unix/sysv/linux/aarch64/configure.ac| 2 ++
 sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed | 1 +
 3 files changed, 5 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed

diff --git a/sysdeps/unix/sysv/linux/aarch64/configure 
b/sysdeps/unix/sysv/linux/aarch64/configure
index 2563e83..325422f 100755
--- a/sysdeps/unix/sysv/linux/aarch64/configure
+++ b/sysdeps/unix/sysv/linux/aarch64/configure
@@ -31,3 +31,5 @@ case "$prefix" in
 esac
 fi
 
+ldd_rewrite_script=$dir/ldd-rewrite.sed
+
diff --git a/sysdeps/unix/sysv/linux/aarch64/configure.ac 
b/sysdeps/unix/sysv/linux/aarch64/configure.ac
index 6526816..3ca8ed1 100644
--- a/sysdeps/unix/sysv/linux/aarch64/configure.ac
+++ b/sysdeps/unix/sysv/linux/aarch64/configure.ac
@@ -9,3 +9,5 @@ else
   LIBC_SLIBDIR_RTLDDIR([lib64], [lib])
 fi
 
+ldd_rewrite_script=$dir/ldd-rewrite.sed
+
diff --git a/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed 
b/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
new file mode 100644
index 000..2f3bbb9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
@@ -0,0 +1 @@
+s_^\(RTLDLIST=\)\(.*lib/\)\([^/]*\)\(-aarch64\)\(\|\_be\)\(\|\_ilp32\)\(.so\.[0-9.]*\)$_\1"\2\3-aarch64\5\7
 \2\3-aarch64\5\_ilp32\7"_
-- 
2.7.4



[PATCH 12/27] [AARCH64] Add ILP32 support to elf_machine_load_address.

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

This adds ILP32 support to elf_machine_load_address.
Since elf_machine_load_address depends on the static address being
found without relocations, we need to use 16bit relocation which gets
resolved at link time for ILP32.  This is just like how the 32bit
relocation gets resolved at link time for LP64.

* sysdeps/aarch64/dl-machine.h (elf_machine_load_address): Add support
for ILP32.

Signed-off-by: Yury Norov 
---
 sysdeps/aarch64/dl-machine.h | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
index 7a49852..771b0c6 100644
--- a/sysdeps/aarch64/dl-machine.h
+++ b/sysdeps/aarch64/dl-machine.h
@@ -54,19 +54,33 @@ elf_machine_load_address (void)
  by constructing a non GOT reference to the symbol, the dynamic
  address of the symbol we compute using adrp/add to compute the
  symbol's address relative to the PC.
- This depends on 32bit relocations being resolved at link time
- and that the static address fits in the 32bits.  */
+ This depends on 32/16bit relocations being resolved at link time
+ and that the static address fits in the 32/16 bits.  */
 
   ElfW(Addr) static_addr;
   ElfW(Addr) dynamic_addr;
 
   asm ("   \n"
 "  adrp%1, _dl_start;  \n"
+#ifdef __LP64__
 "  add %1, %1, #:lo12:_dl_start\n"
+#else
+"  add %w1, %w1, #:lo12:_dl_start  \n"
+#endif
 "  ldr %w0, 1f \n"
 "  b   2f  \n"
 "1:\n"
+#ifdef __LP64__
 "  .word   _dl_start   \n"
+#else
+# ifdef __AARCH64EB__
+"  .short  0   \n"
+# endif
+"  .short  _dl_start   \n"
+# ifndef __AARCH64EB__
+"  .short  0   \n"
+# endif
+#endif
 "2:\n"
 : "=r" (static_addr),  "=r" (dynamic_addr));
   return dynamic_addr - static_addr;
-- 
2.7.4



[PATCH 17/27] [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

To be support multi-lib with ldd, we need to add a ldd-rewrite.sed file
to rewrite RTLDLIST to include both ld.so's.

* sysdeps/unix/sysv/linux/aarch64/configure.ac (ldd_rewrite_script):
Set.
* sysdeps/unix/sysv/linux/aarch64/configure: Regenerate.
* sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed: New file.

Signed-off-by: Yury Norov 
---
 sysdeps/unix/sysv/linux/aarch64/configure   | 2 ++
 sysdeps/unix/sysv/linux/aarch64/configure.ac| 2 ++
 sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed | 1 +
 3 files changed, 5 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed

diff --git a/sysdeps/unix/sysv/linux/aarch64/configure 
b/sysdeps/unix/sysv/linux/aarch64/configure
index 2563e83..325422f 100755
--- a/sysdeps/unix/sysv/linux/aarch64/configure
+++ b/sysdeps/unix/sysv/linux/aarch64/configure
@@ -31,3 +31,5 @@ case "$prefix" in
 esac
 fi
 
+ldd_rewrite_script=$dir/ldd-rewrite.sed
+
diff --git a/sysdeps/unix/sysv/linux/aarch64/configure.ac 
b/sysdeps/unix/sysv/linux/aarch64/configure.ac
index 6526816..3ca8ed1 100644
--- a/sysdeps/unix/sysv/linux/aarch64/configure.ac
+++ b/sysdeps/unix/sysv/linux/aarch64/configure.ac
@@ -9,3 +9,5 @@ else
   LIBC_SLIBDIR_RTLDDIR([lib64], [lib])
 fi
 
+ldd_rewrite_script=$dir/ldd-rewrite.sed
+
diff --git a/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed 
b/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
new file mode 100644
index 000..2f3bbb9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ldd-rewrite.sed
@@ -0,0 +1 @@
+s_^\(RTLDLIST=\)\(.*lib/\)\([^/]*\)\(-aarch64\)\(\|\_be\)\(\|\_ilp32\)\(.so\.[0-9.]*\)$_\1"\2\3-aarch64\5\7
 \2\3-aarch64\5\_ilp32\7"_
-- 
2.7.4



[PATCH 0/6] kexec_file: Add buffer hand-over for the next kernel

2016-06-20 Thread Thiago Jung Bauermann
Hello,

This patch series implements a mechanism which allows the kernel to pass on
a buffer to the kernel that will be kexec'd. This buffer is passed as a
segment which is added to the kimage when it is being prepared by
kexec_file_load.

How the second kernel is informed of this buffer is architecture-specific.
On PowerPC, this is done via the device tree, by checking the properties
/chosen/linux,kexec-handover-buffer-start and
/chosen/linux,kexec-handover-buffer-end, which is analogous to how the
kernel finds the initrd.

This feature was implemented because the Integrity Measurement Architecture
subsystem needs to preserve its measurement list accross the kexec reboot.
This is so that IMA can implement trusted boot support on the OpenPower
platform, because on such systems an intermediary Linux instance running as
part of the firmware is used to boot the target operating system via kexec.
Using this mechanism, IMA on this intermediary instance can hand over to the
target OS the measurements of the components that were used to boot it.

Because there could be additional measurement events between the
kexec_file_load call and the actual reboot, IMA needs a way to update the
buffer with those additional events before rebooting. One can minimize
the interval between the kexec_file_load and the reboot syscalls, but as
small as it can be, there is always the possibility that the measurement
list will be out of date at the time of reboot.

To address this issue, this patch series also introduces kexec_update_segment,
which allows a reboot notifier to change the contents of the image segment
during the reboot process.

There's one patch which makes kimage_load_normal_segment and
kexec_update_segment share code. It's not much code that they can share
though, so I'm not sure if it's worth including this patch.

The last patch is not intended to be merged, it just demonstrates how this
feature can be used.

This series applies on top of v2 of the "kexec_file_load implementation
for PowerPC" patch series at:

http://lists.infradead.org/pipermail/kexec/2016-June/016078.html

Thiago Jung Bauermann (6):
  kexec_file: Add buffer hand-over support for the next kernel
  powerpc: kexec_file: Add buffer hand-over support for the next kernel
  kexec_file: Allow skipping checksum calculation for some segments.
  kexec_file: Add mechanism to update kexec segments.
  kexec: Share logic to copy segment page contents.
  IMA: Demonstration code for kexec buffer passing.

 arch/powerpc/include/asm/kexec.h   |   9 ++
 arch/powerpc/kernel/kexec_elf_64.c |  50 +++-
 arch/powerpc/kernel/machine_kexec_64.c |  64 ++
 arch/x86/kernel/crash.c|   4 +-
 arch/x86/kernel/kexec-bzimage64.c  |   6 +-
 include/linux/ima.h|  11 ++
 include/linux/kexec.h  |  47 +++-
 kernel/kexec_core.c| 205 ++---
 kernel/kexec_file.c| 102 ++--
 security/integrity/ima/ima.h   |   5 +
 security/integrity/ima/ima_init.c  |  26 +
 security/integrity/ima/ima_template.c  |  79 +
 12 files changed, 547 insertions(+), 61 deletions(-)

-- 
1.9.1



[PATCH 23/27] [AARCH64] delouse input arguments in system functions

2016-06-20 Thread Yury Norov
Signed-off-by: Yury Norov 
---
 sysdeps/aarch64/__longjmp.S   | 2 ++
 sysdeps/aarch64/dl-tlsdesc.S  | 6 ++
 sysdeps/aarch64/memcmp.S  | 3 +++
 sysdeps/aarch64/memcpy.S  | 4 +++-
 sysdeps/aarch64/memmove.S | 3 +++
 sysdeps/aarch64/memset.S  | 3 ++-
 sysdeps/aarch64/setjmp.S  | 1 +
 sysdeps/aarch64/strchr.S  | 1 +
 sysdeps/aarch64/strchrnul.S   | 1 +
 sysdeps/aarch64/strcmp.S  | 2 ++
 sysdeps/aarch64/strcpy.S  | 2 ++
 sysdeps/aarch64/strlen.S  | 2 ++
 sysdeps/aarch64/strncmp.S | 3 +++
 sysdeps/aarch64/strnlen.S | 3 +++
 sysdeps/aarch64/strrchr.S | 1 +
 sysdeps/aarch64/sysdep.h  | 4 +++-
 sysdeps/unix/sysv/linux/aarch64/clone.S   | 7 +++
 sysdeps/unix/sysv/linux/aarch64/getcontext.S  | 1 +
 sysdeps/unix/sysv/linux/aarch64/setcontext.S  | 1 +
 sysdeps/unix/sysv/linux/aarch64/swapcontext.S | 1 +
 20 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/sysdeps/aarch64/__longjmp.S b/sysdeps/aarch64/__longjmp.S
index 58332be..0377715 100644
--- a/sysdeps/aarch64/__longjmp.S
+++ b/sysdeps/aarch64/__longjmp.S
@@ -46,6 +46,8 @@ ENTRY (__longjmp)
cfi_offset(d14, JB_D14<<3)
cfi_offset(d15, JB_D15<<3)
 
+   DELOUSE(0)
+
ldp x19, x20, [x0, #JB_X19<<3]
ldp x21, x22, [x0, #JB_X21<<3]
ldp x23, x24, [x0, #JB_X23<<3]
diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
index fe8a17d..718dddf 100644
--- a/sysdeps/aarch64/dl-tlsdesc.S
+++ b/sysdeps/aarch64/dl-tlsdesc.S
@@ -74,6 +74,7 @@
cfi_startproc
.align 2
 _dl_tlsdesc_return:
+   DELOUSE(0)
ldr PTR_REG (0), [x0, #PTR_SIZE]
RET
cfi_endproc
@@ -126,6 +127,7 @@ _dl_tlsdesc_undefweak:
   td->entry in _dl_tlsdesc_resolve_rela_fixup ensuring that the load
   from [x0,#8] here happens after the initialization of td->arg.  */
ldarxzr, [x0]
+   DELOUSE(0)
ldr PTR_REG (0), [x0, #PTR_SIZE]
mrs x1, tpidr_el0
sub PTR_REG (0), PTR_REG (0), PTR_REG (1)
@@ -174,6 +176,7 @@ _dl_tlsdesc_dynamic:
stp x29, x30, [sp,#-(32+16*NSAVEXREGPAIRS)]!
cfi_adjust_cfa_offset (32+16*NSAVEXREGPAIRS)
mov x29, sp
+   DELOUSE(0)
 
/* Save just enough registers to support fast path, if we fall
   into slow path we will save additional registers.  */
@@ -279,12 +282,14 @@ _dl_tlsdesc_resolve_rela:
 
SAVE_Q_REGISTERS
 
+   DELOUSE(3)
ldr PTR_REG (1), [x3, #PTR_SIZE]
bl  _dl_tlsdesc_resolve_rela_fixup
 
RESTORE_Q_REGISTERS
 
ldr x0, [sp, #32+16*8]
+   DELOUSE(0)
ldr PTR_REG (1), [x0]
blr x1
 
@@ -346,6 +351,7 @@ _dl_tlsdesc_resolve_hold:
RESTORE_Q_REGISTERS
 
ldr x0, [sp, #32+16*9]
+   DELOUSE(0)
ldr PTR_REG (1), [x0]
blr x1
 
diff --git a/sysdeps/aarch64/memcmp.S b/sysdeps/aarch64/memcmp.S
index ae2d997..982aa02 100644
--- a/sysdeps/aarch64/memcmp.S
+++ b/sysdeps/aarch64/memcmp.S
@@ -47,6 +47,9 @@
 #define mask   x13
 
 ENTRY_ALIGN (memcmp, 6)
+   DELOUSE(0)
+   DELOUSE(1)
+   DELOUSE(2)
cbz limit, L(ret0)
eor tmp1, src1, src2
tst tmp1, #7
diff --git a/sysdeps/aarch64/memcpy.S b/sysdeps/aarch64/memcpy.S
index 442f390..e0bbbf8 100644
--- a/sysdeps/aarch64/memcpy.S
+++ b/sysdeps/aarch64/memcpy.S
@@ -46,7 +46,9 @@
 #include 
 
 ENTRY_ALIGN (memcpy, 6)
-
+   DELOUSE(0)
+   DELOUSE(1)
+   DELOUSE(2)
mov dst, dstin
cmp count, #64
b.geL(cpy_not_short)
diff --git a/sysdeps/aarch64/memmove.S b/sysdeps/aarch64/memmove.S
index dd91db0..3f72dea 100644
--- a/sysdeps/aarch64/memmove.S
+++ b/sysdeps/aarch64/memmove.S
@@ -46,6 +46,9 @@
 #define D_hx14
 
 ENTRY_ALIGN (memmove, 6)
+   DELOUSE(0)
+   DELOUSE(1)
+   DELOUSE(2)
 
cmp dstin, src
b.loL(downwards)
diff --git a/sysdeps/aarch64/memset.S b/sysdeps/aarch64/memset.S
index e49f4d6..e8eed9e 100644
--- a/sysdeps/aarch64/memset.S
+++ b/sysdeps/aarch64/memset.S
@@ -52,7 +52,8 @@
 #define tmp3w  w9
 
 ENTRY_ALIGN (__memset, 6)
-
+   DELOUSE(0)
+   DELOUSE(2)
mov dst, dstin  /* Preserve return value.  */
andsA_lw, val, #255
 #ifndef DONT_USE_DC
diff --git a/sysdeps/aarch64/setjmp.S b/sysdeps/aarch64/setjmp.S
index da83f19..d608660 100644
--- a/sysdeps/aarch64/setjmp.S
+++ b/sysdeps/aarch64/setjmp.S
@@ -33,6 +33,7 @@ END (_setjmp)
 libc_hidden_def (_setjmp)
 
 ENTRY (__sigsetjmp)
+   DELOUSE(0)
 
 1:
stp x19, x20, [x0, #JB_X19<<3]
diff --git 

[PATCH 0/6] kexec_file: Add buffer hand-over for the next kernel

2016-06-20 Thread Thiago Jung Bauermann
Hello,

This patch series implements a mechanism which allows the kernel to pass on
a buffer to the kernel that will be kexec'd. This buffer is passed as a
segment which is added to the kimage when it is being prepared by
kexec_file_load.

How the second kernel is informed of this buffer is architecture-specific.
On PowerPC, this is done via the device tree, by checking the properties
/chosen/linux,kexec-handover-buffer-start and
/chosen/linux,kexec-handover-buffer-end, which is analogous to how the
kernel finds the initrd.

This feature was implemented because the Integrity Measurement Architecture
subsystem needs to preserve its measurement list accross the kexec reboot.
This is so that IMA can implement trusted boot support on the OpenPower
platform, because on such systems an intermediary Linux instance running as
part of the firmware is used to boot the target operating system via kexec.
Using this mechanism, IMA on this intermediary instance can hand over to the
target OS the measurements of the components that were used to boot it.

Because there could be additional measurement events between the
kexec_file_load call and the actual reboot, IMA needs a way to update the
buffer with those additional events before rebooting. One can minimize
the interval between the kexec_file_load and the reboot syscalls, but as
small as it can be, there is always the possibility that the measurement
list will be out of date at the time of reboot.

To address this issue, this patch series also introduces kexec_update_segment,
which allows a reboot notifier to change the contents of the image segment
during the reboot process.

There's one patch which makes kimage_load_normal_segment and
kexec_update_segment share code. It's not much code that they can share
though, so I'm not sure if it's worth including this patch.

The last patch is not intended to be merged, it just demonstrates how this
feature can be used.

This series applies on top of v2 of the "kexec_file_load implementation
for PowerPC" patch series at:

http://lists.infradead.org/pipermail/kexec/2016-June/016078.html

Thiago Jung Bauermann (6):
  kexec_file: Add buffer hand-over support for the next kernel
  powerpc: kexec_file: Add buffer hand-over support for the next kernel
  kexec_file: Allow skipping checksum calculation for some segments.
  kexec_file: Add mechanism to update kexec segments.
  kexec: Share logic to copy segment page contents.
  IMA: Demonstration code for kexec buffer passing.

 arch/powerpc/include/asm/kexec.h   |   9 ++
 arch/powerpc/kernel/kexec_elf_64.c |  50 +++-
 arch/powerpc/kernel/machine_kexec_64.c |  64 ++
 arch/x86/kernel/crash.c|   4 +-
 arch/x86/kernel/kexec-bzimage64.c  |   6 +-
 include/linux/ima.h|  11 ++
 include/linux/kexec.h  |  47 +++-
 kernel/kexec_core.c| 205 ++---
 kernel/kexec_file.c| 102 ++--
 security/integrity/ima/ima.h   |   5 +
 security/integrity/ima/ima_init.c  |  26 +
 security/integrity/ima/ima_template.c  |  79 +
 12 files changed, 547 insertions(+), 61 deletions(-)

-- 
1.9.1



[PATCH 23/27] [AARCH64] delouse input arguments in system functions

2016-06-20 Thread Yury Norov
Signed-off-by: Yury Norov 
---
 sysdeps/aarch64/__longjmp.S   | 2 ++
 sysdeps/aarch64/dl-tlsdesc.S  | 6 ++
 sysdeps/aarch64/memcmp.S  | 3 +++
 sysdeps/aarch64/memcpy.S  | 4 +++-
 sysdeps/aarch64/memmove.S | 3 +++
 sysdeps/aarch64/memset.S  | 3 ++-
 sysdeps/aarch64/setjmp.S  | 1 +
 sysdeps/aarch64/strchr.S  | 1 +
 sysdeps/aarch64/strchrnul.S   | 1 +
 sysdeps/aarch64/strcmp.S  | 2 ++
 sysdeps/aarch64/strcpy.S  | 2 ++
 sysdeps/aarch64/strlen.S  | 2 ++
 sysdeps/aarch64/strncmp.S | 3 +++
 sysdeps/aarch64/strnlen.S | 3 +++
 sysdeps/aarch64/strrchr.S | 1 +
 sysdeps/aarch64/sysdep.h  | 4 +++-
 sysdeps/unix/sysv/linux/aarch64/clone.S   | 7 +++
 sysdeps/unix/sysv/linux/aarch64/getcontext.S  | 1 +
 sysdeps/unix/sysv/linux/aarch64/setcontext.S  | 1 +
 sysdeps/unix/sysv/linux/aarch64/swapcontext.S | 1 +
 20 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/sysdeps/aarch64/__longjmp.S b/sysdeps/aarch64/__longjmp.S
index 58332be..0377715 100644
--- a/sysdeps/aarch64/__longjmp.S
+++ b/sysdeps/aarch64/__longjmp.S
@@ -46,6 +46,8 @@ ENTRY (__longjmp)
cfi_offset(d14, JB_D14<<3)
cfi_offset(d15, JB_D15<<3)
 
+   DELOUSE(0)
+
ldp x19, x20, [x0, #JB_X19<<3]
ldp x21, x22, [x0, #JB_X21<<3]
ldp x23, x24, [x0, #JB_X23<<3]
diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
index fe8a17d..718dddf 100644
--- a/sysdeps/aarch64/dl-tlsdesc.S
+++ b/sysdeps/aarch64/dl-tlsdesc.S
@@ -74,6 +74,7 @@
cfi_startproc
.align 2
 _dl_tlsdesc_return:
+   DELOUSE(0)
ldr PTR_REG (0), [x0, #PTR_SIZE]
RET
cfi_endproc
@@ -126,6 +127,7 @@ _dl_tlsdesc_undefweak:
   td->entry in _dl_tlsdesc_resolve_rela_fixup ensuring that the load
   from [x0,#8] here happens after the initialization of td->arg.  */
ldarxzr, [x0]
+   DELOUSE(0)
ldr PTR_REG (0), [x0, #PTR_SIZE]
mrs x1, tpidr_el0
sub PTR_REG (0), PTR_REG (0), PTR_REG (1)
@@ -174,6 +176,7 @@ _dl_tlsdesc_dynamic:
stp x29, x30, [sp,#-(32+16*NSAVEXREGPAIRS)]!
cfi_adjust_cfa_offset (32+16*NSAVEXREGPAIRS)
mov x29, sp
+   DELOUSE(0)
 
/* Save just enough registers to support fast path, if we fall
   into slow path we will save additional registers.  */
@@ -279,12 +282,14 @@ _dl_tlsdesc_resolve_rela:
 
SAVE_Q_REGISTERS
 
+   DELOUSE(3)
ldr PTR_REG (1), [x3, #PTR_SIZE]
bl  _dl_tlsdesc_resolve_rela_fixup
 
RESTORE_Q_REGISTERS
 
ldr x0, [sp, #32+16*8]
+   DELOUSE(0)
ldr PTR_REG (1), [x0]
blr x1
 
@@ -346,6 +351,7 @@ _dl_tlsdesc_resolve_hold:
RESTORE_Q_REGISTERS
 
ldr x0, [sp, #32+16*9]
+   DELOUSE(0)
ldr PTR_REG (1), [x0]
blr x1
 
diff --git a/sysdeps/aarch64/memcmp.S b/sysdeps/aarch64/memcmp.S
index ae2d997..982aa02 100644
--- a/sysdeps/aarch64/memcmp.S
+++ b/sysdeps/aarch64/memcmp.S
@@ -47,6 +47,9 @@
 #define mask   x13
 
 ENTRY_ALIGN (memcmp, 6)
+   DELOUSE(0)
+   DELOUSE(1)
+   DELOUSE(2)
cbz limit, L(ret0)
eor tmp1, src1, src2
tst tmp1, #7
diff --git a/sysdeps/aarch64/memcpy.S b/sysdeps/aarch64/memcpy.S
index 442f390..e0bbbf8 100644
--- a/sysdeps/aarch64/memcpy.S
+++ b/sysdeps/aarch64/memcpy.S
@@ -46,7 +46,9 @@
 #include 
 
 ENTRY_ALIGN (memcpy, 6)
-
+   DELOUSE(0)
+   DELOUSE(1)
+   DELOUSE(2)
mov dst, dstin
cmp count, #64
b.geL(cpy_not_short)
diff --git a/sysdeps/aarch64/memmove.S b/sysdeps/aarch64/memmove.S
index dd91db0..3f72dea 100644
--- a/sysdeps/aarch64/memmove.S
+++ b/sysdeps/aarch64/memmove.S
@@ -46,6 +46,9 @@
 #define D_hx14
 
 ENTRY_ALIGN (memmove, 6)
+   DELOUSE(0)
+   DELOUSE(1)
+   DELOUSE(2)
 
cmp dstin, src
b.loL(downwards)
diff --git a/sysdeps/aarch64/memset.S b/sysdeps/aarch64/memset.S
index e49f4d6..e8eed9e 100644
--- a/sysdeps/aarch64/memset.S
+++ b/sysdeps/aarch64/memset.S
@@ -52,7 +52,8 @@
 #define tmp3w  w9
 
 ENTRY_ALIGN (__memset, 6)
-
+   DELOUSE(0)
+   DELOUSE(2)
mov dst, dstin  /* Preserve return value.  */
andsA_lw, val, #255
 #ifndef DONT_USE_DC
diff --git a/sysdeps/aarch64/setjmp.S b/sysdeps/aarch64/setjmp.S
index da83f19..d608660 100644
--- a/sysdeps/aarch64/setjmp.S
+++ b/sysdeps/aarch64/setjmp.S
@@ -33,6 +33,7 @@ END (_setjmp)
 libc_hidden_def (_setjmp)
 
 ENTRY (__sigsetjmp)
+   DELOUSE(0)
 
 1:
stp x19, x20, [x0, #JB_X19<<3]
diff --git a/sysdeps/aarch64/strchr.S 

[PATCH 21/27] [AARCH64] ILP32: introduce syscalls that pass off_t

2016-06-20 Thread Yury Norov
From: Yury Norov 

ILP32 has 64-bit off_t, to follow modern requirements.
But kernel clears top-halves of input registers. It means
we have to pass corresponding arguments in a pair, like
aarch32 does. In this patch all affected syscalls are redefined.
Most of them are taken from arm code.

Signed-off-by: Yury Norov 
---
 sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c  | 31 +++
 .../unix/sysv/linux/aarch64/ilp32/fallocate64.c|  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c  |  1 +
 .../unix/sysv/linux/aarch64/ilp32/ftruncate64.c|  4 +++
 sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek.c  | 36 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c   |  1 +
 .../unix/sysv/linux/aarch64/ilp32/posix_fadvise.c  |  1 +
 .../sysv/linux/aarch64/ilp32/posix_fadvise64.c |  2 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/pread.c  |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c|  5 +++
 sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite.c |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c   |  5 +++
 sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.c  |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c   |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c |  4 +++
 16 files changed, 96 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pread.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c

diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c 
b/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c
new file mode 100644
index 000..4951d06
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2007-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   .  */
+
+#include 
+#include 
+#include 
+
+
+/* Reserve storage for the data of the file associated with FD.  */
+int
+fallocate (int fd, int mode, __off_t offset, __off_t len)
+{
+  return SYSCALL_CANCEL (fallocate, fd, mode,
+__LONG_LONG_PAIR (offset >> 32, offset),
+__LONG_LONG_PAIR (len >> 32, len));
+}
+weak_alias (fallocate, fallocate64)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c 
b/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c
new file mode 100644
index 000..f27735a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c
@@ -0,0 +1 @@
+/* See sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c 
b/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c
new file mode 100644
index 000..fb5b598
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c
@@ -0,0 +1 @@
+/* See sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncatei64.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c 
b/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
new file mode 100644
index 000..bd0f5fe
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
@@ -0,0 +1,4 @@
+#include 
+
+weak_alias (__ftruncate64, __ftruncate)
+weak_alias (__ftruncate64, ftruncate)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c 

[PATCH 21/27] [AARCH64] ILP32: introduce syscalls that pass off_t

2016-06-20 Thread Yury Norov
From: Yury Norov 

ILP32 has 64-bit off_t, to follow modern requirements.
But kernel clears top-halves of input registers. It means
we have to pass corresponding arguments in a pair, like
aarch32 does. In this patch all affected syscalls are redefined.
Most of them are taken from arm code.

Signed-off-by: Yury Norov 
---
 sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c  | 31 +++
 .../unix/sysv/linux/aarch64/ilp32/fallocate64.c|  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c  |  1 +
 .../unix/sysv/linux/aarch64/ilp32/ftruncate64.c|  4 +++
 sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek.c  | 36 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c   |  1 +
 .../unix/sysv/linux/aarch64/ilp32/posix_fadvise.c  |  1 +
 .../sysv/linux/aarch64/ilp32/posix_fadvise64.c |  2 ++
 sysdeps/unix/sysv/linux/aarch64/ilp32/pread.c  |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c|  5 +++
 sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite.c |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c   |  5 +++
 sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.c  |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c   |  1 +
 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c |  4 +++
 16 files changed, 96 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lseek.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/posix_fadvise64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pread.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pread64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/pwrite64.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/readahead.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate.c
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/truncate64.c

diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c 
b/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c
new file mode 100644
index 000..4951d06
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2007-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   .  */
+
+#include 
+#include 
+#include 
+
+
+/* Reserve storage for the data of the file associated with FD.  */
+int
+fallocate (int fd, int mode, __off_t offset, __off_t len)
+{
+  return SYSCALL_CANCEL (fallocate, fd, mode,
+__LONG_LONG_PAIR (offset >> 32, offset),
+__LONG_LONG_PAIR (len >> 32, len));
+}
+weak_alias (fallocate, fallocate64)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c 
b/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c
new file mode 100644
index 000..f27735a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate64.c
@@ -0,0 +1 @@
+/* See sysdeps/unix/sysv/linux/aarch64/ilp32/fallocate.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c 
b/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c
new file mode 100644
index 000..fb5b598
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate.c
@@ -0,0 +1 @@
+/* See sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncatei64.c */
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c 
b/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
new file mode 100644
index 000..bd0f5fe
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/ftruncate64.c
@@ -0,0 +1,4 @@
+#include 
+
+weak_alias (__ftruncate64, __ftruncate)
+weak_alias (__ftruncate64, ftruncate)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c 
b/sysdeps/unix/sysv/linux/aarch64/ilp32/llseek.c
new file mode 100644

[PATCH 13/27] [AARCH64] Set up wordsize for ILP32.

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

__WORDSIZE needs to be set to 32 for ILP32.

* sysdeps/aarch64/bits/wordsize.h (__WORDSIZE): Set to 32 for ILP32.
Update comments.

Signed-off-by: Yury Norov 
---
 sysdeps/aarch64/bits/wordsize.h | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
index 3ecccaa..3d5a79d 100644
--- a/sysdeps/aarch64/bits/wordsize.h
+++ b/sysdeps/aarch64/bits/wordsize.h
@@ -15,12 +15,16 @@
License along with the GNU C Library; if not, see
.  */
 
-#define __WORDSIZE 64
+#ifdef __LP64__
+# define __WORDSIZE64
+#else
+# define __WORDSIZE32
+#endif
 
-/* LP64 ABI has a 64bit time_t.
+/* LP64 and ILP32s ABI uses a 64bit time_t.
This allows aarch32 and AARCH64 applications
both access utmp. */
 #define __WORDSIZE_TIME64_COMPAT32 1
 
-/* LP64 use the 64bit system call interface. */
+/* LP64 and ILP32 use the 64bit system call interface. */
 #define __SYSCALL_WORDSIZE 64
-- 
2.7.4



[PATCH 13/27] [AARCH64] Set up wordsize for ILP32.

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

__WORDSIZE needs to be set to 32 for ILP32.

* sysdeps/aarch64/bits/wordsize.h (__WORDSIZE): Set to 32 for ILP32.
Update comments.

Signed-off-by: Yury Norov 
---
 sysdeps/aarch64/bits/wordsize.h | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
index 3ecccaa..3d5a79d 100644
--- a/sysdeps/aarch64/bits/wordsize.h
+++ b/sysdeps/aarch64/bits/wordsize.h
@@ -15,12 +15,16 @@
License along with the GNU C Library; if not, see
.  */
 
-#define __WORDSIZE 64
+#ifdef __LP64__
+# define __WORDSIZE64
+#else
+# define __WORDSIZE32
+#endif
 
-/* LP64 ABI has a 64bit time_t.
+/* LP64 and ILP32s ABI uses a 64bit time_t.
This allows aarch32 and AARCH64 applications
both access utmp. */
 #define __WORDSIZE_TIME64_COMPAT32 1
 
-/* LP64 use the 64bit system call interface. */
+/* LP64 and ILP32 use the 64bit system call interface. */
 #define __SYSCALL_WORDSIZE 64
-- 
2.7.4



[RFC PATCH 00/27] ARM64: support ILP32

2016-06-20 Thread Yury Norov
This series enables aarch64 port with ilp32 mode.

After long discussions in kernel list, we finally got
consensus on how ABI should look. This patchset adds
support for the ABI in GLIBC. It is tested with LTP 
with no big regressions comparing to LP64 and AARCH32.

Though it's very raw. Please be patient reviewing it.

ABI details:
 - types are taken from AARCH32, next types turned to 64-bit,
   as modern requirement for new APIs tells:
ino_t  is  u64 type
off_t  is  s64 type
blkcnt_t   is  s64 type
fsblkcnt_t is  u64 type
fsfilcnt_t is  u64 type
 - 64-bit arguments are passed in syscall as register pair,
   as kernel internally clears top halves for all input regs;
 - standard syscall table is used;
 - 32-bit time_t is used. AARCH64/ILP32 is waiting for general
   fix of Y2038 problem just like other 32-bit arches;
 - stat{64}, statfs{64} structures are of the identical layout
   with LP64. Corresponding syscalls are taken from 64-bit code.

Links:
This series: https://github.com/norov/glibc/commits/ilp32-2.23
Kernel series: https://github.com/norov/linux/commits/ilp32-nowrap
Kernel in LKML: https://lkml.org/lkml/2016/6/17/990

Please review it. Any comments appreciated.

Yury.

Andrew Pinski (24):
  [AARCH64] Fix utmp struct for compatibility reasons.
  [AARCH64] Add header guards to sysdep.h headers.
  Add dynamic ILP32 AARCH64 relocations to elf.h
  [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE.  Use it in
LDST_PCREL and LDST_GLOBAL.
  [AARCH64] Use PTR_REG in crti.S.
  [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S
  [AARCH64] Use PTR_* macros in dl-trampoline.S
  [AARCH64] Use PTR_* in start.S
  [AARCH64] Use PTR_REG in getcontext.S.
  [AARCH64] Detect ILP32 in configure scripts.
  [AARCH64] Syscalls for ILP32 are passed always via 64bit values.
  [AARCH64] Add ILP32 support to elf_machine_load_address.
  [AARCH64] Set up wordsize for ILP32.
  [AARCH64] Add ILP32 to makefiles
  [AARCH64] Add support to ldconfig for ILP32 and libilp32
  [AARCH64] Add ILP32 ld.so to the known interpreter names.
  [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found
  [AARCH64] Add kernel_sigaction.h for AARCH64 ILP32
  [AARCH64] Add typesizes.h for ILP32
  [AARCH64] Make lp64 and ilp32 directories.
  Add support for AT_ARM64_MIDR.
  [AARCH64] Fix ILP32 warning
  [AARCH64] Change type of __align to long long
  Fix PTRDIFF_MIN/PTRDIFF_MIN and PTRDIFF_MIN for ILP32.

Yury Norov (3):
  [AARCH64] ILP32: introduce syscalls that pass off_t
  [AARCH64] ILP32: support stat syscall family
  [AARCH64] delouse input arguments in system functions

 elf/cache.c|   2 +
 elf/dl-sysdep.c|   1 +
 elf/elf.h  |   3 +
 sysdeps/aarch64/Implies|   6 -
 sysdeps/aarch64/__longjmp.S|   6 +-
 sysdeps/aarch64/bits/wordsize.h|  28 +++
 sysdeps/aarch64/configure  |  15 +-
 sysdeps/aarch64/configure.ac   |  11 +-
 sysdeps/aarch64/crti.S |   3 +-
 sysdeps/aarch64/dl-irel.h  |   3 +-
 sysdeps/aarch64/dl-machine.h   | 199 -
 sysdeps/aarch64/dl-tlsdesc.S   |  42 +++--
 sysdeps/aarch64/dl-trampoline.S|  18 +-
 sysdeps/aarch64/ilp32/Implies  |   6 +
 sysdeps/aarch64/jmpbuf-unwind.h|   2 +-
 sysdeps/aarch64/lp64/Implies   |   7 +
 sysdeps/aarch64/memcmp.S   |   3 +
 sysdeps/aarch64/memcpy.S   |   4 +-
 sysdeps/aarch64/memmove.S  |   3 +
 sysdeps/aarch64/memset.S   |   3 +-
 sysdeps/aarch64/nptl/bits/semaphore.h  |   2 +-
 sysdeps/aarch64/preconfigure   |  11 +-
 sysdeps/aarch64/setjmp.S   |   5 +-
 sysdeps/aarch64/start.S|  20 ++-
 sysdeps/aarch64/strchr.S   |   1 +
 sysdeps/aarch64/strchrnul.S|   1 +
 sysdeps/aarch64/strcmp.S   |   2 +
 sysdeps/aarch64/strcpy.S   |   2 +
 sysdeps/aarch64/strlen.S   |   2 +
 sysdeps/aarch64/strncmp.S  |   3 +
 sysdeps/aarch64/strnlen.S  |   3 +
 sysdeps/aarch64/strrchr.S  |   1 +
 sysdeps/aarch64/sysdep.h   |  39 +++-
 sysdeps/generic/ldconfig.h |   1 +
 sysdeps/generic/stdint.h   |   9 +-
 sysdeps/unix/sysv/linux/aarch64/Implies|   2 -
 sysdeps/unix/sysv/linux/aarch64/Makefile   |  16 +-
 sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h   |   6 +-
 

[RFC PATCH 00/27] ARM64: support ILP32

2016-06-20 Thread Yury Norov
This series enables aarch64 port with ilp32 mode.

After long discussions in kernel list, we finally got
consensus on how ABI should look. This patchset adds
support for the ABI in GLIBC. It is tested with LTP 
with no big regressions comparing to LP64 and AARCH32.

Though it's very raw. Please be patient reviewing it.

ABI details:
 - types are taken from AARCH32, next types turned to 64-bit,
   as modern requirement for new APIs tells:
ino_t  is  u64 type
off_t  is  s64 type
blkcnt_t   is  s64 type
fsblkcnt_t is  u64 type
fsfilcnt_t is  u64 type
 - 64-bit arguments are passed in syscall as register pair,
   as kernel internally clears top halves for all input regs;
 - standard syscall table is used;
 - 32-bit time_t is used. AARCH64/ILP32 is waiting for general
   fix of Y2038 problem just like other 32-bit arches;
 - stat{64}, statfs{64} structures are of the identical layout
   with LP64. Corresponding syscalls are taken from 64-bit code.

Links:
This series: https://github.com/norov/glibc/commits/ilp32-2.23
Kernel series: https://github.com/norov/linux/commits/ilp32-nowrap
Kernel in LKML: https://lkml.org/lkml/2016/6/17/990

Please review it. Any comments appreciated.

Yury.

Andrew Pinski (24):
  [AARCH64] Fix utmp struct for compatibility reasons.
  [AARCH64] Add header guards to sysdep.h headers.
  Add dynamic ILP32 AARCH64 relocations to elf.h
  [AARCH64] Add PTR_REG, PTR_LOG_SIZE, and PTR_SIZE.  Use it in
LDST_PCREL and LDST_GLOBAL.
  [AARCH64] Use PTR_REG in crti.S.
  [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S
  [AARCH64] Use PTR_* macros in dl-trampoline.S
  [AARCH64] Use PTR_* in start.S
  [AARCH64] Use PTR_REG in getcontext.S.
  [AARCH64] Detect ILP32 in configure scripts.
  [AARCH64] Syscalls for ILP32 are passed always via 64bit values.
  [AARCH64] Add ILP32 support to elf_machine_load_address.
  [AARCH64] Set up wordsize for ILP32.
  [AARCH64] Add ILP32 to makefiles
  [AARCH64] Add support to ldconfig for ILP32 and libilp32
  [AARCH64] Add ILP32 ld.so to the known interpreter names.
  [AARCH64] Add ldd-rewrite.sed so that ilp32 ld.so can be found
  [AARCH64] Add kernel_sigaction.h for AARCH64 ILP32
  [AARCH64] Add typesizes.h for ILP32
  [AARCH64] Make lp64 and ilp32 directories.
  Add support for AT_ARM64_MIDR.
  [AARCH64] Fix ILP32 warning
  [AARCH64] Change type of __align to long long
  Fix PTRDIFF_MIN/PTRDIFF_MIN and PTRDIFF_MIN for ILP32.

Yury Norov (3):
  [AARCH64] ILP32: introduce syscalls that pass off_t
  [AARCH64] ILP32: support stat syscall family
  [AARCH64] delouse input arguments in system functions

 elf/cache.c|   2 +
 elf/dl-sysdep.c|   1 +
 elf/elf.h  |   3 +
 sysdeps/aarch64/Implies|   6 -
 sysdeps/aarch64/__longjmp.S|   6 +-
 sysdeps/aarch64/bits/wordsize.h|  28 +++
 sysdeps/aarch64/configure  |  15 +-
 sysdeps/aarch64/configure.ac   |  11 +-
 sysdeps/aarch64/crti.S |   3 +-
 sysdeps/aarch64/dl-irel.h  |   3 +-
 sysdeps/aarch64/dl-machine.h   | 199 -
 sysdeps/aarch64/dl-tlsdesc.S   |  42 +++--
 sysdeps/aarch64/dl-trampoline.S|  18 +-
 sysdeps/aarch64/ilp32/Implies  |   6 +
 sysdeps/aarch64/jmpbuf-unwind.h|   2 +-
 sysdeps/aarch64/lp64/Implies   |   7 +
 sysdeps/aarch64/memcmp.S   |   3 +
 sysdeps/aarch64/memcpy.S   |   4 +-
 sysdeps/aarch64/memmove.S  |   3 +
 sysdeps/aarch64/memset.S   |   3 +-
 sysdeps/aarch64/nptl/bits/semaphore.h  |   2 +-
 sysdeps/aarch64/preconfigure   |  11 +-
 sysdeps/aarch64/setjmp.S   |   5 +-
 sysdeps/aarch64/start.S|  20 ++-
 sysdeps/aarch64/strchr.S   |   1 +
 sysdeps/aarch64/strchrnul.S|   1 +
 sysdeps/aarch64/strcmp.S   |   2 +
 sysdeps/aarch64/strcpy.S   |   2 +
 sysdeps/aarch64/strlen.S   |   2 +
 sysdeps/aarch64/strncmp.S  |   3 +
 sysdeps/aarch64/strnlen.S  |   3 +
 sysdeps/aarch64/strrchr.S  |   1 +
 sysdeps/aarch64/sysdep.h   |  39 +++-
 sysdeps/generic/ldconfig.h |   1 +
 sysdeps/generic/stdint.h   |   9 +-
 sysdeps/unix/sysv/linux/aarch64/Implies|   2 -
 sysdeps/unix/sysv/linux/aarch64/Makefile   |  16 +-
 sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h   |   6 +-
 

Re: [LKP] [lkp] [x86 tsc] 19fa5e7364: WARNING: CPU: 0 PID: 0 at arch/x86/mm/extable.c:50 ex_handler_rdmsr_unsafe+0x72/0x80

2016-06-20 Thread Yu Chen
Hi,

On Mon, Jun 20, 2016 at 3:31 PM, kernel test robot
 wrote:
>
> FYI, we noticed the following commit:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git x86
> commit 19fa5e73647fde1e6a7038a8f05cddf4c43f08d3 ("x86 tsc: enumerate SKL 
> cpu_khz and tsc_khz via CPUID")
>
>
> on test machine: vm-kbuild-yocto-x86_64: 1 threads qemu-system-x86_64 
> -enable-kvm -cpu SandyBridge with 320M memory
>
> caused below changes:
>
>
> +--+++
> |  | 
> cc50dc7f73 | 19fa5e7364 |
> +--+++
> | boot_successes   | 0
>   | 0  |
> | boot_failures| 10   
>   | 12 |
> | invoked_oom-killer:gfp_mask=0x   | 10   
>   | 10 |
> | Mem-Info | 10   
>   | 10 |
> | Kernel_panic-not_syncing:Out_of_memory_and_no_killable_processes | 10   
>   | 10 |
> | backtrace:btrfs_test_extent_io   | 10   
>   | 10 |
> | backtrace:init_btrfs_fs  | 10   
>   | 10 |
> | backtrace:kernel_init_freeable   | 10   
>   | 10 |
> | WARNING:at_arch/x86/mm/extable.c:#ex_handler_rdmsr_unsafe| 0
>   | 10 |
> | backtrace:native_calibrate_cpu   | 0
>   | 10 |
> | backtrace:tsc_init   | 0
>   | 10 |
> | backtrace:x86_late_time_init | 0
>   | 10 |
> +--+++
>
>
>
> [0.00] clocksource: hpet: mask: 0x max_cycles: 0x, 
> max_idle_ns: 19112604467 ns
> [0.00] hpet clockevent registered
> [0.00] [ cut here ]
> [0.00] WARNING: CPU: 0 PID: 0 at arch/x86/mm/extable.c:50 
> ex_handler_rdmsr_unsafe+0x72/0x80
> [0.00] unchecked MSR access error: RDMSR from 0xce
> [0.00] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 
> 4.7.0-rc3-9-g19fa5e7 #1
> [0.00] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
> Debian-1.8.2-1 04/01/2014
> [0.00]   83203c38 816da89d 
> 83203c88
> [0.00]   82e71808 8104e8c2 
> 83203c78
> [0.00]  810b796b 00328453b4a0 82e71808 
> 0032
> [0.00] Call Trace:
> [0.00]  [] dump_stack+0x83/0xb6
> [0.00]  [] ? ex_handler_rdmsr_unsafe+0x72/0x80
> [0.00]  [] __warn+0x10b/0x130
> [0.00]  [] warn_slowpath_fmt+0x63/0x70
> [0.00]  [] ex_handler_rdmsr_unsafe+0x72/0x80
> [0.00]  [] fixup_exception+0x46/0x60
> [0.00]  [] do_general_protection+0x7b/0x150
> [0.00]  [] general_protection+0x28/0x30
> [0.00]  [] ? native_read_msr+0x6/0x20
> [0.00]  [] cpu_khz_from_msr+0xf1/0x150
> [0.00]  [] ? trap_init+0x22e/0x22e
> [0.00]  [] native_calibrate_cpu+0x85/0x5b0
> [0.00]  [] ? native_restore_fl+0x6/0x10
> [0.00]  [] ? __setup_irq+0x196/0x750
> [0.00]  [] ? trap_init+0x22e/0x22e
> [0.00]  [] tsc_init+0x42/0x3c3
> [0.00]  [] ? setup_irq+0x6f/0xc0
> [0.00]  [] ? trap_init+0x22e/0x22e
> [0.00]  [] ? trap_init+0x22e/0x22e
> [0.00]  [] x86_late_time_init+0xf/0x11
> [0.00]  [] ? x86_late_time_init+0xf/0x11
> [0.00]  [] start_kernel+0x3f3/0x4b1
> [0.00]  [] ? early_idt_handler_array+0x120/0x120
> [0.00]  [] x86_64_start_reservations+0x2f/0x31
> [0.00]  [] x86_64_start_kernel+0xe6/0xf3
> [0.00] ---[ end trace 7c0d92684f22f4ac ]---
> [0.00] tsc: Fast TSC calibration using PIT
>
>
> FYI, raw QEMU command line is:
>
> qemu-system-x86_64 -enable-kvm -cpu SandyBridge -kernel 
> /pkg/linux/x86_64-randconfig-w0-06180628/gcc-6/19fa5e73647fde1e6a7038a8f05cddf4c43f08d3/vmlinuz-4.7.0-rc3-9-g19fa5e7
>  -append 'root=/dev/ram0 user=lkp 
> job=/lkp/scheduled/vm-kbuild-yocto-x86_64-32/bisect_boot-1-yocto-minimal-x86_64.cgz-x86_64-randconfig-w0-06180628-19fa5e73647fde1e6a7038a8f05cddf4c43f08d3-20160618-25535-h82bax-0.yaml~
>  ARCH=x86_64 kconfig=x86_64-randconfig-w0-06180628 
> branch=internal-eywa/master commit=19fa5e73647fde1e6a7038a8f05cddf4c43f08d3 
> BOOT_IMAGE=/pkg/linux/x86_64-randconfig-w0-06180628/gcc-6/19fa5e73647fde1e6a7038a8f05cddf4c43f08d3/vmlinuz-4.7.0-rc3-9-g19fa5e7
>  max_uptime=600 
> 

Re: [LKP] [lkp] [x86 tsc] 19fa5e7364: WARNING: CPU: 0 PID: 0 at arch/x86/mm/extable.c:50 ex_handler_rdmsr_unsafe+0x72/0x80

2016-06-20 Thread Yu Chen
Hi,

On Mon, Jun 20, 2016 at 3:31 PM, kernel test robot
 wrote:
>
> FYI, we noticed the following commit:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git x86
> commit 19fa5e73647fde1e6a7038a8f05cddf4c43f08d3 ("x86 tsc: enumerate SKL 
> cpu_khz and tsc_khz via CPUID")
>
>
> on test machine: vm-kbuild-yocto-x86_64: 1 threads qemu-system-x86_64 
> -enable-kvm -cpu SandyBridge with 320M memory
>
> caused below changes:
>
>
> +--+++
> |  | 
> cc50dc7f73 | 19fa5e7364 |
> +--+++
> | boot_successes   | 0
>   | 0  |
> | boot_failures| 10   
>   | 12 |
> | invoked_oom-killer:gfp_mask=0x   | 10   
>   | 10 |
> | Mem-Info | 10   
>   | 10 |
> | Kernel_panic-not_syncing:Out_of_memory_and_no_killable_processes | 10   
>   | 10 |
> | backtrace:btrfs_test_extent_io   | 10   
>   | 10 |
> | backtrace:init_btrfs_fs  | 10   
>   | 10 |
> | backtrace:kernel_init_freeable   | 10   
>   | 10 |
> | WARNING:at_arch/x86/mm/extable.c:#ex_handler_rdmsr_unsafe| 0
>   | 10 |
> | backtrace:native_calibrate_cpu   | 0
>   | 10 |
> | backtrace:tsc_init   | 0
>   | 10 |
> | backtrace:x86_late_time_init | 0
>   | 10 |
> +--+++
>
>
>
> [0.00] clocksource: hpet: mask: 0x max_cycles: 0x, 
> max_idle_ns: 19112604467 ns
> [0.00] hpet clockevent registered
> [0.00] [ cut here ]
> [0.00] WARNING: CPU: 0 PID: 0 at arch/x86/mm/extable.c:50 
> ex_handler_rdmsr_unsafe+0x72/0x80
> [0.00] unchecked MSR access error: RDMSR from 0xce
> [0.00] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 
> 4.7.0-rc3-9-g19fa5e7 #1
> [0.00] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
> Debian-1.8.2-1 04/01/2014
> [0.00]   83203c38 816da89d 
> 83203c88
> [0.00]   82e71808 8104e8c2 
> 83203c78
> [0.00]  810b796b 00328453b4a0 82e71808 
> 0032
> [0.00] Call Trace:
> [0.00]  [] dump_stack+0x83/0xb6
> [0.00]  [] ? ex_handler_rdmsr_unsafe+0x72/0x80
> [0.00]  [] __warn+0x10b/0x130
> [0.00]  [] warn_slowpath_fmt+0x63/0x70
> [0.00]  [] ex_handler_rdmsr_unsafe+0x72/0x80
> [0.00]  [] fixup_exception+0x46/0x60
> [0.00]  [] do_general_protection+0x7b/0x150
> [0.00]  [] general_protection+0x28/0x30
> [0.00]  [] ? native_read_msr+0x6/0x20
> [0.00]  [] cpu_khz_from_msr+0xf1/0x150
> [0.00]  [] ? trap_init+0x22e/0x22e
> [0.00]  [] native_calibrate_cpu+0x85/0x5b0
> [0.00]  [] ? native_restore_fl+0x6/0x10
> [0.00]  [] ? __setup_irq+0x196/0x750
> [0.00]  [] ? trap_init+0x22e/0x22e
> [0.00]  [] tsc_init+0x42/0x3c3
> [0.00]  [] ? setup_irq+0x6f/0xc0
> [0.00]  [] ? trap_init+0x22e/0x22e
> [0.00]  [] ? trap_init+0x22e/0x22e
> [0.00]  [] x86_late_time_init+0xf/0x11
> [0.00]  [] ? x86_late_time_init+0xf/0x11
> [0.00]  [] start_kernel+0x3f3/0x4b1
> [0.00]  [] ? early_idt_handler_array+0x120/0x120
> [0.00]  [] x86_64_start_reservations+0x2f/0x31
> [0.00]  [] x86_64_start_kernel+0xe6/0xf3
> [0.00] ---[ end trace 7c0d92684f22f4ac ]---
> [0.00] tsc: Fast TSC calibration using PIT
>
>
> FYI, raw QEMU command line is:
>
> qemu-system-x86_64 -enable-kvm -cpu SandyBridge -kernel 
> /pkg/linux/x86_64-randconfig-w0-06180628/gcc-6/19fa5e73647fde1e6a7038a8f05cddf4c43f08d3/vmlinuz-4.7.0-rc3-9-g19fa5e7
>  -append 'root=/dev/ram0 user=lkp 
> job=/lkp/scheduled/vm-kbuild-yocto-x86_64-32/bisect_boot-1-yocto-minimal-x86_64.cgz-x86_64-randconfig-w0-06180628-19fa5e73647fde1e6a7038a8f05cddf4c43f08d3-20160618-25535-h82bax-0.yaml~
>  ARCH=x86_64 kconfig=x86_64-randconfig-w0-06180628 
> branch=internal-eywa/master commit=19fa5e73647fde1e6a7038a8f05cddf4c43f08d3 
> BOOT_IMAGE=/pkg/linux/x86_64-randconfig-w0-06180628/gcc-6/19fa5e73647fde1e6a7038a8f05cddf4c43f08d3/vmlinuz-4.7.0-rc3-9-g19fa5e7
>  max_uptime=600 
> 

Re: mmc: dw_mmc: warning with CONFIG_DMA_API_DEBUG

2016-06-20 Thread Jaehoon Chung
Hi guys,

On 06/21/2016 11:31 AM, Shawn Lin wrote:
> On 2016/6/21 10:24, Seung-Woo Kim wrote:
>> Hello Shawn,
>>
>>> -Original Message-
>>> From: Shawn Lin [mailto:shawn@rock-chips.com]
>>> Sent: Tuesday, June 21, 2016 10:52 AM
>>> To: Seung-Woo Kim; jh80.ch...@samsung.com; ulf.hans...@linaro.org; 
>>> linux-...@vger.kernel.org; linux-
>>> ker...@vger.kernel.org
>>> Cc: shawn@rock-chips.com
>>> Subject: Re: mmc: dw_mmc: warning with CONFIG_DMA_API_DEBUG
>>>
>>> On 2016/6/20 16:34, Seung-Woo Kim wrote:
 Hi folks,

 During booting test on my Exynos5422 based Odroid-XU3, kernel compiled
 with CONFIG_DMA_API_DEBUG reported following warning:

 [ cut here ]
 WARNING: CPU: 0 PID: 0 at lib/dma-debug.c:1096 check_unmap+0x7bc/0xb38
 dwmmc_exynos 1220.mmc: DMA-API: device driver tries to free DMA memory 
 it has not allocated [device
>>> address=0x6d9d2200]
>>>
>>> Thanks for this report and fix.
>>>
>>> DTO(the same as IDMAC-RI/TI) interrupts may or may not come together
>>> with DATA_ERR. If DATA_ERR occur without geting DTO, we should issue
>>> CMD12 manually to generate DTO. It's a ugly deisgn for dwmmc but from
>>> the vendor's ask.
>>>
>>> So you should never think we complete the xfer without
>>> checking DATA_ERR. This way you got the warning.

Well, EVENT_DATA_ERR is already checked in tasklet_func..and cleared that flags.

>>>
>>> So could you try this one:
>>
>> With your patch, there is no more the DMA API waring in my environment.
> 
> Nice to hear that.  Thanks for testing, Seung-Woo.

Really? It's not solution..When send tuning command, it should be returned CRC 
error.
Then it called the dw_mci_stop_dma() and also dma_ops->complete().

When i applied you suggestion, also produced.. :)

[2.469916] [] (unwind_backtrace) from [] 
(show_stack+0x10/0x14)
[2.469934] [] (show_stack) from [] 
(dump_stack+0x74/0x94)
[2.469949] [] (dump_stack) from [] (__warn+0xd4/0x100)
[2.469961] [] (__warn) from [] 
(warn_slowpath_fmt+0x38/0x48)
[2.469975] [] (warn_slowpath_fmt) from [] 
(check_unmap+0x828/0x8a8)
[2.469991] [] (check_unmap) from [] 
(debug_dma_unmap_sg+0x5c/0x13c)
[2.470012] [] (debug_dma_unmap_sg) from [] 
(dw_mci_dma_cleanup+0x68/0xa4)
[2.470029] [] (dw_mci_dma_cleanup) from [] 
(dw_mci_stop_dma+0x30/0x40)
[2.470045] [] (dw_mci_stop_dma) from [] 
(dw_mci_tasklet_func+0x340/0x3b4)
[2.470063] [] (dw_mci_tasklet_func) from [] 
(tasklet_action+0x84/0x12c)
[2.470076] [] (tasklet_action) from [] 
(__do_softirq+0xec/0x244)
[2.470089] [] (__do_softirq) from [] 
(irq_exit+0xb4/0xf8)
[2.470109] [] (irq_exit) from [] 
(__handle_domain_irq+0x70/0xe4)
[2.470123] [] (__handle_domain_irq) from [] 
(gic_handle_irq+0x50/0x9c)
[2.470135] [] (gic_handle_irq) from [] 
(__irq_svc+0x54/0x90)
[2.470141] Exception stack(0xee3d3c58 to 0xee3d3ca0)
[2.470148] 3c40:   
c0b1ef0c 000a
[2.470159] 3c60: 0001 005c 016d  c0b4f7a4 0006 
 005c
[2.470170] 3c80: 0006 c0b671e8 6013 ee3d3ca8 c0398e08 c015b830 
6013 
[2.470183] [] (__irq_svc) from [] 
(console_unlock+0x560/0x628)
[2.470196] [] (console_unlock) from [] 
(vprintk_emit+0x1fc/0x508)
[2.470211] [] (vprintk_emit) from [] 
(dev_vprintk_emit+0xf8/0x198)
[2.470224] [] (dev_vprintk_emit) from [] 
(dev_printk_emit+0x1c/0x2c)
[2.470235] [] (dev_printk_emit) from [] 
(__dev_printk+0x4c/0x70)
[2.470246] [] (__dev_printk) from [] 
(_dev_info+0x38/0x48)
[2.470258] [] (_dev_info) from [] 
(usb_new_device+0xe8/0x3d0)
[2.470270] [] (usb_new_device) from [] 
(hub_event+0x760/0xff4)
[2.470289] [] (hub_event) from [] 
(process_one_work+0x120/0x328)
[2.470304] [] (process_one_work) from [] 
(worker_thread+0x2c/0x4ac)
[2.470321] [] (worker_thread) from [] 
(kthread+0xd8/0xf4)
[2.470335] [] (kthread) from [ 
> Hi Jaehoon,
> 
> How about this?
> 
>>
>> Best Regards,
>> - Seung-Woo Kim
>>
>>>
>>> --- a/drivers/mmc/host/dw_mmc.c
>>> +++ b/drivers/mmc/host/dw_mmc.c
>>> @@ -2474,7 +2474,8 @@ static irqreturn_t dw_mci_interrupt(int irq, void
>>> *dev_id)
>>>  mci_writel(host, IDSTS64, SDMMC_IDMAC_INT_TI |
>>>
>>> SDMMC_IDMAC_INT_RI);
>>>  mci_writel(host, IDSTS64, SDMMC_IDMAC_INT_NI);
>>> -   host->dma_ops->complete((void *)host);
>>> +   if (!test_bit(EVENT_DATA_ERROR,
>>> >pending_events))
>>> +   host->dma_ops->complete((void *)host);
>>>  }
>>>  } else {
>>>  pending = mci_readl(host, IDSTS);
>>> @@ -2482,7 +2483,8 @@ static irqreturn_t dw_mci_interrupt(int irq, void
>>> *dev_id)
>>>  mci_writel(host, IDSTS, SDMMC_IDMAC_INT_TI |
>>>
>>> SDMMC_IDMAC_INT_RI);
>>>  mci_writel(host, IDSTS, 

[PATCH v20 17/20] perf, tools: Make alias matching case-insensitive

2016-06-20 Thread Sukadev Bhattiprolu
From: Andi Kleen 

Make alias matching the events parser case-insensitive. This is useful
with the JSON events. perf uses lower case events, but the CPU manuals
generally use upper case event names. The JSON files use lower
case by default too. But if we search case insensitively then
users can cut-n-paste the upper case event names.

So the following works:

% perf stat -e BR_INST_EXEC.TAKEN_INDIRECT_NEAR_CALL true

 Performance counter stats for 'true':

   305  BR_INST_EXEC.TAKEN_INDIRECT_NEAR_CALL

   0.000492799 seconds time elapsed

Signed-off-by: Andi Kleen 
---
 tools/perf/util/parse-events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 77bb7ac..c599077 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1436,7 +1436,7 @@ comp_pmu(const void *p1, const void *p2)
struct perf_pmu_event_symbol *pmu1 = (struct perf_pmu_event_symbol *) 
p1;
struct perf_pmu_event_symbol *pmu2 = (struct perf_pmu_event_symbol *) 
p2;
 
-   return strcmp(pmu1->symbol, pmu2->symbol);
+   return strcasecmp(pmu1->symbol, pmu2->symbol);
 }
 
 static void perf_pmu__parse_cleanup(void)
-- 
2.5.3



[PATCH v20 18/20] perf, tools, pmu-events: Fix fixed counters on Intel

2016-06-20 Thread Sukadev Bhattiprolu
From: Andi Kleen 

The JSON event lists use a different encoding for fixed counters
than perf for instructions and cycles (ref-cycles is ok)

This lead to some common events like inst_retired.any
or cpu_clk_unhalted.thread not counting, when specified with their
JSON name.

Special case these events in the jevents conversion process.
I prefer to not touch the JSON files for this, as it's intended
that standard JSON files can be just dropped into the perf
build without changes.

Signed-off-by: Andi Kleen 
Signed-off-by: Sukadev Bhattiprolu 
[Fix minor compile error]
---
 tools/perf/pmu-events/jevents.c | 27 +--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index b701d77..c8d8e4a 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -237,6 +237,29 @@ static void print_events_table_suffix(FILE *outfp)
fprintf(outfp, "};\n");
 }
 
+static struct fixed {
+   const char *name;
+   const char *event;
+} fixed[] = {
+   { "inst_retired.any", "event=0xc0" },
+   { "cpu_clk_unhalted.thread", "event=0x3c" },
+   { "cpu_clk_unhalted.thread_any", "event=0x3c,any=1" },
+   { NULL, NULL},
+};
+
+/*
+ * Handle different fixed counter encodings between JSON and perf.
+ */
+static char *real_event(const char *name, char *event)
+{
+   int i;
+
+   for (i = 0; fixed[i].name; i++)
+   if (!strcasecmp(name, fixed[i].name))
+   return (char *)fixed[i].event;
+   return event;
+}
+
 /* Call func with each event in the json file */
 int json_events(const char *fn,
  int (*func)(void *data, char *name, char *event, char *desc,
@@ -325,8 +348,8 @@ int json_events(const char *fn,
if (msr != NULL)
addfield(map, , ",", msr->pname, msrval);
fixname(name);
-
-   err = func(data, name, event, desc, long_desc, topic);
+   err = func(data, name, real_event(name, event), desc,
+  long_desc, topic);
free(event);
free(desc);
free(name);
-- 
2.5.3



Re: mmc: dw_mmc: warning with CONFIG_DMA_API_DEBUG

2016-06-20 Thread Jaehoon Chung
Hi guys,

On 06/21/2016 11:31 AM, Shawn Lin wrote:
> On 2016/6/21 10:24, Seung-Woo Kim wrote:
>> Hello Shawn,
>>
>>> -Original Message-
>>> From: Shawn Lin [mailto:shawn@rock-chips.com]
>>> Sent: Tuesday, June 21, 2016 10:52 AM
>>> To: Seung-Woo Kim; jh80.ch...@samsung.com; ulf.hans...@linaro.org; 
>>> linux-...@vger.kernel.org; linux-
>>> ker...@vger.kernel.org
>>> Cc: shawn@rock-chips.com
>>> Subject: Re: mmc: dw_mmc: warning with CONFIG_DMA_API_DEBUG
>>>
>>> On 2016/6/20 16:34, Seung-Woo Kim wrote:
 Hi folks,

 During booting test on my Exynos5422 based Odroid-XU3, kernel compiled
 with CONFIG_DMA_API_DEBUG reported following warning:

 [ cut here ]
 WARNING: CPU: 0 PID: 0 at lib/dma-debug.c:1096 check_unmap+0x7bc/0xb38
 dwmmc_exynos 1220.mmc: DMA-API: device driver tries to free DMA memory 
 it has not allocated [device
>>> address=0x6d9d2200]
>>>
>>> Thanks for this report and fix.
>>>
>>> DTO(the same as IDMAC-RI/TI) interrupts may or may not come together
>>> with DATA_ERR. If DATA_ERR occur without geting DTO, we should issue
>>> CMD12 manually to generate DTO. It's a ugly deisgn for dwmmc but from
>>> the vendor's ask.
>>>
>>> So you should never think we complete the xfer without
>>> checking DATA_ERR. This way you got the warning.

Well, EVENT_DATA_ERR is already checked in tasklet_func..and cleared that flags.

>>>
>>> So could you try this one:
>>
>> With your patch, there is no more the DMA API waring in my environment.
> 
> Nice to hear that.  Thanks for testing, Seung-Woo.

Really? It's not solution..When send tuning command, it should be returned CRC 
error.
Then it called the dw_mci_stop_dma() and also dma_ops->complete().

When i applied you suggestion, also produced.. :)

[2.469916] [] (unwind_backtrace) from [] 
(show_stack+0x10/0x14)
[2.469934] [] (show_stack) from [] 
(dump_stack+0x74/0x94)
[2.469949] [] (dump_stack) from [] (__warn+0xd4/0x100)
[2.469961] [] (__warn) from [] 
(warn_slowpath_fmt+0x38/0x48)
[2.469975] [] (warn_slowpath_fmt) from [] 
(check_unmap+0x828/0x8a8)
[2.469991] [] (check_unmap) from [] 
(debug_dma_unmap_sg+0x5c/0x13c)
[2.470012] [] (debug_dma_unmap_sg) from [] 
(dw_mci_dma_cleanup+0x68/0xa4)
[2.470029] [] (dw_mci_dma_cleanup) from [] 
(dw_mci_stop_dma+0x30/0x40)
[2.470045] [] (dw_mci_stop_dma) from [] 
(dw_mci_tasklet_func+0x340/0x3b4)
[2.470063] [] (dw_mci_tasklet_func) from [] 
(tasklet_action+0x84/0x12c)
[2.470076] [] (tasklet_action) from [] 
(__do_softirq+0xec/0x244)
[2.470089] [] (__do_softirq) from [] 
(irq_exit+0xb4/0xf8)
[2.470109] [] (irq_exit) from [] 
(__handle_domain_irq+0x70/0xe4)
[2.470123] [] (__handle_domain_irq) from [] 
(gic_handle_irq+0x50/0x9c)
[2.470135] [] (gic_handle_irq) from [] 
(__irq_svc+0x54/0x90)
[2.470141] Exception stack(0xee3d3c58 to 0xee3d3ca0)
[2.470148] 3c40:   
c0b1ef0c 000a
[2.470159] 3c60: 0001 005c 016d  c0b4f7a4 0006 
 005c
[2.470170] 3c80: 0006 c0b671e8 6013 ee3d3ca8 c0398e08 c015b830 
6013 
[2.470183] [] (__irq_svc) from [] 
(console_unlock+0x560/0x628)
[2.470196] [] (console_unlock) from [] 
(vprintk_emit+0x1fc/0x508)
[2.470211] [] (vprintk_emit) from [] 
(dev_vprintk_emit+0xf8/0x198)
[2.470224] [] (dev_vprintk_emit) from [] 
(dev_printk_emit+0x1c/0x2c)
[2.470235] [] (dev_printk_emit) from [] 
(__dev_printk+0x4c/0x70)
[2.470246] [] (__dev_printk) from [] 
(_dev_info+0x38/0x48)
[2.470258] [] (_dev_info) from [] 
(usb_new_device+0xe8/0x3d0)
[2.470270] [] (usb_new_device) from [] 
(hub_event+0x760/0xff4)
[2.470289] [] (hub_event) from [] 
(process_one_work+0x120/0x328)
[2.470304] [] (process_one_work) from [] 
(worker_thread+0x2c/0x4ac)
[2.470321] [] (worker_thread) from [] 
(kthread+0xd8/0xf4)
[2.470335] [] (kthread) from [ 
> Hi Jaehoon,
> 
> How about this?
> 
>>
>> Best Regards,
>> - Seung-Woo Kim
>>
>>>
>>> --- a/drivers/mmc/host/dw_mmc.c
>>> +++ b/drivers/mmc/host/dw_mmc.c
>>> @@ -2474,7 +2474,8 @@ static irqreturn_t dw_mci_interrupt(int irq, void
>>> *dev_id)
>>>  mci_writel(host, IDSTS64, SDMMC_IDMAC_INT_TI |
>>>
>>> SDMMC_IDMAC_INT_RI);
>>>  mci_writel(host, IDSTS64, SDMMC_IDMAC_INT_NI);
>>> -   host->dma_ops->complete((void *)host);
>>> +   if (!test_bit(EVENT_DATA_ERROR,
>>> >pending_events))
>>> +   host->dma_ops->complete((void *)host);
>>>  }
>>>  } else {
>>>  pending = mci_readl(host, IDSTS);
>>> @@ -2482,7 +2483,8 @@ static irqreturn_t dw_mci_interrupt(int irq, void
>>> *dev_id)
>>>  mci_writel(host, IDSTS, SDMMC_IDMAC_INT_TI |
>>>
>>> SDMMC_IDMAC_INT_RI);
>>>  mci_writel(host, IDSTS, 

[PATCH v20 17/20] perf, tools: Make alias matching case-insensitive

2016-06-20 Thread Sukadev Bhattiprolu
From: Andi Kleen 

Make alias matching the events parser case-insensitive. This is useful
with the JSON events. perf uses lower case events, but the CPU manuals
generally use upper case event names. The JSON files use lower
case by default too. But if we search case insensitively then
users can cut-n-paste the upper case event names.

So the following works:

% perf stat -e BR_INST_EXEC.TAKEN_INDIRECT_NEAR_CALL true

 Performance counter stats for 'true':

   305  BR_INST_EXEC.TAKEN_INDIRECT_NEAR_CALL

   0.000492799 seconds time elapsed

Signed-off-by: Andi Kleen 
---
 tools/perf/util/parse-events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 77bb7ac..c599077 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1436,7 +1436,7 @@ comp_pmu(const void *p1, const void *p2)
struct perf_pmu_event_symbol *pmu1 = (struct perf_pmu_event_symbol *) 
p1;
struct perf_pmu_event_symbol *pmu2 = (struct perf_pmu_event_symbol *) 
p2;
 
-   return strcmp(pmu1->symbol, pmu2->symbol);
+   return strcasecmp(pmu1->symbol, pmu2->symbol);
 }
 
 static void perf_pmu__parse_cleanup(void)
-- 
2.5.3



[PATCH v20 18/20] perf, tools, pmu-events: Fix fixed counters on Intel

2016-06-20 Thread Sukadev Bhattiprolu
From: Andi Kleen 

The JSON event lists use a different encoding for fixed counters
than perf for instructions and cycles (ref-cycles is ok)

This lead to some common events like inst_retired.any
or cpu_clk_unhalted.thread not counting, when specified with their
JSON name.

Special case these events in the jevents conversion process.
I prefer to not touch the JSON files for this, as it's intended
that standard JSON files can be just dropped into the perf
build without changes.

Signed-off-by: Andi Kleen 
Signed-off-by: Sukadev Bhattiprolu 
[Fix minor compile error]
---
 tools/perf/pmu-events/jevents.c | 27 +--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index b701d77..c8d8e4a 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -237,6 +237,29 @@ static void print_events_table_suffix(FILE *outfp)
fprintf(outfp, "};\n");
 }
 
+static struct fixed {
+   const char *name;
+   const char *event;
+} fixed[] = {
+   { "inst_retired.any", "event=0xc0" },
+   { "cpu_clk_unhalted.thread", "event=0x3c" },
+   { "cpu_clk_unhalted.thread_any", "event=0x3c,any=1" },
+   { NULL, NULL},
+};
+
+/*
+ * Handle different fixed counter encodings between JSON and perf.
+ */
+static char *real_event(const char *name, char *event)
+{
+   int i;
+
+   for (i = 0; fixed[i].name; i++)
+   if (!strcasecmp(name, fixed[i].name))
+   return (char *)fixed[i].event;
+   return event;
+}
+
 /* Call func with each event in the json file */
 int json_events(const char *fn,
  int (*func)(void *data, char *name, char *event, char *desc,
@@ -325,8 +348,8 @@ int json_events(const char *fn,
if (msr != NULL)
addfield(map, , ",", msr->pname, msrval);
fixname(name);
-
-   err = func(data, name, event, desc, long_desc, topic);
+   err = func(data, name, real_event(name, event), desc,
+  long_desc, topic);
free(event);
free(desc);
free(name);
-- 
2.5.3



Re: [PATCH] devpts: remove DEVPTS_MULTIPLE_INSTANCES from all configs

2016-06-20 Thread Vineet Gupta
On Monday 20 June 2016 02:44 PM, Alexandru Moise wrote:
> As each mount of devpts is now an independent filesystem,
> the DEVPTS_MULTIPLE_INSTANCES config option no longer exists.
> So remove it.
>
> Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com>

For arch/arc

Acked-by: Vineet Gupta 


[PATCH 2/3] staging: lowmemorykiller: count anon pages only when we have swap devices

2016-06-20 Thread Ganesh Mahendran
lowmem_count() should only count anon pages when we have swap device.

Signed-off-by: Ganesh Mahendran 
---
 drivers/staging/android/lowmemorykiller.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/lowmemorykiller.c 
b/drivers/staging/android/lowmemorykiller.c
index 6da9260..1d8de47 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -73,10 +73,14 @@ static unsigned long lowmem_deathpending_timeout;
 static unsigned long lowmem_count(struct shrinker *s,
  struct shrink_control *sc)
 {
-   return global_page_state(NR_ACTIVE_ANON) +
-   global_page_state(NR_ACTIVE_FILE) +
-   global_page_state(NR_INACTIVE_ANON) +
-   global_page_state(NR_INACTIVE_FILE);
+   unsigned long freeable = global_page_state(NR_ACTIVE_FILE) +
+   global_page_state(NR_INACTIVE_FILE);
+
+   if (get_nr_swap_pages() > 0)
+   freeable += global_page_state(NR_ACTIVE_ANON) +
+   global_page_state(NR_INACTIVE_ANON);
+
+   return freeable;
 }
 
 static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
-- 
1.9.1



Re: [PATCH] devpts: remove DEVPTS_MULTIPLE_INSTANCES from all configs

2016-06-20 Thread Vineet Gupta
On Monday 20 June 2016 02:44 PM, Alexandru Moise wrote:
> As each mount of devpts is now an independent filesystem,
> the DEVPTS_MULTIPLE_INSTANCES config option no longer exists.
> So remove it.
>
> Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com>

For arch/arc

Acked-by: Vineet Gupta 


[PATCH 2/3] staging: lowmemorykiller: count anon pages only when we have swap devices

2016-06-20 Thread Ganesh Mahendran
lowmem_count() should only count anon pages when we have swap device.

Signed-off-by: Ganesh Mahendran 
---
 drivers/staging/android/lowmemorykiller.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/lowmemorykiller.c 
b/drivers/staging/android/lowmemorykiller.c
index 6da9260..1d8de47 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -73,10 +73,14 @@ static unsigned long lowmem_deathpending_timeout;
 static unsigned long lowmem_count(struct shrinker *s,
  struct shrink_control *sc)
 {
-   return global_page_state(NR_ACTIVE_ANON) +
-   global_page_state(NR_ACTIVE_FILE) +
-   global_page_state(NR_INACTIVE_ANON) +
-   global_page_state(NR_INACTIVE_FILE);
+   unsigned long freeable = global_page_state(NR_ACTIVE_FILE) +
+   global_page_state(NR_INACTIVE_FILE);
+
+   if (get_nr_swap_pages() > 0)
+   freeable += global_page_state(NR_ACTIVE_ANON) +
+   global_page_state(NR_INACTIVE_ANON);
+
+   return freeable;
 }
 
 static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
-- 
1.9.1



Re: [PATCH v3 1/2] dmaengine: vdma: Add 64 bit addressing support for the axi dma

2016-06-20 Thread Vinod Koul
On Tue, Jun 07, 2016 at 07:21:15PM +0530, Kedareswara rao Appana wrote:
> The AXI DMA is a soft ip, which can be programmed to support
> 32 bit addressing or greater than 32 bit addressing.
> 
> When the AXI DMA ip is configured for 32 bit address space
> in simple dma mode the buffer address is specified by a single register
> (18h for MM2S channel and 48h for S2MM channel). When configured in SG mode
> The current descriptor and tail descriptor are specified by a single
> Register(08h for curdesc 10h for tail desc for MM2S channel and 38h for
> Curdesc and 40h for tail desc for S2MM).
> 
> When the  AXI DMA core is configured for an address space greater
> than 32 then each buffer address or descriptor address is specified by
> a combination of two registers.
> 
> The first register specifies the LSB 32 bits of address,
> while the next register specifies the MSB 32 bits of address.
> 
> For example, 48h will specify the LSB 32 bits while 4Ch will
> specify the MSB 32 bits of the first start address.
> So we need to program two registers at a time.
> 
> This patch adds the 64 bit addressing support for the axidma
> IP in the driver.

Applied both, thanks

-- 
~Vinod


Re: [PATCH v3 1/2] dmaengine: vdma: Add 64 bit addressing support for the axi dma

2016-06-20 Thread Vinod Koul
On Tue, Jun 07, 2016 at 07:21:15PM +0530, Kedareswara rao Appana wrote:
> The AXI DMA is a soft ip, which can be programmed to support
> 32 bit addressing or greater than 32 bit addressing.
> 
> When the AXI DMA ip is configured for 32 bit address space
> in simple dma mode the buffer address is specified by a single register
> (18h for MM2S channel and 48h for S2MM channel). When configured in SG mode
> The current descriptor and tail descriptor are specified by a single
> Register(08h for curdesc 10h for tail desc for MM2S channel and 38h for
> Curdesc and 40h for tail desc for S2MM).
> 
> When the  AXI DMA core is configured for an address space greater
> than 32 then each buffer address or descriptor address is specified by
> a combination of two registers.
> 
> The first register specifies the LSB 32 bits of address,
> while the next register specifies the MSB 32 bits of address.
> 
> For example, 48h will specify the LSB 32 bits while 4Ch will
> specify the MSB 32 bits of the first start address.
> So we need to program two registers at a time.
> 
> This patch adds the 64 bit addressing support for the axidma
> IP in the driver.

Applied both, thanks

-- 
~Vinod


[PATCH 3/3] staging: lowmemorykiller: select the task with maximum rss to kill

2016-06-20 Thread Ganesh Mahendran
Current task selecting logic in LMK does not fully aware of the memory
pressure. It may select the task with maximum score adj, but with
least tasksize.

For example, if min_score_adj is 200, and there are 2 tasks in system:
   task a: score adj 500, tasksize 200M
   task b: score adj 1000, tasksize 1M
Current LMK logic will select *task b*. But now the system already have
much memory pressure.

We should select the task with maximum task from all the tasks which
score adj >= min_score_adj.

Signed-off-by: Ganesh Mahendran 
---
 drivers/staging/android/lowmemorykiller.c | 25 -
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/android/lowmemorykiller.c 
b/drivers/staging/android/lowmemorykiller.c
index 1d8de47..5fcfcfe 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -122,8 +122,6 @@ static unsigned long lowmem_scan(struct shrinker *s, struct 
shrink_control *sc)
return 0;
}
 
-   selected_oom_score_adj = min_score_adj;
-
rcu_read_lock();
for_each_process(tsk) {
struct task_struct *p;
@@ -151,18 +149,19 @@ static unsigned long lowmem_scan(struct shrinker *s, 
struct shrink_control *sc)
task_unlock(p);
if (tasksize <= 0)
continue;
-   if (selected) {
-   if (oom_score_adj < selected_oom_score_adj)
-   continue;
-   if (oom_score_adj == selected_oom_score_adj &&
-   tasksize <= selected_tasksize)
-   continue;
+
+   /*
+* From the processes which score adj >= min_score_adj,
+* we select the one with the maximum tasksize.
+*/
+   if (selected_tasksize < tasksize) {
+   selected = p;
+   selected_tasksize = tasksize;
+   selected_oom_score_adj = oom_score_adj;
+
+   lowmem_print(2, "select '%s' (%d), adj %hd, size %d, to 
kill\n",
+p->comm, p->pid, oom_score_adj, 
tasksize);
}
-   selected = p;
-   selected_tasksize = tasksize;
-   selected_oom_score_adj = oom_score_adj;
-   lowmem_print(2, "select '%s' (%d), adj %hd, size %d, to kill\n",
-p->comm, p->pid, oom_score_adj, tasksize);
}
if (selected) {
task_lock(selected);
-- 
1.9.1



[PATCH 3/3] staging: lowmemorykiller: select the task with maximum rss to kill

2016-06-20 Thread Ganesh Mahendran
Current task selecting logic in LMK does not fully aware of the memory
pressure. It may select the task with maximum score adj, but with
least tasksize.

For example, if min_score_adj is 200, and there are 2 tasks in system:
   task a: score adj 500, tasksize 200M
   task b: score adj 1000, tasksize 1M
Current LMK logic will select *task b*. But now the system already have
much memory pressure.

We should select the task with maximum task from all the tasks which
score adj >= min_score_adj.

Signed-off-by: Ganesh Mahendran 
---
 drivers/staging/android/lowmemorykiller.c | 25 -
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/android/lowmemorykiller.c 
b/drivers/staging/android/lowmemorykiller.c
index 1d8de47..5fcfcfe 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -122,8 +122,6 @@ static unsigned long lowmem_scan(struct shrinker *s, struct 
shrink_control *sc)
return 0;
}
 
-   selected_oom_score_adj = min_score_adj;
-
rcu_read_lock();
for_each_process(tsk) {
struct task_struct *p;
@@ -151,18 +149,19 @@ static unsigned long lowmem_scan(struct shrinker *s, 
struct shrink_control *sc)
task_unlock(p);
if (tasksize <= 0)
continue;
-   if (selected) {
-   if (oom_score_adj < selected_oom_score_adj)
-   continue;
-   if (oom_score_adj == selected_oom_score_adj &&
-   tasksize <= selected_tasksize)
-   continue;
+
+   /*
+* From the processes which score adj >= min_score_adj,
+* we select the one with the maximum tasksize.
+*/
+   if (selected_tasksize < tasksize) {
+   selected = p;
+   selected_tasksize = tasksize;
+   selected_oom_score_adj = oom_score_adj;
+
+   lowmem_print(2, "select '%s' (%d), adj %hd, size %d, to 
kill\n",
+p->comm, p->pid, oom_score_adj, 
tasksize);
}
-   selected = p;
-   selected_tasksize = tasksize;
-   selected_oom_score_adj = oom_score_adj;
-   lowmem_print(2, "select '%s' (%d), adj %hd, size %d, to kill\n",
-p->comm, p->pid, oom_score_adj, tasksize);
}
if (selected) {
task_lock(selected);
-- 
1.9.1



Re: [PATCH 0/3] serial: remove modular code from a few more non-modular drivers

2016-06-20 Thread Paul Gortmaker
[[PATCH 0/3] serial: remove modular code from a few more non-modular drivers] 
On 20/06/2016 (Mon 18:55) Paul Gortmaker wrote:

> For anyone new to the underlying goal of this cleanup, we are trying to
> not use module support for code that can never be built as a module since:
> 
>  (1) it is easy to accidentally write unused module_exit and remove code
>  (2) it can be misleading when reading the source, thinking it can be
>  modular when the Makefile and/or Kconfig prohibit it
>  (3) it requires the include of the module.h header file which in turn
>  includes nearly everything else, thus adding to CPP overhead.
>  (4) it gets copied/replicated into other code and spreads like weeds.
> 
> We have already fixed a bunch of these in drivers/tty already, so there
> is really nothing new to see here (at least for the serial maintainers).

Apologies in advance to anyone who is trying to find these patches via
an archive of linux-kernel or linux-serial ; it seems that we hit a
window where a glitch at vger.kernel.org was rejecting incoming mails.

P.
--

> 
> Changes seen here cover the following categories:
> 
>   -just replacement of modular macros with their non-modular
>equivalents that CPP would have inserted anyway
> 
>   -the removal of including module.h ; replaced with init.h
>as required based on whether the file already had it.
> 
>   -the removal of any/all unused/orphaned __exit functions
>that would never be called/exercised.
> 
>   -the removal of any ".remove" functions that were hooked into
>the driver struct.   This ".remove" function would of
>course not be called from the __exit function since that was
>never run.  However in theory, someone could have triggered it
>via sysfs unbind, even though there isn't a sensible use case
>for doing so.  So to cover that possibility, we've also disabled
>sysfs unbind in the driver.
> 
> In doing so we get rid of ~70 lines of dead code across 3 drivers.
> 
> There are no initcall level changes here; everything was at the level
> of device_initcall and remains so, by using the builtin equivalents.
> 
> Build tested for arm(2) and m32r(1) on the linux-next tree from today
> to ensure no silly typos crept in.
> 
> If there is a desire for any of these to be modular, we can definitely
> consider that, but by default the changes here keep the code consistent
> with existing behaviour.  Thus I do not expand functionality into the
> modular realm that I can't run time test, or even know if the modular
> instance has a sensible modular use case.
> 
> Paul.
> ---
> 
> Cc: Alexey Charkov 
> Cc: Greg Kroah-Hartman 
> Cc: Jiri Slaby 
> Cc: Tony Prisk 
> Cc: linux-ser...@vger.kernel.org
> 
> Paul Gortmaker (3):
>   serial: pxa: make it explicitly non-modular
>   serial: vt8500_serial: make it explicitly non-modular
>   serial: m32r_sio: make it explicitly non-modular
> 
>  drivers/tty/serial/m32r_sio.c  | 18 +-
>  drivers/tty/serial/pxa.c   | 31 +++
>  drivers/tty/serial/vt8500_serial.c | 30 ++
>  3 files changed, 6 insertions(+), 73 deletions(-)
> 
> -- 
> 2.8.4


[PATCH 1/3] staging: lowmemorykiller: change lowmem_adj to lowmem_score_adj

2016-06-20 Thread Ganesh Mahendran
om_adj is deprecated, and in lowmemorykiller module, we use score adj
to do the comparing.
---
oom_score_adj = p->signal->oom_score_adj;
if (oom_score_adj < min_score_adj) {
task_unlock(p);
continue;
}
---

This patch makes the variable name consistent with the usage.

Signed-off-by: Ganesh Mahendran 
---
 drivers/staging/android/lowmemorykiller.c | 29 +++--
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/android/lowmemorykiller.c 
b/drivers/staging/android/lowmemorykiller.c
index 24d2745..6da9260 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -7,9 +7,9 @@
  * /sys/module/lowmemorykiller/parameters/minfree. Both files take a comma
  * separated list of numbers in ascending order.
  *
- * For example, write "0,8" to /sys/module/lowmemorykiller/parameters/adj and
- * "1024,4096" to /sys/module/lowmemorykiller/parameters/minfree to kill
- * processes with a oom_score_adj value of 8 or higher when the free memory
+ * For example, write "0,470" to 
/sys/module/lowmemorykiller/parameters/score_adj
+ * and "1024,4096" to /sys/module/lowmemorykiller/parameters/minfree to kill
+ * processes with a oom_score_adj value of 470 or higher when the free memory
  * drops below 4096 pages and kill processes with a oom_score_adj value of 0 or
  * higher when the free memory drops below 1024 pages.
  *
@@ -44,14 +44,15 @@
 #include 
 
 static u32 lowmem_debug_level = 1;
-static short lowmem_adj[6] = {
+
+static short lowmem_score_adj[6] = {
0,
-   1,
-   6,
-   12,
+   58,
+   352,
+   705,
 };
 
-static int lowmem_adj_size = 4;
+static int lowmem_score_adj_size = 4;
 static int lowmem_minfree[6] = {
3 * 512,/* 6MB */
2 * 1024,   /* 8MB */
@@ -89,20 +90,20 @@ static unsigned long lowmem_scan(struct shrinker *s, struct 
shrink_control *sc)
int minfree = 0;
int selected_tasksize = 0;
short selected_oom_score_adj;
-   int array_size = ARRAY_SIZE(lowmem_adj);
+   int array_size = ARRAY_SIZE(lowmem_score_adj);
int other_free = global_page_state(NR_FREE_PAGES) - totalreserve_pages;
int other_file = global_page_state(NR_FILE_PAGES) -
global_page_state(NR_SHMEM) -
total_swapcache_pages();
 
-   if (lowmem_adj_size < array_size)
-   array_size = lowmem_adj_size;
+   if (lowmem_score_adj_size < array_size)
+   array_size = lowmem_score_adj_size;
if (lowmem_minfree_size < array_size)
array_size = lowmem_minfree_size;
for (i = 0; i < array_size; i++) {
minfree = lowmem_minfree[i];
if (other_free < minfree && other_file < minfree) {
-   min_score_adj = lowmem_adj[i];
+   min_score_adj = lowmem_score_adj[i];
break;
}
}
@@ -165,7 +166,7 @@ static unsigned long lowmem_scan(struct shrinker *s, struct 
shrink_control *sc)
if (selected->mm)
task_set_lmk_waiting(selected);
task_unlock(selected);
-   lowmem_print(1, "Killing '%s' (%d), adj %hd,\n"
+   lowmem_print(1, "Killing '%s' (%d), score adj %hd,\n"
 "   to free %ldkB on behalf of '%s' (%d) 
because\n"
 "   cache %ldkB is below limit %ldkB for 
oom_score_adj %hd\n"
 "   Free memory is %ldkB above reserved\n",
@@ -205,7 +206,7 @@ device_initcall(lowmem_init);
  * bootargs behaviour is to continue using module_param here.
  */
 module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR);
-module_param_array_named(adj, lowmem_adj, short, _adj_size,
+module_param_array_named(score_adj, lowmem_score_adj, short, 
_score_adj_size,
 S_IRUGO | S_IWUSR);
 module_param_array_named(minfree, lowmem_minfree, uint, _minfree_size,
 S_IRUGO | S_IWUSR);
-- 
1.9.1



Re: [PATCH 0/3] serial: remove modular code from a few more non-modular drivers

2016-06-20 Thread Paul Gortmaker
[[PATCH 0/3] serial: remove modular code from a few more non-modular drivers] 
On 20/06/2016 (Mon 18:55) Paul Gortmaker wrote:

> For anyone new to the underlying goal of this cleanup, we are trying to
> not use module support for code that can never be built as a module since:
> 
>  (1) it is easy to accidentally write unused module_exit and remove code
>  (2) it can be misleading when reading the source, thinking it can be
>  modular when the Makefile and/or Kconfig prohibit it
>  (3) it requires the include of the module.h header file which in turn
>  includes nearly everything else, thus adding to CPP overhead.
>  (4) it gets copied/replicated into other code and spreads like weeds.
> 
> We have already fixed a bunch of these in drivers/tty already, so there
> is really nothing new to see here (at least for the serial maintainers).

Apologies in advance to anyone who is trying to find these patches via
an archive of linux-kernel or linux-serial ; it seems that we hit a
window where a glitch at vger.kernel.org was rejecting incoming mails.

P.
--

> 
> Changes seen here cover the following categories:
> 
>   -just replacement of modular macros with their non-modular
>equivalents that CPP would have inserted anyway
> 
>   -the removal of including module.h ; replaced with init.h
>as required based on whether the file already had it.
> 
>   -the removal of any/all unused/orphaned __exit functions
>that would never be called/exercised.
> 
>   -the removal of any ".remove" functions that were hooked into
>the driver struct.   This ".remove" function would of
>course not be called from the __exit function since that was
>never run.  However in theory, someone could have triggered it
>via sysfs unbind, even though there isn't a sensible use case
>for doing so.  So to cover that possibility, we've also disabled
>sysfs unbind in the driver.
> 
> In doing so we get rid of ~70 lines of dead code across 3 drivers.
> 
> There are no initcall level changes here; everything was at the level
> of device_initcall and remains so, by using the builtin equivalents.
> 
> Build tested for arm(2) and m32r(1) on the linux-next tree from today
> to ensure no silly typos crept in.
> 
> If there is a desire for any of these to be modular, we can definitely
> consider that, but by default the changes here keep the code consistent
> with existing behaviour.  Thus I do not expand functionality into the
> modular realm that I can't run time test, or even know if the modular
> instance has a sensible modular use case.
> 
> Paul.
> ---
> 
> Cc: Alexey Charkov 
> Cc: Greg Kroah-Hartman 
> Cc: Jiri Slaby 
> Cc: Tony Prisk 
> Cc: linux-ser...@vger.kernel.org
> 
> Paul Gortmaker (3):
>   serial: pxa: make it explicitly non-modular
>   serial: vt8500_serial: make it explicitly non-modular
>   serial: m32r_sio: make it explicitly non-modular
> 
>  drivers/tty/serial/m32r_sio.c  | 18 +-
>  drivers/tty/serial/pxa.c   | 31 +++
>  drivers/tty/serial/vt8500_serial.c | 30 ++
>  3 files changed, 6 insertions(+), 73 deletions(-)
> 
> -- 
> 2.8.4


[PATCH 1/3] staging: lowmemorykiller: change lowmem_adj to lowmem_score_adj

2016-06-20 Thread Ganesh Mahendran
om_adj is deprecated, and in lowmemorykiller module, we use score adj
to do the comparing.
---
oom_score_adj = p->signal->oom_score_adj;
if (oom_score_adj < min_score_adj) {
task_unlock(p);
continue;
}
---

This patch makes the variable name consistent with the usage.

Signed-off-by: Ganesh Mahendran 
---
 drivers/staging/android/lowmemorykiller.c | 29 +++--
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/android/lowmemorykiller.c 
b/drivers/staging/android/lowmemorykiller.c
index 24d2745..6da9260 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -7,9 +7,9 @@
  * /sys/module/lowmemorykiller/parameters/minfree. Both files take a comma
  * separated list of numbers in ascending order.
  *
- * For example, write "0,8" to /sys/module/lowmemorykiller/parameters/adj and
- * "1024,4096" to /sys/module/lowmemorykiller/parameters/minfree to kill
- * processes with a oom_score_adj value of 8 or higher when the free memory
+ * For example, write "0,470" to 
/sys/module/lowmemorykiller/parameters/score_adj
+ * and "1024,4096" to /sys/module/lowmemorykiller/parameters/minfree to kill
+ * processes with a oom_score_adj value of 470 or higher when the free memory
  * drops below 4096 pages and kill processes with a oom_score_adj value of 0 or
  * higher when the free memory drops below 1024 pages.
  *
@@ -44,14 +44,15 @@
 #include 
 
 static u32 lowmem_debug_level = 1;
-static short lowmem_adj[6] = {
+
+static short lowmem_score_adj[6] = {
0,
-   1,
-   6,
-   12,
+   58,
+   352,
+   705,
 };
 
-static int lowmem_adj_size = 4;
+static int lowmem_score_adj_size = 4;
 static int lowmem_minfree[6] = {
3 * 512,/* 6MB */
2 * 1024,   /* 8MB */
@@ -89,20 +90,20 @@ static unsigned long lowmem_scan(struct shrinker *s, struct 
shrink_control *sc)
int minfree = 0;
int selected_tasksize = 0;
short selected_oom_score_adj;
-   int array_size = ARRAY_SIZE(lowmem_adj);
+   int array_size = ARRAY_SIZE(lowmem_score_adj);
int other_free = global_page_state(NR_FREE_PAGES) - totalreserve_pages;
int other_file = global_page_state(NR_FILE_PAGES) -
global_page_state(NR_SHMEM) -
total_swapcache_pages();
 
-   if (lowmem_adj_size < array_size)
-   array_size = lowmem_adj_size;
+   if (lowmem_score_adj_size < array_size)
+   array_size = lowmem_score_adj_size;
if (lowmem_minfree_size < array_size)
array_size = lowmem_minfree_size;
for (i = 0; i < array_size; i++) {
minfree = lowmem_minfree[i];
if (other_free < minfree && other_file < minfree) {
-   min_score_adj = lowmem_adj[i];
+   min_score_adj = lowmem_score_adj[i];
break;
}
}
@@ -165,7 +166,7 @@ static unsigned long lowmem_scan(struct shrinker *s, struct 
shrink_control *sc)
if (selected->mm)
task_set_lmk_waiting(selected);
task_unlock(selected);
-   lowmem_print(1, "Killing '%s' (%d), adj %hd,\n"
+   lowmem_print(1, "Killing '%s' (%d), score adj %hd,\n"
 "   to free %ldkB on behalf of '%s' (%d) 
because\n"
 "   cache %ldkB is below limit %ldkB for 
oom_score_adj %hd\n"
 "   Free memory is %ldkB above reserved\n",
@@ -205,7 +206,7 @@ device_initcall(lowmem_init);
  * bootargs behaviour is to continue using module_param here.
  */
 module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR);
-module_param_array_named(adj, lowmem_adj, short, _adj_size,
+module_param_array_named(score_adj, lowmem_score_adj, short, 
_score_adj_size,
 S_IRUGO | S_IWUSR);
 module_param_array_named(minfree, lowmem_minfree, uint, _minfree_size,
 S_IRUGO | S_IWUSR);
-- 
1.9.1



Re: ktime_get_ts64() splat during resume

2016-06-20 Thread Logan Gunthorpe

Hey Rafael,

This patch appears to be working on my laptop. Thanks.

Logan

On 20/06/16 07:22 PM, Rafael J. Wysocki wrote:

On Tuesday, June 21, 2016 02:05:59 AM Rafael J. Wysocki wrote:

On Monday, June 20, 2016 11:15:18 PM Rafael J. Wysocki wrote:

On Mon, Jun 20, 2016 at 8:29 PM, Linus Torvalds
 wrote:

On Mon, Jun 20, 2016 at 7:38 AM, Rafael J. Wysocki  wrote:


Overall, we seem to be heading towards the "really weird" territory here.


So the whole commit that Boris bisected down to is weird to me.

Why isn't the temporary text mapping just set up unconditionally in
the temp_level4_pgt?

Why does it have that insane "let's leave the temp_level4_pgt alone
until we actually switch to it, and save away restore_pgd_addr and the
restore_pgd, to then be set up at restore time"?

All the other temporary mappings are set up statically in the
temp_level4_pgt, why not that one?


The text mapping in temp_level4_pgt has to map the image kernel's
physical entry address to the same virtual address that the image
kernel had for it, because the image kernel will switch over to its
own page tables first and it will use its own kernel text mapping from
that point on.  That may not be the same as the text mapping of the
(currently running) restore (or "boot") kernel.

So if we set up the text mapping in temp_level4_pgt upfront, we
basically can't reference the original kernel text (or do any
addressing relative to it) any more after switching over to
temp_level4_pgt.

For some reason I thought that was not doable, but now that I look at
the code it looks like it can be done.  I'll try doing that.


I recalled what the problem was. :-)

In principle, the kernel text mapping in the image kernel may be different
from the kernel text mapping in the restore ("boot") kernel, but the patch
I posted a couple of hours ago actually assumed them to be the same, because
it switched to temp_level4_pgt before jumping to the relocated code.

To get rid of that implicit assumption it has to switch to temp_level4_pgt
from the relocated code itself, but for that to work, the page containing
the relocated code must be executable in the original page tables (it isn't
usually).

So updated patch is appended.

Again, it works for me, but I'm wondering about everybody else.

Thanks,
Rafael

---
From: Rafael J. Wysocki 
Subject: [PATCH v2] x86/power/64: Fix kernel text mapping corruption during 
image restoration

Logan Gunthorpe reports that hibernation stopped working reliably for
him after commit ab76f7b4ab23 (x86/mm: Set NX on gap between __ex_table
and rodata).

That turns out to be a consequence of a long-standing issue with the
64-bit image restoration code on x86, which is that the temporary
page tables set up by it to avoid page tables corruption when the
last bits of the image kernel's memory contents are copied into
their original page frames re-use the boot kernel's text mapping,
but that mapping may very well get corrupted just like any other
part of the page tables.  Of course, if that happens, the final
jump to the image kernel's entry point will go to nowhere.

The exact reason why commit ab76f7b4ab23 matters here is that it
sometimes causes a PMD of a large page to be split into PTEs
that are allocated dynamically and get corrupted during image
restoration as described above.

To fix that issue note that the code copying the last bits of the
image kernel's memory contents to the page frames occupied by them
previoulsy doesn't use the kernel text mapping, because it runs from
a special page covered by the identity mapping set up for that code
from scratch.  Hence, the kernel text mapping is only needed before
that code starts to run and then it will only be used just for the
final jump to the image kernel's entry point.

Accordingly, the temporary page tables set up in swsusp_arch_resume()
on x86-64 need to contain the kernel text mapping too.  That mapping
is only going to be used for the final jump to the image kernel, so
it only needs to cover the image kernel's entry point, because the
first thing the image kernel does after getting control back is to
switch over to its own original page tables.  Moreover, the virtual
address of the image kernel's entry point in that mapping has to be
the same as the one mapped by the image kernel's page tables.

With that in mind, modify the x86-64's arch_hibernation_header_save()
and arch_hibernation_header_restore() routines to pass the physical
address of the image kernel's entry point (in addition to its virtual
address) to the boot kernel (a small piece of assembly code involved
in passing the entry point's virtual address to the image kernel is
not necessary any more after that, so drop it).  Update RESTORE_MAGIC
too to reflect the image header format change.

Next, in set_up_temporary_mappings(), use the physical and virtual
addresses of the image kernel's entry point passed in the image
header to set 

Re: ktime_get_ts64() splat during resume

2016-06-20 Thread Logan Gunthorpe

Hey Rafael,

This patch appears to be working on my laptop. Thanks.

Logan

On 20/06/16 07:22 PM, Rafael J. Wysocki wrote:

On Tuesday, June 21, 2016 02:05:59 AM Rafael J. Wysocki wrote:

On Monday, June 20, 2016 11:15:18 PM Rafael J. Wysocki wrote:

On Mon, Jun 20, 2016 at 8:29 PM, Linus Torvalds
 wrote:

On Mon, Jun 20, 2016 at 7:38 AM, Rafael J. Wysocki  wrote:


Overall, we seem to be heading towards the "really weird" territory here.


So the whole commit that Boris bisected down to is weird to me.

Why isn't the temporary text mapping just set up unconditionally in
the temp_level4_pgt?

Why does it have that insane "let's leave the temp_level4_pgt alone
until we actually switch to it, and save away restore_pgd_addr and the
restore_pgd, to then be set up at restore time"?

All the other temporary mappings are set up statically in the
temp_level4_pgt, why not that one?


The text mapping in temp_level4_pgt has to map the image kernel's
physical entry address to the same virtual address that the image
kernel had for it, because the image kernel will switch over to its
own page tables first and it will use its own kernel text mapping from
that point on.  That may not be the same as the text mapping of the
(currently running) restore (or "boot") kernel.

So if we set up the text mapping in temp_level4_pgt upfront, we
basically can't reference the original kernel text (or do any
addressing relative to it) any more after switching over to
temp_level4_pgt.

For some reason I thought that was not doable, but now that I look at
the code it looks like it can be done.  I'll try doing that.


I recalled what the problem was. :-)

In principle, the kernel text mapping in the image kernel may be different
from the kernel text mapping in the restore ("boot") kernel, but the patch
I posted a couple of hours ago actually assumed them to be the same, because
it switched to temp_level4_pgt before jumping to the relocated code.

To get rid of that implicit assumption it has to switch to temp_level4_pgt
from the relocated code itself, but for that to work, the page containing
the relocated code must be executable in the original page tables (it isn't
usually).

So updated patch is appended.

Again, it works for me, but I'm wondering about everybody else.

Thanks,
Rafael

---
From: Rafael J. Wysocki 
Subject: [PATCH v2] x86/power/64: Fix kernel text mapping corruption during 
image restoration

Logan Gunthorpe reports that hibernation stopped working reliably for
him after commit ab76f7b4ab23 (x86/mm: Set NX on gap between __ex_table
and rodata).

That turns out to be a consequence of a long-standing issue with the
64-bit image restoration code on x86, which is that the temporary
page tables set up by it to avoid page tables corruption when the
last bits of the image kernel's memory contents are copied into
their original page frames re-use the boot kernel's text mapping,
but that mapping may very well get corrupted just like any other
part of the page tables.  Of course, if that happens, the final
jump to the image kernel's entry point will go to nowhere.

The exact reason why commit ab76f7b4ab23 matters here is that it
sometimes causes a PMD of a large page to be split into PTEs
that are allocated dynamically and get corrupted during image
restoration as described above.

To fix that issue note that the code copying the last bits of the
image kernel's memory contents to the page frames occupied by them
previoulsy doesn't use the kernel text mapping, because it runs from
a special page covered by the identity mapping set up for that code
from scratch.  Hence, the kernel text mapping is only needed before
that code starts to run and then it will only be used just for the
final jump to the image kernel's entry point.

Accordingly, the temporary page tables set up in swsusp_arch_resume()
on x86-64 need to contain the kernel text mapping too.  That mapping
is only going to be used for the final jump to the image kernel, so
it only needs to cover the image kernel's entry point, because the
first thing the image kernel does after getting control back is to
switch over to its own original page tables.  Moreover, the virtual
address of the image kernel's entry point in that mapping has to be
the same as the one mapped by the image kernel's page tables.

With that in mind, modify the x86-64's arch_hibernation_header_save()
and arch_hibernation_header_restore() routines to pass the physical
address of the image kernel's entry point (in addition to its virtual
address) to the boot kernel (a small piece of assembly code involved
in passing the entry point's virtual address to the image kernel is
not necessary any more after that, so drop it).  Update RESTORE_MAGIC
too to reflect the image header format change.

Next, in set_up_temporary_mappings(), use the physical and virtual
addresses of the image kernel's entry point passed in the image
header to set up a minimum kernel text mapping (using memory pages
that won't be overwritten 

Re: [PATCH v5 0/7] /dev/random - a new approach

2016-06-20 Thread Stephan Mueller
Am Dienstag, 21. Juni 2016, 01:12:55 schrieb Theodore Ts'o:

Hi Theodore,

> On Mon, Jun 20, 2016 at 09:00:49PM +0200, Stephan Mueller wrote:
> > The time stamp maintenance is the exact cause for the correlation: one HID
> > event triggers:
> > 
> > - add_interrupt_randomness which takes high-res time stamp, Jiffies and
> > some pointers
> > 
> > - add_input_randomness which takes high-res time stamp, Jiffies and HID
> > event value
> > 
> > The same applies to disk events. My suggestion is to get rid of the double
> > counting of time stamps for one event.
> > 
> > And I guess I do not need to stress that correlation of data that is
> > supposed to be entropic is not good :-)
> 
> What is your concern, specifically?  If it is in the entropy
> accounting, there is more entropy in HID event interrupts, so I don't
> think adding the extra 1/64th bit of entropy is going to be problematic.

My concern is that interrupts have *much* more entropy than 1/64th. With a 
revaluation of the assumed entropy in interrupts, we will serve *all* systems 
much better and not just systems with HID.

As said, I think we heavily penalize server type and VM environments against 
desktop systems by crediting entropy in large scale to HID and conversely to a 
much lesser degree to interrupts.
> 
> If it is that there are two timestamps that are closely correleated
> being added into the pool, the add_interrupt_randomness() path is
> going to mix that timestamp with the interrupt timings from 63 other
> interrupts before it is mixed into the input pool, while the
> add_input_randomness() mixes it directly into the pool.  So if you
> think there is a way this could be leveraged into attack, please give
> specifics --- but I think we're on pretty solid ground here.

I am not saying that there is an active attack vector. All I want is to 
revalue the entropy in one interrupt which can only be done if we drop the HID 
time stamp collection.

Ciao
Stephan


Re: [PATCH v5 0/7] /dev/random - a new approach

2016-06-20 Thread Stephan Mueller
Am Dienstag, 21. Juni 2016, 01:12:55 schrieb Theodore Ts'o:

Hi Theodore,

> On Mon, Jun 20, 2016 at 09:00:49PM +0200, Stephan Mueller wrote:
> > The time stamp maintenance is the exact cause for the correlation: one HID
> > event triggers:
> > 
> > - add_interrupt_randomness which takes high-res time stamp, Jiffies and
> > some pointers
> > 
> > - add_input_randomness which takes high-res time stamp, Jiffies and HID
> > event value
> > 
> > The same applies to disk events. My suggestion is to get rid of the double
> > counting of time stamps for one event.
> > 
> > And I guess I do not need to stress that correlation of data that is
> > supposed to be entropic is not good :-)
> 
> What is your concern, specifically?  If it is in the entropy
> accounting, there is more entropy in HID event interrupts, so I don't
> think adding the extra 1/64th bit of entropy is going to be problematic.

My concern is that interrupts have *much* more entropy than 1/64th. With a 
revaluation of the assumed entropy in interrupts, we will serve *all* systems 
much better and not just systems with HID.

As said, I think we heavily penalize server type and VM environments against 
desktop systems by crediting entropy in large scale to HID and conversely to a 
much lesser degree to interrupts.
> 
> If it is that there are two timestamps that are closely correleated
> being added into the pool, the add_interrupt_randomness() path is
> going to mix that timestamp with the interrupt timings from 63 other
> interrupts before it is mixed into the input pool, while the
> add_input_randomness() mixes it directly into the pool.  So if you
> think there is a way this could be leveraged into attack, please give
> specifics --- but I think we're on pretty solid ground here.

I am not saying that there is an active attack vector. All I want is to 
revalue the entropy in one interrupt which can only be done if we drop the HID 
time stamp collection.

Ciao
Stephan


[PATCH v4 2/3] x86/platform/p2sb: New Primary to Sideband bridge support driver for Intel SOC's

2016-06-20 Thread Tan Jui Nee
From: Andy Shevchenko 

There is already one and at least one more user coming which
require an access to Primary to Sideband bridge (P2SB) in order
to get IO or MMIO bar hidden by BIOS.
Create a driver to access P2SB for x86 devices.

Signed-off-by: Yong, Jonathan 
Signed-off-by: Andy Shevchenko 
---
Changes in V4:
- Move Kconfig option CONFIG_X86_INTEL_NON_ACPI from
  [PATCH 2/3] x86/platform/p2sb: New Primary to Sideband bridge support 
driver for Intel SOC's
  to
  [PATCH 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO 
pinctrl in non-ACPI system
  since the config is used in latter patch.

Changes in V3:
- No change

Changes in V2:
- Add new config option CONFIG_X86_INTEL_NON_ACPI and "select PINCTRL"
  to fix kbuildbot error

 arch/x86/Kconfig |  4 ++
 arch/x86/include/asm/p2sb.h  | 27 +++
 arch/x86/platform/intel/Makefile |  1 +
 arch/x86/platform/intel/p2sb.c   | 99 
 4 files changed, 131 insertions(+)
 create mode 100644 arch/x86/include/asm/p2sb.h
 create mode 100644 arch/x86/platform/intel/p2sb.c

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index d9a94da..d305d81 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -604,6 +604,10 @@ config IOSF_MBI_DEBUG
 
  If you don't require the option or are in doubt, say N.
 
+config P2SB
+   tristate
+   depends on PCI
+
 config X86_RDC321X
bool "RDC R-321x SoC"
depends on X86_32
diff --git a/arch/x86/include/asm/p2sb.h b/arch/x86/include/asm/p2sb.h
new file mode 100644
index 000..686e07b
--- /dev/null
+++ b/arch/x86/include/asm/p2sb.h
@@ -0,0 +1,27 @@
+/*
+ * Primary to Sideband bridge (P2SB) access support
+ */
+
+#ifndef P2SB_SYMS_H
+#define P2SB_SYMS_H
+
+#include 
+#include 
+
+#if IS_ENABLED(CONFIG_P2SB)
+
+int p2sb_bar(struct pci_dev *pdev, unsigned int devfn,
+   struct resource *res);
+
+#else /* CONFIG_P2SB is not set */
+
+static inline
+int p2sb_bar(struct pci_dev *pdev, unsigned int devfn,
+   struct resource *res)
+{
+   return -ENODEV;
+}
+
+#endif /* CONFIG_P2SB */
+
+#endif /* P2SB_SYMS_H */
diff --git a/arch/x86/platform/intel/Makefile b/arch/x86/platform/intel/Makefile
index b878032..dbf9f10 100644
--- a/arch/x86/platform/intel/Makefile
+++ b/arch/x86/platform/intel/Makefile
@@ -1 +1,2 @@
 obj-$(CONFIG_IOSF_MBI) += iosf_mbi.o
+obj-$(CONFIG_P2SB) += p2sb.o
diff --git a/arch/x86/platform/intel/p2sb.c b/arch/x86/platform/intel/p2sb.c
new file mode 100644
index 000..8be47a4
--- /dev/null
+++ b/arch/x86/platform/intel/p2sb.c
@@ -0,0 +1,99 @@
+/*
+ * Primary to Sideband bridge (P2SB) driver
+ *
+ * Copyright (c) 2016, Intel Corporation.
+ *
+ * Authors: Andy Shevchenko 
+ * Jonathan Yong 
+ *
+ * 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.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define SBREG_BAR  0x10
+#define SBREG_HIDE 0xe1
+
+static DEFINE_SPINLOCK(p2sb_spinlock);
+
+/*
+ * p2sb_bar - Get Primary to Sideband bridge (P2SB) BAR
+ * @pdev:  PCI device to get PCI bus to communicate with
+ * @devfn: PCI device and function to communicate with
+ * @res:   resources to be filled in
+ *
+ * The BIOS prevents the P2SB device from being enumerated by the PCI
+ * subsystem, so we need to unhide and hide it back to lookup the P2SB BAR.
+ *
+ * Locking is handled by spinlock - cannot sleep.
+ *
+ * Return:
+ * 0 on success or appropriate errno value on error.
+ */
+int p2sb_bar(struct pci_dev *pdev, unsigned int devfn,
+   struct resource *res)
+{
+   u32 base_addr;
+   u64 base64_addr;
+   unsigned long flags;
+
+   if (!res)
+   return -EINVAL;
+
+   spin_lock(_spinlock);
+
+   /* Unhide the P2SB device */
+   pci_bus_write_config_byte(pdev->bus, devfn, SBREG_HIDE, 0x00);
+
+   /* Check if device present */
+   pci_bus_read_config_dword(pdev->bus, devfn, 0, _addr);
+   if (base_addr == 0x || base_addr == 0x) {
+   spin_unlock(_spinlock);
+   dev_warn(>dev, "P2SB device access disabled by BIOS?\n");
+   return -ENODEV;
+   }
+
+   /* Get IO or MMIO BAR */
+   pci_bus_read_config_dword(pdev->bus, devfn, SBREG_BAR, _addr);
+   if ((base_addr & PCI_BASE_ADDRESS_SPACE) == 

[PATCH 3/5] PM / devfreq: make exynos-bus explicitly non-modular

2016-06-20 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

devfreq/Kconfig:config ARM_EXYNOS_BUS_DEVFREQ
devfreq/Kconfig:bool "ARM EXYNOS Generic Memory Bus DEVFREQ Driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Chanwoo Choi 
Cc: MyungJoo Ham 
Cc: Kyungmin Park 
Cc: Kukjin Kim 
Cc: Krzysztof Kozlowski 
Cc: linux...@vger.kernel.org
Cc: linux-samsung-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/devfreq/exynos-bus.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
index 2363d0a189b7..2e018d80e0f7 100644
--- a/drivers/devfreq/exynos-bus.c
+++ b/drivers/devfreq/exynos-bus.c
@@ -17,7 +17,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -553,7 +553,6 @@ static const struct of_device_id exynos_bus_of_match[] = {
{ .compatible = "samsung,exynos-bus", },
{ /* sentinel */ },
 };
-MODULE_DEVICE_TABLE(of, exynos_bus_of_match);
 
 static struct platform_driver exynos_bus_platdrv = {
.probe  = exynos_bus_probe,
@@ -563,8 +562,4 @@ static struct platform_driver exynos_bus_platdrv = {
.of_match_table = of_match_ptr(exynos_bus_of_match),
},
 };
-module_platform_driver(exynos_bus_platdrv);
-
-MODULE_DESCRIPTION("Generic Exynos Bus frequency driver");
-MODULE_AUTHOR("Chanwoo Choi ");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(exynos_bus_platdrv);
-- 
2.8.4



[PATCH v4 2/3] x86/platform/p2sb: New Primary to Sideband bridge support driver for Intel SOC's

2016-06-20 Thread Tan Jui Nee
From: Andy Shevchenko 

There is already one and at least one more user coming which
require an access to Primary to Sideband bridge (P2SB) in order
to get IO or MMIO bar hidden by BIOS.
Create a driver to access P2SB for x86 devices.

Signed-off-by: Yong, Jonathan 
Signed-off-by: Andy Shevchenko 
---
Changes in V4:
- Move Kconfig option CONFIG_X86_INTEL_NON_ACPI from
  [PATCH 2/3] x86/platform/p2sb: New Primary to Sideband bridge support 
driver for Intel SOC's
  to
  [PATCH 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO 
pinctrl in non-ACPI system
  since the config is used in latter patch.

Changes in V3:
- No change

Changes in V2:
- Add new config option CONFIG_X86_INTEL_NON_ACPI and "select PINCTRL"
  to fix kbuildbot error

 arch/x86/Kconfig |  4 ++
 arch/x86/include/asm/p2sb.h  | 27 +++
 arch/x86/platform/intel/Makefile |  1 +
 arch/x86/platform/intel/p2sb.c   | 99 
 4 files changed, 131 insertions(+)
 create mode 100644 arch/x86/include/asm/p2sb.h
 create mode 100644 arch/x86/platform/intel/p2sb.c

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index d9a94da..d305d81 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -604,6 +604,10 @@ config IOSF_MBI_DEBUG
 
  If you don't require the option or are in doubt, say N.
 
+config P2SB
+   tristate
+   depends on PCI
+
 config X86_RDC321X
bool "RDC R-321x SoC"
depends on X86_32
diff --git a/arch/x86/include/asm/p2sb.h b/arch/x86/include/asm/p2sb.h
new file mode 100644
index 000..686e07b
--- /dev/null
+++ b/arch/x86/include/asm/p2sb.h
@@ -0,0 +1,27 @@
+/*
+ * Primary to Sideband bridge (P2SB) access support
+ */
+
+#ifndef P2SB_SYMS_H
+#define P2SB_SYMS_H
+
+#include 
+#include 
+
+#if IS_ENABLED(CONFIG_P2SB)
+
+int p2sb_bar(struct pci_dev *pdev, unsigned int devfn,
+   struct resource *res);
+
+#else /* CONFIG_P2SB is not set */
+
+static inline
+int p2sb_bar(struct pci_dev *pdev, unsigned int devfn,
+   struct resource *res)
+{
+   return -ENODEV;
+}
+
+#endif /* CONFIG_P2SB */
+
+#endif /* P2SB_SYMS_H */
diff --git a/arch/x86/platform/intel/Makefile b/arch/x86/platform/intel/Makefile
index b878032..dbf9f10 100644
--- a/arch/x86/platform/intel/Makefile
+++ b/arch/x86/platform/intel/Makefile
@@ -1 +1,2 @@
 obj-$(CONFIG_IOSF_MBI) += iosf_mbi.o
+obj-$(CONFIG_P2SB) += p2sb.o
diff --git a/arch/x86/platform/intel/p2sb.c b/arch/x86/platform/intel/p2sb.c
new file mode 100644
index 000..8be47a4
--- /dev/null
+++ b/arch/x86/platform/intel/p2sb.c
@@ -0,0 +1,99 @@
+/*
+ * Primary to Sideband bridge (P2SB) driver
+ *
+ * Copyright (c) 2016, Intel Corporation.
+ *
+ * Authors: Andy Shevchenko 
+ * Jonathan Yong 
+ *
+ * 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.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define SBREG_BAR  0x10
+#define SBREG_HIDE 0xe1
+
+static DEFINE_SPINLOCK(p2sb_spinlock);
+
+/*
+ * p2sb_bar - Get Primary to Sideband bridge (P2SB) BAR
+ * @pdev:  PCI device to get PCI bus to communicate with
+ * @devfn: PCI device and function to communicate with
+ * @res:   resources to be filled in
+ *
+ * The BIOS prevents the P2SB device from being enumerated by the PCI
+ * subsystem, so we need to unhide and hide it back to lookup the P2SB BAR.
+ *
+ * Locking is handled by spinlock - cannot sleep.
+ *
+ * Return:
+ * 0 on success or appropriate errno value on error.
+ */
+int p2sb_bar(struct pci_dev *pdev, unsigned int devfn,
+   struct resource *res)
+{
+   u32 base_addr;
+   u64 base64_addr;
+   unsigned long flags;
+
+   if (!res)
+   return -EINVAL;
+
+   spin_lock(_spinlock);
+
+   /* Unhide the P2SB device */
+   pci_bus_write_config_byte(pdev->bus, devfn, SBREG_HIDE, 0x00);
+
+   /* Check if device present */
+   pci_bus_read_config_dword(pdev->bus, devfn, 0, _addr);
+   if (base_addr == 0x || base_addr == 0x) {
+   spin_unlock(_spinlock);
+   dev_warn(>dev, "P2SB device access disabled by BIOS?\n");
+   return -ENODEV;
+   }
+
+   /* Get IO or MMIO BAR */
+   pci_bus_read_config_dword(pdev->bus, devfn, SBREG_BAR, _addr);
+   if ((base_addr & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) {
+   flags = IORESOURCE_IO;
+   base64_addr = base_addr & PCI_BASE_ADDRESS_IO_MASK;
+   } else {
+  

[PATCH 3/5] PM / devfreq: make exynos-bus explicitly non-modular

2016-06-20 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

devfreq/Kconfig:config ARM_EXYNOS_BUS_DEVFREQ
devfreq/Kconfig:bool "ARM EXYNOS Generic Memory Bus DEVFREQ Driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Chanwoo Choi 
Cc: MyungJoo Ham 
Cc: Kyungmin Park 
Cc: Kukjin Kim 
Cc: Krzysztof Kozlowski 
Cc: linux...@vger.kernel.org
Cc: linux-samsung-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/devfreq/exynos-bus.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
index 2363d0a189b7..2e018d80e0f7 100644
--- a/drivers/devfreq/exynos-bus.c
+++ b/drivers/devfreq/exynos-bus.c
@@ -17,7 +17,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -553,7 +553,6 @@ static const struct of_device_id exynos_bus_of_match[] = {
{ .compatible = "samsung,exynos-bus", },
{ /* sentinel */ },
 };
-MODULE_DEVICE_TABLE(of, exynos_bus_of_match);
 
 static struct platform_driver exynos_bus_platdrv = {
.probe  = exynos_bus_probe,
@@ -563,8 +562,4 @@ static struct platform_driver exynos_bus_platdrv = {
.of_match_table = of_match_ptr(exynos_bus_of_match),
},
 };
-module_platform_driver(exynos_bus_platdrv);
-
-MODULE_DESCRIPTION("Generic Exynos Bus frequency driver");
-MODULE_AUTHOR("Chanwoo Choi ");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(exynos_bus_platdrv);
-- 
2.8.4



[PATCH 2/5] PM / devfreq: make devfreq-event explicitly non-modular

2016-06-20 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

menuconfig PM_DEVFREQ_EVENT
bool "DEVFREQ-Event device Support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

This code wasn't using module_init, so we don't need to be concerned
with altering the initcall level here.

We don't replace module.h with init.h since the file already has that.
But we do add export.h since this file does export some symbols.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: MyungJoo Ham 
Cc: Kyungmin Park 
Cc: Chanwoo Choi 
Cc: linux...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/devfreq/devfreq-event.c | 12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/devfreq/devfreq-event.c b/drivers/devfreq/devfreq-event.c
index 39b048eda2ce..9aea2c7ecbe6 100644
--- a/drivers/devfreq/devfreq-event.c
+++ b/drivers/devfreq/devfreq-event.c
@@ -15,7 +15,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -481,13 +481,3 @@ static int __init devfreq_event_init(void)
return 0;
 }
 subsys_initcall(devfreq_event_init);
-
-static void __exit devfreq_event_exit(void)
-{
-   class_destroy(devfreq_event_class);
-}
-module_exit(devfreq_event_exit);
-
-MODULE_AUTHOR("Chanwoo Choi ");
-MODULE_DESCRIPTION("DEVFREQ-Event class support");
-MODULE_LICENSE("GPL");
-- 
2.8.4



[PATCH 2/5] PM / devfreq: make devfreq-event explicitly non-modular

2016-06-20 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

menuconfig PM_DEVFREQ_EVENT
bool "DEVFREQ-Event device Support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

This code wasn't using module_init, so we don't need to be concerned
with altering the initcall level here.

We don't replace module.h with init.h since the file already has that.
But we do add export.h since this file does export some symbols.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: MyungJoo Ham 
Cc: Kyungmin Park 
Cc: Chanwoo Choi 
Cc: linux...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/devfreq/devfreq-event.c | 12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/devfreq/devfreq-event.c b/drivers/devfreq/devfreq-event.c
index 39b048eda2ce..9aea2c7ecbe6 100644
--- a/drivers/devfreq/devfreq-event.c
+++ b/drivers/devfreq/devfreq-event.c
@@ -15,7 +15,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -481,13 +481,3 @@ static int __init devfreq_event_init(void)
return 0;
 }
 subsys_initcall(devfreq_event_init);
-
-static void __exit devfreq_event_exit(void)
-{
-   class_destroy(devfreq_event_class);
-}
-module_exit(devfreq_event_exit);
-
-MODULE_AUTHOR("Chanwoo Choi ");
-MODULE_DESCRIPTION("DEVFREQ-Event class support");
-MODULE_LICENSE("GPL");
-- 
2.8.4



[PATCH 4/5] PM / devfreq: make event/exynos-nocp explicitly non-modular

2016-06-20 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

event/Kconfig:config DEVFREQ_EVENT_EXYNOS_NOCP
event/Kconfig:  bool "EXYNOS NoC (Network On Chip) Probe DEVFREQ event Driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Chanwoo Choi 
Cc: MyungJoo Ham 
Cc: Kyungmin Park 
Cc: Kukjin Kim 
Cc: Krzysztof Kozlowski 
Cc: linux...@vger.kernel.org
Cc: linux-samsung-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/devfreq/event/exynos-nocp.c | 19 +++
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/devfreq/event/exynos-nocp.c 
b/drivers/devfreq/event/exynos-nocp.c
index 6b6a5f310486..f954578abfdf 100644
--- a/drivers/devfreq/event/exynos-nocp.c
+++ b/drivers/devfreq/event/exynos-nocp.c
@@ -10,7 +10,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -280,25 +280,12 @@ static int exynos_nocp_probe(struct platform_device *pdev)
return 0;
 }
 
-static int exynos_nocp_remove(struct platform_device *pdev)
-{
-   struct exynos_nocp *nocp = platform_get_drvdata(pdev);
-
-   clk_disable_unprepare(nocp->clk);
-
-   return 0;
-}
-
 static struct platform_driver exynos_nocp_driver = {
.probe  = exynos_nocp_probe,
-   .remove = exynos_nocp_remove,
.driver = {
.name   = "exynos-nocp",
+   .suppress_bind_attrs = true,
.of_match_table = exynos_nocp_id_match,
},
 };
-module_platform_driver(exynos_nocp_driver);
-
-MODULE_DESCRIPTION("Exynos NoC (Network on Chip) Probe driver");
-MODULE_AUTHOR("Chanwoo Choi ");
-MODULE_LICENSE("GPL");
+builtin_platform_driver(exynos_nocp_driver);
-- 
2.8.4



[PATCH 5/5] PM / devfreq: make event/exynos-ppmu explicitly non-modular

2016-06-20 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

config DEVFREQ_EVENT_EXYNOS_PPMU
   bool "EXYNOS PPMU (Platform Perf Monitoring Unit) DEVFREQ event Driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: MyungJoo Ham 
Cc: Kyungmin Park 
Cc: Kukjin Kim 
Cc: Krzysztof Kozlowski 
Cc: Chanwoo Choi 
Cc: linux...@vger.kernel.org
Cc: linux-samsung-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/devfreq/event/exynos-ppmu.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/devfreq/event/exynos-ppmu.c 
b/drivers/devfreq/event/exynos-ppmu.c
index f312485f1451..38a997807043 100644
--- a/drivers/devfreq/event/exynos-ppmu.c
+++ b/drivers/devfreq/event/exynos-ppmu.c
@@ -14,7 +14,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -524,8 +524,4 @@ static struct platform_driver exynos_ppmu_driver = {
.of_match_table = exynos_ppmu_id_match,
},
 };
-module_platform_driver(exynos_ppmu_driver);
-
-MODULE_DESCRIPTION("Exynos PPMU(Platform Performance Monitoring Unit) driver");
-MODULE_AUTHOR("Chanwoo Choi ");
-MODULE_LICENSE("GPL");
+builtin_platform_driver(exynos_ppmu_driver);
-- 
2.8.4



[PATCH 4/5] PM / devfreq: make event/exynos-nocp explicitly non-modular

2016-06-20 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

event/Kconfig:config DEVFREQ_EVENT_EXYNOS_NOCP
event/Kconfig:  bool "EXYNOS NoC (Network On Chip) Probe DEVFREQ event Driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Chanwoo Choi 
Cc: MyungJoo Ham 
Cc: Kyungmin Park 
Cc: Kukjin Kim 
Cc: Krzysztof Kozlowski 
Cc: linux...@vger.kernel.org
Cc: linux-samsung-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/devfreq/event/exynos-nocp.c | 19 +++
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/devfreq/event/exynos-nocp.c 
b/drivers/devfreq/event/exynos-nocp.c
index 6b6a5f310486..f954578abfdf 100644
--- a/drivers/devfreq/event/exynos-nocp.c
+++ b/drivers/devfreq/event/exynos-nocp.c
@@ -10,7 +10,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -280,25 +280,12 @@ static int exynos_nocp_probe(struct platform_device *pdev)
return 0;
 }
 
-static int exynos_nocp_remove(struct platform_device *pdev)
-{
-   struct exynos_nocp *nocp = platform_get_drvdata(pdev);
-
-   clk_disable_unprepare(nocp->clk);
-
-   return 0;
-}
-
 static struct platform_driver exynos_nocp_driver = {
.probe  = exynos_nocp_probe,
-   .remove = exynos_nocp_remove,
.driver = {
.name   = "exynos-nocp",
+   .suppress_bind_attrs = true,
.of_match_table = exynos_nocp_id_match,
},
 };
-module_platform_driver(exynos_nocp_driver);
-
-MODULE_DESCRIPTION("Exynos NoC (Network on Chip) Probe driver");
-MODULE_AUTHOR("Chanwoo Choi ");
-MODULE_LICENSE("GPL");
+builtin_platform_driver(exynos_nocp_driver);
-- 
2.8.4



[PATCH 5/5] PM / devfreq: make event/exynos-ppmu explicitly non-modular

2016-06-20 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

config DEVFREQ_EVENT_EXYNOS_PPMU
   bool "EXYNOS PPMU (Platform Perf Monitoring Unit) DEVFREQ event Driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: MyungJoo Ham 
Cc: Kyungmin Park 
Cc: Kukjin Kim 
Cc: Krzysztof Kozlowski 
Cc: Chanwoo Choi 
Cc: linux...@vger.kernel.org
Cc: linux-samsung-...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/devfreq/event/exynos-ppmu.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/devfreq/event/exynos-ppmu.c 
b/drivers/devfreq/event/exynos-ppmu.c
index f312485f1451..38a997807043 100644
--- a/drivers/devfreq/event/exynos-ppmu.c
+++ b/drivers/devfreq/event/exynos-ppmu.c
@@ -14,7 +14,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -524,8 +524,4 @@ static struct platform_driver exynos_ppmu_driver = {
.of_match_table = exynos_ppmu_id_match,
},
 };
-module_platform_driver(exynos_ppmu_driver);
-
-MODULE_DESCRIPTION("Exynos PPMU(Platform Performance Monitoring Unit) driver");
-MODULE_AUTHOR("Chanwoo Choi ");
-MODULE_LICENSE("GPL");
+builtin_platform_driver(exynos_ppmu_driver);
-- 
2.8.4



[PATCH v4 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system

2016-06-20 Thread Tan Jui Nee
This driver uses the P2SB hide/unhide mechanism cooperatively
to pass the PCI BAR address to the gpio platform driver.

Signed-off-by: Tan Jui Nee 
---
Changes in V4:
- Move Kconfig option CONFIG_X86_INTEL_NON_ACPI from
  [PATCH 2/3] x86/platform/p2sb: New Primary to Sideband bridge support 
driver for Intel SOC's
  to
  [PATCH 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO 
pinctrl in non-ACPI system
  since the config is used in latter patch.
- Select CONFIG_P2SB when CONFIG_LPC_ICH is enabled.
- Remove #ifdef CONFIG_X86_INTEL_NON_ACPI and use
  #if defined(CONFIG_X86_INTEL_NON_ACPI) when lpc_ich_misc is called
  as suggested by Lee Jones.
- Use single dimensional array instead of 2D array for apl_gpio_io_res
  structure and use DEFINE_RES_IRQ for its IRQ resource.

Changes in V3:
- Simplify register addresses calculation and use DEFINE_RES_MEM_NAMED
  defines for apl_gpio_io_res structure
- Define magic number for P2SB PCI ID
- Replace switch-case with if-else since currently we have only one
  use case
- Only call mfd_add_devices() once for all gpio communities

Changes in V2:
- Add new config option CONFIG_X86_INTEL_NON_ACPI and "select PINCTRL"
  to fix kbuildbot error

 arch/x86/Kconfig  |  10 
 drivers/mfd/Kconfig   |   3 +-
 drivers/mfd/lpc_ich.c | 126 ++
 3 files changed, 138 insertions(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index d305d81..520edd3 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -604,6 +604,16 @@ config IOSF_MBI_DEBUG
 
  If you don't require the option or are in doubt, say N.
 
+config X86_INTEL_NON_ACPI
+   bool "Enable support non-ACPI Intel platforms"
+   select PINCTRL
+   ---help---
+ Select this option to enables MMIO BAR access over the P2SB for
+ non-ACPI Intel SoC platforms. This driver uses the P2SB hide/unhide
+ mechanism cooperatively to pass the PCI BAR address to the platform
+ driver, currently GPIO on the following SoC products.
+  - Apollo Lake
+
 config P2SB
tristate
depends on PCI
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 1bcf601..dc4e543 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -369,8 +369,9 @@ config MFD_INTEL_QUARK_I2C_GPIO
 
 config LPC_ICH
tristate "Intel ICH LPC"
-   depends on PCI
+   depends on X86 && PCI
select MFD_CORE
+   select P2SB
help
  The LPC bridge function of the Intel ICH provides support for
  many functional units. This driver provides needed support for
diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c
index bd3aa45..a64854d 100644
--- a/drivers/mfd/lpc_ich.c
+++ b/drivers/mfd/lpc_ich.c
@@ -68,6 +68,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+
+#include 
 
 #define ACPIBASE   0x40
 #define ACPIBASE_GPE_OFF   0x28
@@ -94,6 +98,21 @@
 #define wdt_mem_res(i) wdt_res(ICH_RES_MEM_OFF, i)
 #define wdt_res(b, i) (_ich_res[(b) + (i)])
 
+/* Offset data for Apollo Lake GPIO communities */
+#define APL_GPIO_SOUTHWEST_OFFSET  0xc0
+#define APL_GPIO_NORTHWEST_OFFSET  0xc4
+#define APL_GPIO_NORTH_OFFSET  0xc5
+#define APL_GPIO_WEST_OFFSET   0xc7
+
+#define APL_GPIO_SOUTHWEST_NPIN43
+#define APL_GPIO_NORTHWEST_NPIN77
+#define APL_GPIO_NORTH_NPIN78
+#define APL_GPIO_WEST_NPIN 47
+
+#define APL_GPIO_IRQ 14
+
+#define PCI_IDSEL_P2SB 0x0d
+
 struct lpc_ich_priv {
int chipset;
 
@@ -133,6 +152,59 @@ static struct resource gpio_ich_res[] = {
},
 };
 
+static struct resource apl_gpio_io_res[] = {
+   DEFINE_RES_MEM_NAMED(APL_GPIO_NORTH_OFFSET,
+   APL_GPIO_NORTH_NPIN * SZ_8, "apl_pinctrl_n"),
+   DEFINE_RES_MEM_NAMED(APL_GPIO_NORTHWEST_OFFSET,
+   APL_GPIO_NORTHWEST_NPIN * SZ_8, "apl_pinctrl_nw"),
+   DEFINE_RES_MEM_NAMED(APL_GPIO_WEST_OFFSET,
+   APL_GPIO_WEST_NPIN * SZ_8, "apl_pinctrl_w"),
+   DEFINE_RES_MEM_NAMED(APL_GPIO_SOUTHWEST_OFFSET,
+   APL_GPIO_SOUTHWEST_NPIN * SZ_8, "apl_pinctrl_sw"),
+   DEFINE_RES_IRQ(APL_GPIO_IRQ),
+};
+
+static struct pinctrl_pin_desc apl_pinctrl_pdata;
+
+static struct mfd_cell apl_gpio_devices[] = {
+   {
+   .name = "apl-pinctrl",
+   .id = 0,
+   .num_resources = ARRAY_SIZE(apl_gpio_io_res),
+   .resources = apl_gpio_io_res,
+   .pdata_size = sizeof(apl_pinctrl_pdata),
+   .platform_data = _pinctrl_pdata,
+   .ignore_resource_conflicts = true,
+   },
+   {
+   .name = "apl-pinctrl",
+   .id = 1,
+   .num_resources = 

Re: [PATCH v5 0/7] /dev/random - a new approach

2016-06-20 Thread Theodore Ts'o
On Mon, Jun 20, 2016 at 09:00:49PM +0200, Stephan Mueller wrote:
> 
> The time stamp maintenance is the exact cause for the correlation: one HID 
> event triggers:
> 
> - add_interrupt_randomness which takes high-res time stamp, Jiffies and some 
> pointers
> 
> - add_input_randomness which takes high-res time stamp, Jiffies and HID event 
> value
> 
> The same applies to disk events. My suggestion is to get rid of the double 
> counting of time stamps for one event.
> 
> And I guess I do not need to stress that correlation of data that is supposed 
> to be entropic is not good :-)

What is your concern, specifically?  If it is in the entropy
accounting, there is more entropy in HID event interrupts, so I don't
think adding the extra 1/64th bit of entropy is going to be problematic.

If it is that there are two timestamps that are closely correleated
being added into the pool, the add_interrupt_randomness() path is
going to mix that timestamp with the interrupt timings from 63 other
interrupts before it is mixed into the input pool, while the
add_input_randomness() mixes it directly into the pool.  So if you
think there is a way this could be leveraged into attack, please give
specifics --- but I think we're on pretty solid ground here.

Cheers,

- Ted



[PATCH 1/5] PM / devfreq: make devfreq explicitly non-modular

2016-06-20 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

menuconfig PM_DEVFREQ
  bool "Generic Dynamic Voltage and Frequency Scaling (DVFS) support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

This code wasn't using module_init, so we don't need to be concerned
with altering the initcall level here.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

We don't replace module.h with init.h since the file already has that.
But we do add export.h since this file does export some symbols.

Cc: MyungJoo Ham 
Cc: Kyungmin Park 
Cc: linux...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/devfreq/devfreq.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 1d6c803804d5..6723f31c3973 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -15,7 +15,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -1198,13 +1198,6 @@ static int __init devfreq_init(void)
 }
 subsys_initcall(devfreq_init);
 
-static void __exit devfreq_exit(void)
-{
-   class_destroy(devfreq_class);
-   destroy_workqueue(devfreq_wq);
-}
-module_exit(devfreq_exit);
-
 /*
  * The followings are helper functions for devfreq user device drivers with
  * OPP framework.
@@ -1470,7 +1463,3 @@ void devm_devfreq_unregister_notifier(struct device *dev,
   devm_devfreq_dev_match, devfreq));
 }
 EXPORT_SYMBOL(devm_devfreq_unregister_notifier);
-
-MODULE_AUTHOR("MyungJoo Ham ");
-MODULE_DESCRIPTION("devfreq class support");
-MODULE_LICENSE("GPL");
-- 
2.8.4



[PATCH 0/5] PM / devfreq: remove modular references from non-modules

2016-06-20 Thread Paul Gortmaker
For anyone new to the underlying goal of this cleanup, we are trying to
not use module support for code that can never be built as a module since:

 (1) it is easy to accidentally write unused module_exit and remove code
 (2) it can be misleading when reading the source, thinking it can be
 modular when the Makefile and/or Kconfig prohibit it
 (3) it requires the include of the module.h header file which in turn
 includes nearly everything else, thus adding to CPP overhead.
 (4) it gets copied/replicated into other code and spreads like weeds.

We have already merged over 100 of these for mainline to date, so there
is really nothing new to see here, in terms of the type of change.

That said, devfreq changes seen here cover the following categories:

  -just replacement of modular macros with their non-modular
   equivalents that CPP would have inserted anyway

  -the removal of including module.h ; replaced with init.h
   and/or export.h as required based on whether the file used it.

  -the removal of any/all unused/orphaned __exit functions that
   would never be called.

  -the removal of any ".remove" functions that were hooked into
   the driver struct.   This ".remove" function would of
   course not be called from the __exit function since that was
   never run.  However in theory, someone could have triggered it
   via sysfs unbind, even though there isn't a sensible use case
   for doing so.  So to cover that possibility, we've also disabled
   sysfs unbind in the driver.

There are no initcall level changes here; everything stays at the level
of initcall it was previously - either by not using modular versions to
begin with, or by using the builtin level equivalents.

Build tested for arm and arm64 allmodconfig (for which all the drivers
touched here get coverage) on the linux-next tree from today to ensure
no silly typos crept in.

If there is a desire for any of these to be modular, we can definitely
consider that, but by default the changes here keep the code consistent
with existing behaviour.  Thus I do not expand functionality into the
modular realm that I can't run time test, or even know if the modular
instance has a sensible modular use case.

Paul.
---

Cc: Chanwoo Choi 
Cc: Krzysztof Kozlowski 
Cc: Kukjin Kim 
Cc: Kyungmin Park 
Cc: MyungJoo Ham 
Cc: linux...@vger.kernel.org
Cc: linux-samsung-...@vger.kernel.org


Paul Gortmaker (5):
  PM / devfreq: make devfreq explicitly non-modular
  PM / devfreq: make devfreq-event explicitly non-modular
  PM / devfreq: make exynos-bus explicitly non-modular
  PM / devfreq: make event/exynos-nocp explicitly non-modular
  PM / devfreq: make event/exynos-ppmu explicitly non-modular

 drivers/devfreq/devfreq-event.c | 12 +---
 drivers/devfreq/devfreq.c   | 13 +
 drivers/devfreq/event/exynos-nocp.c | 19 +++
 drivers/devfreq/event/exynos-ppmu.c |  8 ++--
 drivers/devfreq/exynos-bus.c|  9 ++---
 5 files changed, 9 insertions(+), 52 deletions(-)

-- 
2.8.4



[PATCH v4 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system

2016-06-20 Thread Tan Jui Nee
This driver uses the P2SB hide/unhide mechanism cooperatively
to pass the PCI BAR address to the gpio platform driver.

Signed-off-by: Tan Jui Nee 
---
Changes in V4:
- Move Kconfig option CONFIG_X86_INTEL_NON_ACPI from
  [PATCH 2/3] x86/platform/p2sb: New Primary to Sideband bridge support 
driver for Intel SOC's
  to
  [PATCH 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO 
pinctrl in non-ACPI system
  since the config is used in latter patch.
- Select CONFIG_P2SB when CONFIG_LPC_ICH is enabled.
- Remove #ifdef CONFIG_X86_INTEL_NON_ACPI and use
  #if defined(CONFIG_X86_INTEL_NON_ACPI) when lpc_ich_misc is called
  as suggested by Lee Jones.
- Use single dimensional array instead of 2D array for apl_gpio_io_res
  structure and use DEFINE_RES_IRQ for its IRQ resource.

Changes in V3:
- Simplify register addresses calculation and use DEFINE_RES_MEM_NAMED
  defines for apl_gpio_io_res structure
- Define magic number for P2SB PCI ID
- Replace switch-case with if-else since currently we have only one
  use case
- Only call mfd_add_devices() once for all gpio communities

Changes in V2:
- Add new config option CONFIG_X86_INTEL_NON_ACPI and "select PINCTRL"
  to fix kbuildbot error

 arch/x86/Kconfig  |  10 
 drivers/mfd/Kconfig   |   3 +-
 drivers/mfd/lpc_ich.c | 126 ++
 3 files changed, 138 insertions(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index d305d81..520edd3 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -604,6 +604,16 @@ config IOSF_MBI_DEBUG
 
  If you don't require the option or are in doubt, say N.
 
+config X86_INTEL_NON_ACPI
+   bool "Enable support non-ACPI Intel platforms"
+   select PINCTRL
+   ---help---
+ Select this option to enables MMIO BAR access over the P2SB for
+ non-ACPI Intel SoC platforms. This driver uses the P2SB hide/unhide
+ mechanism cooperatively to pass the PCI BAR address to the platform
+ driver, currently GPIO on the following SoC products.
+  - Apollo Lake
+
 config P2SB
tristate
depends on PCI
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 1bcf601..dc4e543 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -369,8 +369,9 @@ config MFD_INTEL_QUARK_I2C_GPIO
 
 config LPC_ICH
tristate "Intel ICH LPC"
-   depends on PCI
+   depends on X86 && PCI
select MFD_CORE
+   select P2SB
help
  The LPC bridge function of the Intel ICH provides support for
  many functional units. This driver provides needed support for
diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c
index bd3aa45..a64854d 100644
--- a/drivers/mfd/lpc_ich.c
+++ b/drivers/mfd/lpc_ich.c
@@ -68,6 +68,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+
+#include 
 
 #define ACPIBASE   0x40
 #define ACPIBASE_GPE_OFF   0x28
@@ -94,6 +98,21 @@
 #define wdt_mem_res(i) wdt_res(ICH_RES_MEM_OFF, i)
 #define wdt_res(b, i) (_ich_res[(b) + (i)])
 
+/* Offset data for Apollo Lake GPIO communities */
+#define APL_GPIO_SOUTHWEST_OFFSET  0xc0
+#define APL_GPIO_NORTHWEST_OFFSET  0xc4
+#define APL_GPIO_NORTH_OFFSET  0xc5
+#define APL_GPIO_WEST_OFFSET   0xc7
+
+#define APL_GPIO_SOUTHWEST_NPIN43
+#define APL_GPIO_NORTHWEST_NPIN77
+#define APL_GPIO_NORTH_NPIN78
+#define APL_GPIO_WEST_NPIN 47
+
+#define APL_GPIO_IRQ 14
+
+#define PCI_IDSEL_P2SB 0x0d
+
 struct lpc_ich_priv {
int chipset;
 
@@ -133,6 +152,59 @@ static struct resource gpio_ich_res[] = {
},
 };
 
+static struct resource apl_gpio_io_res[] = {
+   DEFINE_RES_MEM_NAMED(APL_GPIO_NORTH_OFFSET,
+   APL_GPIO_NORTH_NPIN * SZ_8, "apl_pinctrl_n"),
+   DEFINE_RES_MEM_NAMED(APL_GPIO_NORTHWEST_OFFSET,
+   APL_GPIO_NORTHWEST_NPIN * SZ_8, "apl_pinctrl_nw"),
+   DEFINE_RES_MEM_NAMED(APL_GPIO_WEST_OFFSET,
+   APL_GPIO_WEST_NPIN * SZ_8, "apl_pinctrl_w"),
+   DEFINE_RES_MEM_NAMED(APL_GPIO_SOUTHWEST_OFFSET,
+   APL_GPIO_SOUTHWEST_NPIN * SZ_8, "apl_pinctrl_sw"),
+   DEFINE_RES_IRQ(APL_GPIO_IRQ),
+};
+
+static struct pinctrl_pin_desc apl_pinctrl_pdata;
+
+static struct mfd_cell apl_gpio_devices[] = {
+   {
+   .name = "apl-pinctrl",
+   .id = 0,
+   .num_resources = ARRAY_SIZE(apl_gpio_io_res),
+   .resources = apl_gpio_io_res,
+   .pdata_size = sizeof(apl_pinctrl_pdata),
+   .platform_data = _pinctrl_pdata,
+   .ignore_resource_conflicts = true,
+   },
+   {
+   .name = "apl-pinctrl",
+   .id = 1,
+   .num_resources = ARRAY_SIZE(apl_gpio_io_res),
+ 

Re: [PATCH v5 0/7] /dev/random - a new approach

2016-06-20 Thread Theodore Ts'o
On Mon, Jun 20, 2016 at 09:00:49PM +0200, Stephan Mueller wrote:
> 
> The time stamp maintenance is the exact cause for the correlation: one HID 
> event triggers:
> 
> - add_interrupt_randomness which takes high-res time stamp, Jiffies and some 
> pointers
> 
> - add_input_randomness which takes high-res time stamp, Jiffies and HID event 
> value
> 
> The same applies to disk events. My suggestion is to get rid of the double 
> counting of time stamps for one event.
> 
> And I guess I do not need to stress that correlation of data that is supposed 
> to be entropic is not good :-)

What is your concern, specifically?  If it is in the entropy
accounting, there is more entropy in HID event interrupts, so I don't
think adding the extra 1/64th bit of entropy is going to be problematic.

If it is that there are two timestamps that are closely correleated
being added into the pool, the add_interrupt_randomness() path is
going to mix that timestamp with the interrupt timings from 63 other
interrupts before it is mixed into the input pool, while the
add_input_randomness() mixes it directly into the pool.  So if you
think there is a way this could be leveraged into attack, please give
specifics --- but I think we're on pretty solid ground here.

Cheers,

- Ted



[PATCH 1/5] PM / devfreq: make devfreq explicitly non-modular

2016-06-20 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

menuconfig PM_DEVFREQ
  bool "Generic Dynamic Voltage and Frequency Scaling (DVFS) support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

This code wasn't using module_init, so we don't need to be concerned
with altering the initcall level here.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

We don't replace module.h with init.h since the file already has that.
But we do add export.h since this file does export some symbols.

Cc: MyungJoo Ham 
Cc: Kyungmin Park 
Cc: linux...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/devfreq/devfreq.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 1d6c803804d5..6723f31c3973 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -15,7 +15,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -1198,13 +1198,6 @@ static int __init devfreq_init(void)
 }
 subsys_initcall(devfreq_init);
 
-static void __exit devfreq_exit(void)
-{
-   class_destroy(devfreq_class);
-   destroy_workqueue(devfreq_wq);
-}
-module_exit(devfreq_exit);
-
 /*
  * The followings are helper functions for devfreq user device drivers with
  * OPP framework.
@@ -1470,7 +1463,3 @@ void devm_devfreq_unregister_notifier(struct device *dev,
   devm_devfreq_dev_match, devfreq));
 }
 EXPORT_SYMBOL(devm_devfreq_unregister_notifier);
-
-MODULE_AUTHOR("MyungJoo Ham ");
-MODULE_DESCRIPTION("devfreq class support");
-MODULE_LICENSE("GPL");
-- 
2.8.4



[PATCH 0/5] PM / devfreq: remove modular references from non-modules

2016-06-20 Thread Paul Gortmaker
For anyone new to the underlying goal of this cleanup, we are trying to
not use module support for code that can never be built as a module since:

 (1) it is easy to accidentally write unused module_exit and remove code
 (2) it can be misleading when reading the source, thinking it can be
 modular when the Makefile and/or Kconfig prohibit it
 (3) it requires the include of the module.h header file which in turn
 includes nearly everything else, thus adding to CPP overhead.
 (4) it gets copied/replicated into other code and spreads like weeds.

We have already merged over 100 of these for mainline to date, so there
is really nothing new to see here, in terms of the type of change.

That said, devfreq changes seen here cover the following categories:

  -just replacement of modular macros with their non-modular
   equivalents that CPP would have inserted anyway

  -the removal of including module.h ; replaced with init.h
   and/or export.h as required based on whether the file used it.

  -the removal of any/all unused/orphaned __exit functions that
   would never be called.

  -the removal of any ".remove" functions that were hooked into
   the driver struct.   This ".remove" function would of
   course not be called from the __exit function since that was
   never run.  However in theory, someone could have triggered it
   via sysfs unbind, even though there isn't a sensible use case
   for doing so.  So to cover that possibility, we've also disabled
   sysfs unbind in the driver.

There are no initcall level changes here; everything stays at the level
of initcall it was previously - either by not using modular versions to
begin with, or by using the builtin level equivalents.

Build tested for arm and arm64 allmodconfig (for which all the drivers
touched here get coverage) on the linux-next tree from today to ensure
no silly typos crept in.

If there is a desire for any of these to be modular, we can definitely
consider that, but by default the changes here keep the code consistent
with existing behaviour.  Thus I do not expand functionality into the
modular realm that I can't run time test, or even know if the modular
instance has a sensible modular use case.

Paul.
---

Cc: Chanwoo Choi 
Cc: Krzysztof Kozlowski 
Cc: Kukjin Kim 
Cc: Kyungmin Park 
Cc: MyungJoo Ham 
Cc: linux...@vger.kernel.org
Cc: linux-samsung-...@vger.kernel.org


Paul Gortmaker (5):
  PM / devfreq: make devfreq explicitly non-modular
  PM / devfreq: make devfreq-event explicitly non-modular
  PM / devfreq: make exynos-bus explicitly non-modular
  PM / devfreq: make event/exynos-nocp explicitly non-modular
  PM / devfreq: make event/exynos-ppmu explicitly non-modular

 drivers/devfreq/devfreq-event.c | 12 +---
 drivers/devfreq/devfreq.c   | 13 +
 drivers/devfreq/event/exynos-nocp.c | 19 +++
 drivers/devfreq/event/exynos-ppmu.c |  8 ++--
 drivers/devfreq/exynos-bus.c|  9 ++---
 5 files changed, 9 insertions(+), 52 deletions(-)

-- 
2.8.4



[PATCH v4 0/3] pinctrl/broxton: enable platform device in the absent of ACPI enumeration

2016-06-20 Thread Tan Jui Nee
Hi,
The patches are to cater the need for non-ACPI system whereby
a platform device has to be created in order to bind with
Apollo Lake Pinctrl GPIO platform driver.

The MMIO BAR is accessed over the Primary to Sideband bridge
(P2SB). Since the BIOS prevents the P2SB device from being
enumerated by the PCI subsystem, so we need to hide/unhide P2SB
to lookup the P2SB BAR and pass the PCI BAR address to the gpio
platform driver.

All these three patches have dependencies on each other.

Changes in V4:
- Move Kconfig option CONFIG_X86_INTEL_NON_ACPI from
  [PATCH 2/3] x86/platform/p2sb: New Primary to Sideband bridge support 
driver for Intel SOC's
  to
  [PATCH 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO 
pinctrl in non-ACPI system
  since the config is used in latter patch.
- Select CONFIG_P2SB when CONFIG_LPC_ICH is enabled.
- Remove #ifdef CONFIG_X86_INTEL_NON_ACPI and use
  #if defined(CONFIG_X86_INTEL_NON_ACPI) when lpc_ich_misc is called
  as suggested by Lee Jones.
- Use single dimensional array instead of 2D array for apl_gpio_io_res
  structure and use DEFINE_RES_IRQ for its IRQ resource.

Changes in V3:
- Simplify register addresses calculation and use DEFINE_RES_MEM_NAMED
  defines for apl_gpio_io_res structure
- Define magic number for P2SB PCI ID
- Replace switch-case with if-else since currently we have only one
  use case
- Only call mfd_add_devices() once for all gpio communities

Changes in V2:
- Add new config option CONFIG_X86_INTEL_NON_ACPI and "select PINCTRL"
  to fix kbuildbot error

Andy Shevchenko (1):
  x86/platform/p2sb: New Primary to Sideband bridge support driver for
Intel SOC's

Tan Jui Nee (2):
  pinctrl/broxton: enable platform device in the absent of ACPI
enumeration
  mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in
non-ACPI system

 arch/x86/Kconfig|  14 
 arch/x86/include/asm/p2sb.h |  27 +++
 arch/x86/platform/intel/Makefile|   1 +
 arch/x86/platform/intel/p2sb.c  |  99 +
 drivers/mfd/Kconfig |   3 +-
 drivers/mfd/lpc_ich.c   | 126 
 drivers/pinctrl/intel/pinctrl-broxton.c |  43 ---
 7 files changed, 300 insertions(+), 13 deletions(-)
 create mode 100644 arch/x86/include/asm/p2sb.h
 create mode 100644 arch/x86/platform/intel/p2sb.c

-- 
1.9.1



[PATCH v4 0/3] pinctrl/broxton: enable platform device in the absent of ACPI enumeration

2016-06-20 Thread Tan Jui Nee
Hi,
The patches are to cater the need for non-ACPI system whereby
a platform device has to be created in order to bind with
Apollo Lake Pinctrl GPIO platform driver.

The MMIO BAR is accessed over the Primary to Sideband bridge
(P2SB). Since the BIOS prevents the P2SB device from being
enumerated by the PCI subsystem, so we need to hide/unhide P2SB
to lookup the P2SB BAR and pass the PCI BAR address to the gpio
platform driver.

All these three patches have dependencies on each other.

Changes in V4:
- Move Kconfig option CONFIG_X86_INTEL_NON_ACPI from
  [PATCH 2/3] x86/platform/p2sb: New Primary to Sideband bridge support 
driver for Intel SOC's
  to
  [PATCH 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO 
pinctrl in non-ACPI system
  since the config is used in latter patch.
- Select CONFIG_P2SB when CONFIG_LPC_ICH is enabled.
- Remove #ifdef CONFIG_X86_INTEL_NON_ACPI and use
  #if defined(CONFIG_X86_INTEL_NON_ACPI) when lpc_ich_misc is called
  as suggested by Lee Jones.
- Use single dimensional array instead of 2D array for apl_gpio_io_res
  structure and use DEFINE_RES_IRQ for its IRQ resource.

Changes in V3:
- Simplify register addresses calculation and use DEFINE_RES_MEM_NAMED
  defines for apl_gpio_io_res structure
- Define magic number for P2SB PCI ID
- Replace switch-case with if-else since currently we have only one
  use case
- Only call mfd_add_devices() once for all gpio communities

Changes in V2:
- Add new config option CONFIG_X86_INTEL_NON_ACPI and "select PINCTRL"
  to fix kbuildbot error

Andy Shevchenko (1):
  x86/platform/p2sb: New Primary to Sideband bridge support driver for
Intel SOC's

Tan Jui Nee (2):
  pinctrl/broxton: enable platform device in the absent of ACPI
enumeration
  mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in
non-ACPI system

 arch/x86/Kconfig|  14 
 arch/x86/include/asm/p2sb.h |  27 +++
 arch/x86/platform/intel/Makefile|   1 +
 arch/x86/platform/intel/p2sb.c  |  99 +
 drivers/mfd/Kconfig |   3 +-
 drivers/mfd/lpc_ich.c   | 126 
 drivers/pinctrl/intel/pinctrl-broxton.c |  43 ---
 7 files changed, 300 insertions(+), 13 deletions(-)
 create mode 100644 arch/x86/include/asm/p2sb.h
 create mode 100644 arch/x86/platform/intel/p2sb.c

-- 
1.9.1



[PATCH 26/27] [AARCH64] Change type of __align to long long

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

So that ILP32 is aligned to 64bits.

Signed-off-by: Yury Norov 
---
 sysdeps/aarch64/nptl/bits/semaphore.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdeps/aarch64/nptl/bits/semaphore.h 
b/sysdeps/aarch64/nptl/bits/semaphore.h
index 3cc5b37..3fe6047 100644
--- a/sysdeps/aarch64/nptl/bits/semaphore.h
+++ b/sysdeps/aarch64/nptl/bits/semaphore.h
@@ -31,5 +31,5 @@
 typedef union
 {
   char __size[__SIZEOF_SEM_T];
-  long int __align;
+  long long int __align;
 } sem_t;
-- 
2.7.4



[PATCH 26/27] [AARCH64] Change type of __align to long long

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

So that ILP32 is aligned to 64bits.

Signed-off-by: Yury Norov 
---
 sysdeps/aarch64/nptl/bits/semaphore.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdeps/aarch64/nptl/bits/semaphore.h 
b/sysdeps/aarch64/nptl/bits/semaphore.h
index 3cc5b37..3fe6047 100644
--- a/sysdeps/aarch64/nptl/bits/semaphore.h
+++ b/sysdeps/aarch64/nptl/bits/semaphore.h
@@ -31,5 +31,5 @@
 typedef union
 {
   char __size[__SIZEOF_SEM_T];
-  long int __align;
+  long long int __align;
 } sem_t;
-- 
2.7.4



[PATCH 27/27] Fix PTRDIFF_MIN/PTRDIFF_MIN and PTRDIFF_MIN for ILP32.

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

Signed-off-by: Andrew Pinski 
Signed-off-by: Yury Norov 
---
 sysdeps/aarch64/bits/wordsize.h | 8 +++-
 sysdeps/generic/stdint.h| 9 +++--
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
index 3d5a79d..18697e2 100644
--- a/sysdeps/aarch64/bits/wordsize.h
+++ b/sysdeps/aarch64/bits/wordsize.h
@@ -19,12 +19,10 @@
 # define __WORDSIZE64
 #else
 # define __WORDSIZE32
+# define __WORDSIZE32_SIZE_ULONG   1
+# define __WORDSIZE32_PTRDIFF_LONG 1
 #endif
 
-/* LP64 and ILP32s ABI uses a 64bit time_t.
-   This allows aarch32 and AARCH64 applications
+/* This allows ILP32 and AARCH64 applications
both access utmp. */
 #define __WORDSIZE_TIME64_COMPAT32 1
-
-/* LP64 and ILP32 use the 64bit system call interface. */
-#define __SYSCALL_WORDSIZE 64
diff --git a/sysdeps/generic/stdint.h b/sysdeps/generic/stdint.h
index 4427627..05f895a 100644
--- a/sysdeps/generic/stdint.h
+++ b/sysdeps/generic/stdint.h
@@ -248,8 +248,13 @@ typedef unsigned long long int uintmax_t;
 #  define PTRDIFF_MIN  (-9223372036854775807L-1)
 #  define PTRDIFF_MAX  (9223372036854775807L)
 # else
-#  define PTRDIFF_MIN  (-2147483647-1)
-#  define PTRDIFF_MAX  (2147483647)
+#  ifdef __WORDSIZE32_PTRDIFF_LONG
+#define PTRDIFF_MIN(-2147483647L-1)
+#define PTRDIFF_MAX(2147483647L)
+#  else
+#define PTRDIFF_MIN(-2147483647-1)
+#define PTRDIFF_MAX(2147483647)
+#  endif
 # endif
 
 /* Limits of `sig_atomic_t'.  */
-- 
2.7.4



[PATCH v4 1/3] pinctrl/broxton: enable platform device in the absent of ACPI enumeration

2016-06-20 Thread Tan Jui Nee
This is to cater the need for non-ACPI system whereby
a platform device has to be created in order to bind
with the Apollo Lake Pinctrl GPIO platform driver.

Signed-off-by: Tan Jui Nee 
Acked-by: Mika Westerberg 
---
Changes in V4:
- added Mika's ACK

Changes in V3:
- No change

Changes in V2:
- No change

 drivers/pinctrl/intel/pinctrl-broxton.c | 43 -
 1 file changed, 31 insertions(+), 12 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-broxton.c 
b/drivers/pinctrl/intel/pinctrl-broxton.c
index 5979d38..59cb7a6 100644
--- a/drivers/pinctrl/intel/pinctrl-broxton.c
+++ b/drivers/pinctrl/intel/pinctrl-broxton.c
@@ -1,7 +1,7 @@
 /*
  * Intel Broxton SoC pinctrl/GPIO driver
  *
- * Copyright (C) 2015, Intel Corporation
+ * Copyright (C) 2015, 2016 Intel Corporation
  * Author: Mika Westerberg 
  *
  * This program is free software; you can redistribute it and/or modify
@@ -1003,29 +1003,46 @@ static const struct acpi_device_id 
bxt_pinctrl_acpi_match[] = {
 };
 MODULE_DEVICE_TABLE(acpi, bxt_pinctrl_acpi_match);
 
+static const struct platform_device_id bxt_pinctrl_platform_ids[] = {
+   { "apl-pinctrl", (kernel_ulong_t)_pinctrl_soc_data },
+   { "broxton-pinctrl", (kernel_ulong_t)_pinctrl_soc_data },
+   { },
+};
+
 static int bxt_pinctrl_probe(struct platform_device *pdev)
 {
const struct intel_pinctrl_soc_data *soc_data = NULL;
const struct intel_pinctrl_soc_data **soc_table;
-   const struct acpi_device_id *id;
struct acpi_device *adev;
int i;
 
adev = ACPI_COMPANION(>dev);
-   if (!adev)
-   return -ENODEV;
+   if (adev) {
+   const struct acpi_device_id *id;
 
-   id = acpi_match_device(bxt_pinctrl_acpi_match, >dev);
-   if (!id)
-   return -ENODEV;
+   id = acpi_match_device(bxt_pinctrl_acpi_match, >dev);
+   if (!id)
+   return -ENODEV;
 
-   soc_table = (const struct intel_pinctrl_soc_data **)id->driver_data;
+   soc_table = (const struct intel_pinctrl_soc_data **)
+   id->driver_data;
 
-   for (i = 0; soc_table[i]; i++) {
-   if (!strcmp(adev->pnp.unique_id, soc_table[i]->uid)) {
-   soc_data = soc_table[i];
-   break;
+   for (i = 0; soc_table[i]; i++) {
+   if (!strcmp(adev->pnp.unique_id, soc_table[i]->uid)) {
+   soc_data = soc_table[i];
+   break;
+   }
}
+   } else {
+   const struct platform_device_id *pid;
+
+   pid = platform_get_device_id(pdev);
+   if (!pid)
+   return -ENODEV;
+
+   soc_table = (const struct intel_pinctrl_soc_data **)
+   pid->driver_data;
+   soc_data = soc_table[pdev->id];
}
 
if (!soc_data)
@@ -1047,6 +1064,7 @@ static struct platform_driver bxt_pinctrl_driver = {
.acpi_match_table = bxt_pinctrl_acpi_match,
.pm = _pinctrl_pm_ops,
},
+   .id_table = bxt_pinctrl_platform_ids,
 };
 
 static int __init bxt_pinctrl_init(void)
@@ -1064,3 +1082,4 @@ module_exit(bxt_pinctrl_exit);
 MODULE_AUTHOR("Mika Westerberg ");
 MODULE_DESCRIPTION("Intel Broxton SoC pinctrl/GPIO driver");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:broxton-pinctrl");
-- 
1.9.1



[PATCH 27/27] Fix PTRDIFF_MIN/PTRDIFF_MIN and PTRDIFF_MIN for ILP32.

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

Signed-off-by: Andrew Pinski 
Signed-off-by: Yury Norov 
---
 sysdeps/aarch64/bits/wordsize.h | 8 +++-
 sysdeps/generic/stdint.h| 9 +++--
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
index 3d5a79d..18697e2 100644
--- a/sysdeps/aarch64/bits/wordsize.h
+++ b/sysdeps/aarch64/bits/wordsize.h
@@ -19,12 +19,10 @@
 # define __WORDSIZE64
 #else
 # define __WORDSIZE32
+# define __WORDSIZE32_SIZE_ULONG   1
+# define __WORDSIZE32_PTRDIFF_LONG 1
 #endif
 
-/* LP64 and ILP32s ABI uses a 64bit time_t.
-   This allows aarch32 and AARCH64 applications
+/* This allows ILP32 and AARCH64 applications
both access utmp. */
 #define __WORDSIZE_TIME64_COMPAT32 1
-
-/* LP64 and ILP32 use the 64bit system call interface. */
-#define __SYSCALL_WORDSIZE 64
diff --git a/sysdeps/generic/stdint.h b/sysdeps/generic/stdint.h
index 4427627..05f895a 100644
--- a/sysdeps/generic/stdint.h
+++ b/sysdeps/generic/stdint.h
@@ -248,8 +248,13 @@ typedef unsigned long long int uintmax_t;
 #  define PTRDIFF_MIN  (-9223372036854775807L-1)
 #  define PTRDIFF_MAX  (9223372036854775807L)
 # else
-#  define PTRDIFF_MIN  (-2147483647-1)
-#  define PTRDIFF_MAX  (2147483647)
+#  ifdef __WORDSIZE32_PTRDIFF_LONG
+#define PTRDIFF_MIN(-2147483647L-1)
+#define PTRDIFF_MAX(2147483647L)
+#  else
+#define PTRDIFF_MIN(-2147483647-1)
+#define PTRDIFF_MAX(2147483647)
+#  endif
 # endif
 
 /* Limits of `sig_atomic_t'.  */
-- 
2.7.4



[PATCH v4 1/3] pinctrl/broxton: enable platform device in the absent of ACPI enumeration

2016-06-20 Thread Tan Jui Nee
This is to cater the need for non-ACPI system whereby
a platform device has to be created in order to bind
with the Apollo Lake Pinctrl GPIO platform driver.

Signed-off-by: Tan Jui Nee 
Acked-by: Mika Westerberg 
---
Changes in V4:
- added Mika's ACK

Changes in V3:
- No change

Changes in V2:
- No change

 drivers/pinctrl/intel/pinctrl-broxton.c | 43 -
 1 file changed, 31 insertions(+), 12 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-broxton.c 
b/drivers/pinctrl/intel/pinctrl-broxton.c
index 5979d38..59cb7a6 100644
--- a/drivers/pinctrl/intel/pinctrl-broxton.c
+++ b/drivers/pinctrl/intel/pinctrl-broxton.c
@@ -1,7 +1,7 @@
 /*
  * Intel Broxton SoC pinctrl/GPIO driver
  *
- * Copyright (C) 2015, Intel Corporation
+ * Copyright (C) 2015, 2016 Intel Corporation
  * Author: Mika Westerberg 
  *
  * This program is free software; you can redistribute it and/or modify
@@ -1003,29 +1003,46 @@ static const struct acpi_device_id 
bxt_pinctrl_acpi_match[] = {
 };
 MODULE_DEVICE_TABLE(acpi, bxt_pinctrl_acpi_match);
 
+static const struct platform_device_id bxt_pinctrl_platform_ids[] = {
+   { "apl-pinctrl", (kernel_ulong_t)_pinctrl_soc_data },
+   { "broxton-pinctrl", (kernel_ulong_t)_pinctrl_soc_data },
+   { },
+};
+
 static int bxt_pinctrl_probe(struct platform_device *pdev)
 {
const struct intel_pinctrl_soc_data *soc_data = NULL;
const struct intel_pinctrl_soc_data **soc_table;
-   const struct acpi_device_id *id;
struct acpi_device *adev;
int i;
 
adev = ACPI_COMPANION(>dev);
-   if (!adev)
-   return -ENODEV;
+   if (adev) {
+   const struct acpi_device_id *id;
 
-   id = acpi_match_device(bxt_pinctrl_acpi_match, >dev);
-   if (!id)
-   return -ENODEV;
+   id = acpi_match_device(bxt_pinctrl_acpi_match, >dev);
+   if (!id)
+   return -ENODEV;
 
-   soc_table = (const struct intel_pinctrl_soc_data **)id->driver_data;
+   soc_table = (const struct intel_pinctrl_soc_data **)
+   id->driver_data;
 
-   for (i = 0; soc_table[i]; i++) {
-   if (!strcmp(adev->pnp.unique_id, soc_table[i]->uid)) {
-   soc_data = soc_table[i];
-   break;
+   for (i = 0; soc_table[i]; i++) {
+   if (!strcmp(adev->pnp.unique_id, soc_table[i]->uid)) {
+   soc_data = soc_table[i];
+   break;
+   }
}
+   } else {
+   const struct platform_device_id *pid;
+
+   pid = platform_get_device_id(pdev);
+   if (!pid)
+   return -ENODEV;
+
+   soc_table = (const struct intel_pinctrl_soc_data **)
+   pid->driver_data;
+   soc_data = soc_table[pdev->id];
}
 
if (!soc_data)
@@ -1047,6 +1064,7 @@ static struct platform_driver bxt_pinctrl_driver = {
.acpi_match_table = bxt_pinctrl_acpi_match,
.pm = _pinctrl_pm_ops,
},
+   .id_table = bxt_pinctrl_platform_ids,
 };
 
 static int __init bxt_pinctrl_init(void)
@@ -1064,3 +1082,4 @@ module_exit(bxt_pinctrl_exit);
 MODULE_AUTHOR("Mika Westerberg ");
 MODULE_DESCRIPTION("Intel Broxton SoC pinctrl/GPIO driver");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:broxton-pinctrl");
-- 
1.9.1



[PATCH 06/27] [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

This converts dl-tlsdesc.S code over to use the new macros which allows for
sharing between ILP32 and LP64 code.

* sysdeps/aarch64/dl-tlsdesc.S (_dl_tlsdesc_return): Use PTR_REG.
(_dl_tlsdesc_undefweak): Use PTR_REG, PTR_SIZE.
(_dl_tlsdesc_dynamic): Likewise.
(_dl_tlsdesc_resolve_rela): Likewise.
(_dl_tlsdesc_resolve_hold): Likewise.

Signed-off-by: Yury Norov 
---
 sysdeps/aarch64/dl-tlsdesc.S | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
index 05be370..fe8a17d 100644
--- a/sysdeps/aarch64/dl-tlsdesc.S
+++ b/sysdeps/aarch64/dl-tlsdesc.S
@@ -74,7 +74,7 @@
cfi_startproc
.align 2
 _dl_tlsdesc_return:
-   ldr x0, [x0, #8]
+   ldr PTR_REG (0), [x0, #PTR_SIZE]
RET
cfi_endproc
.size   _dl_tlsdesc_return, .-_dl_tlsdesc_return
@@ -126,9 +126,9 @@ _dl_tlsdesc_undefweak:
   td->entry in _dl_tlsdesc_resolve_rela_fixup ensuring that the load
   from [x0,#8] here happens after the initialization of td->arg.  */
ldarxzr, [x0]
-   ldr x0, [x0, #8]
+   ldr PTR_REG (0), [x0, #PTR_SIZE]
mrs x1, tpidr_el0
-   sub x0, x0, x1
+   sub PTR_REG (0), PTR_REG (0), PTR_REG (1)
ldr x1, [sp], #16
cfi_adjust_cfa_offset (-16)
RET
@@ -189,20 +189,20 @@ _dl_tlsdesc_dynamic:
   td->entry in _dl_tlsdesc_resolve_rela_fixup ensuring that the load
   from [x0,#8] here happens after the initialization of td->arg.  */
ldarxzr, [x0]
-   ldr x1, [x0,#8]
-   ldr x0, [x4]
-   ldr x3, [x1,#16]
-   ldr x2, [x0]
-   cmp x3, x2
+   ldr PTR_REG (1), [x0,#PTR_SIZE]
+   ldr PTR_REG (0), [x4]
+   ldr PTR_REG (3), [x1,#(PTR_SIZE * 2)]
+   ldr PTR_REG (2), [x0]
+   cmp PTR_REG (3), PTR_REG (2)
b.hi2f
-   ldr x2, [x1]
-   add x0, x0, x2, lsl #4
-   ldr x0, [x0]
+   ldr PTR_REG (2), [x1]
+   add PTR_REG (0), PTR_REG (0), PTR_REG (2), lsl #(PTR_LOG_SIZE + 1)
+   ldr PTR_REG (0), [x0]
cmn x0, #0x1
b.eq2f
-   ldr x1, [x1,#8]
-   add x0, x0, x1
-   sub x0, x0, x4
+   ldr PTR_REG (1), [x1,#(PTR_SIZE * 2)]
+   add PTR_REG (0), PTR_REG (0), PTR_REG (1)
+   sub PTR_REG (0), PTR_REG (0), PTR_REG (4)
 1:
ldp  x1,  x2, [sp, #32+16*0]
ldp  x3,  x4, [sp, #32+16*1]
@@ -233,7 +233,7 @@ _dl_tlsdesc_dynamic:
bl  __tls_get_addr
 
mrs x1, tpidr_el0
-   sub x0, x0, x1
+   sub PTR_REG (0), PTR_REG (0), PTR_REG (1)
 
RESTORE_Q_REGISTERS
 
@@ -279,13 +279,13 @@ _dl_tlsdesc_resolve_rela:
 
SAVE_Q_REGISTERS
 
-   ldr x1, [x3, #8]
+   ldr PTR_REG (1), [x3, #PTR_SIZE]
bl  _dl_tlsdesc_resolve_rela_fixup
 
RESTORE_Q_REGISTERS
 
ldr x0, [sp, #32+16*8]
-   ldr x1, [x0]
+   ldr PTR_REG (1), [x0]
blr x1
 
ldp  x1,  x4, [sp, #32+16*0]
@@ -346,7 +346,7 @@ _dl_tlsdesc_resolve_hold:
RESTORE_Q_REGISTERS
 
ldr x0, [sp, #32+16*9]
-   ldr x1, [x0]
+   ldr PTR_REG (1), [x0]
blr x1
 
ldp  x1,  x2, [sp, #32+16*0]
-- 
2.7.4



[PATCH 09/27] [AARCH64] Use PTR_REG in getcontext.S.

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

Just like the other patches, this patch allows for getcontext.S to be used
between ILP32 and LP64.

* sysdeps/unix/sysv/linux/aarch64/getcontext.S: Use PTR_REG when
doing an add so wrapping of the pointer is correct for ILP32.

Signed-off-by: Yury Norov 
---
 sysdeps/unix/sysv/linux/aarch64/getcontext.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/aarch64/getcontext.S 
b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
index c2dd5b8..71e526c 100644
--- a/sysdeps/unix/sysv/linux/aarch64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
@@ -90,7 +90,7 @@ ENTRY(__getcontext)
 
/* Grab the signal mask */
/* rt_sigprocmask (SIG_BLOCK, NULL, >uc_sigmask, _NSIG8) */
-   add x2, x0, #UCONTEXT_SIGMASK
+   add PTR_REG (2), PTR_REG (0), #UCONTEXT_SIGMASK
mov x0, SIG_BLOCK
mov x1, 0
mov x3, _NSIG8
-- 
2.7.4



[PATCH 06/27] [AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

This converts dl-tlsdesc.S code over to use the new macros which allows for
sharing between ILP32 and LP64 code.

* sysdeps/aarch64/dl-tlsdesc.S (_dl_tlsdesc_return): Use PTR_REG.
(_dl_tlsdesc_undefweak): Use PTR_REG, PTR_SIZE.
(_dl_tlsdesc_dynamic): Likewise.
(_dl_tlsdesc_resolve_rela): Likewise.
(_dl_tlsdesc_resolve_hold): Likewise.

Signed-off-by: Yury Norov 
---
 sysdeps/aarch64/dl-tlsdesc.S | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
index 05be370..fe8a17d 100644
--- a/sysdeps/aarch64/dl-tlsdesc.S
+++ b/sysdeps/aarch64/dl-tlsdesc.S
@@ -74,7 +74,7 @@
cfi_startproc
.align 2
 _dl_tlsdesc_return:
-   ldr x0, [x0, #8]
+   ldr PTR_REG (0), [x0, #PTR_SIZE]
RET
cfi_endproc
.size   _dl_tlsdesc_return, .-_dl_tlsdesc_return
@@ -126,9 +126,9 @@ _dl_tlsdesc_undefweak:
   td->entry in _dl_tlsdesc_resolve_rela_fixup ensuring that the load
   from [x0,#8] here happens after the initialization of td->arg.  */
ldarxzr, [x0]
-   ldr x0, [x0, #8]
+   ldr PTR_REG (0), [x0, #PTR_SIZE]
mrs x1, tpidr_el0
-   sub x0, x0, x1
+   sub PTR_REG (0), PTR_REG (0), PTR_REG (1)
ldr x1, [sp], #16
cfi_adjust_cfa_offset (-16)
RET
@@ -189,20 +189,20 @@ _dl_tlsdesc_dynamic:
   td->entry in _dl_tlsdesc_resolve_rela_fixup ensuring that the load
   from [x0,#8] here happens after the initialization of td->arg.  */
ldarxzr, [x0]
-   ldr x1, [x0,#8]
-   ldr x0, [x4]
-   ldr x3, [x1,#16]
-   ldr x2, [x0]
-   cmp x3, x2
+   ldr PTR_REG (1), [x0,#PTR_SIZE]
+   ldr PTR_REG (0), [x4]
+   ldr PTR_REG (3), [x1,#(PTR_SIZE * 2)]
+   ldr PTR_REG (2), [x0]
+   cmp PTR_REG (3), PTR_REG (2)
b.hi2f
-   ldr x2, [x1]
-   add x0, x0, x2, lsl #4
-   ldr x0, [x0]
+   ldr PTR_REG (2), [x1]
+   add PTR_REG (0), PTR_REG (0), PTR_REG (2), lsl #(PTR_LOG_SIZE + 1)
+   ldr PTR_REG (0), [x0]
cmn x0, #0x1
b.eq2f
-   ldr x1, [x1,#8]
-   add x0, x0, x1
-   sub x0, x0, x4
+   ldr PTR_REG (1), [x1,#(PTR_SIZE * 2)]
+   add PTR_REG (0), PTR_REG (0), PTR_REG (1)
+   sub PTR_REG (0), PTR_REG (0), PTR_REG (4)
 1:
ldp  x1,  x2, [sp, #32+16*0]
ldp  x3,  x4, [sp, #32+16*1]
@@ -233,7 +233,7 @@ _dl_tlsdesc_dynamic:
bl  __tls_get_addr
 
mrs x1, tpidr_el0
-   sub x0, x0, x1
+   sub PTR_REG (0), PTR_REG (0), PTR_REG (1)
 
RESTORE_Q_REGISTERS
 
@@ -279,13 +279,13 @@ _dl_tlsdesc_resolve_rela:
 
SAVE_Q_REGISTERS
 
-   ldr x1, [x3, #8]
+   ldr PTR_REG (1), [x3, #PTR_SIZE]
bl  _dl_tlsdesc_resolve_rela_fixup
 
RESTORE_Q_REGISTERS
 
ldr x0, [sp, #32+16*8]
-   ldr x1, [x0]
+   ldr PTR_REG (1), [x0]
blr x1
 
ldp  x1,  x4, [sp, #32+16*0]
@@ -346,7 +346,7 @@ _dl_tlsdesc_resolve_hold:
RESTORE_Q_REGISTERS
 
ldr x0, [sp, #32+16*9]
-   ldr x1, [x0]
+   ldr PTR_REG (1), [x0]
blr x1
 
ldp  x1,  x2, [sp, #32+16*0]
-- 
2.7.4



[PATCH 09/27] [AARCH64] Use PTR_REG in getcontext.S.

2016-06-20 Thread Yury Norov
From: Andrew Pinski 

Just like the other patches, this patch allows for getcontext.S to be used
between ILP32 and LP64.

* sysdeps/unix/sysv/linux/aarch64/getcontext.S: Use PTR_REG when
doing an add so wrapping of the pointer is correct for ILP32.

Signed-off-by: Yury Norov 
---
 sysdeps/unix/sysv/linux/aarch64/getcontext.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/aarch64/getcontext.S 
b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
index c2dd5b8..71e526c 100644
--- a/sysdeps/unix/sysv/linux/aarch64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/aarch64/getcontext.S
@@ -90,7 +90,7 @@ ENTRY(__getcontext)
 
/* Grab the signal mask */
/* rt_sigprocmask (SIG_BLOCK, NULL, >uc_sigmask, _NSIG8) */
-   add x2, x0, #UCONTEXT_SIGMASK
+   add PTR_REG (2), PTR_REG (0), #UCONTEXT_SIGMASK
mov x0, SIG_BLOCK
mov x1, 0
mov x3, _NSIG8
-- 
2.7.4



  1   2   3   4   5   6   7   8   9   10   >