From patchwork Sat Oct 6 14:06:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 1557801 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 543B83FD56 for ; Sat, 6 Oct 2012 14:06:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750939Ab2JFOGG (ORCPT ); Sat, 6 Oct 2012 10:06:06 -0400 Received: from mail-qc0-f174.google.com ([209.85.216.174]:53718 "EHLO mail-qc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750719Ab2JFOGE (ORCPT ); Sat, 6 Oct 2012 10:06:04 -0400 Received: by mail-qc0-f174.google.com with SMTP id d3so1771897qch.19 for ; Sat, 06 Oct 2012 07:06:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version:content-type:x-gm-message-state; bh=TrLDObqkl3TCbyozTBBpE+JQfIo0RjKPA28/b11caw0=; b=G3sASFdhUegPJ3/XcuIIbbFkGj73VLCp66claUNspS8Y+P+4+HC4P6SrZyRDQsOfML PIWvlcbPX6FMyVzDC37R+7RKMD9uxE+sncE6IqhYd3umKJ+VwtY1fRBoGKopoI5XQbAC xurhr61HH4H+QvLCovYcFPf4bWTFBkqebgVjuZzU4JzQqryOgtsunlvcVNbMzPV6/aB1 oftiUyFUmkjiUeYnKVmHG4ZmvB0SxMf/dJqHcH0cLUgna4O5+cq74uDOh88hmJVjCA5J oHiAamcL+JcVQ50cUZhrcJ0EFnBcrkNILQgC7/9OIcQ+mJmu/lzYBzog7T8Djm7Sz3Pa 5HLg== Received: by 10.224.78.197 with SMTP id m5mr21741669qak.36.1349532362722; Sat, 06 Oct 2012 07:06:02 -0700 (PDT) Received: from xanadu.home (modemcable203.213-202-24.mc.videotron.ca. [24.202.213.203]) by mx.google.com with ESMTPS id gd19sm12729166qeb.0.2012.10.06.07.06.01 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 06 Oct 2012 07:06:01 -0700 (PDT) Date: Sat, 6 Oct 2012 10:06:00 -0400 (EDT) From: Nicolas Pitre To: Marc Zyngier cc: Tony Lindgren , Dave Martin , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Russell King - ARM Linux Subject: Re: [PATCH v2 2/7] ARM: virt: allow the kernel to be entered in HYP mode In-Reply-To: <6d3553bfe8a2d1ac88cab852100616a7@localhost> Message-ID: References: <1347036934-8519-1-git-send-email-marc.zyngier@arm.com> <1347036934-8519-3-git-send-email-marc.zyngier@arm.com> <20121005200822.GQ3874@atomide.com> <6d3553bfe8a2d1ac88cab852100616a7@localhost> User-Agent: Alpine 2.02 (LFD 1266 2009-07-14) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmcMyQ92Nu2Ro/5f9X3m2HlTcEuVN8GSMDgoyR217QVkxH2eeuXQQ1UB4tWptOPsC1LFPnM Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org On Sat, 6 Oct 2012, Marc Zyngier wrote: > Hi Tony, > > On Fri, 5 Oct 2012 13:08:22 -0700, Tony Lindgren wrote: > > Hi, > > > > * Marc Zyngier [120907 10:04]: > >> From: Dave Martin > >> > >> This patch does two things: > >> > >> * Ensure that asynchronous aborts are masked at kernel entry. > >> The bootloader should be masking these anyway, but this reduces > >> the damage window just in case it doesn't. > >> > >> * Enter svc mode via exception return to ensure that CPU state is > >> properly serialised. This does not matter when switching from > >> an ordinary privileged mode ("PL1" modes in ARMv7-AR rev C > >> parlance), but it potentially does matter when switching from a > >> another privileged mode such as hyp mode. > >> > >> This should allow the kernel to boot safely either from svc mode or > >> hyp mode, even if no support for use of the ARM Virtualization > >> Extensions is built into the kernel. > >> > >> Signed-off-by: Dave Martin > >> Signed-off-by: Marc Zyngier > > > > Just bisected this down in linux-next for breaking booting of > > my omap2420 ARMv6 based n8x0.. > > > >> --- a/arch/arm/kernel/head.S > >> +++ b/arch/arm/kernel/head.S > >> @@ -83,8 +83,12 @@ ENTRY(stext) > >> THUMB( .thumb ) @ switch to Thumb now. > >> THUMB(1: ) > >> > >> - setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode > >> - @ and irqs disabled > >> +#ifdef CONFIG_ARM_VIRT_EXT > >> + bl __hyp_stub_install > >> +#endif > >> + @ ensure svc mode and all interrupts masked > >> + safe_svcmode_maskall r9 > >> + > >> mrc p15, 0, r9, c0, c0 @ get processor id > >> bl __lookup_processor_type @ r5=procinfo r9=cpuid > >> movs r10, r5 @ invalid processor (r5=0)? > > > > ..and looks like undoing this part fixes it. Any ideas? > > > > I quickly tried disabling ARCH_OMAP3 and ARCH_OMAP4 so it's > > ARMv6 but that does not help. > > If you compiled for v6 only, we can safely exclude __hyp_stub_install, and > I assume that you get past the decompressor. > > If so, that indicates some side effect of the safe_svcmode_maskall macro, > and I suspect the "movs pc, lr" bit. That would be surprizing if the "movs pc, lr" was to blame. This should work on all architectures. However the A bit might be to blame. > Can you try the attached patch? It basically falls back to the previous > behaviour if not entered in HYP mode. This is likely to work of course. However I think we should try to pinpoint the exact problem i.e. whether it is the A bit or the "movs pc, lr" which makes a difference (it is unlikely to be both). So I was about to suggest to test this patch as well: Nicolas --- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h index 683a1e6b60..118e22ee46 100644 --- a/arch/arm/include/asm/assembler.h +++ b/arch/arm/include/asm/assembler.h @@ -254,8 +254,7 @@ mov lr , \reg and lr , lr , #MODE_MASK cmp lr , #HYP_MODE - orr \reg , \reg , #PSR_A_BIT | PSR_I_BIT | PSR_F_BIT - bic \reg , \reg , #MODE_MASK + mov \reg , #PSR_I_BIT | PSR_F_BIT orr \reg , \reg , #SVC_MODE THUMB( orr \reg , \reg , #PSR_T_BIT ) msr spsr_cxsf, \reg