From: Cornelia Huck <cohuck@redhat.com>
To: Elena Afanasova <eafanasova@gmail.com>
Cc: kvm@vger.kernel.org, stefanha@redhat.com, jag.raman@oracle.com,
elena.ufimtseva@oracle.com
Subject: Re: [RESEND RFC v2 1/4] KVM: add initial support for KVM_SET_IOREGION
Date: Mon, 8 Feb 2021 12:49:48 +0100 [thread overview]
Message-ID: <20210208124948.6e769151.cohuck@redhat.com> (raw)
In-Reply-To: <85cdd5d96b227ba64d333bff112c7900b6f14dea.camel@gmail.com>
On Fri, 05 Feb 2021 10:39:33 -0800
Elena Afanasova <eafanasova@gmail.com> wrote:
> On Thu, 2021-02-04 at 14:03 +0100, Cornelia Huck wrote:
> > On Fri, 29 Jan 2021 21:48:26 +0300
> > Elena Afanasova <eafanasova@gmail.com> wrote:
> > > @@ -1308,6 +1330,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)
> >
> > This new ioctl needs some documentation under
> > Documentation/virt/kvm/api.rst. (That would also make review easier.)
> >
> Agreed. The latest version of the ioregionfd API can be found in
> https://marc.info/?l=kvm&m=160633710708172&w=2. There are still some
> open questions like write coalescing support. So I think API may still
> be changed during code reviews.
Understood.
>
> > >
> > > /* enable ucontrol for s390 */
> > > struct kvm_s390_ucas_mapping {
> >
> > (...)
> >
> > > diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
> > > index c2323c27a28b..aadb73903f8b 100644
> > > --- a/virt/kvm/eventfd.c
> > > +++ b/virt/kvm/eventfd.c
> > > @@ -27,6 +27,7 @@
> > > #include <trace/events/kvm.h>
> > >
> > > #include <kvm/iodev.h>
> > > +#include "ioregion.h"
> > >
> > > #ifdef CONFIG_HAVE_KVM_IRQFD
> > >
> > > @@ -755,6 +756,23 @@ static const struct kvm_io_device_ops
> > > ioeventfd_ops = {
> > > .destructor = ioeventfd_destructor,
> > > };
> > >
> > > +#ifdef CONFIG_KVM_IOREGION
> > > +/* assumes kvm->slots_lock held */
> > > +bool kvm_eventfd_collides(struct kvm *kvm, int bus_idx,
> > > + u64 start, u64 size)
> > > +{
> > > + struct _ioeventfd *_p;
> > > +
> > > + list_for_each_entry(_p, &kvm->ioeventfds, list)
> > > + if (_p->bus_idx == bus_idx &&
> > > + overlap(start, size, _p->addr,
> > > + !_p->length ? 8 : _p->length))
> >
> > Not a problem right now, as this is x86 only, but I'm not sure we can
> > define "overlap" in a meaningful way for every bus_idx. (For example,
> > the s390-only ccw notifications use addr to identify a device; as
> > long
> > as addr is unique, there will be no clash. I'm not sure yet if
> > ioregions are usable for ccw devices, and if yes, in which form, but
> > we
> > should probably keep it in mind.)
> >
> Thank you for pointing it out. Yes, CCW bus seems to be a special case.
In any case, it needs some special care if we want to include it later,
maybe by introducing a bus-specific collision check. As long as we're
just dealing with pio/mmio, I think the function can stay this way.
next prev parent reply other threads:[~2021-02-08 11:54 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-28 18:32 [RFC v2 0/4] Introduce MMIO/PIO dispatch file descriptors (ioregionfd) Elena Afanasova
2021-01-28 18:32 ` [RFC v2 2/4] KVM: x86: add support for ioregionfd signal handling Elena Afanasova
2021-01-30 16:58 ` Stefan Hajnoczi
2021-02-03 14:00 ` Elena Afanasova
2021-02-09 6:21 ` Jason Wang
2021-02-09 14:49 ` Stefan Hajnoczi
2021-02-10 19:06 ` Elena Afanasova
2021-02-09 6:26 ` Jason Wang
2021-01-28 18:32 ` [RFC v2 3/4] KVM: add support for ioregionfd cmds/replies serialization Elena Afanasova
2021-01-30 18:54 ` Stefan Hajnoczi
2021-02-03 14:10 ` Elena Afanasova
2021-01-28 18:32 ` [RFC v2 4/4] KVM: enforce NR_IOBUS_DEVS limit if kmemcg is disabled Elena Afanasova
2021-01-29 18:48 ` [RESEND RFC v2 1/4] KVM: add initial support for KVM_SET_IOREGION Elena Afanasova
2021-01-30 15:04 ` Stefan Hajnoczi
2021-02-04 13:03 ` Cornelia Huck
2021-02-05 18:39 ` Elena Afanasova
2021-02-08 11:49 ` Cornelia Huck [this message]
2021-02-08 6:21 ` Jason Wang
2021-02-09 14:59 ` Stefan Hajnoczi
2021-02-18 6:17 ` Jason Wang
2021-02-10 19:31 ` Elena Afanasova
2021-02-11 14:59 ` Stefan Hajnoczi
2021-02-17 23:05 ` Elena Afanasova
2021-02-18 6:22 ` Jason Wang
2021-02-18 6:20 ` Jason Wang
2021-01-30 14:56 ` [RFC v2 0/4] Introduce MMIO/PIO dispatch file descriptors (ioregionfd) Stefan Hajnoczi
2021-02-02 14:59 ` Stefan Hajnoczi
2021-02-08 6:02 ` Jason Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210208124948.6e769151.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=eafanasova@gmail.com \
--cc=elena.ufimtseva@oracle.com \
--cc=jag.raman@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).