qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@csgraf.de>
To: Roman Bolshakov <r.bolshakov@yadro.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org, Cameron Esfahani <dirty@apple.com>,
	qemu-arm@nongnu.org, Frank Yang <lfy@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Peter Collingbourne <pcc@google.com>
Subject: Re: [PATCH v3 06/10] hvf: Add Apple Silicon support
Date: Thu, 3 Dec 2020 15:26:33 +0100	[thread overview]
Message-ID: <78852f5f-c0d0-fcba-e69d-cbbeca057fc0@csgraf.de> (raw)
In-Reply-To: <20201203052156.GB82480@SPB-NB-133.local>


On 03.12.20 06:21, Roman Bolshakov wrote:
> On Wed, Dec 02, 2020 at 08:04:04PM +0100, Alexander Graf wrote:
>> With Apple Silicon available to the masses, it's a good time to add support
>> for driving its virtualization extensions from QEMU.
>>
>> This patch adds all necessary architecture specific code to get basic VMs
>> working. It's still pretty raw, but definitely functional.
>>
> That's very cool, Alex!
>
>> [...]
>> diff --git a/accel/hvf/hvf-cpus.c b/accel/hvf/hvf-cpus.c
>> index a423f629d5..e613c22ad0 100644
>> --- a/accel/hvf/hvf-cpus.c
>> +++ b/accel/hvf/hvf-cpus.c
>> @@ -60,6 +60,10 @@
>>   
>>   #include <Hypervisor/Hypervisor.h>
>>   
> On an older laptop with 10.15 I've noticed this causes a build failure.
> Here's layout of Hypervisor.framework on 10.15:
>
>   Hypervisor.framework find .
>   .
>   ./Versions
>   ./Versions/A
>   ./Versions/A/Hypervisor.tbd
>   ./Versions/A/Headers
>   ./Versions/A/Headers/hv_arch_vmx.h
>   ./Versions/A/Headers/hv_error.h
>   ./Versions/A/Headers/hv_types.h
>   ./Versions/A/Headers/hv.h
>   ./Versions/A/Headers/hv_arch_x86.h
>   ./Versions/A/Headers/hv_vmx.h
>   ./Versions/Current
>   ./module.map
>   ./Hypervisor.tbd
>   ./Headers
>
> The issue also exists in another patch in the series:
>    "hvf: Move common code out"


Ugh, I'll try and see if I can dig out a 10.15 machine somewhere.


>
>> +#ifdef __aarch64__
>> +#define HV_VM_DEFAULT NULL
>> +#endif
>> +
> I don't see if it's used anywhere.


It's used in hv_vm_create() as argument. The enum that contains it is 
hidden behind an #ifdef __x86_64__ in HVF though.


>
>>   /* Memory slots */
>>   
>>   struct mac_slot {
>> [...]
>>
> Side question. I have very little knowledge of ARM but it seems much
> leaner compared to x86 trap/emulation layer. Is it a consequence of
> load/store architecture and it's expected to be that small on ARM?


It's multiple things coming together. Early in the virtualization days 
of KVM on ARM, we decided that KVM would only support MMIO for 
instructions that hardware predecodes on exception. That seems to have 
trickled down into basically all relevant OSs these days, so you can run 
Linux, *BSD and Windows just fine without handling any instructions that 
are not already predecoded for you.

This in turn means you don't need an instruction emulator, which is most 
of the complexity on the x86 hvf code.


> I have only noticed MMIO, system registers (access to them apparently
> leads to a trap), kick and PSCI traps (which sounds somewhat similar to
> Intel MPSpec/APIC) and no system instruction traps (except WFI in the
> next patch).


System Registers are a bit tricky. Some of them lead to traps (as you've 
seen), others do not and instead read/write shadow registers directly. 
For those, we need to do the register sync.

But yes, there is little to handle for an ARM guest. I was positively 
surprised as well. To be fair though, most of the complexity in KVM ARM 
code comes from vGIC (not available on M1), debug registers (not handled 
here yet), PMU multiplexing (not handled) and stage2 page table 
maintenance (done by HVF). We just wiggle ourselves out of those.


Alex




  reply	other threads:[~2020-12-03 14:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-02 19:03 [PATCH v3 00/10] hvf: Implement Apple Silicon Support Alexander Graf
2020-12-02 19:03 ` [PATCH v3 01/10] hvf: Add hypervisor entitlement to output binaries Alexander Graf
2020-12-02 23:32   ` Roman Bolshakov
2020-12-02 19:04 ` [PATCH v3 02/10] hvf: Move common code out Alexander Graf
2020-12-03  0:20   ` Roman Bolshakov
2020-12-02 19:04 ` [PATCH v3 03/10] hvf: Introduce hvf vcpu struct Alexander Graf
2020-12-03  0:41   ` Roman Bolshakov
2020-12-02 19:04 ` [PATCH v3 04/10] arm: Set PSCI to 0.2 for HVF Alexander Graf
2020-12-03  1:03   ` Roman Bolshakov
2020-12-02 19:04 ` [PATCH v3 05/10] hvf: arm: Mark CPU as dirty on reset Alexander Graf
2020-12-03  1:52   ` Roman Bolshakov
2020-12-03 10:55     ` Alexander Graf
2020-12-03 13:02       ` Roman Bolshakov
2020-12-03 14:13         ` Alexander Graf
2020-12-02 19:04 ` [PATCH v3 06/10] hvf: Add Apple Silicon support Alexander Graf
2020-12-03  5:21   ` Roman Bolshakov
2020-12-03 14:26     ` Alexander Graf [this message]
2020-12-02 19:04 ` [PATCH v3 07/10] arm: Add Hypervisor.framework build target Alexander Graf
2020-12-03  5:25   ` Roman Bolshakov
2020-12-02 19:04 ` [PATCH v3 08/10] arm/hvf: Add a WFI handler Alexander Graf
2020-12-03 10:39   ` Roman Bolshakov
2020-12-03 18:18     ` Peter Collingbourne
2020-12-04 18:15       ` Roman Bolshakov
2020-12-02 19:04 ` [PATCH v3 09/10] hvf: arm: Add support for GICv3 Alexander Graf
2020-12-02 19:04 ` [PATCH v3 10/10] hvf: arm: Implement -cpu host Alexander Graf
2020-12-02 19:27 ` [PATCH v3 00/10] hvf: Implement Apple Silicon Support no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=78852f5f-c0d0-fcba-e69d-cbbeca057fc0@csgraf.de \
    --to=agraf@csgraf.de \
    --cc=dirty@apple.com \
    --cc=ehabkost@redhat.com \
    --cc=lfy@google.com \
    --cc=pbonzini@redhat.com \
    --cc=pcc@google.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=r.bolshakov@yadro.com \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).