Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/include/linux drm: Allow multiple conc...
details: https://anonhg.NetBSD.org/src/rev/a8bad0b14272
branches: trunk
changeset: 1028912:a8bad0b14272
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 12:27:49 2021 +0000
description:
drm: Allow multiple concurrent io_mapping_map_wc on the same space.
(This should maybe check that there aren't overlapping maps of the
same parts of the space.)
diffstat:
sys/external/bsd/drm2/dist/drm/i915/i915_gem.c | 6 ++--
sys/external/bsd/drm2/dist/drm/i915/i915_vma.c | 10 +++++---
sys/external/bsd/drm2/include/linux/io-mapping.h | 25 ++++-------------------
3 files changed, 14 insertions(+), 27 deletions(-)
diffs (173 lines):
diff -r 8660a4881a72 -r a8bad0b14272 sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c Sun Dec 19 12:27:39 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c Sun Dec 19 12:27:49 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_gem.c,v 1.73 2021/12/19 12:27:09 riastradh Exp $ */
+/* $NetBSD: i915_gem.c,v 1.74 2021/12/19 12:27:49 riastradh Exp $ */
/*
* Copyright © 2008-2015 Intel Corporation
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_gem.c,v 1.73 2021/12/19 12:27:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem.c,v 1.74 2021/12/19 12:27:49 riastradh Exp $");
#ifdef __NetBSD__
#include <drm/bus_dma_hacks.h>
@@ -405,7 +405,7 @@
(void __force *)vaddr + offset,
length);
#ifdef __NetBSD__
- io_mapping_unmap(mapping, vaddr);
+ io_mapping_unmap(mapping, vaddr, PAGE_SIZE);
#else
io_mapping_unmap(vaddr);
#endif
diff -r 8660a4881a72 -r a8bad0b14272 sys/external/bsd/drm2/dist/drm/i915/i915_vma.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_vma.c Sun Dec 19 12:27:39 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_vma.c Sun Dec 19 12:27:49 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_vma.c,v 1.11 2021/12/19 12:12:15 riastradh Exp $ */
+/* $NetBSD: i915_vma.c,v 1.12 2021/12/19 12:27:49 riastradh Exp $ */
/*
* Copyright © 2016 Intel Corporation
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_vma.c,v 1.11 2021/12/19 12:12:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_vma.c,v 1.12 2021/12/19 12:27:49 riastradh Exp $");
#include <linux/sched/mm.h>
#include <drm/drm_gem.h>
@@ -513,7 +513,8 @@
if (unlikely(cmpxchg(&vma->iomap, NULL, ptr))) {
#ifdef __NetBSD__
- io_mapping_unmap(&i915_vm_to_ggtt(vma->vm)->iomap, ptr);
+ io_mapping_unmap(&i915_vm_to_ggtt(vma->vm)->iomap, ptr,
+ vma->node.size);
#else
io_mapping_unmap(ptr);
#endif
@@ -1181,7 +1182,8 @@
return;
#ifdef __NetBSD__
- io_mapping_unmap(&i915_vm_to_ggtt(vma->vm)->iomap, vma->iomap);
+ io_mapping_unmap(&i915_vm_to_ggtt(vma->vm)->iomap, vma->iomap,
+ vma->node.size);
#else
io_mapping_unmap(vma->iomap);
#endif
diff -r 8660a4881a72 -r a8bad0b14272 sys/external/bsd/drm2/include/linux/io-mapping.h
--- a/sys/external/bsd/drm2/include/linux/io-mapping.h Sun Dec 19 12:27:39 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/io-mapping.h Sun Dec 19 12:27:49 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: io-mapping.h,v 1.11 2021/12/19 12:04:51 riastradh Exp $ */
+/* $NetBSD: io-mapping.h,v 1.12 2021/12/19 12:27:49 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -45,7 +45,6 @@
bus_addr_t base; /* Linux API */
bus_size_t size; /* Linux API */
vaddr_t diom_va;
- bus_size_t diom_mapsize;
bool diom_atomic;
};
@@ -78,7 +77,6 @@
mapping->diom_bst = bst;
mapping->base = addr;
mapping->size = size;
- mapping->diom_mapsize = 0;
mapping->diom_atomic = false;
/* Allocate kva for one page. */
@@ -93,7 +91,6 @@
io_mapping_fini(struct io_mapping *mapping)
{
- KASSERT(mapping->diom_mapsize == 0);
KASSERT(!mapping->diom_atomic);
uvm_km_free(kernel_map, mapping->diom_va, PAGE_SIZE, UVM_KMF_VAONLY);
@@ -135,11 +132,10 @@
KASSERT(PAGE_SIZE <= mapping->size);
KASSERT(offset <= (mapping->size - PAGE_SIZE));
KASSERT(__type_fit(off_t, offset));
- KASSERT(mapping->diom_mapsize == 0);
- KASSERT(!mapping->diom_atomic);
va = uvm_km_alloc(kernel_map, size, PAGE_SIZE,
UVM_KMF_VAONLY|UVM_KMF_WAITVA);
+ KASSERT(va != mapping->diom_va);
for (pg = 0; pg < npgs; pg++) {
cookie = bus_space_mmap(mapping->diom_bst, mapping->base,
offset + pg*PAGE_SIZE,
@@ -152,27 +148,20 @@
}
pmap_update(pmap_kernel());
- mapping->diom_mapsize = size;
- mapping->diom_atomic = false;
return (void *)va;
}
static inline void
-io_mapping_unmap(struct io_mapping *mapping, void *ptr __diagused)
+io_mapping_unmap(struct io_mapping *mapping, void *ptr, bus_size_t size)
{
vaddr_t va = (vaddr_t)ptr;
- KASSERT(mapping->diom_mapsize);
- KASSERT(!mapping->diom_atomic);
KASSERT(mapping->diom_va != va);
- pmap_kremove(va, mapping->diom_mapsize);
+ pmap_kremove(va, size);
pmap_update(pmap_kernel());
- uvm_km_free(kernel_map, va, mapping->diom_mapsize, UVM_KMF_VAONLY);
-
- mapping->diom_mapsize = 0;
- mapping->diom_atomic = false;
+ uvm_km_free(kernel_map, va, size, UVM_KMF_VAONLY);
}
static inline void *
@@ -184,7 +173,6 @@
KASSERT(PAGE_SIZE <= mapping->size);
KASSERT(offset <= (mapping->size - PAGE_SIZE));
KASSERT(__type_fit(off_t, offset));
- KASSERT(mapping->diom_mapsize == 0);
KASSERT(!mapping->diom_atomic);
cookie = bus_space_mmap(mapping->diom_bst, mapping->base, offset,
@@ -196,7 +184,6 @@
PROT_READ|PROT_WRITE, pmap_mmap_flags(cookie));
pmap_update(pmap_kernel());
- mapping->diom_mapsize = PAGE_SIZE;
mapping->diom_atomic = true;
return (void *)mapping->diom_va;
}
@@ -205,14 +192,12 @@
io_mapping_unmap_atomic(struct io_mapping *mapping, void *ptr __diagused)
{
- KASSERT(mapping->diom_mapsize);
KASSERT(mapping->diom_atomic);
KASSERT(mapping->diom_va == (vaddr_t)ptr);
pmap_kremove(mapping->diom_va, PAGE_SIZE);
pmap_update(pmap_kernel());
- mapping->diom_mapsize = 0;
mapping->diom_atomic = false;
}
Home |
Main Index |
Thread Index |
Old Index