kernel-hacking-2024-linux-s.../tools/lguest
Rusty Russell 59eba788db lguest: support backdoor window.
The VIRTIO_PCI_CAP_PCI_CFG in the PCI virtio 1.0 spec allows access to
the BAR registers without mapping them.  This is a compulsory feature,
and we implement it here.

There are some subtleties involving access widths which we should
note:

4.1.4.7.1 Device Requirements: PCI configuration access capability

...
   Upon detecting driver write access to pci_cfg_data, the device MUST
   execute a write access at offset cap.offset at BAR selected by
   cap.bar using the first cap.length bytes from pci_cfg_data.

   Upon detecting driver read access to pci_cfg_data, the device MUST
   execute a read access of length cap.length at offset cap.offset at
   BAR selected by cap.bar and store the first cap.length bytes in
   pci_cfg_data.

So, for a write, we copy into the pci_cfg_data window, then write from
there out to the BAR.  This works correctly if cap.length != width of
write.  Similarly, for a read, we read into window from the BAR then
read the value from there.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:43 +10:30
..
.gitignore
extract
lguest.c lguest: support backdoor window. 2015-02-11 16:47:43 +10:30
lguest.txt lguest: fix paths in comments 2013-03-07 09:56:46 +11:00
Makefile lguest: fix failure to find linux/virtio_types.h 2015-02-11 16:47:37 +10:30