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 1531127694073106.77266611004939; Mon, 9 Jul 2018 02:14:54 -0700 (PDT) Received: from localhost ([::1]:39993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcSFv-0006bn-5Y for importer@patchew.org; Mon, 09 Jul 2018 05:14:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcSE0-0005RD-Jt for qemu-devel@nongnu.org; Mon, 09 Jul 2018 05:12:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcSDz-0007Iv-8h for qemu-devel@nongnu.org; Mon, 09 Jul 2018 05:12:52 -0400 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]:44034) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fcSDz-0007IS-1n for qemu-devel@nongnu.org; Mon, 09 Jul 2018 05:12:51 -0400 Received: by mail-ed1-x543.google.com with SMTP id d17-v6so1280331eds.11 for ; Mon, 09 Jul 2018 02:12:51 -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.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jul 2018 02:12:49 -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=MN/6uPFsSUmJo97MLGcJ1wTzpriKuT3kmibyuLoIX+o=; b=L0t6x0JQ3BJ09lK3Fnre9o6viJqyBAAgncqS2SWE77/VUaox1e94XoZ9St56WZBJ6h KDbWcXEMsvGTwiJCpZPDQzvrG6Qw/gOg60buUYcxuBsdc6hnRHXk/6f+nW2H6FWNuahE Grp8fEFgklGbGz83OWBSkQE6VT/SxpDb0g3h48IHEjPUQGvtjkZ2GxNZBdmyL9RKylij skkzsK2kWdefhU7I2bsq2RCm4ZAnjDz81WkYyMHrEoL6NiaooKwbzxox+ME6jZzZREo0 Mvxmbo/xpSMj2OerReTl9Ap8fcDf4RY/jaFehZxHGqAN8Quq1+c7dm4bPnp6cT55ul38 GVKw== 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=MN/6uPFsSUmJo97MLGcJ1wTzpriKuT3kmibyuLoIX+o=; b=gGuydkmxizc2O6QB5qyzJ3C2c3uamErFSdFvHIM6N5u7Bzuxf/F4EHxUNFGkjjByQA Njce7EzQ9BOmfAzmNOcPDiF+ugt39UpnoM05k5nCY2nxZebWHIO0julYBZ9vJSsQkKNa 046S2NZoj2+2BRJUx1gSbsxYkHF5CKaKP/BhqUV9nKz/MbIBGMkZhHYOdbdg+l7jXUCb Ww6wWgOsTFYWjIoH+V+Td69j3OSPKMoixwbS2nxGmTsxBImfnjqz0heJphyPOUO/831m JHQhGp0+iuT4BQIK/wO/fyzpdcm0cd8ajkh7KxiNtKvO66f7POS0EOx/oxMNZbVPLy7G 2/Rg== X-Gm-Message-State: APt69E2vucgx9+GlTpiCNPbfXA7GNzWONGb+UVwklg+ZAj+Vg71KXUF3 iJc2g48vtzjB4q2EvWO60xo= X-Google-Smtp-Source: AAOMgpehTG+ZP4u8/CZhTP3lQnhv74wgCLmvGA7si8APY3LHYhpyrZ1AEsCeE+Gb2v+Lp2XRjY6V8g== X-Received: by 2002:a50:e40d:: with SMTP id d13-v6mr8834414edm.263.1531127570090; Mon, 09 Jul 2018 02:12:50 -0700 (PDT) From: Emanuele Giuseppe Esposito To: Paolo Bonzini Date: Mon, 9 Jul 2018 11:11:33 +0200 Message-Id: <20180709091136.28849-5-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 4/7] tests/qgraph: arm/raspi2 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 arm/raspi2 machine to the graph. This machine contains a generic-sdhci,= so its constructor must take care of setting it properly when called. Signed-off-by: Emanuele Giuseppe Esposito --- tests/Makefile.include | 3 +- tests/libqos/raspi2-machine.c | 68 +++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 tests/libqos/raspi2-machine.c diff --git a/tests/Makefile.include b/tests/Makefile.include index acbf704a8a..de75a7394e 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -770,7 +770,8 @@ libqos-usb-obj-y =3D $(libqos-spapr-obj-y) $(libqos-pc-= obj-y) tests/libqos/usb.o libqos-virtio-obj-y =3D $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/lib= qos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/lib= qos/malloc-generic.o =20 libqgraph-obj-y =3D tests/libqos/qgraph.o -libqgraph-pc-obj-y =3D $(libqos-pc-obj-y) tests/libqos/sdhci.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 =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/raspi2-machine.c b/tests/libqos/raspi2-machine.c new file mode 100644 index 0000000000..47f024076f --- /dev/null +++ b/tests/libqos/raspi2-machine.c @@ -0,0 +1,68 @@ +/* + * 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" + +typedef struct QRaspi2Machine QRaspi2Machine; + +struct QRaspi2Machine { + QOSGraphObject obj; + QSDHCI_MemoryMapped sdhci; +}; + +static void raspi2_destroy(QOSGraphObject *obj) +{ + g_free(obj); +} + +static QOSGraphObject *raspi2_get_device(void *obj, const char *device) +{ + QRaspi2Machine *machine =3D obj; + if (!g_strcmp0(device, "generic-sdhci")) { + return &machine->sdhci.obj; + } + + printf("%s not present in arm/raspi2", device); + abort(); +} + +static void *qos_create_machine_arm_raspi2(void) +{ + QRaspi2Machine *machine =3D g_new0(QRaspi2Machine, 1); + + machine->obj.get_device =3D raspi2_get_device; + machine->obj.destructor =3D raspi2_destroy; + qos_create_sdhci_mm(&machine->sdhci, 0x3f300000, &(QSDHCIProperties) { + .version =3D 3, + .baseclock =3D 52, + .capab.sdma =3D false, + .capab.reg =3D 0x052134b4 + }); + return &machine->obj; +} + +static void raspi2(void) +{ + qos_node_create_machine("arm/raspi2", qos_create_machine_arm_raspi2); + qos_node_contains("arm/raspi2", "generic-sdhci"); +} + +libqos_init(raspi2); --=20 2.17.1