1 // SPDX-License-Identifier: MIT
3 * Copyright (C) 2013-2017 Oracle Corporation
4 * This file is based on ast_ttm.c
5 * Copyright 2012 Red Hat Inc.
6 * Authors: Dave Airlie <airlied@redhat.com>
7 * Michael Thayer <michael.thayer@oracle.com>
10 #include <drm/drm_file.h>
13 int vbox_mm_init(struct vbox_private
*vbox
)
15 struct drm_vram_mm
*vmm
;
17 struct drm_device
*dev
= &vbox
->ddev
;
19 vmm
= drm_vram_helper_alloc_mm(dev
, pci_resource_start(dev
->pdev
, 0),
20 vbox
->available_vram_size
);
23 DRM_ERROR("Error initializing VRAM MM; %d\n", ret
);
27 vbox
->fb_mtrr
= arch_phys_wc_add(pci_resource_start(dev
->pdev
, 0),
28 pci_resource_len(dev
->pdev
, 0));
32 void vbox_mm_fini(struct vbox_private
*vbox
)
34 arch_phys_wc_del(vbox
->fb_mtrr
);
35 drm_vram_helper_release_mm(&vbox
->ddev
);