From patchwork Mon Oct 24 11:30:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9634 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532419wru; Mon, 24 Oct 2022 09:08:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM55750fK1RlUqTID4Qxi0cEyATaaKujTEfNj2c+9F20Prbwho3+uMvPT2Yyo0D9ps29wfEh X-Received: by 2002:a17:906:2681:b0:783:6a92:4c38 with SMTP id t1-20020a170906268100b007836a924c38mr28742640ejc.75.1666627681310; Mon, 24 Oct 2022 09:08:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627681; cv=none; d=google.com; s=arc-20160816; b=aoI/R1nEOYtWg3iNBEE3Ousm2DH8vjXMIAIWo59XTPszBhrLlrzH709fxTLAp+z2E3 qXPsTXQvuVtQBAfpqIATXZ4qa6FEcX0CVqYxv2bPJpOgAczYRNC+ie141TBk248YCbRE pakCMuquplzCLEcMyXFX/n8iracvRZxfKNuVRlyob4xzwPVPHnPzBK3f4AOQVhqDHUYv f/c8jFSpPXxO/c6oN4NeB4W9EiinaQMeam1OsEHR0WSGE/yDUnpSP+RujCKA6A7NXuQb 3LVbTb/0Jdu6Asa+YzvSAhjYuGxzscxdnJD7yBfxhZ7sg+U6P0BHX8yOjpxL4DbdfO2o yWvw== 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=ALDqe2sxc5xF9v7cbCeCb+1g9YvMaEj0hFzblANG1ZI=; b=XjSvbItYF6BsU42kvaimRibmdZunFMWeQ1eNS4pJA2P6tzdvqEywTnBaTJ/qzyTUso zYbsEckN9MwAqsQphhnvzFSHtRDZe9OPrO+4B+pHzlOBj783icobagBBcNeL+1xE/gAd 56kJWBG9hFEbaSYMY+V/Xquan3YCGAiE0RlZAuwrOyulCPdNi36ykKWFvsZm2ODF0CuK fL1AF5QhrhBtE40r2VNNhr53YsvXVxREtR7ESzCcAcQT4QIV8NXI1+ceEX3M7tJtUUL2 /yCf9xBSDmg+ACKXUakgdiT87u38kOSkyn4lwMAGTRVFpxVucnGyzKBwvBzEYH2SawyW KVGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VWxjh2Te; 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 l15-20020a1709065a8f00b0078e1e77f443si104689ejq.418.2022.10.24.09.07.36; Mon, 24 Oct 2022 09:08:01 -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=VWxjh2Te; 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 S232543AbiJXQG5 (ORCPT + 99 others); Mon, 24 Oct 2022 12:06:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233016AbiJXQEJ (ORCPT ); Mon, 24 Oct 2022 12:04:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D5081E576D; Mon, 24 Oct 2022 07:56:21 -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 ams.source.kernel.org (Postfix) with ESMTPS id 1BB53B81698; Mon, 24 Oct 2022 12:28:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76DFEC433C1; Mon, 24 Oct 2022 12:28:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614499; bh=xYGfpluMhE2yfUa76Sd/ZU7uGJoQMeIwNU8LXhnTMoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VWxjh2TewuCXloznqcToK9PyR4eoJvl820FTyuSmsC9sXtgy64R7Gcg90RLbs9Svk lGSNNBCNufJAp5F+RvBxb+Qhu5PxXTrqjjDETCibqsF5sx25r0T0veblX8RYf4s94f ogo21BNsy3LmPjM1z43pxWd2mFV4zBqBjmK4XBqM= 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.10 255/390] spmi: pmic-arb: correct duplicate APID to PPID mapping logic Date: Mon, 24 Oct 2022 13:30:52 +0200 Message-Id: <20221024113033.744131759@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747585787613990324?= X-GMAIL-MSGID: =?utf-8?q?1747585787613990324?= 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 bbbd311eda03..e6de2aeece8d 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -887,7 +887,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); @@ -910,16 +911,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;