History log of /openbsd-current/sys/dev/pci/drm/ttm/ttm_bo_util.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.35 04-Apr-2024 jsg

drm/ttm: Make sure the mapped tt pages are decrypted when needed

From Zack Rusin
de125efb3bae7720d10364a9ab6785466e4e2461 in linux-6.6.y/6.6.24
71ce046327cfd3aef3f93d1c44e091395eb03f8f in mainline linux


Revision tags: OPENBSD_7_5_BASE
# 1.34 16-Jan-2024 jsg

update drm to linux 6.6.12

Thanks to the OpenBSD Foundation for sponsoring this work.


Revision tags: OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.33 01-Jan-2023 jsg

update drm to linux 6.1.2

new hardware support includes

AMD
Raphael, Ryzen 7000 desktop, gfx1036/GC 10.3.6
Mendocino, Ryzen & Athlon 7020 Series mobile APU, gfx1037/GC 10.3.7
Navi 31, gfx1100 dGPU, GC 11.0.0, Radeon RX 7900 XT/XTX
gfx1101 dGPU
gfx1102 dGPU
gfx1103 APU

Thanks to the OpenBSD Foundation for sponsoring this work.


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.32 14-Jan-2022 jsg

update drm to linux 5.15.14

new hardware support includes

Intel
ehl/Elkhart Lake (embedded)
jsl/Jasper Lake (atom)
rkl/Rocket Lake (desktop)

AMD
van gogh APU (gfx1033)
yellow carp / rembrandt APU (gfx1035?)
Ryzen 6000 APU
navy flounder / navi 22 (gfx1031)
RX 6700, RX 6700 XT, RX 6700M, RX 6800M, RX 6850M XT
dimgrey cavefish / navi 23 (gfx1032)
Pro W6600, Pro W6600M, RX 6600, RX 6600 XT, RX 6600M,
RX 6600S, RX 6650M, RX 6650M XT, RX 6700S, RX 6800S
beige goby / navi 24 (gfx1034)
RX 6500 XT, RX 6400, RX 6500M, RX 6300M

Thanks to the OpenBSD Foundation for sponsoring this work
niklas@ for helping with ttm and amdgpu and patrick@ for adapting
rockchip drm.


# 1.31 04-Nov-2021 jsg

revert rev 1.30 of ttm_bo_util.c

Laurence Tratt reported firefox would hard lock a machine
with polaris12 with the ttm change from linux 5.10.77.
robert@ also hit the same problem.


# 1.30 03-Nov-2021 jsg

drm/ttm: fix memleak in ttm_transfered_destroy

From Christian Koenig
c21b4002214c1c7e7b627b9b53375612f7aab6db in linux 5.10.y/5.10.77
0db55f9a1bafbe3dac750ea669de9134922389b5 in mainline linux


Revision tags: OPENBSD_7_0_BASE
# 1.29 28-Jul-2021 kettenis

Switch to an MI implementation of kmap_atomic() and implement
kmap_atomic_prot(). Use this to unstub ttm_copy_io_ttm_page()
and ttm_copy_ttm_io_page(). This fixes suspend/resume of machines
with certain radeondrm(4) hardware.

Based on a diff from jsg@. Tested by Edd Barrett and Alf Schlichting.
ok jsg@


# 1.28 07-Jul-2021 jsg

update drm to linux 5.10.47

hardware support changes include
inteldrm: better support for tiger lake
amdgpu: support for navi12, navi21 "sienna_cichlid", arcturus
amdgpu: support for cezanne "green sardine" ryzen 5000 apu

Thanks to the OpenBSD Foundation for sponsoring this work,
patrick@ for helping adapt rockchip drm, kettenis@ and mpi@
for uvm discussions and various testers.


# 1.27 26-Jun-2021 matthieu

Revert last change, which is under an #ifdef __linux__ block so no used.

noticed by jsg@


# 1.26 25-Jun-2021 matthieu

basic radeondrm / X support for riscv64. Ok kettenis@

- add wscons devices
- build radeondrm and add MD uvm bits to support it.


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.25 14-Jun-2020 jsg

rename our kunmap() to kunmap_va()

In linux kunmap() has a page struct * argument our kunmap() has a void *
argument which results in uncoverted uses building but doing the wrong
thing. Renaming will catch any codepaths that need to be changed at
compile time.


# 1.24 08-Jun-2020 jsg

update drm to linux 5.7

adds kernel support for
amdgpu: vega20, raven2, renoir, navi10, navi14
inteldrm: icelake, tigerlake

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping, patrick@ for helping adapt rockchip drm and many developers for
testing.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.23 19-Aug-2019 jsg

define CONFIG_X86* in autoconf.h as needed and reduce diff to linux
ok kettenis@


# 1.22 14-Apr-2019 jsg

Update shared drm code, inteldrm(4) and radeondrm(4) from linux 4.4 to
linux 4.19.34.

Adds support for more Intel hardware:
Broxton/Apollo Lake (was is_preliminary in 4.4)
Amber Lake (another Kaby Lake refresh)
Gemini Lake
Coffee Lake
Whiskey Lake
Cannon Lake (though no hardware with Intel graphics ever shipped)
Ice Lake (alpha support, hardware not released)

This does not add support for new radeon hardware on the AMD side as
newer radeons have a different kernel driver (amdgpu).

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping and a bunch of other developers for testing.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.21 20-Aug-2018 kettenis

Add arm64 support. On ARM write-combining translates into the normal uncached
memory attribute and uncached translates into device-nGnRnE memory. This
complicates the mapping onto PMAP_WC, PMAP_NOCACHE and PMAP_DEVICE a bit
since the requirements of the drm(4) subsystem don't quite match the natural
definitions for these.

ok jsg@, mpi@, visa@


# 1.20 20-Aug-2018 jsg

Cached tests moved from callers into ttm_io_prot() with linux 3.18
which was partly missed when the 4.4 ttm changes went in.
Prompted by a patch from kettenis@


# 1.19 25-Apr-2018 jsg

update ttm and radeondrm(4) to Linux 4.4.129

Compared to the previous Linux 3.8 based port this adds support for
KAVERI/KABINI/MULLINS APUs and OLAND/BONAIRE/HAINAN/HAWAII GPUs.

Thanks to the OpenBSD Foundation for sponsoring this work.


# 1.18 20-Apr-2018 deraadt

oops, snapshot tests not ready yet


# 1.17 20-Apr-2018 deraadt

sync


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.16 04-Jun-2017 kettenis

Switch the TTM code over to the generic DRM VMA manager.

ok jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 27-Sep-2015 jsg

Switch remaining users of the FreeBSD refcount apis back to the original
linux kref/kobject use.

ok kettenis@


Revision tags: OPENBSD_5_8_BASE
# 1.14 12-Apr-2015 jsg

Switch back to ioread32 and iowrite32 for cases where bus_space_vaddr is
used instead of bus_space_read/bus_space_write.


# 1.13 12-Apr-2015 jsg

make wait_queue_head a struct with a mutex
better matches linux behaviour


# 1.12 08-Apr-2015 jsg

change back to memcpy_toio/memcpy_fromio/memset_io


# 1.11 08-Apr-2015 jsg

ttm has it's own version of kmap/kunmap that uses
kernel_map/uvm_km_valloc and i915 has a version that uses
phys_map/uvm_km_valloc_wait as calling code assumes kmap would
sleep if no memory is available.

Move these and ttm's vmap/vunmap into the linux compat files
and make them all use phys_map/uvm_km_valloc_wait.

looks good kettenis@


# 1.10 06-Apr-2015 jsg

move some inline linux compat into the dedicated files


Revision tags: OPENBSD_5_7_BASE
# 1.9 12-Feb-2015 jsg

Add and use macros for linux memory barriers. Fix the call in
i915_gem_object_flush_fence() to be mb() not wmb() while here.


# 1.8 10-Feb-2015 jsg

switch most mtx_* calls back to linux spinlocks


# 1.7 10-Feb-2015 jsg

switch most rwlock calls back to their linux equivalents


# 1.6 16-Nov-2014 deraadt

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.5 10-Feb-2014 jsg

drm/ttm: Fix ttm_bo_move_memcpy

From Thomas Hellstrom
1fe70122dd9b926e84b14d1603202ae2ef2c5edd in ubuntu 3.8
da95c788ef0c645378ffccb7060a0df1a33aee38 in mainline linux


# 1.4 10-Feb-2014 jsg

drm/ttm: Handle in-memory region copies

From Jakob Bornecrantz
f8f0599d88fb76646bdd8b735dc2574ad80c625d in ubuntu 3.8
9a0599ddeae012a771bba5e23393fc52d8a59d89 in mainline linux


# 1.3 09-Feb-2014 jsg

use linux style memory allocations in ttm


# 1.2 08-Dec-2013 jsg

add static back to the ttm functions
ok kettenis@


# 1.1 12-Aug-2013 jsg

Add a port of the TTM and Radeon DRM code from Linux 3.8.13.
Includes kernel modesetting, framebuffer console and support
for newer hardware.

Firmware needs to be present for acceleration and in some cases
modesetting to work. It can be installed via fw_update
or manually via pkg_add.

With lots of help from kettenis@ some macppc bits from mpi@
and some ttm refcount/queue bits from FreeBSD.

Thanks to M:Tier and the OpenBSD Foundation for sponsoring this work.


# 1.34 16-Jan-2024 jsg

update drm to linux 6.6.12

Thanks to the OpenBSD Foundation for sponsoring this work.


Revision tags: OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.33 01-Jan-2023 jsg

update drm to linux 6.1.2

new hardware support includes

AMD
Raphael, Ryzen 7000 desktop, gfx1036/GC 10.3.6
Mendocino, Ryzen & Athlon 7020 Series mobile APU, gfx1037/GC 10.3.7
Navi 31, gfx1100 dGPU, GC 11.0.0, Radeon RX 7900 XT/XTX
gfx1101 dGPU
gfx1102 dGPU
gfx1103 APU

Thanks to the OpenBSD Foundation for sponsoring this work.


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.32 14-Jan-2022 jsg

update drm to linux 5.15.14

new hardware support includes

Intel
ehl/Elkhart Lake (embedded)
jsl/Jasper Lake (atom)
rkl/Rocket Lake (desktop)

AMD
van gogh APU (gfx1033)
yellow carp / rembrandt APU (gfx1035?)
Ryzen 6000 APU
navy flounder / navi 22 (gfx1031)
RX 6700, RX 6700 XT, RX 6700M, RX 6800M, RX 6850M XT
dimgrey cavefish / navi 23 (gfx1032)
Pro W6600, Pro W6600M, RX 6600, RX 6600 XT, RX 6600M,
RX 6600S, RX 6650M, RX 6650M XT, RX 6700S, RX 6800S
beige goby / navi 24 (gfx1034)
RX 6500 XT, RX 6400, RX 6500M, RX 6300M

Thanks to the OpenBSD Foundation for sponsoring this work
niklas@ for helping with ttm and amdgpu and patrick@ for adapting
rockchip drm.


# 1.31 04-Nov-2021 jsg

revert rev 1.30 of ttm_bo_util.c

Laurence Tratt reported firefox would hard lock a machine
with polaris12 with the ttm change from linux 5.10.77.
robert@ also hit the same problem.


# 1.30 03-Nov-2021 jsg

drm/ttm: fix memleak in ttm_transfered_destroy

From Christian Koenig
c21b4002214c1c7e7b627b9b53375612f7aab6db in linux 5.10.y/5.10.77
0db55f9a1bafbe3dac750ea669de9134922389b5 in mainline linux


Revision tags: OPENBSD_7_0_BASE
# 1.29 28-Jul-2021 kettenis

Switch to an MI implementation of kmap_atomic() and implement
kmap_atomic_prot(). Use this to unstub ttm_copy_io_ttm_page()
and ttm_copy_ttm_io_page(). This fixes suspend/resume of machines
with certain radeondrm(4) hardware.

Based on a diff from jsg@. Tested by Edd Barrett and Alf Schlichting.
ok jsg@


# 1.28 07-Jul-2021 jsg

update drm to linux 5.10.47

