From patchwork Sun Feb 15 09:32:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Wu X-Patchwork-Id: 5829781 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CDA09BF440 for ; Sun, 15 Feb 2015 09:37:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 43D05201C8 for ; Sun, 15 Feb 2015 09:37:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 823842017E for ; Sun, 15 Feb 2015 09:36:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YMvbL-0008QH-4j; Sun, 15 Feb 2015 09:34:55 +0000 Received: from szxga02-in.huawei.com ([119.145.14.65]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YMvZy-0007LA-Rz for linux-arm-kernel@lists.infradead.org; Sun, 15 Feb 2015 09:33:34 +0000 Received: from 172.24.2.119 (EHLO szxeml434-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CHI04344; Sun, 15 Feb 2015 17:32:46 +0800 (CST) Received: from localhost (10.177.24.136) by szxeml434-hub.china.huawei.com (10.82.67.225) with Microsoft SMTP Server id 14.3.158.1; Sun, 15 Feb 2015 17:32:35 +0800 From: Yun Wu To: , , Subject: [PATCH v2 3/6] irqchip: gicv3-its: limit order of DT size to MAX_ORDER Date: Sun, 15 Feb 2015 17:32:00 +0800 Message-ID: <1423992723-5028-4-git-send-email-wuyun.wu@huawei.com> X-Mailer: git-send-email 1.9.4.msysgit.1 In-Reply-To: <1423992723-5028-1-git-send-email-wuyun.wu@huawei.com> References: <1423992723-5028-1-git-send-email-wuyun.wu@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.24.136] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150215_013331_122927_D252DE14 X-CRM114-Status: UNSURE ( 8.28 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: Yun Wu , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When required DT size is out of the kmalloc()'s capability, the whole ITS will fail in probing. This actually is not the hardware's problem and is mainly a limitation of the kernel memory allocator. This patch will keep ITS going on to the next initializaion step with an explicit warning. Signed-off-by: Yun Wu --- drivers/irqchip/irq-gic-v3-its.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 1.8.0 diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index f5bfa42..de36606 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -828,6 +828,12 @@ static int its_alloc_tables(struct its_node *its) u32 ids = GITS_TYPER_DEVBITS(typer); order = get_order((1UL << ids) * entry_size); + if (order >= MAX_ORDER) { + pr_warn("%s: DT size too large, reduce to %u pages\n", + its->msi_chip.of_node->full_name, + 1 << order); + order = MAX_ORDER; + } } alloc_size = (1 << order) * PAGE_SIZE;