18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/******************************************************************************
38c2ecf20Sopenharmony_ci * Xen balloon functionality
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci#ifndef _XEN_BALLOON_H
68c2ecf20Sopenharmony_ci#define _XEN_BALLOON_H
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#define RETRY_UNLIMITED	0
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_cistruct balloon_stats {
118c2ecf20Sopenharmony_ci	/* We aim for 'current allocation' == 'target allocation'. */
128c2ecf20Sopenharmony_ci	unsigned long current_pages;
138c2ecf20Sopenharmony_ci	unsigned long target_pages;
148c2ecf20Sopenharmony_ci	unsigned long target_unpopulated;
158c2ecf20Sopenharmony_ci	/* Number of pages in high- and low-memory balloons. */
168c2ecf20Sopenharmony_ci	unsigned long balloon_low;
178c2ecf20Sopenharmony_ci	unsigned long balloon_high;
188c2ecf20Sopenharmony_ci	unsigned long total_pages;
198c2ecf20Sopenharmony_ci	unsigned long schedule_delay;
208c2ecf20Sopenharmony_ci	unsigned long max_schedule_delay;
218c2ecf20Sopenharmony_ci	unsigned long retry_count;
228c2ecf20Sopenharmony_ci	unsigned long max_retry_count;
238c2ecf20Sopenharmony_ci};
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciextern struct balloon_stats balloon_stats;
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_civoid balloon_set_new_target(unsigned long target);
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ciint alloc_xenballooned_pages(int nr_pages, struct page **pages);
308c2ecf20Sopenharmony_civoid free_xenballooned_pages(int nr_pages, struct page **pages);
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#ifdef CONFIG_XEN_BALLOON
338c2ecf20Sopenharmony_civoid xen_balloon_init(void);
348c2ecf20Sopenharmony_ci#else
358c2ecf20Sopenharmony_cistatic inline void xen_balloon_init(void)
368c2ecf20Sopenharmony_ci{
378c2ecf20Sopenharmony_ci}
388c2ecf20Sopenharmony_ci#endif
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#endif	/* _XEN_BALLOON_H */
41