aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorGravatar Ingo Molnar <mingo@kernel.org> 2024-02-27 10:09:49 +0100
committerGravatar Ingo Molnar <mingo@kernel.org> 2024-02-27 10:09:49 +0100
commit9b9c280b9af2aa851d83e7d0b79f36a3d869d745 (patch)
treeb61cf8566669d9615234e87696a833ee487e2655 /arch/x86/mm
parentx86/apic: Build the x86 topology enumeration functions on UP APIC builds too (diff)
parentx86/bugs: Use fixed addressing for VERW operand (diff)
downloadlinux-9b9c280b9af2aa851d83e7d0b79f36a3d869d745.tar.gz
linux-9b9c280b9af2aa851d83e7d0b79f36a3d869d745.tar.bz2
linux-9b9c280b9af2aa851d83e7d0b79f36a3d869d745.zip
Merge branch 'x86/urgent' into x86/apic, to resolve conflicts
Conflicts: arch/x86/kernel/cpu/common.c arch/x86/kernel/cpu/intel.c Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/ident_map.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/arch/x86/mm/ident_map.c b/arch/x86/mm/ident_map.c
index 968d7005f4a7..f50cc210a981 100644
--- a/arch/x86/mm/ident_map.c
+++ b/arch/x86/mm/ident_map.c
@@ -26,18 +26,31 @@ static int ident_pud_init(struct x86_mapping_info *info, pud_t *pud_page,
for (; addr < end; addr = next) {
pud_t *pud = pud_page + pud_index(addr);
pmd_t *pmd;
+ bool use_gbpage;
next = (addr & PUD_MASK) + PUD_SIZE;
if (next > end)
next = end;
- if (info->direct_gbpages) {
- pud_t pudval;
+ /* if this is already a gbpage, this portion is already mapped */
+ if (pud_large(*pud))
+ continue;
+
+ /* Is using a gbpage allowed? */
+ use_gbpage = info->direct_gbpages;
- if (pud_present(*pud))
- continue;
+ /* Don't use gbpage if it maps more than the requested region. */
+ /* at the begining: */
+ use_gbpage &= ((addr & ~PUD_MASK) == 0);
+ /* ... or at the end: */
+ use_gbpage &= ((next & ~PUD_MASK) == 0);
+
+ /* Never overwrite existing mappings */
+ use_gbpage &= !pud_present(*pud);
+
+ if (use_gbpage) {
+ pud_t pudval;
- addr &= PUD_MASK;
pudval = __pud((addr - info->offset) | info->page_flag);
set_pud(pud, pudval);
continue;