Page MenuHomeFreeBSD

Create VM_MEMATTR_DEVICE on all architectures
ClosedPublic

Authored by andrew on Apr 10 2021, 12:47 PM.

Details

Summary

This is intended to be used with memory mapped IO, e.g. from
bus_space_map with no flags, or pmap_mapdev.

Use this new memory type in the map request configured by
resource_init_map_request, and in pciconf.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

sys/amd64/include/vm.h
45

Why only for kernel?

Also, the recent change to pci_user.c can be simplified after your introduction of VM_MEMATTR_DEVICE, look at line 1129.

sys/amd64/include/vm.h
45

It would break the switch statement in usr.bin/vm/vmstat.c if we don't limit to just the kernel as it will have the same value twice.

sys/amd64/include/vm.h
45

Then perhaps define MD name VM_MEMATTR_DEVMAP, present on all arches. It would be _UNCACHEABLE on x86, DEVICE on arm. pci_user.c would use _DEVMAP

sys/amd64/include/vm.h
45

We could also replace the switch statement with if else, e.g. D29703

  • Remove _KERNEL checks
  • Only use VM_MEMATTR_DEVICE in pciconf
This revision is now accepted and ready to land.Apr 12 2021, 2:01 AM
This revision was automatically updated to reflect the committed changes.