Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1832128imm; Mon, 3 Sep 2018 10:34:34 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb6RpxQTiRezvAiXts+YQ0ChAD+iXYe45g6OvFjMpdn/hufa26SP1t3uFGqxU/3c01LJIqx X-Received: by 2002:a63:b258:: with SMTP id t24-v6mr713087pgo.317.1535996074451; Mon, 03 Sep 2018 10:34:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535996074; cv=none; d=google.com; s=arc-20160816; b=NbtRly9/+aCySGA20o4xw5A/U/LAP0fM32C0sAev671DbMbXMovZm7ng5g0+DfLPUf NImIwEXe6H+XjpaUPJoxHMwj2QPVjBRqO+ZCm9AOzTVg+amwuvVmKksbd5OzAKGj2c4b i/mut0s5bmu4EnOgZcidYc9NCqX68n2rNjjGTRV1g5P2EU3IdDgUsxTYnRl0W4c/r805 pD8QvEM83yWGha5C+Ddk6DBokSLz7kBrLne1fbpnRkcLNZaYrA1OQWOwKeXNViGg5RUk zX4y3gosQcNIed7su/9NXKjUavkH5ScQK7RlpNqV49O27PNthbatpNiPppX45zkeH23f KKpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=IYlVChZ+6Cpb6gk8UlanHMHl/+w5WJc3UoYc52IP69c=; b=FvXIqgH6ALTv66APSUM//BZq7jSnjUSAD4eB9Sv5n2neclcEGp2gx3+s3m8V40987w taeiX0vu5mH7/HHIRsE60JFTehpyuLWSn4we+xaiE9XyxGm8alFLDep6PANRskIpuPpj jzXuUylMnuKQVWIww/fTOhP9OzOu96kiAk7vVwY3KVYYhlCcHZttfWnfSQjENnS1GItf 7hBmdZWZL3Lrye85jZ7lyYbA8m93/R9HZOsIX73Uunqd2G7eKSCkIRRNpitooMOamDyM 1DUWjBlGk7UFVX0RfHYSg3vuh7XLqJ73DJfMaecgTZYr5W6GliIQ1lRUIX+ISUVsU9g9 rHkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m24-v6si406461pls.497.2018.09.03.10.34.19; Mon, 03 Sep 2018 10:34:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731207AbeICVxl (ORCPT + 99 others); Mon, 3 Sep 2018 17:53:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47518 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728303AbeICVxk (ORCPT ); Mon, 3 Sep 2018 17:53:40 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A47F0D1B; Mon, 3 Sep 2018 17:32:31 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vivek Gautam , Tomasz Figa , Robin Murphy , Will Deacon , Jitendra Bhivare Subject: [PATCH 4.18 024/123] iommu/arm-smmu: Error out only if not enough context interrupts Date: Mon, 3 Sep 2018 18:56:08 +0200 Message-Id: <20180903165720.522579160@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165719.499675257@linuxfoundation.org> References: <20180903165719.499675257@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vivek Gautam commit d1e20222d5372e951bbb2fd3f6489ec4a6ea9b11 upstream. 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 [will: drop useless printk] Signed-off-by: Will Deacon Cc: Jitendra Bhivare Signed-off-by: Greg Kroah-Hartman --- drivers/iommu/arm-smmu.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -2103,12 +2103,16 @@ static int arm_smmu_device_probe(struct 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; + } + + /* Ignore superfluous interrupts */ + smmu->num_context_irqs = smmu->num_context_banks; } for (i = 0; i < smmu->num_global_irqs; ++i) {