From patchwork Wed Jul 19 07:38:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13318467 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 79BE1EB64DA for ; Wed, 19 Jul 2023 07:38:57 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.565607.883887 (Exim 4.92) (envelope-from ) id 1qM1lV-0000H5-RG; Wed, 19 Jul 2023 07:38:29 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 565607.883887; Wed, 19 Jul 2023 07:38:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qM1lV-0000Gq-Oh; Wed, 19 Jul 2023 07:38:29 +0000 Received: by outflank-mailman (input) for mailman id 565607; Wed, 19 Jul 2023 07:38:28 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qM1lT-0000Gk-Ta for xen-devel@lists.xenproject.org; Wed, 19 Jul 2023 07:38:28 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20609.outbound.protection.outlook.com [2a01:111:f400:7e1b::609]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 3f4a7a05-2607-11ee-b23a-6b7b168915f2; Wed, 19 Jul 2023 09:38:26 +0200 (CEST) Received: from DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) by DBAPR04MB7205.eurprd04.prod.outlook.com (2603:10a6:10:1b3::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Wed, 19 Jul 2023 07:38:24 +0000 Received: from DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::e5cf:5743:ab60:b14e]) by DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::e5cf:5743:ab60:b14e%5]) with mapi id 15.20.6588.031; Wed, 19 Jul 2023 07:38:24 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3f4a7a05-2607-11ee-b23a-6b7b168915f2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AZ8nVvbL5RDd9X4iHrwCAsv7BdEfdWqFGlv1fJts5zqmOlzyyfyYGx7dkRdFk7uFS/1jzF2PvA1hFKFzw/1UsLsl7D8dFC5J8lcBeW5iZmzN66Zwt2LwPMjTaqZdH8quLuaptuhY2VI35s64mcqdMkdf48mxakNS3+pNMf9NALzfKYBpGYNPRfmrpSfXAFFCZQ9Go4oKatEc+FQq1tx9IUQMBJEgJkyqPmtp4yovfYq/HJ152KwkNdpLxHQbNYtyIRfgAaoj97a+FOp8HqgzHYhNi1RvIDodNYGvLS4Fs597O7qAkwE6LTy0FKfar6QomkhWbtHJqnn0GVIyxinVFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uXb4NC6XF0E0BgAu0gjiWqBFwYNC73u24iqA1zZv1OA=; b=lKG5DEZaIGw7mLCDrNG8qW4puVnI3mwG+KypYLaOJNiHv8oifDWa3fiyLTv/2Rbp9+nZfjWEaB0XLzt0u8uZa4oZispYS6tvEGZvEBPYpBTE9I6WQO8H3E++gfcYRA41EYHA0gVnS3RKDkz6Ew89erIWPo1NTvZP5cBUaIRRr0HytMkIA2nnUU67ciRTxZAhYyT8D6JCdwVrrkYwb7K5FEr6qAnri4GSjQDhaRNtAWXgEZ2l5UF/7eBgKAF8gRdhrhV3QXZm/xjTm1tDSJ9pH+ZVY+KCNIQAkgCUj2DmBY7AIOXpogEcJ1xy2ROK7vluxnmdtV+aJv33c7+K9dbw8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uXb4NC6XF0E0BgAu0gjiWqBFwYNC73u24iqA1zZv1OA=; b=PZM60Xy++uNWcU8Fsys2POBF/jOhBlk7DGQMltbhD5t0opSJO4mav17+mwT/aqUiZzAtuNu5CV5W4zTi1/gVhXt3pI16/ZfeOmroxrgdYyMNst/2Pi6YBg0CbmkamwsDuVoMvk3MKDppL5jH5raRGFr3JGI8TwhC9bkMZ7bQSYK5V2AGArN8Od0licaMnMyj3p6xRWSXuKXxxTDaYKh1Sc0Orc7nmSf3KSDmisQWvKTedQXQ/fTZgVchFDyMUl63u29lEgLTaM8LHbagRPF3gswq/xG8cjnwmbUKeAs8cM1KBRWYhXWIxBQh9pSIxs23yqnn+JIHTpxKbPfvmvbtwQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: <3913c170-09c6-2baf-ed38-5614f8c6cb2e@suse.com> Date: Wed, 19 Jul 2023 09:38:22 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= From: Jan Beulich Subject: [PATCH] x86: fix early boot output X-ClientProxiedBy: FR2P281CA0120.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9d::13) To DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8790:EE_|DBAPR04MB7205:EE_ X-MS-Office365-Filtering-Correlation-Id: dc18c008-b461-464a-e846-08db882b2258 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BJ8OgDn/U+37P5Q5jGz5QYws7luNlQjW6/cRLptGqBVhzqRjQDg2qXzBUOrm7Q481UAKctZy2zTSILzg5G9Cktbn/fHiOOxFVvWcDLkSeE7fJ2p+wxTOBbj7hxUYtLy4qmFKnJbG/IQR8uUIF74g3sOpTeTTAcYgab57stWviOcTO+CDgduP5eKJYARYimjs63e1mbwYzRu1nKde41jfA0igCuS6g9Y+NY/vf8wF3MUmUaM7t+wUiAlDkXGOwOkEzfrLWyWjvmpwz3p49L4QeMvnTXfO/U8aI7Jfbfg9sxlQfN07K1yWdGrdNoUHwlrImRR5Z/oxJXD+iTPMyrtyK84mA+YTKoxGYeAgOdb3fGmT8X8DOwtYemoC2o4lKgy7mjN83ydDPxPg7QQBuilGd9sAPV65i/L0GnWhhBfX+cnxYOH3o7neAL4FqQJADWEkJHiXc+7jdqCF0bxQIsU79zmn4hgB8MYYky5je9pvvjUQbG1aoAOUAnQIMDmpbd8ixT6btP0aVJI4XFCpGkYMKRzKOt9pa8e+gTGFFUrvpuljqiw0hy4YXUyA13MDM4k1FwRvcy2Nj51m081jgYwPudzj+NOfFm39AVLi4vVIMqJRpc6cr/UxBNK3ub8wQLKbepHU/V/qsNPL/d7I6/0JJA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8790.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(396003)(39860400002)(376002)(346002)(136003)(451199021)(41300700001)(8936002)(31686004)(8676002)(316002)(5660300002)(54906003)(2906002)(478600001)(66476007)(6916009)(66946007)(66556008)(4326008)(6512007)(6506007)(26005)(6486002)(2616005)(38100700002)(186003)(83380400001)(36756003)(86362001)(31696002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?LdTa6gyBIyjptWPUM++Ox3NkhNUG?= =?utf-8?q?LC9OdcQEN2Jyv0/YIbvxqaEwmHUZDn5nUY0Skxe4dSLHpoDhfi+5kcoj74x3Da75I?= =?utf-8?q?0/MVVnyBxNdoNg4CbbR6k50A2eaDskQeRJlimZ1h+A5rYAtmsoJ7ZG9RPh/LExqu/?= =?utf-8?q?YJMNC7U/n/yLtOE8OcJmSZUF7RXvwDb6TIVLFO4XGH2E47zT/JEuAfTu0Ut9tvLYj?= =?utf-8?q?ge2FTNs7d4VBZUnQmMXy38GCWc6BLkWong9qGdGPwXKfsTWRGxd7x+IefJYi2EN3W?= =?utf-8?q?1OsZs8izwdtDti8S1Xsibb+Wse6tbOawz7M3ikApykHFJeGgUaYGgRiQeL0LcgG1g?= =?utf-8?q?UNKn+M/S06tF6b+Zsikk1CFsGP6TLoxdOut22pVVcluGjdwT6WhtvWlOILjuBrCYG?= =?utf-8?q?riR/Bz/fjMQna4o/Q3DjsA2f2aIKQ54nXv+sJ+KsQoqbDTYSQcA/2W1PiJ+fR2C7i?= =?utf-8?q?J9cZYmPz9UB6gq4SaRWFsNEMLmcxwBo/8kl+gdgBKPo6IaiNuZlSbwvrwmcnHb0/8?= =?utf-8?q?8IpufUT1t5Xn5dF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QrEc6JtjsI+zMWQMj3ycWMhzSameS/5/iXhKB5TqTmDhzF68tRvsMV?= =?utf-8?q?tFEFl++Obfuj67otW5362E7lzN/H3ThrWIflZ3ae73j7FlflVOU22+8qcJGQCwaoK?= =?utf-8?q?NNx15h4vEiSx?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc18c008-b461-464a-e846-08db882b2258 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8790.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 07:38:24.5526 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: K2fP/l0cInEFE9dYmT/VZ4bs4t8u+sk4LNKSl1oX9hlT1uhiPjx3iQhiA9S2r0D4tbKcPVnZFKah/IDsV85pCQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7205 Loading the VGA base address involves sym_esi(), i.e. %esi still needs to hold the relocation base address. Therefore the address of the message to output cannot be "passed" in %esi. Put the message offset in %ecx instead, adding it into %esi _after_ its last use as base address. Fixes: b28044226e1c ("x86: make Xen early boot code relocatable") Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- This also suggests that 78e693cc1232 ("x86/boot: fix early error output") was only tested for the no-VGA case (i.e. EFI+MB2), and only for one of the two paths which bypass the loading of %edi at .Lget_vtb (or the offset load merely was lucky to pick up a zero). Clearly when using "vga=current" with MB2 when the screen is already in graphics mode, there will continue to be no visible output. --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -146,17 +146,17 @@ efi_platform: early_error: /* Here to improve the disassembly. */ .Lbad_cpu: - add $sym_offs(.Lbad_cpu_msg), %esi + mov $sym_offs(.Lbad_cpu_msg), %ecx jmp .Lget_vtb .Lnot_multiboot: - add $sym_offs(.Lbad_ldr_msg), %esi + mov $sym_offs(.Lbad_ldr_msg), %ecx jmp .Lget_vtb .Lnot_aligned: - add $sym_offs(.Lbag_alg_msg), %esi + mov $sym_offs(.Lbag_alg_msg), %ecx jmp .Lget_vtb #ifdef CONFIG_REQUIRE_NX .Lno_nx: - add $sym_offs(.Lno_nx_msg), %esi + mov $sym_offs(.Lno_nx_msg), %ecx jmp .Lget_vtb #endif .Lmb2_no_st: @@ -164,11 +164,11 @@ early_error: /* Here to improve the disa * Here we are on EFI platform. vga_text_buffer was zapped earlier * because there is pretty good chance that VGA is unavailable. */ - add $sym_offs(.Lbad_ldr_nst), %esi + mov $sym_offs(.Lbad_ldr_nst), %ecx jmp .Lget_vtb .Lmb2_no_ih: /* Ditto. */ - add $sym_offs(.Lbad_ldr_nih), %esi + mov $sym_offs(.Lbad_ldr_nih), %ecx jmp .Lget_vtb .Lmb2_no_bs: /* @@ -176,7 +176,7 @@ early_error: /* Here to improve the disa * via start label. Then reliable vga_text_buffer zap is impossible * in Multiboot2 scanning loop and we have to zero %edi below. */ - add $sym_offs(.Lbad_ldr_nbs), %esi + mov $sym_offs(.Lbad_ldr_nbs), %ecx xor %edi,%edi # No VGA text buffer jmp .Lprint_err .Lmb2_efi_ia_32: @@ -184,12 +184,15 @@ early_error: /* Here to improve the disa * Here we are on EFI IA-32 platform. Then reliable vga_text_buffer zap is * impossible in Multiboot2 scanning loop and we have to zero %edi below. */ - add $sym_offs(.Lbad_efi_msg), %esi + mov $sym_offs(.Lbad_efi_msg), %ecx xor %edi,%edi # No VGA text buffer jmp .Lprint_err .Lget_vtb: mov sym_esi(vga_text_buffer), %edi .Lprint_err: + add %ecx, %esi # Add string offset to relocation base. + # NOTE: No further use of sym_esi() till the end of the "function"! +1: lodsb test %al,%al # Terminate on '\0' sentinel je .Lhalt @@ -202,11 +205,11 @@ early_error: /* Here to improve the disa mov %bl,%al out %al,%dx # Send a character over the serial line test %edi,%edi # Is the VGA text buffer available? - jz .Lprint_err + jz 1b stosb # Write a character to the VGA text buffer mov $7,%al stosb # Write an attribute to the VGA text buffer - jmp .Lprint_err + jmp 1b .Lhalt: hlt jmp .Lhalt