From patchwork Mon Feb 4 13:44:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Elisei X-Patchwork-Id: 10795693 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 539D4922 for ; Mon, 4 Feb 2019 13:44:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40F772B49A for ; Mon, 4 Feb 2019 13:44:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 347842B4BA; Mon, 4 Feb 2019 13:44:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADF342B49A for ; Mon, 4 Feb 2019 13:44:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730696AbfBDNo2 (ORCPT ); Mon, 4 Feb 2019 08:44:28 -0500 Received: from foss.arm.com ([217.140.101.70]:55744 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727347AbfBDNo2 (ORCPT ); Mon, 4 Feb 2019 08:44:28 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C7D90A78; Mon, 4 Feb 2019 05:44:27 -0800 (PST) Received: from login9.euhpc.arm.com (login9.euhpc.arm.com [10.6.27.141]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B90553F557; Mon, 4 Feb 2019 05:44:26 -0800 (PST) From: Alexandru Elisei To: kvm@vger.kernel.org Cc: drjones@redhat.com, kvmarm@lists.cs.columbia.edu, andre.przywara@arm.com, vladimir.murzin@arm.com Subject: [kvm-unit-tests PATCH v3 0/5] arm/arm64: Add support for running under kvmtool Date: Mon, 4 Feb 2019 13:44:07 +0000 Message-Id: <20190204134412.47877-1-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.17.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP kvm-unit-tests is designed to be run with QEMU as the virtual machine monitor. It relies on devices emulated by QEMU (like isa-debug-exit or testdev) and it makes certain assumptions based on the implicit QEMU virtual environment configuration (like the serial base address). kvmtool [1] is a lightweight virtual machine monitor for running KVM guests. kvmtool has reduced complexity compared to QEMU and is easily hackable. This patch series aims to make it possible to run kvm-unit-tests using kvmtool on the arm and arm64 architectures, with two caveats: (1) When terminating a test, the userspace process won't exit with an exit code that signals the success or failure of the test. Output from the test can still be parsed to determine the outcome of the test. (2) kvmtool has been designed to work with a linux guest and it automatically generates the command line arguments for a Linux kernel. The arm/arm64 selftest and gic tests will fail if unexpected command line arguments are found. To get around this limitation, the test binary needs to be loaded using the --firmware option introduced by kvmtool in commit 5e4b563d75b9 ("arm: Allow command line for firmware"). This option suppresses the automatic kernel command line and can be used to run all tests, not just the tests that require specific arguments. The run scripts haven't been modified. To run a test under kvmtool, one needs to launch kvmtool manually. For example, to run the timer test the following command can be used: lkvm run --cpus 1 --console serial --firmware timer.flat. To run the gicv3-ipi test: lkvm run --cpus 8 --console serial --params "ipi" --irqchip gicv3 \ --firmware gic.flat Changes in v3: * Updated cover letter with information about the kvmtool --firmware option. * Gathered Reviewed-by tags. * Renamed the config.h define UART_EARLY_BASE to CONFIG_UART_EARLY_BASE and made the necessary casts in lib/arm/io.c Changes in v2: * Generate lib/config.h when configuring kvm-unit-tests; arm/arm64 uses it to get the UART address. * Added --vmm configure option for arm/arm64 which will set the UART address in lib/config.h when the tests are run under QEMU or kvmtool. * Renamed psci_sys_reset() to psci_system_reset(). * Dropped patches that allowed a test to ignore unexpected command line arguments. Summary: * Patches 1, 2 and 3 add support for configuring kvm-unit-tests on arm and arm64 to use the ns16550a UART emulated by kvmtool. * Patches 4 and 5 provide an alternative mechanism for terminating the virtual machine by using PSCI. [1] https://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git/ [2] https://www.spinics.net/lists/kvm-arm/msg34352.html Alexandru Elisei (5): lib: arm: Use UART address from generated config.h configure: arm/arm64: Add --vmm option with no effect lib: arm: Use ns16550a UART when --vmm=kvmtool lib: arm: Implement PSCI SYSTEM_OFF in psci_system_off() lib: arm: Fallback to psci_system_off() in exit() configure | 32 ++++++++++++++++++++++++++++++++ Makefile | 2 +- lib/arm/asm/psci.h | 3 ++- lib/arm/io.c | 41 ++++++++++++++++++++++++++--------------- lib/arm/psci.c | 8 +++++++- .gitignore | 1 + 6 files changed, 69 insertions(+), 18 deletions(-) Reviewed-by: Alexandru Elisei Tested-by: Alexandru Elisei