From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1515C433EF for ; Mon, 20 Sep 2021 20:22:59 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2EA366121D for ; Mon, 20 Sep 2021 20:22:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2EA366121D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:54800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSPoX-00050C-QF for qemu-devel@archiver.kernel.org; Mon, 20 Sep 2021 16:22:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSPnI-00044L-4m; Mon, 20 Sep 2021 16:21:40 -0400 Received: from mail.csgraf.de ([85.25.223.15]:53646 helo=zulu616.server4you.de) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSPnE-00029a-GS; Mon, 20 Sep 2021 16:21:39 -0400 Received: from MacBook-Air.alex.local (dynamic-095-115-125-107.95.115.pool.telefonica.de [95.115.125.107]) by csgraf.de (Postfix) with ESMTPSA id 923B56080333; Mon, 20 Sep 2021 22:21:28 +0200 (CEST) Subject: Re: [PATCH v12 00/10] hvf: Implement Apple Silicon Support To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , Peter Maydell References: <20210916155404.86958-1-agraf@csgraf.de> From: Alexander Graf Message-ID: <27a265d5-2e7c-f234-0d09-f40a731e588d@csgraf.de> Date: Mon, 20 Sep 2021 22:21:28 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US Received-SPF: pass client-ip=85.25.223.15; envelope-from=agraf@csgraf.de; helo=zulu616.server4you.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, 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: Eduardo Habkost , Sergio Lopez , Richard Henderson , QEMU Developers , Cameron Esfahani , Roman Bolshakov , qemu-arm , Frank Yang , Paolo Bonzini , Peter Collingbourne Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 20.09.21 18:17, Philippe Mathieu-Daudé wrote: > On 9/20/21 15:15, Peter Maydell wrote: >> On Mon, 20 Sept 2021 at 11:11, Peter Maydell wrote: >>> On Thu, 16 Sept 2021 at 16:54, Alexander Graf wrote: >>>> Now that Apple Silicon is widely available, people are obviously excited >>>> to try and run virtualized workloads on them, such as Linux and Windows. >>>> >>>> This patch set implements a fully functional version to get the ball >>>> going on that. With this applied, I can successfully run both Linux and >>>> Windows as guests. I am not aware of any limitations specific to >>>> Hypervisor.framework apart from: >>>> >>>> - gdbstub debugging (breakpoints) >>>> - missing GICv3 support >>>> - Windows will not work due to UDEF SMC implementation >>>> >>>> To use hvf support, please make sure to run -M virt,highmem=off to fit >>>> in M1's physical address space limits and use -cpu host. >>> Applied to target-arm.next, thanks (with the unnecessary #include >>> in patch 6 removed). >> Turns out that the final patch breaks "make check-acceptance". >> All the orangepi boot tests timeout: >> >> (15/58) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi: >> INTERRUPTED: Test interrupted by SIGTERM\nRunner error occurred: >> Timeout reached\nOriginal status: ERROR\n{'name': >> '15-tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi', >> 'logdir': '/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/tests/... >> (90.24 s) >> (16/58) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi_initrd: >> INTERRUPTED: Test interrupted by SIGTERM\nRunner error occurred: >> Timeout reached\nOriginal status: ERROR\n{'name': >> '16-tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi_initrd', >> 'logdir': '/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang... >> (90.24 s) >> (17/58) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi_sd: >> INTERRUPTED: Test interrupted by SIGTERM\nRunner error occurred: >> Timeout reached\nOriginal status: ERROR\n{'name': >> '17-tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi_sd', >> 'logdir': '/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/tes... >> (90.24 s) > Works for me on x86_64 Fedora 34 built with > --enable-trace-backends=log --enable-debug: > > $ ./tests/venv/bin/avocado run > tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi > Fetching asset from > tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi > Fetching asset from > tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi_initrd > Fetching asset from > tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi_initrd > Fetching asset from > tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi_sd > Fetching asset from > tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi_sd > Fetching asset from > tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi_bionic_20_08 > Fetching asset from > tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi_uboot_netbsd9 > Fetching asset from > tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi_uboot_netbsd9 > JOB ID : b19f151f7320def3a432255f3a99c0dde3da95c0 > JOB LOG : > /home/phil/avocado/job-results/job-2021-09-20T18.12-b19f151/job.log > (1/5) > tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi: > PASS (6.29 s) > (2/5) > tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi_initrd: > PASS (51.23 s) > (3/5) > tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi_sd: > PASS (76.53 s) > (4/5) > tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi_bionic_20_08: > SKIP: storage limited > (5/5) > tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi_uboot_netbsd9: > SKIP: storage limited > RESULTS : PASS 3 | ERROR 0 | FAIL 0 | SKIP 2 | WARN 0 | INTERRUPT 0 | > CANCEL 0 > JOB TIME : 135.18 s > The OrangePi kernel goes into an endless loop here:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/compressed/head.S?h=v5.10#n637 The reason is simple: It tries to install its own HYP code using the old "install HYP handler, then invoke it" trick based on SPSR's indication that HYP is available, but fails to do so because HYP calls get handled by QEMU instead because the PSCI conduit is configured to HVC. The patch below seems to fix it for me. Please advise how you want to proceed. Alex diff --git a/hw/arm/allwinner-h3.c b/hw/arm/allwinner-h3.c index 27f1070145..f9b7ed1871 100644 --- a/hw/arm/allwinner-h3.c +++ b/hw/arm/allwinner-h3.c @@ -237,7 +237,7 @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp)          /* Provide Power State Coordination Interface */          qdev_prop_set_int32(DEVICE(&s->cpus[i]), "psci-conduit", -                            QEMU_PSCI_CONDUIT_HVC); +                            QEMU_PSCI_CONDUIT_SMC);          /* Disable secondary CPUs */          qdev_prop_set_bit(DEVICE(&s->cpus[i]), "start-powered-off",