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: 6219451 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@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 B28DBBF4A6 for ; Wed, 15 Apr 2015 09:47:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 05F5A2034F for ; Wed, 15 Apr 2015 09:47:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 70A4C2037B for ; Wed, 15 Apr 2015 09:47:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754333AbbDOJri (ORCPT ); Wed, 15 Apr 2015 05:47:38 -0400 Received: from mail-bn1bn0101.outbound.protection.outlook.com ([157.56.110.101]:44741 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753489AbbDOJrh (ORCPT ); Wed, 15 Apr 2015 05:47:37 -0400 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: CC: , Zang Roy-R61911 , Hu Mingkai-B21284 , Scott Wood , Yoder Stuart-B08248 , Arnd Bergmann , Bjorn Helgaas , "Minghuan Lian" 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 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,RCVD_ILLEGAL_IP, RCVD_IN_DNSWL_HI, 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 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) |