From patchwork Tue Oct 29 10:29:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frediano Ziglio X-Patchwork-Id: 13854641 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 0821FD2AB1C for ; Tue, 29 Oct 2024 10:30:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.827212.1241799 (Exim 4.92) (envelope-from ) id 1t5jUD-0008Pt-Cy; Tue, 29 Oct 2024 10:30:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 827212.1241799; Tue, 29 Oct 2024 10:30:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5jUD-0008NX-5s; Tue, 29 Oct 2024 10:30:05 +0000 Received: by outflank-mailman (input) for mailman id 827212; Tue, 29 Oct 2024 10:30:03 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5jUB-0006t0-C9 for xen-devel@lists.xenproject.org; Tue, 29 Oct 2024 10:30:03 +0000 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [2a00:1450:4864:20::633]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bd53e640-95e0-11ef-99a3-01e77a169b0f; Tue, 29 Oct 2024 11:29:55 +0100 (CET) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a99ebb390a5so1156311166b.1 for ; Tue, 29 Oct 2024 03:29:55 -0700 (PDT) Received: from fziglio-desktop.. ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1dfbc7e8sm458495466b.31.2024.10.29.03.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 03:29:54 -0700 (PDT) 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: bd53e640-95e0-11ef-99a3-01e77a169b0f X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjo2MzMiLCJoZWxvIjoibWFpbC1lajEteDYzMy5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6ImJkNTNlNjQwLTk1ZTAtMTFlZi05OWEzLTAxZTc3YTE2OWIwZiIsInRzIjoxNzMwMTk3Nzk1LjUzMDAzNCwic2VuZGVyIjoiZnJlZGlhbm8uemlnbGlvQGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1730197795; x=1730802595; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GlmexNYkWAFWJCr6Snri0UTFiTtdD3QbNKgKkQOoYME=; b=eGYJBZiXRlHP+J8Bnvt6OW/Ftw3Ceh5UDlhcIYQoeelkoMThzDkWixNb8JLzbba7Hy m6OCkCxr6C1nX12vGT0cFewKrfvPTOaaMAq6i6Vq1kqRSdWZBbusSfyXXurMyYx/R20+ +XmmSJtgQj1lyjrt39jQp47IOQGzTzXWc9YYg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730197795; x=1730802595; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GlmexNYkWAFWJCr6Snri0UTFiTtdD3QbNKgKkQOoYME=; b=qMbt1otv1wy54Uzi0MfLZIrc76l2QxJr0P3PX/9JUi2bj27ZxytoOUouChPiJbt3s1 WyuaaBDhyTPy/ha9QiFVjxrJh46Va+aaNfIc/kFqBQON7sa5+27RKYA1ZKkx2MyNJ3tJ 6RRqlnMIRHj0fj/g6d4cotPFAsRODjs2YwiLVLXfeiTy01RUtfqNyGwdghmhHY/MmM0p 4JGq96IlHevoiwbWk+2GQln/6yymj6PwcKzhs3hZaJ6JKoB4G3BV2RajN1qJOomrc51y LQpWVi/lg3X0LUNptec/2mWQTwv7+gxVpEvmmu+iWEISDYTuZhwkTJXetkUVrSiY0fbO kgKA== X-Gm-Message-State: AOJu0Yx4ZQHVzxZuIPQapHJ3u4Llnwdn5ZT2JoGpBGyk3XUwQSJe0BEx WoBaFqSvmW7xIu0Q+SbbOrbPvmjmy8QSatO6ebZkIy75Mpw2JmrC24pnD6x6PHJ5k8X76JGBRmh U X-Google-Smtp-Source: AGHT+IE2wUsDPiSFiORRAyMj/1O36KBCAzkvKv2Vba6kqickrrJHq8KEcCk4wfzDtDkPTqYZIi/l+w== X-Received: by 2002:a17:906:da8b:b0:a99:5f45:cb69 with SMTP id a640c23a62f3a-a9e2b32edcdmr149064566b.4.1730197794666; Tue, 29 Oct 2024 03:29:54 -0700 (PDT) From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: Frediano Ziglio , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH v7 3/5] x86/boot: Use boot_vid_info variable directly from C code Date: Tue, 29 Oct 2024 10:29:40 +0000 Message-Id: <20241029102942.162912-4-frediano.ziglio@cloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241029102942.162912-1-frediano.ziglio@cloud.com> References: <20241029102942.162912-1-frediano.ziglio@cloud.com> MIME-Version: 1.0 No more need to pass from assembly code. Signed-off-by: Frediano Ziglio Reviewed-by: Andrew Cooper --- Changes since v1: - split the 2 variable changes into 2 commits. Changes since v2: - revert commit order. --- xen/arch/x86/boot/build32.lds.S | 1 + xen/arch/x86/boot/head.S | 10 +--------- xen/arch/x86/boot/reloc.c | 13 +++++-------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.lds.S index 27f0d7ac3c..f20fc18977 100644 --- a/xen/arch/x86/boot/build32.lds.S +++ b/xen/arch/x86/boot/build32.lds.S @@ -50,6 +50,7 @@ SECTIONS DECLARE_IMPORT(__trampoline_seg_start); DECLARE_IMPORT(__trampoline_seg_stop); DECLARE_IMPORT(trampoline_phys); + DECLARE_IMPORT(boot_vid_info); . = . + GAP; *(.text) *(.text.*) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index ade2c5c43d..5da7ac138f 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -514,18 +514,10 @@ trampoline_setup: mov sym_esi(trampoline_phys), %ecx add $TRAMPOLINE_SPACE,%ecx -#ifdef CONFIG_VIDEO - lea sym_esi(boot_vid_info), %edx -#else - xor %edx, %edx -#endif - /* Save Multiboot / PVH info struct (after relocation) for later use. */ - push %edx /* Boot video info to be filled from MB2. */ mov %ebx, %edx /* Multiboot / PVH information address. */ - /* reloc(magic/eax, info/edx, trampoline/ecx, video/stk) using fastcall. */ + /* reloc(magic/eax, info/edx, trampoline/ecx) using fastcall. */ call reloc - add $4, %esp #ifdef CONFIG_PVH_GUEST cmpb $0, sym_esi(pvh_boot) diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index 94b078d7b1..707d9c5f15 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -176,7 +176,7 @@ static multiboot_info_t *mbi_reloc(uint32_t mbi_in, memctx *ctx) return mbi_out; } -static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx *ctx) +static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, memctx *ctx) { const multiboot2_fixed_t *mbi_fix = _p(mbi_in); const multiboot2_memory_map_t *mmap_src; @@ -185,7 +185,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx memory_map_t *mmap_dst; multiboot_info_t *mbi_out; #ifdef CONFIG_VIDEO - struct boot_video_info *video = NULL; + struct boot_video_info *video = &boot_vid_info; #endif uint32_t ptr; unsigned int i, mod_idx = 0; @@ -290,12 +290,11 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx #ifdef CONFIG_VIDEO case MULTIBOOT2_TAG_TYPE_VBE: - if ( video_out ) + if ( video ) { const struct vesa_ctrl_info *ci; const struct vesa_mode_info *mi; - video = _p(video_out); ci = (const void *)get_mb2_data(tag, vbe, vbe_control_info); mi = (const void *)get_mb2_data(tag, vbe, vbe_mode_info); @@ -321,7 +320,6 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx if ( (get_mb2_data(tag, framebuffer, framebuffer_type) != MULTIBOOT2_FRAMEBUFFER_TYPE_RGB) ) { - video_out = 0; video = NULL; } break; @@ -346,8 +344,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx } /* SAF-1-safe */ -void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline, - uint32_t video_info) +void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline) { memctx ctx = { trampoline }; @@ -357,7 +354,7 @@ void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline, return mbi_reloc(in, &ctx); case MULTIBOOT2_BOOTLOADER_MAGIC: - return mbi2_reloc(in, video_info, &ctx); + return mbi2_reloc(in, &ctx); case XEN_HVM_START_MAGIC_VALUE: if ( IS_ENABLED(CONFIG_PVH_GUEST) )