From patchwork Mon Aug 20 12:01:59 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: 959644 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="e3Vsekx9"; 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 41vCK457C7z9s3C for ; Mon, 20 Aug 2018 22:09:12 +1000 (AEST) Received: from localhost ([::1]:46687 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frize-0002oH-6Y for incoming@patchwork.ozlabs.org; Mon, 20 Aug 2018 08:09:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fritC-0005mY-PN 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 1frit6-0002RT-Sa for qemu-devel@nongnu.org; Mon, 20 Aug 2018 08:02:30 -0400 Received: from mail-ed1-x541.google.com ([2a00:1450:4864:20::541]:41453) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1frit6-0002RC-Lc; Mon, 20 Aug 2018 08:02:24 -0400 Received: by mail-ed1-x541.google.com with SMTP id f38-v6so817617edd.8; Mon, 20 Aug 2018 05:02:24 -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=7ezFTu2dOshlwEmcF4CgUzi67nKAw10BGadd5cWftT4=; b=e3Vsekx92ys0j4ZaMZS/Cj0nb+B0j/aM4gdBrjcEVMG6dv3PC9FCsFF2eawgJZDC6f Ga6au9u9ctKC1r2L/EVb3MW2FecZe0siAMai+KlO167pIiJcDgnEXWOZvYrd2KoKYTy0 P9PblLhObjj6EpDSRxL4ySfZfsdRbhWpCcKXAzaidoaLDu64Y6QrLSAPqDXjuq9tKRuX /wHVRY8vajiiVSzXR8zQqP2QHipRB+R42JwXAZgTWg/LMUXdWzZJWYtrpceRgiBgzXEy IQgw6WjhCrm2g3A35g0S7wiel0pvjO6sf6wEA12EmYmhKpRQ+s+LV5i8atuBXgMG0V/3 zSAA== 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=7ezFTu2dOshlwEmcF4CgUzi67nKAw10BGadd5cWftT4=; b=aNRIcmqjGXKPY5bpoEa9nrn1R29jaABJ3ZhRvJGfwH8lAmHoXqCjBqqzZTlzBCrMzJ tfzGx8NziW3QSbNW63OXCokrHydjZyHqgk1ImzRRhpS9bYNj8QKnnpPwbqCVu2fZjlDs l4gqvv5E/DbQPfN4/IQEBN1/erh7JaanPUmAuxdrjbmeS6BQ/X6Dn+XpW63t0ywPgctK P/eh2PGnw6w++JAWv1PamC4L/uxD9XnlBJXnqiMRa8Yrf9e1/lYspnF4x8RSt32g7Nc/ F87N0ZFoaO/h3fj5gtgdgNkzJWYFcwDF/MlncAdTZPRWVz1Y9/IuQNGHV5F6MBJJkOIt FUbw== X-Gm-Message-State: AOUpUlEYd05s/3C0Jmhlgjkgv6uANyjKfitjmGOWpFmNurO4p9Wl31Hp FRapqzeA/sNoNBxIWAxu4m2sEhwEFsM= X-Google-Smtp-Source: AA+uWPyl3zCPa/20HNDVlxyBvoWcxH2rE2NqE3dszUZwMp0ipENAumNsx8J4KxS5XHDua0jqcIiCLg== X-Received: by 2002:a50:dccc:: with SMTP id v12-v6mr54207424edk.82.1534766543302; Mon, 20 Aug 2018 05:02:23 -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.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Aug 2018 05:02:22 -0700 (PDT) From: Emanuele Giuseppe Esposito To: qemu-devel@nongnu.org Date: Mon, 20 Aug 2018 14:01:59 +0200 Message-Id: <20180820120213.11095-3-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::541 Subject: [Qemu-devel] [PATCH 02/16] test/qgraph: 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: 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/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 --- tests/Makefile.include | 1 + tests/libqos/sabrelite-machine.c | 82 ++++++++++++++++++++++++++++++++ tests/sdhci-test.c | 7 +-- 3 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 tests/libqos/sabrelite-machine.c diff --git a/tests/Makefile.include b/tests/Makefile.include index b4a9b28706..4690d5f5e9 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -759,6 +759,7 @@ libqos-virtio-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/virt 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-machines-obj-y = $(libqgraph-arm-machines-obj-y) libqgraph-machines-obj-y += tests/libqos/x86_64_pc-machine.o diff --git a/tests/libqos/sabrelite-machine.c b/tests/libqos/sabrelite-machine.c new file mode 100644 index 0000000000..1d8c39e209 --- /dev/null +++ b/tests/libqos/sabrelite-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 QSabreliteMachine QSabreliteMachine; + +struct QSabreliteMachine { + QOSGraphObject obj; + QGuestAllocator *alloc; + QSDHCI_MemoryMapped sdhci; +}; + +static void sabrelite_destructor(QOSGraphObject *obj) +{ + g_free(obj); +} + +static void *sabrelite_get_driver(void *object, const char *interface) +{ + QSabreliteMachine *machine = 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 = 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 *qos_create_machine_arm_sabrelite(void) +{ + QSabreliteMachine *machine = g_new0(QSabreliteMachine, 1); + + machine->obj.get_device = sabrelite_get_device; + machine->obj.get_driver = sabrelite_get_driver; + machine->obj.destructor = sabrelite_destructor; + qos_init_sdhci_smm(&machine->sdhci, 0x02190000, &(QSDHCIProperties) { + .version = 3, + .baseclock = 0, + .capab.sdma = true, + .capab.reg = 0x057834b4, + }); + return &machine->obj; +} + +static void sabrelite_register_nodes(void) +{ + qos_node_create_machine("arm/sabrelite", qos_create_machine_arm_sabrelite); + qos_node_contains("arm/sabrelite", "generic-sdhci", NULL); +} + +libqos_init(sabrelite_register_nodes); diff --git a/tests/sdhci-test.c b/tests/sdhci-test.c index 9f4cd9209a..31ecc06159 100644 --- a/tests/sdhci-test.c +++ b/tests/sdhci-test.c @@ -55,14 +55,15 @@ FIELD(SDHC_CAPAB, DRIVER, 36, 3); /* since v3 */ Exynos4210 { "arm", "smdkc210", {0x12510000, 2, 0, {1, 0x5e80080} } }, - * - * FIXME: the following drivers are missing: - * i.MX 6 { "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} } },