From nobody Mon Feb 9 20:35:23 2026 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; 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 1552930535143792.6305439530438; Mon, 18 Mar 2019 10:35:35 -0700 (PDT) Received: from localhost ([127.0.0.1]:44987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5wAc-00086Y-6g for importer@patchew.org; Mon, 18 Mar 2019 13:35:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5w4u-0004DZ-92 for qemu-devel@nongnu.org; Mon, 18 Mar 2019 13:29:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h5vrL-0003VD-Tf for qemu-devel@nongnu.org; Mon, 18 Mar 2019 13:15:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57172) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h5vrL-0003Ud-Dj for qemu-devel@nongnu.org; Mon, 18 Mar 2019 13:15:35 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AAD2E2C971E for ; Mon, 18 Mar 2019 17:15:34 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-67.ams2.redhat.com [10.36.112.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2A745D70E for ; Mon, 18 Mar 2019 17:15:33 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 18 Mar 2019 18:15:18 +0100 Message-Id: <20190318171521.8524-11-pbonzini@redhat.com> In-Reply-To: <20190318171521.8524-1-pbonzini@redhat.com> References: <20190318171521.8524-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 18 Mar 2019 17:15:34 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 10/13] libqos: add ARM imx25-pdk machine object 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This is used to test imx_i2c. Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 1 + tests/libqos/arm-imx25-pdk-machine.c | 92 ++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 tests/libqos/arm-imx25-pdk-machine.c diff --git a/tests/Makefile.include b/tests/Makefile.include index 53ac5c35c2..31f9852b8b 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -730,6 +730,7 @@ qos-test-obj-y +=3D tests/libqos/virtio-serial.o =20 # Machines qos-test-obj-y +=3D tests/libqos/aarch64-xlnx-zcu102-machine.o +qos-test-obj-y +=3D tests/libqos/arm-imx25-pdk-machine.o qos-test-obj-y +=3D tests/libqos/arm-n800-machine.o qos-test-obj-y +=3D tests/libqos/arm-raspi2-machine.o qos-test-obj-y +=3D tests/libqos/arm-sabrelite-machine.o diff --git a/tests/libqos/arm-imx25-pdk-machine.c b/tests/libqos/arm-imx25-= pdk-machine.c new file mode 100644 index 0000000000..25066fb8a9 --- /dev/null +++ b/tests/libqos/arm-imx25-pdk-machine.c @@ -0,0 +1,92 @@ +/* + * libqos driver framework + * + * Copyright (c) 2019 Red Hat, Inc. + * + * Author: Paolo Bonzini + * + * 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 "libqos/i2c.h" + +#define ARM_PAGE_SIZE 4096 +#define IMX25_PDK_RAM_START 0x80000000 +#define IMX25_PDK_RAM_END 0x88000000 + +typedef struct QIMX25PDKMachine QIMX25PDKMachine; + +struct QIMX25PDKMachine { + QOSGraphObject obj; + QGuestAllocator alloc; + IMXI2C i2c_1; +}; + +static void *imx25_pdk_get_driver(void *object, const char *interface) +{ + QIMX25PDKMachine *machine =3D object; + if (!g_strcmp0(interface, "memory")) { + return &machine->alloc; + } + + fprintf(stderr, "%s not present in arm/imx25_pdk\n", interface); + g_assert_not_reached(); +} + +static QOSGraphObject *imx25_pdk_get_device(void *obj, const char *device) +{ + QIMX25PDKMachine *machine =3D obj; + if (!g_strcmp0(device, "imx.i2c")) { + return &machine->i2c_1.obj; + } + + fprintf(stderr, "%s not present in arm/imx25_pdk\n", device); + g_assert_not_reached(); +} + +static void imx25_pdk_destructor(QOSGraphObject *obj) +{ + QIMX25PDKMachine *machine =3D (QIMX25PDKMachine *) obj; + alloc_destroy(&machine->alloc); +} + +static void *qos_create_machine_arm_imx25_pdk(QTestState *qts) +{ + QIMX25PDKMachine *machine =3D g_new0(QIMX25PDKMachine, 1); + + alloc_init(&machine->alloc, 0, + IMX25_PDK_RAM_START, + IMX25_PDK_RAM_END, + ARM_PAGE_SIZE); + machine->obj.get_device =3D imx25_pdk_get_device; + machine->obj.get_driver =3D imx25_pdk_get_driver; + machine->obj.destructor =3D imx25_pdk_destructor; + + imx_i2c_init(&machine->i2c_1, qts, 0x43f80000); + return &machine->obj; +} + +static void imx25_pdk_register_nodes(void) +{ + QOSGraphEdgeOptions edge =3D { + .extra_device_opts =3D "bus=3Di2c-bus.0" + }; + qos_node_create_machine("arm/imx25-pdk", qos_create_machine_arm_imx25_= pdk); + qos_node_contains("arm/imx25-pdk", "imx.i2c", &edge, NULL); +} + +libqos_init(imx25_pdk_register_nodes); --=20 2.20.1