[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 09/21] hw/vfio/pci: Convert CONFIG_KVM check to runtime on
From: |
Eric Auger |
Subject: |
Re: [PATCH v2 09/21] hw/vfio/pci: Convert CONFIG_KVM check to runtime one |
Date: |
Mon, 10 Mar 2025 15:53:13 +0100 |
User-agent: |
Mozilla Thunderbird |
Hi,
On 3/10/25 1:54 PM, BALATON Zoltan wrote:
> On Mon, 10 Mar 2025, Eric Auger wrote:
>> Hi Philippe,
>>
>> On 3/9/25 12:09 AM, Philippe Mathieu-Daudé wrote:
>>> Use the runtime kvm_enabled() helper to check whether
>>> KVM is available or not.
>>
>> Miss the "why" of this patch.
>>
>> By the way I fail to remember/see where kvm_allowed is set.
>
> It's in include/system/kvm.h
There you can only find the kvm_enabled() macro definition.
I was eventually able to locate it:
accel/accel-system.c: *(acc->allowed) = true;
in accel_init_machine()
>
>> I am also confused because we still have some code, like in
>> vfio/common.c which does both checks:
>> #ifdef CONFIG_KVM
>> if (kvm_enabled()) {
>> max_memslots = kvm_get_max_memslots();
>> }
>> #endif
>
> I think this is because if KVM is not available the if cannot be true
> so it can be left out altogether. This may make sense on platforms
> like Windows and macOS where QEMU is compiled without KVM so basically
> everywhere except Linux.
But in practice we have a stub for kvm_get_max_memslots in
accel/stubs/kvm-stub.c.
Eric
>
> Regards,
> BALATON Zoltan