]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - Documentation/ABI/testing/sysfs-firmware-qemu_fw_cfg
Merge branches 'pm-opp-fixes', 'pm-cpufreq-fixes' and 'pm-cpuidle-fixes'
[mirror_ubuntu-bionic-kernel.git] / Documentation / ABI / testing / sysfs-firmware-qemu_fw_cfg
1 What: /sys/firmware/qemu_fw_cfg/
2 Date: August 2015
3 Contact: Gabriel Somlo <somlo@cmu.edu>
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
14 The authoritative guest-side hardware interface documentation
15 to the fw_cfg device can be found in "docs/specs/fw_cfg.txt"
16 in the QEMU source tree.
17
18 === SysFS fw_cfg Interface ===
19
20 The fw_cfg sysfs interface described in this document is only
21 intended to display discoverable blobs (i.e., those registered
22 with the file directory), as there is no way to determine the
23 presence or size of "legacy" blobs (with selector keys between
24 0x0002 and 0x0018) programmatically.
25
26 All fw_cfg information is shown under:
27
28 /sys/firmware/qemu_fw_cfg/
29
30 The only legacy blob displayed is the fw_cfg device revision:
31
32 /sys/firmware/qemu_fw_cfg/rev
33
34 --- Discoverable fw_cfg blobs by selector key ---
35
36 All discoverable blobs listed in the fw_cfg file directory are
37 displayed as entries named after their unique selector key
38 value, e.g.:
39
40 /sys/firmware/qemu_fw_cfg/by_key/32
41 /sys/firmware/qemu_fw_cfg/by_key/33
42 /sys/firmware/qemu_fw_cfg/by_key/34
43 ...
44
45 Each such fw_cfg sysfs entry has the following values exported
46 as attributes:
47
48 name : The 56-byte nul-terminated ASCII string used as the
49 blob's 'file name' in the fw_cfg directory.
50 size : The length of the blob, as given in the fw_cfg
51 directory.
52 key : The value of the blob's selector key as given in the
53 fw_cfg directory. This value is the same as used in
54 the parent directory name.
55 raw : The raw bytes of the blob, obtained by selecting the
56 entry via the control register, and reading a number
57 of bytes equal to the blob size from the data
58 register.
59
60 --- Listing fw_cfg blobs by file name ---
61
62 While the fw_cfg device does not impose any specific naming
63 convention on the blobs registered in the file directory,
64 QEMU developers have traditionally used path name semantics
65 to give each blob a descriptive name. For example:
66
67 "bootorder"
68 "genroms/kvmvapic.bin"
69 "etc/e820"
70 "etc/boot-fail-wait"
71 "etc/system-states"
72 "etc/table-loader"
73 "etc/acpi/rsdp"
74 "etc/acpi/tables"
75 "etc/smbios/smbios-tables"
76 "etc/smbios/smbios-anchor"
77 ...
78
79 In addition to the listing by unique selector key described
80 above, the fw_cfg sysfs driver also attempts to build a tree
81 of directories matching the path name components of fw_cfg
82 blob names, ending in symlinks to the by_key entry for each
83 "basename", as illustrated below (assume current directory is
84 /sys/firmware):
85
86 qemu_fw_cfg/by_name/bootorder -> ../by_key/38
87 qemu_fw_cfg/by_name/etc/e820 -> ../../by_key/35
88 qemu_fw_cfg/by_name/etc/acpi/rsdp -> ../../../by_key/41
89 ...
90
91 Construction of the directory tree and symlinks is done on a
92 "best-effort" basis, as there is no guarantee that components
93 of fw_cfg blob names are always "well behaved". I.e., there is
94 the possibility that a symlink (basename) will conflict with
95 a dirname component of another fw_cfg blob, in which case the
96 creation of the offending /sys/firmware/qemu_fw_cfg/by_name
97 entry will be skipped.
98
99 The authoritative list of entries will continue to be found
100 under the /sys/firmware/qemu_fw_cfg/by_key directory.