Skip to content

Commit d9d7677

Browse files
committed
Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 mm updates from Ingo Molnar: "A handful of changes: - two memory encryption related fixes - don't display the kernel's virtual memory layout plaintext on 32-bit kernels either - two simplifications" * 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/mm: Remove the now redundant N_MEMORY check dma-mapping: Fix dma_pgprot() for unencrypted coherent pages x86: Don't let pgprot_modify() change the page encryption bit x86/mm/kmmio: Use this_cpu_ptr() instead get_cpu_var() for kmmio_ctx x86/mm/init/32: Stop printing the virtual memory layout
2 parents 7cc7e93 + aa61ee7 commit d9d7677

File tree

6 files changed

+12
-50
lines changed

6 files changed

+12
-50
lines changed

arch/x86/include/asm/pgtable.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,12 +621,15 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
621621
return __pmd(val);
622622
}
623623

624-
/* mprotect needs to preserve PAT bits when updating vm_page_prot */
624+
/*
625+
* mprotect needs to preserve PAT and encryption bits when updating
626+
* vm_page_prot
627+
*/
625628
#define pgprot_modify pgprot_modify
626629
static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
627630
{
628631
pgprotval_t preservebits = pgprot_val(oldprot) & _PAGE_CHG_MASK;
629-
pgprotval_t addbits = pgprot_val(newprot);
632+
pgprotval_t addbits = pgprot_val(newprot) & ~_PAGE_CHG_MASK;
630633
return __pgprot(preservebits | addbits);
631634
}
632635

arch/x86/include/asm/pgtable_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
*/
119119
#define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \
120120
_PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY | \
121-
_PAGE_SOFT_DIRTY | _PAGE_DEVMAP)
121+
_PAGE_SOFT_DIRTY | _PAGE_DEVMAP | _PAGE_ENC)
122122
#define _HPAGE_CHG_MASK (_PAGE_CHG_MASK | _PAGE_PSE)
123123

124124
/*

arch/x86/mm/init_32.c

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -788,44 +788,6 @@ void __init mem_init(void)
788788
x86_init.hyper.init_after_bootmem();
789789

790790
mem_init_print_info(NULL);
791-
printk(KERN_INFO "virtual kernel memory layout:\n"
792-
" fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
793-
" cpu_entry : 0x%08lx - 0x%08lx (%4ld kB)\n"
794-
#ifdef CONFIG_HIGHMEM
795-
" pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
796-
#endif
797-
" vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
798-
" lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n"
799-
" .init : 0x%08lx - 0x%08lx (%4ld kB)\n"
800-
" .data : 0x%08lx - 0x%08lx (%4ld kB)\n"
801-
" .text : 0x%08lx - 0x%08lx (%4ld kB)\n",
802-
FIXADDR_START, FIXADDR_TOP,
803-
(FIXADDR_TOP - FIXADDR_START) >> 10,
804-
805-
CPU_ENTRY_AREA_BASE,
806-
CPU_ENTRY_AREA_BASE + CPU_ENTRY_AREA_MAP_SIZE,
807-
CPU_ENTRY_AREA_MAP_SIZE >> 10,
808-
809-
#ifdef CONFIG_HIGHMEM
810-
PKMAP_BASE, PKMAP_BASE+LAST_PKMAP*PAGE_SIZE,
811-
(LAST_PKMAP*PAGE_SIZE) >> 10,
812-
#endif
813-
814-
VMALLOC_START, VMALLOC_END,
815-
(VMALLOC_END - VMALLOC_START) >> 20,
816-
817-
(unsigned long)__va(0), (unsigned long)high_memory,
818-
((unsigned long)high_memory - (unsigned long)__va(0)) >> 20,
819-
820-
(unsigned long)&__init_begin, (unsigned long)&__init_end,
821-
((unsigned long)&__init_end -
822-
(unsigned long)&__init_begin) >> 10,
823-
824-
(unsigned long)&_etext, (unsigned long)&_edata,
825-
((unsigned long)&_edata - (unsigned long)&_etext) >> 10,
826-
827-
(unsigned long)&_text, (unsigned long)&_etext,
828-
((unsigned long)&_etext - (unsigned long)&_text) >> 10);
829791

830792
/*
831793
* Check boundaries twice: Some fundamental inconsistencies can

arch/x86/mm/init_64.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,7 @@ void __init paging_init(void)
818818
* will not set it back.
819819
*/
820820
node_clear_state(0, N_MEMORY);
821-
if (N_MEMORY != N_NORMAL_MEMORY)
822-
node_clear_state(0, N_NORMAL_MEMORY);
821+
node_clear_state(0, N_NORMAL_MEMORY);
823822

824823
zone_sizes_init();
825824
}

arch/x86/mm/kmmio.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ int kmmio_handler(struct pt_regs *regs, unsigned long addr)
260260
goto no_kmmio;
261261
}
262262

263-
ctx = &get_cpu_var(kmmio_ctx);
263+
ctx = this_cpu_ptr(&kmmio_ctx);
264264
if (ctx->active) {
265265
if (page_base == ctx->addr) {
266266
/*
@@ -285,7 +285,7 @@ int kmmio_handler(struct pt_regs *regs, unsigned long addr)
285285
pr_emerg("previous hit was at 0x%08lx.\n", ctx->addr);
286286
disarm_kmmio_fault_page(faultpage);
287287
}
288-
goto no_kmmio_ctx;
288+
goto no_kmmio;
289289
}
290290
ctx->active++;
291291

@@ -314,11 +314,8 @@ int kmmio_handler(struct pt_regs *regs, unsigned long addr)
314314
* the user should drop to single cpu before tracing.
315315
*/
316316

317-
put_cpu_var(kmmio_ctx);
318317
return 1; /* fault handled */
319318

320-
no_kmmio_ctx:
321-
put_cpu_var(kmmio_ctx);
322319
no_kmmio:
323320
rcu_read_unlock();
324321
preempt_enable_no_resched();
@@ -333,7 +330,7 @@ int kmmio_handler(struct pt_regs *regs, unsigned long addr)
333330
static int post_kmmio_handler(unsigned long condition, struct pt_regs *regs)
334331
{
335332
int ret = 0;
336-
struct kmmio_context *ctx = &get_cpu_var(kmmio_ctx);
333+
struct kmmio_context *ctx = this_cpu_ptr(&kmmio_ctx);
337334

338335
if (!ctx->active) {
339336
/*
@@ -371,7 +368,6 @@ static int post_kmmio_handler(unsigned long condition, struct pt_regs *regs)
371368
if (!(regs->flags & X86_EFLAGS_TF))
372369
ret = 1;
373370
out:
374-
put_cpu_var(kmmio_ctx);
375371
return ret;
376372
}
377373

kernel/dma/mapping.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ EXPORT_SYMBOL(dma_get_sgtable_attrs);
154154
*/
155155
pgprot_t dma_pgprot(struct device *dev, pgprot_t prot, unsigned long attrs)
156156
{
157+
if (force_dma_unencrypted(dev))
158+
prot = pgprot_decrypted(prot);
157159
if (dev_is_dma_coherent(dev) ||
158160
(IS_ENABLED(CONFIG_DMA_NONCOHERENT_CACHE_SYNC) &&
159161
(attrs & DMA_ATTR_NON_CONSISTENT)))

0 commit comments

Comments
 (0)