mem-reservation.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Xen memory reservation utilities.
  4. *
  5. * Copyright (c) 2003, B Dragovic
  6. * Copyright (c) 2003-2004, M Williamson, K Fraser
  7. * Copyright (c) 2005 Dan M. Smith, IBM Corporation
  8. * Copyright (c) 2010 Daniel Kiper
  9. * Copyright (c) 2018 Oleksandr Andrushchenko, EPAM Systems Inc.
  10. */
  11. #ifndef _XENMEM_RESERVATION_H
  12. #define _XENMEM_RESERVATION_H
  13. #include <linux/highmem.h>
  14. #include <xen/page.h>
  15. extern bool xen_scrub_pages;
  16. static inline void xenmem_reservation_scrub_page(struct page *page)
  17. {
  18. if (xen_scrub_pages)
  19. clear_highpage(page);
  20. }
  21. #ifdef CONFIG_XEN_HAVE_PVMMU
  22. void __xenmem_reservation_va_mapping_update(unsigned long count,
  23. struct page **pages,
  24. xen_pfn_t *frames);
  25. void __xenmem_reservation_va_mapping_reset(unsigned long count,
  26. struct page **pages);
  27. #endif
  28. static inline void xenmem_reservation_va_mapping_update(unsigned long count,
  29. struct page **pages,
  30. xen_pfn_t *frames)
  31. {
  32. #ifdef CONFIG_XEN_HAVE_PVMMU
  33. if (!xen_feature(XENFEAT_auto_translated_physmap))
  34. __xenmem_reservation_va_mapping_update(count, pages, frames);
  35. #endif
  36. }
  37. static inline void xenmem_reservation_va_mapping_reset(unsigned long count,
  38. struct page **pages)
  39. {
  40. #ifdef CONFIG_XEN_HAVE_PVMMU
  41. if (!xen_feature(XENFEAT_auto_translated_physmap))
  42. __xenmem_reservation_va_mapping_reset(count, pages);
  43. #endif
  44. }
  45. int xenmem_reservation_increase(int count, xen_pfn_t *frames);
  46. int xenmem_reservation_decrease(int count, xen_pfn_t *frames);
  47. #endif