From nobody Sun Nov 9 22:26:47 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15519807887021000.099622345715; Thu, 7 Mar 2019 09:46:28 -0800 (PST) Received: from localhost ([127.0.0.1]:56309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1x69-0007F5-LN for importer@patchew.org; Thu, 07 Mar 2019 12:46:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1wqb-0002x2-0a for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1wqZ-0007wd-Se for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:20 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:50667) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1wqZ-0007vb-Ew for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:19 -0500 Received: by mail-wm1-x329.google.com with SMTP id x7so10090906wmj.0 for ; Thu, 07 Mar 2019 09:30:19 -0800 (PST) Received: from 640k.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id d206sm9979753wmc.11.2019.03.07.09.30.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 09:30:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=3f55o9UjAoS/ed/61y7wMoloYdAQSCRtYGIZYtfr5nU=; b=ogyrj+FB1NhUGZDySZrWvZxwqHxjLtMUFqG3W1KtvEQ8Y7n2I/ZK4HAsViu/08PvkH ojIjso+EpAJ2pVbgYURVhIgiFB03IvXRX4g0M4scKiy0BH8XumES7Vh5TPUu6KAa9Jkq 35AK9OcIgN1KikAvVFxCZfv3Kjw2Yg6LcIAPicj59xGwxGF+4iyKMub5iRefc2Fgunew +d40rLgibA0kI/D70RkA0lkjzKrhc2GQ3IVig9s/xuhhfc75bgK4BicvaqJcxXN+vZ7G BmqWc3IaVjWUTddCmUGljk+pIxqXb+VSQ/9AcGOc5X0w2p52/pgMX3KLUh4aZqhF4h+5 CCUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=3f55o9UjAoS/ed/61y7wMoloYdAQSCRtYGIZYtfr5nU=; b=ha7uvfoSwz+EQ0oM2RLj53hi7f/duvP8JZ3vrOq5giLIGXT+FzEj2RKSXmhS+UHoBF he6parBVqxaPLUfW5LOI1JmwoDvugK8YqwEE00B8WyGeQg2uoo3OW9jZSfN2fgcjIoJk M5x/vC8sXytCwU381CP+f1kV7JdVBUfX4mNBPbY9uE1SZDu8OxV78jquinm4ekfbX0I9 icHS5Sgx/E3rd/LcQHAfQ1nhuNFwF1LtJA+NiNlsBB0WuHIwYeWmeur3nsHnjFh/5LH7 M3Sx4MIyEa5z2qIKD6bu5IeeCdSTo7/KM3X0gnowcfvROQ0TVsQ/8F5xXmfHoU1R6cFs 3q0A== X-Gm-Message-State: APjAAAVWTkzqee3R0PtDZVpmViaV4Wh4DTteBfcZkmgINyfYQ6rq7pO1 nT8lwRZ3+y45W9VEhJwS0HMX6H8d X-Google-Smtp-Source: APXvYqw2gMEnxjH3L8v3n7r1DX0Qc4HO9Ob2uFvl74C9t6gH3j0mWpuqM6xFJEA6BWeg2Z0CYjd4hA== X-Received: by 2002:a7b:c74b:: with SMTP id w11mr6284503wmk.79.1551979817888; Thu, 07 Mar 2019 09:30:17 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 7 Mar 2019 18:29:18 +0100 Message-Id: <1551979804-6060-12-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551979804-6060-1-git-send-email-pbonzini@redhat.com> References: <1551979804-6060-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::329 Subject: [Qemu-devel] [PULL 11/57] tests/libqos: arm/sabrelite 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: thuth@redhat.com, Emanuele Giuseppe Esposito , lviver@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Emanuele Giuseppe Esposito Add arm/sabrelite machine to the graph. This machine contains generic-sdhci= , so its constructor must take care of setting it properly when called. Signed-off-by: Emanuele Giuseppe Esposito Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 1 + tests/libqos/arm-sabrelite-machine.c | 91 ++++++++++++++++++++++++++++++++= ++++ 2 files changed, 92 insertions(+) create mode 100644 tests/libqos/arm-sabrelite-machine.c diff --git a/tests/Makefile.include b/tests/Makefile.include index 959d026..4758352 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -756,6 +756,7 @@ qos-test-obj-y +=3D tests/libqos/sdhci.o =20 # Machines qos-test-obj-y +=3D tests/libqos/arm-raspi2-machine.o +qos-test-obj-y +=3D tests/libqos/arm-sabrelite-machine.o qos-test-obj-y +=3D tests/libqos/arm-smdkc210-machine.o qos-test-obj-y +=3D tests/libqos/x86_64_pc-machine.o =20 diff --git a/tests/libqos/arm-sabrelite-machine.c b/tests/libqos/arm-sabrel= ite-machine.c new file mode 100644 index 0000000..c4128d8 --- /dev/null +++ b/tests/libqos/arm-sabrelite-machine.c @@ -0,0 +1,91 @@ +/* + * 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 "libqos/malloc.h" +#include "libqos/qgraph.h" +#include "sdhci.h" + +#define ARM_PAGE_SIZE 4096 +#define SABRELITE_RAM_START 0x10000000 +#define SABRELITE_RAM_END 0x30000000 + +typedef struct QSabreliteMachine QSabreliteMachine; + +struct QSabreliteMachine { + QOSGraphObject obj; + QGuestAllocator alloc; + QSDHCI_MemoryMapped sdhci; +}; + +static void *sabrelite_get_driver(void *object, const char *interface) +{ + QSabreliteMachine *machine =3D object; + if (!g_strcmp0(interface, "memory")) { + return &machine->alloc; + } + + fprintf(stderr, "%s not present in arm/sabrelite\n", interface); + g_assert_not_reached(); +} + +static QOSGraphObject *sabrelite_get_device(void *obj, const char *device) +{ + QSabreliteMachine *machine =3D obj; + if (!g_strcmp0(device, "generic-sdhci")) { + return &machine->sdhci.obj; + } + + fprintf(stderr, "%s not present in arm/sabrelite\n", device); + g_assert_not_reached(); +} + +static void sabrelite_destructor(QOSGraphObject *obj) +{ + QSabreliteMachine *machine =3D (QSabreliteMachine *) obj; + alloc_destroy(&machine->alloc); +} + +static void *qos_create_machine_arm_sabrelite(QTestState *qts) +{ + QSabreliteMachine *machine =3D g_new0(QSabreliteMachine, 1); + + alloc_init(&machine->alloc, 0, + SABRELITE_RAM_START, + SABRELITE_RAM_END, + ARM_PAGE_SIZE); + machine->obj.get_device =3D sabrelite_get_device; + machine->obj.get_driver =3D sabrelite_get_driver; + machine->obj.destructor =3D sabrelite_destructor; + qos_init_sdhci_mm(&machine->sdhci, qts, 0x02190000, &(QSDHCIProperties= ) { + .version =3D 3, + .baseclock =3D 0, + .capab.sdma =3D true, + .capab.reg =3D 0x057834b4, + }); + return &machine->obj; +} + +static void sabrelite_register_nodes(void) +{ + qos_node_create_machine("arm/sabrelite", qos_create_machine_arm_sabrel= ite); + qos_node_contains("arm/sabrelite", "generic-sdhci", NULL); +} + +libqos_init(sabrelite_register_nodes); --=20 1.8.3.1