Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3130237pxb; Tue, 12 Oct 2021 22:40:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8i3dznIXGCUD706asdbFS2969Zjg0tfpJ1oK3Azn7CiyQSPosiH6pD9Nn+BKhcjDxS7r7 X-Received: by 2002:a17:906:3157:: with SMTP id e23mr40294517eje.29.1634103601678; Tue, 12 Oct 2021 22:40:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634103601; cv=none; d=google.com; s=arc-20160816; b=rpayqJk/jcATFZuqWQl/gofVnu7Rtp5LW+ecZ9h3uyoDrjTHjzJKRcjtxLTfZyS78u I6WYw9CtpdEBxbr5g/nOFiPrwEMVYw51ruSK4w8xKv43HvzNXszEjM3lPemNA/IEp+RU 1/LL6x/ohrjPD0QeROEcf8GcvBSA0IEUqtnMaRXF/8x7bGzYKthx7sAtI6fUk3Mz+v4N BRVSzb4Fi0w+3RKh3m1tA4i/QjNixAMWEPnnItlIL7aHfU1RkpaNk8x2vzpQOhSfnAKT m8xQqvoOCNaDx6/hQ66gKMrSI34bBg4ggctJcWFWyLwvycJpQCOxXNwFbo9Kgo38INrN HQMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=9fhbkTDJxMCsx3vMwgVwFc3cEfidix11BjFd5kmmHMw=; b=HzYjlKdCJx2SI8MTndJ+Jdo6mYlt66sU+7pdYcIBueIdCF2Hq69YeM//lA890ZoGtH hxksD4QD2KACiPku+6JJNNVothYm6SKEbGEHKNvzaEnFG0TGtZnmKrzq++v4c2tL5mHz q+lwucPftdGb0ljPgG8+H4lxBC+L3BzSZb8kAhuwrP1UwBHfcOxUZ3khQmao3k7R4os0 PWyIlQQjJnPooZbC7rAV5Y6Ry7mg7ZzKhStS1cNU5ohzeWKMZgUDQcxkcLaoT5HHkUB4 tIRN4eljaijGlOziUhCzMj5oyxzGAkaLQBnosCJzi39B4Kj9nq6Kz6KZR/uXbG/wTbzl AGzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=nTVwUbg4; 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=quicinc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v20si16507931edi.84.2021.10.12.22.39.36; Tue, 12 Oct 2021 22:40:01 -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=@quicinc.com header.s=qcdkim header.b=nTVwUbg4; 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=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229991AbhJMFjv (ORCPT + 99 others); Wed, 13 Oct 2021 01:39:51 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:41661 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229665AbhJMFjv (ORCPT ); Wed, 13 Oct 2021 01:39:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1634103468; x=1665639468; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=9fhbkTDJxMCsx3vMwgVwFc3cEfidix11BjFd5kmmHMw=; b=nTVwUbg4cO4stmFmE0DlKbpGWG7NKr2Nz2vb26HB5CQfVAIjF4HYidBD HboO4/uBKbk4pmNlAtQHZJcssmbuA+s4H7WxA0qHk2iEtP+5n8GH7l6Cx kzXQKfiJGYGnWQ4N1DYGS/nTPFGc9h39NM5A23zt0HZ7KsTANQGia6+Wu s=; Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 12 Oct 2021 22:37:48 -0700 X-QCInternal: smtphost Received: from nalasex01c.na.qualcomm.com ([10.47.97.35]) by ironmsg-lv-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2021 22:37:48 -0700 Received: from [10.231.205.174] (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.7; Tue, 12 Oct 2021 22:37:46 -0700 Subject: Re: [RESEND PATCH v1 5/9] spmi: pmic-arb: correct duplicate APID to PPID mapping logic To: Stephen Boyd , , CC: , References: <1631860384-26608-1-git-send-email-quic_fenglinw@quicinc.com> <1631860384-26608-6-git-send-email-quic_fenglinw@quicinc.com> <163406067294.936959.15501496135258886323@swboyd.mtv.corp.google.com> From: Fenglin Wu Message-ID: Date: Wed, 13 Oct 2021 13:37:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <163406067294.936959.15501496135258886323@swboyd.mtv.corp.google.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/13/2021 1:44 AM, Stephen Boyd wrote: > Quoting Fenglin Wu (2021-09-16 23:33:00) >> 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. >> >> Signed-off-by: David Collins >> Signed-off-by: Fenglin Wu >> --- > Does this need a Fixes tag? ACK, will add a Fixes tag > >> 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 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 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); >> @@ -941,16 +942,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) { > This can be one line please. ACK. >> /* >> * 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; >> -- >> 2.7.4 >>