Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp319892pxb; Thu, 25 Feb 2021 03:31:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJws648yWah4jaDFLMlb84IHI0WNvRNNgB+55YXstEsE3w7RrULqSpW2qXpqyGD2hcnC0zvO X-Received: by 2002:a17:906:5797:: with SMTP id k23mr2134902ejq.489.1614252702096; Thu, 25 Feb 2021 03:31:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614252702; cv=none; d=google.com; s=arc-20160816; b=Rs5qilpfjAgeG91yIF6pg2QzlnCOarMbfvj8BQzZJR40aTyDcu9S2FtL3pnWkDxjY/ qzg6c1d/gpxJ0DH9957ObFGB35j2jaRFS+FM/UpbM7IBi8U1IQ+kmNYwUvfRAqOAnr3B 8H3VzJYL4An2iCPnS6tEbxE4LAFbmKQf38E6jlZOmzSDjph/J3vG1iyGp7X0TUspf8Hp Rn/3832taZyQyKyvmnIadxRH2GpOqNQ+QQrZFd04KrP2UCDaJqEcCwUaKe9Nkd5AdlyL Pe/m3hPMev/nBHzKFfT+Ik7s3bMaQGwp8bjqcu7EsLorsNBXKPs2kAQLfF0oZ5PGkFke PaNQ== 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=sUB9b8mLBADiFLajYbNzAcV1Flm8kvOKL0eDsmGOshw=; b=Y4vUwNES0WiR4+CHBVFRCnLg9uUxtwEPh71ICTF1C4QJKfbQ4Tkn/FmMSGgRra2nKK Ysnidc8UUwviFmmVJ7M8m6apgwlIfpWMW+BOH8GNmppU/PbjofZckv8Y0ltrfcIgVn6t 4v3t8PxTNztetg7gvsGlNYutJQKoRhe7m83RRxpn/SVeqp2Qc2/6QK+dxmJ9gVvdnBHY Q4enCMUirfFX34Q8YkW/3A5w44qxLYOQGpT5+KMyUA1cAwctOzkvFLe6lyNobl4+SOU+ Llz3vRkcSFLGAtDe/ceaA9tUQB36ll5/a49Y95Rcg5w9mEYuKhxfA5MQIM1KgnbBv2MH 5sug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rRxk3WXA; 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 i10si3240832ejd.572.2021.02.25.03.30.44; Thu, 25 Feb 2021 03:31:42 -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=rRxk3WXA; 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 S231604AbhBYHV7 (ORCPT + 99 others); Thu, 25 Feb 2021 02:21:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbhBYHV6 (ORCPT ); Thu, 25 Feb 2021 02:21:58 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00425C06174A for ; Wed, 24 Feb 2021 23:21:17 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id q204so1972910pfq.10 for ; Wed, 24 Feb 2021 23:21:17 -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=sUB9b8mLBADiFLajYbNzAcV1Flm8kvOKL0eDsmGOshw=; b=rRxk3WXAnemwR8JSd7hgJ+KgPv/k+ig/DP9xx2/NLcKoaaoeKX1pxbb6hIEE386jJJ PO48+Dg14MKVC6lLs/ofDX2rnvlLiA/aVqGj82xqxmNwENOmEvaz7BQQ/82oRM2MpRBP Hp0c5j+YpMgsV24eMJFJX9TMfhWdtcCPfpFIkWp8Z1lohgC8m1SmCT0qh4zYDldUZeEY TnylPwDFMED3Pm/M36PBg0t5saa8RuTO6yftzssmVtmumLuJCV1r3D7ei9iq/TeygPwD jlhKF51ZMA7pj3M87TLoclEfbf7ulX0zA38a87Ef8OPMYNYepr4fNfrbLzr2X7RGiO9c 6EGg== 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=sUB9b8mLBADiFLajYbNzAcV1Flm8kvOKL0eDsmGOshw=; b=Cs1Mllk6D1cQfd5+5xKOwZ+N+T6F0RnuMJn1uRXVSgaHV/jP+p2ICXXfNtEJUF1Y6n LwHv71bL7KW9FOVT8RAvkmcY5Y5GyyNROsxtbJ4uSV9CeGz4vy1sXYewOfAun3+wAyBY b6MV74aYj/FU7y0bbwNQweMP+v3QnKhO/yP++nDVlXuuIHBJglJmVMtcFQhNovXrnV6T 7wMlqQ12kCeTZp6rmzQ5bh8LOx+7OTVImHl0cOAKxpJB85mRmZj4qbPI6ySZyLWRMM5u w8u9giDT0YLruWgHEYoxI1+/zSUFuUG6Ljt/21on3c9uan6gvvrgXMf1bdklrlceVRyQ ceLA== X-Gm-Message-State: AOAM530p0tWgdjihBo2vjyqgOKz319elCAujp62UzKzPZVcv6UWnwvR6 iWzWVzL9khfKX3Ui13ynTfQO2A== X-Received: by 2002:aa7:9e04:0:b029:1ed:996a:abb4 with SMTP id y4-20020aa79e040000b02901ed996aabb4mr1950169pfq.5.1614237677470; Wed, 24 Feb 2021 23:21:17 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id k9sm4639497pji.8.2021.02.24.23.21.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Feb 2021 23:21:16 -0800 (PST) Date: Thu, 25 Feb 2021 12:51:14 +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, 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 =?utf-8?Q?Benn=C3=A9e?= , Vincent Guittot Subject: Re: [PATCH v4] i2c: virtio: add a virtio i2c frontend driver Message-ID: <20210225072114.iwmtaexl3dkihlba@vireshk-i7> References: <7c5e44c534b3fd07b855af22d8d4b78bc44cd7a4.1602465440.git.jie.deng@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7c5e44c534b3fd07b855af22d8d4b78bc44cd7a4.1602465440.git.jie.deng@intel.com> User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > +#include > +#include > + > +/** > + * 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