AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/10/24 05:55 flow patch-triage
0m Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "KMSANReasoning": "",
  "NeedsKMSAN": false,
  "Reasoning": "The patch exclusively modifies s390 KVM and guest memory management (gmap/dat) code located entirely within arch/s390/kvm/. Since the target architecture is amd64 (x86_64), the modified code paths are exclusive to s390 and are structurally unreachable on amd64.",
  "WorthFuzzing": false
}

1/1 2026/10/24 05:55 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 529dc80a29bf24c5f73696e7115f3bb40f40620e\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Sat Oct 24 05:55:16 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/arch/s390/kvm/gmap/dat.c b/arch/s390/kvm/gmap/dat.c\nindex ff80d02c9f564..807a4ef84a072 100644\n--- a/arch/s390/kvm/gmap/dat.c\n+++ b/arch/s390/kvm/gmap/dat.c\n@@ -102,34 +102,37 @@ void dat_free_level(struct crst_table *table, bool owns_ptes)\n \tdat_free_crst(table);\n }\n \n-int dat_set_asce_limit(struct kvm_s390_mmu_cache *mc, union asce *asce, int newtype)\n+int dat_set_asce_limit(struct kvm_s390_mmu_cache *mc, struct dat_tables *datt, int newtype)\n {\n \tstruct crst_table *table;\n \tunion crste crste;\n \n-\twhile (asce-\u003edt \u003e newtype) {\n-\t\ttable = dereference_asce(*asce);\n+\twhile (datt-\u003easce.dt \u003e newtype) {\n+\t\ttable = datt-\u003etable;\n \t\tcrste = table-\u003ecrstes[0];\n \t\tif (crste.h.fc)\n \t\t\treturn 0;\n \t\tif (!crste.h.i) {\n-\t\t\tasce-\u003ersto = crste.h.fc0.to;\n+\t\t\tdatt-\u003easce.rsto = crste.h.fc0.to;\n \t\t\tdat_free_crst(table);\n+\t\t\tdatt-\u003etable = phys_to_virt(datt-\u003easce.val \u0026 _ASCE_ORIGIN);\n \t\t} else {\n \t\t\tcrste.h.tt--;\n \t\t\tcrst_table_init((void *)table, crste.val);\n \t\t}\n-\t\tasce-\u003edt--;\n+\t\tdatt-\u003easce.dt--;\n \t}\n-\twhile (asce-\u003edt \u003c newtype) {\n-\t\tcrste = _crste_fc0(asce-\u003ersto, asce-\u003edt + 1);\n+\twhile (datt-\u003easce.dt \u003c newtype) {\n+\t\tcrste = _crste_fc0(datt-\u003easce.rsto, datt-\u003easce.dt + 1);\n \t\ttable = dat_alloc_crst_noinit(mc);\n \t\tif (!table)\n \t\t\treturn -ENOMEM;\n \t\tcrst_table_init((void *)table, _CRSTE_HOLE(crste.h.tt).val);\n \t\ttable-\u003ecrstes[0] = crste;\n-\t\tasce-\u003ersto = __pa(table) \u003e\u003e PAGE_SHIFT;\n-\t\tasce-\u003edt++;\n+\n+\t\tdatt-\u003easce.rsto = __pa(table) \u003e\u003e PAGE_SHIFT;\n+\t\tdatt-\u003easce.dt++;\n+\t\tdatt-\u003etable = table;\n \t}\n \treturn 0;\n }\n@@ -159,34 +162,8 @@ bool __must_check dat_crstep_xchg_atomic(union crste *crstep, union crste old, u\n \treturn cspg_crste(crstep, old, new);\n }\n \n-static void dat_set_storage_key_from_pgste(union pte pte, union pgste pgste)\n-{\n-\tunion skey nkey = { .acc = pgste.acc, .fp = pgste.fp };\n-\n-\tpage_set_storage_key(pte_origin(pte), nkey.skey, 0);\n-}\n-\n-static void dat_move_storage_key(union pte old, union pte new)\n-{\n-\tpage_set_storage_key(pte_origin(new), page_get_storage_key(pte_origin(old)), 1);\n-}\n-\n-static union pgste dat_save_storage_key_into_pgste(union pte pte, union pgste pgste)\n-{\n-\tunion skey skey;\n-\n-\tskey.skey = page_get_storage_key(pte_origin(pte));\n-\n-\tpgste.acc = skey.acc;\n-\tpgste.fp = skey.fp;\n-\tpgste.gr |= skey.r;\n-\tpgste.gc |= skey.c;\n-\n-\treturn pgste;\n-}\n-\n union pgste __dat_ptep_xchg(union pte *ptep, union pgste pgste, union pte new, gfn_t gfn,\n-\t\t\t    union asce asce, bool uses_skeys)\n+\t\t\t    struct dat_tables datt)\n {\n \tunion pte old = READ_ONCE(*ptep);\n \n@@ -200,12 +177,13 @@ union pgste __dat_ptep_xchg(union pte *ptep, union pgste pgste, union pte new, g\n \t\tunsigned long opts = IPTE_GUEST_ASCE | (pgste.nodat ? IPTE_NODAT : 0);\n \n \t\tif (machine_has_tlb_guest())\n-\t\t\t__ptep_ipte(gfn_to_gpa(gfn), (void *)ptep, opts, asce.val, IPTE_GLOBAL);\n+\t\t\t__ptep_ipte(gfn_to_gpa(gfn), (void *)ptep, opts,\n+\t\t\t\t    datt.asce.val, IPTE_GLOBAL);\n \t\telse\n \t\t\t__ptep_ipte(gfn_to_gpa(gfn), (void *)ptep, 0, 0, IPTE_GLOBAL);\n \t}\n \n-\tif (uses_skeys) {\n+\tif (datt.uses_skeys) {\n \t\tif (old.h.i \u0026\u0026 !new.h.i)\n \t\t\t/* Invalid to valid: restore storage keys from PGSTE. */\n \t\t\tdat_set_storage_key_from_pgste(new, pgste);\n@@ -231,7 +209,7 @@ union pgste __dat_ptep_xchg(union pte *ptep, union pgste pgste, union pte new, g\n  * Return: 0 in case of success, -ENOMEM if running out of memory.\n  */\n static int dat_split_ste(struct kvm_s390_mmu_cache *mc, union pmd *pmdp, gfn_t gfn,\n-\t\t\t union asce asce, bool uses_skeys)\n+\t\t\t struct dat_tables datt)\n {\n \tunion pgste pgste_init;\n \tstruct page_table *pt;\n@@ -260,21 +238,21 @@ static int dat_split_ste(struct kvm_s390_mmu_cache *mc, union pmd *pmdp, gfn_t g\n \t\tinit.s.y = old.s.fc1.y;\n \t\tinit.s.sd = old.s.fc1.sd;\n \t\tinit.s.pr = old.s.fc1.pr;\n+\t\tinit.s.prefix_notif = old.s.fc1.prefix_notif;\n \t\tpgste_init.val = 0;\n \t\tif (old.h.fc) {\n \t\t\tfor (i = 0; i \u003c _PAGE_ENTRIES; i++)\n \t\t\t\tpt-\u003eptes[i].val = init.val | i * PAGE_SIZE;\n \t\t\t/* No need to take locks as the page table is not installed yet. */\n-\t\t\tpgste_init.prefix_notif = old.s.fc1.prefix_notif;\n \t\t\tpgste_init.vsie_notif = old.s.fc1.vsie_notif;\n \t\t\tpgste_init.vsie_gmem = old.s.fc1.vsie_notif;\n-\t\t\tpgste_init.pcl = uses_skeys \u0026\u0026 init.h.i;\n+\t\t\tpgste_init.pcl = datt.uses_skeys \u0026\u0026 init.h.i;\n \t\t\tdat_init_pgstes(pt, pgste_init.val);\n \t\t} else {\n \t\t\tdat_init_page_table(pt, init.val, 0);\n \t\t}\n \n-\t\tif (dat_pmdp_xchg_atomic(pmdp, old, new, gfn, asce)) {\n+\t\tif (dat_pmdp_xchg_atomic(pmdp, old, new, gfn, datt.asce)) {\n \t\t\tif (!pgste_init.pcl)\n \t\t\t\treturn 0;\n \t\t\tfor (i = 0; i \u003c _PAGE_ENTRIES; i++) {\n@@ -300,7 +278,7 @@ static int dat_split_ste(struct kvm_s390_mmu_cache *mc, union pmd *pmdp, gfn_t g\n  * Return: %0 in case of success, %-ENOMEM if running out of memory.\n  */\n static int dat_split_crste(struct kvm_s390_mmu_cache *mc, union crste *crstep,\n-\t\t\t   gfn_t gfn, union asce asce, bool uses_skeys)\n+\t\t\t   gfn_t gfn, struct dat_tables datt)\n {\n \tstruct crst_table *table;\n \tunion crste old, new, init;\n@@ -308,7 +286,7 @@ static int dat_split_crste(struct kvm_s390_mmu_cache *mc, union crste *crstep,\n \n \told = READ_ONCE(*crstep);\n \tif (is_pmd(old))\n-\t\treturn dat_split_ste(mc, \u0026crstep-\u003epmd, gfn, asce, uses_skeys);\n+\t\treturn dat_split_ste(mc, \u0026crstep-\u003epmd, gfn, datt);\n \n \tBUG_ON(!mc);\n \n@@ -333,7 +311,7 @@ static int dat_split_crste(struct kvm_s390_mmu_cache *mc, union crste *crstep,\n \t\t} else {\n \t\t\tcrst_table_init((void *)table, init.val);\n \t\t}\n-\t\tif (dat_crstep_xchg_atomic(crstep, old, new, gfn, asce))\n+\t\tif (dat_crstep_xchg_atomic(crstep, old, new, gfn, datt.asce))\n \t\t\treturn 0;\n \t\told = READ_ONCE(*crstep);\n \t}\n@@ -347,7 +325,7 @@ static int dat_split_crste(struct kvm_s390_mmu_cache *mc, union crste *crstep,\n  * @mc: Cache to use to allocate dat tables, if needed; can be NULL if neither\n  *      %DAT_WALK_SPLIT or %DAT_WALK_ALLOC is specified in @flags.\n  * @gfn: Guest frame.\n- * @asce: The ASCE of the address space.\n+ * @datt: The DAT tables of the address space.\n  * @flags: Flags from WALK_* macros.\n  * @walk_level: Level to walk to, from LEVEL_* macros.\n  * @last: Will be filled the last visited non-pte DAT entry.\n@@ -363,7 +341,6 @@ static int dat_split_crste(struct kvm_s390_mmu_cache *mc, union crste *crstep,\n  * * %DAT_WALK_ANY: return successfully even if the requested level could not be reached\n  * * %DAT_WALK_CONTINUE: walk to the requested level with the specified flags, and then try to\n  *                       continue walking to ptes with only DAT_WALK_ANY\n- * * %DAT_WALK_USES_SKEYS: storage keys are in use\n  *\n  * Context: called with kvm-\u003emmu_lock held.\n  *\n@@ -376,12 +353,11 @@ static int dat_split_crste(struct kvm_s390_mmu_cache *mc, union crste *crstep,\n  * * %-ENOENT if the requested level could not be reached for other reasons\n  * * %-ENOMEM if running out of memory while allocating or splitting a table\n  */\n-int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, int flags,\n+int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, struct dat_tables datt, int flags,\n \t\t   int walk_level, union crste **last, union pte **ptepp)\n {\n \tunion vaddress vaddr = { .addr = gfn_to_gpa(gfn) };\n \tbool continue_anyway = flags \u0026 DAT_WALK_CONTINUE;\n-\tbool uses_skeys = flags \u0026 DAT_WALK_USES_SKEYS;\n \tbool ign_holes = flags \u0026 DAT_WALK_IGN_HOLES;\n \tbool allocate = flags \u0026 DAT_WALK_ALLOC;\n \tbool split = flags \u0026 DAT_WALK_SPLIT;\n@@ -394,15 +370,15 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in\n \n \t*last = NULL;\n \t*ptepp = NULL;\n-\tif (WARN_ON_ONCE(unlikely(!asce.val)))\n+\tif (WARN_ON_ONCE(unlikely(!datt.asce.val)))\n \t\treturn -EINVAL;\n-\tif (WARN_ON_ONCE(unlikely(walk_level \u003e asce.dt)))\n+\tif (WARN_ON_ONCE(unlikely(walk_level \u003e datt.asce.dt)))\n \t\treturn -EINVAL;\n-\tif (!asce_contains_gfn(asce, gfn))\n+\tif (!dat_tables_contain_gfn(datt, gfn))\n \t\treturn PGM_ADDRESSING;\n \n-\ttable = dereference_asce(asce);\n-\tif (asce.dt \u003e= ASCE_TYPE_REGION1) {\n+\ttable = datt.table;\n+\tif (datt.asce.dt \u003e= ASCE_TYPE_REGION1) {\n \t\t*last = table-\u003ecrstes + vaddr.rfx;\n \t\tentry = READ_ONCE(**last);\n \t\tif (WARN_ON_ONCE(entry.h.tt != TABLE_TYPE_REGION1))\n@@ -414,7 +390,7 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in\n \t\tif (entry.pgd.h.i) {\n \t\t\tif (!allocate)\n \t\t\t\treturn any ? 0 : -ENOENT;\n-\t\t\trc = dat_split_crste(mc, *last, gfn, asce, uses_skeys);\n+\t\t\trc = dat_split_crste(mc, *last, gfn, datt);\n \t\t\tif (rc)\n \t\t\t\treturn rc;\n \t\t\tentry = READ_ONCE(**last);\n@@ -422,7 +398,7 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in\n \t\ttable = dereference_crste(entry.pgd);\n \t}\n \n-\tif (asce.dt \u003e= ASCE_TYPE_REGION2) {\n+\tif (datt.asce.dt \u003e= ASCE_TYPE_REGION2) {\n \t\t*last = table-\u003ecrstes + vaddr.rsx;\n \t\tentry = READ_ONCE(**last);\n \t\tif (WARN_ON_ONCE(entry.h.tt != TABLE_TYPE_REGION2))\n@@ -434,7 +410,7 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in\n \t\tif (entry.p4d.h.i) {\n \t\t\tif (!allocate)\n \t\t\t\treturn any ? 0 : -ENOENT;\n-\t\t\trc = dat_split_crste(mc, *last, gfn, asce, uses_skeys);\n+\t\t\trc = dat_split_crste(mc, *last, gfn, datt);\n \t\t\tif (rc)\n \t\t\t\treturn rc;\n \t\t\tentry = READ_ONCE(**last);\n@@ -442,7 +418,7 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in\n \t\ttable = dereference_crste(entry.p4d);\n \t}\n \n-\tif (asce.dt \u003e= ASCE_TYPE_REGION3) {\n+\tif (datt.asce.dt \u003e= ASCE_TYPE_REGION3) {\n \t\t*last = table-\u003ecrstes + vaddr.rtx;\n \t\tentry = READ_ONCE(**last);\n \t\tif (WARN_ON_ONCE(entry.h.tt != TABLE_TYPE_REGION3))\n@@ -459,7 +435,7 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in\n \t\tif (entry.pud.h.i \u0026\u0026 !entry.pud.h.fc) {\n \t\t\tif (!allocate)\n \t\t\t\treturn any ? 0 : -ENOENT;\n-\t\t\trc = dat_split_crste(mc, *last, gfn, asce, uses_skeys);\n+\t\t\trc = dat_split_crste(mc, *last, gfn, datt);\n \t\t\tif (rc)\n \t\t\t\treturn rc;\n \t\t\tentry = READ_ONCE(**last);\n@@ -467,7 +443,7 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in\n \t\tif (walk_level \u003c= TABLE_TYPE_SEGMENT \u0026\u0026 entry.pud.h.fc) {\n \t\t\tif (!split)\n \t\t\t\treturn -EFBIG;\n-\t\t\trc = dat_split_crste(mc, *last, gfn, asce, uses_skeys);\n+\t\t\trc = dat_split_crste(mc, *last, gfn, datt);\n \t\t\tif (rc)\n \t\t\t\treturn rc;\n \t\t\tentry = READ_ONCE(**last);\n@@ -491,7 +467,7 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in\n \tif (entry.pmd.h.i \u0026\u0026 !entry.pmd.h.fc) {\n \t\tif (!allocate)\n \t\t\treturn any ? 0 : -ENOENT;\n-\t\trc = dat_split_ste(mc, \u0026(*last)-\u003epmd, gfn, asce, uses_skeys);\n+\t\trc = dat_split_ste(mc, \u0026(*last)-\u003epmd, gfn, datt);\n \t\tif (rc)\n \t\t\treturn rc;\n \t\tentry = READ_ONCE(**last);\n@@ -499,7 +475,7 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in\n \tif (walk_level \u003c= TABLE_TYPE_PAGE_TABLE \u0026\u0026 entry.pmd.h.fc) {\n \t\tif (!split)\n \t\t\treturn -EFBIG;\n-\t\trc = dat_split_ste(mc, \u0026(*last)-\u003epmd, gfn, asce, uses_skeys);\n+\t\trc = dat_split_ste(mc, \u0026(*last)-\u003epmd, gfn, datt);\n \t\tif (rc)\n \t\t\treturn rc;\n \t\tentry = READ_ONCE(**last);\n@@ -581,7 +557,7 @@ static long dat_crste_walk_range(gfn_t start, gfn_t end, struct crst_table *tabl\n  * _dat_walk_gfn_range() - Walk DAT tables.\n  * @start: The first guest page frame to walk.\n  * @end: The guest page frame immediately after the last one to walk.\n- * @asce: The ASCE of the guest mapping.\n+ * @datt: The DAT tables of the guest mapping.\n  * @ops: The gmap_walk_ops that will be used to perform the walk.\n  * @flags: Flags from WALK_* (currently only WALK_IGN_HOLES is supported).\n  * @priv: Will be passed as-is to the callbacks.\n@@ -592,29 +568,28 @@ static long dat_crste_walk_range(gfn_t start, gfn_t end, struct crst_table *tabl\n  *         given ASCE unless the DAT_WALK_IGN_HOLES flag is specified,\n  *         otherwise it returns whatever the callbacks return.\n  */\n-long _dat_walk_gfn_range(gfn_t start, gfn_t end, union asce asce,\n+long _dat_walk_gfn_range(gfn_t start, gfn_t end, struct dat_tables datt,\n \t\t\t const struct dat_walk_ops *ops, int flags, void *priv)\n {\n-\tstruct crst_table *table = dereference_asce(asce);\n \tstruct dat_walk walk = {\n \t\t.ops\t= ops,\n-\t\t.asce\t= asce,\n+\t\t.datt\t= datt,\n \t\t.priv\t= priv,\n \t\t.flags\t= flags,\n \t\t.start\t= start,\n \t\t.end\t= end,\n \t};\n \n-\tif (WARN_ON_ONCE(unlikely(!asce.val)))\n+\tif (WARN_ON_ONCE(unlikely(!datt.asce.val)))\n \t\treturn -EINVAL;\n-\tif (!asce_contains_gfn(asce, start))\n+\tif (!dat_tables_contain_gfn(datt, start))\n \t\treturn (flags \u0026 DAT_WALK_IGN_HOLES) ? 0 : -EFAULT;\n \n-\treturn dat_crste_walk_range(start, min(end, asce_end(asce)), table, \u0026walk);\n+\treturn dat_crste_walk_range(start, min(end, dat_tables_end(datt)), datt.table, \u0026walk);\n }\n \n #if KVM_S390_MANAGES_S390_GUEST\n-int dat_get_storage_key(union asce asce, gfn_t gfn, union skey *skey)\n+int dat_get_storage_key(struct dat_tables datt, gfn_t gfn, union skey *skey)\n {\n \tunion crste *crstep;\n \tunion pgste pgste;\n@@ -623,7 +598,7 @@ int dat_get_storage_key(union asce asce, gfn_t gfn, union skey *skey)\n \n again:\n \tskey-\u003eskey = 0;\n-\trc = dat_entry_walk(NULL, gfn, asce, DAT_WALK_ANY, TABLE_TYPE_PAGE_TABLE, \u0026crstep, \u0026ptep);\n+\trc = dat_entry_walk(NULL, gfn, datt, DAT_WALK_ANY, TABLE_TYPE_PAGE_TABLE, \u0026crstep, \u0026ptep);\n \tif (rc)\n \t\treturn rc;\n \n@@ -657,7 +632,7 @@ static void dat_update_ptep_sd(union pgste old, union pgste pgste, union pte *pt\n \t\t__atomic64_or(_PAGE_SD, \u0026ptep-\u003eval);\n }\n \n-int dat_set_storage_key(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t gfn,\n+int dat_set_storage_key(struct kvm_s390_mmu_cache *mc, struct dat_tables datt, gfn_t gfn,\n \t\t\tunion skey skey, bool nq)\n {\n \tunion pgste pgste, old;\n@@ -666,7 +641,7 @@ int dat_set_storage_key(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t gf\n \tint rc;\n \n again:\n-\trc = dat_entry_walk(mc, gfn, asce, DAT_WALK_LEAF_ALLOC, TABLE_TYPE_PAGE_TABLE,\n+\trc = dat_entry_walk(mc, gfn, datt, DAT_WALK_LEAF_ALLOC, TABLE_TYPE_PAGE_TABLE,\n \t\t\t    \u0026crstep, \u0026ptep);\n \tif (rc)\n \t\treturn rc;\n@@ -719,7 +694,7 @@ static bool page_cond_set_storage_key(phys_addr_t paddr, union skey skey, union\n \treturn true;\n }\n \n-int dat_cond_set_storage_key(struct kvm_s390_mmu_cache *mmc, union asce asce, gfn_t gfn,\n+int dat_cond_set_storage_key(struct kvm_s390_mmu_cache *mmc, struct dat_tables datt, gfn_t gfn,\n \t\t\t     union skey skey, union skey *oldkey, bool nq, bool mr, bool mc)\n {\n \tunion pgste pgste, old;\n@@ -729,7 +704,7 @@ int dat_cond_set_storage_key(struct kvm_s390_mmu_cache *mmc, union asce asce, gf\n \tint rc;\n \n again:\n-\trc = dat_entry_walk(mmc, gfn, asce, DAT_WALK_LEAF_ALLOC, TABLE_TYPE_PAGE_TABLE,\n+\trc = dat_entry_walk(mmc, gfn, datt, DAT_WALK_LEAF_ALLOC, TABLE_TYPE_PAGE_TABLE,\n \t\t\t    \u0026crstep, \u0026ptep);\n \tif (rc)\n \t\treturn rc;\n@@ -777,7 +752,7 @@ int dat_cond_set_storage_key(struct kvm_s390_mmu_cache *mmc, union asce asce, gf\n \treturn rc;\n }\n \n-int dat_reset_reference_bit(union asce asce, gfn_t gfn, union skey *skey)\n+int dat_reset_reference_bit(struct dat_tables datt, gfn_t gfn, union skey *skey)\n {\n \tunion pgste pgste, old;\n \tunion crste *crstep;\n@@ -786,7 +761,7 @@ int dat_reset_reference_bit(union asce asce, gfn_t gfn, union skey *skey)\n \n \tskey-\u003eskey = 0;\n again:\n-\trc = dat_entry_walk(NULL, gfn, asce, DAT_WALK_ANY, TABLE_TYPE_PAGE_TABLE, \u0026crstep, \u0026ptep);\n+\trc = dat_entry_walk(NULL, gfn, datt, DAT_WALK_ANY, TABLE_TYPE_PAGE_TABLE, \u0026crstep, \u0026ptep);\n \tif (rc)\n \t\treturn rc;\n \n@@ -854,7 +829,7 @@ static long dat_reset_skeys_crste(union crste *crstep, gfn_t gfn, gfn_t next, st\n \treturn 0;\n }\n \n-long dat_reset_skeys(union asce asce, gfn_t start)\n+long dat_reset_skeys(struct dat_tables datt, gfn_t start)\n {\n \tconst struct dat_walk_ops ops = {\n \t\t.pte_entry = dat_reset_skeys_pte,\n@@ -862,7 +837,8 @@ long dat_reset_skeys(union asce asce, gfn_t start)\n \t\t.pud_entry = dat_reset_skeys_crste,\n \t};\n \n-\treturn _dat_walk_gfn_range(start, asce_end(asce), asce, \u0026ops, DAT_WALK_IGN_HOLES, NULL);\n+\treturn _dat_walk_gfn_range(start, dat_tables_end(datt), datt, \u0026ops,\n+\t\t\t\t   DAT_WALK_IGN_HOLES, NULL);\n }\n #endif /* KVM_S390_MANAGES_S390_GUEST */\n \n@@ -878,7 +854,7 @@ static long _dat_slot_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct dat_wal\n \t\treturn 0;\n \n \tpgste = pgste_get_lock(ptep);\n-\tpgste = __dat_ptep_xchg(ptep, pgste, new_pte, gfn, walk-\u003easce, false);\n+\tpgste = __dat_ptep_xchg(ptep, pgste, new_pte, gfn, walk-\u003edatt);\n \tpgste.cmma_d = 0;\n \tpgste_set_unlock(ptep, pgste);\n \n@@ -898,7 +874,7 @@ static long _dat_slot_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct d\n \n \t/* This table entry needs to be updated. */\n \tif (walk-\u003estart \u003c= gfn \u0026\u0026 walk-\u003eend \u003e= next) {\n-\t\tif (!dat_crstep_xchg_atomic(crstep, crste, new_crste, gfn, walk-\u003easce))\n+\t\tif (!dat_crstep_xchg_atomic(crstep, crste, new_crste, gfn, walk-\u003edatt.asce))\n \t\t\treturn -EINVAL;\n \t\t/* A lower level table was present, needs to be freed. */\n \t\tif (!crste.h.fc \u0026\u0026 !crste.h.i) {\n@@ -915,7 +891,7 @@ static long _dat_slot_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct d\n \t\treturn 0;\n \t/* Split (install a lower level table), and handle things there. */\n \tif (mc)\n-\t\treturn dat_split_crste(mc, crstep, gfn, walk-\u003easce, false);\n+\t\treturn dat_split_crste(mc, crstep, gfn, walk-\u003edatt);\n \t/* A large page should never cross memslots boundaries */\n \treturn -EINVAL;\n }\n@@ -925,9 +901,9 @@ static const struct dat_walk_ops dat_slot_ops = {\n \t.crste_ops = { _dat_slot_crste, _dat_slot_crste, _dat_slot_crste, _dat_slot_crste, },\n };\n \n-int dat_set_slot(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t start, gfn_t end)\n+int dat_set_slot(struct kvm_s390_mmu_cache *mc, struct dat_tables datt, gfn_t start, gfn_t end)\n {\n-\treturn _dat_walk_gfn_range(start, end, asce, \u0026dat_slot_ops,\n+\treturn _dat_walk_gfn_range(start, end, datt, \u0026dat_slot_ops,\n \t\t\t\t   DAT_WALK_IGN_HOLES | DAT_WALK_ANY, mc);\n }\n \n@@ -1008,7 +984,7 @@ static const struct dat_walk_ops test_age_ops = {\n \n /**\n  * dat_test_age_gfn() - Test young.\n- * @asce: The ASCE whose address range is to be tested.\n+ * @datt: The DAT tables whose address range is to be tested.\n  * @start: The first guest frame of the range to check.\n  * @end: The guest frame after the last in the range.\n  *\n@@ -1016,9 +992,9 @@ static const struct dat_walk_ops test_age_ops = {\n  *\n  * Return: %true if any page in the given range is young, otherwise %false.\n  */\n-bool dat_test_age_gfn(union asce asce, gfn_t start, gfn_t end)\n+bool dat_test_age_gfn(struct dat_tables datt, gfn_t start, gfn_t end)\n {\n-\treturn _dat_walk_gfn_range(start, end, asce, \u0026test_age_ops, 0, NULL) \u003e 0;\n+\treturn _dat_walk_gfn_range(start, end, datt, \u0026test_age_ops, 0, NULL) \u003e 0;\n }\n \n #if KVM_S390_MANAGES_S390_GUEST\n@@ -1035,7 +1011,7 @@ static long dat_set_pn_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct\n \t\t\tbreak;\n \t\tnewcrste = oldcrste;\n \t\tnewcrste.s.fc1.prefix_notif = 1;\n-\t} while (!dat_crstep_xchg_atomic(crstep, oldcrste, newcrste, gfn, walk-\u003easce));\n+\t} while (!dat_crstep_xchg_atomic(crstep, oldcrste, newcrste, gfn, walk-\u003edatt.asce));\n \t*n = 2;\n \treturn 0;\n }\n@@ -1043,18 +1019,19 @@ static long dat_set_pn_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct\n static long dat_set_pn_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct dat_walk *walk)\n {\n \tint *n = walk-\u003epriv;\n-\tunion pgste pgste;\n \n-\tpgste = pgste_get_lock(ptep);\n+\t/*\n+\t * Updating a softbit while holding kvm-\u003emmu_lock in write mode, no\n+\t * need to take the PCL lock.\n+\t */\n \tif (!ptep-\u003eh.i \u0026\u0026 !ptep-\u003eh.p) {\n-\t\tpgste.prefix_notif = 1;\n+\t\t__atomic64_or(_PAGE_PREFIX_NOTIF, \u0026ptep-\u003eval);\n \t\t*n += 1;\n \t}\n-\tpgste_set_unlock(ptep, pgste);\n \treturn 0;\n }\n \n-int dat_set_prefix_notif_bit(union asce asce, gfn_t gfn)\n+int dat_set_prefix_notif_bit(struct dat_tables datt, gfn_t gfn)\n {\n \tstatic const struct dat_walk_ops ops = {\n \t\t.pte_entry = dat_set_pn_pte,\n@@ -1064,7 +1041,7 @@ int dat_set_prefix_notif_bit(union asce asce, gfn_t gfn)\n \n \tint n = 0;\n \n-\t_dat_walk_gfn_range(gfn, gfn + 2, asce, \u0026ops, DAT_WALK_IGN_HOLES, \u0026n);\n+\t_dat_walk_gfn_range(gfn, gfn + 2, datt, \u0026ops, DAT_WALK_IGN_HOLES, \u0026n);\n \tif (n != 2)\n \t\treturn -EAGAIN;\n \treturn 0;\n@@ -1072,7 +1049,7 @@ int dat_set_prefix_notif_bit(union asce asce, gfn_t gfn)\n \n /**\n  * dat_perform_essa() - Perform ESSA actions on the PGSTE.\n- * @asce: The asce to operate on.\n+ * @datt: The DAT tables to operate on.\n  * @gfn: The guest page frame to operate on.\n  * @orc: The specific action to perform, see the ESSA_SET_* macros.\n  * @state: The storage attributes to be returned to the guest.\n@@ -1085,14 +1062,15 @@ int dat_set_prefix_notif_bit(union asce asce, gfn_t gfn)\n  * * %0 if the page state has been altered, but the page is not to be added to the CBRL\n  * * %-1 if the page state has not been altered and the page is not to be added to the CBRL\n  */\n-int dat_perform_essa(union asce asce, gfn_t gfn, int orc, union essa_state *state, bool *dirty)\n+int dat_perform_essa(struct dat_tables datt, gfn_t gfn, int orc,\n+\t\t     union essa_state *state, bool *dirty)\n {\n \tunion crste *crstep;\n \tunion pgste pgste;\n \tunion pte *ptep;\n \tint res = 0;\n \n-\tif (dat_entry_walk(NULL, gfn, asce, 0, TABLE_TYPE_PAGE_TABLE, \u0026crstep, \u0026ptep)) {\n+\tif (dat_entry_walk(NULL, gfn, datt, 0, TABLE_TYPE_PAGE_TABLE, \u0026crstep, \u0026ptep)) {\n \t\t*state = (union essa_state) { .exception = 1 };\n \t\treturn -1;\n \t}\n@@ -1180,13 +1158,13 @@ static long dat_reset_cmma_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct da\n \treturn 0;\n }\n \n-long dat_reset_cmma(union asce asce, gfn_t start)\n+long dat_reset_cmma(struct dat_tables datt, gfn_t start)\n {\n \tconst struct dat_walk_ops dat_reset_cmma_ops = {\n \t\t.pte_entry = dat_reset_cmma_pte,\n \t};\n \n-\treturn _dat_walk_gfn_range(start, asce_end(asce), asce, \u0026dat_reset_cmma_ops,\n+\treturn _dat_walk_gfn_range(start, dat_tables_end(datt), datt, \u0026dat_reset_cmma_ops,\n \t\t\t\t   DAT_WALK_IGN_HOLES, NULL);\n }\n \n@@ -1220,7 +1198,7 @@ static long __dat_peek_cmma_crste(union crste *crstep, gfn_t gfn, gfn_t next, st\n \treturn 0;\n }\n \n-int dat_peek_cmma(gfn_t start, union asce asce, unsigned int *count, u8 *values)\n+int dat_peek_cmma(gfn_t start, struct dat_tables datt, unsigned int *count, u8 *values)\n {\n \tconst struct dat_walk_ops ops = {\n \t\t.pte_entry = __dat_peek_cmma_pte,\n@@ -1232,7 +1210,7 @@ int dat_peek_cmma(gfn_t start, union asce asce, unsigned int *count, u8 *values)\n \tstruct dat_get_cmma_state state = { .values = values, };\n \tint rc;\n \n-\trc = _dat_walk_gfn_range(start, start + *count, asce, \u0026ops, DAT_WALK_DEFAULT, \u0026state);\n+\trc = _dat_walk_gfn_range(start, start + *count, datt, \u0026ops, DAT_WALK_DEFAULT, \u0026state);\n \t*count = state.end \u003e= start ? state.end - start : 0;\n \t/* Return success if at least one value was saved, otherwise an error. */\n \treturn (rc == -EFAULT \u0026\u0026 *count \u003e 0) ? 0 : rc;\n@@ -1266,7 +1244,8 @@ static long __dat_get_cmma_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct da\n \treturn 0;\n }\n \n-int dat_get_cmma(union asce asce, gfn_t *start, unsigned int *count, u8 *values, atomic64_t *rem)\n+int dat_get_cmma(struct dat_tables datt, gfn_t *start, unsigned int *count,\n+\t\t u8 *values, atomic64_t *rem)\n {\n \tconst struct dat_walk_ops ops = { .pte_entry = __dat_get_cmma_pte, };\n \tstruct dat_get_cmma_state state = {\n@@ -1276,10 +1255,10 @@ int dat_get_cmma(union asce asce, gfn_t *start, unsigned int *count, u8 *values,\n \t\t.start = -1,\n \t};\n \n-\t_dat_walk_gfn_range(*start, asce_end(asce), asce, \u0026ops, DAT_WALK_IGN_HOLES, \u0026state);\n+\t_dat_walk_gfn_range(*start, dat_tables_end(datt), datt, \u0026ops, DAT_WALK_IGN_HOLES, \u0026state);\n \t/* If no dirty pages were found, wrap around and continue searching */\n \tif (*start \u0026\u0026 state.start == -1)\n-\t\t_dat_walk_gfn_range(0, *start, asce, \u0026ops, DAT_WALK_IGN_HOLES, \u0026state);\n+\t\t_dat_walk_gfn_range(0, *start, datt, \u0026ops, DAT_WALK_IGN_HOLES, \u0026state);\n \n \tif (state.start == -1) {\n \t\t*count = 0;\n@@ -1314,7 +1293,7 @@ static long __dat_set_cmma_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct da\n /**\n  * dat_set_cmma_bits() - Set CMMA bits for a range of guest pages.\n  * @mc: Cache used for allocations.\n- * @asce: The ASCE of the guest.\n+ * @datt: The DAT tables of the guest.\n  * @gfn: The guest frame of the fist page whose CMMA bits are to set.\n  * @count: How many pages need to be processed.\n  * @mask: Which PGSTE bits should be set.\n@@ -1329,7 +1308,7 @@ static long __dat_set_cmma_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct da\n  *\n  * Return: %0 in case of success, a negative error value otherwise.\n  */\n-int dat_set_cmma_bits(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t gfn,\n+int dat_set_cmma_bits(struct kvm_s390_mmu_cache *mc, struct dat_tables datt, gfn_t gfn,\n \t\t      unsigned long count, unsigned long mask, const uint8_t *bits)\n {\n \tconst struct dat_walk_ops ops = { .pte_entry = __dat_set_cmma_pte, };\n@@ -1340,11 +1319,11 @@ int dat_set_cmma_bits(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t gfn,\n \tint rc;\n \n \tfor (cur = ALIGN_DOWN(gfn, _PAGE_ENTRIES); cur \u003c gfn + count; cur += _PAGE_ENTRIES) {\n-\t\trc = dat_entry_walk(mc, cur, asce, DAT_WALK_ALLOC, TABLE_TYPE_PAGE_TABLE,\n+\t\trc = dat_entry_walk(mc, cur, datt, DAT_WALK_ALLOC, TABLE_TYPE_PAGE_TABLE,\n \t\t\t\t    \u0026crstep, \u0026ptep);\n \t\tif (rc)\n \t\t\treturn rc;\n \t}\n-\treturn _dat_walk_gfn_range(gfn, gfn + count, asce, \u0026ops, DAT_WALK_IGN_HOLES, \u0026state);\n+\treturn _dat_walk_gfn_range(gfn, gfn + count, datt, \u0026ops, DAT_WALK_IGN_HOLES, \u0026state);\n }\n #endif /* KVM_S390_MANAGES_S390_GUEST */\ndiff --git a/arch/s390/kvm/gmap/dat.h b/arch/s390/kvm/gmap/dat.h\nindex 90389d47ba4e0..3493f033e2045 100644\n--- a/arch/s390/kvm/gmap/dat.h\n+++ b/arch/s390/kvm/gmap/dat.h\n@@ -27,9 +27,6 @@\n /* For consistency */\n #define KVM_S390_CMMA_SIZE_MAX ((u32)KVM_S390_SKEYS_MAX)\n \n-#define _ASCE(x) ((union asce) { .val = (x), })\n-#define NULL_ASCE _ASCE(0)\n-\n enum {\n \t_DAT_TOKEN_NONE = 0,\n \t_DAT_TOKEN_PIC,\n@@ -55,7 +52,6 @@ enum {\n #define TABLE_TYPE_PAGE_TABLE -1\n \n enum dat_walk_flags {\n-\tDAT_WALK_USES_SKEYS\t= 0x40,\n \tDAT_WALK_CONTINUE\t= 0x20,\n \tDAT_WALK_IGN_HOLES\t= 0x10,\n \tDAT_WALK_SPLIT\t\t= 0x08,\n@@ -77,7 +73,7 @@ union pte {\n \t\tunsigned long u : 1; /* Page unused */\n \t\tunsigned long s : 1; /* Special */\n \t\tunsigned long w : 1; /* Writable */\n-\t\tunsigned long r : 1; /* Readable */\n+\t\tunsigned long prefix_notif:1; /* Guest prefix invalidation notification */\n \t\tunsigned long d : 1; /* Dirty */\n \t\tunsigned long y : 1; /* Young */\n \t\tunsigned long sd: 1; /* Soft dirty */\n@@ -109,9 +105,15 @@ union pte {\n #define _REGION3_FR_MASK\t(_REGION3_MASK \u003e\u003e PAGE_SHIFT)\n #define _PAGES_PER_SEGMENT\t_PAGE_ENTRIES\n #define _PAGES_PER_REGION3\t(_PAGES_PER_SEGMENT * _CRST_ENTRIES)\n+#define _UCAS_ENTRY_LENGTH\t0\n+#define _UCAS_ENTRY_OFFSET\t3\n+\n+#define CRDTE_NODAT\t\tIPTE_NODAT\n+#define CRDTE_GUEST_ASCE\tIPTE_GUEST_ASCE\n \n-/* Soft dirty, needed as macro for atomic operations on ptes */\n-#define _PAGE_SD 0x002\n+/* Needed as macro for atomic operations on ptes */\n+#define _PAGE_PREFIX_NOTIF\t0x010\t/* Guest prefix invalidation notification */\n+#define _PAGE_SD\t\t0x002\t/* Soft dirty */\n \n /* Needed as macro to perform atomic operations */\n #define PGSTE_PCL_BIT\t\t0x0080000000000000UL\t/* PCL lock, HW bit */\n@@ -144,10 +146,9 @@ union pgste {\n \t\tunsigned long usage        : 2;\n \t\tunsigned long              : 8;\n \t\tunsigned long cmma_d       : 1; /* Dirty flag for CMMA bits */\n-\t\tunsigned long prefix_notif : 1; /* Guest prefix invalidation notification */\n \t\tunsigned long vsie_notif   : 1; /* Referenced in a shadow table */\n \t\tunsigned long vsie_gmem    : 1; /* Contains nested guest memory */\n-\t\tunsigned long              : 4;\n+\t\tunsigned long              : 5;\n \t\tunsigned long              : 8;\n \t};\n \tstruct {\n@@ -350,6 +351,15 @@ struct page_table {\n static_assert(sizeof(struct crst_table) == _CRST_TABLE_SIZE);\n static_assert(sizeof(struct page_table) == PAGE_SIZE);\n \n+struct dat_tables {\n+\tunion asce asce;\n+\tstruct crst_table *table;\n+\tbool has_pgstes;\t/* Need to use the PCL lock */\n+\tbool owns_ptes;\t\t/* The ptes are owned by this instance */\n+\tbool uses_skeys;\t/* Storage keys are in use */\n+\tbool uses_cmma;\t\t/* CMMA is in use */\n+};\n+\n struct dat_walk;\n \n typedef long (*dat_walk_op)(union crste *crste, gfn_t gfn, gfn_t next, struct dat_walk *w);\n@@ -371,7 +381,7 @@ struct dat_walk {\n \tconst struct dat_walk_ops *ops;\n \tunion crste *last;\n \tunion pte *last_pte;\n-\tunion asce asce;\n+\tstruct dat_tables datt;\n \tgfn_t start;\n \tgfn_t end;\n \tint flags;\n@@ -421,6 +431,17 @@ static inline union crste _crste_fc0(kvm_pfn_t pfn, int tt)\n \treturn res;\n }\n \n+static inline union crste _crste_ucas(kvm_pfn_t pfn)\n+{\n+\tunion crste res = { .val = PFN_PHYS(pfn) };\n+\n+\tres.h.i = 1;\n+\tres.h.tt = TABLE_TYPE_SEGMENT;\n+\tres.h.fc0.tl = _UCAS_ENTRY_LENGTH;\n+\tres.h.fc0.tf = _UCAS_ENTRY_OFFSET;\n+\treturn res;\n+}\n+\n /**\n  * _crste() - Useful constructor for union crste with FC=1\n  * @pfn: the pfn this pte should point to.\n@@ -520,52 +541,53 @@ struct guest_fault {\n #define PTVAL_VMADDR\tMKPTVAL(8, 6)\n \n union pgste __must_check __dat_ptep_xchg(union pte *ptep, union pgste pgste, union pte new,\n-\t\t\t\t\t gfn_t gfn, union asce asce, bool uses_skeys);\n+\t\t\t\t\t gfn_t gfn, struct dat_tables datt);\n bool dat_crstep_xchg_atomic(union crste *crstep, union crste old, union crste new, gfn_t gfn,\n \t\t\t    union asce asce);\n-void dat_crstep_xchg(union crste *crstep, union crste new, gfn_t gfn, union asce asce);\n \n-long _dat_walk_gfn_range(gfn_t start, gfn_t end, union asce asce,\n+long _dat_walk_gfn_range(gfn_t start, gfn_t end, struct dat_tables datt,\n \t\t\t const struct dat_walk_ops *ops, int flags, void *priv);\n \n-int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, int flags,\n+int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, struct dat_tables datt, int flags,\n \t\t   int walk_level, union crste **last, union pte **ptepp);\n void dat_free_level(struct crst_table *table, bool owns_ptes);\n struct crst_table *dat_alloc_crst_sleepable(unsigned long init);\n-int dat_set_asce_limit(struct kvm_s390_mmu_cache *mc, union asce *asce, int newtype);\n+int dat_set_asce_limit(struct kvm_s390_mmu_cache *mc, struct dat_tables *datt, int newtype);\n \n #if KVM_S390_MANAGES_S390_GUEST\n-int dat_get_storage_key(union asce asce, gfn_t gfn, union skey *skey);\n-int dat_set_storage_key(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t gfn,\n+int dat_get_storage_key(struct dat_tables datt, gfn_t gfn, union skey *skey);\n+int dat_set_storage_key(struct kvm_s390_mmu_cache *mc, struct dat_tables datt, gfn_t gfn,\n \t\t\tunion skey skey, bool nq);\n-int dat_cond_set_storage_key(struct kvm_s390_mmu_cache *mmc, union asce asce, gfn_t gfn,\n+int dat_cond_set_storage_key(struct kvm_s390_mmu_cache *mmc, struct dat_tables datt, gfn_t gfn,\n \t\t\t     union skey skey, union skey *oldkey, bool nq, bool mr, bool mc);\n-int dat_reset_reference_bit(union asce asce, gfn_t gfn, union skey *skey);\n-long dat_reset_skeys(union asce asce, gfn_t start);\n+int dat_reset_reference_bit(struct dat_tables datt, gfn_t gfn, union skey *skey);\n+long dat_reset_skeys(struct dat_tables datt, gfn_t start);\n #endif /* KVM_S390_MANAGES_S390_GUEST */\n \n unsigned long dat_get_ptval(struct page_table *table, struct ptval_param param);\n void dat_set_ptval(struct page_table *table, struct ptval_param param, unsigned long val);\n \n-int dat_set_slot(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t start, gfn_t end);\n+int dat_set_slot(struct kvm_s390_mmu_cache *mc, struct dat_tables datt, gfn_t start, gfn_t end);\n \n #if KVM_S390_MANAGES_S390_GUEST\n-int dat_set_prefix_notif_bit(union asce asce, gfn_t gfn);\n+int dat_set_prefix_notif_bit(struct dat_tables datt, gfn_t gfn);\n #else\n-static inline int dat_set_prefix_notif_bit(union asce asce, gfn_t gfn)\n+static inline int dat_set_prefix_notif_bit(struct dat_tables datt, gfn_t gfn)\n {\n \treturn 0;\n }\n #endif /* KVM_S390_MANAGES_S390_GUEST */\n \n-bool dat_test_age_gfn(union asce asce, gfn_t start, gfn_t end);\n+bool dat_test_age_gfn(struct dat_tables datt, gfn_t start, gfn_t end);\n \n #if KVM_S390_MANAGES_S390_GUEST\n-int dat_perform_essa(union asce asce, gfn_t gfn, int orc, union essa_state *state, bool *dirty);\n-long dat_reset_cmma(union asce asce, gfn_t start_gfn);\n-int dat_peek_cmma(gfn_t start, union asce asce, unsigned int *count, u8 *values);\n-int dat_get_cmma(union asce asce, gfn_t *start, unsigned int *count, u8 *values, atomic64_t *rem);\n-int dat_set_cmma_bits(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t gfn,\n+int dat_perform_essa(struct dat_tables datt, gfn_t gfn, int orc,\n+\t\t     union essa_state *state, bool *dirty);\n+long dat_reset_cmma(struct dat_tables datt, gfn_t start_gfn);\n+int dat_peek_cmma(gfn_t start, struct dat_tables datt, unsigned int *count, u8 *values);\n+int dat_get_cmma(struct dat_tables datt, gfn_t *start, unsigned int *count,\n+\t\t u8 *values, atomic64_t *rem);\n+int dat_set_cmma_bits(struct kvm_s390_mmu_cache *mc, struct dat_tables datt, gfn_t gfn,\n \t\t      unsigned long count, unsigned long mask, const uint8_t *bits);\n #endif /* KVM_S390_MANAGES_S390_GUEST */\n \n@@ -594,6 +616,11 @@ static inline struct vsie_rmap *kvm_s390_mmu_cache_alloc_rmap(struct kvm_s390_mm\n \treturn kzalloc_obj(struct vsie_rmap, GFP_KVM_S390_MMU_CACHE);\n }\n \n+static inline bool has_pgstes(struct dat_tables datt)\n+{\n+\treturn KVM_S390_MANAGES_S390_GUEST \u0026\u0026 datt.has_pgstes;\n+}\n+\n static inline struct crst_table *crste_table_start(union crste *crstep)\n {\n \treturn (struct crst_table *)ALIGN_DOWN((unsigned long)crstep, _CRST_TABLE_SIZE);\n@@ -609,38 +636,62 @@ static inline bool crdte_crste(union crste *crstep, union crste old, union crste\n {\n \tunsigned long dtt = 0x10 | new.h.tt \u003c\u003c 2;\n \tvoid *table = crste_table_start(crstep);\n+\tunsigned long addr = gfn_to_gpa(gfn);\n+\n+\taddr |= machine_has_tlb_guest() ? CRDTE_GUEST_ASCE : 0;\n+\treturn crdte(old.val, new.val, table, dtt, addr, asce.val);\n+}\n+\n+static inline bool crdte_pte(union pte *ptep, union pte old, union pte new, gfn_t gfn,\n+\t\t\t     union asce asce, bool nt)\n+{\n+\tvoid *table = pte_table_start(ptep);\n+\tunsigned long addr = gfn_to_gpa(gfn);\n \n-\treturn crdte(old.val, new.val, table, dtt, gfn_to_gpa(gfn), asce.val);\n+\tif (machine_has_tlb_guest())\n+\t\taddr |= CRDTE_GUEST_ASCE | (nt ? CRDTE_NODAT : 0);\n+\treturn crdte(old.val, new.val, table, 0, addr, asce.val);\n }\n \n /**\n  * idte_crste() - invalidate a crste entry using idte\n  * @crstep: pointer to the crste to be invalidated\n  * @gfn: a gfn mapped by the crste\n- * @opt: options for the idte instruction\n  * @asce: the asce\n- * @local: whether the operation is cpu-local\n  */\n-static __always_inline void idte_crste(union crste *crstep, gfn_t gfn, unsigned long opt,\n-\t\t\t\t       union asce asce, int local)\n+static __always_inline void idte_crste(union crste *crstep, gfn_t gfn, union asce asce)\n {\n \tunsigned long table_origin = __pa(crste_table_start(crstep));\n \tunsigned long gaddr = gfn_to_gpa(gfn) \u0026 HPAGE_MASK;\n \n-\tif (__builtin_constant_p(opt) \u0026\u0026 opt == 0) {\n+\ttable_origin |= crstep-\u003eval \u0026 _REGION_ENTRY_TYPE_MASK;\n+\n+\tif (!machine_has_tlb_guest()) {\n \t\t/* flush without guest asce */\n-\t\tasm volatile(\"idte\t%[table_origin],0,%[gaddr],%[local]\"\n+\t\tasm volatile(\"idte\t%[table_origin],0,%[gaddr]\"\n \t\t\t: \"+m\" (*crstep)\n-\t\t\t: [table_origin] \"a\" (table_origin), [gaddr] \"a\" (gaddr),\n-\t\t\t  [local] \"i\" (local)\n-\t\t\t: \"cc\");\n+\t\t\t: [table_origin] \"a\" (table_origin), [gaddr] \"a\" (gaddr)\n+\t\t\t: \"memory\", \"cc\");\n \t} else {\n \t\t/* flush with guest asce */\n-\t\tasm volatile(\"idte %[table_origin],%[asce],%[gaddr_opt],%[local]\"\n+\t\tasm volatile(\"idte %[table_origin],%[asce],%[gaddr_opt]\"\n \t\t\t: \"+m\" (*crstep)\n-\t\t\t: [table_origin] \"a\" (table_origin), [gaddr_opt] \"a\" (gaddr | opt),\n-\t\t\t  [asce] \"a\" (asce.val), [local] \"i\" (local)\n-\t\t\t: \"cc\");\n+\t\t\t: [table_origin] \"a\" (table_origin),\n+\t\t\t  [gaddr_opt] \"a\" (gaddr | IDTE_GUEST_ASCE),\n+\t\t\t  [asce] \"a\" (asce.val)\n+\t\t\t: \"memory\", \"cc\");\n+\t}\n+}\n+\n+static __always_inline void ipte(gfn_t gfn, union pte *ptep, union asce asce, bool nt)\n+{\n+\tunsigned long flags;\n+\n+\tif (machine_has_tlb_guest()) {\n+\t\tflags = IPTE_GUEST_ASCE | (nt ? IPTE_NODAT : 0);\n+\t\t__ptep_ipte(gfn_to_gpa(gfn), (void *)ptep, flags, asce.val, IPTE_GLOBAL);\n+\t} else {\n+\t\t__ptep_ipte(gfn_to_gpa(gfn), (void *)ptep, 0, 0, IPTE_GLOBAL);\n \t}\n }\n \n@@ -661,6 +712,11 @@ static inline gfn_t asce_end(union asce asce)\n \treturn 1ULL \u003c\u003c ((asce.dt + 1) * 11 + _SEGMENT_SHIFT - PAGE_SHIFT);\n }\n \n+static inline gfn_t dat_tables_end(struct dat_tables datt)\n+{\n+\treturn asce_end(datt.asce);\n+}\n+\n #define _CRSTE(x) ((union crste) { .val = _Generic((x),\t\\\n \t\t\tunion pgd : (x).val,\t\t\\\n \t\t\tunion p4d : (x).val,\t\t\\\n@@ -687,6 +743,11 @@ static inline bool asce_contains_gfn(union asce asce, gfn_t gfn)\n \treturn gfn \u003c asce_end(asce);\n }\n \n+static inline bool dat_tables_contain_gfn(struct dat_tables datt, gfn_t gfn)\n+{\n+\treturn asce_contains_gfn(datt.asce, gfn);\n+}\n+\n static inline bool is_pmd(union crste crste)\n {\n \treturn crste.h.tt == TABLE_TYPE_SEGMENT;\n@@ -852,11 +913,6 @@ static inline struct crst_table *_dereference_crste(union crste crste)\n \t\tunion pgd : _dereference_crste(_CRSTE(x)),\t\\\n \t\tunion crste : _dereference_crste(_CRSTE(x))))\n \n-static inline struct crst_table *dereference_asce(union asce asce)\n-{\n-\treturn phys_to_virt(asce.val \u0026 _ASCE_ORIGIN);\n-}\n-\n static inline void asce_flush_tlb(union asce asce)\n {\n \t__tlb_flush_idte(asce.val);\n@@ -893,19 +949,18 @@ static inline void pgste_set_unlock(union pte *ptep, union pgste pgste)\n \tWRITE_ONCE(*pgste_of(ptep), pgste);\n }\n \n-static inline void dat_ptep_xchg(union pte *ptep, union pte new, gfn_t gfn, union asce asce,\n-\t\t\t\t bool has_skeys)\n+static inline void dat_ptep_xchg(union pte *ptep, union pte new, gfn_t gfn, struct dat_tables datt)\n {\n \tunion pgste pgste;\n \n \tpgste = pgste_get_lock(ptep);\n-\tpgste = __dat_ptep_xchg(ptep, pgste, new, gfn, asce, has_skeys);\n+\tpgste = __dat_ptep_xchg(ptep, pgste, new, gfn, datt);\n \tpgste_set_unlock(ptep, pgste);\n }\n \n-static inline void dat_ptep_clear(union pte *ptep, gfn_t gfn, union asce asce, bool has_skeys)\n+static inline void dat_ptep_clear(union pte *ptep, gfn_t gfn, struct dat_tables datt)\n {\n-\tdat_ptep_xchg(ptep, _PTE_EMPTY, gfn, asce, has_skeys);\n+\tdat_ptep_xchg(ptep, _PTE_EMPTY, gfn, datt);\n }\n \n static inline void dat_free_pt(struct page_table *pt)\n@@ -972,20 +1027,47 @@ static inline int get_level(union crste *crstep, union pte *ptep)\n \treturn ptep ? TABLE_TYPE_PAGE_TABLE : crstep-\u003eh.tt;\n }\n \n-static inline int dat_delete_slot(union asce asce, gfn_t start, unsigned long npages)\n+static inline int dat_delete_slot(struct dat_tables datt, gfn_t start, unsigned long npages)\n {\n-\treturn dat_set_slot(NULL, asce, start, start + npages);\n+\treturn dat_set_slot(NULL, datt, start, start + npages);\n }\n \n-static inline int dat_create_slot(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t start,\n-\t\t\t\t  unsigned long npages)\n+static inline int dat_create_slot(struct kvm_s390_mmu_cache *mc, struct dat_tables datt,\n+\t\t\t\t  gfn_t start, unsigned long npages)\n {\n-\treturn dat_set_slot(mc, asce, start, start + npages);\n+\treturn dat_set_slot(mc, datt, start, start + npages);\n }\n \n static inline bool crste_is_ucas(union crste crste)\n {\n-\treturn is_pmd(crste) \u0026\u0026 crste.h.i \u0026\u0026 crste.h.fc0.tl == 1 \u0026\u0026 crste.h.fc == 0;\n+\treturn is_pmd(crste) \u0026\u0026 crste.h.i \u0026\u0026 !crste.h.fc \u0026\u0026\n+\t       crste.h.fc0.tl == _UCAS_ENTRY_LENGTH \u0026\u0026 crste.h.fc0.tf == _UCAS_ENTRY_OFFSET;\n+}\n+\n+static inline void dat_set_storage_key_from_pgste(union pte pte, union pgste pgste)\n+{\n+\tunion skey nkey = { .acc = pgste.acc, .fp = pgste.fp };\n+\n+\tpage_set_storage_key(pte_origin(pte), nkey.skey, 0);\n+}\n+\n+static inline void dat_move_storage_key(union pte old, union pte new)\n+{\n+\tpage_set_storage_key(pte_origin(new), page_get_storage_key(pte_origin(old)), 1);\n+}\n+\n+static inline union pgste dat_save_storage_key_into_pgste(union pte pte, union pgste pgste)\n+{\n+\tunion skey skey;\n+\n+\tskey.skey = page_get_storage_key(pte_origin(pte));\n+\n+\tpgste.acc = skey.acc;\n+\tpgste.fp = skey.fp;\n+\tpgste.gr |= skey.r;\n+\tpgste.gc |= skey.c;\n+\n+\treturn pgste;\n }\n \n #endif /* ARCH_KVM_GMAP_DAT_H */\ndiff --git a/arch/s390/kvm/gmap/gmap.c b/arch/s390/kvm/gmap/gmap.c\nindex 3f3fa864cc36b..01d25aa1f605f 100644\n--- a/arch/s390/kvm/gmap/gmap.c\n+++ b/arch/s390/kvm/gmap/gmap.c\n@@ -46,8 +46,8 @@ static int gmap_limit_to_type(gfn_t limit)\n  */\n struct gmap *gmap_new(struct kvm *kvm, gfn_t limit)\n {\n+\tstruct gmap *gmap __free(kfree) = NULL;\n \tstruct crst_table *table;\n-\tstruct gmap *gmap;\n \tint type;\n \n \ttype = gmap_limit_to_type(limit);\n@@ -64,27 +64,27 @@ struct gmap *gmap_new(struct kvm *kvm, gfn_t limit)\n \trefcount_set(\u0026gmap-\u003erefcount, 1);\n \n \ttable = dat_alloc_crst_sleepable(_CRSTE_EMPTY(type).val);\n-\tif (!table) {\n-\t\tkfree(gmap);\n+\tif (!table)\n \t\treturn NULL;\n-\t}\n \n-\tgmap-\u003easce.val = __pa(table);\n-\tgmap-\u003easce.dt = type;\n-\tgmap-\u003easce.tl = _ASCE_TABLE_LENGTH;\n-\tgmap-\u003easce.x = 1;\n-\tgmap-\u003easce.p = 1;\n-\tgmap-\u003easce.s = 1;\n+\tgmap-\u003edatt.table = table;\n+\tgmap-\u003edatt.asce.val = __pa(table);\n+\tgmap-\u003edatt.asce.dt = type;\n+\tgmap-\u003edatt.asce.tl = _ASCE_TABLE_LENGTH;\n+\tgmap-\u003edatt.asce.x = 1;\n+\tgmap-\u003edatt.asce.p = 1;\n+\tgmap-\u003edatt.asce.s = 1;\n \tgmap-\u003ekvm = kvm;\n-\tset_bit(GMAP_FLAG_OWNS_PAGETABLES, \u0026gmap-\u003eflags);\n+\tgmap-\u003edatt.owns_ptes = true;\n+\tgmap-\u003edatt.has_pgstes = KVM_S390_MANAGES_S390_GUEST \u0026\u0026 !(sclp.has_kss \u0026\u0026 cpu_has_edat2());\n \n-\treturn gmap;\n+\treturn_ptr(gmap);\n }\n \n static void gmap_add_child(struct gmap *parent, struct gmap *child)\n {\n \tKVM_BUG_ON(is_ucontrol(parent) \u0026\u0026 parent-\u003eparent, parent-\u003ekvm);\n-\tKVM_BUG_ON(is_ucontrol(parent) \u0026\u0026 !owns_page_tables(parent), parent-\u003ekvm);\n+\tKVM_BUG_ON(is_ucontrol(parent) \u0026\u0026 !parent-\u003edatt.owns_ptes, parent-\u003ekvm);\n \tKVM_BUG_ON(!refcount_read(\u0026child-\u003erefcount), parent-\u003ekvm);\n \tlockdep_assert_held(\u0026parent-\u003echildren_lock);\n \n@@ -105,8 +105,11 @@ static void gmap_add_child(struct gmap *parent, struct gmap *child)\n \telse\n \t\tclear_bit(GMAP_FLAG_ALLOW_HPAGE_2G, \u0026child-\u003eflags);\n \n-\tif (kvm_is_ucontrol(parent-\u003ekvm))\n-\t\tclear_bit(GMAP_FLAG_OWNS_PAGETABLES, \u0026child-\u003eflags);\n+\tif (kvm_is_ucontrol(parent-\u003ekvm)) {\n+\t\tchild-\u003edatt.owns_ptes = false;\n+\t\tchild-\u003edatt.uses_skeys = true;\n+\t}\n+\tchild-\u003edatt.has_pgstes = true;\n \tlist_add(\u0026child-\u003elist, \u0026parent-\u003echildren);\n }\n \n@@ -139,7 +142,7 @@ int gmap_set_limit(struct gmap *gmap, gfn_t limit)\n \t\tif (rc)\n \t\t\treturn rc;\n \t\tscoped_guard(write_lock, \u0026gmap-\u003ekvm-\u003emmu_lock)\n-\t\t\trc = dat_set_asce_limit(mc, \u0026gmap-\u003easce, type);\n+\t\t\trc = dat_set_asce_limit(mc, \u0026gmap-\u003edatt, type);\n \t} while (rc == -ENOMEM);\n \n \treturn 0;\n@@ -196,15 +199,15 @@ void gmap_dispose(struct gmap *gmap)\n \t/* No VSIE shadow block is allowed to use this gmap */\n \tKVM_BUG_ON(!list_empty(\u0026gmap-\u003escb_users), gmap-\u003ekvm);\n \t/* The ASCE must be valid */\n-\tKVM_BUG_ON(!gmap-\u003easce.val, gmap-\u003ekvm);\n+\tKVM_BUG_ON(!gmap-\u003edatt.asce.val, gmap-\u003ekvm);\n \t/* The refcount must be 0 */\n \tKVM_BUG_ON(refcount_read(\u0026gmap-\u003erefcount), gmap-\u003ekvm);\n \n \t/* Flush tlb of all gmaps */\n-\tasce_flush_tlb(gmap-\u003easce);\n+\tasce_flush_tlb(gmap-\u003edatt.asce);\n \n \t/* Free all DAT tables. */\n-\tdat_free_level(dereference_asce(gmap-\u003easce), owns_page_tables(gmap));\n+\tdat_free_level(gmap-\u003edatt.table, gmap-\u003edatt.owns_ptes);\n \n \t/* Free additional data for a shadow gmap */\n \tif (is_shadow(gmap))\n@@ -232,21 +235,25 @@ void gmap_dispose(struct gmap *gmap)\n int s390_replace_asce(struct gmap *gmap)\n {\n \tstruct crst_table *table;\n-\tunion asce asce;\n \n \t/* Replacing segment type ASCEs would cause serious issues */\n-\tif (gmap-\u003easce.dt == ASCE_TYPE_SEGMENT)\n+\tif (gmap-\u003edatt.asce.dt == ASCE_TYPE_SEGMENT)\n \t\treturn -EINVAL;\n \n \ttable = dat_alloc_crst_sleepable(0);\n \tif (!table)\n \t\treturn -ENOMEM;\n-\tmemcpy(table, dereference_asce(gmap-\u003easce), sizeof(*table));\n \n \t/* Set new table origin while preserving existing ASCE control bits */\n-\tasce = gmap-\u003easce;\n-\tasce.rsto = virt_to_pfn(table);\n-\tWRITE_ONCE(gmap-\u003easce, asce);\n+\tscoped_guard(write_lock, \u0026gmap-\u003ekvm-\u003emmu_lock) {\n+\t\tmemcpy(table, gmap-\u003edatt.table, sizeof(*table));\n+\t\tif (gmap-\u003edatt.asce.dt == ASCE_TYPE_SEGMENT) {\n+\t\t\tdat_free_crst(table);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tgmap-\u003edatt.asce.rsto = virt_to_pfn(table);\n+\t\tgmap-\u003edatt.table = table;\n+\t}\n \n \treturn 0;\n }\n@@ -298,7 +305,7 @@ static long gmap_clear_young_pte(union pte *ptep, gfn_t gfn, gfn_t end, struct d\n \t\treturn 0;\n \n \tpgste = pgste_get_lock(ptep);\n-\tif (!pgste.prefix_notif || gmap_mkold_prefix(p-\u003egmap, gfn, end)) {\n+\tif (!pte.s.prefix_notif || gmap_mkold_prefix(p-\u003egmap, gfn, end)) {\n \t\tnew = pte;\n \t\tnew.h.i = 1;\n \t\tnew.s.y = 0;\n@@ -307,8 +314,8 @@ static long gmap_clear_young_pte(union pte *ptep, gfn_t gfn, gfn_t end, struct d\n \t\tnew.s.d = 0;\n \t\tnew.h.p = 1;\n \n-\t\tpgste.prefix_notif = 0;\n-\t\tpgste = __dat_ptep_xchg(ptep, pgste, new, gfn, walk-\u003easce, uses_skeys(p-\u003egmap));\n+\t\tnew.s.prefix_notif = 0;\n+\t\tpgste = __dat_ptep_xchg(ptep, pgste, new, gfn, walk-\u003edatt);\n \t}\n \tp-\u003eyoung = 1;\n \tpgste_set_unlock(ptep, pgste);\n@@ -338,7 +345,7 @@ static long gmap_clear_young_crste(union crste *crstep, gfn_t gfn, gfn_t end, st\n \t\t\tfolio_set_dirty(phys_to_folio(crste_origin_large(crste)));\n \t\tnew.s.fc1.d = 0;\n \t\tnew.h.p = 1;\n-\t} while (!dat_crstep_xchg_atomic(crstep, crste, new, gfn, walk-\u003easce));\n+\t} while (!dat_crstep_xchg_atomic(crstep, crste, new, gfn, walk-\u003edatt.asce));\n \n \tpriv-\u003eyoung = 1;\n \treturn 0;\n@@ -365,7 +372,7 @@ bool gmap_age_gfn(struct gmap *gmap, gfn_t start, gfn_t end)\n \t\t.young = false,\n \t};\n \n-\t_dat_walk_gfn_range(start, end, gmap-\u003easce, \u0026ops, 0, \u0026priv);\n+\t_dat_walk_gfn_range(start, end, gmap-\u003edatt, \u0026ops, 0, \u0026priv);\n \n \treturn priv.young;\n }\n@@ -407,7 +414,7 @@ static long _gmap_unmap_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct\n \tif (!old.h.fc)\n \t\treturn 0;\n \n-\tif (old.s.fc1.pr \u0026\u0026 test_bit(GMAP_FLAG_EXPORT_ON_UNMAP, \u0026priv-\u003egmap-\u003eflags))\n+\tif (old.s.fc1.pr \u0026\u0026 export_on_unmap(priv-\u003egmap))\n \t\tfolio = phys_to_folio(crste_origin_large(old));\n \t/*\n \t * No races should happen because kvm-\u003emmu_lock is held in write mode,\n@@ -430,17 +437,8 @@ static long _gmap_unmap_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct\n \treturn 0;\n }\n \n-/**\n- * gmap_unmap_gfn_range() - Unmap a range of guest addresses.\n- * @gmap: The gmap to act on.\n- * @slot: The memslot in which the range is located.\n- * @start: The first gfn to unmap.\n- * @end: The gfn after the last one to unmap.\n- *\n- * Context: Called with the kvm mmu write lock held.\n- * Return: false\n- */\n-bool gmap_unmap_gfn_range(struct gmap *gmap, struct kvm_memory_slot *slot, gfn_t start, gfn_t end)\n+static bool gmap_unmap_gfn_range_slow(struct gmap *gmap, struct kvm_memory_slot *slot,\n+\t\t\t\t      gfn_t start, gfn_t end)\n {\n \tconst struct dat_walk_ops ops = {\n \t\t.pte_entry = _gmap_unmap_pte,\n@@ -454,10 +452,109 @@ bool gmap_unmap_gfn_range(struct gmap *gmap, struct kvm_memory_slot *slot, gfn_t\n \n \tlockdep_assert_held_write(\u0026gmap-\u003ekvm-\u003emmu_lock);\n \n-\t_dat_walk_gfn_range(start, end, gmap-\u003easce, \u0026ops, 0, \u0026priv);\n+\t_dat_walk_gfn_range(start, end, gmap-\u003edatt, \u0026ops, 0, \u0026priv);\n+\treturn false;\n+}\n+\n+static long _gmap_unmap_pud_fast(union crste *crstep, gfn_t gfn, gfn_t next, struct dat_walk *w)\n+{\n+\tunion crste old = *crstep;\n+\n+\t/* We only care about large puds */\n+\tif (!old.h.fc)\n+\t\treturn 0;\n+\tif (!gfn)\n+\t\tgmap_unmap_prefix(w-\u003epriv, 0, next);\n+\tif (old.s.fc1.vsie_notif)\n+\t\tgmap_handle_vsie_unshadow_event(w-\u003epriv, gfn);\n+\n+\tidte_crste(crstep, gfn, w-\u003edatt.asce);\n+\t*crstep = _CRSTE_EMPTY(old.h.tt);\n+\n+\treturn 0;\n+}\n+\n+static long _gmap_unmap_pmd_fast(union crste *crstep, gfn_t gfn, gfn_t next, struct dat_walk *w)\n+{\n+\tunion crste old = *crstep;\n+\tstruct page_table *pt;\n+\tgfn_t first, last;\n+\tunsigned int i;\n+\n+\tif (old.h.fc) {\n+\t\tif (old.s.fc1.vsie_notif)\n+\t\t\tgmap_handle_vsie_unshadow_event(w-\u003epriv, gfn);\n+\n+\t\tidte_crste(crstep, gfn, w-\u003edatt.asce);\n+\t\tWRITE_ONCE(*crstep, _CRSTE_EMPTY(old.h.tt));\n+\n+\t\treturn 0;\n+\t}\n+\n+\tif (old.h.i)\n+\t\treturn 0;\n+\n+\tpt = dereference_pmd(old.pmd);\n+\tfirst = max(gfn, w-\u003estart) \u0026 (PTRS_PER_PTE - 1);\n+\tlast = (min(next, w-\u003eend) - 1) \u0026 (PTRS_PER_PTE - 1);\n+\n+\tfor (i = first; i \u003c= last; i++)\n+\t\tif (pte_needs_unshadow(pt-\u003eptes[i], _PTE_EMPTY, pt-\u003epgstes[i]))\n+\t\t\tgmap_handle_vsie_unshadow_event(w-\u003epriv, gfn + i);\n+\n+\t/* Detach the page table */\n+\tidte_crste(crstep, gfn, w-\u003edatt.asce);\n+\n+\tfor (i = first; i \u003c= last; i++) {\n+\t\tif (!pt-\u003eptes[i].h.i \u0026\u0026 w-\u003edatt.uses_skeys)\n+\t\t\tpt-\u003epgstes[i] = dat_save_storage_key_into_pgste(pt-\u003eptes[i], pt-\u003epgstes[i]);\n+\t\tpt-\u003eptes[i] = _PTE_EMPTY;\n+\t\tpt-\u003epgstes[i].vsie_notif = 0;\n+\t\tpt-\u003epgstes[i].vsie_gmem = 0;\n+\t\tpt-\u003epgstes[i].zero = 0;\n+\t}\n+\n+\tbarrier();\n+\t/* Reattach the modified page table */\n+\tWRITE_ONCE(*crstep, old);\n+\n+\treturn 0;\n+}\n+\n+static bool gmap_unmap_gfn_range_fast(struct gmap *gmap, gfn_t start, gfn_t end)\n+{\n+\tconst struct dat_walk_ops ops = {\n+\t\t.pud_entry = _gmap_unmap_pud_fast,\n+\t\t.pmd_entry = _gmap_unmap_pmd_fast,\n+\t};\n+\tbool failed;\n+\n+\tlockdep_assert_held_write(\u0026gmap-\u003ekvm-\u003emmu_lock);\n+\n+\tgmap_unmap_prefix(gmap, ALIGN_DOWN(start, _PAGE_ENTRIES), ALIGN(end, _PAGE_ENTRIES));\n+\n+\tfailed = _dat_walk_gfn_range(start, end, gmap-\u003edatt, \u0026ops, DAT_WALK_IGN_HOLES, gmap);\n+\tKVM_BUG_ON(failed, gmap-\u003ekvm);\n \treturn false;\n }\n \n+/**\n+ * gmap_unmap_gfn_range() - Unmap a range of guest addresses.\n+ * @gmap: The gmap to act on.\n+ * @slot: The memslot in which the range is located.\n+ * @start: The first gfn to unmap.\n+ * @end: The gfn after the last one to unmap.\n+ *\n+ * Context: Called with the kvm mmu write lock held.\n+ * Return: false\n+ */\n+bool gmap_unmap_gfn_range(struct gmap *gmap, struct kvm_memory_slot *slot, gfn_t start, gfn_t end)\n+{\n+\tif ((end - start \u003c= _PAGES_PER_SEGMENT) || export_on_unmap(gmap) || is_ucontrol(gmap))\n+\t\treturn gmap_unmap_gfn_range_slow(gmap, slot, start, end);\n+\treturn gmap_unmap_gfn_range_fast(gmap, start, end);\n+}\n+\n static union pgste __pte_test_and_clear_softdirty(union pte *ptep, union pgste pgste, gfn_t gfn,\n \t\t\t\t\t\t  struct gmap *gmap)\n {\n@@ -470,7 +567,7 @@ static union pgste __pte_test_and_clear_softdirty(union pte *ptep, union pgste p\n \t * If this page contains one or more prefixes of vCPUS that are currently\n \t * running, do not reset the protection, leave it marked as dirty.\n \t */\n-\tif (!pgste.prefix_notif || gmap_mkold_prefix(gmap, gfn, gfn + 1)) {\n+\tif (!pte.s.prefix_notif || gmap_mkold_prefix(gmap, gfn, gfn + 1)) {\n \t\tpte.h.p = 1;\n \t\tpte.s.sd = 0;\n \t\tpgste = gmap_ptep_xchg(gmap, ptep, pte, pgste, gfn);\n@@ -536,7 +633,7 @@ void gmap_sync_dirty_log(struct gmap *gmap, gfn_t start, gfn_t end)\n \n \tlockdep_assert_held(\u0026gmap-\u003ekvm-\u003emmu_lock);\n \n-\t_dat_walk_gfn_range(start, end, gmap-\u003easce, \u0026walk_ops, 0, gmap);\n+\t_dat_walk_gfn_range(start, end, gmap-\u003edatt, \u0026walk_ops, 0, gmap);\n }\n \n static int gmap_handle_minor_crste_fault(struct gmap *gmap, struct guest_fault *f)\n@@ -618,7 +715,7 @@ int gmap_try_fixup_minor(struct gmap *gmap, struct guest_fault *fault)\n \n \tlockdep_assert_held(\u0026gmap-\u003ekvm-\u003emmu_lock);\n \n-\trc = dat_entry_walk(NULL, fault-\u003egfn, gmap-\u003easce, DAT_WALK_LEAF, TABLE_TYPE_PAGE_TABLE,\n+\trc = dat_entry_walk(NULL, fault-\u003egfn, gmap-\u003edatt, DAT_WALK_LEAF, TABLE_TYPE_PAGE_TABLE,\n \t\t\t    \u0026fault-\u003ecrstep, \u0026fault-\u003eptep);\n \t/* If a PTE or a leaf CRSTE could not be reached, slow path. */\n \tif (rc)\n@@ -692,7 +789,7 @@ static int _gmap_link(struct kvm_s390_mmu_cache *mc, struct gmap *gmap, int leve\n \tunion pgste pgste;\n \tint rc = 0;\n \n-\trc = dat_entry_walk(mc, f-\u003egfn, gmap-\u003easce, DAT_WALK_ALLOC_CONTINUE, level,\n+\trc = dat_entry_walk(mc, f-\u003egfn, gmap-\u003edatt, DAT_WALK_ALLOC_CONTINUE, level,\n \t\t\t    \u0026f-\u003ecrstep, \u0026f-\u003eptep);\n \tif (rc == -ENOMEM)\n \t\treturn rc;\n@@ -707,6 +804,7 @@ static int _gmap_link(struct kvm_s390_mmu_cache *mc, struct gmap *gmap, int leve\n \t\tpgste = pgste_get_lock(f-\u003eptep);\n \t\toldpte = *f-\u003eptep;\n \t\tnewpte = _pte(f-\u003epfn, f-\u003ewritable, f-\u003ewrite_attempt | oldpte.s.d, !f-\u003epage);\n+\t\tnewpte.s.prefix_notif = oldpte.s.prefix_notif;\n \t\tnewpte.s.sd = oldpte.s.sd;\n \t\toldpte.s.sd = 0;\n \t\tif (oldpte.val == _PTE_EMPTY.val || oldpte.h.pfra == f-\u003epfn) {\n@@ -765,31 +863,29 @@ static int gmap_ucas_map_one(struct kvm_s390_mmu_cache *mc, struct gmap *gmap,\n \tint rc;\n \n \tif (force_alloc)\n-\t\trc = dat_entry_walk(mc, p_gfn, gmap-\u003eparent-\u003easce, DAT_WALK_ALLOC,\n+\t\trc = dat_entry_walk(mc, p_gfn, gmap-\u003eparent-\u003edatt, DAT_WALK_ALLOC,\n \t\t\t\t    TABLE_TYPE_PAGE_TABLE, \u0026crstep, \u0026ptep);\n \telse\n-\t\trc = dat_entry_walk(mc, p_gfn, gmap-\u003eparent-\u003easce, DAT_WALK_ALLOC_CONTINUE,\n+\t\trc = dat_entry_walk(mc, p_gfn, gmap-\u003eparent-\u003edatt, DAT_WALK_ALLOC_CONTINUE,\n \t\t\t\t    TABLE_TYPE_SEGMENT, \u0026crstep, \u0026ptep);\n \tif (rc)\n \t\treturn rc;\n \tif (!ptep) {\n-\t\tnewcrste = _crste_fc0(p_gfn, TABLE_TYPE_SEGMENT);\n-\t\tnewcrste.h.i = 1;\n-\t\tnewcrste.h.fc0.tl = 1;\n+\t\tnewcrste = _crste_ucas(p_gfn);\n \t} else {\n \t\tpt = pte_table_start(ptep);\n \t\tdat_set_ptval(pt, PTVAL_VMADDR, p_gfn \u003e\u003e (_SEGMENT_SHIFT - PAGE_SHIFT));\n \t\tnewcrste = _crste_fc0(virt_to_pfn(pt), TABLE_TYPE_SEGMENT);\n \t}\n-\trc = dat_entry_walk(mc, c_gfn, gmap-\u003easce, DAT_WALK_ALLOC, TABLE_TYPE_SEGMENT,\n-\t\t\t    \u0026crstep, \u0026ptep);\n+\trc = dat_entry_walk(mc, c_gfn, gmap-\u003edatt, DAT_WALK_ALLOC | DAT_WALK_IGN_HOLES,\n+\t\t\t    TABLE_TYPE_SEGMENT, \u0026crstep, \u0026ptep);\n \tif (rc)\n \t\treturn rc;\n \tdo {\n \t\toldcrste = READ_ONCE(*crstep);\n \t\tif (oldcrste.val == newcrste.val)\n \t\t\tbreak;\n-\t} while (!dat_crstep_xchg_atomic(crstep, oldcrste, newcrste, c_gfn, gmap-\u003easce));\n+\t} while (!dat_crstep_xchg_atomic(crstep, oldcrste, newcrste, c_gfn, gmap-\u003edatt.asce));\n \treturn 0;\n }\n \n@@ -798,8 +894,9 @@ static int gmap_ucas_translate_simple(struct gmap *gmap, gpa_t *gaddr, union crs\n \tunion pte *ptep;\n \tint rc;\n \n-\trc = dat_entry_walk(NULL, gpa_to_gfn(*gaddr), gmap-\u003easce, DAT_WALK_CONTINUE,\n-\t\t\t    TABLE_TYPE_SEGMENT, crstepp, \u0026ptep);\n+\trc = dat_entry_walk(NULL, gpa_to_gfn(*gaddr), gmap-\u003edatt,\n+\t\t\t    DAT_WALK_IGN_HOLES | DAT_WALK_ANY,\n+\t\t\t    TABLE_TYPE_PAGE_TABLE, crstepp, \u0026ptep);\n \tif (rc || (!ptep \u0026\u0026 !crste_is_ucas(**crstepp)))\n \t\treturn -EREMOTE;\n \tif (!ptep)\n@@ -836,26 +933,24 @@ int gmap_ucas_translate(struct kvm_s390_mmu_cache *mc, struct gmap *gmap, gpa_t\n \t\tif (rc \u003c= 0)\n \t\t\treturn rc;\n \t}\n-\tdo {\n-\t\tscoped_guard(write_lock, \u0026gmap-\u003ekvm-\u003emmu_lock) {\n-\t\t\trc = gmap_ucas_translate_simple(gmap, gaddr, \u0026crstep);\n-\t\t\tif (rc \u003c= 0)\n-\t\t\t\treturn rc;\n-\t\t\ttranslated_address = (*gaddr \u0026 ~_SEGMENT_MASK) |\n-\t\t\t\t\t     (crstep-\u003eval \u0026 _SEGMENT_MASK);\n-\t\t\trc = gmap_ucas_map_one(mc, gmap, gpa_to_gfn(translated_address), gfn, true);\n-\t\t}\n-\t\tif (!rc) {\n-\t\t\t*gaddr = translated_address;\n-\t\t\treturn 0;\n-\t\t}\n-\t\tif (rc != -ENOMEM)\n-\t\t\treturn -EREMOTE;\n-\t\trc = kvm_s390_mmu_cache_topup(mc);\n-\t\tif (rc)\n+\trc = kvm_s390_mmu_cache_topup(mc);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\tscoped_guard(write_lock, \u0026gmap-\u003ekvm-\u003emmu_lock) {\n+\t\trc = gmap_ucas_translate_simple(gmap, gaddr, \u0026crstep);\n+\t\tif (rc \u003c= 0)\n \t\t\treturn rc;\n-\t} while (1);\n-\treturn 0;\n+\t\ttranslated_address = (*gaddr \u0026 ~_SEGMENT_MASK) |\n+\t\t\t\t     (crstep-\u003eval \u0026 _SEGMENT_MASK);\n+\t\trc = gmap_ucas_map_one(mc, gmap, gpa_to_gfn(translated_address), gfn, true);\n+\t}\n+\n+\tif (!rc)\n+\t\t*gaddr = translated_address;\n+\tif (!rc || rc == -ENOMEM)\n+\t\treturn rc;\n+\treturn -EREMOTE;\n }\n \n int gmap_ucas_map(struct gmap *gmap, gfn_t p_gfn, gfn_t c_gfn, unsigned long count)\n@@ -892,10 +987,12 @@ static void gmap_ucas_unmap_one(struct gmap *gmap, gfn_t c_gfn)\n \tunion pte *ptep;\n \tint rc;\n \n-\trc = dat_entry_walk(NULL, c_gfn, gmap-\u003easce, 0, TABLE_TYPE_SEGMENT, \u0026crstep, \u0026ptep);\n-\tif (rc)\n+\trc = dat_entry_walk(NULL, c_gfn, gmap-\u003edatt, DAT_WALK_IGN_HOLES,\n+\t\t\t    TABLE_TYPE_SEGMENT, \u0026crstep, \u0026ptep);\n+\tif (rc || !is_pmd(*crstep))\n \t\treturn;\n-\twhile (!dat_crstep_xchg_atomic(crstep, READ_ONCE(*crstep), _PMD_EMPTY, c_gfn, gmap-\u003easce))\n+\twhile (!dat_crstep_xchg_atomic(crstep, READ_ONCE(*crstep), _PMD_EMPTY,\n+\t\t\t\t       c_gfn, gmap-\u003edatt.asce))\n \t\t;\n }\n \n@@ -920,7 +1017,7 @@ static long _gmap_split_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct\n \t\t\tgmap_unmap_prefix(gmap, gfn, next);\n \t\tif (crste.s.fc1.vsie_notif)\n \t\t\tgmap_handle_vsie_unshadow_event(gmap, gfn);\n-\t\tif (dat_crstep_xchg_atomic(crstep, crste, newcrste, gfn, walk-\u003easce))\n+\t\tif (dat_crstep_xchg_atomic(crstep, crste, newcrste, gfn, walk-\u003edatt.asce))\n \t\t\tbreak;\n \t\tcrste = READ_ONCE(*crstep);\n \t}\n@@ -941,7 +1038,7 @@ void gmap_split_huge_pages(struct gmap *gmap)\n \n \tdo {\n \t\tscoped_guard(read_lock, \u0026gmap-\u003ekvm-\u003emmu_lock)\n-\t\t\tstart = _dat_walk_gfn_range(start, asce_end(gmap-\u003easce), gmap-\u003easce,\n+\t\t\tstart = _dat_walk_gfn_range(start, dat_tables_end(gmap-\u003edatt), gmap-\u003edatt,\n \t\t\t\t\t\t    \u0026ops, DAT_WALK_IGN_HOLES, gmap);\n \t} while (start);\n }\n@@ -956,16 +1053,17 @@ static int _gmap_enable_skeys(struct gmap *gmap)\n \tif (uses_skeys(gmap))\n \t\treturn 0;\n \n-\tset_bit(GMAP_FLAG_USES_SKEYS, \u0026gmap-\u003eflags);\n+\tgmap-\u003edatt.uses_skeys = true;\n+\tgmap-\u003edatt.has_pgstes = true;\n \trc = gmap_helper_disable_cow_sharing();\n \tif (rc) {\n-\t\tclear_bit(GMAP_FLAG_USES_SKEYS, \u0026gmap-\u003eflags);\n+\t\tgmap-\u003edatt.uses_skeys = false;\n \t\treturn rc;\n \t}\n \n \tdo {\n \t\tscoped_guard(write_lock, \u0026gmap-\u003ekvm-\u003emmu_lock)\n-\t\t\tstart = dat_reset_skeys(gmap-\u003easce, start);\n+\t\t\tstart = dat_reset_skeys(gmap-\u003edatt, start);\n \t} while (start);\n \treturn 0;\n }\n@@ -1020,7 +1118,7 @@ int gmap_pv_destroy_range(struct gmap *gmap, gfn_t start, gfn_t end, bool interr\n \n \tdo {\n \t\tscoped_guard(read_lock, \u0026gmap-\u003ekvm-\u003emmu_lock)\n-\t\t\tstart = _dat_walk_gfn_range(start, end, gmap-\u003easce, \u0026ops,\n+\t\t\tstart = _dat_walk_gfn_range(start, end, gmap-\u003edatt, \u0026ops,\n \t\t\t\t\t\t    DAT_WALK_IGN_HOLES, NULL);\n \t\tif (interruptible \u0026\u0026 fatal_signal_pending(current))\n \t\t\treturn -EINTR;\n@@ -1072,14 +1170,13 @@ int gmap_protect_rmap(struct kvm_s390_mmu_cache *mc, struct gmap *sg, gfn_t p_gf\n \tunion pgste pgste;\n \tunion pte *ptep;\n \tunion pte pte;\n-\tint flags, rc;\n+\tint rc;\n \n \tif (KVM_BUG_ON(!is_shadow(sg) || level \u003c= TABLE_TYPE_PAGE_TABLE, sg-\u003ekvm))\n \t\treturn -EINVAL;\n \tlockdep_assert_held(\u0026sg-\u003eparent-\u003echildren_lock);\n \n-\tflags = DAT_WALK_SPLIT_ALLOC | (uses_skeys(sg-\u003eparent) ? DAT_WALK_USES_SKEYS : 0);\n-\trc = dat_entry_walk(mc, p_gfn, sg-\u003eparent-\u003easce, flags,\n+\trc = dat_entry_walk(mc, p_gfn, sg-\u003eparent-\u003edatt, DAT_WALK_SPLIT_ALLOC,\n \t\t\t    TABLE_TYPE_PAGE_TABLE, \u0026crstep, \u0026ptep);\n \tif (rc)\n \t\treturn rc;\n@@ -1140,8 +1237,8 @@ void _gmap_set_cmma_all(struct gmap *gmap, bool dirty)\n \n \tdo {\n \t\tscoped_guard(read_lock, \u0026gmap-\u003ekvm-\u003emmu_lock)\n-\t\t\tgfn = _dat_walk_gfn_range(gfn, asce_end(gmap-\u003easce), gmap-\u003easce, \u0026ops,\n-\t\t\t\t\t\t  DAT_WALK_IGN_HOLES,\n+\t\t\tgfn = _dat_walk_gfn_range(gfn, dat_tables_end(gmap-\u003edatt), gmap-\u003edatt,\n+\t\t\t\t\t\t  \u0026ops, DAT_WALK_IGN_HOLES,\n \t\t\t\t\t\t  \u0026gmap-\u003ekvm-\u003earch.cmma_dirty_pages);\n \t} while (gfn);\n }\n@@ -1159,15 +1256,15 @@ static void gmap_unshadow_level(struct gmap *sg, gfn_t r_gfn, int level)\n \t\talign = 1UL \u003c\u003c (11 * level + _SEGMENT_SHIFT);\n \tkvm_s390_vsie_gmap_notifier(sg, ALIGN_DOWN(gaddr, align), ALIGN(gaddr + 1, align));\n \tsg-\u003einvalidated = true;\n-\tif (dat_entry_walk(NULL, r_gfn, sg-\u003easce, 0, level, \u0026crstep, \u0026ptep))\n+\tif (dat_entry_walk(NULL, r_gfn, sg-\u003edatt, 0, level, \u0026crstep, \u0026ptep))\n \t\treturn;\n \tif (ptep) {\n \t\tif (READ_ONCE(*ptep).val != _PTE_EMPTY.val)\n-\t\t\tdat_ptep_xchg(ptep, _PTE_EMPTY, r_gfn, sg-\u003easce, uses_skeys(sg));\n+\t\t\tdat_ptep_xchg(ptep, _PTE_EMPTY, r_gfn, sg-\u003edatt);\n \t\treturn;\n \t}\n \n-\tcrste = dat_crstep_clear_atomic(crstep, r_gfn, sg-\u003easce);\n+\tcrste = dat_crstep_clear_atomic(crstep, r_gfn, sg-\u003edatt.asce);\n \tif (crste_leaf(crste) || crste.h.i)\n \t\treturn;\n \tif (is_pmd(crste))\ndiff --git a/arch/s390/kvm/gmap/gmap.h b/arch/s390/kvm/gmap/gmap.h\nindex 8f47f29c89fd2..6824507706ed9 100644\n--- a/arch/s390/kvm/gmap/gmap.h\n+++ b/arch/s390/kvm/gmap/gmap.h\n@@ -18,28 +18,20 @@\n  * enum gmap_flags - Flags of a gmap.\n  *\n  * @GMAP_FLAG_SHADOW: The gmap is a vsie shadow gmap.\n- * @GMAP_FLAG_OWNS_PAGETABLES: The gmap owns all dat levels; normally 1, is 0\n- *                             only for ucontrol per-cpu gmaps, since they\n- *                             share the page tables with the main gmap.\n  * @GMAP_FLAG_IS_UCONTROL: The gmap is ucontrol (main gmap or per-cpu gmap).\n  * @GMAP_FLAG_ALLOW_HPAGE_1M: 1M hugepages are allowed for this gmap,\n  *                            independently of the page size used by userspace.\n  * @GMAP_FLAG_ALLOW_HPAGE_2G: 2G hugepages are allowed for this gmap,\n  *                            independently of the page size used by userspace.\n  * @GMAP_FLAG_PFAULT_ENABLED: Pfault is enabled for the gmap.\n- * @GMAP_FLAG_USES_SKEYS: If the guest uses storage keys.\n- * @GMAP_FLAG_USES_CMM: Whether the guest uses CMMA.\n  * @GMAP_FLAG_EXPORT_ON_UNMAP: Whether to export guest pages when unmapping.\n  */\n enum gmap_flags {\n \tGMAP_FLAG_SHADOW = 0,\n-\tGMAP_FLAG_OWNS_PAGETABLES,\n \tGMAP_FLAG_IS_UCONTROL,\n \tGMAP_FLAG_ALLOW_HPAGE_1M,\n \tGMAP_FLAG_ALLOW_HPAGE_2G,\n \tGMAP_FLAG_PFAULT_ENABLED,\n-\tGMAP_FLAG_USES_SKEYS,\n-\tGMAP_FLAG_USES_CMM,\n \tGMAP_FLAG_EXPORT_ON_UNMAP,\n };\n \n@@ -49,7 +41,7 @@ enum gmap_flags {\n  * @flags: GMAP_FLAG_* flags.\n  * @edat_level: The edat level of this shadow gmap.\n  * @kvm: The vm.\n- * @asce: The ASCE used by this gmap.\n+ * @datt: The DAT tables used by this gmap.\n  * @list: List head used in children gmaps for the children gmap list.\n  * @children_lock: Protects children and scb_users.\n  * @children: List of child gmaps of this gmap.\n@@ -64,7 +56,7 @@ struct gmap {\n \tunsigned char edat_level;\n \tbool invalidated;\n \tstruct kvm *kvm;\n-\tunion asce asce;\n+\tstruct dat_tables datt;\n \tstruct list_head list;\n \tspinlock_t children_lock;\t/* Protects: children, scb_users */\n \tstruct list_head children;\n@@ -116,12 +108,12 @@ void gmap_split_huge_pages(struct gmap *gmap);\n \n static inline bool uses_skeys(struct gmap *gmap)\n {\n-\treturn test_bit(GMAP_FLAG_USES_SKEYS, \u0026gmap-\u003eflags);\n+\treturn has_pgstes(gmap-\u003edatt) \u0026\u0026 gmap-\u003edatt.uses_skeys;\n }\n \n static inline bool uses_cmm(struct gmap *gmap)\n {\n-\treturn test_bit(GMAP_FLAG_USES_CMM, \u0026gmap-\u003eflags);\n+\treturn has_pgstes(gmap-\u003edatt) \u0026\u0026 gmap-\u003edatt.uses_cmma;\n }\n \n static inline bool pfault_enabled(struct gmap *gmap)\n@@ -131,17 +123,21 @@ static inline bool pfault_enabled(struct gmap *gmap)\n \n static inline bool is_ucontrol(struct gmap *gmap)\n {\n+#ifdef CONFIG_KVM_S390_UCONTROL\n \treturn test_bit(GMAP_FLAG_IS_UCONTROL, \u0026gmap-\u003eflags);\n+#else\n+\treturn 0;\n+#endif\n }\n \n-static inline bool is_shadow(struct gmap *gmap)\n+static inline bool export_on_unmap(struct gmap *gmap)\n {\n-\treturn test_bit(GMAP_FLAG_SHADOW, \u0026gmap-\u003eflags);\n+\treturn test_bit(GMAP_FLAG_EXPORT_ON_UNMAP, \u0026gmap-\u003eflags);\n }\n \n-static inline bool owns_page_tables(struct gmap *gmap)\n+static inline bool is_shadow(struct gmap *gmap)\n {\n-\treturn test_bit(GMAP_FLAG_OWNS_PAGETABLES, \u0026gmap-\u003eflags);\n+\treturn test_bit(GMAP_FLAG_SHADOW, \u0026gmap-\u003eflags);\n }\n \n static inline struct gmap *gmap_put(struct gmap *gmap)\n@@ -232,8 +228,8 @@ static inline union pgste _gmap_ptep_xchg(struct gmap *gmap, union pte *ptep, un\n \telse\n \t\tlockdep_assert_not_held(\u0026gmap-\u003echildren_lock);\n \n-\tif (pgste.prefix_notif \u0026\u0026 (newpte.h.p || newpte.h.i)) {\n-\t\tpgste.prefix_notif = 0;\n+\tif (ptep-\u003es.prefix_notif \u0026\u0026 (newpte.h.p || newpte.h.i)) {\n+\t\tnewpte.s.prefix_notif = 0;\n \t\tgmap_unmap_prefix(gmap, gfn, gfn + 1);\n \t}\n \tif (pte_needs_unshadow(*ptep, newpte, pgste)) {\n@@ -247,7 +243,7 @@ static inline union pgste _gmap_ptep_xchg(struct gmap *gmap, union pte *ptep, un\n \tif (!ptep-\u003es.d \u0026\u0026 newpte.s.d \u0026\u0026 !newpte.s.s)\n \t\tSetPageDirty(pfn_to_page(newpte.h.pfra));\n \tpgste.zero = 0;\n-\treturn __dat_ptep_xchg(ptep, pgste, newpte, gfn, gmap-\u003easce, uses_skeys(gmap));\n+\treturn __dat_ptep_xchg(ptep, pgste, newpte, gfn, gmap-\u003edatt);\n }\n \n static inline union pgste gmap_ptep_xchg(struct gmap *gmap, union pte *ptep, union pte newpte,\n@@ -305,7 +301,7 @@ static inline bool __must_check _gmap_crstep_xchg_atomic(struct gmap *gmap, unio\n \t\t\tgmap_handle_vsie_unshadow_event(gmap, gfn);\n \t\telse\n \t\t\t_gmap_handle_vsie_unshadow_event(gmap, gfn);\n-\t\tif (!dat_crstep_xchg_atomic(crstep, oldcrste, newcrste, gfn, gmap-\u003easce))\n+\t\tif (!dat_crstep_xchg_atomic(crstep, oldcrste, newcrste, gfn, gmap-\u003edatt.asce))\n \t\t\treturn false;\n \t\t/*\n \t\t * Return false even if the swap was successful, as it only\n@@ -319,7 +315,7 @@ static inline bool __must_check _gmap_crstep_xchg_atomic(struct gmap *gmap, unio\n \t}\n \tif (!oldcrste.s.fc1.d \u0026\u0026 newcrste.s.fc1.d \u0026\u0026 !newcrste.s.fc1.s)\n \t\tSetPageDirty(phys_to_page(crste_origin_large(newcrste)));\n-\treturn dat_crstep_xchg_atomic(crstep, oldcrste, newcrste, gfn, gmap-\u003easce);\n+\treturn dat_crstep_xchg_atomic(crstep, oldcrste, newcrste, gfn, gmap-\u003edatt.asce);\n }\n \n static inline bool __must_check gmap_crstep_xchg_atomic(struct gmap *gmap, union crste *crstep,\ndiff --git a/arch/s390/kvm/gmap/kvm_mmu.c b/arch/s390/kvm/gmap/kvm_mmu.c\nindex c2ffb5e59ec63..784c4aae59958 100644\n--- a/arch/s390/kvm/gmap/kvm_mmu.c\n+++ b/arch/s390/kvm/gmap/kvm_mmu.c\n@@ -72,7 +72,7 @@ int s390_kvm_mmu_prepare_memory_region(struct kvm *kvm,\n \t\t\treturn -EINVAL;\n \t\tif ((new-\u003ebase_gfn + new-\u003enpages) * PAGE_SIZE \u003e kvm-\u003earch.mem_limit)\n \t\t\treturn -EINVAL;\n-\t\tif (!asce_contains_gfn(kvm-\u003earch.gmap-\u003easce, new-\u003ebase_gfn + new-\u003enpages - 1))\n+\t\tif (!dat_tables_contain_gfn(kvm-\u003earch.gmap-\u003edatt, new-\u003ebase_gfn + new-\u003enpages - 1))\n \t\t\treturn -EINVAL;\n \t}\n \n@@ -102,9 +102,9 @@ int s390_kvm_mmu_prepare_memory_region(struct kvm *kvm,\n \tscoped_guard(write_lock, \u0026kvm-\u003emmu_lock) {\n \t\tkvm_s390_update_cmma_dirty(kvm, old);\n \t\tif (change == KVM_MR_DELETE || change == KVM_MR_MOVE)\n-\t\t\trc = dat_delete_slot(kvm-\u003earch.gmap-\u003easce, old-\u003ebase_gfn, old-\u003enpages);\n+\t\t\trc = dat_delete_slot(kvm-\u003earch.gmap-\u003edatt, old-\u003ebase_gfn, old-\u003enpages);\n \t\tif (!rc \u0026\u0026 (change == KVM_MR_MOVE || change == KVM_MR_CREATE))\n-\t\t\trc = dat_create_slot(mc, kvm-\u003earch.gmap-\u003easce, new-\u003ebase_gfn, new-\u003enpages);\n+\t\t\trc = dat_create_slot(mc, kvm-\u003earch.gmap-\u003edatt, new-\u003ebase_gfn, new-\u003enpages);\n \t}\n \t/*\n \t * Can only be triggered if dat_{create,delete}_slot() found an\ndiff --git a/arch/s390/kvm/s390/gaccess.c b/arch/s390/kvm/s390/gaccess.c\nindex 2d27dcb680029..eff16f9edfadb 100644\n--- a/arch/s390/kvm/s390/gaccess.c\n+++ b/arch/s390/kvm/s390/gaccess.c\n@@ -653,7 +653,7 @@ static int vm_check_access_key_gpa(struct kvm *kvm, u8 access_key,\n \tint r;\n \n \tscoped_guard(read_lock, \u0026kvm-\u003emmu_lock)\n-\t\tr = dat_get_storage_key(kvm-\u003earch.gmap-\u003easce, gpa_to_gfn(gpa), \u0026storage_key);\n+\t\tr = dat_get_storage_key(kvm-\u003earch.gmap-\u003edatt, gpa_to_gfn(gpa), \u0026storage_key);\n \tif (r)\n \t\treturn r;\n \tif (access_key == 0 || storage_key.acc == access_key)\n@@ -712,7 +712,7 @@ static int vcpu_check_access_key_gpa(struct kvm_vcpu *vcpu, u8 access_key,\n \t * assume that this cannot fail\n \t */\n \tscoped_guard(read_lock, \u0026vcpu-\u003ekvm-\u003emmu_lock)\n-\t\tr = dat_get_storage_key(vcpu-\u003earch.gmap-\u003easce, gpa_to_gfn(gpa), \u0026storage_key);\n+\t\tr = dat_get_storage_key(vcpu-\u003earch.gmap-\u003edatt, gpa_to_gfn(gpa), \u0026storage_key);\n \tif (r)\n \t\treturn r;\n \t/* access key matches storage key -\u003e allow */\n@@ -1286,7 +1286,7 @@ static int walk_guest_tables(struct gmap *sg, unsigned long saddr, struct pgtwal\n \t\treturn -EAGAIN;\n \tkvm = parent-\u003ekvm;\n \tWARN_ON(!kvm);\n-\tasce = sg-\u003eguest_asce;\n+\tasce.val = sg-\u003eguest_asce.val;\n \tentries = get_entries(w);\n \n \tw-\u003elevel = LEVEL_MEM;\n@@ -1435,6 +1435,7 @@ static int _do_shadow_pte(struct kvm_s390_mmu_cache *mc, struct gmap *sg, gpa_t\n \tnewpte.s.d |= ptep_h-\u003es.d;\n \tnewpte.s.sd |= ptep_h-\u003es.sd;\n \tnewpte.h.p \u0026= ptep_h-\u003eh.p;\n+\tnewpte.s.prefix_notif = ptep_h-\u003es.prefix_notif;\n \tif (!newpte.h.p \u0026\u0026 !f-\u003ewritable) {\n \t\trc = -EOPNOTSUPP;\n \t} else {\n@@ -1451,7 +1452,7 @@ static int _do_shadow_pte(struct kvm_s390_mmu_cache *mc, struct gmap *sg, gpa_t\n \tnewpte = _pte(f-\u003epfn, 0, !p, 0);\n \tif (!pgste_get_trylock(ptep, \u0026pgste))\n \t\treturn -EAGAIN;\n-\tpgste = __dat_ptep_xchg(ptep, pgste, newpte, gpa_to_gfn(raddr), sg-\u003easce, uses_skeys(sg));\n+\tpgste = __dat_ptep_xchg(ptep, pgste, newpte, gpa_to_gfn(raddr), sg-\u003edatt);\n \tpgste_set_unlock(ptep, pgste);\n \n \treturn 0;\n@@ -1494,7 +1495,7 @@ static int _do_shadow_crste(struct kvm_s390_mmu_cache *mc, struct gmap *sg, gpa_\n \t\treturn -EAGAIN;\n \n \tnewcrste = _crste_fc1(f-\u003epfn, oldcrste.h.tt, 0, !p);\n-\twhile (!dat_crstep_xchg_atomic(table, READ_ONCE(*table), newcrste, r_gfn, sg-\u003easce))\n+\twhile (!dat_crstep_xchg_atomic(table, READ_ONCE(*table), newcrste, r_gfn, sg-\u003edatt.asce))\n \t\t;\n \treturn 0;\n }\n@@ -1503,9 +1504,9 @@ static int _gaccess_do_shadow(struct kvm_s390_mmu_cache *mc, struct gmap *sg,\n \t\t\t      unsigned long saddr, struct pgtwalk *w)\n {\n \tstruct guest_fault *entries;\n-\tint flags, i, hl, gl, l, rc;\n \tunion crste *table, *host;\n \tunion pte *ptep, *ptep_h;\n+\tint i, hl, gl, l, rc;\n \n \tlockdep_assert_held(\u0026sg-\u003ekvm-\u003emmu_lock);\n \tlockdep_assert_held(\u0026sg-\u003eparent-\u003echildren_lock);\n@@ -1514,8 +1515,8 @@ static int _gaccess_do_shadow(struct kvm_s390_mmu_cache *mc, struct gmap *sg,\n \tptep_h = NULL;\n \tptep = NULL;\n \n-\trc = dat_entry_walk(NULL, gpa_to_gfn(saddr), sg-\u003easce, DAT_WALK_ANY, TABLE_TYPE_PAGE_TABLE,\n-\t\t\t    \u0026table, \u0026ptep);\n+\trc = dat_entry_walk(NULL, gpa_to_gfn(saddr), sg-\u003edatt, DAT_WALK_ANY,\n+\t\t\t    TABLE_TYPE_PAGE_TABLE, \u0026table, \u0026ptep);\n \tif (rc)\n \t\treturn rc;\n \n@@ -1546,7 +1547,7 @@ static int _gaccess_do_shadow(struct kvm_s390_mmu_cache *mc, struct gmap *sg,\n \t\t\treturn -EAGAIN;\n \t}\n \n-\trc = dat_entry_walk(NULL, entries[LEVEL_MEM].gfn, sg-\u003eparent-\u003easce, DAT_WALK_LEAF,\n+\trc = dat_entry_walk(NULL, entries[LEVEL_MEM].gfn, sg-\u003eparent-\u003edatt, DAT_WALK_LEAF,\n \t\t\t    TABLE_TYPE_PAGE_TABLE, \u0026host, \u0026ptep_h);\n \tif (rc)\n \t\treturn rc;\n@@ -1556,16 +1557,16 @@ static int _gaccess_do_shadow(struct kvm_s390_mmu_cache *mc, struct gmap *sg,\n \tl = min3(gl, hl, w-\u003elevel);\n \n real_address_space:\n-\tflags = DAT_WALK_SPLIT_ALLOC | (uses_skeys(sg-\u003eparent) ? DAT_WALK_USES_SKEYS : 0);\n \t/* If necessary, create the shadow mapping */\n \tif (l \u003c gl) {\n-\t\trc = dat_entry_walk(mc, gpa_to_gfn(saddr), sg-\u003easce, flags, l, \u0026table, \u0026ptep);\n+\t\trc = dat_entry_walk(mc, gpa_to_gfn(saddr), sg-\u003edatt, DAT_WALK_SPLIT_ALLOC, l,\n+\t\t\t\t    \u0026table, \u0026ptep);\n \t\tif (rc)\n \t\t\treturn rc;\n \t}\n \tif (l \u003c hl) {\n-\t\trc = dat_entry_walk(mc, entries[LEVEL_MEM].gfn, sg-\u003eparent-\u003easce,\n-\t\t\t\t    flags, l, \u0026host, \u0026ptep_h);\n+\t\trc = dat_entry_walk(mc, entries[LEVEL_MEM].gfn, sg-\u003eparent-\u003edatt,\n+\t\t\t\t    DAT_WALK_SPLIT_ALLOC, l, \u0026host, \u0026ptep_h);\n \t\tif (rc)\n \t\t\treturn rc;\n \t}\ndiff --git a/arch/s390/kvm/s390/priv.c b/arch/s390/kvm/s390/priv.c\nindex b3cb2c2c3aa71..1d9e81f6429ba 100644\n--- a/arch/s390/kvm/s390/priv.c\n+++ b/arch/s390/kvm/s390/priv.c\n@@ -276,7 +276,7 @@ static int handle_iske(struct kvm_vcpu *vcpu)\n \tgaddr = kvm_s390_logical_to_effective(vcpu, gaddr);\n \tgaddr = kvm_s390_real_to_abs(vcpu, gaddr);\n \tscoped_guard(read_lock, \u0026vcpu-\u003ekvm-\u003emmu_lock)\n-\t\trc = dat_get_storage_key(vcpu-\u003earch.gmap-\u003easce, gpa_to_gfn(gaddr), \u0026key);\n+\t\trc = dat_get_storage_key(vcpu-\u003earch.gmap-\u003edatt, gpa_to_gfn(gaddr), \u0026key);\n \tif (rc \u003e 0)\n \t\treturn kvm_s390_inject_program_int(vcpu, rc);\n \tif (rc \u003c 0)\n@@ -308,7 +308,7 @@ static int handle_rrbe(struct kvm_vcpu *vcpu)\n \tgaddr = kvm_s390_logical_to_effective(vcpu, gaddr);\n \tgaddr = kvm_s390_real_to_abs(vcpu, gaddr);\n \tscoped_guard(read_lock, \u0026vcpu-\u003ekvm-\u003emmu_lock)\n-\t\trc = dat_reset_reference_bit(vcpu-\u003earch.gmap-\u003easce, gpa_to_gfn(gaddr), \u0026skey);\n+\t\trc = dat_reset_reference_bit(vcpu-\u003earch.gmap-\u003edatt, gpa_to_gfn(gaddr), \u0026skey);\n \tif (rc \u003e 0)\n \t\treturn kvm_s390_inject_program_int(vcpu, rc);\n \tif (rc \u003c 0)\n@@ -360,7 +360,7 @@ static int handle_sske(struct kvm_vcpu *vcpu)\n \n \twhile (start != end) {\n \t\tscoped_guard(read_lock, \u0026vcpu-\u003ekvm-\u003emmu_lock) {\n-\t\t\trc = dat_cond_set_storage_key(vcpu-\u003earch.mc, vcpu-\u003earch.gmap-\u003easce,\n+\t\t\trc = dat_cond_set_storage_key(vcpu-\u003earch.mc, vcpu-\u003earch.gmap-\u003edatt,\n \t\t\t\t\t\t      gpa_to_gfn(start), key, \u0026oldkey,\n \t\t\t\t\t\t      m3 \u0026 SSKE_NQ, m3 \u0026 SSKE_MR, m3 \u0026 SSKE_MC);\n \t\t}\n@@ -1118,7 +1118,7 @@ static int handle_pfmf(struct kvm_vcpu *vcpu)\n \t\t\tif (rc)\n \t\t\t\treturn rc;\n \t\t\tscoped_guard(read_lock, \u0026vcpu-\u003ekvm-\u003emmu_lock) {\n-\t\t\t\trc = dat_cond_set_storage_key(vcpu-\u003earch.mc, vcpu-\u003earch.gmap-\u003easce,\n+\t\t\t\trc = dat_cond_set_storage_key(vcpu-\u003earch.mc, vcpu-\u003earch.gmap-\u003edatt,\n \t\t\t\t\t\t\t      gpa_to_gfn(start), key,\n \t\t\t\t\t\t\t      NULL, nq, mr, mc);\n \t\t\t}\n@@ -1167,7 +1167,7 @@ static inline int __do_essa(struct kvm_vcpu *vcpu, const int orc)\n \tgfn = vcpu-\u003erun-\u003es.regs.gprs[r2] \u003e\u003e PAGE_SHIFT;\n \tentries = (vcpu-\u003earch.sie_block-\u003ecbrlo \u0026 ~PAGE_MASK) \u003e\u003e 3;\n \n-\tnappended = dat_perform_essa(vcpu-\u003earch.gmap-\u003easce, gfn, orc, \u0026state, \u0026dirtied);\n+\tnappended = dat_perform_essa(vcpu-\u003earch.gmap-\u003edatt, gfn, orc, \u0026state, \u0026dirtied);\n \tvcpu-\u003erun-\u003es.regs.gprs[r1] = state.val;\n \tif (nappended \u003c 0)\n \t\treturn 0;\n@@ -1199,7 +1199,7 @@ static void _essa_clear_cbrl(struct kvm_vcpu *vcpu, unsigned long *cbrl, int len\n \tlockdep_assert_held(\u0026vcpu-\u003ekvm-\u003emmu_lock);\n \n \tfor (i = 0; i \u003c len; i++) {\n-\t\tif (dat_entry_walk(NULL, gpa_to_gfn(cbrl[i]), vcpu-\u003earch.gmap-\u003easce,\n+\t\tif (dat_entry_walk(NULL, gpa_to_gfn(cbrl[i]), vcpu-\u003earch.gmap-\u003edatt,\n \t\t\t\t   0, TABLE_TYPE_PAGE_TABLE, \u0026crstep, \u0026ptep))\n \t\t\tcontinue;\n \t\tif (!ptep || ptep-\u003es.pr)\n@@ -1238,6 +1238,7 @@ static int handle_essa(struct kvm_vcpu *vcpu)\n \t\treturn kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);\n \n \tif (!READ_ONCE(vcpu-\u003ekvm-\u003earch.migration_mode)) {\n+\t\tWRITE_ONCE(vcpu-\u003earch.gmap-\u003edatt.has_pgstes, true);\n \t\t/*\n \t\t * CMMA is enabled in the KVM settings, but is disabled in\n \t\t * the SIE block and in the mm_context, and we are not doing\n@@ -1247,7 +1248,7 @@ static int handle_essa(struct kvm_vcpu *vcpu)\n \t\t * value really needs to be written to; if the value is\n \t\t * already correct, we do nothing and avoid the lock.\n \t\t */\n-\t\tset_bit(GMAP_FLAG_USES_CMM, \u0026vcpu-\u003earch.gmap-\u003eflags);\n+\t\tWRITE_ONCE(vcpu-\u003earch.gmap-\u003edatt.uses_cmma, true);\n \t\t/*\n \t\t * If we are here, we are supposed to have CMMA enabled in\n \t\t * the SIE block. Enabling CMMA works on a per-CPU basis,\ndiff --git a/arch/s390/kvm/s390/pv.c b/arch/s390/kvm/s390/pv.c\nindex b18abd0e29efc..d565b02e47b12 100644\n--- a/arch/s390/kvm/s390/pv.c\n+++ b/arch/s390/kvm/s390/pv.c\n@@ -487,7 +487,7 @@ int kvm_s390_pv_set_aside(struct kvm *kvm, u16 *rc, u16 *rrc)\n \t\treturn -EINVAL;\n \n \t/* Guest with segment type ASCE, refuse to destroy asynchronously */\n-\tif (kvm-\u003earch.gmap-\u003easce.dt == TABLE_TYPE_SEGMENT)\n+\tif (kvm-\u003earch.gmap-\u003edatt.asce.dt == TABLE_TYPE_SEGMENT)\n \t\treturn -EINVAL;\n \n \tpriv = kzalloc_obj(*priv);\n@@ -500,7 +500,7 @@ int kvm_s390_pv_set_aside(struct kvm *kvm, u16 *rc, u16 *rrc)\n \t\tpriv-\u003estor_var = kvm-\u003earch.pv.stor_var;\n \t\tpriv-\u003estor_base = kvm-\u003earch.pv.stor_base;\n \t\tpriv-\u003ehandle = kvm_s390_pv_get_handle(kvm);\n-\t\tpriv-\u003eold_gmap_table = (unsigned long)dereference_asce(kvm-\u003earch.gmap-\u003easce);\n+\t\tpriv-\u003eold_gmap_table = (unsigned long)kvm-\u003earch.gmap-\u003edatt.table;\n \t\tif (s390_replace_asce(kvm-\u003earch.gmap))\n \t\t\tres = -ENOMEM;\n \t}\n@@ -626,7 +626,8 @@ int kvm_s390_pv_deinit_cleanup_all(struct kvm *kvm, u16 *rc, u16 *rrc)\n \t * cleanup has been performed.\n \t */\n \tif (need_zap \u0026\u0026 mmget_not_zero(kvm-\u003emm)) {\n-\t\tgmap_pv_destroy_range(kvm-\u003earch.gmap, 0, asce_end(kvm-\u003earch.gmap-\u003easce), false);\n+\t\tgmap_pv_destroy_range(kvm-\u003earch.gmap, 0, dat_tables_end(kvm-\u003earch.gmap-\u003edatt),\n+\t\t\t\t      false);\n \t\tmmput(kvm-\u003emm);\n \t}\n \n@@ -664,7 +665,7 @@ int kvm_s390_pv_deinit_aside_vm(struct kvm *kvm, u16 *rc, u16 *rrc)\n \t\treturn -EINVAL;\n \n \t/* When a fatal signal is received, stop immediately */\n-\tif (gmap_pv_destroy_range(kvm-\u003earch.gmap, 0, asce_end(kvm-\u003earch.gmap-\u003easce), true))\n+\tif (gmap_pv_destroy_range(kvm-\u003earch.gmap, 0, dat_tables_end(kvm-\u003earch.gmap-\u003edatt), true))\n \t\tgoto done;\n \tif (kvm_s390_pv_dispose_one_leftover(kvm, p, rc, rrc))\n \t\tret = -EIO;\n@@ -737,7 +738,7 @@ int kvm_s390_pv_init_vm(struct kvm *kvm, u16 *rc, u16 *rrc)\n \t/* Inputs */\n \tuvcb.guest_stor_origin = 0; /* MSO is 0 for KVM */\n \tuvcb.guest_stor_len = kvm-\u003earch.pv.guest_len;\n-\tuvcb.guest_asce = kvm-\u003earch.gmap-\u003easce.val;\n+\tuvcb.guest_asce = kvm-\u003earch.gmap-\u003edatt.asce.val;\n \tuvcb.guest_sca = virt_to_phys(kvm-\u003earch.sca);\n \tuvcb.conf_base_stor_origin =\n \t\tvirt_to_phys((void *)kvm-\u003earch.pv.stor_base);\ndiff --git a/arch/s390/kvm/s390/s390.c b/arch/s390/kvm/s390/s390.c\nindex e4912db67adc1..71d79b4437ac0 100644\n--- a/arch/s390/kvm/s390/s390.c\n+++ b/arch/s390/kvm/s390/s390.c\n@@ -212,7 +212,7 @@ module_param(nested, int, S_IRUGO);\n MODULE_PARM_DESC(nested, \"Nested virtualization support\");\n \n /* allow 1m huge page guest backing */\n-static int hpage;\n+static int hpage = 1;\n module_param(hpage, int, 0444);\n MODULE_PARM_DESC(hpage, \"1m huge page backing support\");\n \n@@ -563,25 +563,23 @@ static int kvm_s390_keyop(struct kvm_s390_mmu_cache *mc, struct kvm *kvm, int op\n \t\t\t  unsigned long addr, union skey skey)\n {\n \tgfn_t gfn = gpa_to_gfn(addr);\n-\tunion asce asce;\n \tint r;\n \n \tguard(read_lock)(\u0026kvm-\u003emmu_lock);\n-\tasce = kvm-\u003earch.gmap-\u003easce;\n \n \tswitch (op) {\n \tcase KVM_S390_KEYOP_SSKE:\n-\t\tr = dat_cond_set_storage_key(mc, asce, gfn, skey, \u0026skey, 0, 0, 0);\n+\t\tr = dat_cond_set_storage_key(mc, kvm-\u003earch.gmap-\u003edatt, gfn, skey, \u0026skey, 0, 0, 0);\n \t\tif (r == 0 || r == 1)\n \t\t\treturn skey.skey;\n \t\tbreak;\n \tcase KVM_S390_KEYOP_ISKE:\n-\t\tr = dat_get_storage_key(asce, gfn, \u0026skey);\n+\t\tr = dat_get_storage_key(kvm-\u003earch.gmap-\u003edatt, gfn, \u0026skey);\n \t\tif (!r)\n \t\t\treturn skey.skey;\n \t\tbreak;\n \tcase KVM_S390_KEYOP_RRBE:\n-\t\tr = dat_reset_reference_bit(asce, gfn, \u0026skey);\n+\t\tr = dat_reset_reference_bit(kvm-\u003earch.gmap-\u003edatt, gfn, \u0026skey);\n \t\tif (!r)\n \t\t\treturn skey.skey;\n \t\tbreak;\n@@ -1001,7 +999,7 @@ static int kvm_s390_set_mem_control(struct kvm *kvm, struct kvm_device_attr *att\n \t\tVM_EVENT(kvm, 3, \"%s\", \"RESET: CMMA states\");\n \t\tdo {\n \t\t\tscoped_guard(read_lock, \u0026kvm-\u003emmu_lock)\n-\t\t\t\tstart_gfn = dat_reset_cmma(kvm-\u003earch.gmap-\u003easce, start_gfn);\n+\t\t\t\tstart_gfn = dat_reset_cmma(kvm-\u003earch.gmap-\u003edatt, start_gfn);\n \t\t} while (start_gfn);\n \t\tret = 0;\n \t\tbreak;\n@@ -1048,7 +1046,7 @@ static int kvm_s390_set_mem_control(struct kvm *kvm, struct kvm_device_attr *att\n \t\tif (ret)\n \t\t\tbreak;\n \t\tVM_EVENT(kvm, 3, \"SET: max guest address: %lu\", new_limit);\n-\t\tVM_EVENT(kvm, 3, \"New guest asce: 0x%p\", (void *)kvm-\u003earch.gmap-\u003easce.val);\n+\t\tVM_EVENT(kvm, 3, \"New guest asce: 0x%p\", (void *)kvm-\u003earch.gmap-\u003edatt.asce.val);\n \t\tbreak;\n \t}\n \tdefault:\n@@ -2174,7 +2172,7 @@ static int kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)\n \n \tscoped_guard(read_lock, \u0026kvm-\u003emmu_lock) {\n \t\tfor (i = 0; i \u003c args-\u003ecount; i++) {\n-\t\t\tr = dat_get_storage_key(kvm-\u003earch.gmap-\u003easce,\n+\t\t\tr = dat_get_storage_key(kvm-\u003earch.gmap-\u003edatt,\n \t\t\t\t\t\targs-\u003estart_gfn + i, keys + i);\n \t\t\tif (r)\n \t\t\t\tbreak;\n@@ -2241,7 +2239,7 @@ static int kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)\n \t\t\tbreak;\n \t\tscoped_guard(read_lock, \u0026kvm-\u003emmu_lock) {\n \t\t\tfor (i = 0 ; i \u003c args-\u003ecount; i++) {\n-\t\t\t\tr = dat_set_storage_key(mc, kvm-\u003earch.gmap-\u003easce,\n+\t\t\t\tr = dat_set_storage_key(mc, kvm-\u003earch.gmap-\u003edatt,\n \t\t\t\t\t\t\targs-\u003estart_gfn + i, keys[i], 0);\n \t\t\t\tif (r)\n \t\t\t\t\tbreak;\n@@ -2295,10 +2293,10 @@ static int kvm_s390_get_cmma_bits(struct kvm *kvm,\n \n \tscoped_guard(read_lock, \u0026kvm-\u003emmu_lock) {\n \t\tif (peek)\n-\t\t\tret = dat_peek_cmma(args-\u003estart_gfn, kvm-\u003earch.gmap-\u003easce, \u0026args-\u003ecount,\n+\t\t\tret = dat_peek_cmma(args-\u003estart_gfn, kvm-\u003earch.gmap-\u003edatt, \u0026args-\u003ecount,\n \t\t\t\t\t    values);\n \t\telse\n-\t\t\tret = dat_get_cmma(kvm-\u003earch.gmap-\u003easce, \u0026args-\u003estart_gfn, \u0026args-\u003ecount,\n+\t\t\tret = dat_get_cmma(kvm-\u003earch.gmap-\u003edatt, \u0026args-\u003estart_gfn, \u0026args-\u003ecount,\n \t\t\t\t\t   values, \u0026kvm-\u003earch.cmma_dirty_pages);\n \t}\n \n@@ -2354,12 +2352,13 @@ static int kvm_s390_set_cmma_bits(struct kvm *kvm,\n \t\tif (r)\n \t\t\treturn r;\n \t\tscoped_guard(read_lock, \u0026kvm-\u003emmu_lock) {\n-\t\t\tr = dat_set_cmma_bits(mc, kvm-\u003earch.gmap-\u003easce, args-\u003estart_gfn,\n+\t\t\tr = dat_set_cmma_bits(mc, kvm-\u003earch.gmap-\u003edatt, args-\u003estart_gfn,\n \t\t\t\t\t      args-\u003ecount, args-\u003emask, bits);\n \t\t}\n \t} while (r == -ENOMEM);\n \n-\tset_bit(GMAP_FLAG_USES_CMM, \u0026kvm-\u003earch.gmap-\u003eflags);\n+\tWRITE_ONCE(kvm-\u003earch.gmap-\u003edatt.has_pgstes, true);\n+\tWRITE_ONCE(kvm-\u003earch.gmap-\u003edatt.uses_cmma, true);\n \n \treturn r \u003c= 0 ? r : -EFAULT;\n }\n@@ -3346,13 +3345,18 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)\n \t\t\t.flags = 0,\n \t\t};\n \n+\t\trc = gmap_enable_skeys(kvm-\u003earch.gmap);\n+\t\tif (rc)\n+\t\t\tgoto out_err;\n \t\t/* one flat fake memslot covering the whole address-space */\n \t\tmutex_lock(\u0026kvm-\u003eslots_lock);\n-\t\tKVM_BUG_ON(kvm_set_internal_memslot(kvm, \u0026fake_memslot), kvm);\n+\t\trc = kvm_set_internal_memslot(kvm, \u0026fake_memslot);\n \t\tmutex_unlock(\u0026kvm-\u003eslots_lock);\n+\t\tif (KVM_BUG_ON(rc, kvm))\n+\t\t\tgoto out_err;\n \t\tset_bit(GMAP_FLAG_IS_UCONTROL, \u0026kvm-\u003earch.gmap-\u003eflags);\n \t} else {\n-\t\tstruct crst_table *table = dereference_asce(kvm-\u003earch.gmap-\u003easce);\n+\t\tstruct crst_table *table = kvm-\u003earch.gmap-\u003edatt.table;\n \n \t\tcrst_table_init((void *)table, _CRSTE_HOLE(table-\u003ecrstes[0].h.tt).val);\n \t}\n@@ -3369,6 +3373,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)\n \n \treturn 0;\n out_err:\n+\tif (kvm-\u003earch.gmap)\n+\t\tkvm-\u003earch.gmap = gmap_put(kvm-\u003earch.gmap);\n \tfree_page((unsigned long)kvm-\u003earch.sie_page2);\n \tdebug_unregister(kvm-\u003earch.dbf);\n \tsca_dispose(kvm);\n@@ -4328,7 +4334,7 @@ static int kvm_s390_fixup_prefix(struct kvm_vcpu *vcpu)\n \t\treturn rc;\n \n \tscoped_guard(write_lock, \u0026vcpu-\u003ekvm-\u003emmu_lock)\n-\t\trc = dat_set_prefix_notif_bit(vcpu-\u003ekvm-\u003earch.gmap-\u003easce, gfn);\n+\t\trc = dat_set_prefix_notif_bit(vcpu-\u003ekvm-\u003earch.gmap-\u003edatt, gfn);\n \treturn rc;\n }\n \n@@ -4806,7 +4812,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)\n \n \t\tsie_return = kvm_s390_enter_exit_sie(vcpu-\u003earch.sie_block,\n \t\t\t\t\t\t     vcpu-\u003erun-\u003es.regs.gprs,\n-\t\t\t\t\t\t     vcpu-\u003earch.gmap-\u003easce.val);\n+\t\t\t\t\t\t     vcpu-\u003earch.gmap-\u003edatt.asce.val);\n \n \t\t__enable_cpu_timer_accounting(vcpu);\n \t\tguest_timing_exit_irqoff();\n@@ -5769,7 +5775,7 @@ void kvm_s390_update_cmma_dirty(struct kvm *kvm, const struct kvm_memory_slot *o\n \n \tif (kvm-\u003earch.migration_mode \u0026\u0026 kvm-\u003earch.use_cmma \u0026\u0026 old) {\n \t\t_dat_walk_gfn_range(old-\u003ebase_gfn, old-\u003ebase_gfn + old-\u003enpages,\n-\t\t\t\t    kvm-\u003earch.gmap-\u003easce, \u0026ops, DAT_WALK_IGN_HOLES,\n+\t\t\t\t    kvm-\u003earch.gmap-\u003edatt, \u0026ops, DAT_WALK_IGN_HOLES,\n \t\t\t\t    \u0026kvm-\u003earch.cmma_dirty_pages);\n \t}\n }\n@@ -5835,7 +5841,7 @@ long kvm_arch_vcpu_pre_fault_memory(struct kvm_vcpu *vcpu, struct kvm_pre_fault_\n bool kvm_test_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range)\n {\n \tscoped_guard(read_lock, \u0026kvm-\u003emmu_lock)\n-\t\treturn dat_test_age_gfn(kvm-\u003earch.gmap-\u003easce, range-\u003estart, range-\u003eend);\n+\t\treturn dat_test_age_gfn(kvm-\u003earch.gmap-\u003edatt, range-\u003estart, range-\u003eend);\n }\n \n /**\ndiff --git a/arch/s390/kvm/s390/s390.h b/arch/s390/kvm/s390/s390.h\nindex aa0d1d062f8dc..daf3b0d004a48 100644\n--- a/arch/s390/kvm/s390/s390.h\n+++ b/arch/s390/kvm/s390/s390.h\n@@ -115,11 +115,7 @@ static inline int is_vcpu_idle(struct kvm_vcpu *vcpu)\n \n static inline int kvm_is_ucontrol(struct kvm *kvm)\n {\n-#ifdef CONFIG_KVM_S390_UCONTROL\n-\treturn test_bit(GMAP_FLAG_IS_UCONTROL, \u0026kvm-\u003earch.gmap-\u003eflags);\n-#else\n-\treturn 0;\n-#endif\n+\treturn is_ucontrol(kvm-\u003earch.gmap);\n }\n \n #define GUEST_PREFIX_SHIFT 12\ndiff --git a/arch/s390/kvm/s390/vsie.c b/arch/s390/kvm/s390/vsie.c\nindex 5926689fa2267..0a2cd9315e131 100644\n--- a/arch/s390/kvm/s390/vsie.c\n+++ b/arch/s390/kvm/s390/vsie.c\n@@ -49,20 +49,21 @@ struct vsie_page {\n \t/* address of the last reported fault to guest2 */\n \tunsigned long fault_addr;\t\t/* 0x0228 */\n \t/* calculated guest addresses of satellite control blocks */\n-\tgpa_t sca_gpa;\t\t\t\t/* 0x0230 */\n-\tgpa_t itdba_gpa;\t\t\t/* 0x0238 */\n-\tgpa_t gvrd_gpa;\t\t\t\t/* 0x0240 */\n-\tgpa_t riccbd_gpa;\t\t\t/* 0x0248 */\n-\tgpa_t sdnx_gpa;\t\t\t\t/* 0x0250 */\n+\tstruct kvm_host_map sca_map;\t\t/* 0x0230 */\n+\tstruct kvm_host_map itdba_map;\t\t/* 0x0260 */\n+\tstruct kvm_host_map gvrd_map;\t\t/* 0x0290 */\n+\tstruct kvm_host_map riccbd_map;\t\t/* 0x02c0 */\n+\tstruct kvm_host_map sdnx_map;\t\t/* 0x02f0 */\n+\tstruct kvm_host_map scb_map;\t\t/* 0x0320 */\n \t/*\n \t * guest address of the original SCB. Remains set for free vsie\n \t * pages, so we can properly look them up in our addr_to_page\n \t * radix tree.\n \t */\n-\tgpa_t scb_gpa;\t\t\t\t/* 0x0258 */\n+\tgpa_t scb_gpa;\t\t\t\t/* 0x0350 */\n \t/* the shadow gmap in use by the vsie_page */\n-\tstruct gmap_cache gmap_cache;\t\t/* 0x0260 */\n-\t__u8 reserved[0x06f8 - 0x0278];\t\t/* 0x0278 */\n+\tstruct gmap_cache gmap_cache;\t\t/* 0x0358 */\n+\t__u8 reserved[0x06f8 - 0x0370];\t\t/* 0x0370 */\n \tstruct kvm_s390_crypto_cb crycb;\t/* 0x06f8 */\n \t__u8 fac[8 + S390_ARCH_FAC_LIST_SIZE_BYTE];/* 0x07f8 */\n };\n@@ -681,72 +682,45 @@ static int map_prefix(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page, struct\n }\n \n /*\n- * Pin the guest page given by gpa and set hpa to the pinned host address.\n+ * pin_guest_page() - Pin the given guest page and return its hpa.\n+ * @vcpu: the vCPU\n+ * @gpa: the gpa to pin\n+ * @map: the map representing this pinning.\n+ *\n  * Will always be pinned writable.\n  *\n- * Returns: - 0 on success\n- *          - -EINVAL if the gpa is not valid guest storage\n+ * Returns: - 0 if the gpa is not valid guest storage,\n+ *          - The host hpa of the pinned page in case of success\n  */\n-static int pin_guest_page(struct kvm *kvm, gpa_t gpa, hpa_t *hpa)\n+static hpa_t pin_guest_page(struct kvm_vcpu *vcpu, gpa_t gpa, struct kvm_host_map *map)\n {\n-\tstruct page *page;\n-\n-\tpage = gfn_to_page(kvm, gpa_to_gfn(gpa));\n-\tif (!page)\n-\t\treturn -EINVAL;\n-\t*hpa = (hpa_t)page_to_phys(page) + (gpa \u0026 ~PAGE_MASK);\n-\treturn 0;\n-}\n-\n-/* Unpins a page previously pinned via pin_guest_page, marking it as dirty. */\n-static void unpin_guest_page(struct kvm *kvm, gpa_t gpa, hpa_t hpa)\n-{\n-\tkvm_release_page_dirty(pfn_to_page(phys_to_pfn(hpa)));\n-\t/* mark the page always as dirty for migration */\n-\tmark_page_dirty(kvm, gpa_to_gfn(gpa));\n+\tif (kvm_vcpu_map(vcpu, gpa_to_gfn(gpa), map))\n+\t\treturn 0;\n+\tif (!kvm_vcpu_mapped(map))\n+\t\treturn 0;\n+\treturn (hpa_t)PFN_PHYS(map-\u003epfn) + (gpa \u0026 ~PAGE_MASK);\n }\n \n /* unpin all blocks previously pinned by pin_blocks(), marking them dirty */\n static void unpin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)\n {\n \tstruct kvm_s390_sie_block *scb_s = \u0026vsie_page-\u003escb_s;\n-\thpa_t hpa;\n \n-\thpa = (u64) scb_s-\u003escaoh \u003c\u003c 32 | scb_s-\u003escaol;\n-\tif (hpa) {\n-\t\tunpin_guest_page(vcpu-\u003ekvm, vsie_page-\u003esca_gpa, hpa);\n-\t\tvsie_page-\u003esca_gpa = 0;\n-\t\tscb_s-\u003escaol = 0;\n-\t\tscb_s-\u003escaoh = 0;\n-\t}\n+\tkvm_vcpu_unmap(vcpu, \u0026vsie_page-\u003esca_map);\n+\tscb_s-\u003escaol = 0;\n+\tscb_s-\u003escaoh = 0;\n \n-\thpa = scb_s-\u003eitdba;\n-\tif (hpa) {\n-\t\tunpin_guest_page(vcpu-\u003ekvm, vsie_page-\u003eitdba_gpa, hpa);\n-\t\tvsie_page-\u003eitdba_gpa = 0;\n-\t\tscb_s-\u003eitdba = 0;\n-\t}\n+\tkvm_vcpu_unmap(vcpu, \u0026vsie_page-\u003eitdba_map);\n+\tscb_s-\u003eitdba = 0;\n \n-\thpa = scb_s-\u003egvrd;\n-\tif (hpa) {\n-\t\tunpin_guest_page(vcpu-\u003ekvm, vsie_page-\u003egvrd_gpa, hpa);\n-\t\tvsie_page-\u003egvrd_gpa = 0;\n-\t\tscb_s-\u003egvrd = 0;\n-\t}\n+\tkvm_vcpu_unmap(vcpu, \u0026vsie_page-\u003egvrd_map);\n+\tscb_s-\u003egvrd = 0;\n \n-\thpa = scb_s-\u003ericcbd;\n-\tif (hpa) {\n-\t\tunpin_guest_page(vcpu-\u003ekvm, vsie_page-\u003ericcbd_gpa, hpa);\n-\t\tvsie_page-\u003ericcbd_gpa = 0;\n-\t\tscb_s-\u003ericcbd = 0;\n-\t}\n+\tkvm_vcpu_unmap(vcpu, \u0026vsie_page-\u003ericcbd_map);\n+\tscb_s-\u003ericcbd = 0;\n \n-\thpa = scb_s-\u003esdnxo;\n-\tif (hpa) {\n-\t\tunpin_guest_page(vcpu-\u003ekvm, vsie_page-\u003esdnx_gpa, hpa);\n-\t\tvsie_page-\u003esdnx_gpa = 0;\n-\t\tscb_s-\u003esdnxo = 0;\n-\t}\n+\tkvm_vcpu_unmap(vcpu, \u0026vsie_page-\u003esdnx_map);\n+\tscb_s-\u003esdnxo = 0;\n }\n \n /*\n@@ -783,13 +757,12 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)\n \t\t\t ((gpa + offsetof(struct bsca_block, cpu[0]) - 1) \u0026 PAGE_MASK))\n \t\t\trc = set_validity_icpt(scb_s, 0x003bU);\n \t\tif (!rc) {\n-\t\t\trc = pin_guest_page(vcpu-\u003ekvm, gpa, \u0026hpa);\n-\t\t\tif (rc)\n+\t\t\thpa = pin_guest_page(vcpu, gpa, \u0026vsie_page-\u003esca_map);\n+\t\t\tif (!hpa)\n \t\t\t\trc = set_validity_icpt(scb_s, 0x0034U);\n \t\t}\n-\t\tif (rc)\n+\t\tif (rc || !hpa)\n \t\t\tgoto unpin;\n-\t\tvsie_page-\u003esca_gpa = gpa;\n \t\tscb_s-\u003escaoh = (u32)((u64)hpa \u003e\u003e 32);\n \t\tscb_s-\u003escaol = (u32)(u64)hpa;\n \t}\n@@ -801,12 +774,11 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)\n \t\t\tgoto unpin;\n \t\t}\n \t\t/* 256 bytes cannot cross page boundaries */\n-\t\trc = pin_guest_page(vcpu-\u003ekvm, gpa, \u0026hpa);\n-\t\tif (rc) {\n+\t\thpa = pin_guest_page(vcpu, gpa, \u0026vsie_page-\u003eitdba_map);\n+\t\tif (!hpa) {\n \t\t\trc = set_validity_icpt(scb_s, 0x0080U);\n \t\t\tgoto unpin;\n \t\t}\n-\t\tvsie_page-\u003eitdba_gpa = gpa;\n \t\tscb_s-\u003eitdba = hpa;\n \t}\n \n@@ -820,12 +792,11 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)\n \t\t * 512 bytes vector registers cannot cross page boundaries\n \t\t * if this block gets bigger, we have to shadow it.\n \t\t */\n-\t\trc = pin_guest_page(vcpu-\u003ekvm, gpa, \u0026hpa);\n-\t\tif (rc) {\n+\t\thpa = pin_guest_page(vcpu, gpa, \u0026vsie_page-\u003egvrd_map);\n+\t\tif (!hpa) {\n \t\t\trc = set_validity_icpt(scb_s, 0x1310U);\n \t\t\tgoto unpin;\n \t\t}\n-\t\tvsie_page-\u003egvrd_gpa = gpa;\n \t\tscb_s-\u003egvrd = hpa;\n \t}\n \n@@ -836,13 +807,12 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)\n \t\t\tgoto unpin;\n \t\t}\n \t\t/* 64 bytes cannot cross page boundaries */\n-\t\trc = pin_guest_page(vcpu-\u003ekvm, gpa, \u0026hpa);\n-\t\tif (rc) {\n+\t\thpa = pin_guest_page(vcpu, gpa, \u0026vsie_page-\u003ericcbd_map);\n+\t\tif (!hpa) {\n \t\t\trc = set_validity_icpt(scb_s, 0x0043U);\n \t\t\tgoto unpin;\n \t\t}\n \t\t/* Validity 0x0044 will be checked by SIE */\n-\t\tvsie_page-\u003ericcbd_gpa = gpa;\n \t\tscb_s-\u003ericcbd = hpa;\n \t}\n \tif (((scb_s-\u003eecb \u0026 ECB_GS) \u0026\u0026 !(scb_s-\u003eecd \u0026 ECD_HOSTREGMGMT)) ||\n@@ -866,12 +836,11 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)\n \t\t/* Due to alignment rules (checked above) this cannot\n \t\t * cross page boundaries\n \t\t */\n-\t\trc = pin_guest_page(vcpu-\u003ekvm, gpa, \u0026hpa);\n-\t\tif (rc) {\n+\t\thpa = pin_guest_page(vcpu, gpa, \u0026vsie_page-\u003esdnx_map);\n+\t\tif (!hpa) {\n \t\t\trc = set_validity_icpt(scb_s, 0x10b0U);\n \t\t\tgoto unpin;\n \t\t}\n-\t\tvsie_page-\u003esdnx_gpa = gpa;\n \t\tscb_s-\u003esdnxo = hpa | sdnxc;\n \t}\n \treturn 0;\n@@ -881,13 +850,9 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)\n }\n \n /* unpin the scb provided by guest 2, marking it as dirty */\n-static void unpin_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page,\n-\t\t      gpa_t gpa)\n+static void unpin_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)\n {\n-\thpa_t hpa = virt_to_phys(vsie_page-\u003escb_o);\n-\n-\tif (hpa)\n-\t\tunpin_guest_page(vcpu-\u003ekvm, gpa, hpa);\n+\tkvm_vcpu_unmap(vcpu, \u0026vsie_page-\u003escb_map);\n \tvsie_page-\u003escb_o = NULL;\n }\n \n@@ -901,12 +866,10 @@ static int pin_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page,\n \t\t   gpa_t gpa)\n {\n \thpa_t hpa;\n-\tint rc;\n \n-\trc = pin_guest_page(vcpu-\u003ekvm, gpa, \u0026hpa);\n-\tif (rc) {\n-\t\trc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);\n-\t\tWARN_ON_ONCE(rc);\n+\thpa = pin_guest_page(vcpu, gpa, \u0026vsie_page-\u003escb_map);\n+\tif (!hpa) {\n+\t\tWARN_ON_ONCE(kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING));\n \t\treturn 1;\n \t}\n \tvsie_page-\u003escb_o = phys_to_virt(hpa);\n@@ -1232,7 +1195,8 @@ static int do_vsie_run(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page, struc\n \t\t\tgoto xfer_to_guest_mode_check;\n \t\t}\n \t\tguest_timing_enter_irqoff();\n-\t\tsie_return = kvm_s390_enter_exit_sie(scb_s, vcpu-\u003erun-\u003es.regs.gprs, sg-\u003easce.val);\n+\t\tsie_return = kvm_s390_enter_exit_sie(scb_s, vcpu-\u003erun-\u003es.regs.gprs,\n+\t\t\t\t\t\t     sg-\u003edatt.asce.val);\n \t\tguest_timing_exit_irqoff();\n \t\tlocal_irq_enable();\n \t}\n@@ -1601,7 +1565,7 @@ int kvm_s390_handle_vsie(struct kvm_vcpu *vcpu)\n out_unshadow:\n \tunshadow_scb(vcpu, vsie_page);\n out_unpin_scb:\n-\tunpin_scb(vcpu, vsie_page, scb_addr);\n+\tunpin_scb(vcpu, vsie_page);\n out_put:\n \tput_vsie_page(vsie_page);\n \n"
}

2/1 2026/10/24 05:55 agent patch-evaluator
0m Model:
core

Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch exclusively modifies s390 KVM and guest memory management (gmap/dat) code located entirely within arch/s390/kvm/. Since the target architecture is amd64 (x86_64), the modified code paths are exclusive to s390 and are structurally unreachable on amd64.",
  "WorthFuzzing": false
}

Instruction:
You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.

================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.

- REACHABILITY IS THE PRIMARY GATE:
  Fuzzing can only discover bugs in code that can actually execute in standard virtualized
  environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
  If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
  regardless of whether it adds assertions or complex logic.

- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
  Patch authors routinely label changes as "cleanups", "refactorings", or state
  "No functional change intended". Do NOT take these claims at face value.
  Code refactorings that rearrange logic, introduce helper functions, or alter state management
  in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
  If reachable executable code is modified or refactored, it MUST be fuzzed.

- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
  When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
  BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
  Even if the author believes the invariant always holds, fuzzing is essential to verify whether
  an unusual sequence of operations can violate it.

================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:

- Non-kernel and non-executable changes:
  * Modifications to Documentation/, comments, or spelling fixes.
  * User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
    that do not affect the compiled kernel image (vmlinux) or kernel modules.
  * Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
    that do not alter control flow or data structures.
  * Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
  * Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
    ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
  * Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
    physical PCI hot-unplug or manual sysfs driver unbinding.
  * Code paths exclusive to architectures other than the target architecture.

================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
  * Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
    BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
  * Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
  * Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
  * Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).

================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:

- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
  Do NOT list generic, ubiquitous functions called by almost every program in the corpus
  (including, but not limited to: general memory allocators and deallocators, page fault
  and trap handlers, or core synchronization primitives; this is not an exhaustive list).
  Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
  which severely dilutes fuzzing effort away from the actual changes.

- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
  List functions that specifically implement the logic being added or altered, or direct API entrypoints
  for the subsystem feature under review.

- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
  Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
  distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
  If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
  functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).

================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
Target architecture: amd64

For your convenience, here is the diff of the changes:
commit 529dc80a29bf24c5f73696e7115f3bb40f40620e
Author: syz-cluster <triage@syzkaller.com>
Date:   Sat Oct 24 05:55:16 2026 +0000

    syz-cluster: applied patch under review

diff --git a/arch/s390/kvm/gmap/dat.c b/arch/s390/kvm/gmap/dat.c
index ff80d02c9f564..807a4ef84a072 100644
--- a/arch/s390/kvm/gmap/dat.c
+++ b/arch/s390/kvm/gmap/dat.c
@@ -102,34 +102,37 @@ void dat_free_level(struct crst_table *table, bool owns_ptes)
 	dat_free_crst(table);
 }
 
-int dat_set_asce_limit(struct kvm_s390_mmu_cache *mc, union asce *asce, int newtype)
+int dat_set_asce_limit(struct kvm_s390_mmu_cache *mc, struct dat_tables *datt, int newtype)
 {
 	struct crst_table *table;
 	union crste crste;
 
-	while (asce->dt > newtype) {
-		table = dereference_asce(*asce);
+	while (datt->asce.dt > newtype) {
+		table = datt->table;
 		crste = table->crstes[0];
 		if (crste.h.fc)
 			return 0;
 		if (!crste.h.i) {
-			asce->rsto = crste.h.fc0.to;
+			datt->asce.rsto = crste.h.fc0.to;
 			dat_free_crst(table);
+			datt->table = phys_to_virt(datt->asce.val & _ASCE_ORIGIN);
 		} else {
 			crste.h.tt--;
 			crst_table_init((void *)table, crste.val);
 		}
-		asce->dt--;
+		datt->asce.dt--;
 	}
-	while (asce->dt < newtype) {
-		crste = _crste_fc0(asce->rsto, asce->dt + 1);
+	while (datt->asce.dt < newtype) {
+		crste = _crste_fc0(datt->asce.rsto, datt->asce.dt + 1);
 		table = dat_alloc_crst_noinit(mc);
 		if (!table)
 			return -ENOMEM;
 		crst_table_init((void *)table, _CRSTE_HOLE(crste.h.tt).val);
 		table->crstes[0] = crste;
-		asce->rsto = __pa(table) >> PAGE_SHIFT;
-		asce->dt++;
+
+		datt->asce.rsto = __pa(table) >> PAGE_SHIFT;
+		datt->asce.dt++;
+		datt->table = table;
 	}
 	return 0;
 }
@@ -159,34 +162,8 @@ bool __must_check dat_crstep_xchg_atomic(union crste *crstep, union crste old, u
 	return cspg_crste(crstep, old, new);
 }
 
-static void dat_set_storage_key_from_pgste(union pte pte, union pgste pgste)
-{
-	union skey nkey = { .acc = pgste.acc, .fp = pgste.fp };
-
-	page_set_storage_key(pte_origin(pte), nkey.skey, 0);
-}
-
-static void dat_move_storage_key(union pte old, union pte new)
-{
-	page_set_storage_key(pte_origin(new), page_get_storage_key(pte_origin(old)), 1);
-}
-
-static union pgste dat_save_storage_key_into_pgste(union pte pte, union pgste pgste)
-{
-	union skey skey;
-
-	skey.skey = page_get_storage_key(pte_origin(pte));
-
-	pgste.acc = skey.acc;
-	pgste.fp = skey.fp;
-	pgste.gr |= skey.r;
-	pgste.gc |= skey.c;
-
-	return pgste;
-}
-
 union pgste __dat_ptep_xchg(union pte *ptep, union pgste pgste, union pte new, gfn_t gfn,
-			    union asce asce, bool uses_skeys)
+			    struct dat_tables datt)
 {
 	union pte old = READ_ONCE(*ptep);
 
@@ -200,12 +177,13 @@ union pgste __dat_ptep_xchg(union pte *ptep, union pgste pgste, union pte new, g
 		unsigned long opts = IPTE_GUEST_ASCE | (pgste.nodat ? IPTE_NODAT : 0);
 
 		if (machine_has_tlb_guest())
-			__ptep_ipte(gfn_to_gpa(gfn), (void *)ptep, opts, asce.val, IPTE_GLOBAL);
+			__ptep_ipte(gfn_to_gpa(gfn), (void *)ptep, opts,
+				    datt.asce.val, IPTE_GLOBAL);
 		else
 			__ptep_ipte(gfn_to_gpa(gfn), (void *)ptep, 0, 0, IPTE_GLOBAL);
 	}
 
-	if (uses_skeys) {
+	if (datt.uses_skeys) {
 		if (old.h.i && !new.h.i)
 			/* Invalid to valid: restore storage keys from PGSTE. */
 			dat_set_storage_key_from_pgste(new, pgste);
@@ -231,7 +209,7 @@ union pgste __dat_ptep_xchg(union pte *ptep, union pgste pgste, union pte new, g
  * Return: 0 in case of success, -ENOMEM if running out of memory.
  */
 static int dat_split_ste(struct kvm_s390_mmu_cache *mc, union pmd *pmdp, gfn_t gfn,
-			 union asce asce, bool uses_skeys)
+			 struct dat_tables datt)
 {
 	union pgste pgste_init;
 	struct page_table *pt;
@@ -260,21 +238,21 @@ static int dat_split_ste(struct kvm_s390_mmu_cache *mc, union pmd *pmdp, gfn_t g
 		init.s.y = old.s.fc1.y;
 		init.s.sd = old.s.fc1.sd;
 		init.s.pr = old.s.fc1.pr;
+		init.s.prefix_notif = old.s.fc1.prefix_notif;
 		pgste_init.val = 0;
 		if (old.h.fc) {
 			for (i = 0; i < _PAGE_ENTRIES; i++)
 				pt->ptes[i].val = init.val | i * PAGE_SIZE;
 			/* No need to take locks as the page table is not installed yet. */
-			pgste_init.prefix_notif = old.s.fc1.prefix_notif;
 			pgste_init.vsie_notif = old.s.fc1.vsie_notif;
 			pgste_init.vsie_gmem = old.s.fc1.vsie_notif;
-			pgste_init.pcl = uses_skeys && init.h.i;
+			pgste_init.pcl = datt.uses_skeys && init.h.i;
 			dat_init_pgstes(pt, pgste_init.val);
 		} else {
 			dat_init_page_table(pt, init.val, 0);
 		}
 
-		if (dat_pmdp_xchg_atomic(pmdp, old, new, gfn, asce)) {
+		if (dat_pmdp_xchg_atomic(pmdp, old, new, gfn, datt.asce)) {
 			if (!pgste_init.pcl)
 				return 0;
 			for (i = 0; i < _PAGE_ENTRIES; i++) {
@@ -300,7 +278,7 @@ static int dat_split_ste(struct kvm_s390_mmu_cache *mc, union pmd *pmdp, gfn_t g
  * Return: %0 in case of success, %-ENOMEM if running out of memory.
  */
 static int dat_split_crste(struct kvm_s390_mmu_cache *mc, union crste *crstep,
-			   gfn_t gfn, union asce asce, bool uses_skeys)
+			   gfn_t gfn, struct dat_tables datt)
 {
 	struct crst_table *table;
 	union crste old, new, init;
@@ -308,7 +286,7 @@ static int dat_split_crste(struct kvm_s390_mmu_cache *mc, union crste *crstep,
 
 	old = READ_ONCE(*crstep);
 	if (is_pmd(old))
-		return dat_split_ste(mc, &crstep->pmd, gfn, asce, uses_skeys);
+		return dat_split_ste(mc, &crstep->pmd, gfn, datt);
 
 	BUG_ON(!mc);
 
@@ -333,7 +311,7 @@ static int dat_split_crste(struct kvm_s390_mmu_cache *mc, union crste *crstep,
 		} else {
 			crst_table_init((void *)table, init.val);
 		}
-		if (dat_crstep_xchg_atomic(crstep, old, new, gfn, asce))
+		if (dat_crstep_xchg_atomic(crstep, old, new, gfn, datt.asce))
 			return 0;
 		old = READ_ONCE(*crstep);
 	}
@@ -347,7 +325,7 @@ static int dat_split_crste(struct kvm_s390_mmu_cache *mc, union crste *crstep,
  * @mc: Cache to use to allocate dat tables, if needed; can be NULL if neither
  *      %DAT_WALK_SPLIT or %DAT_WALK_ALLOC is specified in @flags.
  * @gfn: Guest frame.
- * @asce: The ASCE of the address space.
+ * @datt: The DAT tables of the address space.
  * @flags: Flags from WALK_* macros.
  * @walk_level: Level to walk to, from LEVEL_* macros.
  * @last: Will be filled the last visited non-pte DAT entry.
@@ -363,7 +341,6 @@ static int dat_split_crste(struct kvm_s390_mmu_cache *mc, union crste *crstep,
  * * %DAT_WALK_ANY: return successfully even if the requested level could not be reached
  * * %DAT_WALK_CONTINUE: walk to the requested level with the specified flags, and then try to
  *                       continue walking to ptes with only DAT_WALK_ANY
- * * %DAT_WALK_USES_SKEYS: storage keys are in use
  *
  * Context: called with kvm->mmu_lock held.
  *
@@ -376,12 +353,11 @@ static int dat_split_crste(struct kvm_s390_mmu_cache *mc, union crste *crstep,
  * * %-ENOENT if the requested level could not be reached for other reasons
  * * %-ENOMEM if running out of memory while allocating or splitting a table
  */
-int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, int flags,
+int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, struct dat_tables datt, int flags,
 		   int walk_level, union crste **last, union pte **ptepp)
 {
 	union vaddress vaddr = { .addr = gfn_to_gpa(gfn) };
 	bool continue_anyway = flags & DAT_WALK_CONTINUE;
-	bool uses_skeys = flags & DAT_WALK_USES_SKEYS;
 	bool ign_holes = flags & DAT_WALK_IGN_HOLES;
 	bool allocate = flags & DAT_WALK_ALLOC;
 	bool split = flags & DAT_WALK_SPLIT;
@@ -394,15 +370,15 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in
 
 	*last = NULL;
 	*ptepp = NULL;
-	if (WARN_ON_ONCE(unlikely(!asce.val)))
+	if (WARN_ON_ONCE(unlikely(!datt.asce.val)))
 		return -EINVAL;
-	if (WARN_ON_ONCE(unlikely(walk_level > asce.dt)))
+	if (WARN_ON_ONCE(unlikely(walk_level > datt.asce.dt)))
 		return -EINVAL;
-	if (!asce_contains_gfn(asce, gfn))
+	if (!dat_tables_contain_gfn(datt, gfn))
 		return PGM_ADDRESSING;
 
-	table = dereference_asce(asce);
-	if (asce.dt >= ASCE_TYPE_REGION1) {
+	table = datt.table;
+	if (datt.asce.dt >= ASCE_TYPE_REGION1) {
 		*last = table->crstes + vaddr.rfx;
 		entry = READ_ONCE(**last);
 		if (WARN_ON_ONCE(entry.h.tt != TABLE_TYPE_REGION1))
@@ -414,7 +390,7 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in
 		if (entry.pgd.h.i) {
 			if (!allocate)
 				return any ? 0 : -ENOENT;
-			rc = dat_split_crste(mc, *last, gfn, asce, uses_skeys);
+			rc = dat_split_crste(mc, *last, gfn, datt);
 			if (rc)
 				return rc;
 			entry = READ_ONCE(**last);
@@ -422,7 +398,7 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in
 		table = dereference_crste(entry.pgd);
 	}
 
-	if (asce.dt >= ASCE_TYPE_REGION2) {
+	if (datt.asce.dt >= ASCE_TYPE_REGION2) {
 		*last = table->crstes + vaddr.rsx;
 		entry = READ_ONCE(**last);
 		if (WARN_ON_ONCE(entry.h.tt != TABLE_TYPE_REGION2))
@@ -434,7 +410,7 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in
 		if (entry.p4d.h.i) {
 			if (!allocate)
 				return any ? 0 : -ENOENT;
-			rc = dat_split_crste(mc, *last, gfn, asce, uses_skeys);
+			rc = dat_split_crste(mc, *last, gfn, datt);
 			if (rc)
 				return rc;
 			entry = READ_ONCE(**last);
@@ -442,7 +418,7 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in
 		table = dereference_crste(entry.p4d);
 	}
 
-	if (asce.dt >= ASCE_TYPE_REGION3) {
+	if (datt.asce.dt >= ASCE_TYPE_REGION3) {
 		*last = table->crstes + vaddr.rtx;
 		entry = READ_ONCE(**last);
 		if (WARN_ON_ONCE(entry.h.tt != TABLE_TYPE_REGION3))
@@ -459,7 +435,7 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in
 		if (entry.pud.h.i && !entry.pud.h.fc) {
 			if (!allocate)
 				return any ? 0 : -ENOENT;
-			rc = dat_split_crste(mc, *last, gfn, asce, uses_skeys);
+			rc = dat_split_crste(mc, *last, gfn, datt);
 			if (rc)
 				return rc;
 			entry = READ_ONCE(**last);
@@ -467,7 +443,7 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in
 		if (walk_level <= TABLE_TYPE_SEGMENT && entry.pud.h.fc) {
 			if (!split)
 				return -EFBIG;
-			rc = dat_split_crste(mc, *last, gfn, asce, uses_skeys);
+			rc = dat_split_crste(mc, *last, gfn, datt);
 			if (rc)
 				return rc;
 			entry = READ_ONCE(**last);
@@ -491,7 +467,7 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in
 	if (entry.pmd.h.i && !entry.pmd.h.fc) {
 		if (!allocate)
 			return any ? 0 : -ENOENT;
-		rc = dat_split_ste(mc, &(*last)->pmd, gfn, asce, uses_skeys);
+		rc = dat_split_ste(mc, &(*last)->pmd, gfn, datt);
 		if (rc)
 			return rc;
 		entry = READ_ONCE(**last);
@@ -499,7 +475,7 @@ int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, in
 	if (walk_level <= TABLE_TYPE_PAGE_TABLE && entry.pmd.h.fc) {
 		if (!split)
 			return -EFBIG;
-		rc = dat_split_ste(mc, &(*last)->pmd, gfn, asce, uses_skeys);
+		rc = dat_split_ste(mc, &(*last)->pmd, gfn, datt);
 		if (rc)
 			return rc;
 		entry = READ_ONCE(**last);
@@ -581,7 +557,7 @@ static long dat_crste_walk_range(gfn_t start, gfn_t end, struct crst_table *tabl
  * _dat_walk_gfn_range() - Walk DAT tables.
  * @start: The first guest page frame to walk.
  * @end: The guest page frame immediately after the last one to walk.
- * @asce: The ASCE of the guest mapping.
+ * @datt: The DAT tables of the guest mapping.
  * @ops: The gmap_walk_ops that will be used to perform the walk.
  * @flags: Flags from WALK_* (currently only WALK_IGN_HOLES is supported).
  * @priv: Will be passed as-is to the callbacks.
@@ -592,29 +568,28 @@ static long dat_crste_walk_range(gfn_t start, gfn_t end, struct crst_table *tabl
  *         given ASCE unless the DAT_WALK_IGN_HOLES flag is specified,
  *         otherwise it returns whatever the callbacks return.
  */
-long _dat_walk_gfn_range(gfn_t start, gfn_t end, union asce asce,
+long _dat_walk_gfn_range(gfn_t start, gfn_t end, struct dat_tables datt,
 			 const struct dat_walk_ops *ops, int flags, void *priv)
 {
-	struct crst_table *table = dereference_asce(asce);
 	struct dat_walk walk = {
 		.ops	= ops,
-		.asce	= asce,
+		.datt	= datt,
 		.priv	= priv,
 		.flags	= flags,
 		.start	= start,
 		.end	= end,
 	};
 
-	if (WARN_ON_ONCE(unlikely(!asce.val)))
+	if (WARN_ON_ONCE(unlikely(!datt.asce.val)))
 		return -EINVAL;
-	if (!asce_contains_gfn(asce, start))
+	if (!dat_tables_contain_gfn(datt, start))
 		return (flags & DAT_WALK_IGN_HOLES) ? 0 : -EFAULT;
 
-	return dat_crste_walk_range(start, min(end, asce_end(asce)), table, &walk);
+	return dat_crste_walk_range(start, min(end, dat_tables_end(datt)), datt.table, &walk);
 }
 
 #if KVM_S390_MANAGES_S390_GUEST
-int dat_get_storage_key(union asce asce, gfn_t gfn, union skey *skey)
+int dat_get_storage_key(struct dat_tables datt, gfn_t gfn, union skey *skey)
 {
 	union crste *crstep;
 	union pgste pgste;
@@ -623,7 +598,7 @@ int dat_get_storage_key(union asce asce, gfn_t gfn, union skey *skey)
 
 again:
 	skey->skey = 0;
-	rc = dat_entry_walk(NULL, gfn, asce, DAT_WALK_ANY, TABLE_TYPE_PAGE_TABLE, &crstep, &ptep);
+	rc = dat_entry_walk(NULL, gfn, datt, DAT_WALK_ANY, TABLE_TYPE_PAGE_TABLE, &crstep, &ptep);
 	if (rc)
 		return rc;
 
@@ -657,7 +632,7 @@ static void dat_update_ptep_sd(union pgste old, union pgste pgste, union pte *pt
 		__atomic64_or(_PAGE_SD, &ptep->val);
 }
 
-int dat_set_storage_key(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t gfn,
+int dat_set_storage_key(struct kvm_s390_mmu_cache *mc, struct dat_tables datt, gfn_t gfn,
 			union skey skey, bool nq)
 {
 	union pgste pgste, old;
@@ -666,7 +641,7 @@ int dat_set_storage_key(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t gf
 	int rc;
 
 again:
-	rc = dat_entry_walk(mc, gfn, asce, DAT_WALK_LEAF_ALLOC, TABLE_TYPE_PAGE_TABLE,
+	rc = dat_entry_walk(mc, gfn, datt, DAT_WALK_LEAF_ALLOC, TABLE_TYPE_PAGE_TABLE,
 			    &crstep, &ptep);
 	if (rc)
 		return rc;
@@ -719,7 +694,7 @@ static bool page_cond_set_storage_key(phys_addr_t paddr, union skey skey, union
 	return true;
 }
 
-int dat_cond_set_storage_key(struct kvm_s390_mmu_cache *mmc, union asce asce, gfn_t gfn,
+int dat_cond_set_storage_key(struct kvm_s390_mmu_cache *mmc, struct dat_tables datt, gfn_t gfn,
 			     union skey skey, union skey *oldkey, bool nq, bool mr, bool mc)
 {
 	union pgste pgste, old;
@@ -729,7 +704,7 @@ int dat_cond_set_storage_key(struct kvm_s390_mmu_cache *mmc, union asce asce, gf
 	int rc;
 
 again:
-	rc = dat_entry_walk(mmc, gfn, asce, DAT_WALK_LEAF_ALLOC, TABLE_TYPE_PAGE_TABLE,
+	rc = dat_entry_walk(mmc, gfn, datt, DAT_WALK_LEAF_ALLOC, TABLE_TYPE_PAGE_TABLE,
 			    &crstep, &ptep);
 	if (rc)
 		return rc;
@@ -777,7 +752,7 @@ int dat_cond_set_storage_key(struct kvm_s390_mmu_cache *mmc, union asce asce, gf
 	return rc;
 }
 
-int dat_reset_reference_bit(union asce asce, gfn_t gfn, union skey *skey)
+int dat_reset_reference_bit(struct dat_tables datt, gfn_t gfn, union skey *skey)
 {
 	union pgste pgste, old;
 	union crste *crstep;
@@ -786,7 +761,7 @@ int dat_reset_reference_bit(union asce asce, gfn_t gfn, union skey *skey)
 
 	skey->skey = 0;
 again:
-	rc = dat_entry_walk(NULL, gfn, asce, DAT_WALK_ANY, TABLE_TYPE_PAGE_TABLE, &crstep, &ptep);
+	rc = dat_entry_walk(NULL, gfn, datt, DAT_WALK_ANY, TABLE_TYPE_PAGE_TABLE, &crstep, &ptep);
 	if (rc)
 		return rc;
 
@@ -854,7 +829,7 @@ static long dat_reset_skeys_crste(union crste *crstep, gfn_t gfn, gfn_t next, st
 	return 0;
 }
 
-long dat_reset_skeys(union asce asce, gfn_t start)
+long dat_reset_skeys(struct dat_tables datt, gfn_t start)
 {
 	const struct dat_walk_ops ops = {
 		.pte_entry = dat_reset_skeys_pte,
@@ -862,7 +837,8 @@ long dat_reset_skeys(union asce asce, gfn_t start)
 		.pud_entry = dat_reset_skeys_crste,
 	};
 
-	return _dat_walk_gfn_range(start, asce_end(asce), asce, &ops, DAT_WALK_IGN_HOLES, NULL);
+	return _dat_walk_gfn_range(start, dat_tables_end(datt), datt, &ops,
+				   DAT_WALK_IGN_HOLES, NULL);
 }
 #endif /* KVM_S390_MANAGES_S390_GUEST */
 
@@ -878,7 +854,7 @@ static long _dat_slot_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct dat_wal
 		return 0;
 
 	pgste = pgste_get_lock(ptep);
-	pgste = __dat_ptep_xchg(ptep, pgste, new_pte, gfn, walk->asce, false);
+	pgste = __dat_ptep_xchg(ptep, pgste, new_pte, gfn, walk->datt);
 	pgste.cmma_d = 0;
 	pgste_set_unlock(ptep, pgste);
 
@@ -898,7 +874,7 @@ static long _dat_slot_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct d
 
 	/* This table entry needs to be updated. */
 	if (walk->start <= gfn && walk->end >= next) {
-		if (!dat_crstep_xchg_atomic(crstep, crste, new_crste, gfn, walk->asce))
+		if (!dat_crstep_xchg_atomic(crstep, crste, new_crste, gfn, walk->datt.asce))
 			return -EINVAL;
 		/* A lower level table was present, needs to be freed. */
 		if (!crste.h.fc && !crste.h.i) {
@@ -915,7 +891,7 @@ static long _dat_slot_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct d
 		return 0;
 	/* Split (install a lower level table), and handle things there. */
 	if (mc)
-		return dat_split_crste(mc, crstep, gfn, walk->asce, false);
+		return dat_split_crste(mc, crstep, gfn, walk->datt);
 	/* A large page should never cross memslots boundaries */
 	return -EINVAL;
 }
@@ -925,9 +901,9 @@ static const struct dat_walk_ops dat_slot_ops = {
 	.crste_ops = { _dat_slot_crste, _dat_slot_crste, _dat_slot_crste, _dat_slot_crste, },
 };
 
-int dat_set_slot(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t start, gfn_t end)
+int dat_set_slot(struct kvm_s390_mmu_cache *mc, struct dat_tables datt, gfn_t start, gfn_t end)
 {
-	return _dat_walk_gfn_range(start, end, asce, &dat_slot_ops,
+	return _dat_walk_gfn_range(start, end, datt, &dat_slot_ops,
 				   DAT_WALK_IGN_HOLES | DAT_WALK_ANY, mc);
 }
 
@@ -1008,7 +984,7 @@ static const struct dat_walk_ops test_age_ops = {
 
 /**
  * dat_test_age_gfn() - Test young.
- * @asce: The ASCE whose address range is to be tested.
+ * @datt: The DAT tables whose address range is to be tested.
  * @start: The first guest frame of the range to check.
  * @end: The guest frame after the last in the range.
  *
@@ -1016,9 +992,9 @@ static const struct dat_walk_ops test_age_ops = {
  *
  * Return: %true if any page in the given range is young, otherwise %false.
  */
-bool dat_test_age_gfn(union asce asce, gfn_t start, gfn_t end)
+bool dat_test_age_gfn(struct dat_tables datt, gfn_t start, gfn_t end)
 {
-	return _dat_walk_gfn_range(start, end, asce, &test_age_ops, 0, NULL) > 0;
+	return _dat_walk_gfn_range(start, end, datt, &test_age_ops, 0, NULL) > 0;
 }
 
 #if KVM_S390_MANAGES_S390_GUEST
@@ -1035,7 +1011,7 @@ static long dat_set_pn_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct
 			break;
 		newcrste = oldcrste;
 		newcrste.s.fc1.prefix_notif = 1;
-	} while (!dat_crstep_xchg_atomic(crstep, oldcrste, newcrste, gfn, walk->asce));
+	} while (!dat_crstep_xchg_atomic(crstep, oldcrste, newcrste, gfn, walk->datt.asce));
 	*n = 2;
 	return 0;
 }
@@ -1043,18 +1019,19 @@ static long dat_set_pn_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct
 static long dat_set_pn_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct dat_walk *walk)
 {
 	int *n = walk->priv;
-	union pgste pgste;
 
-	pgste = pgste_get_lock(ptep);
+	/*
+	 * Updating a softbit while holding kvm->mmu_lock in write mode, no
+	 * need to take the PCL lock.
+	 */
 	if (!ptep->h.i && !ptep->h.p) {
-		pgste.prefix_notif = 1;
+		__atomic64_or(_PAGE_PREFIX_NOTIF, &ptep->val);
 		*n += 1;
 	}
-	pgste_set_unlock(ptep, pgste);
 	return 0;
 }
 
-int dat_set_prefix_notif_bit(union asce asce, gfn_t gfn)
+int dat_set_prefix_notif_bit(struct dat_tables datt, gfn_t gfn)
 {
 	static const struct dat_walk_ops ops = {
 		.pte_entry = dat_set_pn_pte,
@@ -1064,7 +1041,7 @@ int dat_set_prefix_notif_bit(union asce asce, gfn_t gfn)
 
 	int n = 0;
 
-	_dat_walk_gfn_range(gfn, gfn + 2, asce, &ops, DAT_WALK_IGN_HOLES, &n);
+	_dat_walk_gfn_range(gfn, gfn + 2, datt, &ops, DAT_WALK_IGN_HOLES, &n);
 	if (n != 2)
 		return -EAGAIN;
 	return 0;
@@ -1072,7 +1049,7 @@ int dat_set_prefix_notif_bit(union asce asce, gfn_t gfn)
 
 /**
  * dat_perform_essa() - Perform ESSA actions on the PGSTE.
- * @asce: The asce to operate on.
+ * @datt: The DAT tables to operate on.
  * @gfn: The guest page frame to operate on.
  * @orc: The specific action to perform, see the ESSA_SET_* macros.
  * @state: The storage attributes to be returned to the guest.
@@ -1085,14 +1062,15 @@ int dat_set_prefix_notif_bit(union asce asce, gfn_t gfn)
  * * %0 if the page state has been altered, but the page is not to be added to the CBRL
  * * %-1 if the page state has not been altered and the page is not to be added to the CBRL
  */
-int dat_perform_essa(union asce asce, gfn_t gfn, int orc, union essa_state *state, bool *dirty)
+int dat_perform_essa(struct dat_tables datt, gfn_t gfn, int orc,
+		     union essa_state *state, bool *dirty)
 {
 	union crste *crstep;
 	union pgste pgste;
 	union pte *ptep;
 	int res = 0;
 
-	if (dat_entry_walk(NULL, gfn, asce, 0, TABLE_TYPE_PAGE_TABLE, &crstep, &ptep)) {
+	if (dat_entry_walk(NULL, gfn, datt, 0, TABLE_TYPE_PAGE_TABLE, &crstep, &ptep)) {
 		*state = (union essa_state) { .exception = 1 };
 		return -1;
 	}
@@ -1180,13 +1158,13 @@ static long dat_reset_cmma_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct da
 	return 0;
 }
 
-long dat_reset_cmma(union asce asce, gfn_t start)
+long dat_reset_cmma(struct dat_tables datt, gfn_t start)
 {
 	const struct dat_walk_ops dat_reset_cmma_ops = {
 		.pte_entry = dat_reset_cmma_pte,
 	};
 
-	return _dat_walk_gfn_range(start, asce_end(asce), asce, &dat_reset_cmma_ops,
+	return _dat_walk_gfn_range(start, dat_tables_end(datt), datt, &dat_reset_cmma_ops,
 				   DAT_WALK_IGN_HOLES, NULL);
 }
 
@@ -1220,7 +1198,7 @@ static long __dat_peek_cmma_crste(union crste *crstep, gfn_t gfn, gfn_t next, st
 	return 0;
 }
 
-int dat_peek_cmma(gfn_t start, union asce asce, unsigned int *count, u8 *values)
+int dat_peek_cmma(gfn_t start, struct dat_tables datt, unsigned int *count, u8 *values)
 {
 	const struct dat_walk_ops ops = {
 		.pte_entry = __dat_peek_cmma_pte,
@@ -1232,7 +1210,7 @@ int dat_peek_cmma(gfn_t start, union asce asce, unsigned int *count, u8 *values)
 	struct dat_get_cmma_state state = { .values = values, };
 	int rc;
 
-	rc = _dat_walk_gfn_range(start, start + *count, asce, &ops, DAT_WALK_DEFAULT, &state);
+	rc = _dat_walk_gfn_range(start, start + *count, datt, &ops, DAT_WALK_DEFAULT, &state);
 	*count = state.end >= start ? state.end - start : 0;
 	/* Return success if at least one value was saved, otherwise an error. */
 	return (rc == -EFAULT && *count > 0) ? 0 : rc;
@@ -1266,7 +1244,8 @@ static long __dat_get_cmma_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct da
 	return 0;
 }
 
-int dat_get_cmma(union asce asce, gfn_t *start, unsigned int *count, u8 *values, atomic64_t *rem)
+int dat_get_cmma(struct dat_tables datt, gfn_t *start, unsigned int *count,
+		 u8 *values, atomic64_t *rem)
 {
 	const struct dat_walk_ops ops = { .pte_entry = __dat_get_cmma_pte, };
 	struct dat_get_cmma_state state = {
@@ -1276,10 +1255,10 @@ int dat_get_cmma(union asce asce, gfn_t *start, unsigned int *count, u8 *values,
 		.start = -1,
 	};
 
-	_dat_walk_gfn_range(*start, asce_end(asce), asce, &ops, DAT_WALK_IGN_HOLES, &state);
+	_dat_walk_gfn_range(*start, dat_tables_end(datt), datt, &ops, DAT_WALK_IGN_HOLES, &state);
 	/* If no dirty pages were found, wrap around and continue searching */
 	if (*start && state.start == -1)
-		_dat_walk_gfn_range(0, *start, asce, &ops, DAT_WALK_IGN_HOLES, &state);
+		_dat_walk_gfn_range(0, *start, datt, &ops, DAT_WALK_IGN_HOLES, &state);
 
 	if (state.start == -1) {
 		*count = 0;
@@ -1314,7 +1293,7 @@ static long __dat_set_cmma_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct da
 /**
  * dat_set_cmma_bits() - Set CMMA bits for a range of guest pages.
  * @mc: Cache used for allocations.
- * @asce: The ASCE of the guest.
+ * @datt: The DAT tables of the guest.
  * @gfn: The guest frame of the fist page whose CMMA bits are to set.
  * @count: How many pages need to be processed.
  * @mask: Which PGSTE bits should be set.
@@ -1329,7 +1308,7 @@ static long __dat_set_cmma_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct da
  *
  * Return: %0 in case of success, a negative error value otherwise.
  */
-int dat_set_cmma_bits(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t gfn,
+int dat_set_cmma_bits(struct kvm_s390_mmu_cache *mc, struct dat_tables datt, gfn_t gfn,
 		      unsigned long count, unsigned long mask, const uint8_t *bits)
 {
 	const struct dat_walk_ops ops = { .pte_entry = __dat_set_cmma_pte, };
@@ -1340,11 +1319,11 @@ int dat_set_cmma_bits(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t gfn,
 	int rc;
 
 	for (cur = ALIGN_DOWN(gfn, _PAGE_ENTRIES); cur < gfn + count; cur += _PAGE_ENTRIES) {
-		rc = dat_entry_walk(mc, cur, asce, DAT_WALK_ALLOC, TABLE_TYPE_PAGE_TABLE,
+		rc = dat_entry_walk(mc, cur, datt, DAT_WALK_ALLOC, TABLE_TYPE_PAGE_TABLE,
 				    &crstep, &ptep);
 		if (rc)
 			return rc;
 	}
-	return _dat_walk_gfn_range(gfn, gfn + count, asce, &ops, DAT_WALK_IGN_HOLES, &state);
+	return _dat_walk_gfn_range(gfn, gfn + count, datt, &ops, DAT_WALK_IGN_HOLES, &state);
 }
 #endif /* KVM_S390_MANAGES_S390_GUEST */
diff --git a/arch/s390/kvm/gmap/dat.h b/arch/s390/kvm/gmap/dat.h
index 90389d47ba4e0..3493f033e2045 100644
--- a/arch/s390/kvm/gmap/dat.h
+++ b/arch/s390/kvm/gmap/dat.h
@@ -27,9 +27,6 @@
 /* For consistency */
 #define KVM_S390_CMMA_SIZE_MAX ((u32)KVM_S390_SKEYS_MAX)
 
-#define _ASCE(x) ((union asce) { .val = (x), })
-#define NULL_ASCE _ASCE(0)
-
 enum {
 	_DAT_TOKEN_NONE = 0,
 	_DAT_TOKEN_PIC,
@@ -55,7 +52,6 @@ enum {
 #define TABLE_TYPE_PAGE_TABLE -1
 
 enum dat_walk_flags {
-	DAT_WALK_USES_SKEYS	= 0x40,
 	DAT_WALK_CONTINUE	= 0x20,
 	DAT_WALK_IGN_HOLES	= 0x10,
 	DAT_WALK_SPLIT		= 0x08,
@@ -77,7 +73,7 @@ union pte {
 		unsigned long u : 1; /* Page unused */
 		unsigned long s : 1; /* Special */
 		unsigned long w : 1; /* Writable */
-		unsigned long r : 1; /* Readable */
+		unsigned long prefix_notif:1; /* Guest prefix invalidation notification */
 		unsigned long d : 1; /* Dirty */
 		unsigned long y : 1; /* Young */
 		unsigned long sd: 1; /* Soft dirty */
@@ -109,9 +105,15 @@ union pte {
 #define _REGION3_FR_MASK	(_REGION3_MASK >> PAGE_SHIFT)
 #define _PAGES_PER_SEGMENT	_PAGE_ENTRIES
 #define _PAGES_PER_REGION3	(_PAGES_PER_SEGMENT * _CRST_ENTRIES)
+#define _UCAS_ENTRY_LENGTH	0
+#define _UCAS_ENTRY_OFFSET	3
+
+#define CRDTE_NODAT		IPTE_NODAT
+#define CRDTE_GUEST_ASCE	IPTE_GUEST_ASCE
 
-/* Soft dirty, needed as macro for atomic operations on ptes */
-#define _PAGE_SD 0x002
+/* Needed as macro for atomic operations on ptes */
+#define _PAGE_PREFIX_NOTIF	0x010	/* Guest prefix invalidation notification */
+#define _PAGE_SD		0x002	/* Soft dirty */
 
 /* Needed as macro to perform atomic operations */
 #define PGSTE_PCL_BIT		0x0080000000000000UL	/* PCL lock, HW bit */
@@ -144,10 +146,9 @@ union pgste {
 		unsigned long usage        : 2;
 		unsigned long              : 8;
 		unsigned long cmma_d       : 1; /* Dirty flag for CMMA bits */
-		unsigned long prefix_notif : 1; /* Guest prefix invalidation notification */
 		unsigned long vsie_notif   : 1; /* Referenced in a shadow table */
 		unsigned long vsie_gmem    : 1; /* Contains nested guest memory */
-		unsigned long              : 4;
+		unsigned long              : 5;
 		unsigned long              : 8;
 	};
 	struct {
@@ -350,6 +351,15 @@ struct page_table {
 static_assert(sizeof(struct crst_table) == _CRST_TABLE_SIZE);
 static_assert(sizeof(struct page_table) == PAGE_SIZE);
 
+struct dat_tables {
+	union asce asce;
+	struct crst_table *table;
+	bool has_pgstes;	/* Need to use the PCL lock */
+	bool owns_ptes;		/* The ptes are owned by this instance */
+	bool uses_skeys;	/* Storage keys are in use */
+	bool uses_cmma;		/* CMMA is in use */
+};
+
 struct dat_walk;
 
 typedef long (*dat_walk_op)(union crste *crste, gfn_t gfn, gfn_t next, struct dat_walk *w);
@@ -371,7 +381,7 @@ struct dat_walk {
 	const struct dat_walk_ops *ops;
 	union crste *last;
 	union pte *last_pte;
-	union asce asce;
+	struct dat_tables datt;
 	gfn_t start;
 	gfn_t end;
 	int flags;
@@ -421,6 +431,17 @@ static inline union crste _crste_fc0(kvm_pfn_t pfn, int tt)
 	return res;
 }
 
+static inline union crste _crste_ucas(kvm_pfn_t pfn)
+{
+	union crste res = { .val = PFN_PHYS(pfn) };
+
+	res.h.i = 1;
+	res.h.tt = TABLE_TYPE_SEGMENT;
+	res.h.fc0.tl = _UCAS_ENTRY_LENGTH;
+	res.h.fc0.tf = _UCAS_ENTRY_OFFSET;
+	return res;
+}
+
 /**
  * _crste() - Useful constructor for union crste with FC=1
  * @pfn: the pfn this pte should point to.
@@ -520,52 +541,53 @@ struct guest_fault {
 #define PTVAL_VMADDR	MKPTVAL(8, 6)
 
 union pgste __must_check __dat_ptep_xchg(union pte *ptep, union pgste pgste, union pte new,
-					 gfn_t gfn, union asce asce, bool uses_skeys);
+					 gfn_t gfn, struct dat_tables datt);
 bool dat_crstep_xchg_atomic(union crste *crstep, union crste old, union crste new, gfn_t gfn,
 			    union asce asce);
-void dat_crstep_xchg(union crste *crstep, union crste new, gfn_t gfn, union asce asce);
 
-long _dat_walk_gfn_range(gfn_t start, gfn_t end, union asce asce,
+long _dat_walk_gfn_range(gfn_t start, gfn_t end, struct dat_tables datt,
 			 const struct dat_walk_ops *ops, int flags, void *priv);
 
-int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, union asce asce, int flags,
+int dat_entry_walk(struct kvm_s390_mmu_cache *mc, gfn_t gfn, struct dat_tables datt, int flags,
 		   int walk_level, union crste **last, union pte **ptepp);
 void dat_free_level(struct crst_table *table, bool owns_ptes);
 struct crst_table *dat_alloc_crst_sleepable(unsigned long init);
-int dat_set_asce_limit(struct kvm_s390_mmu_cache *mc, union asce *asce, int newtype);
+int dat_set_asce_limit(struct kvm_s390_mmu_cache *mc, struct dat_tables *datt, int newtype);
 
 #if KVM_S390_MANAGES_S390_GUEST
-int dat_get_storage_key(union asce asce, gfn_t gfn, union skey *skey);
-int dat_set_storage_key(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t gfn,
+int dat_get_storage_key(struct dat_tables datt, gfn_t gfn, union skey *skey);
+int dat_set_storage_key(struct kvm_s390_mmu_cache *mc, struct dat_tables datt, gfn_t gfn,
 			union skey skey, bool nq);
-int dat_cond_set_storage_key(struct kvm_s390_mmu_cache *mmc, union asce asce, gfn_t gfn,
+int dat_cond_set_storage_key(struct kvm_s390_mmu_cache *mmc, struct dat_tables datt, gfn_t gfn,
 			     union skey skey, union skey *oldkey, bool nq, bool mr, bool mc);
-int dat_reset_reference_bit(union asce asce, gfn_t gfn, union skey *skey);
-long dat_reset_skeys(union asce asce, gfn_t start);
+int dat_reset_reference_bit(struct dat_tables datt, gfn_t gfn, union skey *skey);
+long dat_reset_skeys(struct dat_tables datt, gfn_t start);
 #endif /* KVM_S390_MANAGES_S390_GUEST */
 
 unsigned long dat_get_ptval(struct page_table *table, struct ptval_param param);
 void dat_set_ptval(struct page_table *table, struct ptval_param param, unsigned long val);
 
-int dat_set_slot(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t start, gfn_t end);
+int dat_set_slot(struct kvm_s390_mmu_cache *mc, struct dat_tables datt, gfn_t start, gfn_t end);
 
 #if KVM_S390_MANAGES_S390_GUEST
-int dat_set_prefix_notif_bit(union asce asce, gfn_t gfn);
+int dat_set_prefix_notif_bit(struct dat_tables datt, gfn_t gfn);
 #else
-static inline int dat_set_prefix_notif_bit(union asce asce, gfn_t gfn)
+static inline int dat_set_prefix_notif_bit(struct dat_tables datt, gfn_t gfn)
 {
 	return 0;
 }
 #endif /* KVM_S390_MANAGES_S390_GUEST */
 
-bool dat_test_age_gfn(union asce asce, gfn_t start, gfn_t end);
+bool dat_test_age_gfn(struct dat_tables datt, gfn_t start, gfn_t end);
 
 #if KVM_S390_MANAGES_S390_GUEST
-int dat_perform_essa(union asce asce, gfn_t gfn, int orc, union essa_state *state, bool *dirty);
-long dat_reset_cmma(union asce asce, gfn_t start_gfn);
-int dat_peek_cmma(gfn_t start, union asce asce, unsigned int *count, u8 *values);
-int dat_get_cmma(union asce asce, gfn_t *start, unsigned int *count, u8 *values, atomic64_t *rem);
-int dat_set_cmma_bits(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t gfn,
+int dat_perform_essa(struct dat_tables datt, gfn_t gfn, int orc,
+		     union essa_state *state, bool *dirty);
+long dat_reset_cmma(struct dat_tables datt, gfn_t start_gfn);
+int dat_peek_cmma(gfn_t start, struct dat_tables datt, unsigned int *count, u8 *values);
+int dat_get_cmma(struct dat_tables datt, gfn_t *start, unsigned int *count,
+		 u8 *values, atomic64_t *rem);
+int dat_set_cmma_bits(struct kvm_s390_mmu_cache *mc, struct dat_tables datt, gfn_t gfn,
 		      unsigned long count, unsigned long mask, const uint8_t *bits);
 #endif /* KVM_S390_MANAGES_S390_GUEST */
 
@@ -594,6 +616,11 @@ static inline struct vsie_rmap *kvm_s390_mmu_cache_alloc_rmap(struct kvm_s390_mm
 	return kzalloc_obj(struct vsie_rmap, GFP_KVM_S390_MMU_CACHE);
 }
 
+static inline bool has_pgstes(struct dat_tables datt)
+{
+	return KVM_S390_MANAGES_S390_GUEST && datt.has_pgstes;
+}
+
 static inline struct crst_table *crste_table_start(union crste *crstep)
 {
 	return (struct crst_table *)ALIGN_DOWN((unsigned long)crstep, _CRST_TABLE_SIZE);
@@ -609,38 +636,62 @@ static inline bool crdte_crste(union crste *crstep, union crste old, union crste
 {
 	unsigned long dtt = 0x10 | new.h.tt << 2;
 	void *table = crste_table_start(crstep);
+	unsigned long addr = gfn_to_gpa(gfn);
+
+	addr |= machine_has_tlb_guest() ? CRDTE_GUEST_ASCE : 0;
+	return crdte(old.val, new.val, table, dtt, addr, asce.val);
+}
+
+static inline bool crdte_pte(union pte *ptep, union pte old, union pte new, gfn_t gfn,
+			     union asce asce, bool nt)
+{
+	void *table = pte_table_start(ptep);
+	unsigned long addr = gfn_to_gpa(gfn);
 
-	return crdte(old.val, new.val, table, dtt, gfn_to_gpa(gfn), asce.val);
+	if (machine_has_tlb_guest())
+		addr |= CRDTE_GUEST_ASCE | (nt ? CRDTE_NODAT : 0);
+	return crdte(old.val, new.val, table, 0, addr, asce.val);
 }
 
 /**
  * idte_crste() - invalidate a crste entry using idte
  * @crstep: pointer to the crste to be invalidated
  * @gfn: a gfn mapped by the crste
- * @opt: options for the idte instruction
  * @asce: the asce
- * @local: whether the operation is cpu-local
  */
-static __always_inline void idte_crste(union crste *crstep, gfn_t gfn, unsigned long opt,
-				       union asce asce, int local)
+static __always_inline void idte_crste(union crste *crstep, gfn_t gfn, union asce asce)
 {
 	unsigned long table_origin = __pa(crste_table_start(crstep));
 	unsigned long gaddr = gfn_to_gpa(gfn) & HPAGE_MASK;
 
-	if (__builtin_constant_p(opt) && opt == 0) {
+	table_origin |= crstep->val & _REGION_ENTRY_TYPE_MASK;
+
+	if (!machine_has_tlb_guest()) {
 		/* flush without guest asce */
-		asm volatile("idte	%[table_origin],0,%[gaddr],%[local]"
+		asm volatile("idte	%[table_origin],0,%[gaddr]"
 			: "+m" (*crstep)
-			: [table_origin] "a" (table_origin), [gaddr] "a" (gaddr),
-			  [local] "i" (local)
-			: "cc");
+			: [table_origin] "a" (table_origin), [gaddr] "a" (gaddr)
+			: "memory", "cc");
 	} else {
 		/* flush with guest asce */
-		asm volatile("idte %[table_origin],%[asce],%[gaddr_opt],%[local]"
+		asm volatile("idte %[table_origin],%[asce],%[gaddr_opt]"
 			: "+m" (*crstep)
-			: [table_origin] "a" (table_origin), [gaddr_opt] "a" (gaddr | opt),
-			  [asce] "a" (asce.val), [local] "i" (local)
-			: "cc");
+			: [table_origin] "a" (table_origin),
+			  [gaddr_opt] "a" (gaddr | IDTE_GUEST_ASCE),
+			  [asce] "a" (asce.val)
+			: "memory", "cc");
+	}
+}
+
+static __always_inline void ipte(gfn_t gfn, union pte *ptep, union asce asce, bool nt)
+{
+	unsigned long flags;
+
+	if (machine_has_tlb_guest()) {
+		flags = IPTE_GUEST_ASCE | (nt ? IPTE_NODAT : 0);
+		__ptep_ipte(gfn_to_gpa(gfn), (void *)ptep, flags, asce.val, IPTE_GLOBAL);
+	} else {
+		__ptep_ipte(gfn_to_gpa(gfn), (void *)ptep, 0, 0, IPTE_GLOBAL);
 	}
 }
 
@@ -661,6 +712,11 @@ static inline gfn_t asce_end(union asce asce)
 	return 1ULL << ((asce.dt + 1) * 11 + _SEGMENT_SHIFT - PAGE_SHIFT);
 }
 
+static inline gfn_t dat_tables_end(struct dat_tables datt)
+{
+	return asce_end(datt.asce);
+}
+
 #define _CRSTE(x) ((union crste) { .val = _Generic((x),	\
 			union pgd : (x).val,		\
 			union p4d : (x).val,		\
@@ -687,6 +743,11 @@ static inline bool asce_contains_gfn(union asce asce, gfn_t gfn)
 	return gfn < asce_end(asce);
 }
 
+static inline bool dat_tables_contain_gfn(struct dat_tables datt, gfn_t gfn)
+{
+	return asce_contains_gfn(datt.asce, gfn);
+}
+
 static inline bool is_pmd(union crste crste)
 {
 	return crste.h.tt == TABLE_TYPE_SEGMENT;
@@ -852,11 +913,6 @@ static inline struct crst_table *_dereference_crste(union crste crste)
 		union pgd : _dereference_crste(_CRSTE(x)),	\
 		union crste : _dereference_crste(_CRSTE(x))))
 
-static inline struct crst_table *dereference_asce(union asce asce)
-{
-	return phys_to_virt(asce.val & _ASCE_ORIGIN);
-}
-
 static inline void asce_flush_tlb(union asce asce)
 {
 	__tlb_flush_idte(asce.val);
@@ -893,19 +949,18 @@ static inline void pgste_set_unlock(union pte *ptep, union pgste pgste)
 	WRITE_ONCE(*pgste_of(ptep), pgste);
 }
 
-static inline void dat_ptep_xchg(union pte *ptep, union pte new, gfn_t gfn, union asce asce,
-				 bool has_skeys)
+static inline void dat_ptep_xchg(union pte *ptep, union pte new, gfn_t gfn, struct dat_tables datt)
 {
 	union pgste pgste;
 
 	pgste = pgste_get_lock(ptep);
-	pgste = __dat_ptep_xchg(ptep, pgste, new, gfn, asce, has_skeys);
+	pgste = __dat_ptep_xchg(ptep, pgste, new, gfn, datt);
 	pgste_set_unlock(ptep, pgste);
 }
 
-static inline void dat_ptep_clear(union pte *ptep, gfn_t gfn, union asce asce, bool has_skeys)
+static inline void dat_ptep_clear(union pte *ptep, gfn_t gfn, struct dat_tables datt)
 {
-	dat_ptep_xchg(ptep, _PTE_EMPTY, gfn, asce, has_skeys);
+	dat_ptep_xchg(ptep, _PTE_EMPTY, gfn, datt);
 }
 
 static inline void dat_free_pt(struct page_table *pt)
@@ -972,20 +1027,47 @@ static inline int get_level(union crste *crstep, union pte *ptep)
 	return ptep ? TABLE_TYPE_PAGE_TABLE : crstep->h.tt;
 }
 
-static inline int dat_delete_slot(union asce asce, gfn_t start, unsigned long npages)
+static inline int dat_delete_slot(struct dat_tables datt, gfn_t start, unsigned long npages)
 {
-	return dat_set_slot(NULL, asce, start, start + npages);
+	return dat_set_slot(NULL, datt, start, start + npages);
 }
 
-static inline int dat_create_slot(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t start,
-				  unsigned long npages)
+static inline int dat_create_slot(struct kvm_s390_mmu_cache *mc, struct dat_tables datt,
+				  gfn_t start, unsigned long npages)
 {
-	return dat_set_slot(mc, asce, start, start + npages);
+	return dat_set_slot(mc, datt, start, start + npages);
 }
 
 static inline bool crste_is_ucas(union crste crste)
 {
-	return is_pmd(crste) && crste.h.i && crste.h.fc0.tl == 1 && crste.h.fc == 0;
+	return is_pmd(crste) && crste.h.i && !crste.h.fc &&
+	       crste.h.fc0.tl == _UCAS_ENTRY_LENGTH && crste.h.fc0.tf == _UCAS_ENTRY_OFFSET;
+}
+
+static inline void dat_set_storage_key_from_pgste(union pte pte, union pgste pgste)
+{
+	union skey nkey = { .acc = pgste.acc, .fp = pgste.fp };
+
+	page_set_storage_key(pte_origin(pte), nkey.skey, 0);
+}
+
+static inline void dat_move_storage_key(union pte old, union pte new)
+{
+	page_set_storage_key(pte_origin(new), page_get_storage_key(pte_origin(old)), 1);
+}
+
+static inline union pgste dat_save_storage_key_into_pgste(union pte pte, union pgste pgste)
+{
+	union skey skey;
+
+	skey.skey = page_get_storage_key(pte_origin(pte));
+
+	pgste.acc = skey.acc;
+	pgste.fp = skey.fp;
+	pgste.gr |= skey.r;
+	pgste.gc |= skey.c;
+
+	return pgste;
 }
 
 #endif /* ARCH_KVM_GMAP_DAT_H */
diff --git a/arch/s390/kvm/gmap/gmap.c b/arch/s390/kvm/gmap/gmap.c
index 3f3fa864cc36b..01d25aa1f605f 100644
--- a/arch/s390/kvm/gmap/gmap.c
+++ b/arch/s390/kvm/gmap/gmap.c
@@ -46,8 +46,8 @@ static int gmap_limit_to_type(gfn_t limit)
  */
 struct gmap *gmap_new(struct kvm *kvm, gfn_t limit)
 {
+	struct gmap *gmap __free(kfree) = NULL;
 	struct crst_table *table;
-	struct gmap *gmap;
 	int type;
 
 	type = gmap_limit_to_type(limit);
@@ -64,27 +64,27 @@ struct gmap *gmap_new(struct kvm *kvm, gfn_t limit)
 	refcount_set(&gmap->refcount, 1);
 
 	table = dat_alloc_crst_sleepable(_CRSTE_EMPTY(type).val);
-	if (!table) {
-		kfree(gmap);
+	if (!table)
 		return NULL;
-	}
 
-	gmap->asce.val = __pa(table);
-	gmap->asce.dt = type;
-	gmap->asce.tl = _ASCE_TABLE_LENGTH;
-	gmap->asce.x = 1;
-	gmap->asce.p = 1;
-	gmap->asce.s = 1;
+	gmap->datt.table = table;
+	gmap->datt.asce.val = __pa(table);
+	gmap->datt.asce.dt = type;
+	gmap->datt.asce.tl = _ASCE_TABLE_LENGTH;
+	gmap->datt.asce.x = 1;
+	gmap->datt.asce.p = 1;
+	gmap->datt.asce.s = 1;
 	gmap->kvm = kvm;
-	set_bit(GMAP_FLAG_OWNS_PAGETABLES, &gmap->flags);
+	gmap->datt.owns_ptes = true;
+	gmap->datt.has_pgstes = KVM_S390_MANAGES_S390_GUEST && !(sclp.has_kss && cpu_has_edat2());
 
-	return gmap;
+	return_ptr(gmap);
 }
 
 static void gmap_add_child(struct gmap *parent, struct gmap *child)
 {
 	KVM_BUG_ON(is_ucontrol(parent) && parent->parent, parent->kvm);
-	KVM_BUG_ON(is_ucontrol(parent) && !owns_page_tables(parent), parent->kvm);
+	KVM_BUG_ON(is_ucontrol(parent) && !parent->datt.owns_ptes, parent->kvm);
 	KVM_BUG_ON(!refcount_read(&child->refcount), parent->kvm);
 	lockdep_assert_held(&parent->children_lock);
 
@@ -105,8 +105,11 @@ static void gmap_add_child(struct gmap *parent, struct gmap *child)
 	else
 		clear_bit(GMAP_FLAG_ALLOW_HPAGE_2G, &child->flags);
 
-	if (kvm_is_ucontrol(parent->kvm))
-		clear_bit(GMAP_FLAG_OWNS_PAGETABLES, &child->flags);
+	if (kvm_is_ucontrol(parent->kvm)) {
+		child->datt.owns_ptes = false;
+		child->datt.uses_skeys = true;
+	}
+	child->datt.has_pgstes = true;
 	list_add(&child->list, &parent->children);
 }
 
@@ -139,7 +142,7 @@ int gmap_set_limit(struct gmap *gmap, gfn_t limit)
 		if (rc)
 			return rc;
 		scoped_guard(write_lock, &gmap->kvm->mmu_lock)
-			rc = dat_set_asce_limit(mc, &gmap->asce, type);
+			rc = dat_set_asce_limit(mc, &gmap->datt, type);
 	} while (rc == -ENOMEM);
 
 	return 0;
@@ -196,15 +199,15 @@ void gmap_dispose(struct gmap *gmap)
 	/* No VSIE shadow block is allowed to use this gmap */
 	KVM_BUG_ON(!list_empty(&gmap->scb_users), gmap->kvm);
 	/* The ASCE must be valid */
-	KVM_BUG_ON(!gmap->asce.val, gmap->kvm);
+	KVM_BUG_ON(!gmap->datt.asce.val, gmap->kvm);
 	/* The refcount must be 0 */
 	KVM_BUG_ON(refcount_read(&gmap->refcount), gmap->kvm);
 
 	/* Flush tlb of all gmaps */
-	asce_flush_tlb(gmap->asce);
+	asce_flush_tlb(gmap->datt.asce);
 
 	/* Free all DAT tables. */
-	dat_free_level(dereference_asce(gmap->asce), owns_page_tables(gmap));
+	dat_free_level(gmap->datt.table, gmap->datt.owns_ptes);
 
 	/* Free additional data for a shadow gmap */
 	if (is_shadow(gmap))
@@ -232,21 +235,25 @@ void gmap_dispose(struct gmap *gmap)
 int s390_replace_asce(struct gmap *gmap)
 {
 	struct crst_table *table;
-	union asce asce;
 
 	/* Replacing segment type ASCEs would cause serious issues */
-	if (gmap->asce.dt == ASCE_TYPE_SEGMENT)
+	if (gmap->datt.asce.dt == ASCE_TYPE_SEGMENT)
 		return -EINVAL;
 
 	table = dat_alloc_crst_sleepable(0);
 	if (!table)
 		return -ENOMEM;
-	memcpy(table, dereference_asce(gmap->asce), sizeof(*table));
 
 	/* Set new table origin while preserving existing ASCE control bits */
-	asce = gmap->asce;
-	asce.rsto = virt_to_pfn(table);
-	WRITE_ONCE(gmap->asce, asce);
+	scoped_guard(write_lock, &gmap->kvm->mmu_lock) {
+		memcpy(table, gmap->datt.table, sizeof(*table));
+		if (gmap->datt.asce.dt == ASCE_TYPE_SEGMENT) {
+			dat_free_crst(table);
+			return -EINVAL;
+		}
+		gmap->datt.asce.rsto = virt_to_pfn(table);
+		gmap->datt.table = table;
+	}
 
 	return 0;
 }
@@ -298,7 +305,7 @@ static long gmap_clear_young_pte(union pte *ptep, gfn_t gfn, gfn_t end, struct d
 		return 0;
 
 	pgste = pgste_get_lock(ptep);
-	if (!pgste.prefix_notif || gmap_mkold_prefix(p->gmap, gfn, end)) {
+	if (!pte.s.prefix_notif || gmap_mkold_prefix(p->gmap, gfn, end)) {
 		new = pte;
 		new.h.i = 1;
 		new.s.y = 0;
@@ -307,8 +314,8 @@ static long gmap_clear_young_pte(union pte *ptep, gfn_t gfn, gfn_t end, struct d
 		new.s.d = 0;
 		new.h.p = 1;
 
-		pgste.prefix_notif = 0;
-		pgste = __dat_ptep_xchg(ptep, pgste, new, gfn, walk->asce, uses_skeys(p->gmap));
+		new.s.prefix_notif = 0;
+		pgste = __dat_ptep_xchg(ptep, pgste, new, gfn, walk->datt);
 	}
 	p->young = 1;
 	pgste_set_unlock(ptep, pgste);
@@ -338,7 +345,7 @@ static long gmap_clear_young_crste(union crste *crstep, gfn_t gfn, gfn_t end, st
 			folio_set_dirty(phys_to_folio(crste_origin_large(crste)));
 		new.s.fc1.d = 0;
 		new.h.p = 1;
-	} while (!dat_crstep_xchg_atomic(crstep, crste, new, gfn, walk->asce));
+	} while (!dat_crstep_xchg_atomic(crstep, crste, new, gfn, walk->datt.asce));
 
 	priv->young = 1;
 	return 0;
@@ -365,7 +372,7 @@ bool gmap_age_gfn(struct gmap *gmap, gfn_t start, gfn_t end)
 		.young = false,
 	};
 
-	_dat_walk_gfn_range(start, end, gmap->asce, &ops, 0, &priv);
+	_dat_walk_gfn_range(start, end, gmap->datt, &ops, 0, &priv);
 
 	return priv.young;
 }
@@ -407,7 +414,7 @@ static long _gmap_unmap_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct
 	if (!old.h.fc)
 		return 0;
 
-	if (old.s.fc1.pr && test_bit(GMAP_FLAG_EXPORT_ON_UNMAP, &priv->gmap->flags))
+	if (old.s.fc1.pr && export_on_unmap(priv->gmap))
 		folio = phys_to_folio(crste_origin_large(old));
 	/*
 	 * No races should happen because kvm->mmu_lock is held in write mode,
@@ -430,17 +437,8 @@ static long _gmap_unmap_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct
 	return 0;
 }
 
-/**
- * gmap_unmap_gfn_range() - Unmap a range of guest addresses.
- * @gmap: The gmap to act on.
- * @slot: The memslot in which the range is located.
- * @start: The first gfn to unmap.
- * @end: The gfn after the last one to unmap.
- *
- * Context: Called with the kvm mmu write lock held.
- * Return: false
- */
-bool gmap_unmap_gfn_range(struct gmap *gmap, struct kvm_memory_slot *slot, gfn_t start, gfn_t end)
+static bool gmap_unmap_gfn_range_slow(struct gmap *gmap, struct kvm_memory_slot *slot,
+				      gfn_t start, gfn_t end)
 {
 	const struct dat_walk_ops ops = {
 		.pte_entry = _gmap_unmap_pte,
@@ -454,10 +452,109 @@ bool gmap_unmap_gfn_range(struct gmap *gmap, struct kvm_memory_slot *slot, gfn_t
 
 	lockdep_assert_held_write(&gmap->kvm->mmu_lock);
 
-	_dat_walk_gfn_range(start, end, gmap->asce, &ops, 0, &priv);
+	_dat_walk_gfn_range(start, end, gmap->datt, &ops, 0, &priv);
+	return false;
+}
+
+static long _gmap_unmap_pud_fast(union crste *crstep, gfn_t gfn, gfn_t next, struct dat_walk *w)
+{
+	union crste old = *crstep;
+
+	/* We only care about large puds */
+	if (!old.h.fc)
+		return 0;
+	if (!gfn)
+		gmap_unmap_prefix(w->priv, 0, next);
+	if (old.s.fc1.vsie_notif)
+		gmap_handle_vsie_unshadow_event(w->priv, gfn);
+
+	idte_crste(crstep, gfn, w->datt.asce);
+	*crstep = _CRSTE_EMPTY(old.h.tt);
+
+	return 0;
+}
+
+static long _gmap_unmap_pmd_fast(union crste *crstep, gfn_t gfn, gfn_t next, struct dat_walk *w)
+{
+	union crste old = *crstep;
+	struct page_table *pt;
+	gfn_t first, last;
+	unsigned int i;
+
+	if (old.h.fc) {
+		if (old.s.fc1.vsie_notif)
+			gmap_handle_vsie_unshadow_event(w->priv, gfn);
+
+		idte_crste(crstep, gfn, w->datt.asce);
+		WRITE_ONCE(*crstep, _CRSTE_EMPTY(old.h.tt));
+
+		return 0;
+	}
+
+	if (old.h.i)
+		return 0;
+
+	pt = dereference_pmd(old.pmd);
+	first = max(gfn, w->start) & (PTRS_PER_PTE - 1);
+	last = (min(next, w->end) - 1) & (PTRS_PER_PTE - 1);
+
+	for (i = first; i <= last; i++)
+		if (pte_needs_unshadow(pt->ptes[i], _PTE_EMPTY, pt->pgstes[i]))
+			gmap_handle_vsie_unshadow_event(w->priv, gfn + i);
+
+	/* Detach the page table */
+	idte_crste(crstep, gfn, w->datt.asce);
+
+	for (i = first; i <= last; i++) {
+		if (!pt->ptes[i].h.i && w->datt.uses_skeys)
+			pt->pgstes[i] = dat_save_storage_key_into_pgste(pt->ptes[i], pt->pgstes[i]);
+		pt->ptes[i] = _PTE_EMPTY;
+		pt->pgstes[i].vsie_notif = 0;
+		pt->pgstes[i].vsie_gmem = 0;
+		pt->pgstes[i].zero = 0;
+	}
+
+	barrier();
+	/* Reattach the modified page table */
+	WRITE_ONCE(*crstep, old);
+
+	return 0;
+}
+
+static bool gmap_unmap_gfn_range_fast(struct gmap *gmap, gfn_t start, gfn_t end)
+{
+	const struct dat_walk_ops ops = {
+		.pud_entry = _gmap_unmap_pud_fast,
+		.pmd_entry = _gmap_unmap_pmd_fast,
+	};
+	bool failed;
+
+	lockdep_assert_held_write(&gmap->kvm->mmu_lock);
+
+	gmap_unmap_prefix(gmap, ALIGN_DOWN(start, _PAGE_ENTRIES), ALIGN(end, _PAGE_ENTRIES));
+
+	failed = _dat_walk_gfn_range(start, end, gmap->datt, &ops, DAT_WALK_IGN_HOLES, gmap);
+	KVM_BUG_ON(failed, gmap->kvm);
 	return false;
 }
 
+/**
+ * gmap_unmap_gfn_range() - Unmap a range of guest addresses.
+ * @gmap: The gmap to act on.
+ * @slot: The memslot in which the range is located.
+ * @start: The first gfn to unmap.
+ * @end: The gfn after the last one to unmap.
+ *
+ * Context: Called with the kvm mmu write lock held.
+ * Return: false
+ */
+bool gmap_unmap_gfn_range(struct gmap *gmap, struct kvm_memory_slot *slot, gfn_t start, gfn_t end)
+{
+	if ((end - start <= _PAGES_PER_SEGMENT) || export_on_unmap(gmap) || is_ucontrol(gmap))
+		return gmap_unmap_gfn_range_slow(gmap, slot, start, end);
+	return gmap_unmap_gfn_range_fast(gmap, start, end);
+}
+
 static union pgste __pte_test_and_clear_softdirty(union pte *ptep, union pgste pgste, gfn_t gfn,
 						  struct gmap *gmap)
 {
@@ -470,7 +567,7 @@ static union pgste __pte_test_and_clear_softdirty(union pte *ptep, union pgste p
 	 * If this page contains one or more prefixes of vCPUS that are currently
 	 * running, do not reset the protection, leave it marked as dirty.
 	 */
-	if (!pgste.prefix_notif || gmap_mkold_prefix(gmap, gfn, gfn + 1)) {
+	if (!pte.s.prefix_notif || gmap_mkold_prefix(gmap, gfn, gfn + 1)) {
 		pte.h.p = 1;
 		pte.s.sd = 0;
 		pgste = gmap_ptep_xchg(gmap, ptep, pte, pgste, gfn);
@@ -536,7 +633,7 @@ void gmap_sync_dirty_log(struct gmap *gmap, gfn_t start, gfn_t end)
 
 	lockdep_assert_held(&gmap->kvm->mmu_lock);
 
-	_dat_walk_gfn_range(start, end, gmap->asce, &walk_ops, 0, gmap);
+	_dat_walk_gfn_range(start, end, gmap->datt, &walk_ops, 0, gmap);
 }
 
 static int gmap_handle_minor_crste_fault(struct gmap *gmap, struct guest_fault *f)
@@ -618,7 +715,7 @@ int gmap_try_fixup_minor(struct gmap *gmap, struct guest_fault *fault)
 
 	lockdep_assert_held(&gmap->kvm->mmu_lock);
 
-	rc = dat_entry_walk(NULL, fault->gfn, gmap->asce, DAT_WALK_LEAF, TABLE_TYPE_PAGE_TABLE,
+	rc = dat_entry_walk(NULL, fault->gfn, gmap->datt, DAT_WALK_LEAF, TABLE_TYPE_PAGE_TABLE,
 			    &fault->crstep, &fault->ptep);
 	/* If a PTE or a leaf CRSTE could not be reached, slow path. */
 	if (rc)
@@ -692,7 +789,7 @@ static int _gmap_link(struct kvm_s390_mmu_cache *mc, struct gmap *gmap, int leve
 	union pgste pgste;
 	int rc = 0;
 
-	rc = dat_entry_walk(mc, f->gfn, gmap->asce, DAT_WALK_ALLOC_CONTINUE, level,
+	rc = dat_entry_walk(mc, f->gfn, gmap->datt, DAT_WALK_ALLOC_CONTINUE, level,
 			    &f->crstep, &f->ptep);
 	if (rc == -ENOMEM)
 		return rc;
@@ -707,6 +804,7 @@ static int _gmap_link(struct kvm_s390_mmu_cache *mc, struct gmap *gmap, int leve
 		pgste = pgste_get_lock(f->ptep);
 		oldpte = *f->ptep;
 		newpte = _pte(f->pfn, f->writable, f->write_attempt | oldpte.s.d, !f->page);
+		newpte.s.prefix_notif = oldpte.s.prefix_notif;
 		newpte.s.sd = oldpte.s.sd;
 		oldpte.s.sd = 0;
 		if (oldpte.val == _PTE_EMPTY.val || oldpte.h.pfra == f->pfn) {
@@ -765,31 +863,29 @@ static int gmap_ucas_map_one(struct kvm_s390_mmu_cache *mc, struct gmap *gmap,
 	int rc;
 
 	if (force_alloc)
-		rc = dat_entry_walk(mc, p_gfn, gmap->parent->asce, DAT_WALK_ALLOC,
+		rc = dat_entry_walk(mc, p_gfn, gmap->parent->datt, DAT_WALK_ALLOC,
 				    TABLE_TYPE_PAGE_TABLE, &crstep, &ptep);
 	else
-		rc = dat_entry_walk(mc, p_gfn, gmap->parent->asce, DAT_WALK_ALLOC_CONTINUE,
+		rc = dat_entry_walk(mc, p_gfn, gmap->parent->datt, DAT_WALK_ALLOC_CONTINUE,
 				    TABLE_TYPE_SEGMENT, &crstep, &ptep);
 	if (rc)
 		return rc;
 	if (!ptep) {
-		newcrste = _crste_fc0(p_gfn, TABLE_TYPE_SEGMENT);
-		newcrste.h.i = 1;
-		newcrste.h.fc0.tl = 1;
+		newcrste = _crste_ucas(p_gfn);
 	} else {
 		pt = pte_table_start(ptep);
 		dat_set_ptval(pt, PTVAL_VMADDR, p_gfn >> (_SEGMENT_SHIFT - PAGE_SHIFT));
 		newcrste = _crste_fc0(virt_to_pfn(pt), TABLE_TYPE_SEGMENT);
 	}
-	rc = dat_entry_walk(mc, c_gfn, gmap->asce, DAT_WALK_ALLOC, TABLE_TYPE_SEGMENT,
-			    &crstep, &ptep);
+	rc = dat_entry_walk(mc, c_gfn, gmap->datt, DAT_WALK_ALLOC | DAT_WALK_IGN_HOLES,
+			    TABLE_TYPE_SEGMENT, &crstep, &ptep);
 	if (rc)
 		return rc;
 	do {
 		oldcrste = READ_ONCE(*crstep);
 		if (oldcrste.val == newcrste.val)
 			break;
-	} while (!dat_crstep_xchg_atomic(crstep, oldcrste, newcrste, c_gfn, gmap->asce));
+	} while (!dat_crstep_xchg_atomic(crstep, oldcrste, newcrste, c_gfn, gmap->datt.asce));
 	return 0;
 }
 
@@ -798,8 +894,9 @@ static int gmap_ucas_translate_simple(struct gmap *gmap, gpa_t *gaddr, union crs
 	union pte *ptep;
 	int rc;
 
-	rc = dat_entry_walk(NULL, gpa_to_gfn(*gaddr), gmap->asce, DAT_WALK_CONTINUE,
-			    TABLE_TYPE_SEGMENT, crstepp, &ptep);
+	rc = dat_entry_walk(NULL, gpa_to_gfn(*gaddr), gmap->datt,
+			    DAT_WALK_IGN_HOLES | DAT_WALK_ANY,
+			    TABLE_TYPE_PAGE_TABLE, crstepp, &ptep);
 	if (rc || (!ptep && !crste_is_ucas(**crstepp)))
 		return -EREMOTE;
 	if (!ptep)
@@ -836,26 +933,24 @@ int gmap_ucas_translate(struct kvm_s390_mmu_cache *mc, struct gmap *gmap, gpa_t
 		if (rc <= 0)
 			return rc;
 	}
-	do {
-		scoped_guard(write_lock, &gmap->kvm->mmu_lock) {
-			rc = gmap_ucas_translate_simple(gmap, gaddr, &crstep);
-			if (rc <= 0)
-				return rc;
-			translated_address = (*gaddr & ~_SEGMENT_MASK) |
-					     (crstep->val & _SEGMENT_MASK);
-			rc = gmap_ucas_map_one(mc, gmap, gpa_to_gfn(translated_address), gfn, true);
-		}
-		if (!rc) {
-			*gaddr = translated_address;
-			return 0;
-		}
-		if (rc != -ENOMEM)
-			return -EREMOTE;
-		rc = kvm_s390_mmu_cache_topup(mc);
-		if (rc)
+	rc = kvm_s390_mmu_cache_topup(mc);
+	if (rc)
+		return rc;
+
+	scoped_guard(write_lock, &gmap->kvm->mmu_lock) {
+		rc = gmap_ucas_translate_simple(gmap, gaddr, &crstep);
+		if (rc <= 0)
 			return rc;
-	} while (1);
-	return 0;
+		translated_address = (*gaddr & ~_SEGMENT_MASK) |
+				     (crstep->val & _SEGMENT_MASK);
+		rc = gmap_ucas_map_one(mc, gmap, gpa_to_gfn(translated_address), gfn, true);
+	}
+
+	if (!rc)
+		*gaddr = translated_address;
+	if (!rc || rc == -ENOMEM)
+		return rc;
+	return -EREMOTE;
 }
 
 int gmap_ucas_map(struct gmap *gmap, gfn_t p_gfn, gfn_t c_gfn, unsigned long count)
@@ -892,10 +987,12 @@ static void gmap_ucas_unmap_one(struct gmap *gmap, gfn_t c_gfn)
 	union pte *ptep;
 	int rc;
 
-	rc = dat_entry_walk(NULL, c_gfn, gmap->asce, 0, TABLE_TYPE_SEGMENT, &crstep, &ptep);
-	if (rc)
+	rc = dat_entry_walk(NULL, c_gfn, gmap->datt, DAT_WALK_IGN_HOLES,
+			    TABLE_TYPE_SEGMENT, &crstep, &ptep);
+	if (rc || !is_pmd(*crstep))
 		return;
-	while (!dat_crstep_xchg_atomic(crstep, READ_ONCE(*crstep), _PMD_EMPTY, c_gfn, gmap->asce))
+	while (!dat_crstep_xchg_atomic(crstep, READ_ONCE(*crstep), _PMD_EMPTY,
+				       c_gfn, gmap->datt.asce))
 		;
 }
 
@@ -920,7 +1017,7 @@ static long _gmap_split_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct
 			gmap_unmap_prefix(gmap, gfn, next);
 		if (crste.s.fc1.vsie_notif)
 			gmap_handle_vsie_unshadow_event(gmap, gfn);
-		if (dat_crstep_xchg_atomic(crstep, crste, newcrste, gfn, walk->asce))
+		if (dat_crstep_xchg_atomic(crstep, crste, newcrste, gfn, walk->datt.asce))
 			break;
 		crste = READ_ONCE(*crstep);
 	}
@@ -941,7 +1038,7 @@ void gmap_split_huge_pages(struct gmap *gmap)
 
 	do {
 		scoped_guard(read_lock, &gmap->kvm->mmu_lock)
-			start = _dat_walk_gfn_range(start, asce_end(gmap->asce), gmap->asce,
+			start = _dat_walk_gfn_range(start, dat_tables_end(gmap->datt), gmap->datt,
 						    &ops, DAT_WALK_IGN_HOLES, gmap);
 	} while (start);
 }
@@ -956,16 +1053,17 @@ static int _gmap_enable_skeys(struct gmap *gmap)
 	if (uses_skeys(gmap))
 		return 0;
 
-	set_bit(GMAP_FLAG_USES_SKEYS, &gmap->flags);
+	gmap->datt.uses_skeys = true;
+	gmap->datt.has_pgstes = true;
 	rc = gmap_helper_disable_cow_sharing();
 	if (rc) {
-		clear_bit(GMAP_FLAG_USES_SKEYS, &gmap->flags);
+		gmap->datt.uses_skeys = false;
 		return rc;
 	}
 
 	do {
 		scoped_guard(write_lock, &gmap->kvm->mmu_lock)
-			start = dat_reset_skeys(gmap->asce, start);
+			start = dat_reset_skeys(gmap->datt, start);
 	} while (start);
 	return 0;
 }
@@ -1020,7 +1118,7 @@ int gmap_pv_destroy_range(struct gmap *gmap, gfn_t start, gfn_t end, bool interr
 
 	do {
 		scoped_guard(read_lock, &gmap->kvm->mmu_lock)
-			start = _dat_walk_gfn_range(start, end, gmap->asce, &ops,
+			start = _dat_walk_gfn_range(start, end, gmap->datt, &ops,
 						    DAT_WALK_IGN_HOLES, NULL);
 		if (interruptible && fatal_signal_pending(current))
 			return -EINTR;
@@ -1072,14 +1170,13 @@ int gmap_protect_rmap(struct kvm_s390_mmu_cache *mc, struct gmap *sg, gfn_t p_gf
 	union pgste pgste;
 	union pte *ptep;
 	union pte pte;
-	int flags, rc;
+	int rc;
 
 	if (KVM_BUG_ON(!is_shadow(sg) || level <= TABLE_TYPE_PAGE_TABLE, sg->kvm))
 		return -EINVAL;
 	lockdep_assert_held(&sg->parent->children_lock);
 
-	flags = DAT_WALK_SPLIT_ALLOC | (uses_skeys(sg->parent) ? DAT_WALK_USES_SKEYS : 0);
-	rc = dat_entry_walk(mc, p_gfn, sg->parent->asce, flags,
+	rc = dat_entry_walk(mc, p_gfn, sg->parent->datt, DAT_WALK_SPLIT_ALLOC,
 			    TABLE_TYPE_PAGE_TABLE, &crstep, &ptep);
 	if (rc)
 		return rc;
@@ -1140,8 +1237,8 @@ void _gmap_set_cmma_all(struct gmap *gmap, bool dirty)
 
 	do {
 		scoped_guard(read_lock, &gmap->kvm->mmu_lock)
-			gfn = _dat_walk_gfn_range(gfn, asce_end(gmap->asce), gmap->asce, &ops,
-						  DAT_WALK_IGN_HOLES,
+			gfn = _dat_walk_gfn_range(gfn, dat_tables_end(gmap->datt), gmap->datt,
+						  &ops, DAT_WALK_IGN_HOLES,
 						  &gmap->kvm->arch.cmma_dirty_pages);
 	} while (gfn);
 }
@@ -1159,15 +1256,15 @@ static void gmap_unshadow_level(struct gmap *sg, gfn_t r_gfn, int level)
 		align = 1UL << (11 * level + _SEGMENT_SHIFT);
 	kvm_s390_vsie_gmap_notifier(sg, ALIGN_DOWN(gaddr, align), ALIGN(gaddr + 1, align));
 	sg->invalidated = true;
-	if (dat_entry_walk(NULL, r_gfn, sg->asce, 0, level, &crstep, &ptep))
+	if (dat_entry_walk(NULL, r_gfn, sg->datt, 0, level, &crstep, &ptep))
 		return;
 	if (ptep) {
 		if (READ_ONCE(*ptep).val != _PTE_EMPTY.val)
-			dat_ptep_xchg(ptep, _PTE_EMPTY, r_gfn, sg->asce, uses_skeys(sg));
+			dat_ptep_xchg(ptep, _PTE_EMPTY, r_gfn, sg->datt);
 		return;
 	}
 
-	crste = dat_crstep_clear_atomic(crstep, r_gfn, sg->asce);
+	crste = dat_crstep_clear_atomic(crstep, r_gfn, sg->datt.asce);
 	if (crste_leaf(crste) || crste.h.i)
 		return;
 	if (is_pmd(crste))
diff --git a/arch/s390/kvm/gmap/gmap.h b/arch/s390/kvm/gmap/gmap.h
index 8f47f29c89fd2..6824507706ed9 100644
--- a/arch/s390/kvm/gmap/gmap.h
+++ b/arch/s390/kvm/gmap/gmap.h
@@ -18,28 +18,20 @@
  * enum gmap_flags - Flags of a gmap.
  *
  * @GMAP_FLAG_SHADOW: The gmap is a vsie shadow gmap.
- * @GMAP_FLAG_OWNS_PAGETABLES: The gmap owns all dat levels; normally 1, is 0
- *                             only for ucontrol per-cpu gmaps, since they
- *                             share the page tables with the main gmap.
  * @GMAP_FLAG_IS_UCONTROL: The gmap is ucontrol (main gmap or per-cpu gmap).
  * @GMAP_FLAG_ALLOW_HPAGE_1M: 1M hugepages are allowed for this gmap,
  *                            independently of the page size used by userspace.
  * @GMAP_FLAG_ALLOW_HPAGE_2G: 2G hugepages are allowed for this gmap,
  *                            independently of the page size used by userspace.
  * @GMAP_FLAG_PFAULT_ENABLED: Pfault is enabled for the gmap.
- * @GMAP_FLAG_USES_SKEYS: If the guest uses storage keys.
- * @GMAP_FLAG_USES_CMM: Whether the guest uses CMMA.
  * @GMAP_FLAG_EXPORT_ON_UNMAP: Whether to export guest pages when unmapping.
  */
 enum gmap_flags {
 	GMAP_FLAG_SHADOW = 0,
-	GMAP_FLAG_OWNS_PAGETABLES,
 	GMAP_FLAG_IS_UCONTROL,
 	GMAP_FLAG_ALLOW_HPAGE_1M,
 	GMAP_FLAG_ALLOW_HPAGE_2G,
 	GMAP_FLAG_PFAULT_ENABLED,
-	GMAP_FLAG_USES_SKEYS,
-	GMAP_FLAG_USES_CMM,
 	GMAP_FLAG_EXPORT_ON_UNMAP,
 };
 
@@ -49,7 +41,7 @@ enum gmap_flags {
  * @flags: GMAP_FLAG_* flags.
  * @edat_level: The edat level of this shadow gmap.
  * @kvm: The vm.
- * @asce: The ASCE used by this gmap.
+ * @datt: The DAT tables used by this gmap.
  * @list: List head used in children gmaps for the children gmap list.
  * @children_lock: Protects children and scb_users.
  * @children: List of child gmaps of this gmap.
@@ -64,7 +56,7 @@ struct gmap {
 	unsigned char edat_level;
 	bool invalidated;
 	struct kvm *kvm;
-	union asce asce;
+	struct dat_tables datt;
 	struct list_head list;
 	spinlock_t children_lock;	/* Protects: children, scb_users */
 	struct list_head children;
@@ -116,12 +108,12 @@ void gmap_split_huge_pages(struct gmap *gmap);
 
 static inline bool uses_skeys(struct gmap *gmap)
 {
-	return test_bit(GMAP_FLAG_USES_SKEYS, &gmap->flags);
+	return has_pgstes(gmap->datt) && gmap->datt.uses_skeys;
 }
 
 static inline bool uses_cmm(struct gmap *gmap)
 {
-	return test_bit(GMAP_FLAG_USES_CMM, &gmap->flags);
+	return has_pgstes(gmap->datt) && gmap->datt.uses_cmma;
 }
 
 static inline bool pfault_enabled(struct gmap *gmap)
@@ -131,17 +123,21 @@ static inline bool pfault_enabled(struct gmap *gmap)
 
 static inline bool is_ucontrol(struct gmap *gmap)
 {
+#ifdef CONFIG_KVM_S390_UCONTROL
 	return test_bit(GMAP_FLAG_IS_UCONTROL, &gmap->flags);
+#else
+	return 0;
+#endif
 }
 
-static inline bool is_shadow(struct gmap *gmap)
+static inline bool export_on_unmap(struct gmap *gmap)
 {
-	return test_bit(GMAP_FLAG_SHADOW, &gmap->flags);
+	return test_bit(GMAP_FLAG_EXPORT_ON_UNMAP, &gmap->flags);
 }
 
-static inline bool owns_page_tables(struct gmap *gmap)
+static inline bool is_shadow(struct gmap *gmap)
 {
-	return test_bit(GMAP_FLAG_OWNS_PAGETABLES, &gmap->flags);
+	return test_bit(GMAP_FLAG_SHADOW, &gmap->flags);
 }
 
 static inline struct gmap *gmap_put(struct gmap *gmap)
@@ -232,8 +228,8 @@ static inline union pgste _gmap_ptep_xchg(struct gmap *gmap, union pte *ptep, un
 	else
 		lockdep_assert_not_held(&gmap->children_lock);
 
-	if (pgste.prefix_notif && (newpte.h.p || newpte.h.i)) {
-		pgste.prefix_notif = 0;
+	if (ptep->s.prefix_notif && (newpte.h.p || newpte.h.i)) {
+		newpte.s.prefix_notif = 0;
 		gmap_unmap_prefix(gmap, gfn, gfn + 1);
 	}
 	if (pte_needs_unshadow(*ptep, newpte, pgste)) {
@@ -247,7 +243,7 @@ static inline union pgste _gmap_ptep_xchg(struct gmap *gmap, union pte *ptep, un
 	if (!ptep->s.d && newpte.s.d && !newpte.s.s)
 		SetPageDirty(pfn_to_page(newpte.h.pfra));
 	pgste.zero = 0;
-	return __dat_ptep_xchg(ptep, pgste, newpte, gfn, gmap->asce, uses_skeys(gmap));
+	return __dat_ptep_xchg(ptep, pgste, newpte, gfn, gmap->datt);
 }
 
 static inline union pgste gmap_ptep_xchg(struct gmap *gmap, union pte *ptep, union pte newpte,
@@ -305,7 +301,7 @@ static inline bool __must_check _gmap_crstep_xchg_atomic(struct gmap *gmap, unio
 			gmap_handle_vsie_unshadow_event(gmap, gfn);
 		else
 			_gmap_handle_vsie_unshadow_event(gmap, gfn);
-		if (!dat_crstep_xchg_atomic(crstep, oldcrste, newcrste, gfn, gmap->asce))
+		if (!dat_crstep_xchg_atomic(crstep, oldcrste, newcrste, gfn, gmap->datt.asce))
 			return false;
 		/*
 		 * Return false even if the swap was successful, as it only
@@ -319,7 +315,7 @@ static inline bool __must_check _gmap_crstep_xchg_atomic(struct gmap *gmap, unio
 	}
 	if (!oldcrste.s.fc1.d && newcrste.s.fc1.d && !newcrste.s.fc1.s)
 		SetPageDirty(phys_to_page(crste_origin_large(newcrste)));
-	return dat_crstep_xchg_atomic(crstep, oldcrste, newcrste, gfn, gmap->asce);
+	return dat_crstep_xchg_atomic(crstep, oldcrste, newcrste, gfn, gmap->datt.asce);
 }
 
 static inline bool __must_check gmap_crstep_xchg_atomic(struct gmap *gmap, union crste *crstep,
diff --git a/arch/s390/kvm/gmap/kvm_mmu.c b/arch/s390/kvm/gmap/kvm_mmu.c
index c2ffb5e59ec63..784c4aae59958 100644
--- a/arch/s390/kvm/gmap/kvm_mmu.c
+++ b/arch/s390/kvm/gmap/kvm_mmu.c
@@ -72,7 +72,7 @@ int s390_kvm_mmu_prepare_memory_region(struct kvm *kvm,
 			return -EINVAL;
 		if ((new->base_gfn + new->npages) * PAGE_SIZE > kvm->arch.mem_limit)
 			return -EINVAL;
-		if (!asce_contains_gfn(kvm->arch.gmap->asce, new->base_gfn + new->npages - 1))
+		if (!dat_tables_contain_gfn(kvm->arch.gmap->datt, new->base_gfn + new->npages - 1))
 			return -EINVAL;
 	}
 
@@ -102,9 +102,9 @@ int s390_kvm_mmu_prepare_memory_region(struct kvm *kvm,
 	scoped_guard(write_lock, &kvm->mmu_lock) {
 		kvm_s390_update_cmma_dirty(kvm, old);
 		if (change == KVM_MR_DELETE || change == KVM_MR_MOVE)
-			rc = dat_delete_slot(kvm->arch.gmap->asce, old->base_gfn, old->npages);
+			rc = dat_delete_slot(kvm->arch.gmap->datt, old->base_gfn, old->npages);
 		if (!rc && (change == KVM_MR_MOVE || change == KVM_MR_CREATE))
-			rc = dat_create_slot(mc, kvm->arch.gmap->asce, new->base_gfn, new->npages);
+			rc = dat_create_slot(mc, kvm->arch.gmap->datt, new->base_gfn, new->npages);
 	}
 	/*
 	 * Can only be triggered if dat_{create,delete}_slot() found an
diff --git a/arch/s390/kvm/s390/gaccess.c b/arch/s390/kvm/s390/gaccess.c
index 2d27dcb680029..eff16f9edfadb 100644
--- a/arch/s390/kvm/s390/gaccess.c
+++ b/arch/s390/kvm/s390/gaccess.c
@@ -653,7 +653,7 @@ static int vm_check_access_key_gpa(struct kvm *kvm, u8 access_key,
 	int r;
 
 	scoped_guard(read_lock, &kvm->mmu_lock)
-		r = dat_get_storage_key(kvm->arch.gmap->asce, gpa_to_gfn(gpa), &storage_key);
+		r = dat_get_storage_key(kvm->arch.gmap->datt, gpa_to_gfn(gpa), &storage_key);
 	if (r)
 		return r;
 	if (access_key == 0 || storage_key.acc == access_key)
@@ -712,7 +712,7 @@ static int vcpu_check_access_key_gpa(struct kvm_vcpu *vcpu, u8 access_key,
 	 * assume that this cannot fail
 	 */
 	scoped_guard(read_lock, &vcpu->kvm->mmu_lock)
-		r = dat_get_storage_key(vcpu->arch.gmap->asce, gpa_to_gfn(gpa), &storage_key);
+		r = dat_get_storage_key(vcpu->arch.gmap->datt, gpa_to_gfn(gpa), &storage_key);
 	if (r)
 		return r;
 	/* access key matches storage key -> allow */
@@ -1286,7 +1286,7 @@ static int walk_guest_tables(struct gmap *sg, unsigned long saddr, struct pgtwal
 		return -EAGAIN;
 	kvm = parent->kvm;
 	WARN_ON(!kvm);
-	asce = sg->guest_asce;
+	asce.val = sg->guest_asce.val;
 	entries = get_entries(w);
 
 	w->level = LEVEL_MEM;
@@ -1435,6 +1435,7 @@ static int _do_shadow_pte(struct kvm_s390_mmu_cache *mc, struct gmap *sg, gpa_t
 	newpte.s.d |= ptep_h->s.d;
 	newpte.s.sd |= ptep_h->s.sd;
 	newpte.h.p &= ptep_h->h.p;
+	newpte.s.prefix_notif = ptep_h->s.prefix_notif;
 	if (!newpte.h.p && !f->writable) {
 		rc = -EOPNOTSUPP;
 	} else {
@@ -1451,7 +1452,7 @@ static int _do_shadow_pte(struct kvm_s390_mmu_cache *mc, struct gmap *sg, gpa_t
 	newpte = _pte(f->pfn, 0, !p, 0);
 	if (!pgste_get_trylock(ptep, &pgste))
 		return -EAGAIN;
-	pgste = __dat_ptep_xchg(ptep, pgste, newpte, gpa_to_gfn(raddr), sg->asce, uses_skeys(sg));
+	pgste = __dat_ptep_xchg(ptep, pgste, newpte, gpa_to_gfn(raddr), sg->datt);
 	pgste_set_unlock(ptep, pgste);
 
 	return 0;
@@ -1494,7 +1495,7 @@ static int _do_shadow_crste(struct kvm_s390_mmu_cache *mc, struct gmap *sg, gpa_
 		return -EAGAIN;
 
 	newcrste = _crste_fc1(f->pfn, oldcrste.h.tt, 0, !p);
-	while (!dat_crstep_xchg_atomic(table, READ_ONCE(*table), newcrste, r_gfn, sg->asce))
+	while (!dat_crstep_xchg_atomic(table, READ_ONCE(*table), newcrste, r_gfn, sg->datt.asce))
 		;
 	return 0;
 }
@@ -1503,9 +1504,9 @@ static int _gaccess_do_shadow(struct kvm_s390_mmu_cache *mc, struct gmap *sg,
 			      unsigned long saddr, struct pgtwalk *w)
 {
 	struct guest_fault *entries;
-	int flags, i, hl, gl, l, rc;
 	union crste *table, *host;
 	union pte *ptep, *ptep_h;
+	int i, hl, gl, l, rc;
 
 	lockdep_assert_held(&sg->kvm->mmu_lock);
 	lockdep_assert_held(&sg->parent->children_lock);
@@ -1514,8 +1515,8 @@ static int _gaccess_do_shadow(struct kvm_s390_mmu_cache *mc, struct gmap *sg,
 	ptep_h = NULL;
 	ptep = NULL;
 
-	rc = dat_entry_walk(NULL, gpa_to_gfn(saddr), sg->asce, DAT_WALK_ANY, TABLE_TYPE_PAGE_TABLE,
-			    &table, &ptep);
+	rc = dat_entry_walk(NULL, gpa_to_gfn(saddr), sg->datt, DAT_WALK_ANY,
+			    TABLE_TYPE_PAGE_TABLE, &table, &ptep);
 	if (rc)
 		return rc;
 
@@ -1546,7 +1547,7 @@ static int _gaccess_do_shadow(struct kvm_s390_mmu_cache *mc, struct gmap *sg,
 			return -EAGAIN;
 	}
 
-	rc = dat_entry_walk(NULL, entries[LEVEL_MEM].gfn, sg->parent->asce, DAT_WALK_LEAF,
+	rc = dat_entry_walk(NULL, entries[LEVEL_MEM].gfn, sg->parent->datt, DAT_WALK_LEAF,
 			    TABLE_TYPE_PAGE_TABLE, &host, &ptep_h);
 	if (rc)
 		return rc;
@@ -1556,16 +1557,16 @@ static int _gaccess_do_shadow(struct kvm_s390_mmu_cache *mc, struct gmap *sg,
 	l = min3(gl, hl, w->level);
 
 real_address_space:
-	flags = DAT_WALK_SPLIT_ALLOC | (uses_skeys(sg->parent) ? DAT_WALK_USES_SKEYS : 0);
 	/* If necessary, create the shadow mapping */
 	if (l < gl) {
-		rc = dat_entry_walk(mc, gpa_to_gfn(saddr), sg->asce, flags, l, &table, &ptep);
+		rc = dat_entry_walk(mc, gpa_to_gfn(saddr), sg->datt, DAT_WALK_SPLIT_ALLOC, l,
+				    &table, &ptep);
 		if (rc)
 			return rc;
 	}
 	if (l < hl) {
-		rc = dat_entry_walk(mc, entries[LEVEL_MEM].gfn, sg->parent->asce,
-				    flags, l, &host, &ptep_h);
+		rc = dat_entry_walk(mc, entries[LEVEL_MEM].gfn, sg->parent->datt,
+				    DAT_WALK_SPLIT_ALLOC, l, &host, &ptep_h);
 		if (rc)
 			return rc;
 	}
diff --git a/arch/s390/kvm/s390/priv.c b/arch/s390/kvm/s390/priv.c
index b3cb2c2c3aa71..1d9e81f6429ba 100644
--- a/arch/s390/kvm/s390/priv.c
+++ b/arch/s390/kvm/s390/priv.c
@@ -276,7 +276,7 @@ static int handle_iske(struct kvm_vcpu *vcpu)
 	gaddr = kvm_s390_logical_to_effective(vcpu, gaddr);
 	gaddr = kvm_s390_real_to_abs(vcpu, gaddr);
 	scoped_guard(read_lock, &vcpu->kvm->mmu_lock)
-		rc = dat_get_storage_key(vcpu->arch.gmap->asce, gpa_to_gfn(gaddr), &key);
+		rc = dat_get_storage_key(vcpu->arch.gmap->datt, gpa_to_gfn(gaddr), &key);
 	if (rc > 0)
 		return kvm_s390_inject_program_int(vcpu, rc);
 	if (rc < 0)
@@ -308,7 +308,7 @@ static int handle_rrbe(struct kvm_vcpu *vcpu)
 	gaddr = kvm_s390_logical_to_effective(vcpu, gaddr);
 	gaddr = kvm_s390_real_to_abs(vcpu, gaddr);
 	scoped_guard(read_lock, &vcpu->kvm->mmu_lock)
-		rc = dat_reset_reference_bit(vcpu->arch.gmap->asce, gpa_to_gfn(gaddr), &skey);
+		rc = dat_reset_reference_bit(vcpu->arch.gmap->datt, gpa_to_gfn(gaddr), &skey);
 	if (rc > 0)
 		return kvm_s390_inject_program_int(vcpu, rc);
 	if (rc < 0)
@@ -360,7 +360,7 @@ static int handle_sske(struct kvm_vcpu *vcpu)
 
 	while (start != end) {
 		scoped_guard(read_lock, &vcpu->kvm->mmu_lock) {
-			rc = dat_cond_set_storage_key(vcpu->arch.mc, vcpu->arch.gmap->asce,
+			rc = dat_cond_set_storage_key(vcpu->arch.mc, vcpu->arch.gmap->datt,
 						      gpa_to_gfn(start), key, &oldkey,
 						      m3 & SSKE_NQ, m3 & SSKE_MR, m3 & SSKE_MC);
 		}
@@ -1118,7 +1118,7 @@ static int handle_pfmf(struct kvm_vcpu *vcpu)
 			if (rc)
 				return rc;
 			scoped_guard(read_lock, &vcpu->kvm->mmu_lock) {
-				rc = dat_cond_set_storage_key(vcpu->arch.mc, vcpu->arch.gmap->asce,
+				rc = dat_cond_set_storage_key(vcpu->arch.mc, vcpu->arch.gmap->datt,
 							      gpa_to_gfn(start), key,
 							      NULL, nq, mr, mc);
 			}
@@ -1167,7 +1167,7 @@ static inline int __do_essa(struct kvm_vcpu *vcpu, const int orc)
 	gfn = vcpu->run->s.regs.gprs[r2] >> PAGE_SHIFT;
 	entries = (vcpu->arch.sie_block->cbrlo & ~PAGE_MASK) >> 3;
 
-	nappended = dat_perform_essa(vcpu->arch.gmap->asce, gfn, orc, &state, &dirtied);
+	nappended = dat_perform_essa(vcpu->arch.gmap->datt, gfn, orc, &state, &dirtied);
 	vcpu->run->s.regs.gprs[r1] = state.val;
 	if (nappended < 0)
 		return 0;
@@ -1199,7 +1199,7 @@ static void _essa_clear_cbrl(struct kvm_vcpu *vcpu, unsigned long *cbrl, int len
 	lockdep_assert_held(&vcpu->kvm->mmu_lock);
 
 	for (i = 0; i < len; i++) {
-		if (dat_entry_walk(NULL, gpa_to_gfn(cbrl[i]), vcpu->arch.gmap->asce,
+		if (dat_entry_walk(NULL, gpa_to_gfn(cbrl[i]), vcpu->arch.gmap->datt,
 				   0, TABLE_TYPE_PAGE_TABLE, &crstep, &ptep))
 			continue;
 		if (!ptep || ptep->s.pr)
@@ -1238,6 +1238,7 @@ static int handle_essa(struct kvm_vcpu *vcpu)
 		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
 
 	if (!READ_ONCE(vcpu->kvm->arch.migration_mode)) {
+		WRITE_ONCE(vcpu->arch.gmap->datt.has_pgstes, true);
 		/*
 		 * CMMA is enabled in the KVM settings, but is disabled in
 		 * the SIE block and in the mm_context, and we are not doing
@@ -1247,7 +1248,7 @@ static int handle_essa(struct kvm_vcpu *vcpu)
 		 * value really needs to be written to; if the value is
 		 * already correct, we do nothing and avoid the lock.
 		 */
-		set_bit(GMAP_FLAG_USES_CMM, &vcpu->arch.gmap->flags);
+		WRITE_ONCE(vcpu->arch.gmap->datt.uses_cmma, true);
 		/*
 		 * If we are here, we are supposed to have CMMA enabled in
 		 * the SIE block. Enabling CMMA works on a per-CPU basis,
diff --git a/arch/s390/kvm/s390/pv.c b/arch/s390/kvm/s390/pv.c
index b18abd0e29efc..d565b02e47b12 100644
--- a/arch/s390/kvm/s390/pv.c
+++ b/arch/s390/kvm/s390/pv.c
@@ -487,7 +487,7 @@ int kvm_s390_pv_set_aside(struct kvm *kvm, u16 *rc, u16 *rrc)
 		return -EINVAL;
 
 	/* Guest with segment type ASCE, refuse to destroy asynchronously */
-	if (kvm->arch.gmap->asce.dt == TABLE_TYPE_SEGMENT)
+	if (kvm->arch.gmap->datt.asce.dt == TABLE_TYPE_SEGMENT)
 		return -EINVAL;
 
 	priv = kzalloc_obj(*priv);
@@ -500,7 +500,7 @@ int kvm_s390_pv_set_aside(struct kvm *kvm, u16 *rc, u16 *rrc)
 		priv->stor_var = kvm->arch.pv.stor_var;
 		priv->stor_base = kvm->arch.pv.stor_base;
 		priv->handle = kvm_s390_pv_get_handle(kvm);
-		priv->old_gmap_table = (unsigned long)dereference_asce(kvm->arch.gmap->asce);
+		priv->old_gmap_table = (unsigned long)kvm->arch.gmap->datt.table;
 		if (s390_replace_asce(kvm->arch.gmap))
 			res = -ENOMEM;
 	}
@@ -626,7 +626,8 @@ int kvm_s390_pv_deinit_cleanup_all(struct kvm *kvm, u16 *rc, u16 *rrc)
 	 * cleanup has been performed.
 	 */
 	if (need_zap && mmget_not_zero(kvm->mm)) {
-		gmap_pv_destroy_range(kvm->arch.gmap, 0, asce_end(kvm->arch.gmap->asce), false);
+		gmap_pv_destroy_range(kvm->arch.gmap, 0, dat_tables_end(kvm->arch.gmap->datt),
+				      false);
 		mmput(kvm->mm);
 	}
 
@@ -664,7 +665,7 @@ int kvm_s390_pv_deinit_aside_vm(struct kvm *kvm, u16 *rc, u16 *rrc)
 		return -EINVAL;
 
 	/* When a fatal signal is received, stop immediately */
-	if (gmap_pv_destroy_range(kvm->arch.gmap, 0, asce_end(kvm->arch.gmap->asce), true))
+	if (gmap_pv_destroy_range(kvm->arch.gmap, 0, dat_tables_end(kvm->arch.gmap->datt), true))
 		goto done;
 	if (kvm_s390_pv_dispose_one_leftover(kvm, p, rc, rrc))
 		ret = -EIO;
@@ -737,7 +738,7 @@ int kvm_s390_pv_init_vm(struct kvm *kvm, u16 *rc, u16 *rrc)
 	/* Inputs */
 	uvcb.guest_stor_origin = 0; /* MSO is 0 for KVM */
 	uvcb.guest_stor_len = kvm->arch.pv.guest_len;
-	uvcb.guest_asce = kvm->arch.gmap->asce.val;
+	uvcb.guest_asce = kvm->arch.gmap->datt.asce.val;
 	uvcb.guest_sca = virt_to_phys(kvm->arch.sca);
 	uvcb.conf_base_stor_origin =
 		virt_to_phys((void *)kvm->arch.pv.stor_base);
diff --git a/arch/s390/kvm/s390/s390.c b/arch/s390/kvm/s390/s390.c
index e4912db67adc1..71d79b4437ac0 100644
--- a/arch/s390/kvm/s390/s390.c
+++ b/arch/s390/kvm/s390/s390.c
@@ -212,7 +212,7 @@ module_param(nested, int, S_IRUGO);
 MODULE_PARM_DESC(nested, "Nested virtualization support");
 
 /* allow 1m huge page guest backing */
-static int hpage;
+static int hpage = 1;
 module_param(hpage, int, 0444);
 MODULE_PARM_DESC(hpage, "1m huge page backing support");
 
@@ -563,25 +563,23 @@ static int kvm_s390_keyop(struct kvm_s390_mmu_cache *mc, struct kvm *kvm, int op
 			  unsigned long addr, union skey skey)
 {
 	gfn_t gfn = gpa_to_gfn(addr);
-	union asce asce;
 	int r;
 
 	guard(read_lock)(&kvm->mmu_lock);
-	asce = kvm->arch.gmap->asce;
 
 	switch (op) {
 	case KVM_S390_KEYOP_SSKE:
-		r = dat_cond_set_storage_key(mc, asce, gfn, skey, &skey, 0, 0, 0);
+		r = dat_cond_set_storage_key(mc, kvm->arch.gmap->datt, gfn, skey, &skey, 0, 0, 0);
 		if (r == 0 || r == 1)
 			return skey.skey;
 		break;
 	case KVM_S390_KEYOP_ISKE:
-		r = dat_get_storage_key(asce, gfn, &skey);
+		r = dat_get_storage_key(kvm->arch.gmap->datt, gfn, &skey);
 		if (!r)
 			return skey.skey;
 		break;
 	case KVM_S390_KEYOP_RRBE:
-		r = dat_reset_reference_bit(asce, gfn, &skey);
+		r = dat_reset_reference_bit(kvm->arch.gmap->datt, gfn, &skey);
 		if (!r)
 			return skey.skey;
 		break;
@@ -1001,7 +999,7 @@ static int kvm_s390_set_mem_control(struct kvm *kvm, struct kvm_device_attr *att
 		VM_EVENT(kvm, 3, "%s", "RESET: CMMA states");
 		do {
 			scoped_guard(read_lock, &kvm->mmu_lock)
-				start_gfn = dat_reset_cmma(kvm->arch.gmap->asce, start_gfn);
+				start_gfn = dat_reset_cmma(kvm->arch.gmap->datt, start_gfn);
 		} while (start_gfn);
 		ret = 0;
 		break;
@@ -1048,7 +1046,7 @@ static int kvm_s390_set_mem_control(struct kvm *kvm, struct kvm_device_attr *att
 		if (ret)
 			break;
 		VM_EVENT(kvm, 3, "SET: max guest address: %lu", new_limit);
-		VM_EVENT(kvm, 3, "New guest asce: 0x%p", (void *)kvm->arch.gmap->asce.val);
+		VM_EVENT(kvm, 3, "New guest asce: 0x%p", (void *)kvm->arch.gmap->datt.asce.val);
 		break;
 	}
 	default:
@@ -2174,7 +2172,7 @@ static int kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
 
 	scoped_guard(read_lock, &kvm->mmu_lock) {
 		for (i = 0; i < args->count; i++) {
-			r = dat_get_storage_key(kvm->arch.gmap->asce,
+			r = dat_get_storage_key(kvm->arch.gmap->datt,
 						args->start_gfn + i, keys + i);
 			if (r)
 				break;
@@ -2241,7 +2239,7 @@ static int kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
 			break;
 		scoped_guard(read_lock, &kvm->mmu_lock) {
 			for (i = 0 ; i < args->count; i++) {
-				r = dat_set_storage_key(mc, kvm->arch.gmap->asce,
+				r = dat_set_storage_key(mc, kvm->arch.gmap->datt,
 							args->start_gfn + i, keys[i], 0);
 				if (r)
 					break;
@@ -2295,10 +2293,10 @@ static int kvm_s390_get_cmma_bits(struct kvm *kvm,
 
 	scoped_guard(read_lock, &kvm->mmu_lock) {
 		if (peek)
-			ret = dat_peek_cmma(args->start_gfn, kvm->arch.gmap->asce, &args->count,
+			ret = dat_peek_cmma(args->start_gfn, kvm->arch.gmap->datt, &args->count,
 					    values);
 		else
-			ret = dat_get_cmma(kvm->arch.gmap->asce, &args->start_gfn, &args->count,
+			ret = dat_get_cmma(kvm->arch.gmap->datt, &args->start_gfn, &args->count,
 					   values, &kvm->arch.cmma_dirty_pages);
 	}
 
@@ -2354,12 +2352,13 @@ static int kvm_s390_set_cmma_bits(struct kvm *kvm,
 		if (r)
 			return r;
 		scoped_guard(read_lock, &kvm->mmu_lock) {
-			r = dat_set_cmma_bits(mc, kvm->arch.gmap->asce, args->start_gfn,
+			r = dat_set_cmma_bits(mc, kvm->arch.gmap->datt, args->start_gfn,
 					      args->count, args->mask, bits);
 		}
 	} while (r == -ENOMEM);
 
-	set_bit(GMAP_FLAG_USES_CMM, &kvm->arch.gmap->flags);
+	WRITE_ONCE(kvm->arch.gmap->datt.has_pgstes, true);
+	WRITE_ONCE(kvm->arch.gmap->datt.uses_cmma, true);
 
 	return r <= 0 ? r : -EFAULT;
 }
@@ -3346,13 +3345,18 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 			.flags = 0,
 		};
 
+		rc = gmap_enable_skeys(kvm->arch.gmap);
+		if (rc)
+			goto out_err;
 		/* one flat fake memslot covering the whole address-space */
 		mutex_lock(&kvm->slots_lock);
-		KVM_BUG_ON(kvm_set_internal_memslot(kvm, &fake_memslot), kvm);
+		rc = kvm_set_internal_memslot(kvm, &fake_memslot);
 		mutex_unlock(&kvm->slots_lock);
+		if (KVM_BUG_ON(rc, kvm))
+			goto out_err;
 		set_bit(GMAP_FLAG_IS_UCONTROL, &kvm->arch.gmap->flags);
 	} else {
-		struct crst_table *table = dereference_asce(kvm->arch.gmap->asce);
+		struct crst_table *table = kvm->arch.gmap->datt.table;
 
 		crst_table_init((void *)table, _CRSTE_HOLE(table->crstes[0].h.tt).val);
 	}
@@ -3369,6 +3373,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 
 	return 0;
 out_err:
+	if (kvm->arch.gmap)
+		kvm->arch.gmap = gmap_put(kvm->arch.gmap);
 	free_page((unsigned long)kvm->arch.sie_page2);
 	debug_unregister(kvm->arch.dbf);
 	sca_dispose(kvm);
@@ -4328,7 +4334,7 @@ static int kvm_s390_fixup_prefix(struct kvm_vcpu *vcpu)
 		return rc;
 
 	scoped_guard(write_lock, &vcpu->kvm->mmu_lock)
-		rc = dat_set_prefix_notif_bit(vcpu->kvm->arch.gmap->asce, gfn);
+		rc = dat_set_prefix_notif_bit(vcpu->kvm->arch.gmap->datt, gfn);
 	return rc;
 }
 
@@ -4806,7 +4812,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
 
 		sie_return = kvm_s390_enter_exit_sie(vcpu->arch.sie_block,
 						     vcpu->run->s.regs.gprs,
-						     vcpu->arch.gmap->asce.val);
+						     vcpu->arch.gmap->datt.asce.val);
 
 		__enable_cpu_timer_accounting(vcpu);
 		guest_timing_exit_irqoff();
@@ -5769,7 +5775,7 @@ void kvm_s390_update_cmma_dirty(struct kvm *kvm, const struct kvm_memory_slot *o
 
 	if (kvm->arch.migration_mode && kvm->arch.use_cmma && old) {
 		_dat_walk_gfn_range(old->base_gfn, old->base_gfn + old->npages,
-				    kvm->arch.gmap->asce, &ops, DAT_WALK_IGN_HOLES,
+				    kvm->arch.gmap->datt, &ops, DAT_WALK_IGN_HOLES,
 				    &kvm->arch.cmma_dirty_pages);
 	}
 }
@@ -5835,7 +5841,7 @@ long kvm_arch_vcpu_pre_fault_memory(struct kvm_vcpu *vcpu, struct kvm_pre_fault_
 bool kvm_test_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range)
 {
 	scoped_guard(read_lock, &kvm->mmu_lock)
-		return dat_test_age_gfn(kvm->arch.gmap->asce, range->start, range->end);
+		return dat_test_age_gfn(kvm->arch.gmap->datt, range->start, range->end);
 }
 
 /**
diff --git a/arch/s390/kvm/s390/s390.h b/arch/s390/kvm/s390/s390.h
index aa0d1d062f8dc..daf3b0d004a48 100644
--- a/arch/s390/kvm/s390/s390.h
+++ b/arch/s390/kvm/s390/s390.h
@@ -115,11 +115,7 @@ static inline int is_vcpu_idle(struct kvm_vcpu *vcpu)
 
 static inline int kvm_is_ucontrol(struct kvm *kvm)
 {
-#ifdef CONFIG_KVM_S390_UCONTROL
-	return test_bit(GMAP_FLAG_IS_UCONTROL, &kvm->arch.gmap->flags);
-#else
-	return 0;
-#endif
+	return is_ucontrol(kvm->arch.gmap);
 }
 
 #define GUEST_PREFIX_SHIFT 12
diff --git a/arch/s390/kvm/s390/vsie.c b/arch/s390/kvm/s390/vsie.c
index 5926689fa2267..0a2cd9315e131 100644
--- a/arch/s390/kvm/s390/vsie.c
+++ b/arch/s390/kvm/s390/vsie.c
@@ -49,20 +49,21 @@ struct vsie_page {
 	/* address of the last reported fault to guest2 */
 	unsigned long fault_addr;		/* 0x0228 */
 	/* calculated guest addresses of satellite control blocks */
-	gpa_t sca_gpa;				/* 0x0230 */
-	gpa_t itdba_gpa;			/* 0x0238 */
-	gpa_t gvrd_gpa;				/* 0x0240 */
-	gpa_t riccbd_gpa;			/* 0x0248 */
-	gpa_t sdnx_gpa;				/* 0x0250 */
+	struct kvm_host_map sca_map;		/* 0x0230 */
+	struct kvm_host_map itdba_map;		/* 0x0260 */
+	struct kvm_host_map gvrd_map;		/* 0x0290 */
+	struct kvm_host_map riccbd_map;		/* 0x02c0 */
+	struct kvm_host_map sdnx_map;		/* 0x02f0 */
+	struct kvm_host_map scb_map;		/* 0x0320 */
 	/*
 	 * guest address of the original SCB. Remains set for free vsie
 	 * pages, so we can properly look them up in our addr_to_page
 	 * radix tree.
 	 */
-	gpa_t scb_gpa;				/* 0x0258 */
+	gpa_t scb_gpa;				/* 0x0350 */
 	/* the shadow gmap in use by the vsie_page */
-	struct gmap_cache gmap_cache;		/* 0x0260 */
-	__u8 reserved[0x06f8 - 0x0278];		/* 0x0278 */
+	struct gmap_cache gmap_cache;		/* 0x0358 */
+	__u8 reserved[0x06f8 - 0x0370];		/* 0x0370 */
 	struct kvm_s390_crypto_cb crycb;	/* 0x06f8 */
 	__u8 fac[8 + S390_ARCH_FAC_LIST_SIZE_BYTE];/* 0x07f8 */
 };
@@ -681,72 +682,45 @@ static int map_prefix(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page, struct
 }
 
 /*
- * Pin the guest page given by gpa and set hpa to the pinned host address.
+ * pin_guest_page() - Pin the given guest page and return its hpa.
+ * @vcpu: the vCPU
+ * @gpa: the gpa to pin
+ * @map: the map representing this pinning.
+ *
  * Will always be pinned writable.
  *
- * Returns: - 0 on success
- *          - -EINVAL if the gpa is not valid guest storage
+ * Returns: - 0 if the gpa is not valid guest storage,
+ *          - The host hpa of the pinned page in case of success
  */
-static int pin_guest_page(struct kvm *kvm, gpa_t gpa, hpa_t *hpa)
+static hpa_t pin_guest_page(struct kvm_vcpu *vcpu, gpa_t gpa, struct kvm_host_map *map)
 {
-	struct page *page;
-
-	page = gfn_to_page(kvm, gpa_to_gfn(gpa));
-	if (!page)
-		return -EINVAL;
-	*hpa = (hpa_t)page_to_phys(page) + (gpa & ~PAGE_MASK);
-	return 0;
-}
-
-/* Unpins a page previously pinned via pin_guest_page, marking it as dirty. */
-static void unpin_guest_page(struct kvm *kvm, gpa_t gpa, hpa_t hpa)
-{
-	kvm_release_page_dirty(pfn_to_page(phys_to_pfn(hpa)));
-	/* mark the page always as dirty for migration */
-	mark_page_dirty(kvm, gpa_to_gfn(gpa));
+	if (kvm_vcpu_map(vcpu, gpa_to_gfn(gpa), map))
+		return 0;
+	if (!kvm_vcpu_mapped(map))
+		return 0;
+	return (hpa_t)PFN_PHYS(map->pfn) + (gpa & ~PAGE_MASK);
 }
 
 /* unpin all blocks previously pinned by pin_blocks(), marking them dirty */
 static void unpin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 {
 	struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;
-	hpa_t hpa;
 
-	hpa = (u64) scb_s->scaoh << 32 | scb_s->scaol;
-	if (hpa) {
-		unpin_guest_page(vcpu->kvm, vsie_page->sca_gpa, hpa);
-		vsie_page->sca_gpa = 0;
-		scb_s->scaol = 0;
-		scb_s->scaoh = 0;
-	}
+	kvm_vcpu_unmap(vcpu, &vsie_page->sca_map);
+	scb_s->scaol = 0;
+	scb_s->scaoh = 0;
 
-	hpa = scb_s->itdba;
-	if (hpa) {
-		unpin_guest_page(vcpu->kvm, vsie_page->itdba_gpa, hpa);
-		vsie_page->itdba_gpa = 0;
-		scb_s->itdba = 0;
-	}
+	kvm_vcpu_unmap(vcpu, &vsie_page->itdba_map);
+	scb_s->itdba = 0;
 
-	hpa = scb_s->gvrd;
-	if (hpa) {
-		unpin_guest_page(vcpu->kvm, vsie_page->gvrd_gpa, hpa);
-		vsie_page->gvrd_gpa = 0;
-		scb_s->gvrd = 0;
-	}
+	kvm_vcpu_unmap(vcpu, &vsie_page->gvrd_map);
+	scb_s->gvrd = 0;
 
-	hpa = scb_s->riccbd;
-	if (hpa) {
-		unpin_guest_page(vcpu->kvm, vsie_page->riccbd_gpa, hpa);
-		vsie_page->riccbd_gpa = 0;
-		scb_s->riccbd = 0;
-	}
+	kvm_vcpu_unmap(vcpu, &vsie_page->riccbd_map);
+	scb_s->riccbd = 0;
 
-	hpa = scb_s->sdnxo;
-	if (hpa) {
-		unpin_guest_page(vcpu->kvm, vsie_page->sdnx_gpa, hpa);
-		vsie_page->sdnx_gpa = 0;
-		scb_s->sdnxo = 0;
-	}
+	kvm_vcpu_unmap(vcpu, &vsie_page->sdnx_map);
+	scb_s->sdnxo = 0;
 }
 
 /*
@@ -783,13 +757,12 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 			 ((gpa + offsetof(struct bsca_block, cpu[0]) - 1) & PAGE_MASK))
 			rc = set_validity_icpt(scb_s, 0x003bU);
 		if (!rc) {
-			rc = pin_guest_page(vcpu->kvm, gpa, &hpa);
-			if (rc)
+			hpa = pin_guest_page(vcpu, gpa, &vsie_page->sca_map);
+			if (!hpa)
 				rc = set_validity_icpt(scb_s, 0x0034U);
 		}
-		if (rc)
+		if (rc || !hpa)
 			goto unpin;
-		vsie_page->sca_gpa = gpa;
 		scb_s->scaoh = (u32)((u64)hpa >> 32);
 		scb_s->scaol = (u32)(u64)hpa;
 	}
@@ -801,12 +774,11 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 			goto unpin;
 		}
 		/* 256 bytes cannot cross page boundaries */
-		rc = pin_guest_page(vcpu->kvm, gpa, &hpa);
-		if (rc) {
+		hpa = pin_guest_page(vcpu, gpa, &vsie_page->itdba_map);
+		if (!hpa) {
 			rc = set_validity_icpt(scb_s, 0x0080U);
 			goto unpin;
 		}
-		vsie_page->itdba_gpa = gpa;
 		scb_s->itdba = hpa;
 	}
 
@@ -820,12 +792,11 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 		 * 512 bytes vector registers cannot cross page boundaries
 		 * if this block gets bigger, we have to shadow it.
 		 */
-		rc = pin_guest_page(vcpu->kvm, gpa, &hpa);
-		if (rc) {
+		hpa = pin_guest_page(vcpu, gpa, &vsie_page->gvrd_map);
+		if (!hpa) {
 			rc = set_validity_icpt(scb_s, 0x1310U);
 			goto unpin;
 		}
-		vsie_page->gvrd_gpa = gpa;
 		scb_s->gvrd = hpa;
 	}
 
@@ -836,13 +807,12 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 			goto unpin;
 		}
 		/* 64 bytes cannot cross page boundaries */
-		rc = pin_guest_page(vcpu->kvm, gpa, &hpa);
-		if (rc) {
+		hpa = pin_guest_page(vcpu, gpa, &vsie_page->riccbd_map);
+		if (!hpa) {
 			rc = set_validity_icpt(scb_s, 0x0043U);
 			goto unpin;
 		}
 		/* Validity 0x0044 will be checked by SIE */
-		vsie_page->riccbd_gpa = gpa;
 		scb_s->riccbd = hpa;
 	}
 	if (((scb_s->ecb & ECB_GS) && !(scb_s->ecd & ECD_HOSTREGMGMT)) ||
@@ -866,12 +836,11 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 		/* Due to alignment rules (checked above) this cannot
 		 * cross page boundaries
 		 */
-		rc = pin_guest_page(vcpu->kvm, gpa, &hpa);
-		if (rc) {
+		hpa = pin_guest_page(vcpu, gpa, &vsie_page->sdnx_map);
+		if (!hpa) {
 			rc = set_validity_icpt(scb_s, 0x10b0U);
 			goto unpin;
 		}
-		vsie_page->sdnx_gpa = gpa;
 		scb_s->sdnxo = hpa | sdnxc;
 	}
 	return 0;
@@ -881,13 +850,9 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 }
 
 /* unpin the scb provided by guest 2, marking it as dirty */
-static void unpin_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page,
-		      gpa_t gpa)
+static void unpin_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 {
-	hpa_t hpa = virt_to_phys(vsie_page->scb_o);
-
-	if (hpa)
-		unpin_guest_page(vcpu->kvm, gpa, hpa);
+	kvm_vcpu_unmap(vcpu, &vsie_page->scb_map);
 	vsie_page->scb_o = NULL;
 }
 
@@ -901,12 +866,10 @@ static int pin_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page,
 		   gpa_t gpa)
 {
 	hpa_t hpa;
-	int rc;
 
-	rc = pin_guest_page(vcpu->kvm, gpa, &hpa);
-	if (rc) {
-		rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
-		WARN_ON_ONCE(rc);
+	hpa = pin_guest_page(vcpu, gpa, &vsie_page->scb_map);
+	if (!hpa) {
+		WARN_ON_ONCE(kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING));
 		return 1;
 	}
 	vsie_page->scb_o = phys_to_virt(hpa);
@@ -1232,7 +1195,8 @@ static int do_vsie_run(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page, struc
 			goto xfer_to_guest_mode_check;
 		}
 		guest_timing_enter_irqoff();
-		sie_return = kvm_s390_enter_exit_sie(scb_s, vcpu->run->s.regs.gprs, sg->asce.val);
+		sie_return = kvm_s390_enter_exit_sie(scb_s, vcpu->run->s.regs.gprs,
+						     sg->datt.asce.val);
 		guest_timing_exit_irqoff();
 		local_irq_enable();
 	}
@@ -1601,7 +1565,7 @@ int kvm_s390_handle_vsie(struct kvm_vcpu *vcpu)
 out_unshadow:
 	unshadow_scb(vcpu, vsie_page);
 out_unpin_scb:
-	unpin_scb(vcpu, vsie_page, scb_addr);
+	unpin_scb(vcpu, vsie_page);
 out_put:
 	put_vsie_page(vsie_page);
 

3/2 2026/10/24 05:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 44574
							output: 20
							thoughts: 349
						

Thoughts:
**Evaluating the Patch Series for Syzkaller Fuzzing Potential**

Okay, let's see, the goal is to determine if this patch series is a good candidate for syzkaller fuzzing. First, I need to check the target architecture. Ah, "Target architecture: amd64" - I need to make a note of this. However, let's look at the files that were actually modified in the patch:

*   `arch/s390/kvm/gmap/dat.c`
*   `arch/s390/kvm/gmap/dat.h`
*   `arch/s390/kvm/gmap/gmap.c`
*   `arch/s390/kvm/gmap/gmap.h`
*   `arch/s390/kvm/gmap/kvm_mmu.c`
*   `arch/s390/kvm/s390/gaccess.c`
*   `arch/s390/kvm/s390/priv.c`
*   `arch/s390/kvm/s390/pv.c`
*   `arch/s390/kvm/s390/s390.c`
*   `arch/s390/kvm/s390/s390.h`
*   `arch/s390/kvm/s390/vsie.c`

Wait a minute, it looks like **all** the modified files are under the `arch/s390/` directory. That's a strong indicator. I need to be absolutely sure that no files outside of `arch/s390/` were touched. Let's do a quick `git status` or diff to confirm, or, to be absolutely certain, I'll run a dedicated tool to verify that 100%. This is the sort of thing that can trip you up!



4/2 2026/10/24 05:55 tool grepper
0m Args:
{
  "Expression": "arch/s390"
}

Results:
{
  "Output": "\nFull output is too long, showing 200 out of 431 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (53 files in total):\nDocumentation/.renames.txt:15\nDocumentation/admin-guide/kernel-parameters.txt:2\nDocumentation/arch/s390/3270.rst:2\nDocumentation/arch/s390/cds.rst:2\nDocumentation/arch/s390/common_io.rst:1\nDocumentation/arch/s390/pci.rst:1\nDocumentation/arch/s390/s390dbf.rst:4\nDocumentation/arch/s390/vfio-ap-locking.rst:1\nDocumentation/arch/s390/vfio-ccw.rst:1\nDocumentation/bpf/s390.rst:1\nDocumentation/driver-api/s390-drivers.rst:6\nDocumentation/kbuild/makefiles.rst:3\nDocumentation/userspace-api/ioctl/ioctl-number.rst:4\nMAINTAINERS:27\narch/parisc/kernel/vdso.c:1\narch/s390/Kconfig:4\narch/s390/Makefile:6\narch/s390/Makefile.postlink:2\narch/s390/boot/install.sh:1\narch/s390/boot/uv.c:1\narch/s390/include/asm/debug.h:2\narch/s390/include/asm/delay.h:1\narch/s390/include/asm/kvm_host_s390.h:1\narch/s390/include/asm/pgalloc.h:1\narch/s390/kernel/uv.c:1\narch/s390/kernel/vdso/vdso_wrapper.S:1\narch/s390/kvm/s390/Makefile:2\narch/s390/purgatory/kexec-purgatory.S:1\ncrypto/Kconfig:1\ndrivers/s390/char/zcore.c:1\nfs/ioctl.c:1\ninclude/crypto/hash.h:1\nkernel/Kconfig.kexec:1\nscripts/head-object-list.txt:1\ntools/include/asm/barrier.h:1\ntools/include/uapi/asm/bitsperlong.h:1\ntools/include/uapi/asm/bpf_perf_event.h:1\ntools/perf/arch/s390/include/perf_regs.h:1\ntools/perf/check-headers.sh:4\ntools/perf/trace/beauty/syscalltbl.sh:1\ntools/perf/util/dwarf-regs-arch/dwarf-regs-s390.c:1\ntools/perf/util/dwarf-regs.c:1\ntools/perf/util/kvm-stat-arch/kvm-stat-s390.c:1\ntools/perf/util/libunwind-arch/libunwind-s390.c:1\ntools/perf/util/perf-regs-arch/perf_regs_s390.c:1\ntools/perf/util/s390-cpumsf.c:1\ntools/testing/kunit/qemu_configs/s390.py:1\ntools/testing/selftests/bpf/vmtest.sh:1\ntools/testing/selftests/kvm/include/s390/sie.h:1\ntools/testing/selftests/nolibc/Makefile.nolibc:1\n... and 3 more files\n\nDocumentation/.renames.txt=923=riscv/vm-layout arch/riscv/vm-layout\nDocumentation/.renames.txt:924:s390/3270 arch/s390/3270\nDocumentation/.renames.txt:925:s390/cds arch/s390/cds\nDocumentation/.renames.txt:926:s390/common_io arch/s390/common_io\nDocumentation/.renames.txt:927:s390/driver-model arch/s390/driver-model\nDocumentation/.renames.txt:928:s390/features arch/s390/features\nDocumentation/.renames.txt:929:s390/index arch/s390/index\nDocumentation/.renames.txt:930:s390/monreader arch/s390/monreader\nDocumentation/.renames.txt:931:s390/pci arch/s390/pci\nDocumentation/.renames.txt:932:s390/qeth arch/s390/qeth\nDocumentation/.renames.txt:933:s390/s390dbf arch/s390/s390dbf\nDocumentation/.renames.txt:934:s390/text_files arch/s390/text_files\nDocumentation/.renames.txt:935:s390/vfio-ap arch/s390/vfio-ap\nDocumentation/.renames.txt:936:s390/vfio-ap-locking arch/s390/vfio-ap-locking\nDocumentation/.renames.txt:937:s390/vfio-ccw arch/s390/vfio-ccw\nDocumentation/.renames.txt:938:s390/zfcpdump arch/s390/zfcpdump\nDocumentation/.renames.txt-939-security/LSM security/lsm-development\n--\nDocumentation/admin-guide/kernel-parameters.txt=98=Kernel parameters\n--\nDocumentation/admin-guide/kernel-parameters.txt-711-\tccw_timeout_log\t[S390]\nDocumentation/admin-guide/kernel-parameters.txt:712:\t\t\tSee Documentation/arch/s390/common_io.rst for details.\nDocumentation/admin-guide/kernel-parameters.txt-713-\n--\nDocumentation/admin-guide/kernel-parameters.txt-794-\tcio_ignore=\t[S390]\nDocumentation/admin-guide/kernel-parameters.txt:795:\t\t\tSee Documentation/arch/s390/common_io.rst for details.\nDocumentation/admin-guide/kernel-parameters.txt-796-\n--\nDocumentation/arch/s390/3270.rst=80=Here are the installation steps in detail:\n--\nDocumentation/arch/s390/3270.rst-118-\t5. Run the 3270 configuration script config3270.  It is\nDocumentation/arch/s390/3270.rst:119:\tdistributed in this same directory, Documentation/arch/s390, as\nDocumentation/arch/s390/3270.rst-120-\tconfig3270.sh.  Inspect the output script it produces,\n--\nDocumentation/arch/s390/3270.rst-127-\nDocumentation/arch/s390/3270.rst:128:\t\tcd Documentation/arch/s390\nDocumentation/arch/s390/3270.rst-129-\t\tsh config3270.sh\n--\nDocumentation/arch/s390/cds.rst=40=Note:\nDocumentation/arch/s390/cds.rst-41-  In order to write a driver for S/390, you also need to look into the interface\nDocumentation/arch/s390/cds.rst:42:  described in Documentation/arch/s390/driver-model.rst.\nDocumentation/arch/s390/cds.rst-43-\n--\nDocumentation/arch/s390/cds.rst=106=can be found in the architecture specific C header file\nDocumentation/arch/s390/cds.rst:107:linux/arch/s390/include/asm/irq.h.\nDocumentation/arch/s390/cds.rst-108-\n--\nDocumentation/arch/s390/common_io.rst=118=debugfs entries\n--\nDocumentation/arch/s390/common_io.rst-138-  /sys/kernel/debug/s390dbf/cio_*/level a number between 0 and 6; see the\nDocumentation/arch/s390/common_io.rst:139:  documentation on the S/390 debug feature (Documentation/arch/s390/s390dbf.rst)\nDocumentation/arch/s390/common_io.rst-140-  for details.\n--\nDocumentation/arch/s390/pci.rst=36=For example:\n--\nDocumentation/arch/s390/pci.rst-45-  details, see the documentation on the S/390 debug feature at\nDocumentation/arch/s390/pci.rst:46:  Documentation/arch/s390/s390dbf.rst.\nDocumentation/arch/s390/pci.rst-47-\n--\nDocumentation/arch/s390/s390dbf.rst=5=files:\nDocumentation/arch/s390/s390dbf.rst:6:      - arch/s390/kernel/debug.c\nDocumentation/arch/s390/s390dbf.rst:7:      - arch/s390/include/asm/debug.h\nDocumentation/arch/s390/s390dbf.rst-8-\n--\nDocumentation/arch/s390/s390dbf.rst=139=Kernel Interfaces:\n--\nDocumentation/arch/s390/s390dbf.rst-141-\nDocumentation/arch/s390/s390dbf.rst:142:.. kernel-doc:: arch/s390/kernel/debug.c\nDocumentation/arch/s390/s390dbf.rst:143:.. kernel-doc:: arch/s390/include/asm/debug.h\nDocumentation/arch/s390/s390dbf.rst-144-\n--\nDocumentation/arch/s390/vfio-ap-locking.rst=95=resources, so only the matrix_dev-\u003emdevs_lock needs to be held.\nDocumentation/arch/s390/vfio-ap-locking.rst-96-\nDocumentation/arch/s390/vfio-ap-locking.rst:97:The PQAP Hook Lock (arch/s390/include/asm/kvm_host.h)\nDocumentation/arch/s390/vfio-ap-locking.rst-98------------------------------------------------------\n--\nDocumentation/arch/s390/vfio-ccw.rst=438=Reference\n--\nDocumentation/arch/s390/vfio-ccw.rst-442-3. https://en.wikipedia.org/wiki/Channel_I/O\nDocumentation/arch/s390/vfio-ccw.rst:443:4. Documentation/arch/s390/cds.rst\nDocumentation/arch/s390/vfio-ccw.rst-444-5. Documentation/driver-api/vfio.rst\n--\nDocumentation/bpf/s390.rst=130=The virtual machine can be started as follows::\n--\nDocumentation/bpf/s390.rst-135-    -m 4G \\\nDocumentation/bpf/s390.rst:136:    -kernel linux/arch/s390/boot/compressed/vmlinux \\\nDocumentation/bpf/s390.rst-137-    -drive file=./s390.img,if=virtio,format=raw \\\n--\nDocumentation/driver-api/s390-drivers.rst=29=Some additional information can also be found in the kernel source under\nDocumentation/driver-api/s390-drivers.rst:30:Documentation/arch/s390/driver-model.rst.\nDocumentation/driver-api/s390-drivers.rst-31-\n--\nDocumentation/driver-api/s390-drivers.rst=36=into several categories:\n--\nDocumentation/driver-api/s390-drivers.rst-40-* I/O subchannels bound to the vfio-ccw driver. See\nDocumentation/driver-api/s390-drivers.rst:41:  Documentation/arch/s390/vfio-ccw.rst.\nDocumentation/driver-api/s390-drivers.rst-42-* Message subchannels. No Linux driver currently exists.\n--\nDocumentation/driver-api/s390-drivers.rst=65=Operation.\nDocumentation/driver-api/s390-drivers.rst-66-\nDocumentation/driver-api/s390-drivers.rst:67:.. kernel-doc:: arch/s390/include/asm/cio.h\nDocumentation/driver-api/s390-drivers.rst-68-   :internal:\n--\nDocumentation/driver-api/s390-drivers.rst=79=strange side effects may happen.\nDocumentation/driver-api/s390-drivers.rst-80-\nDocumentation/driver-api/s390-drivers.rst:81:.. kernel-doc:: arch/s390/include/asm/ccwdev.h\nDocumentation/driver-api/s390-drivers.rst-82-   :internal:\n--\nDocumentation/driver-api/s390-drivers.rst=95=attached device.\nDocumentation/driver-api/s390-drivers.rst-96-\nDocumentation/driver-api/s390-drivers.rst:97:.. kernel-doc:: arch/s390/include/uapi/asm/cmb.h\nDocumentation/driver-api/s390-drivers.rst-98-   :internal:\n--\nDocumentation/driver-api/s390-drivers.rst=112=ccw group devices\n--\nDocumentation/driver-api/s390-drivers.rst-114-\nDocumentation/driver-api/s390-drivers.rst:115:.. kernel-doc:: arch/s390/include/asm/ccwgroup.h\nDocumentation/driver-api/s390-drivers.rst-116-   :internal:\n--\nDocumentation/kbuild/makefiles.rst=1093=KBUILD_LDFLAGS\n--\nDocumentation/kbuild/makefiles.rst-1100-\nDocumentation/kbuild/makefiles.rst:1101:    #arch/s390/Makefile\nDocumentation/kbuild/makefiles.rst-1102-    KBUILD_LDFLAGS         := -m elf_s390\n--\nDocumentation/kbuild/makefiles.rst=1120=OBJCOPYFLAGS\n--\nDocumentation/kbuild/makefiles.rst-1130-\nDocumentation/kbuild/makefiles.rst:1131:    #arch/s390/Makefile\nDocumentation/kbuild/makefiles.rst-1132-    OBJCOPYFLAGS := -O binary\nDocumentation/kbuild/makefiles.rst-1133-\nDocumentation/kbuild/makefiles.rst:1134:    #arch/s390/boot/Makefile\nDocumentation/kbuild/makefiles.rst-1135-    $(obj)/image: vmlinux FORCE\n--\nDocumentation/userspace-api/ioctl/ioctl-number.rst=73=Code  Seq#    Include File                                             Comments\n--\nDocumentation/userspace-api/ioctl/ioctl-number.rst-86-0x10  00-0F  drivers/char/s390/vmcp.h\nDocumentation/userspace-api/ioctl/ioctl-number.rst:87:0x10  10-1F  arch/s390/include/uapi/sclp_ctl.h\nDocumentation/userspace-api/ioctl/ioctl-number.rst:88:0x10  20-2F  arch/s390/include/uapi/asm/hypfs.h\nDocumentation/userspace-api/ioctl/ioctl-number.rst-89-0x12  all    linux/fs.h                                                BLK* ioctls\n--\nDocumentation/userspace-api/ioctl/ioctl-number.rst-131-'C'   F0-FF  drivers/net/wan/cosa.h                                    conflict!\nDocumentation/userspace-api/ioctl/ioctl-number.rst:132:'D'   all    arch/s390/include/asm/dasd.h\nDocumentation/userspace-api/ioctl/ioctl-number.rst-133-'D'   40-5F  drivers/scsi/dpt/dtpi_ioctl.h                             Dead since 2022\n--\nDocumentation/userspace-api/ioctl/ioctl-number.rst-238-'c'   00-1F  linux/chio.h                                              conflict!\nDocumentation/userspace-api/ioctl/ioctl-number.rst:239:'c'   80-9F  arch/s390/include/asm/chsc.h                              conflict!\nDocumentation/userspace-api/ioctl/ioctl-number.rst-240-'c'   A0-AF  arch/x86/include/asm/msr.h conflict!\n--\nMAINTAINERS=4918=S:\tSupported\nMAINTAINERS:4919:F:\tarch/s390/net/\nMAINTAINERS:4920:X:\tarch/s390/net/pnet.c\nMAINTAINERS-4921-\n--\nMAINTAINERS=14448=F:\tDocumentation/virt/kvm/s390*\nMAINTAINERS:14449:F:\tarch/s390/include/asm/gmap_helpers.h\nMAINTAINERS:14450:F:\tarch/s390/include/asm/kvm*\nMAINTAINERS:14451:F:\tarch/s390/include/uapi/asm/kvm*\nMAINTAINERS:14452:F:\tarch/s390/include/uapi/asm/uvdevice.h\nMAINTAINERS:14453:F:\tarch/s390/kernel/uv.c\nMAINTAINERS:14454:F:\tarch/s390/kvm/\nMAINTAINERS:14455:F:\tarch/s390/mm/gmap_helpers.c\nMAINTAINERS-14456-F:\tdrivers/s390/char/uvdevice.c\n--\nMAINTAINERS=24252=F:\tDocumentation/driver-api/s390-drivers.rst\nMAINTAINERS:24253:F:\tDocumentation/arch/s390/\nMAINTAINERS:24254:F:\tarch/s390/\nMAINTAINERS-24255-F:\tdrivers/cpuidle/cpuidle-s390.c\n--\nMAINTAINERS=24271=S:\tSupported\nMAINTAINERS:24272:F:\tarch/s390/crypto/\nMAINTAINERS:24273:F:\tarch/s390/include/asm/archrandom.h\nMAINTAINERS:24274:F:\tarch/s390/include/asm/cpacf.h\nMAINTAINERS-24275-\n--\nMAINTAINERS=24316=T:\tgit git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git\nMAINTAINERS:24317:F:\tarch/s390/include/asm/pgtable.h\nMAINTAINERS:24318:F:\tarch/s390/mm\nMAINTAINERS-24319-\n--\nMAINTAINERS=24332=S:\tSupported\nMAINTAINERS:24333:F:\tDocumentation/arch/s390/pci.rst\nMAINTAINERS:24334:F:\tarch/s390/pci/\nMAINTAINERS-24335-F:\tdrivers/pci/hotplug/s390_pci_hpc.c\n--\nMAINTAINERS=24357=T:\tgit git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git\nMAINTAINERS:24358:F:\tDocumentation/arch/s390/vfio-ap*\nMAINTAINERS-24359-F:\tdrivers/s390/crypto/vfio_ap*\n--\nMAINTAINERS=24368=T:\tgit git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git\nMAINTAINERS:24369:F:\tDocumentation/arch/s390/vfio-ccw.rst\nMAINTAINERS-24370-F:\tdrivers/s390/cio/vfio_ccw*\n--\nMAINTAINERS=24380=T:\tgit git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git\nMAINTAINERS:24381:F:\tarch/s390/kvm/s390/pci*\nMAINTAINERS-24382-F:\tdrivers/vfio/pci/vfio_pci_zdev.c\n--\nMAINTAINERS=24389=S:\tSupported\nMAINTAINERS:24390:F:\tarch/s390/include/asm/ap.h\nMAINTAINERS:24391:F:\tarch/s390/include/asm/pkey.h\n\n"
}

5/2 2026/10/24 05:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 50913
							output: 101
							thoughts: 1549
						

Thoughts:
**Analysis of the Provided Commit for Fuzzing Eligibility**

Okay, first things first, I see the commit diff. I don't need to re-fetch that; it's right here in the prompt. I can see all the modified files are under `arch/s390/kvm/`.  Now, I need to focus on the instructions and, specifically, the negative criteria for `WorthFuzzing=false`. The instruction states that I should only return `WorthFuzzing=false` if *all* the changed code falls into one of these categories: unreachable execution paths or code exclusive to an architecture *other* than the target.

The target architecture is stated as `amd64`. Looking at the modified files, they're *all* in `arch/s390/`.  That's IBM's System/390 architecture, s390x.  So, right away, my brain goes to the fact that s390 code is inherently unreachable on an amd64 system. There's no possible way it would be compiled and executed, it's a completely different architecture.

I'm verifying, because I always want to be thorough. The critical part of the rule is "all modified code falls strictly into one or more of these categories". So, let me re-examine the diff and confirm.  Yes, every single file touched is within the `arch/s390/` directory structure. No files outside of that scope. This is s390-specific code, particularly KVM code for s390. On amd64, KVM uses the code in `arch/x86/kvm/`, and they have no connection.

Okay, let's step through the negative criterion again: "Code paths exclusive to architectures other than the target architecture". Bingo! All of this code is exclusive to s390. That's a perfect match.

So, let me re-read the relevant section again: `Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories: ... - Code paths exclusive to architectures other than the target architecture.` Since this check is satisfied, that means `WorthFuzzing=false`.

Now, I need to set the `FocusSymbols` and `EnableConfigs`. When `WorthFuzzing` is `false`, as per the documentation, both of these should be empty. So, `[]` for both.

Finally, the `Reasoning`. I'll make this super clear: "The patch exclusively modifies s390 KVM code under `arch/s390/kvm/`. Since the target architecture is amd64 (x86_64), all modified code paths belong exclusively to an architecture other than the target architecture and are structurally unreachable."

That's it. Time to submit this.



6/2 2026/10/24 05:55 tool set-results
0m Args:
{
  "EnableConfigs": [],
  "FocusSymbols": [],
  "Reasoning": "The patch exclusively modifies s390 KVM and guest memory management (gmap/dat) code located entirely within arch/s390/kvm/. Since the target architecture is amd64 (x86_64), the modified code paths are exclusive to s390 and are structurally unreachable on amd64.",
  "WorthFuzzing": false
}

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch exclusively modifies s390 KVM and guest memory management (gmap/dat) code located entirely within arch/s390/kvm/. Since the target architecture is amd64 (x86_64), the modified code paths are exclusive to s390 and are structurally unreachable on amd64.",
  "WorthFuzzing": false
}

7/1 2026/10/24 05:55 action If
0m Args:
{
  "WorthFuzzing": false
}

Results:
null

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)