Thread (8 messages) flat view 8 messages, 4 authors, 2021-03-03

Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

From: Stefan Hajnoczi <stefanha@redhat.com>
Date: 2021-03-03 20:57:21
Also in: linux-i2c, lkml

On Tue, Mar 02, 2021 at 11:54:02AM +0100, Arnd Bergmann wrote:
On Tue, Mar 2, 2021 at 10:51 AM Stefan Hajnoczi [off-list ref] wrote:
quoted
On Tue, Mar 02, 2021 at 10:42:06AM +0800, Jie Deng wrote:
quoted
quoted
quoted
+/*
+ * Definitions for virtio I2C Adpter
+ *
+ * Copyright (c) 2021 Intel Corporation. All rights reserved.
+ */
+
+#ifndef _UAPI_LINUX_VIRTIO_I2C_H
+#define _UAPI_LINUX_VIRTIO_I2C_H
Why is this a uapi header? Can't this all be moved into the driver
itself?
Linux VIRTIO drivers provide a uapi header with structs and constants
that describe the device interface. This allows other software like
QEMU, other operating systems, etc to reuse these headers instead of
redefining everything.

These files should contain:
1. Device-specific feature bits (VIRTIO_<device>_F_<feature>)
2. VIRTIO Configuration Space layout (struct virtio_<device>_config)
3. Virtqueue request layout (struct virtio_<device>_<req/resp>)

For examples, see <linux/virtio_net.h> and <linux/virtio_blk.h>.
Ok, makes sense. So it's not strictly uapi but just helpful for
virtio applications to reference these. I suppose it is slightly harder
when building qemu on other operating systems though, how does
it get these headers on BSD or Windows?
qemu.git imports Linux headers from time to time and can use them
instead of system headers:

  https://gitlab.com/qemu-project/qemu/-/blob/master/scripts/update-linux-headers.sh

Stefan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help