linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/4] SysFS driver for QEMU fw_cfg device
@ 2015-11-23 15:57 Gabriel L. Somlo
  2015-11-23 15:57 ` [PATCH v5 1/4] firmware: introduce sysfs driver for QEMU's " Gabriel L. Somlo
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Gabriel L. Somlo @ 2015-11-23 15:57 UTC (permalink / raw)
  To: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, arnd-r2nGTMty4D4,
	lersek-H+wXaHxf7aLQT0dZR+AlfA, ralf-6z/3iImG2C8G8FEW9MqTrA,
	rmk+kernel-lFZ/pmaqli7XmaaqVzeoHQ, eric-WhKQ6XTQaPysTnJN9+BGXg,
	hanjun.guo-QSEj5FYQhm4dnm+yROfE0A, zajec5-Re5JQEeQqe8AvxtiuMwx3w,
	sudeep.holla-5wv7dgnIgG8, agross-sgV2jX0FEOL9JmXXK+q4OQ,
	linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: qemu-devel-qX2TKyscuCcdnm+yROfE0A,
	jordan.l.justen-ral2JQCrhuEAvxtiuMwx3w,
	mst-H+wXaHxf7aLQT0dZR+AlfA, peter.maydell-QSEj5FYQhm4dnm+yROfE0A,
	leif.lindholm-QSEj5FYQhm4dnm+yROfE0A,
	ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A,
	pbonzini-H+wXaHxf7aLQT0dZR+AlfA, kraxel-H+wXaHxf7aLQT0dZR+AlfA,
	luto-kltTT9wpgjJwATOyAt5JVQ, stefanha-Re5JQEeQqe8AvxtiuMwx3w,
	revol-GANU6spQydw

Allow access to QEMU firmware blobs, passed into the guest VM via
the fw_cfg device, through SysFS entries. Blob meta-data (e.g. name,
size, and fw_cfg key), as well as the raw binary blob data may be
accessed.

The SysFS access location is /sys/firmware/qemu_fw_cfg/... and was
selected based on overall similarity to the type of information
exposed under /sys/firmware/dmi/entries/...

New since v4:

	Documentation (Patches 1/4 and 4/4) now points to the authoritative
	file in the QEMU source tree for any details related to the "hardware
	interface" of the fw_cfg device; Only details specific to sysfs (1/4) 
	and DT (4/4) should stay in the kernel docs.

Thanks,
  --Gabriel

>New (since v3):
>
>	Patch 1/4: Device probing now works with either ACPI, DT, or
>		   optionally by manually specifying a base, size, and
>		   register offsets on the command line. This way, all
>		   architectures offering fw_cfg can be supported, although
>		   x86 and ARM get *automatic* support via ACPI and/or DT.
>
>		   HUGE thanks to Laszlo Ersek <lersek-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> for
>		   pointing out drivers/virtio/virtio_mmio.c, as an example
>		   on how to pull this off !!!
>
>		   Stefan: I saw Marc's DMA patches to fw_cfg. Since only
>		   x86 and ARM will support it starting with QEMU 2.5, and
>		   since I expect to get lots of otherwise interesting (but
>		   otherwise orthogonal) feedback on this series, I'd like
>		   to stick with ioread8() across the board for now. We can
>		   always patch in DMA support in a backward compatible way
>		   later, once this series gets (hopefully) accepted :)
>
>	Patch 2/4: (was 3/4 in v3): unchanged. Exports kset_find_obj() so
>		   modules can call it.
>
>	Patch 3/4: (was 4/4 in v3): rebased, but otherwise the same.
>		   Essentially, creates a "human readable" directory
>		   hierarchy from "path-like" tokens making up fw_cfg
>		   blob names. I'm not really sure there's a way to make
>		   this happen via udev rules, but I have at least one
>		   potential use case for doing it *before* udev becomes
>		   available (cc: Andy Lutomirski <luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>),
>		   so I'd be happy to leave this functionality in the
>		   kernel module. See further below for an illustration
>		   of this.
>
>	Patch 4/4: Updates the existing ARM DT documentation for fw_cfg,
>		   mainly by pointing at the more comprehensive document
>		   introduced with Patch 1/4 for details on the fw_cfg
>		   device interface, leaving only the specific ARM/DT
>		   address/size node information in place.
>
>>  In addition to the "by_key" blob listing, e.g.:
>>  
>>  $ tree /sys/firmware/qemu_fw_cfg/
>>  /sys/firmware/qemu_fw_cfg/
>>  |-- by_key
>>  |   |-- 32
>>  |   |   |-- key
>>  |   |   |-- name                        ("etc/boot-fail-wait")
>>  |   |   |-- raw
>>  |   |   `-- size
>>  |   |-- 33
>>  |   |   |-- key
>>  |   |   |-- name                        ("etc/smbios/smbios-tables")
>>  |   |   |-- raw
>>  |   |   `-- size
>>  |   |-- 34
>>  |   |   |-- key
>>  |   |   |-- name                        ("etc/smbios/smbios-anchor")
>>  |   |   |-- raw
>>  |   |   `-- size
>>  |   |-- 35
>>  |   |   |-- key
>>  |   |   |-- name                        ("etc/e820")
>>  |   |   |-- raw
>>  |   |   `-- size
>>  |   |-- 36
>>  |   |   |-- key
>>  |   |   |-- name                        ("genroms/kvmvapic.bin")
>>  |   |   |-- raw
>>  |   |   `-- size
>>  |   |-- 37
>>  |   |   |-- key
>>  |   |   |-- name                        ("etc/system-states")
>>  |   |   |-- raw
>>  |   |   `-- size
>>  |   |-- 38
>>  |   |   |-- key
>>  |   |   |-- name                        ("etc/acpi/tables")
>>  |   |   |-- raw
>>  |   |   `-- size
>>  |   |-- 39
>>  |   |   |-- key
>>  |   |   |-- name                        ("etc/table-loader")
>>  |   |   |-- raw
>>  |   |   `-- size
>>  |   |-- 40
>>  |   |   |-- key
>>  |   |   |-- name                        ("etc/tpm/log")
>>  |   |   |-- raw
>>  |   |   `-- size
>>  |   |-- 41
>>  |   |   |-- key
>>  |   |   |-- name                        ("etc/acpi/rsdp")
>>  |   |   |-- raw
>>  |   |   `-- size
>>  |   `-- 42
>>  |       |-- key
>>  |       |-- name                        ("bootorder")
>>  |       |-- raw
>>  |       `-- size
>>  |
>>  ...
>>  
>>  Patch 3/4 also gets us a "human readable" "by_name" listing, like so:
>>  
>>  ...
>>  |-- by_name
>>  |   |-- bootorder -> ../by_key/42
>>  |   |-- etc
>>  |   |   |-- acpi
>>  |   |   |   |-- rsdp -> ../../../by_key/41
>>  |   |   |   `-- tables -> ../../../by_key/38
>>  |   |   |-- boot-fail-wait -> ../../by_key/32
>>  |   |   |-- e820 -> ../../by_key/35
>>  |   |   |-- smbios
>>  |   |   |   |-- smbios-anchor -> ../../../by_key/34
>>  |   |   |   `-- smbios-tables -> ../../../by_key/33
>>  |   |   |-- system-states -> ../../by_key/37
>>  |   |   |-- table-loader -> ../../by_key/39
>>  |   |   `-- tpm
>>  |   |       `-- log -> ../../../by_key/40
>>  |   `-- genroms
>>  |       `-- kvmvapic.bin -> ../../by_key/36
>>  `-- rev
>

Gabriel Somlo (4):
  firmware: introduce sysfs driver for QEMU's fw_cfg device
  kobject: export kset_find_obj() for module use
  firmware: create directory hierarchy for sysfs fw_cfg entries
  devicetree: update documentation for fw_cfg ARM bindings

 .../ABI/testing/sysfs-firmware-qemu_fw_cfg         | 100 +++
 Documentation/devicetree/bindings/arm/fw-cfg.txt   |  38 +-
 drivers/firmware/Kconfig                           |  19 +
 drivers/firmware/Makefile                          |   1 +
 drivers/firmware/qemu_fw_cfg.c                     | 714 +++++++++++++++++++++
 lib/kobject.c                                      |   1 +
 6 files changed, 837 insertions(+), 36 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-firmware-qemu_fw_cfg
 create mode 100644 drivers/firmware/qemu_fw_cfg.c

-- 
2.4.3

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-11-25  2:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-23 15:57 [PATCH v5 0/4] SysFS driver for QEMU fw_cfg device Gabriel L. Somlo
2015-11-23 15:57 ` [PATCH v5 1/4] firmware: introduce sysfs driver for QEMU's " Gabriel L. Somlo
     [not found]   ` <1448294264-17388-2-git-send-email-somlo-D+Gtc/HYRWM@public.gmane.org>
2015-11-23 20:14     ` kbuild test robot
     [not found]       ` <201511240404.AFpczj7x%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-11-24 16:55         ` Gabriel L. Somlo
     [not found]           ` <20151124165553.GA22627-h65ZQ0r4j6KKUezXOiBB2eW1CriLhL8O@public.gmane.org>
2015-11-24 17:38             ` [Qemu-devel] " Eric Blake
     [not found]               ` <5654A08A.6030002-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-11-24 17:44                 ` Laszlo Ersek
2015-11-24 18:09               ` Gabriel L. Somlo
2015-11-23 15:57 ` [PATCH v5 2/4] kobject: export kset_find_obj() for module use Gabriel L. Somlo
2015-11-23 15:57 ` [PATCH v5 3/4] firmware: create directory hierarchy for sysfs fw_cfg entries Gabriel L. Somlo
2015-11-23 15:57 ` [PATCH v5 4/4] devicetree: update documentation for fw_cfg ARM bindings Gabriel L. Somlo
     [not found]   ` <1448294264-17388-5-git-send-email-somlo-D+Gtc/HYRWM@public.gmane.org>
2015-11-23 16:35     ` Laszlo Ersek
     [not found]       ` <56534067.6040401-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-11-23 16:47         ` Gabriel L. Somlo
2015-11-25  2:42     ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).