]> xenbits.xensource.com Git - xtf.git/commitdiff
test-nmi-ts-priv: Update to avoid using test_wants_user_mappings
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 1 Mar 2024 21:07:13 +0000 (21:07 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Sun, 3 Mar 2024 00:13:29 +0000 (00:13 +0000)
user_inject_nmi() was already __user_text.  The only other thing needing
fixing is the mapping of the APIC MMIO window, so do that explicitly.

No change in test behaviour.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
tests/nmi-taskswitch-priv/main.c

index 1bc275651cb7258b4391a591813568033682773b..b2e43f9c234afcd472b41a9daa84f7b5596aa6dd 100644 (file)
@@ -33,8 +33,6 @@
 
 const char test_title[] = "Test nmi-taskswitch-priv";
 
-bool test_wants_user_mappings = true;
-
 static uint8_t nmi_stack[PAGE_SIZE] __page_aligned_bss;
 
 void entry_NMI_task(void);
@@ -125,6 +123,12 @@ void test_main(void)
     if ( rc )
         return xtf_error("Error: Unable to set up xapic mode: %d\n", rc);
 
+    /*
+     * Remap the Local APIC MMIO window as USER, so user_inject_nmi() can send
+     * a self-NMI.  No INVLPG, as this is a strict relaxing of permissions.
+     */
+    pae_l2_identmap[APIC_DEFAULT_BASE >> PAE_L2_PT_SHIFT] |= _PAGE_USER;
+
     /*
      * Set up NMI handling to be a task gate.
      */