Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 
0003 /*
0004  * Xen memory reservation utilities.
0005  *
0006  * Copyright (c) 2003, B Dragovic
0007  * Copyright (c) 2003-2004, M Williamson, K Fraser
0008  * Copyright (c) 2005 Dan M. Smith, IBM Corporation
0009  * Copyright (c) 2010 Daniel Kiper
0010  * Copyright (c) 2018 Oleksandr Andrushchenko, EPAM Systems Inc.
0011  */
0012 
0013 #ifndef _XENMEM_RESERVATION_H
0014 #define _XENMEM_RESERVATION_H
0015 
0016 #include <linux/highmem.h>
0017 
0018 #include <xen/page.h>
0019 
0020 extern bool xen_scrub_pages;
0021 
0022 static inline void xenmem_reservation_scrub_page(struct page *page)
0023 {
0024     if (xen_scrub_pages)
0025         clear_highpage(page);
0026 }
0027 
0028 #ifdef CONFIG_XEN_HAVE_PVMMU
0029 void __xenmem_reservation_va_mapping_update(unsigned long count,
0030                         struct page **pages,
0031                         xen_pfn_t *frames);
0032 
0033 void __xenmem_reservation_va_mapping_reset(unsigned long count,
0034                        struct page **pages);
0035 #endif
0036 
0037 static inline void xenmem_reservation_va_mapping_update(unsigned long count,
0038                             struct page **pages,
0039                             xen_pfn_t *frames)
0040 {
0041 #ifdef CONFIG_XEN_HAVE_PVMMU
0042     if (!xen_feature(XENFEAT_auto_translated_physmap))
0043         __xenmem_reservation_va_mapping_update(count, pages, frames);
0044 #endif
0045 }
0046 
0047 static inline void xenmem_reservation_va_mapping_reset(unsigned long count,
0048                                struct page **pages)
0049 {
0050 #ifdef CONFIG_XEN_HAVE_PVMMU
0051     if (!xen_feature(XENFEAT_auto_translated_physmap))
0052         __xenmem_reservation_va_mapping_reset(count, pages);
0053 #endif
0054 }
0055 
0056 int xenmem_reservation_increase(int count, xen_pfn_t *frames);
0057 
0058 int xenmem_reservation_decrease(int count, xen_pfn_t *frames);
0059 
0060 #endif