hardware support changes include
inteldrm: better support for tiger lake
amdgpu: support for navi12, navi21 "sienna_cichlid", arcturus
amdgpu: support for cezanne "green sardine" ryzen 5000 apu

Thanks to the OpenBSD Foundation for sponsoring this work,
patrick@ for helping adapt rockchip drm, kettenis@ and mpi@
for uvm discussions and various testers.


# 1.27 26-Jun-2021 matthieu

Revert last change, which is under an #ifdef __linux__ block so no used.

noticed by jsg@


# 1.26 25-Jun-2021 matthieu

basic radeondrm / X support for riscv64. Ok kettenis@

- add wscons devices
- build radeondrm and add MD uvm bits to support it.


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.25 14-Jun-2020 jsg

rename our kunmap() to kunmap_va()

In linux kunmap() has a page struct * argument our kunmap() has a void *
argument which results in uncoverted uses building but doing the wrong
thing. Renaming will catch any codepaths that need to be changed at
compile time.


# 1.24 08-Jun-2020 jsg

update drm to linux 5.7

adds kernel support for
amdgpu: vega20, raven2, renoir, navi10, navi14
inteldrm: icelake, tigerlake

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping, patrick@ for helping adapt rockchip drm and many developers for
testing.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.23 19-Aug-2019 jsg

define CONFIG_X86* in autoconf.h as needed and reduce diff to linux
ok kettenis@


# 1.22 14-Apr-2019 jsg

Update shared drm code, inteldrm(4) and radeondrm(4) from linux 4.4 to
linux 4.19.34.

Adds support for more Intel hardware:
Broxton/Apollo Lake (was is_preliminary in 4.4)
Amber Lake (another Kaby Lake refresh)
Gemini Lake
Coffee Lake
Whiskey Lake
Cannon Lake (though no hardware with Intel graphics ever shipped)
Ice Lake (alpha support, hardware not released)

This does not add support for new radeon hardware on the AMD side as
newer radeons have a different kernel driver (amdgpu).

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping and a bunch of other developers for testing.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.21 20-Aug-2018 kettenis

Add arm64 support. On ARM write-combining translates into the normal uncached
memory attribute and uncached translates into device-nGnRnE memory. This
complicates the mapping onto PMAP_WC, PMAP_NOCACHE and PMAP_DEVICE a bit
since the requirements of the drm(4) subsystem don't quite match the natural
definitions for these.

ok jsg@, mpi@, visa@


# 1.20 20-Aug-2018 jsg

Cached tests moved from callers into ttm_io_prot() with linux 3.18
which was partly missed when the 4.4 ttm changes went in.
Prompted by a patch from kettenis@


# 1.19 25-Apr-2018 jsg

update ttm and radeondrm(4) to Linux 4.4.129

Compared to the previous Linux 3.8 based port this adds support for
KAVERI/KABINI/MULLINS APUs and OLAND/BONAIRE/HAINAN/HAWAII GPUs.

Thanks to the OpenBSD Foundation for sponsoring this work.


# 1.18 20-Apr-2018 deraadt

oops, snapshot tests not ready yet


# 1.17 20-Apr-2018 deraadt

sync


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.16 04-Jun-2017 kettenis

Switch the TTM code over to the generic DRM VMA manager.

ok jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 27-Sep-2015 jsg

Switch remaining users of the FreeBSD refcount apis back to the original
linux kref/kobject use.

ok kettenis@


Revision tags: OPENBSD_5_8_BASE
# 1.14 12-Apr-2015 jsg

Switch back to ioread32 and iowrite32 for cases where bus_space_vaddr is
used instead of bus_space_read/bus_space_write.


# 1.13 12-Apr-2015 jsg

make wait_queue_head a struct with a mutex
better matches linux behaviour


# 1.12 08-Apr-2015 jsg

change back to memcpy_toio/memcpy_fromio/memset_io


# 1.11 08-Apr-2015 jsg

ttm has it's own version of kmap/kunmap that uses
kernel_map/uvm_km_valloc and i915 has a version that uses
phys_map/uvm_km_valloc_wait as calling code assumes kmap would
sleep if no memory is available.

Move these and ttm's vmap/vunmap into the linux compat files
and make them all use phys_map/uvm_km_valloc_wait.

looks good kettenis@


# 1.10 06-Apr-2015 jsg

move some inline linux compat into the dedicated files


Revision tags: OPENBSD_5_7_BASE
# 1.9 12-Feb-2015 jsg

Add and use macros for linux memory barriers. Fix the call in
i915_gem_object_flush_fence() to be mb() not wmb() while here.


# 1.8 10-Feb-2015 jsg

switch most mtx_* calls back to linux spinlocks


# 1.7 10-Feb-2015 jsg

switch most rwlock calls back to their linux equivalents


# 1.6 16-Nov-2014 deraadt

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.5 10-Feb-2014 jsg

drm/ttm: Fix ttm_bo_move_memcpy

From Thomas Hellstrom
1fe70122dd9b926e84b14d1603202ae2ef2c5edd in ubuntu 3.8
da95c788ef0c645378ffccb7060a0df1a33aee38 in mainline linux


# 1.4 10-Feb-2014 jsg

drm/ttm: Handle in-memory region copies

From Jakob Bornecrantz
f8f0599d88fb76646bdd8b735dc2574ad80c625d in ubuntu 3.8
9a0599ddeae012a771bba5e23393fc52d8a59d89 in mainline linux


# 1.3 09-Feb-2014 jsg

use linux style memory allocations in ttm


# 1.2 08-Dec-2013 jsg

add static back to the ttm functions
ok kettenis@


# 1.1 12-Aug-2013 jsg

Add a port of the TTM and Radeon DRM code from Linux 3.8.13.
Includes kernel modesetting, framebuffer console and support
for newer hardware.

Firmware needs to be present for acceleration and in some cases
modesetting to work. It can be installed via fw_update
or manually via pkg_add.

With lots of help from kettenis@ some macppc bits from mpi@
and some ttm refcount/queue bits from FreeBSD.

Thanks to M:Tier and the OpenBSD Foundation for sponsoring this work.


# 1.33 01-Jan-2023 jsg

update drm to linux 6.1.2

new hardware support includes

AMD
Raphael, Ryzen 7000 desktop, gfx1036/GC 10.3.6
Mendocino, Ryzen & Athlon 7020 Series mobile APU, gfx1037/GC 10.3.7
Navi 31, gfx1100 dGPU, GC 11.0.0, Radeon RX 7900 XT/XTX
gfx1101 dGPU
gfx1102 dGPU
gfx1103 APU

Thanks to the OpenBSD Foundation for sponsoring this work.


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.32 14-Jan-2022 jsg

update drm to linux 5.15.14

new hardware support includes

Intel
ehl/Elkhart Lake (embedded)
jsl/Jasper Lake (atom)
rkl/Rocket Lake (desktop)

AMD
van gogh APU (gfx1033)
yellow carp / rembrandt APU (gfx1035?)
Ryzen 6000 APU
navy flounder / navi 22 (gfx1031)
RX 6700, RX 6700 XT, RX 6700M, RX 6800M, RX 6850M XT
dimgrey cavefish / navi 23 (gfx1032)
Pro W6600, Pro W6600M, RX 6600, RX 6600 XT, RX 6600M,
RX 6600S, RX 6650M, RX 6650M XT, RX 6700S, RX 6800S
beige goby / navi 24 (gfx1034)
RX 6500 XT, RX 6400, RX 6500M, RX 6300M

Thanks to the OpenBSD Foundation for sponsoring this work
niklas@ for helping with ttm and amdgpu and patrick@ for adapting
rockchip drm.


# 1.31 04-Nov-2021 jsg

revert rev 1.30 of ttm_bo_util.c

Laurence Tratt reported firefox would hard lock a machine
with polaris12 with the ttm change from linux 5.10.77.
robert@ also hit the same problem.


# 1.30 03-Nov-2021 jsg

drm/ttm: fix memleak in ttm_transfered_destroy

From Christian Koenig
c21b4002214c1c7e7b627b9b53375612f7aab6db in linux 5.10.y/5.10.77
0db55f9a1bafbe3dac750ea669de9134922389b5 in mainline linux


Revision tags: OPENBSD_7_0_BASE
# 1.29 28-Jul-2021 kettenis

Switch to an MI implementation of kmap_atomic() and implement
kmap_atomic_prot(). Use this to unstub ttm_copy_io_ttm_page()
and ttm_copy_ttm_io_page(). This fixes suspend/resume of machines
with certain radeondrm(4) hardware.

Based on a diff from jsg@. Tested by Edd Barrett and Alf Schlichting.
ok jsg@


# 1.28 07-Jul-2021 jsg

update drm to linux 5.10.47

hardware support changes include
inteldrm: better support for tiger lake
amdgpu: support for navi12, navi21 "sienna_cichlid", arcturus
amdgpu: support for cezanne "green sardine" ryzen 5000 apu

Thanks to the OpenBSD Foundation for sponsoring this work,
patrick@ for helping adapt rockchip drm, kettenis@ and mpi@
for uvm discussions and various testers.


# 1.27 26-Jun-2021 matthieu

Revert last change, which is under an #ifdef __linux__ block so no used.

noticed by jsg@


# 1.26 25-Jun-2021 matthieu

basic radeondrm / X support for riscv64. Ok kettenis@

- add wscons devices
- build radeondrm and add MD uvm bits to support it.


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.25 14-Jun-2020 jsg

rename our kunmap() to kunmap_va()

In linux kunmap() has a page struct * argument our kunmap() has a void *
argument which results in uncoverted uses building but doing the wrong
thing. Renaming will catch any codepaths that need to be changed at
compile time.


# 1.24 08-Jun-2020 jsg

update drm to linux 5.7

adds kernel support for
amdgpu: vega20, raven2, renoir, navi10, navi14
inteldrm: icelake, tigerlake

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping, patrick@ for helping adapt rockchip drm and many developers for
testing.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.23 19-Aug-2019 jsg

define CONFIG_X86* in autoconf.h as needed and reduce diff to linux
ok kettenis@


# 1.22 14-Apr-2019 jsg

Update shared drm code, inteldrm(4) and radeondrm(4) from linux 4.4 to
linux 4.19.34.

Adds support for more Intel hardware:
Broxton/Apollo Lake (was is_preliminary in 4.4)
Amber Lake (another Kaby Lake refresh)
Gemini Lake
Coffee Lake
Whiskey Lake
Cannon Lake (though no hardware with Intel graphics ever shipped)
Ice Lake (alpha support, hardware not released)

This does not add support for new radeon hardware on the AMD side as
newer radeons have a different kernel driver (amdgpu).

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping and a bunch of other developers for testing.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.21 20-Aug-2018 kettenis

Add arm64 support. On ARM write-combining translates into the normal uncached
memory attribute and uncached translates into device-nGnRnE memory. This
complicates the mapping onto PMAP_WC, PMAP_NOCACHE and PMAP_DEVICE a bit
since the requirements of the drm(4) subsystem don't quite match the natural
definitions for these.

ok jsg@, mpi@, visa@


# 1.20 20-Aug-2018 jsg

Cached tests moved from callers into ttm_io_prot() with linux 3.18
which was partly missed when the 4.4 ttm changes went in.
Prompted by a patch from kettenis@


# 1.19 25-Apr-2018 jsg

update ttm and radeondrm(4) to Linux 4.4.129

Compared to the previous Linux 3.8 based port this adds support for
KAVERI/KABINI/MULLINS APUs and OLAND/BONAIRE/HAINAN/HAWAII GPUs.

Thanks to the OpenBSD Foundation for sponsoring this work.


# 1.18 20-Apr-2018 deraadt

oops, snapshot tests not ready yet


# 1.17 20-Apr-2018 deraadt

sync


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.16 04-Jun-2017 kettenis

Switch the TTM code over to the generic DRM VMA manager.

ok jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 27-Sep-2015 jsg

Switch remaining users of the FreeBSD refcount apis back to the original
linux kref/kobject use.

ok kettenis@


Revision tags: OPENBSD_5_8_BASE
# 1.14 12-Apr-2015 jsg

Switch back to ioread32 and iowrite32 for cases where bus_space_vaddr is
used instead of bus_space_read/bus_space_write.


# 1.13 12-Apr-2015 jsg

