From nobody Wed May 1 16:32:56 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165107027214575.95332676762666; Wed, 27 Apr 2022 07:37:52 -0700 (PDT) Received: from localhost ([::1]:47832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njinf-0003wE-3f for importer2@patchew.org; Wed, 27 Apr 2022 10:37:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59230) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njilj-0000P9-P0 for qemu-devel@nongnu.org; Wed, 27 Apr 2022 10:35:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:55226) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njilh-0000h7-If for qemu-devel@nongnu.org; Wed, 27 Apr 2022 10:35:51 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-578-aKORJdcYM32dpSsQngXQbA-1; Wed, 27 Apr 2022 10:35:45 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 66F393C23FA3; Wed, 27 Apr 2022 14:35:44 +0000 (UTC) Received: from localhost (unknown [10.39.195.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16949C53360; Wed, 27 Apr 2022 14:35:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651070148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9ZP3lPqOofQa8RmvJott9WghY1vGPz5GAxohwXzJYBw=; b=bprIP2it/RJi1/0vUc48IaD4t8NQorMyhqKf31/SNzTZFR3O/tKWWf9MsC8qej0TfvuMmN 7pRnhCQkLhABEqFubxHNdaE2McNYLBuCtM0kpSRMk1kAhGisBbpIEUTtmCR0qLLaCYXRdX +kvNFHFvyUEZoNLmY+fcNWu7NY2mSrI= X-MC-Unique: aKORJdcYM32dpSsQngXQbA-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH 1/6] virtio-scsi: fix ctrl and event handler functions in dataplane mode Date: Wed, 27 Apr 2022 15:35:36 +0100 Message-Id: <20220427143541.119567-2-stefanha@redhat.com> In-Reply-To: <20220427143541.119567-1-stefanha@redhat.com> References: <20220427143541.119567-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nir Soffer , Paolo Bonzini , qemu-stable@nongnu.org, Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1651070274356100001 Content-Type: text/plain; charset="utf-8" Commit f34e8d8b8d48d73f36a67b6d5e492ef9784b5012 ("virtio-scsi: prepare virtio_scsi_handle_cmd for dataplane") prepared the virtio-scsi cmd virtqueue handler function to by used in both the dataplane and non-datpalane code paths. It failed to convert the ctrl and event virtqueue handler functions, which are not designed to be called from the dataplane code path but will be since the ioeventfd is set up for those virtqueues when dataplane starts. Convert the ctrl and event virtqueue handler functions now so they operate correctly when called from the dataplane code path. Avoid code duplication by extracting this code into a helper function. Fixes: f34e8d8b8d48d73f36a67b6d5e492ef9784b5012 ("virtio-scsi: prepare virt= io_scsi_handle_cmd for dataplane") Signed-off-by: Stefan Hajnoczi Reviewed-by: Paolo Bonzini --- hw/scsi/virtio-scsi.c | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 34a968ecfb..417fbc71d6 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -472,16 +472,32 @@ bool virtio_scsi_handle_ctrl_vq(VirtIOSCSI *s, VirtQu= eue *vq) return progress; } =20 +/* + * If dataplane is configured but not yet started, do so now and return tr= ue on + * success. + * + * Dataplane is started by the core virtio code but virtqueue handler func= tions + * can also be invoked when a guest kicks before DRIVER_OK, so this helper + * function helps us deal with manually starting ioeventfd in that case. + */ +static bool virtio_scsi_defer_to_dataplane(VirtIOSCSI *s) +{ + if (!s->ctx || s->dataplane_started) { + return false; + } + + virtio_device_start_ioeventfd(&s->parent_obj.parent_obj); + return !s->dataplane_fenced; +} + static void virtio_scsi_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) { VirtIOSCSI *s =3D (VirtIOSCSI *)vdev; =20 - if (s->ctx) { - virtio_device_start_ioeventfd(vdev); - if (!s->dataplane_fenced) { - return; - } + if (virtio_scsi_defer_to_dataplane(s)) { + return; } + virtio_scsi_acquire(s); virtio_scsi_handle_ctrl_vq(s, vq); virtio_scsi_release(s); @@ -720,12 +736,10 @@ static void virtio_scsi_handle_cmd(VirtIODevice *vdev= , VirtQueue *vq) /* use non-QOM casts in the data path */ VirtIOSCSI *s =3D (VirtIOSCSI *)vdev; =20 - if (s->ctx && !s->dataplane_started) { - virtio_device_start_ioeventfd(vdev); - if (!s->dataplane_fenced) { - return; - } + if (virtio_scsi_defer_to_dataplane(s)) { + return; } + virtio_scsi_acquire(s); virtio_scsi_handle_cmd_vq(s, vq); virtio_scsi_release(s); @@ -855,12 +869,10 @@ static void virtio_scsi_handle_event(VirtIODevice *vd= ev, VirtQueue *vq) { VirtIOSCSI *s =3D VIRTIO_SCSI(vdev); =20 - if (s->ctx) { - virtio_device_start_ioeventfd(vdev); - if (!s->dataplane_fenced) { - return; - } + if (virtio_scsi_defer_to_dataplane(s)) { + return; } + virtio_scsi_acquire(s); virtio_scsi_handle_event_vq(s, vq); virtio_scsi_release(s); --=20 2.35.1 From nobody Wed May 1 16:32:56 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165107030430169.26960283789913; Wed, 27 Apr 2022 07:38:24 -0700 (PDT) Received: from localhost ([::1]:49736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njioB-0005Bh-7c for importer2@patchew.org; Wed, 27 Apr 2022 10:38:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njili-0000Nn-JF for qemu-devel@nongnu.org; Wed, 27 Apr 2022 10:35:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:49854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njilh-0000gu-30 for qemu-devel@nongnu.org; Wed, 27 Apr 2022 10:35:50 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-537-YR4LPSrsOJupEDYG-3O-ww-1; Wed, 27 Apr 2022 10:35:46 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9D7B23C23FAD; Wed, 27 Apr 2022 14:35:45 +0000 (UTC) Received: from localhost (unknown [10.39.195.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E88B57D286; Wed, 27 Apr 2022 14:35:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651070148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mYGyh7CVx9WwteO21dWLdp23TH8NvGdhAPf41cUleTQ=; b=G8i4qIPTI/JjQ3KEFuP+pfyqlWCiJxz9feDXrrDkQR7Up5GG7eOjmEQdpUH/kd8PFiMrSU zM/0ZtGuStUQHLtLi3rVdHw1S++9r0Pjl5vRMu4gwd03PWWEWvPm+ZjRTctswiGRvQTMye bDpQrIE5qvQBaGFLJPmsTh6LLaAIIZg= X-MC-Unique: YR4LPSrsOJupEDYG-3O-ww-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH 2/6] virtio-scsi: don't waste CPU polling the event virtqueue Date: Wed, 27 Apr 2022 15:35:37 +0100 Message-Id: <20220427143541.119567-3-stefanha@redhat.com> In-Reply-To: <20220427143541.119567-1-stefanha@redhat.com> References: <20220427143541.119567-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nir Soffer , Paolo Bonzini , qemu-stable@nongnu.org, Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1651070304555100001 Content-Type: text/plain; charset="utf-8" The virtio-scsi event virtqueue is not emptied by its handler function. This is typical for rx virtqueues where the device uses buffers when some event occurs (e.g. a packet is received, an error condition happens, etc). Polling non-empty virtqueues wastes CPU cycles. We are not waiting for new buffers to become available, we are waiting for an event to occur, so it's a misuse of CPU resources to poll for buffers. Introduce the new virtio_queue_aio_attach_host_notifier_no_poll() API, which is identical to virtio_queue_aio_attach_host_notifier() except that it does not poll the virtqueue. Before this patch the following command-line consumed 100% CPU in the IOThread polling and calling virtio_scsi_handle_event(): $ qemu-system-x86_64 -M accel=3Dkvm -m 1G -cpu host \ --object iothread,id=3Diothread0 \ --device virtio-scsi-pci,iothread=3Diothread0 \ --blockdev file,filename=3Dtest.img,aio=3Dnative,cache.direct=3Don,no= de-name=3Ddrive0 \ --device scsi-hd,drive=3Ddrive0 After this patch CPU is no longer wasted. Reported-by: Nir Soffer Signed-off-by: Stefan Hajnoczi Tested-by: Nir Soffer --- include/hw/virtio/virtio.h | 1 + hw/scsi/virtio-scsi-dataplane.c | 2 +- hw/virtio/virtio.c | 13 +++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index b31c4507f5..b62a35fdca 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -317,6 +317,7 @@ EventNotifier *virtio_queue_get_host_notifier(VirtQueue= *vq); void virtio_queue_set_host_notifier_enabled(VirtQueue *vq, bool enabled); void virtio_queue_host_notifier_read(EventNotifier *n); void virtio_queue_aio_attach_host_notifier(VirtQueue *vq, AioContext *ctx); +void virtio_queue_aio_attach_host_notifier_no_poll(VirtQueue *vq, AioConte= xt *ctx); void virtio_queue_aio_detach_host_notifier(VirtQueue *vq, AioContext *ctx); VirtQueue *virtio_vector_first_queue(VirtIODevice *vdev, uint16_t vector); VirtQueue *virtio_vector_next_queue(VirtQueue *vq); diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplan= e.c index 29575cbaf6..8bb6e6acfc 100644 --- a/hw/scsi/virtio-scsi-dataplane.c +++ b/hw/scsi/virtio-scsi-dataplane.c @@ -138,7 +138,7 @@ int virtio_scsi_dataplane_start(VirtIODevice *vdev) =20 aio_context_acquire(s->ctx); virtio_queue_aio_attach_host_notifier(vs->ctrl_vq, s->ctx); - virtio_queue_aio_attach_host_notifier(vs->event_vq, s->ctx); + virtio_queue_aio_attach_host_notifier_no_poll(vs->event_vq, s->ctx); =20 for (i =3D 0; i < vs->conf.num_queues; i++) { virtio_queue_aio_attach_host_notifier(vs->cmd_vqs[i], s->ctx); diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 9d637e043e..67a873f54a 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -3534,6 +3534,19 @@ void virtio_queue_aio_attach_host_notifier(VirtQueue= *vq, AioContext *ctx) virtio_queue_host_notifier_aio_poll_end); } =20 +/* + * Same as virtio_queue_aio_attach_host_notifier() but without polling. Use + * this for rx virtqueues and similar cases where the virtqueue handler + * function does not pop all elements. When the virtqueue is left non-empty + * polling consumes CPU cycles and should not be used. + */ +void virtio_queue_aio_attach_host_notifier_no_poll(VirtQueue *vq, AioConte= xt *ctx) +{ + aio_set_event_notifier(ctx, &vq->host_notifier, true, + virtio_queue_host_notifier_read, + NULL, NULL); +} + void virtio_queue_aio_detach_host_notifier(VirtQueue *vq, AioContext *ctx) { aio_set_event_notifier(ctx, &vq->host_notifier, true, NULL, NULL, NULL= ); --=20 2.35.1 From nobody Wed May 1 16:32:56 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651070499315757.2904840611818; Wed, 27 Apr 2022 07:41:39 -0700 (PDT) Received: from localhost ([::1]:57352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njirK-00021q-AK for importer2@patchew.org; Wed, 27 Apr 2022 10:41:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njilj-0000P1-IN for qemu-devel@nongnu.org; Wed, 27 Apr 2022 10:35:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:58065) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njilh-0000gy-7V for qemu-devel@nongnu.org; Wed, 27 Apr 2022 10:35:51 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-215-_sm_EtTKMxm1qn8qcxVLIw-1; Wed, 27 Apr 2022 10:35:47 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 13D5985A5BC; Wed, 27 Apr 2022 14:35:47 +0000 (UTC) Received: from localhost (unknown [10.39.195.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9FD2757D286; Wed, 27 Apr 2022 14:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651070148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IGMnXRiavKpjG6ndOOvn4+U/wInmDD0OdsbcPkkRYhY=; b=ilbImkh+5lZg1ciFCN8mn1X/YnUtSthAVjt/or8RidInJXXUIF8xrFvuNb8ht41ZmE4h/0 J+obH9EnbpVCxX5Vt6O5mQgxA51XXMaT0O1GjnOEY+BzGHxXy3Vllc9r7PxNGaRpCfasSd mJsS37hYS9pdRVrVo+KcVl6YXqrIOqY= X-MC-Unique: _sm_EtTKMxm1qn8qcxVLIw-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH 3/6] virtio-scsi: clean up virtio_scsi_handle_event_vq() Date: Wed, 27 Apr 2022 15:35:38 +0100 Message-Id: <20220427143541.119567-4-stefanha@redhat.com> In-Reply-To: <20220427143541.119567-1-stefanha@redhat.com> References: <20220427143541.119567-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 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_LOW=-0.7, 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: , Cc: Nir Soffer , Paolo Bonzini , qemu-stable@nongnu.org, Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1651070499678100001 Content-Type: text/plain; charset="utf-8" virtio_scsi_handle_event_vq() is only called from hw/scsi/virtio-scsi.c now and its return value is no longer used. Remove the function prototype from virtio-scsi.h and drop the return value. Signed-off-by: Stefan Hajnoczi Reviewed-by: Paolo Bonzini --- include/hw/virtio/virtio-scsi.h | 1 - hw/scsi/virtio-scsi.c | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scs= i.h index 543681bc18..5957597825 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -151,7 +151,6 @@ void virtio_scsi_common_realize(DeviceState *dev, Error **errp); =20 void virtio_scsi_common_unrealize(DeviceState *dev); -bool virtio_scsi_handle_event_vq(VirtIOSCSI *s, VirtQueue *vq); bool virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue *vq); bool virtio_scsi_handle_ctrl_vq(VirtIOSCSI *s, VirtQueue *vq); void virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq, VirtIOSCSIReq *req= ); diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 417fbc71d6..aa03a713d8 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -856,13 +856,11 @@ void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice= *dev, virtio_scsi_complete_req(req); } =20 -bool virtio_scsi_handle_event_vq(VirtIOSCSI *s, VirtQueue *vq) +static void virtio_scsi_handle_event_vq(VirtIOSCSI *s, VirtQueue *vq) { if (s->events_dropped) { virtio_scsi_push_event(s, NULL, VIRTIO_SCSI_T_NO_EVENT, 0); - return true; } - return false; } =20 static void virtio_scsi_handle_event(VirtIODevice *vdev, VirtQueue *vq) --=20 2.35.1 From nobody Wed May 1 16:32:56 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651070602590379.2855608944834; Wed, 27 Apr 2022 07:43:22 -0700 (PDT) Received: from localhost ([::1]:34450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njisz-0005cv-Ju for importer2@patchew.org; Wed, 27 Apr 2022 10:43:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njilk-0000Qm-Ji for qemu-devel@nongnu.org; Wed, 27 Apr 2022 10:35:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52706) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njilj-0000hV-4c for qemu-devel@nongnu.org; Wed, 27 Apr 2022 10:35:52 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-56-JHzxYGLoNkyDvjasvkMhgw-1; Wed, 27 Apr 2022 10:35:49 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E12DC3C23FA2; Wed, 27 Apr 2022 14:35:48 +0000 (UTC) Received: from localhost (unknown [10.39.195.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 800D2C53360; Wed, 27 Apr 2022 14:35:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651070150; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IRO4+PdsxK6PDuWJMEd52IHWLIHjs1Qwwm786P8EMSI=; b=WdJcfCP3dnIkSee5o62dneL6cW0RxSKsP2e9sNNOWddNWxVue9iUz7aQtyonXAxiEZhjvV lIIe8A9RYX8D30XpxT8MjXIdIkBlOcdIfPQCN8QOB5VQV60zDhPqpLJaIZREo9v4sFkUtC w4O8+5d+DgQ8YpDnabTYrRvH4X+bhcQ= X-MC-Unique: JHzxYGLoNkyDvjasvkMhgw-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH 4/6] virtio-scsi: clean up virtio_scsi_handle_ctrl_vq() Date: Wed, 27 Apr 2022 15:35:39 +0100 Message-Id: <20220427143541.119567-5-stefanha@redhat.com> In-Reply-To: <20220427143541.119567-1-stefanha@redhat.com> References: <20220427143541.119567-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 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_LOW=-0.7, 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: , Cc: Nir Soffer , Paolo Bonzini , qemu-stable@nongnu.org, Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1651070604286100001 Content-Type: text/plain; charset="utf-8" virtio_scsi_handle_ctrl_vq() is only called from hw/scsi/virtio-scsi.c now and its return value is no longer used. Remove the function prototype from virtio-scsi.h and drop the return value. Signed-off-by: Stefan Hajnoczi Reviewed-by: Paolo Bonzini --- include/hw/virtio/virtio-scsi.h | 1 - hw/scsi/virtio-scsi.c | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scs= i.h index 5957597825..44dc3b81ec 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -152,7 +152,6 @@ void virtio_scsi_common_realize(DeviceState *dev, =20 void virtio_scsi_common_unrealize(DeviceState *dev); bool virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue *vq); -bool virtio_scsi_handle_ctrl_vq(VirtIOSCSI *s, VirtQueue *vq); void virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq, VirtIOSCSIReq *req= ); void virtio_scsi_free_req(VirtIOSCSIReq *req); void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index aa03a713d8..eefda16e4b 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -460,16 +460,13 @@ static void virtio_scsi_handle_ctrl_req(VirtIOSCSI *s= , VirtIOSCSIReq *req) } } =20 -bool virtio_scsi_handle_ctrl_vq(VirtIOSCSI *s, VirtQueue *vq) +static void virtio_scsi_handle_ctrl_vq(VirtIOSCSI *s, VirtQueue *vq) { VirtIOSCSIReq *req; - bool progress =3D false; =20 while ((req =3D virtio_scsi_pop_req(s, vq))) { - progress =3D true; virtio_scsi_handle_ctrl_req(s, req); } - return progress; } =20 /* --=20 2.35.1 From nobody Wed May 1 16:32:56 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651070275454832.8469119064662; Wed, 27 Apr 2022 07:37:55 -0700 (PDT) Received: from localhost ([::1]:48098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njini-00046p-Fq for importer2@patchew.org; Wed, 27 Apr 2022 10:37:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njilo-0000bX-4C for qemu-devel@nongnu.org; Wed, 27 Apr 2022 10:35:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:21706) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njilm-0000iS-Jc for qemu-devel@nongnu.org; Wed, 27 Apr 2022 10:35:55 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-657-dejJJqurNmWph2QOb5pebQ-1; Wed, 27 Apr 2022 10:35:50 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5AF893804066; Wed, 27 Apr 2022 14:35:50 +0000 (UTC) Received: from localhost (unknown [10.39.195.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E35DC53360; Wed, 27 Apr 2022 14:35:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651070154; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y2B3UHJCHcDbMqiCmwRKQBEinjC0OqCWN/Ziw3EvNTk=; b=MyTBFk3HuZDc3e49pQx0vnNmyUQiddLCdus2S54g5BbUGiWDBnHX4mBgiX6cm4WKIiBoey TGoIDxWlllwcPsl5Mo8YrqXaIei/eqIxQRraPlJqHIrGAGsay4hMob3cOdDoYSehbYLVwf aruQ/sbjcg0zNn3l+dswoyrzpzJQCPo= X-MC-Unique: dejJJqurNmWph2QOb5pebQ-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH 5/6] virtio-scsi: clean up virtio_scsi_handle_cmd_vq() Date: Wed, 27 Apr 2022 15:35:40 +0100 Message-Id: <20220427143541.119567-6-stefanha@redhat.com> In-Reply-To: <20220427143541.119567-1-stefanha@redhat.com> References: <20220427143541.119567-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nir Soffer , Paolo Bonzini , qemu-stable@nongnu.org, Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1651070277354100001 Content-Type: text/plain; charset="utf-8" virtio_scsi_handle_cmd_vq() is only called from hw/scsi/virtio-scsi.c now and its return value is no longer used. Remove the function prototype from virtio-scsi.h and drop the return value. Signed-off-by: Stefan Hajnoczi Reviewed-by: Paolo Bonzini --- include/hw/virtio/virtio-scsi.h | 1 - hw/scsi/virtio-scsi.c | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scs= i.h index 44dc3b81ec..2497530064 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -151,7 +151,6 @@ void virtio_scsi_common_realize(DeviceState *dev, Error **errp); =20 void virtio_scsi_common_unrealize(DeviceState *dev); -bool virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue *vq); void virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq, VirtIOSCSIReq *req= ); void virtio_scsi_free_req(VirtIOSCSIReq *req); void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index eefda16e4b..12c6a21202 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -685,12 +685,11 @@ static void virtio_scsi_handle_cmd_req_submit(VirtIOS= CSI *s, VirtIOSCSIReq *req) scsi_req_unref(sreq); } =20 -bool virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue *vq) +static void virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue *vq) { VirtIOSCSIReq *req, *next; int ret =3D 0; bool suppress_notifications =3D virtio_queue_get_notification(vq); - bool progress =3D false; =20 QTAILQ_HEAD(, VirtIOSCSIReq) reqs =3D QTAILQ_HEAD_INITIALIZER(reqs); =20 @@ -700,7 +699,6 @@ bool virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue= *vq) } =20 while ((req =3D virtio_scsi_pop_req(s, vq))) { - progress =3D true; ret =3D virtio_scsi_handle_cmd_req_prepare(s, req); if (!ret) { QTAILQ_INSERT_TAIL(&reqs, req, next); @@ -725,7 +723,6 @@ bool virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue= *vq) QTAILQ_FOREACH_SAFE(req, &reqs, next, next) { virtio_scsi_handle_cmd_req_submit(s, req); } - return progress; } =20 static void virtio_scsi_handle_cmd(VirtIODevice *vdev, VirtQueue *vq) --=20 2.35.1 From nobody Wed May 1 16:32:56 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165107047425883.41308634373922; Wed, 27 Apr 2022 07:41:14 -0700 (PDT) Received: from localhost ([::1]:56170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njiqv-00019r-6b for importer2@patchew.org; Wed, 27 Apr 2022 10:41:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njilq-0000kh-K6 for qemu-devel@nongnu.org; Wed, 27 Apr 2022 10:35:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:31219) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njilo-0000iy-T7 for qemu-devel@nongnu.org; Wed, 27 Apr 2022 10:35:58 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-518-gGmo0JixPweqOK-Azy62tw-1; Wed, 27 Apr 2022 10:35:51 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8F97A3C23FA2; Wed, 27 Apr 2022 14:35:51 +0000 (UTC) Received: from localhost (unknown [10.39.195.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3772857CDCC; Wed, 27 Apr 2022 14:35:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651070156; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=trhdUnW3Typt8O4WzTElku0HronMbgxuIpqheIbqPcY=; b=H4/DQs/9sdvLYhs/MKQDZkqO3Qhg3owypL3wAKJQgCGz/l7YBN4TJBBwRnwUXvlnqEBM0n ytN2NV3eX9wT6jT0cew8x2xHGmf4QTpWJzp43INnAj/JOzZ9nsFdLyhObVjUN+zRc4IGrA VhGRvBTR+63x0X2t+lpbr7x227eMZe4= X-MC-Unique: gGmo0JixPweqOK-Azy62tw-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH 6/6] virtio-scsi: move request-related items from .h to .c Date: Wed, 27 Apr 2022 15:35:41 +0100 Message-Id: <20220427143541.119567-7-stefanha@redhat.com> In-Reply-To: <20220427143541.119567-1-stefanha@redhat.com> References: <20220427143541.119567-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nir Soffer , Paolo Bonzini , qemu-stable@nongnu.org, Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1651070475584100001 Content-Type: text/plain; charset="utf-8" There is no longer a need to expose the request and related APIs in virtio-scsi.h since there are no callers outside virtio-scsi.c. Note the block comment in VirtIOSCSIReq has been adjusted to meet the coding style. Signed-off-by: Stefan Hajnoczi Reviewed-by: Paolo Bonzini --- include/hw/virtio/virtio-scsi.h | 40 ----------------------------- hw/scsi/virtio-scsi.c | 45 ++++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 44 deletions(-) diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scs= i.h index 2497530064..abdda2cbd0 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -94,42 +94,6 @@ struct VirtIOSCSI { uint32_t host_features; }; =20 -typedef struct VirtIOSCSIReq { - /* Note: - * - fields up to resp_iov are initialized by virtio_scsi_init_req; - * - fields starting at vring are zeroed by virtio_scsi_init_req. - * */ - VirtQueueElement elem; - - VirtIOSCSI *dev; - VirtQueue *vq; - QEMUSGList qsgl; - QEMUIOVector resp_iov; - - union { - /* Used for two-stage request submission */ - QTAILQ_ENTRY(VirtIOSCSIReq) next; - - /* Used for cancellation of request during TMFs */ - int remaining; - }; - - SCSIRequest *sreq; - size_t resp_size; - enum SCSIXferMode mode; - union { - VirtIOSCSICmdResp cmd; - VirtIOSCSICtrlTMFResp tmf; - VirtIOSCSICtrlANResp an; - VirtIOSCSIEvent event; - } resp; - union { - VirtIOSCSICmdReq cmd; - VirtIOSCSICtrlTMFReq tmf; - VirtIOSCSICtrlANReq an; - } req; -} VirtIOSCSIReq; - static inline void virtio_scsi_acquire(VirtIOSCSI *s) { if (s->ctx) { @@ -151,10 +115,6 @@ void virtio_scsi_common_realize(DeviceState *dev, Error **errp); =20 void virtio_scsi_common_unrealize(DeviceState *dev); -void virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq, VirtIOSCSIReq *req= ); -void virtio_scsi_free_req(VirtIOSCSIReq *req); -void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, - uint32_t event, uint32_t reason); =20 void virtio_scsi_dataplane_setup(VirtIOSCSI *s, Error **errp); int virtio_scsi_dataplane_start(VirtIODevice *s); diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 12c6a21202..db54d104be 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -29,6 +29,43 @@ #include "hw/virtio/virtio-access.h" #include "trace.h" =20 +typedef struct VirtIOSCSIReq { + /* + * Note: + * - fields up to resp_iov are initialized by virtio_scsi_init_req; + * - fields starting at vring are zeroed by virtio_scsi_init_req. + */ + VirtQueueElement elem; + + VirtIOSCSI *dev; + VirtQueue *vq; + QEMUSGList qsgl; + QEMUIOVector resp_iov; + + union { + /* Used for two-stage request submission */ + QTAILQ_ENTRY(VirtIOSCSIReq) next; + + /* Used for cancellation of request during TMFs */ + int remaining; + }; + + SCSIRequest *sreq; + size_t resp_size; + enum SCSIXferMode mode; + union { + VirtIOSCSICmdResp cmd; + VirtIOSCSICtrlTMFResp tmf; + VirtIOSCSICtrlANResp an; + VirtIOSCSIEvent event; + } resp; + union { + VirtIOSCSICmdReq cmd; + VirtIOSCSICtrlTMFReq tmf; + VirtIOSCSICtrlANReq an; + } req; +} VirtIOSCSIReq; + static inline int virtio_scsi_get_lun(uint8_t *lun) { return ((lun[2] << 8) | lun[3]) & 0x3FFF; @@ -45,7 +82,7 @@ static inline SCSIDevice *virtio_scsi_device_get(VirtIOSC= SI *s, uint8_t *lun) return scsi_device_get(&s->bus, 0, lun[1], virtio_scsi_get_lun(lun)); } =20 -void virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq, VirtIOSCSIReq *req) +static void virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq, VirtIOSCSIR= eq *req) { VirtIODevice *vdev =3D VIRTIO_DEVICE(s); const size_t zero_skip =3D @@ -58,7 +95,7 @@ void virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq, V= irtIOSCSIReq *req) memset((uint8_t *)req + zero_skip, 0, sizeof(*req) - zero_skip); } =20 -void virtio_scsi_free_req(VirtIOSCSIReq *req) +static void virtio_scsi_free_req(VirtIOSCSIReq *req) { qemu_iovec_destroy(&req->resp_iov); qemu_sglist_destroy(&req->qsgl); @@ -801,8 +838,8 @@ static void virtio_scsi_reset(VirtIODevice *vdev) s->events_dropped =3D false; } =20 -void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, - uint32_t event, uint32_t reason) +static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, + uint32_t event, uint32_t reason) { VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(s); VirtIOSCSIReq *req; --=20 2.35.1