From patchwork Tue Jan 11 14:58:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 531117 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp3565584imp; Tue, 11 Jan 2022 07:04:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJyckzBSMSGJohaA1VE1/x+xHPi4s7+q/DYVLoICPaELC2v1pU8ennxIXOr0QCOF7E2pVSWq X-Received: by 2002:a05:6102:ccd:: with SMTP id g13mr2207736vst.83.1641913472918; Tue, 11 Jan 2022 07:04:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641913472; cv=none; d=google.com; s=arc-20160816; b=uGXNsp9ocj0DnbV1PRDjDuMfS8WxFCvk6THiCAFPFVvwSukMlRmPF+H1Kg3NJUksh8 jjtXJ2Z3pulR07fUQVJOcOxk3KBn6xZuFVOVN99YKnY3KjgYEYL2jptrMq9bibEWpZA4 9O0FCb3bcsd9D59iNYVabHcOLXb/3q6qjlHZf4w108T0Ex7qxIgyupjdbLbmWpOR/1Ae kH1Rn63uBNG0pSw2K0X01mmc3+JAYbEejCxW3+YCot9D/Yr9WdReo8ChdWJjEuiSpHR0 Qwf39h3CjQjJrqImEt5uMx846DfYWs8VGtTlSUkYeIk4hBVooWeZlnC1ItlJCKMDDJOe 0c2w== 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=xYgBi7meUDrNQiQckDrzllyCUb0ZOwkj0uY1sKNF5mU=; b=awdi1Cev44LTjt6/MdUy6pYfRHJiFWL4V1hNayILcCWOwNwGJAMZV5mlvkSmmAL8j8 M+5msVLGndv5r6fVoFx6omijSMzICPtxW3uKloXbBL1GYgTSCukoTLZzH50b/O2R8/7w L/p6jSwypuMsC/YYOVr9IhpOFlie/c4NlLl2X/0VzhTdJAnhwlNNhjapPbp56nHNp1i/ gQpGfpSkqnFU8cgyKXiPbu27nItJZDUX3ctE50uP697r7YKVPBNmxcxHBR7mhKjExsZS Pf/DQNNAvKYsWe48FPUL04FGJvKcuReikY2dgrdR2Er8IOCSXLy79c/Z8Y+Wflp1xe2w QMlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wZKHI4Pm; 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 p28si158632vko.176.2022.01.11.07.04.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jan 2022 07:04:32 -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=wZKHI4Pm; 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]:49188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n7IhM-0007oA-Ck for patch@linaro.org; Tue, 11 Jan 2022 10:04:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56476) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7IbX-0000Qy-ER for qemu-devel@nongnu.org; Tue, 11 Jan 2022 09:58:31 -0500 Received: from [2607:f8b0:4864:20::1036] (port=39593 helo=mail-pj1-x1036.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n7IbV-0002mp-SQ for qemu-devel@nongnu.org; Tue, 11 Jan 2022 09:58:31 -0500 Received: by mail-pj1-x1036.google.com with SMTP id c14-20020a17090a674e00b001b31e16749cso5691700pjm.4 for ; Tue, 11 Jan 2022 06:58:28 -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=xYgBi7meUDrNQiQckDrzllyCUb0ZOwkj0uY1sKNF5mU=; b=wZKHI4Pmj+50AP6AezBv3SGJmh+BgXKGVs6pf683imI/FvWlssZVMzPTrGyfiDpsAW ErCvdLWW3lgb4AZArk0CfHhYK3f3M+0MFNWy7mmZ5m3X+xUXM/7yzKCdn7SDl1IlE9Xv ZWqkyq3CByelNrqm5QIIiUMh0KmfmhTMd7b2f+1SAOCvF0/vSeKsWpqLuG1ctkAjLuw+ z4EKIMaNGO6WAvJQJt4EMAqBH4EDxIuQ94syd7j1M/smGyDaKe/s7bSYr/pY82DmBpsD JI1I4BmdTKHnHTF6/FdFfvSqm/exHgNpX9DPsYdP5bjcuaMTQ2wQentpU6CPfgT1N/5j N1YA== 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=xYgBi7meUDrNQiQckDrzllyCUb0ZOwkj0uY1sKNF5mU=; b=bViiJXymOiOSJS/Q5Gpn1Is5xyCKExhrW2A34Xo5x3uegCYHeAXmBb5iEwuHk9QvQe Tbtx8SxNeweeS3XJcs4EEMQJOLwMTWDnXDwLk/zJ6qcGHKgBLZLNXThSIp7CjDFjNQWI S5xJn5P5il7goV4fxDgm+SbJT7+NpcBC6B3MQm4GcGOkGAIXuFV/+1FIS/bfhQaKc+/A HUp5Wus3TlaOhmiH2NGv5uHg6HahFjffgU1iQBTle8DeTSUqyT294GWJPWj2n+3SDJkp HzHYu8znOqRxHd1yyTF8BDrQZa76PlmtXREv9VnQWzKz8PIKHuUjvwedQ6wPVRj8Al3M Z6WQ== X-Gm-Message-State: AOAM5333GzM1hVcOakysnV0m5rsFzYML/8+ujHr6XN7crz4cdugrvZrL bLKtsDtvClDjhtL5egG/1oyRtQ0jTl6T1Q== X-Received: by 2002:a05:6a00:114e:b0:4bc:b9f1:7215 with SMTP id b14-20020a056a00114e00b004bcb9f17215mr4764407pfm.13.1641913107801; Tue, 11 Jan 2022 06:58:27 -0800 (PST) Received: from localhost ([122.171.221.63]) by smtp.gmail.com with ESMTPSA id m19sm11226568pfk.218.2022.01.11.06.58.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 06:58:27 -0800 (PST) From: Viresh Kumar To: qemu-devel@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , "Michael S. Tsirkin" Subject: [PATCH] hw/vhost-user-i2c: Add support for VIRTIO_I2C_F_ZERO_LENGTH_REQUEST Date: Tue, 11 Jan 2022 20:28:24 +0530 Message-Id: <4f8de2059fc963bb67920a1a2f8481f969a35eec.1641912994.git.viresh.kumar@linaro.org> 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::1036 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=viresh.kumar@linaro.org; helo=mail-pj1-x1036.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, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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. Signed-off-by: Viresh Kumar Reviewed-by: Alex Bennée --- hw/virtio/vhost-user-i2c.c | 10 ++++++++-- include/hw/virtio/vhost-user-i2c.h | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-user-i2c.c b/hw/virtio/vhost-user-i2c.c index d172632bb0cd..6323a7203ae4 100644 --- a/hw/virtio/vhost-user-i2c.c +++ b/hw/virtio/vhost-user-i2c.c @@ -19,6 +19,10 @@ #define VIRTIO_ID_I2C_ADAPTER 34 #endif +static const int feature_bits[] = { + VIRTIO_I2C_F_ZERO_LENGTH_REQUEST +}; + static void vu_i2c_start(VirtIODevice *vdev) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); @@ -113,8 +117,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 */