[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d167bf69-64f7-4b7b-81ee-054f05d39c98@suse.com>
Date: Wed, 13 Mar 2024 12:29:37 +0200
From: Nikolay Borisov <nik.borisov@...e.com>
To: Wei Yang <richard.weiyang@...il.com>, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com
Cc: x86@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/4] x86/boot: replace __PHYSICAL_START with
LOAD_PHYSICAL_ADDR
On 13.03.24 г. 9:58 ч., Wei Yang wrote:
> Both __PHYSICAL_START and LOAD_PHYSICAL_ADDR are defined to get aligned
> CONFIG_PHYSICAL_START, so we can replace __PHYSICAL_START with
> LOAD_PHYSICAL_ADDR. And then remove the definition of __PHYSICAL_START,
> which is only used to define __START_KERNEL.
>
> Since <asm/boot.h> includes <asm/pgtable_types.h>, which includes
> <asm/page_types.h>, it is fine to move definition from <asm/boot.h> to
> <asm/page_types.h>.
>
> Signed-off-by: Wei Yang <richard.weiyang@...il.com>
> ---
> arch/x86/include/asm/boot.h | 5 -----
> arch/x86/include/asm/page_types.h | 8 +++++---
> 2 files changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/include/asm/boot.h b/arch/x86/include/asm/boot.h
> index a38cc0afc90a..12cbc57d0128 100644
> --- a/arch/x86/include/asm/boot.h
> +++ b/arch/x86/include/asm/boot.h
> @@ -6,11 +6,6 @@
> #include <asm/pgtable_types.h>
> #include <uapi/asm/boot.h>
>
> -/* Physical address where kernel should be loaded. */
> -#define LOAD_PHYSICAL_ADDR ((CONFIG_PHYSICAL_START \
> - + (CONFIG_PHYSICAL_ALIGN - 1)) \
> - & ~(CONFIG_PHYSICAL_ALIGN - 1))
> -
> /* Minimum kernel alignment, as a power of two */
> #ifdef CONFIG_X86_64
> # define MIN_KERNEL_ALIGN_LG2 PMD_SHIFT
> diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h
> index 86bd4311daf8..acc1620fd121 100644
> --- a/arch/x86/include/asm/page_types.h
> +++ b/arch/x86/include/asm/page_types.h
> @@ -31,10 +31,12 @@
>
> #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_TSK_EXEC
>
> -#define __PHYSICAL_START ALIGN(CONFIG_PHYSICAL_START, \
> - CONFIG_PHYSICAL_ALIGN)
> +/* Physical address where kernel should be loaded. */
> +#define LOAD_PHYSICAL_ADDR ((CONFIG_PHYSICAL_START \
> + + (CONFIG_PHYSICAL_ALIGN - 1)) \
> + & ~(CONFIG_PHYSICAL_ALIGN - 1))
Why don't you simply define LOAD_PHYSICAL_ADDR via
ALIGN(CONFIG_PHYSICAL_START, CONFIG_PHYSICAL_ALING) it's way more readable.
>
> -#define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START)
> +#define __START_KERNEL (__START_KERNEL_map + LOAD_PHYSICAL_ADDR)
>
> #ifdef CONFIG_X86_64
> #include <asm/page_64_types.h>
Powered by blists - more mailing lists