Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2954169rwb; Thu, 29 Sep 2022 18:10:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM48jjAH3+NxTfB1cegZpHf8B51fjruF9p+ZnP3To5NW1fjAh/dVNmZpgEyMNkrU2DJ3+1X6 X-Received: by 2002:a17:907:25c5:b0:782:978d:c3da with SMTP id ae5-20020a17090725c500b00782978dc3damr4575322ejc.623.1664500250824; Thu, 29 Sep 2022 18:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664500250; cv=none; d=google.com; s=arc-20160816; b=E5BVPam8oyM11XQ4VIVFnF4eytRb8zmIQhO06SnHV6gFVAssByY6x+ZY14Y9b6ny6t RCQ6WH/CzLZ/nN6yVsa5jNr3eS/SesS2Pb5FnA9luDydxUtns/+XfsPg52Z9GGV+mSv5 U+CGYft0bSjJitsiADuGsG6ZvoIA1CSKX5eHOjr0HJROTEshA9V7QJCKqfQF5oId+5As qJ+z8LvJkNWf0mddnmyXbeVOYye7XPkIMKVQdhmRiNB6nItOTi0pSJIPHrJ4F3R435Wh xaERFmbcpNMxLqxNTQEql4CN0Ow2t5cuXh7zZsSnjl3FedPI2S8DZPMcgrqSqCnWB89I 54/A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=23ql5sB0jHEdwPj6clAi0MHxVZ9VVDV2hT1csrdhiFc=; b=hPC5lO7tz3vHKDDczqDA7KWLPEcT+cXkoNKVUM65CXjIRrLKGY7Wz6yGmbuCxUehRj xQwKzL94Y340JUhU/HeUMpOwwbpD+lMfR++XksIAw4BmETtsg4Y4kt129Gk3uwJ3UpB4 UWcT7Yh62TtBzkw4KWgDW/39cxT9Ddz7J8/TFGak6DlKO7sWElm5KT8Vu2GCqLJgDg+6 ihWH5IShgWdaAg6AALcbOU7LbgGxCh+n4pY2VJPhHUCBv34rY3BysBuMzcg1wACvnc7C E7fDBPIr4nz4dlGJugEC2hmr1XLv2k0OtTHUyBSsPImg/i8gn7TKQRSlwkUwtz91UTw2 k6SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fQuJneWX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w10-20020a50d78a000000b00451db83b2d6si1029421edi.312.2022.09.29.18.10.24; Thu, 29 Sep 2022 18:10:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fQuJneWX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229966AbiI3Aug (ORCPT + 99 others); Thu, 29 Sep 2022 20:50:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229877AbiI3Au1 (ORCPT ); Thu, 29 Sep 2022 20:50:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADDA44B0CC for ; Thu, 29 Sep 2022 17:50:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3CE71621F8 for ; Fri, 30 Sep 2022 00:50:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFBADC433D6; Fri, 30 Sep 2022 00:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664499022; bh=taB5laCLRmijvLj1M4Rx6x1cEHHxTJYPbp+d1oTUFsc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fQuJneWXXqsrGdnZzU9Sz5uRMKKesEz872/LTokdzkeYNBFFvqGUELZl0PY8jorU9 rn2hGrh01qtpMRIB6kulEOJnLVQsZ26z47yZBxKsZ1EHveuq7VfUGR2eALSfxwFrfg keze0XATVrr8aXRA9Rx4Z3HRSp04axEHlQ+IxRGwAEA6virz4XMPHDvCSe/laAN7Bj tq5hclN8mmv+HHvf7h1CR7NTZy9iVCdaY8QO/iS/+dwZ8p2L4b5bE7e1LkGoNE87IS uVezkvXmLd+J098V/pH0rn1ABzGOWQ62R3oYek1JWJ4iNX6NUkVFyGItuZEF7L4yh1 //p+PkI7omsXQ== From: Stephen Boyd To: Greg Kroah-Hartman Cc: David Collins , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Fenglin Wu Subject: [PATCH 7/9] spmi: pmic-arb: correct duplicate APID to PPID mapping logic Date: Thu, 29 Sep 2022 17:50:16 -0700 Message-Id: <20220930005019.2663064-8-sboyd@kernel.org> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog In-Reply-To: <20220930005019.2663064-1-sboyd@kernel.org> References: <20220930005019.2663064-1-sboyd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Collins Correct the way that duplicate PPID mappings are handled for PMIC arbiter v5. The final APID mapped to a given PPID should be the one which has write owner = APPS EE, if it exists, or if not that, then the first APID mapped to the PPID, if it exists. Fixes: 40f318f0ed67 ("spmi: pmic-arb: add support for HW version 5") Signed-off-by: David Collins Signed-off-by: Fenglin Wu Link: https://lore.kernel.org/r/1655004286-11493-7-git-send-email-quic_fenglinw@quicinc.com Signed-off-by: Stephen Boyd --- drivers/spmi/spmi-pmic-arb.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 56f22941d570..cf92abc51689 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -1031,7 +1031,8 @@ static int pmic_arb_read_apid_map_v5(struct spmi_pmic_arb *pmic_arb) * version 5, there is more than one APID mapped to each PPID. * The owner field for each of these mappings specifies the EE which is * allowed to write to the APID. The owner of the last (highest) APID - * for a given PPID will receive interrupts from the PPID. + * which has the IRQ owner bit set for a given PPID will receive + * interrupts from the PPID. */ for (i = 0; ; i++, apidd++) { offset = pmic_arb->ver_ops->apid_map_offset(i); @@ -1054,16 +1055,16 @@ static int pmic_arb_read_apid_map_v5(struct spmi_pmic_arb *pmic_arb) apid = pmic_arb->ppid_to_apid[ppid] & ~PMIC_ARB_APID_VALID; prev_apidd = &pmic_arb->apid_data[apid]; - if (valid && is_irq_ee && - prev_apidd->write_ee == pmic_arb->ee) { + if (!valid || apidd->write_ee == pmic_arb->ee) { + /* First PPID mapping or one for this EE */ + pmic_arb->ppid_to_apid[ppid] = i | PMIC_ARB_APID_VALID; + } else if (valid && is_irq_ee && + prev_apidd->write_ee == pmic_arb->ee) { /* * Duplicate PPID mapping after the one for this EE; * override the irq owner */ prev_apidd->irq_ee = apidd->irq_ee; - } else if (!valid || is_irq_ee) { - /* First PPID mapping or duplicate for another EE */ - pmic_arb->ppid_to_apid[ppid] = i | PMIC_ARB_APID_VALID; } apidd->ppid = ppid; -- https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/ https://git.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi.git