|
From: | Paolo Bonzini |
Subject: | Re: [PATCH v15 15/60] i386/xen: add pc_machine_kvm_type to initialize XEN_EMULATE mode |
Date: | Fri, 10 Mar 2023 09:52:48 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 |
On 3/10/23 09:28, David Woodhouse wrote:
On Fri, 2023-03-10 at 11:15 +0800, Xiaoyao Li wrote:On 3/1/2023 9:51 PM, David Woodhouse wrote:From: David Woodhouse <dwmw@amazon.co.uk> The xen_overlay device (and later similar devices for event channels and grant tables) need to be instantiated. Do this from a kvm_type method on the PC machine derivatives, since KVM is only way to support Xen emulation for now.Just curious, isn't there any more reasonable place to add machine specific initialization? abusing the mc->kvm_type() looks bad to me.Hm, good question. Off the top of my head I have no better answer than "Paolo made me do it": https://lore.kernel.org/qemu-devel/8495140d-3301-7693-b804-0554166802da@redhat.com/ But I have gained a bit more clue since December, and reading that message again I'll put a lot more focus on the fact that he said "during mc->kvm_type OR AFTERWARDS".
I don't think this is abusing mc->kvm_type; that is the point where startup code tells the machine "now you have your accelerator configuration, do what you want with that info". In fact I find using xen_enabled() in mc->kvm_type to be less ugly than having a MachineClass entry just for KVM. :)
But, if you want to move it to pc_basic_device_init() that is certainly okay too. It's not like people are going to add TCG/Xen support tomorrow but it is a tiny step in the direction of less accelerator-specific code for Xen emulation.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |