linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Jie Deng <jie.deng@intel.com>
Cc: linux-i2c@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, mst@redhat.com,
	jasowang@redhat.com, wsa+renesas@sang-engineering.com,
	wsa@kernel.org, andriy.shevchenko@linux.intel.com,
	jarkko.nikula@linux.intel.com, jdelvare@suse.de,
	Sergey.Semin@baikalelectronics.ru, krzk@kernel.org,
	rppt@kernel.org, loic.poulain@linaro.org, tali.perry1@gmail.com,
	bjorn.andersson@linaro.org, shuo.a.liu@intel.com,
	conghui.chen@intel.com, yu1.wang@intel.com,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Vincent Guittot" <vincent.guittot@linaro.org>
Subject: Re: [PATCH v4] i2c: virtio: add a virtio i2c frontend driver
Date: Thu, 25 Feb 2021 12:51:14 +0530	[thread overview]
Message-ID: <20210225072114.iwmtaexl3dkihlba@vireshk-i7> (raw)
In-Reply-To: <7c5e44c534b3fd07b855af22d8d4b78bc44cd7a4.1602465440.git.jie.deng@intel.com>

On 12-10-20, 09:55, 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.
> 
> This driver communicates with the backend driver through a
> virtio I2C message structure which includes following parts:
> 
> - Header: i2c_msg addr, flags, len.
> - Data buffer: the pointer to the I2C msg data.
> - Status: the processing result from the backend.
> 
> People may implement different backend drivers to emulate
> different controllers according to their needs. A backend
> example can be found in the device model of the open source
> project ACRN. For more information, please refer to
> https://projectacrn.org.

> diff --git a/include/uapi/linux/virtio_i2c.h b/include/uapi/linux/virtio_i2c.h
> new file mode 100644
> index 0000000..7413e45
> --- /dev/null
> +++ b/include/uapi/linux/virtio_i2c.h
> @@ -0,0 +1,31 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause */
> +/*
> + * Definitions for virtio I2C Adpter
> + *
> + * Copyright (c) 2020 Intel Corporation. All rights reserved.
> + */
> +
> +#ifndef _UAPI_LINUX_VIRTIO_I2C_H
> +#define _UAPI_LINUX_VIRTIO_I2C_H
> +
> +#include <linux/types.h>
> +#include <linux/virtio_ids.h>
> +#include <linux/virtio_config.h>
> +
> +/**
> + * struct virtio_i2c_hdr - the virtio I2C message header structure
> + * @addr: i2c_msg addr, the slave address
> + * @flags: i2c_msg flags
> + * @len: i2c_msg len
> + */
> +struct virtio_i2c_hdr {
> +	__le16 addr;
> +	__le16 flags;
> +	__le16 len;
> +};

Hi Jie,

I am a bit confused about the header and the format in which data is being
processed here. When I look at the specification present here:

https://lists.oasis-open.org/archives/virtio-comment/202009/msg00021.html

it talks about 

struct virtio_i2c_out_hdr {
        le16 addr;
        le16 padding;
        le32 flags;
};
struct virtio_i2c_in_hdr {
        u8 status;
};

struct virtio_i2c_req {
        struct virtio_i2c_out_hdr out_hdr;
        u8 write_buf [];
        u8 read_buf [];
        struct virtio_i2c_in_hdr in_hdr;
};

while what we have above is completely different. What am I missing ?

-- 
viresh

  parent reply	other threads:[~2021-02-25  7:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-12  1:55 [PATCH v4] i2c: virtio: add a virtio i2c frontend driver Jie Deng
2020-10-12  5:45 ` kernel test robot
2020-11-25  9:35 ` Michael S. Tsirkin
2020-11-26  2:00   ` Jie Deng
2021-02-25  7:21 ` Viresh Kumar [this message]
2021-02-26  2:46   ` Jie Deng
2021-02-26  4:21     ` Viresh Kumar
2021-02-26  6:36       ` Jie Deng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210225072114.iwmtaexl3dkihlba@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=Sergey.Semin@baikalelectronics.ru \
    --cc=alex.bennee@linaro.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=conghui.chen@intel.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jasowang@redhat.com \
    --cc=jdelvare@suse.de \
    --cc=jie.deng@intel.com \
    --cc=krzk@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=mst@redhat.com \
    --cc=rppt@kernel.org \
    --cc=shuo.a.liu@intel.com \
    --cc=tali.perry1@gmail.com \
    --cc=vincent.guittot@linaro.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=wsa@kernel.org \
    --cc=yu1.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).