Re: [PATCH kvmtool 00/21] arm64: Handle PSCI calls in userspace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Oliver,

On Fri, May 26, 2023 at 10:16:51PM +0000, Oliver Upton wrote:
> The 6.4 kernel picks up support for a generalized SMCCC filter, allowing
> userspace to select hypercall ranges that should be forwarded to
> userspace. This is a shameless attempt of making future SMCCC interfaces
> the responsibility of userspace :)
> 
> As a starting point, let's move PSCI up into userspace. KVM already
> leans on userspace for handling calls that have a system-wide effect.
> 
> Tested on linux-next with a 64 vCPU VM. Additionally, I took a stab at
> running kvm-unit-test's psci test, which passes.

I applied these patches to kvmtool and tested 6.4, however they don't work
with an SVE enabled kernel/device.

# ./lkvm run -c 2 -m 4 -k psci.flat                                                                                                                                                
INFO: psci: PSCI version 1.0                                                                                                                                                         
PASS: psci: invalid-function                                                                                                                                                         
PASS: psci: affinity-info-on                                                                                                                                                         
PASS: psci: affinity-info-off                                                                                                                                                        
  Error: KVM_ARM_VCPU_FINALIZE: Operation not permitted                                                                                                                              
  Fatal: Unable to configure requested vcpu features 

`kvm_cpu__configure_features` in kvmtool is failing because Linux returns an
error if SVE was already finalised (arch/arm64/kvm/reset.c):

```
int kvm_arm_vcpu_finalize(struct kvm_vcpu *vcpu, int feature)
{
        switch (feature) {
        case KVM_ARM_VCPU_SVE:
                if (!vcpu_has_sve(vcpu))
                        return -EINVAL;

                if (kvm_arm_vcpu_sve_finalized(vcpu))
                        return -EPERM; // <---- returns here

                return kvm_vcpu_finalize_sve(vcpu);
        }

        return -EINVAL;
}
```

It's not immediately obvious to me why finalising SVE twice is an error.
Changing that to `return 0;` gets the test passing, but not sure if there
are other implications.

I also booted with `arm64.nosve` and the test passed.

Thanks,
Joey



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux