From patchwork Thu Feb 10 11:04:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 541429 Delivered-To: patch@linaro.org Received: by 2002:a5d:59ac:0:0:0:0:0 with SMTP id p12csp2059776wrr; Thu, 10 Feb 2022 03:06:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJz23NRbsbJOnxWuTWcgQxmEehf4IgBr+fcJnnAG+MThZBApaaFdagKqyzR95ZqJl1w05ncx X-Received: by 2002:a25:6dc1:: with SMTP id i184mr6359262ybc.151.1644491211482; Thu, 10 Feb 2022 03:06:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644491211; cv=none; d=google.com; s=arc-20160816; b=fWMmwP3VX0kwtH99RWSeMBpfDfciQ4XnWJhbDGAK/uEFnSn6D/4PCwo1Jw8yWR9O4Z LqmRM9xkXdjncCzt+LINxlQykYueVQpp1KVuhGC+C1a5kRE347wNUDZR3jwQ+KJQdzra 2Z8yNl/yhGbBmNjBdXqAoAzE0eDkvOB/FjlcaHYq5UVtYVB00PWpWd6lbWj3bhJE4DkO l1k+UqXkoX29HW6epF1T7hqk5/oS1g6tpLZqG8XYH+f/sxxCuq92foLwlo80cgG5jKvb aoHj5u9+avuJOMIC/NGkHzUGYEqgfxqvOQMNA6iUQWcxGMqjQQWX+md6ekPAM4mLM3AW aE3w== 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 :mime-version:message-id:date:subject:to:from:dkim-signature; bh=yTJns6fdcOtlD/K+Iqk8JaH26SG5pW+Pxg5Zfqp1+ks=; b=uJ9Y92pOlJ1g+4s/RM+dQ7dtyYkLGDAI2AI5rRvdDVmn+2OlPAAjuzW8fmS904miB1 ILjI+b1w8B+fW2hV8eo/iI3lQLAq/bkQ/qCnv672kcTGUfJwMzGO0ZRf7cbpKBJhC33V +Tn515ZYEzfwNdTnBK4Y9dpuqQhej0q5E3Hxw93q0HqH74H9zh5Mo1OTHQjM95mMzDe0 vTVvrIk2eBxKQ+Tsgm1kvgftY2o0bpsA75RZ/6XQtE1xvXvB69XIW666kcuTm25oSvRt vvB2OejPl9gWVQkQz8NhDLF5ylWo1T3k9AZsVt/6zD+rMnPwiSI8wo0eKHuRJpsqOPEl hZ1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ojvMIVcM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j5si14642552ybu.17.2022.02.10.03.06.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Feb 2022 03:06:51 -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=pass header.i=@linaro.org header.s=google header.b=ojvMIVcM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nI7Hm-0007lV-TZ for patch@linaro.org; Thu, 10 Feb 2022 06:06:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nI7FS-0007jv-Mc for qemu-devel@nongnu.org; Thu, 10 Feb 2022 06:04:27 -0500 Received: from [2607:f8b0:4864:20::434] (port=38464 helo=mail-pf1-x434.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nI7FJ-0002kw-BU for qemu-devel@nongnu.org; Thu, 10 Feb 2022 06:04:25 -0500 Received: by mail-pf1-x434.google.com with SMTP id x15so7146505pfr.5 for ; Thu, 10 Feb 2022 03:04:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yTJns6fdcOtlD/K+Iqk8JaH26SG5pW+Pxg5Zfqp1+ks=; b=ojvMIVcMMD33FcQPHx0f6Gc6D982P08nCDeFXwiz91LqEIzgum5h1mXp2VJqaI+rtt RBQOFun8mjxqHQvFA3h33MZ83Rso27kyVeTMLnChU9p5RRpgHZljGPDYT8yQKa55zKKV vYUEMJsx5GBd28eS/tInqwycMHWRtKLoRWq4DEyBJTHtfewRGVC6BTYhDPOoYaCsARID WXihL0nhONJ++rK9zKtVUQUbflFyEwxi6VYKRd+cfy1zI8BB9mS05b/z0EfKA+qWeVJr 89AxJ/4EagveMhSb0JbrpriaRK7aE0SxJYY+uxuYHhkZ+cI9tVOC4SRpmo7HBqrtjuIH HJEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yTJns6fdcOtlD/K+Iqk8JaH26SG5pW+Pxg5Zfqp1+ks=; b=Oe9wIp6LCsbziiHahY6Fpirtte/ddCgWVTCY9Fffmd83mT8NJftpbSRQ3LOM4PBASz I/JAJersG0QJv9lNiNbYB1gbW0jWrBaPuk/KnNOG3UooKcceUaWNkyHzzMtnvZe6/MU4 pleIUuHiKBLCIuXmsy2mhE9cDM3Py4Itl8lPldk3H0knFylVKKwiXFMGB9KE1cw6+r0A RmfhKIi9SBxKGlcl9QynM6puJIXzxNVHPu2wnSz788K+9tbo4nK3VY0AdoXghhbR8J1U HOFXeXNH5iwZ/NJDIhbHAmPGw21y2BdtcYsZgTcDDPkUEEV6JyknpbD6It7ynlOMWvkU 9zPg== X-Gm-Message-State: AOAM531Jujr8E5ETP8YV7KNX7DfhTY02oSzZE8o95vPHBUjnGvreC90N pJdiLlTB22nu6g8T2J2ipDK3NwxmiW5YJA== X-Received: by 2002:a63:d318:: with SMTP id b24mr5751516pgg.255.1644491050197; Thu, 10 Feb 2022 03:04:10 -0800 (PST) Received: from localhost ([136.185.132.167]) by smtp.gmail.com with ESMTPSA id f3sm23516175pfe.43.2022.02.10.03.04.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 03:04:09 -0800 (PST) From: Viresh Kumar To: qemu-devel@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , "Michael S. Tsirkin" Subject: [PATCH V2] hw/vhost-user-i2c: Add support for VIRTIO_I2C_F_ZERO_LENGTH_REQUEST Date: Thu, 10 Feb 2022 16:34:02 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::434 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=viresh.kumar@linaro.org; helo=mail-pf1-x434.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: Viresh Kumar , Vincent Guittot , stratos-dev@op-lists.linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- V2: - Add missing VHOST_INVALID_FEATURE_BIT. - Add reviewed-by tag. hw/virtio/vhost-user-i2c.c | 11 +++++++++-- include/hw/virtio/vhost-user-i2c.h | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-user-i2c.c b/hw/virtio/vhost-user-i2c.c index d172632bb0cd..42c7f6d9e5bb 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) diff --git a/include/hw/virtio/vhost-user-i2c.h b/include/hw/virtio/vhost-user-i2c.h index deae47a76d55..d8372f3b43ea 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 */