Files
reims-vgpu/vendor
Anees Iqbal 18a87b6026 🆕 Give the device doorbell pages in BAR 4
A guest's single commit costs 5.4 us against 2.9-3.1 on a native Mac, and
about 1.5 us of it is the bundle's call into the kext to write DOORBELL.
The device now has a BAR 4 of 256 doorbell pages of 16 KiB, which a guest
binds to its contexts through DOORBELL_PAGE_BIND (0x040, `page | context <<
8`) where it took DOORBELL_PAGES (feature bit 46). A page is its context's
own DOORBELL: a write of a ring's id at its first byte wakes that ring
where it is one of the context's queues', and is answered at the doorbell
as there when it asks. Every other write is dropped and counted, logged
once per kind: at an unbound page or another offset (`unbound`), or of
ring 0 or another context's ring (`foreign`). Reads answer 0. A reset
unbinds every page.

A queue of a context with a page is routed on the page's doorbell
(`route_doorbell_page`), and on DOORBELL otherwise. A page bound to another
context drops the routes on it of its old context's queues, so the host
wakes no ring at a page but its context's.

What the host and guest see:
- the C API: `rvg_graphics_device_doorbell_write`, the config's
  `doorbell_pages` (third version) and the callbacks' `route_doorbell_page`
  (third version), whose thread docs/api.md section 5 names;
- FEATURES_HI bit 14 is offered only where the host sets `doorbell_pages`;
- QEMU's reims-graphics-pci (b4771167) maps BAR 4 and offers the pages;
- a guest that does not take the bit, or a host that does not offer it,
  has every doorbell on DOORBELL as before: the bind is ignored and every
  BAR 4 write dropped (`without_doorbell_pages_the_doorbells_are_the_register_s`).

The wire header's change rewrites the option ROM's record; its bytes are
the same.
2026-11-14 18:01:06 -08:00
..