make wait_queue_head a struct with a mutex
better matches linux behaviour


# 1.12 08-Apr-2015 jsg

change back to memcpy_toio/memcpy_fromio/memset_io


# 1.11 08-Apr-2015 jsg

ttm has it's own version of kmap/kunmap that uses
kernel_map/uvm_km_valloc and i915 has a version that uses
phys_map/uvm_km_valloc_wait as calling code assumes kmap would
sleep if no memory is available.

Move these and ttm's vmap/vunmap into the linux compat files
and make them all use phys_map/uvm_km_valloc_wait.

looks good kettenis@


# 1.10 06-Apr-2015 jsg

move some inline linux compat into the dedicated files


Revision tags: OPENBSD_5_7_BASE
# 1.9 12-Feb-2015 jsg

Add and use macros for linux memory barriers. Fix the call in
i915_gem_object_flush_fence() to be mb() not wmb() while here.


# 1.8 10-Feb-2015 jsg

switch most mtx_* calls back to linux spinlocks


# 1.7 10-Feb-2015 jsg

switch most rwlock calls back to their linux equivalents


# 1.6 16-Nov-2014 deraadt

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.5 10-Feb-2014 jsg

drm/ttm: Fix ttm_bo_move_memcpy

From Thomas Hellstrom
1fe70122dd9b926e84b14d1603202ae2ef2c5edd in ubuntu 3.8
da95c788ef0c645378ffccb7060a0df1a33aee38 in mainline linux


# 1.4 10-Feb-2014 jsg

drm/ttm: Handle in-memory region copies

From Jakob Bornecrantz
f8f0599d88fb76646bdd8b735dc2574ad80c625d in ubuntu 3.8
9a0599ddeae012a771bba5e23393fc52d8a59d89 in mainline linux


# 1.3 09-Feb-2014 jsg

use linux style memory allocations in ttm


# 1.2 08-Dec-2013 jsg

add static back to the ttm functions
ok kettenis@


# 1.1 12-Aug-2013 jsg

Add a port of the TTM and Radeon DRM code from Linux 3.8.13.
Includes kernel modesetting, framebuffer console and support
for newer hardware.

Firmware needs to be present for acceleration and in some cases
modesetting to work. It can be installed via fw_update
or manually via pkg_add.

With lots of help from kettenis@ some macppc bits from mpi@
and some ttm refcount/queue bits from FreeBSD.

Thanks to M:Tier and the OpenBSD Foundation for sponsoring this work.


# 1.32 14-Jan-2022 jsg

update drm to linux 5.15.14

new hardware support includes

Intel
ehl/Elkhart Lake (embedded)
jsl/Jasper Lake (atom)
rkl/Rocket Lake (desktop)

AMD
van gogh APU (gfx1033)
yellow carp / rembrandt APU (gfx1035?)
Ryzen 6000 APU
navy flounder / navi 22 (gfx1031)
RX 6700, RX 6700 XT, RX 6700M, RX 6800M, RX 6850M XT
dimgrey cavefish / navi 23 (gfx1032)
Pro W6600, Pro W6600M, RX 6600, RX 6600 XT, RX 6600M,
RX 6600S, RX 6650M, RX 6650M XT, RX 6700S, RX 6800S
beige goby / navi 24 (gfx1034)
RX 6500 XT, RX 6400, RX 6500M, RX 6300M

Thanks to the OpenBSD Foundation for sponsoring this work
niklas@ for helping with ttm and amdgpu and patrick@ for adapting
rockchip drm.


# 1.31 04-Nov-2021 jsg

revert rev 1.30 of ttm_bo_util.c

Laurence Tratt reported firefox would hard lock a machine
with polaris12 with the ttm change from linux 5.10.77.
robert@ also hit the same problem.


# 1.30 03-Nov-2021 jsg

drm/ttm: fix memleak in ttm_transfered_destroy

From Christian Koenig
c21b4002214c1c7e7b627b9b53375612f7aab6db in linux 5.10.y/5.10.77
0db55f9a1bafbe3dac750ea669de9134922389b5 in mainline linux


Revision tags: OPENBSD_7_0_BASE
# 1.29 28-Jul-2021 kettenis

Switch to an MI implementation of kmap_atomic() and implement
kmap_atomic_prot(). Use this to unstub ttm_copy_io_ttm_page()
and ttm_copy_ttm_io_page(). This fixes suspend/resume of machines
with certain radeondrm(4) hardware.

Based on a diff from jsg@. Tested by Edd Barrett and Alf Schlichting.
ok jsg@


# 1.28 07-Jul-2021 jsg

update drm to linux 5.10.47

hardware support changes include
inteldrm: better support for tiger lake
amdgpu: support for navi12, navi21 "sienna_cichlid", arcturus
amdgpu: support for cezanne "green sardine" ryzen 5000 apu

Thanks to the OpenBSD Foundation for sponsoring this work,
patrick@ for helping adapt rockchip drm, kettenis@ and mpi@
for uvm discussions and various testers.


# 1.27 26-Jun-2021 matthieu

Revert last change, which is under an #ifdef __linux__ block so no used.

noticed by jsg@


# 1.26 25-Jun-2021 matthieu

basic radeondrm / X support for riscv64. Ok kettenis@

- add wscons devices
- build radeondrm and add MD uvm bits to support it.


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.25 14-Jun-2020 jsg

rename our kunmap() to kunmap_va()

In linux kunmap() has a page struct * argument our kunmap() has a void *
argument which results in uncoverted uses building but doing the wrong
thing. Renaming will catch any codepaths that need to be changed at
compile time.


# 1.24 08-Jun-2020 jsg

update drm to linux 5.7

adds kernel support for
amdgpu: vega20, raven2, renoir, navi10, navi14
inteldrm: icelake, tigerlake

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping, patrick@ for helping adapt rockchip drm and many developers for
testing.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.23 19-Aug-2019 jsg

define CONFIG_X86* in autoconf.h as needed and reduce diff to linux
ok kettenis@


# 1.22 14-Apr-2019 jsg

Update shared drm code, inteldrm(4) and radeondrm(4) from linux 4.4 to
linux 4.19.34.

Adds support for more Intel hardware:
Broxton/Apollo Lake (was is_preliminary in 4.4)
Amber Lake (another Kaby Lake refresh)
Gemini Lake
Coffee Lake
Whiskey Lake
Cannon Lake (though no hardware with Intel graphics ever shipped)
Ice Lake (alpha support, hardware not released)

This does not add support for new radeon hardware on the AMD side as
newer radeons have a different kernel driver (amdgpu).

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping and a bunch of other developers for testing.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.21 20-Aug-2018 kettenis

Add arm64 support. On ARM write-combining translates into the normal uncached
memory attribute and uncached translates into device-nGnRnE memory. This
complicates the mapping onto PMAP_WC, PMAP_NOCACHE and PMAP_DEVICE a bit
since the requirements of the drm(4) subsystem don't quite match the natural
definitions for these.

ok jsg@, mpi@, visa@


# 1.20 20-Aug-2018 jsg

Cached tests moved from callers into ttm_io_prot() with linux 3.18
which was partly missed when the 4.4 ttm changes went in.
Prompted by a patch from kettenis@


# 1.19 25-Apr-2018 jsg

update ttm and radeondrm(4) to Linux 4.4.129

Compared to the previous Linux 3.8 based port this adds support for
KAVERI/KABINI/MULLINS APUs and OLAND/BONAIRE/HAINAN/HAWAII GPUs.

Thanks to the OpenBSD Foundation for sponsoring this work.


# 1.18 20-Apr-2018 deraadt

oops, snapshot tests not ready yet


# 1.17 20-Apr-2018 deraadt

sync


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.16 04-Jun-2017 kettenis

Switch the TTM code over to the generic DRM VMA manager.

ok jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 27-Sep-2015 jsg

Switch remaining users of the FreeBSD refcount apis back to the original
linux kref/kobject use.

ok kettenis@


Revision tags: OPENBSD_5_8_BASE
# 1.14 12-Apr-2015 jsg

Switch back to ioread32 and iowrite32 for cases where bus_space_vaddr is
used instead of bus_space_read/bus_space_write.


# 1.13 12-Apr-2015 jsg

make wait_queue_head a struct with a mutex
better matches linux behaviour


# 1.12 08-Apr-2015 jsg

change back to memcpy_toio/memcpy_fromio/memset_io


# 1.11 08-Apr-2015 jsg

ttm has it's own version of kmap/kunmap that uses
kernel_map/uvm_km_valloc and i915 has a version that uses
phys_map/uvm_km_valloc_wait as calling code assumes kmap would
sleep if no memory is available.

Move these and ttm's vmap/vunmap into the linux compat files
and make them all use phys_map/uvm_km_valloc_wait.

looks good kettenis@


# 1.10 06-Apr-2015 jsg

move some inline linux compat into the dedicated files


Revision tags: OPENBSD_5_7_BASE
# 1.9 12-Feb-2015 jsg

Add and use macros for linux memory barriers. Fix the call in
i915_gem_object_flush_fence() to be mb() not wmb() while here.


# 1.8 10-Feb-2015 jsg

switch most mtx_* calls back to linux spinlocks


# 1.7 10-Feb-2015 jsg

switch most rwlock calls back to their linux equivalents


# 1.6 16-Nov-2014 deraadt

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.5 10-Feb-2014 jsg

drm/ttm: Fix ttm_bo_move_memcpy

From Thomas Hellstrom
1fe70122dd9b926e84b14d1603202ae2ef2c5edd in ubuntu 3.8
da95c788ef0c645378ffccb7060a0df1a33aee38 in mainline linux


# 1.4 10-Feb-2014 jsg

drm/ttm: Handle in-memory region copies

From Jakob Bornecrantz
f8f0599d88fb76646bdd8b735dc2574ad80c625d in ubuntu 3.8
9a0599ddeae012a771bba5e23393fc52d8a59d89 in mainline linux


# 1.3 09-Feb-2014 jsg

use linux style memory allocations in ttm


# 1.2 08-Dec-2013 jsg

add static back to the ttm functions
ok kettenis@


# 1.1 12-Aug-2013 jsg

Add a port of the TTM and Radeon DRM code from Linux 3.8.13.
Includes kernel modesetting, framebuffer console and support
for newer hardware.

Firmware needs to be present for acceleration and in some cases
modesetting to work. It can be installed via fw_update
or manually via pkg_add.

With lots of help from kettenis@ some macppc bits from mpi@
and some ttm refcount/queue bits from FreeBSD.

Thanks to M:Tier and the OpenBSD Foundation for sponsoring this work.


# 1.31 04-Nov-2021 jsg

revert rev 1.30 of ttm_bo_util.c

Laurence Tratt reported firefox would hard lock a machine
with polaris12 with the ttm change from linux 5.10.77.
robert@ also hit the same problem.


# 1.30 03-Nov-2021 jsg

drm/ttm: fix memleak in ttm_transfered_destroy

From Christian Koenig
c21b4002214c1c7e7b627b9b53375612f7aab6db in linux 5.10.y/5.10.77
0db55f9a1bafbe3dac750ea669de9134922389b5 in mainline linux


Revision tags: OPENBSD_7_0_BASE
# 1.29 28-Jul-2021 kettenis

Switch to an MI implementation of kmap_atomic() and implement
kmap_atomic_prot(). Use this to unstub ttm_copy_io_ttm_page()
and ttm_copy_ttm_io_page(). This fixes suspend/resume of machines
with certain radeondrm(4) hardware.

Based on a diff from jsg@. Tested by Edd Barrett and Alf Schlichting.
ok jsg@


# 1.28 07-Jul-2021 jsg

update drm to linux 5.10.47

hardware support changes include
inteldrm: better support for tiger lake
amdgpu: support for navi12, navi21 "sienna_cichlid", arcturus
amdgpu: support for cezanne "green sardine" ryzen 5000 apu

Thanks to the OpenBSD Foundation for sponsoring this work,
patrick@ for helping adapt rockchip drm, kettenis@ and mpi@
for uvm discussions and various testers.


# 1.27 26-Jun-2021 matthieu

Revert last change, which is under an #ifdef __linux__ block so no used.

noticed by jsg@


# 1.26 25-Jun-2021 matthieu

