From nobody Mon Sep 16 19:45:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1707317786; cv=none; d=zohomail.com; s=zohoarc; b=R1nxNZy4ZCO3yZzFAKGdKJEHRGuv7TbQe4VgxUmuxg4bEbxxx/BRJhqOx1orffMLgnHWxt+CGHHT1HIST4FIdPwd2ma+swwnszFW5MO6VqEoZPD0ie/cykhfkMcBloWflMlbyh2picAYar+ZusphgMaB7tO2FuM2/3Qg5hZ/hjg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707317786; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VvhvJ0mk4ckYFEcAiyKPBpKqoDXebryxKX/EJIJcbn4=; b=CR6vnkpnDvou3u+xkXqjfJsOTqpl+JL1UNs187JGXtLWvUXS516/SnKPyEdSs+Gs3ERbQzHFy3TiYTxB5wC0C2gpYta3j6okER5z5hgVO38HRExxGmyrfCXeiORhCPmYrLGJuTGGQP3eFBCLl4ptPI3LJRe+JQh+Mn8VP661EtI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1707317786717161.2838818891006; Wed, 7 Feb 2024 06:56:26 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.677723.1054524 (Exim 4.92) (envelope-from ) id 1rXjLP-0006wJ-My; Wed, 07 Feb 2024 14:56:11 +0000 Received: by outflank-mailman (output) from mailman id 677723.1054524; Wed, 07 Feb 2024 14:56:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rXjLP-0006w6-Gn; Wed, 07 Feb 2024 14:56:11 +0000 Received: by outflank-mailman (input) for mailman id 677723; Wed, 07 Feb 2024 14:56:10 +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 1rXjLO-0006gr-ES for xen-devel@lists.xenproject.org; Wed, 07 Feb 2024 14:56:10 +0000 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [2a00:1450:4864:20::632]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 07532507-c5c9-11ee-8a49-1f161083a0e0; Wed, 07 Feb 2024 15:56:09 +0100 (CET) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a30f7c9574eso100317366b.0 for ; Wed, 07 Feb 2024 06:56:09 -0800 (PST) Received: from localhost ([213.195.118.74]) by smtp.gmail.com with ESMTPSA id y13-20020a170906070d00b00a386a32a9d9sm834614ejb.194.2024.02.07.06.56.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 06:56:08 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 07532507-c5c9-11ee-8a49-1f161083a0e0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1707317768; x=1707922568; 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=VvhvJ0mk4ckYFEcAiyKPBpKqoDXebryxKX/EJIJcbn4=; b=g6B46dlfp7q0nunTllR8NB5f4f3IRonaTzlX53W1RlNhcEIWLz90iDqNiMpBJMqNgQ S1NC4U6I9d0nmcVIHR5U3fE13l1ff/p+sv+q8FkgtAc6dOXaovzTjTQM7MRXTSk0rfvE iIFLzs5U4vHcVK1NsdIHF7Nhr8GbOPh6WFXSc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707317768; x=1707922568; 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=VvhvJ0mk4ckYFEcAiyKPBpKqoDXebryxKX/EJIJcbn4=; b=qNHXlDGViVIHBNMFpfNtvHiRsr4T/ia41xI7GyXmIGasd1S6kUgp+y+ZFICbXi4IbL 2BTsGbKJMu9UD7fm9h2tGmN33MPPgD+6rVR/5+E28AyqIX035h/gdvd1RNxttGkefNVb 44I3zjU+8yDCgDowFGuzefL4BpP/ZUffhOO48DBFwz4ApOkKjBueJJo2KLwup4xU46u/ g9N8zAuG1tx3kvxLhFlY2eQWFgTtDUAJIHIZxMJ/v3FHrXL9KhtfQaCHF+DbRCu33iO8 Q4xE5gUBkWBCX5tA91OwpQHjsz9ZiQNNGkhRaEnHb6l2IpyNuux5B7rDuVs2tq+lLEt4 dB2w== X-Gm-Message-State: AOJu0YwkxDK+Z6liLxr2KKaQqxZEM0iZ6DommNGqhvz+dikyCI3FErVH IV8s5TmgYtmLtKc0XEw+2nWA25lo5ATni5HQ8s+BaoHEIxxtNi3hxPVuZ2ZMYc9vtydv4FBC9kP + X-Google-Smtp-Source: AGHT+IEf//jnO6+wwgVwFq/WbrfkwQt0EVuxuJU/7OLvjKJPip3WS7InnQyd8gBn9YlqnI5vxEk4Nw== X-Received: by 2002:a17:906:cc1:b0:a38:5c3c:9d1e with SMTP id l1-20020a1709060cc100b00a385c3c9d1emr1744877ejh.18.1707317768593; Wed, 07 Feb 2024 06:56:08 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXtnfQ4fJ1r4TYx1lFl0J8JNHk10d6cWkSfoq5n/yZRh5p5FxCnDmCFAljj8VyeWsf1vl9b16Ni+7hOCHfm/OaCfd/2bDdIpCQ+3V7O+jfokzkfiST9xH5EBMQJh3/mtrtR4PC0tXSJ/9VQzFrIg8e+BDzDEoVUbXXo6CFax+lo7fwEgCXwmOSpOMkHD2tIaTU8uSwQvg/V0vI7REPXfqnIX6WCoZmKZ0CUzfDx3nN56R6Br1EJU3WByChBz7um5utykJgmp0PqzD4r5WI/Nis9yyh/8ymQkgLQiThHwDBqKthf+cpgh6zNTwGv1shcC6SJx3dKft3Y63g49diiN2ZR05QOFfZCwn3pqQEdtIo78ydvw50BUmLlJDw0rWsn+tgTZt4gZEf08HetDF9UhjMZS7rOT38bQIq9mzHHRE2BN4ARc6kXqKmUZ+NFQqMIhvq5aZ1keLiDIbbpfmuYqgG+nrI= From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Shawn Anastasio , Alistair Francis , Bob Eshleman , Connor Davis Subject: [PATCH v6 1/3] xen: introduce Kconfig function alignment option Date: Wed, 7 Feb 2024 15:55:45 +0100 Message-ID: <20240207145547.89689-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240207145547.89689-1-roger.pau@citrix.com> References: <20240207145547.89689-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1707317788493100002 And use it to replace CODE_ALIGN in assembly. This allows to generalize the way the code alignment gets set across all architectures. No functional change intended. Signed-off-by: Roger Pau Monn=C3=A9 Acked-by: Shawn Anastasio Reviewed-by: Jan Beulich Reviewed-by: Michal Orzel --- Changes since v5: - New in this version. --- xen/Kconfig | 17 +++++++++++++++++ xen/arch/arm/Kconfig | 1 + xen/arch/arm/include/asm/config.h | 3 +-- xen/arch/ppc/Kconfig | 1 + xen/arch/ppc/include/asm/config.h | 3 --- xen/arch/riscv/Kconfig | 1 + xen/arch/riscv/include/asm/config.h | 1 - xen/arch/x86/Kconfig | 1 + xen/arch/x86/include/asm/config.h | 3 +-- xen/include/xen/linkage.h | 5 +++-- 10 files changed, 26 insertions(+), 10 deletions(-) diff --git a/xen/Kconfig b/xen/Kconfig index 134e6e68ad84..1e1b041fd52f 100644 --- a/xen/Kconfig +++ b/xen/Kconfig @@ -37,6 +37,23 @@ config CC_HAS_VISIBILITY_ATTRIBUTE config CC_SPLIT_SECTIONS bool =20 +# Set code alignment. +# +# Allow setting on a boolean basis, and then convert such selection to an +# integer for the build system and code to consume more easily. +config FUNCTION_ALIGNMENT_4B + bool +config FUNCTION_ALIGNMENT_8B + bool +config FUNCTION_ALIGNMENT_16B + bool +config FUNCTION_ALIGNMENT + int + default 16 if FUNCTION_ALIGNMENT_16B + default 8 if FUNCTION_ALIGNMENT_8B + default 4 if FUNCTION_ALIGNMENT_4B + default 0 + source "arch/$(SRCARCH)/Kconfig" =20 config DEFCONFIG_LIST diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index 50e9bfae1ac8..80fb5b14f04e 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -16,6 +16,7 @@ config ARM select HAS_PASSTHROUGH select HAS_UBSAN select IOMMU_FORCE_PT_SHARE + select FUNCTION_ALIGNMENT_4B =20 config ARCH_DEFCONFIG string diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/c= onfig.h index 3b6d829197a4..a2e22b659d53 100644 --- a/xen/arch/arm/include/asm/config.h +++ b/xen/arch/arm/include/asm/config.h @@ -53,8 +53,7 @@ =20 /* Linkage for ARM */ #ifdef __ASSEMBLY__ -#define CODE_ALIGN 4 -#define ALIGN .balign CODE_ALIGN +#define ALIGN .balign CONFIG_FUNCTION_ALIGNMENT #define ENTRY(name) \ .globl name; \ ALIGN; \ diff --git a/xen/arch/ppc/Kconfig b/xen/arch/ppc/Kconfig index ab116ffb2a70..6b3b2bb95f56 100644 --- a/xen/arch/ppc/Kconfig +++ b/xen/arch/ppc/Kconfig @@ -1,6 +1,7 @@ config PPC def_bool y select HAS_DEVICE_TREE + select FUNCTION_ALIGNMENT_4B =20 config PPC64 def_bool y diff --git a/xen/arch/ppc/include/asm/config.h b/xen/arch/ppc/include/asm/c= onfig.h index e5d201e16c50..e0a0abfeb408 100644 --- a/xen/arch/ppc/include/asm/config.h +++ b/xen/arch/ppc/include/asm/config.h @@ -31,9 +31,6 @@ #define INVALID_VCPU_ID MAX_VIRT_CPUS =20 /* Linkage for PPC */ -#ifdef __ASSEMBLY__ -#define CODE_ALIGN 4 -#endif =20 #define XEN_VIRT_START _AC(0xc000000000000000, UL) =20 diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig index f382b36f6c82..b4b354a7786e 100644 --- a/xen/arch/riscv/Kconfig +++ b/xen/arch/riscv/Kconfig @@ -1,5 +1,6 @@ config RISCV def_bool y + select FUNCTION_ALIGNMENT_16B =20 config RISCV_64 def_bool y diff --git a/xen/arch/riscv/include/asm/config.h b/xen/arch/riscv/include/a= sm/config.h index a80cdd4f857c..99ea5635208b 100644 --- a/xen/arch/riscv/include/asm/config.h +++ b/xen/arch/riscv/include/asm/config.h @@ -69,7 +69,6 @@ =20 /* Linkage for RISCV */ #ifdef __ASSEMBLY__ -#define CODE_ALIGN 16 #define CODE_FILL /* empty */ #endif =20 diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index 1acdffc51c22..3dd8f18b46ef 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -29,6 +29,7 @@ config X86 select HAS_UBSAN select HAS_VPCI if HVM select NEEDS_LIBELF + select FUNCTION_ALIGNMENT_16B =20 config ARCH_DEFCONFIG string diff --git a/xen/arch/x86/include/asm/config.h b/xen/arch/x86/include/asm/c= onfig.h index 660246d1dae5..ab7288cb3682 100644 --- a/xen/arch/x86/include/asm/config.h +++ b/xen/arch/x86/include/asm/config.h @@ -43,9 +43,8 @@ =20 /* Linkage for x86 */ #ifdef __ASSEMBLY__ -#define CODE_ALIGN 16 #define CODE_FILL 0x90 -#define ALIGN .align CODE_ALIGN, CODE_FILL +#define ALIGN .align CONFIG_FUNCTION_ALIGNMENT, CODE_FILL #define ENTRY(name) \ ALIGN; \ GLOBAL(name) diff --git a/xen/include/xen/linkage.h b/xen/include/xen/linkage.h index 0997e16810b2..770ae49963b8 100644 --- a/xen/include/xen/linkage.h +++ b/xen/include/xen/linkage.h @@ -41,9 +41,10 @@ */ #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 +# define DO_CODE_ALIGN(align...) LASTARG(CONFIG_FUNCTION_ALIGNMENT, ## ali= gn), \ + CODE_FILL #else -# define DO_CODE_ALIGN(align...) LASTARG(CODE_ALIGN, ## align) +# define DO_CODE_ALIGN(align...) LASTARG(CONFIG_FUNCTION_ALIGNMENT, ## ali= gn) #endif =20 #define FUNC(name, align...) \ --=20 2.43.0