lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 26 Feb 2021 10:46:03 +0800
From:   Jie Deng <jie.deng@...el.com>
To:     Viresh Kumar <viresh.kumar@...aro.org>
Cc:     linux-i2c@...r.kernel.org,
        virtualization@...ts.linux-foundation.org,
        linux-kernel@...r.kernel.org, mst@...hat.com, jasowang@...hat.com,
        wsa+renesas@...g-engineering.com, wsa@...nel.org,
        andriy.shevchenko@...ux.intel.com, jarkko.nikula@...ux.intel.com,
        jdelvare@...e.de, Sergey.Semin@...kalelectronics.ru,
        krzk@...nel.org, rppt@...nel.org, loic.poulain@...aro.org,
        tali.perry1@...il.com, bjorn.andersson@...aro.org,
        shuo.a.liu@...el.com, conghui.chen@...el.com, yu1.wang@...el.com,
        Alex Bennée <alex.bennee@...aro.org>,
        Vincent Guittot <vincent.guittot@...aro.org>
Subject: Re: [PATCH v4] i2c: virtio: add a virtio i2c frontend driver


On 2021/2/25 15:21, Viresh Kumar wrote:
> 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 ?

This v4 was the old version before the specification was acked by the 
virtio tc.

Following is the latest specification.

https://raw.githubusercontent.com/oasis-tcs/virtio-spec/master/virtio-i2c.tex

I will send the v5 since the host/guest ABI changes.

Thanks.

Powered by blists - more mailing lists