Re: [RFC v3 1/5] KVM: add initial support for KVM_SET_IOREGION

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

 



On Tue, Mar 09, 2021 at 01:26:48PM +0800, Jason Wang wrote:
> On 2021/2/21 8:04 下午, Elena Afanasova wrote:
> > @@ -1308,6 +1332,7 @@ struct kvm_vfio_spapr_tce {
> >   					struct kvm_userspace_memory_region)
> >   #define KVM_SET_TSS_ADDR          _IO(KVMIO,   0x47)
> >   #define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO,  0x48, __u64)
> > +#define KVM_SET_IOREGION          _IOW(KVMIO,  0x49, struct kvm_ioregion)
> 
> 
> I wonder how could we extend ioregion fd in the future? Do we need something
> like handshake or version here?

The struct kvm_ioregion->flags field can be used to enable optional
features. KVM capabilities can be used to test the presence of optional
features. This might be enough.

A different approach to extensibility is a sizeof(struct kvm_ioregion)
field for arbitrary extensions to the struct.

> > +static int
> > +kvm_set_ioregion(struct kvm *kvm, struct kvm_ioregion *args)
> > +{
> > +	int ret;
> > +
> > +	enum kvm_bus bus_idx = get_bus_from_flags(args->flags);
> > +
> > +	/* check for range overflow */
> > +	if (args->guest_paddr + args->memory_size < args->guest_paddr)
> > +		return -EINVAL;
> > +	/* If size is ignored only posted writes are allowed */
> > +	if (!args->memory_size && !(args->flags & KVM_IOREGION_POSTED_WRITES))
> 
> 
> We don't have flags like KVM_IOREGION_POSTED_WRITES for ioeventfd. Is this a
> must?

There is no way to trigger a FAST_MMIO read. Guest accesses, including
memory loads, appear as writes.

Stefan

Attachment: signature.asc
Description: PGP signature


[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