From nobody Sun Nov 9 22:39:44 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 155198126984583.16857345008373; Thu, 7 Mar 2019 09:54:29 -0800 (PST) Received: from localhost ([127.0.0.1]:56405 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1xDr-0005Rk-NB for importer@patchew.org; Thu, 07 Mar 2019 12:54:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1wqc-0002yD-1L for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1wqa-0007xJ-P0 for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:22 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:39009) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1wqa-0007wi-Gk for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:20 -0500 Received: by mail-wm1-x335.google.com with SMTP id z84so10074253wmg.4 for ; Thu, 07 Mar 2019 09:30:20 -0800 (PST) Received: from 640k.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id d206sm9979753wmc.11.2019.03.07.09.30.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 09:30:18 -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=Qsg9qPMrbGORnhwvhcDNuGbu0oB8D6wNji1DeUCKqWY=; b=oSb4uBxzInHV6qMGLI9w+SUdzXBL4PPFo668OtMs4Zm4VzJRcSi4YhYac5NmewIIHa JhUD19DkfTVkC78H477YKHEi68jiJ66T7CII/vimueRIdAJFQxg8MpTZJKCc40nvAQoq 6q0fFniXfupajnL487wJhTkkDTwkhXom4WrgdShJl7kmB7/DK9PYM8ywbMwmmWTpaMTC ZsTykyJrDeDl+uSTb0bWQsSBKfjHTsao/fiuvceVKaKRj8MWaos5DWqfM4AfJaeZfQhg K0KmpjklARmKiHKoMAFZG/3PrkID1s0HUINQGoz1Zhy2sAjZXGTivHQTDxWstIA6zMOc 5jNQ== 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=Qsg9qPMrbGORnhwvhcDNuGbu0oB8D6wNji1DeUCKqWY=; b=BAvKpKb/3H/qbY/d1aW9K7LmItQoeVSzxJ4pXLPfE0Y502we9b9rc7ge79uazWthhc n3tPJL6aiJuJxFuA4fdFq0TnKfa1xmoug1WjHvqvnOiCYOcnLCstAZ9ERDGgC9vEFrmo LrGuwyMnaVFb/FsUHyq5uMBC+W50MbfFNxeQR0UdgjH0/CrY0ndywuXC0Ih1AV5ql24o B2Ibu9BI7LtTOyOFrzezAGxjXtxSSPbH5LL+zcr+EHmnK6hZ01Nz8viTOoJraJjGJqgI YoubmJ3PmrUYc6FFvWLuEZGqCyE431klrn2Onl/uB3992SSrRtkW0e5nSK+/9QaMdpIU B1Zw== X-Gm-Message-State: APjAAAU7DALZy21nqH/WLg+cisoD6bhr4ecwSapdqNHF4s32SJyGWvVf ZJvCbW3SchlU8c1MXQiWryPeq3+w X-Google-Smtp-Source: APXvYqx9PDyq2on7zISqH0o1FdsGyY4qegTL5GqnKvSwsybPRSDGPY+c3QH5dEZ5uLw4q608e9g6Yw== X-Received: by 2002:a1c:2543:: with SMTP id l64mr6676864wml.116.1551979819184; Thu, 07 Mar 2019 09:30:19 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 7 Mar 2019 18:29:19 +0100 Message-Id: <1551979804-6060-13-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::335 Subject: [Qemu-devel] [PULL 12/57] tests/libqos: arm/xilinx-zynq-a9 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 xilinx-zynq-a9 machine to the graph. This machine contains generic-sdhc= i, 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-xilinx-zynq-a9-machine.c | 94 +++++++++++++++++++++++++++= ++++ 2 files changed, 95 insertions(+) create mode 100644 tests/libqos/arm-xilinx-zynq-a9-machine.c diff --git a/tests/Makefile.include b/tests/Makefile.include index 4758352..c7800d5 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -758,6 +758,7 @@ qos-test-obj-y +=3D tests/libqos/sdhci.o 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/arm-xilinx-zynq-a9-machine.o qos-test-obj-y +=3D tests/libqos/x86_64_pc-machine.o =20 check-unit-y +=3D tests/test-qgraph$(EXESUF) diff --git a/tests/libqos/arm-xilinx-zynq-a9-machine.c b/tests/libqos/arm-x= ilinx-zynq-a9-machine.c new file mode 100644 index 0000000..4e199fc --- /dev/null +++ b/tests/libqos/arm-xilinx-zynq-a9-machine.c @@ -0,0 +1,94 @@ +/* + * 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" + +typedef struct QXilinxZynqA9Machine QXilinxZynqA9Machine; + +struct QXilinxZynqA9Machine { + QOSGraphObject obj; + QGuestAllocator alloc; + QSDHCI_MemoryMapped sdhci; +}; + +#define ARM_PAGE_SIZE 4096 +#define XILINX_ZYNQ_A9_RAM_ADDR 0 +#define XILINX_ZYNQ_A9_RAM_SIZE 0x20000000 + +static void *xilinx_zynq_a9_get_driver(void *object, const char *interface) +{ + QXilinxZynqA9Machine *machine =3D object; + if (!g_strcmp0(interface, "memory")) { + return &machine->alloc; + } + + fprintf(stderr, "%s not present in arm/xilinx-zynq-a9\n", interface); + g_assert_not_reached(); +} + +static QOSGraphObject *xilinx_zynq_a9_get_device(void *obj, const char *de= vice) +{ + QXilinxZynqA9Machine *machine =3D obj; + if (!g_strcmp0(device, "generic-sdhci")) { + return &machine->sdhci.obj; + } + + fprintf(stderr, "%s not present in arm/xilinx-zynq-a9\n", device); + g_assert_not_reached(); +} + +static void xilinx_zynq_a9_destructor(QOSGraphObject *obj) +{ + QXilinxZynqA9Machine *machine =3D (QXilinxZynqA9Machine *) obj; + alloc_destroy(&machine->alloc); +} + +static void *qos_create_machine_arm_xilinx_zynq_a9(QTestState *qts) +{ + QXilinxZynqA9Machine *machine =3D g_new0(QXilinxZynqA9Machine, 1); + + alloc_init(&machine->alloc, 0, + XILINX_ZYNQ_A9_RAM_ADDR + (1 << 20), + XILINX_ZYNQ_A9_RAM_ADDR + XILINX_ZYNQ_A9_RAM_SIZE, + ARM_PAGE_SIZE); + + machine->obj.get_device =3D xilinx_zynq_a9_get_device; + machine->obj.get_driver =3D xilinx_zynq_a9_get_driver; + machine->obj.destructor =3D xilinx_zynq_a9_destructor; + /* Datasheet: UG585 (v1.12.1) */ + qos_init_sdhci_mm(&machine->sdhci, qts, 0xe0100000, &(QSDHCIProperties= ) { + .version =3D 2, + .baseclock =3D 0, + .capab.sdma =3D true, + .capab.reg =3D 0x69ec0080, + }); + return &machine->obj; +} + +static void xilinx_zynq_a9_register_nodes(void) +{ + qos_node_create_machine("arm/xilinx-zynq-a9", + qos_create_machine_arm_xilinx_zynq_a9); + qos_node_contains("arm/xilinx-zynq-a9", "generic-sdhci", NULL); +} + +libqos_init(xilinx_zynq_a9_register_nodes); --=20 1.8.3.1