diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-08-12 20:48:56 (GMT) |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-08-16 16:49:56 (GMT) |
commit | b754b35b089ddfea3ff7b9b1d2e99e61d726d177 (patch) | |
tree | 9875b958a0e61f8e3ec2dd2f31aeb50e60c90bd5 /Documentation | |
parent | b3c6c8bfe378309f8185d591579a3cb3aa2fe2e8 (diff) | |
download | linux-b754b35b089ddfea3ff7b9b1d2e99e61d726d177.tar.xz |
vgaarbiter: rst-ifiy and polish kerneldoc
Move the documentation into Documentation/gpu, link it up and pull in
the kernel doc.
No actual text changes except that I did polish the kerneldoc a bit,
especially for vga_client_register().
v2: Remove some rst from vga-switcheroo.rst that I don't understand,
but which seems to be the reason why the new vgaarbiter.rst sometimes
drops out of the sidebar index.
v3: Drop one level of headings and clarify the vgaarb one a bit.
v4: Fix some typos (Sean).
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
Cc: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1471034937-651-20-git-send-email-daniel.vetter@ffwll.ch
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/gpu/index.rst | 1 | ||||
-rw-r--r-- | Documentation/gpu/vga-switcheroo.rst | 2 | ||||
-rw-r--r-- | Documentation/gpu/vgaarbiter.rst (renamed from Documentation/vgaarbiter.txt) | 161 |
3 files changed, 81 insertions, 83 deletions
diff --git a/Documentation/gpu/index.rst b/Documentation/gpu/index.rst index fcac0fa..ba92f45 100644 --- a/Documentation/gpu/index.rst +++ b/Documentation/gpu/index.rst @@ -12,3 +12,4 @@ Linux GPU Driver Developer's Guide drm-uapi i915 vga-switcheroo + vgaarbiter diff --git a/Documentation/gpu/vga-switcheroo.rst b/Documentation/gpu/vga-switcheroo.rst index cbbdb99..463a74f 100644 --- a/Documentation/gpu/vga-switcheroo.rst +++ b/Documentation/gpu/vga-switcheroo.rst @@ -1,5 +1,3 @@ -.. _vga_switcheroo: - ============== VGA Switcheroo ============== diff --git a/Documentation/vgaarbiter.txt b/Documentation/gpu/vgaarbiter.rst index 014423e..0b41b05 100644 --- a/Documentation/vgaarbiter.txt +++ b/Documentation/gpu/vgaarbiter.rst @@ -1,4 +1,4 @@ - +=========== VGA Arbiter =========== @@ -19,21 +19,8 @@ control bus resources. Therefore an arbitration scheme outside of the X server is needed to control the sharing of these resources. This document introduces the operation of the VGA arbiter implemented for the Linux kernel. ----------------------------------------------------------------------------- - -I. Details and Theory of Operation - I.1 vgaarb - I.2 libpciaccess - I.3 xf86VGAArbiter (X server implementation) -II. Credits -III.References - - -I. Details and Theory of Operation -================================== - -I.1 vgaarb ----------- +vgaarb kernel/userspace ABI +--------------------------- The vgaarb is a module of the Linux Kernel. When it is initially loaded, it scans all PCI devices and adds the VGA ones inside the arbitration. The @@ -44,42 +31,52 @@ explicitly tell it by calling vga_set_legacy_decoding(). The kernel exports a char device interface (/dev/vga_arbiter) to the clients, which has the following semantics: - open : open user instance of the arbiter. By default, it's attached to - the default VGA device of the system. - - close : close user instance. Release locks made by the user - - read : return a string indicating the status of the target like: - - "<card_ID>,decodes=<io_state>,owns=<io_state>,locks=<io_state> (ic,mc)" - - An IO state string is of the form {io,mem,io+mem,none}, mc and - ic are respectively mem and io lock counts (for debugging/ - diagnostic only). "decodes" indicate what the card currently - decodes, "owns" indicates what is currently enabled on it, and - "locks" indicates what is locked by this card. If the card is - unplugged, we get "invalid" then for card_ID and an -ENODEV - error is returned for any command until a new card is targeted. - - - write : write a command to the arbiter. List of commands: - - target <card_ID> : switch target to card <card_ID> (see below) - lock <io_state> : acquires locks on target ("none" is an invalid io_state) - trylock <io_state> : non-blocking acquire locks on target (returns EBUSY if - unsuccessful) - unlock <io_state> : release locks on target - unlock all : release all locks on target held by this user (not - implemented yet) - decodes <io_state> : set the legacy decoding attributes for the card - - poll : event if something changes on any card (not just the - target) - - card_ID is of the form "PCI:domain:bus:dev.fn". It can be set to "default" - to go back to the system default card (TODO: not implemented yet). Currently, - only PCI is supported as a prefix, but the userland API may support other bus - types in the future, even if the current kernel implementation doesn't. +open + Opens a user instance of the arbiter. By default, it's attached to the + default VGA device of the system. + +close + Close a user instance. Release locks made by the user + +read + Return a string indicating the status of the target like: + + "<card_ID>,decodes=<io_state>,owns=<io_state>,locks=<io_state> (ic,mc)" + + An IO state string is of the form {io,mem,io+mem,none}, mc and + ic are respectively mem and io lock counts (for debugging/ + diagnostic only). "decodes" indicate what the card currently + decodes, "owns" indicates what is currently enabled on it, and + "locks" indicates what is locked by this card. If the card is + unplugged, we get "invalid" then for card_ID and an -ENODEV + error is returned for any command until a new card is targeted. + + +write + Write a command to the arbiter. List of commands: + + target <card_ID> + switch target to card <card_ID> (see below) + lock <io_state> + acquires locks on target ("none" is an invalid io_state) + trylock <io_state> + non-blocking acquire locks on target (returns EBUSY if + unsuccessful) + unlock <io_state> + release locks on target + unlock all + release all locks on target held by this user (not implemented + yet) + decodes <io_state> + set the legacy decoding attributes for the card + + poll + event if something changes on any card (not just the target) + + card_ID is of the form "PCI:domain:bus:dev.fn". It can be set to "default" + to go back to the system default card (TODO: not implemented yet). Currently, + only PCI is supported as a prefix, but the userland API may support other bus + types in the future, even if the current kernel implementation doesn't. Note about locks: @@ -97,29 +94,35 @@ in the arbiter. There is also an in-kernel API of the arbiter in case DRM, vgacon, or other drivers want to use it. +In-kernel interface +------------------- + +.. kernel-doc:: include/linux/vgaarb.h + :internal: -I.2 libpciaccess ----------------- +.. kernel-doc:: drivers/gpu/vga/vgaarb.c + :export: + +libpciaccess +------------ To use the vga arbiter char device it was implemented an API inside the libpciaccess library. One field was added to struct pci_device (each device -on the system): +on the system):: /* the type of resource decoded by the device */ int vgaarb_rsrc; -Besides it, in pci_system were added: +Besides it, in pci_system were added:: int vgaarb_fd; int vga_count; struct pci_device *vga_target; struct pci_device *vga_default_dev; - The vga_count is used to track how many cards are being arbitrated, so for instance, if there is only one card, then it can completely escape arbitration. - These functions below acquire VGA resources for the given card and mark those resources as locked. If the resources requested are "normal" (and not legacy) resources, the arbiter will first check whether the card is doing legacy @@ -136,44 +139,44 @@ VGA memory and IO afaik). If the card already owns the resources, the function succeeds. vga_arb_trylock() will return (-EBUSY) instead of blocking. Nested calls are supported (a per-resource counter is maintained). +Set the target device of this client. :: -Set the target device of this client. int pci_device_vgaarb_set_target (struct pci_device *dev); - For instance, in x86 if two devices on the same bus want to lock different resources, both will succeed (lock). If devices are in different buses and -trying to lock different resources, only the first who tried succeeds. +trying to lock different resources, only the first who tried succeeds. :: + int pci_device_vgaarb_lock (void); int pci_device_vgaarb_trylock (void); -Unlock resources of device. +Unlock resources of device. :: + int pci_device_vgaarb_unlock (void); Indicates to the arbiter if the card decodes legacy VGA IOs, legacy VGA Memory, both, or none. All cards default to both, the card driver (fbdev for example) should tell the arbiter if it has disabled legacy decoding, so the card can be left out of the arbitration process (and can be safe to take -interrupts at any time. +interrupts at any time. :: + int pci_device_vgaarb_decodes (int new_vgaarb_rsrc); -Connects to the arbiter device, allocates the struct - int pci_device_vgaarb_init (void); +Connects to the arbiter device, allocates the struct :: -Close the connection - void pci_device_vgaarb_fini (void); + int pci_device_vgaarb_init (void); +Close the connection :: -I.3 xf86VGAArbiter (X server implementation) --------------------------------------------- + void pci_device_vgaarb_fini (void); -(TODO) +xf86VGAArbiter (X server implementation) +---------------------------------------- X server basically wraps all the functions that touch VGA registers somehow. - -II. Credits -=========== +References +---------- Benjamin Herrenschmidt (IBM?) started this work when he discussed such design with the Xorg community in 2005 [1, 2]. In the end of 2007, Paulo Zanoni and @@ -182,11 +185,7 @@ enhancing the kernel code to adapt as a kernel module and also did the implementation of the user space side [3]. Now (2009) Tiago Vignatti and Dave Airlie finally put this work in shape and queued to Jesse Barnes' PCI tree. - -III. References -============== - -[0] http://cgit.freedesktop.org/xorg/xserver/commit/?id=4b42448a2388d40f257774fbffdccaea87bd0347 -[1] http://lists.freedesktop.org/archives/xorg/2005-March/006663.html -[2] http://lists.freedesktop.org/archives/xorg/2005-March/006745.html -[3] http://lists.freedesktop.org/archives/xorg/2007-October/029507.html +0) http://cgit.freedesktop.org/xorg/xserver/commit/?id=4b42448a2388d40f257774fbffdccaea87bd0347 +1) http://lists.freedesktop.org/archives/xorg/2005-March/006663.html +2) http://lists.freedesktop.org/archives/xorg/2005-March/006745.html +3) http://lists.freedesktop.org/archives/xorg/2007-October/029507.html |