From patchwork Fri Nov 22 09:33:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frediano Ziglio X-Patchwork-Id: 13882951 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 E456BE65D3B for ; Fri, 22 Nov 2024 09:34:38 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.841793.1257293 (Exim 4.92) (envelope-from ) id 1tEQ3T-0003fL-Ej; Fri, 22 Nov 2024 09:34:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 841793.1257293; Fri, 22 Nov 2024 09:34:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tEQ3T-0003fB-Al; Fri, 22 Nov 2024 09:34:23 +0000 Received: by outflank-mailman (input) for mailman id 841793; Fri, 22 Nov 2024 09:34:22 +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 1tEQ3S-0003Ql-8q for xen-devel@lists.xenproject.org; Fri, 22 Nov 2024 09:34:22 +0000 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [2a00:1450:4864:20::429]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f2476440-a8b4-11ef-a0cc-8be0dac302b0; Fri, 22 Nov 2024 10:34:18 +0100 (CET) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-382423e1f7aso1238562f8f.2 for ; Fri, 22 Nov 2024 01:34:18 -0800 (PST) Received: from localhost.localdomain ([87.115.149.99]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-433cde16abasm21427775e9.19.2024.11.22.01.34.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:34:17 -0800 (PST) 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: f2476440-a8b4-11ef-a0cc-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjo0MjkiLCJoZWxvIjoibWFpbC13cjEteDQyOS5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6ImYyNDc2NDQwLWE4YjQtMTFlZi1hMGNjLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyMjY4MDU4LjYwNDM5NSwic2VuZGVyIjoiZnJlZGlhbm8uemlnbGlvQGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1732268057; x=1732872857; 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=y0Aj5W+j63+NuGcn0ZB3t9CEq3oH9AJf5/KiiQiC1a0=; b=DltuG8wiFM11m+gahYtY7Dw01gyRWqw99t3Wbn3+JpQSMuf7D5p5E04UP7Lmq+C7iw rKsXZw+5/yegJ/nynOgejcDNI/gCAeRQ9+hoiJ2LFehgIPw41csRv9/E50pB3r5P5JTr +g9+sCrsYdDjFnU0AG5LM6b7OrYqyJAvlV2rw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732268057; x=1732872857; 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=y0Aj5W+j63+NuGcn0ZB3t9CEq3oH9AJf5/KiiQiC1a0=; b=K658k3WzL8xo2M7Psx+PEYc4yNmDh0zcFA4AQk8d18mZim4IFRWaQFy+hbTxzHbjtP 8HIyCcON5qcM3uE3KwPlp79OLTO8SiE6q/7DUGhM6QfOgPSEDyL6sFY+ov84fx7D1//E sX/t3sJYyyv75XG6b+FfsTYcHjlEaZiffuWjVeEvXaZNksK8DR3MuqOa+FIU14F28xw/ K5TRgPl7beUDiOpvsytYUfKdxFzneHVtgwyrcahHyTQPAtYLjXPePt3AAIRURVzQhfAK KPMOnvT3K5NDDUgjdk4GrJrcvKX/4FO0bMVrvab10OEFPxKM0Yk6v2SQO5eu7kcUmodD 84hw== X-Gm-Message-State: AOJu0YzCfoA5NhOdowC+On3Aqhz8PfksH2ozl1Q3HyTm+sN0OrOPWUKw yamx6QVC6T/c4ILceIXC6JGUoq4Lm5D4Xnnf09ERYv4MWivuJoP5VXecd/DXrox7yA9/3bNs/WV 8F5I= X-Gm-Gg: ASbGncsRR0vQBkNNKqZOKvQOT9WUkzERoIHO8tUfzAEWuK7NomQUMxYRoybJQapzBsz zC62gpxl46AJaz7DOeI99Nr75yQbbPgsh+WVcR/vrgsaFIbM5uUgZNv0RCF2/cHEb8+Iys5pgBt 8I933IBkBZfBqjC5szTc3VBYdtVw+ueTPk578N1TSK/jhjRjrLz4lA4LKqltCQda5tzBfxw1w3R iOogXNKevoflcMFd432YHa3U45nPlpkmmYmEOxuoSl2/RtXpmPMjDtGEKa/Eyr+C1Spwg== X-Google-Smtp-Source: AGHT+IEoKDi872bJ7XgCPBqMWAU668/ao8l/n2sRLkR94Hw3rysbJY3JLdtZx/GavkwDxgBVA/W7lA== X-Received: by 2002:a05:6000:389:b0:382:37b2:87ee with SMTP id ffacd0b85a97d-38260b581b7mr1949072f8f.21.1732268057653; Fri, 22 Nov 2024 01:34:17 -0800 (PST) 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 v2 1/4] Use an include/boot directory to override headers for boot code Date: Fri, 22 Nov 2024 09:33:55 +0000 Message-Id: <20241122093358.478774-2-frediano.ziglio@cloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241122093358.478774-1-frediano.ziglio@cloud.com> References: <20241122093358.478774-1-frediano.ziglio@cloud.com> MIME-Version: 1.0 Not all headers can be used by 32 bit boot code. Allows to override some headers, we don't want to mess up with main headers as most of the code is only 64 bit so the easy stuff should be done for 64 bit declarations. Boot headers should be 64 bit compatibles to avoid having multiple declarations. Signed-off-by: Frediano Ziglio --- xen/arch/x86/boot/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile index d457876659..13d4583173 100644 --- a/xen/arch/x86/boot/Makefile +++ b/xen/arch/x86/boot/Makefile @@ -18,7 +18,7 @@ CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS)) $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS)) CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3 CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS)) -CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS)) -D__XEN__ +CFLAGS_x86_32 += -I$(srctree)/arch/x86/include/boot $(filter -I% -O%,$(XEN_CFLAGS)) -D__XEN__ # override for 32bit binaries $(obj32): CFLAGS_stack_boundary := From patchwork Fri Nov 22 09:33:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frediano Ziglio X-Patchwork-Id: 13882949 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 B19E1E65D3B for ; Fri, 22 Nov 2024 09:34:33 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.841794.1257303 (Exim 4.92) (envelope-from ) id 1tEQ3U-0003ua-Lo; Fri, 22 Nov 2024 09:34:24 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 841794.1257303; Fri, 22 Nov 2024 09:34:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tEQ3U-0003uP-IM; Fri, 22 Nov 2024 09:34:24 +0000 Received: by outflank-mailman (input) for mailman id 841794; Fri, 22 Nov 2024 09:34:23 +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 1tEQ3T-0003Ql-7W for xen-devel@lists.xenproject.org; Fri, 22 Nov 2024 09:34:23 +0000 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [2a00:1450:4864:20::334]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f2a44511-a8b4-11ef-a0cc-8be0dac302b0; Fri, 22 Nov 2024 10:34:19 +0100 (CET) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-43167ff0f91so16514805e9.1 for ; Fri, 22 Nov 2024 01:34:19 -0800 (PST) Received: from localhost.localdomain ([87.115.149.99]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-433cde16abasm21427775e9.19.2024.11.22.01.34.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:34:18 -0800 (PST) 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: f2a44511-a8b4-11ef-a0cc-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjozMzQiLCJoZWxvIjoibWFpbC13bTEteDMzNC5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6ImYyYTQ0NTExLWE4YjQtMTFlZi1hMGNjLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyMjY4MDU5LjIyMzU0OCwic2VuZGVyIjoiZnJlZGlhbm8uemlnbGlvQGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1732268058; x=1732872858; 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=2manZp1AIdPBh7iI0RBUSq4id6SrxSe85LAkzhSm0W8=; b=XOI1klEeYh4Ya34UH/Ooh2fkq+ZFq682EaW1u4SC9LeyFv6hHtjtIapeAdMMaHrLmH UJYUCFbmzdumvMFjULcEOa2oqHqQdxCrHxLOyR18SzpSqZeQnfN8YfM6MEV+IwDjTY0q B9Xoig8R97go2H9lcZihh2admbXX6JK5OInPg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732268058; x=1732872858; 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=2manZp1AIdPBh7iI0RBUSq4id6SrxSe85LAkzhSm0W8=; b=GSmIRxw5rbFxPAqMyByMVHaODaJMNeRWnwZJ49iteUfQWSTfEICDJi2NtsPDvM2QPz yrHK104kj5jveqnhJ/pTkbLH/Gqndyd7QQMbeDBwYa6pc8BMW0Xz3Zdk5T+JrA+m2dRg awlU4Aqx6pyu7A3D0chTGTZF1vMiAW/iQUBCl0qPdgWD+XBdySWzd6wQealX+QyXOuIF 1vp9fgJhILm/15W5beXfYYg7nD879Ufs3Lm51NumN/uyPlyE7n5iQBKVLHtVLg6T0mAV gsA/YZNDQo1rPjKbvSZYfa8i3HaQ+uHw/iazU9FynitLzmDdMJhKblXsha4gjZyCs29M coZw== X-Gm-Message-State: AOJu0YykPvZJEeGSGUnyxG5bjMRpJH1RgZ8NzrosuxPRN8LsSCIUK8VJ j3zg7eJOdRcx1T7jmp/jAEpHPKKJ6iLqIUbrgBxa/mmz9Jg6eIyhHxU5lw8rtIag3GBirdT+Is7 L8Ic= X-Gm-Gg: ASbGncuFkW9G9U7uBYU/2jfniDdrr7cbnIuhJ6CizjH+nsljnMhRESjUqebsmJKBDJI 6+wD88b70uKV09cwxHowATRvtKr+S3vcysA5/kiup169noYcURPf3EbTNJsAEw1nk9ivenT1KsW BCrfFB1jEpkIQ7sxwWmFbF70TadfbavS4FJ4G97bAPPj7Ivcb5KjVIlm33Gg4Wk1NfJ6ifm5ZTi G9h9WNYYlCcIt5SGw7e0IVQP8uyU/lL68MqwESmkHTcJyQnGHclBIDymco/zacxc6DpvQ== X-Google-Smtp-Source: AGHT+IFodxhFSGMz2wPZzJH0OfLJPHqvn9QSN/CUVAgp9yNsRWl2t3/+UqXtcApCXoDULXHfzVqjrg== X-Received: by 2002:a05:600c:4507:b0:42c:b5f1:44ff with SMTP id 5b1f17b1804b1-433ce48f8c5mr16629935e9.24.1732268058468; Fri, 22 Nov 2024 01:34:18 -0800 (PST) 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 v2 2/4] x86/boot: Use header to allows inclusion of public xen.h header Date: Fri, 22 Nov 2024 09:33:56 +0000 Message-Id: <20241122093358.478774-3-frediano.ziglio@cloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241122093358.478774-1-frediano.ziglio@cloud.com> References: <20241122093358.478774-1-frediano.ziglio@cloud.com> MIME-Version: 1.0 This allows to include other headers and avoid duplicated declarations. Signed-off-by: Frediano Ziglio --- xen/arch/x86/include/boot/public/xen.h | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 xen/arch/x86/include/boot/public/xen.h diff --git a/xen/arch/x86/include/boot/public/xen.h b/xen/arch/x86/include/boot/public/xen.h new file mode 100644 index 0000000000..399b86b5e5 --- /dev/null +++ b/xen/arch/x86/include/boot/public/xen.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +/* This header allows the inclusion of public xen.h */ + +#ifndef BOOT__PUBLIC__XEN_H +#define BOOT__PUBLIC__XEN_H + +#if !defined(__XEN__) || defined(__XEN_TOOLS__) || __XEN__ != 1 +#error Unexpected defines +#endif + +#include + +#ifdef __i386__ + +# define __XEN_TOOLS__ 1 +# undef __XEN__ +# include +# define __XEN__ 1 +# undef __XEN_TOOLS__ + +#else + +# include + +#endif + +#endif /* BOOT__PUBLIC__XEN_H */ From patchwork Fri Nov 22 09:33:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frediano Ziglio X-Patchwork-Id: 13882952 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 91266E65D3E for ; Fri, 22 Nov 2024 09:34:39 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.841796.1257315 (Exim 4.92) (envelope-from ) id 1tEQ3V-00042r-Ch; Fri, 22 Nov 2024 09:34:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 841796.1257315; Fri, 22 Nov 2024 09:34:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tEQ3V-00041W-5j; Fri, 22 Nov 2024 09:34:25 +0000 Received: by outflank-mailman (input) for mailman id 841796; Fri, 22 Nov 2024 09:34:23 +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 1tEQ3T-0003h5-Ts for xen-devel@lists.xenproject.org; Fri, 22 Nov 2024 09:34:23 +0000 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [2a00:1450:4864:20::32f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f33284cc-a8b4-11ef-99a3-01e77a169b0f; Fri, 22 Nov 2024 10:34:20 +0100 (CET) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-43168d9c6c9so16785675e9.3 for ; Fri, 22 Nov 2024 01:34:20 -0800 (PST) Received: from localhost.localdomain ([87.115.149.99]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-433cde16abasm21427775e9.19.2024.11.22.01.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:34:18 -0800 (PST) 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: f33284cc-a8b4-11ef-99a3-01e77a169b0f X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjozMmYiLCJoZWxvIjoibWFpbC13bTEteDMyZi5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6ImYzMzI4NGNjLWE4YjQtMTFlZi05OWEzLTAxZTc3YTE2OWIwZiIsInRzIjoxNzMyMjY4MDYwLjE0NjMyNCwic2VuZGVyIjoiZnJlZGlhbm8uemlnbGlvQGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1732268059; x=1732872859; 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=S9P+7ZFehIpPa+fzpjshgI13fOA+PXjg5ryC8YmcWr4=; b=Il5WZ2+8NYx/DNyb9RgrRxOSmxSRVqphu9Y8+GBARLKiqEJ4IIskLZkDGLP026/foB V8eySMFYsa1RwK0gQX1y+PUsNyS/fCrD61k8DNTRbCxh5VTV4+nVKulD96X5x6RdW6jJ T5oCbNxYMha0y3dm1TfMCO7ccxLbdGEj9b2U8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732268059; x=1732872859; 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=S9P+7ZFehIpPa+fzpjshgI13fOA+PXjg5ryC8YmcWr4=; b=pehJEpyecBnboSc6cUOPhzi4Y57l6RtsG+wfdVsxKVmYSh9A90t4JMCy53viBu7iJW 8dD5DQf1wVN64rEZ6vUGmYGxg/IHuESEYSOtEWZH+DcHyLc3B9z9Zkuhnaz0ZUTEueAK Wl+cCvnrlw4ypo2HH6RxGWxh1ZMN/OOlOBnsWmBTmmxAng/sS0ag4Lg7lbI0kYhnun6r rAiFXfTltANnz/EgQ2i3FM3WnGaHq3gW9Uyk0OiPv7Ns+farmkJK205Y/mwv8tbuiNE1 4tnQsQ8EQBuLtL1Zz6n4bhaxXhUhJ6kbI07SSVeLTK6ZCW7dnbHVGsfSwmR4QJ8T8U/V yJ2Q== X-Gm-Message-State: AOJu0Yyj+E7V5/teMxBMlv3pwwsY+PwwPyV/qZfXD2zS6DtzRj3d4Ruw mw6WvpvFZRgspf+whgpMcXFkOsi/kWM2q10eMLdjnpjiyc4qMsIA/mE6EfpLbYO3fEm3El2G5PI t6DE= X-Gm-Gg: ASbGnctM+rZGzqY/pJIgJtX5/2/bz67zUrLdeV12y85Ee4rrA1Cu4RNARsJNbhpJMhy 5gyNXqatps9LIHIXF9fOfySfxnbNlBhuuc12RHBCxQ3c56jaoHCeDxMKE7f+q0VLY0anYghAWDH VFllJEMQiVx8QKc6Ngj+nlS7bkDn1gDUlxHBONDzsjuIHWFiETMG3bwGeOxn+n++WZPvpoRyPLu EYG3MuXj9bX/yY4AQ2EC5PGykRvizas99NR0NaujTau8Ov30vGKyJG7pt4EYS1Xl1DjbQ== X-Google-Smtp-Source: AGHT+IHquO76tm3Afjb8UWXeMVBPqDiBL7+TVDSGOJO4rtyIk5MtI0LS7cuGChe6gYm0cm3DnxCoqw== X-Received: by 2002:a05:600c:3b94:b0:433:6cf9:5e65 with SMTP id 5b1f17b1804b1-433ce4af3bfmr15568005e9.29.1732268059305; Fri, 22 Nov 2024 01:34:19 -0800 (PST) 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 v2 3/4] x86/boot: Move some settings to C Date: Fri, 22 Nov 2024 09:33:57 +0000 Message-Id: <20241122093358.478774-4-frediano.ziglio@cloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241122093358.478774-1-frediano.ziglio@cloud.com> References: <20241122093358.478774-1-frediano.ziglio@cloud.com> MIME-Version: 1.0 Initialise multiboot_ptr and pvh_start_info_pa from C code. Signed-off-by: Frediano Ziglio --- xen/arch/x86/boot/build32.lds.S | 3 +++ xen/arch/x86/boot/head.S | 10 -------- xen/arch/x86/boot/reloc.c | 28 ++++++++++++++++++----- xen/arch/x86/include/asm/guest/pvh-boot.h | 1 + 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.lds.S index 1e59732edd..1726c17c88 100644 --- a/xen/arch/x86/boot/build32.lds.S +++ b/xen/arch/x86/boot/build32.lds.S @@ -51,6 +51,9 @@ SECTIONS DECLARE_IMPORT(__trampoline_seg_stop); DECLARE_IMPORT(trampoline_phys); DECLARE_IMPORT(boot_vid_info); + DECLARE_IMPORT(multiboot_ptr); + DECLARE_IMPORT(pvh_boot); + DECLARE_IMPORT(pvh_start_info_pa); . = . + GAP; *(.text) *(.text.*) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 1b3bd16fe5..510b3cfe6c 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -517,16 +517,6 @@ trampoline_setup: /* reloc(magic/eax, info/edx) using fastcall. */ call reloc -#ifdef CONFIG_PVH_GUEST - cmpb $0, sym_esi(pvh_boot) - je 1f - mov %eax, sym_esi(pvh_start_info_pa) - jmp 2f -#endif -1: - mov %eax, sym_esi(multiboot_ptr) -2: - /* Interrogate CPU extended features via CPUID. */ mov $1, %eax cpuid diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index 7a375ad41c..8f757813ee 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -17,13 +17,15 @@ #include #include -#include #include #include +#include #include +#include #include +#include #ifdef CONFIG_VIDEO # include "video.h" @@ -347,27 +349,41 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, memctx *ctx) } /* SAF-1-safe */ -void *reloc(uint32_t magic, uint32_t in) +void reloc(uint32_t magic, uint32_t in) { memctx ctx = { trampoline_phys + TRAMPOLINE_HEAP_END }; + void *res; + switch ( magic ) { case MULTIBOOT_BOOTLOADER_MAGIC: - return mbi_reloc(in, &ctx); + res = mbi_reloc(in, &ctx); + break; case MULTIBOOT2_BOOTLOADER_MAGIC: - return mbi2_reloc(in, &ctx); + res = mbi2_reloc(in, &ctx); + break; case XEN_HVM_START_MAGIC_VALUE: if ( IS_ENABLED(CONFIG_PVH_GUEST) ) - return pvh_info_reloc(in, &ctx); + { + res = pvh_info_reloc(in, &ctx); + break; + } /* Fallthrough */ default: /* Nothing we can do */ - return NULL; + res = NULL; } + +#ifdef CONFIG_PVH_GUEST + if ( pvh_boot ) + pvh_start_info_pa = (unsigned long)res; +#endif + + multiboot_ptr = (unsigned long)res; } /* diff --git a/xen/arch/x86/include/asm/guest/pvh-boot.h b/xen/arch/x86/include/asm/guest/pvh-boot.h index 247ba6899e..b5ad2b11a4 100644 --- a/xen/arch/x86/include/asm/guest/pvh-boot.h +++ b/xen/arch/x86/include/asm/guest/pvh-boot.h @@ -13,6 +13,7 @@ #ifdef CONFIG_PVH_GUEST extern bool pvh_boot; +extern uint32_t pvh_start_info_pa; void pvh_init(multiboot_info_t **mbi, module_t **mod); void pvh_print_info(void); From patchwork Fri Nov 22 09:33:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frediano Ziglio X-Patchwork-Id: 13882950 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 BCE95E65D3D for ; Fri, 22 Nov 2024 09:34:37 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.841795.1257307 (Exim 4.92) (envelope-from ) id 1tEQ3U-0003xI-VI; Fri, 22 Nov 2024 09:34:24 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 841795.1257307; Fri, 22 Nov 2024 09:34:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tEQ3U-0003wD-QK; Fri, 22 Nov 2024 09:34:24 +0000 Received: by outflank-mailman (input) for mailman id 841795; Fri, 22 Nov 2024 09:34:23 +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 1tEQ3T-0003Ql-G6 for xen-devel@lists.xenproject.org; Fri, 22 Nov 2024 09:34:23 +0000 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [2a00:1450:4864:20::234]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f3c6f407-a8b4-11ef-a0cc-8be0dac302b0; Fri, 22 Nov 2024 10:34:21 +0100 (CET) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2fb561f273eso21419161fa.2 for ; Fri, 22 Nov 2024 01:34:20 -0800 (PST) Received: from localhost.localdomain ([87.115.149.99]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-433cde16abasm21427775e9.19.2024.11.22.01.34.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:34:19 -0800 (PST) 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: f3c6f407-a8b4-11ef-a0cc-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjoyMzQiLCJoZWxvIjoibWFpbC1sajEteDIzNC5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6ImYzYzZmNDA3LWE4YjQtMTFlZi1hMGNjLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyMjY4MDYxLjAwMDg4LCJzZW5kZXIiOiJmcmVkaWFuby56aWdsaW9AY2xvdWQuY29tIiwicmVjaXBpZW50IjoieGVuLWRldmVsQGxpc3RzLnhlbnByb2plY3Qub3JnIn0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1732268060; x=1732872860; 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=clkfofX0J3fQFkdU29C0Xri5NVrLAF8Z8Fjb/kEwIZk=; b=Dma3tjPv0YP5AJqWv9hKS05qHGVQX8qvHcb5++A2jGyjwzMAp3idfL+5RhbC509tWz WdG9azBSQ16n9T11xzeAIXN+TDuNAtCa8WU0gcov1XubghOCzaGLFoq/BYhYpoCTd+H9 zxyEzus2TauhpDZOswWjHO7USGxhdznGTMfH8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732268060; x=1732872860; 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=clkfofX0J3fQFkdU29C0Xri5NVrLAF8Z8Fjb/kEwIZk=; b=BpLBfBKlZbYOhl7gEJy9LbVvqhp3nuYG+nQkHoci5G2+uVEbxf3d8SxwNoc3IK2AFX UZKMMdQmSnICGGUqYclhA/q0kqY6wUOenW/3JzH/2/i6OqfUQwzep91j5dryj0tawWva 5vB2Xj8bYDV9rGpD2TlfrvWRSaAcrAQitqf+KrvFy6c557vViRzRsCVUN7UduMNFDU6O 7L3yOFdDe/mPhIAAFtfGzEZFhehchWXKRYibLw1L3kT0Kkkkb1wqJgsuNk7Nz2QZXv1W zOGykndht6eurVTML4VHefvsWxivLs6Bzj/g5ASsWY32m6hT1xvgTyZB/maGF5SDcolq K4fg== X-Gm-Message-State: AOJu0YxEQEkOvYFS7SoMEL3TCYVm0d07Dy+kL92+mdPqgD6jZ4ixRCrJ soJqHLgnP94AwYd/5jc58pSB65haCfmHY25z19t/hMoVyC+gvzu3bec8AhKoWTCyBzDUawjVEFo Hft4= X-Gm-Gg: ASbGncvrOhmOApumJcQXz5OxRsZ3ZQMlRN9Y275rpOWRdp+U7dTi3UPi6GhpyrP3uWZ fZ7NhRLLhG6y6qvkHwBzdxvKp/0uyvt7TFpz0U89NOorjaTOtRxA+rvCbedqugnk95L27mT5Bfg qQQ8dbdYE64wD1v6AWMPIbe/Wwi5iOZep534lV9PLij3trVHA5rlvgGN3Qutn7qlNbLlO/tFQ5U y3ia7VZzGjVOtS9zCpULxfOLryBmqSz9apW3kzPl3HyEPijZQ+Jnq5FebM5RtpWTO309A== X-Google-Smtp-Source: AGHT+IFWNhUfxz6SzEBDhFQYxqPUTQB9b5y15PAsd+iSkDTyNeK7GmIgCcorcvcRJz/Jv7TNTiPKqg== X-Received: by 2002:a2e:7a0e:0:b0:2ff:a928:a23e with SMTP id 38308e7fff4ca-2ffa928a3ebmr5385491fa.25.1732268060088; Fri, 22 Nov 2024 01:34:20 -0800 (PST) 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 v2 4/4] x86/boot: Use external symbols from cmdline_parse_early Date: Fri, 22 Nov 2024 09:33:58 +0000 Message-Id: <20241122093358.478774-5-frediano.ziglio@cloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241122093358.478774-1-frediano.ziglio@cloud.com> References: <20241122093358.478774-1-frediano.ziglio@cloud.com> MIME-Version: 1.0 Move some assembly code to C. Signed-off-by: Frediano Ziglio --- xen/arch/x86/boot/build32.lds.S | 1 + xen/arch/x86/boot/cmdline.c | 14 ++++++++++++-- xen/arch/x86/boot/head.S | 9 +-------- xen/arch/x86/boot/trampoline.S | 2 +- xen/arch/x86/include/asm/setup.h | 2 ++ xen/arch/x86/include/boot/xen/cpumask.h | 1 + xen/arch/x86/include/boot/xen/string.h | 10 ++++++++++ 7 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 xen/arch/x86/include/boot/xen/cpumask.h create mode 100644 xen/arch/x86/include/boot/xen/string.h diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.lds.S index 1726c17c88..652f951e52 100644 --- a/xen/arch/x86/boot/build32.lds.S +++ b/xen/arch/x86/boot/build32.lds.S @@ -54,6 +54,7 @@ SECTIONS DECLARE_IMPORT(multiboot_ptr); DECLARE_IMPORT(pvh_boot); DECLARE_IMPORT(pvh_start_info_pa); + DECLARE_IMPORT(early_boot_opts); . = . + GAP; *(.text) *(.text.*) diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c index 196c580e91..7a8a3ed97f 100644 --- a/xen/arch/x86/boot/cmdline.c +++ b/xen/arch/x86/boot/cmdline.c @@ -22,6 +22,9 @@ #include #include #include +#include + +#include #include "video.h" @@ -39,6 +42,8 @@ typedef struct __packed { #endif } early_boot_opts_t; +extern early_boot_opts_t early_boot_opts; + /* Avoid pulling in all of ctypes.h for this. */ #define tolower(c) ((c) | 0x20) @@ -335,10 +340,15 @@ static void vga_parse(const char *cmdline, early_boot_opts_t *ebo) #endif /* SAF-1-safe */ -void cmdline_parse_early(const char *cmdline, early_boot_opts_t *ebo) +void cmdline_parse_early(void) { - if ( !cmdline ) + early_boot_opts_t *ebo = &early_boot_opts; + struct multiboot_info *mbi = (void *)multiboot_ptr; + const char *cmdline; + + if ( !(mbi->flags & MBI_CMDLINE) || !mbi->cmdline ) return; + cmdline = (void *)mbi->cmdline; ebo->skip_realmode = skip_realmode(cmdline); ebo->opt_edd = edd_parse(cmdline); diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 510b3cfe6c..49bacee225 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -675,14 +675,7 @@ trampoline_setup: cmpb $0, sym_esi(efi_platform) jnz 1f - /* Bail if there is no command line to parse. */ - mov sym_esi(multiboot_ptr), %ebx - testl $MBI_CMDLINE,MB_flags(%ebx) - jz 1f - - lea sym_esi(early_boot_opts), %edx - mov MB_cmdline(%ebx), %eax - /* cmdline_parse_early(cmdline/eax, opts/edx) using fastcall. */ + /* cmdline_parse_early using fastcall. */ call cmdline_parse_early 1: diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S index 924bda37c1..204c9bc889 100644 --- a/xen/arch/x86/boot/trampoline.S +++ b/xen/arch/x86/boot/trampoline.S @@ -255,7 +255,7 @@ trampoline_boot_cpu_entry: .align 2 /* Keep in sync with cmdline.c:early_boot_opts_t type! */ -early_boot_opts: +GLOBAL(early_boot_opts) skip_realmode: .byte 0 opt_edd: diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h index 5c2391a868..c461d5d3a7 100644 --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -16,6 +16,8 @@ extern uint64_t boot_tsc_stamp; extern void *stack_start; extern unsigned int multiboot_ptr; +struct domain; + void early_cpu_init(bool verbose); void early_time_init(void); diff --git a/xen/arch/x86/include/boot/xen/cpumask.h b/xen/arch/x86/include/boot/xen/cpumask.h new file mode 100644 index 0000000000..046b862b78 --- /dev/null +++ b/xen/arch/x86/include/boot/xen/cpumask.h @@ -0,0 +1 @@ +/* Empty. */ diff --git a/xen/arch/x86/include/boot/xen/string.h b/xen/arch/x86/include/boot/xen/string.h new file mode 100644 index 0000000000..6556d3b4af --- /dev/null +++ b/xen/arch/x86/include/boot/xen/string.h @@ -0,0 +1,10 @@ +#ifndef BOOT__XEN__STRING_H +#define BOOT__XEN__STRING_H + +#include /* for size_t */ + +void *memset(void *s, int c, size_t n); +void *memcpy(void *dest, const void *src, size_t n); +void *memmove(void *dest, const void *src, size_t n); + +#endif /* BOOT__XEN__STRING_H */