From nobody Mon Feb 9 08:57:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150515116821924.43489979201138; Mon, 11 Sep 2017 10:32:48 -0700 (PDT) Received: from localhost ([::1]:59377 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drSZj-0001ay-Cp for importer@patchew.org; Mon, 11 Sep 2017 13:32:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drSOH-0007E2-V5 for qemu-devel@nongnu.org; Mon, 11 Sep 2017 13:20:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drSOG-0001Ae-JF for qemu-devel@nongnu.org; Mon, 11 Sep 2017 13:20:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39930) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1drSO9-00014O-KF; Mon, 11 Sep 2017 13:20:49 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 79B07C3F80; Mon, 11 Sep 2017 17:20:48 +0000 (UTC) Received: from red.redhat.com (ovpn-120-44.rdu2.redhat.com [10.10.120.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id E41A35D968; Mon, 11 Sep 2017 17:20:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 79B07C3F80 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=eblake@redhat.com From: Eric Blake To: qemu-devel@nongnu.org Date: Mon, 11 Sep 2017 12:19:54 -0500 Message-Id: <20170911172022.4738-11-eblake@redhat.com> In-Reply-To: <20170911172022.4738-1-eblake@redhat.com> References: <20170911172022.4738-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 11 Sep 2017 17:20:48 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v7 10/38] libqos: Move/rename qpci_unplug_acpi_device_test() to pci.c 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: thuth@redhat.com, "open list:virtio-blk" , Amit Shah , Jason Wang , armbru@redhat.com, Stefan Hajnoczi , pbonzini@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Commit 2f8b2767 originally added qpci_plug_device_test() and qpci_unplug_acpi_device_test() as a pair, both in pci-pc.c. Later, commit cf716b31 moved one half of the pair to pci.c when adding PPC64 support. Keep the implementations of the two functions together, and shorten the name to qpci_unplug_device_test(), since all callers use the two functions in tandem. Signed-off-by: Eric Blake --- tests/libqos/pci.h | 2 +- tests/e1000e-test.c | 2 +- tests/ivshmem-test.c | 2 +- tests/libqos/pci-pc.c | 23 ----------------------- tests/libqos/pci.c | 23 +++++++++++++++++++++++ tests/virtio-blk-test.c | 2 +- tests/virtio-net-test.c | 2 +- tests/virtio-rng-test.c | 2 +- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/tests/libqos/pci.h b/tests/libqos/pci.h index 429c382282..fdda7eca6e 100644 --- a/tests/libqos/pci.h +++ b/tests/libqos/pci.h @@ -111,5 +111,5 @@ QPCIBar qpci_legacy_iomap(QPCIDevice *dev, uint16_t add= r); void qpci_plug_device_test(const char *driver, const char *id, uint8_t slot, const char *opts); -void qpci_unplug_acpi_device_test(const char *id, uint8_t slot); +void qpci_unplug_device_test(const char *id, uint8_t slot); #endif diff --git a/tests/e1000e-test.c b/tests/e1000e-test.c index d8085d944e..4c663a3019 100644 --- a/tests/e1000e-test.c +++ b/tests/e1000e-test.c @@ -461,7 +461,7 @@ static void test_e1000e_hotplug(gconstpointer data) qtest_start("-device e1000e"); qpci_plug_device_test("e1000e", "e1000e_net", slot, NULL); - qpci_unplug_acpi_device_test("e1000e_net", slot); + qpci_unplug_device_test("e1000e_net", slot); qtest_end(); } diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c index 37763425ee..8c9ed6a568 100644 --- a/tests/ivshmem-test.c +++ b/tests/ivshmem-test.c @@ -427,7 +427,7 @@ static void test_ivshmem_hotplug(void) qpci_plug_device_test("ivshmem", "iv1", PCI_SLOT_HP, opts); if (strcmp(arch, "ppc64") !=3D 0) { - qpci_unplug_acpi_device_test("iv1", PCI_SLOT_HP); + qpci_unplug_device_test("iv1", PCI_SLOT_HP); } qtest_end(); diff --git a/tests/libqos/pci-pc.c b/tests/libqos/pci-pc.c index e267fd1a44..6305d142a5 100644 --- a/tests/libqos/pci-pc.c +++ b/tests/libqos/pci-pc.c @@ -19,9 +19,6 @@ #include "qemu-common.h" -#define ACPI_PCIHP_ADDR 0xae00 -#define PCI_EJ_BASE 0x0008 - typedef struct QPCIBusPC { QPCIBus bus; @@ -156,23 +153,3 @@ void qpci_free_pc(QPCIBus *bus) g_free(s); } - -void qpci_unplug_acpi_device_test(const char *id, uint8_t slot) -{ - QDict *response; - char *cmd; - - cmd =3D g_strdup_printf("{'execute': 'device_del'," - " 'arguments': {" - " 'id': '%s'" - "}}", id); - response =3D qmp(cmd); - g_free(cmd); - g_assert(response); - g_assert(!qdict_haskey(response, "error")); - QDECREF(response); - - outb(ACPI_PCIHP_ADDR + PCI_EJ_BASE, 1 << slot); - - qmp_eventwait("DEVICE_DELETED"); -} diff --git a/tests/libqos/pci.c b/tests/libqos/pci.c index 2dcdeade2a..9f36ec73ef 100644 --- a/tests/libqos/pci.c +++ b/tests/libqos/pci.c @@ -16,6 +16,9 @@ #include "hw/pci/pci_regs.h" #include "qemu/host-utils.h" +#define ACPI_PCIHP_ADDR 0xae00 +#define PCI_EJ_BASE 0x0008 + void qpci_device_foreach(QPCIBus *bus, int vendor_id, int device_id, void (*func)(QPCIDevice *dev, int devfn, void *da= ta), void *data) @@ -412,3 +415,23 @@ void qpci_plug_device_test(const char *driver, const c= har *id, g_assert(!qdict_haskey(response, "error")); QDECREF(response); } + +void qpci_unplug_device_test(const char *id, uint8_t slot) +{ + QDict *response; + char *cmd; + + cmd =3D g_strdup_printf("{'execute': 'device_del'," + " 'arguments': {" + " 'id': '%s'" + "}}", id); + response =3D qmp(cmd); + g_free(cmd); + g_assert(response); + g_assert(!qdict_haskey(response, "error")); + QDECREF(response); + + outb(ACPI_PCIHP_ADDR + PCI_EJ_BASE, 1 << slot); + + qmp_eventwait("DEVICE_DELETED"); +} diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c index ca4ee645b7..8441ab91ed 100644 --- a/tests/virtio-blk-test.c +++ b/tests/virtio-blk-test.c @@ -672,7 +672,7 @@ static void pci_hotplug(void) /* unplug secondary disk */ if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { - qpci_unplug_acpi_device_test("drv1", PCI_SLOT_HP); + qpci_unplug_device_test("drv1", PCI_SLOT_HP); } qtest_shutdown(qs); } diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c index 635b942c36..24e0f774f0 100644 --- a/tests/virtio-net-test.c +++ b/tests/virtio-net-test.c @@ -248,7 +248,7 @@ static void hotplug(void) qpci_plug_device_test("virtio-net-pci", "net1", PCI_SLOT_HP, NULL); if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { - qpci_unplug_acpi_device_test("net1", PCI_SLOT_HP); + qpci_unplug_device_test("net1", PCI_SLOT_HP); } test_end(); diff --git a/tests/virtio-rng-test.c b/tests/virtio-rng-test.c index dcecf77463..fc4a36474b 100644 --- a/tests/virtio-rng-test.c +++ b/tests/virtio-rng-test.c @@ -25,7 +25,7 @@ static void hotplug(void) qpci_plug_device_test("virtio-rng-pci", "rng1", PCI_SLOT_HP, NULL); if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { - qpci_unplug_acpi_device_test("rng1", PCI_SLOT_HP); + qpci_unplug_device_test("rng1", PCI_SLOT_HP); } } --=20 2.13.5