From nobody Mon Feb 9 23:59:55 2026 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1565631098; cv=none; d=zoho.com; s=zohoarc; b=cLinl33F1x6j6tUt+dnqFi7L3OBWkfRZWdWhTz2vV2YBxrDtFgelfxhXGIwguIrYZRBiM741/iq4VcsKGmZ4SFPllna6CRm4HXe673q8xxzJqCpM8YIkllQIkahte7ICBin2JN26glGSRkrwqiNckaZk6qgMO6TUlRZpOaKUqH8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565631098; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=8dHSU4/G6Zygf9l3myCMrCWC87mfAv/spWzDvyaYzwE=; b=hbn1WeS8ungj2DT5auGW8iRuXSHmsJ47pRK/AGpAHtQLkrJRgSgDLJDD5nGX0ZA1Bh7K5DCazQ+8TlVNb/hygVcOu4XZoE24i4dXb9OkQaWsj3LjlxHTDmnwz/2iydswTES/5Tv7o78rIvvrQ2aYjjM96hsfMFNyUrfRXLup+5w= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1565631098525821.7821093501763; Mon, 12 Aug 2019 10:31:38 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hxE9a-0006mm-1r; Mon, 12 Aug 2019 17:30:42 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hxE9Y-0006lR-VI for xen-devel@lists.xenproject.org; Mon, 12 Aug 2019 17:30:40 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id e767d733-bd26-11e9-8980-bc764e045a96; Mon, 12 Aug 2019 17:30:40 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EF0B21715; Mon, 12 Aug 2019 10:30:39 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 491D63F706; Mon, 12 Aug 2019 10:30:39 -0700 (PDT) X-Inumbo-ID: e767d733-bd26-11e9-8980-bc764e045a96 From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 12 Aug 2019 18:30:05 +0100 Message-Id: <20190812173019.11956-15-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190812173019.11956-1-julien.grall@arm.com> References: <20190812173019.11956-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v3 14/28] xen/arm32: head: Rework and document check_cpu_mode() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Julien Grall , Stefano Stabellini , Volodymyr Babchuk MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" A branch in the success case can be avoided by inverting the branch condition. At the same time, remove a pointless comment as Xen can only run at Hypervisor Mode. Lastly, document the behavior and the main registers usage within the function. Signed-off-by: Julien Grall --- Changes in v2: - Patch added --- xen/arch/arm/arm32/head.S | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index 4285f76463..c7b4fe4cd4 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -206,6 +206,16 @@ secondary_switched: b launch ENDPROC(init_secondary) =20 +/* + * Check if the CPU supports virtualization extensions and has been booted + * in Hypervisor mode. + * + * This function will never return when the CPU doesn't support + * virtualization extensions or is booted in another mode than + * Hypervisor mode. + * + * Clobbers r0 - r3 + */ check_cpu_mode: /* Check that this CPU has Hyp mode */ mrc CP32(r0, ID_PFR1) @@ -220,15 +230,12 @@ check_cpu_mode: mrs r0, cpsr and r0, r0, #0x1f /* Mode is in the low 5 bits of CPSR = */ teq r0, #0x1a /* Hyp Mode? */ - beq hyp + moveq pc, lr /* Yes, return */ =20 /* OK, we're boned. */ PRINT("- Xen must be entered in NS Hyp mode -\r\n") PRINT("- Please update the bootloader -\r\n") b fail - -hyp: PRINT("- Xen starting in Hyp mode -\r\n") - mov pc, lr ENDPROC(check_cpu_mode) =20 zero_bss: --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel