Skip to content
  1. Dec 07, 2017
  2. Dec 03, 2017
  3. Nov 29, 2017
  4. Nov 28, 2017
  5. Nov 27, 2017
  6. Nov 26, 2017
  7. Nov 21, 2017
    • Kees Cook's avatar
      treewide: setup_timer() -> timer_setup() · e99e88a9
      Kees Cook authored
      
      
      This converts all remaining cases of the old setup_timer() API into using
      timer_setup(), where the callback argument is the structure already
      holding the struct timer_list. These should have no behavioral changes,
      since they just change which pointer is passed into the callback with
      the same available pointers after conversion. It handles the following
      examples, in addition to some other variations.
      
      Casting from unsigned long:
      
          void my_callback(unsigned long data)
          {
              struct something *ptr = (struct something *)data;
          ...
          }
          ...
          setup_timer(&ptr->my_timer, my_callback, ptr);
      
      and forced object casts:
      
          void my_callback(struct something *ptr)
          {
          ...
          }
          ...
          setup_timer(&ptr->my_timer, my_callback, (unsigned long)ptr);
      
      become:
      
          void my_callback(struct timer_list *t)
          {
              struct something *ptr = from_timer(ptr, t, my_timer);
          ...
          }
          ...
          timer_setup(&ptr->my_timer, my_callback, 0);
      
      Direct function assignments:
      
          void my_callback(unsigned long data)
          {
              struct something *ptr = (struct something *)data;
          ...
          }
          ...
          ptr->my_timer.function = my_callback;
      
      have a temporary cast added, along with converting the args:
      
          void my_callback(struct timer_list *t)
          {
              struct something *ptr = from_timer(ptr, t, my_timer);
          ...
          }
          ...
          ptr->my_timer.function = (TIMER_FUNC_TYPE)my_callback;
      
      And finally, callbacks without a data assignment:
      
          void my_callback(unsigned long data)
          {
          ...
          }
          ...
          setup_timer(&ptr->my_timer, my_callback, 0);
      
      have their argument renamed to verify they're unused during conversion:
      
          void my_callback(struct timer_list *unused)
          {
          ...
          }
          ...
          timer_setup(&ptr->my_timer, my_callback, 0);
      
      The conversion is done with the following Coccinelle script:
      
      spatch --very-quiet --all-includes --include-headers \
      	-I ./arch/x86/include -I ./arch/x86/include/generated \
      	-I ./include -I ./arch/x86/include/uapi \
      	-I ./arch/x86/include/generated/uapi -I ./include/uapi \
      	-I ./include/generated/uapi --include ./include/linux/kconfig.h \
      	--dir . \
      	--cocci-file ~/src/data/timer_setup.cocci
      
      @fix_address_of@
      expression e;
      @@
      
       setup_timer(
      -&(e)
      +&e
       , ...)
      
      // Update any raw setup_timer() usages that have a NULL callback, but
      // would otherwise match change_timer_function_usage, since the latter
      // will update all function assignments done in the face of a NULL
      // function initialization in setup_timer().
      @change_timer_function_usage_NULL@
      expression _E;
      identifier _timer;
      type _cast_data;
      @@
      
      (
      -setup_timer(&_E->_timer, NULL, _E);
      +timer_setup(&_E->_timer, NULL, 0);
      |
      -setup_timer(&_E->_timer, NULL, (_cast_data)_E);
      +timer_setup(&_E->_timer, NULL, 0);
      |
      -setup_timer(&_E._timer, NULL, &_E);
      +timer_setup(&_E._timer, NULL, 0);
      |
      -setup_timer(&_E._timer, NULL, (_cast_data)&_E);
      +timer_setup(&_E._timer, NULL, 0);
      )
      
      @change_timer_function_usage@
      expression _E;
      identifier _timer;
      struct timer_list _stl;
      identifier _callback;
      type _cast_func, _cast_data;
      @@
      
      (
      -setup_timer(&_E->_timer, _callback, _E);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, &_callback, _E);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, _callback, (_cast_data)_E);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, &_callback, (_cast_data)_E);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, (_cast_func)_callback, _E);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, (_cast_func)&_callback, _E);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, (_cast_func)_callback, (_cast_data)_E);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, (_cast_func)&_callback, (_cast_data)_E);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E._timer, _callback, (_cast_data)_E);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, _callback, (_cast_data)&_E);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, &_callback, (_cast_data)_E);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, &_callback, (_cast_data)&_E);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)_E);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)&_E);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)_E);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)&_E);
      +timer_setup(&_E._timer, _callback, 0);
      |
       _E->_timer@_stl.function = _callback;
      |
       _E->_timer@_stl.function = &_callback;
      |
       _E->_timer@_stl.function = (_cast_func)_callback;
      |
       _E->_timer@_stl.function = (_cast_func)&_callback;
      |
       _E._timer@_stl.function = _callback;
      |
       _E._timer@_stl.function = &_callback;
      |
       _E._timer@_stl.function = (_cast_func)_callback;
      |
       _E._timer@_stl.function = (_cast_func)&_callback;
      )
      
      // callback(unsigned long arg)
      @change_callback_handle_cast
       depends on change_timer_function_usage@
      identifier change_timer_function_usage._callback;
      identifier change_timer_function_usage._timer;
      type _origtype;
      identifier _origarg;
      type _handletype;
      identifier _handle;
      @@
      
       void _callback(
      -_origtype _origarg
      +struct timer_list *t
       )
       {
      (
      	... when != _origarg
      	_handletype *_handle =
      -(_handletype *)_origarg;
      +from_timer(_handle, t, _timer);
      	... when != _origarg
      |
      	... when != _origarg
      	_handletype *_handle =
      -(void *)_origarg;
      +from_timer(_handle, t, _timer);
      	... when != _origarg
      |
      	... when != _origarg
      	_handletype *_handle;
      	... when != _handle
      	_handle =
      -(_handletype *)_origarg;
      +from_timer(_handle, t, _timer);
      	... when != _origarg
      |
      	... when != _origarg
      	_handletype *_handle;
      	... when != _handle
      	_handle =
      -(void *)_origarg;
      +from_timer(_handle, t, _timer);
      	... when != _origarg
      )
       }
      
      // callback(unsigned long arg) without existing variable
      @change_callback_handle_cast_no_arg
       depends on change_timer_function_usage &&
                           !change_callback_handle_cast@
      identifier change_timer_function_usage._callback;
      identifier change_timer_function_usage._timer;
      type _origtype;
      identifier _origarg;
      type _handletype;
      @@
      
       void _callback(
      -_origtype _origarg
      +struct timer_list *t
       )
       {
      +	_handletype *_origarg = from_timer(_origarg, t, _timer);
      +
      	... when != _origarg
      -	(_handletype *)_origarg
      +	_origarg
      	... when != _origarg
       }
      
      // Avoid already converted callbacks.
      @match_callback_converted
       depends on change_timer_function_usage &&
                  !change_callback_handle_cast &&
      	    !change_callback_handle_cast_no_arg@
      identifier change_timer_function_usage._callback;
      identifier t;
      @@
      
       void _callback(struct timer_list *t)
       { ... }
      
      // callback(struct something *handle)
      @change_callback_handle_arg
       depends on change_timer_function_usage &&
      	    !match_callback_converted &&
                  !change_callback_handle_cast &&
                  !change_callback_handle_cast_no_arg@
      identifier change_timer_function_usage._callback;
      identifier change_timer_function_usage._timer;
      type _handletype;
      identifier _handle;
      @@
      
       void _callback(
      -_handletype *_handle
      +struct timer_list *t
       )
       {
      +	_handletype *_handle = from_timer(_handle, t, _timer);
      	...
       }
      
      // If change_callback_handle_arg ran on an empty function, remove
      // the added handler.
      @unchange_callback_handle_arg
       depends on change_timer_function_usage &&
      	    change_callback_handle_arg@
      identifier change_timer_function_usage._callback;
      identifier change_timer_function_usage._timer;
      type _handletype;
      identifier _handle;
      identifier t;
      @@
      
       void _callback(struct timer_list *t)
       {
      -	_handletype *_handle = from_timer(_handle, t, _timer);
       }
      
      // We only want to refactor the setup_timer() data argument if we've found
      // the matching callback. This undoes changes in change_timer_function_usage.
      @unchange_timer_function_usage
       depends on change_timer_function_usage &&
                  !change_callback_handle_cast &&
                  !change_callback_handle_cast_no_arg &&
      	    !change_callback_handle_arg@
      expression change_timer_function_usage._E;
      identifier change_timer_function_usage._timer;
      identifier change_timer_function_usage._callback;
      type change_timer_function_usage._cast_data;
      @@
      
      (
      -timer_setup(&_E->_timer, _callback, 0);
      +setup_timer(&_E->_timer, _callback, (_cast_data)_E);
      |
      -timer_setup(&_E._timer, _callback, 0);
      +setup_timer(&_E._timer, _callback, (_cast_data)&_E);
      )
      
      // If we fixed a callback from a .function assignment, fix the
      // assignment cast now.
      @change_timer_function_assignment
       depends on change_timer_function_usage &&
                  (change_callback_handle_cast ||
                   change_callback_handle_cast_no_arg ||
                   change_callback_handle_arg)@
      expression change_timer_function_usage._E;
      identifier change_timer_function_usage._timer;
      identifier change_timer_function_usage._callback;
      type _cast_func;
      typedef TIMER_FUNC_TYPE;
      @@
      
      (
       _E->_timer.function =
      -_callback
      +(TIMER_FUNC_TYPE)_callback
       ;
      |
       _E->_timer.function =
      -&_callback
      +(TIMER_FUNC_TYPE)_callback
       ;
      |
       _E->_timer.function =
      -(_cast_func)_callback;
      +(TIMER_FUNC_TYPE)_callback
       ;
      |
       _E->_timer.function =
      -(_cast_func)&_callback
      +(TIMER_FUNC_TYPE)_callback
       ;
      |
       _E._timer.function =
      -_callback
      +(TIMER_FUNC_TYPE)_callback
       ;
      |
       _E._timer.function =
      -&_callback;
      +(TIMER_FUNC_TYPE)_callback
       ;
      |
       _E._timer.function =
      -(_cast_func)_callback
      +(TIMER_FUNC_TYPE)_callback
       ;
      |
       _E._timer.function =
      -(_cast_func)&_callback
      +(TIMER_FUNC_TYPE)_callback
       ;
      )
      
      // Sometimes timer functions are called directly. Replace matched args.
      @change_timer_function_calls
       depends on change_timer_function_usage &&
                  (change_callback_handle_cast ||
                   change_callback_handle_cast_no_arg ||
                   change_callback_handle_arg)@
      expression _E;
      identifier change_timer_function_usage._timer;
      identifier change_timer_function_usage._callback;
      type _cast_data;
      @@
      
       _callback(
      (
      -(_cast_data)_E
      +&_E->_timer
      |
      -(_cast_data)&_E
      +&_E._timer
      |
      -_E
      +&_E->_timer
      )
       )
      
      // If a timer has been configured without a data argument, it can be
      // converted without regard to the callback argument, since it is unused.
      @match_timer_function_unused_data@
      expression _E;
      identifier _timer;
      identifier _callback;
      @@
      
      (
      -setup_timer(&_E->_timer, _callback, 0);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, _callback, 0L);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, _callback, 0UL);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E._timer, _callback, 0);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, _callback, 0L);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, _callback, 0UL);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_timer, _callback, 0);
      +timer_setup(&_timer, _callback, 0);
      |
      -setup_timer(&_timer, _callback, 0L);
      +timer_setup(&_timer, _callback, 0);
      |
      -setup_timer(&_timer, _callback, 0UL);
      +timer_setup(&_timer, _callback, 0);
      |
      -setup_timer(_timer, _callback, 0);
      +timer_setup(_timer, _callback, 0);
      |
      -setup_timer(_timer, _callback, 0L);
      +timer_setup(_timer, _callback, 0);
      |
      -setup_timer(_timer, _callback, 0UL);
      +timer_setup(_timer, _callback, 0);
      )
      
      @change_callback_unused_data
       depends on match_timer_function_unused_data@
      identifier match_timer_function_unused_data._callback;
      type _origtype;
      identifier _origarg;
      @@
      
       void _callback(
      -_origtype _origarg
      +struct timer_list *unused
       )
       {
      	... when != _origarg
       }
      
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      e99e88a9
    • Kees Cook's avatar
      treewide: init_timer() -> setup_timer() · b9eaf187
      Kees Cook authored
      
      
      This mechanically converts all remaining cases of ancient open-coded timer
      setup with the old setup_timer() API, which is the first step in timer
      conversions. This has no behavioral changes, since it ultimately just
      changes the order of assignment to fields of struct timer_list when
      finding variations of:
      
          init_timer(&t);
          f.function = timer_callback;
          t.data = timer_callback_arg;
      
      to be converted into:
      
          setup_timer(&t, timer_callback, timer_callback_arg);
      
      The conversion is done with the following Coccinelle script, which
      is an improved version of scripts/cocci/api/setup_timer.cocci, in the
      following ways:
       - assignments-before-init_timer() cases
       - limit the .data case removal to the specific struct timer_list instance
       - handling calls by dereference (timer->field vs timer.field)
      
      spatch --very-quiet --all-includes --include-headers \
      	-I ./arch/x86/include -I ./arch/x86/include/generated \
      	-I ./include -I ./arch/x86/include/uapi \
      	-I ./arch/x86/include/generated/uapi -I ./include/uapi \
      	-I ./include/generated/uapi --include ./include/linux/kconfig.h \
      	--dir . \
      	--cocci-file ~/src/data/setup_timer.cocci
      
      @fix_address_of@
      expression e;
      @@
      
       init_timer(
      -&(e)
      +&e
       , ...)
      
      // Match the common cases first to avoid Coccinelle parsing loops with
      // "... when" clauses.
      
      @match_immediate_function_data_after_init_timer@
      expression e, func, da;
      @@
      
      -init_timer
      +setup_timer
       ( \(&e\|e\)
      +, func, da
       );
      (
      -\(e.function\|e->function\) = func;
      -\(e.data\|e->data\) = da;
      |
      -\(e.data\|e->data\) = da;
      -\(e.function\|e->function\) = func;
      )
      
      @match_immediate_function_data_before_init_timer@
      expression e, func, da;
      @@
      
      (
      -\(e.function\|e->function\) = func;
      -\(e.data\|e->data\) = da;
      |
      -\(e.data\|e->data\) = da;
      -\(e.function\|e->function\) = func;
      )
      -init_timer
      +setup_timer
       ( \(&e\|e\)
      +, func, da
       );
      
      @match_function_and_data_after_init_timer@
      expression e, e2, e3, e4, e5, func, da;
      @@
      
      -init_timer
      +setup_timer
       ( \(&e\|e\)
      +, func, da
       );
       ... when != func = e2
           when != da = e3
      (
      -e.function = func;
      ... when != da = e4
      -e.data = da;
      |
      -e->function = func;
      ... when != da = e4
      -e->data = da;
      |
      -e.data = da;
      ... when != func = e5
      -e.function = func;
      |
      -e->data = da;
      ... when != func = e5
      -e->function = func;
      )
      
      @match_function_and_data_before_init_timer@
      expression e, e2, e3, e4, e5, func, da;
      @@
      (
      -e.function = func;
      ... when != da = e4
      -e.data = da;
      |
      -e->function = func;
      ... when != da = e4
      -e->data = da;
      |
      -e.data = da;
      ... when != func = e5
      -e.function = func;
      |
      -e->data = da;
      ... when != func = e5
      -e->function = func;
      )
      ... when != func = e2
          when != da = e3
      -init_timer
      +setup_timer
       ( \(&e\|e\)
      +, func, da
       );
      
      @r1 exists@
      expression t;
      identifier f;
      position p;
      @@
      
      f(...) { ... when any
        init_timer@p(\(&t\|t\))
        ... when any
      }
      
      @r2 exists@
      expression r1.t;
      identifier g != r1.f;
      expression e8;
      @@
      
      g(...) { ... when any
        \(t.data\|t->data\) = e8
        ... when any
      }
      
      // It is dangerous to use setup_timer if data field is initialized
      // in another function.
      @script:python depends on r2@
      p << r1.p;
      @@
      
      cocci.include_match(False)
      
      @r3@
      expression r1.t, func, e7;
      position r1.p;
      @@
      
      (
      -init_timer@p(&t);
      +setup_timer(&t, func, 0UL);
      ... when != func = e7
      -t.function = func;
      |
      -t.function = func;
      ... when != func = e7
      -init_timer@p(&t);
      +setup_timer(&t, func, 0UL);
      |
      -init_timer@p(t);
      +setup_timer(t, func, 0UL);
      ... when != func = e7
      -t->function = func;
      |
      -t->function = func;
      ... when != func = e7
      -init_timer@p(t);
      +setup_timer(t, func, 0UL);
      )
      
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      b9eaf187
    • Kees Cook's avatar
      treewide: Switch DEFINE_TIMER callbacks to struct timer_list * · 24ed960a
      Kees Cook authored
      
      
      This changes all DEFINE_TIMER() callbacks to use a struct timer_list
      pointer instead of unsigned long. Since the data argument has already been
      removed, none of these callbacks are using their argument currently, so
      this renames the argument to "unused".
      
      Done using the following semantic patch:
      
      @match_define_timer@
      declarer name DEFINE_TIMER;
      identifier _timer, _callback;
      @@
      
       DEFINE_TIMER(_timer, _callback);
      
      @change_callback depends on match_define_timer@
      identifier match_define_timer._callback;
      type _origtype;
      identifier _origarg;
      @@
      
       void
      -_callback(_origtype _origarg)
      +_callback(struct timer_list *unused)
       { ... }
      
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      24ed960a
    • Philip Derrin's avatar
      ARM: 8722/1: mm: make STRICT_KERNEL_RWX effective for LPAE · 400eeffa
      Philip Derrin authored
      
      
      Currently, for ARM kernels with CONFIG_ARM_LPAE and
      CONFIG_STRICT_KERNEL_RWX enabled, the 2MiB pages mapping the
      kernel code and rodata are writable. They are marked read-only in
      a software bit (L_PMD_SECT_RDONLY) but the hardware read-only bit
      is not set (PMD_SECT_AP2).
      
      For user mappings, the logic that propagates the software bit
      to the hardware bit is in set_pmd_at(); but for the kernel,
      section_update() writes the PMDs directly, skipping this logic.
      
      The fix is to set PMD_SECT_AP2 for read-only sections in
      section_update(), at the same time as L_PMD_SECT_RDONLY.
      
      Fixes: 1e347922 ("ARM: 8275/1: mm: fix PMD_SECT_RDONLY undeclared compile error")
      Signed-off-by: default avatarPhilip Derrin <philip@cog.systems>
      Reported-by: default avatarNeil Dick <neil@cog.systems>
      Tested-by: default avatarNeil Dick <neil@cog.systems>
      Tested-by: default avatarLaura Abbott <labbott@redhat.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      400eeffa
    • Philip Derrin's avatar
      ARM: 8721/1: mm: dump: check hardware RO bit for LPAE · 3b0c0c92
      Philip Derrin authored
      
      
      When CONFIG_ARM_LPAE is set, the PMD dump relies on the software
      read-only bit to determine whether a page is writable. This
      concealed a bug which left the kernel text section writable
      (AP2=0) while marked read-only in the software bit.
      
      In a kernel with the AP2 bug, the dump looks like this:
      
          ---[ Kernel Mapping ]---
          0xc0000000-0xc0200000           2M RW NX SHD
          0xc0200000-0xc0600000           4M ro x  SHD
          0xc0600000-0xc0800000           2M ro NX SHD
          0xc0800000-0xc4800000          64M RW NX SHD
      
      The fix is to check that the software and hardware bits are both
      set before displaying "ro". The dump then shows the true perms:
      
          ---[ Kernel Mapping ]---
          0xc0000000-0xc0200000           2M RW NX SHD
          0xc0200000-0xc0600000           4M RW x  SHD
          0xc0600000-0xc0800000           2M RW NX SHD
          0xc0800000-0xc4800000          64M RW NX SHD
      
      Fixes: ded94779 ("ARM: 8109/1: mm: Modify pte_write and pmd_write logic for LPAE")
      Signed-off-by: default avatarPhilip Derrin <philip@cog.systems>
      Tested-by: default avatarNeil Dick <neil@cog.systems>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      3b0c0c92
    • Russell King's avatar
      ARM: make decompressor debug output user selectable · 29337b60
      Russell King authored
      
      
      Make the decompressor debug output user selectable, otherwise merely
      enabling DEBUG_LL causes the decompressor to become board specific,
      thereby preventing a multi-platform kernel from booting.  Enabling
      DEBUG_LL doesn't cause the kernel itself to become platform specific
      unless EARLY_PRINTK is enabled, or one of the debugging routines is
      added in a path that results in it being called.
      
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      29337b60
    • Russell King's avatar
      ARM: fix get_user_pages_fast · 1ee5e87f
      Russell King authored
      
      
      Ensure that get_user_pages_fast() is not able to access memory which
      has been mapped with PROT_NONE.
      
      Reported-by: default avatarAl Viro <viro@ZenIV.linux.org.uk>
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      1ee5e87f
  8. Nov 20, 2017
    • Arnd Bergmann's avatar
      ARM: dts: r8a779x: Add '#reset-cells' in cpg-mssr · 098f5305
      Arnd Bergmann authored
      
      
      With the latest dtc, we get many warnings about the missing
      '#reset-cells' property in these controllers, e.g.:
      
      arch/arm/boot/dts/r8a7790-lager.dtb: Warning (resets_property): Missing property '#reset-cells' in node /clock-controller@e6150000 or bad phandle (referred from /can@e6e80000:resets[0])
      arch/arm/boot/dts/r8a7792-blanche.dtb: Warning (resets_property): Missing property '#reset-cells' in node /soc/clock-controller@e6150000 or bad phandle (referred from /soc/dma-controller@e6700000:resets[0])
      arch/arm/boot/dts/r8a7792-wheat.dtb: Warning (resets_property): Missing property '#reset-cells' in node /soc/clock-controller@e6150000 or bad phandle (referred from /soc/ethernet@e6800000:resets[0])
      arch/arm/boot/dts/r8a7793-gose.dtb: Warning (resets_property): Missing property '#reset-cells' in node /clock-controller@e6150000 or bad phandle (referred from /gpio@e6050000:resets[0])
      arch/arm/boot/dts/r8a7794-alt.dtb: Warning (resets_property): Missing property '#reset-cells' in node /clock-controller@e6150000 or bad phandle (referred from /i2c@e6500000:resets[0])
      arch/arm/boot/dts/r8a7794-silk.dtb: Warning (resets_property): Missing property '#reset-cells' in node /clock-controller@e6150000 or bad phandle (referred from /interrupt-controller@e61c0000:resets[0])
      
      This adds it for the three r8a779x chips that were lacking it. The
      binding mandates this as <1>, so this is the value I use.
      
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      [geert: Add fix for r8a7793.dtsi]
      Fixes: 34fbd2b1 ("ARM: dts: r8a7790: Add reset control properties")
      Fixes: 6e11a322 ("ARM: dts: r8a7792: Add reset control properties")
      Fixes: 84fb19e1 ("ARM: dts: r8a7793: Add reset control properties")
      Fixes: 615beb75 ("ARM: dts: r8a7794: Add reset control properties")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      
      Signed-off-by: default avatarSimon Horman <horms+renesas@verge.net.au>
      098f5305
  9. Nov 18, 2017
  10. Nov 16, 2017
  11. Nov 15, 2017
  12. Nov 10, 2017
    • Tony Lindgren's avatar
      ARM: dts: Add remote-wakeup-connected for omap OHCI · 60636a5d
      Tony Lindgren authored
      
      
      Add remote-wakeup-connected for omap OHCI as that's needed by
      ohci-platform driver.
      
      Cc: devicetree@vger.kernel.org
      Cc: Hans de Goede <hdegoede@redhat.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
      Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Acked-by: default avatarRoger Quadros <rogerq@ti.com>
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      60636a5d
    • Rob Herring's avatar
      ARM: dts: am33xx: Add missing #phy-cells to ti,am335x-usb-phy · f0e11ff8
      Rob Herring authored
      
      
      "ti,am335x-usb-phy" is using the phy binding, but is missing #phy-cells
      property. Fixes the following warning in TI dts files:
      
      Warning (phys_property): Missing property '#phy-cells' in node ...
      
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Cc: "Benoît Cousson" <bcousson@baylibre.com>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: linux-omap@vger.kernel.org
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      f0e11ff8
    • Rob Herring's avatar
      ARM: dts: omap: Add missing #phy-cells to usb-nop-xceiv · f568f6f5
      Rob Herring authored
      
      
      "usb-nop-xceiv" is using the phy binding, but is missing #phy-cells
      property. This is probably because the binding was the precursor to the phy
      binding.
      
      Fixes the following warning in OMAP dts files:
      
      Warning (phys_property): Missing property '#phy-cells' in node ...
      
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Cc: "Benoît Cousson" <bcousson@baylibre.com>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Enric Balletbo i Serra <eballetbo@gmail.com>
      Cc: Javier Martinez Canillas <javier@dowhile0.org>
      Cc: linux-omap@vger.kernel.org
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      f568f6f5
    • Linus Walleij's avatar
      ARM: sa1100: simpad: Correct I2C GPIO offsets · d82e99a6
      Linus Walleij authored
      
      
      Arnd reported the following build bug bug:
      
      In file included from arch/arm/mach-sa1100/simpad.c:20:0:
      arch/arm/mach-sa1100/include/mach/SA-1100.h:1118:18: error: large
      integer implicitly truncated to unsigned type [-Werror=overflow]
                            (0x00000001 << (Nb))
                            ^
      include/linux/gpio/machine.h:56:16: note: in definition of macro
      'GPIO_LOOKUP_IDX'
      .chip_hwnum = _chip_hwnum,
                    ^~~~~~~~~~~
      arch/arm/mach-sa1100/include/mach/SA-1100.h:1140:21: note: in
      expansion of macro 'GPIO_GPIO'
                          ^~~~~~~~~
      arch/arm/mach-sa1100/simpad.c:331:27: note: in expansion of
      macro 'GPIO_GPIO21'
        GPIO_LOOKUP_IDX("gpio", GPIO_GPIO21, NULL, 0,
      
      This is what happened:
      
      commit b2e63555
      "i2c: gpio: Convert to use descriptors"
      commit 4d0ce62c
      "i2c: gpio: Augment all boardfiles to use open drain"
      together uncovered an old bug in the Simpad board
      file: as theGPIO_LOOKUP_IDX() encodes GPIO offsets
      on gpiochips in an u16 (see <linux/gpio/machine.h>)
      these GPIO "numbers" does not fit, since in
      arch/arm/mach-sa1100/include/mach/SA-1100.h it is
      defined as:
      
        #define GPIO_GPIO(Nb) (0x00000001 << (Nb))
        (...)
        #define GPIO_GPIO21 GPIO_GPIO(21) /* GPIO [21] */
      
      This is however provably wrong, since the i2c-gpio
      driver uses proper GPIO numbers, albeit earlier from
      the global number space, whereas this GPIO_GPIO21
      is the local line offset in the GPIO register, which
      is used in other code but certainly not in the
      gpiolib GPIO driver in drivers/gpio/gpio-sa1100.c, which
      has code like this:
      
      static void sa1100_gpio_set(struct gpio_chip *chip,
                                  unsigned offset, int value)
      {
          int reg = value ? R_GPSR : R_GPCR;
      
          writel_relaxed(BIT(offset),
              sa1100_gpio_chip(chip)->membase + reg);
      }
      
      So far everything however compiled fine as an unsigned
      int was used to pass the GPIO numbers in
      struct i2c_gpio_platform_data. We can trace the actual error
      back to
      
      commit dbd406f9
      "ARM: 7025/1: simpad: add GPIO based device definitions."
      This added the i2c_gpio with the wrong offsets.
      
      This commit was before the SA1100 was converted to use
      the gpiolib, but as can be seen from the contemporary
      gpio.c in mach-sa1100, it was already using:
      
      static int sa1100_gpio_get(struct gpio_chip *chip,
                                 unsigned offset)
      {
              return GPLR & GPIO_GPIO(offset);
      }
      
      And GPIO_GPIO() is essentially the BIT() macro.
      
      Reported-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      d82e99a6
    • Marc Zyngier's avatar
      KVM: arm/arm64: GICv4: Add init/teardown of the per-VM vPE irq domain · 74fe55dc
      Marc Zyngier authored
      
      
      In order to control the GICv4 view of virtual CPUs, we rely
      on an irqdomain allocated for that purpose. Let's add a couple
      of helpers to that effect.
      
      At the same time, the vgic data structures gain new fields to
      track all this... erm... wonderful stuff.
      
      The way we hook into the vgic init is slightly convoluted. We
      need the vgic to be initialized (in order to guarantee that
      the number of vcpus is now fixed), and we must have a vITS
      (otherwise this is all very pointless). So we end-up calling
      the init from both vgic_init and vgic_its_create.
      
      Reviewed-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
      Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
      74fe55dc
  13. Nov 09, 2017
    • Masahiro Yamada's avatar
      kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib · 7e7962dd
      Masahiro Yamada authored
      
      
      If CONFIG_OF_ALL_DTBS is enabled, "make ARCH=arm64 dtbs" compiles each
      DTB twice; one from arch/arm64/boot/dts/*/Makefile and the other from
      the dtb-$(CONFIG_OF_ALL_DTBS) line in arch/arm64/boot/dts/Makefile.
      It could be a race problem when building DTBS in parallel.
      
      Another minor issue is CONFIG_OF_ALL_DTBS covers only *.dts in vendor
      sub-directories, so this broke when Broadcom added one more hierarchy
      in arch/arm64/boot/dts/broadcom/<soc>/.
      
      One idea to fix the issues in a clean way is to move DTB handling
      to Kbuild core scripts.  Makefile.dtbinst already recognizes dtb-y
      natively, so it should not hurt to do so.
      
      Add $(dtb-y) to extra-y, and $(dtb-) as well if CONFIG_OF_ALL_DTBS is
      enabled.  All clutter things in Makefiles go away.
      
      As a bonus clean-up, I also removed dts-dirs.  Just use subdir-y
      directly to traverse sub-directories.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      [robh: corrected BUILTIN_DTB to CONFIG_BUILTIN_DTB]
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      7e7962dd
  14. Nov 08, 2017
  15. Nov 07, 2017
Loading