Skip to content

Commit 5462ade

Browse files
kirylhansendc
authored andcommitted
x86/boot: Centralize __pa()/__va() definitions
Replace multiple __pa()/__va() definitions with a single one in misc.h. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Mike Rapoport <rppt@linux.ibm.com> Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com> Link: https://lore.kernel.org/all/20230330114956.20342-2-kirill.shutemov%40linux.intel.com
1 parent 89d7971 commit 5462ade

3 files changed

Lines changed: 9 additions & 10 deletions

File tree

arch/x86/boot/compressed/ident_map_64.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@
88
* Copyright (C) 2016 Kees Cook
99
*/
1010

11-
/*
12-
* Since we're dealing with identity mappings, physical and virtual
13-
* addresses are the same, so override these defines which are ultimately
14-
* used by the headers in misc.h.
15-
*/
16-
#define __pa(x) ((unsigned long)(x))
17-
#define __va(x) ((void *)((unsigned long)(x)))
18-
1911
/* No PAGE_TABLE_ISOLATION support needed either: */
2012
#undef CONFIG_PAGE_TABLE_ISOLATION
2113

arch/x86/boot/compressed/misc.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@
1919
/* cpu_feature_enabled() cannot be used this early */
2020
#define USE_EARLY_PGTABLE_L5
2121

22+
/*
23+
* Boot stub deals with identity mappings, physical and virtual addresses are
24+
* the same, so override these defines.
25+
*
26+
* <asm/page.h> will not define them if they are already defined.
27+
*/
28+
#define __pa(x) ((unsigned long)(x))
29+
#define __va(x) ((void *)((unsigned long)(x)))
30+
2231
#include <linux/linkage.h>
2332
#include <linux/screen_info.h>
2433
#include <linux/elf.h>

arch/x86/boot/compressed/sev.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ static enum es_result vc_read_mem(struct es_em_ctxt *ctxt,
104104
}
105105

106106
#undef __init
107-
#undef __pa
108107
#define __init
109-
#define __pa(x) ((unsigned long)(x))
110108

111109
#define __BOOT_COMPRESSED
112110

0 commit comments

Comments
 (0)