enable io_mapping paths for lmem
authorjsg <jsg@openbsd.org>
Wed, 20 Mar 2024 02:56:49 +0000 (02:56 +0000)
committerjsg <jsg@openbsd.org>
Wed, 20 Mar 2024 02:56:49 +0000 (02:56 +0000)
sys/dev/pci/drm/i915/gem/i915_gem_lmem.c
sys/dev/pci/drm/i915/gem/i915_gem_object.c
sys/dev/pci/drm/ttm/ttm_resource.c

index 1181249..3198b64 100644 (file)
@@ -15,9 +15,6 @@ i915_gem_object_lmem_io_map(struct drm_i915_gem_object *obj,
                            unsigned long n,
                            unsigned long size)
 {
-       STUB();
-       return NULL;
-#ifdef notyet
        resource_size_t offset;
 
        GEM_BUG_ON(!i915_gem_object_is_contiguous(obj));
@@ -26,7 +23,6 @@ i915_gem_object_lmem_io_map(struct drm_i915_gem_object *obj,
        offset -= obj->mm.region->region.start;
 
        return io_mapping_map_wc(&obj->mm.region->iomap, offset, size);
-#endif
 }
 
 /**
index 3e8e604..5453c51 100644 (file)
@@ -521,8 +521,6 @@ i915_gem_object_read_from_page_kmap(struct drm_i915_gem_object *obj, u64 offset,
 static void
 i915_gem_object_read_from_page_iomap(struct drm_i915_gem_object *obj, u64 offset, void *dst, int size)
 {
-       STUB();
-#ifdef notyet
        pgoff_t idx = offset >> PAGE_SHIFT;
        dma_addr_t dma = i915_gem_object_get_dma_address(obj, idx);
        void __iomem *src_map;
@@ -537,7 +535,6 @@ i915_gem_object_read_from_page_iomap(struct drm_i915_gem_object *obj, u64 offset
                memcpy_fromio(dst, src_ptr, size);
 
        io_mapping_unmap(src_map);
-#endif
 }
 
 static bool object_has_mappable_iomem(struct drm_i915_gem_object *obj)
index 521f52d..c651273 100644 (file)
@@ -564,32 +564,16 @@ retry:
                goto retry;
        }
 
-#ifdef __linux__
        addr = io_mapping_map_local_wc(iter_io->iomap, iter_io->cache.offs +
                                       (((resource_size_t)i - iter_io->cache.i)
                                        << PAGE_SHIFT));
-#else
-       if (bus_space_map(bst, iter_io->cache.offs +
-           (((resource_size_t)i - iter_io->cache.i) << PAGE_SHIFT),
-           PAGE_SIZE, BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE,
-           &dmap->bsh)) {
-               printf("%s bus_space_map failed\n", __func__);
-               addr = 0;
-       } else {
-               addr = bus_space_vaddr(bst, dmap->bsh);
-       }
-#endif
        iosys_map_set_vaddr_iomem(dmap, addr);
 }
 
 static void ttm_kmap_iter_iomap_unmap_local(struct ttm_kmap_iter *iter,
                                            struct iosys_map *map, bus_space_tag_t bst)
 {
-#ifdef notyet
        io_mapping_unmap_local(map->vaddr_iomem);
-#else
-       bus_space_unmap(bst, map->bsh, PAGE_SIZE);
-#endif
 }
 
 static const struct ttm_kmap_iter_ops ttm_kmap_iter_io_ops = {