1. 23 2月, 2015 1 次提交
  2. 21 2月, 2015 3 次提交
  3. 20 2月, 2015 23 次提交
    • L
      thermal: exynos: fix: Check if data->tmu_read callback is present before read · 4531fa16
      Lukasz Majewski 提交于
      The exynos_tmu_data() function should on entrance test not only for valid
      data pointer, but also for data->tmu_read one.
      It is important, since afterwards it is dereferenced to get temperature code.
      Signed-off-by: NLukasz Majewski <l.majewski@samsung.com>
      Tested-by: NAbhilash Kesavan <a.kesavan@samsung.com>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      4531fa16
    • D
      Infiniband: Fix potential NULL d_inode dereference · a95104fd
      David Howells 提交于
      Code that does this:
      
      	if (!(d_unhashed(tmp) && tmp->d_inode)) {
      		...
      		simple_unlink(parent->d_inode, tmp);
      	}
      
      is broken because:
      
      	!(d_unhashed(tmp) && tmp->d_inode)
      
      is equivalent to:
      
      	!d_unhashed(tmp) || !tmp->d_inode
      
      so it is possible to get into simple_unlink() with tmp->d_inode == NULL.
      
      simple_unlink(), however, assumes tmp->d_inode cannot be NULL.
      
      I think that what was meant is this:
      
      	!d_unhashed(tmp) && tmp->d_inode
      
      and that the logical-not operator or the final close-bracket was misplaced.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      cc: Bryan O'Sullivan <bos@pathscale.com>
      cc: Roland Dreier <rolandd@cisco.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      a95104fd
    • T
      clk: Only recalculate the rate if needed · ec02ace8
      Tomeu Vizoso 提交于
      We don't really need to recalculate the effective rate of a clock when a
      per-user clock is removed, if the constraints of the later aren't
      limiting the requested rate.
      
      This was causing problems with clocks that never had a rate set before,
      as rate_req would be zero. Though this could be considered a bug in the
      implementation of those clocks, this should be checked somewhere else.
      
      Fixes: 1c8e6004 ("clk: Add rate constraints to clocks")
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
      Signed-off-by: NTomeu Vizoso <tomeu.vizoso@collabora.com>
      Signed-off-by: NMichael Turquette <mturquette@linaro.org>
      ec02ace8
    • C
      ipmi: Fix a memory ordering issue · 1d86e29b
      Corey Minyard 提交于
      From a locking point of view it is safe to check waiting_msg without
      a lock, but there is a memory ordering issue that causes it to
      possibly not be set right when viewed from another processor.  We are
      already claiming a lock right after that, move the check to inside
      the lock to enforce the memory ordering.
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      1d86e29b
    • J
      ipmi: Remove uses of return value of seq_printf · d6c5dc18
      Joe Perches 提交于
      The seq_printf like functions will soon be changed to return void.
      
      Convert these uses to check seq_has_overflowed instead.
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      d6c5dc18
    • T
      ipmi: Use is_visible callback for conditional sysfs entries · 2d06a0c9
      Takashi Iwai 提交于
      Instead of manual calls of device_create_file() and
      device_remove_file(), implement the condition in is_visible callback
      for the attribute group and put these entries to the group, too.
      This simplifies the code and avoids the possible races.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      2d06a0c9
    • N
      ipmi: Free ipmi_recv_msg messages from the linked list on close · bdf2829c
      Nicholas Krause 提交于
      This adds a loop through the elements in the linked list, recv_msgs using
      list_for_entry_safe in order to free messages in this list.  In addition
      we are using the safe version of this marco in order to prevent use after
      bugs related to deleting the element we are on currently by holding a
      pointer to the next element after the current one we are on and freeing
      with the function, ipmi_free_recv_msg internally in this loop.
      Signed-off-by: NNicholas Krause <xerofoify@gmail.com>
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      bdf2829c
    • A
      ipmi: avoid gcc warning · 191cc414
      Arnd Bergmann 提交于
      A new harmless warning has come up on ARM builds with gcc-4.9:
      
      drivers/char/ipmi/ipmi_msghandler.c: In function 'smi_send.isra.11':
      include/linux/spinlock.h:372:95: warning: 'flags' may be used uninitialized in this function [-Wmaybe-uninitialized]
        raw_spin_unlock_irqrestore(&lock->rlock, flags);
                                                                                                     ^
      drivers/char/ipmi/ipmi_msghandler.c:1490:16: note: 'flags' was declared here
        unsigned long flags;
                      ^
      
      This could be worked around by initializing the 'flags' variable, but it
      seems better to rework the code to avoid this.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Fixes: 7ea0ed2b ("ipmi: Make the message handler easier to use for SMI interfaces")
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      191cc414
    • J
      ipmi: Update timespec usage to timespec64 · 48862ea2
      John Stultz 提交于
      As part of the internal y2038 cleanup, this patch removes
      timespec usage in the ipmi driver, replacing it timespec64
      
      Cc: openipmi-developer@lists.sourceforge.net
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NCorey Minyard <minyard@mvista.com>
      48862ea2
    • J
      ipmi: Cleanup DEBUG_TIMING ifdef usage · f93aae9f
      John Stultz 提交于
      The driver uses #ifdef DEBUG_TIMING in order to conditionally print out
      timestamped debug messages. Unfortunately it adds the ifdefs all over the
      usage sites.
      
      This patch cleans it up by adding a debug_timestamp() function which
      is compiled out if DEBUG_TIMING isn't present. This cleans up all
      the ugly ifdefs in the function logic.
      
      Cc: openipmi-developer@lists.sourceforge.net
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NCorey Minyard <minyard@mvista.com>
      f93aae9f
    • N
      drivers:char:ipmi: Remove unneeded FIXME comment in the file,ipmi_si_intf.c · 31013fa9
      Nicholas Krause 提交于
      Removes a no longer needed FIXME comment in the function,acpi_gpe_irq_setup
      for the file,ipmi_si_intf.c. This comment is no longer needed as clearly we
      are passing the correct level of  ACPI_GPE_LEVEL_TRIGGERED to the installer
      function,acpi_install_gpe_handler due to no breakage after years of using
      this ACPI level in the function,acpi_install_gpe_handler.
      Signed-off-by: NNicholas Krause <xerofoify@gmail.com>
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      31013fa9
    • W
      char: ipmi: Remove obsolete cleanup for clientdata · bb82d90e
      Wolfram Sang 提交于
      A few new i2c-drivers came into the kernel which clear the clientdata-pointer
      on exit or error. This is obsolete meanwhile, the core will do it.
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      bb82d90e
    • C
      ipmi: Remove a FIXME for slab conversion · 2fcaf60c
      Corey Minyard 提交于
      There can't be more than a few IPMI messages allocated at any one time,
      so converting the messages to slabs would be a waste.  So just remove
      the FIXME.
      Suggested-by: NNicholas Krause <xerofoify@gmail.com>
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      2fcaf60c
    • K
      NVMe: Fix potential corruption on sync commands · 0c0f9b95
      Keith Busch 提交于
      This makes all sync commands uninterruptible and schedules without timeout
      so the controller either has to post a completion or the timeout recovery
      fails the command. This fixes potential memory or data corruption from
      a command timing out too early or woken by a signal. Previously any DMA
      buffers mapped for that command would have been released even though we
      don't know what the controller is planning to do with those addresses.
      Signed-off-by: NKeith Busch <keith.busch@intel.com>
      0c0f9b95
    • K
      NVMe: Remove unused variables · 48328518
      Keith Busch 提交于
      We don't track queues in a llist, subscribe to hot-cpu notifications,
      or internally retry commands. Delete the unused artifacts.
      Signed-off-by: NKeith Busch <keith.busch@intel.com>
      48328518
    • K
      NVMe: Fix scsi mode select llbaa setting · 9ac16938
      Keith Busch 提交于
      It should be a logical bitwise AND, not conditional.
      Signed-off-by: NKeith Busch <keith.busch@intel.com>
      9ac16938
    • K
      NVMe: Fix potential corruption during shutdown · 07836e65
      Keith Busch 提交于
      The driver has to end unreturned commands at some point even if the
      controller has not provided a completion. The driver tried to be safe by
      deleting IO queues prior to ending all unreturned commands. That should
      cause the controller to internally abort inflight commands, but IO queue
      deletion request does not have to be successful, so all bets are off. We
      still have to make progress, so to be extra safe, this patch doesn't
      clear a queue to release the dma mapping for a command until after the
      pci device has been disabled.
      
      This patch removes the special handling during device initialization
      so controller recovery can be done all the time. This is possible since
      initialization is not inlined with pci probe anymore.
      Reported-by: NNilish Choudhury <nilesh.choudhury@oracle.com>
      Signed-off-by: NKeith Busch <keith.busch@intel.com>
      07836e65
    • K
      NVMe: Asynchronous controller probe · 2e1d8448
      Keith Busch 提交于
      This performs the longest parts of nvme device probe in scheduled work.
      This speeds up probe significantly when multiple devices are in use.
      Signed-off-by: NKeith Busch <keith.busch@intel.com>
      2e1d8448
    • K
      NVMe: Register management handle under nvme class · b3fffdef
      Keith Busch 提交于
      This creates a new class type for nvme devices to register their
      management character devices with. This is so we do not rely on miscdev
      to provide enough minors for as many nvme devices some people plan to
      use. The previous limit was approximately 60 NVMe controllers, depending
      on the platform and kernel. Now the limit is 1M, which ought to be enough
      for anybody.
      
      Since we have a new device class, it makes sense to attach the block
      devices under this as well, so part of this patch moves the management
      handle initialization prior to the namespaces discovery.
      Signed-off-by: NKeith Busch <keith.busch@intel.com>
      b3fffdef
    • K
      NVMe: Update SCSI Inquiry VPD 83h translation · 4f1982b4
      Keith Busch 提交于
      The original translation created collisions on Inquiry VPD 83 for many
      existing devices. Newer specifications provide other ways to translate
      based on the device's version can be used to create unique identifiers.
      
      Version 1.1 provides an EUI64 field that uniquely identifies each
      namespace, and 1.2 added the longer NGUID field for the same reason.
      Both follow the IEEE EUI format and readily translate to the SCSI device
      identification EUI designator type 2h. For devices implementing either,
      the translation will use this type, defaulting to the EUI64 8-byte type if
      implemented then NGUID's 16 byte version if not. If neither are provided,
      the 1.0 translation is used, and is updated to use the SCSI String format
      to guarantee a unique identifier.
      
      Knowing when to use the new fields depends on the nvme controller's
      revision. The NVME_VS macro was not decoding this correctly, so that is
      fixed in this patch and moved to a more appropriate place.
      
      Since the Identify Namespace structure required an update for the NGUID
      field, this patch adds the remaining new 1.2 fields to the structure.
      Signed-off-by: NKeith Busch <keith.busch@intel.com>
      4f1982b4
    • K
      NVMe: Metadata format support · e1e5e564
      Keith Busch 提交于
      Adds support for NVMe metadata formats and exposes block devices for
      all namespaces regardless of their format. Namespace formats that are
      unusable will have disk capacity set to 0, but a handle to the block
      device is created to simplify device management. A namespace is not
      usable when the format requires host interleave block and metadata in
      single buffer, has no provisioned storage, or has better data but failed
      to register with blk integrity.
      
      The namespace has to be scanned in two phases to support separate
      metadata formats. The first establishes the sector size and capacity
      prior to invoking add_disk. If metadata is required, the capacity will
      be temporarilly set to 0 until it can be revalidated and registered with
      the integrity extenstions after add_disk completes.
      
      The driver relies on the integrity extensions to provide the metadata
      buffer. NVMe requires this be a single physically contiguous region,
      so only one integrity segment is allowed per command. If the metadata
      is used for T10 PI, the driver provides mappings to save and restore
      the reftag physical block translation. The driver provides no-op
      functions for generate and verify if metadata is not used for protection
      information. This way the setup is always provided by the block layer.
      
      If a request does not supply a required metadata buffer, the command
      is failed with bad address. This could only happen if a user manually
      disables verify/generate on such a disk. The only exception to where
      this is okay is if the controller is capable of stripping/generating
      the metadata, which is possible on some types of formats.
      
      The metadata scatter gather list now occupies the spot in the nvme_iod
      that used to be used to link retryable IOD's, but we don't do that
      anymore, so the field was unused.
      Signed-off-by: NKeith Busch <keith.busch@intel.com>
      e1e5e564
    • P
      cpuidle: powernv: Avoid endianness conversions while parsing DT · 70734a78
      Preeti U Murthy 提交于
      We currently read the information about idle states from the DT
      so as to populate the cpuidle table. Use those APIs to read from
      the DT that can avoid endianness conversions of the property values
      in the cpuidle driver.
      Signed-off-by: NPreeti U Murthy <preeti@linux.vnet.ibm.com>
      Acked-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      70734a78
    • W
      i2c: designware-baytrail: another fixup for proper Kconfig dependencies · b4ad0510
      Wolfram Sang 提交于
      IOSF_MBI is tristate. Baytrail driver isn't.
      Reported-by: NRandy Dunlap <rdunlap@infradead.org>
      Acked-by: NDavid E. Box <david.e.box@linux.intel.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      b4ad0510
  4. 19 2月, 2015 13 次提交
    • C
      rbd: convert to blk-mq · 7ad18afa
      Christoph Hellwig 提交于
      This converts the rbd driver to use the blk-mq infrastructure.  Except
      for switching to a per-request work item this is almost mechanical.
      
      This was tested by Alexandre DERUMIER in November, and found to give
      him 120000 iops, although the only comparism available was an old
      3.10 kernel which gave 80000iops.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NAlex Elder <elder@linaro.org>
      [idryomov@gmail.com: context, blk_mq_init_queue() EH]
      Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
      7ad18afa
    • I
      rbd: do not treat standalone as flatten · cf32bd9c
      Ilya Dryomov 提交于
      If the clone is resized down to 0, it becomes standalone.  If such
      resize is carried over while an image is mapped we would detect this
      and call rbd_dev_parent_put() which means "let go of all parent state,
      including the spec(s) of parent images(s)".  This leads to a mismatch
      between "rbd info" and sysfs parent fields, so a fix is in order.
      
          # rbd create --image-format 2 --size 1 foo
          # rbd snap create foo@snap
          # rbd snap protect foo@snap
          # rbd clone foo@snap bar
          # DEV=$(rbd map bar)
          # rbd resize --allow-shrink --size 0 bar
          # rbd resize --size 1 bar
          # rbd info bar | grep parent
                  parent: rbd/foo@snap
      
      Before:
      
          # cat /sys/bus/rbd/devices/0/parent
          (no parent image)
      
      After:
      
          # cat /sys/bus/rbd/devices/0/parent
          pool_id 0
          pool_name rbd
          image_id 10056b8b4567
          image_name foo
          snap_id 2
          snap_name snap
          overlap 0
      Signed-off-by: NIlya Dryomov <idryomov@redhat.com>
      Reviewed-by: NJosh Durgin <jdurgin@redhat.com>
      Reviewed-by: NAlex Elder <elder@linaro.org>
      cf32bd9c
    • I
      rbd: fix error paths in rbd_dev_refresh() · 73e39e4d
      Ilya Dryomov 提交于
      header_rwsem should be released on errors.  Also remove useless
      rbd_dev->mapping.size != rbd_dev->header.image_size test.
      Signed-off-by: NIlya Dryomov <idryomov@redhat.com>
      73e39e4d
    • R
      rbd: nuke copy_token() · 3a25cf43
      Rickard Strandqvist 提交于
      It's been largely superseded by dup_token() and unused for over
      2 years, identified by cppcheck.
      Signed-off-by: NRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
      [idryomov@redhat.com: changelog]
      Signed-off-by: NIlya Dryomov <idryomov@redhat.com>
      3a25cf43
    • A
      cpufreq: s3c: remove last use of resume_clocks callback · 67fadaa2
      Arnd Bergmann 提交于
      Commit 32726d2d ("ARM: SAMSUNG: Remove legacy clock code")
      already removed the callback pointer, but there was one remaining
      user:
      
      drivers/cpufreq/s3c24xx-cpufreq.c: In function 's3c_cpufreq_resume_clocks':
      drivers/cpufreq/s3c24xx-cpufreq.c:149:14: error: 'struct s3c_cpufreq_info' has no member named 'resume_clocks'
        cpu_cur.info->resume_clocks();
                    ^
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Fixes: 32726d2d ("ARM: SAMSUNG: Remove legacy clock code")
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Cc: 3.17+ <stable@vger.kernel.org> # v3.17+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      67fadaa2
    • A
      cpufreq: s3c: remove incorrect __init annotations · 61882b63
      Arnd Bergmann 提交于
      The two functions s3c2416_cpufreq_driver_init and s3c_cpufreq_register
      are marked init but are called from a context that might be run after
      the __init sections are discarded, as the compiler points out:
      
      WARNING: vmlinux.o(.data+0x1ad9dc): Section mismatch in reference from the variable s3c2416_cpufreq_driver to the function .init.text:s3c2416_cpufreq_driver_init()
      WARNING: drivers/built-in.o(.text+0x35b5dc): Section mismatch in reference from the function s3c2410a_cpufreq_add() to the function .init.text:s3c_cpufreq_register()
      
      This removes the __init markings.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Cc: All applicable <stable@vger.kernel.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      61882b63
    • B
      x86/intel/quark: Add Isolated Memory Regions for Quark X1000 · 28a375df
      Bryan O'Donoghue 提交于
      Intel's Quark X1000 SoC contains a set of registers called
      Isolated Memory Regions. IMRs are accessed over the IOSF mailbox
      interface. IMRs are areas carved out of memory that define
      read/write access rights to the various system agents within the
      Quark system. For a given agent in the system it is possible to
      specify if that agent may read or write an area of memory
      defined by an IMR with a granularity of 1 KiB.
      
      Quark_SecureBootPRM_330234_001.pdf section 4.5 details the
      concept of IMRs quark-x1000-datasheet.pdf section 12.7.4 details
      the implementation of IMRs in silicon.
      
      eSRAM flush, CPU Snoop write-only, CPU SMM Mode, CPU non-SMM
      mode, RMU and PCIe Virtual Channels (VC0 and VC1) can have
      individual read/write access masks applied to them for a given
      memory region in Quark X1000. This enables IMRs to treat each
      memory transaction type listed above on an individual basis and
      to filter appropriately based on the IMR access mask for the
      memory region. Quark supports eight IMRs.
      
      Since all of the DMA capable SoC components in the X1000 are
      mapped to VC0 it is possible to define sections of memory as
      invalid for DMA write operations originating from Ethernet, USB,
      SD and any other DMA capable south-cluster component on VC0.
      Similarly it is possible to mark kernel memory as non-SMM mode
      read/write only or to mark BIOS runtime memory as SMM mode
      accessible only depending on the particular memory footprint on
      a given system.
      
      On an IMR violation Quark SoC X1000 systems are configured to
      reset the system, so ensuring that the IMR memory map is
      consistent with the EFI provided memory map is critical to
      ensure no IMR violations reset the system.
      
      The API for accessing IMRs is based on MTRR code but doesn't
      provide a /proc or /sys interface to manipulate IMRs. Defining
      the size and extent of IMRs is exclusively the domain of
      in-kernel code.
      
      Quark firmware sets up a series of locked IMRs around pieces of
      memory that firmware owns such as ACPI runtime data. During boot
      a series of unlocked IMRs are placed around items in memory to
      guarantee no DMA modification of those items can take place.
      Grub also places an unlocked IMR around the kernel boot params
      data structure and compressed kernel image. It is necessary for
      the kernel to tear down all unlocked IMRs in order to ensure
      that the kernel's view of memory passed via the EFI memory map
      is consistent with the IMR memory map. Without tearing down all
      unlocked IMRs on boot transitory IMRs such as those used to
      protect the compressed kernel image will cause IMR violations and system reboots.
      
      The IMR init code tears down all unlocked IMRs and sets a
      protective IMR around the kernel .text and .rodata as one
      contiguous block. This sanitizes the IMR memory map with respect
      to the EFI memory map and protects the read-only portions of the
      kernel from unwarranted DMA access.
      Tested-by: NOng, Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NBryan O'Donoghue <pure.logic@nexus-software.ie>
      Reviewed-by: NAndy Shevchenko <andy.schevchenko@gmail.com>
      Reviewed-by: NDarren Hart <dvhart@linux.intel.com>
      Reviewed-by: NOng, Boon Leong <boon.leong.ong@intel.com>
      Cc: andy.shevchenko@gmail.com
      Cc: dvhart@infradead.org
      Link: http://lkml.kernel.org/r/1422635379-12476-2-git-send-email-pure.logic@nexus-software.ieSigned-off-by: NIngo Molnar <mingo@kernel.org>
      28a375df
    • S
      Revert "clk: mxs: Fix invalid 32-bit access to frac registers" · a9261487
      Stefan Wahren 提交于
      Revert commit 039e5970 (clk: mxs: Fix invalid 32-bit access to frac
      registers), because it leads to a faulty spi communication on mx28evk.
      Signed-off-by: NStefan Wahren <stefan.wahren@i2se.com>
      Reported-by: NFabio Estevam <fabio.estevam@freescale.com>
      Tested-by: NFabio Estevam <fabio.estevam@freescale.com>
      Signed-off-by: NMichael Turquette <mturquette@linaro.org>
      a9261487
    • E
      clk: qoriq: Add support for the platform PLL · a513b72c
      Emil Medve 提交于
      Change-Id: Iac11ed95f274485a86d2c11f32a3dc502bcd020f
      Signed-off-by: NEmil Medve <Emilian.Medve@Freescale.com>
      Acked-by: NTang Yuantian <Yuantian.Tang@freescale.com>
      Signed-off-by: NMichael Turquette <mturquette@linaro.org>
      a513b72c
    • M
      ACPI / LPSS: Deassert resets for SPI host controllers on Braswell · 3095794a
      Mika Westerberg 提交于
      On some Braswell systems BIOS leaves resets for SPI host controllers
      active. This prevents the SPI driver from transferring messages on wire.
      
      Fix this in similar way that we do for I2C already by deasserting resets
      for the SPI host controllers.
      Reported-by: NYang A Fang <yang.a.fang@intel.com>
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Cc: 3.17+ <stable@vger.kernel.org> # 3.17+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      3095794a
    • M
      ACPI / LPSS: Always disable I2C host controllers · 3293c7b8
      Mika Westerberg 提交于
      On Baytrail and Braswell the BIOS might leave the I2C host controllers
      enabled, probably because it uses them for its own purposes. This is fine
      in normal cases because the I2C driver will disable the hardware when it
      is probed anyway.
      
      However, in case of suspend to disk it is different story. If the driver
      happens to be compiled as a module the boot kernel never loads the driver
      thus leaving host controllers enabled upon loading the hibernation image.
      
      The I2C host controller interrupt mask register has default value of 0x8ff,
      in other words it has most of the interrupts unmasked. When combined with
      the fact that the host controller is enabled, the driver immediately starts
      getting interrupts even before its resume hook is called (once IO-APIC is
      resumed). Since the driver is not prepared for this it will crash the
      kernel due to NULL pointer derefence because dev->msgs is NULL.
      
      Unfortunately we were not able to get full backtrace to from the console
      which could be reproduced here.
      
      In order to fix this even when the driver is compiled as module, we disable
      the I2C host controllers in byt_i2c_setup() before devices are created.
      Reported-by: NYu Chen <yu.c.chen@intel.com>
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Cc: 3.17+ <stable@vger.kernel.org> # 3.17+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      3293c7b8
    • J
      clk: Replace explicit clk assignment with __clk_hw_set_clk · 4e907ef6
      Javier Martinez Canillas 提交于
      The change in the clk API to return a per-user clock instance, moved
      the clock state to struct clk_core so now the struct clk_hw .core field
      is used instead of .clk for most operations.
      
      So for hardware clocks that needs to share the same clock state, both
      the .core and .clk pointers have to be assigned but currently only the
      .clk is set. This leads to NULL pointer dereference when the operations
      try to access the hw clock .core. For example, the composite clock rate
      and mux components didn't have a .core set which leads to this error:
      
      Unable to handle kernel NULL pointer dereference at virtual address 00000034
      pgd = c0004000
      [00000034] *pgd=00000000
      Internal error: Oops: 5 [#1] PREEMPT SMP ARM
      Modules linked in:
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.19.0-next-20150211-00002-g1fb7f0e1150d #423
      Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      task: ee480000 ti: ee488000 task.ti: ee488000
      PC is at clk_mux_determine_rate_flags+0x14/0x19c
      LR is at __clk_mux_determine_rate+0x24/0x2c
      pc : [<c03a355c>]    lr : [<c03a3734>]    psr: a0000113
      sp : ee489ce8  ip : ee489d84  fp : ee489d84
      r10: 0000005c  r9 : 00000001  r8 : 016e3600
      r7 : 00000000  r6 : 00000000  r5 : ee442200  r4 : ee440c98
      r3 : ffffffff  r2 : 00000000  r1 : 016e3600  r0 : ee440c98
      Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
      Control: 10c5387d  Table: 4000406a  DAC: 00000015
      Process swapper/0 (pid: 1, stack limit = 0xee488210)
      Stack: (0xee489ce8 to 0xee48a000)
      9ce0:                   00000000 ffffffff 60000113 ee440c98 ee442200 00000000
      9d00: 016e3600 ffffffff 00000001 0000005c ee489d84 c03a3734 ee489d80 ee489d84
      9d20: 00000000 c048b130 00000400 c03a5798 ee489d80 ee489d84 c0607f60 ffffffea
      9d40: 00000001 00000001 ee489d5c c003f844 c06e3340 ee402680 ee440d0c ed935000
      9d60: 016e3600 00000003 00000001 0000005c eded3700 c03a11a0 ee489d80 ee489d84
      9d80: 016e3600 ee402680 c05b413a eddc9900 016e3600 c03a1228 00000000 ffffffff
      9da0: ffffffff eddc9900 016e3600 c03a1c1c ffffffff 016e3600 ed8c6710 c03d6ce4
      9dc0: eded3400 00000000 00000000 c03c797c 00000001 0000005c eded3700 eded3700
      9de0: 000005e0 00000001 0000005c c03db8ac c06e7e54 c03c8f08 00000000 c06e7e64
      9e00: c06b6e74 c06e7f64 000005e0 c06e7df8 c06e5100 00000000 c06e7e6c c06e7f54
      9e20: 00000000 00000000 eebd9550 00000000 c06e7da0 c06e7e54 ee7b5010 c06e7da0
      9e40: eddc9690 c06e7db4 c06b6e74 00000097 00000000 c03d4398 00000000 ee7b5010
      9e60: eebd9550 c06e7da0 00000000 c03db824 ee7b5010 fffffffe c06e7db4 c0299c7c
      9e80: ee7b5010 c072a05c 00000000 c0298858 ee7b5010 c06e7db4 ee7b5044 00000000
      9ea0: eddc9580 c0298a04 c06e7db4 00000000 c0298978 c02971d4 ee405c78 ee732b40
      9ec0: c06e7db4 eded3800 c06d6738 c0298044 c0608300 c06e7db4 00000000 c06e7db4
      9ee0: 00000000 c06beb58 c06beb58 c0299024 00000000 c068dd00 00000000 c0008944
      9f00: 00000038 c049013c ee462200 c0711920 ee480000 60000113 c06c2cb0 00000000
      9f20: 00000000 c06c2cb0 60000113 00000000 ef7fcafc 00000000 c0640194 c00389ec
      9f40: c05ec3a8 c063f824 00000006 00000006 c06c2c50 c0696444 00000006 c0696424
      9f60: c06ee1c0 c066b588 c06b6e74 00000097 00000000 c066bd44 00000006 00000006
      9f80: c066b588 c003d684 00000000 c0481938 00000000 00000000 00000000 00000000
      9fa0: 00000000 c0481940 00000000 c000e680 00000000 00000000 00000000 00000000
      9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
      [<c03a355c>] (clk_mux_determine_rate_flags) from [<c03a3734>] (__clk_mux_determine_rate+0x24/0x2c)
      [<c03a3734>] (__clk_mux_determine_rate) from [<c03a5798>] (clk_composite_determine_rate+0xbc/0x238)
      [<c03a5798>] (clk_composite_determine_rate) from [<c03a11a0>] (clk_core_round_rate_nolock+0x5c/0x9c)
      [<c03a11a0>] (clk_core_round_rate_nolock) from [<c03a1228>] (__clk_round_rate+0x38/0x40)
      [<c03a1228>] (__clk_round_rate) from [<c03a1c1c>] (clk_round_rate+0x20/0x38)
      [<c03a1c1c>] (clk_round_rate) from [<c03d6ce4>] (max98090_dai_set_sysclk+0x34/0x118)
      [<c03d6ce4>] (max98090_dai_set_sysclk) from [<c03c797c>] (snd_soc_dai_set_sysclk+0x38/0x80)
      [<c03c797c>] (snd_soc_dai_set_sysclk) from [<c03db8ac>] (snow_late_probe+0x24/0x48)
      [<c03db8ac>] (snow_late_probe) from [<c03c8f08>] (snd_soc_register_card+0xf04/0x1070)
      [<c03c8f08>] (snd_soc_register_card) from [<c03d4398>] (devm_snd_soc_register_card+0x30/0x64)
      [<c03d4398>] (devm_snd_soc_register_card) from [<c03db824>] (snow_probe+0x68/0xcc)
      [<c03db824>] (snow_probe) from [<c0299c7c>] (platform_drv_probe+0x48/0x98)
      [<c0299c7c>] (platform_drv_probe) from [<c0298858>] (driver_probe_device+0x114/0x234)
      [<c0298858>] (driver_probe_device) from [<c0298a04>] (__driver_attach+0x8c/0x90)
      [<c0298a04>] (__driver_attach) from [<c02971d4>] (bus_for_each_dev+0x54/0x88)
      [<c02971d4>] (bus_for_each_dev) from [<c0298044>] (bus_add_driver+0xd8/0x1cc)
      [<c0298044>] (bus_add_driver) from [<c0299024>] (driver_register+0x78/0xf4)
      [<c0299024>] (driver_register) from [<c0008944>] (do_one_initcall+0x80/0x1d0)
      [<c0008944>] (do_one_initcall) from [<c066bd44>] (kernel_init_freeable+0x10c/0x1d8)
      [<c066bd44>] (kernel_init_freeable) from [<c0481940>] (kernel_init+0x8/0xe4)
      [<c0481940>] (kernel_init) from [<c000e680>] (ret_from_fork+0x14/0x34)
      Code: e24dd00c e5907000 e1a08001 e88d000c (e5970034)
      
      The changes were made using the following cocinelle semantic patch:
      
      @i@
      @@
      
      @depends on i@
      identifier dst;
      @@
      
      - dst->clk = hw->clk;
      + __clk_hw_set_clk(dst, hw);
      
      @depends on i@
      identifier dst;
      @@
      
      - dst->hw.clk = hw->clk;
      + __clk_hw_set_clk(&dst->hw, hw);
      
      Fixes: 035a61c3 ("clk: Make clk API return per-user struct clk instances")
      Signed-off-by: NJavier Martinez Canillas <javier.martinez@collabora.co.uk>
      Reviewed-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NMichael Turquette <mturquette@linaro.org>
      4e907ef6
    • J
      clk: Don't dereference parent clock if is NULL · 9e0ad7d2
      Javier Martinez Canillas 提交于
      The clock passed as an argument to clk_mux_determine_rate_flags()
      has the CLK_SET_RATE_PARENT flag set but it has no parent, then a
      NULL pointer will tried to be dereferenced.
      
      This shouldn't happen since setting that flag for a clock with no
      parent is a bug but the core should be robust to handle that case.
      
      Fixes: 035a61c3 ("clk: Make clk API return per-user struct clk instances")
      Signed-off-by: NJavier Martinez Canillas <javier.martinez@collabora.co.uk>
      Reviewed-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NMichael Turquette <mturquette@linaro.org>
      9e0ad7d2