From patchwork Sun Feb 14 17:17:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8302441 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EDF5B9F399 for ; Sun, 14 Feb 2016 17:20:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 30C562039E for ; Sun, 14 Feb 2016 17:20:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8AE802024D for ; Sun, 14 Feb 2016 17:20:48 +0000 (UTC) Received: from localhost ([::1]:52223 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aV0Ln-0003cm-CX for patchwork-qemu-devel@patchwork.kernel.org; Sun, 14 Feb 2016 12:20:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aV0IY-0006pM-3W for qemu-devel@nongnu.org; Sun, 14 Feb 2016 12:17:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aV0IX-00034v-7z for qemu-devel@nongnu.org; Sun, 14 Feb 2016 12:17:26 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:33689) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aV0IX-00034r-12 for qemu-devel@nongnu.org; Sun, 14 Feb 2016 12:17:25 -0500 Received: by mail-wm0-x243.google.com with SMTP id c200so11963161wme.0 for ; Sun, 14 Feb 2016 09:17:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=siJGFKuiNSlQzjI75q9DHsw8DX4JdhlFHGY/+mZtFFE=; b=PS5MHauClpr62DCCTwku+IHbmKz/BFjd/twLmKImGFqwSn1Weqi2zzO75fyHPeVRzl kvqIvH+NMk7hwO4Iz0WUAWvCjctdGGjRld2v2CUFR12W4rKmpbT77lX9kdfk7Go6kVHF WRc5reGs/GRBJfJS4Qp2XfVvoQjB1a6Shu/uciZJ+xb11xYttBhY0ixG2D1GSOxp4p/i y7vmIBIwtOg7BCmofu8nv7DdGKFO06jDPQBdbSZ9QwaZbUQ58Tj5SXC0e3AOrmZ6cwYO I8eeD5zIQFEtF2QLlaLnTn5B57+MjdjPJUROz5txvZ5hVRuewoycu0VMPxn8IOpfYAVa U75Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=siJGFKuiNSlQzjI75q9DHsw8DX4JdhlFHGY/+mZtFFE=; b=jAMtNKQ+l69MAOCiWwZYSYsfL+vgVIFGMcO4ZEw33aZvU/A7xu6NMgBkGU/E1cr+5o b3Uy8SuY/1RQPhJb4O3e131KhOVmJTxZ3e/0zGHlVDLrcm1BO7A52Ll1xBd3YdQ2lUzk jUFQKNyAZ9jcOK6Kfyr43oODhTZWrJ+9t8nELXzhz9cB0OY0UK6KVITSqwhb7lxhlXLW ORF/EDYqlZlLLkQvsb1BKNGAYR+Azw1UpmQnx5Hk/30wTZrmvd+E86gk40Aa36Da+3jF 5VmdqQAtwGyX8gzT/vpjEzdWYwjidYcbYNOgkRNVNmmHY2grSWiKdL+9EXKt8fozSjZV Xcew== X-Gm-Message-State: AG10YOTY8ye4bZD9/jpIKcwAwyNWiKRmUrVVANQT56hvM2qgaxkFi8mtunxtzRPXJfJ5ow== X-Received: by 10.194.87.161 with SMTP id az1mr11954966wjb.163.1455470244534; Sun, 14 Feb 2016 09:17:24 -0800 (PST) Received: from donizetti.lan (94-39-152-251.adsl-ull.clienti.tiscali.it. [94.39.152.251]) by smtp.gmail.com with ESMTPSA id ko2sm21426149wjc.9.2016.02.14.09.17.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Feb 2016 09:17:23 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Sun, 14 Feb 2016 18:17:07 +0100 Message-Id: <1455470231-5223-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1455470231-5223-1-git-send-email-pbonzini@redhat.com> References: <1455470231-5223-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 Cc: stefanha@redhat.com, mst@redhat.com Subject: [Qemu-devel] [PATCH 4/8] virtio: export vring_notify as virtio_should_notify X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Virtio dataplane needs to trigger the irq manually through the guest notifier. Export virtio_should_notify so that it can be used around event_notifier_set. Signed-off-by: Paolo Bonzini Acked-by: Cornelia Huck Reviewed-by: Fam Zheng --- hw/virtio/virtio.c | 4 ++-- include/hw/virtio/virtio.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 3a5cca4..abb97f4 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1162,7 +1162,7 @@ void virtio_irq(VirtQueue *vq) virtio_notify_vector(vq->vdev, vq->vector); } -static bool vring_notify(VirtIODevice *vdev, VirtQueue *vq) +bool virtio_should_notify(VirtIODevice *vdev, VirtQueue *vq) { uint16_t old, new; bool v; @@ -1187,7 +1187,7 @@ static bool vring_notify(VirtIODevice *vdev, VirtQueue *vq) void virtio_notify(VirtIODevice *vdev, VirtQueue *vq) { - if (!vring_notify(vdev, vq)) { + if (!virtio_should_notify(vdev, vq)) { return; } diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 4ce01a1..5884228 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -162,6 +162,7 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes, unsigned int *out_bytes, unsigned max_in_bytes, unsigned max_out_bytes); +bool virtio_should_notify(VirtIODevice *vdev, VirtQueue *vq); void virtio_notify(VirtIODevice *vdev, VirtQueue *vq); void virtio_save(VirtIODevice *vdev, QEMUFile *f);