From patchwork Fri Jul 18 14:00:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 4585071 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 5F7CC9F26C for ; Fri, 18 Jul 2014 14:04:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 94703201BA for ; Fri, 18 Jul 2014 14:04:08 +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 12DDF2018E for ; Fri, 18 Jul 2014 14:04:07 +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 1X88jQ-0005VA-Db; Fri, 18 Jul 2014 14:01:52 +0000 Received: from mail-wg0-f47.google.com ([74.125.82.47]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X88iv-0004wi-UV for linux-arm-kernel@lists.infradead.org; Fri, 18 Jul 2014 14:01:22 +0000 Received: by mail-wg0-f47.google.com with SMTP id b13so3451702wgh.18 for ; Fri, 18 Jul 2014 07:00:54 -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:in-reply-to :references; bh=MCV2UYvUi5tVKQEMLRvR/rWBCxZXzyeBWq4RCIJFhfc=; b=cdTRAvWiMjb81RC78KlD81yBPBuq83CPV427zzXxItnQjj31+oNmq0fT7/D3vFC1PI brdr4+eeueSpFxEQkGsDIE0Zmqkez+AXQBEEW4rlA9Z0Ddo4Bj/VqGA7MhQwXAVi9kML yacH48pSoUkxW6Mw9ELvhW5aEULZBY28i2lPJ5MuLhAix4cGr8mgpcB7pouT3vxRIpVI RjTOV/sT+RB0agnXQRXVarKY10qgUeAX6sq12wCbJfngYyOT40sOfqukSY4R9kF9q3LP yOyDc6yWgt3r23YEZHKTsrI+wVUMz29a0fA2b5Dq9OOiIr9GpZ/BCQuF75IUbdppyU5j iBiA== X-Gm-Message-State: ALoCoQmBk3s50+lynt7B2tmvi9IJMeokPztrCQzp75dCyK2+NH4OIyOSufTjL63PHr7NA7wQd3GL X-Received: by 10.194.48.8 with SMTP id h8mr6987698wjn.106.1405692054217; Fri, 18 Jul 2014 07:00:54 -0700 (PDT) Received: from mohikan.mushroom.smurfnet.nu (cpc4-cmbg17-2-0-cust71.5-4.cable.virginm.net. [86.14.224.72]) by mx.google.com with ESMTPSA id ft17sm14465308wjc.14.2014.07.18.07.00.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jul 2014 07:00:53 -0700 (PDT) From: Leif Lindholm To: linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, linux@arm.linux.org.uk Subject: [PATCH 1/7] arm: break part of __soft_restart out into separate function Date: Fri, 18 Jul 2014 15:00:47 +0100 Message-Id: <1405692053-7514-2-git-send-email-leif.lindholm@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1405692053-7514-1-git-send-email-leif.lindholm@linaro.org> References: <1405692053-7514-1-git-send-email-leif.lindholm@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140718_070122_132250_A7F9FB01 X-CRM114-Status: GOOD ( 12.75 ) X-Spam-Score: -0.7 (/) Cc: roy.franz@linaro.org, matt.fleming@intel.com, ard.biesheuvel@linaro.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: , 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=-1.9 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 Certain operations can be considered mandatory for any piece of code preparing to switch off the MMU. Break this out into separate function idmap_prepare(). Signed-off-by: Leif Lindholm Suggested-by: Will Deacon Acked-by: Will Deacon --- arch/arm/include/asm/idmap.h | 1 + arch/arm/kernel/process.c | 12 +----------- arch/arm/mm/idmap.c | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/arch/arm/include/asm/idmap.h b/arch/arm/include/asm/idmap.h index bf863ed..2e914a8 100644 --- a/arch/arm/include/asm/idmap.h +++ b/arch/arm/include/asm/idmap.h @@ -10,5 +10,6 @@ extern pgd_t *idmap_pgd; void setup_mm_for_reboot(void); +void idmap_prepare(void); #endif /* __ASM_IDMAP_H */ diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 81ef686..6849e13 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -75,17 +75,7 @@ static void __soft_restart(void *addr) { phys_reset_t phys_reset; - /* Take out a flat memory mapping. */ - setup_mm_for_reboot(); - - /* Clean and invalidate caches */ - flush_cache_all(); - - /* Turn off caching */ - cpu_proc_fin(); - - /* Push out any further dirty data, and ensure cache is empty */ - flush_cache_all(); + idmap_prepare(); /* Switch to the identity mapping. */ phys_reset = (phys_reset_t)(unsigned long)virt_to_phys(cpu_reset); diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c index 8e0e52e..5c85779 100644 --- a/arch/arm/mm/idmap.c +++ b/arch/arm/mm/idmap.c @@ -122,3 +122,18 @@ void setup_mm_for_reboot(void) local_flush_tlb_all(); #endif } + +void idmap_prepare(void) +{ + /* Take out a flat memory mapping. */ + setup_mm_for_reboot(); + + /* Clean and invalidate caches */ + flush_cache_all(); + + /* Turn off caching */ + cpu_proc_fin(); + + /* Push out any further dirty data, and ensure cache is empty */ + flush_cache_all(); +}