qemu-ppc
[Top][All Lists]
Advanced

[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: Philippe Mathieu-Daudé
Subject: Re: [PATCH v2 09/21] hw/vfio/pci: Convert CONFIG_KVM check to runtime one
Date: Tue, 11 Mar 2025 09:54:44 +0100
User-agent: Mozilla Thunderbird

On 10/3/25 13:54, 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.

In accel/accel-system.c:

    int accel_init_machine(AccelState *accel, MachineState *ms)
    {
        AccelClass *acc = ACCEL_GET_CLASS(accel);
        int ret;
        ms->accelerator = accel;
        *(acc->allowed) = true;
        ret = acc->init_machine(ms);
        if (ret < 0) {
            ms->accelerator = NULL;
            *(acc->allowed) = false;
            object_unref(OBJECT(accel));
        } else {
            object_set_accelerator_compat_props(acc->compat_props);
        }
        return ret;
    }


It's in include/system/kvm.h

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

We should prefer kvm_enabled() over CONFIG_KVM, but for kvm_enabled()
we need the prototypes declared, which sometimes aren't.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]