* [PATCH v2] LoongArch: KVM: Advertise already-supported capabilities
@ 2026-08-05 5:45 Tao Cui
2026-08-06 11:50 ` Bibo Mao
2026-08-09 4:06 ` Huacai Chen
0 siblings, 2 replies; 5+ messages in thread
From: Tao Cui @ 2026-08-05 5:45 UTC (permalink / raw)
To: zhaotianrui, maobibo
Cc: chenhuacai, kernel, kvm, loongarch, linux-kernel, cui.tao
Several LoongArch KVM features are fully implemented but were never
reported through their standard KVM_CHECK_EXTENSION probes, so userspace
cannot discover them. Advertise the ones that already work and have a
real consumer:
- KVM_CAP_STEAL_TIME: steal time works end-to-end (host-side record
plus guest paravirt side), and the probe returns kvm_pvtime_supported().
- KVM_CAP_VCPU_ATTRIBUTES: per-vCPU device-attribute ioctls are
implemented (CPUCFG, PVTIME control); advertise the discovery cap.
This adds no new functionality; it only makes existing features
discoverable via the standard probe.
Signed-off-by: Tao Cui <cui.tao@linux.dev>
---
Changes in v2:
- Drop KVM_CAP_IRQFD_RESAMPLE: the only consumer is VFIO INTx, which
needs IOMMU/VFIO not yet available on LoongArch.
- Drop KVM_CAP_VM_GPA_BITS: the cap implies a GPA-width setter that
LoongArch does not implement.
arch/loongarch/kvm/vm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/loongarch/kvm/vm.c b/arch/loongarch/kvm/vm.c
index 1317c718f896..0a51931d6f6e 100644
--- a/arch/loongarch/kvm/vm.c
+++ b/arch/loongarch/kvm/vm.c
@@ -122,6 +122,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
case KVM_CAP_IOEVENTFD:
case KVM_CAP_MP_STATE:
case KVM_CAP_SET_GUEST_DEBUG:
+ case KVM_CAP_VCPU_ATTRIBUTES:
r = 1;
break;
case KVM_CAP_NR_VCPUS:
@@ -136,6 +137,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
case KVM_CAP_NR_MEMSLOTS:
r = KVM_USER_MEM_SLOTS;
break;
+ case KVM_CAP_STEAL_TIME:
+ r = kvm_pvtime_supported();
+ break;
default:
r = 0;
break;
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] LoongArch: KVM: Advertise already-supported capabilities
2026-08-05 5:45 [PATCH v2] LoongArch: KVM: Advertise already-supported capabilities Tao Cui
@ 2026-08-06 11:50 ` Bibo Mao
2026-08-09 4:06 ` Huacai Chen
1 sibling, 0 replies; 5+ messages in thread
From: Bibo Mao @ 2026-08-06 11:50 UTC (permalink / raw)
To: Tao Cui, zhaotianrui; +Cc: chenhuacai, kernel, kvm, loongarch, linux-kernel
On 2026/8/5 下午1:45, Tao Cui wrote:
> Several LoongArch KVM features are fully implemented but were never
> reported through their standard KVM_CHECK_EXTENSION probes, so userspace
> cannot discover them. Advertise the ones that already work and have a
> real consumer:
>
> - KVM_CAP_STEAL_TIME: steal time works end-to-end (host-side record
> plus guest paravirt side), and the probe returns kvm_pvtime_supported().
>
> - KVM_CAP_VCPU_ATTRIBUTES: per-vCPU device-attribute ioctls are
> implemented (CPUCFG, PVTIME control); advertise the discovery cap.
>
> This adds no new functionality; it only makes existing features
> discoverable via the standard probe.
>
> Signed-off-by: Tao Cui <cui.tao@linux.dev>
> ---
> Changes in v2:
> - Drop KVM_CAP_IRQFD_RESAMPLE: the only consumer is VFIO INTx, which
> needs IOMMU/VFIO not yet available on LoongArch.
> - Drop KVM_CAP_VM_GPA_BITS: the cap implies a GPA-width setter that
> LoongArch does not implement.
>
> arch/loongarch/kvm/vm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/loongarch/kvm/vm.c b/arch/loongarch/kvm/vm.c
> index 1317c718f896..0a51931d6f6e 100644
> --- a/arch/loongarch/kvm/vm.c
> +++ b/arch/loongarch/kvm/vm.c
> @@ -122,6 +122,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> case KVM_CAP_IOEVENTFD:
> case KVM_CAP_MP_STATE:
> case KVM_CAP_SET_GUEST_DEBUG:
> + case KVM_CAP_VCPU_ATTRIBUTES:
> r = 1;
> break;
> case KVM_CAP_NR_VCPUS:
> @@ -136,6 +137,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> case KVM_CAP_NR_MEMSLOTS:
> r = KVM_USER_MEM_SLOTS;
> break;
> + case KVM_CAP_STEAL_TIME:
> + r = kvm_pvtime_supported();
> + break;
> default:
> r = 0;
> break;
>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] LoongArch: KVM: Advertise already-supported capabilities
2026-08-05 5:45 [PATCH v2] LoongArch: KVM: Advertise already-supported capabilities Tao Cui
2026-08-06 11:50 ` Bibo Mao
@ 2026-08-09 4:06 ` Huacai Chen
2026-08-10 4:08 ` Tao Cui
1 sibling, 1 reply; 5+ messages in thread
From: Huacai Chen @ 2026-08-09 4:06 UTC (permalink / raw)
To: Tao Cui; +Cc: zhaotianrui, maobibo, kernel, kvm, loongarch, linux-kernel
Applied, thanks.
Huacai
On Wed, Aug 5, 2026 at 1:46 PM Tao Cui <cui.tao@linux.dev> wrote:
>
> Several LoongArch KVM features are fully implemented but were never
> reported through their standard KVM_CHECK_EXTENSION probes, so userspace
> cannot discover them. Advertise the ones that already work and have a
> real consumer:
>
> - KVM_CAP_STEAL_TIME: steal time works end-to-end (host-side record
> plus guest paravirt side), and the probe returns kvm_pvtime_supported().
>
> - KVM_CAP_VCPU_ATTRIBUTES: per-vCPU device-attribute ioctls are
> implemented (CPUCFG, PVTIME control); advertise the discovery cap.
>
> This adds no new functionality; it only makes existing features
> discoverable via the standard probe.
>
> Signed-off-by: Tao Cui <cui.tao@linux.dev>
> ---
> Changes in v2:
> - Drop KVM_CAP_IRQFD_RESAMPLE: the only consumer is VFIO INTx, which
> needs IOMMU/VFIO not yet available on LoongArch.
> - Drop KVM_CAP_VM_GPA_BITS: the cap implies a GPA-width setter that
> LoongArch does not implement.
>
> arch/loongarch/kvm/vm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/loongarch/kvm/vm.c b/arch/loongarch/kvm/vm.c
> index 1317c718f896..0a51931d6f6e 100644
> --- a/arch/loongarch/kvm/vm.c
> +++ b/arch/loongarch/kvm/vm.c
> @@ -122,6 +122,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> case KVM_CAP_IOEVENTFD:
> case KVM_CAP_MP_STATE:
> case KVM_CAP_SET_GUEST_DEBUG:
> + case KVM_CAP_VCPU_ATTRIBUTES:
> r = 1;
> break;
> case KVM_CAP_NR_VCPUS:
> @@ -136,6 +137,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> case KVM_CAP_NR_MEMSLOTS:
> r = KVM_USER_MEM_SLOTS;
> break;
> + case KVM_CAP_STEAL_TIME:
> + r = kvm_pvtime_supported();
> + break;
> default:
> r = 0;
> break;
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] LoongArch: KVM: Advertise already-supported capabilities
2026-08-09 4:06 ` Huacai Chen
@ 2026-08-10 4:08 ` Tao Cui
2026-08-10 6:03 ` Huacai Chen
0 siblings, 1 reply; 5+ messages in thread
From: Tao Cui @ 2026-08-10 4:08 UTC (permalink / raw)
To: Huacai Chen; +Cc: zhaotianrui, maobibo, kernel, kvm, loongarch, linux-kernel
Hi, Huacai
I missed my Signed-off-by tag for this patch, my mistake.
Could you append:
Signed-off-by: Tao Cui <cuitao@kylinos.cn>
If it’s not workable, no problem at all.
于 2026年8月9日 GMT+08:00 12:06:36,Huacai Chen <chenhuacai@kernel.org> 写道:
>Applied, thanks.
>
>Huacai
>
>On Wed, Aug 5, 2026 at 1:46 PM Tao Cui <cui.tao@linux.dev> wrote:
>>
>> Several LoongArch KVM features are fully implemented but were never
>> reported through their standard KVM_CHECK_EXTENSION probes, so userspace
>> cannot discover them. Advertise the ones that already work and have a
>> real consumer:
>>
>> - KVM_CAP_STEAL_TIME: steal time works end-to-end (host-side record
>> plus guest paravirt side), and the probe returns kvm_pvtime_supported().
>>
>> - KVM_CAP_VCPU_ATTRIBUTES: per-vCPU device-attribute ioctls are
>> implemented (CPUCFG, PVTIME control); advertise the discovery cap.
>>
>> This adds no new functionality; it only makes existing features
>> discoverable via the standard probe.
>>
>> Signed-off-by: Tao Cui <cui.tao@linux.dev>
>> ---
>> Changes in v2:
>> - Drop KVM_CAP_IRQFD_RESAMPLE: the only consumer is VFIO INTx, which
>> needs IOMMU/VFIO not yet available on LoongArch.
>> - Drop KVM_CAP_VM_GPA_BITS: the cap implies a GPA-width setter that
>> LoongArch does not implement.
>>
>> arch/loongarch/kvm/vm.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/arch/loongarch/kvm/vm.c b/arch/loongarch/kvm/vm.c
>> index 1317c718f896..0a51931d6f6e 100644
>> --- a/arch/loongarch/kvm/vm.c
>> +++ b/arch/loongarch/kvm/vm.c
>> @@ -122,6 +122,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
>> case KVM_CAP_IOEVENTFD:
>> case KVM_CAP_MP_STATE:
>> case KVM_CAP_SET_GUEST_DEBUG:
>> + case KVM_CAP_VCPU_ATTRIBUTES:
>> r = 1;
>> break;
>> case KVM_CAP_NR_VCPUS:
>> @@ -136,6 +137,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
>> case KVM_CAP_NR_MEMSLOTS:
>> r = KVM_USER_MEM_SLOTS;
>> break;
>> + case KVM_CAP_STEAL_TIME:
>> + r = kvm_pvtime_supported();
>> + break;
>> default:
>> r = 0;
>> break;
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] LoongArch: KVM: Advertise already-supported capabilities
2026-08-10 4:08 ` Tao Cui
@ 2026-08-10 6:03 ` Huacai Chen
0 siblings, 0 replies; 5+ messages in thread
From: Huacai Chen @ 2026-08-10 6:03 UTC (permalink / raw)
To: Tao Cui; +Cc: zhaotianrui, maobibo, kernel, kvm, loongarch, linux-kernel
On Mon, Aug 10, 2026 at 12:08 PM Tao Cui <cui.tao@linux.dev> wrote:
>
> Hi, Huacai
>
> I missed my Signed-off-by tag for this patch, my mistake.
> Could you append:
> Signed-off-by: Tao Cui <cuitao@kylinos.cn>
> If it’s not workable, no problem at all.
Corrected.
Huacai
>
> 于 2026年8月9日 GMT+08:00 12:06:36,Huacai Chen <chenhuacai@kernel.org> 写道:
> >Applied, thanks.
> >
> >Huacai
> >
> >On Wed, Aug 5, 2026 at 1:46 PM Tao Cui <cui.tao@linux.dev> wrote:
> >>
> >> Several LoongArch KVM features are fully implemented but were never
> >> reported through their standard KVM_CHECK_EXTENSION probes, so userspace
> >> cannot discover them. Advertise the ones that already work and have a
> >> real consumer:
> >>
> >> - KVM_CAP_STEAL_TIME: steal time works end-to-end (host-side record
> >> plus guest paravirt side), and the probe returns kvm_pvtime_supported().
> >>
> >> - KVM_CAP_VCPU_ATTRIBUTES: per-vCPU device-attribute ioctls are
> >> implemented (CPUCFG, PVTIME control); advertise the discovery cap.
> >>
> >> This adds no new functionality; it only makes existing features
> >> discoverable via the standard probe.
> >>
> >> Signed-off-by: Tao Cui <cui.tao@linux.dev>
> >> ---
> >> Changes in v2:
> >> - Drop KVM_CAP_IRQFD_RESAMPLE: the only consumer is VFIO INTx, which
> >> needs IOMMU/VFIO not yet available on LoongArch.
> >> - Drop KVM_CAP_VM_GPA_BITS: the cap implies a GPA-width setter that
> >> LoongArch does not implement.
> >>
> >> arch/loongarch/kvm/vm.c | 4 ++++
> >> 1 file changed, 4 insertions(+)
> >>
> >> diff --git a/arch/loongarch/kvm/vm.c b/arch/loongarch/kvm/vm.c
> >> index 1317c718f896..0a51931d6f6e 100644
> >> --- a/arch/loongarch/kvm/vm.c
> >> +++ b/arch/loongarch/kvm/vm.c
> >> @@ -122,6 +122,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> >> case KVM_CAP_IOEVENTFD:
> >> case KVM_CAP_MP_STATE:
> >> case KVM_CAP_SET_GUEST_DEBUG:
> >> + case KVM_CAP_VCPU_ATTRIBUTES:
> >> r = 1;
> >> break;
> >> case KVM_CAP_NR_VCPUS:
> >> @@ -136,6 +137,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> >> case KVM_CAP_NR_MEMSLOTS:
> >> r = KVM_USER_MEM_SLOTS;
> >> break;
> >> + case KVM_CAP_STEAL_TIME:
> >> + r = kvm_pvtime_supported();
> >> + break;
> >> default:
> >> r = 0;
> >> break;
> >>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-10 6:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-05 5:45 [PATCH v2] LoongArch: KVM: Advertise already-supported capabilities Tao Cui
2026-08-06 11:50 ` Bibo Mao
2026-08-09 4:06 ` Huacai Chen
2026-08-10 4:08 ` Tao Cui
2026-08-10 6:03 ` Huacai Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®