1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  */
4 
5 #include "bochs.h"
6 
7 /* ---------------------------------------------------------------------- */
8 
bochs_mm_init(struct bochs_device * bochs)9 int bochs_mm_init(struct bochs_device *bochs)
10 {
11 	struct drm_vram_mm *vmm;
12 
13 	vmm = drm_vram_helper_alloc_mm(bochs->dev, bochs->fb_base,
14 				       bochs->fb_size,
15 				       &drm_gem_vram_mm_funcs);
16 	return PTR_ERR_OR_ZERO(vmm);
17 }
18 
bochs_mm_fini(struct bochs_device * bochs)19 void bochs_mm_fini(struct bochs_device *bochs)
20 {
21 	if (!bochs->dev->vram_mm)
22 		return;
23 
24 	drm_vram_helper_release_mm(bochs->dev);
25 }
26