From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01FF6C433DB for ; Thu, 25 Mar 2021 05:11:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5EB4961A10 for ; Thu, 25 Mar 2021 05:11:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5EB4961A10 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPIGq-0006yi-4G for qemu-devel@archiver.kernel.org; Thu, 25 Mar 2021 01:11:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60404) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPIFf-00067e-AP for qemu-devel@nongnu.org; Thu, 25 Mar 2021 01:09:47 -0400 Received: from mga06.intel.com ([134.134.136.31]:50058) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPIFc-0002Sx-T8 for qemu-devel@nongnu.org; Thu, 25 Mar 2021 01:09:46 -0400 IronPort-SDR: 9gbW/26zcDJmjZWb8/GnMYC8KFm/ZBjcWA5Jfwb4nVOBtnbWL4FOuDgPr4cHBx6l4SD1SBKNT9 L9RtPgcW6syg== X-IronPort-AV: E=McAfee;i="6000,8403,9933"; a="252207589" X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="252207589" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2021 22:09:36 -0700 IronPort-SDR: RJjDuwFLj7h/56yl0w52w+qnJ6tBtzKfblcYN9BV6cOsCvubVUSQmZAG4vjgdk0PjbGI/+Q87t LYZFlxksIxcQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,276,1610438400"; d="scan'208";a="374917420" Received: from unknown (HELO [10.239.154.55]) ([10.239.154.55]) by orsmga003.jf.intel.com with ESMTP; 24 Mar 2021 22:09:34 -0700 Subject: Re: [PATCH 3/5] tools/vhost-user-i2c: Add backend driver To: Viresh Kumar , qemu-devel@nongnu.org References: From: Jie Deng Message-ID: <290a8771-7273-a898-a826-c97df6eefb1b@intel.com> Date: Thu, 25 Mar 2021 13:09:34 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Received-SPF: pass client-ip=134.134.136.31; envelope-from=jie.deng@intel.com; helo=mga06.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vincent Guittot , Bill Mills , Arnd Bergmann , Mike Holmes , =?UTF-8?Q?Alex_Benn=c3=a9e?= , stratos-dev@op-lists.linaro.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 2021/3/24 15:33, Viresh Kumar wrote: > + > +/* Definitions from virtio-i2c specifications */ > +#define VHOST_USER_I2C_MAX_QUEUES 1 > + > +/* Status */ > +#define VIRTIO_I2C_MSG_OK 0 > +#define VIRTIO_I2C_MSG_ERR 1 > + > +/* The bit 0 of the @virtio_i2c_out_hdr.@flags, used to group the requests */ > +#define VIRTIO_I2C_FLAGS_FAIL_NEXT 0x00000001 > + > +/** > + * struct virtio_i2c_out_hdr - the virtio I2C message OUT header > + * @addr: the controlled device's address > + * @padding: used to pad to full dword > + * @flags: used for feature extensibility > + */ > +struct virtio_i2c_out_hdr { > + uint16_t addr; > + uint16_t padding; > + uint32_t flags; > +} __attribute__((packed)); __le16,  __le32 ? > + > +/** > + * struct virtio_i2c_in_hdr - the virtio I2C message IN header > + * @status: the processing result from the backend > + */ > +struct virtio_i2c_in_hdr { > + uint8_t status; > +} __attribute__((packed)); > + I understand these definitions can be removed once the frontend driver is merged by the Linux ? > +/* vhost-user-i2c definitions */ > + > +#ifndef container_of > +#define container_of(ptr, type, member) ({ \ > + const typeof(((type *) 0)->member) *__mptr = (ptr); \ > + (type *) ((char *) __mptr - offsetof(type, member));}) > +#endif This seems to be a general interface.  I see there is a definition in qemu/compiler.h. Can we reuse it ?