From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751633AbdFFLGT (ORCPT ); Tue, 6 Jun 2017 07:06:19 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:7382 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751411AbdFFLGP (ORCPT ); Tue, 6 Jun 2017 07:06:15 -0400 Subject: Re: [PATCH v7 3/3] iommu/arm-smmu-v3: Add workaround for Cavium ThunderX2 erratum #126 To: Geetha sowjanya , , , , , , References: <1496145821-3411-1-git-send-email-gakula@caviumnetworks.com> <1496145821-3411-4-git-send-email-gakula@caviumnetworks.com> CC: , , Geetha Sowjanya , , , , , , , , , , , , , , Linuxarm From: John Garry Message-ID: <17f9e235-179c-38cf-c76f-c8d2af60965f@huawei.com> Date: Tue, 6 Jun 2017 12:03:59 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <1496145821-3411-4-git-send-email-gakula@caviumnetworks.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.181.152] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.59368C39.023A,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: e3bce82854b687d75e8dff51ac535920 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/05/2017 13:03, Geetha sowjanya wrote: > From: Geetha Sowjanya > > Cavium ThunderX2 SMMU doesn't support MSI and also doesn't have unique irq separate irq lines > lines for gerror, eventq and cmdq-sync. > > This patch addresses the issue by checking if any interrupt sources are > using same irq number, then they are registered as shared irqs. > > Signed-off-by: Geetha Sowjanya > --- > Documentation/arm64/silicon-errata.txt | 1 + > drivers/iommu/arm-smmu-v3.c | 29 +++++++++++++++++++++++++---- > 2 files changed, 26 insertions(+), 4 deletions(-) > > diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt > index 4693a32..42422f6 100644 > --- a/Documentation/arm64/silicon-errata.txt > +++ b/Documentation/arm64/silicon-errata.txt > @@ -63,6 +63,7 @@ stable kernels. > | Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 | > | Cavium | ThunderX SMMUv2 | #27704 | N/A | > | Cavium | ThunderX2 SMMUv3| #74 | N/A | > +| Cavium | ThunderX2 SMMUv3| #126 | N/A | > | | | | | > | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | > | | | | | > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c > index 4e80205..d2db01f 100644 > --- a/drivers/iommu/arm-smmu-v3.c > +++ b/drivers/iommu/arm-smmu-v3.c > @@ -2232,6 +2232,25 @@ static void arm_smmu_setup_msis(struct arm_smmu_device *smmu) > devm_add_action(dev, arm_smmu_free_msis, dev); > } > > +static int get_irq_flags(struct arm_smmu_device *smmu, int irq) > +{ > + int match_count = 0; > + > + if (irq == smmu->evtq.q.irq) > + match_count++; > + if (irq == smmu->cmdq.q.irq) > + match_count++; > + if (irq == smmu->gerr_irq) > + match_count++; > + if (irq == smmu->priq.q.irq) > + match_count++; > + > + if (match_count > 1) > + return IRQF_SHARED | IRQF_ONESHOT; > + > + return IRQF_ONESHOT; > +} > + > static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu) > { > int ret, irq; > @@ -2252,7 +2271,7 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu) > if (irq) { > ret = devm_request_threaded_irq(smmu->dev, irq, NULL, > arm_smmu_evtq_thread, > - IRQF_ONESHOT, > + get_irq_flags(smmu, irq), > "arm-smmu-v3-evtq", smmu); > if (ret < 0) > dev_warn(smmu->dev, "failed to enable evtq irq\n"); > @@ -2261,7 +2280,8 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu) > irq = smmu->cmdq.q.irq; > if (irq) { > ret = devm_request_irq(smmu->dev, irq, > - arm_smmu_cmdq_sync_handler, 0, If it is indeed ok to change this to having IRQF_ONESHOT set now (right?), then can you add a note to the commit message? > + arm_smmu_cmdq_sync_handler, > + get_irq_flags(smmu, irq), indentation looks inconsistent > "arm-smmu-v3-cmdq-sync", smmu); > if (ret < 0) > dev_warn(smmu->dev, "failed to enable cmdq-sync irq\n"); > @@ -2270,7 +2290,8 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu) > irq = smmu->gerr_irq; > if (irq) { > ret = devm_request_irq(smmu->dev, irq, arm_smmu_gerror_handler, > - 0, "arm-smmu-v3-gerror", smmu); > + get_irq_flags(smmu, irq), > + "arm-smmu-v3-gerror", smmu); > if (ret < 0) > dev_warn(smmu->dev, "failed to enable gerror irq\n"); > } > @@ -2280,7 +2301,7 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu) > if (irq) { > ret = devm_request_threaded_irq(smmu->dev, irq, NULL, > arm_smmu_priq_thread, > - IRQF_ONESHOT, > + get_irq_flags(smmu, irq), > "arm-smmu-v3-priq", > smmu); > if (ret < 0) >