public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Micah Morton <mortonm@chromium.org>
Cc: Alex Williamson <alex.williamson@redhat.com>,
	kvm@vger.kernel.org, jmattson@google.com
Subject: Re: [RFC PATCH] KVM: Add module for IRQ forwarding
Date: Thu, 14 May 2020 00:05:17 +0200	[thread overview]
Message-ID: <0fdb5d54-e4d6-8f2f-69fe-1b157999d6cd@redhat.com> (raw)
In-Reply-To: <CAJ-EccPjU0Lh5gEnr0L9AhuuJTad1yHX-BzzWq21m+e-vY-ELA@mail.gmail.com>

On 13/05/20 21:10, Micah Morton wrote:
> * If we only care about the bus controller existing (in an emulated
> fashion) enough for the guest to discover the device in question, this
> could work. I’m concerned that power management could be an issue here
> however. For instance, I have a touchscreen device assigned to the
> guest (irq forwarding done with this module) that in response to the
> screen being touched prepares the i2c controller for a transaction by
> calling into the PM system which end up writing to the PCI config
> space** (here https://elixir.bootlin.com/linux/v5.6.12/source/drivers/i2c/busses/i2c-designware-master.c#L435).
> It seems like this kind of scenario expands the scope of what would
> need to be supported by the emulated i2c controller, which is less
> ideal. The way I have it currently working, vfio-pci emulates the PCI
> config space so the guest can do power management by accessing that
> space.

This wouldn't be a problem.  When the emulated i2c controller starts a
transaction on th edevice, it will be performed by the host i2c
controller and this will lead to the same config space write.

I have another question: would it be possible to expose this IRQ through
/dev/i2c-* instead of messing with VFIO?

In fact, adding support for /dev/i2c passthrough to QEMU has long been a
pet idea of mine (my usecase was different though: the idea was to write
programs for a microcontroller on an ARM single board computer and run
them under QEMU in emulation mode).  It's not trivial, because there
could be some impedence mismatch between the guest (which might be
programmed against a low-level controller or might even do bit banging)
and the i2c-dev interface which is more high level.  Also QEMU cannot do
clock stretching right now.  However, it's certainly doable.

>> (Finally, in the past we were doing device assignment tasks within KVM
>> and it was a bad idea.  Anything you want to do within KVM with respect
>> to device assignment, someone else will want to do it from bare metal.
> 
> Are you saying people would want to use this in non-virtualized
> scenarios like running drivers in userspace without any VMM/guest? And
> they could do that if this was part of VFIO and not part of KVM?

Yes, see above for an example.

Paolo


  reply	other threads:[~2020-05-13 22:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 22:00 [RFC PATCH] KVM: Add module for IRQ forwarding Micah Morton
2020-05-12 17:14 ` Alex Williamson
2020-05-13  7:02   ` Paolo Bonzini
2020-05-13 14:34     ` Alex Williamson
2020-05-13 15:23       ` Paolo Bonzini
2020-05-13 19:10         ` Micah Morton
2020-05-13 22:05           ` Paolo Bonzini [this message]
2020-05-14 17:44             ` Micah Morton
2020-05-14 21:17               ` Paolo Bonzini
2020-05-14 22:43                 ` Alex Williamson
2020-05-15 20:30                   ` Micah Morton
2020-06-03 18:23                     ` [PATCH] vfio: PoC patch for printing IRQs used by i2c devices Micah Morton
2020-06-09 20:19                       ` Micah Morton
2020-06-19 18:51                         ` Alex Williamson
2020-06-19 20:00                           ` Micah Morton
2020-06-22 21:59                             ` Micah Morton
2020-05-15 10:11               ` [RFC PATCH] KVM: Add module for IRQ forwarding Auger Eric
2020-05-15 16:39                 ` Micah Morton
2020-05-13 21:52     ` Micah Morton

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=0fdb5d54-e4d6-8f2f-69fe-1b157999d6cd@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=mortonm@chromium.org \
    /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