From patchwork Mon Aug 20 12:01:58 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: 959636 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="Db5MFDOB"; 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 41vCBB227Kz9s3C for ; Mon, 20 Aug 2018 22:03:14 +1000 (AEST) Received: from localhost ([::1]:46654 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fritr-0005jb-ST for incoming@patchwork.ozlabs.org; Mon, 20 Aug 2018 08:03:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frit7-0005jQ-5u for qemu-devel@nongnu.org; Mon, 20 Aug 2018 08:02:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frit5-0002R2-6X for qemu-devel@nongnu.org; Mon, 20 Aug 2018 08:02:25 -0400 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]:46342) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1frit4-0002Qs-W9; Mon, 20 Aug 2018 08:02:23 -0400 Received: by mail-ed1-x543.google.com with SMTP id o8-v6so8316725edt.13; Mon, 20 Aug 2018 05:02:22 -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=uSXtyAIca98e0rGST+N0DtLo5Ug3mCqpiAl8gcsZQOU=; b=Db5MFDOBgYnbuizkEqqs7QwKNNVEzVIYYWvg7Bv4P7FZMnASyA6bqBYch5RujIPBB5 uZZtkDkwchypE/oJa3gxCuhW4TmMyPpIn9C0kxXSBgBCWB9QdHx4xcwzLFgy7QdqmIqI +29xn4y5T7tXNizwlhasApzhLrt6w2ak37MM5z/vDDKZM4QcRFQ9HdobqVIbtCCtghJh RQHS8es8u4XkSAvXtvcrLS5qaYHI5JLBNljUYTJ29hrn25lE1/2JmLI6qiEVIK/XiD3c 5PgTn8mCTRXK6QW0oXvTxRbLrKKs6rQmqiH1PC/f4gEEI0U47blVJuiSjlo8PV4z9Pul YRiA== 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=uSXtyAIca98e0rGST+N0DtLo5Ug3mCqpiAl8gcsZQOU=; b=JVHyPBbUkmZWn5mQviqRISSAUiJN7gAomedShnn5lsJzi+Vy9ocYVoNxt1K96INvgu y/MdLaJWwdWXkgEa67yzz1ok6OBVkYisS1KwpUi6GIf3vZxHe65sKHF+vY5N/fLggmOF 488MJchuPEqz2DfK38QDIWZjsbqtqZNRDDKYY7QHNsikniDyk2lW7lqrHrj47kfX7PeB zpEDP9tVGMRcyCa7lRann+AwYbzVpFLEbyk6YdGu51lXw5LDdZfUprgE6YWTniHmr8hR jbG7TxXqzo9IMuJI8QEN1HW0vV0bb5awtWTfX0ZcEYrjfrAqT0Dq7xXEpZIsldEmijNH YIFA== X-Gm-Message-State: AOUpUlGnPf9rOY7yM4R9WE6+yV5ULbg9NsFrB3XTtuxz1wie4GQlrQu8 qeZ5fiqgicydlBnYmHevI2BkwR4CJv0= X-Google-Smtp-Source: AA+uWPx2wkOs6kUWpAaeWtmPluLj2CbrKto6ZxgJNitv0BaYqaqBIe5g7VP+SEPX+T3JozLLkpA0eg== X-Received: by 2002:a50:8832:: with SMTP id b47-v6mr2949534edb.182.1534766541649; Mon, 20 Aug 2018 05:02:21 -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.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Aug 2018 05:02:21 -0700 (PDT) From: Emanuele Giuseppe Esposito To: qemu-devel@nongnu.org Date: Mon, 20 Aug 2018 14:01:58 +0200 Message-Id: <20180820120213.11095-2-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 01/16] test/qgraph: arm/smdkc210 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 arm/smdkc210 machine 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 --- tests/Makefile.include | 9 ++-- tests/libqos/smdkc210-machine.c | 82 +++++++++++++++++++++++++++++++++ tests/sdhci-test.c | 7 +-- 3 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 tests/libqos/smdkc210-machine.c diff --git a/tests/Makefile.include b/tests/Makefile.include index 30355058fc..b4a9b28706 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -756,10 +756,13 @@ libqos-imx-obj-y = $(libqos-obj-y) tests/libqos/i2c-imx.o libqos-usb-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/usb.o libqos-virtio-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o -libqgraph-machines-obj-y = tests/libqos/x86_64_pc-machine.o -libqgraph-machines-obj-y += tests/libqos/raspi2-machine.o +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-machines-obj-y = $(libqgraph-arm-machines-obj-y) +libqgraph-machines-obj-y += tests/libqos/x86_64_pc-machine.o libqgraph-machines-obj-y += tests/libqos/ppc64_pseries-machine.o -libqgraph-machines-obj-y += tests/libqos/virt-machine.o libqgraph-virtio-obj-y = tests/libqos/virtio-serial.o libqgraph-virtio-obj-y += tests/libqos/virtio-9p.o diff --git a/tests/libqos/smdkc210-machine.c b/tests/libqos/smdkc210-machine.c new file mode 100644 index 0000000000..542d426209 --- /dev/null +++ b/tests/libqos/smdkc210-machine.c @@ -0,0 +1,82 @@ +/* + * 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 QSmdkc210Machine QSmdkc210Machine; + +struct QSmdkc210Machine { + QOSGraphObject obj; + QGuestAllocator *alloc; + QSDHCI_MemoryMapped sdhci; +}; + +static void smdkc210_destructor(QOSGraphObject *obj) +{ + g_free(obj); +} + +static void *smdkc210_get_driver(void *object, const char *interface) +{ + QSmdkc210Machine *machine = object; + if (!g_strcmp0(interface, "memory")) { + return &machine->alloc; + } + + fprintf(stderr, "%s not present in arm/smdkc210\n", interface); + g_assert_not_reached(); +} + +static QOSGraphObject *smdkc210_get_device(void *obj, const char *device) +{ + QSmdkc210Machine *machine = obj; + if (!g_strcmp0(device, "generic-sdhci")) { + return &machine->sdhci.obj; + } + + fprintf(stderr, "%s not present in arm/smdkc210\n", device); + g_assert_not_reached(); +} + +static void *qos_create_machine_arm_smdkc210(void) +{ + QSmdkc210Machine *machine = g_new0(QSmdkc210Machine, 1); + + machine->obj.get_device = smdkc210_get_device; + machine->obj.get_driver = smdkc210_get_driver; + machine->obj.destructor = smdkc210_destructor; + qos_init_sdhci_smm(&machine->sdhci, 0x12510000, &(QSDHCIProperties) { + .version = 2, + .baseclock = 0, + .capab.sdma = true, + .capab.reg = 0x5e80080, + }); + return &machine->obj; +} + +static void smdkc210_register_nodes(void) +{ + qos_node_create_machine("arm/smdkc210", qos_create_machine_arm_smdkc210); + qos_node_contains("arm/smdkc210", "generic-sdhci", NULL); +} + +libqos_init(smdkc210_register_nodes); diff --git a/tests/sdhci-test.c b/tests/sdhci-test.c index ed29839f3d..9f4cd9209a 100644 --- a/tests/sdhci-test.c +++ b/tests/sdhci-test.c @@ -51,12 +51,13 @@ FIELD(SDHC_CAPAB, DRIVER, 36, 3); /* since v3 */ BCM2835 { "arm", "raspi2", {0x3f300000, 3, 52, {0, 0x052134b4} } }, - * - * FIXME: the following drivers are missing: - * + Exynos4210 { "arm", "smdkc210", {0x12510000, 2, 0, {1, 0x5e80080} } }, + * + * FIXME: the following drivers are missing: + * i.MX 6 { "arm", "sabrelite",