1. 16 9月, 2016 1 次提交
    • R
      iommu: Introduce iommu_fwspec · 57f98d2f
      Robin Murphy 提交于
      Introduce a common structure to hold the per-device firmware data that
      most IOMMU drivers need to keep track of. This enables us to configure
      much of that data from common firmware code, and consolidate a lot of
      the equivalent implementations, device look-up tables, etc. which are
      currently strewn across IOMMU drivers.
      
      This will also be enable us to address the outstanding "multiple IOMMUs
      on the platform bus" problem by tweaking IOMMU API calls to prefer
      dev->fwspec->ops before falling back to dev->bus->iommu_ops, and thus
      gracefully handle those troublesome systems which we currently cannot.
      
      As the first user, hook up the OF IOMMU configuration mechanism. The
      driver-defined nature of DT cells means that we still need the drivers
      to translate and add the IDs themselves, but future users such as the
      much less free-form ACPI IORT will be much simpler and self-contained.
      
      CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Suggested-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      57f98d2f
  2. 20 5月, 2016 1 次提交
    • R
      include/linux: apply __malloc attribute · 48a27055
      Rasmus Villemoes 提交于
      Attach the malloc attribute to a few allocation functions.  This helps
      gcc generate better code by telling it that the return value doesn't
      alias any existing pointers (which is even more valuable given the
      pessimizations implied by -fno-strict-aliasing).
      
      A simple example of what this allows gcc to do can be seen by looking at
      the last part of drm_atomic_helper_plane_reset:
      
      	plane->state = kzalloc(sizeof(*plane->state), GFP_KERNEL);
      
      	if (plane->state) {
      		plane->state->plane = plane;
      		plane->state->rotation = BIT(DRM_ROTATE_0);
      	}
      
      which compiles to
      
          e8 99 bf d6 ff          callq  ffffffff8116d540 <kmem_cache_alloc_trace>
          48 85 c0                test   %rax,%rax
          48 89 83 40 02 00 00    mov    %rax,0x240(%rbx)
          74 11                   je     ffffffff814015c4 <drm_atomic_helper_plane_reset+0x64>
          48 89 18                mov    %rbx,(%rax)
          48 8b 83 40 02 00 00    mov    0x240(%rbx),%rax [*]
          c7 40 40 01 00 00 00    movl   $0x1,0x40(%rax)
      
      With this patch applied, the instruction at [*] is elided, since the
      store to plane->state->plane is known to not alter the value of
      plane->state.
      
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      48a27055
  3. 02 5月, 2016 1 次提交
    • A
      driver-core: use 'dev' argument in dev_dbg_ratelimited stub · 1f62ff34
      Arnd Bergmann 提交于
      dev_dbg_ratelimited() is a macro that ignores its first argument when DEBUG is
      not set, which can lead to unused variable warnings:
      
      ethernet/mellanox/mlxsw/pci.c: In function 'mlxsw_pci_cqe_sdq_handle':
      ethernet/mellanox/mlxsw/pci.c:646:18: warning: unused variable 'pdev' [-Wunused-variable]
      ethernet/mellanox/mlxsw/pci.c: In function 'mlxsw_pci_cqe_rdq_handle':
      ethernet/mellanox/mlxsw/pci.c:671:18: warning: unused variable 'pdev' [-Wunused-variable]
      
      The macro already ensures that all its other arguments are silently
      ignored by the compiler without triggering a warning, through the
      use of the no_printk() macro, but the dev argument is not passed into
      that.
      
      This changes the definition to use the same trick as no_printk() with
      an if(0) that leads the compiler to not evaluate the side-effects but
      still see that 'dev' might not be unused.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Suggested-by: NAndrew Lunn <andrew@lunn.ch>
      Fixes: 6f586e66 ("driver-core: Shut up dev_dbg_reatelimited() without DEBUG")
      Reviewed-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1f62ff34
  4. 22 4月, 2016 1 次提交
  5. 17 2月, 2016 1 次提交
  6. 09 2月, 2016 1 次提交
  7. 04 2月, 2016 1 次提交
  8. 08 1月, 2016 1 次提交
  9. 09 12月, 2015 1 次提交
  10. 10 10月, 2015 1 次提交
  11. 06 8月, 2015 1 次提交
  12. 30 7月, 2015 1 次提交
  13. 28 7月, 2015 1 次提交
  14. 23 7月, 2015 1 次提交
  15. 18 7月, 2015 1 次提交
    • N
      include, lib: add __printf attributes to several function prototypes · 8db14860
      Nicolas Iooss 提交于
      Using __printf attributes helps to detect several format string issues
      at compile time (even though -Wformat-security is currently disabled in
      Makefile).  For example it can detect when formatting a pointer as a
      number, like the issue fixed in commit a3fa71c4 ("wl18xx: show
      rx_frames_per_rates as an array as it really is"), or when the arguments
      do not match the format string, c.f.  for example commit 5ce1aca8
      ("reiserfs: fix __RASSERT format string").
      
      To prevent similar bugs in the future, add a __printf attribute to every
      function prototype which needs one in include/linux/ and lib/.  These
      functions were mostly found by using gcc's -Wsuggest-attribute=format
      flag.
      Signed-off-by: NNicolas Iooss <nicolas.iooss_linux@m4x.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Felipe Balbi <balbi@ti.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8db14860
  16. 17 6月, 2015 1 次提交
    • P
      platform_device: better support builtin boilerplate avoidance · f309d444
      Paul Gortmaker 提交于
      We have macros that help reduce the boilerplate for modules
      that register with no extra init/exit complexity other than the
      most standard use case.  However we see an increasing number of
      non-modular drivers using these modular_driver() type register
      functions.
      
      There are several downsides to this:
      1) The code can appear modular to a reader of the code, and they
         won't know if the code really is modular without checking the
         Makefile and Kconfig to see if compilation is governed by a
         bool or tristate.
      2) Coders of drivers may be tempted to code up an __exit function
         that is never used, just in order to satisfy the required three
         args of the modular registration function.
      3) Non-modular code ends up including the <module.h> which increases
         CPP overhead that they don't need.
      4) It hinders us from performing better separation of the module
         init code and the generic init code.
      
      Here we introduce similar macros, with the mapping from module_driver
      to builtin_driver and similar, so that simple changes of:
      
        module_platform_driver()       --->  builtin_platform_driver()
        module_platform_driver_probe() --->  builtin_platform_driver_probe().
      
      can help us avoid #3 above, without having to code up the same
      __init functions and device_initcall() boilerplate.
      
      For non modular code, module_init becomes __initcall.  But direct use
      of __initcall is discouraged, vs. one of the priority categorized
      subgroups.  As __initcall gets mapped onto device_initcall, our
      use of device_initcall directly in this change means that the
      runtime impact is zero -- drivers will remain at level 6 in the
      initcall ordering.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      f309d444
  17. 20 5月, 2015 3 次提交
    • L
      driver-core: enable drivers to opt-out of async probe · d173a137
      Luis R. Rodriguez 提交于
      There are drivers that can not be probed asynchronously. One such group
      is platform drivers registered with platform_driver_probe(), which
      expects driver's probe routine be discarded after the driver has been
      registered and initial binding attempt executed. Also
      platform_driver_probe() an error when no devices were bound to the
      driver, allowing failing to load such driver module altogether.
      
      Other drivers do not work well with asynchronous probing because of
      driver bug or not optimal driver organization.
      
      To allow using such drivers even when user requests asynchronous probing
      as default boot strategy, let's allow them to opt out.
      Signed-off-by: NLuis R. Rodriguez <mcgrof@suse.com>
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d173a137
    • L
      driver-core: add driver module asynchronous probe support · f2411da7
      Luis R. Rodriguez 提交于
      Some init systems may wish to express the desire to have device drivers
      run their probe() code asynchronously. This implements support for this
      and allows userspace to request async probe as a preference through a
      generic shared device driver module parameter, async_probe.
      
      Implementation for async probe is supported through a module parameter
      given that since synchronous probe has been prevalent for years some
      userspace might exist which relies on the fact that the device driver
      will probe synchronously and the assumption that devices it provides
      will be immediately available after this.
      Signed-off-by: NLuis R. Rodriguez <mcgrof@suse.com>
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f2411da7
    • D
      driver-core: add asynchronous probing support for drivers · 765230b5
      Dmitry Torokhov 提交于
      Some devices take a long time when initializing, and not all drivers are
      suited to initialize their devices when they are open. For example,
      input drivers need to interrogate their devices in order to publish
      device's capabilities before userspace will open them. When such drivers
      are compiled into kernel they may stall entire kernel initialization.
      
      This change allows drivers request for their probe functions to be
      called asynchronously during driver and device registration (manual
      binding is still synchronous). Because async_schedule is used to perform
      asynchronous calls module loading will still wait for the probing to
      complete.
      
      Note that the end goal is to make the probing asynchronous by default,
      so annotating drivers with PROBE_PREFER_ASYNCHRONOUS is a temporary
      measure that allows us to speed up boot process while we validating and
      fixing the rest of the drivers and preparing userspace.
      
      This change is based on earlier patch by "Luis R. Rodriguez"
      <mcgrof@suse.com>
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      765230b5
  18. 04 4月, 2015 1 次提交
    • R
      device property: Make it possible to use secondary firmware nodes · 97badf87
      Rafael J. Wysocki 提交于
      Add a secondary pointer to struct fwnode_handle so as to make it
      possible for a device to have two firmware nodes associated with
      it at the same time, for example, an ACPI node and a node with
      a set of properties provided by platform initialization code.
      
      In the future that will allow device property lookup to fall back
      from the primary firmware node to the secondary one if the given
      property is not present there to make it easier to provide defaults
      for device properties used by device drivers.
      
      Introduce two helper routines, set_primary_fwnode() and
      set_secondary_fwnode() allowing callers to add a primary/secondary
      firmware node to the given device in such a way that
      
       (1) If there's only one firmware node for that device, it will be
           pointed to by the device's firmware node pointer.
       (2) If both the primary and secondary firmware nodes are present,
           the primary one will be pointed to by the device's firmware
           node pointer, while the secondary one will be pointed to by the
           primary node's secondary pointer.
       (3) If one of these nodes is removed (by calling one of the new
           nelpers with NULL as the second argument), the other one will
           be preserved.
      
      Make ACPI use set_primary_fwnode() for attaching its firmware nodes
      to devices.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      97badf87
  19. 25 3月, 2015 1 次提交
  20. 17 3月, 2015 1 次提交
  21. 27 1月, 2015 2 次提交
  22. 04 12月, 2014 1 次提交
  23. 27 11月, 2014 1 次提交
  24. 02 10月, 2014 1 次提交
    • J
      driver core: Add BUS_NOTIFY_REMOVED_DEVICE event · 599bad38
      Joerg Roedel 提交于
      This event closes an important gap in the bus notifiers.
      There is already the BUS_NOTIFY_DEL_DEVICE event, but that
      is sent when the device is still bound to its device driver.
      
      This is too early for the IOMMU code to destroy any mappings
      for the device, as they might still be in use by the driver.
      
      The new BUS_NOTIFY_REMOVED_DEVICE event introduced with this
      patch closes this gap as it is sent when the device is
      already unbound from its device driver and almost completly
      removed from the driver core.
      
      With this event the IOMMU code can safely destroy any
      mappings and other data structures when a device is removed.
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Tested-by: NJerry Hoemann <jerry.hoemann@hp.com>
      599bad38
  25. 24 9月, 2014 1 次提交
  26. 18 7月, 2014 1 次提交
  27. 07 7月, 2014 1 次提交
  28. 20 6月, 2014 1 次提交
  29. 28 5月, 2014 3 次提交
  30. 24 5月, 2014 1 次提交
  31. 06 5月, 2014 1 次提交
    • S
      device: introduce per device dma_pfn_offset · 8febcaa2
      Santosh Shilimkar 提交于
      On few architectures, there are few restrictions on DMAble area of system
      RAM. That also means that devices needs to know about this restrictions so
      that the dma_masks can be updated accordingly and dma address translation
      helpers can add/subtract the dma offset.
      
      In most of cases DMA addresses can be performed using offset value of
      Bus address space relatively to physical address space as following:
      
      PFN->DMA:  __pfn_to_phys(pfn + [-]dma_pfn_offset)
      DMA->PFN:  __phys_to_pfn(dma_addr) + [-]dma_pfn_offset
      
      So we introduce per device dma_pfn_offset which can be popullated
      by architecture init code while creating the devices.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Olof Johansson <olof@lixom.net>
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Reviewed-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
      8febcaa2
  32. 30 4月, 2014 1 次提交
  33. 17 4月, 2014 1 次提交
  34. 26 3月, 2014 1 次提交
  35. 12 2月, 2014 1 次提交