From patchwork Wed Apr 15 09:49:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minghuan Lian X-Patchwork-Id: 6219531 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D764A9F2EC for ; Wed, 15 Apr 2015 09:51:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1253C2034F for ; Wed, 15 Apr 2015 09:51:14 +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 3E9C4202E9 for ; Wed, 15 Apr 2015 09:51:13 +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 1YiJvz-0001t0-0Y; Wed, 15 Apr 2015 09:48:39 +0000 Received: from mail-bn1on0117.outbound.protection.outlook.com ([157.56.110.117] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YiJvJ-0001Rq-MX for linux-arm-kernel@lists.infradead.org; Wed, 15 Apr 2015 09:47:58 +0000 Received: from BY2PR0301MB0742.namprd03.prod.outlook.com (0.160.63.20) by BY2PR0301MB0630.namprd03.prod.outlook.com (0.160.125.28) with Microsoft SMTP Server (TLS) id 15.1.136.25; Wed, 15 Apr 2015 09:47:35 +0000 Received: from CO2PR03CA0029.namprd03.prod.outlook.com (10.141.194.156) by BY2PR0301MB0742.namprd03.prod.outlook.com (0.160.63.20) with Microsoft SMTP Server (TLS) id 15.1.136.25; Wed, 15 Apr 2015 09:47:33 +0000 Received: from BN1BFFO11FD053.protection.gbl (2a01:111:f400:7c10::1:119) by CO2PR03CA0029.outlook.office365.com (2a01:111:e400:1414::28) with Microsoft SMTP Server (TLS) id 15.1.118.21 via Frontend Transport; Wed, 15 Apr 2015 09:47:32 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD053.mail.protection.outlook.com (10.58.145.8) with Microsoft SMTP Server (TLS) id 15.1.142.12 via Frontend Transport; Wed, 15 Apr 2015 09:47:31 +0000 Received: from lmh.ap.freescale.net (lmh.ap.freescale.net [10.193.20.53]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t3F9lRx7007250; Wed, 15 Apr 2015 02:47:28 -0700 From: Minghuan Lian To: Subject: [PATCH] irqchip/gicv3-its: Decrease page size when needed Date: Wed, 15 Apr 2015 17:49:22 +0800 Message-ID: <1429091364-31939-1-git-send-email-Minghuan.Lian@freescale.com> X-Mailer: git-send-email 1.9.1 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; BMV:1; SFV:NSPM; SFS:(10019020)(6009001)(339900001)(199003)(189002)(50466002)(6806004)(87936001)(48376002)(19580395003)(19580405001)(85426001)(86362001)(575784001)(46102003)(77096005)(77156002)(62966003)(105606002)(106466001)(2351001)(110136001)(229853001)(104016003)(92566002)(50986999)(47776003)(36756003)(50226001)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR0301MB0742; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0301MB0742; UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0301MB0630; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(5002010); SRVR:BY2PR0301MB0742; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0301MB0742; X-Forefront-PRVS: 0547116B72 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2015 09:47:31.6820 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB0742 X-OriginatorOrg: freescale.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150415_024757_995204_6F462865 X-CRM114-Status: UNSURE ( 6.77 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 1.3 (+) Cc: Arnd Bergmann , Minghuan Lian , Hu Mingkai-B21284 , Zang Roy-R61911 , Yoder Stuart-B08248 , Bjorn Helgaas , Scott Wood , 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=-2.9 required=5.0 tests=BAYES_00,RCVD_ILLEGAL_IP, RCVD_IN_DNSWL_MED,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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 The default page size of ITS table has been changed to 64KB, but for some platforms the real size of allocate memory which calculated by DEVBITS of register GITS_TYPER may smaller than default size. In this case, psz must be decreased, otherwise, the wrong page number will cause kernel hang. Signed-off-by: Minghuan Lian --- drivers/irqchip/irq-gic-v3-its.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 596b0a9..d0374a6 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -844,6 +844,9 @@ static int its_alloc_tables(struct its_node *its) its->tables[i] = base; + while (alloc_size < psz) + psz = psz >> 1; + retry_baser: val = (virt_to_phys(base) | (type << GITS_BASER_TYPE_SHIFT) |