From patchwork Thu Sep 13 11:36:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 146623 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp494488ljw; Thu, 13 Sep 2018 04:37:00 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZenmIOkRSPgMnU9W6M3DE3qsXUFEGJJe5M68xnJbucl5jBf2YGDg5JiqdEm3UiKZa679ju X-Received: by 2002:a1c:1a48:: with SMTP id a69-v6mr5071132wma.43.1536838619989; Thu, 13 Sep 2018 04:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536838619; cv=none; d=google.com; s=arc-20160816; b=HK45RoXCOBhaktRszS5UECfbYMM00GSt3/PjW3rB+hKT+NdqTSmwFiMmtGn6gHboOi SptffjYxLzHBgAcqEpxPotE/7LhXytJj4WecwVbKdFHVNJLZd2Gz3bwB/upCLtaQTr3A egXwyOv20iyYh5iH/y+YE36ia0PMtzUAkQv0flU+gmpvrvV8DS40YW46N7KkmeOMapSG mp2gaspl7fTt35343zbczidKeVhpYwkZWy+I4OAdrDS2RalrQFxKTn17vho1boOgDz8j fPT3S++q2iaYc/MhFehmogCe9oDzry8taGkgvXiStFZCAvXnJkgPiplmff+DnkPvFIlN MCXw== 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=e9Pnm8L9qcgThnBTKDzwSvS/TlWDVgPlTsMBuNiwSXc=; b=C4acul26722CY9FszB3N1DYpa83S35+roRHB4YIpswycQtzkWlIE2L6kWosFLhLs9f v/ykKKDoarf7ebOC7jU0qpFd4dlWzZdKHxEFFPQFacMWFvmhqRR+gPyeq0gpBdcRzya6 ZSzLODcZK+EZLBPKXkGRQH47Wp9z3rl7uQkFod9+t7jBTsLQX8rR9ul+6RrUzuINjISo RmAKNgrtDBFrGEBrHnOiGwE9qyEe/uYAn0cV9DEfzZNcw0EPwrYAJB1CJbfysNxDZ6PC wvYmdMA+IEqFw8XGb095eod3e183m+vHsgkXmfFngfxfO6qlW/LzipUfO36wn3/FFjcx celw== 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=P67tgm4Y; 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 65-v6si3649334wmw.37.2018.09.13.04.36.59; Thu, 13 Sep 2018 04:36:59 -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=P67tgm4Y; 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 0048C267806; Thu, 13 Sep 2018 13:36:58 +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 44F58267846; Thu, 13 Sep 2018 13:36:55 +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 6B1582677BB for ; Thu, 13 Sep 2018 13:36:53 +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=cC56pbsNhwSgTABAoAocg4rBw2Edm1wV0DtGxQ9FSw0=; b=P67tgm4Yf2Yd 6x83SQtvDcOGLVe0QiERcjkzx8ucopwzOMZ0YP7DOd9PIy8N2Jphe+hkWW2vRrH+5cqwt1r3dcHMz dPKt/hRdhhPmJAuW6jIR8mnU2vBDUdQMCHacGo5JPtI2uCDYeCxBFTA/fES7hm+LkLZa07PDPTfX7 yCXqM=; 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 1g0PvZ-0000Ix-8I; Thu, 13 Sep 2018 11:36:53 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id 032791121CA5; Thu, 13 Sep 2018 12:36:53 +0100 (BST) From: Mark Brown To: Yu Zhao In-Reply-To: Message-Id: <20180913113653.032791121CA5@debutante.sirena.org.uk> Date: Thu, 13 Sep 2018 12:36:52 +0100 (BST) Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "sound: enable interrupt after dma buffer initialization" 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 sound: enable interrupt after dma buffer initialization 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 b61749a89f826eb61fc59794d9e4697bd246eb61 Mon Sep 17 00:00:00 2001 From: Yu Zhao Date: Tue, 11 Sep 2018 15:14:04 -0600 Subject: [PATCH] sound: enable interrupt after dma buffer initialization 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: Takashi Iwai Signed-off-by: Yu Zhao Signed-off-by: Mark Brown --- sound/hda/hdac_controller.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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/hda/hdac_controller.c b/sound/hda/hdac_controller.c index 560ec0986e1a..11057d9f84ec 100644 --- a/sound/hda/hdac_controller.c +++ b/sound/hda/hdac_controller.c @@ -40,6 +40,8 @@ static void azx_clear_corbrp(struct hdac_bus *bus) */ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus) { + WARN_ON_ONCE(!bus->rb.area); + spin_lock_irq(&bus->reg_lock); /* CORB set up */ bus->corb.addr = bus->rb.addr; @@ -479,13 +481,15 @@ bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset) /* reset controller */ azx_reset(bus, full_reset); - /* initialize interrupts */ + /* clear interrupts */ azx_int_clear(bus); - azx_int_enable(bus); /* initialize the codec command I/O */ snd_hdac_bus_init_cmd_io(bus); + /* enable interrupts after CORB/RIRB buffers are initialized above */ + azx_int_enable(bus); + /* program the position buffer */ if (bus->use_posbuf && bus->posbuf.addr) { snd_hdac_chip_writel(bus, DPLBASE, (u32)bus->posbuf.addr);