Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1252602pxb; Thu, 4 Mar 2021 07:07:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzq0p7miXkN6jOy8Cyp0Ft3cw6y8uRY7MrmhkGhAYBfj7MPGBNk/cC+T4tvuNQDqbn9ac1y X-Received: by 2002:a17:906:2bd7:: with SMTP id n23mr4740652ejg.502.1614870425347; Thu, 04 Mar 2021 07:07:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614870425; cv=none; d=google.com; s=arc-20160816; b=gF/uQ6svuWFW8k2CD1epLI05LN+fRT95l3jh5tR9Xm42nMv49QVxbG/Of0P4SqBfQS 3tgk5RfYavGKeXvfbToJ5xIeiOQjCETvs5YkXNDHplbQzbvEovpPrKuZurOCUzB92p+W vFxnYvn36KAZnthqn/+ZfeMbyKEIawCNkb6BJW01J3lCP4d3uVaPJAowLgvrApgWThby wsNUjFP45ERHnPaHkcFjEaC3Y8X0ZvqiSyWVIBan1Ep3MF9eX9wRmSKP1UaqHFxr+dS7 yQCi8bonKf3kK7IOXW27Cw5HbcSXUXOlegtRnEFg/OgtUUoAfNw1DVeV3kr1K/r2IakW EUwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=lhnMZ4ENoesC9an41W7hRXBlWihDFnBbKFbIgxQO4pM=; b=jGe0v2FyLQCiRiXTnN1NTxROEJrhyt9XYli0T+K3eb7+vJ4/0DQucOpJe3DUCM48gV 4p+eficalOkhTJ5FwqTwBFAzMiqLBVKPcm6y0DEw9ENl7W4pgMt3vR/3gAiPGOXIt+9f vsvh3dDo36zRa+TfOp7xFtPGwQrwc8nqKb2deqwlkColM1Zn9Oq7prD2qyjRWiWY5yth QjqxjFy/RXpAWwl5L2OISmUcnfBPsNkBsh3rCy+hvFchAtHNo0Z9jPInEnf/dvswC/95 mEIqDMXpbYO2VsdgWG0jkhkSWmu8uqI1Asen9bje42UUlhZ8zNFNIV/nPY/MN+EPf1dU RA1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I2MbN9no; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gt5si10693401ejb.181.2021.03.04.07.06.41; Thu, 04 Mar 2021 07:07:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I2MbN9no; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234028AbhCDGHy (ORCPT + 99 others); Thu, 4 Mar 2021 01:07:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233609AbhCDGHX (ORCPT ); Thu, 4 Mar 2021 01:07:23 -0500 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED221C061756 for ; Wed, 3 Mar 2021 22:06:42 -0800 (PST) Received: by mail-pg1-x52b.google.com with SMTP id g4so18239875pgj.0 for ; Wed, 03 Mar 2021 22:06:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=lhnMZ4ENoesC9an41W7hRXBlWihDFnBbKFbIgxQO4pM=; b=I2MbN9nodGYFRtkulvpWrrFXJYMV1tWBKV1qB9pqMjDBT8LUXOI6KCn/jrqTHWMCp3 gB6ek4/gD56VTatjebaC9Ox0MtutSaCWwGO4kHb/B4H4EwPGCn6F6tSk+tKDm9G8cY1b hZph1RAVBHrbCEhZ7MsKvaxyjfsQhWbPn6lV7sCirzEcGbftwmg/0HEu2nWN6Sd9E0xC +VZ9nyjQxtaAfCVv+CYCtvk2n3nzvrekFX1HgL31Tg2nYMWoS5Xzmpk+gqo85yfHlGl5 m0CQe3dICfdVys0IFA7vMUTZodXnNyYgMXTVgB/fIhyDUu0PmjUH1UQzAJ9Qe5iPDQRt Jr4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=lhnMZ4ENoesC9an41W7hRXBlWihDFnBbKFbIgxQO4pM=; b=c9CCeDRz+YxWlEJDxZP5K1UPRaHsNPIq/C/Fv7+WwfWREFJFLCz8IL0KGhzvw7GxWp dif8JFLYhT2zqg4zw4HsTMLbceappLu+vEuY7aIH7hycOrsdMYacrVqQ8N+S3NIESrYN tqKOVGZ5lbQQDNTZjNrxFvWiu13BerFFyomsFQRWFw2E49bAjU23FyLCbwJ1/Hz2oSpY uoRfqNdqg0U92E1D1OyjaPFj44OqOu4hDJix7ypZ3lWDvDzhPVQ3p8mTbncRZvyGow++ DH1nuBexRjsgE62Kwqx7lNUBiH1+XrQudtNSO10SYIhI8WwLWd+JGyXdp2Bmpwn0FvMA INIQ== X-Gm-Message-State: AOAM532ukU1xYkmU4EmweZ0KI2ysZ9VL/9Du0Ds8lDedo9ZZREw9UuEz 3rYP5bOxB7nbnwMgXrHB2lmhKP5cjzmdDg== X-Received: by 2002:a05:6a00:1345:b029:1e3:d231:49cd with SMTP id k5-20020a056a001345b02901e3d23149cdmr2344636pfu.3.1614838002149; Wed, 03 Mar 2021 22:06:42 -0800 (PST) Received: from localhost ([122.171.124.15]) by smtp.gmail.com with ESMTPSA id w17sm23288081pgg.41.2021.03.03.22.06.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Mar 2021 22:06:41 -0800 (PST) Date: Thu, 4 Mar 2021 11:36:39 +0530 From: Viresh Kumar To: Jie Deng Cc: linux-i2c@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, mst@redhat.com, wsa@kernel.org, jasowang@redhat.com, wsa+renesas@sang-engineering.com, andriy.shevchenko@linux.intel.com, conghui.chen@intel.com, arnd@arndb.de, kblaiech@mellanox.com, jarkko.nikula@linux.intel.com, Sergey.Semin@baikalelectronics.ru, rppt@kernel.org, loic.poulain@linaro.org, tali.perry1@gmail.com, u.kleine-koenig@pengutronix.de, bjorn.andersson@linaro.org, yu1.wang@intel.com, shuo.a.liu@intel.com, stefanha@redhat.com, pbonzini@redhat.com, Alex =?utf-8?Q?Benn=C3=A9e?= , Vincent Guittot Subject: Re: [PATCH v6] i2c: virtio: add a virtio i2c frontend driver Message-ID: <20210304060638.7qes424vvdmptz5c@vireshk-i7> References: <9a2086f37c0a62069b67c39a3f75941b78a0039c.1614749417.git.jie.deng@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9a2086f37c0a62069b67c39a3f75941b78a0039c.1614749417.git.jie.deng@intel.com> User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04-03-21, 09:59, Jie Deng wrote: > Add an I2C bus driver for virtio para-virtualization. > > The controller can be emulated by the backend driver in > any device model software by following the virtio protocol. > > The device specification can be found on > https://lists.oasis-open.org/archives/virtio-comment/202101/msg00008.html. > > By following the specification, people may implement different > backend drivers to emulate different controllers according to > their needs. > > Co-developed-by: Conghui Chen > Signed-off-by: Conghui Chen > Signed-off-by: Jie Deng > --- Please always supply version history, it makes it difficult to review otherwise. > drivers/i2c/busses/Kconfig | 11 ++ > drivers/i2c/busses/Makefile | 3 + > drivers/i2c/busses/i2c-virtio.c | 289 ++++++++++++++++++++++++++++++++++++++++ > include/uapi/linux/virtio_i2c.h | 42 ++++++ > include/uapi/linux/virtio_ids.h | 1 + > 5 files changed, 346 insertions(+) > create mode 100644 drivers/i2c/busses/i2c-virtio.c > create mode 100644 include/uapi/linux/virtio_i2c.h > > diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig > index 05ebf75..0860395 100644 > --- a/drivers/i2c/busses/Kconfig > +++ b/drivers/i2c/busses/Kconfig > @@ -21,6 +21,17 @@ config I2C_ALI1535 > This driver can also be built as a module. If so, the module > will be called i2c-ali1535. > > +config I2C_VIRTIO > + tristate "Virtio I2C Adapter" > + depends on VIRTIO depends on I2C as well ? > + help > + If you say yes to this option, support will be included for the virtio > + I2C adapter driver. The hardware can be emulated by any device model > + software according to the virtio protocol. > + > + This driver can also be built as a module. If so, the module > + will be called i2c-virtio. > + > config I2C_ALI1563 > tristate "ALI 1563" > depends on PCI > diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile > index 615f35e..b88da08 100644 > --- a/drivers/i2c/busses/Makefile > +++ b/drivers/i2c/busses/Makefile > @@ -6,6 +6,9 @@ > # ACPI drivers > obj-$(CONFIG_I2C_SCMI) += i2c-scmi.o > > +# VIRTIO I2C host controller driver > +obj-$(CONFIG_I2C_VIRTIO) += i2c-virtio.o > + Not that it is important but I would have added it towards the end instead of at the top of the file.. > # PC SMBus host controller drivers > obj-$(CONFIG_I2C_ALI1535) += i2c-ali1535.o > obj-$(CONFIG_I2C_ALI1563) += i2c-ali1563.o > diff --git a/drivers/i2c/busses/i2c-virtio.c b/drivers/i2c/busses/i2c-virtio.c > new file mode 100644 > index 0000000..98c0fcc > --- /dev/null > +++ b/drivers/i2c/busses/i2c-virtio.c > @@ -0,0 +1,289 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Virtio I2C Bus Driver > + * > + * The Virtio I2C Specification: > + * https://raw.githubusercontent.com/oasis-tcs/virtio-spec/master/virtio-i2c.tex > + * > + * Copyright (c) 2021 Intel Corporation. All rights reserved. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include I don't think above two are required here.. > +#include > +#include > +#include same here. > +#include same here. > + And this blank line as well, since all are standard linux headers. > +#include > +#include > + > +/** > + * struct virtio_i2c - virtio I2C data > + * @vdev: virtio device for this controller > + * @completion: completion of virtio I2C message > + * @adap: I2C adapter for this controller > + * @i2c_lock: lock for virtqueue processing > + * @vq: the virtio virtqueue for communication > + */ > +struct virtio_i2c { > + struct virtio_device *vdev; > + struct completion completion; > + struct i2c_adapter adap; > + struct mutex i2c_lock; i2c_ is redundant here. "lock" sounds good enough. > + struct virtqueue *vq; > +}; > + > +/** > + * struct virtio_i2c_req - the virtio I2C request structure > + * @out_hdr: the OUT header of the virtio I2C message > + * @buf: the buffer into which data is read, or from which it's written > + * @in_hdr: the IN header of the virtio I2C message > + */ > +struct virtio_i2c_req { > + struct virtio_i2c_out_hdr out_hdr; > + u8 *buf; > + struct virtio_i2c_in_hdr in_hdr; > +}; > + > +static void virtio_i2c_msg_done(struct virtqueue *vq) > +{ > + struct virtio_i2c *vi = vq->vdev->priv; > + > + complete(&vi->completion); > +} > + > +static int virtio_i2c_send_reqs(struct virtqueue *vq, > + struct virtio_i2c_req *reqs, > + struct i2c_msg *msgs, int nr) > +{ > + struct scatterlist *sgs[3], out_hdr, msg_buf, in_hdr; > + int i, outcnt, incnt, err = 0; > + u8 *buf; > + > + for (i = 0; i < nr; i++) { > + if (!msgs[i].len) > + break; > + > + /* Only 7-bit mode supported for this moment. For the address format, > + * Please check the Virtio I2C Specification. > + */ Please use proper comment style. /* * Only 7-bit mode supported for now, check Virtio I2C * specification for format of "addr" field. */ > + reqs[i].out_hdr.addr = cpu_to_le16(msgs[i].addr << 1); > + > + if (i != nr - 1) > + reqs[i].out_hdr.flags |= VIRTIO_I2C_FLAGS_FAIL_NEXT; Since flags field hasn't been touched anywhere, directly assigning it may be better instead of |=, it makes it more readable. > + > + outcnt = incnt = 0; > + sg_init_one(&out_hdr, &reqs[i].out_hdr, sizeof(reqs[i].out_hdr)); > + sgs[outcnt++] = &out_hdr; > + > + buf = kzalloc(msgs[i].len, GFP_KERNEL); > + if (!buf) > + break; > + > + reqs[i].buf = buf; > + sg_init_one(&msg_buf, reqs[i].buf, msgs[i].len); > + > + if (msgs[i].flags & I2C_M_RD) { > + sgs[outcnt + incnt++] = &msg_buf; > + } else { > + memcpy(reqs[i].buf, msgs[i].buf, msgs[i].len); > + sgs[outcnt++] = &msg_buf; > + } > + > + sg_init_one(&in_hdr, &reqs[i].in_hdr, sizeof(reqs[i].in_hdr)); > + sgs[outcnt + incnt++] = &in_hdr; > + > + err = virtqueue_add_sgs(vq, sgs, outcnt, incnt, &reqs[i], GFP_KERNEL); > + if (err < 0) { > + pr_err("failed to add msg[%d] to virtqueue.\n", i); > + kfree(reqs[i].buf); > + reqs[i].buf = NULL; > + break; > + } > + } > + > + return i; > +} > + > +static int virtio_i2c_complete_reqs(struct virtqueue *vq, > + struct virtio_i2c_req *reqs, > + struct i2c_msg *msgs, int nr) > +{ > + struct virtio_i2c_req *req; > + unsigned int len; > + int i; > + > + for (i = 0; i < nr; i++) { > + req = (struct virtio_i2c_req *)virtqueue_get_buf(vq, &len); No need of cast here since return type is void *. > + if (!(req && req == &reqs[i])) { I find this less readable compared to: if (!req || req != &reqs[i]) { > + pr_err("msg[%d]: addr=0x%x virtqueue error.\n", i, msgs[i].addr); > + break; > + } > + > + if (req->in_hdr.status != VIRTIO_I2C_MSG_OK) { > + pr_err("msg[%d]: addr=0x%x backend error.\n", i, msgs[i].addr); > + break; > + } For all the above errors where you simply break out, you still need to free the memory for buf, right ? > + > + if (msgs[i].flags & I2C_M_RD) > + memcpy(msgs[i].buf, req->buf, msgs[i].len); > + > + kfree(req->buf); > + req->buf = NULL; > + } > + > + return i; > +} > + > +static int virtio_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) > +{ > + struct virtio_i2c *vi = i2c_get_adapdata(adap); > + struct virtqueue *vq = vi->vq; > + struct virtio_i2c_req *reqs; > + unsigned long time_left; > + int ret, nr; > + > + reqs = kcalloc(num, sizeof(*reqs), GFP_KERNEL); > + if (!reqs) > + return -ENOMEM; > + > + mutex_lock(&vi->i2c_lock); I have never worked with i2c stuff earlier, but I don't think you need a lock here. The transactions seem to be serialized by the i2c-core by itself (look at i2c_transfer() in i2c-core-base.c), though there is another exported version __i2c_transfer() but the comment over it says the callers must take adapter lock before calling it. > + > + ret = virtio_i2c_send_reqs(vq, reqs, msgs, num); > + if (ret == 0) > + goto err_unlock_free; > + > + nr = ret; > + > + virtqueue_kick(vq); > + > + time_left = wait_for_completion_timeout(&vi->completion, adap->timeout); > + if (!time_left) { > + dev_err(&adap->dev, "virtio i2c backend timeout.\n"); > + ret = -ETIMEDOUT; You need to free bufs of the requests here as well.. > + goto err_unlock_free; > + } > + > + ret = virtio_i2c_complete_reqs(vq, reqs, msgs, nr); > + > + reinit_completion(&vi->completion); > + > +err_unlock_free: > + mutex_unlock(&vi->i2c_lock); > + kfree(reqs); > + return ret; > +} > + > +static void virtio_i2c_del_vqs(struct virtio_device *vdev) > +{ > + vdev->config->reset(vdev); > + vdev->config->del_vqs(vdev); > +} > + > +static int virtio_i2c_setup_vqs(struct virtio_i2c *vi) > +{ > + struct virtio_device *vdev = vi->vdev; > + > + vi->vq = virtio_find_single_vq(vdev, virtio_i2c_msg_done, "msg"); > + return PTR_ERR_OR_ZERO(vi->vq); > +} > + > +static u32 virtio_i2c_func(struct i2c_adapter *adap) > +{ > + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; > +} > + > +static struct i2c_algorithm virtio_algorithm = { > + .master_xfer = virtio_i2c_xfer, > + .functionality = virtio_i2c_func, > +}; > + > +static struct i2c_adapter virtio_adapter = { > + .owner = THIS_MODULE, > + .name = "Virtio I2C Adapter", > + .class = I2C_CLASS_DEPRECATED, Why are we using something that is deprecated here ? > + .algo = &virtio_algorithm, > +}; > + > +static int virtio_i2c_probe(struct virtio_device *vdev) > +{ > + struct device *pdev = vdev->dev.parent; > + struct virtio_i2c *vi; > + int ret; > + > + vi = devm_kzalloc(&vdev->dev, sizeof(*vi), GFP_KERNEL); > + if (!vi) > + return -ENOMEM; > + > + vdev->priv = vi; > + vi->vdev = vdev; > + > + mutex_init(&vi->i2c_lock); > + init_completion(&vi->completion); > + > + ret = virtio_i2c_setup_vqs(vi); > + if (ret) > + return ret; > + > + vi->adap = virtio_adapter; > + i2c_set_adapdata(&vi->adap, vi); > + vi->adap.dev.parent = &vdev->dev; better add a blank line here. > + /* Setup ACPI node for controlled devices which will be probed through ACPI */ > + ACPI_COMPANION_SET(&vi->adap.dev, ACPI_COMPANION(pdev)); > + vi->adap.timeout = HZ / 10; > + > + ret = i2c_add_adapter(&vi->adap); > + if (ret) { > + virtio_i2c_del_vqs(vdev); > + dev_err(&vdev->dev, "failed to add virtio-i2c adapter.\n"); > + } > + > + return ret; > +} > + > +static void virtio_i2c_remove(struct virtio_device *vdev) > +{ > + struct virtio_i2c *vi = vdev->priv; > + > + i2c_del_adapter(&vi->adap); > + virtio_i2c_del_vqs(vdev); > +} > + > +static struct virtio_device_id id_table[] = { > + { VIRTIO_ID_I2C_ADPTER, VIRTIO_DEV_ANY_ID }, > + {} > +}; > +MODULE_DEVICE_TABLE(virtio, id_table); > + > +static int __maybe_unused virtio_i2c_freeze(struct virtio_device *vdev) > +{ > + virtio_i2c_del_vqs(vdev); > + return 0; > +} > + > +static int __maybe_unused virtio_i2c_restore(struct virtio_device *vdev) > +{ > + return virtio_i2c_setup_vqs(vdev->priv); > +} > + > +static struct virtio_driver virtio_i2c_driver = { > + .id_table = id_table, > + .probe = virtio_i2c_probe, > + .remove = virtio_i2c_remove, > + .driver = { > + .name = "i2c_virtio", > + }, > +#ifdef CONFIG_PM_SLEEP > + .freeze = virtio_i2c_freeze, > + .restore = virtio_i2c_restore, > +#endif > +}; > +module_virtio_driver(virtio_i2c_driver); > + > +MODULE_DESCRIPTION("Virtio i2c bus driver"); You can add module-author as well here. > +MODULE_LICENSE("GPL"); > diff --git a/include/uapi/linux/virtio_i2c.h b/include/uapi/linux/virtio_i2c.h > new file mode 100644 > index 0000000..00f4508 > --- /dev/null > +++ b/include/uapi/linux/virtio_i2c.h > @@ -0,0 +1,42 @@ > +/* SPDX-License-Identifier: GPL-2.0-or-later WITH Linux-syscall-note */ > +/* > + * 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 > + > +#include > +#include > +#include Any file (header or c) should only include what it directly needs and nothing else. And so you should need only types.h here and nothing else. > + > +/** > + * struct virtio_i2c_out_hdr - the virtio I2C message OUT header > + * @addr: the controlled device address > + * @padding: used to pad to full dword > + * @flags: used for feature extensibility > + */ > +struct virtio_i2c_out_hdr { > + __le16 addr; > + __le16 padding; > + __le32 flags; > +}; It might be worth setting __packed for the structures here, even when we have taken care of padding ourselves, for both the structures.. > + > +/* The bit 0 of the @virtio_i2c_out_hdr.@flags, used to group the requests */ > +#define VIRTIO_I2C_FLAGS_FAIL_NEXT 0x00000001 > + I would define this before the above structure. > +/** > + * struct virtio_i2c_in_hdr - the virtio I2C message IN header > + * @status: the processing result from the backend > + */ > +struct virtio_i2c_in_hdr { > + u8 status; > +}; > + > +/* The final status written by the device */ > +#define VIRTIO_I2C_MSG_OK 0 > +#define VIRTIO_I2C_MSG_ERR 1 > + > +#endif /* _UAPI_LINUX_VIRTIO_I2C_H */ > diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h > index bc1c062..6ae32db 100644 > --- a/include/uapi/linux/virtio_ids.h > +++ b/include/uapi/linux/virtio_ids.h > @@ -54,5 +54,6 @@ > #define VIRTIO_ID_FS 26 /* virtio filesystem */ > #define VIRTIO_ID_PMEM 27 /* virtio pmem */ > #define VIRTIO_ID_MAC80211_HWSIM 29 /* virtio mac80211-hwsim */ > +#define VIRTIO_ID_I2C_ADPTER 34 /* virtio i2c adpter */ > > #endif /* _LINUX_VIRTIO_IDS_H */ Thanks for yet another version Jie. -- viresh