From patchwork Thu Sep 13 11:39:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 146624 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp496853ljw; Thu, 13 Sep 2018 04:39:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY+EtMjdjm19Dv2BqRCOVxkg5Rug+MKkM8+5eFlANTk5E6/d/0CN70T2FJJqNT7sj3oxKKh X-Received: by 2002:a1c:610b:: with SMTP id v11-v6mr5365545wmb.20.1536838763738; Thu, 13 Sep 2018 04:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536838763; cv=none; d=google.com; s=arc-20160816; b=LPEHNaFumF7UgS5ZS2oY1XMRAh+s2bt4RhigyIw6YNZDMLLWR3sLSbo6BhdjtOHg9n n+n3d7fBghO4nUSWeyy2/iSqJuWiMDo9xsJ6FzJZuWw2ovoc64xEuraCQQ3kJCX8aZwF wp6e+OdSbRvZbEJ32qLBzpdr+QGdSbPcWzUW5fcjXnIVnwkxswUNUXXf+RBvOvn1DPkm F1vl703loM0LNpDu5NKR9sKLFPi/3/tjFall2d/V3JHYOnpJWq1ZZi/P94bVZr+T1G/0 2OhJDcnQRzhCrMGFjw9bjts3pE7Eb0YIYrOvFWvKA87O/HmwGyUMAJTttF+ElA9PX0sk mS2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to; bh=pcG8dTjf3CW0RwzmObGhwlMYtZIHEy6Me/s63zWhI5w=; b=zOXRldoO3i1tbzKqZTGfWq3q8tCXkludhEO8Rug7b5RgWdFiRiUUQN+HLnGQsautUF lJ+lDT62iPCfucTCodDSBvZzIP3nl9rIfHk73nXN4ELTWUyFdIASPhEv7lPxq/ECV8VB ByCDbPpirhSCX8RaQ88zJ5YzrdQm2PZJoIOPrV3ddRcyaYTrE7Wm1j/zo9GGuIPxYIcY H14jsEFroe39nzhAykpGvZt9Vpq9CUFXvtiixZsadhLXJBAOwnGMk2oIM+Say52KVSuY y3UDmXz6o6DZNriNwlMg/9NoQvipY8re+WGkIztUn4CtB+PY9GrvLWv7YncFOMBn3LFL SIkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b="hWuDX/oS"; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id f2-v6si3315157wma.73.2018.09.13.04.39.23; Thu, 13 Sep 2018 04:39:23 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b="hWuDX/oS"; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DF94D267806; Thu, 13 Sep 2018 13:39:21 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1B209267846; Thu, 13 Sep 2018 13:39:20 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 847D72677BB for ; Thu, 13 Sep 2018 13:39:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=pQB0fgaVYFYS3KKx9pckaclltqEuQvX0SWM+ThtSGOE=; b=hWuDX/oSoymo flc2PqJmem8GkFKEqnOSFQkGb5Dx/VtkeVsU9LnWI8cPRwP1HkMKJC5y9F4Rfz0Zmg+e7BBiC/Fc6 y9NJSf9kLrGEeBjqKyMKDSzZpriimGFuJGeFjrETaPCuWh33tRaQ/TdWQnA9FOlWhcQubVLMTSbaI CXGuY=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=debutante.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpa (Exim 4.89) (envelope-from ) id 1g0Pxu-0000J8-5H; Thu, 13 Sep 2018 11:39:18 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id D06B01121CA5; Thu, 13 Sep 2018 12:39:17 +0100 (BST) From: Mark Brown To: Yu Zhao In-Reply-To: Message-Id: <20180913113917.D06B01121CA5@debutante.sirena.org.uk> Date: Thu, 13 Sep 2018 12:39:17 +0100 (BST) Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "Revert "ASoC: Intel: Skylake: Acquire irq after RIRB allocation"" to the asoc tree X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org The patch Revert "ASoC: Intel: Skylake: Acquire irq after RIRB allocation" has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 542cedec53c9e8b73f3f05bf8468823598c50489 Mon Sep 17 00:00:00 2001 From: Yu Zhao Date: Tue, 11 Sep 2018 15:12:46 -0600 Subject: [PATCH] Revert "ASoC: Intel: Skylake: Acquire irq after RIRB allocation" This reverts commit 12eeeb4f4733bbc4481d01df35933fc15beb8b19. 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 [ 16.950903] Call Trace: [ 16.950906] [ 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] [ 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: Yu Zhao Signed-off-by: Mark Brown --- sound/soc/intel/skylake/skl.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- 2.19.0.rc2 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index cf09721ca13e..dce649485649 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -838,7 +838,11 @@ static int skl_first_init(struct hdac_bus *bus) snd_hdac_bus_parse_capabilities(bus); + if (skl_acquire_irq(bus, 0) < 0) + return -EBUSY; + pci_set_master(pci); + synchronize_irq(bus->irq); gcap = snd_hdac_chip_readw(bus, GCAP); dev_dbg(bus->dev, "chipset global capabilities = 0x%x\n", gcap); @@ -871,12 +875,6 @@ static int skl_first_init(struct hdac_bus *bus) if (err < 0) return err; - err = skl_acquire_irq(bus, 0); - if (err < 0) - return err; - - synchronize_irq(bus->irq); - /* initialize chip */ skl_init_pci(skl);