From nobody Wed Nov 27 19:50:50 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697644457; cv=none; d=zohomail.com; s=zohoarc; b=K9Fpxeg2TMS/KuEV0xTuq7DMH58vIfuNnOWEV7q72saVP25pnu4HvnOeTHsVHjGG0nqUNagsm0Bidx+hU1dsnvigiNeaGsYrO7OcYIsjK8UH6UV5OmWChF6OuduC1IqzySUSyhrK95izN6uCAez8HelZM0mgDmW5NRSA3VaIvDU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697644457; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=thscQjX5d6rsLU3psVlcnXGZdg35cG2DFqaiwAr/Wqo=; b=FH+onfssFk6904B4RYyD6C49mnL6vfOHca3qPxc+UHXdjcNetmdSdk0vlDEmTmdV8wtSNagAB2QYH9XV6ZBhCoWd/Bb3nUa2pbg8oJJCbeMSS1sSfrj5nX/QJAcKPO1YIhYOQx4UoB1Kh9vFApyOgGjBvEjDWBpghmTYTR3tng4= 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 1697644457697929.542214680701; Wed, 18 Oct 2023 08:54:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt8rp-0004vo-FH; Wed, 18 Oct 2023 11:53:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8ro-0004vO-BL for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt8rm-0006Mp-TB for qemu-devel@nongnu.org; Wed, 18 Oct 2023 11:53:52 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-184-1GULOs7vP-mcXnBW2rj2Eg-1; Wed, 18 Oct 2023 11:53:45 -0400 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-32db9cd71d7so1648395f8f.0 for ; Wed, 18 Oct 2023 08:53:44 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f2:2037:f34:d61b:7da0:a7be]) by smtp.gmail.com with ESMTPSA id e7-20020a05600c218700b00407efbc4361sm1995276wme.9.2023.10.18.08.53.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697644429; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=thscQjX5d6rsLU3psVlcnXGZdg35cG2DFqaiwAr/Wqo=; b=R4JhmTo0zSgL9+j/en6NCjQYAdLPKExfcBU4g34X53605SFIx6Oq7/VJ4rih/cVUq6NQN+ 9kfd6LamXNEVqPJ8UZB7kiV/h/FeCuUBe7tMmN31JHI1LZajRPxB2dKmX63bHlUFQN2czy DSFwUhY2MGWFT554Yj+Wz6Rs6TtMGPQ= X-MC-Unique: 1GULOs7vP-mcXnBW2rj2Eg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644423; x=1698249223; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=thscQjX5d6rsLU3psVlcnXGZdg35cG2DFqaiwAr/Wqo=; b=WOJiC/S2jb33VtgZH1hqlDEIjjIRdwNPPGmZNz1usfBymsBveCZO0kVh26z1I7Wo1B kPQVGNY7ZdJY5o5PglBozC75tmXez2r6FPOpEmZGO1W0LnwWIljCf5MVMXYQFgL/8Vxm lXkJVZxTiqQK54CuEYbDCmFlagDxlKF3t4e8E6vMVk9OXsQguv8BOPIrOGj48JeF0VzW ugJInCnxZlUX5xVO9pGjNbvcHCCFaec6xKwbfBs3yFbHeDIw6VsHSGWzJgMc6TEnqfTT 8afcGg51XJjLSmCp6cGi4cgOVtHCbxwUdfwXRj4v3NZUcuyY/bTvAOct6rLLZefmjYjk dNNw== X-Gm-Message-State: AOJu0YxVS+/wit+l2FCfCjmYYqkXLMVo0Etf19XsID9KE5kPyNv2AfbS XFXBilH2S5fIzMr8DQsvc/19ozuPtUF3q6BPTn2MoFVLO/yhQ0I3y5BbvayBzYxk4u86E6UlWd/ zyBzjyhrZVMn6Ee2fLxH72Lrw0nG83ur/Oz0Zs9aTvlMVVhiN4e/FWEKWQO7g6C/1JvQE4Bk= X-Received: by 2002:adf:a29c:0:b0:32d:a431:9045 with SMTP id s28-20020adfa29c000000b0032da4319045mr4707444wra.30.1697644422845; Wed, 18 Oct 2023 08:53:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEf2j6pizQYXlznqRKiP3MuRvUmFArvLb8S2+NTOyoOL4BxBb9053iTrLh17NG54xuimXNmaw== X-Received: by 2002:adf:a29c:0:b0:32d:a431:9045 with SMTP id s28-20020adfa29c000000b0032da4319045mr4707429wra.30.1697644422572; Wed, 18 Oct 2023 08:53:42 -0700 (PDT) Date: Wed, 18 Oct 2023 11:53:38 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hawkins Jiawei , Eugenio =?utf-8?B?UMOpcmV6?= Subject: [PULL 06/83] vhost: Expose vhost_svq_available_slots() Message-ID: <99d6a32469debf1a48921125879b614d15acfb7a.1697644299.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697644458958100005 From: Hawkins Jiawei Next patches in this series will delay the polling and checking of buffers until either the SVQ is full or control commands shadow buffers are full, no longer perform an immediate poll and check of the device's used buffers for each CVQ state load command. To achieve this, this patch exposes vhost_svq_available_slots(), allowing QEMU to know whether the SVQ is full. Signed-off-by: Hawkins Jiawei Acked-by: Eugenio P=C3=A9rez Message-Id: <25938079f0bd8185fd664c64e205e629f7a966be.1697165821.git.yin311= 49@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-shadow-virtqueue.h | 1 + hw/virtio/vhost-shadow-virtqueue.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.h b/hw/virtio/vhost-shadow-vi= rtqueue.h index 5bce67837b..19c842a15b 100644 --- a/hw/virtio/vhost-shadow-virtqueue.h +++ b/hw/virtio/vhost-shadow-virtqueue.h @@ -114,6 +114,7 @@ typedef struct VhostShadowVirtqueue { =20 bool vhost_svq_valid_features(uint64_t features, Error **errp); =20 +uint16_t vhost_svq_available_slots(const VhostShadowVirtqueue *svq); void vhost_svq_push_elem(VhostShadowVirtqueue *svq, const VirtQueueElement *elem, uint32_t len); int vhost_svq_add(VhostShadowVirtqueue *svq, const struct iovec *out_sg, diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-vi= rtqueue.c index e731b1d2ea..fc5f408f77 100644 --- a/hw/virtio/vhost-shadow-virtqueue.c +++ b/hw/virtio/vhost-shadow-virtqueue.c @@ -66,7 +66,7 @@ bool vhost_svq_valid_features(uint64_t features, Error **= errp) * * @svq: The svq */ -static uint16_t vhost_svq_available_slots(const VhostShadowVirtqueue *svq) +uint16_t vhost_svq_available_slots(const VhostShadowVirtqueue *svq) { return svq->num_free; } --=20 MST