From patchwork Thu Mar 7 17:29:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1053153 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=209.51.188.17; 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=redhat.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="lI44g0ur"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44FdjY39Rvz9s70 for ; Fri, 8 Mar 2019 05:01:19 +1100 (AEDT) Received: from localhost ([127.0.0.1]:56522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1xKU-00032M-UD for incoming@patchwork.ozlabs.org; Thu, 07 Mar 2019 13:01:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1wqc-0002z8-Qj for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1wqb-0007y0-LG for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:22 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:39080) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1wqb-0007xN-Cy for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:21 -0500 Received: by mail-wr1-x442.google.com with SMTP id l12so1948926wrp.6 for ; Thu, 07 Mar 2019 09:30:21 -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=tDRByElg/tsuAN/LWk0Us4U3aK0MJsxONTOniwy9FmU=; b=lI44g0urcVOUyGAA+g/cAgYIKWqSdbQ7AjeS4sN+7Bh5BBYsiEx8QfVLDXBafzZlvQ 2UlwDB/KwKBc+NyUhjlg78RSpoLdn+iNwDojmKk/JPPH1ajJM19pmyaEtNMQ/eAOoiJi f9vZtee70jHHi0iOpIcs3u+SJ8agMM4qobGGYXBMLhUlJOotf2RoOJhmPtxN0QlTb+Pu n1ysvpKImkK/9aCNeawEXiwFsSOtMcEXjKELSwPhHYOEkAQdQSmJ1gxd8PtvZd+R+dDp lM77p+/tPpZp0GGsfYKuZN7M5a+BJ7FZEWJnqv+N244ax4arRyx/B4cGbly87Nw5qOYF ll+g== 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=tDRByElg/tsuAN/LWk0Us4U3aK0MJsxONTOniwy9FmU=; b=K7a/fi0a0tpwhhMAy5eDqHkW7coTJTUrUY1EyESmFAIeFiQa9zb+Iwh4E431K+al9r JRJo/W+sOh88/hwWZZYhY/bY/fxyFxkqlDuotMt4ENmyGbUbuGudnyV3sldPolq/oYye xAv2f9KcnmFCIU5xUy06jKhcpcokYSH3hhcMyXVd7rdmWFamqsmpQ9YDPGB+3lcta5RH BGQcdframaJEN8d9mvxL+P/pan2Onh21S8w2/2jeZba62bZGd6m3/imsiBJUO7GSXsiR w967jc6+OIRBDAqcp6mjBxjWivbGfK5L7SROOxRc1zIgD12m1LQIxQrTpY99xnJauHyL 8iaQ== X-Gm-Message-State: APjAAAWRuSrctj+nIJUcOoIpha1cJrdqjB41/zlRPgBugSU9FEEuZeCF 9x7VItXxIG6IQuL8qFRFR7K8DeW9 X-Google-Smtp-Source: APXvYqxt6xKDdgGyy6Qu9yQRlQ17jdSsaKJRYq1wmLZ4QwhzWZSQk2ApjfU+1RIdmwqWVaV0BTMhLQ== X-Received: by 2002:a5d:4145:: with SMTP id c5mr7587134wrq.256.1551979820129; 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.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 09:30:19 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 7 Mar 2019 18:29:20 +0100 Message-Id: <1551979804-6060-14-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::442 Subject: [Qemu-devel] [PULL 13/57] tests/libqos: aarch64/xlnx-zcu102 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Emanuele Giuseppe Esposito Add xlnx-zcu102 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 Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 1 + tests/libqos/aarch64-xlnx-zcu102-machine.c | 94 ++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 tests/libqos/aarch64-xlnx-zcu102-machine.c diff --git a/tests/Makefile.include b/tests/Makefile.include index c7800d5..d675ad8 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -755,6 +755,7 @@ qos-test-obj-y += $(libqos-pc-obj-y) qos-test-obj-y += tests/libqos/sdhci.o # Machines +qos-test-obj-y += tests/libqos/aarch64-xlnx-zcu102-machine.o qos-test-obj-y += tests/libqos/arm-raspi2-machine.o qos-test-obj-y += tests/libqos/arm-sabrelite-machine.o qos-test-obj-y += tests/libqos/arm-smdkc210-machine.o diff --git a/tests/libqos/aarch64-xlnx-zcu102-machine.c b/tests/libqos/aarch64-xlnx-zcu102-machine.c new file mode 100644 index 0000000..6fff040 --- /dev/null +++ b/tests/libqos/aarch64-xlnx-zcu102-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 QXlnxZCU102Machine QXlnxZCU102Machine; + +struct QXlnxZCU102Machine { + QOSGraphObject obj; + QGuestAllocator alloc; + QSDHCI_MemoryMapped sdhci; +}; + +#define ARM_PAGE_SIZE 4096 +#define XLNX_ZCU102_RAM_ADDR 0 +#define XLNX_ZCU102_RAM_SIZE 0x20000000 + +static void *xlnx_zcu102_get_driver(void *object, const char *interface) +{ + QXlnxZCU102Machine *machine = object; + if (!g_strcmp0(interface, "memory")) { + return &machine->alloc; + } + + fprintf(stderr, "%s not present in aarch64/xlnx-zcu102\n", interface); + g_assert_not_reached(); +} + +static QOSGraphObject *xlnx_zcu102_get_device(void *obj, const char *device) +{ + QXlnxZCU102Machine *machine = obj; + if (!g_strcmp0(device, "generic-sdhci")) { + return &machine->sdhci.obj; + } + + fprintf(stderr, "%s not present in aarch64/xlnx-zcu102\n", device); + g_assert_not_reached(); +} + +static void xlnx_zcu102_destructor(QOSGraphObject *obj) +{ + QXlnxZCU102Machine *machine = (QXlnxZCU102Machine *) obj; + alloc_destroy(&machine->alloc); +} + +static void *qos_create_machine_aarch64_xlnx_zcu102(QTestState *qts) +{ + QXlnxZCU102Machine *machine = g_new0(QXlnxZCU102Machine, 1); + + alloc_init(&machine->alloc, 0, + XLNX_ZCU102_RAM_ADDR + (1 << 20), + XLNX_ZCU102_RAM_ADDR + XLNX_ZCU102_RAM_SIZE, + ARM_PAGE_SIZE); + + machine->obj.get_device = xlnx_zcu102_get_device; + machine->obj.get_driver = xlnx_zcu102_get_driver; + machine->obj.destructor = xlnx_zcu102_destructor; + /* Datasheet: UG1085 (v1.7) */ + qos_init_sdhci_mm(&machine->sdhci, qts, 0xff160000, &(QSDHCIProperties) { + .version = 3, + .baseclock = 0, + .capab.sdma = true, + .capab.reg = 0x280737ec6481 + }); + return &machine->obj; +} + +static void xlnx_zcu102_register_nodes(void) +{ + qos_node_create_machine("aarch64/xlnx-zcu102", + qos_create_machine_aarch64_xlnx_zcu102); + qos_node_contains("aarch64/xlnx-zcu102", "generic-sdhci", NULL); +} + +libqos_init(xlnx_zcu102_register_nodes);