1. 17 9月, 2018 4 次提交
  2. 13 9月, 2018 4 次提交
    • T
      ALSA: hda - Enable runtime PM only for discrete GPU · 37a3a98e
      Takashi Iwai 提交于
      The recent change of vga_switcheroo allowed the runtime PM for
      HD-audio on AMD GPUs, but this also resulted in a regression.  When
      the HD-audio controller driver gets runtime-suspended, HD-audio link
      is turned off, and the hotplug notification is ignored.  This leads to
      the inconsistent audio state (the connection isn't notified and ELD is
      ignored).
      
      The best fix would be to implement the proper ELD notification via the
      audio component, but it's still not ready.  As a quick workaround,
      this patch adds the check of runtime_idle and allows the runtime
      suspend only when the vga_switcheroo is bound with discrete GPU.
      That is, a system with a single GPU and APU would be again without
      runtime PM to keep the HD-audio link for the hotplug notification and
      ELD read out.
      
      Also, the codec->auto_runtime_pm flag is set only for the discrete GPU
      at the time GPU gets bound via vga_switcheroo (i.e. only dGPU is
      forcibly runtime-PM enabled), so that APU can still get the ELD
      notification.
      
      For identifying which GPU is bound, a new vga_switcheroo client
      callback, gpu_bound, is implemented.  The vga_switcheroo simply calls
      this when GPU is bound, and tells whether it's dGPU or APU.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200945
      Fixes: 07f4f97d ("vga_switcheroo: Use device link for HDA controller")
      Reported-by: NJian-Hong Pan <jian-hong@endlessm.com>
      Tested-by: NJian-Hong Pan <jian-hong@endlessm.com>
      Acked-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      37a3a98e
    • T
      ALSA: oxfw: fix memory leak of private data · 498fe23a
      Takashi Sakamoto 提交于
      Although private data of sound card instance is usually allocated in the
      tail of the instance, drivers in ALSA firewire stack allocate the private
      data before allocating the instance. In this case, the private data
      should be released explicitly at .private_free callback of the instance.
      
      This commit fixes memory leak following to the above design.
      
      Fixes: 6c29230e ('ALSA: oxfw: delayed registration of sound card')
      Cc: <stable@vger.kernel.org> # v4.7+
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      498fe23a
    • T
      ALSA: firewire-tascam: fix memory leak of private data · 8d28277c
      Takashi Sakamoto 提交于
      Although private data of sound card instance is usually allocated in the
      tail of the instance, drivers in ALSA firewire stack allocate the private
      data before allocating the instance. In this case, the private data
      should be released explicitly at .private_free callback of the instance.
      
      This commit fixes memory leak following to the above design.
      
      Fixes: b610386c ('ALSA: firewire-tascam: deleyed registration of sound card')
      Cc: <stable@vger.kernel.org> # v4.7+
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      8d28277c
    • T
      ALSA: firewire-digi00x: fix memory leak of private data · a49a83ab
      Takashi Sakamoto 提交于
      Although private data of sound card instance is usually allocated in the
      tail of the instance, drivers in ALSA firewire stack allocate the private
      data before allocating the instance. In this case, the private data
      should be released explicitly at .private_free callback of the instance.
      
      This commit fixes memory leak following to the above design.
      
      Fixes: 86c8dd7f ('ALSA: firewire-digi00x: delayed registration of sound card')
      Cc: <stable@vger.kernel.org> # v4.7+
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      a49a83ab
  3. 12 9月, 2018 3 次提交
    • Y
      sound: don't call skl_init_chip() to reset intel skl soc · 75383f8d
      Yu Zhao 提交于
      Internally, skl_init_chip() calls snd_hdac_bus_init_chip() which
      1) sets bus->chip_init to prevent multiple entrances before device
      is stopped; 2) enables interrupt.
      
      We shouldn't use it for the purpose of resetting device only because
      1) when we really want to initialize device, we won't be able to do
      so; 2) we are ready to handle interrupt yet, and kernel crashes when
      interrupt comes in.
      
      Rename azx_reset() to snd_hdac_bus_reset_link(), and use it to reset
      device properly.
      
      Fixes: 60767abc ("ASoC: Intel: Skylake: Reset the controller in probe")
      Reviewed-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NYu Zhao <yuzhao@google.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      75383f8d
    • Y
      sound: enable interrupt after dma buffer initialization · b61749a8
      Yu Zhao 提交于
      In snd_hdac_bus_init_chip(), we enable interrupt before
      snd_hdac_bus_init_cmd_io() initializing dma buffers. If irq has
      been acquired and irq handler uses the dma buffer, kernel may crash
      when interrupt comes in.
      
      Fix the problem by postponing enabling irq after dma buffer
      initialization. And warn once on null dma buffer pointer during the
      initialization.
      Reviewed-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NYu Zhao <yuzhao@google.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      b61749a8
    • Y
      Revert "ASoC: Intel: Skylake: Acquire irq after RIRB allocation" · 542cedec
      Yu Zhao 提交于
      This reverts commit 12eeeb4f.
      
      The patch doesn't fix accessing memory with null pointer in
      skl_interrupt().
      
      There are two problems: 1) skl_init_chip() is called twice, before
      and after dma buffer is allocate. The first call sets bus->chip_init
      which prevents the second from initializing bus->corb.buf and
      rirb.buf from bus->rb.area. 2) snd_hdac_bus_init_chip() enables
      interrupt before snd_hdac_bus_init_cmd_io() initializing dma buffers.
      There is a small window which skl_interrupt() can be called if irq
      has been acquired. If so, it crashes when using null dma buffer
      pointers.
      
      Will fix the problems in the following patches. Also attaching the
      crash for future reference.
      
      [   16.949148] general protection fault: 0000 [#1] PREEMPT SMP KASAN PTI
      <snipped>
      [   16.950903] Call Trace:
      [   16.950906]  <IRQ>
      [   16.950918]  skl_interrupt+0x19e/0x2d6 [snd_soc_skl]
      [   16.950926]  ? dma_supported+0xb5/0xb5 [snd_soc_skl]
      [   16.950933]  __handle_irq_event_percpu+0x27a/0x6c8
      [   16.950937]  ? __irq_wake_thread+0x1d1/0x1d1
      [   16.950942]  ? __do_softirq+0x57a/0x69e
      [   16.950944]  handle_irq_event_percpu+0x95/0x1ba
      [   16.950948]  ? _raw_spin_unlock+0x65/0xdc
      [   16.950951]  ? __handle_irq_event_percpu+0x6c8/0x6c8
      [   16.950953]  ? _raw_spin_unlock+0x65/0xdc
      [   16.950957]  ? time_cpufreq_notifier+0x483/0x483
      [   16.950959]  handle_irq_event+0x89/0x123
      [   16.950962]  handle_fasteoi_irq+0x16f/0x425
      [   16.950965]  handle_irq+0x1fe/0x28e
      [   16.950969]  do_IRQ+0x6e/0x12e
      [   16.950972]  common_interrupt+0x7a/0x7a
      [   16.950974]  </IRQ>
      <snipped>
      [   16.951031] RIP: snd_hdac_bus_update_rirb+0x19b/0x4cf [snd_hda_core] RSP: ffff88015c807c08
      [   16.951036] ---[ end trace 58bf9ece1775bc92 ]---
      
      Fixes: 2eeeb4f4733b ("ASoC: Intel: Skylake: Acquire irq after RIRB allocation")
      Signed-off-by: NYu Zhao <yuzhao@google.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      542cedec
  4. 10 9月, 2018 5 次提交
  5. 06 9月, 2018 2 次提交
  6. 04 9月, 2018 1 次提交
  7. 03 9月, 2018 3 次提交
    • J
      ASoC: rsnd: fixup not to call clk_get/set under non-atomic · 4d230d12
      Jiada Wang 提交于
      Clocking operations clk_get/set_rate, are non-atomic,
      they shouldn't be called in soc_pcm_trigger() which is atomic.
      
      Following issue was found due to execution of clk_get_rate() causes
      sleep in soc_pcm_trigger(), which shouldn't be blocked.
      
      We can reproduce this issue by following
      	> enable CONFIG_DEBUG_ATOMIC_SLEEP=y
      	> compile, and boot
      	> mount -t debugfs none /sys/kernel/debug
      	> while true; do cat /sys/kernel/debug/clk/clk_summary > /dev/null; done &
      	> while true; do aplay xxx; done
      
      This patch adds support to .prepare callback, and moves non-atomic
      clocking operations to it. As .prepare is non-atomic, it is always
      called before trigger_start/trigger_stop.
      
      	BUG: sleeping function called from invalid context at kernel/locking/mutex.c:620
      	in_atomic(): 1, irqs_disabled(): 128, pid: 2242, name: aplay
      	INFO: lockdep is turned off.
      	irq event stamp: 5964
      	hardirqs last enabled at (5963): [<ffff200008e59e40>] mutex_lock_nested+0x6e8/0x6f0
      	hardirqs last disabled at (5964): [<ffff200008e623f0>] _raw_spin_lock_irqsave+0x24/0x68
      	softirqs last enabled at (5502): [<ffff200008081838>] __do_softirq+0x560/0x10c0
      	softirqs last disabled at (5495): [<ffff2000080c2e78>] irq_exit+0x160/0x25c
      	Preemption disabled at:[ 62.904063] [<ffff200008be4d48>] snd_pcm_stream_lock+0xb4/0xc0
      	CPU: 2 PID: 2242 Comm: aplay Tainted: G B C 4.9.54+ #186
      	Hardware name: Renesas Salvator-X board based on r8a7795 (DT)
      	Call trace:
      	[<ffff20000808fe48>] dump_backtrace+0x0/0x37c
      	[<ffff2000080901d8>] show_stack+0x14/0x1c
      	[<ffff2000086f4458>] dump_stack+0xfc/0x154
      	[<ffff2000081134a0>] ___might_sleep+0x57c/0x58c
      	[<ffff2000081136b8>] __might_sleep+0x208/0x21c
      	[<ffff200008e5980c>] mutex_lock_nested+0xb4/0x6f0
      	[<ffff2000087cac74>] clk_prepare_lock+0xb0/0x184
      	[<ffff2000087cb094>] clk_core_get_rate+0x14/0x54
      	[<ffff2000087cb0f4>] clk_get_rate+0x20/0x34
      	[<ffff20000113aa00>] rsnd_adg_ssi_clk_try_start+0x158/0x4f8 [snd_soc_rcar]
      	[<ffff20000113da00>] rsnd_ssi_init+0x668/0x7a0 [snd_soc_rcar]
      	[<ffff200001133ff4>] rsnd_soc_dai_trigger+0x4bc/0xcf8 [snd_soc_rcar]
      	[<ffff200008c1af24>] soc_pcm_trigger+0x2a4/0x2d4
      
      Fixes: e7d850dd ("ASoC: rsnd: use mod base common method on SSI-parent")
      Signed-off-by: NJiada Wang <jiada_wang@mentor.com>
      Signed-off-by: NTimo Wischer <twischer@de.adit-jv.com>
      [Kuninori: tidyup for upstream]
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Tested-by: NHiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      4d230d12
    • T
      ALSA: rawmidi: Initialize allocated buffers · 5a7b44a8
      Takashi Iwai 提交于
      syzbot reported the uninitialized value exposure in certain situations
      using virmidi loop.  It's likely a very small race at writing and
      reading, and the influence is almost negligible.  But it's safer to
      paper over this just by replacing the existing kvmalloc() with
      kvzalloc().
      
      Reported-by: syzbot+194dffdb8b22fc5d207a@syzkaller.appspotmail.com
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      5a7b44a8
    • S
      ASoC: q6routing: initialize data correctly · 7aa09ff2
      Srinivas Kandagatla 提交于
      Some of the router data fields are left as default zeros which are
      valid dai ids, so initialize these to invalid value of -1.
      
      Without intializing these correctly get_session_from_id() can return
      incorrect session resulting in not closing the opened copp and messing
      up with the copp ref count.
      
      Fixes: e3a33673 ("ASoC: qdsp6: q6routing: Add q6routing driver")
      Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      7aa09ff2
  8. 31 8月, 2018 1 次提交
    • A
      ASoC: tas6424: Save last fault register even when clear · d40e3e9e
      Andrew F. Davis 提交于
      When there is no fault bit set in a fault register we skip the fault
      reporting section for that register. This also skips over saving that
      registers value. We save the value so we will not double report an
      error, but if an error clears then returns we will also not report it
      as we did not save the all cleared register value. Fix this by saving
      the fault register value in the all clear path.
      Signed-off-by: NAndrew F. Davis <afd@ti.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      d40e3e9e
  9. 30 8月, 2018 1 次提交
    • T
      ALSA: hda - Fix cancel_work_sync() stall from jackpoll work · 16037643
      Takashi Iwai 提交于
      On AMD/ATI controllers, the HD-audio controller driver allows a bus
      reset upon the error recovery, and its procedure includes the
      cancellation of pending jack polling work as found in
      snd_hda_bus_codec_reset().  This works usually fine, but it becomes a
      problem when the reset happens from the jack poll work itself; then
      calling cancel_work_sync() from the work being processed tries to wait
      the finish endlessly.
      
      As a workaround, this patch adds the check of current_work() and
      applies the cancel_work_sync() only when it's not from the
      jackpoll_work.
      
      This doesn't fix the root cause of the reported error below, but at
      least, it eases the unexpected stall of the whole system.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200937
      Cc: <stable@vger.kernel.org>
      Cc: Lukas Wunner <lukas@wunner.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      16037643
  10. 29 8月, 2018 4 次提交
  11. 24 8月, 2018 1 次提交
  12. 21 8月, 2018 1 次提交
  13. 20 8月, 2018 3 次提交
  14. 16 8月, 2018 3 次提交
  15. 15 8月, 2018 2 次提交
    • C
      ASoC: dapm: Fix NULL pointer deference on CODEC to CODEC DAIs · 249dc495
      Charles Keepax 提交于
      Commit a655de80 ("ASoC: core: Allow topology to override
      machine driver FE DAI link config.") caused soc_dai_hw_params to
      be come dependent on the substream private_data being set with
      a pointer to the snd_soc_pcm_runtime. Currently, CODEC to CODEC
      links don't set this, which causes a NULL pointer dereference:
      
      [<4069de54>] (soc_dai_hw_params) from
      [<40694b68>] (snd_soc_dai_link_event+0x1a0/0x380)
      
      Since the ASoC core in general assumes that the substream
      private_data will be set to a pointer to the snd_soc_pcm_runtime,
      update the CODEC to CODEC links to respect this.
      Signed-off-by: NCharles Keepax <ckeepax@opensource.cirrus.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      249dc495
    • T
      ALSA: seq: virmidi: Fix discarding the unsubscribed output · 82fd4b05
      Takashi Iwai 提交于
      The recent change to move the virmidi output processing to a work
      slightly modified the code to discard the unsubscribed outputs so that
      it works without a temporary buffer.  However, this is actually buggy,
      and may spew a kernel warning due to the unexpected call of
      snd_rawmidi_transmit_ack(), as triggered by syzbot.
      
      This patch takes back to the original code in that part, use a
      temporary buffer and simply repeat snd_rawmidi_transmit(), in order to
      address the regression.
      
      Fixes: f7debfe5 ("ALSA: seq: virmidi: Offload the output event processing")
      Reported-by: syzbot+ec5f605c91812d200367@syzkaller.appspotmail.com
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      82fd4b05
  16. 14 8月, 2018 2 次提交
    • Y
      ASoC: Intel: Skylake: Acquire irq after RIRB allocation · 12eeeb4f
      Yong Zhi 提交于
      Cold reboot stress test found that the hda irq could access rirb ring
      buffer before its memory gets allocated which resulting in null
      pointer dereference inside snd_hdac_bus_update_rirb().
      
      Fix it by moving the skl_acquire_irq after ring buffer allocation.
      While here, also change err return from -EBUSY to actual error code.
      Signed-off-by: NYong Zhi <yong.zhi@intel.com>
      Acked-by: NPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      12eeeb4f
    • M
      ASoC: wm9712: fix replace codec to component · 5e4cfada
      Marcel Ziswiler 提交于
      Since commit 143b4484 ("ASoC: wm9712: replace codec to component")
      "wm9712-codec" got renamed to "wm9712-component", however, this change
      never got propagated down to the actual board/platform drivers. E.g. on
      Colibri T20 this lead to the following spew upon boot with sound/touch
      being broken:
      
      [    2.214121] tegra-snd-wm9712 sound: ASoC: CODEC DAI wm9712-hifi not registered
      [    2.222137] tegra-snd-wm9712 sound: snd_soc_register_card failed (-517)
      ...
      [    2.344384] tegra-snd-wm9712 sound: ASoC: CODEC DAI wm9712-hifi not registered
      [    2.351885] tegra-snd-wm9712 sound: snd_soc_register_card failed (-517)
      ...
      [    2.668339] tegra-snd-wm9712 sound: ASoC: CODEC DAI wm9712-hifi not registered
      [    2.675811] tegra-snd-wm9712 sound: snd_soc_register_card failed (-517)
      ...
      [    3.208408] tegra-snd-wm9712 sound: ASoC: CODEC DAI wm9712-hifi not registered
      [    3.216312] tegra-snd-wm9712 sound: snd_soc_register_card failed (-517)
      ...
      [    3.235397] tegra-snd-wm9712 sound: ASoC: CODEC DAI wm9712-hifi not registered
      [    3.248938] tegra-snd-wm9712 sound: snd_soc_register_card failed (-517)
      ...
      [   14.970443] ALSA device list:
      [   14.996628]   No soundcards found.
      
      This commit finally fixes this again.
      Signed-off-by: NMarcel Ziswiler <marcel.ziswiler@toradex.com>
      Acked-by: NCharles Keepax <ckeepax@opensource.cirrus.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      5e4cfada