Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2095925pxb; Mon, 12 Apr 2021 14:22:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEGEfZ+fxlAA3kOBjeGB97bA+KUZn5UeiYctorKkqwUbfdomJJvIgfQSERLKpOTqGEGb7w X-Received: by 2002:aa7:c957:: with SMTP id h23mr30863153edt.301.1618262524115; Mon, 12 Apr 2021 14:22:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618262524; cv=none; d=google.com; s=arc-20160816; b=dlcNjetIf0t5DOHmeK4Gv6BIxMCBYwkUK5GObPhnClt/pD9oKDDPldG707je4rEhxE vN49XOIxZJFhL78cFVioiu61xo12moKMvRDwhG2lwva2gCoFUN9H35bm+2I5SPAKbqS3 HqFAcZSGAD123kM7zm6hNeiEo18+1qNalTLCFTlWUMO3bDKg6ew5CpYdwZz909P7KOhH ix59tSJeJjHU07l+2y8ydctZz5VNij0CIz7D/yl920aohU5w99j/XOWBi/SaTuEj6MOR ofbrrGE0xTrZAJGKsDHaRwCGYpIOdq4Say8YwJRbt8yUfj5UxBFJ7lWHBPsUgo1L9YML yhRw== 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=tDSqOP/sQeQU8iOM1S9w7OgS/0+vrHtGNJIBs2L076E=; b=ZdZYzuhCInWGxtIGWR+PVaFjMGm3RD30zfLOuWtLIbt5tya6RTyuvd8GS6bUIiqtQ3 nd+tpWX8ym1GjXuORzcxSRAFUG0HohdoNUjJaJ0ZRX0BXmCAQzYQNlSeeht4GXU8RouD pOvXiJk6JSwUFblgsSq2VymlJq0FJTNOG8ZWJ1444S4tUQyGazJ7gRShJWzJzfaPHybF q+NOhRar/9lYttG8oBn0LQ7QVxxBF6qfMt1EghhgfN16mUuzeJimxegpEwOUuyr0KRhO OgZL0wZzqQYqUn4/ptuED8gxF0O+LClhA6jdMGEzfQ6GWs3xsbSME1LRfysZVCs/1XnL 9How== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ow2WN10c; 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 c20si8740295ejb.471.2021.04.12.14.21.40; Mon, 12 Apr 2021 14:22:04 -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=Ow2WN10c; 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 S241145AbhDLJLv (ORCPT + 99 others); Mon, 12 Apr 2021 05:11:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:49838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238498AbhDLI4Y (ORCPT ); Mon, 12 Apr 2021 04:56:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7DA0561261; Mon, 12 Apr 2021 08:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217767; bh=7RH1ok2hvfmGbJIFz1ZUsEXix6olH5SqdhmzepKwlEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ow2WN10cyYNVeF1POKicvdoY+EkxenRTTn0E11E4brQTxp+e2VpUjdKu50oKBe3ji aKuxAeOlZsytMX4mSNLayzD/r9Ls9MsEjDVULZQ8evu6QdhqbPIBWr1BBV+dF4Up24 YafMUGbQGwIoEU/emZmPZf+mc/18CnzZFFWiC07k= 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.10 102/188] ASoC: SOF: Intel: HDA: fix core status verification Date: Mon, 12 Apr 2021 10:40:16 +0200 Message-Id: <20210412084017.044364654@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084013.643370347@linuxfoundation.org> References: <20210412084013.643370347@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 c731b9bd60b4..85ec4361c8c4 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