1. 05 10月, 2019 40 次提交
    • U
      mmc: dw_mmc: Re-store SDIO IRQs mask at system resume · da87dfca
      Ulf Hansson 提交于
      [ Upstream commit 7c526608d5afb62cbc967225e2ccaacfdd142e9d ]
      
      In cases when SDIO IRQs have been enabled, runtime suspend is prevented by
      the driver. However, this still means dw_mci_runtime_suspend|resume() gets
      called during system suspend/resume, via pm_runtime_force_suspend|resume().
      This means during system suspend/resume, the register context of the dw_mmc
      device most likely loses its register context, even in cases when SDIO IRQs
      have been enabled.
      
      To re-enable the SDIO IRQs during system resume, the dw_mmc driver
      currently relies on the mmc core to re-enable the SDIO IRQs when it resumes
      the SDIO card, but this isn't the recommended solution. Instead, it's
      better to deal with this locally in the dw_mmc driver, so let's do that.
      Tested-by: NMatthias Kaehlcke <mka@chromium.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NDouglas Anderson <dianders@chromium.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      da87dfca
    • U
      mmc: core: Add helper function to indicate if SDIO IRQs is enabled · a0dd3d95
      Ulf Hansson 提交于
      [ Upstream commit bd880b00697befb73eff7220ee20bdae4fdd487b ]
      
      To avoid each host driver supporting SDIO IRQs, from keeping track
      internally about if SDIO IRQs has been claimed, let's introduce a common
      helper function, sdio_irq_claimed().
      
      The function returns true if SDIO IRQs are claimed, via using the
      information about the number of claimed irqs. This is safe, even without
      any locks, as long as the helper function is called only from
      runtime/system suspend callbacks of the host driver.
      Tested-by: NMatthias Kaehlcke <mka@chromium.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NDouglas Anderson <dianders@chromium.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      a0dd3d95
    • A
      mmc: sdhci: Fix incorrect switch to HS mode · 8ba99d50
      Al Cooper 提交于
      [ Upstream commit c894e33ddc1910e14d6f2a2016f60ab613fd8b37 ]
      
      When switching from any MMC speed mode that requires 1.8v
      (HS200, HS400 and HS400ES) to High Speed (HS) mode, the system
      ends up configured for SDR12 with a 50MHz clock which is an illegal
      mode.
      
      This happens because the SDHCI_CTRL_VDD_180 bit in the
      SDHCI_HOST_CONTROL2 register is left set and when this bit is
      set, the speed mode is controlled by the SDHCI_CTRL_UHS field
      in the SDHCI_HOST_CONTROL2 register. The SDHCI_CTRL_UHS field
      will end up being set to 0 (SDR12) by sdhci_set_uhs_signaling()
      because there is no UHS mode being set.
      
      The fix is to change sdhci_set_uhs_signaling() to set the
      SDHCI_CTRL_UHS field to SDR25 (which is the same as HS) for
      any switch to HS mode.
      
      This was found on a new eMMC controller that does strict checking
      of the speed mode and the corresponding clock rate. It caused the
      switch to HS400 mode to fail because part of the sequence to switch
      to HS400 requires a switch from HS200 to HS before going to HS400.
      Suggested-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NAl Cooper <alcooperx@gmail.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      8ba99d50
    • U
      mmc: core: Clarify sdio_irq_pending flag for MMC_CAP2_SDIO_IRQ_NOTHREAD · 86912277
      Ulf Hansson 提交于
      [ Upstream commit 36d57efb4af534dd6b442ea0b9a04aa6dfa37abe ]
      
      The sdio_irq_pending flag is used to let host drivers indicate that it has
      signaled an IRQ. If that is the case and we only have a single SDIO func
      that have claimed an SDIO IRQ, our assumption is that we can avoid reading
      the SDIO_CCCR_INTx register and just call the SDIO func irq handler
      immediately. This makes sense, but the flag is set/cleared in a somewhat
      messy order, let's fix that up according to below.
      
      First, the flag is currently set in sdio_run_irqs(), which is executed as a
      work that was scheduled from sdio_signal_irq(). To make it more implicit
      that the host have signaled an IRQ, let's instead immediately set the flag
      in sdio_signal_irq(). This also makes the behavior consistent with host
      drivers that uses the legacy, mmc_signal_sdio_irq() API. This have no
      functional impact, because we don't expect host drivers to call
      sdio_signal_irq() until after the work (sdio_run_irqs()) have been executed
      anyways.
      
      Second, currently we never clears the flag when using the sdio_run_irqs()
      work, but only when using the sdio_irq_thread(). Let make the behavior
      consistent, by moving the flag to be cleared inside the common
      process_sdio_pending_irqs() function. Additionally, tweak the behavior of
      the flag slightly, by avoiding to clear it unless we processed the SDIO
      IRQ. The purpose with this at this point, is to keep the information about
      whether there have been an SDIO IRQ signaled by the host, so at system
      resume we can decide to process it without reading the SDIO_CCCR_INTx
      register.
      Tested-by: NMatthias Kaehlcke <mka@chromium.org>
      Reviewed-by: NMatthias Kaehlcke <mka@chromium.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NDouglas Anderson <dianders@chromium.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      86912277
    • G
      raid5: don't set STRIPE_HANDLE to stripe which is in batch list · a5443cd2
      Guoqing Jiang 提交于
      [ Upstream commit 6ce220dd2f8ea71d6afc29b9a7524c12e39f374a ]
      
      If stripe in batch list is set with STRIPE_HANDLE flag, then the stripe
      could be set with STRIPE_ACTIVE by the handle_stripe function. And if
      error happens to the batch_head at the same time, break_stripe_batch_list
      is called, then below warning could happen (the same report in [1]), it
      means a member of batch list was set with STRIPE_ACTIVE.
      
      [7028915.431770] stripe state: 2001
      [7028915.431815] ------------[ cut here ]------------
      [7028915.431828] WARNING: CPU: 18 PID: 29089 at drivers/md/raid5.c:4614 break_stripe_batch_list+0x203/0x240 [raid456]
      [...]
      [7028915.431879] CPU: 18 PID: 29089 Comm: kworker/u82:5 Tainted: G           O    4.14.86-1-storage #4.14.86-1.2~deb9
      [7028915.431881] Hardware name: Supermicro SSG-2028R-ACR24L/X10DRH-iT, BIOS 3.1 06/18/2018
      [7028915.431888] Workqueue: raid5wq raid5_do_work [raid456]
      [7028915.431890] task: ffff9ab0ef36d7c0 task.stack: ffffb72926f84000
      [7028915.431896] RIP: 0010:break_stripe_batch_list+0x203/0x240 [raid456]
      [7028915.431898] RSP: 0018:ffffb72926f87ba8 EFLAGS: 00010286
      [7028915.431900] RAX: 0000000000000012 RBX: ffff9aaa84a98000 RCX: 0000000000000000
      [7028915.431901] RDX: 0000000000000000 RSI: ffff9ab2bfa15458 RDI: ffff9ab2bfa15458
      [7028915.431902] RBP: ffff9aaa8fb4e900 R08: 0000000000000001 R09: 0000000000002eb4
      [7028915.431903] R10: 00000000ffffffff R11: 0000000000000000 R12: ffff9ab1736f1b00
      [7028915.431904] R13: 0000000000000000 R14: ffff9aaa8fb4e900 R15: 0000000000000001
      [7028915.431906] FS:  0000000000000000(0000) GS:ffff9ab2bfa00000(0000) knlGS:0000000000000000
      [7028915.431907] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [7028915.431908] CR2: 00007ff953b9f5d8 CR3: 0000000bf4009002 CR4: 00000000003606e0
      [7028915.431909] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [7028915.431910] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [7028915.431910] Call Trace:
      [7028915.431923]  handle_stripe+0x8e7/0x2020 [raid456]
      [7028915.431930]  ? __wake_up_common_lock+0x89/0xc0
      [7028915.431935]  handle_active_stripes.isra.58+0x35f/0x560 [raid456]
      [7028915.431939]  raid5_do_work+0xc6/0x1f0 [raid456]
      
      Also commit 59fc630b ("RAID5: batch adjacent full stripe write")
      said "If a stripe is added to batch list, then only the first stripe
      of the list should be put to handle_list and run handle_stripe."
      
      So don't set STRIPE_HANDLE to stripe which is already in batch list,
      otherwise the stripe could be put to handle_list and run handle_stripe,
      then the above warning could be triggered.
      
      [1]. https://www.spinics.net/lists/raid/msg62552.htmlSigned-off-by: NGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
      Signed-off-by: NSong Liu <songliubraving@fb.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      a5443cd2
    • P
      ASoC: dmaengine: Make the pcm->name equal to pcm->id if the name is not set · 064fba88
      Peter Ujfalusi 提交于
      [ Upstream commit 2ec42f3147e1610716f184b02e65d7f493eed925 ]
      
      Some tools use the snd_pcm_info_get_name() to try to identify PCMs or for
      other purposes.
      
      Currently it is left empty with the dmaengine-pcm, in this case copy the
      pcm->id string as pcm->name.
      
      For example IGT is using this to find the HDMI PCM for testing audio on it.
      Signed-off-by: NPeter Ujfalusi <peter.ujfalusi@ti.com>
      Reported-by: NArthur She <arthur.she@linaro.org>
      Link: https://lore.kernel.org/r/20190906055524.7393-1-peter.ujfalusi@ti.comSigned-off-by: NMark Brown <broonie@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      064fba88
    • M
      platform/x86: intel_pmc_core: Do not ioremap RAM · 476eda25
      M. Vefa Bicakci 提交于
      [ Upstream commit 7d505758b1e556cdf65a5e451744fe0ae8063d17 ]
      
      On a Xen-based PVH virtual machine with more than 4 GiB of RAM,
      intel_pmc_core fails initialization with the following warning message
      from the kernel, indicating that the driver is attempting to ioremap
      RAM:
      
        ioremap on RAM at 0x00000000fe000000 - 0x00000000fe001fff
        WARNING: CPU: 1 PID: 434 at arch/x86/mm/ioremap.c:186 __ioremap_caller.constprop.0+0x2aa/0x2c0
      ...
        Call Trace:
         ? pmc_core_probe+0x87/0x2d0 [intel_pmc_core]
         pmc_core_probe+0x87/0x2d0 [intel_pmc_core]
      
      This issue appears to manifest itself because of the following fallback
      mechanism in the driver:
      
      	if (lpit_read_residency_count_address(&slp_s0_addr))
      		pmcdev->base_addr = PMC_BASE_ADDR_DEFAULT;
      
      The validity of address PMC_BASE_ADDR_DEFAULT (i.e., 0xFE000000) is not
      verified by the driver, which is what this patch introduces. With this
      patch, if address PMC_BASE_ADDR_DEFAULT is in RAM, then the driver will
      not attempt to ioremap the aforementioned address.
      Signed-off-by: NM. Vefa Bicakci <m.v.b@runbox.com>
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      476eda25
    • G
      x86/cpu: Add Tiger Lake to Intel family · e836cd29
      Gayatri Kammela 提交于
      [ Upstream commit 6e1c32c5dbb4b90eea8f964c2869d0bde050dbe0 ]
      
      Add the model numbers/CPUIDs of Tiger Lake mobile and desktop to the
      Intel family.
      Suggested-by: NTony Luck <tony.luck@intel.com>
      Signed-off-by: NGayatri Kammela <gayatri.kammela@intel.com>
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      Reviewed-by: NTony Luck <tony.luck@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rahul Tanwar <rahul.tanwar@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20190905193020.14707-2-tony.luck@intel.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e836cd29
    • H
      s390/crypto: xts-aes-s390 fix extra run-time crypto self tests finding · b21919ee
      Harald Freudenberger 提交于
      [ Upstream commit 9e323d45ba94262620a073a3f9945ca927c07c71 ]
      
      With 'extra run-time crypto self tests' enabled, the selftest
      for s390-xts fails with
      
        alg: skcipher: xts-aes-s390 encryption unexpectedly succeeded on
        test vector "random: len=0 klen=64"; expected_error=-22,
        cfg="random: inplace use_digest nosimd src_divs=[2.61%@+4006,
        84.44%@+21, 1.55%@+13, 4.50%@+344, 4.26%@+21, 2.64%@+27]"
      
      This special case with nbytes=0 is not handled correctly and this
      fix now makes sure that -EINVAL is returned when there is en/decrypt
      called with 0 bytes to en/decrypt.
      Signed-off-by: NHarald Freudenberger <freude@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      b21919ee
    • M
      kprobes: Prohibit probing on BUG() and WARN() address · fad90d4b
      Masami Hiramatsu 提交于
      [ Upstream commit e336b4027775cb458dc713745e526fa1a1996b2a ]
      
      Since BUG() and WARN() may use a trap (e.g. UD2 on x86) to
      get the address where the BUG() has occurred, kprobes can not
      do single-step out-of-line that instruction. So prohibit
      probing on such address.
      
      Without this fix, if someone put a kprobe on WARN(), the
      kernel will crash with invalid opcode error instead of
      outputing warning message, because kernel can not find
      correct bug address.
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Acked-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Acked-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
      Cc: David S . Miller <davem@davemloft.net>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Naveen N . Rao <naveen.n.rao@linux.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/156750890133.19112.3393666300746167111.stgit@devnote2Signed-off-by: NIngo Molnar <mingo@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      fad90d4b
    • P
      dmaengine: ti: edma: Do not reset reserved paRAM slots · 213077da
      Peter Ujfalusi 提交于
      [ Upstream commit c5dbe60664b3660f5ac5854e21273ea2e7ff698f ]
      
      Skip resetting paRAM slots marked as reserved as they might be used by
      other cores.
      Signed-off-by: NPeter Ujfalusi <peter.ujfalusi@ti.com>
      Link: https://lore.kernel.org/r/20190823125618.8133-2-peter.ujfalusi@ti.comSigned-off-by: NVinod Koul <vkoul@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      213077da
    • Y
      md/raid1: fail run raid1 array when active disk less than one · f1db7562
      Yufen Yu 提交于
      [ Upstream commit 07f1a6850c5d5a65c917c3165692b5179ac4cb6b ]
      
      When run test case:
        mdadm -CR /dev/md1 -l 1 -n 4 /dev/sd[a-d] --assume-clean --bitmap=internal
        mdadm -S /dev/md1
        mdadm -A /dev/md1 /dev/sd[b-c] --run --force
      
        mdadm --zero /dev/sda
        mdadm /dev/md1 -a /dev/sda
      
        echo offline > /sys/block/sdc/device/state
        echo offline > /sys/block/sdb/device/state
        sleep 5
        mdadm -S /dev/md1
      
        echo running > /sys/block/sdb/device/state
        echo running > /sys/block/sdc/device/state
        mdadm -A /dev/md1 /dev/sd[a-c] --run --force
      
      mdadm run fail with kernel message as follow:
      [  172.986064] md: kicking non-fresh sdb from array!
      [  173.004210] md: kicking non-fresh sdc from array!
      [  173.022383] md/raid1:md1: active with 0 out of 4 mirrors
      [  173.022406] md1: failed to create bitmap (-5)
      
      In fact, when active disk in raid1 array less than one, we
      need to return fail in raid1_run().
      Reviewed-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NYufen Yu <yuyufen@huawei.com>
      Signed-off-by: NSong Liu <songliubraving@fb.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      f1db7562
    • W
      hwmon: (acpi_power_meter) Change log level for 'unsafe software power cap' · 76cf93f0
      Wang Shenran 提交于
      [ Upstream commit 6e4d91aa071810deac2cd052161aefb376ecf04e ]
      
      At boot time, the acpi_power_meter driver logs the following error level
      message: "Ignoring unsafe software power cap". Having read about it from
      a few sources, it seems that the error message can be quite misleading.
      
      While the message can imply that Linux is ignoring the fact that the
      system is operating in potentially dangerous conditions, the truth is
      the driver found an ACPI_PMC object that supports software power
      capping. The driver simply decides not to use it, perhaps because it
      doesn't support the object.
      
      The best solution is probably changing the log level from error to warning.
      All sources I have found, regarding the error, have downplayed its
      significance. There is not much of a reason for it to be on error level,
      while causing potential confusions or misinterpretations.
      Signed-off-by: NWang Shenran <shenran268@gmail.com>
      Link: https://lore.kernel.org/r/20190724080110.6952-1-shenran268@gmail.comSigned-off-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      76cf93f0
    • K
      closures: fix a race on wakeup from closure_sync · f0956418
      Kent Overstreet 提交于
      [ Upstream commit a22a9602b88fabf10847f238ff81fde5f906fef7 ]
      
      The race was when a thread using closure_sync() notices cl->s->done == 1
      before the thread calling closure_put() calls wake_up_process(). Then,
      it's possible for that thread to return and exit just before
      wake_up_process() is called - so we're trying to wake up a process that
      no longer exists.
      
      rcu_read_lock() is sufficient to protect against this, as there's an rcu
      barrier somewhere in the process teardown path.
      Signed-off-by: NKent Overstreet <kent.overstreet@gmail.com>
      Acked-by: NColy Li <colyli@suse.de>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      f0956418
    • W
      ACPI / PCI: fix acpi_pci_irq_enable() memory leak · 9fcfdff6
      Wenwen Wang 提交于
      [ Upstream commit 29b49958cf73b439b17fa29e9a25210809a6c01c ]
      
      In acpi_pci_irq_enable(), 'entry' is allocated by kzalloc() in
      acpi_pci_irq_check_entry() (invoked from acpi_pci_irq_lookup()). However,
      it is not deallocated if acpi_pci_irq_valid() returns false, leading to a
      memory leak. To fix this issue, free 'entry' before returning 0.
      
      Fixes: e237a551 ("x86/ACPI/PCI: Recognize that Interrupt Line 255 means "not connected"")
      Signed-off-by: NWenwen Wang <wenwen@cs.uga.edu>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      9fcfdff6
    • W
      ACPI: custom_method: fix memory leaks · e4467fb6
      Wenwen Wang 提交于
      [ Upstream commit 03d1571d9513369c17e6848476763ebbd10ec2cb ]
      
      In cm_write(), 'buf' is allocated through kzalloc(). In the following
      execution, if an error occurs, 'buf' is not deallocated, leading to memory
      leaks. To fix this issue, free 'buf' before returning the error.
      
      Fixes: 526b4af4 ("ACPI: Split out custom_method functionality into an own driver")
      Signed-off-by: NWenwen Wang <wenwen@cs.uga.edu>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e4467fb6
    • M
      ARM: dts: exynos: Mark LDO10 as always-on on Peach Pit/Pi Chromebooks · 6fceb241
      Marek Szyprowski 提交于
      [ Upstream commit 5b0eeeaa37615df37a9a30929b73e9defe61ca84 ]
      
      Commit aff138bf ("ARM: dts: exynos: Add TMU nodes regulator supply
      for Peach boards") assigned LDO10 to Exynos Thermal Measurement Unit,
      but it turned out that it supplies also some other critical parts and
      board freezes/crashes when it is turned off.
      
      The mentioned commit made Exynos TMU a consumer of that regulator and in
      typical case Exynos TMU driver keeps it enabled from early boot. However
      there are such configurations (example is multi_v7_defconfig), in which
      some of the regulators are compiled as modules and are not available
      from early boot. In such case it may happen that LDO10 is turned off by
      regulator core, because it has no consumers yet (in this case consumer
      drivers cannot get it, because the supply regulators for it are not yet
      available). This in turn causes the board to crash. This patch restores
      'always-on' property for the LDO10 regulator.
      
      Fixes: aff138bf ("ARM: dts: exynos: Add TMU nodes regulator supply for Peach boards")
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NKrzysztof Kozlowski <krzk@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      6fceb241
    • T
      libtraceevent: Change users plugin directory · e4b4280d
      Tzvetomir Stoyanov 提交于
      [ Upstream commit e97fd1383cd77c467d2aed7fa4e596789df83977 ]
      
      To be compliant with XDG user directory layout, the user's plugin
      directory is changed from ~/.traceevent/plugins to
      ~/.local/lib/traceevent/plugins/
      Suggested-by: NPatrick McLean <chutzpah@gentoo.org>
      Signed-off-by: NTzvetomir Stoyanov <tstoyanov@vmware.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Patrick McLean <chutzpah@gentoo.org>
      Cc: linux-trace-devel@vger.kernel.org
      Link: https://lore.kernel.org/linux-trace-devel/20190313144206.41e75cf8@patrickm/
      Link: http://lore.kernel.org/linux-trace-devel/20190801074959.22023-4-tz.stoyanov@gmail.com
      Link: http://lore.kernel.org/lkml/20190805204355.344622683@goodmis.orgSigned-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e4b4280d
    • E
      iommu/iova: Avoid false sharing on fq_timer_on · c55659cd
      Eric Dumazet 提交于
      [ Upstream commit 0d87308cca2c124f9bce02383f1d9632c9be89c4 ]
      
      In commit 14bd9a607f90 ("iommu/iova: Separate atomic variables
      to improve performance") Jinyu Qi identified that the atomic_cmpxchg()
      in queue_iova() was causing a performance loss and moved critical fields
      so that the false sharing would not impact them.
      
      However, avoiding the false sharing in the first place seems easy.
      We should attempt the atomic_cmpxchg() no more than 100 times
      per second. Adding an atomic_read() will keep the cache
      line mostly shared.
      
      This false sharing came with commit 9a005a80
      ("iommu/iova: Add flush timer").
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Fixes: 9a005a80 ('iommu/iova: Add flush timer')
      Cc: Jinyu Qi <jinyuqi@huawei.com>
      Cc: Joerg Roedel <jroedel@suse.de>
      Acked-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      c55659cd
    • D
      libata/ahci: Drop PCS quirk for Denverton and beyond · 223b0481
      Dan Williams 提交于
      [ Upstream commit c312ef176399e04fc5f7f2809d9a589751fbf6d9 ]
      
      The Linux ahci driver has historically implemented a configuration fixup
      for platforms / platform-firmware that fails to enable the ports prior
      to OS hand-off at boot. The fixup was originally implemented way back
      before ahci moved from drivers/scsi/ to drivers/ata/, and was updated in
      2007 via commit 49f29090 "ahci: update PCS programming". The quirk
      sets a port-enable bitmap in the PCS register at offset 0x92.
      
      This quirk could be applied generically up until the arrival of the
      Denverton (DNV) platform. The DNV AHCI controller architecture supports
      more than 6 ports and along with that the PCS register location and
      format were updated to allow for more possible ports in the bitmap. DNV
      AHCI expands the register to 32-bits and moves it to offset 0x94.
      
      As it stands there are no known problem reports with existing Linux
      trying to set bits at offset 0x92 which indicates that the quirk is not
      applicable. Likely it is not applicable on a wider range of platforms,
      but it is difficult to discern which platforms if any still depend on
      the quirk.
      
      Rather than try to fix the PCS quirk to consider the DNV register layout
      instead require explicit opt-in. The assumption is that the OS driver
      need not touch this register, and platforms can be added with a new
      boad_ahci_pcs7 board-id when / if problematic platforms are found in the
      future. The logic in ahci_intel_pcs_quirk() looks for all Intel AHCI
      instances with "legacy" board-ids and otherwise skips the quirk if the
      board was matched by class-code.
      Reported-by: NStephen Douthit <stephend@silicom-usa.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Reviewed-by: NStephen Douthit <stephend@silicom-usa.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      223b0481
    • Q
      iommu/amd: Silence warnings under memory pressure · de888e02
      Qian Cai 提交于
      [ Upstream commit 3d708895325b78506e8daf00ef31549476e8586a ]
      
      When running heavy memory pressure workloads, the system is throwing
      endless warnings,
      
      smartpqi 0000:23:00.0: AMD-Vi: IOMMU mapping error in map_sg (io-pages:
      5 reason: -12)
      Hardware name: HPE ProLiant DL385 Gen10/ProLiant DL385 Gen10, BIOS A40
      07/10/2019
      swapper/10: page allocation failure: order:0, mode:0xa20(GFP_ATOMIC),
      nodemask=(null),cpuset=/,mems_allowed=0,4
      Call Trace:
       <IRQ>
       dump_stack+0x62/0x9a
       warn_alloc.cold.43+0x8a/0x148
       __alloc_pages_nodemask+0x1a5c/0x1bb0
       get_zeroed_page+0x16/0x20
       iommu_map_page+0x477/0x540
       map_sg+0x1ce/0x2f0
       scsi_dma_map+0xc6/0x160
       pqi_raid_submit_scsi_cmd_with_io_request+0x1c3/0x470 [smartpqi]
       do_IRQ+0x81/0x170
       common_interrupt+0xf/0xf
       </IRQ>
      
      because the allocation could fail from iommu_map_page(), and the volume
      of this call could be huge which may generate a lot of serial console
      output and cosumes all CPUs.
      
      Fix it by silencing the warning in this call site, and there is still a
      dev_err() later to notify the failure.
      Signed-off-by: NQian Cai <cai@lca.pw>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      de888e02
    • T
      ALSA: firewire-motu: add support for MOTU 4pre · 6241c0ac
      Takashi Sakamoto 提交于
      [ Upstream commit 6af86bdb8ad41f4cf1292d3b10857dc322758328 ]
      
      MOTU 4pre was launched in 2012 by MOTU, Inc. This commit allows userspace
      applications can transmit and receive PCM frames and MIDI messages for
      this model via ALSA PCM interface and RawMidi/Sequencer interfaces.
      
      The device supports MOTU protocol version 3. Unlike the other devices, the
      device is simply designed. The size of data block is fixed to 10 quadlets
      during available sampling rates (44.1 - 96.0 kHz). Each data block
      includes 1 source packet header, 2 data chunks for messages, 8 data chunks
      for PCM samples and 2 data chunks for padding to quadlet alignment. The
      device has no MIDI, optical, BNC and AES/EBU interfaces.
      
      Like support for the other MOTU devices, the quality of playback sound
      is not enough good with periodical noise yet.
      
      $ python2 crpp < ~/git/am-config-rom/motu/motu-4pre.img
                     ROM header and bus information block
                     -----------------------------------------------------------------
      400  041078cc  bus_info_length 4, crc_length 16, crc 30924
      404  31333934  bus_name "1394"
      408  20ff7000  irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 255, max_rec 7 (256)
      40c  0001f200  company_id 0001f2     |
      410  000a41c5  device_id 00000a41c5  | EUI-64 0001f200000a41c5
      
                     root directory
                     -----------------------------------------------------------------
      414  0004ef04  directory_length 4, crc 61188
      418  030001f2  vendor
      41c  0c0083c0  node capabilities per IEEE 1394
      420  d1000002  --> unit directory at 428
      424  8d000005  --> eui-64 leaf at 438
      
                     unit directory at 428
                     -----------------------------------------------------------------
      428  0003ceda  directory_length 3, crc 52954
      42c  120001f2  specifier id
      430  13000045  version
      434  17103800  model
      
                     eui-64 leaf at 438
                     -----------------------------------------------------------------
      438  0002d248  leaf_length 2, crc 53832
      43c  0001f200  company_id 0001f2     |
      440  000a41c5  device_id 00000a41c5  | EUI-64 0001f200000a41c5
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      6241c0ac
    • A
      nvme-multipath: fix ana log nsid lookup when nsid is not found · ad58ce6c
      Anton Eidelman 提交于
      [ Upstream commit e01f91dff91c7b16a6e3faf2565017d497a73f83 ]
      
      ANA log parsing invokes nvme_update_ana_state() per ANA group desc.
      This updates the state of namespaces with nsids in desc->nsids[].
      
      Both ctrl->namespaces list and desc->nsids[] array are sorted by nsid.
      Hence nvme_update_ana_state() performs a single walk over ctrl->namespaces:
      - if current namespace matches the current desc->nsids[n],
        this namespace is updated, and n is incremented.
      - the process stops when it encounters the end of either
        ctrl->namespaces end or desc->nsids[]
      
      In case desc->nsids[n] does not match any of ctrl->namespaces,
      the remaining nsids following desc->nsids[n] will not be updated.
      Such situation was considered abnormal and generated WARN_ON_ONCE.
      
      However ANA log MAY contain nsids not (yet) found in ctrl->namespaces.
      For example, lets consider the following scenario:
      - nvme0 exposes namespaces with nsids = [2, 3] to the host
      - a new namespace nsid = 1 is added dynamically
      - also, a ANA topology change is triggered
      - NS_CHANGED aen is generated and triggers scan_work
      - before scan_work discovers nsid=1 and creates a namespace, a NOTICE_ANA
        aen was issues and ana_work receives ANA log with nsids=[1, 2, 3]
      
      Result: ana_work fails to update ANA state on existing namespaces [2, 3]
      
      Solution:
      Change the way nvme_update_ana_state() namespace list walk
      checks the current namespace against desc->nsids[n] as follows:
      a) ns->head->ns_id < desc->nsids[n]: keep walking ctrl->namespaces.
      b) ns->head->ns_id == desc->nsids[n]: match, update the namespace
      c) ns->head->ns_id >= desc->nsids[n]: skip to desc->nsids[n+1]
      
      This enables correct operation in the scenario described above.
      This also allows ANA log to contain nsids currently invisible
      to the host, i.e. inactive nsids.
      Signed-off-by: NAnton Eidelman <anton@lightbitslabs.com>
      Reviewed-by: NJames Smart <james.smart@broadcom.com>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      ad58ce6c
    • T
      nvmet: fix data units read and written counters in SMART log · 9edc229b
      Tom Wu 提交于
      [ Upstream commit 3bec2e3754becebd4c452999adb49bc62c575ea4 ]
      
      In nvme spec 1.3 there is a definition for data write/read counters
      from SMART log, (See section 5.14.1.2):
      	This value is reported in thousands (i.e., a value of 1
      	corresponds to 1000 units of 512 bytes read) and is rounded up.
      
      However, in nvme target where value is reported with actual units,
      but not thousands of units as the spec requires.
      Signed-off-by: NTom Wu <tomwu@mellanox.com>
      Reviewed-by: NIsrael Rukshin <israelr@mellanox.com>
      Reviewed-by: NMax Gurtovoy <maxg@mellanox.com>
      Reviewed-by: NChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      9edc229b
    • S
      x86/mm/pti: Handle unaligned address gracefully in pti_clone_pagetable() · 7bbb7a9d
      Song Liu 提交于
      [ Upstream commit 825d0b73cd7526b0bb186798583fae810091cbac ]
      
      pti_clone_pmds() assumes that the supplied address is either:
      
       - properly PUD/PMD aligned
      or
       - the address is actually mapped which means that independently
         of the mapping level (PUD/PMD/PTE) the next higher mapping
         exists.
      
      If that's not the case the unaligned address can be incremented by PUD or
      PMD size incorrectly. All callers supply mapped and/or aligned addresses,
      but for the sake of robustness it's better to handle that case properly and
      to emit a warning.
      
      [ tglx: Rewrote changelog and added WARN_ON_ONCE() ]
      Signed-off-by: NSong Liu <songliubraving@fb.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NIngo Molnar <mingo@kernel.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1908282352470.1938@nanos.tec.linutronix.deSigned-off-by: NSasha Levin <sashal@kernel.org>
      7bbb7a9d
    • S
      ASoC: fsl_ssi: Fix clock control issue in master mode · 5201b4ff
      Shengjiu Wang 提交于
      [ Upstream commit 696d05225cebffd172008d212657be90e823eac0 ]
      
      The test case is
      arecord -Dhw:0 -d 10 -f S16_LE -r 48000 -c 2 temp.wav &
      aplay -Dhw:0 -d 30 -f S16_LE -r 48000 -c 2 test.wav
      
      There will be error after end of arecord:
      aplay: pcm_write:2051: write error: Input/output error
      
      Capture and Playback work in parallel in master mode, one
      substream stops, the other substream is impacted, the
      reason is that clock is disabled wrongly.
      
      The clock's reference count is not increased when second
      substream starts, the hw_param() function returns in the
      beginning because first substream is enabled, then in end
      of first substream, the hw_free() disables the clock.
      
      This patch is to move the clock enablement to the place
      before checking of the device enablement in hw_param().
      Signed-off-by: NShengjiu Wang <shengjiu.wang@nxp.com>
      Link: https://lore.kernel.org/r/1567012817-12625-1-git-send-email-shengjiu.wang@nxp.comSigned-off-by: NMark Brown <broonie@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      5201b4ff
    • T
      x86/mm/pti: Do not invoke PTI functions when PTI is disabled · 4b7d9c2a
      Thomas Gleixner 提交于
      [ Upstream commit 990784b57731192b7d90c8d4049e6318d81e887d ]
      
      When PTI is disabled at boot time either because the CPU is not affected or
      PTI has been disabled on the command line, the boot code still calls into
      pti_finalize() which then unconditionally invokes:
      
           pti_clone_entry_text()
           pti_clone_kernel_text()
      
      pti_clone_kernel_text() was called unconditionally before the 32bit support
      was added and 32bit added the call to pti_clone_entry_text().
      
      The call has no side effects as cloning the page tables into the available
      second one, which was allocated for PTI does not create damage. But it does
      not make sense either and in case that this functionality would be extended
      later this might actually lead to hard to diagnose issues.
      
      Neither function should be called when PTI is runtime disabled. Make the
      invocation conditional.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NDave Hansen <dave.hansen@linux.intel.com>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Acked-by: NSong Liu <songliubraving@fb.com>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/20190828143124.063353972@linutronix.deSigned-off-by: NSasha Levin <sashal@kernel.org>
      4b7d9c2a
    • M
      arm64: kpti: ensure patched kernel text is fetched from PoU · eb2485e3
      Mark Rutland 提交于
      [ Upstream commit f32c7a8e45105bd0af76872bf6eef0438ff12fb2 ]
      
      While the MMUs is disabled, I-cache speculation can result in
      instructions being fetched from the PoC. During boot we may patch
      instructions (e.g. for alternatives and jump labels), and these may be
      dirty at the PoU (and stale at the PoC).
      
      Thus, while the MMU is disabled in the KPTI pagetable fixup code we may
      load stale instructions into the I-cache, potentially leading to
      subsequent crashes when executing regions of code which have been
      modified at runtime.
      
      Similarly to commit:
      
        8ec41987 ("arm64: mm: ensure patched kernel text is fetched from PoU")
      
      ... we can invalidate the I-cache after enabling the MMU to prevent such
      issues.
      
      The KPTI pagetable fixup code itself should be clean to the PoC per the
      boot protocol, so no maintenance is required for this code.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Reviewed-by: NJames Morse <james.morse@arm.com>
      Signed-off-by: NWill Deacon <will@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      eb2485e3
    • N
      x86/apic/vector: Warn when vector space exhaustion breaks affinity · b6194965
      Neil Horman 提交于
      [ Upstream commit 743dac494d61d991967ebcfab92e4f80dc7583b3 ]
      
      On x86, CPUs are limited in the number of interrupts they can have affined
      to them as they only support 256 interrupt vectors per CPU. 32 vectors are
      reserved for the CPU and the kernel reserves another 22 for internal
      purposes. That leaves 202 vectors for assignement to devices.
      
      When an interrupt is set up or the affinity is changed by the kernel or the
      administrator, the vector assignment code attempts to honor the requested
      affinity mask. If the vector space on the CPUs in that affinity mask is
      exhausted the code falls back to a wider set of CPUs and assigns a vector
      on a CPU outside of the requested affinity mask silently.
      
      While the effective affinity is reflected in the corresponding
      /proc/irq/$N/effective_affinity* files the silent breakage of the requested
      affinity can lead to unexpected behaviour for administrators.
      
      Add a pr_warn() when this happens so that adminstrators get at least
      informed about it in the syslog.
      
      [ tglx: Massaged changelog and made the pr_warn() more informative ]
      
      Reported-by: djuran@redhat.com
      Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: djuran@redhat.com
      Link: https://lkml.kernel.org/r/20190822143421.9535-1-nhorman@tuxdriver.comSigned-off-by: NSasha Levin <sashal@kernel.org>
      b6194965
    • D
      sched/cpufreq: Align trace event behavior of fast switching · 01e8f487
      Douglas RAILLARD 提交于
      [ Upstream commit 77c84dd1881d0f0176cb678d770bfbda26c54390 ]
      
      Fast switching path only emits an event for the CPU of interest, whereas the
      regular path emits an event for all the CPUs that had their frequency changed,
      i.e. all the CPUs sharing the same policy.
      
      With the current behavior, looking at cpu_frequency event for a given CPU that
      is using the fast switching path will not give the correct frequency signal.
      Signed-off-by: NDouglas RAILLARD <douglas.raillard@arm.com>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      01e8f487
    • A
      ACPI / CPPC: do not require the _PSD method · 2919fa03
      Al Stone 提交于
      [ Upstream commit 4c4cdc4c63853fee48c02e25c8605fb65a6c9924 ]
      
      According to the ACPI 6.3 specification, the _PSD method is optional
      when using CPPC.  The underlying assumption is that each CPU can change
      frequency independently from all other CPUs; _PSD is provided to tell
      the OS that some processors can NOT do that.
      
      However, the acpi_get_psd() function returns ENODEV if there is no _PSD
      method present, or an ACPI error status if an error occurs when evaluating
      _PSD, if present.  This makes _PSD mandatory when using CPPC, in violation
      of the specification, and only on Linux.
      
      This has forced some firmware writers to provide a dummy _PSD, even though
      it is irrelevant, but only because Linux requires it; other OSPMs follow
      the spec.  We really do not want to have OS specific ACPI tables, though.
      
      So, correct acpi_get_psd() so that it does not return an error if there
      is no _PSD method present, but does return a failure when the method can
      not be executed properly.  This allows _PSD to be optional as it should
      be.
      Signed-off-by: NAl Stone <ahs3@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      2919fa03
    • K
      ASoC: es8316: fix headphone mixer volume table · b7992213
      Katsuhiro Suzuki 提交于
      [ Upstream commit f972d02fee2496024cfd6f59021c9d89d54922a6 ]
      
      This patch fix setting table of Headphone mixer volume.
      Current code uses 4 ... 7 values but these values are prohibited.
      
      Correct settings are the following:
        0000 -12dB
        0001 -10.5dB
        0010 -9dB
        0011 -7.5dB
        0100 -6dB
        1000 -4.5dB
        1001 -3dB
        1010 -1.5dB
        1011 0dB
      Signed-off-by: NKatsuhiro Suzuki <katsuhiro@katsuster.net>
      Reviewed-by: NDaniel Drake <drake@endlessm.com>
      Link: https://lore.kernel.org/r/20190826153900.25969-1-katsuhiro@katsuster.netSigned-off-by: NMark Brown <broonie@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      b7992213
    • M
      media: ov9650: add a sanity check · dd25f76c
      Mauro Carvalho Chehab 提交于
      [ Upstream commit 093347abc7a4e0490e3c962ecbde2dc272a8f708 ]
      
      As pointed by cppcheck:
      
      	[drivers/media/i2c/ov9650.c:706]: (error) Shifting by a negative value is undefined behaviour
      	[drivers/media/i2c/ov9650.c:707]: (error) Shifting by a negative value is undefined behaviour
      	[drivers/media/i2c/ov9650.c:721]: (error) Shifting by a negative value is undefined behaviour
      
      Prevent mangling with gains with invalid values.
      
      As pointed by Sylvester, this should never happen in practice,
      as min value of V4L2_CID_GAIN control is 16 (gain is always >= 16
      and m is always >= 0), but it is too hard for a static analyzer
      to get this, as the logic with validates control min/max is
      elsewhere inside V4L2 core.
      Reviewed-by: NSylwester Nawrocki <s.nawrocki@samsung.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      dd25f76c
    • B
      perf trace beauty ioctl: Fix off-by-one error in cmd->string table · 342a0bee
      Benjamin Peterson 提交于
      [ Upstream commit b92675f4a9c02dd78052645597dac9e270679ddf ]
      
      While tracing a program that calls isatty(3), I noticed that strace
      reported TCGETS for the request argument of the underlying ioctl(2)
      syscall while perf trace reported TCSETS. strace is corrrect. The bug in
      perf was due to the tty ioctl beauty table starting at 0x5400 rather
      than 0x5401.
      
      Committer testing:
      
        Using augmented_raw_syscalls.o and settings to make 'perf trace'
        use strace formatting, i.e. with this in ~/.perfconfig
      
        # cat ~/.perfconfig
        [trace]
      	add_events = /home/acme/git/linux/tools/perf/examples/bpf/augmented_raw_syscalls.c
      	show_zeros = yes
      	show_duration = no
      	no_inherit = yes
      	show_timestamp = no
      	show_arg_names = no
      	args_alignment = 40
      	show_prefix = yes
      
        # strace -e ioctl stty > /dev/null
        ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
        ioctl(1, TIOCGWINSZ, 0x7fff8a9b0860)    = -1 ENOTTY (Inappropriate ioctl for device)
        ioctl(1, TCGETS, 0x7fff8a9b0540)        = -1 ENOTTY (Inappropriate ioctl for device)
        +++ exited with 0 +++
        #
      
      Before:
      
        # perf trace -e ioctl stty > /dev/null
        ioctl(0, TCSETS, 0x7fff2cf79f20)        = 0
        ioctl(1, TIOCSWINSZ, 0x7fff2cf79f40)    = -1 ENOTTY (Inappropriate ioctl for device)
        ioctl(1, TCSETS, 0x7fff2cf79c20)        = -1 ENOTTY (Inappropriate ioctl for device)
        #
      
      After:
      
        # perf trace -e ioctl stty > /dev/null
        ioctl(0, TCGETS, 0x7ffed0763920)        = 0
        ioctl(1, TIOCGWINSZ, 0x7ffed0763940)    = -1 ENOTTY (Inappropriate ioctl for device)
        ioctl(1, TCGETS, 0x7ffed0763620)        = -1 ENOTTY (Inappropriate ioctl for device)
        #
      Signed-off-by: NBenjamin Peterson <benjamin@python.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Fixes: 1cc47f2d ("perf trace beauty ioctl: Improve 'cmd' beautifier")
      Link: http://lkml.kernel.org/r/20190823033625.18814-1-benjamin@python.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      342a0bee
    • M
      media: saa7134: fix terminology around saa7134_i2c_eeprom_md7134_gate() · 57409ea7
      Maciej S. Szmigiero 提交于
      [ Upstream commit 9d802222a3405599d6e1984d9324cddf592ea1f4 ]
      
      saa7134_i2c_eeprom_md7134_gate() function and the associated comment uses
      an inverted i2c gate open / closed terminology.
      Let's fix this.
      Signed-off-by: NMaciej S. Szmigiero <mail@maciej.szmigiero.name>
      Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      [hverkuil-cisco@xs4all.nl: fix alignment checkpatch warning]
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      57409ea7
    • W
      media: cpia2_usb: fix memory leaks · 78550c5c
      Wenwen Wang 提交于
      [ Upstream commit 1c770f0f52dca1a2323c594f01f5ec6f1dddc97f ]
      
      In submit_urbs(), 'cam->sbuf[i].data' is allocated through kmalloc_array().
      However, it is not deallocated if the following allocation for urbs fails.
      To fix this issue, free 'cam->sbuf[i].data' if usb_alloc_urb() fails.
      Signed-off-by: NWenwen Wang <wenwen@cs.uga.edu>
      Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      78550c5c
    • W
      media: saa7146: add cleanup in hexium_attach() · d796c6c1
      Wenwen Wang 提交于
      [ Upstream commit 42e64117d3b4a759013f77bbcf25ab6700e55de7 ]
      
      If saa7146_register_device() fails, no cleanup is executed, leading to
      memory/resource leaks. To fix this issue, perform necessary cleanup work
      before returning the error.
      Signed-off-by: NWenwen Wang <wenwen@cs.uga.edu>
      Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      d796c6c1
    • H
      media: cec-notifier: clear cec_adap in cec_notifier_unregister · ab20f38c
      Hans Verkuil 提交于
      [ Upstream commit 14d5511691e5290103bc480998bc322e68f139d4 ]
      
      If cec_notifier_cec_adap_unregister() is called before
      cec_unregister_adapter() then everything is OK (and this is the
      case today). But if it is the other way around, then
      cec_notifier_unregister() is called first, and that doesn't
      set n->cec_adap to NULL.
      
      So if e.g. cec_notifier_set_phys_addr() is called after
      cec_notifier_unregister() but before cec_unregister_adapter()
      then n->cec_adap points to an unregistered and likely deleted
      cec adapter. So just set n->cec_adap->notifier and n->cec_adap
      to NULL for rubustness.
      
      Eventually cec_notifier_unregister will disappear and this will
      be simplified substantially.
      Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      ab20f38c
    • K
      PM / devfreq: exynos-bus: Correct clock enable sequence · d51268d7
      Kamil Konieczny 提交于
      [ Upstream commit 2c2b20e0da89c76759ee28c6824413ab2fa3bfc6 ]
      
      Regulators should be enabled before clocks to avoid h/w hang. This
      require change in exynos_bus_probe() to move exynos_bus_parse_of()
      after exynos_bus_parent_parse_of() and change in error handling.
      Similar change is needed in exynos_bus_exit() where clock should be
      disabled before regulators.
      Signed-off-by: NKamil Konieczny <k.konieczny@partner.samsung.com>
      Acked-by: NChanwoo Choi <cw00.choi@samsung.com>
      Signed-off-by: NMyungJoo Ham <myungjoo.ham@samsung.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      d51268d7
    • L
      PM / devfreq: passive: Use non-devm notifiers · 7e19b7e0
      Leonard Crestez 提交于
      [ Upstream commit 0ef7c7cce43f6ecc2b96d447e69b2900a9655f7c ]
      
      The devfreq passive governor registers and unregisters devfreq
      transition notifiers on DEVFREQ_GOV_START/GOV_STOP using devm wrappers.
      
      If devfreq itself is registered with devm then a warning is triggered on
      rmmod from devm_devfreq_unregister_notifier. Call stack looks like this:
      
      	devm_devfreq_unregister_notifier+0x30/0x40
      	devfreq_passive_event_handler+0x4c/0x88
      	devfreq_remove_device.part.8+0x6c/0x9c
      	devm_devfreq_dev_release+0x18/0x20
      	release_nodes+0x1b0/0x220
      	devres_release_all+0x78/0x84
      	device_release_driver_internal+0x100/0x1c0
      	driver_detach+0x4c/0x90
      	bus_remove_driver+0x7c/0xd0
      	driver_unregister+0x2c/0x58
      	platform_driver_unregister+0x10/0x18
      	imx_devfreq_platdrv_exit+0x14/0xd40 [imx_devfreq]
      
      This happens because devres_release_all will first remove all the nodes
      into a separate todo list so the nested devres_release from
      devm_devfreq_unregister_notifier won't find anything.
      
      Fix the warning by calling the non-devm APIS for frequency notification.
      Using devm wrappers is not actually useful for a governor anyway: it
      relies on the devfreq core to correctly match the GOV_START/GOV_STOP
      notifications.
      
      Fixes: 99613311 ("PM / devfreq: Add new passive governor")
      Signed-off-by: NLeonard Crestez <leonard.crestez@nxp.com>
      Acked-by: NChanwoo Choi <cw00.choi@samsung.com>
      Signed-off-by: NMyungJoo Ham <myungjoo.ham@samsung.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      7e19b7e0