From patchwork Wed Apr 30 11:36:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 4092981 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 93D4D9F39D for ; Wed, 30 Apr 2014 11:39:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B85482021B for ; Wed, 30 Apr 2014 11:39:31 +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 E52832026F for ; Wed, 30 Apr 2014 11:39:30 +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 1WfSp3-0007hs-0G; Wed, 30 Apr 2014 11:37:09 +0000 Received: from mail-wi0-f181.google.com ([209.85.212.181]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WfSp0-0007eu-Ke for linux-arm-kernel@lists.infradead.org; Wed, 30 Apr 2014 11:37:07 +0000 Received: by mail-wi0-f181.google.com with SMTP id f8so1997806wiw.8 for ; Wed, 30 Apr 2014 04:36:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=McL7M8iHW524G+SIRlAlwZfgb5JttizhDeG4K3bzc4k=; b=b/GZr4kzdG6DyEwywzGAbhyD0bx+CAfKHrix4nFTnl+mj6p86lbWlJA0hnMF6izRJh ou/Jro0+SBpp27piH3X2gSgG1Z+hIhsmtk9gyAVeSknLbFnM2++Rmnwhr72quKCy37+J 9erkY/uJwwgjjR4JS/1xx/HDr/+45MNmxYDt7j9rX4ZNCEKaZzOjUIkchUttg/fqWIeB 6d1XQpLoThBUEK96yTkA4uhJ/0R8BeyneEmSsqvQVcAU1+hx4CkBnmaUe7dpShxXPur2 Oud10XBXWrbqJJRBiSnZJ63vNU4XhbYTsOUDOL/apY+XlQmYlvfE/OM6V0pJljpALp25 EOyg== X-Gm-Message-State: ALoCoQkQpB1cjzBIMnEQSsOmVln8Y8ZfrdwsadJP+nPhR3E7xWNGwDSB80um6n8oVw1kkYWiT1a5 X-Received: by 10.180.90.132 with SMTP id bw4mr3184779wib.43.1398857804265; Wed, 30 Apr 2014 04:36:44 -0700 (PDT) Received: from marmot.wormnet.eu (marmot.wormnet.eu. [188.246.204.87]) by mx.google.com with ESMTPSA id dn1sm3082243wid.6.2014.04.30.04.36.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Apr 2014 04:36:43 -0700 (PDT) From: Steve Capper To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] arm64: mm: Create gigabyte kernel logical mappings where possible Date: Wed, 30 Apr 2014 12:36:22 +0100 Message-Id: <1398857782-1525-1-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140430_043706_823292_7B1B3A6E X-CRM114-Status: GOOD ( 14.97 ) X-Spam-Score: -0.7 (/) Cc: catalin.marinas@arm.com, Steve Capper , jays.lee@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 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.5 required=5.0 tests=BAYES_00,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 We have the capability to map 1GB level 1 blocks when using a 4K granule. This patch adjusts the create_mapping logic s.t. when mapping physical memory on boot, we attempt to use a 1GB block if both the VA and PA start and end are 1GB aligned. This both reduces the levels of lookup required to resolve a kernel logical address, as well as reduces TLB pressure on cores that support 1GB TLB entries. Signed-off-by: Steve Capper --- Hello, This patch has been tested on the FastModel for 4K and 64K pages. Also, this has been tested with Jungseok's 4 level patch. I put in the explicit check for PAGE_SHIFT, as I am anticipating a three level 64KB configuration at some point. With two level 64K, a PUD is equivalent to a PMD which is equivalent to a PGD, and these are all level 2 descriptors. Under three level 64K, a PUD would be equivalent to a PGD which would be a level 1 descriptor thus may not be a block. Comments/critique/testers welcome. Cheers, diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 4d29332..867e979 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -234,7 +234,20 @@ static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr, pud = pud_offset(pgd, addr); do { next = pud_addr_end(addr, end); - alloc_init_pmd(pud, addr, next, phys); + + /* + * For 4K granule only, attempt to put down a 1GB block + */ + if ((PAGE_SHIFT == 12) && + ((addr | next | phys) & ~PUD_MASK) == 0) { + pud_t old_pud = *pud; + set_pud(pud, __pud(phys | prot_sect_kernel)); + + if (!pud_none(old_pud)) + flush_tlb_all(); + } else { + alloc_init_pmd(pud, addr, next, phys); + } phys += next - addr; } while (pud++, addr = next, addr != end); }