From nobody Mon Feb 9 18:46:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513308414482621.4917490814304; Thu, 14 Dec 2017 19:26:54 -0800 (PST) Received: from localhost ([::1]:44017 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePgeA-0006CB-Mh for importer@patchew.org; Thu, 14 Dec 2017 22:26:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePgWD-0007d0-07 for qemu-devel@nongnu.org; Thu, 14 Dec 2017 22:18:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePgW9-0002ca-QT for qemu-devel@nongnu.org; Thu, 14 Dec 2017 22:18:36 -0500 Received: from mail-qk0-x244.google.com ([2607:f8b0:400d:c09::244]:35247) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ePgW9-0002cH-MR; Thu, 14 Dec 2017 22:18:33 -0500 Received: by mail-qk0-x244.google.com with SMTP id c13so8843933qke.2; Thu, 14 Dec 2017 19:18:33 -0800 (PST) Received: from x1.local ([181.91.222.165]) by smtp.gmail.com with ESMTPSA id l125sm3484740qkc.3.2017.12.14.19.17.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Dec 2017 19:18:32 -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 :mime-version:content-transfer-encoding; bh=ODhuAZcZ7T8cAUToHWt+/xxs9BPhqRdYTNiMThBf9A0=; b=FFVtFKzQpfo/SdLcOmzEjpo7ThBLdDTFMtDBu2bVZBGCmhKXgQcIIKx4W2F2vGvIUD zOEf135PJ/dVwCAEEiwq504f+dgzkCXAONVug7Zb94bZ0MidbqihwGc4BvgmcBXmW1bf WGnbIWomuaGzhK1PV1XqTGVat4ph3uoFA5uUdsyXyLc6fPjt2s86+v/NXL2Bf73XjPjz gvirNbj5+9GTiEYID6/txW/2ONJEzcytrLqMJSV99c1K7xO8rhNiqBd9d1/Bx6Iypbn9 4rjLEG97Pck5EWMyv/rKp5I2HuULFVyKYSQMhePQVffQ34WjztNzFNqUwrQItbg80pl5 z5jA== 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:mime-version:content-transfer-encoding; bh=ODhuAZcZ7T8cAUToHWt+/xxs9BPhqRdYTNiMThBf9A0=; b=mPAGuHt/gTVhhfLW9mLHFh7mLvnbxQbU4nl5q4VJv3kkNCAu5WxHl3oUthj/TLs9cf qLCGiROomrMNJiqng9QKv64cRG/S3zaUb3itru0TWTxuYyclck/WTp1maSmU8BxhDTnv y5OoJxFx1P0YfrxXhYoAT4AZByJtsQzbZIS1TwPLLw+CbYiJ/M+Sor2TrddIocvkX8NF Wamz11Z/wAPeNY3SiQ1Ccxc+7gg87zBbkunKIApoiiRZErkmEPX2iUTEC/nSOOUR31ky uMzQmIBgVQz7Px6W9X+OFiCtB/VCbbINZPM5aO+cdA9vxVEzUky1TQoN7LKp/2RwJuEi yJsw== X-Gm-Message-State: AKGB3mL+AgKlNsIamawLiyv7Ku2PSKhkP4evzXOrDmmabfI31/j1kp3P s0OTRvesXA2SAg240HJScOI= X-Google-Smtp-Source: ACJfBosQDLuzmEh1V5jqnE4Cx4gA5tZwiXBNtL6+wiaOZi7ebOabJ4WC9x82d0IUoAhHz+8c84R2eQ== X-Received: by 10.55.195.142 with SMTP id r14mr19978307qkl.146.1513307913200; Thu, 14 Dec 2017 19:18:33 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Alistair Francis , "Edgar E . Iglesias" , Peter Maydell , Michael Walle , Andrzej Zaborowski , Andrew Baumann , Andrey Smirnov , Andrey Yurovsky Date: Fri, 15 Dec 2017 00:15:43 -0300 Message-Id: <20171215031547.31006-17-f4bug@amsat.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171215031547.31006-1-f4bug@amsat.org> References: <20171215031547.31006-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::244 Subject: [Qemu-devel] [PATCH v2 16/20] sdhci: add qtest to check the SD Spec version 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: Prasad J Pandit , Peter Crosthwaite , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Sai Pavan Boddu , qemu-arm@nongnu.org, Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 with check_specs_version() Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi --- tests/sdhci-test.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ tests/Makefile.include | 2 ++ 2 files changed, 76 insertions(+) create mode 100644 tests/sdhci-test.c diff --git a/tests/sdhci-test.c b/tests/sdhci-test.c new file mode 100644 index 0000000000..4ebe1e349b --- /dev/null +++ b/tests/sdhci-test.c @@ -0,0 +1,74 @@ +/* + * QTest testcase for SDHCI controllers + * + * Written by Philippe Mathieu-Daud=C3=A9 + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ +#include "qemu/osdep.h" +#include "libqtest.h" + +#define SDHC_HCVER 0xFE + +static const struct sdhci_t { + const char *arch; + const char *machine; + struct { + uintptr_t addr; + uint8_t version; + } sdhci; +} models[] =3D { + { "arm", "smdkc210", + {0x12510000, 2} }, + { "arm", "sabrelite", + {0x02190000, 3} }, + { "arm", "raspi2", /* bcm2835 */ + {0x3f300000, 3} }, + { "arm", "xilinx-zynq-a9", /* exynos4210 */ + {0xe0100000, 3} }, +}; + +static uint32_t sdhci_readl(uintptr_t base, uint32_t reg_addr) +{ + QTestState *qtest =3D global_qtest; + + return qtest_readl(qtest, base + reg_addr); +} + +static void check_specs_version(uintptr_t addr, uint8_t version) +{ + uint32_t v; + + v =3D sdhci_readl(addr, SDHC_HCVER); + v &=3D 0xff; + v +=3D 1; + g_assert_cmpuint(v, =3D=3D, version); +} + +static void test_machine(const void *data) +{ + const struct sdhci_t *test =3D data; + + global_qtest =3D qtest_startf("-machine %s -d unimp", test->machine); + + check_specs_version(test->sdhci.addr, test->sdhci.version); + + qtest_quit(global_qtest); +} + +int main(int argc, char *argv[]) +{ + char *name; + int i; + + g_test_init(&argc, &argv, NULL); + + for (i =3D 0; i < ARRAY_SIZE(models); i++) { + name =3D g_strdup_printf("sdhci/%s", models[i].machine); + qtest_add_data_func(name, &models[i], test_machine); + g_free(name); + } + + return g_test_run(); +} diff --git a/tests/Makefile.include b/tests/Makefile.include index c002352134..af7f324e07 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -355,6 +355,7 @@ check-qtest-arm-y +=3D tests/virtio-blk-test$(EXESUF) gcov-files-arm-y +=3D arm-softmmu/hw/block/virtio-blk.c check-qtest-arm-y +=3D tests/test-arm-mptimer$(EXESUF) gcov-files-arm-y +=3D hw/timer/arm_mptimer.c +check-qtest-arm-y +=3D tests/sdhci-test$(EXESUF) =20 check-qtest-aarch64-y =3D tests/numa-test$(EXESUF) =20 @@ -609,6 +610,7 @@ tests/test-qht-par$(EXESUF): tests/test-qht-par.o tests= /qht-bench$(EXESUF) $(tes tests/qht-bench$(EXESUF): tests/qht-bench.o $(test-util-obj-y) tests/test-bufferiszero$(EXESUF): tests/test-bufferiszero.o $(test-util-ob= j-y) tests/atomic_add-bench$(EXESUF): tests/atomic_add-bench.o $(test-util-obj-= y) +tests/sdhci-test$(EXESUF): tests/sdhci-test.o =20 tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \ hw/core/qdev.o hw/core/qdev-properties.o hw/core/hotplug.o\ --=20 2.15.1