Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4033278pxv; Mon, 28 Jun 2021 20:04:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLJh8WLqSn6lTyP9bU+XyW3qN5FmAWDkE9CnyNPEp7881uPFvcD2RJl/xxmKAto5z1DxR7 X-Received: by 2002:a92:d483:: with SMTP id p3mr8665130ilg.113.1624935868683; Mon, 28 Jun 2021 20:04:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624935868; cv=none; d=google.com; s=arc-20160816; b=DuNsF6Flr/6hTJoVS+iljAsWs83Jf/tet44oELYIMuO0zGbfBITbPAJZW2tJ2r88wp zx0ZEJxeFSCby/MGB6+PVxdvvhjtHZnHwqyBthf6+EatnfXIbz8GWp1JNoGfKJzNLfoN Ili1rWqzakCxeBaE6r4kzuaNmWPkkbhgUKRR7BhjljbV72daOVxOS0sspm7P5eSadaLg Zzv5Ti7Ocx3LkjBOw8GojbV5Yb8JR9I3STa18ytBD2Tfut27rCKX7nLtOaB5hJNFdZrH LJyuLdCuWov4TAECu22yQT1BC+V8rRiiuo5ufUCn+UBZVit7yt3yGnoFqvzrzCblfBpp ixrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject; bh=jJryHr2F1gztKJ9xUYGaJNXxPqfOfBlYy7ahAPxZzJE=; b=m7KWwWoqwLBupTDBmJdnCYBlJFiUIAo3Fo5ey1V2HJhs+AhkC6TCUiun5zsKlFkA4d PR1mgcoSmC8ScOacvxdzAf4rvBkFLInM55HH+g95UY2XwCls7plfWNbXq9v71wfMXjrU p8h392L7bYiG55iymx1HLXsNNw+Lgpvej3KMvI8cNh3r1wWK/dZ5aj2AnwGSEDhiL6aM bUGN7MP0zGLY+IvJy/sh7PBW7ortCYSKfkT26v98CG0HzmCQUHv83qEGpyDv5QRW1BZv OnTHmOCsVkdAklsFRhWQtdUr6OjczL3N2Y449P1SRUKpomdscYeqc+rqGwhjoZBaGENX bPAg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r4si16850029ioh.93.2021.06.28.20.04.16; Mon, 28 Jun 2021 20:04:28 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231700AbhF2DGQ (ORCPT + 99 others); Mon, 28 Jun 2021 23:06:16 -0400 Received: from mga12.intel.com ([192.55.52.136]:50692 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231332AbhF2DGP (ORCPT ); Mon, 28 Jun 2021 23:06:15 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10029"; a="187761273" X-IronPort-AV: E=Sophos;i="5.83,307,1616482800"; d="scan'208";a="187761273" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2021 20:03:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,307,1616482800"; d="scan'208";a="456601083" Received: from dengjie-mobl1.ccr.corp.intel.com (HELO [10.239.154.58]) ([10.239.154.58]) by fmsmga008.fm.intel.com with ESMTP; 28 Jun 2021 20:03:43 -0700 Subject: Re: [PATCH v10] i2c: virtio: add a virtio i2c frontend driver To: Arnd Bergmann , Wolfram Sang , Linux I2C , virtualization@lists.linux-foundation.org, Linux Kernel Mailing List , "Michael S. Tsirkin" , Jason Wang , Andy Shevchenko , conghui.chen@intel.com, kblaiech@mellanox.com, jarkko.nikula@linux.intel.com, Sergey Semin , Mike Rapoport , loic.poulain@linaro.org, Tali Perry , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Bjorn Andersson , yu1.wang@intel.com, shuo.a.liu@intel.com, Viresh Kumar , Stefan Hajnoczi , Paolo Bonzini References: <226a8d5663b7bb6f5d06ede7701eedb18d1bafa1.1616493817.git.jie.deng@intel.com> From: Jie Deng Message-ID: Date: Tue, 29 Jun 2021 11:03:42 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.10.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/6/28 17:01, Arnd Bergmann wrote: > On Mon, Jun 28, 2021 at 10:39 AM Wolfram Sang wrote: >> sorry for the long delay. I am not familiar with VFIO, so I had to dive >> into the topic a little first. I am still not seeing through it >> completely, so I have very high-level questions first. > You probably know this already, but just in case for clarification > these are two different things: > > VFIO: kernel feature to make raw (usually PCI) devices available > to user space drivers and virtual machines from a kernel > running on bare metal. > > virtio: transport protocol for implementing arbitrary paravirtualized > drivers in (usually) a virtual machine guest without giving the > guest access to hardware registers. > Thanks Arnd for clarification. Let me add some more: The native model is as follows: a specific native I2C driver operates a specific hardware. A specific native I2C driver  <--> A specific hardware The virtio paravirtualized model is something like: virtio-i2c <--> virtio I2C interfaces <--> virtio-backend <--> Real hardware virtio-i2c: is this driver, the frontend driver. virtio I2C interfaces: which are described in the specification. https://raw.githubusercontent.com/oasis-tcs/virtio-spec/master/virtio-i2c.tex.     I had tried to mirror Linux I2C interfaces (like "i2c_msg") into virtio I2C interface directly. But     when I was doing upstream for this specification, I understood the virtio TC had the design philosophy     "VIRTIO devices are not specific to Linux so the specs design should avoid the limitations of the     current Linux driver behavior." So we redefined a minimum virtio I2C interfaces to make a working POC.     and we may extend it in the future according to the need. virtio-backend: the backend driver communicate with virtio-i2c by following virtio I2C interfaces specs.      The are already two backend drivers developed by Viresh, one in QEMU, another in rust-vmm.      1. vhost-user: https://lore.kernel.org/qemu-devel/cover.1617278395.git.viresh.kumar@linaro.org/t/#m3b5044bad9769b170f505e63bd081eb27cef8db2      2. rust-vmm I2C backend: https://github.com/rust-vmm/vhost-device/pull/1 Regards, Jie