From nobody Tue Nov 4 22:01:31 2025 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; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531127872624584.1238045733458; Mon, 9 Jul 2018 02:17:52 -0700 (PDT) Received: from localhost ([::1]:40011 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcSIo-0000iW-1k for importer@patchew.org; Mon, 09 Jul 2018 05:17:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcSE1-0005RT-Jz for qemu-devel@nongnu.org; Mon, 09 Jul 2018 05:12:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcSE0-0007Jl-Cb for qemu-devel@nongnu.org; Mon, 09 Jul 2018 05:12:53 -0400 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]:38463) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fcSE0-0007J6-5W for qemu-devel@nongnu.org; Mon, 09 Jul 2018 05:12:52 -0400 Received: by mail-ed1-x543.google.com with SMTP id a5-v6so13346736edt.5 for ; Mon, 09 Jul 2018 02:12:52 -0700 (PDT) Received: from localhost.localdomain ([194.230.159.64]) by smtp.gmail.com with ESMTPSA id c6-v6sm6865091edt.41.2018.07.09.02.12.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jul 2018 02:12:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PRrLBb//RNiIQ5HAMG0VPE7b5IppsBjHnGBSCmwZono=; b=nrPtD9xR6ki9DxjUT2fH9sPeVf11cWqZttd7lUstG98ONLuGQ4NYHHoPACfsVgnK36 ZnzAOQ2nQq0Eic0AG3LqEJey+68ZJ4yvKNWwsPSvaKlhiJ920C67Xww1huYBR/oFM7Yg nequfZA9W/N83EbB1L2dlYSNteopmxkhfbihQ0pL64XpXmFGA7ZF51JyRFKOV+l/j5PN 6z03g88amIho8wq0x+5qm53sODW4SIJ0pu8agOuY8vuEsBWgpxHElGOAlhkoQEzLO4Ad UpPa0ZNG2j+WsHWn1UJaFi79rvMjyycsQEae0HJpU+jK40D8Y3RfZyDv81+MWfmjDRh7 eYiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PRrLBb//RNiIQ5HAMG0VPE7b5IppsBjHnGBSCmwZono=; b=iobF7NxWtj1EdeDYZmletacYl8g0LU9jhH1ujBeO1MJSq2QaY78g7+ufMBbi/sWTeV nWtytJ4Bod5hixlBjSGvP0PFFuBTg+oKiVZk+ufdoQMPt4tmfoX5HLK4Eg55Q/IW4olR En6aDN849Qfu4klElsmgsdzH0N+VdJs1D714q79qW1vrP05NMoLblkbXV1fDFVWUGEw9 3i0pE9YpBItsAiA2GBplRRZgXODVWexnLN9DnG2e/zCNamRgf9MwuCSLp3/CJ8tNB/na +WarEz24I+p/BYNyU8iuFNHOY4BnR98hvkeKINr9KHXtvk80F+u37EGXCkeN+pKAtvbz FzHw== X-Gm-Message-State: APt69E1VHshHTJOuBKCV6w878mwotPWg0ec5qy2OQ+NKDpMV/4ophiLm N/Dljkf+hl671GGxzr8g7pw= X-Google-Smtp-Source: AAOMgpfFuGFPWwgtoe2s5cw1fOIGOVSNYqEkwlVicc+4cWdXz5Yr7TlVIDbhNyhgnI/AtdIYxQ6ZXg== X-Received: by 2002:a50:a804:: with SMTP id j4-v6mr22466996edc.61.1531127571201; Mon, 09 Jul 2018 02:12:51 -0700 (PDT) From: Emanuele Giuseppe Esposito To: Paolo Bonzini Date: Mon, 9 Jul 2018 11:11:34 +0200 Message-Id: <20180709091136.28849-6-e.emanuelegiuseppe@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709091136.28849-1-e.emanuelegiuseppe@gmail.com> References: <20180709091136.28849-1-e.emanuelegiuseppe@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::543 Subject: [Qemu-devel] [PATCH 5/7] tests/qgraph: x86_64/pc machine node 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: Laurent Vivier , Emanuele Giuseppe Esposito , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add pc machine for the x86_64 QEMU binary. This machine contains an i440FX-= pcihost driver, that contains itself a pci-bus-pc that produces the pci-bus interfa= ce. Signed-off-by: Emanuele Giuseppe Esposito --- tests/Makefile.include | 2 +- tests/libqos/x86_64_pc-machine.c | 93 ++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 tests/libqos/x86_64_pc-machine.c diff --git a/tests/Makefile.include b/tests/Makefile.include index de75a7394e..706ac39ea5 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -771,7 +771,7 @@ libqos-virtio-obj-y =3D $(libqos-spapr-obj-y) $(libqos-= pc-obj-y) tests/libqos/virt =20 libqgraph-obj-y =3D tests/libqos/qgraph.o libqgraph-pc-obj-y =3D $(libqos-pc-obj-y) $(libqgraph-obj-y) tests/libqos/= sdhci.o -libqgraph-pc-obj-y +=3D tests/libqos/raspi2-machine.o +libqgraph-pc-obj-y +=3D tests/libqos/raspi2-machine.o tests/libqos/x86_64_= pc-machine.o =20 check-unit-y +=3D tests/test-qgraph$(EXESUF) tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y) diff --git a/tests/libqos/x86_64_pc-machine.c b/tests/libqos/x86_64_pc-mach= ine.c new file mode 100644 index 0000000000..626e8d7d70 --- /dev/null +++ b/tests/libqos/x86_64_pc-machine.c @@ -0,0 +1,93 @@ +/* + * libqos driver framework + * + * Copyright (c) 2018 Emanuele Giuseppe Esposito + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see + */ + +#include "qemu/osdep.h" +#include "libqtest.h" +#include "qgraph.h" +#include "sdhci.h" +#include "pci-pc.h" + +typedef struct QX86_64_PCMachine QX86_64_PCMachine; +typedef struct i440FX_pcihost i440FX_pcihost; +typedef struct QSDHCI_PCI QSDHCI_PCI; + +struct i440FX_pcihost { + QOSGraphObject obj; + QPCIBusPC pci; +}; + +struct QX86_64_PCMachine { + QOSGraphObject obj; + i440FX_pcihost bridge; +}; + +/* i440FX_pcihost */ + +static QOSGraphObject *i440FX_host_get_device(void *obj, const char *devic= e) +{ + i440FX_pcihost *host =3D obj; + if (!g_strcmp0(device, "pci-bus-pc")) { + return &host->pci.obj; + } + printf("%s not present in i440FX-pcihost", device); + abort(); +} + +static void qos_create_i440FX_host(i440FX_pcihost *host) +{ + host->obj.get_device =3D i440FX_host_get_device; + qpci_set_pc(&host->pci, global_qtest, NULL); +} + +/* x86_64/pc machine */ + +static void pc_destroy(QOSGraphObject *obj) +{ + g_free(obj); +} + +static QOSGraphObject *pc_get_device(void *obj, const char *device) +{ + QX86_64_PCMachine *machine =3D obj; + if (!g_strcmp0(device, "i440FX-pcihost")) { + return &machine->bridge.obj; + } + + printf("%s not present in x86_64/pc", device); + abort(); +} + +static void *qos_create_machine_pc(void) +{ + QX86_64_PCMachine *machine =3D g_new0(QX86_64_PCMachine, 1); + machine->obj.get_device =3D pc_get_device; + machine->obj.destructor =3D pc_destroy; + qos_create_i440FX_host(&machine->bridge); + + return &machine->obj; +} + +static void pc_machine(void) +{ + qos_node_create_machine("x86_64/pc", qos_create_machine_pc); + qos_node_create_driver("i440FX-pcihost", NULL); + qos_node_contains("x86_64/pc", "i440FX-pcihost"); + qos_node_contains("i440FX-pcihost", "pci-bus-pc"); +} + +libqos_init(pc_machine); --=20 2.17.1