basic radeondrm / X support for riscv64. Ok kettenis@

- add wscons devices
- build radeondrm and add MD uvm bits to support it.


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.25 14-Jun-2020 jsg

rename our kunmap() to kunmap_va()

In linux kunmap() has a page struct * argument our kunmap() has a void *
argument which results in uncoverted uses building but doing the wrong
thing. Renaming will catch any codepaths that need to be changed at
compile time.


# 1.24 08-Jun-2020 jsg

update drm to linux 5.7

adds kernel support for
amdgpu: vega20, raven2, renoir, navi10, navi14
inteldrm: icelake, tigerlake

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping, patrick@ for helping adapt rockchip drm and many developers for
testing.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.23 19-Aug-2019 jsg

define CONFIG_X86* in autoconf.h as needed and reduce diff to linux
ok kettenis@


# 1.22 14-Apr-2019 jsg

Update shared drm code, inteldrm(4) and radeondrm(4) from linux 4.4 to
linux 4.19.34.

Adds support for more Intel hardware:
Broxton/Apollo Lake (was is_preliminary in 4.4)
Amber Lake (another Kaby Lake refresh)
Gemini Lake
Coffee Lake
Whiskey Lake
Cannon Lake (though no hardware with Intel graphics ever shipped)
Ice Lake (alpha support, hardware not released)

This does not add support for new radeon hardware on the AMD side as
newer radeons have a different kernel driver (amdgpu).

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping and a bunch of other developers for testing.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.21 20-Aug-2018 kettenis

Add arm64 support. On ARM write-combining translates into the normal uncached
memory attribute and uncached translates into device-nGnRnE memory. This
complicates the mapping onto PMAP_WC, PMAP_NOCACHE and PMAP_DEVICE a bit
since the requirements of the drm(4) subsystem don't quite match the natural
definitions for these.

ok jsg@, mpi@, visa@


# 1.20 20-Aug-2018 jsg

Cached tests moved from callers into ttm_io_prot() with linux 3.18
which was partly missed when the 4.4 ttm changes went in.
Prompted by a patch from kettenis@


# 1.19 25-Apr-2018 jsg

update ttm and radeondrm(4) to Linux 4.4.129

Compared to the previous Linux 3.8 based port this adds support for
KAVERI/KABINI/MULLINS APUs and OLAND/BONAIRE/HAINAN/HAWAII GPUs.

Thanks to the OpenBSD Foundation for sponsoring this work.


# 1.18 20-Apr-2018 deraadt

oops, snapshot tests not ready yet


# 1.17 20-Apr-2018 deraadt

sync


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.16 04-Jun-2017 kettenis

Switch the TTM code over to the generic DRM VMA manager.

ok jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 27-Sep-2015 jsg

Switch remaining users of the FreeBSD refcount apis back to the original
linux kref/kobject use.

ok kettenis@


Revision tags: OPENBSD_5_8_BASE
# 1.14 12-Apr-2015 jsg

Switch back to ioread32 and iowrite32 for cases where bus_space_vaddr is
used instead of bus_space_read/bus_space_write.


# 1.13 12-Apr-2015 jsg

make wait_queue_head a struct with a mutex
better matches linux behaviour


# 1.12 08-Apr-2015 jsg

change back to memcpy_toio/memcpy_fromio/memset_io


# 1.11 08-Apr-2015 jsg

ttm has it's own version of kmap/kunmap that uses
kernel_map/uvm_km_valloc and i915 has a version that uses
phys_map/uvm_km_valloc_wait as calling code assumes kmap would
sleep if no memory is available.

Move these and ttm's vmap/vunmap into the linux compat files
and make them all use phys_map/uvm_km_valloc_wait.

looks good kettenis@


# 1.10 06-Apr-2015 jsg

move some inline linux compat into the dedicated files


Revision tags: OPENBSD_5_7_BASE
# 1.9 12-Feb-2015 jsg

Add and use macros for linux memory barriers. Fix the call in
i915_gem_object_flush_fence() to be mb() not wmb() while here.


# 1.8 10-Feb-2015 jsg

switch most mtx_* calls back to linux spinlocks


# 1.7 10-Feb-2015 jsg

switch most rwlock calls back to their linux equivalents


# 1.6 16-Nov-2014 deraadt

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.5 10-Feb-2014 jsg

drm/ttm: Fix ttm_bo_move_memcpy

From Thomas Hellstrom
1fe70122dd9b926e84b14d1603202ae2ef2c5edd in ubuntu 3.8
da95c788ef0c645378ffccb7060a0df1a33aee38 in mainline linux


# 1.4 10-Feb-2014 jsg

drm/ttm: Handle in-memory region copies

From Jakob Bornecrantz
f8f0599d88fb76646bdd8b735dc2574ad80c625d in ubuntu 3.8
9a0599ddeae012a771bba5e23393fc52d8a59d89 in mainline linux


# 1.3 09-Feb-2014 jsg

use linux style memory allocations in ttm


# 1.2 08-Dec-2013 jsg

add static back to the ttm functions
ok kettenis@


# 1.1 12-Aug-2013 jsg

Add a port of the TTM and Radeon DRM code from Linux 3.8.13.
Includes kernel modesetting, framebuffer console and support
for newer hardware.

Firmware needs to be present for acceleration and in some cases
modesetting to work. It can be installed via fw_update
or manually via pkg_add.

With lots of help from kettenis@ some macppc bits from mpi@
and some ttm refcount/queue bits from FreeBSD.

Thanks to M:Tier and the OpenBSD Foundation for sponsoring this work.


# 1.30 03-Nov-2021 jsg

drm/ttm: fix memleak in ttm_transfered_destroy

From Christian Koenig
c21b4002214c1c7e7b627b9b53375612f7aab6db in linux 5.10.y/5.10.77
0db55f9a1bafbe3dac750ea669de9134922389b5 in mainline linux


Revision tags: OPENBSD_7_0_BASE
# 1.29 28-Jul-2021 kettenis

Switch to an MI implementation of kmap_atomic() and implement
kmap_atomic_prot(). Use this to unstub ttm_copy_io_ttm_page()
and ttm_copy_ttm_io_page(). This fixes suspend/resume of machines
with certain radeondrm(4) hardware.

Based on a diff from jsg@. Tested by Edd Barrett and Alf Schlichting.
ok jsg@


# 1.28 07-Jul-2021 jsg

update drm to linux 5.10.47

hardware support changes include
inteldrm: better support for tiger lake
amdgpu: support for navi12, navi21 "sienna_cichlid", arcturus
amdgpu: support for cezanne "green sardine" ryzen 5000 apu

Thanks to the OpenBSD Foundation for sponsoring this work,
patrick@ for helping adapt rockchip drm, kettenis@ and mpi@
for uvm discussions and various testers.


# 1.27 26-Jun-2021 matthieu

Revert last change, which is under an #ifdef __linux__ block so no used.

noticed by jsg@


# 1.26 25-Jun-2021 matthieu

basic radeondrm / X support for riscv64. Ok kettenis@

- add wscons devices
- build radeondrm and add MD uvm bits to support it.


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.25 14-Jun-2020 jsg

rename our kunmap() to kunmap_va()

In linux kunmap() has a page struct * argument our kunmap() has a void *
argument which results in uncoverted uses building but doing the wrong
thing. Renaming will catch any codepaths that need to be changed at
compile time.


# 1.24 08-Jun-2020 jsg

update drm to linux 5.7

adds kernel support for
amdgpu: vega20, raven2, renoir, navi10, navi14
inteldrm: icelake, tigerlake

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping, patrick@ for helping adapt rockchip drm and many developers for
testing.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.23 19-Aug-2019 jsg

define CONFIG_X86* in autoconf.h as needed and reduce diff to linux
ok kettenis@


# 1.22 14-Apr-2019 jsg

Update shared drm code, inteldrm(4) and radeondrm(4) from linux 4.4 to
linux 4.19.34.

Adds support for more Intel hardware:
Broxton/Apollo Lake (was is_preliminary in 4.4)
Amber Lake (another Kaby Lake refresh)
Gemini Lake
Coffee Lake
Whiskey Lake
Cannon Lake (though no hardware with Intel graphics ever shipped)
Ice Lake (alpha support, hardware not released)

This does not add support for new radeon hardware on the AMD side as
newer radeons have a different kernel driver (amdgpu).

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping and a bunch of other developers for testing.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.21 20-Aug-2018 kettenis

Add arm64 support. On ARM write-combining translates into the normal uncached
memory attribute and uncached translates into device-nGnRnE memory. This
complicates the mapping onto PMAP_WC, PMAP_NOCACHE and PMAP_DEVICE a bit
since the requirements of the drm(4) subsystem don't quite match the natural
definitions for these.

ok jsg@, mpi@, visa@


# 1.20 20-Aug-2018 jsg

Cached tests moved from callers into ttm_io_prot() with linux 3.18
which was partly missed when the 4.4 ttm changes went in.
Prompted by a patch from kettenis@


# 1.19 25-Apr-2018 jsg

update ttm and radeondrm(4) to Linux 4.4.129

Compared to the previous Linux 3.8 based port this adds support for
KAVERI/KABINI/MULLINS APUs and OLAND/BONAIRE/HAINAN/HAWAII GPUs.

Thanks to the OpenBSD Foundation for sponsoring this work.


# 1.18 20-Apr-2018 deraadt

oops, snapshot tests not ready yet


# 1.17 20-Apr-2018 deraadt

sync


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.16 04-Jun-2017 kettenis

Switch the TTM code over to the generic DRM VMA manager.

ok jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 27-Sep-2015 jsg

Switch remaining users of the FreeBSD refcount apis back to the original
linux kref/kobject use.

ok kettenis@


Revision tags: OPENBSD_5_8_BASE
# 1.14 12-Apr-2015 jsg

Switch back to ioread32 and iowrite32 for cases where bus_space_vaddr is
used instead of bus_space_read/bus_space_write.


# 1.13 12-Apr-2015 jsg

make wait_queue_head a struct with a mutex
better matches linux behaviour


# 1.12 08-Apr-2015 jsg

change back to memcpy_toio/memcpy_fromio/memset_io


# 1.11 08-Apr-2015 jsg

ttm has it's own version of kmap/kunmap that uses
kernel_map/uvm_km_valloc and i915 has a version that uses
phys_map/uvm_km_valloc_wait as calling code assumes kmap would
sleep if no memory is available.

Move these and ttm's vmap/vunmap into the linux compat files
and make them all use phys_map/uvm_km_valloc_wait.

looks good kettenis@


# 1.10 06-Apr-2015 jsg

move some inline linux compat into the dedicated files


Revision tags: OPENBSD_5_7_BASE
# 1.9 12-Feb-2015 jsg

Add and use macros for linux memory barriers. Fix the call in
i915_gem_object_flush_fence() to be mb() not wmb() while here.


# 1.8 10-Feb-2015 jsg

switch most mtx_* calls back to linux spinlocks


# 1.7 10-Feb-2015 jsg

switch most rwlock calls back to their linux equivalents


# 1.6 16-Nov-2014 deraadt

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.5 10-Feb-2014 jsg

drm/ttm: Fix ttm_bo_move_memcpy

From Thomas Hellstrom
1fe70122dd9b926e84b14d1603202ae2ef2c5edd in ubuntu 3.8
da95c788ef0c645378ffccb7060a0df1a33aee38 in mainline linux


# 1.4 10-Feb-2014 jsg

drm/ttm: Handle in-memory region copies

From Jakob Bornecrantz
f8f0599d88fb76646bdd8b735dc2574ad80c625d in ubuntu 3.8
9a0599ddeae012a771bba5e23393fc52d8a59d89 in mainline linux


# 1.3 09-Feb-2014 jsg

use linux style memory allocations in ttm


# 1.2 08-Dec-2013 jsg

add static back to the ttm functions
ok kettenis@


# 1.1 12-Aug-2013 jsg

Add a port of the TTM and Radeon DRM code from Linux 3.8.13.
Includes kernel modesetting, framebuffer console and support
for newer hardware.

Firmware needs to be present for acceleration and in some cases
modesetting to work. It can be installed via fw_update
or manually via pkg_add.

