Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] KVM_CAP_PPC_COMPAT_CAPS advertises capability support on all pseries hosts, but the KVM_PPC_GET_COMPAT_CAPS ioctl fails with -EINVAL on non-nestedv2 pseries hosts.
--
--- Patch [2]: [PATCH v9 2/4] KVM: PPC: Book3S HV: Implement compat CPU capability retrieval for KVM on PowerVM ---
commit 48012da6c0966da1bf70f356cb9a87c22af64308
Author: Amit Machhiwal <[email protected]>
KVM: PPC: Book3S HV: Implement compat CPU capability retrieval for KVM on PowerVM
This commit adds support for retrieving host CPU compatibility capabilities
for nested guests on PowerVM via a new ioctl, KVM_PPC_GET_COMPAT_CAPS. It
retrieves the cached capabilities negotiated via the H_GUEST_GET_CAPABILITIES
hcall for nestedv2 systems.
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 61dbeea317f3b..8799124b80960 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
[ ... ]
> @@ -6510,6 +6510,25 @@ static bool kvmppc_hash_v3_possible(void)
> return true;
> }
>
> +
> +static int kvmppc_get_compat_caps(struct kvm_ppc_compat_caps *host_caps)
> +{
> + unsigned long capabilities = 0;
> + long rc = -EINVAL;
> +
> + if (kvmhv_on_pseries()) {
> + if (kvmhv_is_nestedv2()) {
> + WARN_ON_ONCE(!nested_capabilities);
> + capabilities = nested_capabilities;
> + rc = 0;
> + }
> + }
> +
[Severity: High]
KVM_CAP_PPC_COMPAT_CAPS appears to be advertised for all pseries hosts in
kvm_vm_ioctl_check_extension():
case KVM_CAP_PPC_COMPAT_CAPS:
r = 0;
if (hv_enabled && kvmhv_on_pseries())
r = 1;
break;
But here in kvmppc_get_compat_caps(), the ioctl returns -EINVAL for
non-nestedv2 pseries hosts.
Will this mismatch cause userspace (like QEMU) to fail during guest
initialization if it sees the capability is supported on a non-nestedv2
host, but the ioctl unexpectedly fails with -EINVAL?
> + host_caps->compat_capabilities = capabilities & KVM_PPC_COMPAT_BITMASK;
> +
> + return rc;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.