~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/xen/mmu_hvm.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 #include <linux/types.h>
  3 #include <linux/crash_dump.h>
  4 
  5 #include <xen/interface/xen.h>
  6 #include <xen/hvm.h>
  7 
  8 #include "xen-ops.h"
  9 
 10 #ifdef CONFIG_PROC_VMCORE
 11 /*
 12  * The kdump kernel has to check whether a pfn of the crashed kernel
 13  * was a ballooned page. vmcore is using this function to decide
 14  * whether to access a pfn of the crashed kernel.
 15  * Returns "false" if the pfn is not backed by a RAM page, the caller may
 16  * handle the pfn special in this case.
 17  */
 18 static bool xen_vmcore_pfn_is_ram(struct vmcore_cb *cb, unsigned long pfn)
 19 {
 20         struct xen_hvm_get_mem_type a = {
 21                 .domid = DOMID_SELF,
 22                 .pfn = pfn,
 23         };
 24 
 25         if (HYPERVISOR_hvm_op(HVMOP_get_mem_type, &a)) {
 26                 pr_warn_once("Unexpected HVMOP_get_mem_type failure\n");
 27                 return true;
 28         }
 29         return a.mem_type != HVMMEM_mmio_dm;
 30 }
 31 static struct vmcore_cb xen_vmcore_cb = {
 32         .pfn_is_ram = xen_vmcore_pfn_is_ram,
 33 };
 34 #endif
 35 
 36 static void xen_hvm_exit_mmap(struct mm_struct *mm)
 37 {
 38         struct xen_hvm_pagetable_dying a;
 39         int rc;
 40 
 41         a.domid = DOMID_SELF;
 42         a.gpa = __pa(mm->pgd);
 43         rc = HYPERVISOR_hvm_op(HVMOP_pagetable_dying, &a);
 44         WARN_ON_ONCE(rc < 0);
 45 }
 46 
 47 static int is_pagetable_dying_supported(void)
 48 {
 49         struct xen_hvm_pagetable_dying a;
 50         int rc = 0;
 51 
 52         a.domid = DOMID_SELF;
 53         a.gpa = 0x00;
 54         rc = HYPERVISOR_hvm_op(HVMOP_pagetable_dying, &a);
 55         if (rc < 0) {
 56                 printk(KERN_DEBUG "HVMOP_pagetable_dying not supported\n");
 57                 return 0;
 58         }
 59         return 1;
 60 }
 61 
 62 void __init xen_hvm_init_mmu_ops(void)
 63 {
 64         if (is_pagetable_dying_supported())
 65                 pv_ops.mmu.exit_mmap = xen_hvm_exit_mmap;
 66 #ifdef CONFIG_PROC_VMCORE
 67         register_vmcore_cb(&xen_vmcore_cb);
 68 #endif
 69 }
 70 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php