From patchwork Fri Mar 4 13:38:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 548120 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp45856mag; Fri, 4 Mar 2022 06:06:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJzS/TrXiHHqlP6ST7jsK6NTn6J9BEQwLaR9Iijz4WPGBPSlg5ScAYdJJAdtGikIL56QpkW0 X-Received: by 2002:a05:6122:549:b0:330:288:f36d with SMTP id y9-20020a056122054900b003300288f36dmr17093934vko.28.1646402775952; Fri, 04 Mar 2022 06:06:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646402775; cv=none; d=google.com; s=arc-20160816; b=wDKNXiZog3IYlq4Uj4rvFag5rozrML4bc828xTz/YEX8e4G0Yp02fpRoNZaGApiEpB zOupH9vZyQQNmUeEjbcojGRW8JMb8LhjsYT+14rBzXJIRxIlqIgH3x4QVB4HJMDF9fwT UGWBqzjYZcTITaLqqia0DFaklEhQx6H2r13HTxe2aq5EZLu7claqHqC5E0k+zH2XP6sv Nb9Moa0q7mkfI6aKnjLLAs2XCrmvHFrrIVnWZhhqlg5mKM8cP7k1qQlU5KBskoltndg0 hZOFyUX2sm8n2Q2Vf7Pz0HC73c3rqsdogEC9kiyBRu+oGjWWcO7bqwOVmhudqWyKzqET XPaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :content-disposition:in-reply-to:mime-version:references:message-id :subject:to:from:date:dkim-signature; bh=xYUjGCjqDKAb5NDT97RnxRdsQlEA2CnL9zsqzwpbiAQ=; b=MqUd3LQ4Uc3oOWFaw6T4x/aFzUyuVm/cVR8+ngoajND5XX7NHrV6I2Izu7F+YKkx1k x4ZjvEeHP1aRSkOIocYpeu06PkM4OIWAYXVQrZ95xvnV0fmETtg+VJt0p55KlBqrU4rY Rfxct+xF8jIWcECBL5HiMHwRFtU0alMIOnukrNgf2GkdqcQX/zpJ6l2FNnoRZEk49Elx 4BfH/mAQvkRIcM+89oSJSyIOXU1I9NaSV11TbzrOj0F8xQhQvew3OZYcIx2h7ni/8bYZ faA0mjRNiDBPVFTQ+K3hJuVfC2eaHUvSOG+YfHbw4IRXwTud5oxdjR4d8I+FwFyU+/70 WXOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=CNAeKk+t; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x15-20020a67df8f000000b0031bf1889a06si359298vsk.350.2022.03.04.06.06.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Mar 2022 06:06:15 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=CNAeKk+t; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:56806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nQ8ZT-0000ko-Di for patch@linaro.org; Fri, 04 Mar 2022 09:06:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nQ89B-0000VH-OH for qemu-devel@nongnu.org; Fri, 04 Mar 2022 08:39:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:26831) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nQ89A-0000Uw-9K for qemu-devel@nongnu.org; Fri, 04 Mar 2022 08:39:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646401143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xYUjGCjqDKAb5NDT97RnxRdsQlEA2CnL9zsqzwpbiAQ=; b=CNAeKk+teapYSwQqCFbPfWFXPhqPfVL27dJr6E6q7I6VQmpvzcV35W5+9hix6YoH6uBy3+ TBGkIgR46xq6QGiDS0/f6GZpDrCPy0xfNKMJa/wjh09OHc+udUUHTAQZVqjpvG4MHrIvT4 lr9qDxjOWlzYNl9GHKKsnupthooheM4= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-311-AmOPkJl3MW2DIABbqANX3Q-1; Fri, 04 Mar 2022 08:39:03 -0500 X-MC-Unique: AmOPkJl3MW2DIABbqANX3Q-1 Received: by mail-wr1-f69.google.com with SMTP id h11-20020a5d430b000000b001f01a35a86fso3366577wrq.4 for ; Fri, 04 Mar 2022 05:39:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=xYUjGCjqDKAb5NDT97RnxRdsQlEA2CnL9zsqzwpbiAQ=; b=Cm5bwOWU6WxTXIr/CosAdbJYtE/MmEvoWeMX8BVew6o/bGKkO7bx68fRfBxQkbCIOW Hm5vtYYIDXgDJf+m/7s/zjG5UjyI6L/DhJlJzTPQvDBT6uG50zEuONmo09ghk2iEH/z7 DATTocsHjCExt46PmGL9nAsZsjMdA85haFKVA9H8T6i4vdTN/AKBIcqP83CpSwERwqBM 72eIAc+FJY5ioWuAK3sC9rc+WwT5zTw7WWKsVv4kQBmU7J8qUhE2QxEFSHC7noQhjzWw f7042Z+taiSQl1s4U3hYd3rrhxiwhnEpXenZT22+MP/HYdX3CPYwR9g2FYwwbZZqC1C4 e/DQ== X-Gm-Message-State: AOAM531S58VX8scoogTjOwRsTwTloi98hkHR4TH9X6nG8z3ASFmJgiwX AsVEGFsV+qoSWfRbFnznwk2XF6d1km/ifAgmf9HS8+B85PxhqNdH7Cnsm8/SfgToauLQ1BuUpdN 50RJM3d4j2SzxmQZ+0cah4OzEQUu0fWnaMDHVcP7JdKejPNIR83P8+5EmufN+ X-Received: by 2002:a05:600c:4982:b0:380:e458:dbd9 with SMTP id h2-20020a05600c498200b00380e458dbd9mr7732761wmp.49.1646401141385; Fri, 04 Mar 2022 05:39:01 -0800 (PST) X-Received: by 2002:a05:600c:4982:b0:380:e458:dbd9 with SMTP id h2-20020a05600c498200b00380e458dbd9mr7732742wmp.49.1646401141080; Fri, 04 Mar 2022 05:39:01 -0800 (PST) Received: from redhat.com ([2.52.16.157]) by smtp.gmail.com with ESMTPSA id a3-20020a7bc1c3000000b00380e493660esm11183768wmj.42.2022.03.04.05.38.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 05:38:55 -0800 (PST) Date: Fri, 4 Mar 2022 08:38:52 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 12/45] hw/vhost-user-i2c: Add support for VIRTIO_I2C_F_ZERO_LENGTH_REQUEST Message-ID: <20220304133556.233983-13-mst@redhat.com> References: <20220304133556.233983-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220304133556.233983-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Alex =?utf-8?q?Benn=C3=A9e?= , Viresh Kumar Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Viresh Kumar VIRTIO_I2C_F_ZERO_LENGTH_REQUEST is a mandatory feature, that must be implemented by everyone. Add its support. Reviewed-by: Alex Bennée Signed-off-by: Viresh Kumar Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-user-i2c.h | 3 +++ hw/virtio/vhost-user-i2c.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/hw/virtio/vhost-user-i2c.h b/include/hw/virtio/vhost-user-i2c.h index deae47a76d..d8372f3b43 100644 --- a/include/hw/virtio/vhost-user-i2c.h +++ b/include/hw/virtio/vhost-user-i2c.h @@ -25,4 +25,7 @@ struct VHostUserI2C { bool connected; }; +/* Virtio Feature bits */ +#define VIRTIO_I2C_F_ZERO_LENGTH_REQUEST 0 + #endif /* _QEMU_VHOST_USER_I2C_H */ diff --git a/hw/virtio/vhost-user-i2c.c b/hw/virtio/vhost-user-i2c.c index d172632bb0..42c7f6d9e5 100644 --- a/hw/virtio/vhost-user-i2c.c +++ b/hw/virtio/vhost-user-i2c.c @@ -19,6 +19,11 @@ #define VIRTIO_ID_I2C_ADAPTER 34 #endif +static const int feature_bits[] = { + VIRTIO_I2C_F_ZERO_LENGTH_REQUEST, + VHOST_INVALID_FEATURE_BIT +}; + static void vu_i2c_start(VirtIODevice *vdev) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); @@ -113,8 +118,10 @@ static void vu_i2c_set_status(VirtIODevice *vdev, uint8_t status) static uint64_t vu_i2c_get_features(VirtIODevice *vdev, uint64_t requested_features, Error **errp) { - /* No feature bits used yet */ - return requested_features; + VHostUserI2C *i2c = VHOST_USER_I2C(vdev); + + virtio_add_feature(&requested_features, VIRTIO_I2C_F_ZERO_LENGTH_REQUEST); + return vhost_get_features(&i2c->vhost_dev, feature_bits, requested_features); } static void vu_i2c_handle_output(VirtIODevice *vdev, VirtQueue *vq)