From patchwork Mon May 9 12:08:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 9045751 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 3ED2C9F1D3 for ; Mon, 9 May 2016 12:10:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 81C4E2011E for ; Mon, 9 May 2016 12:10:43 +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 99308200E6 for ; Mon, 9 May 2016 12:10:42 +0000 (UTC) Received: from localhost ([::1]:40850 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azk1J-00070o-QY for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 May 2016 08:10:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azjzb-0003KX-AU for qemu-devel@nongnu.org; Mon, 09 May 2016 08:08:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azjzZ-0004ei-TX for qemu-devel@nongnu.org; Mon, 09 May 2016 08:08:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49129) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azjzZ-0004ed-LS for qemu-devel@nongnu.org; Mon, 09 May 2016 08:08:53 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5CD0E804E1; Mon, 9 May 2016 12:08:53 +0000 (UTC) Received: from localhost (ovpn-112-46.ams2.redhat.com [10.36.112.46]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u49C8pDu003585; Mon, 9 May 2016 08:08:52 -0400 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Date: Mon, 9 May 2016 13:08:02 +0100 Message-Id: <1462795687-25698-19-git-send-email-stefanha@redhat.com> In-Reply-To: <1462795687-25698-1-git-send-email-stefanha@redhat.com> References: <1462795687-25698-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 09 May 2016 12:08:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 18/23] libqos: drop duplicated virtio_config.h definitions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marc.mari.barcelo@gmail.com, Paolo Bonzini , jsnow@redhat.com, Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable 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 Note that VIRTIO_F_ANY_LAYOUT and VIRTIO_F_NOTIFY_ON_EMPTY are bit numbers in virtio_config.h but bit masks in qtest virtio.h. Therefore it's necessary to change users from X to (1u << X). Signed-off-by: Stefan Hajnoczi --- tests/libqos/virtio.c | 19 ++++++++++--------- tests/libqos/virtio.h | 9 --------- tests/virtio-blk-test.c | 6 ++++-- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c index 613dece..ee9e892 100644 --- a/tests/libqos/virtio.c +++ b/tests/libqos/virtio.c @@ -11,6 +11,7 @@ #include #include "libqtest.h" #include "libqos/virtio.h" +#include "standard-headers/linux/virtio_config.h" uint8_t qvirtio_config_readb(const QVirtioBus *bus, QVirtioDevice *d, uint64_t addr) @@ -55,28 +56,28 @@ QVirtQueue *qvirtqueue_setup(const QVirtioBus *bus, QVirtioDevice *d, void qvirtio_reset(const QVirtioBus *bus, QVirtioDevice *d) { - bus->set_status(d, QVIRTIO_RESET); - g_assert_cmphex(bus->get_status(d), ==, QVIRTIO_RESET); + bus->set_status(d, 0); + g_assert_cmphex(bus->get_status(d), ==, 0); } void qvirtio_set_acknowledge(const QVirtioBus *bus, QVirtioDevice *d) { - bus->set_status(d, bus->get_status(d) | QVIRTIO_ACKNOWLEDGE); - g_assert_cmphex(bus->get_status(d), ==, QVIRTIO_ACKNOWLEDGE); + bus->set_status(d, bus->get_status(d) | VIRTIO_CONFIG_S_ACKNOWLEDGE); + g_assert_cmphex(bus->get_status(d), ==, VIRTIO_CONFIG_S_ACKNOWLEDGE); } void qvirtio_set_driver(const QVirtioBus *bus, QVirtioDevice *d) { - bus->set_status(d, bus->get_status(d) | QVIRTIO_DRIVER); + bus->set_status(d, bus->get_status(d) | VIRTIO_CONFIG_S_DRIVER); g_assert_cmphex(bus->get_status(d), ==, - QVIRTIO_DRIVER | QVIRTIO_ACKNOWLEDGE); + VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_ACKNOWLEDGE); } void qvirtio_set_driver_ok(const QVirtioBus *bus, QVirtioDevice *d) { - bus->set_status(d, bus->get_status(d) | QVIRTIO_DRIVER_OK); - g_assert_cmphex(bus->get_status(d), ==, - QVIRTIO_DRIVER_OK | QVIRTIO_DRIVER | QVIRTIO_ACKNOWLEDGE); + bus->set_status(d, bus->get_status(d) | VIRTIO_CONFIG_S_DRIVER_OK); + g_assert_cmphex(bus->get_status(d), ==, VIRTIO_CONFIG_S_DRIVER_OK | + VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_ACKNOWLEDGE); } void qvirtio_wait_queue_isr(const QVirtioBus *bus, QVirtioDevice *d, diff --git a/tests/libqos/virtio.h b/tests/libqos/virtio.h index e663bcf..993ae0e 100644 --- a/tests/libqos/virtio.h +++ b/tests/libqos/virtio.h @@ -12,13 +12,6 @@ #include "libqos/malloc.h" -#define QVIRTIO_RESET 0x0 -#define QVIRTIO_ACKNOWLEDGE 0x1 -#define QVIRTIO_DRIVER 0x2 -#define QVIRTIO_DRIVER_OK 0x4 - -#define QVIRTIO_F_NOTIFY_ON_EMPTY 0x01000000 -#define QVIRTIO_F_ANY_LAYOUT 0x08000000 #define QVIRTIO_F_RING_INDIRECT_DESC 0x10000000 #define QVIRTIO_F_RING_EVENT_IDX 0x20000000 #define QVIRTIO_F_BAD_FEATURE 0x40000000 @@ -27,8 +20,6 @@ #define QVRING_DESC_F_WRITE 0x2 #define QVRING_DESC_F_INDIRECT 0x4 -#define QVIRTIO_F_NOTIFY_ON_EMPTY 0x01000000 -#define QVIRTIO_F_ANY_LAYOUT 0x08000000 #define QVIRTIO_F_RING_INDIRECT_DESC 0x10000000 #define QVIRTIO_F_RING_EVENT_IDX 0x20000000 #define QVIRTIO_F_BAD_FEATURE 0x40000000 diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c index 02107a6..adc6862 100644 --- a/tests/virtio-blk-test.c +++ b/tests/virtio-blk-test.c @@ -20,6 +20,7 @@ #include "libqos/malloc-generic.h" #include "qemu/bswap.h" #include "standard-headers/linux/virtio_ids.h" +#include "standard-headers/linux/virtio_config.h" #define QVIRTIO_BLK_F_BARRIER 0x00000001 #define QVIRTIO_BLK_F_SIZE_MAX 0x00000002 @@ -240,7 +241,7 @@ static void test_basic(const QVirtioBus *bus, QVirtioDevice *dev, guest_free(alloc, req_addr); - if (features & QVIRTIO_F_ANY_LAYOUT) { + if (features & (1u << VIRTIO_F_ANY_LAYOUT)) { /* Write and read with 2 descriptor layout */ /* Write request */ req.type = QVIRTIO_BLK_T_OUT; @@ -607,7 +608,8 @@ static void pci_idx(void) features = qvirtio_get_features(&qvirtio_pci, &dev->vdev); features = features & ~(QVIRTIO_F_BAD_FEATURE | QVIRTIO_F_RING_INDIRECT_DESC | - QVIRTIO_F_NOTIFY_ON_EMPTY | QVIRTIO_BLK_F_SCSI); + (1u << VIRTIO_F_NOTIFY_ON_EMPTY) | + QVIRTIO_BLK_F_SCSI); qvirtio_set_features(&qvirtio_pci, &dev->vdev, features); vqpci = (QVirtQueuePCI *)qvirtqueue_setup(&qvirtio_pci, &dev->vdev,