From patchwork Thu Jul 19 17:53:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 10535003 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EBA8A600F4 for ; Thu, 19 Jul 2018 17:55:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA0CF27FA1 for ; Thu, 19 Jul 2018 17:55:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDD1F29E17; Thu, 19 Jul 2018 17:55:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7A00227FA1 for ; Thu, 19 Jul 2018 17:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=w57mIjMBh8rZaogkeY/CV3Vg8arCEsy1jAPciZQbd6g=; b=rEvBnmnTLWXcwodXnT63wI2ibU 9izXdZnVSXovpW3yIV49KvZ4Kn7QiAIIFmcmNXITaBz6J7l2ZrvoSQoXvIN3P36Wx9ZVV+IOFXv5X rddNeC4A3s0k+9q+/MmZZZ8USMzI1BfCqisXgFiXDnHW2DEa/fnwU40dckBb2LpB8nSnBrtvnASkK Ei9+zR8RgvzrF8zfhfC34Ce86R2+20afSuhwq13RXl3a2nW+FchH2x6PiOWtfQ3YSmahfh585i8iz fmWuUteY4VmLXBgZxaJ3XfuChM4+RrBIUJ0jo0O/yd25Yt5vdNS45Dgzn/14FjyTUfgCXE0F7SepI kU4Wsmkg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fgD9F-0002jL-5K; Thu, 19 Jul 2018 17:55:29 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fgD8Y-0001RE-LM for linux-arm-kernel@lists.infradead.org; Thu, 19 Jul 2018 17:54:52 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5113160BDE; Thu, 19 Jul 2018 17:54:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1532022876; bh=wler9wIaqgW6zsf4CatUPTGGqUnIkI9EJZNyUfJ+OF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MiJjYcgxDifTBK+J1bOB4isM0KlN9QMvwNKFqzOharVRuk0rukXSLVKu2kwF3oiSB Q081hZPFidDZrTjdX1eDgTlraqbLt3rKMV9gYdcI3uG63zDNzALtlU8PXhfcJerT/F kL/+iKvjc+r4r+TcfqDWm0gZCQDHrQA2OSMWP+Vo= Received: from blr-ubuntu-41.ap.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek.gautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9F8A960B22; Thu, 19 Jul 2018 17:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1532022874; bh=wler9wIaqgW6zsf4CatUPTGGqUnIkI9EJZNyUfJ+OF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dw96qUUMInEPCLwcTzzb2X0ftF7akMSWUZcGfPQ3f7pxiOZ/FTMn1meZjhmo+11ZE 8Ofb3y6tNoXKk21K1ewWCbpJLbCh0Sqf7/R9wASY4E58EPF4d8ev27HG3NLJPrl8D7 SuHYCj8oc7O7yRMruFZ8CUsutietE2R6XjboMZio= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9F8A960B22 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vivek.gautam@codeaurora.org From: Vivek Gautam To: joro@8bytes.org, robh+dt@kernel.org, robin.murphy@arm.com, will.deacon@arm.com, andy.gross@linaro.org Subject: [PATCH 3/3] iommu/arm-smmu: Error out only if not enough context interrupts Date: Thu, 19 Jul 2018 23:23:56 +0530 Message-Id: <20180719175356.14753-4-vivek.gautam@codeaurora.org> X-Mailer: git-send-email 2.16.1.72.g5be1f00a9a70 In-Reply-To: <20180719175356.14753-1-vivek.gautam@codeaurora.org> References: <20180719175356.14753-1-vivek.gautam@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180719_105447_231330_9449CA4D X-CRM114-Status: GOOD ( 15.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org, tfiga@chromium.org, david.brown@linaro.org, iommu@lists.linux-foundation.org, Vivek Gautam , sricharan@codeaurora.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Currently we check if the number of context banks is not equal to num_context_interrupts. However, there are booloaders such as, one on sdm845 that reserves few context banks and thus kernel views less than the total available context banks. So, although the hardware definition in device tree would mention the correct number of context interrupts, this number can be greater than the number of context banks visible to smmu in kernel. We should therefore error out only when the number of context banks is greater than the available number of context interrupts. Signed-off-by: Vivek Gautam Suggested-by: Tomasz Figa Cc: Robin Murphy Cc: Will Deacon --- drivers/iommu/arm-smmu.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 7c69736a30f8..4cb53bf4f423 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -2229,12 +2229,19 @@ static int arm_smmu_device_probe(struct platform_device *pdev) if (err) return err; - if (smmu->version == ARM_SMMU_V2 && - smmu->num_context_banks != smmu->num_context_irqs) { - dev_err(dev, - "found only %d context interrupt(s) but %d required\n", - smmu->num_context_irqs, smmu->num_context_banks); - return -ENODEV; + if (smmu->version == ARM_SMMU_V2) { + if (smmu->num_context_banks > smmu->num_context_irqs) { + dev_err(dev, + "found only %d context irq(s) but %d required\n", + smmu->num_context_irqs, smmu->num_context_banks); + return -ENODEV; + } else if (smmu->num_context_banks < smmu->num_context_irqs) { + /* loose extra context interrupts */ + dev_notice(dev, + "found %d context irq(s) but only %d required\n", + smmu->num_context_irqs, smmu->num_context_banks); + smmu->num_context_irqs = smmu->num_context_banks; + } } for (i = 0; i < smmu->num_global_irqs; ++i) {