Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3479102pxv; Mon, 28 Jun 2021 05:34:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLbJ89YXRnBhEfdpdYoHVWCtPHa2y6SG2l3Gb/v93wBCrcwXN2baY0QsfYMKaCHIoRvQOn X-Received: by 2002:a17:907:2651:: with SMTP id ar17mr24134482ejc.135.1624883694053; Mon, 28 Jun 2021 05:34:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624883694; cv=none; d=google.com; s=arc-20160816; b=PZhtbOUA1nf1M+VXTYB+j0pJy3UXd1Abgk6kuREdhsoG8osDGxlyz1lmLttnwXrIGZ xh2bTuqBKoHqhb0S2GT4wJvc081dUC1gPmSJlt2xRDOtE/9pMaGwDByuB+zJwGDgGADO 40xuPlsUGPdjFHJfR55eAchLspbA/yf1bbuBDYYJbD/D4eRWiEJ/bNnUMA6xRSW7blHq 5X3n5pFkxqa9BRgVpjFvc+pjbSQWUt4v79h/HvQ+90t4sfA27Q/NTRWCI1uQL/KhZbm4 F41K5hV1Jb+4c/5E8gpOkVLK9gDaac+xrLq+h4RNxaNG0HazOGDc1OEfHY4tlPOe+EjJ pOmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=glWq8xarC14JAkh2dHGQFdARabRQiLZXkKAsk0msb5U=; b=qabQWa5SBwSiTqxcudRXx3v91n2r5KSzr/ZXIyfRTjEY8i1DiJGc7d95nanAz3ws9p E+/kUloddgmlpZN5JKjCMhsaVACFCeuNEeLfAqoX8PtCIi5A1gyZkQcxiRIVoCIY5/Lp +bU7hvG3c7pfFC/PCfhNz4e8E4XKmO+TM3HTcuywLlaa6GqXtbinl5/8GtklAydjNuEm d+yJ4PREdQ0jGVZDqUVCi8vLSPBfU5XH4FMnzGP6A+JQoAqguo/zJF0d+ounZqswfkKy mkYkkrgIRKY859WUwJoiGkR8xWnbsLJ7wholR1TlbfGnsNv/3APJV9rkIV5yOq/e7h0y 64IA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l6si11126138edw.533.2021.06.28.05.34.30; Mon, 28 Jun 2021 05:34:54 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232725AbhF1Lzz (ORCPT + 99 others); Mon, 28 Jun 2021 07:55:55 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:47311 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232624AbhF1Lzw (ORCPT ); Mon, 28 Jun 2021 07:55:52 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]) by mrelayeu.kundenserver.de (mreue108 [213.165.67.113]) with ESMTPSA (Nemesis) id 1Mz9hF-1l2pcd13qt-00wF9x; Mon, 28 Jun 2021 13:53:24 +0200 Received: by mail-wr1-f42.google.com with SMTP id u8so7633457wrq.8; Mon, 28 Jun 2021 04:53:24 -0700 (PDT) X-Gm-Message-State: AOAM5337nIPre6DkoebwL0XVS2DUUp5feFqEre95wciyOd8v9mMO4bVN fjh4Om6mgCJinbOGPTH2FkyMDelYYzNZ7ZjBRYk= X-Received: by 2002:adf:e107:: with SMTP id t7mr26147077wrz.165.1624881203891; Mon, 28 Jun 2021 04:53:23 -0700 (PDT) MIME-Version: 1.0 References: <226a8d5663b7bb6f5d06ede7701eedb18d1bafa1.1616493817.git.jie.deng@intel.com> In-Reply-To: From: Arnd Bergmann Date: Mon, 28 Jun 2021 13:50:53 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v10] i2c: virtio: add a virtio i2c frontend driver To: Wolfram Sang , Arnd Bergmann , Jie Deng , 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=2DK=C3=B6nig?= , Bjorn Andersson , yu1.wang@intel.com, shuo.a.liu@intel.com, Viresh Kumar , Stefan Hajnoczi , Paolo Bonzini Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:gGi3h1CRILr1ecBD6YdtnUVxZDVOdsWKttG3fVwPzk89d4YD7Qf qIJtUlWlDHPs5iaVEEsqhavkFhhzyNrxaVeOX+SdBJO3mAvw+EZqRhqWkae/RZq9l2xE0p4 MhNUluf3gAp9azfKnANYPhic5DJxpq0E/hwnasFz2Qfqmeml6OdYBf4RaOfFYdu2Euqy6ZP BmCHL2XfcDPjWN5ZfHsGg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:3QO04RmNmPA=:PZDqGGRW72Kl8+rxL9P3xR gsXPRmNFWBFXJx3vjkApxQVZl1Ec/OKBTGupe6P4xg1aBOneaeLjlNd9TedKaqgTDhUo+n/ll s42iLbZhY5/iQZ9O9rLlR0o1NLjohT8FoXZAukbcJ4YomMIOal4JRc8pQ/5K740M9b5sO7elB WffmmofttM9tIoSTAlsYBn1zPmNi4kjFOo3HrWqaLVbOo+34mkKAWIIWWHJOBQc2mkTX6xB89 Le58Hz8Sy+w4/qnQ44rCvyPKX0hXVKyqeZuL/RRjE2ES56PdKhXCKIqFFkkvgdcgxxqvTXHqp 0HN/dZnjntbvfuBMlH1JAmucxyLEveRs/xUdNfQ0YCvP+hW7tGipDTuqXX+3E9RHO7XqBL4Pv Jv0Ca0b4yCdaIM0C3r5FwiIooSjicnLB5/0imbJrVAfN4RV73QMIUmmdJeyCvJjlSMqDaaNpY gleQQDzB9d5W+xMLUtWGwYzpcxiEdihNYyd7tMNSNTZ3Aw0F0Kxf/CpPeL4R0nK8gguabfwWl ouk36WU2cO1ffDpfKT1y/PoJ6OPYs/DNFegtRX1X0ds93vC05eFLyBBW2yCJ2f6Jvmu9XTlmy m7tLBTeR/NAAgmrMncHRsjG9Lr945A1CaZF6CSfsJrz7J5rHn5vzEkGbe6W3PX/DPpvPQupHL XFZA= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 28, 2021 at 12:13 PM Wolfram Sang wrote: > > > > Ok, that's what I thought. There is one corner case that I've struggled > > with though: Suppose the host has an SMBus-only driver, and the > > proposed driver exposes this as an I2C device to the guest, which > > makes it available to guest user space (or a guest kernel driver) > > using the emulated smbus command set. Is it always possible for > > the host user space to turn the I2C transaction back into the > > expected SMBus transaction on the host? > > If an SMBus commands gets converted to I2C messages, it can be converted > back to an SMBus command. I don't see anything preventing that right > now. However, the mapping-back code does look a bit clumsy, now that I > envision it. Maybe it is better, after all, to support I2C_SMBUS > directly and pass SMBus transactions as is. It should be a tad more > effiecient, too. You can fine Viresh's vhost-user implementation at https://lore.kernel.org/qemu-devel/cover.1617278395.git.viresh.kumar@linaro.org/t/#m3b5044bad9769b170f505e63bd081eb27cef8db2 As you say, it does get a bit clumsy, but I think there is also a good argument to be made that the clumsiness is based on the host Linux user interface more than the on the requirements of the physical interface, and that should not have to be reflected in the virtio specification. > Speaking of it, I recall another gory detail: SMBus has transfers named > "read block data" and "block process call". These also need special > support from I2C host controllers before they can be emulated because > the length of the read needs to be adjusted in flight. These commands > are rare and not hard to implement. However, it makes exposing what is > supported a little more difficult. Right, this one has come up before as well: the preliminary result was to assume that this probably won't be needed, but would be easy enough to add later if necessary. Arnd