Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2129985pxb; Mon, 12 Apr 2021 15:27:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwopKMkY22TWkwJEmmlAqYWwDpTxJBYZKOV9V/9R4RB3bAi6wEVmMeNO6Yy8zheH12XahEz X-Received: by 2002:a17:90a:6c45:: with SMTP id x63mr1465920pjj.138.1618266450995; Mon, 12 Apr 2021 15:27:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618266450; cv=none; d=google.com; s=arc-20160816; b=NMjCcJSBadWAqSwjNHE/I9JKEJoDLkOjLGDNaovlsgbkyuIAZCUob2LwbO5frl98U3 /Jv6Y1e/s919GDOIxLbAbkF3JuURP2xmrTTbX2Y8x3HRFxVX0tBm3YuRaZwHP7uZsIGJ nFtZILt8y5daUmLe1zA0v+seuP5zUKKg4UaBXUA4+ps+EV8nutpchHtZ5Z0JbOFmqYd3 Aaz5NNfS7/zSl2rNQZvvTSrffUzoY0KzSdPUTvbLf/IfMIH5CeSwFcn40GGu1pED5EYB oW8peSV7ZIAXa0NIhFcTJt7OfONV9q95YACC+bS5Gb31V3CPCXaoAPuYwoMcgMuWPBeV CrgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YIZrdQfiipIOEefqvmCKKP8sZTNb6ffz994orrnkjkw=; b=gA/o04/uVVV397S13ynRISMtcPwilxEJBn9w9odDmR6Wi5wenydlSPSYRFR33hgZn/ jKNiGH+M779T1hVrYccaU35Gm4udWlu6+IjycplW0/eyygyljLR1sd/zgKeMq62O5E27 Fu4QVAKuHmDfpi7U3+0+38Z/BDhm4erSbOCA/8eLASn8rv22iWaWdmdWqh2E1CkBCop+ H2uMauLR2F6UvPPRX6qLME2d13B7pAHiLRZpfA2xLa9wrTD4TOsQTUTvZd1Z6D9teXBM yWqffSpYVwn5QBai1sX10PrmZAJfdONpK75pgMMiYi/ncFjHvOBsXIw4KEKfMPfSCZgB NLaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gpVTWdqQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 19si14502515pgx.504.2021.04.12.15.27.18; Mon, 12 Apr 2021 15:27:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gpVTWdqQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241866AbhDLJaz (ORCPT + 99 others); Mon, 12 Apr 2021 05:30:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:34282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239204AbhDLJHA (ORCPT ); Mon, 12 Apr 2021 05:07:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 538716138A; Mon, 12 Apr 2021 09:03:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618218209; bh=ANqvCsrIDcTNKVska+ktPilrJD2+3obbpeQNLkuYUoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gpVTWdqQEgrVaScpAT/YboTqU/zdk7FdU2kOMp2K5biHDNNk2vJ1KsAXZs9xKKjnH AOCQm0dGkf8IuZb0rbBPcc3zZvs1+AZcOBlNgVisT3j2DpzlQnWaxjCJqyNOUI1s6i Y5/dS1Vr6qBHoWkwhQPa/0izMlWNu6gFYdEOiPSM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Vehmanen , Ranjani Sridharan , Guennadi Liakhovetski , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.11 112/210] ASoC: SOF: Intel: HDA: fix core status verification Date: Mon, 12 Apr 2021 10:40:17 +0200 Message-Id: <20210412084019.741971149@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084016.009884719@linuxfoundation.org> References: <20210412084016.009884719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guennadi Liakhovetski [ Upstream commit 927280909fa7d8e61596800d82f18047c6cfbbe4 ] When checking for enabled cores it isn't enough to check that some of the requested cores are running, we have to check that all of them are. Fixes: 747503b1813a ("ASoC: SOF: Intel: Add Intel specific HDA DSP HW operations") Reviewed-by: Kai Vehmanen Reviewed-by: Ranjani Sridharan Signed-off-by: Guennadi Liakhovetski Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20210322163728.16616-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sof/intel/hda-dsp.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c index 012bac41fee0..ea8e7ad8684d 100644 --- a/sound/soc/sof/intel/hda-dsp.c +++ b/sound/soc/sof/intel/hda-dsp.c @@ -226,10 +226,17 @@ bool hda_dsp_core_is_enabled(struct snd_sof_dev *sdev, val = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPCS); - is_enable = (val & HDA_DSP_ADSPCS_CPA_MASK(core_mask)) && - (val & HDA_DSP_ADSPCS_SPA_MASK(core_mask)) && - !(val & HDA_DSP_ADSPCS_CRST_MASK(core_mask)) && - !(val & HDA_DSP_ADSPCS_CSTALL_MASK(core_mask)); +#define MASK_IS_EQUAL(v, m, field) ({ \ + u32 _m = field(m); \ + ((v) & _m) == _m; \ +}) + + is_enable = MASK_IS_EQUAL(val, core_mask, HDA_DSP_ADSPCS_CPA_MASK) && + MASK_IS_EQUAL(val, core_mask, HDA_DSP_ADSPCS_SPA_MASK) && + !(val & HDA_DSP_ADSPCS_CRST_MASK(core_mask)) && + !(val & HDA_DSP_ADSPCS_CSTALL_MASK(core_mask)); + +#undef MASK_IS_EQUAL dev_dbg(sdev->dev, "DSP core(s) enabled? %d : core_mask %x\n", is_enable, core_mask); -- 2.30.2