From patchwork Fri Jan 10 14:54:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 1221156 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hErHDI8p; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47vR6k6FCtz9sR4 for ; Sat, 11 Jan 2020 02:02:38 +1100 (AEDT) Received: from localhost ([::1]:47242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipvo3-00050a-UB for incoming@patchwork.ozlabs.org; Fri, 10 Jan 2020 10:02:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54713) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipvhM-0005GJ-Ki for qemu-devel@nongnu.org; Fri, 10 Jan 2020 09:55:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipvhI-0008DZ-Ow for qemu-devel@nongnu.org; Fri, 10 Jan 2020 09:55:38 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:34839 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ipvhE-0008A5-V4 for qemu-devel@nongnu.org; Fri, 10 Jan 2020 09:55:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578668132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pcJ+wB7cNlY38bik4p3wpP3qiRSX7Sl8ZObmSchT014=; b=hErHDI8p1vmIeePu1MR0ZO3FjZZqfwOsBiostWoG9pn3Kiq83MZ7x4vL7xqUN0Qvme2LbY gAz8lWjdimhQdUbX0D644/otdXHyWss+76RRnQBB12gdJff6eGnuewMUsR0HxnAlGyoarz ChqgMa+nZEnd6RYLr5oufKkaY1rDWqw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-95-deHWbyOWMj6ZZi6hu3Q_TA-1; Fri, 10 Jan 2020 09:55:31 -0500 X-MC-Unique: deHWbyOWMj6ZZi6hu3Q_TA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C366B10883B3; Fri, 10 Jan 2020 14:55:28 +0000 (UTC) Received: from laptop.redhat.com (ovpn-117-108.ams2.redhat.com [10.36.117.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 391467BA5F; Fri, 10 Jan 2020 14:55:23 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, maz@kernel.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, qemu-devel@nongnu.org, qemu-arm@nongnu.org Subject: [kvm-unit-tests PATCH v2 14/16] arm/run: Allow Migration tests Date: Fri, 10 Jan 2020 15:54:10 +0100 Message-Id: <20200110145412.14937-15-eric.auger@redhat.com> In-Reply-To: <20200110145412.14937-1-eric.auger@redhat.com> References: <20200110145412.14937-1-eric.auger@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, drjones@redhat.com, andre.przywara@arm.com, thuth@redhat.com, yuzenghui@huawei.com, alexandru.elisei@arm.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Let's link getchar.o to use puts and getchar from the tests. Then allow tests belonging to the migration group to trigger the migration from the test code by putting "migrate" into the uart. Then the code can wait for the migration completion by using getchar(). The __getchar implement is minimalist as it just reads the data register. It is just meant to read the single character emitted at the end of the migration by the runner script. It is not meant to read more data (FIFOs are not enabled). Signed-off-by: Eric Auger Reviewed-by: Thomas Huth --- arm/Makefile.common | 2 +- arm/run | 2 +- lib/arm/io.c | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/arm/Makefile.common b/arm/Makefile.common index 7cc0f04..327f112 100644 --- a/arm/Makefile.common +++ b/arm/Makefile.common @@ -32,7 +32,7 @@ CFLAGS += -I $(SRCDIR)/lib -I $(SRCDIR)/lib/libfdt -I lib asm-offsets = lib/$(ARCH)/asm-offsets.h include $(SRCDIR)/scripts/asm-offsets.mak -cflatobjs += lib/util.o +cflatobjs += lib/util.o lib/getchar.o cflatobjs += lib/alloc_phys.o cflatobjs += lib/alloc_page.o cflatobjs += lib/vmalloc.o diff --git a/arm/run b/arm/run index 277db9b..a390ca5 100755 --- a/arm/run +++ b/arm/run @@ -61,6 +61,6 @@ fi M+=",accel=$ACCEL" command="$qemu -nodefaults $M -cpu $processor $chr_testdev $pci_testdev" command+=" -display none -serial stdio -kernel" -command="$(timeout_cmd) $command" +command="$(migration_cmd) $(timeout_cmd) $command" run_qemu $command "$@" diff --git a/lib/arm/io.c b/lib/arm/io.c index 99fd315..ed89e19 100644 --- a/lib/arm/io.c +++ b/lib/arm/io.c @@ -87,6 +87,19 @@ void puts(const char *s) spin_unlock(&uart_lock); } +/* + * Minimalist implementation for migration completion detection. + * Needs to be improved for more advanced Rx cases + */ +int __getchar(void) +{ + int ret; + + ret = readb(uart0_base); + if (!ret) + return -1; + return ret; +} /* * Defining halt to take 'code' as an argument guarantees that it will