Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2658019pxb; Tue, 12 Oct 2021 10:46:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4T2ysZL6rw7BpRKqTVyOAIpsYqgoP6qswEFuBSmLZtUr0DhIeChwxdn/h5mevvEPgspZ+ X-Received: by 2002:a17:906:e85:: with SMTP id p5mr34408974ejf.159.1634060805439; Tue, 12 Oct 2021 10:46:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634060805; cv=none; d=google.com; s=arc-20160816; b=RsApZWdPeVE+r0Hy8bfVIEfQwa1+fjOyW4z7bEPkL6i2QkpuExwquMLgGtO8lGywcG DSv3kx1ZVkpHiKHvB2GNzBu4A6P2At2zQwbNQL11EcTpzyHFDcE4Y2yM70ZNSNBxqp1A Z6puxfySBvUWbPkxiOv3dBfsLjATYV1wRVFrS5Sbfn30t2BYF+iBBUOlDGnU5WZbQOYh uDhhiNdnhKYxeJx8op7O1JX8ViuzXQZcz/KFF4aitALVsAXInreB2XSn1y0zNfCoKr3b NMCO1vaLrkrQ0XB5c+sIW2AI7tP1CTH3YVC2aVr8Mh6b7j+pZoVAmK8EQiH4Za/mqiWx 8S1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:date:to:cc:from:subject :references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=EpUUxR1mO5oX4BHNcPFKnduU8EjlcYR/gERcBvqH0SU=; b=x6foF461wCHKFREoJhVHgBV6yKsnRQj8EjujxFCJJ1EDeL+pbtdyaI/qxASUrXZEfr 4Jptgg+jnR7gkQxf4Lhg1UeqWeM0yHu5e+n19ulHkmI4e5340hehR9wkYbn8JSqziFLF GfIH8OvfJAeRS0LH8hUafyky7L/qudE/w5JQNxanQ5Ht+QvQ8cdjGPRoxrChHJygzhzP TAgkrswJknzcl5ORIMvyBh9fKSV0ZE6q9i7zKxwP33TIqCupCthoknTlQRckL/9K0puo aY1eOTaN9/nMtA4uG4QnBRsRlaBymlkuMmVRyaxw4PxeXi4YCBSNjjfFyEt8ZjvSVKQV h+Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Pp5n6k+v; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f14si14188714edc.609.2021.10.12.10.46.21; Tue, 12 Oct 2021 10:46:45 -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=@kernel.org header.s=k20201202 header.b=Pp5n6k+v; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232437AbhJLRqh (ORCPT + 99 others); Tue, 12 Oct 2021 13:46:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:57590 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbhJLRqg (ORCPT ); Tue, 12 Oct 2021 13:46:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 25E2D610C9; Tue, 12 Oct 2021 17:44:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634060674; bh=lVL3q5uChIkTh3tk08GPoiBOGZxjg76dso8RpirFeW8=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=Pp5n6k+vHngx0oAzK71EV4QIwnREZETfdcp4S/ZxjDE9o9jSmqwltgIZpu312Poaq Gme3coZ2DzgLrgs9vv4/KBmDKwQXfJq49XpxKINR4Qe0DikHCQl6MUfI2gJuHxRDs4 hnbkGTD0AiR8Qgxrb1AB/A9pUiNlJBCbX6mVDAm7DbmVPiSrgB+25QMPaZs5Lb7onX UHT22W8UInOMIsE8yMDs63GE+b5zb1ZJgFpZvs5nCs7Hr808YJlazigsdAY9MkiokZ 8O0tDK5X2kGpr7/BPQV+FZEmvt0uW4PAn5+2KHSd3briMs2UEqhnbMzuQdKcy2a6qn XGbYrznEcQuew== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <1631860384-26608-6-git-send-email-quic_fenglinw@quicinc.com> References: <1631860384-26608-1-git-send-email-quic_fenglinw@quicinc.com> <1631860384-26608-6-git-send-email-quic_fenglinw@quicinc.com> Subject: Re: [RESEND PATCH v1 5/9] spmi: pmic-arb: correct duplicate APID to PPID mapping logic From: Stephen Boyd Cc: collinsd@codeaurora.org, subbaram@codeaurora.org, quic_fenglinw@quicinc.com To: Fenglin Wu , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 12 Oct 2021 10:44:32 -0700 Message-ID: <163406067294.936959.15501496135258886323@swboyd.mtv.corp.google.com> User-Agent: alot/0.9.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Fenglin Wu (2021-09-16 23:33:00) > From: David Collins >=20 > 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 =3D APPS EE, if it exists, or if not > that, then the first APID mapped to the PPID, if it exists. >=20 > Signed-off-by: David Collins > Signed-off-by: Fenglin Wu > --- Does this need a Fixes tag? > drivers/spmi/spmi-pmic-arb.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c > index 59c445b..f1b72d8 100644 > --- a/drivers/spmi/spmi-pmic-arb.c > +++ b/drivers/spmi/spmi-pmic-arb.c > @@ -918,7 +918,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 wh= ich 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 =3D 0; ; i++, apidd++) { > offset =3D pmic_arb->ver_ops->apid_map_offset(i); > @@ -941,16 +942,16 @@ static int pmic_arb_read_apid_map_v5(struct spmi_pm= ic_arb *pmic_arb) > apid =3D pmic_arb->ppid_to_apid[ppid] & ~PMIC_ARB_APID_VA= LID; > prev_apidd =3D &pmic_arb->apid_data[apid]; > =20 > - if (valid && is_irq_ee && > - prev_apidd->write_ee =3D=3D pmic_arb->ee)= { > + if (!valid || apidd->write_ee =3D=3D pmic_arb->ee) { > + /* First PPID mapping or one for this EE */ > + pmic_arb->ppid_to_apid[ppid] =3D i | PMIC_ARB_API= D_VALID; > + } else if (valid && is_irq_ee && > + prev_apidd->write_ee =3D=3D pmic_arb->ee) { This can be one line please. > /* > * Duplicate PPID mapping after the one for this = EE; > * override the irq owner > */ > prev_apidd->irq_ee =3D apidd->irq_ee; > - } else if (!valid || is_irq_ee) { > - /* First PPID mapping or duplicate for another EE= */ > - pmic_arb->ppid_to_apid[ppid] =3D i | PMIC_ARB_API= D_VALID; > } > =20 > apidd->ppid =3D ppid; > --=20 > 2.7.4 >