With lots of help from kettenis@ some macppc bits from mpi@
and some ttm refcount/queue bits from FreeBSD.

Thanks to M:Tier and the OpenBSD Foundation for sponsoring this work.


# 1.29 28-Jul-2021 kettenis

Switch to an MI implementation of kmap_atomic() and implement
kmap_atomic_prot(). Use this to unstub ttm_copy_io_ttm_page()
and ttm_copy_ttm_io_page(). This fixes suspend/resume of machines
with certain radeondrm(4) hardware.

Based on a diff from jsg@. Tested by Edd Barrett and Alf Schlichting.
ok jsg@


# 1.28 07-Jul-2021 jsg

update drm to linux 5.10.47

hardware support changes include
inteldrm: better support for tiger lake
amdgpu: support for navi12, navi21 "sienna_cichlid", arcturus
amdgpu: support for cezanne "green sardine" ryzen 5000 apu

Thanks to the OpenBSD Foundation for sponsoring this work,
patrick@ for helping adapt rockchip drm, kettenis@ and mpi@
for uvm discussions and various testers.


# 1.27 26-Jun-2021 matthieu

Revert last change, which is under an #ifdef __linux__ block so no used.

noticed by jsg@


# 1.26 25-Jun-2021 matthieu

basic radeondrm / X support for riscv64. Ok kettenis@

- add wscons devices
- build radeondrm and add MD uvm bits to support it.


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.25 14-Jun-2020 jsg

rename our kunmap() to kunmap_va()

In linux kunmap() has a page struct * argument our kunmap() has a void *
argument which results in uncoverted uses building but doing the wrong
thing. Renaming will catch any codepaths that need to be changed at
compile time.


# 1.24 08-Jun-2020 jsg

update drm to linux 5.7

adds kernel support for
amdgpu: vega20, raven2, renoir, navi10, navi14
inteldrm: icelake, tigerlake

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping, patrick@ for helping adapt rockchip drm and many developers for
testing.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.23 19-Aug-2019 jsg

define CONFIG_X86* in autoconf.h as needed and reduce diff to linux
ok kettenis@


# 1.22 14-Apr-2019 jsg

Update shared drm code, inteldrm(4) and radeondrm(4) from linux 4.4 to
linux 4.19.34.

Adds support for more Intel hardware:
Broxton/Apollo Lake (was is_preliminary in 4.4)
Amber Lake (another Kaby Lake refresh)
Gemini Lake
Coffee Lake
Whiskey Lake
Cannon Lake (though no hardware with Intel graphics ever shipped)
Ice Lake (alpha support, hardware not released)

This does not add support for new radeon hardware on the AMD side as
newer radeons have a different kernel driver (amdgpu).

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping and a bunch of other developers for testing.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.21 20-Aug-2018 kettenis

Add arm64 support. On ARM write-combining translates into the normal uncached
memory attribute and uncached translates into device-nGnRnE memory. This
complicates the mapping onto PMAP_WC, PMAP_NOCACHE and PMAP_DEVICE a bit
since the requirements of the drm(4) subsystem don't quite match the natural
definitions for these.

ok jsg@, mpi@, visa@


# 1.20 20-Aug-2018 jsg

Cached tests moved from callers into ttm_io_prot() with linux 3.18
which was partly missed when the 4.4 ttm changes went in.
Prompted by a patch from kettenis@


# 1.19 25-Apr-2018 jsg

update ttm and radeondrm(4) to Linux 4.4.129

Compared to the previous Linux 3.8 based port this adds support for
KAVERI/KABINI/MULLINS APUs and OLAND/BONAIRE/HAINAN/HAWAII GPUs.

Thanks to the OpenBSD Foundation for sponsoring this work.


# 1.18 20-Apr-2018 deraadt

oops, snapshot tests not ready yet


# 1.17 20-Apr-2018 deraadt

sync


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.16 04-Jun-2017 kettenis

Switch the TTM code over to the generic DRM VMA manager.

ok jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 27-Sep-2015 jsg

Switch remaining users of the FreeBSD refcount apis back to the original
linux kref/kobject use.

ok kettenis@


Revision tags: OPENBSD_5_8_BASE
# 1.14 12-Apr-2015 jsg

Switch back to ioread32 and iowrite32 for cases where bus_space_vaddr is
used instead of bus_space_read/bus_space_write.


# 1.13 12-Apr-2015 jsg

make wait_queue_head a struct with a mutex
better matches linux behaviour


# 1.12 08-Apr-2015 jsg

change back to memcpy_toio/memcpy_fromio/memset_io


# 1.11 08-Apr-2015 jsg

ttm has it's own version of kmap/kunmap that uses
kernel_map/uvm_km_valloc and i915 has a version that uses
phys_map/uvm_km_valloc_wait as calling code assumes kmap would
sleep if no memory is available.

Move these and ttm's vmap/vunmap into the linux compat files
and make them all use phys_map/uvm_km_valloc_wait.

looks good kettenis@


# 1.10 06-Apr-2015 jsg

move some inline linux compat into the dedicated files


Revision tags: OPENBSD_5_7_BASE
# 1.9 12-Feb-2015 jsg

Add and use macros for linux memory barriers. Fix the call in
i915_gem_object_flush_fence() to be mb() not wmb() while here.


# 1.8 10-Feb-2015 jsg

switch most mtx_* calls back to linux spinlocks


# 1.7 10-Feb-2015 jsg

switch most rwlock calls back to their linux equivalents


# 1.6 16-Nov-2014 deraadt

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.5 10-Feb-2014 jsg

drm/ttm: Fix ttm_bo_move_memcpy

From Thomas Hellstrom
1fe70122dd9b926e84b14d1603202ae2ef2c5edd in ubuntu 3.8
da95c788ef0c645378ffccb7060a0df1a33aee38 in mainline linux


# 1.4 10-Feb-2014 jsg

drm/ttm: Handle in-memory region copies

From Jakob Bornecrantz
f8f0599d88fb76646bdd8b735dc2574ad80c625d in ubuntu 3.8
9a0599ddeae012a771bba5e23393fc52d8a59d89 in mainline linux


# 1.3 09-Feb-2014 jsg

use linux style memory allocations in ttm


# 1.2 08-Dec-2013 jsg

add static back to the ttm functions
ok kettenis@


# 1.1 12-Aug-2013 jsg

Add a port of the TTM and Radeon DRM code from Linux 3.8.13.
Includes kernel modesetting, framebuffer console and support
for newer hardware.

Firmware needs to be present for acceleration and in some cases
modesetting to work. It can be installed via fw_update
or manually via pkg_add.

With lots of help from kettenis@ some macppc bits from mpi@
and some ttm refcount/queue bits from FreeBSD.

Thanks to M:Tier and the OpenBSD Foundation for sponsoring this work.


# 1.28 07-Jul-2021 jsg

update drm to linux 5.10.47

hardware support changes include
inteldrm: better support for tiger lake
amdgpu: support for navi12, navi21 "sienna_cichlid", arcturus
amdgpu: support for cezanne "green sardine" ryzen 5000 apu

Thanks to the OpenBSD Foundation for sponsoring this work,
patrick@ for helping adapt rockchip drm, kettenis@ and mpi@
for uvm discussions and various testers.


# 1.27 26-Jun-2021 matthieu

Revert last change, which is under an #ifdef __linux__ block so no used.

noticed by jsg@


# 1.26 25-Jun-2021 matthieu

basic radeondrm / X support for riscv64. Ok kettenis@

- add wscons devices
- build radeondrm and add MD uvm bits to support it.


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.25 14-Jun-2020 jsg

rename our kunmap() to kunmap_va()

In linux kunmap() has a page struct * argument our kunmap() has a void *
argument which results in uncoverted uses building but doing the wrong
thing. Renaming will catch any codepaths that need to be changed at
compile time.


# 1.24 08-Jun-2020 jsg

update drm to linux 5.7

adds kernel support for
amdgpu: vega20, raven2, renoir, navi10, navi14
inteldrm: icelake, tigerlake

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping, patrick@ for helping adapt rockchip drm and many developers for
testing.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.23 19-Aug-2019 jsg

define CONFIG_X86* in autoconf.h as needed and reduce diff to linux
ok kettenis@


# 1.22 14-Apr-2019 jsg

Update shared drm code, inteldrm(4) and radeondrm(4) from linux 4.4 to
linux 4.19.34.

Adds support for more Intel hardware:
Broxton/Apollo Lake (was is_preliminary in 4.4)
Amber Lake (another Kaby Lake refresh)
Gemini Lake
Coffee Lake
Whiskey Lake
Cannon Lake (though no hardware with Intel graphics ever shipped)
Ice Lake (alpha support, hardware not released)

This does not add support for new radeon hardware on the AMD side as
newer radeons have a different kernel driver (amdgpu).

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping and a bunch of other developers for testing.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.21 20-Aug-2018 kettenis

Add arm64 support. On ARM write-combining translates into the normal uncached
memory attribute and uncached translates into device-nGnRnE memory. This
complicates the mapping onto PMAP_WC, PMAP_NOCACHE and PMAP_DEVICE a bit
since the requirements of the drm(4) subsystem don't quite match the natural
definitions for these.

ok jsg@, mpi@, visa@


# 1.20 20-Aug-2018 jsg

Cached tests moved from callers into ttm_io_prot() with linux 3.18
which was partly missed when the 4.4 ttm changes went in.
Prompted by a patch from kettenis@


# 1.19 25-Apr-2018 jsg

update ttm and radeondrm(4) to Linux 4.4.129

Compared to the previous Linux 3.8 based port this adds support for
KAVERI/KABINI/MULLINS APUs and OLAND/BONAIRE/HAINAN/HAWAII GPUs.

Thanks to the OpenBSD Foundation for sponsoring this work.


# 1.18 20-Apr-2018 deraadt

oops, snapshot tests not ready yet


# 1.17 20-Apr-2018 deraadt

sync


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.16 04-Jun-2017 kettenis

Switch the TTM code over to the generic DRM VMA manager.

ok jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 27-Sep-2015 jsg

Switch remaining users of the FreeBSD refcount apis back to the original
linux kref/kobject use.

ok kettenis@


Revision tags: OPENBSD_5_8_BASE
# 1.14 12-Apr-2015 jsg

Switch back to ioread32 and iowrite32 for cases where bus_space_vaddr is
used instead of bus_space_read/bus_space_write.


# 1.13 12-Apr-2015 jsg

make wait_queue_head a struct with a mutex
better matches linux behaviour


# 1.12 08-Apr-2015 jsg

change back to memcpy_toio/memcpy_fromio/memset_io


# 1.11 08-Apr-2015 jsg

ttm has it's own version of kmap/kunmap that uses
kernel_map/uvm_km_valloc and i915 has a version that uses
phys_map/uvm_km_valloc_wait as calling code assumes kmap would
sleep if no memory is available.

Move these and ttm's vmap/vunmap into the linux compat files
and make them all use phys_map/uvm_km_valloc_wait.

looks good kettenis@


# 1.10 06-Apr-2015 jsg

move some inline linux compat into the dedicated files


Revision tags: OPENBSD_5_7_BASE
# 1.9 12-Feb-2015 jsg

Add and use macros for linux memory barriers. Fix the call in
i915_gem_object_flush_fence() to be mb() not wmb() while here.


# 1.8 10-Feb-2015 jsg

switch most mtx_* calls back to linux spinlocks


# 1.7 10-Feb-2015 jsg

switch most rwlock calls back to their linux equivalents


# 1.6 16-Nov-2014 deraadt

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.5 10-Feb-2014 jsg

drm/ttm: Fix ttm_bo_move_memcpy

From Thomas Hellstrom
1fe70122dd9b926e84b14d1603202ae2ef2c5edd in ubuntu 3.8
da95c788ef0c645378ffccb7060a0df1a33aee38 in mainline linux


# 1.4 10-Feb-2014 jsg

drm/ttm: Handle in-memory region copies

From Jakob Bornecrantz
f8f0599d88fb76646bdd8b735dc2574ad80c625d in ubuntu 3.8
9a0599ddeae012a771bba5e23393fc52d8a59d89 in mainline linux


# 1.3 09-Feb-2014 jsg

use linux style memory allocations in ttm


