From patchwork Sat Oct 22 07:25:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109396wrr; Sat, 22 Oct 2022 01:48:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JlDnPKrfBCtqjLS8xULM9JX75eF0rkY4NZb/EdDri7I0advD1iuR59FNwnHu5A4AnKX7o X-Received: by 2002:aa7:c491:0:b0:461:7f0c:c573 with SMTP id m17-20020aa7c491000000b004617f0cc573mr1443314edq.8.1666428499098; Sat, 22 Oct 2022 01:48:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428499; cv=none; d=google.com; s=arc-20160816; b=n9E2vHNGzteACbkRKLWKmtDmeBH6HPDUDI7yICj9PUudpf3xwKtl/u6L63boYp7vrK uPNjTbzziLixLmgBihRLK3R0gjMJvlP5pBw5T0pk/p/wYG2NBjTTGI6wvkat9agqAoUT YeKO1c92+ybz5aDFx/XY7py03S7ONDuhZdQ0doZiOdC7VBsPc7ypuBCK4qkbO6ocjoxP SOg5/rI5Cr1iXk3VfZSxNtDPhlPtOhry+dGR4u3IXUdS9QgECwTCQT+Hc2FOKpqKpHeH LSqIz2JN0fGic7jeQKElyihG21ir5PcT7EDxk3OVjezSM90NWKRXMbVnoXvh7KSs0mMn 0hbw== 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=ErPD93IJ6gOoF4eX7uNsUbPCy1naZfv+pcbNCA2DqbA=; b=bC5gHL4XHRMlEZWG8MkepwznzZE398WTLZnkGESuy8Nwz/IWQMnfJMk382/X74yt3N K6YcSRtwbs4bGpcTUd9kKSfH5nFGW2ZhDwh+SpZcGmU+Ldb1zI/odTobrUSugWA7t5HH Ryq1Am1KUnSc38arQJcl9KGbnn7+HtreAO9wjphTX29c5HsyYMnG1jrOoiNmNDkLq8Od nGt+CeqMwrBjV2xORMv1Ba5eiU+gT4tfESSFZ7yUMWsNyZiaQtR0SxEYw0YzJIVKwiyt zv/53Fqa+vk3KGIKdFyTNIW7H+1KJTqQLGLkUIuCz4lTUfSXDjxKcuHTwdOlAx6lZxWS ZsHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="U5nXzVt/"; 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=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn22-20020a17090794d600b007986956bd8esi7664632ejc.472.2022.10.22.01.47.54; Sat, 22 Oct 2022 01:48:19 -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=@linuxfoundation.org header.s=korg header.b="U5nXzVt/"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234472AbiJVIrB (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235112AbiJVIoj (ORCPT ); Sat, 22 Oct 2022 04:44:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AAD72EC219; Sat, 22 Oct 2022 01:08:27 -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 A9EF360B8E; Sat, 22 Oct 2022 07:56:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EBB0C43470; Sat, 22 Oct 2022 07:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425372; bh=K2n3lZ/Ursgsg4sKeDOQ5OROfj9/y9Ig83F2qNg4SAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U5nXzVt/vxepdQOPmbbWPD/PuSPxv5HuwiXcharAf/WmaIw03HkCttUke4fdXwuso LLpN69dXrnKJAI1EZ5A6k8yzXqHozu1nlmkKt5b2r5ZtKcstpGyyv3SvFSU9CyAYOS 9f0i5PqdQP7gVWf4OvhHp8wWWeJjVDN7o0QIAICo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Collins , Fenglin Wu , Stephen Boyd , Sasha Levin Subject: [PATCH 5.19 479/717] spmi: pmic-arb: correct duplicate APID to PPID mapping logic Date: Sat, 22 Oct 2022 09:25:58 +0200 Message-Id: <20221022072519.546386667@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747376930164429283?= X-GMAIL-MSGID: =?utf-8?q?1747376930164429283?= From: David Collins [ Upstream commit 1f1693118c2476cb1666ad357edcf3cf48bf9b16 ] 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 Link: https://lore.kernel.org/r/20220930005019.2663064-8-sboyd@kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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 2113be40b5a9..58f580e7aacc 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -992,7 +992,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); @@ -1015,16 +1016,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;