Page MenuHomeFreeBSD

physmem: add ram0 pseudo-driver
Needs ReviewPublic

Authored by mhorne on Oct 6 2021, 8:02 PM.

Details

Reviewers
jhb
gonzo
kevans
Group Reviewers
arm64
Summary

Its purpose is to reserve all I/O space belonging to physical memory
from nexus, preventing it from being handed out to bus_alloc_resource()
callers such as xenpv_alloc_physmem(), which looks for the first
available free range it can get. This mimics the existing pseudo-driver
on x86.

Test Plan

Tested on arm, arm64, riscv.

Relevant output from devinfo -r on my rockpro64:

ram0
      I/O memory addresses:
          0x200000-0x80fffff
          0x8100000-0x8112fff
          0x8113000-0xe8dfffff
          0xe8e00000-0xea317fff
          0xea318000-0xf0f0afff
          0xf0f0b000-0xf0f0efff
          0xf0f0f000-0xf0f0ffff
          0xf0f10000-0xf0f10fff
          0xf0f11000-0xf0f12fff
          0xf0f13000-0xf0f16fff
          0xf0f17000-0xf0f17fff
          0xf0f18000-0xf0f1cfff
          0xf0f1d000-0xf0f1dfff
          0xf0f1e000-0xf0f1efff
          0xf0f1f000-0xf0f20fff
          0xf0f21000-0xf0f21fff
          0xf0f22000-0xf0f22fff
          0xf0f23000-0xf0f24fff
          0xf0f25000-0xf0f25fff
          0xf0f26000-0xf0f26fff
          0xf0f27000-0xf3f3ffff
          0xf3f40000-0xf3f4ffff
          0xf3f50000-0xf5ffffff
          0xf6000000-0xf7fa3fff
          0xf7fa4000-0xf7ffffff

And the matching physmem entries, reported by verbose dmesg:

Physical memory chunk(s):
  0x00200000 - 0x080fffff,   127 MB (  32512 pages)
  0x08113000 - 0xf0f0afff,  3725 MB ( 953848 pages)
  0xf0f0f000 - 0xf0f12fff,     0 MB (      4 pages)
  0xf0f14000 - 0xf0f1bfff,     0 MB (      8 pages)
  0xf0f1d000 - 0xf0f1dfff,     0 MB (      1 pages)
  0xf0f1f000 - 0xf0f20fff,     0 MB (      2 pages)
  0xf0f22000 - 0xf0f22fff,     0 MB (      1 pages)
  0xf0f25000 - 0xf0f25fff,     0 MB (      1 pages)
  0xf0f27000 - 0xf3f3ffff,    48 MB (  12313 pages)
  0xf3f50000 - 0xf5ffffff,    32 MB (   8368 pages)
  0xf7fa4000 - 0xf7ffffff,     0 MB (     92 pages)
Excluded memory regions:
  0x08100000 - 0x08112fff,     0 MB (     19 pages) NoAlloc 
  0xe8e00000 - 0xea317fff,    21 MB (   5400 pages) NoAlloc 
  0xf0f0b000 - 0xf0f0efff,     0 MB (      4 pages) NoAlloc 
  0xf0f10000 - 0xf0f10fff,     0 MB (      1 pages) NoAlloc 
  0xf0f13000 - 0xf0f16fff,     0 MB (      4 pages) NoAlloc 
  0xf0f18000 - 0xf0f1cfff,     0 MB (      5 pages) NoAlloc 
  0xf0f1e000 - 0xf0f1efff,     0 MB (      1 pages) NoAlloc 
  0xf0f21000 - 0xf0f21fff,     0 MB (      1 pages) NoAlloc 
  0xf0f23000 - 0xf0f24fff,     0 MB (      2 pages) NoAlloc 
  0xf0f26000 - 0xf0f26fff,     0 MB (      1 pages) NoAlloc 
  0xf3f40000 - 0xf3f4ffff,     0 MB (     16 pages) NoAlloc 
  0xf6000000 - 0xf7fa3fff,    31 MB (   8100 pages) NoAlloc

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 41992
Build 38880: arc lint + arc unit

Event Timeline

mhorne requested review of this revision.Oct 6 2021, 8:02 PM

Should have test run results for a Xen DomU within a day. An earlier version which had some differences was quite functional at handling this job. The results looked similar to what @mhorne reported.

(for Xen domains this is a crucial missing piece, since otherwise attempting to allocate unused addresses could result in allocating addresses used by physical memory)

Now visible as P519. Works similarly to previous version, handling the crucial job.

mhorne added a subscriber: kevans.

Ping.

Roping in @kevans since he's looked at this file recently. Kyle, since you are planning to switch amd64 to this KPI, should we try to have it use this as well? (rather than the ram pseudo-driver in sys/x86/x86/nexus.c)