From nobody Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658863473; cv=none; d=zohomail.com; s=zohoarc; b=dTRIwT/f7mRRwqcH6ok//NBjOTWDfXqdHffwVCffkHqWP+SPqddV0qSpEQVlpo1/skFPp0rYFqHJBY4NDPU6k4+7Nlmwy+NUCKYbYEYHAUg8KiMN9aSEGYXb2W6+0RyKfVC7o/gvGocM3CwvMRfx9ue0Twp+EeZcYQXVpF5PzqU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658863473; 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=6BvLwU4GMUiq3XaMcxliYSNhOBL1ZkQfbeog0e1G+vA=; b=MF0hJcY3CutNEzWJ+/HhcVqp7YagTPYzD1D/VNFnPbyMdmneW4tpl/QVRyT72rAczdkoX8HBHpL9gw/0FQVP+rl6NxyLlhkAXBLc7pp1YbHatJAeb7Vq7OLabwEqZJ7K+vP+2oZl8KbQu9Bz1qLgfu1a/VhyK2GGhQUq/grm7C0= 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+importer=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 1658863473649868.4519207606916; Tue, 26 Jul 2022 12:24:33 -0700 (PDT) Received: from localhost ([::1]:57150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQAS-000684-BR for importer@patchew.org; Tue, 26 Jul 2022 15:24:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQ7x-0003A8-2j for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:21:58 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:34712) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQ7v-0002HB-19 for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:21:56 -0400 Received: by mail-wr1-x431.google.com with SMTP id h8so21433247wrw.1 for ; Tue, 26 Jul 2022 12:21:54 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id v1-20020adfe281000000b0021e5adb92desm14236233wri.60.2022.07.26.12.21.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:21:51 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 728F11FFB8; Tue, 26 Jul 2022 20:21:50 +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=6BvLwU4GMUiq3XaMcxliYSNhOBL1ZkQfbeog0e1G+vA=; b=mt1ohbECoxDfdXXNDvr9KKtjfVbd+NVKnnkfCVDDhFvlwNG4HIIzvyNWQQLSD8wQmn pbdABLCpv7rjUNNO+WMOl1/jQyM37XEDX17CfpPQLbTIhNK7sBK2+BDLiEl+PT95O8B3 JVKEsl40oEk+idmRiGxMPGcDsk9zMERlqZ9n/9orfiDYL29ApEbSpWx9Lv81cgXLAFtr VbKksMkGBTlGNB5qxzkMouFyk1zWTPZovfBjxDPZ7P1lLQNBQIHg8jXMYiLkkyn2LF6i TmtZjpJ2LMe2yo/yhFEsxGvjWs/u7q552qERMgeZc97yQbrWrexNrUGg7+32gt9+nplV Xkcw== 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=6BvLwU4GMUiq3XaMcxliYSNhOBL1ZkQfbeog0e1G+vA=; b=ROfCGoZmL5FNmh2tHa7c2D2tnLHJNq+YAW2EMVZqS7DjcK90hVFoEX617nY4i5gtkO xgyyTFmhi1TR7/ktB7auTbry2gRl2OdqJT/OFrd3CodHQXA6phIzHYCkP1k3iEGAntOH Zf9qe5HUvKo4INZ3Mmu4Slg3rlJ6UZw8lxGKrIPk0WFyxwxlyYQXONZAxIClsG8MzF1i lIZ2puAa68o2aZpbwSOwC4LnT+gFXsVV/q9iVi1LJBHsqpyzaw6w2H4mZ9eskD/oU+Mm dtJ6HikB5BzQ2XK1pjTRZG0CO7yxOnguopgwL6ZEmzOtGDH1sGyYW/YiKs+Kl3P9MraO BuAQ== X-Gm-Message-State: AJIora+OLQihayU5YKcC0lTrhspvGFbYWVs8yucWI8dqcSo3f2P6KdkB ScWwdkpfr3sMf0BVKoTM4s3VXQ== X-Google-Smtp-Source: AGRyM1uol9Yr9oiP/61aNz24XH7wAilYG5W8/KgjHuI0ikjp+EXv0j+PTnFwy0l2lmuUFUL7d4oAYQ== X-Received: by 2002:a5d:64e2:0:b0:21d:38e8:2497 with SMTP id g2-20020a5d64e2000000b0021d38e82497mr11011148wri.142.1658863313836; Tue, 26 Jul 2022 12:21:53 -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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v3 01/21] include/hw/virtio: more comment for VIRTIO_F_BAD_FEATURE Date: Tue, 26 Jul 2022 20:21:30 +0100 Message-Id: <20220726192150.2435175-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658863475474100001 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 --- v3 - s/vhost/vhost-user/ --- 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..9bb2485415 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-user to advertise VHOST_USER_F_PROTOCOL_FEATURES between QEMU + * and a vhost-user backend. + */ #define VIRTIO_F_BAD_FEATURE 30 =20 #define VIRTIO_LEGACY_FEATURES ((0x1ULL << VIRTIO_F_BAD_FEATURE) | \ --=20 2.30.2 From nobody Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658864106; cv=none; d=zohomail.com; s=zohoarc; b=JbvCmKwK4tzx1Ol/w48BpU1fCWiWLxV9PVZ7Jzeh7pSVgKW0udDunhPoGrZ6OP12YFByEQAyY9NahRc/YwczetNtC9UqiL7tbjwuQ4mKiZEN80Ah2tExurcrEm4zJEW/qICEF0UbmPoIck7qeyW7aibxhb1icDCQxirAEOFolF0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658864106; 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=YA8bK0QimOlD2NvATId4ShuayIO9M3XtMDLWtyqNjMU=; b=cnkOWJamCHNlOXE7nkEMzrN+Z3qWknR5TvCGf3KLd1bFU4YCd97tg64ZJ0b29lgar2pmR/ppy7w+f8xuTZwzveMyB132iEzxLfUjIfc6+F6zKCViHkA8h/xz9RXSw8Hick5EMTJKWyV8zaxKmNaD6VCmDJP2NCvGq3xhtLfqGBE= 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+importer=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 1658864106907756.297711804834; Tue, 26 Jul 2022 12:35:06 -0700 (PDT) Received: from localhost ([::1]:44526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQKf-0000rC-98 for importer@patchew.org; Tue, 26 Jul 2022 15:35:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48806) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQ7v-0003A5-T3 for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:21:58 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:40548) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQ7t-0002Gz-Rr for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:21:55 -0400 Received: by mail-wr1-x431.google.com with SMTP id m17so21166314wrw.7 for ; Tue, 26 Jul 2022 12:21:53 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id h21-20020a05600c351500b003a31df6af2esm25229340wmq.1.2022.07.26.12.21.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:21:51 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 8A6AA1FFBA; Tue, 26 Jul 2022 20:21:50 +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=YA8bK0QimOlD2NvATId4ShuayIO9M3XtMDLWtyqNjMU=; b=rvCiJcliKYs27pOKccyWbWtEwBAGTJnUIVV3uD0ieM/Jj0FL/nfm1fESd0M6AaLIQ9 UtPCVOd+dJQUqnefBkpnS7b9Qrjsw93toP7BioknpsGhscDPCGth7OVMgyMu8r4wlr/K R46chISaJ0kVR9ouJ/mZODJDG07oHeJF3hq/Z6gWS5uSY1LoUf0T3RzbKtH1vZLh3e29 xOzX5TsbtKjCoPV3tPWWjsyDE/18Hwo305voq5+BmVUPLx+V0Nqj1/+1ohcJHxCnVJsJ sdUcwzKRNndiAlGNhHQFcZDTDtWAW4uJ0yh4wcsDIlVyZuPet60YWUrJ1wDrCw2DhEay GqHw== 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=YA8bK0QimOlD2NvATId4ShuayIO9M3XtMDLWtyqNjMU=; b=fSKa6cKkNVeMI9Wedeuxmz86fQvb+Kz0YosJDGLGIqgXeBERfTKoCvmHu7qjj+mvjP j6ycdBWOit5h28jriv4gGCOfvipaSmHomsId7htdBi0/rJyISBQ8j08oivK/wrtZjC6S M7ubLMx5G5nwUNDTjkjRBtOEk+XAust/hqOpNUXRGP10tF6eDfm2lHcSUeVsxum0akIr LHI+zE3YeQtHZsNCJoMIGjukNjMvmwbksfgRlnOgGncZ3BXY3BLFgKeI6gSAMuFj04WD gEHgo/bDDfmonbACJ9aXneBKgwwKk9fzC0+nXMB1oWwZPo+wbamovY+ufXrsifebhVrB RWhw== X-Gm-Message-State: AJIora94J0EAJhvahOUkcYrLt92PC5gzSXtfeWYdwxciaX7DHb6JulV7 CxYVglJwjNumfkIEhYs6VhBLkQ== X-Google-Smtp-Source: AGRyM1v55a66K/AQi26HXoAL9CEJVPVAMRdLt5PXAFlOS4vlblXY8EJ5hZ6fWP8ST3KpSIOXZ/xz4g== X-Received: by 2002:a05:6000:2a8:b0:21d:8c81:7eb0 with SMTP id l8-20020a05600002a800b0021d8c817eb0mr11435997wry.460.1658863312083; Tue, 26 Jul 2022 12:21:52 -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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v3 02/21] include/hw: document vhost_dev feature life-cycle Date: Tue, 26 Jul 2022 20:21:31 +0100 Message-Id: <20220726192150.2435175-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658864108164100001 Try and explicitly document the various state of feature bits as related to the vhost_dev structure. Importantly the backend_features can advertise things like VHOST_USER_F_PROTOCOL_FEATURES which is never exposed to the driver and is only present in the vhost-user feature negotiation. Signed-off-by: Alex Benn=C3=A9e Acked-by: Jason Wang --- include/hw/virtio/vhost.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index a346f23d13..586c5457e2 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -86,8 +86,11 @@ struct vhost_dev { /* if non-zero, minimum required value for max_queues */ int num_queues; uint64_t features; + /** @acked_features: final set of negotiated features */ uint64_t acked_features; + /** @backend_features: backend specific feature bits */ uint64_t backend_features; + /** @protocol_features: final negotiated protocol features */ uint64_t protocol_features; uint64_t max_queues; uint64_t backend_cap; --=20 2.30.2 From nobody Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658863478; cv=none; d=zohomail.com; s=zohoarc; b=e+Q/X2VB5j8A+wc+LTiI9rY0smWgEBdHmJKum3vjldb2Eyp3eOuwtG1KMZ9YWsCmTb8/Zzg59cJTAff7Fqzz3tq9FZxEUpKN7pG6xOZXIWj3d/7cne4OH9pgxNd811UZypb0khEz6vk9C5qDu71QGLB5kSpQU13gtNu06bjjv/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658863478; 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=84wQKQaoKJK6iaVE173auQGOX9Kt1NYCFzy5qnZ8uJk=; b=dThkr89TBZCxex0ereOg6w+mTd06WMkpLyM4TCr+PkgtUMj2toOS9AqISeRfbsJr2eotf2K0tZdo311HeiQulSrJqsl/V5IPqvF/m1RoGLZfPB9itQNormd3RUt23MK04CzUMf3kiRMNV4BbSTVmt7/cx0FMN+hdlAunjW0lCh8= 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+importer=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 1658863478081411.12603041549323; Tue, 26 Jul 2022 12:24:38 -0700 (PDT) Received: from localhost ([::1]:57158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQAW-00068J-Hh for importer@patchew.org; Tue, 26 Jul 2022 15:24:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQ80-0003Cz-HR for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:00 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:36553) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQ7y-0002HV-0i for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:21:59 -0400 Received: by mail-wr1-x436.google.com with SMTP id g2so13396966wru.3 for ; Tue, 26 Jul 2022 12:21:57 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id g3-20020a5d5543000000b0021e4bc9edbfsm15095344wrw.112.2022.07.26.12.21.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:21:51 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 966EB1FFBB; Tue, 26 Jul 2022 20:21:50 +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=84wQKQaoKJK6iaVE173auQGOX9Kt1NYCFzy5qnZ8uJk=; b=kch7zEt17q5jtDmuSy/r4PrZ0BPhTdm93LGH5/AQ2qqOpD9tBfi4PVRFPzHSxRDC22 xtCuwNNEACgZbHpfRPtnnpM3Sbfq8vrEfySYWcBH2d4sVRSGN/bqwxql9XA02cZE/aaI TS1mLiyz4E4/16JX2qbG8Gkmg8BiYXR4X1C7r7u0PYV0jZZwHz6IlY5EVvob/a7I4oMO jsgaw8itkUk5tsUKOq/Oz2BWa+crPqxyzK4lpw8rK5huxgktACtL1yFDIfjQzCottYwr 0cLFbICEcAQL68TZVb6Tlge0sfH9doQBI5P7huFLAvwISkRBx+E6inh7tradlKTbTJ7R lygQ== 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=84wQKQaoKJK6iaVE173auQGOX9Kt1NYCFzy5qnZ8uJk=; b=tLoOD6fQ5oaoFO9tgmjHgaCZydu8TeS/6UjcvrK4lFMIz7GLvYdeK0o2kberJEfspL 8UDmKveriKr+t1u+W61lzR19ovXuJpsw6AZNGjrubnOwG5ofrCy6FYHthLpgRIf6OwKn D4lWqwJAygu/qMlgbY6WNmUyBwTcOv/gnlMFhajU9D+Ong9PXywB3lhGMmZZEMuEN4Yq t4+gNGFxU/N1wPjLhNO/GOBdCz0pAOAcJSxCWMdGWYwdd6Wd0nNI9DOftgcRqFPfWHze 0D7MChyLAqH6hOfcQfCxDcvkt3fSGLT/KnyXPzWn6UC46hv6msjgfJztjJNZU3W5CkF6 GHrg== X-Gm-Message-State: AJIora9joVfhv3S6py34eZQWz4JqrwoyFEsfqMQDaSFnQDQHxE7TpKYV YwOPqNbdbFfKcEjchVwIBCclUQ== X-Google-Smtp-Source: AGRyM1tYFS5T4JB9pCJKP+5yHNnwItuOyc5yLE5g7OzQRU+V2vfQyHwcZMmzNrLDk2+TSk00H7eNNg== X-Received: by 2002:a05:6000:188b:b0:21d:b277:d492 with SMTP id a11-20020a056000188b00b0021db277d492mr12246772wri.311.1658863316526; Tue, 26 Jul 2022 12:21:56 -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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v3 03/21] hw/virtio: fix some coding style issues Date: Tue, 26 Jul 2022 20:21:32 +0100 Message-Id: <20220726192150.2435175-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658863478531100001 Signed-off-by: Alex Benn=C3=A9e Acked-by: Jason Wang --- hw/virtio/vhost-user.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 75b8df21a4..55fce18480 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -200,7 +200,7 @@ typedef struct { VhostUserRequest request; =20 #define VHOST_USER_VERSION_MASK (0x3) -#define VHOST_USER_REPLY_MASK (0x1<<2) +#define VHOST_USER_REPLY_MASK (0x1 << 2) #define VHOST_USER_NEED_REPLY_MASK (0x1 << 3) uint32_t flags; uint32_t size; /* the following payload size */ @@ -208,7 +208,7 @@ typedef struct { =20 typedef union { #define VHOST_USER_VRING_IDX_MASK (0xff) -#define VHOST_USER_VRING_NOFD_MASK (0x1<<8) +#define VHOST_USER_VRING_NOFD_MASK (0x1 << 8) uint64_t u64; struct vhost_vring_state state; struct vhost_vring_addr addr; @@ -248,7 +248,8 @@ struct vhost_user { size_t region_rb_len; /* RAMBlock associated with a given region */ RAMBlock **region_rb; - /* The offset from the start of the RAMBlock to the start of the + /* + * The offset from the start of the RAMBlock to the start of the * vhost region. */ ram_addr_t *region_rb_offset; --=20 2.30.2 From nobody Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658863484; cv=none; d=zohomail.com; s=zohoarc; b=lSPGlBbC2/EAs3CmFgzGz6YoYAjd9sN8tLoaeBS9uCemULbeo7dOJh5evqiCabKueHgQ+EZFGuNrrv6ohwEzL5YMRTIIBp08wUTPAQ3x1NLurjeah6lV7KdScbHLetWmDJvybwWYB5FmZeZQy+Y+EQxPhzShf0QWkCqhON1xHU0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658863484; 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=kIauFkEBziEhsZfmDYmqUoKaLQlqvxSrwk3Mtb6urFc=; b=nMFlbZTWK8uBLJWa4dAvkeNzwJ6ZWv54Dsy+zYxWDOp1aj1MqJf6HBw/C/eU6NKLFVP8QGlq/pN+4xQATpJSXBv71s8Hv3gB9n56hnrRte9eatQOYbhORpuyMD17ZELY032783zGSwO43kGFrL3K6IwGN+5Mg5/9Gba7oRTrdbE= 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+importer=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 1658863484113398.3406383749639; Tue, 26 Jul 2022 12:24:44 -0700 (PDT) Received: from localhost ([::1]:57238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQAc-0006CN-If for importer@patchew.org; Tue, 26 Jul 2022 15:24:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQ83-0003F7-RX for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:05 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:39614) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQ81-0002J0-3R for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:02 -0400 Received: by mail-wm1-x336.google.com with SMTP id i205-20020a1c3bd6000000b003a2fa488efdso6141019wma.4 for ; Tue, 26 Jul 2022 12:21:59 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id n124-20020a1c2782000000b003a2c67aa6c0sm21414582wmn.23.2022.07.26.12.21.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:21:52 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id ACE791FFBC; Tue, 26 Jul 2022 20:21:50 +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=kIauFkEBziEhsZfmDYmqUoKaLQlqvxSrwk3Mtb6urFc=; b=CPInlFtb/85r3ZO40q/xNOn/CdDUM4g0YYOTXgUknWgnTURFYwi+OvC2WwvbyKNbBu n3K9eATd/2S/cMZwUhjFQYDGdfRG7PXS7R/x9G2DuJaYu6MAKIuHi7HTVFKfrSa0p0yP 71ynElwzzRAPg84dNAOkUDNY5+PW+hFzH+NtX1DpnWkLg/gienInDvYVuRh5w4yGtNj5 ay9YkfdAZ2/dVfBX+XWB70zdvvhfHd2EC/N2xIDDE2Hgc3hXm1Szug50XW41VpKnOifW qb/ndMQuwAwkLgkT8SV0+Xi3N2xHgSJC+Eo4nEBP/lba9YtoJy0rgulVHaY9g68dobOK LGbA== 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=kIauFkEBziEhsZfmDYmqUoKaLQlqvxSrwk3Mtb6urFc=; b=oS8WDR8KjD7d2O0JHxW9Yx6lOkPxlZDQP9cCLc8+jsxIgu46sz/PvEdRa21yaVqfBr IdAYhiWM7Np+vfnruy8FtwBu3B5Dg+d3COeYNrmV3inHpshuXPhQEGDY2j9NCQBOLkKD kfQtE8rgBid8pPMeh1UAZnryuLA0bGp2Vb1XIziw+/xP45GqDOqXWZsW9LkGGILPFPl+ 9NwUIfORfCuGtCZgcrPaCS4knqhszcEwkfosNhq44dxFvbV3xpQ9nBLqG6umAHA7RQ30 +YlwU6ceiwazviwYSZ9UhiDo9s8+b6u4w0VWvsKyONmPiOKj8XU87Hyx8tkDeGIoGDLP WRpw== X-Gm-Message-State: AJIora9cGDFPpV56gO7NGBUKKOIbJEzhosVdAO5s+3MiFOSBemrhwXrv StcNLPeuCbPV0HJqrz9By9B2bQ== X-Google-Smtp-Source: AGRyM1s9YByjn5KoOj2iw8/CbmgG+/WfPSn8ESd0wtaN+D8muVBXAF3RSf15A1XN5J2FRLZQMeTunA== X-Received: by 2002:a7b:ce8a:0:b0:3a3:1181:20ae with SMTP id q10-20020a7bce8a000000b003a3118120aemr456964wmj.96.1658863318849; Tue, 26 Jul 2022 12:21:58 -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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v3 04/21] hw/virtio: log potentially buggy guest drivers Date: Tue, 26 Jul 2022 20:21:33 +0100 Message-Id: <20220726192150.2435175-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x336.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658863484761100001 If the guest driver attempts to use the UNUSED(30) bit it is potentially buggy as 6.3 Legacy Interface: Reserved Feature Bits states it "SHOULD NOT be negotiated". For now just log this guest error. Signed-off-by: Alex Benn=C3=A9e Acked-by: Jason Wang --- hw/virtio/virtio.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 5d607aeaa0..97a6307c0f 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2980,6 +2980,13 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t= val) if (vdev->status & VIRTIO_CONFIG_S_FEATURES_OK) { return -EINVAL; } + + if (val & (1ull << VIRTIO_F_BAD_FEATURE)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: guest driver for %s has enabled UNUSED(30) feat= ure bit!\n", + __func__, vdev->name); + } + ret =3D virtio_set_features_nocheck(vdev, val); if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { /* VIRTIO_RING_F_EVENT_IDX changes the size of the caches. */ --=20 2.30.2 From nobody Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658864463; cv=none; d=zohomail.com; s=zohoarc; b=gpeA+b4D8fb+NnRl5BpjRN7KsYx6wZ7qJEoGsAnX7BfPh/4szB1sD3mCDIOrJss6dgg/K93axQSh0vEvVruzRGul6qVYKeh/HFN69k+XaufpU75R1FymSZ4G6tXuNQYtbZRERdAljBkP8YFoARJFwcXPceiM0OufjfyCNBiClIM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658864463; 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=c6PIYMIE3JaTrY/DQKZRjBqoWth+KWJVDK8v0sIayL0=; b=mqnswL4xukF0mbJ3d7P3JOmx8yGxfKl5LGnWv3vObWgZo110q9srVGwGIvjIWzzc2z6aEXznriM/EiFD6qPsoYN9NQ+Sa9G8PZNCeNx9GfQyUtoTs429EVjvXkth78xDM3bjy2TrFAsQz4nF9meRxQYryvAHntRpwmFhC83rL3Q= 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+importer=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 1658864463579611.170290655537; Tue, 26 Jul 2022 12:41:03 -0700 (PDT) Received: from localhost ([::1]:51354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQQQ-0005dY-78 for importer@patchew.org; Tue, 26 Jul 2022 15:41:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQ85-0003F9-1O for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:05 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:34653) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQ83-0002Jm-Jm for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:04 -0400 Received: by mail-wm1-x333.google.com with SMTP id r1-20020a05600c35c100b003a326685e7cso1292854wmq.1 for ; Tue, 26 Jul 2022 12:22:01 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id bd6-20020a05600c1f0600b003a050a391e8sm19502099wmb.38.2022.07.26.12.21.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:21:58 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B8A781FFBD; Tue, 26 Jul 2022 20:21:50 +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=c6PIYMIE3JaTrY/DQKZRjBqoWth+KWJVDK8v0sIayL0=; b=Yd1RoS03X2dpWLourmcbXGS38aK3+3OavISnGFTifCiACdYTsYuAM/VnhG3XMXv1Jd s6kcKw9HFfzu3Xa0Z+jm9NP6xnKsteMi36yME18o6xLclNZuX+Xq7BuxATIqQUijw0Gr SIKuveVbEZ5EvAMUAaUoGZE/MbWIvk1dC9IMuFOO1aYsH93t/Ddt8z94WQ1VphMsnZny 6REMkZ8dS9zopGQNP4gHydFnWtk6KVWHlMCWdFU87mp1ebMYhj1c6mWENRRjLJugRG9+ 3aVQPO+k0cX9ax7FZoIF9pVYOknXhuFlX+3rlgu6httxTv9iUHb4W85giUi/LMO4RYiB 3xXQ== 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=c6PIYMIE3JaTrY/DQKZRjBqoWth+KWJVDK8v0sIayL0=; b=S96P140QL/Gt4fmneV2GI5ld2MnYBeQPaG6Kzy7/DgvSqjdtcFO6la+hG6rm/O6E4M xKLPtsNinZ5mVraDjwZ7BM9FQpsHeCw/gCqeTWU2GZF0BGF27mK7TCwW4XKXQy4BKxUX tiHwcClc3QnL7+gT6b2rfAYCL+/AfHsFB8+nf9kJVBooEDAclF5JkSLQZP7Lojq5CMg9 glrQMolchi2FrSxJsmsPnUDJcwqH+Rc6CkQG5f5DcUtrmYydgz6pY4VaKABA+KfDA7zS NddGp8b7K3h3B0KKfcXMNoOX/zy/ULUbmwyvqe1LLBd/v/Kk8QYd6HUbwfy7A2UgJ0Xd FsHA== X-Gm-Message-State: AJIora+qYAlx7owHLuDU7YehUStjNb5HnJ3TYcr/ALMHrpnwqFiLw1kZ sHmfvjXsofSRkhR8V25u1UtemQ== X-Google-Smtp-Source: AGRyM1vS/VFK0v5dRH2s16M8HUIJiaCfIU+hkNCeZ8NnLJu1K3C7s/9xytbuGo7MoaN6IP4AT0fIXw== X-Received: by 2002:a1c:2981:0:b0:3a2:ffe9:945c with SMTP id p123-20020a1c2981000000b003a2ffe9945cmr478140wmp.38.1658863321016; Tue, 26 Jul 2022 12:22: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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Coiby Xu , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org (open list:Block layer core) Subject: [PATCH v3 05/21] block/vhost-user-blk-server: don't expose VHOST_USER_F_PROTOCOL_FEATURES Date: Tue, 26 Jul 2022 20:21:34 +0100 Message-Id: <20220726192150.2435175-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x333.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658864464772100003 This bit is unused in actual VirtIO feature negotiation and should only appear in the vhost-user messages between master and slave. [AJB: experiment, this doesn't break the tests but I'm not super confident of the range of tests] Signed-off-by: Alex Benn=C3=A9e --- block/export/vhost-user-blk-server.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/export/vhost-user-blk-server.c b/block/export/vhost-user= -blk-server.c index 3409d9e02e..d31436006d 100644 --- a/block/export/vhost-user-blk-server.c +++ b/block/export/vhost-user-blk-server.c @@ -125,8 +125,7 @@ static uint64_t vu_blk_get_features(VuDev *dev) 1ull << VIRTIO_BLK_F_MQ | 1ull << VIRTIO_F_VERSION_1 | 1ull << VIRTIO_RING_F_INDIRECT_DESC | - 1ull << VIRTIO_RING_F_EVENT_IDX | - 1ull << VHOST_USER_F_PROTOCOL_FEATURES; + 1ull << VIRTIO_RING_F_EVENT_IDX ; =20 if (!vexp->handler.writable) { features |=3D 1ull << VIRTIO_BLK_F_RO; --=20 2.30.2 From nobody Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658864682; cv=none; d=zohomail.com; s=zohoarc; b=RjNsFMW11aFFB6Tj5yTsl2RAI6DBwfxznOrhzX3SOml1kd7TwKBVHxM1RalL+pyi6oASEwg4ibXw5e5dN/GWXowWoB/AnxaHNPFEVlzFpJF3zlRT/HiVGkOSZXsGqDSQvIJfS/Oa/yV7ACgKM2H0vh1HyWOXkcBOlIeimpDSkAI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658864682; 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=LTNybQ3j99OfucIFux/yLfgRaMJqRwC34AP3ZvaRhZ0=; b=CMByrpzlhNSiOgG/Jw0+hsmj0fIz4zL3gfs1ZfLghpxHywX5woR51zEtXvaVZpke1hTxACjmBAgOEAwn2/U0ZaH3k+cmNWOHuP9mBCBDiUtAVMoyPZEopGgxtDF1oZ/hUf9S1c7uI5fnH9fZt3u2VAQmQ1xVbo2EB39q4gcRSbM= 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+importer=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 1658864682678104.01809682737257; Tue, 26 Jul 2022 12:44:42 -0700 (PDT) Received: from localhost ([::1]:59674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQTx-00033W-Ie for importer@patchew.org; Tue, 26 Jul 2022 15:44:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQ86-0003GB-8J for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:07 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:45589) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQ83-0002Jw-KN for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:05 -0400 Received: by mail-wr1-x42c.google.com with SMTP id v13so13679311wru.12 for ; Tue, 26 Jul 2022 12:22:02 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id k66-20020a1ca145000000b003a2fdde48d1sm18548865wme.25.2022.07.26.12.21.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:21:58 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D070D1FFBE; Tue, 26 Jul 2022 20:21:50 +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=LTNybQ3j99OfucIFux/yLfgRaMJqRwC34AP3ZvaRhZ0=; b=QUWI0g7DdWfKkgII/OjGbhRWXJcgm++PJpQC2QIKRNp5CXImPv9wBXpTWRkv572tz6 uS2Hsj5+D1c0LPrea1oZSOc4UBbuRIShpJjmSNFjs2iAjIS8w4iqZZdzhmvmZ6qhpQrn gdi6rthlOJsWFM2yrtR+QevuCGDssYHHv/JCzOKBtZHFARKpQoku1ngcEQgyyHGzSMf4 B8UgOnozsvXYToAfaWfd81CelY3kD8gznml5lNP+Xe3Wr5wI/zlZsTu5JQa0sRE9Ex5p DIQ9lNw6irSeMTo0EJfbl+73fc2V8Qd+oFFlIcP2IF+O4zzLxBueq/2zT/iVIjzjXrb9 kD5w== 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=LTNybQ3j99OfucIFux/yLfgRaMJqRwC34AP3ZvaRhZ0=; b=QNjtRGrV6W/5htguUW5DeiNVhmZ/pBIogkQV3VYWJxxHbTjgCLeMDABQk0645Rqw4K zt/pqQ5tNhpGyUgpTpBWgGpYFbb66MQcKQJxR7Kro1QwHO7NIEj0QbVEEFqUvlxJs80+ 8diT0Oa473ZP7LvFkvzxJvDxUd6eClqD9IP99l1g4MQHYZUOc2SCyYzcOQxNmKL1Q+sF Hca8XLp6n0Q+cQKdUyFjTlIta3ly9iS+r4iTdUOvJiklBWZ5VJ+rsXwm1N/ETbHXWZdE EpMoxFV+No9HIaPyrq3a7jrVLuWP7kIih51FWM/RfsZmCnzXwX7+AS4ygcLgYOD40TV4 tJ9A== X-Gm-Message-State: AJIora/3ljiHQ4CRF0Dv3GODAOpeL92EKDxLGanOogBN8xjktzITehdY NcfpN6Tl0vPYry365V+/5nyWIw== X-Google-Smtp-Source: AGRyM1tKLkE3cmwG7Mnlwh6DEr+JoRYn9FssLmWJaWP9KNNoIICux/GYnfXRavgCMkWo84Bncnmi8w== X-Received: by 2002:a05:6000:1841:b0:21e:81a3:e6ef with SMTP id c1-20020a056000184100b0021e81a3e6efmr8889243wri.369.1658863321806; Tue, 26 Jul 2022 12:22: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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v3 06/21] hw/virtio: incorporate backend features in features Date: Tue, 26 Jul 2022 20:21:35 +0100 Message-Id: <20220726192150.2435175-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658864683546100001 There are some extra bits used over a vhost-user connection which are hidden from the device itself. We need to set them here to ensure we enable things like the protocol extensions. Currently net/vhost-user.c has it's own inscrutable way of persisting this data but it really should live in the core vhost_user code. Signed-off-by: Alex Benn=C3=A9e --- hw/virtio/vhost-user.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 55fce18480..a96a586ebf 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1461,7 +1461,14 @@ static int vhost_user_set_features(struct vhost_dev = *dev, */ bool log_enabled =3D features & (0x1ULL << VHOST_F_LOG_ALL); =20 - return vhost_user_set_u64(dev, VHOST_USER_SET_FEATURES, features, + /* + * We need to include any extra backend only feature bits that + * might be needed by our device. Currently this includes the + * VHOST_USER_F_PROTOCOL_FEATURES bit for enabling protocol + * features. + */ + return vhost_user_set_u64(dev, VHOST_USER_SET_FEATURES, + features | dev->backend_features, log_enabled); } =20 --=20 2.30.2 From nobody Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658863744; cv=none; d=zohomail.com; s=zohoarc; b=FF3u30XOjWFyQlZNBU2jjLgKrbcI6d0lit5io2AxCHbXn8SC56qq58xhVs1awBldNP/xhbVfCAZbj2z9F+hHlgbSQFwKsJfVzsyrg6DiytbEsYfA1kSfv4vRnIhvJjtFW/njLTXUw6dWuxunHlcJVeYa72XrkOnacrhS2soJ8Ms= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658863744; 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=YW2c5Ruij34p53cQgqpluStohGrUyVawQTLXfkuUxOo=; b=ZR6QEfCUM+AktyqMPRVhwOrPWN5tqQCnmEX6rGPJwt5WY6DF2secT0Jl7xs81VdxSwh8FXV0ON4Tbyk+Rfvm74FGShkEYxlkul88eouZDujU8Zdb8ASSKWV4mxYSfjCA2/rLIsrP9P9Nj2YxO4G2fg+IBfUahzwnRhOhvd8CWMQ= 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+importer=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 1658863744303902.0410956520892; Tue, 26 Jul 2022 12:29:04 -0700 (PDT) Received: from localhost ([::1]:37890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQEp-0003tf-7d for importer@patchew.org; Tue, 26 Jul 2022 15:29:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQ86-0003GD-NV for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:07 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:46824) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQ85-0002Ll-4t for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:06 -0400 Received: by mail-wr1-x42b.google.com with SMTP id k12so3724140wrm.13 for ; Tue, 26 Jul 2022 12:22:04 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id r10-20020a5d4e4a000000b0021e8cdd0c48sm5817324wrt.15.2022.07.26.12.21.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:21:58 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E72681FFBF; Tue, 26 Jul 2022 20:21:50 +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=YW2c5Ruij34p53cQgqpluStohGrUyVawQTLXfkuUxOo=; b=mxvYJxqybnU5jakdvC8TcDlzX/usyNx5Wm0CRIsmFrTfR8pVOkJN0gLh32kz+stE69 +x0ewWu94fub2IgPadAZjXc/Loy432wGw76WssW8PLLNmrUKeJ2/VSh+c1Mz2K6lw7Vg az7/YAw5aZqAmxYsVGgmsnB8rY1uzcXn+mFwzgl4r5O+k72DZHVHQ2k6M50ZmWPBKGyR 8ZbE9WrahN8FEWI1S//DXA+C7x5EtkpMokn37ldhYJA77yNDMGV3r2BVr+lcYMntgziV 6Ga00M5/lEcegD/sFHDV2ODJjX/llNH5h+aZV5zKzWFC67JwFzCHxkKtEMKJCpD1LGox US+A== 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=YW2c5Ruij34p53cQgqpluStohGrUyVawQTLXfkuUxOo=; b=QOoV27PcLwtzsP4Llj6UD0a6mFqE6+s4vA0heqcBZLzogSV/jBgMKohTj5h2eSfil3 FC/QP51hPX1FUvYY83Mk3j/KxWHOFHKYwU++wHHUI4co+SfsaHd2pqqCvWXSqnyivHTA xWh7bAZHv8J+rYfCpzz8Zlhboed768z0SKmnfVH6hroDhjpEvo3HvB/OB/R1veOuqqe4 L/XSR4gyDZp8rsQEAeIza5qr2JG/A5w7RAFLn+6sv25M+GvmbmdnZAF596FAAGkCeg1u oXukCYmbDhXl3UnismCeHTByiSaYKLFuEgytORcdGerpHuIuFdqR9WS4A0dWjPTNNghg 2HuQ== X-Gm-Message-State: AJIora/dos5MSRiTfuTqLxdwynFGHze9CHRy5rZ3S/8B2jVDfk5Lo57q xaj8ufd2RYKKKxin3hKSe80PaQ== X-Google-Smtp-Source: AGRyM1vkBQxXP6RR1a9KCB5pb7odPrrmyGguK285vAa7LR5xplBNAXaeE/3Y1rMD1+mnVBJraNB1fQ== X-Received: by 2002:a5d:5a12:0:b0:21e:8327:7e03 with SMTP id bq18-20020a5d5a12000000b0021e83277e03mr8714054wrb.567.1658863323822; Tue, 26 Jul 2022 12:22:03 -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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v3 07/21] hw/virtio: gracefully handle unset vhost_dev vdev Date: Tue, 26 Jul 2022 20:21:36 +0100 Message-Id: <20220726192150.2435175-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658863745078100001 I've noticed asserts firing because we query the status of vdev after a vhost connection is closed down. Rather than faulting on the NULL indirect just quietly reply false. Signed-off-by: Alex Benn=C3=A9e --- hw/virtio/vhost.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 0827d631c0..f758f177bb 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -306,7 +306,7 @@ static inline void vhost_dev_log_resize(struct vhost_de= v *dev, uint64_t size) dev->log_size =3D size; } =20 -static int vhost_dev_has_iommu(struct vhost_dev *dev) +static bool vhost_dev_has_iommu(struct vhost_dev *dev) { VirtIODevice *vdev =3D dev->vdev; =20 @@ -316,8 +316,12 @@ static int vhost_dev_has_iommu(struct vhost_dev *dev) * does not have IOMMU, there's no need to enable this feature * which may cause unnecessary IOTLB miss/update transactions. */ - return virtio_bus_device_iommu_enabled(vdev) && - virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM); + if (vdev) { + return virtio_bus_device_iommu_enabled(vdev) && + virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM); + } else { + return false; + } } =20 static void *vhost_memory_map(struct vhost_dev *dev, hwaddr addr, --=20 2.30.2 From nobody Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658865043; cv=none; d=zohomail.com; s=zohoarc; b=QLQiO/CABIaV3Kjbs5FhksHnlgTCxoAIVi5cPcFmpao+N+8eYz7ah3UzIl5Zpf/4hqJ5i7gkff+ACbB4vTgrn+tPb0l1fxZbWWWQhX/z5pePeHEy9ecCCBKSwigkYYSkzbAn5CNqG0duL33OEhRaP1bM03NOVFvkU9sd7jMjW4U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658865043; 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=dtgiw49DbQeIrzltHG3Fc2GoOsMK1WlBSvR6Tgd5p8o=; b=RMZc+HjK859SzKK3YIqwgy/RJDZWEM1vAsq6F1M52kK5wXE0fXJFBz4KAnpIqg/tW1sbVy10b9vF/iv8/UjzfbyqF3sXnpELr0sv62ZkMqmTAxmiMgqZn2jdPtbXbstTlceexU92xFfa0L17M/u1lLulf9y8LhbcHgcrOSdcioM= 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+importer=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 1658865043472453.7906578482713; Tue, 26 Jul 2022 12:50:43 -0700 (PDT) Received: from localhost ([::1]:39802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQZm-0000NK-Cv for importer@patchew.org; Tue, 26 Jul 2022 15:50:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQ88-0003HN-Li for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:09 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:37768) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQ86-0002MG-6o for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:07 -0400 Received: by mail-wm1-x334.google.com with SMTP id c187-20020a1c35c4000000b003a30d88fe8eso11898659wma.2 for ; Tue, 26 Jul 2022 12:22:05 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id z11-20020a05600c0a0b00b003a17ab4e7c8sm27433520wmp.39.2022.07.26.12.21.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:21:58 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id F347A1FFC0; Tue, 26 Jul 2022 20:21:50 +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=dtgiw49DbQeIrzltHG3Fc2GoOsMK1WlBSvR6Tgd5p8o=; b=I6++dGXR/r6EXe9HQKIYlBLX+SqqIxoZcw+d+iIfMwVYNxH/NSY9NygXDz8bBeZ0Es bfASyqOUHuvZxLxcE9QbCL4FiS807KLVrKpTqgafHNFfHzpOGvHhsRa4z6EY9mWXCVrm mGt706UgzQ/xCxXijQ5kyG6CpCQ4f+rNBO60kV2z0yZNveEzWYMJ5cHaPFTUM/IrFzur 72X+Mo7FVf64po3N3yV7qAgVp/AhSoLCKsRR2FhTVVRXnzEGvdIyffrhXmxtJUIq+YzP uvISeaaXkEg1cJWuSYWcetNf6yvMSAXiOjtskWIZZ2VDkJU0EQruugQy8eZxN/tsBycM QPyw== 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=dtgiw49DbQeIrzltHG3Fc2GoOsMK1WlBSvR6Tgd5p8o=; b=JqO/sa7V4o7bwYgiciNSnrgSUXkFH8imYrX0bvdqUPkUV0QQpz1GYWIhj74AYMKB7f LRafd2ppGc0blTHQ6n4LjPhbxJHX0SIPBmU72tHKACTEHQzu/uSw2r47dLxelTChdk08 Vvbiej9d7q8whmwwDZZlhHemYhvAtY1DSLQAg3JRw+bLhHBgnqUKJL8A9jlow+YY+apc 21VZwLESg73x7HsHdqqiUI86DrcgZJvAcqnmidoJ7V2mfT8CD0yNDRdRodBhScpiTm1w NmBY6Qr2XHxwj4cs61qsbnSkT571sT4d2B81D5g236HBxFLXVKb7KkYPYghM+fobCzNz BjyQ== X-Gm-Message-State: AJIora9BS/fJf2/IeIUjdrFy8UB7ROGPpr7wPsGLXSGMYKoDC3QQhK/E Ni1I8qc/TLHnrKrNasKUNtcr7g== X-Google-Smtp-Source: AGRyM1tbIhT5QzrdEnJ49sSvrDLcNqnJT4ba9qMgOpgoC8K8n38uBBDrWtL9/Bxb9tyP7mlHns8VfQ== X-Received: by 2002:a05:600c:3546:b0:3a3:2df8:42c9 with SMTP id i6-20020a05600c354600b003a32df842c9mr429614wmq.161.1658863324857; Tue, 26 Jul 2022 12:22: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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v3 08/21] hw/virtio: handle un-configured shutdown in virtio-pci Date: Tue, 26 Jul 2022 20:21:37 +0100 Message-Id: <20220726192150.2435175-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x334.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658865044742100001 The assert() protecting against leakage is a little aggressive and causes needless crashes if a device is shutdown without having been configured. In this case no descriptors are lost because none have been assigned. Signed-off-by: Alex Benn=C3=A9e --- hw/virtio/virtio-pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 45327f0b31..5ce61f9b45 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -996,9 +996,14 @@ static int virtio_pci_set_guest_notifiers(DeviceState = *d, int nvqs, bool assign) =20 nvqs =3D MIN(nvqs, VIRTIO_QUEUE_MAX); =20 - /* When deassigning, pass a consistent nvqs value - * to avoid leaking notifiers. + /* + * When deassigning, pass a consistent nvqs value to avoid leaking + * notifiers. But first check we've actually been configured, exit + * early if we haven't. */ + if (!assign && !proxy->nvqs_with_notifiers) { + return 0; + } assert(assign || nvqs =3D=3D proxy->nvqs_with_notifiers); =20 proxy->nvqs_with_notifiers =3D nvqs; --=20 2.30.2 From nobody Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658863723; cv=none; d=zohomail.com; s=zohoarc; b=fE1+1R05YkWmtoPk3W5xoSHKLHsgaveD/cAUGlhXJYP2xxRUdYTbWBcpm58DWtPapYEQT7pHZB6nyEShnGsuEHtlRpkta6bS4YrXMExt7al0lXVdXaj2qAFSyNmnUSlQ6lb6nlp7uI4Og+sPun7h86PZ2huqRom/KSm0ezAxXTk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658863723; 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=xHvKCgTFOboJAxlx1VRnV/BrW7lfE7earyZdZjM6gSA=; b=fnTD+Grw5wLJCN6+TEiMeC0wO7USSlAMPc4TPPg8ElumlmUCJ4kkcF32OIzY7Z++LQmGaiFOz7ukW6E1VXkdmJBY7WMDMDkFLOOuSuMtIRgg3DckJNO7qo2mp+Ve9j7GsCFtezUGPW3Jis0eWUx9ixhH961o+LLVCc5qXajWW1g= 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+importer=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 1658863723702270.4251864012666; Tue, 26 Jul 2022 12:28:43 -0700 (PDT) Received: from localhost ([::1]:37320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQEU-0003WU-D2 for importer@patchew.org; Tue, 26 Jul 2022 15:28:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQ89-0003Id-A0 for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:11 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:40548) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQ87-0002Gz-Nn for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:08 -0400 Received: by mail-wr1-x431.google.com with SMTP id m17so21166989wrw.7 for ; Tue, 26 Jul 2022 12:22:07 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id c17-20020adffb51000000b0021d7fa77710sm15226747wrs.92.2022.07.26.12.21.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:21:59 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 14E4D1FFC1; Tue, 26 Jul 2022 20:21:51 +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=xHvKCgTFOboJAxlx1VRnV/BrW7lfE7earyZdZjM6gSA=; b=Jzx3eeK3Bd+7DFk/YQqrFhuAfovlpYNiDON5TdSKn+roVK5OiJj5M63gSMs9Z7pm0e x6jUJ/LkB1108z55lUHM9bxBHnP/qUEDRh4c7+A4tWNYJgaGLoJM9hfskWzKwAY/x7L3 Pdg9YIgfAkAwPeu6FN4zJYndSuG4nJqKbqYQqLu20HzU/Y7BnBKhGTmI9wwotgFf5zLW EXQwTkJwMYwkgOzJanDfK5CQkYV0wNPm48E2afrEXXjKH7FUvLK24IRv1qCZ+JMDw91P QwJL8zsQPxWpwsxn0/ntDL4XkCM/3JvkD+kEQwSJqSPpeYpTuqQpnx5YuReJNlMDh7LC P+2w== 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=xHvKCgTFOboJAxlx1VRnV/BrW7lfE7earyZdZjM6gSA=; b=NVYbdjzYDedkqHGTLW5c21EEsK45bfgCz4fnNle88b5MTl0W5NwmVKQzzj/izaA9m1 bpvA5MedXXpnEmUedc2xOBb4tYETYkP1vKsPNdg1zHlGGpQfao5ebGmaZOT7MnanZqqJ VACKk6nOHZN84AFh5GBfIIMPF26OYcLR4M9T6OmQzGgmuCeXG5VLGR5cZY0pfF1vkY/s 8ThHLBR/lcUj7152CyhaABHhqAhy6OjRGgPd5MqEz8EWGx4lzFcs6EFooeBih9kMCw43 pUi6r+inadDW+cbvxp14HRxE6neZcvDXA9No6B72V1S3zYMif7M+Iw10LAZk2MGAU33T yn9Q== X-Gm-Message-State: AJIora/aynVxELDT5T6xPaTS6v6LUUkhoOd1pxVfl70e3KlncsBkfqSv IcSPLCdWc80venlSqbizy3FaEQ== X-Google-Smtp-Source: AGRyM1uUcaatSO06MmunybWB6jjEFAwJxjiPYmuuRJC84yoP1y5y6nOI1Ni7Mu3oqxZElK4+lYbaiw== X-Received: by 2002:a5d:598e:0:b0:21e:7348:69bf with SMTP id n14-20020a5d598e000000b0021e734869bfmr10706399wri.157.1658863327071; Tue, 26 Jul 2022 12:22: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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v3 09/21] hw/virtio: fix vhost_user_read tracepoint Date: Tue, 26 Jul 2022 20:21:38 +0100 Message-Id: <20220726192150.2435175-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658863724972100003 As reads happen in the callback we were never seeing them. We only really care about the header so move the tracepoint to when the header is complete. Fixes: 6ca6d8ee9d (hw/virtio: add vhost_user_[read|write] trace points) Signed-off-by: Alex Benn=C3=A9e Acked-by: Jason Wang --- hw/virtio/vhost-user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index a96a586ebf..b7c13e7e16 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -296,6 +296,8 @@ static int vhost_user_read_header(struct vhost_dev *dev= , VhostUserMsg *msg) return -EPROTO; } =20 + trace_vhost_user_read(msg->hdr.request, msg->hdr.flags); + return 0; } =20 @@ -545,8 +547,6 @@ static int vhost_user_set_log_base(struct vhost_dev *de= v, uint64_t base, } } =20 - trace_vhost_user_read(msg.hdr.request, msg.hdr.flags); - return 0; } =20 --=20 2.30.2 From nobody Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658864676; cv=none; d=zohomail.com; s=zohoarc; b=ggJMIMjmjTDoR01vUsfZ+XUxVR4imDp7kO3tg3cNJMrYpET/ITOyAnRfI3+W10OrcsG8DLNcyqN2cNIDe+GuG8B5o7IXLFpwkCcILJQ1AAtuxihq6qGKCF2n49rQzGNNn9aMNl+4MmyFQHx2hDqnwh7tkE5mjlpX0UyaQ5SW4qU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658864676; 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=H/ZcxJebFvV+fJPCaMkPj2jiRtkMtcjbXvy3+aTz3aU=; b=gRWQBROfA13LCYxRAbetdID6GlSvrdwH2WgmgpjY42SANCzTzDqCWKMIyKqyOVHzEY5JQFvmg5fNkkzlc/qbLdviDcuJMAuqgeRJmEyx26FD90HL/NKBzjL9wlJfd4mmBIgDElf6S+0JeeLbODvqTQaplMZRp5LZXRftYhxc8TM= 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+importer=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 1658864676776798.2867456237972; Tue, 26 Jul 2022 12:44:36 -0700 (PDT) Received: from localhost ([::1]:59352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQTr-0002pJ-NY for importer@patchew.org; Tue, 26 Jul 2022 15:44:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50702) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQGF-0006c3-8c for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:30:35 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:39721) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQGC-0003fN-C8 for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:30:31 -0400 Received: by mail-wr1-x435.google.com with SMTP id d8so21379829wrp.6 for ; Tue, 26 Jul 2022 12:30:25 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id c17-20020a5d5291000000b0021b956da1dcsm10679692wrv.113.2022.07.26.12.30.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:30:21 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 232BA1FFC2; Tue, 26 Jul 2022 20:21:51 +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=H/ZcxJebFvV+fJPCaMkPj2jiRtkMtcjbXvy3+aTz3aU=; b=BIHOIza6CQ9fpueZJUYtrY+GVXvVmKOUei4TpHPySZ6oVyv0LPY7Qs3ltOpq7IQj1K Umgd3i7m/uJKXDFTIuLZEYXqoGbzb07fsiDgWR9e8tH1dG31MNti0Kv8vb+NiSs/RihU DBgO+SZvcONMaSLQYJgv0KshKJvWuQo4BDmyfilzi/IsSK6q+80FOdFxO0vmNPFoG14I Sd4rPKg8uLgUSlLYmntkG9owaF16Lqlj5c2FF5gRZczm/96zpSIbr3u4qLwgAdkwmP7E GWWlwiPhMjMnwdBT0qXuBPowfCY0OdpVfKI+UWX51CbUbwVnttAn81BOsowMQDewsgup LA8A== 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=H/ZcxJebFvV+fJPCaMkPj2jiRtkMtcjbXvy3+aTz3aU=; b=gNzpohKQJFLFF4Io8Mv51VXolLC0AYkZ4bJad+Q/EKAkpyN60UqBZ55oh+8+KfaaSQ kIDBlqSd5+WLPCoP/G1ZH7KvBoM3BMnW+y3HNWE13AabpyOwm0qlAo4og6qCLfzr/EG3 CoCsix353tlYhdp5a7PvfNJ6ESpNhORcQr8SFV6tP4uj8zgAC8bufaRiQKGldHx/9f3p a2AUVuvIomuulsChM5tnsdDByk7zhyzlaO9vbqurqxxyc5PoD1sRg8Qm7gjfPT5bK3ry HBDvKwucPjFwD2RCsme3Xygd2tJadbvH/gD5UwBAznor1jWe245eg6rc21RGx1ifVEAi BLrg== X-Gm-Message-State: AJIora80eBAdC34ATRHSCAWga32RmvZDvuxOokDco/wrkJWdKJGpsoy7 DWG9vJGHsFM6TrNWSIZYBdlWoQ== X-Google-Smtp-Source: AGRyM1tYu8hWyxcIkViPla7QVznJBNH8yiXBbzSEwFklfN3qoJsGCnccbar5+MFZS76kigoUjT6eaQ== X-Received: by 2002:a05:6000:1f8d:b0:21e:83a6:cf87 with SMTP id bw13-20020a0560001f8d00b0021e83a6cf87mr8288520wrb.559.1658863824683; Tue, 26 Jul 2022 12:30:24 -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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v3 10/21] hw/virtio: add some vhost-user trace events Date: Tue, 26 Jul 2022 20:21:39 +0100 Message-Id: <20220726192150.2435175-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658864677510100001 These are useful for tracing the lifetime of vhost-user connections. Signed-off-by: Alex Benn=C3=A9e --- hw/virtio/vhost.c | 6 ++++++ hw/virtio/trace-events | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index f758f177bb..5185c15295 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1477,6 +1477,8 @@ void vhost_dev_cleanup(struct vhost_dev *hdev) { int i; =20 + trace_vhost_dev_cleanup(hdev); + for (i =3D 0; i < hdev->nvqs; ++i) { vhost_virtqueue_cleanup(hdev->vqs + i); } @@ -1783,6 +1785,8 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODev= ice *vdev) /* should only be called after backend is connected */ assert(hdev->vhost_ops); =20 + trace_vhost_dev_start(hdev, vdev->name); + vdev->vhost_started =3D true; hdev->started =3D true; hdev->vdev =3D vdev; @@ -1869,6 +1873,8 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODev= ice *vdev) /* should only be called after backend is connected */ assert(hdev->vhost_ops); =20 + trace_vhost_dev_stop(hdev, vdev->name); + if (hdev->vhost_ops->vhost_dev_start) { hdev->vhost_ops->vhost_dev_start(hdev, false); } diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index 20af2e7ebd..887ca7afa8 100644 --- a/hw/virtio/trace-events +++ b/hw/virtio/trace-events @@ -8,6 +8,10 @@ vhost_region_add_section_aligned(const char *name, uint64_= t gpa, uint64_t size, vhost_section(const char *name) "%s" vhost_reject_section(const char *name, int d) "%s:%d" vhost_iotlb_miss(void *dev, int step) "%p step %d" +vhost_dev_cleanup(void *dev) "%p" +vhost_dev_start(void *dev, const char *name) "%p:%s" +vhost_dev_stop(void *dev, const char *name) "%p:%s" + =20 # vhost-user.c vhost_user_postcopy_end_entry(void) "" --=20 2.30.2 From nobody Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658865057; cv=none; d=zohomail.com; s=zohoarc; b=g7bOdEmbOdqDQutBEqTnWSi33sf0GwkbillEBMfvr/1ltCaNjaT0Glj8BFX/X93Gk2NaAeXQFtC0F/Nt8k2OM3jDd67FTWcyHAV5jDDE8RPvg6qar/TuXsPInxG37GRDZuEKCy2daLm4YMl9hdE2f8uRrkCy1WIHeidBPVA9lc0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658865057; 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=FoZeVp7JoBfeQWpKR+aNPS0/48Z7oPUNFcWapzaHubk=; b=GlDzQGmvEXt98WMN8Qv3wlY4Sx/Glmz+yr4vwnlQm9VqXBMugwQljzmRSxEfWrqIcCK2rV5jUJawEMupYw6VgyqNO4vM2pGP4wfsW712cBMneWdqNsCQfgia4hne9MBPVZ0j9Fn7HonI35+tBNIetL8XMbmciZN3JCrniH8g9DY= 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+importer=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 1658865057472543.307952087926; Tue, 26 Jul 2022 12:50:57 -0700 (PDT) Received: from localhost ([::1]:40400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQa0-0000ol-9H for importer@patchew.org; Tue, 26 Jul 2022 15:50:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQGE-0006c2-R6 for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:30:35 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:55124) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQG9-0003dD-3o for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:30:30 -0400 Received: by mail-wm1-x332.google.com with SMTP id n185so9334059wmn.4 for ; Tue, 26 Jul 2022 12:30:23 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id h10-20020a5d548a000000b0021e6c52c921sm12383680wrv.54.2022.07.26.12.30.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:30:14 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 488711FFC3; Tue, 26 Jul 2022 20:21:51 +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=FoZeVp7JoBfeQWpKR+aNPS0/48Z7oPUNFcWapzaHubk=; b=dsp73vam66eaXFJ+r3FrurH/C1Tfz9DUUk0szSTEr1Blw8xAIdRRsfDh8Kvn6uVR9+ VN4Zq8xxQ0EHWresOD60bOYH7aSpW2veNZI0hg2z96ESbVz+m06BuYSfugb+dhUAQjWn 37Nv7LD0DsKiGeuDIcYLUqtKtAU4KUwk5eOpMpxg63gufxWJ3J3WnxfiqTkJygw/92+4 uQdiJ0OrfEAM7VYaFilQLsoESQa2e+4GFlxKV2yyk/BYhtXW05pNE9P2PW2PDsiVuBYL 4fQ6rDtpPZYW5XIj69IFBukR5qdrtA2OFnhJBmm/VqJ+elwyeEKUahQvKlUnhm3jk27a 9Y2Q== 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=FoZeVp7JoBfeQWpKR+aNPS0/48Z7oPUNFcWapzaHubk=; b=FUgt9rYrMf8kEeZzRpNIPQUdQLgnTF1KWuS5utOIjsq1xlASpPTOWVE9m7sU2Ayltk Z1lwVbv+jzC8UuCc2uyggX07TYI3aBRYbyDbVNXBIsGo7u1gAYBV9DNvNJvIVHE8o3KP 33TQf6OwY9asdjtCu4DzFGwrL3UNClRF2G110CAqC5+mPlr5K15RbmfXJCaBbj9CmLvP w91qTLZwnJXGY/LjKe5vx+WrA55coSmafiYyLrIKqqC8Kygq2I9pcUDRNpjr16q4xJus janTs/11J3GlSgWWO1DRDZIro3tp4GicVPMRSxoDxyAMfb4okDLxlyQisddFdKoWoEwf 65ZQ== X-Gm-Message-State: AJIora8D0S5vBzc0hJL3E/HXEMeMcodXI7A+qCmRx3LjsTg32QJsR1KO DLXM9FoKqsGffsLVtUBp/0d/ag== X-Google-Smtp-Source: AGRyM1srpKxUESxKR2ya6h6NxDX4Y4AgPfqlMO15QdVySmJnw0LROsOwhuOf+18iFbdobyZE+ajFMA== X-Received: by 2002:a05:600c:19c9:b0:3a3:469f:c1e7 with SMTP id u9-20020a05600c19c900b003a3469fc1e7mr450379wmq.141.1658863821384; Tue, 26 Jul 2022 12:30:21 -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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Vincent Whitchurch Subject: [PATCH v3 11/21] hw/virtio: add boilerplate for vhost-user-gpio device Date: Tue, 26 Jul 2022 20:21:40 +0100 Message-Id: <20220726192150.2435175-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x332.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658865059514100001 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, tweaks to feature bits] Signed-off-by: Alex Benn=C3=A9e Cc: Vincent Whitchurch --- 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 v3 - break out vhost_dev structure for code flow reasons - use the vhost-user-blk connection lifecycle code - follow ->parent_obj style for VHostUserGPIO object - add all feature bits supported by the rust-vmm backend - clean-up errp propagation to avoid local_err and use ERRP_GAURD - s/vhost_dev->features/vdev->guest_features/ when calling vhost_ack_feat= ures - drop VHOST_USER_F_PROTOCOL_FEATURES definition (pushed to vhost-user) - explicitly call vhost_set_vring_enable due to properly negotiated VHOST= _USER_F_PROTOCOL_FEATURES --- include/hw/virtio/vhost-user-gpio.h | 35 +++ hw/virtio/vhost-user-gpio.c | 414 ++++++++++++++++++++++++++++ hw/virtio/Kconfig | 5 + hw/virtio/meson.build | 1 + hw/virtio/trace-events | 5 + 5 files changed, 460 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..4fe9aeecc0 --- /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_obj; + 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..d487966c7e --- /dev/null +++ b/hw/virtio/vhost-user-gpio.c @@ -0,0 +1,414 @@ +/* + * 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" +#include "trace.h" + +#define REALIZE_CONNECTION_RETRIES 3 + +/* Features required from VirtIO */ +static const int feature_bits[] =3D { + VIRTIO_F_VERSION_1, + VIRTIO_F_NOTIFY_ON_EMPTY, + VIRTIO_RING_F_INDIRECT_DESC, + VIRTIO_RING_F_EVENT_IDX, + VIRTIO_GPIO_F_IRQ, + 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); + struct vhost_dev *vhost_dev =3D &gpio->vhost_dev; + int ret, i; + + if (!k->set_guest_notifiers) { + error_report("binding does not support guest notifiers"); + return -ENOSYS; + } + + ret =3D vhost_dev_enable_notifiers(vhost_dev, vdev); + if (ret < 0) { + error_report("Error enabling host notifiers: %d", ret); + return ret; + } + + ret =3D k->set_guest_notifiers(qbus->parent, vhost_dev->nvqs, true); + 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. The backend may also + * apply backend_features when the feature set is sent. + */ + vhost_ack_features(&gpio->vhost_dev, feature_bits, vdev->guest_feature= s); + + 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); + } + + /* + * As we must have VHOST_USER_F_PROTOCOL_FEATURES (because + * VHOST_USER_GET_CONFIG requires it) we need to explicitly enable + * the vrings. + */ + g_assert(vhost_dev->vhost_ops && vhost_dev->vhost_ops->vhost_set_vring= _enable); + ret =3D vhost_dev->vhost_ops->vhost_set_vring_enable(vhost_dev, true); + if (ret =3D=3D 0) { + return 0; + } + + error_report("Failed to start vrings for vhost-user-gpio: %d", ret); + +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); + struct vhost_dev *vhost_dev =3D &gpio->vhost_dev; + int ret; + + if (!k->set_guest_notifiers) { + return; + } + + /* + * We can call vu_gpio_stop multiple times, for example from + * vm_state_notify and the final object finalisation. Check we + * aren't already stopped before doing so. + */ + if (!vhost_dev->started) { + return; + } + + vhost_dev_stop(vhost_dev, vdev); + + ret =3D k->set_guest_notifiers(qbus->parent, vhost_dev->nvqs, false); + if (ret < 0) { + error_report("vhost guest notifier cleanup failed: %d", ret); + return; + } + + vhost_dev_disable_notifiers(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; + + trace_virtio_gpio_set_status(status); + + 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); + + return vhost_get_features(&gpio->vhost_dev, feature_bits, 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, Error **errp) +{ + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + VHostUserGPIO *gpio =3D VHOST_USER_GPIO(vdev); + struct vhost_dev *vhost_dev =3D &gpio->vhost_dev; + int ret; + + if (gpio->connected) { + return 0; + } + gpio->connected =3D true; + + vhost_dev_set_config_notifier(vhost_dev, &gpio_ops); + gpio->vhost_user.supports_config =3D true; + + ret =3D vhost_dev_init(vhost_dev, &gpio->vhost_user, + VHOST_BACKEND_TYPE_USER, 0, errp); + if (ret < 0) { + 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); + Error *local_err =3D NULL; + + switch (event) { + case CHR_EVENT_OPENED: + if (vu_gpio_connect(dev, &local_err) < 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 int vu_gpio_realize_connect(VHostUserGPIO *gpio, Error **errp) +{ + VirtIODevice *vdev =3D &gpio->parent_obj; + DeviceState *dev =3D &vdev->parent_obj; + struct vhost_dev *vhost_dev =3D &gpio->vhost_dev; + int ret; + + ret =3D qemu_chr_fe_wait_connected(&gpio->chardev, errp); + if (ret < 0) { + return ret; + } + + /* + * vu_gpio_connect() may have already connected (via the event + * callback) in which case it will just report success. + */ + ret =3D vu_gpio_connect(dev, errp); + if (ret < 0) { + qemu_chr_fe_disconnect(&gpio->chardev); + return ret; + } + g_assert(gpio->connected); + + ret =3D vhost_dev_get_config(vhost_dev, (uint8_t *)&gpio->config, + sizeof(gpio->config), errp); + + if (ret < 0) { + error_report("vhost-user-gpio: get config failed"); + + qemu_chr_fe_disconnect(&gpio->chardev); + vhost_dev_cleanup(vhost_dev); + return ret; + } + + return 0; +} + +static void vu_gpio_device_realize(DeviceState *dev, Error **errp) +{ + ERRP_GUARD(); + + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + VHostUserGPIO *gpio =3D VHOST_USER_GPIO(dev); + int retries, 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); + + retries =3D REALIZE_CONNECTION_RETRIES; + g_assert(!*errp); + do { + if (*errp) { + error_prepend(errp, "Reconnecting after error: "); + error_report_err(*errp); + *errp =3D NULL; + } + ret =3D vu_gpio_realize_connect(gpio, errp); + } while (ret < 0 && retries--); + + if (ret < 0) { + do_vhost_user_cleanup(vdev, gpio); + } + + 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')) diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index 887ca7afa8..820dadc26c 100644 --- a/hw/virtio/trace-events +++ b/hw/virtio/trace-events @@ -144,3 +144,8 @@ virtio_mem_state_response(uint16_t state) "state=3D%" P= RIu16 virtio_pmem_flush_request(void) "flush request" virtio_pmem_response(void) "flush response" virtio_pmem_flush_done(int type) "fsync return=3D%d" + +# virtio-gpio.c +virtio_gpio_start(void) "start" +virtio_gpio_stop(void) "stop" +virtio_gpio_set_status(uint8_t status) "0x%x" --=20 2.30.2 From nobody Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658866369; cv=none; d=zohomail.com; s=zohoarc; b=lHKCEV230453whfmZyWASOhTPDgioi+7JWIy8/VhW6QWZJa5wFBRwYESPA2YQOBaFKL+EQ5En7EslCkMAsygHtw4XPJcD2yDuonGGHlST4MSb9shdQZ+kmQ82jwWae/ogu84UtvX9UjLx4rPcLTbnKZi81f2VAQf/e+vIBEzCG8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658866369; 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=l6+uZ84tSTJPx/zmVKKKFF/GOqFRPdSsywHKLva/bNXBYYIHWydI+5z/Q9buaFCkkW8JDKF5r3kQGj3Zap/NspnFKOWxCzneFff/3lZrw9HoBqVTUhbAJ7nEdo0hZ7+h97O02t5/fE/CtSErW8N7KhunezSiz2sSajaQvPflXng= 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+importer=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 1658866369453616.3622055054412; Tue, 26 Jul 2022 13:12:49 -0700 (PDT) Received: from localhost ([::1]:47668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQvA-0000vm-6y for importer@patchew.org; Tue, 26 Jul 2022 16:12:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQGA-0006bj-6V for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:30:35 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:34779) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQG4-0003bF-3k for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:30:22 -0400 Received: by mail-wr1-x42c.google.com with SMTP id h8so21457802wrw.1 for ; Tue, 26 Jul 2022 12:30:19 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id i6-20020a5d5226000000b0021d6d9c0bd9sm15124735wra.82.2022.07.26.12.30.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:30:14 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 62CE21FFC4; Tue, 26 Jul 2022 20:21:51 +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=rbC3RCkFQLOWSKwxagAYuVJF2zp2n0bmKFOy5vbWFv0oWniEMmWI8VGPrj00yOq/RY lmrijP9isQ0gJmD4ZjL1mJcPXzNfb2gyogn1amPM+wc5/ffM9jhvE496ilnfO3FFaKdP 1wz2FORZIdXkeaiy8juQbUQNO4YoENc+WW36Fstgu2KUMwYEcY6Y9TQsHtTdtVHyRGEW ZdzIYdpdixxW3mYd4s396W9WIElndQgkEUOVXS87JMUdC+zIs8c+su2yQR+ggjvbypeX Y/bcubCquOg1aUCH8BVRwqM+MMDkAGA+HSQu8kQJ62+6jOOh3yaexPFqoKFK8/fNZCAr jw9w== 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=jiuYZ/TcMzPN+CjHikXny8TI+AsrIsuk8QdLrrhTIZNxfgIynMItFVw0KleBUKJdaI nPmDXT9rtV2l1aQoyqQFcMp1t2fER6Ut598r1WBgYsy1NJ0sZQMSEEE3B6B4nBiEHm6F GVeRvprU9GKFenNh6p9KO/vORgZ/lLSX00xYXhjyaA1/CRFKHiMbtIOfSTW8bcjft3hN f0xwtv7RCIpkw0dzyoBzdDDXfybQfRLbjSyVvgpjzthFJlVjwMybBt38Ix1iuZt5kP9z Sbh7BFLq9DVluvSSuIudQFjlP2UnxG89O5T/KrBB/3fevA4P3fSwFLkZJjtH7b8TkUbX Firg== X-Gm-Message-State: AJIora+StU0UN2GK2wqIbSrUZCIGUNAg2Cbk/NBQd5+5oRacEatXzDgy q8xqqvIlyUPbRkbF0lAUshaG3Q== X-Google-Smtp-Source: AGRyM1v/EP8nba2SBussHKMr4DmX2ICvXysTtIL+uDUDZD2N32iJBtYInsYbekT6bupmWHAUZKX9Pw== X-Received: by 2002:a5d:460e:0:b0:21e:6d12:d308 with SMTP id t14-20020a5d460e000000b0021e6d12d308mr11951414wrq.419.1658863818534; Tue, 26 Jul 2022 12:30:18 -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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v3 12/21] hw/virtio: add vhost-user-gpio-pci boilerplate Date: Tue, 26 Jul 2022 20:21:41 +0100 Message-Id: <20220726192150.2435175-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658866371219100001 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 Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658865711; cv=none; d=zohomail.com; s=zohoarc; b=cDnQYZgfYCiwMU4jh1J74ij+6pX/bZkSE+PiR0JWqE/ehbbR9GGgCtInl2yEpzYF0n31tRJjvv4R04r5fL7WxXNMhJXMkz/wxXVG7isRVaRA1Xi3cAllTf7TdHLaeEcgULYMFZDcC9O6p0/Qe1sWK0bth+1dUObYfhgsTBPG/74= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658865711; 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=Pe5Zimqd2c5xifMUxUMxyry48TVU96KwaVMb7LRHl5I=; b=jTCmqr+VLECI0WV8FPf8i3C+eNMZvfwOYrFmiMzdt76GCyeBcrmRAtIPaPTGKKwYH6gPgyjnrdvpjbyDsBF1vMnpiDhUUPu1gRu9ShAv72OQkCBoH9aKwWFtUy67xf/HS/Z1HVwjzeaePVCs7id9PM6iHSNK3tiLMTWiLGBUpyA= 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+importer=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 1658865711322580.211326853831; Tue, 26 Jul 2022 13:01:51 -0700 (PDT) Received: from localhost ([::1]:60944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQkX-0006hN-UE for importer@patchew.org; Tue, 26 Jul 2022 16:01:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQG2-0006Yn-Pt for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:30:18 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:34668) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQG0-0003aW-Vs for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:30:18 -0400 Received: by mail-wm1-x329.google.com with SMTP id r1-20020a05600c35c100b003a326685e7cso1301181wmq.1 for ; Tue, 26 Jul 2022 12:30:16 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id p15-20020a05600c358f00b003a32297598csm23918246wmq.43.2022.07.26.12.30.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:30:14 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 6E6961FFC5; Tue, 26 Jul 2022 20:21:51 +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=Pe5Zimqd2c5xifMUxUMxyry48TVU96KwaVMb7LRHl5I=; b=zwzj80eC+gHx6S0MoXibeXV7C+sjg2dr+TLUyHkjnGt+Cg2Sf1+KAv5Ggc9hq3E1TV 0/lOeuGlI/RQ4BEoQHchHdjXTI6VdskcHTY8KmUxGxsRXvC9rOVlIFPc5LXZH84yvodX PLC5pN3IsB7mYgsbnxnyqtIgl08yCRvL5titeMOfiLRIg+zMd4UuMhcw8FmwgydutLdR B0YQ6Hqc8zSHqFQxZ2XnzCYDsG2/ey8l6P+ABSzWCalfgb67bFleLsaQtVacb6hsWsfz bLRSBCxgHapMa3oa4z7fmbZshin1lg0kgE+scV37f2TP2iC57u/OXa9LHVaDUl21YB5d S/oA== 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=Pe5Zimqd2c5xifMUxUMxyry48TVU96KwaVMb7LRHl5I=; b=SPTkS9rT5Jcr15IVQOp3uz1lVOrNwA7QJhW5AmbyCJPvQSngcKoI72XvJogL9JA02I GMo5BnnZYz1QEnDiWdcTKXvPhFldTzI5KikEAf0ri0x0ri7tbZpO1Wce+L5MqAG0o8oO QH8196tAqzi8j5Brxk/8dXAZWE1emwBqo+Z2EM8zEOzL+fx6u0m5g6e9nqOJCALZ5Rcr ALFVP+mCkrA/KZc+PiIJppC+9U1ArDVkMpP9lvd2VJ6EdwDh8hjxM+gyMyZsvUhWd3xL h9x/7KpaWUyEly5OOU8ZyG2jWBVw0i+Zyq6Wsc0/pl82W26Ra/R2r9vjLfCqHukO1dKw GSBA== X-Gm-Message-State: AJIora8PcaqkDG2g/mx2x6CHAJlY0ceUf+kT3SZfrqA2SB6j+Gglgcqr Jb0Tsa0JlX7iunG77eC8E7hxvA== X-Google-Smtp-Source: AGRyM1uzk2LHEr9dplaroo5yIwqppLo8dP+wEIJoxOqPKXUpv7E0Ylry8yAN2HSKVIbTJqZaz44IZg== X-Received: by 2002:a05:600c:600b:b0:3a3:1176:222d with SMTP id az11-20020a05600c600b00b003a31176222dmr510171wmb.42.1658863815304; Tue, 26 Jul 2022 12:30:15 -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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 13/21] tests/qtest: pass stdout/stderr down to subtests Date: Tue, 26 Jul 2022 20:21:42 +0100 Message-Id: <20220726192150.2435175-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658865714040100001 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 Acked-by: Thomas Huth Message-Id: <20220407150042.2338562-1-alex.bennee@linaro.org> --- 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 Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658864690; cv=none; d=zohomail.com; s=zohoarc; b=iDstvW2VWLScjB5NuzLuu+a0lvmbosJtvkDIYijoH06MRLz6RG3E84QuNAUtc0Qrq3q4iSWl8tt5xH9bVMOitdC2BfPyh8CGN0+3crEzLugRIBA+c4ZAp09uzJ/qwrk2YgmdcBIm8qVzCuRnuLHE8KGLul4Bj83h/gIA2RlZJD4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658864690; 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=P5Luishia3JsScTlemeh/OGK//MTXXlEPATJORqsFXk=; b=Fd/Mf/MowFh0q8eDp2nFEhs+ZASp9Vw9D39wBjgH2bSz71ywcQdBIFxxpkbcOQTjZqeN2MMdhcY2HI4q6lPBniK0UdriwI/Hc88zonFibppUkZNddH6z72oScc0fCCV7hv0CqSAW8OEjjD0SrKzf9oZdjlLwsbWNpjHmS+x47yc= 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+importer=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 1658864690584801.3801560250835; Tue, 26 Jul 2022 12:44:50 -0700 (PDT) Received: from localhost ([::1]:60028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQU5-0003Hu-BZ for importer@patchew.org; Tue, 26 Jul 2022 15:44:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQGE-0006bv-0e for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:30:35 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:42555) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQGC-0003dw-3F for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:30:29 -0400 Received: by mail-wr1-x431.google.com with SMTP id bn9so10600628wrb.9 for ; Tue, 26 Jul 2022 12:30:24 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id h7-20020a05600c2ca700b003a3253b706esm18044920wmc.34.2022.07.26.12.30.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:30:21 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 83A4B1FFC6; Tue, 26 Jul 2022 20:21:51 +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=P5Luishia3JsScTlemeh/OGK//MTXXlEPATJORqsFXk=; b=FJ0ozNSOgJ0610Goj99oH33uSlU2wu+o4mLZ6/mlIt/TQErfghJnvEi+Ni24CkcKbj sSt5PTn7rguP1jcg/zoKI2xEw48p4KlaHYrzna+YTW1tomW5xlmEidBXoH9OtdG20UFZ gKLpWPan0Erl2sAwJ8pTUzWqhKaZUMJKWflXthbAl7IwksYmlw7A8ZjKBuBGJRwSieQo i3cz8E17pVgsFyh9fhvPc1OcZ6IO074GVyVHlQDINcSckP/Qa1nSjOOoamy+B1P8+V4f Ci6lM/shr8i3LkUA5qt7oQ0FBsd/Uoh+6tR9K0riHODkEhosLDBqX82e/2e1NI3sBMkK ebBg== 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=P5Luishia3JsScTlemeh/OGK//MTXXlEPATJORqsFXk=; b=bk9g7dkK8/MZN0IBY53rhrAsxa9Qu5ZKHKWq6XwwAA4HA0CrFt5px6NVn/AuLkDc1i ygtxpveXaPMa4GIQSzckCXCK+okXpxFQUA25oKYWg1MCMH1bA+6Jt2XrV5nd7GbBlAky wI77pdEhnBEXilSlF+bA9roxT4C7kra4UybXg+Vst7QHc6OMIM25VXOzjoFJloWH89UF D425Z4M7g6vHXhw/Lx2RhXGyIomUlriU/LZIckHebkkRFwIpFtGLGrDv0CXGRFsbDbtL RT88ywTmIY2m9CxK+YkDcZSMW35EkX3AV5uhNZ3klh9UNzijFLJWNrDgMbbP81UexOl9 N4BQ== X-Gm-Message-State: AJIora+EI7mwdafe7X2Uezktziv8mHOCakLFj8zHqnlzyS+YLUtfvTC9 vTM8DdfywKYXcezE2BHmWWTH6g== X-Google-Smtp-Source: AGRyM1shrKDYirTGWOqBEIDMkwAs8zF4wRV1kqspTfiYPqxbU/fzUZTQ5TIfIGwGDFWOXfmA40KiHA== X-Received: by 2002:a5d:5086:0:b0:21e:4eea:eea with SMTP id a6-20020a5d5086000000b0021e4eea0eeamr11444818wrt.47.1658863822781; Tue, 26 Jul 2022 12:30:22 -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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 14/21] tests/qtest: add a timeout for subprocess_run_one_test Date: Tue, 26 Jul 2022 20:21:43 +0100 Message-Id: <20220726192150.2435175-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658864691517100001 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 Reviewed-by: Thomas Huth --- v3 - expand timeout to 180 at Thomas' suggestion --- 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..ac23def284 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, 180 * 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 Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658863484; cv=none; d=zohomail.com; s=zohoarc; b=H2tVH18OgMEbQLw1iGsZiWBWqF/A6A79NIFy+oldTlbr4w8yx3kqS0k9L9vvx+NBB8oMCgxPW84CA1qxC9QOCOeuHLxYnP6mlDpWPI0XAK5+gmOhEnykLTkQ4bt25t+9LeV5mi1omDkzx1quD+8qaXAgt5CwqhdI7DqaofBQIwI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658863484; 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=rgdjLK+rHmGYzX+axfdcXU3cC80ktttNYMslWS8NxWI=; b=c/lio5z81a7yYL4q4qyfWYBJl2ct0tIOCVcQxhBpWOzlUdLc718crIVPXi6ATKwczLN+FforeDuuKjrJHP8DRrtx7Grgb/5EryiCjDNQIOv3SC2jDMENZXuElKrAyyMIoYDE2WYe8vtcNTyowW8uN9V1/yXMeck1wXB6k3m1ujY= 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+importer=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 1658863484475346.19461814033934; Tue, 26 Jul 2022 12:24:44 -0700 (PDT) Received: from localhost ([::1]:57392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQAd-0006JL-EL for importer@patchew.org; Tue, 26 Jul 2022 15:24:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49048) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQ8C-0003LR-DN for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:12 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:42996) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQ8A-0002OI-9Z for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:11 -0400 Received: by mail-wr1-x429.google.com with SMTP id bn9so10575923wrb.9 for ; Tue, 26 Jul 2022 12:22:09 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id y7-20020adfe6c7000000b0021e4f595590sm15502588wrm.28.2022.07.26.12.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:21:59 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 919121FFC7; Tue, 26 Jul 2022 20:21:51 +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=rgdjLK+rHmGYzX+axfdcXU3cC80ktttNYMslWS8NxWI=; b=bxqWqE5cdTZyQNhToMXoxCgKMRyOYgZEl/xoUkm3uBAbqW1J3E3JcxNGIFFCYcik8R v1an9MAOYZ+Py5I3CKXRsjGiorpPEd8/6MsNlXctQ3PkSEF/CNepV6nRBQDE+CfaL9kz AUQ++dbXJoMY8clgcu/WNQvdMrVqakcmMWlpRTo/CA8CCP6j9ihRLX0nTvgzUEEDnnfL L1x5g8fBiotXQxH/sXDG1CRofmRLH2o5tkcE8KVDyD965oFnGXvCZ/W0hsVZQBI2ac4b bI3FLNUGDL/DxTpbFmrjzVBZZqYQ1X26LnR4R00mQwvbj6nvEgN0zoleH2FFlSj1nI/t M2Bg== 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=rgdjLK+rHmGYzX+axfdcXU3cC80ktttNYMslWS8NxWI=; b=RVigpPd0v0Xxi7yj3HlbIdibeDLLjcxGja8EIodUa9yOGtcgWnVHU7sEkzUpNLUECg 1DTqdgUZbrFOztmQZLvQGIq+dC8iB3fCDwrzzhGQm1FNBG8r2IW/rrmUvLP1vyVVUd5P RXyj68cGdY2LILVtL+7MzeDiVv4L3N5DTL4kldDX/KtmcJBMt2IQmx1W/xj7M1R6y/O1 vYr8XteUTP5XRUvrlyvYHMbiyW3DVRjDVpQV6kwK4YYqHefxoI0EcOdBRO65KwpPQgyr uQbWWSzDlwFhFHdR7BzECI1bZAgl3quXAhDq0ZTgd049AmL2dMd1VkjH9oiVfNWM6Vax ujzw== X-Gm-Message-State: AJIora9Byg8cb7jxinwofLhpGBopL7HwS3QFAr3krompXdlN46Ihx6cf yrklziDpHEkei+AG4ECCymhdqA== X-Google-Smtp-Source: AGRyM1tCxn4NvieKVmhr1NrJdwHDx9kyJ3juDJ2rxFRZZ7anLDB7SC54Qjzgv0ia5sxTjgtTz6/ukg== X-Received: by 2002:a5d:588d:0:b0:21d:a5d2:42d5 with SMTP id n13-20020a5d588d000000b0021da5d242d5mr11559128wrf.588.1658863328911; Tue, 26 Jul 2022 12:22:08 -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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 15/21] tests/qtest: use qos_printf instead of g_test_message Date: Tue, 26 Jul 2022 20:21:44 +0100 Message-Id: <20220726192150.2435175-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x429.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658863486562100003 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 ac23def284..d0bdf06fad 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 8bf390be20..968113d591 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 Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658866089; cv=none; d=zohomail.com; s=zohoarc; b=bXpqPkvxpgR/7Z0YCxdIACha1Uz+WXAd/0VM0NNyp9D8rLxm9ZWfsPn+g83b93ujkDsPDhFthrODk4Wes7L3aEb4I4Cinyhva6pmjAb55HNrbO3IYfZ2WXoYODRPJA/Sm/Jlp+/2T0lYmwvuws+4GO3LvH6O+FV7yXYDtWiGhoM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658866089; 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=xlxq1ZBU6AcDaP18E14EH8M6boLy3BklV7N6rZI3qJs=; b=bSPNViepVxZTemeXbZeWPT1vYEq8VrwuIWWI/ue40nki8ILKgsnS+ES5n+onoPqP1NG/seU7LnWNwCbfHVpZ6UfeSAwPj1NTvRfarzexrP/HPnyoZhMwtiPoEKvMZVTPDQoBEzEuqipsDJH1xC6Oks1D4YJdKlFFrOxBWeYIvQE= 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+importer=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 1658866089867908.0036822954986; Tue, 26 Jul 2022 13:08:09 -0700 (PDT) Received: from localhost ([::1]:39132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQqe-0003MZ-Ix for importer@patchew.org; Tue, 26 Jul 2022 16:08:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50610) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQG4-0006Zb-JX for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:30:20 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:41630) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQG1-0003ar-MJ for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:30:19 -0400 Received: by mail-wr1-x42e.google.com with SMTP id q18so11061097wrx.8 for ; Tue, 26 Jul 2022 12:30:17 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id c17-20020adffb51000000b0021d7fa77710sm15240057wrs.92.2022.07.26.12.30.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:30:14 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A864C1FFC8; Tue, 26 Jul 2022 20:21:51 +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=xlxq1ZBU6AcDaP18E14EH8M6boLy3BklV7N6rZI3qJs=; b=jVEZ6Irk8Wh2gVvq9LX+XUkphMQElCWlmKsJ/HVQuPtCdhI928/IDc+OCg7HyHVMyX qDJxTHRud0QAUVd1rwl0QLicifrbP4bQ7I0J/AyyMIYUoi8L/brqsmT7GbkVeP8pD2vz zXWwkFMJFdAq+yq7zF09j9kx3rtXLB8FSRn4EkhLqE8UEKKJ7P1YNql1zc5hfq8Bxz+0 DCg0M2wx6Exo6sxuzKLzavG/gQtoZI9Gj0wucxCuMHIXoLbFDugIvgjxxn1At3tuMOOz c+tqkOkbN49RIT/Zb1d9e3EP2sOoDDlIf+NBsMLMzoDFlH1rcbhLVILeMLrvvYMhZdfY Cpkw== 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=xlxq1ZBU6AcDaP18E14EH8M6boLy3BklV7N6rZI3qJs=; b=mlMgkPkeBgoZ2XbGQUaH5yGUjMlS0HHF33YP/nO9QivjyKxAc/VGaGmAXHeErfkkSt qfLV7nsS8ioztzH6ZAdx/nFRynqSRcuk7O/GbGD0wTWk/6OVuX/mwr0qZnyWR14rGb6x MFuiX+dxdEW2+kIv1Jjjw0a9BkGtIc6BrD6jLPCqA7gRXhTEe7Z/m/1qcbTgyycSVXCu 3R/5Tk3Q7oBkb0xSYcD9NbMOKlv60EIeC9tQ0IMmgLNI3jx5vdMHMTG4iCnLIzgku5iQ yUL5iUYGenv2PDCNQ8aXmnzA0E+sjrnyRM8VKHWPW5p2Qc8dgPh8rpR3xrDJT0RtDILZ PqJg== X-Gm-Message-State: AJIora/HrwrrBAXR0M9dSj8b10J8tItAtxXzOqBs3Zqf7Xdoc+pACl8U +JsaCz8cC346Pk8WtE5jOPs9pg== X-Google-Smtp-Source: AGRyM1se2F8HaTBrPJbsrgtfD6902+CAb1kjyZdUyKf/ZYMdxdYERV/TpF9o5fip4XqQsduMxl/F2g== X-Received: by 2002:a05:6000:1541:b0:21d:b298:96be with SMTP id 1-20020a056000154100b0021db29896bemr11546897wry.206.1658863816126; Tue, 26 Jul 2022 12:30: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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 16/21] tests/qtest: catch unhandled vhost-user messages Date: Tue, 26 Jul 2022 20:21:45 +0100 Message-Id: <20220726192150.2435175-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42e.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658866091338100001 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 968113d591..d0fa034601 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 Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658865305; cv=none; d=zohomail.com; s=zohoarc; b=DietJgIZ+5zDpYlCtoQRhRsdemb/ARvFBImGGOWHtyDpCEc/3kFXIs/VXoctWIiWDIakeuV3K7FMUAJqfv98x54kUHTUh0oN6KGyCdNAkwJWA43Jk4IEIDgEcAk9yHoMYSk6OZ0ojYDL/HCxb24z37BYJTNXJ6KAycTyS+pJMwE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658865305; 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=LMXevkaxdbuLYQ7o/4PC/skTFgBWusJPtQdn9yXNWntFA3U0k/ANQUqKAV/WooR/m83sM0l7UW+NBp/NMBr0ypVH2W7RpGaisNCHrSVfPUQxcF514FkvzBW7Gjo/0onUUs3qQp9u1Ithf/Qi/qrWTYU4uv6h5EZw7wIIhZSlIoI= 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+importer=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 1658865305148899.2082606227864; Tue, 26 Jul 2022 12:55:05 -0700 (PDT) Received: from localhost ([::1]:48150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQdz-0006Ff-J7 for importer@patchew.org; Tue, 26 Jul 2022 15:55:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQ8E-0003Mj-CE for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:14 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:33355) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQ8C-0002OM-4e for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:13 -0400 Received: by mail-wr1-x42e.google.com with SMTP id h9so21496419wrm.0 for ; Tue, 26 Jul 2022 12:22:10 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id az14-20020adfe18e000000b0021e529efa60sm9911003wrb.1.2022.07.26.12.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:21:59 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BF61B1FFC9; Tue, 26 Jul 2022 20:21:51 +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=YFZM3SAWhCsWYiAAU+juFm/2nGYXO7JZo/FUKFvJIzyxBTSVomht3D7zRSZ0iGoitO d8lLhOzrd17TXUmiDmhyisnDgE5msVDiLUlJSgkozeBP3P1//WMcLSPhaKjPTuLsM3EH S3Pa6lC9KI8WiRkf9/AvvmueAq1K5NiczC+EuzZHiyRen3Ot5sn78elpSh+DXGG1ulBc Jv0DU9pRQk8Y6IiHfG7TQpWT3+vFrNM5h6q8Hmgu4pYUem4PzYo93yRBTWZ++1DK0XfH pzy40LBJbJTu/W2R2xV0ocw4EN3hMTH0IIBFHX5SCOMbGxDVQhDqJBYcS0iK3TplxUTW rapw== 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=vHLREeCoIHe9oXicuhFz9KymZFkZ5mpR5Q/LLq0k0Um0lVX2JYIBrYGZ1SPO1IYK7A 95lr/T0RunR3NMhUPvMOpSXFDU/1v4ebmF1J++YdonsM0Dqk1vjcq6miMi6tL9QZhIy8 s7+HI4FEYgGMvnDUQ5jbJiwpfrLEtIka32pPgHWlS2vOuGGj2O3hailkijSWF88i0Gj2 aWdq1qjh3X/inM770BQHSHL+z/AlfjaDiMNZACz9PRd3tyH70Er/aAl2SlMDpDT0/WC+ gACU7ZyX4q8idiHBzAl4oj34tobWMOanIP8H0TrSu5zljbmW1+KB3FzJdOWaAxJgsSfG jD5A== X-Gm-Message-State: AJIora+ErKY/P4WZk7rApodvZFTrucT6dVpcqudjZTlmIUI0cYZrs4Dv 8kjqdWcbR8WHhjkEyACwmtQnmQ== X-Google-Smtp-Source: AGRyM1sHrliBoGwSEmE3n1nRrH7TXR2B6Vhuz3gRes7WKNGJiRledHtAppWL3RkBP1bqtjLh0g2cBg== X-Received: by 2002:a05:6000:2a4:b0:21e:6e0e:df1f with SMTP id l4-20020a05600002a400b0021e6e0edf1fmr11614994wry.516.1658863329858; Tue, 26 Jul 2022 12:22: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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 17/21] tests/qtest: plain g_assert for VHOST_USER_F_PROTOCOL_FEATURES Date: Tue, 26 Jul 2022 20:21:46 +0100 Message-Id: <20220726192150.2435175-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42e.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658865306995100001 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 Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658864462; cv=none; d=zohomail.com; s=zohoarc; b=HCVZjtbpVxTLtjeBISDz0DcYIrO4cEtAclLBz/MBxzqndCF2xDICRKitU5rMYP9AKidzeqSEQhBFxPkL+EP6NOMpnonKCYDsllyAURSSwovA+nEZZfP+ORf8oadejC2HbctS64R0mAkdYIFLeg2ALruG5a3zlyMob3qWY0Kx/O8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658864462; 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=PYaGkXjsZkoph9fA5YpZi9kVlMvB2mVtLyywEwpEssY=; b=OabL9h2ZH1CEMoaXURTrW8djMRcuXP70oAXEV58Xb+ZHqwKV6xd1BBp9J2ExVXGajLzm1uhTLItA195jv1LNvijrcdIDxTEb9cJyOL3AKBoeZppB1Mr36CuIgk/tyx5PWvSXLJbjJa5+hldz0zWfvieFR/9YCYK2mMWktzcQvXI= 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+importer=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 1658864462433709.8302452964499; Tue, 26 Jul 2022 12:41:02 -0700 (PDT) Received: from localhost ([::1]:51246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQQN-0005ZV-SV for importer@patchew.org; Tue, 26 Jul 2022 15:40:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQGC-0006bt-BN for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:30:35 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:39720) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQG6-0003bT-1y for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:30:24 -0400 Received: by mail-wr1-x435.google.com with SMTP id d8so21379539wrp.6 for ; Tue, 26 Jul 2022 12:30:21 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id q6-20020a1cf306000000b0039c5ab7167dsm21916848wmq.48.2022.07.26.12.30.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:30:14 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id CB3A41FFCA; Tue, 26 Jul 2022 20:21:51 +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=PYaGkXjsZkoph9fA5YpZi9kVlMvB2mVtLyywEwpEssY=; b=ual7CBUuvRDdw1MsLKJ5y9GezAGN+AST2WPzf2yk2Np9/RY3mmGfEDID+i+ed+M2h3 g8jLpNPySYjNuKdDSBLr3Ss9dOfDD+AoSxGU+45BFKwg3DJ0gxPAP4sSEC95FMW8nDsS fohp7/TfA0kv/qeuCvtzrwknoecHBdndJcwBKds/Hw0jPC0+oMA09sltLXolo31IV4Wh AUVXml4r7bEj2zIrM6M1FEKkO8wJeq27dJE5gjhxoK2wSZSuYEGl+cBf7Jpe5GpI8Q5w rqa4AcoeuTfU0dhP2WRfgzyp8PjIdSQGenvZ5epopNoyumjGkG3GUmAHEGgMUqpASi85 pFeQ== 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=PYaGkXjsZkoph9fA5YpZi9kVlMvB2mVtLyywEwpEssY=; b=srdW51lmWNXKgsXhm648cZwVZJnV1lb52ZEr57DClHXn4vArepocgTChHs3+PHNeyE sCtHIfoqXkFEb0JzGb3kyqDqmTMi4vPfExCHp3mYPHSeVLc/4jlZyU1mzyYyAxx5iRTK t9uV18qyJImVPEd+6lSP5s2QFJNA3YvPAwwAQFA5q9u852iXjjSEYslWLLasrtFaxIAq IsDewfqSApgbuCMs8OP6dxDuCyvM5PxeeBYzEnxeQ8VCv0wIIKo2NNID54/2qZTNwy3m +7BMvbydoE67b5OpToxgznhXR7YW9738XbFGXPNoIoy0iQOqL4JpdxOWwyNLIAf/Iww8 q8Mg== X-Gm-Message-State: AJIora/qBKYQZAOOR9pt2SKoOM+R64+TxzAzXpSb7F3G6m0i/lT4PlUK 0pqRpa/QQZnKazafv09wIdSudA== X-Google-Smtp-Source: AGRyM1t72VyM1VmtJ2TdD07MYTIgBN9CRsWte1hCUx6n+AWCBgXLd2NuNZrtbD4BNAJcAHx3bDLV5g== X-Received: by 2002:a5d:59c6:0:b0:21e:86fe:fcc6 with SMTP id v6-20020a5d59c6000000b0021e86fefcc6mr8196415wry.139.1658863819519; Tue, 26 Jul 2022 12:30:19 -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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 18/21] tests/qtest: add assert to catch bad features Date: Tue, 26 Jul 2022 20:21:47 +0100 Message-Id: <20220726192150.2435175-19-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658864464767100002 No device driver (which is what the qvirtio_ access functions represent) should be setting UNUSED(30) in the feature space. Although existing libqos users mask it out lets ensure nothing sneaks through. Signed-off-by: Alex Benn=C3=A9e --- tests/qtest/libqos/virtio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qtest/libqos/virtio.c b/tests/qtest/libqos/virtio.c index 09ec09b655..03056e5187 100644 --- a/tests/qtest/libqos/virtio.c +++ b/tests/qtest/libqos/virtio.c @@ -101,6 +101,8 @@ uint64_t qvirtio_get_features(QVirtioDevice *d) =20 void qvirtio_set_features(QVirtioDevice *d, uint64_t features) { + g_assert(!(features & QVIRTIO_F_BAD_FEATURE)); + d->features =3D features; d->bus->set_features(d, features); =20 --=20 2.30.2 From nobody Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658864463; cv=none; d=zohomail.com; s=zohoarc; b=e9r/R+2AAOEXwnML2jOWpilMHm1fSN+D4O0SIlamioFloFFKGQK/fava/ESBy4IkaEILIXOGrCo+pZfgrSwFeWFE4E4wPvLA5P9vXxiVW/5XdmzotVkUIbPkVANCuzK+d0jqDY9hLn1zgxe3mUQivFlf3Nb3dPwla22Sl7ObOT4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658864463; 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=aABPk8mLtqBZm+kWTidF5m3dPt/p0pz5+jpUhBLjAPccENhefTUNEYOnMGJBN1It/MqS1hI3GfC7gGHCGXPvI3GPAEZj460hoRCq2pXImo/pP0oyAzejl6EzJ0z4wHP3a4HkS6J5yNrRTmdWGzG6O/AYhQibSLulbpShg/wDmXI= 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+importer=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 165886446391871.70223652778475; Tue, 26 Jul 2022 12:41:03 -0700 (PDT) Received: from localhost ([::1]:51520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQQQ-0005k7-Ph for importer@patchew.org; Tue, 26 Jul 2022 15:41:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQ8H-0003Or-J5 for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:18 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:41555) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQ8F-0002PG-VR for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:17 -0400 Received: by mail-wr1-x429.google.com with SMTP id q18so11037760wrx.8 for ; Tue, 26 Jul 2022 12:22:15 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id p20-20020a05600c1d9400b003a3561d4f3fsm9574115wms.43.2022.07.26.12.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:22:07 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E1F9F1FFCB; Tue, 26 Jul 2022 20:21:51 +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=CP7lN+TmZ3Pujh0mILQ2/noel6Xy+f6GVEdKkt7wPZTgcLy/3d+waBOSwnEauerGe6 GTIb4KE6LeUH6OvLAHCy0fVRV7IpoaC9KaD+glw+HCFliTQxbMQg0jzOLRR9/95aZ3r0 IxFp7nQuc0GqtVn3EuVklVS9wJtUhK6nmTvTbhPxhnDphkcrpFmDGE/CmOlvskhT7LAP HYt4hxlaYSVzFYeBux39dxQ5jz9MBSV7xv9HeGKEQKQvGN//IqlGthWESbN5kJVuvVgZ YbcQZaUAc97TozDJikyVxPRwbF3B2OWdkM8FjLFp7BsONr64zsCFSwxrbRDSq/0E/wmR LWRA== 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=RZ0oEyPvpBlaAdlG+ddP9govW8pEHRFlmBhskcsU7tFdF6sP8eZcXLELkRCbsI5uA7 01LIH7Lr2wbWhTW3qNscX6LoVfu1ETQNFsCKyQv7fRgayXhy3JMjXMUhI+hqx7rvxnk6 0e+V4vSTS7xS5sYYZaPKNx7qVUE2WFrz8x8RExX/9NIhJ2J85XJ2MJxj/9+K9fnRxCwz 8UMUBSwUacnNNdfTBJ8iDDrA4Jxujfxz3q6Rc7phVurDnVGjEqC+Q2RUYnC0oxH4X92Q EW8Tj135XEHJEo4OjahXOaeHSlerU1F/DzSP9t+QwSyg8ZMKUdxbeXNSatN38wCxYDOS tP4g== X-Gm-Message-State: AJIora+bmsr5g90rxNmeK1LlPBJC+XZsYm0uawbDIgooECBOG2zTNlna hv6BQ17bXFL48Z4xWOR5nGZlCA== X-Google-Smtp-Source: AGRyM1tK0EoYiSgvr3c6MnDpkS8VPb/mN7dezxP8RhaeszDkO5g6tbGO54aZ0dF/1N9gPF7cJEZXog== X-Received: by 2002:a05:6000:1547:b0:21e:5be2:9ed3 with SMTP id 7-20020a056000154700b0021e5be29ed3mr11929957wry.459.1658863334633; Tue, 26 Jul 2022 12:22: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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 19/21] tests/qtest: implement stub for VHOST_USER_GET_CONFIG Date: Tue, 26 Jul 2022 20:21:48 +0100 Message-Id: <20220726192150.2435175-20-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x429.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658864464765100001 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 Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658865489; cv=none; d=zohomail.com; s=zohoarc; b=g39LraZpYBXl4zpxYGWY3W43LNdIkQLWjjJH0T5ypVaDmScunN3p0E2EuqBcQQHZpN/RXE068ucGbV021dAAEaJTKOqorTlxbx4yoKB6HPZpNka8s8UW82YD5D5HCSQChxbTpypKdDgm8AsITZxMBHLOLpNqPdxtCQH27R/fUPk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658865489; 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=CI5GlLC2+CbTxz9bEbvza+Jamr7kJ5p2tUpuDsTiy37zoopsH/SivQaDLOV/EBmZ3HsjZMr/oAVQyqRUwrdFFpRxesswiZdleIcv6mHR9EAVJBdBBzvkz7Wujw7AUSdsr9y168cIbIVWnINmq7XvNGBCkMDAFEUdgFWCAd6BpjA= 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+importer=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 1658865489870240.75850315258253; Tue, 26 Jul 2022 12:58:09 -0700 (PDT) Received: from localhost ([::1]:54664 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQgy-0002Ms-Pl for importer@patchew.org; Tue, 26 Jul 2022 15:58:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49106) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQ8F-0003No-P4 for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:16 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:40548) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQ8E-0002Gz-4p for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:15 -0400 Received: by mail-wr1-x431.google.com with SMTP id m17so21167266wrw.7 for ; Tue, 26 Jul 2022 12:22:13 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id y2-20020a5d6142000000b0021d70a871cbsm15306184wrt.32.2022.07.26.12.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:22:07 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 053CF1FFCC; Tue, 26 Jul 2022 20:21:52 +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=aYHkGrAWWbmJzOEvdL6EsWf5rY3TvU1X5EE6dpqIPsw47NhrxzW/yzy9XPfdW3C8b6 dP72QJZGdWh1xuBDci+l80i8/QXQCO6JkA7hq16xQqNgyNaB3Cj6W4VipNxIg7FLdFI+ 3jY3kWIrecnk0MPCT2SE/wOliO6lJx77Pgs5Li2E+t+dMIvQ+H2YRxaviWEdBminb3op PvQ/GWI6aneYOkszsPNdUJhb8P4L7Rr95fUVt9AEcym/lRKPZa5ysYcaedzEXCWVNMRo 8Qe9Cisb+P8iVMuCmqnUiBXXGa2D9Ksbtj3HXV9RuqB5yWf25F09SSpHTNKFJBCpM82E 87gg== 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=tefjm0eNX1ke9k+y16cPVzS8IrBan5/k40fJvJnSfkBozqH41O2vQAkh+BHvBmgBlF Q4E0FhqX1ER9p/mqZtMl3WpNYclD71eqYE5T4zC5MkNgoEowNgrhrh8QM5EDi5RUSYXo WwvsDrNwg/mU2POl6wKAiSnywkJXnXHsAPy0rRC44g0oljsdZc86ipQuyRR/pRF7AJHk RqmbbK+pqd+lhWFFD22yT650K1AK3mSnCZ00JXA1/kqTYOUmv45ZouiD+U3yfc3QHnpu 4u2bfppLj/SrKzodzqgk7IhqozjQnxA2kESecek1uQ2TKy+pFDV5AdlqONftAJVADSws AJAg== X-Gm-Message-State: AJIora+Y04BCQPzjqPlWyCtIDjVVRY3YSFMe8m1hqFkdKYB6Ue4A0IxA 8rxjVRFcD7dCXPYBz1Q5axzdrcP8RHwbig== X-Google-Smtp-Source: AGRyM1vi457BNj5NqMsPy3KxJOdZDZtoV3dIMhHkmuSHAhdHWUfPzkSbMRWR3tYBM/ThsA2kKm8bIQ== X-Received: by 2002:adf:ed8d:0:b0:21e:c7fb:7945 with SMTP id c13-20020adfed8d000000b0021ec7fb7945mr158066wro.353.1658863332721; Tue, 26 Jul 2022 12:22: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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 20/21] tests/qtest: add a get_features op to vhost-user-test Date: Tue, 26 Jul 2022 20:21:49 +0100 Message-Id: <20220726192150.2435175-21-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658865490554100001 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 Thu May 16 11:20:15 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1658864116; cv=none; d=zohomail.com; s=zohoarc; b=M3AJJkaeYxgdQ7tAppmOt35h8XgHgwHiIzwBL4FNeWL9x7hGRE1It6UBCjsamIsfnpsWjr994nf9gQhZ+vV5apKaUxLc1ZS13VTtuClB6cZEV2elBuVF+dFCKNV26gaWQUIsst3Cp/7oGbhOklvU2w9fohLm1YFpZ80VUSfBuC0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658864116; 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=mz38geXVMD8QvQyjK3HC1o/d5nv/Gs14NfsxQZWXhHg=; b=F7SrP932WrAyKhW/BMwvY13X6pVp/4G1GuxfZPjBbjbGebkiDnLnofWqUkuhkqc7QFBdOYkR4mw+QeLfpSdYTEufpgtgOEoGLnzNkj7Xf1yOEkHTuiR4hQh9FoXg709qFDfI//Mf/23Q8Wxsqt0ybAneDTlYsV1WaBhah1yJiOA= 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+importer=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 1658864115966540.0336977732097; Tue, 26 Jul 2022 12:35:15 -0700 (PDT) Received: from localhost ([::1]:45034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGQKo-0001E6-Il for importer@patchew.org; Tue, 26 Jul 2022 15:35:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGQ8G-0003O3-TX for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:18 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:37832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGQ8D-0002On-5k for qemu-devel@nongnu.org; Tue, 26 Jul 2022 15:22:16 -0400 Received: by mail-wr1-x435.google.com with SMTP id u5so21463745wrm.4 for ; Tue, 26 Jul 2022 12:22:12 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id w17-20020a5d6811000000b0021e6effef8bsm9918372wru.50.2022.07.26.12.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:22:07 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1C3701FFCD; Tue, 26 Jul 2022 20:21:52 +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=mz38geXVMD8QvQyjK3HC1o/d5nv/Gs14NfsxQZWXhHg=; b=MUa/5g31sVcHaZlm/9NUnQVWXsw8uGA+HiEoMdT17oPJkh/uhsMcj0TRySF1qfr7VG lUYKL045zjtlRNHKA47xf3sqX3yOhuKTcosg7Tc0IgfbTk+O4Z9HhUbMPvbPX6qd8t5Z JNaFXrDPPL86cEtlQOlkrdUSlhrBLlkkegnfshABGUFPs6RYEUdrM5wZxLTa/N+f+MUy yfCnU0OTbDCOHkJRbdF8ufSiPrkmgTjQUywhixU5opFRaUZGxs0Xco3oL5/C5WpExBv6 CJ9huTiGAHelqDFb4wwHjS4thwsmzQQAfKsGRRJZ/4gjqHz3KVPOyf6JTcS8Ei1wQlPe RiJA== 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=mz38geXVMD8QvQyjK3HC1o/d5nv/Gs14NfsxQZWXhHg=; b=VDAOdaeptrV2wnjwgc6KuC9h8KYESKU0gU2n7O2jrRfnIeNdT/77sMAxVt1LlzJH1g Lecrw78vFDulriDzxj/O3sBVUxXJXm3npokOSHTWK8RU5BGJCKGbnDXdaMCA8Z7Ko3r3 R5RPMWSNypkbWLRz5iINJbsXw5Apng+koydu0XkwuXWoA3QNWqGuw1haehfjEfdbyAhy AkTQ9FRdqzlOWsCMOtM2qO/y95h/WQBuR9h9kdCfZ6ds7nmLoRosGZQfKHSlYqxjWwJZ ecKMHJqsEzs/wbQpVF02zmH7o4HeFj9i3aFQoAyudMQisqPA8cP48IAWvOWTIE+wAJ5D v2aw== X-Gm-Message-State: AJIora9mraYi7alNBOWna4C7tZHKFGWkfXoZfCOqU11PA3nf8yS09YsF JuboHhfVKquoF3BYj0fTwKgDuA== X-Google-Smtp-Source: AGRyM1uHfvyPhy42hHMwlonjDeJwklTvBA2zwtsPCXbafrLPvnWVIucHUgOJPTOfzw4IU8KZieWy4w== X-Received: by 2002:adf:d084:0:b0:21e:5570:2b05 with SMTP id y4-20020adfd084000000b0021e55702b05mr11682866wrh.554.1658863331786; Tue, 26 Jul 2022 12:22: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, mark.cave-ayland@ilande.co.uk, jasowang@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Eric Auger , Thomas Huth , Laurent Vivier Subject: [PATCH v3 21/21] tests/qtest: enable tests for virtio-gpio Date: Tue, 26 Jul 2022 20:21:50 +0100 Message-Id: <20220726192150.2435175-22-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220726192150.2435175-1-alex.bennee@linaro.org> References: <20220726192150.2435175-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+importer=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1658864118108100001 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 03056e5187..410513225f 100644 --- a/tests/qtest/libqos/virtio.c +++ b/tests/qtest/libqos/virtio.c @@ -110,7 +110,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