# 1.2 08-Dec-2013 jsg

add static back to the ttm functions
ok kettenis@


# 1.1 12-Aug-2013 jsg

Add a port of the TTM and Radeon DRM code from Linux 3.8.13.
Includes kernel modesetting, framebuffer console and support
for newer hardware.

Firmware needs to be present for acceleration and in some cases
modesetting to work. It can be installed via fw_update
or manually via pkg_add.

With lots of help from kettenis@ some macppc bits from mpi@
and some ttm refcount/queue bits from FreeBSD.

Thanks to M:Tier and the OpenBSD Foundation for sponsoring this work.


# 1.27 26-Jun-2021 matthieu

Revert last change, which is under an #ifdef __linux__ block so no used.

noticed by jsg@


# 1.26 25-Jun-2021 matthieu

basic radeondrm / X support for riscv64. Ok kettenis@

- add wscons devices
- build radeondrm and add MD uvm bits to support it.


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.25 14-Jun-2020 jsg

rename our kunmap() to kunmap_va()

In linux kunmap() has a page struct * argument our kunmap() has a void *
argument which results in uncoverted uses building but doing the wrong
thing. Renaming will catch any codepaths that need to be changed at
compile time.


# 1.24 08-Jun-2020 jsg

update drm to linux 5.7

adds kernel support for
amdgpu: vega20, raven2, renoir, navi10, navi14
inteldrm: icelake, tigerlake

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping, patrick@ for helping adapt rockchip drm and many developers for
testing.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.23 19-Aug-2019 jsg

define CONFIG_X86* in autoconf.h as needed and reduce diff to linux
ok kettenis@


# 1.22 14-Apr-2019 jsg

Update shared drm code, inteldrm(4) and radeondrm(4) from linux 4.4 to
linux 4.19.34.

Adds support for more Intel hardware:
Broxton/Apollo Lake (was is_preliminary in 4.4)
Amber Lake (another Kaby Lake refresh)
Gemini Lake
Coffee Lake
Whiskey Lake
Cannon Lake (though no hardware with Intel graphics ever shipped)
Ice Lake (alpha support, hardware not released)

This does not add support for new radeon hardware on the AMD side as
newer radeons have a different kernel driver (amdgpu).

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping and a bunch of other developers for testing.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.21 20-Aug-2018 kettenis

Add arm64 support. On ARM write-combining translates into the normal uncached
memory attribute and uncached translates into device-nGnRnE memory. This
complicates the mapping onto PMAP_WC, PMAP_NOCACHE and PMAP_DEVICE a bit
since the requirements of the drm(4) subsystem don't quite match the natural
definitions for these.

ok jsg@, mpi@, visa@


# 1.20 20-Aug-2018 jsg

Cached tests moved from callers into ttm_io_prot() with linux 3.18
which was partly missed when the 4.4 ttm changes went in.
Prompted by a patch from kettenis@


# 1.19 25-Apr-2018 jsg

update ttm and radeondrm(4) to Linux 4.4.129

Compared to the previous Linux 3.8 based port this adds support for
KAVERI/KABINI/MULLINS APUs and OLAND/BONAIRE/HAINAN/HAWAII GPUs.

Thanks to the OpenBSD Foundation for sponsoring this work.


# 1.18 20-Apr-2018 deraadt

oops, snapshot tests not ready yet


# 1.17 20-Apr-2018 deraadt

sync


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.16 04-Jun-2017 kettenis

Switch the TTM code over to the generic DRM VMA manager.

ok jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 27-Sep-2015 jsg

Switch remaining users of the FreeBSD refcount apis back to the original
linux kref/kobject use.

ok kettenis@


Revision tags: OPENBSD_5_8_BASE
# 1.14 12-Apr-2015 jsg

Switch back to ioread32 and iowrite32 for cases where bus_space_vaddr is
used instead of bus_space_read/bus_space_write.


# 1.13 12-Apr-2015 jsg

make wait_queue_head a struct with a mutex
better matches linux behaviour


# 1.12 08-Apr-2015 jsg

change back to memcpy_toio/memcpy_fromio/memset_io


# 1.11 08-Apr-2015 jsg

ttm has it's own version of kmap/kunmap that uses
kernel_map/uvm_km_valloc and i915 has a version that uses
phys_map/uvm_km_valloc_wait as calling code assumes kmap would
sleep if no memory is available.

Move these and ttm's vmap/vunmap into the linux compat files
and make them all use phys_map/uvm_km_valloc_wait.

looks good kettenis@


# 1.10 06-Apr-2015 jsg

move some inline linux compat into the dedicated files


Revision tags: OPENBSD_5_7_BASE
# 1.9 12-Feb-2015 jsg

Add and use macros for linux memory barriers. Fix the call in
i915_gem_object_flush_fence() to be mb() not wmb() while here.


# 1.8 10-Feb-2015 jsg

switch most mtx_* calls back to linux spinlocks


# 1.7 10-Feb-2015 jsg

switch most rwlock calls back to their linux equivalents


# 1.6 16-Nov-2014 deraadt

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.5 10-Feb-2014 jsg

drm/ttm: Fix ttm_bo_move_memcpy

From Thomas Hellstrom
1fe70122dd9b926e84b14d1603202ae2ef2c5edd in ubuntu 3.8
da95c788ef0c645378ffccb7060a0df1a33aee38 in mainline linux


# 1.4 10-Feb-2014 jsg

drm/ttm: Handle in-memory region copies

From Jakob Bornecrantz
f8f0599d88fb76646bdd8b735dc2574ad80c625d in ubuntu 3.8
9a0599ddeae012a771bba5e23393fc52d8a59d89 in mainline linux


# 1.3 09-Feb-2014 jsg

use linux style memory allocations in ttm


# 1.2 08-Dec-2013 jsg

add static back to the ttm functions
ok kettenis@


# 1.1 12-Aug-2013 jsg

Add a port of the TTM and Radeon DRM code from Linux 3.8.13.
Includes kernel modesetting, framebuffer console and support
for newer hardware.

Firmware needs to be present for acceleration and in some cases
modesetting to work. It can be installed via fw_update
or manually via pkg_add.

With lots of help from kettenis@ some macppc bits from mpi@
and some ttm refcount/queue bits from FreeBSD.

Thanks to M:Tier and the OpenBSD Foundation for sponsoring this work.


# 1.25 14-Jun-2020 jsg

rename our kunmap() to kunmap_va()

In linux kunmap() has a page struct * argument our kunmap() has a void *
argument which results in uncoverted uses building but doing the wrong
thing. Renaming will catch any codepaths that need to be changed at
compile time.


# 1.24 08-Jun-2020 jsg

update drm to linux 5.7

adds kernel support for
amdgpu: vega20, raven2, renoir, navi10, navi14
inteldrm: icelake, tigerlake

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping, patrick@ for helping adapt rockchip drm and many developers for
testing.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.23 19-Aug-2019 jsg

define CONFIG_X86* in autoconf.h as needed and reduce diff to linux
ok kettenis@


# 1.22 14-Apr-2019 jsg

Update shared drm code, inteldrm(4) and radeondrm(4) from linux 4.4 to
linux 4.19.34.

Adds support for more Intel hardware:
Broxton/Apollo Lake (was is_preliminary in 4.4)
Amber Lake (another Kaby Lake refresh)
Gemini Lake
Coffee Lake
Whiskey Lake
Cannon Lake (though no hardware with Intel graphics ever shipped)
Ice Lake (alpha support, hardware not released)

This does not add support for new radeon hardware on the AMD side as
newer radeons have a different kernel driver (amdgpu).

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping and a bunch of other developers for testing.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.21 20-Aug-2018 kettenis

Add arm64 support. On ARM write-combining translates into the normal uncached
memory attribute and uncached translates into device-nGnRnE memory. This
complicates the mapping onto PMAP_WC, PMAP_NOCACHE and PMAP_DEVICE a bit
since the requirements of the drm(4) subsystem don't quite match the natural
definitions for these.

ok jsg@, mpi@, visa@


# 1.20 20-Aug-2018 jsg

Cached tests moved from callers into ttm_io_prot() with linux 3.18
which was partly missed when the 4.4 ttm changes went in.
Prompted by a patch from kettenis@


# 1.19 25-Apr-2018 jsg

update ttm and radeondrm(4) to Linux 4.4.129

Compared to the previous Linux 3.8 based port this adds support for
KAVERI/KABINI/MULLINS APUs and OLAND/BONAIRE/HAINAN/HAWAII GPUs.

Thanks to the OpenBSD Foundation for sponsoring this work.


# 1.18 20-Apr-2018 deraadt

oops, snapshot tests not ready yet


# 1.17 20-Apr-2018 deraadt

sync


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.16 04-Jun-2017 kettenis

Switch the TTM code over to the generic DRM VMA manager.

ok jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 27-Sep-2015 jsg

Switch remaining users of the FreeBSD refcount apis back to the original
linux kref/kobject use.

ok kettenis@


Revision tags: OPENBSD_5_8_BASE
# 1.14 12-Apr-2015 jsg

Switch back to ioread32 and iowrite32 for cases where bus_space_vaddr is
used instead of bus_space_read/bus_space_write.


# 1.13 12-Apr-2015 jsg

make wait_queue_head a struct with a mutex
better matches linux behaviour


# 1.12 08-Apr-2015 jsg

change back to memcpy_toio/memcpy_fromio/memset_io


# 1.11 08-Apr-2015 jsg

ttm has it's own version of kmap/kunmap that uses
kernel_map/uvm_km_valloc and i915 has a version that uses
phys_map/uvm_km_valloc_wait as calling code assumes kmap would
sleep if no memory is available.

Move these and ttm's vmap/vunmap into the linux compat files
and make them all use phys_map/uvm_km_valloc_wait.

looks good kettenis@


# 1.10 06-Apr-2015 jsg

move some inline linux compat into the dedicated files


Revision tags: OPENBSD_5_7_BASE
# 1.9 12-Feb-2015 jsg

Add and use macros for linux memory barriers. Fix the call in
i915_gem_object_flush_fence() to be mb() not wmb() while here.


# 1.8 10-Feb-2015 jsg

switch most mtx_* calls back to linux spinlocks


# 1.7 10-Feb-2015 jsg

switch most rwlock calls back to their linux equivalents


# 1.6 16-Nov-2014 deraadt

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.5 10-Feb-2014 jsg

drm/ttm: Fix ttm_bo_move_memcpy

From Thomas Hellstrom
1fe70122dd9b926e84b14d1603202ae2ef2c5edd in ubuntu 3.8
da95c788ef0c645378ffccb7060a0df1a33aee38 in mainline linux


# 1.4 10-Feb-2014 jsg

drm/ttm: Handle in-memory region copies

From Jakob Bornecrantz
f8f0599d88fb76646bdd8b735dc2574ad80c625d in ubuntu 3.8
9a0599ddeae012a771bba5e23393fc52d8a59d89 in mainline linux


# 1.3 09-Feb-2014 jsg

use linux style memory allocations in ttm


# 1.2 08-Dec-2013 jsg

add static back to the ttm functions
ok kettenis@


# 1.1 12-Aug-2013 jsg

Add a port of the TTM and Radeon DRM code from Linux 3.8.13.
Includes kernel modesetting, framebuffer console and support
for newer hardware.

Firmware needs to be present for acceleration and in some cases
modesetting to work. It can be installed via fw_update
or manually via pkg_add.

With lots of help from kettenis@ some macppc bits from mpi@
and some ttm refcount/queue bits from FreeBSD.

Thanks to M:Tier and the OpenBSD Foundation for sponsoring this work.


# 1.24 08-Jun-2020 jsg

update drm to linux 5.7

adds kernel support for
amdgpu: vega20, raven2, renoir, navi10, navi14
inteldrm: icelake, tigerlake

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping, patrick@ for helping adapt rockchip drm and many developers for
testing.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.23 19-Aug-2019 jsg

define CONFIG_X86* in autoconf.h as needed and reduce diff to linux
ok kettenis@


# 1.22 14-Apr-2019 jsg

Update shared drm code, inteldrm(4) and radeondrm(4) from linux 4.4 to
linux 4.19.34.

