kernel - Improve pmap_change_attr() when used on the DMAP
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 15 Dec 2019 20:18:44 +0000 (12:18 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 15 Dec 2019 20:22:21 +0000 (12:22 -0800)
commitc2ec3418751ed579ef32df1e012847d3c17cbc67
treeb22f1420c3644a23cd4673c4a2788ced4402c6b4
parentc47c81dbc5495f8c4fa01a238784813eb56a239e
kernel - Improve pmap_change_attr() when used on the DMAP

* When used on the DMAP's 1GB or 2MB pages pmap_change_attr()
  basically didn't work because it tries to access terminal PTEs
  (and there aren't any), instead accidently accessing the
  underlying physical memory and causing corruption.

* Fix this by (1) Forcing the DMAP to use 2MB pages and
  (2) special-casing DMAP addresses in pmap_change_attr()
  to act on the PDEs.

* This is not a complete fix because the granularity for
  any DMAP VAs will still be ~2MB and not 4K.  Its use by
  the DRM subsystem requires more investigation.  But the
  changes should improve some of the reported GPU corruption
  issues.

Reported-by: peeter
Testing-by: multiple
sys/platform/pc64/include/pmap.h
sys/platform/pc64/vmm/ept.c
sys/platform/pc64/x86_64/pmap.c