From patchwork Tue May 19 23:00:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Yoder X-Patchwork-Id: 6441091 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 C20CBC0432 for ; Tue, 19 May 2015 23:12:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01799203E9 for ; Tue, 19 May 2015 23:12:25 +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 AA3D8203F1 for ; Tue, 19 May 2015 23:12:23 +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 1YuqeI-0002Yh-Rk; Tue, 19 May 2015 23:10:10 +0000 Received: from mail-by2on0113.outbound.protection.outlook.com ([207.46.100.113] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yuqdy-0001yc-VN for linux-arm-kernel@lists.infradead.org; Tue, 19 May 2015 23:09:51 +0000 Received: from BN3PR0301CA0069.namprd03.prod.outlook.com (10.160.152.165) by CY1PR0301MB0747.namprd03.prod.outlook.com (10.160.159.153) with Microsoft SMTP Server (TLS) id 15.1.166.22; Tue, 19 May 2015 23:09:28 +0000 Received: from BN1BFFO11FD001.protection.gbl (2a01:111:f400:7c10::1:136) by BN3PR0301CA0069.outlook.office365.com (2a01:111:e400:401e::37) with Microsoft SMTP Server (TLS) id 15.1.166.22 via Frontend Transport; Tue, 19 May 2015 23:09:27 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) 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.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD001.mail.protection.outlook.com (10.58.144.64) with Microsoft SMTP Server (TLS) id 15.1.172.14 via Frontend Transport; Tue, 19 May 2015 23:09:27 +0000 Received: from right.am.freescale.net (right.am.freescale.net [10.81.116.70]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t4JN9PQs006943; Tue, 19 May 2015 16:09:25 -0700 From: Stuart Yoder To: , Subject: [PATCH v3] irqchip/gicv3-its: ITS table size should not be smaller than PSZ Date: Tue, 19 May 2015 18:00:41 -0500 Message-ID: <1432076441-26365-1-git-send-email-stuart.yoder@freescale.com> X-Mailer: git-send-email 2.3.3 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD001; 1:TNyHNea42aGYBL9ugefzUr/IzgFqtojNOy6OdrDSiIrJv+RqTrp1vDMIkntCk5drAVVxUbd1TqSdK1C4UJOQlKjPU8oOnSKDtxwXQ4hKRNiWJ0B8FccghCrs9vA2/lKviGZ1FjeTjfQ+Jv5o8ZNA8wJo8xD4CkN/oz3x3oFLx8E7NK8suohboov5hA95ifnrr5cBdL8u5lTYjO3Uz7UPaB+9C8u+UfWGgLsDxySgB6hmkBMWjPW0hktiRvCcx28x+dTmKZdaHbdv+z2KvijS5WupT228lf5WrwmObjk3U3g1FBLJxNsSr31C2+nmOauJ6UeU94JxMVYo0E6FlrX8NA== X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(339900001)(199003)(189002)(19580405001)(104016003)(4001540100001)(19580395003)(50466002)(33646002)(81156007)(107886002)(5001960100002)(48376002)(5001770100001)(46102003)(106466001)(47776003)(5001860100001)(64706001)(50986999)(97736004)(5001830100001)(105606002)(68736005)(6806004)(86362001)(77096005)(87936001)(50226001)(62966003)(77156002)(92566002)(229853001)(189998001)(36756003)(85426001)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0301MB0747; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0747; 2:i163Hd97Q7O7npZyxLh8q9McNzBjo5nhCT8v8d7JPuIXzCiKU6sqgvEEdg7KJ2Nu; 2:974jv7QqloI5TnkxUtn8djwGeVHhnmWUs3woIIkbuYECbjimbUuEf1Z164QmlMyeh0CNjZJ5YKkyEKpBVC3X1ZceuGyZAK/AtotF+dIKmTknyNRR8sfEUY5M0qOx2FcIfc2BWlRxVJJjumQSdwqXZOclUbOid4+JCvDDO/pLGWHwXazHWGVIEYu6r80Yv2nErNLr+2FtE3aqdloXxo4hw34nn4uh7S/Bfn+4MsGVEEM=; 6:gnXO8R/apb2dF6awBZlyWoCTCfdOl5FbzFuRPxARwMLYmyT2NmRjKz3EndId0b/z1pNV19ZTxw1Ho8newoXaIxVSXFNICiaLQzRLAW+1kL6samr5nYad+Cqx8FXtlYE2Y65wFvOCC9j+mppqPGcXojFsdWEi95tz+5l3Y7y7JHTnEzdO9Yx/mIBLk4t00rDCGQ6JEK3H5Sy8alIYMD+ccGC2Sh88heCfV/RX6BOX+jkGdCJMUzYTptR8v+pdPuCIB34Cp/Q6nf/e7Zxm0VmNUz/X5Xf8bgLYyOwisW79FQbDyi9iBmcxaFprYI7+Nj0gVq0KuprdXH9EBH80v7Mj3A==; 3:lOrnRVmI5w5IdsHTkU/8Kn0cmTu+ra5HBhlOrbPItAe+mjX6zMY7tc7MHN6WdmIdjBFHYzaq0VvVBeaCG4r0/Ns9jxHUamvew5z0wZtz9EeQlyaK/XJxsZ/UgwqECIA+9W53C1P3LJJr/jIcWJ4FGvTgJiYs2w6iy3INkEBSuURPkxk98mnywqawR5b/4ivjj8Ppu3ek4RqarJxEpnjT2QRuG795a37Bra6CSUMuJO8ldIEZdeZ30GENi2uMbwzuVv01cj+pMPzQezK8jGhP2LzbUI3MP1PwWPW9hDHqppI= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB0747; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:CY1PR0301MB0747; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB0747; X-Forefront-PRVS: 0581B5AB35 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB0747; 9:PIIr9bXfgpW3OQy6FUqUf0BCgWJ7KI08H1zgubr7?= =?us-ascii?Q?i0EZBoWZBbXOersfNKuFthkk6AnsI9l9eFw9qSF39rY6nNPSiuN9CSEL1pvb?= =?us-ascii?Q?DzRJxUNAUDkl6iE11hDwDQd00bRK3ncB5j0F3unky8WP+Xd67WtNj/4a4DJ3?= =?us-ascii?Q?LSMIdUEzGc0AJFTcIf/UiT3NvLonVBAE/IoENBTm1bQ3bkkTwgYTnZ538kZM?= =?us-ascii?Q?028r2FxZoRH+Hyp58Y1gDFCo0EAfpQqw+5ssl4fV+h7gzoI3+HT7fIJJaMbe?= =?us-ascii?Q?KoqnUFNRUqLqnCrEKta9LLaZ/+vxCHeJiwIp1jMu2JhBlTUvcWyRAj16tSF0?= =?us-ascii?Q?d+8N6/ElEwEXXksfnYc1RAT+f7iRu1fIb7nIJjLzlIhvDgTEOs5sAlvQYilq?= =?us-ascii?Q?OCiOE/YSZ7sVtP/IvO1iDmU4j4z4yoxVzUtUW53m5/gVTeVfY/C8pSnDVCYh?= =?us-ascii?Q?5606tiwyRDlj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-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2015 23:09:27.3757 (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.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB0747 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150519_160951_088258_A2F65FD3 X-CRM114-Status: UNSURE ( 8.32 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.1 (-) Cc: Minghuan Lian , Stuart Yoder , 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=BAD_ENC_HEADER,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 allocating a device table, if the requested allocation is smaller than the default granule size of the ITS then, we need to round up to the default size Signed-off-by: Minghuan Lian Signed-off-by: Stuart Yoder Reviewed-by: Marc Zyngier --- -v3 changes -updated commit message and added comment -would be nice to get this into 4.1 as the kernel will hang booting on some systems drivers/irqchip/irq-gic-v3-its.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 9687f8a..1b7e155 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -828,7 +828,14 @@ static int its_alloc_tables(struct its_node *its) u64 typer = readq_relaxed(its->base + GITS_TYPER); u32 ids = GITS_TYPER_DEVBITS(typer); - order = get_order((1UL << ids) * entry_size); + /* + * 'order' was initialized earlier to the default page + * granule of the the ITS. We can't have an allocation + * smaller than that. If the requested allocation + * is smaller, round up to the default page granule. + */ + order = max(get_order((1UL << ids) * entry_size), + order); if (order >= MAX_ORDER) { order = MAX_ORDER - 1; pr_warn("%s: Device Table too large, reduce its page order to %u\n",