sysfs-firmware-qemu_fw_cfg 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. What: /sys/firmware/qemu_fw_cfg/
  2. Date: August 2015
  3. Contact: Gabriel Somlo <[email protected]>
  4. Description:
  5. Several different architectures supported by QEMU (x86, arm,
  6. sun4*, ppc/mac) are provisioned with a firmware configuration
  7. (fw_cfg) device, originally intended as a way for the host to
  8. provide configuration data to the guest firmware. Starting
  9. with QEMU v2.4, arbitrary fw_cfg file entries may be specified
  10. by the user on the command line, which makes fw_cfg additionally
  11. useful as an out-of-band, asynchronous mechanism for providing
  12. configuration data to the guest userspace.
  13. The authoritative guest-side hardware interface documentation
  14. to the fw_cfg device can be found in "docs/specs/fw_cfg.rst"
  15. in the QEMU source tree, or online at:
  16. https://qemu-project.gitlab.io/qemu/specs/fw_cfg.html
  17. **SysFS fw_cfg Interface**
  18. The fw_cfg sysfs interface described in this document is only
  19. intended to display discoverable blobs (i.e., those registered
  20. with the file directory), as there is no way to determine the
  21. presence or size of "legacy" blobs (with selector keys between
  22. 0x0002 and 0x0018) programmatically.
  23. All fw_cfg information is shown under:
  24. /sys/firmware/qemu_fw_cfg/
  25. The only legacy blob displayed is the fw_cfg device revision:
  26. /sys/firmware/qemu_fw_cfg/rev
  27. **Discoverable fw_cfg blobs by selector key**
  28. All discoverable blobs listed in the fw_cfg file directory are
  29. displayed as entries named after their unique selector key
  30. value, e.g.:
  31. /sys/firmware/qemu_fw_cfg/by_key/32
  32. /sys/firmware/qemu_fw_cfg/by_key/33
  33. /sys/firmware/qemu_fw_cfg/by_key/34
  34. ...
  35. Each such fw_cfg sysfs entry has the following values exported
  36. as attributes:
  37. ==== ====================================================
  38. name The 56-byte nul-terminated ASCII string used as the
  39. blob's 'file name' in the fw_cfg directory.
  40. size The length of the blob, as given in the fw_cfg
  41. directory.
  42. key The value of the blob's selector key as given in the
  43. fw_cfg directory. This value is the same as used in
  44. the parent directory name.
  45. raw The raw bytes of the blob, obtained by selecting the
  46. entry via the control register, and reading a number
  47. of bytes equal to the blob size from the data
  48. register.
  49. ==== ====================================================
  50. **Listing fw_cfg blobs by file name**
  51. While the fw_cfg device does not impose any specific naming
  52. convention on the blobs registered in the file directory,
  53. QEMU developers have traditionally used path name semantics
  54. to give each blob a descriptive name. For example::
  55. "bootorder"
  56. "genroms/kvmvapic.bin"
  57. "etc/e820"
  58. "etc/boot-fail-wait"
  59. "etc/system-states"
  60. "etc/table-loader"
  61. "etc/acpi/rsdp"
  62. "etc/acpi/tables"
  63. "etc/smbios/smbios-tables"
  64. "etc/smbios/smbios-anchor"
  65. ...
  66. In addition to the listing by unique selector key described
  67. above, the fw_cfg sysfs driver also attempts to build a tree
  68. of directories matching the path name components of fw_cfg
  69. blob names, ending in symlinks to the by_key entry for each
  70. "basename", as illustrated below (assume current directory is
  71. /sys/firmware)::
  72. qemu_fw_cfg/by_name/bootorder -> ../by_key/38
  73. qemu_fw_cfg/by_name/etc/e820 -> ../../by_key/35
  74. qemu_fw_cfg/by_name/etc/acpi/rsdp -> ../../../by_key/41
  75. ...
  76. Construction of the directory tree and symlinks is done on a
  77. "best-effort" basis, as there is no guarantee that components
  78. of fw_cfg blob names are always "well behaved". I.e., there is
  79. the possibility that a symlink (basename) will conflict with
  80. a dirname component of another fw_cfg blob, in which case the
  81. creation of the offending /sys/firmware/qemu_fw_cfg/by_name
  82. entry will be skipped.
  83. The authoritative list of entries will continue to be found
  84. under the /sys/firmware/qemu_fw_cfg/by_key directory.