Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1825644imm; Mon, 3 Sep 2018 10:25:05 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda3K49r1IpxTGLuhSx9mKfO3S1CIWqFEnAcTVt3WaaP2TbzpsdcsdVr9rot04BLGjzK05nI X-Received: by 2002:a17:902:744a:: with SMTP id e10-v6mr29579963plt.165.1535995505219; Mon, 03 Sep 2018 10:25:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995504; cv=none; d=google.com; s=arc-20160816; b=c1KiZJEOQN80Xu+N4JEhByWHnmdMeb+FExPFWEpORgTuWAJErrZy91ZAIrV47guJXV CnuOt3ep6kqWmaK40E7L1SxpqQAbu138guswcXTx9UGNMW+VEK1d8HODfZ9A9hUnM+6d 2J4nceA1Bsrynvg6jHQeHL4q7vH8JMIToN1itvKOt2ljJLD26L/pfPgcBSwR9NOwkuxj zi2lcekyRBr/jMTH1r7g+f6koUl9OIIBKWrvUfTuZPcI7PLh/fKEvvkuU8GrxG2RI8pn 1g5GFZvp70PtVw8IE4Fz+lOftlFTwfJ5LvWI1deIa1zTY2+6JNBvsoJ0hfYirMjYk7MJ Raig== 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=eOphGwhMXGJymDUR+H1Lm56xIXNEV6ARbRyKq5ZsIz8=; b=E0Za8tpphjxhO7UVvsFP5hZLiUW7Svt4OCcNgm0rdzGK4qdNq+GvdKnRDE0konJKjG WlSffAJYkG6exo5qArnlRxc7gY6a3s4m5cw13av8gUqcprXLMZlMJqN5XWfhefbkhkTo bL8r7Vk2sufN8AjYdSL0L/La+BOykHBKsjf8wxSbf9clOohohtBUYFYepGuruQsE0CdE A4x1w+uoQgtUqApyPOQ6AqjBqFaGyiSeFJQi2SANA2QUqOFmB4g4ncal7KumSM4KSXoJ in+DTGQT6twsd+xDyzePqtpntPexIYBcAwTNes1EkuzO+6fb1KnoqPg6BU6BMPEOAaNa CKkQ== 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 e94-v6si18804861plb.435.2018.09.03.10.24.50; Mon, 03 Sep 2018 10:25:04 -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 S1730495AbeICVoT (ORCPT + 99 others); Mon, 3 Sep 2018 17:44:19 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45404 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728357AbeICVoS (ORCPT ); Mon, 3 Sep 2018 17:44:18 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A6152D0A; Mon, 3 Sep 2018 17:23:11 +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.14 093/165] iommu/arm-smmu: Error out only if not enough context interrupts Date: Mon, 3 Sep 2018 18:56:19 +0200 Message-Id: <20180903165700.192628841@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@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.14-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 @@ -2100,12 +2100,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) {