32 #define VMW_PPN_SIZE sizeof(unsigned long)
41 uint32_t define_size =
sizeof(define_cmd) + 4;
51 define_cmd.
gmrId = gmr_id;
54 remap_cmd.
gmrId = gmr_id;
61 memcpy(cmd, &define_cmd,
sizeof(define_cmd));
62 cmd +=
sizeof(define_cmd) /
sizeof(
uint32);
65 memcpy(cmd, &remap_cmd,
sizeof(remap_cmd));
66 cmd +=
sizeof(remap_cmd) /
sizeof(
uint32);
86 uint32_t define_size =
sizeof(define_cmd) + 4;
91 DRM_ERROR(
"GMR2 unbind failed.\n");
94 define_cmd.
gmrId = gmr_id;
98 memcpy(cmd, &define_cmd,
sizeof(define_cmd));
108 static int vmw_gmr_build_descriptors(
struct list_head *desc_pages,
115 unsigned int desc_per_page;
116 unsigned long prev_pfn;
123 while (
likely(num_pages != 0)) {
143 desc_virtual = page_virtual - 1;
146 while (
likely(num_pages != 0)) {
149 if (pfn != prev_pfn + 1) {
151 if (desc_virtual - page_virtual ==
177 list_del_init(&page->
lru);
183 static inline void vmw_gmr_free_descriptors(
struct list_head *desc_pages)
188 list_del_init(&page->
lru);
193 static void vmw_gmr_fire_descriptors(
struct vmw_private *dev_priv,
194 int gmr_id,
struct list_head *desc_pages)
198 if (
unlikely(list_empty(desc_pages)))
219 static unsigned long vmw_gmr_count_descriptors(
struct page *pages[],
220 unsigned long num_pages)
222 unsigned long prev_pfn = ~(0
UL);
226 while (num_pages--) {
228 if (prev_pfn + 1 != pfn)
237 struct page *pages[],
238 unsigned long num_pages,
245 return vmw_gmr2_bind(dev_priv, pages, num_pages, gmr_id);
250 if (vmw_gmr_count_descriptors(pages, num_pages) >
254 INIT_LIST_HEAD(&desc_pages);
256 ret = vmw_gmr_build_descriptors(&desc_pages, pages, num_pages);
260 vmw_gmr_fire_descriptors(dev_priv, gmr_id, &desc_pages);
261 vmw_gmr_free_descriptors(&desc_pages);
270 vmw_gmr2_unbind(dev_priv, gmr_id);