Hi Quentin, On Tue, 2025-02-11 at 16:29 +0000, Quentin Perret wrote:> On Tuesday 11 Feb 2025 at 16:17:25 (+0000), Fuad Tabba wrote: >> Hi Quentin, >> >> On Tue, 11 Feb 2025 at 16:12, Quentin Perret <qperret@xxxxxxxxxx> wrote: >>> >>> Hi Fuad, >>> >>> On Tuesday 11 Feb 2025 at 12:11:25 (+0000), Fuad Tabba wrote: >>>> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h >>>> index 117937a895da..f155d3781e08 100644 >>>> --- a/include/uapi/linux/kvm.h >>>> +++ b/include/uapi/linux/kvm.h >>>> @@ -652,6 +652,12 @@ struct kvm_enable_cap { >>>> #define KVM_VM_TYPE_ARM_IPA_SIZE_MASK 0xffULL >>>> #define KVM_VM_TYPE_ARM_IPA_SIZE(x) \ >>>> ((x) & KVM_VM_TYPE_ARM_IPA_SIZE_MASK) >>>> + >>>> +#define KVM_VM_TYPE_ARM_SW_PROTECTED (1UL << 9) >>> >>> FWIW, the downstream Android code has used bit 31 since forever >>> for that. >>> >>> Although I very much believe that upstream should not care about the >>> downstream mess in general, in this particular instance bit 9 really >>> isn't superior in any way, and there's a bunch of existing userspace >>> code that uses bit 31 today as we speak. It is very much Android's >>> problem to update these userspace programs if we do go with bit 9 >>> upstream, but I don't really see how that would benefit upstream >>> either. >>> >>> So, given that there is no maintenance cost for upstream to use bit 31 >>> instead of 9, I'd vote for using bit 31 and ease the landing with >>> existing userspace code, unless folks are really opinionated with this >>> stuff :) >> >> My thinking is that this bit does _not_ mean pKVM. It means an >> experimental software VM that is similar to the x86 >> KVM_X86_SW_PROTECTED_VM. Hence why I didn't choose bit 31. >> >> From Documentation/virt/kvm/api.rst (for x86): >> >> ''' >> Note, KVM_X86_SW_PROTECTED_VM is currently only for development and testing. >> Do not use KVM_X86_SW_PROTECTED_VM for "real" VMs, and especially not in >> production. The behavior and effective ABI for software-protected VMs is >> unstable. >> ''' >> >> which is similar to the documentation I added here. > > Aha, I see, but are we going to allocate _another_ bit for protected VMs > proper once they're supported? Or just update the doc for the existing > bit? If the latter, then I guess this discussion can still happen :) I was hoping that SW_PROTECTED_VM will be the VM type that something like Firecracker could use, e.g. an interface to guest_memfd specifically _without_ pKVM, as Fuad was saying. > Thanks, > Quentin Best, Patrick