From patchwork Mon Jan 15 14:34:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13519708 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 D4ABFC4707B for ; Mon, 15 Jan 2024 14:34:27 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.667405.1038620 (Exim 4.92) (envelope-from ) id 1rPO2W-0007LL-1J; Mon, 15 Jan 2024 14:34:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 667405.1038620; Mon, 15 Jan 2024 14:34:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rPO2V-0007LE-Ta; Mon, 15 Jan 2024 14:34:11 +0000 Received: by outflank-mailman (input) for mailman id 667405; Mon, 15 Jan 2024 14:34:10 +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 1rPO2U-0007L8-Jg for xen-devel@lists.xenproject.org; Mon, 15 Jan 2024 14:34:10 +0000 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [2a00:1450:4864:20::435]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 244fb6bd-b3b3-11ee-9b0f-b553b5be7939; Mon, 15 Jan 2024 15:34:08 +0100 (CET) Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-336990fb8fbso6981551f8f.1 for ; Mon, 15 Jan 2024 06:34:08 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id j27-20020adfb31b000000b00336e32338f3sm12166221wrd.70.2024.01.15.06.34.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jan 2024 06:34:06 -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: 244fb6bd-b3b3-11ee-9b0f-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1705329248; x=1705934048; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=DhGYC5xunoV+JtWHCdjOaB9LbyhgNpSYq/w1/ajKmNQ=; b=gYOwCgSVWGQxiWxu068OA3ETFHZSPuSndxT5wxwx07sCC3alnGPjtQOvwkshFy2VXT 3BtthMrcI8Pdvqka8V7hDDBqYO0VlbfJqtNkBwt5Iy3uBcnhhMh5cGwLZGo5qevbDOMA wMVFeRvUj1jG5LIaH2io96+JcbGvEvzI2VzFTTOQwi8mu3ePiNDcGjNdBsNv3wEsdOcM lRMnsjFIxKcPCqWcfwSxELAoqeKKvGG45LZxjSsdRDU4JiwOXssYOd7eMcMHqEbgrtSX g94sVL8EKITc7TiIxoxUYitlkFHWwe7b06WeHnuY9VzBtKHEhx0KAXv5UOJ4tCKxpmtr Uu4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705329248; x=1705934048; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DhGYC5xunoV+JtWHCdjOaB9LbyhgNpSYq/w1/ajKmNQ=; b=B5zHUScJAxe9mJiqvM/0Qu0qx1hH8gygvgPrQjOxheVbZJT+OX1dFHfQjxoJrvZYbx xYLwDigoiEmIaniG2mrsJVsJWE149wy2KytM01BbObTAuisny/txBcF6VHiBlCrq0dED hgTSIjBD/Zp+zI4L3FUZJDLQ5O5OWK1ac/VbYEAmEDafcLopZe4f3upFyUNkbqP8SIrM xXn3ETKjKvTuJdXIukE+M2iQaD2rmqlnX7MW75lobN9csJvcx4B6kwKDdFP/d6mmtk8y lzBzY7j7ZcOusiUuGFC/F+hSM4Y0P7Vog3yrJRtCh1RrFFjbxrD/vfofIQHBPPfWolZw HCSA== X-Gm-Message-State: AOJu0YwNj4MsnBpeDBXEddnlGOwrTMGuJeS550ZNARTuQealgDmyTLSD i7vSUDNIxAF6oHe0Th4K52u+vQWp8aZTMGdwk0u44T6rjw== X-Google-Smtp-Source: AGHT+IEbL4YAIAz4BJr2LEx28p98YovKKsD5FVF4ZkpcxIETid1bcqstUeK/zBjnrNRHsIaBFDSFkg== X-Received: by 2002:a05:6000:91:b0:337:4202:6166 with SMTP id m17-20020a056000009100b0033742026166mr3560027wrx.80.1705329246587; Mon, 15 Jan 2024 06:34:06 -0800 (PST) Message-ID: <38de36da-0822-4452-9594-8d50a5a77335@suse.com> Date: Mon, 15 Jan 2024 15:34:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v5 1/8] common: assembly entry point type/size annotations From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Julien Grall , Stefano Stabellini , George Dunlap References: <7a133ed9-9d13-4e2c-893a-00c083c8a35d@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8Vq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OH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7a133ed9-9d13-4e2c-893a-00c083c8a35d@suse.com> Recent gas versions generate minimalistic Dwarf debug info for items annotated as functions and having their sizes specified [1]. Furthermore generating live patches wants items properly annotated. "Borrow" Arm's END() and (remotely) derive other annotation infrastructure from Linux'es, for all architectures to use. Signed-off-by: Jan Beulich [1] https://sourceware.org/git?p=binutils-gdb.git;a=commitdiff;h=591cc9fbbfd6d51131c0f1d4a92e7893edcc7a28 Reviewed-by: Roger Pau Monné --- v5: Drop CODE_ALIGN fallback. s/algn/align/g. v3: New, generalized from earlier x86-only version. LAST() (now LASTARG()) moved to macros.h. --- TBD: {CODE,DATA}_ALIGN are byte granular, such that a value of 0 can be specified (in case this has some special meaning on an arch; conceivably it could mean to use some kind of arch default). We may not strictly need that, and hence we could also make these power- of-2 values (using .p2align). Note that we can't use ALIGN() (in place of SYM_ALIGN()) as long as we still have ALIGN. Note further that FUNC()'s etc "align" parameter is intended to allow for only no or a single argument. If we wanted to also make the fill value customizable per call site, the constructs would need re-doing to some degree. --- /dev/null +++ b/xen/include/xen/linkage.h @@ -0,0 +1,54 @@ +#ifndef __LINKAGE_H__ +#define __LINKAGE_H__ + +#ifdef __ASSEMBLY__ + +#include + +/* CODE_ALIGN needs to be specified by every architecture. */ +#ifndef CODE_FILL +# define CODE_FILL ~0 +#endif + +#ifndef DATA_ALIGN +# define DATA_ALIGN 0 +#endif +#ifndef DATA_FILL +# define DATA_FILL ~0 +#endif + +#define SYM_ALIGN(align...) .balign align + +#define SYM_L_GLOBAL(name) .globl name +#define SYM_L_WEAK(name) .weak name +#define SYM_L_LOCAL(name) /* nothing */ + +#define SYM_T_FUNC STT_FUNC +#define SYM_T_DATA STT_OBJECT +#define SYM_T_NONE STT_NOTYPE + +#define SYM(name, typ, linkage, align...) \ + .type name, SYM_T_ ## typ; \ + SYM_L_ ## linkage(name); \ + SYM_ALIGN(align); \ + name: + +#define END(name) .size name, . - name + +#define FUNC(name, align...) \ + SYM(name, FUNC, GLOBAL, LASTARG(CODE_ALIGN, ## align), CODE_FILL) +#define LABEL(name, align...) \ + SYM(name, NONE, GLOBAL, LASTARG(CODE_ALIGN, ## align), CODE_FILL) +#define DATA(name, align...) \ + SYM(name, DATA, GLOBAL, LASTARG(DATA_ALIGN, ## align), DATA_FILL) + +#define FUNC_LOCAL(name, align...) \ + SYM(name, FUNC, LOCAL, LASTARG(CODE_ALIGN, ## align), CODE_FILL) +#define LABEL_LOCAL(name, align...) \ + SYM(name, NONE, LOCAL, LASTARG(CODE_ALIGN, ## align), CODE_FILL) +#define DATA_LOCAL(name, align...) \ + SYM(name, DATA, LOCAL, LASTARG(DATA_ALIGN, ## align), DATA_FILL) + +#endif /* __ASSEMBLY__ */ + +#endif /* __LINKAGE_H__ */ --- a/xen/include/xen/macros.h +++ b/xen/include/xen/macros.h @@ -21,6 +21,15 @@ #define count_args(args...) \ count_args_(., ## args, 8, 7, 6, 5, 4, 3, 2, 1, 0) +#define ARG1_(x, y...) (x) +#define ARG2_(x, y...) ARG1_(y) +#define ARG3_(x, y...) ARG2_(y) +#define ARG4_(x, y...) ARG3_(y) + +#define ARG__(nr) ARG ## nr ## _ +#define ARG_(nr) ARG__(nr) +#define LASTARG(x, y...) ARG_(count_args(x, ## y))(x, ## y) + /* Indirect macros required for expanded argument pasting. */ #define PASTE_(a, b) a ## b #define PASTE(a, b) PASTE_(a, b) From patchwork Mon Jan 15 14:34:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13519709 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 C764BC3DA79 for ; Mon, 15 Jan 2024 14:35:08 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.667409.1038629 (Exim 4.92) (envelope-from ) id 1rPO3I-0007t4-BU; Mon, 15 Jan 2024 14:35:00 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 667409.1038629; Mon, 15 Jan 2024 14:35:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rPO3I-0007sx-8m; Mon, 15 Jan 2024 14:35:00 +0000 Received: by outflank-mailman (input) for mailman id 667409; Mon, 15 Jan 2024 14:34:58 +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 1rPO3G-0007gY-LG for xen-devel@lists.xenproject.org; Mon, 15 Jan 2024 14:34:58 +0000 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [2a00:1450:4864:20::330]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 418a30d1-b3b3-11ee-98f1-6d05b1d4d9a1; Mon, 15 Jan 2024 15:34:57 +0100 (CET) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40e7fb927a3so4172055e9.3 for ; Mon, 15 Jan 2024 06:34:57 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id j27-20020adfb31b000000b00336e32338f3sm12166221wrd.70.2024.01.15.06.34.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jan 2024 06:34:56 -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: 418a30d1-b3b3-11ee-98f1-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1705329297; x=1705934097; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=kdcFdpBiOv5Ief4bXCoTgvxcM2tE3ReF1qPR03/fxTY=; b=ZHWVWgLb+RTLiEt6Yap+F3IHerhJO8mTsyV6kHKv86UZrLDZ7ljktWDgk6P6Evxm24 LlhFVSbgJ8oDsseWNQFcY912a5mLVSyhxt/eUsjcDiC9rQneASJLLsl0Vg0HC9L9OjMd CJ5b7rpmQQnQoUZQOQm4hkGEkFL4F3wV5/WHAkff47o6bH3M296qKkLF547Q5383UZfM KRu6Qy7WnwfWTVlD6izFfhiFwMht3IdWPi6BzmK668SWEw1r9TGKDmM3OWba7C2P1+mp AKvij5EczG7aiWhYYXnbxbToRoksXXG/8XV7v2kIJMzw5q0pVd8037+nSr5af7d7zvKN 9Gxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705329297; x=1705934097; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kdcFdpBiOv5Ief4bXCoTgvxcM2tE3ReF1qPR03/fxTY=; b=TeMQQDE9K+ftjLGqvrMfygTJMS9r//iHPqWilq0+/x+cx772EiiJc3uUJXlYGcIIeE sQSbQ2HI3ew/HYOUju0J3KpH/z2Nihef4N/y9PiHeqH9Pw5vanfUcE85TSxQzNcufDOr +wObGwmlmOiqlr3NxxepSpixz0Y1VThZLqgrJlcbNshxnErYdkYws/A02sQjofXZm2J0 f36VnpGa4drllbnlNfrEANVYZfCQdidtm9N5oP9IAn3+dGhD0A41kFl8i6dOssEHvAQ1 7CfgclKxIDgrlRUSsjteiqxSdBTsuj7TJ5NfSFxL6HB17ye4U91e81kzQ2D0IbIa81lO 3XDg== X-Gm-Message-State: AOJu0YxIxP4hMzEjuBJj8AYxdtY3bYU1YbclTprgv9MtpWnRWOjQKv4v TXwLlNWjcdZX3q+NCclO4Ltr2MiDbjjSAYSqJodHPitYvw== X-Google-Smtp-Source: AGHT+IG6HDtHXNVAxNe3LNwf/lfwnlq/riqmAt11HlHUKGz4GjGi63Byw/qUV1MnEYYwxA9N3RMc/w== X-Received: by 2002:a05:600c:1d26:b0:40e:61f1:ba3 with SMTP id l38-20020a05600c1d2600b0040e61f10ba3mr2820851wms.36.1705329296994; Mon, 15 Jan 2024 06:34:56 -0800 (PST) Message-ID: <9096ad1a-5d86-4dd1-a7c3-6ad2f7e5a623@suse.com> Date: Mon, 15 Jan 2024 15:34:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v5 2/8] x86: annotate entry points with type and size Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , George Dunlap References: <7a133ed9-9d13-4e2c-893a-00c083c8a35d@suse.com> Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurf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fwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7a133ed9-9d13-4e2c-893a-00c083c8a35d@suse.com> Use the generic framework in xen/linkage.h. For switch_to_kernel() and restore_all_guest() so far implicit alignment (from being first in their respective sections) is being made explicit (as in: using FUNC() without 2nd argument). Whereas for {,compat}create_bounce_frame() and autogen_entrypoints[] alignment is newly arranged for. Except for the added/adjusted alignment padding (including their knock-on effects) no change in generated code/data. Note that the basis for support of weak definitions is added despite them not having any use right now. Note that ASM_INT() is switched to DATA(), not DATA_LOCAL(), as the only use site wants the symbol global anyway. Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monné --- v5: Re-base. v4: Correct simd_coprocessor_error's (now entry_XM) END(). Re-base. v3: !PV variant of ret_from_intr is local. Introduction of macros split off to separate patch. Also adjust ASM_INT(). Re-base. v2: Full rework. --- Only two of the assembly files are being converted for now. More could be done right here or as follow-on in separate patches. Note that the FB-label in autogen_stubs() cannot be converted just yet: Such labels cannot be used with .type. We could further diverge from Linux'es model and avoid setting STT_NOTYPE explicitly (that's the type labels get by default anyway). The ASM_INT() redundancy of .global will be eliminated by a subsequent patch. I didn't think that I should make CODE_FILL evaluate to 0xCC right here; IMO that wants to be a separate patch. --- a/xen/arch/x86/include/asm/asm_defns.h +++ b/xen/arch/x86/include/asm/asm_defns.h @@ -13,6 +13,7 @@ #include #ifdef __ASSEMBLY__ +#include #include #ifndef CONFIG_INDIRECT_THUNK .equ CONFIG_INDIRECT_THUNK, 0 @@ -343,10 +344,7 @@ static always_inline void stac(void) .popsection #define ASM_INT(label, val) \ - .p2align 2; \ -label: .long (val); \ - .size label, . - label; \ - .type label, @object + DATA(label, 4) .long (val); END(label) #define ASM_CONSTANT(name, value) \ asm ( ".equ " #name ", %P0; .global " #name \ --- a/xen/arch/x86/include/asm/config.h +++ b/xen/arch/x86/include/asm/config.h @@ -43,7 +43,9 @@ /* Linkage for x86 */ #ifdef __ASSEMBLY__ -#define ALIGN .align 16,0x90 +#define CODE_ALIGN 16 +#define CODE_FILL 0x90 +#define ALIGN .align CODE_ALIGN, CODE_FILL #define ENTRY(name) \ .globl name; \ ALIGN; \ --- a/xen/arch/x86/x86_64/compat/entry.S +++ b/xen/arch/x86/x86_64/compat/entry.S @@ -11,7 +11,7 @@ #include #include -ENTRY(entry_int82) +FUNC(entry_int82) ENDBR64 ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP pushq $0 @@ -29,9 +29,10 @@ ENTRY(entry_int82) mov %rsp, %rdi call do_entry_int82 +END(entry_int82) /* %rbx: struct vcpu */ -ENTRY(compat_test_all_events) +FUNC(compat_test_all_events) ASSERT_NOT_IN_ATOMIC cli # tests must not race interrupts /*compat_test_softirqs:*/ @@ -68,24 +69,21 @@ compat_test_guest_events: call compat_create_bounce_frame jmp compat_test_all_events - ALIGN /* %rbx: struct vcpu */ -compat_process_softirqs: +LABEL_LOCAL(compat_process_softirqs) sti call do_softirq jmp compat_test_all_events - ALIGN /* %rbx: struct vcpu, %rdx: struct trap_bounce */ -.Lcompat_process_trapbounce: +LABEL_LOCAL(.Lcompat_process_trapbounce) sti .Lcompat_bounce_exception: call compat_create_bounce_frame jmp compat_test_all_events - ALIGN /* %rbx: struct vcpu */ -compat_process_mce: +LABEL_LOCAL(compat_process_mce) testb $1 << VCPU_TRAP_MCE,VCPU_async_exception_mask(%rbx) jnz .Lcompat_test_guest_nmi sti @@ -99,9 +97,8 @@ compat_process_mce: movb %dl,VCPU_async_exception_mask(%rbx) jmp compat_process_trap - ALIGN /* %rbx: struct vcpu */ -compat_process_nmi: +LABEL_LOCAL(compat_process_nmi) testb $1 << VCPU_TRAP_NMI,VCPU_async_exception_mask(%rbx) jnz compat_test_guest_events sti @@ -118,9 +115,10 @@ compat_process_trap: leaq VCPU_trap_bounce(%rbx),%rdx call compat_create_bounce_frame jmp compat_test_all_events +END(compat_test_all_events) /* %rbx: struct vcpu, interrupts disabled */ -ENTRY(compat_restore_all_guest) +FUNC(compat_restore_all_guest) ASSERT_INTERRUPTS_DISABLED mov $~(X86_EFLAGS_IOPL | X86_EFLAGS_VM), %r11d and UREGS_eflags(%rsp),%r11d @@ -163,9 +161,10 @@ ENTRY(compat_restore_all_guest) RESTORE_ALL adj=8 compat=1 .Lft0: iretq _ASM_PRE_EXTABLE(.Lft0, handle_exception) +END(compat_restore_all_guest) /* This mustn't modify registers other than %rax. */ -ENTRY(cr4_pv32_restore) +FUNC(cr4_pv32_restore) push %rdx GET_CPUINFO_FIELD(cr4, dx) mov (%rdx), %rax @@ -195,8 +194,9 @@ ENTRY(cr4_pv32_restore) pop %rdx xor %eax, %eax ret +END(cr4_pv32_restore) -ENTRY(compat_syscall) +FUNC(compat_syscall) /* Fix up reported %cs/%ss for compat domains. */ movl $FLAT_COMPAT_USER_SS, UREGS_ss(%rsp) movl $FLAT_COMPAT_USER_CS, UREGS_cs(%rsp) @@ -224,8 +224,9 @@ UNLIKELY_END(compat_syscall_gpf) movw %si,TRAPBOUNCE_cs(%rdx) movb %cl,TRAPBOUNCE_flags(%rdx) jmp .Lcompat_bounce_exception +END(compat_syscall) -ENTRY(compat_sysenter) +FUNC(compat_sysenter) CR4_PV32_RESTORE movq VCPU_trap_ctxt(%rbx),%rcx cmpb $X86_EXC_GP, UREGS_entry_vector(%rsp) @@ -238,17 +239,19 @@ ENTRY(compat_sysenter) movw %ax,TRAPBOUNCE_cs(%rdx) call compat_create_bounce_frame jmp compat_test_all_events +END(compat_sysenter) -ENTRY(compat_int80_direct_trap) +FUNC(compat_int80_direct_trap) CR4_PV32_RESTORE call compat_create_bounce_frame jmp compat_test_all_events +END(compat_int80_direct_trap) /* CREATE A BASIC EXCEPTION FRAME ON GUEST OS (RING-1) STACK: */ /* {[ERRCODE,] EIP, CS, EFLAGS, [ESP, SS]} */ /* %rdx: trap_bounce, %rbx: struct vcpu */ /* On return only %rbx and %rdx are guaranteed non-clobbered. */ -compat_create_bounce_frame: +FUNC_LOCAL(compat_create_bounce_frame) ASSERT_INTERRUPTS_ENABLED mov %fs,%edi ALTERNATIVE "", stac, X86_FEATURE_XEN_SMAP @@ -354,3 +357,4 @@ compat_crash_page_fault: jmp .Lft14 .previous _ASM_EXTABLE(.Lft14, .Lfx14) +END(compat_create_bounce_frame) --- a/xen/arch/x86/x86_64/entry.S +++ b/xen/arch/x86/x86_64/entry.S @@ -24,7 +24,7 @@ #ifdef CONFIG_PV /* %rbx: struct vcpu */ -switch_to_kernel: +FUNC_LOCAL(switch_to_kernel) leaq VCPU_trap_bounce(%rbx),%rdx /* TB_eip = 32-bit syscall ? syscall32_addr : syscall_addr */ @@ -89,24 +89,21 @@ test_guest_events: call create_bounce_frame jmp test_all_events - ALIGN /* %rbx: struct vcpu */ -process_softirqs: +LABEL_LOCAL(process_softirqs) sti call do_softirq jmp test_all_events - ALIGN /* %rbx: struct vcpu, %rdx struct trap_bounce */ -.Lprocess_trapbounce: +LABEL_LOCAL(.Lprocess_trapbounce) sti .Lbounce_exception: call create_bounce_frame jmp test_all_events - ALIGN /* %rbx: struct vcpu */ -process_mce: +LABEL_LOCAL(process_mce) testb $1 << VCPU_TRAP_MCE, VCPU_async_exception_mask(%rbx) jnz .Ltest_guest_nmi sti @@ -120,9 +117,8 @@ process_mce: movb %dl, VCPU_async_exception_mask(%rbx) jmp process_trap - ALIGN /* %rbx: struct vcpu */ -process_nmi: +LABEL_LOCAL(process_nmi) testb $1 << VCPU_TRAP_NMI, VCPU_async_exception_mask(%rbx) jnz test_guest_events sti @@ -139,11 +135,12 @@ process_trap: leaq VCPU_trap_bounce(%rbx), %rdx call create_bounce_frame jmp test_all_events +END(switch_to_kernel) .section .text.entry, "ax", @progbits /* %rbx: struct vcpu, interrupts disabled */ -restore_all_guest: +FUNC_LOCAL(restore_all_guest) ASSERT_INTERRUPTS_DISABLED /* Stash guest SPEC_CTRL value while we can read struct vcpu. */ @@ -220,8 +217,7 @@ restore_all_guest: sysretq 1: sysretl - ALIGN -.Lrestore_rcx_iret_exit_to_guest: +LABEL_LOCAL(.Lrestore_rcx_iret_exit_to_guest) movq 8(%rsp), %rcx # RIP /* No special register assumptions. */ iret_exit_to_guest: @@ -230,6 +226,7 @@ iret_exit_to_guest: addq $8,%rsp .Lft0: iretq _ASM_PRE_EXTABLE(.Lft0, handle_exception) +END(restore_all_guest) /* * When entering SYSCALL from kernel mode: @@ -246,7 +243,7 @@ iret_exit_to_guest: * - Guest %rsp stored in %rax * - Xen stack loaded, pointing at the %ss slot */ -ENTRY(lstar_enter) +FUNC(lstar_enter) #ifdef CONFIG_XEN_SHSTK ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK #endif @@ -281,9 +278,10 @@ ENTRY(lstar_enter) mov %rsp, %rdi call pv_hypercall jmp test_all_events +END(lstar_enter) /* See lstar_enter for entry register state. */ -ENTRY(cstar_enter) +FUNC(cstar_enter) #ifdef CONFIG_XEN_SHSTK ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK #endif @@ -321,8 +319,9 @@ ENTRY(cstar_enter) jne compat_syscall #endif jmp switch_to_kernel +END(cstar_enter) -ENTRY(sysenter_entry) +FUNC(sysenter_entry) ENDBR64 #ifdef CONFIG_XEN_SHSTK ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK @@ -330,7 +329,7 @@ ENTRY(sysenter_entry) pushq $FLAT_USER_SS pushq $0 pushfq -GLOBAL(sysenter_eflags_saved) +LABEL(sysenter_eflags_saved, 0) ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP pushq $3 /* ring 3 null cs */ pushq $0 /* null rip */ @@ -384,8 +383,9 @@ UNLIKELY_END(sysenter_gpf) jne compat_sysenter #endif jmp .Lbounce_exception +END(sysenter_entry) -ENTRY(entry_int80) +FUNC(entry_int80) ENDBR64 ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP pushq $0 @@ -473,6 +473,7 @@ int80_slow_path: */ GET_STACK_END(14) jmp handle_exception_saved +END(entry_int80) /* create_bounce_frame & helpers don't need to be in .text.entry */ .text @@ -481,7 +482,7 @@ int80_slow_path: /* { RCX, R11, [ERRCODE,] RIP, CS, RFLAGS, RSP, SS } */ /* %rdx: trap_bounce, %rbx: struct vcpu */ /* On return only %rbx and %rdx are guaranteed non-clobbered. */ -create_bounce_frame: +FUNC_LOCAL(create_bounce_frame) ASSERT_INTERRUPTS_ENABLED testb $TF_kernel_mode,VCPU_thread_flags(%rbx) jnz 1f @@ -617,6 +618,7 @@ ENTRY(dom_crash_sync_extable) xorl %edi,%edi jmp asm_domain_crash_synchronous /* Does not return */ .popsection +END(create_bounce_frame) #endif /* CONFIG_PV */ /* --- CODE BELOW THIS LINE (MOSTLY) NOT GUEST RELATED --- */ @@ -625,7 +627,7 @@ ENTRY(dom_crash_sync_extable) /* No special register assumptions. */ #ifdef CONFIG_PV -ENTRY(continue_pv_domain) +FUNC(continue_pv_domain) ENDBR64 call check_wakeup_from_wait ret_from_intr: @@ -640,26 +642,28 @@ ret_from_intr: #else jmp test_all_events #endif +END(continue_pv_domain) #else -ret_from_intr: +FUNC_LOCAL(ret_from_intr, 0) ASSERT_CONTEXT_IS_XEN jmp restore_all_xen +END(ret_from_intr) #endif .section .init.text, "ax", @progbits -ENTRY(early_page_fault) +FUNC(early_page_fault) ENDBR64 movl $X86_EXC_PF, 4(%rsp) SAVE_ALL movq %rsp, %rdi call do_early_page_fault jmp restore_all_xen +END(early_page_fault) .section .text.entry, "ax", @progbits - ALIGN /* %r12=ist_exit */ -restore_all_xen: +FUNC_LOCAL(restore_all_xen) #ifdef CONFIG_DEBUG mov %rsp, %rdi @@ -683,8 +687,9 @@ UNLIKELY_END(exit_cr3) RESTORE_ALL adj=8 iretq +END(restore_all_xen) -ENTRY(common_interrupt) +FUNC(common_interrupt) ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP SAVE_ALL @@ -713,12 +718,14 @@ ENTRY(common_interrupt) mov %r15, STACK_CPUINFO_FIELD(xen_cr3)(%r14) mov %bl, STACK_CPUINFO_FIELD(use_pv_cr3)(%r14) jmp ret_from_intr +END(common_interrupt) -ENTRY(entry_PF) +FUNC(entry_PF) ENDBR64 movl $X86_EXC_PF, 4(%rsp) +END(entry_PF) /* No special register assumptions. */ -GLOBAL(handle_exception) +FUNC(handle_exception, 0) ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP SAVE_ALL @@ -886,92 +893,108 @@ FATAL_exception_with_ints_disabled: xorl %esi,%esi movq %rsp,%rdi tailcall fatal_trap +END(handle_exception) -ENTRY(entry_DE) +FUNC(entry_DE) ENDBR64 pushq $0 movl $X86_EXC_DE, 4(%rsp) jmp handle_exception +END(entry_DE) -ENTRY(entry_MF) +FUNC(entry_MF) ENDBR64 pushq $0 movl $X86_EXC_MF, 4(%rsp) jmp handle_exception +END(entry_MF) -ENTRY(entry_XM) +FUNC(entry_XM) ENDBR64 pushq $0 movl $X86_EXC_XM, 4(%rsp) jmp handle_exception +END(entry_XM) -ENTRY(entry_NM) +FUNC(entry_NM) ENDBR64 pushq $0 movl $X86_EXC_NM, 4(%rsp) jmp handle_exception +END(entry_NM) -ENTRY(entry_DB) +FUNC(entry_DB) ENDBR64 pushq $0 movl $X86_EXC_DB, 4(%rsp) jmp handle_ist_exception +END(entry_DB) -ENTRY(entry_BP) +FUNC(entry_BP) ENDBR64 pushq $0 movl $X86_EXC_BP, 4(%rsp) jmp handle_exception +END(entry_BP) -ENTRY(entry_OF) +FUNC(entry_OF) ENDBR64 pushq $0 movl $X86_EXC_OF, 4(%rsp) jmp handle_exception +END(entry_OF) -ENTRY(entry_BR) +FUNC(entry_BR) ENDBR64 pushq $0 movl $X86_EXC_BR, 4(%rsp) jmp handle_exception +END(entry_BR) -ENTRY(entry_UD) +FUNC(entry_UD) ENDBR64 pushq $0 movl $X86_EXC_UD, 4(%rsp) jmp handle_exception +END(entry_UD) -ENTRY(entry_TS) +FUNC(entry_TS) ENDBR64 movl $X86_EXC_TS, 4(%rsp) jmp handle_exception +END(entry_TS) -ENTRY(entry_NP) +FUNC(entry_NP) ENDBR64 movl $X86_EXC_NP, 4(%rsp) jmp handle_exception +END(entry_NP) -ENTRY(entry_SS) +FUNC(entry_SS) ENDBR64 movl $X86_EXC_SS, 4(%rsp) jmp handle_exception +END(entry_SS) -ENTRY(entry_GP) +FUNC(entry_GP) ENDBR64 movl $X86_EXC_GP, 4(%rsp) jmp handle_exception +END(entry_GP) -ENTRY(entry_AC) +FUNC(entry_AC) ENDBR64 movl $X86_EXC_AC, 4(%rsp) jmp handle_exception +END(entry_AC) -ENTRY(entry_CP) +FUNC(entry_CP) ENDBR64 movl $X86_EXC_CP, 4(%rsp) jmp handle_exception +END(entry_CP) -ENTRY(entry_DF) +FUNC(entry_DF) ENDBR64 movl $X86_EXC_DF, 4(%rsp) /* Set AC to reduce chance of further SMAP faults */ @@ -994,8 +1017,9 @@ ENTRY(entry_DF) movq %rsp,%rdi tailcall do_double_fault +END(entry_DF) -ENTRY(entry_NMI) +FUNC(entry_NMI) ENDBR64 pushq $0 movl $X86_EXC_NMI, 4(%rsp) @@ -1126,21 +1150,24 @@ handle_ist_exception: ASSERT_CONTEXT_IS_XEN jmp restore_all_xen #endif +END(entry_NMI) -ENTRY(entry_MC) +FUNC(entry_MC) ENDBR64 pushq $0 movl $X86_EXC_MC, 4(%rsp) jmp handle_ist_exception +END(entry_MC) /* No op trap handler. Required for kexec crash path. */ -GLOBAL(trap_nop) +FUNC(trap_nop, 0) ENDBR64 iretq +END(trap_nop) /* Table of automatically generated entry points. One per vector. */ .pushsection .init.rodata, "a", @progbits -GLOBAL(autogen_entrypoints) +DATA(autogen_entrypoints, 8) /* pop into the .init.rodata section and record an entry point. */ .macro entrypoint ent .pushsection .init.rodata, "a", @progbits @@ -1149,7 +1176,7 @@ GLOBAL(autogen_entrypoints) .endm .popsection -autogen_stubs: /* Automatically generated stubs. */ +FUNC_LOCAL(autogen_stubs, 0) /* Automatically generated stubs. */ vec = 0 .rept X86_NR_VECTORS @@ -1193,6 +1220,7 @@ autogen_stubs: /* Automatically generate vec = vec + 1 .endr +END(autogen_stubs) .section .init.rodata, "a", @progbits - .size autogen_entrypoints, . - autogen_entrypoints +END(autogen_entrypoints) From patchwork Mon Jan 15 14:35:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13519710 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 9B9F6C3DA79 for ; Mon, 15 Jan 2024 14:36:05 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.667411.1038640 (Exim 4.92) (envelope-from ) id 1rPO4C-0008Q3-Jy; Mon, 15 Jan 2024 14:35:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 667411.1038640; Mon, 15 Jan 2024 14:35:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rPO4C-0008Pw-Ge; Mon, 15 Jan 2024 14:35:56 +0000 Received: by outflank-mailman (input) for mailman id 667411; Mon, 15 Jan 2024 14:35:54 +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 1rPO4A-0008Pj-Qo for xen-devel@lists.xenproject.org; Mon, 15 Jan 2024 14:35:54 +0000 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [2a00:1450:4864:20::435]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 62a5b556-b3b3-11ee-98f1-6d05b1d4d9a1; Mon, 15 Jan 2024 15:35:53 +0100 (CET) Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3367601a301so7611299f8f.2 for ; Mon, 15 Jan 2024 06:35:53 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id j27-20020adfb31b000000b00336e32338f3sm12166221wrd.70.2024.01.15.06.35.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jan 2024 06:35:52 -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: 62a5b556-b3b3-11ee-98f1-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1705329352; x=1705934152; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=f1C+rppgzTNnRF/Pqgedt1f2Tofhn86tPcLKmKXp7wk=; b=YnwJhDSb+1aNgogFQq1WXGKeHlsbrHpnIeZbNeTrumTlfNsVRhkFN5fTKHBqUXSGXI lNpQlwkXAP7HMwqgdUDEcy54TQqmXHO+BygyJHFTEStzMePJnLVoYJurn8g18Klbmnhb jIkeU8FAoFNUce19zOFni9WmXKc+oIOedfrktqWnUZEssKw2XYcb4r1yjhs0HW27esLK 4gyHLnW9pCFFKwdHO5VTETF/hEKH9uv9NxaHIaowaKEohO6BbnBt4+5bS+WQAx6esMag 4+5SUCr+69fnwyLKb99wut363TsT/2KQCvVMatL6Y7uP6FdReLLl7iArm0v/YZsbaHdV XyBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705329352; x=1705934152; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=f1C+rppgzTNnRF/Pqgedt1f2Tofhn86tPcLKmKXp7wk=; b=fPvzhtv2tl+IOLqsx+N7MwEzdiikoKN8fmSKNrXfcjsiDv7z5XaRpgwPr5BXz8Jrd3 wVVyiFkANUGAaQccudGbCBapE/dG9F41y0d0HKcgDpgJTxYZ2Xort31jhaHh23sk81+R sCuDTIIrEDNYK3kGQ9apoq4NdIqvcXz4BgfTdGRHuv7i6/JyVrF8nfzZjfUKWsDvQ1BG IXUUCPxTLrYcFErk3iR8slbnw6H9gapjLBEDy1fwALI/TVdLZ5ccaIzRm1jbcz+ymzp1 LjxfFUv2yd7GGG9kXouIlH36XZvZhq6SetvLs73kPca2TyVl25e8+J5uc6n4zVihqF+1 a6VQ== X-Gm-Message-State: AOJu0Ywc8wGrRo7ezgZZOKlVMfKiVookNwWUaMMu2j/x4iIMcdHPMbV5 Bt15rJlZHy5RWFovIbUkCcypygIBmF6uUhGTEGV5tPJsxg== X-Google-Smtp-Source: AGHT+IGX+tq8xYYgAgp0/quQgemYqyrfWtWcRx5Jibskl1EE2xes/OmGyTSnvJ1B07cd6yi9RZxuMg== X-Received: by 2002:adf:ab1b:0:b0:337:5c70:304 with SMTP id q27-20020adfab1b000000b003375c700304mr2296044wrc.15.1705329352708; Mon, 15 Jan 2024 06:35:52 -0800 (PST) Message-ID: Date: Mon, 15 Jan 2024 15:35:52 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v5 3/8] x86: also mark assembler globals hidden Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Julien Grall , Stefano Stabellini , George Dunlap References: <7a133ed9-9d13-4e2c-893a-00c083c8a35d@suse.com> Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7a133ed9-9d13-4e2c-893a-00c083c8a35d@suse.com> Let's have assembler symbols be consistent with C ones. In principle there are (a few) cases where gas can produce smaller code this way, just that for now there's a gas bug causing smaller code to be emitted even when that shouldn't be the case. Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monné --- v5: Re-base over changes earlier in the series. v3: Re-base over generalization of the annotations. v2: New. --- a/xen/arch/x86/include/asm/config.h +++ b/xen/arch/x86/include/asm/config.h @@ -47,11 +47,11 @@ #define CODE_FILL 0x90 #define ALIGN .align CODE_ALIGN, CODE_FILL #define ENTRY(name) \ - .globl name; \ ALIGN; \ - name: + GLOBAL(name) #define GLOBAL(name) \ .globl name; \ + .hidden name; \ name: #endif --- a/xen/include/xen/linkage.h +++ b/xen/include/xen/linkage.h @@ -19,7 +19,7 @@ #define SYM_ALIGN(align...) .balign align -#define SYM_L_GLOBAL(name) .globl name +#define SYM_L_GLOBAL(name) .globl name; .hidden name #define SYM_L_WEAK(name) .weak name #define SYM_L_LOCAL(name) /* nothing */ From patchwork Mon Jan 15 14:36:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13519711 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 CA477C3DA79 for ; Mon, 15 Jan 2024 14:36:45 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.667414.1038650 (Exim 4.92) (envelope-from ) id 1rPO4r-0000Tj-T0; Mon, 15 Jan 2024 14:36:37 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 667414.1038650; Mon, 15 Jan 2024 14:36:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rPO4r-0000Tc-Ox; Mon, 15 Jan 2024 14:36:37 +0000 Received: by outflank-mailman (input) for mailman id 667414; Mon, 15 Jan 2024 14:36:36 +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 1rPO4q-0000TM-Hb for xen-devel@lists.xenproject.org; Mon, 15 Jan 2024 14:36:36 +0000 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [2a00:1450:4864:20::334]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 7b66d45b-b3b3-11ee-9b0f-b553b5be7939; Mon, 15 Jan 2024 15:36:34 +0100 (CET) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40e80046246so2658585e9.1 for ; Mon, 15 Jan 2024 06:36:34 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id j27-20020adfb31b000000b00336e32338f3sm12166221wrd.70.2024.01.15.06.36.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jan 2024 06:36:34 -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: 7b66d45b-b3b3-11ee-9b0f-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1705329394; x=1705934194; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=e/vLrJhMfgT6/QpkaKU7E9tT/DlCGICDK2Ql9bfvWrE=; b=B4jHIn2+ICkwlOBSeeuEUqDsX0YoRUY//rXeksUgyxxCnvqHx567MCFHzgjWSntwUp /9CW7hXo/tlZr9YEjLqHw3j5UKwcb9AaemrN8pvJvZUwhbP8YaalgDMvglkWRDGoP6Ad VV3wmE++D0Pqi+8kRB27UQHEunAG9z1YD9jCEItEuvShAX2uM6zN8okcJ6UNg56a829j Zftx6wFfQyNJqVDwV3t5XLeJSzHjBjg1CmwsdoGggv/MQX/et4FeozHh6Hh6i6xfqq2g CH2Q5VdB4LW+VdDrhbs4TVdsa8Os0NbGZI5BTNTWqkKwbhF00nwgZxwOcKfVbee488Q5 AIFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705329394; x=1705934194; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=e/vLrJhMfgT6/QpkaKU7E9tT/DlCGICDK2Ql9bfvWrE=; b=MbwG3E+0VAqpPmcDDqHrjuCmB6JT5EVVFuSuSUL3WBCfBOcl/fuUaKbDm5rlMyZ/gc El7y57NmNOc/MKyFarKICERq61mJu0yf8KmaBrkyISF6BqtP9nJdPN1HvVz1cOHP5fVJ zZqXWIfHW+5eBtX55ecPOT7fsqB4Xs5fD0SgUWAEJ0ZIGPyFx236yjHkMc10wLnlyq9B uRaiy3GrpTHL94VGjNJAUZXcOOpld+BACpwCEyCHu/qR/HcodK4OL3CVrbMSrjPeobRV xvhzuRGqqWAgj4VnCSgLu3KIsw2XI6e/R8/tYDKUKrGOF/IA75+Sndzk/3fBJaqXNXnE a+yA== X-Gm-Message-State: AOJu0YwmO1yRtmT1GXf0dyWH13tB0ELYg3UoNQzOVpT+iKoTQa/qGYk/ fbRvdAE5vd8RJ1i2sIeuMXG+1MrlxjVKBBdhtQJY51eh8A== X-Google-Smtp-Source: AGHT+IGWxkLJBKgklwKLc6qGoDjPPjv7jwlTgeKRLNLYC1BrohudykjGpxPIL8NGYQHWKTN8/cZLHg== X-Received: by 2002:a05:600c:379a:b0:40e:4a88:fd6c with SMTP id o26-20020a05600c379a00b0040e4a88fd6cmr3181632wmr.61.1705329394216; Mon, 15 Jan 2024 06:36:34 -0800 (PST) Message-ID: <7871702a-b5ca-4430-b282-148b46fccc71@suse.com> Date: Mon, 15 Jan 2024 15:36:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v5 4/8] Arm: annotate entry points with type and size Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Julien Grall , Stefano Stabellini , Volodymyr Babchuk , Bertrand Marquis , George Dunlap , Michal Orzel References: <7a133ed9-9d13-4e2c-893a-00c083c8a35d@suse.com> Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7a133ed9-9d13-4e2c-893a-00c083c8a35d@suse.com> Use the generic framework in xen/linkage.h. No change in generated code except for the changed padding value (noticable when config.gz isn't a multiple of 4 in size). Plus of course the converted symbols change to be hidden ones. Note that ASM_INT() is switched to DATA(), not DATA_LOCAL(), as the only use site wants the symbol global anyway. Signed-off-by: Jan Beulich Reviewed-by: Julien Grall --- Only one each of the assembly files is being converted for now. More could be done right here or as follow-on in separate patches. The ASM_INT() redundancy of .global will be eliminated by a subsequent patch. --- v3: New. --- a/xen/arch/arm/arm32/lib/div64.S +++ b/xen/arch/arm/arm32/lib/div64.S @@ -42,7 +42,7 @@ * Clobbered regs: xl, ip */ -ENTRY(__do_div64) +FUNC(__do_div64) UNWIND(.fnstart) @ Test for easy paths first. @@ -206,4 +206,4 @@ Ldiv0_64: ldr pc, [sp], #8 UNWIND(.fnend) -ENDPROC(__do_div64) +END(__do_div64) --- a/xen/arch/arm/arm64/lib/clear_page.S +++ b/xen/arch/arm/arm64/lib/clear_page.S @@ -22,7 +22,7 @@ * Parameters: * x0 - dest */ -ENTRY(clear_page) +FUNC(clear_page) mrs x1, dczid_el0 and w1, w1, #0xf mov x2, #4 @@ -33,4 +33,4 @@ ENTRY(clear_page) tst x0, #(PAGE_SIZE - 1) b.ne 1b ret -ENDPROC(clear_page) +END(clear_page) --- a/xen/arch/arm/include/asm/asm_defns.h +++ b/xen/arch/arm/include/asm/asm_defns.h @@ -5,6 +5,7 @@ /* NB. Auto-generated from arch/.../asm-offsets.c */ #include #endif +#include #include /* Macros for generic assembly code */ @@ -30,10 +31,7 @@ label: .asciz msg; #define RODATA_STR(label, msg) RODATA_SECT(.rodata.str, label, msg) #define ASM_INT(label, val) \ - .p2align 2; \ -label: .long (val); \ - .size label, . - label; \ - .type label, %object + DATA(label, 4) .long (val); END(label) #endif /* __ARM_ASM_DEFNS_H__ */ /* --- a/xen/arch/arm/include/asm/config.h +++ b/xen/arch/arm/include/asm/config.h @@ -53,7 +53,8 @@ /* Linkage for ARM */ #ifdef __ASSEMBLY__ -#define ALIGN .align 2 +#define CODE_ALIGN 4 +#define ALIGN .balign CODE_ALIGN #define ENTRY(name) \ .globl name; \ ALIGN; \ @@ -61,8 +62,6 @@ #define GLOBAL(name) \ .globl name; \ name: -#define END(name) \ - .size name, .-name #define ENDPROC(name) \ .type name, %function; \ END(name) From patchwork Mon Jan 15 14:37:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13519712 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 AC86CC47258 for ; Mon, 15 Jan 2024 14:37:31 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.667424.1038660 (Exim 4.92) (envelope-from ) id 1rPO5b-00018Y-9Z; Mon, 15 Jan 2024 14:37:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 667424.1038660; Mon, 15 Jan 2024 14:37: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 1rPO5b-00018R-6A; Mon, 15 Jan 2024 14:37:23 +0000 Received: by outflank-mailman (input) for mailman id 667424; Mon, 15 Jan 2024 14:37: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 1rPO5a-0000sg-5y for xen-devel@lists.xenproject.org; Mon, 15 Jan 2024 14:37:22 +0000 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [2a00:1450:4864:20::42e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 974d4fb2-b3b3-11ee-98f1-6d05b1d4d9a1; Mon, 15 Jan 2024 15:37:21 +0100 (CET) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-33770772136so5054904f8f.3 for ; Mon, 15 Jan 2024 06:37:21 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id j27-20020adfb31b000000b00336e32338f3sm12166221wrd.70.2024.01.15.06.37.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jan 2024 06:37:20 -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: 974d4fb2-b3b3-11ee-98f1-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1705329441; x=1705934241; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=FFQ31FcmOb6PAY2U3EoJvJoyLBbzkzu/MkKrJKkl6xs=; b=gUDLSaag2yjMcNlpcT7ujnoN98o9SgOFqw4x0A5uNgrvgLnKOgzU+jS2JNHwREHvFT HvyChURhQFj8FdWfhAFQ/qPR1is+E+6zUnYIslaaNr42Dj4v7jl1+KTqnAu19xGWndK8 BVXlZlM8wWoEtmqxwhkB/MgcdeN0vtWKo2E1gZWGdehd2jOhay1VpSTp+LysMdI5sLiJ 7ViwreYoWzoFfStCzE721AVPtgtBsoXHrV+ucdE5GgmYEOIU+pXWQc0RpTFN/Akvx5FC sVRmShGQfAwNVPmcAFB3hKzjAghNqShdqtG50MXXmqz+tGXaF1RYtrFMZnmrEZ9O71l0 zslQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705329441; x=1705934241; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FFQ31FcmOb6PAY2U3EoJvJoyLBbzkzu/MkKrJKkl6xs=; b=KmzKh9Uug8vF5oPCuxLuEMiOV+b3Bbt+wF8GKzi4Ew3VGJud5qcWeTESetufrF90H5 //1N5mzwtrXUZN/bfyrm2uPcd9OzgJzMNSewh2oayA5nGnMrEOhNX0VS8Zk2X9vtsa3W Q10jR8/hNWZGmlWeWTDxuqRPVe5BTzyFhAJq8KC6jEJWdmy8nCofcpMQG1z+JagVytNB usSgDPjZKbw1NwbGeuURo51gWdVcztbwJ5+KDhkFMVw+Mv2yidZb0FhusT4ZF6XIVuHl V2ihokB5M1vFmS2mXZ0DiT+uv6gSHU8xNN1SbmN201lr0DqvfEgIZiTobraHSVBSjiSJ lLCA== X-Gm-Message-State: AOJu0Yx7GdwdFQdqSMO2aQ2IVtMRy3lmla2xc/pGa7mmc49P5uVnn6nz P4aEMP6XtMX5UkqQEUbma/E/2iVDxgnPfQCYaioERUhozQ== X-Google-Smtp-Source: AGHT+IERDl4S4Scd5eoSzdNvMNWD5vn3MbERcQ8c/IaSWBucKJnm0nZAW3cOOuUCfsgX0k4veeAOeA== X-Received: by 2002:adf:f684:0:b0:336:7a01:98da with SMTP id v4-20020adff684000000b003367a0198damr2812334wrp.55.1705329441074; Mon, 15 Jan 2024 06:37:21 -0800 (PST) Message-ID: <7c57d285-c81d-43d4-93fe-2152ea6ad7f8@suse.com> Date: Mon, 15 Jan 2024 15:37:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v5 5/8] RISC-V: annotate entry points with type and size Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , Julien Grall , Stefano Stabellini , Bobby Eshleman , Alistair Francis , Connor Davis , George Dunlap , Oleksii Kurochko References: <7a133ed9-9d13-4e2c-893a-00c083c8a35d@suse.com> Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf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51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7a133ed9-9d13-4e2c-893a-00c083c8a35d@suse.com> Use the generic framework in xen/linkage.h. No change in generated code except of course the converted symbols change to be hidden ones and gain a valid size. Signed-off-by: Jan Beulich Reviewed-by: Oleksii Kurochko --- Probably count_args_exp() should move to macros.h, but I first wanted to see whether anyone can suggest any better approach for checking whether a defined macro expands to nothing. --- v5: Re-base. v4: Also drop #undef-s from linker script. v3: New. --- a/xen/arch/riscv/entry.S +++ b/xen/arch/riscv/entry.S @@ -5,7 +5,7 @@ #include /* WIP: only works while interrupting Xen context */ -ENTRY(handle_trap) +FUNC(handle_trap) /* Exceptions from xen */ save_to_stack: @@ -92,3 +92,4 @@ restore_registers: REG_L sp, CPU_USER_REGS_SP(sp) sret +END(handle_trap) --- a/xen/arch/riscv/include/asm/asm.h +++ b/xen/arch/riscv/include/asm/asm.h @@ -7,6 +7,7 @@ #define _ASM_RISCV_ASM_H #ifdef __ASSEMBLY__ +#include #define __ASM_STR(x) x #else #define __ASM_STR(x) #x --- a/xen/arch/riscv/include/asm/config.h +++ b/xen/arch/riscv/include/asm/config.h @@ -69,12 +69,8 @@ /* Linkage for RISCV */ #ifdef __ASSEMBLY__ -#define ALIGN .align 4 - -#define ENTRY(name) \ - .globl name; \ - ALIGN; \ - name: +#define CODE_ALIGN 16 +#define CODE_FILL /* empty */ #endif #ifdef CONFIG_RISCV_64 --- a/xen/arch/riscv/riscv64/head.S +++ b/xen/arch/riscv/riscv64/head.S @@ -8,7 +8,7 @@ * a0 -> hart_id ( bootcpu_id ) * a1 -> dtb_base */ -ENTRY(start) +FUNC(start) /* Mask all interrupts */ csrw CSR_SIE, zero @@ -60,19 +60,21 @@ ENTRY(start) mv a1, s1 tail start_xen +END(start) .section .text, "ax", %progbits -ENTRY(reset_stack) +FUNC(reset_stack) la sp, cpu0_boot_stack li t0, STACK_SIZE add sp, sp, t0 ret +END(reset_stack) .section .text.ident, "ax", %progbits -ENTRY(turn_on_mmu) +FUNC(turn_on_mmu) sfence.vma li t0, RV_STAGE1_MODE @@ -84,3 +86,4 @@ ENTRY(turn_on_mmu) csrw CSR_SATP, t1 jr a0 +END(turn_on_mmu) --- a/xen/arch/riscv/xen.lds.S +++ b/xen/arch/riscv/xen.lds.S @@ -1,9 +1,6 @@ #include #include -#undef ENTRY -#undef ALIGN - OUTPUT_ARCH(riscv) ENTRY(start) --- a/xen/include/xen/linkage.h +++ b/xen/include/xen/linkage.h @@ -35,17 +35,28 @@ #define END(name) .size name, . - name +/* + * CODE_FILL in particular may need to expand to nothing (e.g. for RISC-V), in + * which case we also need to get rid of the comma in the .balign directive. + */ +#define count_args_exp(args...) count_args(args) +#if count_args_exp(CODE_FILL) +# define DO_CODE_ALIGN(align...) LASTARG(CODE_ALIGN, ## align), CODE_FILL +#else +# define DO_CODE_ALIGN(align...) LASTARG(CODE_ALIGN, ## align) +#endif + #define FUNC(name, align...) \ - SYM(name, FUNC, GLOBAL, LASTARG(CODE_ALIGN, ## align), CODE_FILL) + SYM(name, FUNC, GLOBAL, DO_CODE_ALIGN(align)) #define LABEL(name, align...) \ - SYM(name, NONE, GLOBAL, LASTARG(CODE_ALIGN, ## align), CODE_FILL) + SYM(name, NONE, GLOBAL, DO_CODE_ALIGN(align)) #define DATA(name, align...) \ SYM(name, DATA, GLOBAL, LASTARG(DATA_ALIGN, ## align), DATA_FILL) #define FUNC_LOCAL(name, align...) \ - SYM(name, FUNC, LOCAL, LASTARG(CODE_ALIGN, ## align), CODE_FILL) + SYM(name, FUNC, LOCAL, DO_CODE_ALIGN(align)) #define LABEL_LOCAL(name, align...) \ - SYM(name, NONE, LOCAL, LASTARG(CODE_ALIGN, ## align), CODE_FILL) + SYM(name, NONE, LOCAL, DO_CODE_ALIGN(align)) #define DATA_LOCAL(name, align...) \ SYM(name, DATA, LOCAL, LASTARG(DATA_ALIGN, ## align), DATA_FILL) From patchwork Mon Jan 15 14:38:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13519713 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 9B9B1C3DA79 for ; Mon, 15 Jan 2024 14:39:06 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.667428.1038671 (Exim 4.92) (envelope-from ) id 1rPO76-0002mQ-KZ; Mon, 15 Jan 2024 14:38:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 667428.1038671; Mon, 15 Jan 2024 14:38:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rPO76-0002mJ-GU; Mon, 15 Jan 2024 14:38:56 +0000 Received: by outflank-mailman (input) for mailman id 667428; Mon, 15 Jan 2024 14:38:55 +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 1rPO75-0002mB-RD for xen-devel@lists.xenproject.org; Mon, 15 Jan 2024 14:38:55 +0000 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [2a00:1450:4864:20::432]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id cea3a8e5-b3b3-11ee-98f1-6d05b1d4d9a1; Mon, 15 Jan 2024 15:38:54 +0100 (CET) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3373bc6d625so7500272f8f.3 for ; Mon, 15 Jan 2024 06:38:54 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id j27-20020adfb31b000000b00336e32338f3sm12166221wrd.70.2024.01.15.06.38.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jan 2024 06:38:53 -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: cea3a8e5-b3b3-11ee-98f1-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1705329534; x=1705934334; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=US14xhGKhc0Smw4Hw8UT6NWF96l1rVjI7L9dESkaVts=; b=gb1xk321YQfY80pHySJfj73l6J5ohQgUpfQweSWOy/AwhtcyEaJrZQK591qfQKgB8E bo/E8bLbph6Ff7EFlQo1ki44FKpSfAiGh5s0LhMv3DZjbfKbihtci9rvUGQxYliS5/su roLL07+klcRBrWpYsR/6p/QaM9tUYLrSdm+eZELdXh5fwy4LqGvdC6ltGaMTlZXIsdGA VrvAbuK+6eI4aokT83dm6/Mmn+b60K2kpfL3ZQqcumV/eofFtNwbQF0zz0SMiZpXfBNW xRACktZPJzSAbAnC+9XSpZpi1hHH8LKTkz/gSgR0yAEB9O+541gOI6DJJDe+AfJzbpTk 8iYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705329534; x=1705934334; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=US14xhGKhc0Smw4Hw8UT6NWF96l1rVjI7L9dESkaVts=; b=ga+DD2roTNyajCz/JC4lBgGrOjeHIwHdVcZsg/9fCsvY6pALDUuiZHB/rIaThIaMN6 U9LsEoGzSw8ukYN+zUoPbOhrL2q7hr6iWDghrxS2XFPzanABfemAZYiroLEXpaRX87cb lkKqIK0awzCxIf7jWYuOqyW63pHDFSezJAEd1PJVNXRHpP31+2fgZRC38eQ7Bwkz58IP sR4OZ6ZUTQvfTleEzCInYhTCeqnrFuJ/vSHq7krumBKxFUPrjTdgMn+zcr54djfAU1ZB 7kCLgqvlt5M9m+k47BeZ4wBelP8Ri6QamLkAcqIBWVashpQJUJYE0s4bKmmPHTosmPFL v+xQ== X-Gm-Message-State: AOJu0YzXI2T3dIK5NUTfZP4evaStH+eCpdaNVhJZZfUbZVUY7ojJHwpN DvtMVNZOaIdB2a8aPJYQyWK5cXTN4Bz2d2/LIrJ0tKDHZw== X-Google-Smtp-Source: AGHT+IGy8MgsnT9vNDEznqHeZ4+w9/iz74rLCoQt+dXDDTs1PHrLhr+0E/XP3VP4XREU/hftW3z2Uw== X-Received: by 2002:a05:6000:10d:b0:336:6388:1092 with SMTP id o13-20020a056000010d00b0033663881092mr2486344wrx.126.1705329533845; Mon, 15 Jan 2024 06:38:53 -0800 (PST) Message-ID: <36004375-1398-4f94-b455-8bfdafe0c9d7@suse.com> Date: Mon, 15 Jan 2024 15:38:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v5 6/8] PPC: switch entry point annotations to common model Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: George Dunlap , Shawn Anastasio References: <7a133ed9-9d13-4e2c-893a-00c083c8a35d@suse.com> Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdS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zrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7a133ed9-9d13-4e2c-893a-00c083c8a35d@suse.com> Use the generic framework in xen/linkage.h. No change in generated code except of course the converted symbols change to be hidden ones. Signed-off-by: Jan Beulich Acked-by: Shawn Anastasio --- v5: Re-base. v4: Also drop #undef-s from linker script. Re-base. v3: New. --- a/xen/arch/ppc/include/asm/asm-defns.h +++ b/xen/arch/ppc/include/asm/asm-defns.h @@ -3,6 +3,7 @@ #define _ASM_PPC_ASM_DEFNS_H #include +#include /* * Load a 64-bit immediate value into the specified GPR. --- a/xen/arch/ppc/include/asm/config.h +++ b/xen/arch/ppc/include/asm/config.h @@ -32,12 +32,7 @@ /* Linkage for PPC */ #ifdef __ASSEMBLY__ -#define ALIGN .p2align 2 - -#define ENTRY(name) \ - .globl name; \ - ALIGN; \ - name: +#define CODE_ALIGN 4 #endif #define XEN_VIRT_START _AC(0xc000000000000000, UL) --- a/xen/arch/ppc/ppc64/exceptions-asm.S +++ b/xen/arch/ppc/ppc64/exceptions-asm.S @@ -6,7 +6,7 @@ .section .text.exceptions, "ax", %progbits /* Helper to dump CPU state to struct cpu_user_regs pointed to by r1. */ -ENTRY(exception_common) +FUNC(exception_common) /* * Save GPRs 1-31. TODO: The value of %r1 has already been modified by the * ISR, so the value we save isn't the exact value we had on entry. @@ -45,11 +45,10 @@ ENTRY(exception_common) stdu %r0, -STACK_FRAME_OVERHEAD(%r1) bl exception_handler - .size exception_common, . - exception_common - .type exception_common, %function + END(exception_common) /* Same as exception_common, but for exceptions that set HSRR{0,1} */ -ENTRY(h_exception_common) +FUNC(h_exception_common) /* * Save GPRs 1-31. TODO: The value of %r1 has already been modified by the * ISR, so the value we save isn't the exact value we had on entry. @@ -89,15 +88,14 @@ ENTRY(h_exception_common) stdu %r0, -STACK_FRAME_OVERHEAD(%r1) bl exception_handler - .size h_exception_common, . - h_exception_common - .type h_exception_common, %function + END(h_exception_common) /* * Declare an ISR for the provided exception that jumps to the specified handler */ .macro ISR name, exc, handler . = (AIL_VECTOR_BASE - EXCEPTION_VECTORS_START) + \exc - ENTRY(\name) + FUNC(\name) /* TODO: switch stack */ /* Reserve space for struct cpu_user_regs */ @@ -113,8 +111,7 @@ ENTRY(h_exception_common) /* Branch to common code */ b \handler - .size \name, . - \name - .type \name, %function + END(\name) .endm /* --- a/xen/arch/ppc/ppc64/head.S +++ b/xen/arch/ppc/ppc64/head.S @@ -6,7 +6,7 @@ .section .text.header, "ax", %progbits -ENTRY(start) +FUNC(start) /* * NOTE: argument registers (r3-r9) must be preserved until the C entrypoint */ @@ -64,11 +64,9 @@ ENTRY(start) /* should never return */ trap +END(start) - .size start, . - start - .type start, %function - -ENTRY(enable_mmu) +FUNC(enable_mmu) mflr %r3 mfmsr %r4 @@ -78,6 +76,4 @@ ENTRY(enable_mmu) mtsrr0 %r3 /* return to caller after MMU enable */ mtsrr1 %r4 rfid - - .size enable_mmu, . - enable_mmu - .type enable_mmu, %function +END(enable_mmu) --- a/xen/arch/ppc/xen.lds.S +++ b/xen/arch/ppc/xen.lds.S @@ -1,9 +1,6 @@ #include #include -#undef ENTRY -#undef ALIGN - OUTPUT_ARCH(powerpc:common64) ENTRY(start) From patchwork Mon Jan 15 14:39:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13519714 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 5088CC4707B for ; Mon, 15 Jan 2024 14:39:50 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.667430.1038679 (Exim 4.92) (envelope-from ) id 1rPO7n-0003N5-RU; Mon, 15 Jan 2024 14:39:39 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 667430.1038679; Mon, 15 Jan 2024 14:39:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rPO7n-0003My-Oe; Mon, 15 Jan 2024 14:39:39 +0000 Received: by outflank-mailman (input) for mailman id 667430; Mon, 15 Jan 2024 14:39:38 +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 1rPO7m-0003Mo-6x for xen-devel@lists.xenproject.org; Mon, 15 Jan 2024 14:39:38 +0000 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [2a00:1450:4864:20::432]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e79542d7-b3b3-11ee-9b0f-b553b5be7939; Mon, 15 Jan 2024 15:39:36 +0100 (CET) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-337ae00f39dso510722f8f.2 for ; Mon, 15 Jan 2024 06:39:36 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id j27-20020adfb31b000000b00336e32338f3sm12166221wrd.70.2024.01.15.06.39.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jan 2024 06:39:35 -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: e79542d7-b3b3-11ee-9b0f-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1705329576; x=1705934376; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=hWQFo/wX+wC8FEgbkzgKbNXtICtACu8yENHkBqHbYaY=; b=RG+jPdTDWqwqqnkMJZt+UMer7MEMUqlhtxYGI+bt1IWXdA4xZzBx4IJ1xvzzQiOtwv v+u5HEIjtTy+7RknwalUKn1UoIG1pFU3HlvHP3jyjFWpk5nZOn2L82ryIXPkwTOJ3UWQ RC2HVfjCHZkgG08DxdkI8l8mPac5Cmsao3qhG4euvEiqZ9meglCPnNXNye3O2FisQlWE E4tzrt4Lj74cFF+/SHyfHEc78PfRKSh7amCS0QgagGT3jfjty6b0KVZ/GYBdeFdlUtY7 o3a0wahwa5CWVF5xhGWzzqJzTAfPyjnYqcXmD0QcaBldaledwT4Md00PJB16hW1pFZzD iYLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705329576; x=1705934376; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hWQFo/wX+wC8FEgbkzgKbNXtICtACu8yENHkBqHbYaY=; b=DhjJE9vgM1FHcVqBBvmqi24iqoVunF1JJN7Y2TMQXtiAYpcQqCb08v34F8nJQxK9Dg kdBAcjduRrkKPjpeX5CB2uC5pghvsntyTDkLXYzSABMgob/ZV1pTn/u+XS265kLYFhVU gJnzrCnsLVedmg0fQebfBxdGpaTLolppcucoARZ9tBYbTGFZdPiCiGPYJwzA5gZ3Ykz1 0hc1z47gI4Owy/K0iWbSJbDmbJWBWs0hKGPidqfZOTAie91OWSZMmzn/PXB7EyY8c5Pm MfpeSa9lMSjWRlX4iqVLTDCZOoman8n9TdTdRdFtO7Ip3spf/508fT6Cy5zbhv8qqYWD dAEg== X-Gm-Message-State: AOJu0Yx0FZ/NkiIa5ix7UGmynlb4YFxlwKIXqJWkKnE0XChuFrHgQ2ml 2HRqRtXw8eTz5iUikuX+D/M5Nnr+NrGDi0qaRqfTR8mCMA== X-Google-Smtp-Source: AGHT+IFxI4KnNmfmhoYBCVyJG+Z7I4BeVQXrQE52XkfbsBK1NmA5/bciGWyf2y+Z2BILad9sbPXDZg== X-Received: by 2002:adf:db03:0:b0:337:55d8:ce80 with SMTP id s3-20020adfdb03000000b0033755d8ce80mr2911320wri.7.1705329575736; Mon, 15 Jan 2024 06:39:35 -0800 (PST) Message-ID: Date: Mon, 15 Jan 2024 15:39:35 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v5 7/8] tools/binfile: switch to common annotations model Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Julien Grall , Stefano Stabellini , George Dunlap References: <7a133ed9-9d13-4e2c-893a-00c083c8a35d@suse.com> Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2Xb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mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7a133ed9-9d13-4e2c-893a-00c083c8a35d@suse.com> Use DATA() / END() and drop the now redundant .global. No change in generated data; of course the two symbols now properly gain "hidden" binding. Signed-off-by: Jan Beulich Reviewed-by: Julien Grall --- v3: New. --- a/xen/tools/binfile +++ b/xen/tools/binfile @@ -29,15 +29,10 @@ cat <$target .section $section.rodata, "a", %progbits - .p2align $align - .global $varname -$varname: +DATA($varname, 1 << $align) .incbin "$binsource" .Lend: +END($varname) - .type $varname, %object - .size $varname, .Lend - $varname - - .global ${varname}_size ASM_INT(${varname}_size, .Lend - $varname) EOF From patchwork Mon Jan 15 14:40:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13519715 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 2767EC3DA79 for ; Mon, 15 Jan 2024 14:40:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.667439.1038700 (Exim 4.92) (envelope-from ) id 1rPO8U-0005Ht-F9; Mon, 15 Jan 2024 14:40:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 667439.1038700; Mon, 15 Jan 2024 14:40:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rPO8U-0005Hk-CF; Mon, 15 Jan 2024 14:40:22 +0000 Received: by outflank-mailman (input) for mailman id 667439; Mon, 15 Jan 2024 14:40:21 +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 1rPO8T-00046P-KH for xen-devel@lists.xenproject.org; Mon, 15 Jan 2024 14:40:21 +0000 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [2a00:1450:4864:20::332]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0244fda4-b3b4-11ee-98f1-6d05b1d4d9a1; Mon, 15 Jan 2024 15:40:21 +0100 (CET) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40e78238db9so9629195e9.3 for ; Mon, 15 Jan 2024 06:40:21 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id j27-20020adfb31b000000b00336e32338f3sm12166221wrd.70.2024.01.15.06.40.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jan 2024 06:40:20 -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: 0244fda4-b3b4-11ee-98f1-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1705329620; x=1705934420; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=PGc0X6Yaf/cUmP7O9RP4fKCBRUMgrpx1/OYaXtfQg1k=; b=c8rwg4O9FQDUsc73rQ9+joRT4ZCz3fCZtRYWADVeG7JsmgG3/DMUmjwcWvZSAM0WSb MvPEnJTg9pPy9iX6vEgkha8lB0obPYCWaURVQmnS0V+4VGTA1DdY/GgB7WP8s0zaoCeX NO1UT7f9mOVLLqHw+/Zwj9cM0Ot2SAON/0EIvJ1Q8rYehbd+xhEDlwWGCnZyVOFfUaDF 5WhDdkJ/ncKLqZZSFFXL99UiPwVOcO0C/SJ9+3nXQRfJF9tyjAsRv7pKxbFdtpuuk+O4 pFoY9HdHG6Xb75Z5s8TxYiR1oFIBrUkVsiLu7DR81GwUwRFqDrKJV40AGuA8qZMrhX4u swAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705329620; x=1705934420; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PGc0X6Yaf/cUmP7O9RP4fKCBRUMgrpx1/OYaXtfQg1k=; b=BS6C0IAbcIwfE7z8LGUL7QJF27TxQvB+a1B67kS/1+Ryw4H1fCRfK2PmxhQflYBPpX TB8AuzWaBfY/eDZOQHMlWE7FZ61/yyMEWP2WLMlCtPv1nkee996wIBGfjYURZBFxNRUh HnwFqPBGC6aYQfl7rnU93bKY9wiXMNHDjVFGmAwAnpfEvDuY42r4tvU6E6vPoMyzKMB8 TTe7Z5Jf2TJc+ZyWGxtuEemvs0Sm2Pv5aQHNLn5HfjWqnvv0a5QF8zmAkKeexNTY5ix1 HE9VtdR6cGYAXFN8jbu7hAatcTUcJuaypcLVheDwZOVUj0cg+fYrt+3U9RPhMtzCOvKR yftQ== X-Gm-Message-State: AOJu0YwOY36IH+ZJmPyHDsmTAB4ASabeynI1NxL+3eIOHh3wLlfER/ls QXhJNFzNcSPJ1iS+lz8sXKD2Dp7Ohik6Tv9Fhy8OCZkYpA== X-Google-Smtp-Source: AGHT+IEoPhR57xV8FSVKgZ6TMjy/XaNhigGL4lCN5GQks/jeVjwsFpysbxkv5z0/PeovruV90mmC5g== X-Received: by 2002:a5d:67cc:0:b0:337:4ce2:a601 with SMTP id n12-20020a5d67cc000000b003374ce2a601mr3282252wrw.76.1705329620403; Mon, 15 Jan 2024 06:40:20 -0800 (PST) Message-ID: <5df1d87d-8e54-4e15-b1fb-46b274cb66ef@suse.com> Date: Mon, 15 Jan 2024 15:40:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v5 8/8] common: honor CONFIG_CC_SPLIT_SECTIONS also for assembly functions Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Julien Grall , Stefano Stabellini , Volodymyr Babchuk , Bertrand Marquis , Bobby Eshleman , Alistair Francis , Connor Davis , George Dunlap , Shawn Anastasio , Michal Orzel References: <7a133ed9-9d13-4e2c-893a-00c083c8a35d@suse.com> Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt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3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <7a133ed9-9d13-4e2c-893a-00c083c8a35d@suse.com> Leverage the new infrastructure in xen/linkage.h to also switch to per- function sections (when configured), deriving the specific name from the "base" section in use at the time FUNC() is invoked. Signed-off-by: Jan Beulich --- TBD: Since we use .subsection in UNLIKELY_START(), a perhaps not really wanted side effect of this change is that respective out-of-line code now moves much closer to its original (invoking) code. TBD: Of course something with the same overall effect, but less impactful might do in Config.mk. E.g. $(filter-out -D%,$(3)) instead of $(firstword (3)). TBD: On top of Roger's respective patch (for livepatch), also respect CONFIG_FUNCTION_ALIGNMENT. Note that we'd need to split DATA() in order to separate r/w and r/o contributions. Further splitting might be needed to also support more advanced attributes (e.g. merge), hence why this isn't done right here. Sadly while a new section's name can be derived from the presently in use, its attributes cannot be. Perhaps the only thing we can do is give DATA() a 2nd mandatory parameter. Then again I guess most data definitions could be moved to C anyway. --- v5: Re-base over changes earlier in the series. v4: Re-base. v2: Make detection properly fail on old gas (by adjusting cc-option-add-closure). --- a/Config.mk +++ b/Config.mk @@ -102,7 +102,7 @@ cc-option = $(shell if $(1) $(2:-Wno-%=- # Usage: $(call cc-option-add CFLAGS,CC,-march=winchip-c6) cc-option-add = $(eval $(call cc-option-add-closure,$(1),$(2),$(3))) define cc-option-add-closure - ifneq ($$(call cc-option,$$($(2)),$(3),n),n) + ifneq ($$(call cc-option,$$($(2)),$(firstword $(3)),n),n) $(1) += $(3) endif endef --- a/xen/Makefile +++ b/xen/Makefile @@ -409,6 +409,9 @@ AFLAGS += -D__ASSEMBLY__ $(call cc-option-add,AFLAGS,CC,-Wa$$(comma)--noexecstack) +# Check to see whether the assmbler supports the --sectname-subst option. +$(call cc-option-add,AFLAGS,CC,-Wa$$(comma)--sectname-subst -DHAVE_AS_SECTNAME_SUBST) + LDFLAGS-$(call ld-option,--warn-rwx-segments) += --no-warn-rwx-segments CFLAGS += $(CFLAGS-y) --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -156,6 +156,9 @@ SECTIONS .init.text : { _sinittext = .; *(.init.text) +#ifdef CONFIG_CC_SPLIT_SECTIONS + *(.init.text.*) +#endif _einittext = .; . = ALIGN(PAGE_SIZE); /* Avoid mapping alt insns executable */ *(.altinstr_replacement) --- a/xen/arch/ppc/xen.lds.S +++ b/xen/arch/ppc/xen.lds.S @@ -104,6 +104,9 @@ SECTIONS .init.text : { _sinittext = .; *(.init.text) +#ifdef CONFIG_CC_SPLIT_SECTIONS + *(.init.text.*) +#endif _einittext = .; . = ALIGN(PAGE_SIZE); /* Avoid mapping alt insns executable */ } :text --- a/xen/arch/riscv/xen.lds.S +++ b/xen/arch/riscv/xen.lds.S @@ -104,6 +104,9 @@ SECTIONS .init.text : { _sinittext = .; *(.init.text) +#ifdef CONFIG_CC_SPLIT_SECTIONS + *(.init.text.*) +#endif _einittext = .; . = ALIGN(PAGE_SIZE); /* Avoid mapping alt insns executable */ } :text --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -86,6 +86,9 @@ SECTIONS . = ALIGN(PAGE_SIZE); _stextentry = .; *(.text.entry) +#ifdef CONFIG_CC_SPLIT_SECTIONS + *(.text.entry.*) +#endif . = ALIGN(PAGE_SIZE); _etextentry = .; @@ -214,6 +217,9 @@ SECTIONS #endif _sinittext = .; *(.init.text) +#ifdef CONFIG_CC_SPLIT_SECTIONS + *(.init.text.*) +#endif *(.text.startup) _einittext = .; /* --- a/xen/include/xen/linkage.h +++ b/xen/include/xen/linkage.h @@ -19,6 +19,14 @@ #define SYM_ALIGN(align...) .balign align +#if defined(HAVE_AS_SECTNAME_SUBST) && defined(CONFIG_CC_SPLIT_SECTIONS) +# define SYM_PUSH_SECTION(name, attr) \ + .pushsection %S.name, attr, %progbits; \ + .equ .Lsplit_section, 1 +#else +# define SYM_PUSH_SECTION(name, attr) +#endif + #define SYM_L_GLOBAL(name) .globl name; .hidden name #define SYM_L_WEAK(name) .weak name #define SYM_L_LOCAL(name) /* nothing */ @@ -33,7 +41,14 @@ SYM_ALIGN(align); \ name: -#define END(name) .size name, . - name +#define END(name) \ + .size name, . - name; \ + .ifdef .Lsplit_section; \ + .if .Lsplit_section; \ + .popsection; \ + .equ .Lsplit_section, 0; \ + .endif; \ + .endif /* * CODE_FILL in particular may need to expand to nothing (e.g. for RISC-V), in @@ -47,6 +62,7 @@ #endif #define FUNC(name, align...) \ + SYM_PUSH_SECTION(name, "ax"); \ SYM(name, FUNC, GLOBAL, DO_CODE_ALIGN(align)) #define LABEL(name, align...) \ SYM(name, NONE, GLOBAL, DO_CODE_ALIGN(align)) @@ -54,6 +70,7 @@ SYM(name, DATA, GLOBAL, LASTARG(DATA_ALIGN, ## align), DATA_FILL) #define FUNC_LOCAL(name, align...) \ + SYM_PUSH_SECTION(name, "ax"); \ SYM(name, FUNC, LOCAL, DO_CODE_ALIGN(align)) #define LABEL_LOCAL(name, align...) \ SYM(name, NONE, LOCAL, DO_CODE_ALIGN(align))