On Tue, Mar 02, 2021 at 11:54:02AM +0100, Arnd Bergmann wrote: > On Tue, Mar 2, 2021 at 10:51 AM Stefan Hajnoczi <stefanha@xxxxxxxxxx> wrote: > > On Tue, Mar 02, 2021 at 10:42:06AM +0800, Jie Deng wrote: > > > > > +/* > > > > > + * 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
Attachment:
signature.asc
Description: PGP signature