]> xenbits.xensource.com Git - mini-os.git/commitdiff
Save/Restore Support: Add unmap_shared_info
authorBruno Alvisio <bruno.alvisio@gmail.com>
Mon, 11 Dec 2017 15:25:36 +0000 (07:25 -0800)
committerWei Liu <wei.liu2@citrix.com>
Wed, 21 Mar 2018 09:16:49 +0000 (09:16 +0000)
This function is necessary as part of the pre-suspend operation.

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
arch/x86/setup.c
hypervisor.c
include/hypervisor.h

index 31fa2c64511c4e47cb6ff5ca08ee4fe698b6dcdb..60e12c0c5d92d1d2864c9d93f1a28fbbbd80849c 100644 (file)
@@ -93,6 +93,19 @@ shared_info_t *map_shared_info(void *p)
     return (shared_info_t *)shared_info;
 }
 
+void unmap_shared_info(void)
+{
+    int rc;
+    pte_t nullpte = { };
+
+    if ( (rc = HYPERVISOR_update_va_mapping((unsigned long)shared_info,
+                                            nullpte, UVMF_INVLPG)) )
+    {
+        printk("Failed to unmap shared_info page!! rc=%d\n", rc);
+        do_exit();
+    }
+}
+
 static void get_cmdline(void *p)
 {
     start_info_t *si = p;
index 1647121a83be5f815e0f1c99325334b420696403..d3857e70edb4f64dec939dbc133461814103bd35 100644 (file)
@@ -78,6 +78,18 @@ shared_info_t *map_shared_info(void *p)
 
     return &shared_info;
 }
+
+void unmap_shared_info(void)
+{
+    struct xen_remove_from_physmap xrtp;
+
+    xrtp.domid = DOMID_SELF;
+    xrtp.gpfn = virt_to_pfn(&shared_info);
+    if ( HYPERVISOR_memory_op(XENMEM_remove_from_physmap, &xrtp) != 0 )
+        BUG();
+
+    return;
+}
 #endif
 
 void do_hypervisor_callback(struct pt_regs *regs)
index f3b1f3c186b2a87d183bf131c2b2781c788a94cd..1d092719d849328abe0a21055b7e225a627c23b7 100644 (file)
@@ -43,6 +43,7 @@ int hvm_get_parameter(int idx, uint64_t *value);
 int hvm_set_parameter(int idx, uint64_t value);
 #endif
 shared_info_t *map_shared_info(void *p);
+void unmap_shared_info(void);
 void force_evtchn_callback(void);
 void do_hypervisor_callback(struct pt_regs *regs);
 void mask_evtchn(uint32_t port);