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=-5.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 A22FAC433DB for ; Thu, 11 Feb 2021 13:57:17 +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 973ED64DEE for ; Thu, 11 Feb 2021 13:57:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 973ED64DEE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lACT5-0003V8-4l for qemu-devel@archiver.kernel.org; Thu, 11 Feb 2021 08:57:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lABg1-0006Ws-Lr; Thu, 11 Feb 2021 08:06:35 -0500 Received: from mail.csgraf.de ([85.25.223.15]:41118 helo=zulu616.server4you.de) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lABfz-00038J-2g; Thu, 11 Feb 2021 08:06:33 -0500 Received: from Alexanders-Mac-mini.local (unknown [188.138.100.120]) by csgraf.de (Postfix) with UTF8SMTPSA id 6F4066080F87; Thu, 11 Feb 2021 14:06:27 +0100 (CET) Message-ID: <37018444-82a8-96c0-b5ce-da056646a1b8@csgraf.de> Date: Thu, 11 Feb 2021 14:06:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:86.0) Gecko/20100101 Thunderbird/86.0 Subject: Re: [PATCH v6 07/11] hvf: Add Apple Silicon support Content-Language: en-US To: Peter Maydell References: <20210120224444.71840-1-agraf@csgraf.de> <20210120224444.71840-8-agraf@csgraf.de> <298dcf49-1a99-9406-275f-b05c8befd13b@csgraf.de> From: Alexander Graf In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=85.25.223.15; envelope-from=agraf@csgraf.de; helo=zulu616.server4you.de X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.119, 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 , 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 10.02.21 23:39, Peter Maydell wrote: > On Wed, 10 Feb 2021 at 22:21, Alexander Graf wrote: >> >> On 28.01.21 16:52, Peter Maydell wrote: >>> On Wed, 20 Jan 2021 at 22:44, Alexander Graf wrote: >>>> + break; >>>> + case EC_AA64_SMC: >>>> + cpu_synchronize_state(cpu); >>>> + if (arm_is_psci_call(arm_cpu, EXCP_SMC)) { >>>> + arm_handle_psci_call(arm_cpu); >>> Have you checked that all the PSCI code really can cope >>> with being called from a non-TCG accelerator? (As an example >>> the CPU_SUSPEND implementation calls the TCG wfi helper...) >> >> I have not explicitly tried it, but I don't see why the TCG >> implementation of wfi should in principle break with hvf. > Because the TCG implementation of wfi is "set some state fields > and then longjump out to the TCG exec_cpu code-execution loop", > and hvf doesn't use that loop. I can confirm that it breaks, but are you really sure about the longjmp not working? What would you prefer instead? Duplicate the PSCI implementation for HVF? > >>>> + } else { >>>> + DPRINTF("unknown SMC! %016llx", env->xregs[0]); >>>> + env->xregs[0] = -1; >>> This should inject an UNDEF exception into the guest. (Compare >>> the pre_smc helper in target/arm/op_helper.c for TCG.) >> >> That would break Windows, which is one of the main use cases for hvf >> support in QEMU. > Why is Windows making bogus SMC calls ? Let me have a quick at my crystal ball ... mmmmmmhhhh ... it's a bit blurry unfortunately. I really don't think I'm the right person to answer that question :). But the Windows loader does invoke weird SMC calls on boot: BdsDxe: starting Boot0002 "UEFI QEMU NVMe Ctrl 1234 1" from PciRoot(0x0)/Pci(0x1,0x0)/NVMe(0x1,00-00-00-00-00-00-00-00) ConvertPages: failed to find range 102000 - 102FFF ConvertPages: range BCCE4000 - BCD05FFF covers multiple entries ConvertPages: range BCCE0000 - BCCEAFFF covers multiple entries hvf_unknown_smc unknown SMC! 00000000c3000001 SetUefiImageMemoryAttributes - 0x00000000BF500000 - 0x0000000000040000 (0x0000000000000008) SetUefiImageMemoryAttributes - 0x00000000BC190000 - 0x0000000000040000 (0x0000000000000008) SetUefiImageMemoryAttributes - 0x00000000BC140000 - 0x0000000000040000 (0x0000000000000008) SetUefiImageMemoryAttributes - 0x00000000BF4C0000 - 0x0000000000030000 (0x0000000000000008) SetUefiImageMemoryAttributes - 0x00000000BC0F0000 - 0x0000000000040000 (0x0000000000000008) SetUefiImageMemoryAttributes - 0x00000000BBCB0000 - 0x0000000000040000 (0x0000000000000008) SetUefiImageMemoryAttributes - 0x00000000BBB00000 - 0x0000000000030000 (0x0000000000000008) SetUefiImageMemoryAttributes - 0x00000000BBAC0000 - 0x0000000000030000 (0x0000000000000008) hvf_unknown_smc unknown SMC! 0000000084000000 hvf_unknown_smc unknown SMC! 000000008400000a hvf_unknown_smc unknown SMC! 000000008400000a hvf_unknown_smc unknown SMC! 000000008400000a hvf_unknown_smc unknown SMC! 000000008400000a hvf_unknown_smc unknown SMC! 000000008400000a hvf_unknown_smc unknown SMC! 000000008400000a hvf_unknown_smc unknown SMC! 000000008400000a hvf_unknown_smc unknown SMC! 000000008400000a hvf_unknown_smc unknown SMC! 000000008400000a hvf_unknown_smc unknown SMC! 000000008400000a Alex