[kvm-unit-tests,v2,09/11] s390x: enable DAT in PGM interrupt handler
diff mbox

Message ID 20180112143417.16743-10-david@redhat.com
State New
Headers show

Commit Message

David Hildenbrand Jan. 12, 2018, 2:34 p.m. UTC
Configure it in setup_vm().

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 lib/s390x/asm/arch_def.h | 2 ++
 lib/s390x/mmu.c          | 4 ++++
 2 files changed, 6 insertions(+)

Patch
diff mbox

diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
index f934120..ac3754e 100644
--- a/lib/s390x/asm/arch_def.h
+++ b/lib/s390x/asm/arch_def.h
@@ -15,6 +15,8 @@  struct psw {
 	uint64_t	addr;
 };
 
+#define PSW_MASK_DAT		0x0400000000000000UL
+
 struct lowcore {
 	uint8_t		pad_0x0000[0x0080 - 0x0000];	/* 0x0000 */
 	uint32_t	ext_int_param;			/* 0x0080 */
diff --git a/lib/s390x/mmu.c b/lib/s390x/mmu.c
index 9febb18..be0358f 100644
--- a/lib/s390x/mmu.c
+++ b/lib/s390x/mmu.c
@@ -47,6 +47,7 @@  void configure_dat(int enable)
 
 static void mmu_enable(pgd_t *pgtable)
 {
+	struct lowcore *lc = NULL;
 	const uint64_t asce = __pa(pgtable) | ASCE_DT_REGION1 |
 			      REGION_TABLE_LENGTH;
 
@@ -56,6 +57,9 @@  static void mmu_enable(pgd_t *pgtable)
 
 	/* enable dat (primary == 0 set as default) */
 	configure_dat(1);
+
+	/* we can now also use DAT unconditionally in our PGM handler */
+	lc->pgm_new_psw.mask |= PSW_MASK_DAT;
 }
 
 static pteval_t *get_pte(pgd_t *pgtable, uintptr_t vaddr)