From patchwork Tue Apr 1 01:51:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ??? X-Patchwork-Id: 3918361 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D2AC89F357 for ; Tue, 1 Apr 2014 01:52:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EE2D2203B1 for ; Tue, 1 Apr 2014 01:52:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BFB9120259 for ; Tue, 1 Apr 2014 01:52:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751316AbaDABwB (ORCPT ); Mon, 31 Mar 2014 21:52:01 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:38714 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751098AbaDABwA (ORCPT ); Mon, 31 Mar 2014 21:52:00 -0400 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N3B003C3X6MTXD0@mailout4.samsung.com>; Tue, 01 Apr 2014 10:51:58 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.48]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id E5.3B.12635.EBB1A335; Tue, 01 Apr 2014 10:51:58 +0900 (KST) X-AuditID: cbfee68d-b7fcd6d00000315b-bc-533a1bbec1bc Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 75.47.28157.EBB1A335; Tue, 01 Apr 2014 10:51:58 +0900 (KST) Received: from DOJAYSLEE01 ([12.36.166.151]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N3B009BIX6MXH40@mmp1.samsung.com>; Tue, 01 Apr 2014 10:51:58 +0900 (KST) From: Jungseok Lee To: konrad.wilk@oracle.com, linux-kernel@vger.kernel.org Cc: sungjinn.chung@samsung.com, linux-samsung-soc Subject: [PATCH] swiotlb: Correct kernel command line handler Date: Tue, 01 Apr 2014 10:51:58 +0900 Message-id: <011801cf4d4c$f7ba51f0$e72ef5d0$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: Ac9NTBtBoMCSDAt8QEisIzQrZOmupg== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrEIsWRmVeSWpSXmKPExsVy+t8zA9190lbBBs/2GlssW/yU0eLyrjls FjPO72Oy+DBjJaMDi8fHp7dYPPq2rGL0+LxJLoA5issmJTUnsyy1SN8ugStj/odDTAVHeCsO tbcxNjB+4+pi5OSQEDCROPx6MyOELSZx4d56ti5GLg4hgWWMEheePGaDKWrYdYgZIrGIUWLd 5jWMEM4fRolbrduYQarYBDQlHt3tYQexRQQsJFatnwZmMwuES+x6eoIJxBYWsJW4+28/mM0i oCqxa3M/2AZeAUuJz0/fsULYghI/Jt9jgejVkli/8zgThC0vsXnNW2aIixQkdpx9zQixS09i 7/kPULtEJPa9eAd2nITAMnaJm5c2s0MsE5D4NvkQ0FAOoISsxKYDUHMkJQ6uuMEygVFsFpLV s5CsnoVk9SwkKxYwsqxiFE0tSC4oTkovMtQrTswtLs1L10vOz93ECImv3h2Mtw9YH2JMBlo/ kVlKNDkfGJ95JfGGxmZGFqYmpsZG5pZmpAkrifMmPUwKEhJITyxJzU5NLUgtii8qzUktPsTI xMEp1cDosXq2SZoEo0BQ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pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 This patch corrects kernel command line handler when io_tlb_nslabs is set to 0. A current implementation allocates default size memory (64MB) when 0 is given to io_tlb_nslabs ("swiotlb=0") by kernel command line. In other words, memory is allocated unintentionally. Signed-off-by: Jungseok Lee Signed-off-by: Sungjinn Chung --- lib/swiotlb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/swiotlb.c b/lib/swiotlb.c index b604b83..9fe9f71 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c @@ -55,6 +55,8 @@ int swiotlb_force; +static int swiotlb_no_use; + /* * Used to do a quick range check in swiotlb_tbl_unmap_single and * swiotlb_tbl_sync_single_*, to see if the memory was in fact allocated by this @@ -102,6 +104,8 @@ setup_io_tlb_npages(char *str) io_tlb_nslabs = simple_strtoul(str, &str, 0); /* avoid tail segment of size < IO_TLB_SEGSIZE */ io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE); + if (!io_tlb_nslabs) + swiotlb_no_use = 1; } if (*str == ',') ++str; @@ -212,7 +216,7 @@ swiotlb_init(int verbose) unsigned char *vstart; unsigned long bytes; - if (!io_tlb_nslabs) { + if (!swiotlb_no_use && !io_tlb_nslabs) { io_tlb_nslabs = (default_size >> IO_TLB_SHIFT); io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE); } @@ -244,7 +248,7 @@ swiotlb_late_init_with_default_size(size_t default_size) unsigned int order; int rc = 0; - if (!io_tlb_nslabs) { + if (!swiotlb_no_use && !io_tlb_nslabs) { io_tlb_nslabs = (default_size >> IO_TLB_SHIFT); io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE); }