From patchwork Mon Mar 8 13:51:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 395427 Delivered-To: patch@linaro.org Received: by 2002:a17:906:a383:0:0:0:0 with SMTP id k3csp1842830ejz; Mon, 8 Mar 2021 06:04:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwjEf5rSP3DtsZWyyaCnM99EzWYxx50gZvuvZDAEi+Vp2MvrxqPVto2UF+3J6Lv7LflTaDV X-Received: by 2002:a05:6e02:b46:: with SMTP id f6mr18379432ilu.230.1615212258796; Mon, 08 Mar 2021 06:04:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615212258; cv=none; d=google.com; s=arc-20160816; b=0iEZQqSDyLUNnNUhYBN8QxWY6Gkg4Fl3uTSH8mBz8b44OAEhK9j6Qbz/Riv4+tGly0 era+k5ioWgjwjp+agGZlzmOQ/l0KUtdsWbQcOPyWXaWtu/vvretT1qYVMzkcmw4gba1X vvKHrz/DjI14+XTtlKGv2yb73VD0sK+TgMC5n3Hhlzi9juGEmZ0SzY5LznHg1P9R1+nB faY2/SQxT3/mzugxBMsApdqy+yNlZOHrYxzmJuVSSc/7WxXbqFy5ImWZ8QdUIJSIgdDo MKAMPBIXKPSOUnEajEwEQNgB3RviBWb75ARHXhF/O3n6BWslFH54Zvd1QiyxZYRA/BOU mBfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=lATrIEPGwmzcWZ6ui8eeo8UnfJDdVIWgXFsp1qvDA7I=; b=Jb0tHuwWe8MorlLv+9LcgPO60bU5PiFDnA5dH5chzFbdEwC/8L6jdtF+IY3SEp3bOy IiqyH5V2WkX1qtHSRg8hvqx7h8+pAWVkTGOdWgjwlVXz5TGCRni5DLB0yhhu3vvGrTqD FYfNarhULJAtLJZOF6I6Pw8PY0wAP/pCoW3nepAeAIsRWetaGo8kO3sjgUGftwsG891R 0d+GiFIDgjWj+79jy1sj/Vkai9vDhdZ7RsCNuwrwA9eVF6U48P+jEMyDibXMiS23YYde zDQU4WVsze02mkQYrsVU7tnVry40qJZst6CV9nUmuTk70DTgybScbWTiaprpoL9b3SJH zj8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DPHzJFxQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n82si10686986iod.64.2021.03.08.06.04.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 08 Mar 2021 06:04:18 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DPHzJFxQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJGUc-0006Qj-1p for patch@linaro.org; Mon, 08 Mar 2021 09:04:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJGO5-0007IC-BA for qemu-devel@nongnu.org; Mon, 08 Mar 2021 08:57:33 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:39144) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lJGO3-0003vC-6s for qemu-devel@nongnu.org; Mon, 08 Mar 2021 08:57:33 -0500 Received: by mail-wr1-x431.google.com with SMTP id b18so11559575wrn.6 for ; Mon, 08 Mar 2021 05:57:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lATrIEPGwmzcWZ6ui8eeo8UnfJDdVIWgXFsp1qvDA7I=; b=DPHzJFxQxoGVUCeYEWVfEVlD4Pa3UOgFIfOuCbj8L7cZitpj0DMBCUS5z3u6ePQrLF AZ8YA3eTlT7z01VImsu9ykQVmAiRzTbFExJP7GdrMMpcEy5iubLOYLV5aMLUpSHuiUmo S2ZHyNzs1AhQJoGMZaEFCAstr22VvfOEz560XKHWWdjQnF/rImJZlG5m/F/obxH3kJtj wESXwmuepwOKPboP6FAIinKrJ1q99bSBcwlqhiq5yxZiBQDNrbiHryXGtQniHsnf17DX 8JxxWmBm7dWw2GWzZ8LmHr2QllJbJFjngw0vxYPfyqHJ8Hea0RJfvgD7TIgDZnf2v4Qp FbEg== 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:mime-version:content-transfer-encoding; bh=lATrIEPGwmzcWZ6ui8eeo8UnfJDdVIWgXFsp1qvDA7I=; b=pUfAbrlM8UKxXHaZvTZ2VJ35WzSfr7jqE9dLbcLuv4vTgmEkUTRcxbXakx3bBs/yD7 Yt/uuDEvZCpxLf8a4pw7G3wC2qlkUv6XwdTpqWXC6fiNa4CBvxQI3muPZFT04pTU5VG4 /YGGZATC3X/bjyVVXONbAzluKeR/uYBgA10L9K6n5E+e86t9Nxu3cY1ED4INBMfTLZMb ZzhJ364Hyw7wNuV/CFmiHYp5LExbwt8gyJGjuGCHLrZYi2DHlOloas70LdKxQc+33fXJ tKI1XCqcJmBwbKCPcYKXbudL83ktv1PtDjOitPw/ZDwMhR1qIiFvRtfQz/pz0/g/1jVA HU/A== X-Gm-Message-State: AOAM5311euNCUpOU0ZADjiJUAiuxredvfZo/eZDICM+JIfGkti/8E0e0 E44NKDglmJIU5gLcPMeE33zRQA== X-Received: by 2002:adf:ebc9:: with SMTP id v9mr23196380wrn.387.1615211849897; Mon, 08 Mar 2021 05:57:29 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id s8sm19705136wrn.97.2021.03.08.05.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Mar 2021 05:57:28 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 64B491FF9F; Mon, 8 Mar 2021 13:51:06 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 16/18] tests/avocado: add boot_xen tests Date: Mon, 8 Mar 2021 13:51:02 +0000 Message-Id: <20210308135104.24903-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210308135104.24903-1-alex.bennee@linaro.org> References: <20210308135104.24903-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , qemu-devel@nongnu.org, Cleber Rosa , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These tests make sure we can boot the Xen hypervisor with a Dom0 kernel using the guest-loader. We currently have to use a kernel I built myself because there are issues using the Debian kernel images. Signed-off-by: Alex Bennée Tested-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Cleber Rosa Message-Id: <20210303173642.3805-8-alex.bennee@linaro.org> -- 2.20.1 diff --git a/MAINTAINERS b/MAINTAINERS index 6bebd5279b..b54a22475b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2023,6 +2023,7 @@ M: Alex Bennée S: Maintained F: hw/core/guest-loader.c F: docs/system/guest-loader.rst +F: tests/acceptance/boot_xen.py Intel Hexadecimal Object File Loader M: Su Hang diff --git a/tests/acceptance/boot_xen.py b/tests/acceptance/boot_xen.py new file mode 100644 index 0000000000..75c2d44492 --- /dev/null +++ b/tests/acceptance/boot_xen.py @@ -0,0 +1,118 @@ +# Functional test that boots a Xen hypervisor with a domU kernel and +# checks the console output is vaguely sane . +# +# Copyright (c) 2020 Linaro +# +# Author: +# Alex Bennée +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import os + +from avocado import skipIf +from avocado_qemu import wait_for_console_pattern +from boot_linux_console import LinuxKernelTest + + +class BootXenBase(LinuxKernelTest): + """ + Boots a Xen hypervisor with a Linux DomU kernel. + """ + + timeout = 90 + XEN_COMMON_COMMAND_LINE = 'dom0_mem=128M loglvl=all guest_loglvl=all' + + def fetch_guest_kernel(self): + # Using my own built kernel - which works + kernel_url = ('https://fileserver.linaro.org/' + 's/JSsewXGZ6mqxPr5/download?path=%2F&files=' + 'linux-5.9.9-arm64-ajb') + kernel_sha1 = '4f92bc4b9f88d5ab792fa7a43a68555d344e1b83' + kernel_path = self.fetch_asset(kernel_url, + asset_hash=kernel_sha1) + + return kernel_path + + def launch_xen(self, xen_path): + """ + Launch Xen with a dom0 guest kernel + """ + self.log.info("launch with xen_path: %s", xen_path) + kernel_path = self.fetch_guest_kernel() + + self.vm.set_console() + + xen_command_line = self.XEN_COMMON_COMMAND_LINE + self.vm.add_args('-machine', 'virtualization=on', + '-cpu', 'cortex-a57', + '-m', '768', + '-kernel', xen_path, + '-append', xen_command_line, + '-device', + 'guest-loader,addr=0x47000000,kernel=%s,bootargs=console=hvc0' + % (kernel_path)) + + self.vm.launch() + + console_pattern = 'VFS: Cannot open root device' + wait_for_console_pattern(self, console_pattern, "Panic on CPU 0:") + + +class BootXen(BootXenBase): + + def test_arm64_xen_411_and_dom0(self): + """ + :avocado: tags=arch:aarch64 + :avocado: tags=accel:tcg + :avocado: tags=cpu:cortex-a57 + :avocado: tags=machine:virt + """ + + # archive of file from https://deb.debian.org/debian/pool/main/x/xen/ + xen_url = ('https://fileserver.linaro.org/s/JSsewXGZ6mqxPr5/' + 'download?path=%2F&files=' + 'xen-hypervisor-4.11-arm64_4.11.4%2B37-g3263f257ca-1_arm64.deb') + xen_sha1 = '034e634d4416adbad1212d59b62bccdcda63e62a' + xen_deb = self.fetch_asset(xen_url, asset_hash=xen_sha1) + xen_path = self.extract_from_deb(xen_deb, "/boot/xen-4.11-arm64") + + self.launch_xen(xen_path) + + def test_arm64_xen_414_and_dom0(self): + """ + :avocado: tags=arch:aarch64 + :avocado: tags=accel:tcg + :avocado: tags=cpu:cortex-a57 + :avocado: tags=machine:virt + """ + + # archive of file from https://deb.debian.org/debian/pool/main/x/xen/ + xen_url = ('https://fileserver.linaro.org/s/JSsewXGZ6mqxPr5/' + 'download?path=%2F&files=' + 'xen-hypervisor-4.14-arm64_4.14.0%2B80-gd101b417b7-1_arm64.deb') + xen_sha1 = 'b9d209dd689ed2b393e625303a225badefec1160' + xen_deb = self.fetch_asset(xen_url, asset_hash=xen_sha1) + xen_path = self.extract_from_deb(xen_deb, "/boot/xen-4.14-arm64") + + self.launch_xen(xen_path) + + def test_arm64_xen_415_and_dom0(self): + """ + :avocado: tags=arch:aarch64 + :avocado: tags=accel:tcg + :avocado: tags=cpu:cortex-a57 + :avocado: tags=machine:virt + """ + + xen_url = ('https://fileserver.linaro.org/' + 's/JSsewXGZ6mqxPr5/download' + '?path=%2F&files=xen-upstream-4.15-unstable.deb') + xen_sha1 = 'fc191172b85cf355abb95d275a24cc0f6d6579d8' + xen_deb = self.fetch_asset(xen_url, asset_hash=xen_sha1) + xen_path = self.extract_from_deb(xen_deb, "/boot/xen-4.15-unstable") + + self.launch_xen(xen_path)