diff options
author | alc <alc@FreeBSD.org> | 2009-07-19 21:40:19 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2009-07-19 21:40:19 +0000 |
commit | 6e8105e16a0ad073971ede82d5e20ff84a2a1035 (patch) | |
tree | f20b252ddfa02062532e3bed9049acdffc9e40c2 /sys/i386/xen/pmap.c | |
parent | 9defbad772d8a70e282b11397513b9380177143a (diff) | |
download | FreeBSD-src-6e8105e16a0ad073971ede82d5e20ff84a2a1035.zip FreeBSD-src-6e8105e16a0ad073971ede82d5e20ff84a2a1035.tar.gz |
Change the handling of fictitious pages by pmap_page_set_memattr() on
amd64 and i386. Essentially, fictitious pages provide a mechanism for
creating aliases for either normal or device-backed pages. Therefore,
pmap_page_set_memattr() on a fictitious page needn't update the direct
map or flush the cache. Such actions are the responsibility of the
"primary" instance of the page or the device driver that "owns" the
physical address. For example, these actions are already performed by
pmap_mapdev().
The device pager needn't restore the memory attributes on a fictitious
page before releasing it. It's now pointless.
Add pmap_page_set_memattr() to the Xen pmap.
Approved by: re (kib)
Diffstat (limited to 'sys/i386/xen/pmap.c')
-rw-r--r-- | sys/i386/xen/pmap.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/i386/xen/pmap.c b/sys/i386/xen/pmap.c index 9a9a1b4..051685a 100644 --- a/sys/i386/xen/pmap.c +++ b/sys/i386/xen/pmap.c @@ -3921,6 +3921,25 @@ pmap_unmapdev(vm_offset_t va, vm_size_t size) kmem_free(kernel_map, base, size); } +/* + * Sets the memory attribute for the specified page. + */ +void +pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) +{ + + m->md.pat_mode = ma; + + /* + * If "m" is a normal page, flush it from the cache. + */ + if ((m->flags & PG_FICTITIOUS) == 0) { + /* If "Self Snoop" is supported, do nothing. */ + if (!(cpu_feature & CPUID_SS)) + pmap_invalidate_cache(); + } +} + int pmap_change_attr(va, size, mode) vm_offset_t va; |