From patchwork Wed May 25 12:55:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liu, Changpeng" X-Patchwork-Id: 12861253 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9A86DC433F5 for ; Wed, 25 May 2022 14:09:16 +0000 (UTC) Received: from localhost ([::1]:57892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntrhL-0002bU-LD for qemu-devel@archiver.kernel.org; Wed, 25 May 2022 10:09:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntqYR-0006DL-8m for qemu-devel@nongnu.org; Wed, 25 May 2022 08:56:02 -0400 Received: from mga05.intel.com ([192.55.52.43]:44955) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntqYK-0002f8-N6 for qemu-devel@nongnu.org; Wed, 25 May 2022 08:55:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653483352; x=1685019352; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Jnial1OdoHHEmwIKrBMigJZ/nCpjItNtIGHTTg7Ue+Q=; b=cZskVAekkqjDPy9O87QILQPxaWjQp7Rja4wlgm5feuJ4+1S8tqlXzNLP PWz6HfWIRK2w/2hhTKFDbGUTX5+84n3y6wXm9Y1L3pqk/2pzwgIWpkNe+ DKrG0yZjaKjYnO89gLZUxdJp3tbzM9Wpd6bleLtQTGVM+82uZwKU2HCOt n7ubI5/1g7Wo/ya5D6cFnO6wFuk/I9+oTTJU6Ea0rvvhtWdRo6zp4Mhjk MlQva10IkqRA45aOjwfzUxKcnTnF3lTrCa/Ze3rxS+Opp9wFGM/hsn/4/ 9GbfIXUZuVXq3/l5fFzR07RG4pKAaTibjZ68mKRWu5fY4TGY/kcgUIjbC g==; X-IronPort-AV: E=McAfee;i="6400,9594,10357"; a="360195204" X-IronPort-AV: E=Sophos;i="5.91,250,1647327600"; d="scan'208";a="360195204" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2022 05:55:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,250,1647327600"; d="scan'208";a="601892511" Received: from waikikibeach52.sh.intel.com ([10.67.111.57]) by orsmga008.jf.intel.com with ESMTP; 25 May 2022 05:55:46 -0700 From: Changpeng Liu To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, changpeng.liu@intel.com Subject: [PATCH 1/2] hw/virtio/vhost-user: don't use uninitialized variable Date: Wed, 25 May 2022 20:55:39 +0800 Message-Id: <20220525125540.50979-1-changpeng.liu@intel.com> X-Mailer: git-send-email 2.21.3 MIME-Version: 1.0 Received-SPF: pass client-ip=192.55.52.43; envelope-from=changpeng.liu@intel.com; helo=mga05.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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-Mailman-Approved-At: Wed, 25 May 2022 10:02:04 -0400 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Variable `vdev` in `struct vhost_dev` will not be ready until start the device, so let's not use it for the error output here. Fixes: 5653493 ("hw/virtio/vhost-user: don't suppress F_CONFIG when supported") Signed-off-by: Changpeng Liu Reviewed-by: Raphael Norwitz --- hw/virtio/vhost-user.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index b040c1ad2b..0594178224 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -2031,18 +2031,16 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque, if (supports_f_config) { if (!virtio_has_feature(protocol_features, VHOST_USER_PROTOCOL_F_CONFIG)) { - error_setg(errp, "vhost-user device %s expecting " + error_setg(errp, "vhost-user device expecting " "VHOST_USER_PROTOCOL_F_CONFIG but the vhost-user backend does " - "not support it.", dev->vdev->name); + "not support it."); return -EPROTO; } } else { if (virtio_has_feature(protocol_features, VHOST_USER_PROTOCOL_F_CONFIG)) { warn_reportf_err(*errp, "vhost-user backend supports " - "VHOST_USER_PROTOCOL_F_CONFIG for " - "device %s but QEMU does not.", - dev->vdev->name); + "VHOST_USER_PROTOCOL_F_CONFIG but QEMU does not."); protocol_features &= ~(1ULL << VHOST_USER_PROTOCOL_F_CONFIG); } } From patchwork Wed May 25 12:55:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liu, Changpeng" X-Patchwork-Id: 12861251 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D0B5C433EF for ; Wed, 25 May 2022 14:06:52 +0000 (UTC) Received: from localhost ([::1]:49216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntrf0-0005on-Vg for qemu-devel@archiver.kernel.org; Wed, 25 May 2022 10:06:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46132) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntqYR-0006DO-9k for qemu-devel@nongnu.org; Wed, 25 May 2022 08:56:02 -0400 Received: from mga05.intel.com ([192.55.52.43]:44960) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntqYN-0002fD-16 for qemu-devel@nongnu.org; Wed, 25 May 2022 08:55:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653483355; x=1685019355; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3RnqZooBIpCs91x1mqVDqgiHf9TjlVDp8RGbzwP+T4U=; b=fxJetUuDdY2T1NGwhn9TT2WPxoyaZfPZxDmBi4J3YNs4lj+gLWf5dUhM Zcx3z9HeZKkum9lUgfG7P7Zjin3OlzsgWYGH40EtZkqb7y7/0mIJrJcYj 3t0cisF+ekDfi6hR834hDo+eP5eYqDAu1dNkvsfXitHWzHotBL1dg/8+E U+nvsu6ZcafxRhSq0IPCcZSLCpwXGjr8tM+Byrwpyuew9D3n3Sat39crQ /brmbznNgHeYMfqC407oi0cSxlv/uBG4Se9zYQhHc2I3jLj60Go0+Na8y /DLzYcdnu/smCof0soUmOf5tJgcQQXsY+PYVoajCjOTNb+fCAhOmfzfN0 g==; X-IronPort-AV: E=McAfee;i="6400,9594,10357"; a="360195212" X-IronPort-AV: E=Sophos;i="5.91,250,1647327600"; d="scan'208";a="360195212" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2022 05:55:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,250,1647327600"; d="scan'208";a="601892520" Received: from waikikibeach52.sh.intel.com ([10.67.111.57]) by orsmga008.jf.intel.com with ESMTP; 25 May 2022 05:55:51 -0700 From: Changpeng Liu To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, changpeng.liu@intel.com Subject: [PATCH 2/2] hw/vhost-user-scsi|blk: set `supports_config` flag correctly Date: Wed, 25 May 2022 20:55:40 +0800 Message-Id: <20220525125540.50979-2-changpeng.liu@intel.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20220525125540.50979-1-changpeng.liu@intel.com> References: <20220525125540.50979-1-changpeng.liu@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.55.52.43; envelope-from=changpeng.liu@intel.com; helo=mga05.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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-Mailman-Approved-At: Wed, 25 May 2022 10:02:04 -0400 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Currently vhost-user-scsi driver doesn't allow to change the configuration space of virtio_scsi, while vhost-user-blk support that, so here we set the flag in vhost-user-blk driver and unset it in vhost-user-scsi. Signed-off-by: Changpeng Liu Reviewed-by: Raphael Norwitz --- hw/block/vhost-user-blk.c | 1 + hw/scsi/vhost-user-scsi.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 5dca4eab09..9117222456 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -337,6 +337,7 @@ static int vhost_user_blk_connect(DeviceState *dev, Error **errp) vhost_dev_set_config_notifier(&s->dev, &blk_ops); + s->vhost_user.supports_config = true; ret = vhost_dev_init(&s->dev, &s->vhost_user, VHOST_BACKEND_TYPE_USER, 0, errp); if (ret < 0) { diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index 9be21d07ee..1b2f7eed98 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -121,7 +121,6 @@ static void vhost_user_scsi_realize(DeviceState *dev, Error **errp) vsc->dev.backend_features = 0; vqs = vsc->dev.vqs; - s->vhost_user.supports_config = true; ret = vhost_dev_init(&vsc->dev, &s->vhost_user, VHOST_BACKEND_TYPE_USER, 0, errp); if (ret < 0) {