diff options
-rw-r--r-- | arch/s390/mm/mem_detect.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/arch/s390/mm/mem_detect.c b/arch/s390/mm/mem_detect.c index fb216e11c25d..854c08448de1 100644 --- a/arch/s390/mm/mem_detect.c +++ b/arch/s390/mm/mem_detect.c | |||
@@ -50,16 +50,28 @@ void detect_memory_layout(struct mem_chunk chunk[]) | |||
50 | unsigned long flags, flags_dat, cr0; | 50 | unsigned long flags, flags_dat, cr0; |
51 | 51 | ||
52 | memset(chunk, 0, MEMORY_CHUNKS * sizeof(struct mem_chunk)); | 52 | memset(chunk, 0, MEMORY_CHUNKS * sizeof(struct mem_chunk)); |
53 | /* Disable IRQs, DAT and low address protection so tprot does the | 53 | /* |
54 | * Disable IRQs, DAT and low address protection so tprot does the | ||
54 | * right thing and we don't get scheduled away with low address | 55 | * right thing and we don't get scheduled away with low address |
55 | * protection disabled. | 56 | * protection disabled. |
56 | */ | 57 | */ |
57 | local_irq_save(flags); | 58 | local_irq_save(flags); |
58 | flags_dat = __arch_local_irq_stnsm(0xfb); | 59 | flags_dat = __arch_local_irq_stnsm(0xfb); |
60 | /* | ||
61 | * In case DAT was enabled, make sure chunk doesn't reside in vmalloc | ||
62 | * space. We have disabled DAT and any access to vmalloc area will | ||
63 | * cause an exception. | ||
64 | * If DAT was disabled we are called from early ipl code. | ||
65 | */ | ||
66 | if (test_bit(5, &flags_dat)) { | ||
67 | if (WARN_ON_ONCE(is_vmalloc_or_module_addr(chunk))) | ||
68 | goto out; | ||
69 | } | ||
59 | __ctl_store(cr0, 0, 0); | 70 | __ctl_store(cr0, 0, 0); |
60 | __ctl_clear_bit(0, 28); | 71 | __ctl_clear_bit(0, 28); |
61 | find_memory_chunks(chunk); | 72 | find_memory_chunks(chunk); |
62 | __ctl_load(cr0, 0, 0); | 73 | __ctl_load(cr0, 0, 0); |
74 | out: | ||
63 | __arch_local_irq_ssm(flags_dat); | 75 | __arch_local_irq_ssm(flags_dat); |
64 | local_irq_restore(flags); | 76 | local_irq_restore(flags); |
65 | } | 77 | } |