From patchwork Mon Aug 20 12:02:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emanuele Giuseppe Esposito X-Patchwork-Id: 959640 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="KG2HUhgI"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41vCFl4dZFz9s3C for ; Mon, 20 Aug 2018 22:06:18 +1000 (AEST) Received: from localhost ([::1]:46670 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1friwo-0000OC-Qf for incoming@patchwork.ozlabs.org; Mon, 20 Aug 2018 08:06:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frit9-0005kB-Ql for qemu-devel@nongnu.org; Mon, 20 Aug 2018 08:02:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frit8-0002SR-Qo for qemu-devel@nongnu.org; Mon, 20 Aug 2018 08:02:27 -0400 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]:41455) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1frit8-0002S3-L8; Mon, 20 Aug 2018 08:02:26 -0400 Received: by mail-ed1-x543.google.com with SMTP id f38-v6so817670edd.8; Mon, 20 Aug 2018 05:02:26 -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=8NDLC6k8bY3YHOL6De2KLx2XSgDYNATkqOfW7DJBFoc=; b=KG2HUhgIhazhAPmGkh5y5XzFkBMR8wYZjew9bHnKQ6cpD0m5vuCWe6my04zXQLa0OE jrANCBkzZsWawxnv2RKU6L8mcFCJg/l9fSvYTivvfmY12B5VouTBBgc/vgUP0vjmmcWr NAyHOfaxcuFbE80NV2GPqRvGKV6XIfjGH2wKTIqAk5ZmvyXlHUPOnH5wwXn77sl1rK2J 5jWPp6qUyqdJN83uq/52Fe6JTNS2M93QV9lmWSI+wEbvxveV+dBjgh8Lcqq2Pys49VLu MnqrUrCVZoigiCXZ7+BmkisRQ08tsrVsKP18WRsvoaQtJLD/uoxjJI6NFmbsbEeshLhD /kqw== 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=8NDLC6k8bY3YHOL6De2KLx2XSgDYNATkqOfW7DJBFoc=; b=YKfP9pzPudgZouFJUQHQt5e8jsa/5f5AQGm7UqXlg2bcqu1dVedepryaAbRSBFbBRs qG3+p50QjqSU1DbECWc2GGKmMllIVtYv7095xbcfpnmJjGpV/uewjg7uwKldL15/wNbn vnjEDRvAMplrb99ogS4/VW2D1LwbBEQSo2P5Fv0Hg1UGNpExSoNNq0AAjy6CfCNMSM3h 0n9TDTsfHNuQFu2YaNyKOH7N3+5HhOwbIw1E3VhxyZtWi2RWYUwzHUdc6mgC531jW77U 6IFIYh+UxFwTJPKbq+fTICAmI6iAsUnRkZEfaoHxxWfsW5/eAUVmUBxb+glAowxyuegE UNvA== X-Gm-Message-State: AOUpUlETA56OpjyFDDCbFRbTeD52ZCtHjWa7/EMxYwys0Q8Eo+WXyflr pjD5OeySz7QKoOL1JxQPEBoPebj6Ti4= X-Google-Smtp-Source: AA+uWPy3cMuNWXRNXLmu/85T4YgGaRd2aiJIi4SEvLUGxsHbVTRtiKSHtU3Hi8HSmDT1LrPSDpdc9A== X-Received: by 2002:a50:de8e:: with SMTP id c14-v6mr54664889edl.196.1534766545370; Mon, 20 Aug 2018 05:02:25 -0700 (PDT) Received: from emanuele-MacBookPro.mobile.usilu.net ([194.230.159.211]) by smtp.gmail.com with ESMTPSA id b20-v6sm1348486edc.30.2018.08.20.05.02.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Aug 2018 05:02:24 -0700 (PDT) From: Emanuele Giuseppe Esposito To: qemu-devel@nongnu.org Date: Mon, 20 Aug 2018 14:02:00 +0200 Message-Id: <20180820120213.11095-4-e.emanuelegiuseppe@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180820120213.11095-1-e.emanuelegiuseppe@gmail.com> References: <20180820120213.11095-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 03/16] test/qgraph: arm/xlinx-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: Laurent Vivier , Dmitry Fleytman , Fam Zheng , =?utf-8?q?P?= =?utf-8?q?hilippe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Amit Shah , Jason Wang , "Michael S. Tsirkin" , Emanuele Giuseppe Esposito , Alexander Graf , Greg Kurz , Keith Busch , qemu-ppc@nongnu.org, Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , John Snow , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add xlinx-zynq-a9 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 Acked-by: Alistair Francis --- tests/Makefile.include | 1 + tests/libqos/xilinx-zynq-a9-machine.c | 84 +++++++++++++++++++++++++++ tests/sdhci-test.c | 8 +-- 3 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 tests/libqos/xilinx-zynq-a9-machine.c diff --git a/tests/Makefile.include b/tests/Makefile.include index 4690d5f5e9..d559218b1c 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -760,6 +760,7 @@ libqgraph-arm-machines-obj-y = tests/libqos/raspi2-machine.o libqgraph-arm-machines-obj-y += tests/libqos/virt-machine.o libqgraph-arm-machines-obj-y += tests/libqos/smdkc210-machine.o libqgraph-arm-machines-obj-y += tests/libqos/sabrelite-machine.o +libqgraph-arm-machines-obj-y += tests/libqos/xilinx-zynq-a9-machine.o libqgraph-machines-obj-y = $(libqgraph-arm-machines-obj-y) libqgraph-machines-obj-y += tests/libqos/x86_64_pc-machine.o diff --git a/tests/libqos/xilinx-zynq-a9-machine.c b/tests/libqos/xilinx-zynq-a9-machine.c new file mode 100644 index 0000000000..025cd80eb2 --- /dev/null +++ b/tests/libqos/xilinx-zynq-a9-machine.c @@ -0,0 +1,84 @@ +/* + * 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 QXilinx_zynq_a9Machine QXilinx_zynq_a9Machine; + +struct QXilinx_zynq_a9Machine { + QOSGraphObject obj; + QGuestAllocator *alloc; + QSDHCI_MemoryMapped sdhci; +}; + +static void xilinx_zynq_a9_destructor(QOSGraphObject *obj) +{ + g_free(obj); +} + +static void *xilinx_zynq_a9_get_driver(void *object, const char *interface) +{ + QXilinx_zynq_a9Machine *machine = 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 *device) +{ + QXilinx_zynq_a9Machine *machine = 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 *qos_create_machine_arm_xilinx_zynq_a9(void) +{ + QXilinx_zynq_a9Machine *machine = g_new0(QXilinx_zynq_a9Machine, 1); + + machine->obj.get_device = xilinx_zynq_a9_get_device; + machine->obj.get_driver = xilinx_zynq_a9_get_driver; + machine->obj.destructor = xilinx_zynq_a9_destructor; + /* Datasheet: UG585 (v1.12.1) */ + qos_init_sdhci_smm(&machine->sdhci, 0xe0100000, &(QSDHCIProperties) { + .version = 2, + .baseclock = 0, + .capab.sdma = true, + .capab.reg = 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); diff --git a/tests/sdhci-test.c b/tests/sdhci-test.c index 31ecc06159..0a8efd8554 100644 --- a/tests/sdhci-test.c +++ b/tests/sdhci-test.c @@ -60,14 +60,14 @@ FIELD(SDHC_CAPAB, DRIVER, 36, 3); /* since v3 */ { "arm", "sabrelite", {0x02190000, 3, 0, {1, 0x057834b4} } }, - * - * FIXME: the following drivers are missing: - * - Zynq-7000 { "arm", "xilinx-zynq-a9", Datasheet: UG585 (v1.12.1) {0xe0100000, 2, 0, {1, 0x69ec0080} } }, + * + * FIXME: the following drivers are missing: + * + ZynqMP { "aarch64", "xlnx-zcu102", Datasheet: UG1085 (v1.7) {0xff160000, 3, 0, {1, 0x280737ec6481} } },