From nobody Fri Apr 19 18:58:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653407690; cv=none; d=zohomail.com; s=zohoarc; b=lR785b1pm9ZMYH/9yjV2kdPKihpc0LiY5lR7DFpRy0hdMBnkL/QlrJGOHjaRnOBw1U0NVeDrZJHfCgqC8YKk8q1uEF9ZaOnCQnMDVKY3go2Oc0JWrnpRMBZfDBVWQVl1ajDc3vVpw8JS3Ac4YoxE1am1al8yX2Q0PYb4iM9OJGQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653407690; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vBtL52cUVXRCn2Iw8uz2+J2VOEbS3hV9Ib2rQvMqV9g=; b=oL/mirIk4EKs9J2sQsG5drfXBvCOXnyk3SSnbgpDJo4A+k6o0i4JIG/ujvTWMTVH9wSQ2Z4z2zgMo9r0MQJfIcLVWGH9xASUMLhlFPtkAG5VXB5H7tz41zTyxL5dDWdjIr4W1ibQuYvdYLXIIoPCUOf53+H4utayIJyC4L81Rdg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653407690715843.9263730332904; Tue, 24 May 2022 08:54:50 -0700 (PDT) Received: from localhost ([::1]:35438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntWrw-00034a-It for importer2@patchew.org; Tue, 24 May 2022 11:54:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWej-00042Z-QC for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:09 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:37841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWec-0005Lz-LR for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:09 -0400 Received: by mail-wr1-x436.google.com with SMTP id t6so26286248wra.4 for ; Tue, 24 May 2022 08:41:02 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id z16-20020adfbbd0000000b0020cfed0bb7fsm13081406wrg.53.2022.05.24.08.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 08:40:57 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 7EB501FFB8; Tue, 24 May 2022 16:40:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vBtL52cUVXRCn2Iw8uz2+J2VOEbS3hV9Ib2rQvMqV9g=; b=FB+WsbPWMMXudRzX/nrHkt/8nRUQMXPRKwDKsm7ykE8csKKpJ/kuARHxSrgXx08dz5 RWNXbVpeVgNVivIVfWCV20b/ioGObn+PpBuY7UJWIANpX0Qe2tPAQlaZ9p6usidh3OhC pHbcUYy7/G9UY6FhD2L+mOZV5gcXjbZSd88S3p2vACVayEP1m+zypJjdlJtIlAs5dd8R 18z+Ot/es6sS8pyT6YS6ZkDoV2hmZtQxt2GcEpRfmj2vdrw8MlFa1uyhPsmPsHTBXuRf qAY+eFT5TQCyXKX2m7V9vLE+2yL4WOPKgRi6QNWcirJ2oayg/P0iEGEal3aEv0EKcno8 0Clg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=vBtL52cUVXRCn2Iw8uz2+J2VOEbS3hV9Ib2rQvMqV9g=; b=uhapn9sEDSjVdKxSVb8Jy4cEnJG5ha8LOnNGkAckc6OWG2IAl0pKaAc/pm/Le9Muhu /BjANOHCxByaXh99yB/RRYl40qFAV9UX6WhoaSpvV7Gc+2oLq9vPF4Eern3eupkKzPCJ SMq+lbxiQk8aVnf4kubvMMAiwYzQ8H1Bpw8eIknrO8MyjIPTQt1LGV1krhTJJicbM2/G 9OFPZTqkrPm2bdKKZD0kGZVdRpPgnc5uI3WCylKZHeiJQV71WiHFcwD8XW4Hd/kwcUEk 8PtPGkw63a1RfCKBQl8cGYfCGjoiQXeuAjJXNtjWoDVcsWH2vKf+s2E89Po/l6CAJnKL pJGg== X-Gm-Message-State: AOAM532wgON9nCNadGDjkTgsIo7PBAhcm4ePkFdT9dAivEeN9duy7KO6 PE/F1RwMjraFpmLsEp4UQeaqdA== X-Google-Smtp-Source: ABdhPJxqcBqpANL5pnIvE0Vo/DEFOEk9VZKOf/8V02Gfz1spjbNxVQsShb6bYepOxRtcSdNgAyFuwQ== X-Received: by 2002:a5d:648e:0:b0:20f:d9b6:a35f with SMTP id o14-20020a5d648e000000b0020fd9b6a35fmr9739650wri.333.1653406861281; Tue, 24 May 2022 08:41:01 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Raphael Norwitz Subject: [PATCH v2 01/15] contrib/vhost-user-blk: fix 32 bit build and enable Date: Tue, 24 May 2022 16:40:42 +0100 Message-Id: <20220524154056.2896913-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220524154056.2896913-1-alex.bennee@linaro.org> References: <20220524154056.2896913-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653407692302100001 We were not building the vhost-user-blk server due to 32 bit compilation problems. The problem was due to format string types so fix that and then enable the build. Tweak the rule to follow the same rules as other vhost-user daemons. Signed-off-by: Alex Benn=C3=A9e Message-Id: <20220321153037.3622127-12-alex.bennee@linaro.org> Reviewed-by: Raphael Norwitz Reviewed-by: Stefan Hajnoczi --- meson.build | 2 +- contrib/vhost-user-blk/vhost-user-blk.c | 6 +++--- contrib/vhost-user-blk/meson.build | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 9ebc00f032..a33ed52b7a 100644 --- a/meson.build +++ b/meson.build @@ -1489,7 +1489,7 @@ have_vhost_user_blk_server =3D get_option('vhost_user= _blk_server') \ error_message: 'vhost_user_blk_server requires linux') \ .require(have_vhost_user, error_message: 'vhost_user_blk_server requires vhost-user suppo= rt') \ - .disable_auto_if(not have_system) \ + .disable_auto_if(not have_tools and not have_system) \ .allowed() =20 if get_option('fuse').disabled() and get_option('fuse_lseek').enabled() diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-b= lk/vhost-user-blk.c index cd4a5d7335..9cb78ca1d0 100644 --- a/contrib/vhost-user-blk/vhost-user-blk.c +++ b/contrib/vhost-user-blk/vhost-user-blk.c @@ -146,7 +146,7 @@ vub_readv(VubReq *req, struct iovec *iov, uint32_t iovc= nt) req->size =3D vub_iov_size(iov, iovcnt); rc =3D preadv(vdev_blk->blk_fd, iov, iovcnt, req->sector_num * 512); if (rc < 0) { - fprintf(stderr, "%s, Sector %"PRIu64", Size %lu failed with %s\n", + fprintf(stderr, "%s, Sector %"PRIu64", Size %zu failed with %s\n", vdev_blk->blk_name, req->sector_num, req->size, strerror(errno)); return -1; @@ -169,7 +169,7 @@ vub_writev(VubReq *req, struct iovec *iov, uint32_t iov= cnt) req->size =3D vub_iov_size(iov, iovcnt); rc =3D pwritev(vdev_blk->blk_fd, iov, iovcnt, req->sector_num * 512); if (rc < 0) { - fprintf(stderr, "%s, Sector %"PRIu64", Size %lu failed with %s\n", + fprintf(stderr, "%s, Sector %"PRIu64", Size %zu failed with %s\n", vdev_blk->blk_name, req->sector_num, req->size, strerror(errno)); return -1; @@ -188,7 +188,7 @@ vub_discard_write_zeroes(VubReq *req, struct iovec *iov= , uint32_t iovcnt, =20 size =3D vub_iov_size(iov, iovcnt); if (size !=3D sizeof(*desc)) { - fprintf(stderr, "Invalid size %ld, expect %ld\n", size, sizeof(*de= sc)); + fprintf(stderr, "Invalid size %zd, expect %zd\n", size, sizeof(*de= sc)); return -1; } buf =3D g_new0(char, size); diff --git a/contrib/vhost-user-blk/meson.build b/contrib/vhost-user-blk/me= son.build index 601ea15ef5..dcb9e2ffcd 100644 --- a/contrib/vhost-user-blk/meson.build +++ b/contrib/vhost-user-blk/meson.build @@ -1,5 +1,4 @@ -# FIXME: broken on 32-bit architectures executable('vhost-user-blk', files('vhost-user-blk.c'), dependencies: [qemuutil, vhost_user], - build_by_default: false, + build_by_default: targetos =3D=3D 'linux', install: false) --=20 2.30.2 From nobody Fri Apr 19 18:58:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653407039; cv=none; d=zohomail.com; s=zohoarc; b=cZfhQiHLLrHUOV0hITKRTojx8QdWnOsN/PE6eXHlnyNRKrji4ZyD0WQTfxZOskKr9FZmrkvALeo8DoS1eBaLUW5aYP1aCDjndtPCJU6kr/y/4FmkI6oLitvo8prPGXrsSmB80iEIKjwrUMm8ojpGJ4QzwnZcDOq47URTHvD5NWI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653407039; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wuv0XY2H3KqTbh7O/QyKEXQHF+ELTPI/LNmsm5wiDv4=; b=W/EOfZJ+ty3PpQthckmWDIQWXDB2AjjMMllJa+YgjeH1tcUdjrjszO7v4bbAR6NqSgADC5FduN9B4PmPCc3nPY0jdxFYU4fAIeOep94XAWFL3EIx0kqM72WyPxwLhUG5LjoZzAex4DQTtRP9VSNxQrUg7cLPri4f1pevr51TQVU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16534070397031000.3339169048123; Tue, 24 May 2022 08:43:59 -0700 (PDT) Received: from localhost ([::1]:45556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntWhS-0006jS-6u for importer2@patchew.org; Tue, 24 May 2022 11:43:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWej-00042U-OL for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:09 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:51866) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWea-0005Lp-KS for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:09 -0400 Received: by mail-wm1-x32d.google.com with SMTP id z17so3978513wmf.1 for ; Tue, 24 May 2022 08:41:00 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id q2-20020adfb182000000b0020c5253d8d0sm13055061wra.28.2022.05.24.08.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 08:40:57 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 8C3051FFBA; Tue, 24 May 2022 16:40:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wuv0XY2H3KqTbh7O/QyKEXQHF+ELTPI/LNmsm5wiDv4=; b=lgIihCWikM2XdSIQsw1gRlsHXfdcEyoU6a2au0m2lylQxjv4oRorj1/qser3tYMsRq uhj9bcgHsl6G/aCxkzaeriMiFDGZ06r9kCL9k6R4M3TmnO+XJSe1sk4uBnXBpCwjpfgv LATH7qQ69E27UUdeO2+7ojltDfWhd1GRS/sIf7G3YsDjlgG/+Zz9WMumBRpg7MUKyTIe s+qRRgi99So67IkY621FrOpPtjg0tMYtTF4ZGlbvhxpwie7wTFHR1WX/If2YCEqHNUBh 6/vWweNEFXXs4CQGZxgeTyG78jvLDiTJW5weTAWgE1gs82SyJT59Sciopjeu3+ndJcIe NcdA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=wuv0XY2H3KqTbh7O/QyKEXQHF+ELTPI/LNmsm5wiDv4=; b=4vn/pJfxKw9a1LVxmXHKCgdO0rzVkoxygo6zbLtKFOAcooATtm5mNfjy3RsM0O5l9Y qDr4eU+32MNIGVitgktLL+YjMY3tSl7M5vZIT4kNiSkSvlZ9xmLDa1HeabFjmx7cawSo KO1CWwXsevui4fdag7Y1kTiI5/tCDp9Z+S9As2LqyZ5I0gPu/2dvb8oSV4iaq6qH/7mT KGYsvMil9wQoT4HJ0IF1zjYmdlgBnee3cJQZHyB0InwSJ8rJ/ecf5QlIO/3UHQp+iYnz aAyrIguqb/b7KscMhJRYBdLxdSnJ95fWit68slOihrZziK0pk2ZHRIaXQZk0evKbnFjk /1KQ== X-Gm-Message-State: AOAM532nu2UgPzfpw6G9Ywe3MVOK7A/UV0LsNudoi4u2xS7TgkRZbrAo GGcfag96/8UUKsSdmzjkpKIL+Q== X-Google-Smtp-Source: ABdhPJxtIvi7uAKswMNOG2G/xdqxQVaKkA62in5dR1jXwMZYFU0QtnI4zntmvydM2dg0dW0/PX+UPw== X-Received: by 2002:a7b:c841:0:b0:394:890e:9195 with SMTP id c1-20020a7bc841000000b00394890e9195mr4368259wml.59.1653406859054; Tue, 24 May 2022 08:40:59 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v2 02/15] include/hw/virtio: more comment for VIRTIO_F_BAD_FEATURE Date: Tue, 24 May 2022 16:40:43 +0100 Message-Id: <20220524154056.2896913-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220524154056.2896913-1-alex.bennee@linaro.org> References: <20220524154056.2896913-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653407040846100001 When debugging a new vhost user you may be surprised to see VHOST_USER_F_PROTOCOL getting squashed in the maze of backend_features, acked_features and guest_features. Expand the description here to help the next poor soul trying to work through this. Signed-off-by: Alex Benn=C3=A9e --- include/hw/virtio/virtio.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index db1c0ddf6b..2b2587d324 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -24,7 +24,12 @@ #include "qom/object.h" #include "hw/virtio/vhost.h" =20 -/* A guest should never accept this. It implies negotiation is broken. */ +/* + * A guest should never accept this. It implies negotiation is + * broken between the driver frontend and the device. This bit is + * re-used for vhost to advertise VHOST_USER_F_PROTOCOL_FEATURES + * between QEMU and a vhost backend. + */ #define VIRTIO_F_BAD_FEATURE 30 =20 #define VIRTIO_LEGACY_FEATURES ((0x1ULL << VIRTIO_F_BAD_FEATURE) | \ --=20 2.30.2 From nobody Fri Apr 19 18:58:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653407315; cv=none; d=zohomail.com; s=zohoarc; b=LZH6iJb2Z2lfoET2lpNlJDz2rkYQ9saaTfmyMQWhKdzyYv7v4UiBdy6ZqfbuTuNhLLaExOgrihpNwJqI2BpPEUM8RFyWdFA/gBL3yQOsu3TS0Es0/t1rNa8zXkR8xagrBzoMdT3AI9nVQkrDaxrurihj5QsIJwTLogl6H9chOSU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653407315; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FgzK20NI+E0P86TSvhLUf2mlqYDXY7EcnmvPOs0iPUg=; b=RN6kFjKVtLAARxr1QPaR8POwntIq4vOdy9xz/XHPrqhjzGB223uF/X/XmMJWbvmaSS/1s9eezS5DGhqjjcD+9pdsC/StwYi8O0rQilsLEqgmEtdlrXfa7B6wemJdv1pVdFwUdPW115xeCwZJ7C2fgyRG/LqXfpnldM8xhDoZVXg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653407315097887.9243823942444; Tue, 24 May 2022 08:48:35 -0700 (PDT) Received: from localhost ([::1]:53824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntWlq-0004CB-VI for importer2@patchew.org; Tue, 24 May 2022 11:48:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWek-00043s-OZ for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:10 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:56300) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWed-0005M5-LB for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:10 -0400 Received: by mail-wm1-x329.google.com with SMTP id y24so3091467wmq.5 for ; Tue, 24 May 2022 08:41:03 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id n32-20020a05600c3ba000b003942a244ecbsm2678034wms.16.2022.05.24.08.40.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 08:41:00 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A3B811FFBB; Tue, 24 May 2022 16:40:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FgzK20NI+E0P86TSvhLUf2mlqYDXY7EcnmvPOs0iPUg=; b=em1GXJ6ftMhEHLwhpn8kbH22HgOaqz4WxzXaq2dmxd+QYbkkAlL9KGx3JekCiN0O4n pBst2/i5nDilULaxPtrA2LhUTg1ZSWHQL43WHZEE6URO0xtXGLWX8g3/Ii/zDSFimfXj mNtXlGUGqoc2a6woXUO2LAcO1/lPLwVr8uzeQ1WWbwbY1djJaYit1yZ6/HB94HAZ7u+J Ch16Qe8UtLOshHIo/WrKnUGZsrYqhmGWOOysZmsgQ01I6RK0JtS5xzVlpPt5hI9eeE7I X/+SIB0N8e0ahca+P+i2z656zZjlHrFul/ocPXR/wlg8KHGs2NCfEkN7FXTfvamI0CEy qhYw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=FgzK20NI+E0P86TSvhLUf2mlqYDXY7EcnmvPOs0iPUg=; b=pr+BsvnPq0U/CKZXAiY9zgFU8uj8s3mJ4oq3g4etozV3kgUE+apFCnVvHOcHtOVYt5 39N+xjYygHCbQMrR6Z+lZMFDddh3D/ZL/BpK5waSZT8zmL2ZxKDf1yzTUvn781XLJT7I PIicKnJ+eZFJLp1OhCTfdQpc4zlslxBvpkTXoCUvmsC8cfafcx+In/S1YMQuXfqTjftk BdcH8UBTzXrP1+evR7y7/d2NKgBXx2l2Wl3b+GckfFXZPHy5GsGLHI10E+yiGDspzspb BdKEvyna47FOLeAGp3u7fUKjiamuCN4uo0PTKEpWsRgK7yIBOtgedjkTwu9b/bju2R8Z y9VQ== X-Gm-Message-State: AOAM5332xroz9tv5EYFN4aCaopU6dz9f1oTsWKn+auhqxknMaUZ4gu+7 JfXLaiQS3mSWsRQq0+SvFDWiag== X-Google-Smtp-Source: ABdhPJyKeVoltlz1xu+Nz7Wuf5B+SQazwoeWc17H8nyicbwxIps2h2roBgpvMvQtHLpmBTTybcJBhg== X-Received: by 2002:a05:600c:1504:b0:397:4d98:8b85 with SMTP id b4-20020a05600c150400b003974d988b85mr4375845wmg.39.1653406862290; Tue, 24 May 2022 08:41:02 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v2 03/15] include/hw/virtio: document vhost_get_features Date: Tue, 24 May 2022 16:40:44 +0100 Message-Id: <20220524154056.2896913-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220524154056.2896913-1-alex.bennee@linaro.org> References: <20220524154056.2896913-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653407317214100001 Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Stefan Hajnoczi --- include/hw/virtio/vhost.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index b291fe4e24..9f9f57c46e 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -246,6 +246,17 @@ bool vhost_virtqueue_pending(struct vhost_dev *hdev, i= nt n); */ void vhost_virtqueue_mask(struct vhost_dev *hdev, VirtIODevice *vdev, int = n, bool mask); + +/** + * vhost_get_features() - return a sanitised set of feature bits + * @hdev: common vhost_dev structure + * @feature_bits: pointer to terminated table of feature bits + * @features: original feature set + * + * This returns a set of features bits that is an intersection of what + * is supported by the vhost backend (hdev->features), the supported + * feature_bits and the requested feature set. + */ uint64_t vhost_get_features(struct vhost_dev *hdev, const int *feature_bit= s, uint64_t features); void vhost_ack_features(struct vhost_dev *hdev, const int *feature_bits, --=20 2.30.2 From nobody Fri Apr 19 18:58:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653410088; cv=none; d=zohomail.com; s=zohoarc; b=UVnpX/8JVCyjy9gmwvbVi0mL+idRotPx/sIYar31Nx39r3LAUCWdf/g/OVB7mreKI5IgEY+p0vx+AcQ+zPayiXiUz48iI6ULFWPQ2C8BHQwoi2XRdErqv7UrNuH++nI+s0aNEzKs6dA03fnwf0vvgJc0oQxcytvok/VKs/+rfz8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653410088; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HF3oxtJzbPygKRRjZfwIDjRnPR4HjsUqS/dYhqTV/10=; b=IMGCiyIuc4LfPM+YcUdFoyQBEfgf/YDlWFxeMMmBXOq12VfEJG727Ifbguq6wKEzKdUsAqhI4nEDm4F4YEFYMgq9sGg/7kNcBxojz4wZaB6XSyu8cQsizqfIEiR+/DYyFjw4Bs2IlbsS2Yrxrop0JWOIMicxOW1OBXOf7XhrEhE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653410088303325.70843472189154; Tue, 24 May 2022 09:34:48 -0700 (PDT) Received: from localhost ([::1]:49654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntXUd-0002x9-8V for importer2@patchew.org; Tue, 24 May 2022 12:34:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWex-0004No-Uy for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:26 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:47084) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWef-0005MF-Ch for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:23 -0400 Received: by mail-wr1-x434.google.com with SMTP id m20so15150194wrb.13 for ; Tue, 24 May 2022 08:41:04 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id i1-20020adfaac1000000b0020c5253d8dasm13459631wrc.38.2022.05.24.08.40.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 08:41:01 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B0B861FFBC; Tue, 24 May 2022 16:40:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HF3oxtJzbPygKRRjZfwIDjRnPR4HjsUqS/dYhqTV/10=; b=hD48p295CVWJRIAJyIIPjaTKTd3fFYgBcO3F7H6LjSkboZRHGU5DIzcziCgCDSRmVf CnC+wvc3rU+2rtN5OwfVuA3Av35lGsGqc8QpUeYhn7ixF1ZA34qX1hvS4dt9os5++eGM LwgMYp68V6JNBRdZPT4vzw8RvdIdHOUl3FaRJaXJId9jxnU5UI2QN8w3ArZACMT62YWn Nkdn+UcNafSzJLH2J93oZI47A0knOLX3zSZZSBO3NrVy5hTgG9PaQ+grEjQxrK0o62PW cwfUE4+Io3pe9ojRNKdsQKLFDxyoVDpAQcBwdGB8Q8LOF8xMrpUXvEqYGe+N0VQsL9kD xslQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=HF3oxtJzbPygKRRjZfwIDjRnPR4HjsUqS/dYhqTV/10=; b=PFS2cHb31bB6jtjKJ7/anE7WTDi0IXODs0knFLtPyrR6wgQSHz6cYFgZ6/OWpoXW9e syTa6uU4yUSXadOIm7asXndy+axKKJSzaJd5HhfA5/3U33WHZWtKmlouAtHWXRhx0MRj OJfA/ls12yomN9lKzbt/BvaRkqWVBp5iVZUomMzipE6q2YfAOByqXQLeKma2FH6zBP5/ KIfXClZ4CioA2zN4fWJtdCW4vmHRmZF+D6IPEHoGZGzGn4GzEd6Duh/KmRrZ+Sl8b95C GFSr5KTQv58L308lRJ5Zji3LljA8TFRYhj1X2uHXncuw8i/HkNC1Z/x7kVCKOVIpYvEi +Ofw== X-Gm-Message-State: AOAM530pvJVK6NO9RRzEs4Xaw/pFUfK9/NyF5C4pB3wulXcbP8MAaQhz URRBFN1WmwF2SmVeY7spghJVhw== X-Google-Smtp-Source: ABdhPJzH6wTCGXMXnAoauXEX+uLcf+iqK/ejjhd3uJtppspSvLyPoGaNM4y3RM/zxVQFzyf9j39BfA== X-Received: by 2002:a05:6000:1843:b0:20e:6a9c:afa1 with SMTP id c3-20020a056000184300b0020e6a9cafa1mr22275662wri.218.1653406864088; Tue, 24 May 2022 08:41:04 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v2 04/15] include/hw/virtio: document vhost_ack_features Date: Tue, 24 May 2022 16:40:45 +0100 Message-Id: <20220524154056.2896913-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220524154056.2896913-1-alex.bennee@linaro.org> References: <20220524154056.2896913-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653410089035100001 Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Stefan Hajnoczi --- include/hw/virtio/vhost.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index 9f9f57c46e..bfe868e341 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -259,6 +259,16 @@ void vhost_virtqueue_mask(struct vhost_dev *hdev, Virt= IODevice *vdev, int n, */ uint64_t vhost_get_features(struct vhost_dev *hdev, const int *feature_bit= s, uint64_t features); + +/** + * vhost_ack_features() - set vhost acked_features + * @hdev: common vhost_dev structure + * @feature_bits: pointer to terminated table of feature bits + * @features: requested feature set + * + * This sets the internal hdev->acked_features to the intersection of + * the backends advertised features and the supported feature_bits. + */ void vhost_ack_features(struct vhost_dev *hdev, const int *feature_bits, uint64_t features); bool vhost_has_free_slot(void); --=20 2.30.2 From nobody Fri Apr 19 18:58:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653409617; cv=none; d=zohomail.com; s=zohoarc; b=QhqOd2K2M6QTX+D0s+Ayd6Wk0re2pwNvyQBJ2uLOkbnUtsDLBGGirk5NisqJDs6q2VII4mlk6NE+Kw0dR4NchyDhdr7gS1xoPVghATHdfMtzFlwQCVXO2gjjBy3+9EaJeI4fGlf7GjffgNyswBxWIexyVStRty/x79z5y3qEmDQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653409617; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0eZjoHrxexxNL+fKaMsZMS+KyvjWLWtAv8XDuWHLS4w=; b=mk0fJWezPjJZfhn/MGxSm/MpLFyHqeaWM54RlrY4NzrerDZ2rpRqYsx6oDvCv+8iwVgIM+l2xRXtPvDg2VyQlqs+HpjYTfibgzN4gj3kcZHVFK3zH5kjvX5nG0rfKjZs+BU3NMv+1T33fXN5atIzPtgw1InbM2oK4OXdaFYgQcw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653409617785100.82358347223749; Tue, 24 May 2022 09:26:57 -0700 (PDT) Received: from localhost ([::1]:35172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntXN2-0001Br-GV for importer2@patchew.org; Tue, 24 May 2022 12:26:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWeo-0004Ds-2o for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:14 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:37832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWek-0005My-8l for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:13 -0400 Received: by mail-wr1-x42b.google.com with SMTP id t6so26286691wra.4 for ; Tue, 24 May 2022 08:41:08 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id k21-20020a7bc315000000b003942a244edfsm2655202wmj.36.2022.05.24.08.40.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 08:41:01 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D32E41FFBD; Tue, 24 May 2022 16:40:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0eZjoHrxexxNL+fKaMsZMS+KyvjWLWtAv8XDuWHLS4w=; b=Wx00BlMxgOAU6pvzZmY8zh/cFzwftNqeM+HANCvKRhHBqB92dBrn0a6ejeqQeIWkAo VLYlI/GGa8u9tx011Hym+mWgWtiW5rg/+8Bqkn/5m85U1qWLc7yu5ZuIB6Z/nXIeifae 7olGSc/QiBEpTPjMgx16cdYP7uY43lMbM+eKYRyCvk6txigwZqJMMycNOq0EnIyzAM40 pkx7uTt3TrUx8UXmES2eCB4iChRXLBOUbMHOvilav9x9BJjwokJWhj9xcM7PmKN5OwH/ NIkOC0TZSAdxR1DdNzB6jr3pmnKJu55AHQjLXSMXxTsgDliMxgoy39EH4vNQCcaWpobE vqJA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=0eZjoHrxexxNL+fKaMsZMS+KyvjWLWtAv8XDuWHLS4w=; b=1WhdDZ0VeR58CA/oYyVkkDxUz41ezySBKUaV5aPCzkFpBcLNmwC6Eg92HOZ5GZnGfv +kWxofEQJs8pD69AM5AUxq5obeXUvqlQ26DAZfDJ5RbZ4KYX7qhXyGih7y90z9esRddx SAee4hKq7FrgN5jOTnara5pJPqZsRnnJEbRvR/hV7+QM7xiDgZvCCT752Fg0IA8Q+4qt MoyfywURHr+wo3WetxAr1trcOzFsWNIfhIhoJwLonT26q67AwpXkaH+lODSGp8ztTz7N 3qmqzPbQyT561QQHZSo3oyypEIgCHbNpUGOjmLZHJEcfDCQiV3t9Zw4dC/jDCf8uQB0y jegw== X-Gm-Message-State: AOAM530rw6xSJFiFU7Mo9M0eYN3OMeiE9iip24kK8tNIrXMpX/oh8sDz ddh4a+WywqnxeOnJL/W7xy/XJg== X-Google-Smtp-Source: ABdhPJxrK+80eZYZog5nQS/FKgP4QRFwv3FuBmoK5s2jk6rUwzqWTwgJTAqQNClYY0WRo4Sfwq8RMA== X-Received: by 2002:a05:6000:34b:b0:20f:fb31:872d with SMTP id e11-20020a056000034b00b0020ffb31872dmr691660wre.449.1653406867791; Tue, 24 May 2022 08:41:07 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v2 05/15] hw/virtio: add boilerplate for vhost-user-gpio device Date: Tue, 24 May 2022 16:40:46 +0100 Message-Id: <20220524154056.2896913-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220524154056.2896913-1-alex.bennee@linaro.org> References: <20220524154056.2896913-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653409618548100001 From: Viresh Kumar This creates the QEMU side of the vhost-user-gpio device which connects to the remote daemon. It is based of vhost-user-i2c code. Signed-off-by: Viresh Kumar Reviewed-by: Alex Benn=C3=A9e Message-Id: <5390324a748194a21bc99b1538e19761a8c64092.1641987128.git.viresh= .kumar@linaro.org> [AJB: fixes for qtest] Signed-off-by: Alex Benn=C3=A9e --- v2 - set VIRTIO_F_VERSION_1 - set VHOST_USER_F_PROTOCOL_FEATURES - terminate feature_bits with VHOST_INVALID_FEATURE_BIT - ensure vdev->backend_features set - ensure vhost_dev.acked_features set --- include/hw/virtio/vhost-user-gpio.h | 35 +++ hw/virtio/vhost-user-gpio.c | 357 ++++++++++++++++++++++++++++ hw/virtio/Kconfig | 5 + hw/virtio/meson.build | 1 + 4 files changed, 398 insertions(+) create mode 100644 include/hw/virtio/vhost-user-gpio.h create mode 100644 hw/virtio/vhost-user-gpio.c diff --git a/include/hw/virtio/vhost-user-gpio.h b/include/hw/virtio/vhost-= user-gpio.h new file mode 100644 index 0000000000..afeb56f53e --- /dev/null +++ b/include/hw/virtio/vhost-user-gpio.h @@ -0,0 +1,35 @@ +/* + * Vhost-user GPIO virtio device + * + * Copyright (c) 2021 Viresh Kumar + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef _QEMU_VHOST_USER_GPIO_H +#define _QEMU_VHOST_USER_GPIO_H + +#include "hw/virtio/virtio.h" +#include "hw/virtio/vhost.h" +#include "hw/virtio/vhost-user.h" +#include "standard-headers/linux/virtio_gpio.h" +#include "chardev/char-fe.h" + +#define TYPE_VHOST_USER_GPIO "vhost-user-gpio-device" +OBJECT_DECLARE_SIMPLE_TYPE(VHostUserGPIO, VHOST_USER_GPIO); + +struct VHostUserGPIO { + /*< private >*/ + VirtIODevice parent; + CharBackend chardev; + struct virtio_gpio_config config; + struct vhost_virtqueue *vhost_vq; + struct vhost_dev vhost_dev; + VhostUserState vhost_user; + VirtQueue *command_vq; + VirtQueue *interrupt_vq; + bool connected; + /*< public >*/ +}; + +#endif /* _QEMU_VHOST_USER_GPIO_H */ diff --git a/hw/virtio/vhost-user-gpio.c b/hw/virtio/vhost-user-gpio.c new file mode 100644 index 0000000000..87e3976880 --- /dev/null +++ b/hw/virtio/vhost-user-gpio.c @@ -0,0 +1,357 @@ +/* + * Vhost-user GPIO virtio device + * + * Copyright (c) 2022 Viresh Kumar + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/qdev-properties.h" +#include "hw/virtio/virtio-bus.h" +#include "hw/virtio/vhost-user-gpio.h" +#include "qemu/error-report.h" +#include "standard-headers/linux/virtio_ids.h" + +/* do no other vhost-user daemons need this? */ +#define VHOST_USER_F_PROTOCOL_FEATURES 30 + +static const int feature_bits[] =3D { + VIRTIO_F_VERSION_1, + VIRTIO_GPIO_F_IRQ, + VHOST_USER_F_PROTOCOL_FEATURES, + VHOST_INVALID_FEATURE_BIT +}; + +static void vu_gpio_get_config(VirtIODevice *vdev, uint8_t *config) +{ + VHostUserGPIO *gpio =3D VHOST_USER_GPIO(vdev); + + memcpy(config, &gpio->config, sizeof(gpio->config)); +} + +static int vu_gpio_config_notifier(struct vhost_dev *dev) +{ + VHostUserGPIO *gpio =3D VHOST_USER_GPIO(dev->vdev); + + memcpy(dev->vdev->config, &gpio->config, sizeof(gpio->config)); + virtio_notify_config(dev->vdev); + + return 0; +} + +const VhostDevConfigOps gpio_ops =3D { + .vhost_dev_config_notifier =3D vu_gpio_config_notifier, +}; + +static int vu_gpio_start(VirtIODevice *vdev) +{ + BusState *qbus =3D BUS(qdev_get_parent_bus(DEVICE(vdev))); + VirtioBusClass *k =3D VIRTIO_BUS_GET_CLASS(qbus); + VHostUserGPIO *gpio =3D VHOST_USER_GPIO(vdev); + int ret, i; + + if (!k->set_guest_notifiers) { + error_report("binding does not support guest notifiers"); + return -ENOSYS; + } + + ret =3D vhost_dev_enable_notifiers(&gpio->vhost_dev, vdev); + if (ret < 0) { + error_report("Error enabling host notifiers: %d", ret); + return ret; + } + + ret =3D k->set_guest_notifiers(qbus->parent, gpio->vhost_dev.nvqs, tru= e); + if (ret < 0) { + error_report("Error binding guest notifier: %d", ret); + goto err_host_notifiers; + } + + /* + * Before we start up we need to ensure we have the final feature + * set needed for the vhost configuration. + */ + vhost_ack_features(&gpio->vhost_dev, feature_bits, vdev->backend_featu= res); + + ret =3D vhost_dev_start(&gpio->vhost_dev, vdev); + if (ret < 0) { + error_report("Error starting vhost-user-gpio: %d", ret); + goto err_guest_notifiers; + } + + /* + * guest_notifier_mask/pending not used yet, so just unmask + * everything here. virtio-pci will do the right thing by + * enabling/disabling irqfd. + */ + for (i =3D 0; i < gpio->vhost_dev.nvqs; i++) { + vhost_virtqueue_mask(&gpio->vhost_dev, vdev, i, false); + } + + return 0; + +err_guest_notifiers: + k->set_guest_notifiers(qbus->parent, gpio->vhost_dev.nvqs, false); +err_host_notifiers: + vhost_dev_disable_notifiers(&gpio->vhost_dev, vdev); + + return ret; +} + +static void vu_gpio_stop(VirtIODevice *vdev) +{ + VHostUserGPIO *gpio =3D VHOST_USER_GPIO(vdev); + BusState *qbus =3D BUS(qdev_get_parent_bus(DEVICE(vdev))); + VirtioBusClass *k =3D VIRTIO_BUS_GET_CLASS(qbus); + int ret; + + if (!k->set_guest_notifiers) { + return; + } + + vhost_dev_stop(&gpio->vhost_dev, vdev); + + ret =3D k->set_guest_notifiers(qbus->parent, gpio->vhost_dev.nvqs, fal= se); + if (ret < 0) { + error_report("vhost guest notifier cleanup failed: %d", ret); + return; + } + + vhost_dev_disable_notifiers(&gpio->vhost_dev, vdev); +} + +static void vu_gpio_set_status(VirtIODevice *vdev, uint8_t status) +{ + VHostUserGPIO *gpio =3D VHOST_USER_GPIO(vdev); + bool should_start =3D status & VIRTIO_CONFIG_S_DRIVER_OK; + + if (!vdev->vm_running) { + should_start =3D false; + } + + if (!gpio->connected) { + return; + } + + if (gpio->vhost_dev.started =3D=3D should_start) { + return; + } + + if (should_start) { + if (vu_gpio_start(vdev)) { + qemu_chr_fe_disconnect(&gpio->chardev); + } + } else { + vu_gpio_stop(vdev); + } +} + +static uint64_t vu_gpio_get_features(VirtIODevice *vdev, uint64_t features, + Error **errp) +{ + VHostUserGPIO *gpio =3D VHOST_USER_GPIO(vdev); + + virtio_add_feature(&features, VIRTIO_GPIO_F_IRQ); + virtio_add_feature(&features, VIRTIO_F_VERSION_1); + + vdev->backend_features =3D vhost_get_features(&gpio->vhost_dev, featur= e_bits, + features); + return vdev->backend_features; +} + +static void vu_gpio_handle_output(VirtIODevice *vdev, VirtQueue *vq) +{ + /* + * Not normally called; it's the daemon that handles the queue; + * however virtio's cleanup path can call this. + */ +} + +static void vu_gpio_guest_notifier_mask(VirtIODevice *vdev, int idx, bool = mask) +{ + VHostUserGPIO *gpio =3D VHOST_USER_GPIO(vdev); + + vhost_virtqueue_mask(&gpio->vhost_dev, vdev, idx, mask); +} + +static void do_vhost_user_cleanup(VirtIODevice *vdev, VHostUserGPIO *gpio) +{ + virtio_delete_queue(gpio->command_vq); + virtio_delete_queue(gpio->interrupt_vq); + g_free(gpio->vhost_dev.vqs); + gpio->vhost_dev.vqs =3D NULL; + virtio_cleanup(vdev); + vhost_user_cleanup(&gpio->vhost_user); +} + +static int vu_gpio_connect(DeviceState *dev) +{ + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + VHostUserGPIO *gpio =3D VHOST_USER_GPIO(vdev); + Error *local_err =3D NULL; + int ret; + + if (gpio->connected) { + return 0; + } + gpio->connected =3D true; + + vhost_dev_set_config_notifier(&gpio->vhost_dev, &gpio_ops); + + ret =3D vhost_dev_init(&gpio->vhost_dev, &gpio->vhost_user, + VHOST_BACKEND_TYPE_USER, 0, &local_err); + if (ret < 0) { + error_report("vhost-user-gpio: vhost initialization failed: %s", + strerror(-ret)); + return ret; + } + + /* restore vhost state */ + if (virtio_device_started(vdev, vdev->status)) { + vu_gpio_start(vdev); + } + + return 0; +} + +static void vu_gpio_disconnect(DeviceState *dev) +{ + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + VHostUserGPIO *gpio =3D VHOST_USER_GPIO(vdev); + + if (!gpio->connected) { + return; + } + gpio->connected =3D false; + + vu_gpio_stop(vdev); + vhost_dev_cleanup(&gpio->vhost_dev); +} + +static void vu_gpio_event(void *opaque, QEMUChrEvent event) +{ + DeviceState *dev =3D opaque; + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + VHostUserGPIO *gpio =3D VHOST_USER_GPIO(vdev); + + switch (event) { + case CHR_EVENT_OPENED: + if (vu_gpio_connect(dev) < 0) { + qemu_chr_fe_disconnect(&gpio->chardev); + return; + } + break; + case CHR_EVENT_CLOSED: + vu_gpio_disconnect(dev); + break; + case CHR_EVENT_BREAK: + case CHR_EVENT_MUX_IN: + case CHR_EVENT_MUX_OUT: + /* Ignore */ + break; + } +} + +static void vu_gpio_device_realize(DeviceState *dev, Error **errp) +{ + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + VHostUserGPIO *gpio =3D VHOST_USER_GPIO(dev); + Error *err =3D NULL; + int ret; + + if (!gpio->chardev.chr) { + error_setg(errp, "vhost-user-gpio: chardev is mandatory"); + return; + } + + if (!vhost_user_init(&gpio->vhost_user, &gpio->chardev, errp)) { + return; + } + + virtio_init(vdev, VIRTIO_ID_GPIO, sizeof(gpio->config)); + + gpio->vhost_dev.nvqs =3D 2; + gpio->command_vq =3D virtio_add_queue(vdev, 256, vu_gpio_handle_output= ); + gpio->interrupt_vq =3D virtio_add_queue(vdev, 256, vu_gpio_handle_outp= ut); + gpio->vhost_dev.vqs =3D g_new0(struct vhost_virtqueue, gpio->vhost_dev= .nvqs); + + gpio->connected =3D false; + + qemu_chr_fe_set_handlers(&gpio->chardev, NULL, NULL, vu_gpio_event, NU= LL, + dev, NULL, true); + +reconnect: + if (qemu_chr_fe_wait_connected(&gpio->chardev, &err) < 0) { + error_report_err(err); + do_vhost_user_cleanup(vdev, gpio); + return; + } + + /* check whether vhost_user_gpio_connect() failed or not */ + if (!gpio->connected) { + goto reconnect; + } + + ret =3D vhost_dev_get_config(&gpio->vhost_dev, (uint8_t *)&gpio->confi= g, + sizeof(gpio->config), errp); + if (ret < 0) { + error_report("vhost-user-gpio: get config failed"); + goto reconnect; + } + + return; +} + +static void vu_gpio_device_unrealize(DeviceState *dev) +{ + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + VHostUserGPIO *gpio =3D VHOST_USER_GPIO(dev); + + vu_gpio_set_status(vdev, 0); + qemu_chr_fe_set_handlers(&gpio->chardev, NULL, NULL, NULL, NULL, NULL,= NULL, + false); + vhost_dev_cleanup(&gpio->vhost_dev); + do_vhost_user_cleanup(vdev, gpio); +} + +static const VMStateDescription vu_gpio_vmstate =3D { + .name =3D "vhost-user-gpio", + .unmigratable =3D 1, +}; + +static Property vu_gpio_properties[] =3D { + DEFINE_PROP_CHR("chardev", VHostUserGPIO, chardev), + DEFINE_PROP_END_OF_LIST(), +}; + +static void vu_gpio_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_CLASS(klass); + + device_class_set_props(dc, vu_gpio_properties); + dc->vmsd =3D &vu_gpio_vmstate; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); + vdc->realize =3D vu_gpio_device_realize; + vdc->unrealize =3D vu_gpio_device_unrealize; + vdc->get_features =3D vu_gpio_get_features; + vdc->get_config =3D vu_gpio_get_config; + vdc->set_status =3D vu_gpio_set_status; + vdc->guest_notifier_mask =3D vu_gpio_guest_notifier_mask; +} + +static const TypeInfo vu_gpio_info =3D { + .name =3D TYPE_VHOST_USER_GPIO, + .parent =3D TYPE_VIRTIO_DEVICE, + .instance_size =3D sizeof(VHostUserGPIO), + .class_init =3D vu_gpio_class_init, +}; + +static void vu_gpio_register_types(void) +{ + type_register_static(&vu_gpio_info); +} + +type_init(vu_gpio_register_types) diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig index e9ecae1f50..cbfd8c7173 100644 --- a/hw/virtio/Kconfig +++ b/hw/virtio/Kconfig @@ -80,3 +80,8 @@ config VHOST_USER_FS bool default y depends on VIRTIO && VHOST_USER + +config VHOST_USER_GPIO + bool + default y + depends on VIRTIO && VHOST_USER diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index 7e8877fd64..33c8e71fab 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -29,6 +29,7 @@ virtio_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true: files= ('virtio-iommu.c')) virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c')) virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2= c.c')) virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rn= g.c')) +virtio_ss.add(when: 'CONFIG_VHOST_USER_GPIO', if_true: files('vhost-user-g= pio.c')) =20 virtio_pci_ss =3D ss.source_set() virtio_pci_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-= pci.c')) --=20 2.30.2 From nobody Fri Apr 19 18:58:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653407652; cv=none; d=zohomail.com; s=zohoarc; b=NENyJZIa3SHWNlkdpw6OllU/31ZB2pdjPOxhecJo218Zzi7LtkUTdb99aq53B6YFl6diMfHHJv90DmeyWn/B7kuWb+19XSGjMWEB6DHsa8OiQYTPdCNTT8+xVE3XQaicm6dcL2ZcJ1iT4/a5wvakZvP6LIyfCoM2PLCe1KxwxYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653407652; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TJYGQIz+rWx7e0twPEDMb7ZMcWZRr8Vc82PxTGHPmrg=; b=TxTWqNdYvuTU2kiP/ZVW7LM5BzfjhkEsDdm/jXulwGSb4VXkybzzUZfRAJo8t/XqPRRxG+cUyWk3bdg73tWWLHWuUWEmdDOcpPjyhl8gKKrDlGyKcoRAz8mqacTokx1kUulvrcfMfsON1OFpD6i+J1wDV/7s8yeeT8WukWSu6HM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653407652447249.26024032723376; Tue, 24 May 2022 08:54:12 -0700 (PDT) Received: from localhost ([::1]:33958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntWrK-00022j-P6 for importer2@patchew.org; Tue, 24 May 2022 11:54:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWem-00049H-Lo for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:12 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:45601) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWei-0005MW-7B for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:12 -0400 Received: by mail-wr1-x434.google.com with SMTP id p10so7649706wrg.12 for ; Tue, 24 May 2022 08:41:07 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id o9-20020adfba09000000b0020d07d90b71sm13472736wrg.66.2022.05.24.08.40.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 08:41:01 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E65F91FFBE; Tue, 24 May 2022 16:40:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TJYGQIz+rWx7e0twPEDMb7ZMcWZRr8Vc82PxTGHPmrg=; b=mKkwyDWINbHLLi93Re+r4vIPV20FFv+yvrrkwiezPir1JKQbFssYW/9VOKfbxRyZcx OrDJc/tPYSbApKTJF5/Zjg9alBOzibWhGSpsiuB3pghtiDigVQrf4//Y3dTrn7wVvAyM dQe7fQ8m2v3tR72rsXM3e79YHiVUhoWG2YAgOlYVIDPrkuWNNOpVjHVKIo4W/1J2a/HJ zqihnYQT1xXGMCi7/fCYoBUVMlMbTXudXS3NCa9Jm3oz84UZwMQ0RX9DpHYB13avTDHQ jdM+ARwcrGFWjdvMe2lvi/D3SLzGgx2jUPIvup7LBg8BUndbIqvoQTSnMf592i6cjW3Y rG3w== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=TJYGQIz+rWx7e0twPEDMb7ZMcWZRr8Vc82PxTGHPmrg=; b=cJjWbc42PEvIj76t4rNC9DJHbRe/kZ2+CrRIIq7e7yvB40PVjAAkJpQ5qvtWhLQCHE 4g3nk9tUYgVa9JWDHxfJEZUWJM/I7yz3dU6tf56CeKMVsLR+L35t7HXn3JYBWlnv7Y5L NravLdcL+b51z2xn7H9f05EoB0ib9oRBer3esf0nU8ksqDc/zPutc2bFkYoRQl4BF03d k4EkR1M5P7jDTzVbdpvDreKYr36GPridsddeZiF1yLomQLrJR7oONH6YspSDHr2M9riR kEIHeo14yPUExQauv+efXq54CADNSUxK4NNs+ZiSbhi7RRsq7FkKSCgzNSl60gxGVnvu gkeQ== X-Gm-Message-State: AOAM530KBxAKDWjF+dOP323lVcaqBRamFQE4Vd3cLAU0OoAnSE0qDfiE bMCE08GBhQPJR85JWyXwiKK5MHFl5P4c7Q== X-Google-Smtp-Source: ABdhPJxQhkMyFBRDzTENUuBhPu4Dir5LmoTXuLPN3AcAXj45k9piZlvZshjiuWArgPJlKPWl5S+O5Q== X-Received: by 2002:adf:d08d:0:b0:20f:fb5a:6b43 with SMTP id y13-20020adfd08d000000b0020ffb5a6b43mr365028wrh.637.1653406866850; Tue, 24 May 2022 08:41:06 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v2 06/15] hw/virtio: add vhost-user-gpio-pci boilerplate Date: Tue, 24 May 2022 16:40:47 +0100 Message-Id: <20220524154056.2896913-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220524154056.2896913-1-alex.bennee@linaro.org> References: <20220524154056.2896913-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653407654095100001 From: Viresh Kumar This allows is to instantiate a vhost-user-gpio device as part of a PCI bus. It is mostly boilerplate which looks pretty similar to the vhost-user-fs-pci device. Signed-off-by: Viresh Kumar Reviewed-by: Alex Benn=C3=A9e Message-Id: <5f560cab92d0d789b1c94295ec74b9952907d69d.1641987128.git.viresh= .kumar@linaro.org> Signed-off-by: Alex Benn=C3=A9e --- hw/virtio/vhost-user-gpio-pci.c | 69 +++++++++++++++++++++++++++++++++ hw/virtio/meson.build | 1 + 2 files changed, 70 insertions(+) create mode 100644 hw/virtio/vhost-user-gpio-pci.c diff --git a/hw/virtio/vhost-user-gpio-pci.c b/hw/virtio/vhost-user-gpio-pc= i.c new file mode 100644 index 0000000000..b3028a24a1 --- /dev/null +++ b/hw/virtio/vhost-user-gpio-pci.c @@ -0,0 +1,69 @@ +/* + * Vhost-user gpio virtio device PCI glue + * + * Copyright (c) 2022 Viresh Kumar + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "hw/qdev-properties.h" +#include "hw/virtio/vhost-user-gpio.h" +#include "hw/virtio/virtio-pci.h" + +struct VHostUserGPIOPCI { + VirtIOPCIProxy parent_obj; + VHostUserGPIO vdev; +}; + +typedef struct VHostUserGPIOPCI VHostUserGPIOPCI; + +#define TYPE_VHOST_USER_GPIO_PCI "vhost-user-gpio-pci-base" + +DECLARE_INSTANCE_CHECKER(VHostUserGPIOPCI, VHOST_USER_GPIO_PCI, + TYPE_VHOST_USER_GPIO_PCI) + +static void vhost_user_gpio_pci_realize(VirtIOPCIProxy *vpci_dev, Error **= errp) +{ + VHostUserGPIOPCI *dev =3D VHOST_USER_GPIO_PCI(vpci_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + + vpci_dev->nvectors =3D 1; + qdev_realize(vdev, BUS(&vpci_dev->bus), errp); +} + +static void vhost_user_gpio_pci_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtioPCIClass *k =3D VIRTIO_PCI_CLASS(klass); + PCIDeviceClass *pcidev_k =3D PCI_DEVICE_CLASS(klass); + k->realize =3D vhost_user_gpio_pci_realize; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); + pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; + pcidev_k->device_id =3D 0; /* Set by virtio-pci based on virtio id */ + pcidev_k->revision =3D 0x00; + pcidev_k->class_id =3D PCI_CLASS_COMMUNICATION_OTHER; +} + +static void vhost_user_gpio_pci_instance_init(Object *obj) +{ + VHostUserGPIOPCI *dev =3D VHOST_USER_GPIO_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VHOST_USER_GPIO); +} + +static const VirtioPCIDeviceTypeInfo vhost_user_gpio_pci_info =3D { + .base_name =3D TYPE_VHOST_USER_GPIO_PCI, + .non_transitional_name =3D "vhost-user-gpio-pci", + .instance_size =3D sizeof(VHostUserGPIOPCI), + .instance_init =3D vhost_user_gpio_pci_instance_init, + .class_init =3D vhost_user_gpio_pci_class_init, +}; + +static void vhost_user_gpio_pci_register(void) +{ + virtio_pci_types_register(&vhost_user_gpio_pci_info); +} + +type_init(vhost_user_gpio_pci_register); diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index 33c8e71fab..c14e3db10a 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -30,6 +30,7 @@ virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('= virtio-mem.c')) virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2= c.c')) virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rn= g.c')) virtio_ss.add(when: 'CONFIG_VHOST_USER_GPIO', if_true: files('vhost-user-g= pio.c')) +virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_GPIO'], if_tr= ue: files('vhost-user-gpio-pci.c')) =20 virtio_pci_ss =3D ss.source_set() virtio_pci_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-= pci.c')) --=20 2.30.2 From nobody Fri Apr 19 18:58:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653408079; cv=none; d=zohomail.com; s=zohoarc; b=h0qAJX6xy6A4zs6EoDaG4L8bB65ukIuxYiWvgQ5wqd2xYDN30FS+0lX/KnwNOwAZjxSvYSeGH4SDmgCxxRxwVYJEXxQgYkCee/lXmNteuRl+z15BGesXUlUqqpWr4TUOW6DTdY2yXlVtnYq8r/wFVDzoIYDqZ9dQc6RxjuPAovM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653408079; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=73P2SMfBOog2gRv6U2nGWjPCxj4E1QB8i6yDPAw1Qyw=; b=Db+zQwpkh+NURb72vuL9b67NDzwxchlpSoEaPqWPvhRCWoDLg6Sqtl1kRp5aeJAPh3P1MhMngSqtDT1Rd0Y5CqbU0dlWPfCfR1A2Ywq7PuylCo521Wh8iySt0zwlTHCRXbUqql5O6cq2Zp0K3GBeenwgZf79DDq3VaFLx2cfPA0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653408079881507.0640884430155; Tue, 24 May 2022 09:01:19 -0700 (PDT) Received: from localhost ([::1]:43848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntWyD-0000ro-KH for importer2@patchew.org; Tue, 24 May 2022 12:01:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWen-0004DH-Ul for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:13 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:39685) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWek-0005NG-T4 for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:13 -0400 Received: by mail-wr1-x434.google.com with SMTP id j25so1852119wrb.6 for ; Tue, 24 May 2022 08:41:10 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id l24-20020adfa398000000b0020fcaba73bcsm10312496wrb.104.2022.05.24.08.40.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 08:41:01 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 09B7A1FFBF; Tue, 24 May 2022 16:40:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=73P2SMfBOog2gRv6U2nGWjPCxj4E1QB8i6yDPAw1Qyw=; b=MFaISvz2azzTtPrFFX4NyGWm4lxgOJI8TFsP2QrvLGim43R53CY5nEq2VdUCImsnK+ N8C3lXlF3i4Jc/l6OUmKOjvsP/Mw8HZKk3/+YE0q/Chv+5+LdipxRjwIJ07pK5FvDkvP YT6PriNhmBkAOrmksjZGQXMlBbxTIFQON+2iHVoGyymIit4jPXZ7AvjHWJ0gex+5E/t8 j//0JGKiaxv2kd7bJ200gqMG7i/KXDxiakFILYbzpGv3X2NQdWD8BCixaQ/iUWmIgrWI xyAPryr+wEfUo/cly5iwpmyfIlmkgeSC4BaZsB1gpB4b6EhfEWXWcHSVHJ3aUjpV5koh I26g== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=73P2SMfBOog2gRv6U2nGWjPCxj4E1QB8i6yDPAw1Qyw=; b=MWPwf5Gw4N1iha5hcMUzDgAd3yvWO3g4SfnBdq7JdrRMF3Th5q+Cle1LvVT9UCI2fI FNoBPgkR1X/6q/DgWzY22kstD/IdsJ1M676z3LYqAL9jr6weNLA6PfEwImhTYRbi1tzl zrn6hVgpUVJe3WY1vt9Gsc+VIi+W8F8nHtCQdEPPCtqY4FZGFilff7V1zFAdwGvGrprb b71rySnd8FSaG4ogeDcUVqnwxjW/8JEUREyx55cPghtJfOt0zbmFZlGG6V4ef5Sfy5cs 2w6FreC8sHLbD5pi9IVdgAelKyc2PYZwKPVkug03E4rsOfDG+kHAzL8e2EVEhm9/MQLu x0Cg== X-Gm-Message-State: AOAM532xmwmALpyjjyGOYhFOhmv22KhXHsjLiMMOnqbXlTAr1Y51hD3T wtRSYh7RWhQyaU6bqWCrFvDy7g== X-Google-Smtp-Source: ABdhPJwy0yeYF2denjcj9WMSTOOX6j1AmUsS7LFOB9fbLBnyZ9zxD8dAv79BFTZEm7+/CUGWtGKOtA== X-Received: by 2002:adf:e791:0:b0:20e:677a:c449 with SMTP id n17-20020adfe791000000b0020e677ac449mr23630183wrm.610.1653406869512; Tue, 24 May 2022 08:41:09 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 07/15] tests/qtest: pass stdout/stderr down to subtests Date: Tue, 24 May 2022 16:40:48 +0100 Message-Id: <20220524154056.2896913-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220524154056.2896913-1-alex.bennee@linaro.org> References: <20220524154056.2896913-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653408081961100001 When trying to work out what the virtio-net-tests where doing it was hard because the g_test_trap_subprocess redirects all output to /dev/null. Lift this restriction by using the appropriate flags so you can see something similar to what the vhost-user-blk tests show when running. Signed-off-by: Alex Benn=C3=A9e Message-Id: <20220407150042.2338562-1-alex.bennee@linaro.org> Acked-by: Thomas Huth --- v2 - keep dumping of CLI behind the g_test_verbose flag --- tests/qtest/qos-test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qtest/qos-test.c b/tests/qtest/qos-test.c index f97d0a08fd..7e1c8fc579 100644 --- a/tests/qtest/qos-test.c +++ b/tests/qtest/qos-test.c @@ -185,7 +185,8 @@ static void run_one_test(const void *arg) static void subprocess_run_one_test(const void *arg) { const gchar *path =3D arg; - g_test_trap_subprocess(path, 0, 0); + g_test_trap_subprocess(path, 0, + G_TEST_SUBPROCESS_INHERIT_STDOUT | G_TEST_SUBPR= OCESS_INHERIT_STDERR); g_test_trap_assert_passed(); } =20 --=20 2.30.2 From nobody Fri Apr 19 18:58:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653409405; cv=none; d=zohomail.com; s=zohoarc; b=baJi7TqhWBD3gBXGzZ9umSCzCMirPnfPgdW0BX3yS4uY2Sqg5Z2ged3Rt83fsSbl/opUcd0PR6y0CzJwVKocAi28R4oB5AoMJOyqxEnykr2+2MfNaEe2bLXJT7pcCFKVp8n9o5hZKKQvN+XxFYBa0xGLEOJ8sFKBJx+WPCtkBVk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653409405; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Hk1aHrQ9TVl6KrEJ1C7v3kI0UJPqRUC122r5YQRX1T0=; b=nHwG441iTfM4yAJDYsVb3i7e3yn1epqn4bhfBTbb7328uIOMEtQ0iTwgUprMyYnHvY/2JHMvWQpdAVBc0PNWYadaNcPD/zKjBKqZzZqGzfC5SAU2I+DXLFzZPxTrvMkbDJklLt5BJ53Emi0ma88RtV59yuZhRmtW5zwCVwL+uyA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653409405315966.4154863422791; Tue, 24 May 2022 09:23:25 -0700 (PDT) Received: from localhost ([::1]:56698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntXJb-0004sY-HE for importer2@patchew.org; Tue, 24 May 2022 12:23:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWel-00044w-4f for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:11 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:41869) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWeg-0005MN-Ku for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:10 -0400 Received: by mail-wr1-x42c.google.com with SMTP id u27so25452414wru.8 for ; Tue, 24 May 2022 08:41:06 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id l4-20020adfbd84000000b0020e5d2a9d0bsm15698734wrh.54.2022.05.24.08.40.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 08:41:01 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 223591FFC0; Tue, 24 May 2022 16:40:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Hk1aHrQ9TVl6KrEJ1C7v3kI0UJPqRUC122r5YQRX1T0=; b=EN+VhVPrP0M8IVs4+YqePHOeZevPT9qaCGj+B4BvNgSlJhupwjZanpmunUUVUeBatm +Q1hVCAWlABbE1CAwnAaA4su1BWSNP1d1TVUHn6X1hGDKeNTlpBE4znAALo1l3Ttnxug i+U4EWRzIpVK/UVPjfqw49uUji7mZjBhm0M7lQX8lIamIWJDwSfGQe3JosZlJm6k+DnQ Jeg1+kJ0mQ4ouzcbbVf8Wsr4Xj2f8hnZRNaH8onqVkBLzNMZzNPA34Q/XGVmeHVx3wMe zUH5bYUlgnThB6KFIRjxWfBnOX6A/SXnWg5IpX7a3IyXQT/CSDyjL0nioQU0UXNOpuk/ I9PQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hk1aHrQ9TVl6KrEJ1C7v3kI0UJPqRUC122r5YQRX1T0=; b=KTOMCekQI8GlxEIwejLfnN3+66zEcB9suqKNJQ3ZQzyGFdAh2oshpbwYMIrfmP0C+G fdhgK05gDN/R6GcroHVSztnX5ZZYmAWR8Q22SU9AafEls3HisrrHIO63eXa8BPhiWzEC f7PmCYyG5R0xKJ7J227N4DJUjNGUUQKegl/70Bx0OQaOwEUGqpE1Ws6+LzFSobqRdIgK S4HZ6S497olQgauGrHli958wZU6lXolHX7Seq2Fl53JTLAPdH7ZwllBJfXUqWR5ElN97 0N9Yy0OTs5x5xNShzzfDM/p3Is5UjP0y2N5ASkVf3eNlwJ5qr8mY6cEcv5FP6CKiicLG h0Ag== X-Gm-Message-State: AOAM532owOyask8LhyozsNJSSbkXBmjvH5g8KcCHik1u12ho0KYl9uWL iJoDKl4gvCzU5D8HkSjv9jTG0O5fsvcxsg== X-Google-Smtp-Source: ABdhPJyhUwbWULAUHrT6pNYhyj3kxsluOMR+ry6fQqBFO1u6O8U/wYm4tnrJdkwozVyoZz4vN8vpVA== X-Received: by 2002:a5d:58f3:0:b0:20d:d14:4801 with SMTP id f19-20020a5d58f3000000b0020d0d144801mr23269955wrd.168.1653406865102; Tue, 24 May 2022 08:41:05 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 08/15] tests/qtest: add a timeout for subprocess_run_one_test Date: Tue, 24 May 2022 16:40:49 +0100 Message-Id: <20220524154056.2896913-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220524154056.2896913-1-alex.bennee@linaro.org> References: <20220524154056.2896913-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653409407191100001 Hangs have been observed in the tests and currently we don't timeout if a subprocess hangs. Rectify that. Signed-off-by: Alex Benn=C3=A9e --- tests/qtest/qos-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qtest/qos-test.c b/tests/qtest/qos-test.c index 7e1c8fc579..46623da731 100644 --- a/tests/qtest/qos-test.c +++ b/tests/qtest/qos-test.c @@ -185,7 +185,7 @@ static void run_one_test(const void *arg) static void subprocess_run_one_test(const void *arg) { const gchar *path =3D arg; - g_test_trap_subprocess(path, 0, + g_test_trap_subprocess(path, 60 * G_USEC_PER_SEC, G_TEST_SUBPROCESS_INHERIT_STDOUT | G_TEST_SUBPR= OCESS_INHERIT_STDERR); g_test_trap_assert_passed(); } --=20 2.30.2 From nobody Fri Apr 19 18:58:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653409945; cv=none; d=zohomail.com; s=zohoarc; b=Bk74e2/PQf+O2H0q21EVbUO+NVKxl00CyiKpRueNOzeLRZofsXicuU6iUfCw9YzxLPBnMcAS8PWwCkUglkEVk/hDFU/XPj40pA7IMZBpzrSs+sLbrJs3kl770PGWMIx/vfVgviFZiRV6opSM2zQUVZ8nRWevQdR630FoNC9QM1o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653409945; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Y8ciTvhxSJt5x501FNvMsdfAL7fFfmd90rVjD5hpgVI=; b=EYzjXCyOjcvpfCYVbxGcgfFnIZ+yLSas1/40lqf0c/7MWkiVga68W+xGYqLhM93+d6X0jbDJd0DCSRkB0JuRmySYCdymSBxdwcULRunGmiFQxZ0F2uEQY1+JA98whboTIC//bY5QWYpqSp/k6BW8po5WeTKSTUstxmZXGH8ZdEk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653409945769319.57087816715466; Tue, 24 May 2022 09:32:25 -0700 (PDT) Received: from localhost ([::1]:45302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntXSK-0008D7-CI for importer2@patchew.org; Tue, 24 May 2022 12:32:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWeu-0004N0-1X for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:21 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:38403) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWes-0005Sd-E0 for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:19 -0400 Received: by mail-wm1-x32a.google.com with SMTP id h205-20020a1c21d6000000b003972dda143eso1646825wmh.3 for ; Tue, 24 May 2022 08:41:17 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id h25-20020adfaa99000000b0020fe61acd09sm4890040wrc.12.2022.05.24.08.41.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 08:41:09 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 3145F1FFC1; Tue, 24 May 2022 16:40:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y8ciTvhxSJt5x501FNvMsdfAL7fFfmd90rVjD5hpgVI=; b=pnh4bnwMq3JDzoRqE2IJXmUT/7GtBFMyslEiI8F7GdDjCx6WYAux77fAzvyrlHMkdQ ob8M5hFG51GattIqu80KX3muPBzArMp+O7sWBkChC6VBFBTne+H6ZZ2u1vyiK+YIIcLh zuPw5YnCrBYpphxiCy9Yo9zTJpk/rfrwU6EmzckYQFU1JR/4dTegm7qJ9+FWYK8CRHjL ODid1SvoSc6ioeNhSn0ZZNbKvTNUVUOsRw1tOTAnC+Vk/oDTeOX47YGFq5xSf/jqxG6Q BGmRKQoToYxqMhpZSDF39en6S9uYHX9WDXDu34jcf90a5qj8ju0h9aZYNVKAeNH/4FF5 2PuQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y8ciTvhxSJt5x501FNvMsdfAL7fFfmd90rVjD5hpgVI=; b=COFCF7TOizFIvK/MoWekTx/i+o21FdtzfitjeH+Yoy/02mG9jDM4wR60glp9QmPSX+ iS1pDsr5xAS9PytYzQSgJlkoKjXOsgk0BuVzRI9gmSLUq5Dm/ierOlaajWySLBYiWxAV 3szxZUfHmiIXTcbjnCd2dPvcUjjXW2sKy+eae83WTffS5sPDGn3H5Hd2Dwk2Ye3UCOW5 6YAAdpes/4Q6kVchLjoBR1C3CcINb9QRt9yOG+Kmed3fATJUAh4iL/AOaxf++3bWeVTx 3Myb/wAtuZrGJS3oVTOFHvxxunbXO0i8nJC6C/aofAUsdHmfQxRtY3nutO9Ftom9mT1S oyZg== X-Gm-Message-State: AOAM530AGYNi5RdhROHmwfU5SihLb2O0QzwIxDG05sYWEdqU1pZ3z56G wjbhDZya+fXREKj9gtFfNTh4EA== X-Google-Smtp-Source: ABdhPJwe5h7Suru64uBPrKRstOPklloeCH1KhWkBnWuDOLG5NESRnEekW0CNUtKiDhVs2iQlXtpE2w== X-Received: by 2002:a05:600c:384c:b0:397:404a:3ccd with SMTP id s12-20020a05600c384c00b00397404a3ccdmr4347076wmr.114.1653406877086; Tue, 24 May 2022 08:41:17 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 09/15] tests/qtest: use qos_printf instead of g_test_message Date: Tue, 24 May 2022 16:40:50 +0100 Message-Id: <20220524154056.2896913-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220524154056.2896913-1-alex.bennee@linaro.org> References: <20220524154056.2896913-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653409948059100001 The vhost-user tests respawn qos-test as a standalone process. As a result the gtester framework squashes all messages coming out of it which make it hard to debug. As the test does not care about asserting certain messages just convert the tests to use the direct qos_printf. Signed-off-by: Alex Benn=C3=A9e --- tests/qtest/qos-test.c | 5 +++++ tests/qtest/vhost-user-test.c | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/qtest/qos-test.c b/tests/qtest/qos-test.c index 46623da731..fef2471f8f 100644 --- a/tests/qtest/qos-test.c +++ b/tests/qtest/qos-test.c @@ -320,6 +320,11 @@ static void walk_path(QOSGraphNode *orig_path, int len) int main(int argc, char **argv, char** envp) { g_test_init(&argc, &argv, NULL); + + if (g_test_subprocess()) { + qos_printf("qos_test running single test in subprocess\n"); + } + if (g_test_verbose()) { qos_printf("ENVIRONMENT VARIABLES: {\n"); for (char **env =3D envp; *env !=3D 0; env++) { diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index a2cec87684..90749c147e 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -26,6 +26,7 @@ #include "libqos/virtio-pci.h" =20 #include "libqos/malloc-pc.h" +#include "libqos/qgraph_internal.h" #include "hw/virtio/virtio-net.h" =20 #include "standard-headers/linux/vhost_types.h" @@ -316,7 +317,7 @@ static void chr_read(void *opaque, const uint8_t *buf, = int size) } =20 if (size !=3D VHOST_USER_HDR_SIZE) { - g_test_message("Wrong message size received %d", size); + qos_printf("%s: Wrong message size received %d\n", __func__, size); return; } =20 @@ -327,8 +328,8 @@ static void chr_read(void *opaque, const uint8_t *buf, = int size) p +=3D VHOST_USER_HDR_SIZE; size =3D qemu_chr_fe_read_all(chr, p, msg.size); if (size !=3D msg.size) { - g_test_message("Wrong message size received %d !=3D %d", - size, msg.size); + qos_printf("%s: Wrong message size received %d !=3D %d\n", + __func__, size, msg.size); return; } } @@ -450,7 +451,7 @@ static const char *init_hugepagefs(void) } =20 if (access(path, R_OK | W_OK | X_OK)) { - g_test_message("access on path (%s): %s", path, strerror(errno)); + qos_printf("access on path (%s): %s", path, strerror(errno)); g_test_fail(); return NULL; } @@ -460,13 +461,13 @@ static const char *init_hugepagefs(void) } while (ret !=3D 0 && errno =3D=3D EINTR); =20 if (ret !=3D 0) { - g_test_message("statfs on path (%s): %s", path, strerror(errno)); + qos_printf("statfs on path (%s): %s", path, strerror(errno)); g_test_fail(); return NULL; } =20 if (fs.f_type !=3D HUGETLBFS_MAGIC) { - g_test_message("Warning: path not on HugeTLBFS: %s", path); + qos_printf("Warning: path not on HugeTLBFS: %s", path); g_test_fail(); return NULL; } --=20 2.30.2 From nobody Fri Apr 19 18:58:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653408007; cv=none; d=zohomail.com; s=zohoarc; b=ZuP51FdnBSSVvd5oTgPsjljcJ9/dlG40QyyTElt+HpuQCBdK/8s4gcwLkVmSOxSdRfpVg6Ej93XgsEMRkbfM5ikAbFVxwDYyV3031iRMcZRXRFHqdJ+MdAxalPsfTN7q5tR72T3wm4S++Sc8jJd0HA/7iBRTSn03P6/x8Zx9P9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653408007; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0BYVTVZiKjXfpCfzCQnV5P+1PaZA5TNtHfPlJaQOz5w=; b=ZfFozPIN11nkGYSg3jwqZPw85Kxa1fkqvGmKfYpuvTiBJE/h0rjwROe4mg/PS1pnRLicqOAY/ti/w5VWuCRDUOrPzpRWLdCRVAllVdriN47Tqa8eJAjOcC0hhQLga5G9j3gHet6hhLVJqJyi+lIt9ve7mgdXdDRddR+mw/UNKSI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653408007711474.45867993657794; Tue, 24 May 2022 09:00:07 -0700 (PDT) Received: from localhost ([::1]:42442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntWwz-0008C8-SS for importer2@patchew.org; Tue, 24 May 2022 12:00:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWep-0004II-Iu for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:15 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:43802) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWen-0005PR-RN for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:15 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 67-20020a1c1946000000b00397382b44f4so1643509wmz.2 for ; Tue, 24 May 2022 08:41:13 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id u22-20020adfa196000000b0020c5253d8dcsm13477778wru.40.2022.05.24.08.41.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 08:41:09 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 50D3D1FFC2; Tue, 24 May 2022 16:40:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0BYVTVZiKjXfpCfzCQnV5P+1PaZA5TNtHfPlJaQOz5w=; b=xnOug7AfIomU33Kc7qg3cEIpkRU7kqx0I97Ls3urj6QlKRPizGmVCaQMaMNgdxQNQL 4uTtHGCgE1RnB5t8XvDhlfPPVFnjfHz2lJ0i1Vi8oqTn/lOz45EQoLxWURMk7h9UD2Sr K3gVbM/XJtniBLib60gukwbV7MUEWdNojT9QIp5y0LeN6PaDdAKow6RLTNCOEuzBtdfP C0fxqnB+kjfVm+kFx/8ZVk1HAlJ6N1gqOBdNX+u+lZwA4lLGTfqliVlEiOWp0gVGCMPn Otib3d0ZSKpSjK/+UG75BmLVR8e7a3LTIGK1FydK/q40OwZh7oDDBaI3fOXVRf0iGsgT CNfQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=0BYVTVZiKjXfpCfzCQnV5P+1PaZA5TNtHfPlJaQOz5w=; b=FBSp9mwM+48KSmkY5qPh5ODYzNLY0FX9hO177pvUpDPOaUdRJUBmG0DLp+CZXhvGtH Po3PzGTARoCTmgqBXbJk0Rxca4m6jT/bhLKZlbKzKKpaEFQ5xIoG24hmP5OAqVziaUvm NnO/9N+jjTy2xvS+vBE8WKhBJBpav+Rihxl/7XUZpVEY/vPAPKiNOHi7KZThU3anWMtI Kkg3KlRD8pvffysqQcWgAHoNzAhVgpTpWjLCCV5e/qrHgC4E3jVBbvr7Z1QfGNZNZVm/ Y03MzQQeFPxbZT5zRL0YNx31wdNGWiEJEBrBbZ/7IPElpwaT/cJaO/tIby9/Pck7bTq0 OJew== X-Gm-Message-State: AOAM531N1c63K70uj+Q0u8gu0deSCyMBTpeOnGPMoBK/lpd3160qGEzb sh8H/KCzKfgYVPdfOmelvaTCcQ== X-Google-Smtp-Source: ABdhPJxP9a4/Optbq8Pk8kp7Jy2Q/qOJVBd4SWk6XtAdA12zQqIXWxXVjIw6Kryp3+cSFztGmOo3Kg== X-Received: by 2002:a7b:c5cd:0:b0:38c:8b1b:d220 with SMTP id n13-20020a7bc5cd000000b0038c8b1bd220mr4308413wmk.118.1653406872538; Tue, 24 May 2022 08:41:12 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 10/15] tests/qtest: catch unhandled vhost-user messages Date: Tue, 24 May 2022 16:40:51 +0100 Message-Id: <20220524154056.2896913-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220524154056.2896913-1-alex.bennee@linaro.org> References: <20220524154056.2896913-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653408009469100001 We don't need to action every message but lets document the ones we are expecting to consume so future tests don't get confused about unhandled bits. Signed-off-by: Alex Benn=C3=A9e --- v1 - drop g_test_fail() when we get unexpected result, that just hangs --- tests/qtest/vhost-user-test.c | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index 90749c147e..11da6ff07a 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -358,12 +358,41 @@ static void chr_read(void *opaque, const uint8_t *buf= , int size) } break; =20 + case VHOST_USER_SET_OWNER: + /* + * We don't need to do anything here, the remote is just + * letting us know it is in charge. Just log it. + */ + qos_printf("set_owner: start of session\n"); + break; + case VHOST_USER_GET_PROTOCOL_FEATURES: if (s->vu_ops->get_protocol_features) { s->vu_ops->get_protocol_features(s, chr, &msg); } break; =20 + case VHOST_USER_SET_PROTOCOL_FEATURES: + /* + * We did set VHOST_USER_F_PROTOCOL_FEATURES so its valid for + * the remote end to send this. There is no handshake reply so + * just log the details for debugging. + */ + qos_printf("set_protocol_features: 0x%"PRIx64 "\n", msg.payload.u6= 4); + break; + + /* + * A real vhost-user backend would actually set the size and + * address of the vrings but we can simply report them. + */ + case VHOST_USER_SET_VRING_NUM: + qos_printf("set_vring_num: %d/%d\n", + msg.payload.state.index, msg.payload.state.num); + break; + case VHOST_USER_SET_VRING_ADDR: + qos_printf("set_vring_addr:\n"); + break; + case VHOST_USER_GET_VRING_BASE: /* send back vring base to qemu */ msg.flags |=3D VHOST_USER_REPLY_MASK; @@ -428,7 +457,18 @@ static void chr_read(void *opaque, const uint8_t *buf,= int size) qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size); break; =20 + case VHOST_USER_SET_VRING_ENABLE: + /* + * Another case we ignore as we don't need to respond. With a + * fully functioning vhost-user we would enable/disable the + * vring monitoring. + */ + qos_printf("set_vring(%d)=3D%s\n", msg.payload.state.index, + msg.payload.state.num ? "enabled" : "disabled"); + break; + default: + qos_printf("vhost-user: un-handled message: %d\n", msg.request); break; } =20 --=20 2.30.2 From nobody Fri Apr 19 18:58:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653409745; cv=none; d=zohomail.com; s=zohoarc; b=W4O05bgABUzoKtZibLfvrD5KwV+cqFjEzhC7FgQhxhvi0XfXqhjdZOLao4TsnktJb17ins+cJFmP9E5neEiCgHssWGdt+5/nL3JdC6+P4MXuNK0ud8wKUcNLCxqqMMeSr4N1TYcYot9b8NrpLwvjL0EhIsOYXqdAZ8Wdpw3NTvs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653409745; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lIw/XzESBQ2ZIkAn8maFDXE0YZAEzzp1ypsC723X+go=; b=aa6KO9YdaHDYEYnFf5xNcR5VBBHqPLIkR1H9PDOjfFyCTx0/d1+mubn902XPta7wWegLOJnZq8gJrz12NH4SegtWY+WQmJYKh6L+CIRhayBpAx6BlW/OI5fQZ3z8Seb/MHjvSULF/nE8USY73b1ulEUKFypwOfvv5+o83H+B3is= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653409745655687.32477486265; Tue, 24 May 2022 09:29:05 -0700 (PDT) Received: from localhost ([::1]:40668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntXP6-0004wg-JB for importer2@patchew.org; Tue, 24 May 2022 12:29:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWeo-0004G0-O9 for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:14 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:42743) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWem-0005OV-VH for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:14 -0400 Received: by mail-wr1-x435.google.com with SMTP id t13so7097652wrg.9 for ; Tue, 24 May 2022 08:41:12 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id u25-20020adfae59000000b0020d106c0386sm13283414wrd.89.2022.05.24.08.41.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 08:41:09 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 5DAA41FFC3; Tue, 24 May 2022 16:40:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lIw/XzESBQ2ZIkAn8maFDXE0YZAEzzp1ypsC723X+go=; b=gdpZI4BUKvCAhqLp2M0ofCADf0PazqBD6SQ7MfY0plJUJZ3cbvVyI3htPrrM2RFjTS Sb3H9xEzsISa+OsSwzqYAkEMd+Ok/hfNYqCEaMB41FEWZwAzqk3HlZAVpDmMzManaRQy j6FAuFj86gP3NhlvR+kZENLLEUnodkpRS6H5Em/uVbmWgQBTd87H549gVtRcXTDOtX6B TLKJWBRVJ7US4cZ9yxrkiH00XurZXoS7Qa5KVDP8PoCxNuvCfWgPZhrRWFHokGjigOcm 22ITGYqTdi03hl0PlADAPf8KReIoPXBjNZXv59KLHWu60zouqzB4Aaohm12yXEV1uWNV Xq+w== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=lIw/XzESBQ2ZIkAn8maFDXE0YZAEzzp1ypsC723X+go=; b=wjxV7SU4Ym6tA7iingfiFkXKSgbUX1fjrngf50CIZJD/lviULtTFXVyGbA9zmv42iH 85/Cgtzb9PSEyGoem10DVLU5qgsp/2BsArwxcBK/BNIlMIXboN8WoyiiOqN/88wxVDx2 kzGdfj5DJbhYMZotjFW/hf+vWFOUi/3HBHiMy6LEV6W/gtD+1949zKDKCuCPXYekICoK hau2Ii6QP3OH3KEhbG4FxNOHML53M241bRo1njBLkdW2L0rJvqKpds1uU3VK6hugCiH6 tkddQ7RlN0QgRd9iiAK2rTB31AqDGkQL+BFJ3DR7s4ggW8cFFns0jmPQ+XnLxB+FcE8N rCvw== X-Gm-Message-State: AOAM532Lf7pjGZsM+IAEXKgCzzYJwUqrjcSByOkd1IcQlLYuu85gfkOg D6gCl2+KKV9lTr1IijD9RpGbZA== X-Google-Smtp-Source: ABdhPJzwLLjhJGOnTyvdUNf2/gw2XFx3/Daj/QYtBtHIpX9lbJoQRmzfK/UZuC5wUYGwSUsvMygOXg== X-Received: by 2002:a05:6000:186c:b0:20f:e176:df0b with SMTP id d12-20020a056000186c00b0020fe176df0bmr8004355wri.608.1653406871606; Tue, 24 May 2022 08:41:11 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 11/15] tests/qtest: use g_autofree for test_server_create_chr Date: Tue, 24 May 2022 16:40:52 +0100 Message-Id: <20220524154056.2896913-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220524154056.2896913-1-alex.bennee@linaro.org> References: <20220524154056.2896913-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653409745991100001 Signed-off-by: Alex Benn=C3=A9e --- tests/qtest/vhost-user-test.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index 11da6ff07a..d0fa034601 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -565,14 +565,13 @@ static void chr_event(void *opaque, QEMUChrEvent even= t) =20 static void test_server_create_chr(TestServer *server, const gchar *opt) { - gchar *chr_path; + g_autofree gchar *chr_path =3D g_strdup_printf("unix:%s%s", + server->socket_path, opt); Chardev *chr; =20 - chr_path =3D g_strdup_printf("unix:%s%s", server->socket_path, opt); chr =3D qemu_chr_new(server->chr_name, chr_path, server->context); - g_free(chr_path); + g_assert(chr); =20 - g_assert_nonnull(chr); qemu_chr_fe_init(&server->chr, chr, &error_abort); qemu_chr_fe_set_handlers(&server->chr, chr_can_read, chr_read, chr_event, NULL, server, server->context, tru= e); --=20 2.30.2 From nobody Fri Apr 19 18:58:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653408575; cv=none; d=zohomail.com; s=zohoarc; b=hrE1CrZX2RZ3X7jkWDCTgBvx2uLyJgc/0jWQYTcKiT+pXnb5Y3YXSRJ+OUflu/eH/T8hDyR2f/s1OKEVgqJcpj7OhWbqY2o2/bkPbOqyJGWTKi22HkHrQ8Z1+sRHI6WJqZp4fsLvVyscUbrIYyC9SgIvi/m+g24Ojbgh24I0/2c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653408575; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=M3AwLOO4tJSX2vgFnHe89rY8t5sl7yh4FwF2sza60a4=; b=lZ29riPiXhfcsW+WqbOCHZRYBKMhch4axHILPbArJu1D4tgSi/THwr9DEhefG/C+Cgc1knsnBdnR852TEcnEpQA1skHZokeq4CQEcCwKYXhaZg/px77jkPPTPt3K2wNS+0TphGzBCx4dSheoSfk4EaPjJM87VkEI0unJHn7weSg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653408575642604.949794397322; Tue, 24 May 2022 09:09:35 -0700 (PDT) Received: from localhost ([::1]:59226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntX6E-0003ot-5G for importer2@patchew.org; Tue, 24 May 2022 12:09:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWes-0004M5-OG for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:18 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:39685) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWer-0005NG-3u for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:18 -0400 Received: by mail-wr1-x434.google.com with SMTP id j25so1852119wrb.6 for ; Tue, 24 May 2022 08:41:16 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id p42-20020a05600c1daa00b003942a244f40sm2661488wms.25.2022.05.24.08.41.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 08:41:09 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 751451FFC4; Tue, 24 May 2022 16:40:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M3AwLOO4tJSX2vgFnHe89rY8t5sl7yh4FwF2sza60a4=; b=im3x5G7w4bnJoBUOvFnpZURKf6o+gjxK1ObwTA8fOKl4hI1s05cgQ35jQGBdTtQeHF s4Zj+u8tXyCwOP0GI66tFBD0/UWvsOfX0iLxWHSD24zj6jKLtjb0LwhePcoL+owWg2qx s3Gi4g1HyXkgwe8HidDEVq9pDtaAGFNjzpki2mQ4F1MLei0GtBWiYqs2ykFvq2C/pHFm 37tBpSu57P6tmx+vMKz5/xaRn29fVCPs+5Ax//cJNMNS/O3dE7IQEOq2N538lNtjoMsQ C2qXh26Xg/57epFIiQeMBMZR+7tvwY713no05Uamks7pP0UNaHMr+O7p+FakOU7sXev6 JNYw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=M3AwLOO4tJSX2vgFnHe89rY8t5sl7yh4FwF2sza60a4=; b=7ocoZSKPME2yA+Pk1R46er54g459qMjY1txXGuJJcbo9CCqH935iZ03AiGBiYB1id6 pWVmEnuoiBN6gsVChzyV+fKtibRkUkYJu/unl783j/UvbYtO2fJTF3tqFHFG+5G6dY0t b4agyUgA0IXkd11pc+V6Nl0Pxsq/6GdxNkJT/p2kCvPYrATOgYoTnrpx8617QkDF+da1 Cq4vM72GucDNW7r4/QBa8M92fX9AkWvVIuwq4TE09sVg7kC9bMUfSQ7k1Y/SN4Jw2Cjj XMeYhU5C+5UYumZf+kagweB6FU5ylTFv7PFawUnXu+lhIqcZzFAavl7+lAezmXHQjDBv 3PDQ== X-Gm-Message-State: AOAM533F3roZtWXvsQlQJWvvlnD48GH437/5ObN0uZuFev0kkdZ3YjPz uu+ZkJjsfMmvwL7JqQkQYadXNA== X-Google-Smtp-Source: ABdhPJwsEbxDw0L+mIWMpbN1QGEIFQCr1YrFCQZzwqtKaQXbmpRpn0rn3SDhIw1tXq4lNPsC+fDWLQ== X-Received: by 2002:a05:6000:2a8:b0:20f:c56e:3f5e with SMTP id l8-20020a05600002a800b0020fc56e3f5emr14531517wry.22.1653406876331; Tue, 24 May 2022 08:41:16 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 12/15] tests/qtest: plain g_assert for VHOST_USER_F_PROTOCOL_FEATURES Date: Tue, 24 May 2022 16:40:53 +0100 Message-Id: <20220524154056.2896913-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220524154056.2896913-1-alex.bennee@linaro.org> References: <20220524154056.2896913-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653408576078100001 checkpatch.pl warns that non-plain asserts should be avoided so convert the check to a plain g_assert. Signed-off-by: Alex Benn=C3=A9e --- tests/qtest/vhost-user-test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index d0fa034601..db18e0b664 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -980,8 +980,7 @@ static void test_multiqueue(void *obj, void *arg, QGues= tAllocator *alloc) static void vu_net_set_features(TestServer *s, CharBackend *chr, VhostUserMsg *msg) { - g_assert_cmpint(msg->payload.u64 & - (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES), !=3D, 0ULL); + g_assert(msg->payload.u64 & (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES)= ); if (s->test_flags =3D=3D TEST_FLAGS_DISCONNECT) { qemu_chr_fe_disconnect(chr); s->test_flags =3D TEST_FLAGS_BAD; --=20 2.30.2 From nobody Fri Apr 19 18:58:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653408295; cv=none; d=zohomail.com; s=zohoarc; b=I3LZ5ciiVZqQHjgacr63RH0FCD/Sf6RA/oVOkasbo/UWwU7Bj+wBBqC/rAb4KTSSgaeNa2Spn523DxFt7ydCCmhLbFaqLRpO3kM2GNTDpOvJjgbQEPLLaR9Dq0p6sQ0B1VDELOR3qW37d1jwnJFc4m35u1XVFWd2Vr/VlBYuRE4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653408295; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hfKNVlrrL3u0vef+FWTAR3LbzLx2Gk+OTMM5YcoQN7Q=; b=m37XshJXuOnxunaaDibx/kL1Ni8yfl+9R/+Mdj6ONbhsl4dSqHNOaBAa5uRXpxCuiv6pyx9lMlLFHEiwUdezSRI7clLO+zJ2j6dm1DS0rN7PB+A4fxjwAnV9/z1eIhqxFbwGxlUZHK9HhyOqyico/ofPicmv9YtdQfXC/Dndhc0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653408295405637.3244410353387; Tue, 24 May 2022 09:04:55 -0700 (PDT) Received: from localhost ([::1]:50724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntX1i-0006Di-CF for importer2@patchew.org; Tue, 24 May 2022 12:04:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWer-0004LA-In for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:18 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:35775) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWep-0005QW-QQ for qemu-devel@nongnu.org; Tue, 24 May 2022 11:41:17 -0400 Received: by mail-wr1-x434.google.com with SMTP id x12so2027892wrg.2 for ; Tue, 24 May 2022 08:41:15 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id q22-20020a1cf316000000b00394708a3d7dsm2355759wmq.15.2022.05.24.08.41.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 08:41:09 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 820E91FFC5; Tue, 24 May 2022 16:40:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hfKNVlrrL3u0vef+FWTAR3LbzLx2Gk+OTMM5YcoQN7Q=; b=owQHW/kRAB58wTje3tlWm07SzXA21elY3U42uFBe60oQRlewztfkpjz7YmVg6PB6zA /bauRLTd1k2Q3s81zHWbo2J79jhBIEHELgr97AYV+upEdGcqqOo6zuSI869Zr0hwTptX 3wEI/aillpylk1ulvGCFYkyKpT5kpAOBf0zdDTs8YZ0bYjvWMjjT9YZKr/Hk3G4PgP1h xnV3hI82zbmyXPZ7eeowiriOZBuPsz3GXzkoyfo0xectFFk5UG41kyX7Zql8QB0QA3Ng /mMTFEnIxbwlPgECPCwtSrgSlo1GqpST+/mA8LVWTecI07AH3i3Xwqwy4ALgsndaswjs VYwg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=hfKNVlrrL3u0vef+FWTAR3LbzLx2Gk+OTMM5YcoQN7Q=; b=zDr13bIXccctEz+kEG4COZLnyRilWcbNMbwHHSlIPj6iOtlX2YvzTmPhIlDCPbiCsD E+reaATfitx1pY7ptQc8o3vwh3iqY7ZFkd+UdxhwUdd4RrdzGLEJ7ZSJDnfgJJpqoahJ 0MTzZZMBOYN61fx6n1jDl5v02B2Y4o0/NTVRChnI/t2ru4N+2WPOiYH8QFqErmrA58Ap clVR98F1CQRDllkMHualB9SdwlqlAYTUBirNynGWrMqdNB7bc73Cu6xLnyETrOVnI127 4wiOyluZcLLlMQVIGedB4lfBomtowGYUQvzm9pRv6MZENi3oNG9PgrixZ/kuyLhZbDa/ nxCg== X-Gm-Message-State: AOAM530cptbqyTzzFK45E4HlG4wgUtRlKob3XhdnojNDMWM4DLg9AEiw QLqh7ta5ga4FhSMkvXO/ifI7ywRFwVX8eg== X-Google-Smtp-Source: ABdhPJzjXNq92X7ZoG9K4IVUGuRnsD85yikWYlO7sbI9A2iItqLSXpbbwxzhmvogfd4itDRtNNbtyQ== X-Received: by 2002:a5d:4e05:0:b0:20d:1f0:1f31 with SMTP id p5-20020a5d4e05000000b0020d01f01f31mr24130748wrt.492.1653406874518; Tue, 24 May 2022 08:41:14 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 13/15] tests/qtest: implement stub for VHOST_USER_GET_CONFIG Date: Tue, 24 May 2022 16:40:54 +0100 Message-Id: <20220524154056.2896913-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220524154056.2896913-1-alex.bennee@linaro.org> References: <20220524154056.2896913-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653408296493100001 We don't implement the full solution because frankly none of the tests need to at the moment. We may end up re-implementing libvhostuser in the end. Signed-off-by: Alex Benn=C3=A9e --- tests/qtest/vhost-user-test.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index db18e0b664..d546721f5d 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -79,6 +79,8 @@ typedef enum VhostUserRequest { VHOST_USER_SET_PROTOCOL_FEATURES =3D 16, VHOST_USER_GET_QUEUE_NUM =3D 17, VHOST_USER_SET_VRING_ENABLE =3D 18, + VHOST_USER_GET_CONFIG =3D 24, + VHOST_USER_SET_CONFIG =3D 25, VHOST_USER_MAX } VhostUserRequest; =20 @@ -372,6 +374,17 @@ static void chr_read(void *opaque, const uint8_t *buf,= int size) } break; =20 + case VHOST_USER_GET_CONFIG: + /* + * Treat GET_CONFIG as a NOP and just reply and let the guest + * consider we have updated its memory. Tests currently don't + * require working configs. + */ + msg.flags |=3D VHOST_USER_REPLY_MASK; + p =3D (uint8_t *) &msg; + qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size); + break; + case VHOST_USER_SET_PROTOCOL_FEATURES: /* * We did set VHOST_USER_F_PROTOCOL_FEATURES so its valid for --=20 2.30.2 From nobody Fri Apr 19 18:58:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653410378; cv=none; d=zohomail.com; s=zohoarc; b=U3fzytXObsNefoDgVcGsr3dSY2IAG3hc8RZG8DDfovNe2GQD7gVkpVkLmacq4OlGDaZlEYCzhVkbinG/UytL7NIxd7c33af7CpL7gY901d85O/yB3/2brT9jj3qydi2KXwwin82/NCxLGNMCqO5STrzaWBYAP7JqhYTsHAvMSwQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653410378; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5yuBY8XhniW5U3BckTrWu3/MUge9sIzVNIAB45zhSUM=; b=J3y742mljmXRpUrgQ6xKqMZoKIVLI0iYEumd1b0hd+mOi/GrAPj8R7HyFx6sw7NgmA9bqs0Ntz7IDDxMul7ZD1q3hVLPePq2hyMEz9C1VP6g8VNjXz5MFdmUCjeSS6+MAlDq8JOb5LUSNnfFktH1l/2g1VD2q7GDOjwUsECUoZk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653410378068691.9706881962709; Tue, 24 May 2022 09:39:38 -0700 (PDT) Received: from localhost ([::1]:32802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntXZI-0002C1-J5 for importer2@patchew.org; Tue, 24 May 2022 12:39:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45348) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWn2-00086o-Lz for qemu-devel@nongnu.org; Tue, 24 May 2022 11:49:45 -0400 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]:47039) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWn1-0006bw-14 for qemu-devel@nongnu.org; Tue, 24 May 2022 11:49:44 -0400 Received: by mail-ej1-x62d.google.com with SMTP id rs12so24471380ejb.13 for ; Tue, 24 May 2022 08:49:42 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id z9-20020a1709063ac900b006fedcb78854sm2525982ejd.164.2022.05.24.08.49.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 08:49:40 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 99E3A1FFC6; Tue, 24 May 2022 16:40:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5yuBY8XhniW5U3BckTrWu3/MUge9sIzVNIAB45zhSUM=; b=Y6HqfDQHFttIjqC81mmE82QINLR8upwEZNbs5ioxVJBvMlel5J73AR8dM+FfN4cPqm /xiU0W+60mFkLU26ADGqp4fq4y/uY6fJK82+ATViGmwrCkmC07QzubmJ2I7+5e9z/tN6 ++2c9/VmPb7olA6TGkpfTIncAC2l1RQnrSP28HVtgzOZb1DpaB2KdhJe7sNIX7+wJSG9 5FRT7VNcrAfF9NqvDmgxsGrokpwcwBeD7DOn4ZStgVuav+PJmtqO0h3TWckPq05Aupud vfSKnsuCGH9nJGcZQIkYiDyFfie6jIAbHQfDpWF4o8AGYyfGa4FBcrqGruVzGig4IabN dzcQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=5yuBY8XhniW5U3BckTrWu3/MUge9sIzVNIAB45zhSUM=; b=B1a6POS90F4PPAXUUhZITaMr3wUmSMc8WLWACWGRF0/yiYPGNryHSWFKIm0rZKgaMa R48+EKiCjatdQwCosPab7c7hJshv03Vi43fQenr3dVHMapACxsvL3LJp9LZwPMgA907X GnEO04q4rXhsFZxo+ow+jbr07wde+1sM6TIuHYQHlAfd+Ot3O86WI+eehrfaHnDCC8c9 7aTUByi8YXqGt4OGNf8DMHP+FVfRTU5wU30iANKin5MoVZ7Y/DCWpnAPA335jdwKFl11 hQZ8UIsiN4TzNnGXTBSbaiigpQelXu2DjHurytwcKrzQyKRcpzoO2nLMToeuGTAxeaB/ EEfg== X-Gm-Message-State: AOAM532+0WVt8xYbfxO/eArYbs2tyKKwDhW9NLYdeoMUnklOKqD+jzpt T5Gf5EaAN0C5CheajjAvMYowjQ== X-Google-Smtp-Source: ABdhPJx0rLGO5JKToKDZGb3vrDzgx1tMy/u1XwO4jU1JTBBEZGcx/oLtsMo1ghMGZ1J3W9t/W8Y+Vw== X-Received: by 2002:a17:907:6093:b0:6fe:a585:143c with SMTP id ht19-20020a170907609300b006fea585143cmr19705845ejc.236.1653407381562; Tue, 24 May 2022 08:49:41 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v2 14/15] tests/qtest: add a get_features op to vhost-user-test Date: Tue, 24 May 2022 16:40:55 +0100 Message-Id: <20220524154056.2896913-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220524154056.2896913-1-alex.bennee@linaro.org> References: <20220524154056.2896913-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653410378789100001 As we expand this test for more virtio devices we will need to support different feature sets. Add a mandatory op field to fetch the list of features needed for the test itself. Signed-off-by: Alex Benn=C3=A9e --- tests/qtest/vhost-user-test.c | 37 +++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index d546721f5d..28b4cf28ec 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -171,10 +171,11 @@ struct vhost_user_ops { const char *chr_opts); =20 /* VHOST-USER commands. */ + uint64_t (*get_features)(TestServer *s); void (*set_features)(TestServer *s, CharBackend *chr, - VhostUserMsg *msg); + VhostUserMsg *msg); void (*get_protocol_features)(TestServer *s, - CharBackend *chr, VhostUserMsg *msg); + CharBackend *chr, VhostUserMsg *msg); }; =20 static const char *init_hugepagefs(void); @@ -338,20 +339,22 @@ static void chr_read(void *opaque, const uint8_t *buf= , int size) =20 switch (msg.request) { case VHOST_USER_GET_FEATURES: + /* Mandatory for tests to define get_features */ + g_assert(s->vu_ops->get_features); + /* send back features to qemu */ msg.flags |=3D VHOST_USER_REPLY_MASK; msg.size =3D sizeof(m.payload.u64); - msg.payload.u64 =3D 0x1ULL << VHOST_F_LOG_ALL | - 0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES; - if (s->queues > 1) { - msg.payload.u64 |=3D 0x1ULL << VIRTIO_NET_F_MQ; - } + if (s->test_flags >=3D TEST_FLAGS_BAD) { msg.payload.u64 =3D 0; s->test_flags =3D TEST_FLAGS_END; + } else { + msg.payload.u64 =3D s->vu_ops->get_features(s); } - p =3D (uint8_t *) &msg; - qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size); + + qemu_chr_fe_write_all(chr, (uint8_t *) &msg, + VHOST_USER_HDR_SIZE + msg.size); break; =20 case VHOST_USER_SET_FEATURES: @@ -990,8 +993,21 @@ static void test_multiqueue(void *obj, void *arg, QGue= stAllocator *alloc) wait_for_rings_started(s, s->queues * 2); } =20 + +static uint64_t vu_net_get_features(TestServer *s) +{ + uint64_t features =3D 0x1ULL << VHOST_F_LOG_ALL | + 0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES; + + if (s->queues > 1) { + features |=3D 0x1ULL << VIRTIO_NET_F_MQ; + } + + return features; +} + static void vu_net_set_features(TestServer *s, CharBackend *chr, - VhostUserMsg *msg) + VhostUserMsg *msg) { g_assert(msg->payload.u64 & (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES)= ); if (s->test_flags =3D=3D TEST_FLAGS_DISCONNECT) { @@ -1020,6 +1036,7 @@ static struct vhost_user_ops g_vu_net_ops =3D { =20 .append_opts =3D append_vhost_net_opts, =20 + .get_features =3D vu_net_get_features, .set_features =3D vu_net_set_features, .get_protocol_features =3D vu_net_get_protocol_features, }; --=20 2.30.2 From nobody Fri Apr 19 18:58:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653409278; cv=none; d=zohomail.com; s=zohoarc; b=FdZtfeLXhaB2WiVBUU9h0fcnIoOVo/FlaAskgaOrpUtiUZYwcKlad4l4txyIG+OECaORdU/PjDEKpNq5uNbvxF9g3f8G0Lp7XMJe8duaFiiN2JLAzmncH9cKEJmyssz+Qok8gUCXsWCulUqU+GvdgPDL6cu6lUnJHOH5vog8xfo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653409278; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lCTpKnmtO5WxNA6xgenekcxC5CTR5A2/QeDUhDt/YRE=; b=UAl9cMjuO7GXz4VMCUfxZpD1pfE8rWJDJcpzf8lKivZZcvX05qH9dPfJgmLrgaAcrhKWGEGr6W2NO8V3BW1b+RcXEDG0R/Jv+2kLouw0Qvw/eT4EWdNO8xVY3oVG1grGMfxej0UhL2qD3r1RQOwBdUSfw6x+MnL7bWOfXfVMewQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653409278636506.56634248310445; Tue, 24 May 2022 09:21:18 -0700 (PDT) Received: from localhost ([::1]:52854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntXHZ-00025C-Fp for importer2@patchew.org; Tue, 24 May 2022 12:21:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45358) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntWn4-000883-3k for qemu-devel@nongnu.org; Tue, 24 May 2022 11:49:46 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]:41552) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntWn1-0006cF-Up for qemu-devel@nongnu.org; Tue, 24 May 2022 11:49:45 -0400 Received: by mail-ed1-x52d.google.com with SMTP id h11so22459406eda.8 for ; Tue, 24 May 2022 08:49:43 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id h24-20020a1709070b1800b006f3ef214e5csm5403135ejl.194.2022.05.24.08.49.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 08:49:40 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B48CA1FFC7; Tue, 24 May 2022 16:40:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lCTpKnmtO5WxNA6xgenekcxC5CTR5A2/QeDUhDt/YRE=; b=n4RGXj/1g8KP4E31aLIBhQ30OWlzBVm2QMNLmdaFCPS5nMlL6ew3xyOk62i1zetS06 rLCYb4CzfpraXDwHbd61nTBcRj6zJG8+iAGjZFtH4zwm+6iQcqj5LSn3DZt0ieTfkLJt Fy808hYu9G5LwsbhPg5JvUYxhhFSY9pZntgMa+vGfjRU2qwg64jiUYqwmDwytU9eajTH 8/wL2Do8UlmBhVA+drR6DkpbrmJGbaCjZGaiTtnhQaACOXRUQLyv7UN5jRw+BvBCrVSb Kjz6uvOaCE9X7nvr0akqTxw/L4twKY78YrPJGvM7XOAyXna2vxLOT68Qs6x25sMssESG 5jwg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=lCTpKnmtO5WxNA6xgenekcxC5CTR5A2/QeDUhDt/YRE=; b=jKUbZ2A5vLVTeGilMP2MOgjrhnphAQ5Zss13JmAjFcyDbLOkb5xn2mh61AdtUe2bnB 9W6LkGC5QdWsuHdEiWyfeksco8FsDKka8R9XcWERfjUERJlNrJtHl6veXt5wRMAKGclH TchRtlW4DbjUcZBbZYxwORKUP6xGvJBKEIAP1KDpxGMXnh71r48q57zlSF/FdysgsrqM DGijxLsUVtNKCWuNH9EMdmwC9oeCNXnLni0Ub+P+2jz4MNHdBjL/46wVB2Wb4889XXmW uOFj1vgAs4K+DJ6j29InGqY2IkmvfrWoZ+fwlMnnPRlQlMLdGY/XNZfgzPXCl0PhF5h2 RRjQ== X-Gm-Message-State: AOAM533qh4HNNqgKVvpAh5rmWlNJMYLMIJo+1e5LeTI/XS/xq2YYxAWJ fsb3bNikHrPMDjBKEvqty/H71g== X-Google-Smtp-Source: ABdhPJxZe8Q3hlDePamYxUd3he2/zSq+E6/B3X8mcrG7s6LyoPTeNAdiLquVfQmUbgEujcHJJFAcpw== X-Received: by 2002:aa7:c3d2:0:b0:42a:b39d:b30c with SMTP id l18-20020aa7c3d2000000b0042ab39db30cmr30172269edr.368.1653407382447; Tue, 24 May 2022 08:49:42 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Eric Auger , Thomas Huth , Laurent Vivier Subject: [PATCH v2 15/15] tests/qtest: enable tests for virtio-gpio Date: Tue, 24 May 2022 16:40:56 +0100 Message-Id: <20220524154056.2896913-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220524154056.2896913-1-alex.bennee@linaro.org> References: <20220524154056.2896913-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653409280794100001 We don't have a virtio-gpio implementation in QEMU and only support a vhost-user backend. The QEMU side of the code is minimal so it should be enough to instantiate the device and pass some vhost-user messages over the control socket. To do this we hook into the existing vhost-user-test code and just add the bits required for gpio. Signed-off-by: Alex Benn=C3=A9e Cc: Viresh Kumar Cc: Paolo Bonzini Cc: Eric Auger Message-Id: <20220408155704.2777166-1-alex.bennee@linaro.org> --- v2 - add more of the missing boilerplate - don't request LOG_SHMD - use get_features op - report VIRTIO_F_VERSION_1 - more comments --- tests/qtest/libqos/virtio-gpio.h | 35 +++++++ tests/qtest/libqos/virtio-gpio.c | 171 +++++++++++++++++++++++++++++++ tests/qtest/libqos/virtio.c | 2 +- tests/qtest/vhost-user-test.c | 66 ++++++++++++ tests/qtest/libqos/meson.build | 1 + 5 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 tests/qtest/libqos/virtio-gpio.h create mode 100644 tests/qtest/libqos/virtio-gpio.c diff --git a/tests/qtest/libqos/virtio-gpio.h b/tests/qtest/libqos/virtio-g= pio.h new file mode 100644 index 0000000000..f11d41bd19 --- /dev/null +++ b/tests/qtest/libqos/virtio-gpio.h @@ -0,0 +1,35 @@ +/* + * virtio-gpio structures + * + * Copyright (c) 2022 Linaro Ltd + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef TESTS_LIBQOS_VIRTIO_GPIO_H +#define TESTS_LIBQOS_VIRTIO_GPIO_H + +#include "qgraph.h" +#include "virtio.h" +#include "virtio-pci.h" + +typedef struct QVhostUserGPIO QVhostUserGPIO; +typedef struct QVhostUserGPIOPCI QVhostUserGPIOPCI; +typedef struct QVhostUserGPIODevice QVhostUserGPIODevice; + +struct QVhostUserGPIO { + QVirtioDevice *vdev; + QVirtQueue **queues; +}; + +struct QVhostUserGPIOPCI { + QVirtioPCIDevice pci_vdev; + QVhostUserGPIO gpio; +}; + +struct QVhostUserGPIODevice { + QOSGraphObject obj; + QVhostUserGPIO gpio; +}; + +#endif diff --git a/tests/qtest/libqos/virtio-gpio.c b/tests/qtest/libqos/virtio-g= pio.c new file mode 100644 index 0000000000..762aa6695b --- /dev/null +++ b/tests/qtest/libqos/virtio-gpio.c @@ -0,0 +1,171 @@ +/* + * virtio-gpio nodes for testing + * + * Copyright (c) 2022 Linaro Ltd + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "standard-headers/linux/virtio_config.h" +#include "../libqtest.h" +#include "qemu/module.h" +#include "qgraph.h" +#include "virtio-gpio.h" + +static QGuestAllocator *alloc; + +static void virtio_gpio_cleanup(QVhostUserGPIO *gpio) +{ + QVirtioDevice *vdev =3D gpio->vdev; + int i; + + for (i =3D 0; i < 2; i++) { + qvirtqueue_cleanup(vdev->bus, gpio->queues[i], alloc); + } + g_free(gpio->queues); +} + +/* + * This handles the VirtIO setup from the point of view of the driver + * frontend and therefor doesn't present any vhost specific features + * and in fact masks of the re-used bit. + */ +static void virtio_gpio_setup(QVhostUserGPIO *gpio) +{ + QVirtioDevice *vdev =3D gpio->vdev; + uint64_t features; + int i; + + features =3D qvirtio_get_features(vdev); + features &=3D ~QVIRTIO_F_BAD_FEATURE; + qvirtio_set_features(vdev, features); + + gpio->queues =3D g_new(QVirtQueue *, 2); + for (i =3D 0; i < 2; i++) { + gpio->queues[i] =3D qvirtqueue_setup(vdev, alloc, i); + } + qvirtio_set_driver_ok(vdev); +} + +static void *qvirtio_gpio_get_driver(QVhostUserGPIO *v_gpio, + const char *interface) +{ + if (!g_strcmp0(interface, "vhost-user-gpio")) { + return v_gpio; + } + if (!g_strcmp0(interface, "virtio")) { + return v_gpio->vdev; + } + + g_assert_not_reached(); +} + +static void *qvirtio_gpio_device_get_driver(void *object, + const char *interface) +{ + QVhostUserGPIODevice *v_gpio =3D object; + return qvirtio_gpio_get_driver(&v_gpio->gpio, interface); +} + +/* virtio-gpio (mmio) */ +static void qvirtio_gpio_device_destructor(QOSGraphObject *obj) +{ + QVhostUserGPIODevice *gpio_dev =3D (QVhostUserGPIODevice *) obj; + virtio_gpio_cleanup(&gpio_dev->gpio); +} + +static void qvirtio_gpio_device_start_hw(QOSGraphObject *obj) +{ + QVhostUserGPIODevice *gpio_dev =3D (QVhostUserGPIODevice *) obj; + virtio_gpio_setup(&gpio_dev->gpio); +} + +static void *virtio_gpio_device_create(void *virtio_dev, + QGuestAllocator *t_alloc, + void *addr) +{ + QVhostUserGPIODevice *virtio_device =3D g_new0(QVhostUserGPIODevice, 1= ); + QVhostUserGPIO *interface =3D &virtio_device->gpio; + + interface->vdev =3D virtio_dev; + alloc =3D t_alloc; + + virtio_device->obj.get_driver =3D qvirtio_gpio_device_get_driver; + virtio_device->obj.start_hw =3D qvirtio_gpio_device_start_hw; + virtio_device->obj.destructor =3D qvirtio_gpio_device_destructor; + + return &virtio_device->obj; +} + +/* virtio-gpio-pci */ +static void qvirtio_gpio_pci_destructor(QOSGraphObject *obj) +{ + QVhostUserGPIOPCI *gpio_pci =3D (QVhostUserGPIOPCI *) obj; + QOSGraphObject *pci_vobj =3D &gpio_pci->pci_vdev.obj; + + virtio_gpio_cleanup(&gpio_pci->gpio); + qvirtio_pci_destructor(pci_vobj); +} + +static void qvirtio_gpio_pci_start_hw(QOSGraphObject *obj) +{ + QVhostUserGPIOPCI *gpio_pci =3D (QVhostUserGPIOPCI *) obj; + QOSGraphObject *pci_vobj =3D &gpio_pci->pci_vdev.obj; + + qvirtio_pci_start_hw(pci_vobj); + virtio_gpio_setup(&gpio_pci->gpio); +} + +static void *qvirtio_gpio_pci_get_driver(void *object, const char *interfa= ce) +{ + QVhostUserGPIOPCI *v_gpio =3D object; + + if (!g_strcmp0(interface, "pci-device")) { + return v_gpio->pci_vdev.pdev; + } + return qvirtio_gpio_get_driver(&v_gpio->gpio, interface); +} + +static void *virtio_gpio_pci_create(void *pci_bus, QGuestAllocator *t_allo= c, + void *addr) +{ + QVhostUserGPIOPCI *virtio_spci =3D g_new0(QVhostUserGPIOPCI, 1); + QVhostUserGPIO *interface =3D &virtio_spci->gpio; + QOSGraphObject *obj =3D &virtio_spci->pci_vdev.obj; + + virtio_pci_init(&virtio_spci->pci_vdev, pci_bus, addr); + interface->vdev =3D &virtio_spci->pci_vdev.vdev; + alloc =3D t_alloc; + + obj->get_driver =3D qvirtio_gpio_pci_get_driver; + obj->start_hw =3D qvirtio_gpio_pci_start_hw; + obj->destructor =3D qvirtio_gpio_pci_destructor; + + return obj; +} + +static void virtio_gpio_register_nodes(void) +{ + QPCIAddress addr =3D { + .devfn =3D QPCI_DEVFN(4, 0), + }; + + QOSGraphEdgeOptions edge_opts =3D { }; + + /* vhost-user-gpio-device */ + edge_opts.extra_device_opts =3D "id=3Dgpio0,chardev=3Dchr-vhost-user-t= est"; + qos_node_create_driver("vhost-user-gpio-device", + virtio_gpio_device_create); + qos_node_consumes("vhost-user-gpio-device", "virtio-bus", &edge_opts); + qos_node_produces("vhost-user-gpio-device", "vhost-user-gpio"); + + /* virtio-gpio-pci */ + edge_opts.extra_device_opts =3D "id=3Dgpio0,addr=3D04.0,chardev=3Dchr-= vhost-user-test"; + add_qpci_address(&edge_opts, &addr); + qos_node_create_driver("vhost-user-gpio-pci", virtio_gpio_pci_create); + qos_node_consumes("vhost-user-gpio-pci", "pci-bus", &edge_opts); + qos_node_produces("vhost-user-gpio-pci", "vhost-user-gpio"); +} + +libqos_init(virtio_gpio_register_nodes); diff --git a/tests/qtest/libqos/virtio.c b/tests/qtest/libqos/virtio.c index 09ec09b655..d6fc4f5a29 100644 --- a/tests/qtest/libqos/virtio.c +++ b/tests/qtest/libqos/virtio.c @@ -108,7 +108,7 @@ void qvirtio_set_features(QVirtioDevice *d, uint64_t fe= atures) * This could be a separate function for drivers that want to access * configuration space before setting FEATURES_OK, but no existing use= rs * need that and it's less code for callers if this is done implicitly. - */ + */ if (features & (1ull << VIRTIO_F_VERSION_1)) { uint8_t status =3D d->bus->get_status(d) | VIRTIO_CONFIG_S_FEATURES_OK; diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index 28b4cf28ec..04950e8458 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -32,6 +32,7 @@ #include "standard-headers/linux/vhost_types.h" #include "standard-headers/linux/virtio_ids.h" #include "standard-headers/linux/virtio_net.h" +#include "standard-headers/linux/virtio_gpio.h" =20 #ifdef CONFIG_LINUX #include @@ -53,9 +54,12 @@ #define VHOST_MAX_VIRTQUEUES 0x100 =20 #define VHOST_USER_F_PROTOCOL_FEATURES 30 +#define VIRTIO_F_VERSION_1 32 + #define VHOST_USER_PROTOCOL_F_MQ 0 #define VHOST_USER_PROTOCOL_F_LOG_SHMFD 1 #define VHOST_USER_PROTOCOL_F_CROSS_ENDIAN 6 +#define VHOST_USER_PROTOCOL_F_CONFIG 9 =20 #define VHOST_LOG_PAGE 0x1000 =20 @@ -140,6 +144,7 @@ enum { =20 enum { VHOST_USER_NET, + VHOST_USER_GPIO, }; =20 typedef struct TestServer { @@ -198,6 +203,19 @@ static void append_vhost_net_opts(TestServer *s, GStri= ng *cmd_line, chr_opts, s->chr_name); } =20 +/* + * For GPIO there are no other magic devices we need to add (like + * block or netdev) so all we need to worry about is the vhost-user + * chardev socket. + */ +static void append_vhost_gpio_opts(TestServer *s, GString *cmd_line, + const char *chr_opts) +{ + g_string_append_printf(cmd_line, QEMU_CMD_CHR, + s->chr_name, s->socket_path, + chr_opts); +} + static void append_mem_opts(TestServer *server, GString *cmd_line, int size, enum test_memfd memfd) { @@ -1085,3 +1103,51 @@ static void register_vhost_user_test(void) test_multiqueue, &opts); } libqos_init(register_vhost_user_test); + +static uint64_t vu_gpio_get_features(TestServer *s) +{ + return 0x1ULL << VIRTIO_F_VERSION_1 | + 0x1ULL << VIRTIO_GPIO_F_IRQ | + 0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES; +} + +/* + * This stub can't handle all the message types but we should reply + * that we support VHOST_USER_PROTOCOL_F_CONFIG as gpio would use it + * talking to a read vhost-user daemon. + */ +static void vu_gpio_get_protocol_features(TestServer *s, CharBackend *chr, + VhostUserMsg *msg) +{ + /* send back features to qemu */ + msg->flags |=3D VHOST_USER_REPLY_MASK; + msg->size =3D sizeof(m.payload.u64); + msg->payload.u64 =3D 1ULL << VHOST_USER_PROTOCOL_F_CONFIG; + + qemu_chr_fe_write_all(chr, (uint8_t *)msg, VHOST_USER_HDR_SIZE + msg->= size); +} + +static struct vhost_user_ops g_vu_gpio_ops =3D { + .type =3D VHOST_USER_GPIO, + + .append_opts =3D append_vhost_gpio_opts, + + .get_features =3D vu_gpio_get_features, + .set_features =3D vu_net_set_features, + .get_protocol_features =3D vu_gpio_get_protocol_features, +}; + +static void register_vhost_gpio_test(void) +{ + QOSGraphTestOptions opts =3D { + .before =3D vhost_user_test_setup, + .subprocess =3D true, + .arg =3D &g_vu_gpio_ops, + }; + + qemu_add_opts(&qemu_chardev_opts); + + qos_add_test("read-guest-mem/memfile", + "vhost-user-gpio", test_read_guest_mem, &opts); +} +libqos_init(register_vhost_gpio_test); diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build index fd5d6e5ae1..9dc815ddd4 100644 --- a/tests/qtest/libqos/meson.build +++ b/tests/qtest/libqos/meson.build @@ -45,6 +45,7 @@ libqos_srcs =3D files( 'virtio-scsi.c', 'virtio-serial.c', 'virtio-iommu.c', + 'virtio-gpio.c', 'generic-pcihost.c', =20 # qgraph machines: --=20 2.30.2