Commit graph

4 commits

Author SHA1 Message Date
Tijl Coosemans
147ea7d409 linuxkpi: Fix set_memory_*
set_memory_* is currently implemented using PHYS_TO_DMAP but not all
architectures have a DMAP.  Looking at how this function is used the
given address isn't physical but virtual so the PHYS_TO_DMAP call can
simply be removed.

Also cast numpages before shifting it to avoid overflow.

Reviewed by:	kib, markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D45057

(cherry picked from commit 7206f7c619912bdd4d54dd539824733eae50c3a9)
2024-05-11 17:32:35 +02:00
Jean-Sébastien Pédron
bb01efa6f8 linuxkpi: Fix uses of pmap_change_attr()
[Why]
This function takes an offset and a length as argument, not a physical
address and a number of pages.

This misuse caused the `set_memory_*()` and
`arch_io_reserve_memtype_wc()` functions to return EINVAL.

Another problem was the fact that they returned errors as a positive
integer, whereas Linux uses negative integers.

[How]
Physical addresses and number of pages are converted to offset+length in
the `set_memory_*()` functions.

`arch_io_reserve_memtype_wc()` now calls `pmap_change_attr()` directly
instead of using `set_memory_wc()`.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D42053

(cherry picked from commit 1e99b2ee90956f275c3668e92a408400f2dada1c)
2024-02-17 23:58:34 +03:00
Bjoern A. Zeeb
9e9c682ff3 LinuxKPI: reduce usage of struct vm_page and vm_page_t
We currently define (Linux) page to (FreeBSD) vm_page.
Cleanup some of the direct struct vm_page and vm_page_t declarations
and usages in the Linux KPI and make them 'struct page' or
'struct page *' to prepare for more upcoming work.

This should be a NOP.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D41255
2023-08-07 00:55:30 +00:00
Emmanuel Vadot
0e45856f9a linuxkpi: Add asm/set_memory.h
Provide functions needed for drm-kmod.

MFC after:      1 week
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D35571
2022-06-29 09:55:23 +02:00