Adds support for more Intel hardware:
Broxton/Apollo Lake (was is_preliminary in 4.4)
Amber Lake (another Kaby Lake refresh)
Gemini Lake
Coffee Lake
Whiskey Lake
Cannon Lake (though no hardware with Intel graphics ever shipped)
Ice Lake (alpha support, hardware not released)

This does not add support for new radeon hardware on the AMD side as
newer radeons have a different kernel driver (amdgpu).

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping and a bunch of other developers for testing.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.21 20-Aug-2018 kettenis

Add arm64 support. On ARM write-combining translates into the normal uncached
memory attribute and uncached translates into device-nGnRnE memory. This
complicates the mapping onto PMAP_WC, PMAP_NOCACHE and PMAP_DEVICE a bit
since the requirements of the drm(4) subsystem don't quite match the natural
definitions for these.

ok jsg@, mpi@, visa@


# 1.20 20-Aug-2018 jsg

Cached tests moved from callers into ttm_io_prot() with linux 3.18
which was partly missed when the 4.4 ttm changes went in.
Prompted by a patch from kettenis@


# 1.19 25-Apr-2018 jsg

update ttm and radeondrm(4) to Linux 4.4.129

Compared to the previous Linux 3.8 based port this adds support for
KAVERI/KABINI/MULLINS APUs and OLAND/BONAIRE/HAINAN/HAWAII GPUs.

Thanks to the OpenBSD Foundation for sponsoring this work.


# 1.18 20-Apr-2018 deraadt

oops, snapshot tests not ready yet


# 1.17 20-Apr-2018 deraadt

sync


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.16 04-Jun-2017 kettenis

Switch the TTM code over to the generic DRM VMA manager.

ok jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 27-Sep-2015 jsg

Switch remaining users of the FreeBSD refcount apis back to the original
linux kref/kobject use.

ok kettenis@


Revision tags: OPENBSD_5_8_BASE
# 1.14 12-Apr-2015 jsg

Switch back to ioread32 and iowrite32 for cases where bus_space_vaddr is
used instead of bus_space_read/bus_space_write.


# 1.13 12-Apr-2015 jsg

make wait_queue_head a struct with a mutex
better matches linux behaviour


# 1.12 08-Apr-2015 jsg

change back to memcpy_toio/memcpy_fromio/memset_io


# 1.11 08-Apr-2015 jsg

ttm has it's own version of kmap/kunmap that uses
kernel_map/uvm_km_valloc and i915 has a version that uses
phys_map/uvm_km_valloc_wait as calling code assumes kmap would
sleep if no memory is available.

Move these and ttm's vmap/vunmap into the linux compat files
and make them all use phys_map/uvm_km_valloc_wait.

looks good kettenis@


# 1.10 06-Apr-2015 jsg

move some inline linux compat into the dedicated files


Revision tags: OPENBSD_5_7_BASE
# 1.9 12-Feb-2015 jsg

Add and use macros for linux memory barriers. Fix the call in
i915_gem_object_flush_fence() to be mb() not wmb() while here.


# 1.8 10-Feb-2015 jsg

switch most mtx_* calls back to linux spinlocks


# 1.7 10-Feb-2015 jsg

switch most rwlock calls back to their linux equivalents


# 1.6 16-Nov-2014 deraadt

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.5 10-Feb-2014 jsg

drm/ttm: Fix ttm_bo_move_memcpy

From Thomas Hellstrom
1fe70122dd9b926e84b14d1603202ae2ef2c5edd in ubuntu 3.8
da95c788ef0c645378ffccb7060a0df1a33aee38 in mainline linux


# 1.4 10-Feb-2014 jsg

drm/ttm: Handle in-memory region copies

From Jakob Bornecrantz
f8f0599d88fb76646bdd8b735dc2574ad80c625d in ubuntu 3.8
9a0599ddeae012a771bba5e23393fc52d8a59d89 in mainline linux


# 1.3 09-Feb-2014 jsg

use linux style memory allocations in ttm


# 1.2 08-Dec-2013 jsg

add static back to the ttm functions
ok kettenis@


# 1.1 12-Aug-2013 jsg

Add a port of the TTM and Radeon DRM code from Linux 3.8.13.
Includes kernel modesetting, framebuffer console and support
for newer hardware.

Firmware needs to be present for acceleration and in some cases
modesetting to work. It can be installed via fw_update
or manually via pkg_add.

With lots of help from kettenis@ some macppc bits from mpi@
and some ttm refcount/queue bits from FreeBSD.

Thanks to M:Tier and the OpenBSD Foundation for sponsoring this work.


# 1.23 19-Aug-2019 jsg

define CONFIG_X86* in autoconf.h as needed and reduce diff to linux
ok kettenis@


# 1.22 14-Apr-2019 jsg

Update shared drm code, inteldrm(4) and radeondrm(4) from linux 4.4 to
linux 4.19.34.

Adds support for more Intel hardware:
Broxton/Apollo Lake (was is_preliminary in 4.4)
Amber Lake (another Kaby Lake refresh)
Gemini Lake
Coffee Lake
Whiskey Lake
Cannon Lake (though no hardware with Intel graphics ever shipped)
Ice Lake (alpha support, hardware not released)

This does not add support for new radeon hardware on the AMD side as
newer radeons have a different kernel driver (amdgpu).

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping and a bunch of other developers for testing.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.21 20-Aug-2018 kettenis

Add arm64 support. On ARM write-combining translates into the normal uncached
memory attribute and uncached translates into device-nGnRnE memory. This
complicates the mapping onto PMAP_WC, PMAP_NOCACHE and PMAP_DEVICE a bit
since the requirements of the drm(4) subsystem don't quite match the natural
definitions for these.

ok jsg@, mpi@, visa@


# 1.20 20-Aug-2018 jsg

Cached tests moved from callers into ttm_io_prot() with linux 3.18
which was partly missed when the 4.4 ttm changes went in.
Prompted by a patch from kettenis@


# 1.19 25-Apr-2018 jsg

update ttm and radeondrm(4) to Linux 4.4.129

Compared to the previous Linux 3.8 based port this adds support for
KAVERI/KABINI/MULLINS APUs and OLAND/BONAIRE/HAINAN/HAWAII GPUs.

Thanks to the OpenBSD Foundation for sponsoring this work.


# 1.18 20-Apr-2018 deraadt

oops, snapshot tests not ready yet


# 1.17 20-Apr-2018 deraadt

sync


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.16 04-Jun-2017 kettenis

Switch the TTM code over to the generic DRM VMA manager.

ok jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 27-Sep-2015 jsg

Switch remaining users of the FreeBSD refcount apis back to the original
linux kref/kobject use.

ok kettenis@


Revision tags: OPENBSD_5_8_BASE
# 1.14 12-Apr-2015 jsg

Switch back to ioread32 and iowrite32 for cases where bus_space_vaddr is
used instead of bus_space_read/bus_space_write.


# 1.13 12-Apr-2015 jsg

make wait_queue_head a struct with a mutex
better matches linux behaviour


# 1.12 08-Apr-2015 jsg

change back to memcpy_toio/memcpy_fromio/memset_io


# 1.11 08-Apr-2015 jsg

ttm has it's own version of kmap/kunmap that uses
kernel_map/uvm_km_valloc and i915 has a version that uses
phys_map/uvm_km_valloc_wait as calling code assumes kmap would
sleep if no memory is available.

Move these and ttm's vmap/vunmap into the linux compat files
and make them all use phys_map/uvm_km_valloc_wait.

looks good kettenis@


# 1.10 06-Apr-2015 jsg

move some inline linux compat into the dedicated files


Revision tags: OPENBSD_5_7_BASE
# 1.9 12-Feb-2015 jsg

Add and use macros for linux memory barriers. Fix the call in
i915_gem_object_flush_fence() to be mb() not wmb() while here.


# 1.8 10-Feb-2015 jsg

switch most mtx_* calls back to linux spinlocks


# 1.7 10-Feb-2015 jsg

switch most rwlock calls back to their linux equivalents


# 1.6 16-Nov-2014 deraadt

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.5 10-Feb-2014 jsg

drm/ttm: Fix ttm_bo_move_memcpy

From Thomas Hellstrom
1fe70122dd9b926e84b14d1603202ae2ef2c5edd in ubuntu 3.8
da95c788ef0c645378ffccb7060a0df1a33aee38 in mainline linux


# 1.4 10-Feb-2014 jsg

drm/ttm: Handle in-memory region copies

From Jakob Bornecrantz
f8f0599d88fb76646bdd8b735dc2574ad80c625d in ubuntu 3.8
9a0599ddeae012a771bba5e23393fc52d8a59d89 in mainline linux


# 1.3 09-Feb-2014 jsg

use linux style memory allocations in ttm


# 1.2 08-Dec-2013 jsg

add static back to the ttm functions
ok kettenis@


# 1.1 12-Aug-2013 jsg

Add a port of the TTM and Radeon DRM code from Linux 3.8.13.
Includes kernel modesetting, framebuffer console and support
for newer hardware.

Firmware needs to be present for acceleration and in some cases
modesetting to work. It can be installed via fw_update
or manually via pkg_add.

With lots of help from kettenis@ some macppc bits from mpi@
and some ttm refcount/queue bits from FreeBSD.

Thanks to M:Tier and the OpenBSD Foundation for sponsoring this work.


# 1.22 14-Apr-2019 jsg

Update shared drm code, inteldrm(4) and radeondrm(4) from linux 4.4 to
linux 4.19.34.

Adds support for more Intel hardware:
Broxton/Apollo Lake (was is_preliminary in 4.4)
Amber Lake (another Kaby Lake refresh)
Gemini Lake
Coffee Lake
Whiskey Lake
Cannon Lake (though no hardware with Intel graphics ever shipped)
Ice Lake (alpha support, hardware not released)

This does not add support for new radeon hardware on the AMD side as
newer radeons have a different kernel driver (amdgpu).

Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for
helping and a bunch of other developers for testing.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.21 20-Aug-2018 kettenis

Add arm64 support. On ARM write-combining translates into the normal uncached
memory attribute and uncached translates into device-nGnRnE memory. This
complicates the mapping onto PMAP_WC, PMAP_NOCACHE and PMAP_DEVICE a bit
since the requirements of the drm(4) subsystem don't quite match the natural
definitions for these.

ok jsg@, mpi@, visa@


# 1.20 20-Aug-2018 jsg

Cached tests moved from callers into ttm_io_prot() with linux 3.18
which was partly missed when the 4.4 ttm changes went in.
Prompted by a patch from kettenis@


# 1.19 25-Apr-2018 jsg

update ttm and radeondrm(4) to Linux 4.4.129

Compared to the previous Linux 3.8 based port this adds support for
KAVERI/KABINI/MULLINS APUs and OLAND/BONAIRE/HAINAN/HAWAII GPUs.

Thanks to the OpenBSD Foundation for sponsoring this work.


# 1.18 20-Apr-2018 deraadt

oops, snapshot tests not ready yet


# 1.17 20-Apr-2018 deraadt

sync


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.16 04-Jun-2017 kettenis

Switch the TTM code over to the generic DRM VMA manager.

ok jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 27-Sep-2015 jsg

Switch remaining users of the FreeBSD refcount apis back to the original
linux kref/kobject use.

ok kettenis@


Revision tags: OPENBSD_5_8_BASE
# 1.14 12-Apr-2015 jsg

Switch back to ioread32 and iowrite32 for cases where bus_space_vaddr is
used instead of bus_space_read/bus_space_write.


# 1.13 12-Apr-2015 jsg

make wait_queue_head a struct with a mutex
better matches linux behaviour


# 1.12 08-Apr-2015 jsg

change back to memcpy_toio/memcpy_fromio/memset_io


# 1.11 08-Apr-2015 jsg

ttm has it's own version of kmap/kunmap that uses
kernel_map/uvm_km_valloc and i915 has a version that uses
phys_map/uvm_km_valloc_wait as calling code assumes kmap would
sleep if no memory is available.

Move these and ttm's vmap/vunmap into the linux compat files
and make them all use phys_map/uvm_km_valloc_wait.

looks good kettenis@


# 1.10 06-Apr-2015 jsg

move some inline linux compat into the dedicated files


