public inbox for linux-hyperv@vger.kernel.org
 help / color / mirror / Atom feed
* VFIO support on hyperv (vfio_pci_core_ioctl())
@ 2026-02-25 22:04 Mukesh R
  2026-02-27 19:29 ` Alex Williamson
  0 siblings, 1 reply; 3+ messages in thread
From: Mukesh R @ 2026-02-25 22:04 UTC (permalink / raw)
  To: alex; +Cc: kvm, wei.liu@kernel.org, linux-hyperv@vger.kernel.org

Hi Alex et al:

I've been looking at making pci passthru irq setup/remap work on hyperv
for the latest (6.19) version using vfio core. Unfortunately, it's just
not fitting well because in case of hyperv the irq remap is done by
the hypervisor. Specifically, for a robust and proper solution, we need
to override vfio_pci_set_msi_trigger(). As such, for the best way forward
I am trying to figure how much flexibility there is to modify
vfio_pci_intrs.c with "if (running_on_hyperv())" branches (putting hyperv
code in separate file).

If none, then the alternative would be to create vfio-hyperv.c with
vfio_device_ops.ioctl = hyperv_vfio_pci_core_ioctl(). But, then I'd
be replicating code for other sub ioctls like vfio_pci_ioctl_get_info(),
vfio_pci_ioctl_get_irq_info(), etc. Would it be acceptable to make them
non static in this case?

Please let me know your thoughts or if you have other suggestions.

Thanks,
-Mukesh

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: VFIO support on hyperv (vfio_pci_core_ioctl())
  2026-02-25 22:04 VFIO support on hyperv (vfio_pci_core_ioctl()) Mukesh R
@ 2026-02-27 19:29 ` Alex Williamson
  2026-02-27 20:06   ` Mukesh R
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Williamson @ 2026-02-27 19:29 UTC (permalink / raw)
  To: Mukesh R; +Cc: kvm, wei.liu@kernel.org, linux-hyperv@vger.kernel.org, alex

On Wed, 25 Feb 2026 14:04:49 -0800
Mukesh R <mrathor@linux.microsoft.com> wrote:

> Hi Alex et al:
> 
> I've been looking at making pci passthru irq setup/remap work on hyperv
> for the latest (6.19) version using vfio core. Unfortunately, it's just
> not fitting well because in case of hyperv the irq remap is done by
> the hypervisor. Specifically, for a robust and proper solution, we need
> to override vfio_pci_set_msi_trigger(). As such, for the best way forward
> I am trying to figure how much flexibility there is to modify
> vfio_pci_intrs.c with "if (running_on_hyperv())" branches (putting hyperv
> code in separate file).
> 
> If none, then the alternative would be to create vfio-hyperv.c with
> vfio_device_ops.ioctl = hyperv_vfio_pci_core_ioctl(). But, then I'd
> be replicating code for other sub ioctls like vfio_pci_ioctl_get_info(),
> vfio_pci_ioctl_get_irq_info(), etc. Would it be acceptable to make them
> non static in this case?
> 
> Please let me know your thoughts or if you have other suggestions.

Hi Mukesh,

In general, littering the code with running_on_hyperv() tests is not
acceptable, but the presented alternative isn't really accurate either.
If you want to substitute in your own ioctl callback, you can still
call vfio_pci_core_ioctl() for all the unhandled ioctls, without extra
exports.  We can also look at whether vfio_pci_device_ops could have a
callback specifically addressing an alternative set_msi_trigger
handler.  Thanks,

Alex

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: VFIO support on hyperv (vfio_pci_core_ioctl())
  2026-02-27 19:29 ` Alex Williamson
@ 2026-02-27 20:06   ` Mukesh R
  0 siblings, 0 replies; 3+ messages in thread
From: Mukesh R @ 2026-02-27 20:06 UTC (permalink / raw)
  To: Alex Williamson; +Cc: kvm, wei.liu@kernel.org, linux-hyperv@vger.kernel.org

On 2/27/26 11:29, Alex Williamson wrote:
> On Wed, 25 Feb 2026 14:04:49 -0800
> Mukesh R <mrathor@linux.microsoft.com> wrote:
> 
>> Hi Alex et al:
>>
>> I've been looking at making pci passthru irq setup/remap work on hyperv
>> for the latest (6.19) version using vfio core. Unfortunately, it's just
>> not fitting well because in case of hyperv the irq remap is done by
>> the hypervisor. Specifically, for a robust and proper solution, we need
>> to override vfio_pci_set_msi_trigger(). As such, for the best way forward
>> I am trying to figure how much flexibility there is to modify
>> vfio_pci_intrs.c with "if (running_on_hyperv())" branches (putting hyperv
>> code in separate file).
>>
>> If none, then the alternative would be to create vfio-hyperv.c with
>> vfio_device_ops.ioctl = hyperv_vfio_pci_core_ioctl(). But, then I'd
>> be replicating code for other sub ioctls like vfio_pci_ioctl_get_info(),
>> vfio_pci_ioctl_get_irq_info(), etc. Would it be acceptable to make them
>> non static in this case?
>>
>> Please let me know your thoughts or if you have other suggestions.
> 
> Hi Mukesh,
> 
> In general, littering the code with running_on_hyperv() tests is not
> acceptable, but the presented alternative isn't really accurate either.
> If you want to substitute in your own ioctl callback, you can still
> call vfio_pci_core_ioctl() for all the unhandled ioctls, without extra

Yes, I realized that after looking at how other callers were using it.

> exports.  We can also look at whether vfio_pci_device_ops could have a
> callback specifically addressing an alternative set_msi_trigger
> handler.  Thanks,

Sounds good. thanks as always,
-Mukesh


> Alex


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-27 20:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-25 22:04 VFIO support on hyperv (vfio_pci_core_ioctl()) Mukesh R
2026-02-27 19:29 ` Alex Williamson
2026-02-27 20:06   ` Mukesh R

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox