From patchwork Mon Oct 24 11:31:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8696 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422616wru; Mon, 24 Oct 2022 05:23:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6jQ6S2Z/R+I13xh648kY+QWoNrjcCvapHMhMrzDCNfBBpL/WqXbikJFq8tZsBqfRU09Hyr X-Received: by 2002:a05:6402:538a:b0:457:b602:d5a6 with SMTP id ew10-20020a056402538a00b00457b602d5a6mr30621522edb.371.1666614185966; Mon, 24 Oct 2022 05:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614185; cv=none; d=google.com; s=arc-20160816; b=ZxMgOb1A8TDA+k5X/SBfS9wwOYAP2AqxqNaSzvpXYbCzqTS9zsuVgo79x+EvgOOo3z BVjofA1laRRZsdiFtgqTEp6Rfc/XTdHFQOoYJfsrxMxTjaT7ogQ8h5J+aHSJHUZ487ha dZAdgD+6Oi7Fr+9Rqmw6s6jmIowrQjxmizGZHtNRZggUqwFlt5cv2HEZDdDu+Cio2XJ0 tOqAsh4xTcpo8GpyykoUCAfPrfkvJ0WzIlpi6LWVGNCo+umVvsJSH6m50eMUZ+sW2tMf poe6h6K4A86VWeaJIUNBKXQRMyrm4UeNAj44UT1NhW2Ih20aEwaTwh73rVa1AQkADrBm J8uw== 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=ZuEVKckTcaCNkTtpL58NJaZGpCNwVdESDVf350rLaAo=; b=lA2VBBMAjqCdP+rM7k83QoEQpUspcAjIiBR1TYocw+5GXdL1sgoQXv91ZNKKlZa/vS Z8+nv3o1NhBt0r6RXAMB9KtNSXkXjDzrRXZcdGA6FeiWZhBCtpVZfltzfRQRCbE97/0X s6tNt3BPmemSamjLaK59Ui6Q/iLah1QDVb67E192xoMm0lNgLlmhyomRUNBiwRriSeUA t912l2J3gqHkhimxMeC2SeVVKdlhTRx69JmUCEdXX79jfyUuXISyj8hfiMzCbgJAsVj/ tN4ooRWyQz8otS9ekmApkFh0Bol6XB/OCvBQG+JBSbEzvSDmt8CPabw3Zz2VZAKJmEYG R40g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fucp+aCT; 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 hu9-20020a170907a08900b007a09ffe2278si6963080ejc.359.2022.10.24.05.22.41; Mon, 24 Oct 2022 05:23:05 -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=fucp+aCT; 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 S233270AbiJXMUz (ORCPT + 99 others); Mon, 24 Oct 2022 08:20:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233386AbiJXMTU (ORCPT ); Mon, 24 Oct 2022 08:19:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBCB082D19; Mon, 24 Oct 2022 04:58:06 -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 4E16B612A4; Mon, 24 Oct 2022 11:51:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36C2BC433C1; Mon, 24 Oct 2022 11:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612305; bh=OFe+RVcm/duytjcmCEfORAPp9ogoeTNcHx8fd2aVeYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fucp+aCTDz1wn7PMKuCKr9ax0oPOfMFIc/tfHNdqQYgVJQl2VJxPPVVQuHp4rQRjw OHEZqlwWYqnjVvoq5UsECnOJP1qNF2AhzjhJJYrAxJA1dcxP015xQ9fcIthlIJmChD l9CcRHUzXg1YNBic9kqgJUBkNNKoaCLHAu4MTack= 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 4.14 148/210] spmi: pmic-arb: correct duplicate APID to PPID mapping logic Date: Mon, 24 Oct 2022 13:31:05 +0200 Message-Id: <20221024113001.783345527@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@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?1747571636421925991?= X-GMAIL-MSGID: =?utf-8?q?1747571636421925991?= 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 360b8218f322..0eb156aa4975 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -867,7 +867,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); @@ -890,16 +891,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;