Revision tags: OPENBSD_5_7_BASE
# 1.9 12-Feb-2015 jsg

Add and use macros for linux memory barriers. Fix the call in
i915_gem_object_flush_fence() to be mb() not wmb() while here.


# 1.8 10-Feb-2015 jsg

switch most mtx_* calls back to linux spinlocks


# 1.7 10-Feb-2015 jsg

switch most rwlock calls back to their linux equivalents


# 1.6 16-Nov-2014 deraadt

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.5 10-Feb-2014 jsg

drm/ttm: Fix ttm_bo_move_memcpy

From Thomas Hellstrom
1fe70122dd9b926e84b14d1603202ae2ef2c5edd in ubuntu 3.8
da95c788ef0c645378ffccb7060a0df1a33aee38 in mainline linux


# 1.4 10-Feb-2014 jsg

drm/ttm: Handle in-memory region copies

From Jakob Bornecrantz
f8f0599d88fb76646bdd8b735dc2574ad80c625d in ubuntu 3.8
9a0599ddeae012a771bba5e23393fc52d8a59d89 in mainline linux


# 1.3 09-Feb-2014 jsg

use linux style memory allocations in ttm


# 1.2 08-Dec-2013 jsg

add static back to the ttm functions
ok kettenis@


# 1.1 12-Aug-2013 jsg

Add a port of the TTM and Radeon DRM code from Linux 3.8.13.
Includes kernel modesetting, framebuffer console and support
for newer hardware.

Firmware needs to be present for acceleration and in some cases
modesetting to work. It can be installed via fw_update
or manually via pkg_add.

With lots of help from kettenis@ some macppc bits from mpi@
and some ttm refcount/queue bits from FreeBSD.

Thanks to M:Tier and the OpenBSD Foundation for sponsoring this work.


# 1.21 20-Aug-2018 kettenis

Add arm64 support. On ARM write-combining translates into the normal uncached
memory attribute and uncached translates into device-nGnRnE memory. This
complicates the mapping onto PMAP_WC, PMAP_NOCACHE and PMAP_DEVICE a bit
since the requirements of the drm(4) subsystem don't quite match the natural
definitions for these.

ok jsg@, mpi@, visa@


# 1.20 20-Aug-2018 jsg

Cached tests moved from callers into ttm_io_prot() with linux 3.18
which was partly missed when the 4.4 ttm changes went in.
Prompted by a patch from kettenis@


# 1.19 25-Apr-2018 jsg

update ttm and radeondrm(4) to Linux 4.4.129

Compared to the previous Linux 3.8 based port this adds support for
KAVERI/KABINI/MULLINS APUs and OLAND/BONAIRE/HAINAN/HAWAII GPUs.

Thanks to the OpenBSD Foundation for sponsoring this work.


# 1.18 20-Apr-2018 deraadt

oops, snapshot tests not ready yet


# 1.17 20-Apr-2018 deraadt

sync


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.16 04-Jun-2017 kettenis

Switch the TTM code over to the generic DRM VMA manager.

ok jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 27-Sep-2015 jsg

Switch remaining users of the FreeBSD refcount apis back to the original
linux kref/kobject use.

ok kettenis@


Revision tags: OPENBSD_5_8_BASE
# 1.14 12-Apr-2015 jsg

Switch back to ioread32 and iowrite32 for cases where bus_space_vaddr is
used instead of bus_space_read/bus_space_write.


# 1.13 12-Apr-2015 jsg

make wait_queue_head a struct with a mutex
better matches linux behaviour


# 1.12 08-Apr-2015 jsg

change back to memcpy_toio/memcpy_fromio/memset_io


# 1.11 08-Apr-2015 jsg

ttm has it's own version of kmap/kunmap that uses
kernel_map/uvm_km_valloc and i915 has a version that uses
phys_map/uvm_km_valloc_wait as calling code assumes kmap would
sleep if no memory is available.

Move these and ttm's vmap/vunmap into the linux compat files
and make them all use phys_map/uvm_km_valloc_wait.

looks good kettenis@


# 1.10 06-Apr-2015 jsg

move some inline linux compat into the dedicated files


Revision tags: OPENBSD_5_7_BASE
# 1.9 12-Feb-2015 jsg

Add and use macros for linux memory barriers. Fix the call in
i915_gem_object_flush_fence() to be mb() not wmb() while here.


# 1.8 10-Feb-2015 jsg

switch most mtx_* calls back to linux spinlocks


# 1.7 10-Feb-2015 jsg

switch most rwlock calls back to their linux equivalents


# 1.6 16-Nov-2014 deraadt

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.5 10-Feb-2014 jsg

drm/ttm: Fix ttm_bo_move_memcpy

From Thomas Hellstrom
1fe70122dd9b926e84b14d1603202ae2ef2c5edd in ubuntu 3.8
da95c788ef0c645378ffccb7060a0df1a33aee38 in mainline linux


# 1.4 10-Feb-2014 jsg

drm/ttm: Handle in-memory region copies

From Jakob Bornecrantz
f8f0599d88fb76646bdd8b735dc2574ad80c625d in ubuntu 3.8
9a0599ddeae012a771bba5e23393fc52d8a59d89 in mainline linux


# 1.3 09-Feb-2014 jsg

use linux style memory allocations in ttm


# 1.2 08-Dec-2013 jsg

add static back to the ttm functions
ok kettenis@


# 1.1 12-Aug-2013 jsg

Add a port of the TTM and Radeon DRM code from Linux 3.8.13.
Includes kernel modesetting, framebuffer console and support
for newer hardware.

Firmware needs to be present for acceleration and in some cases
modesetting to work. It can be installed via fw_update
or manually via pkg_add.

With lots of help from kettenis@ some macppc bits from mpi@
and some ttm refcount/queue bits from FreeBSD.

Thanks to M:Tier and the OpenBSD Foundation for sponsoring this work.


# 1.19 25-Apr-2018 jsg

update ttm and radeondrm(4) to Linux 4.4.129

Compared to the previous Linux 3.8 based port this adds support for
KAVERI/KABINI/MULLINS APUs and OLAND/BONAIRE/HAINAN/HAWAII GPUs.

Thanks to the OpenBSD Foundation for sponsoring this work.


# 1.18 20-Apr-2018 deraadt

oops, snapshot tests not ready yet


# 1.17 20-Apr-2018 deraadt

sync


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.16 04-Jun-2017 kettenis

Switch the TTM code over to the generic DRM VMA manager.

ok jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 27-Sep-2015 jsg

Switch remaining users of the FreeBSD refcount apis back to the original
linux kref/kobject use.

ok kettenis@


Revision tags: OPENBSD_5_8_BASE
# 1.14 12-Apr-2015 jsg

Switch back to ioread32 and iowrite32 for cases where bus_space_vaddr is
used instead of bus_space_read/bus_space_write.


# 1.13 12-Apr-2015 jsg

make wait_queue_head a struct with a mutex
better matches linux behaviour


# 1.12 08-Apr-2015 jsg

change back to memcpy_toio/memcpy_fromio/memset_io


# 1.11 08-Apr-2015 jsg

ttm has it's own version of kmap/kunmap that uses
kernel_map/uvm_km_valloc and i915 has a version that uses
phys_map/uvm_km_valloc_wait as calling code assumes kmap would
sleep if no memory is available.

Move these and ttm's vmap/vunmap into the linux compat files
and make them all use phys_map/uvm_km_valloc_wait.

looks good kettenis@


# 1.10 06-Apr-2015 jsg

move some inline linux compat into the dedicated files


Revision tags: OPENBSD_5_7_BASE
# 1.9 12-Feb-2015 jsg

Add and use macros for linux memory barriers. Fix the call in
i915_gem_object_flush_fence() to be mb() not wmb() while here.


# 1.8 10-Feb-2015 jsg

switch most mtx_* calls back to linux spinlocks


# 1.7 10-Feb-2015 jsg

switch most rwlock calls back to their linux equivalents


# 1.6 16-Nov-2014 deraadt

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.5 10-Feb-2014 jsg

drm/ttm: Fix ttm_bo_move_memcpy

From Thomas Hellstrom
1fe70122dd9b926e84b14d1603202ae2ef2c5edd in ubuntu 3.8
da95c788ef0c645378ffccb7060a0df1a33aee38 in mainline linux


# 1.4 10-Feb-2014 jsg

drm/ttm: Handle in-memory region copies

From Jakob Bornecrantz
f8f0599d88fb76646bdd8b735dc2574ad80c625d in ubuntu 3.8
9a0599ddeae012a771bba5e23393fc52d8a59d89 in mainline linux


# 1.3 09-Feb-2014 jsg

use linux style memory allocations in ttm


# 1.2 08-Dec-2013 jsg

add static back to the ttm functions
ok kettenis@


# 1.1 12-Aug-2013 jsg

Add a port of the TTM and Radeon DRM code from Linux 3.8.13.
Includes kernel modesetting, framebuffer console and support
for newer hardware.

Firmware needs to be present for acceleration and in some cases
modesetting to work. It can be installed via fw_update
or manually via pkg_add.

With lots of help from kettenis@ some macppc bits from mpi@
and some ttm refcount/queue bits from FreeBSD.

Thanks to M:Tier and the OpenBSD Foundation for sponsoring this work.


Revision tags: OPENBSD_6_2_BASE
# 1.16 04-Jun-2017 kettenis

Switch the TTM code over to the generic DRM VMA manager.

ok jsg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.15 27-Sep-2015 jsg

Switch remaining users of the FreeBSD refcount apis back to the original
linux kref/kobject use.

ok kettenis@


Revision tags: OPENBSD_5_8_BASE
# 1.14 12-Apr-2015 jsg

Switch back to ioread32 and iowrite32 for cases where bus_space_vaddr is
used instead of bus_space_read/bus_space_write.


# 1.13 12-Apr-2015 jsg

make wait_queue_head a struct with a mutex
better matches linux behaviour


# 1.12 08-Apr-2015 jsg

change back to memcpy_toio/memcpy_fromio/memset_io


# 1.11 08-Apr-2015 jsg

ttm has it's own version of kmap/kunmap that uses
kernel_map/uvm_km_valloc and i915 has a version that uses
phys_map/uvm_km_valloc_wait as calling code assumes kmap would
sleep if no memory is available.

Move these and ttm's vmap/vunmap into the linux compat files
and make them all use phys_map/uvm_km_valloc_wait.

looks good kettenis@


# 1.10 06-Apr-2015 jsg

move some inline linux compat into the dedicated files


Revision tags: OPENBSD_5_7_BASE
# 1.9 12-Feb-2015 jsg

Add and use macros for linux memory barriers. Fix the call in
i915_gem_object_flush_fence() to be mb() not wmb() while here.


# 1.8 10-Feb-2015 jsg

switch most mtx_* calls back to linux spinlocks


# 1.7 10-Feb-2015 jsg

switch most rwlock calls back to their linux equivalents


# 1.6 16-Nov-2014 deraadt

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.5 10-Feb-2014 jsg

drm/ttm: Fix ttm_bo_move_memcpy

From Thomas Hellstrom
1fe70122dd9b926e84b14d1603202ae2ef2c5edd in ubuntu 3.8
da95c788ef0c645378ffccb7060a0df1a33aee38 in mainline linux


# 1.4 10-Feb-2014 jsg

drm/ttm: Handle in-memory region copies

From Jakob Bornecrantz
f8f0599d88fb76646bdd8b735dc2574ad80c625d in ubuntu 3.8
9a0599ddeae012a771bba5e23393fc52d8a59d89 in mainline linux


# 1.3 09-Feb-2014 jsg

use linux style memory allocations in ttm


# 1.2 08-Dec-2013 jsg

add static back to the ttm functions
ok kettenis@


# 1.1 12-Aug-2013 jsg

Add a port of the TTM and Radeon DRM code from Linux 3.8.13.
Includes kernel modesetting, framebuffer console and support
for newer hardware.

Firmware needs to be present for acceleration and in some cases
modesetting to work. It can be installed via fw_update
or manually via pkg_add.

With lots of help from kettenis@ some macppc bits from mpi@
and some ttm refcount/queue bits from FreeBSD.

Thanks to M:Tier and the OpenBSD Foundation for sponsoring this work.