Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Feb 2025 09:55:50 +0100
From:      Roger Pau =?utf-8?B?TW9ubsOp?= <roger.pau@citrix.com>
To:        Subbsd <subbsd@gmail.com>
Cc:        freebsd-xen@freebsd.org
Subject:   Re: GPU Passthrough with FreeBSD/XEN port, status?
Message-ID:  <Z7RLFvJ10fnGmveg@macbook.local>
In-Reply-To: <CAFt_eMqyffUE_zjnY-bsOOET10cW-cDoyRVcpQTmb3Lu6Jvgig@mail.gmail.com>
References:  <CAFt_eMqyffUE_zjnY-bsOOET10cW-cDoyRVcpQTmb3Lu6Jvgig@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Feb 17, 2025 at 10:26:54PM +0300, Subbsd wrote:
> Hello,
> 
> Hello, This page ( https://wiki.xenproject.org/wiki/FreeBSD_Dom0 ) has
> been around for almost ten years and it contains the following phrase:
> 
> Shortcomings:
> // among others limitation //
> - Missing PCI Passthrough support (Xen/FreeBSD).
> 
> What are these limitations related to? As far as I know, Xen is a type
> 1 hypervisor and it seems that it should not depend very much on the
> Dom0 system, which is only a controller/manager.

The limitation is two fold.  First there's still no finished
passthrough support from a PVH dom0 in Xen itself.  Due to the much
different nature of a PV vs a PVH dom0 the interfaces used to do PCI
passthrogh from a PV dom0 are not usable as-is from a PVH dom0.
There's ongoing work to fix this (and it might indeed be fixed in the
next Xen release).

Secondly, PCI passthrough from a FreeBSD dom0 will need added support
in the Xen toolstack.  The current toolstack code that handle PCI
passthrough is for Linux only, as it for example requires sysfs to
manage devices.  Obviously something different will need to be done on
FreeBSD.

And last, the FreeBSD kernel itself will need an extra component
(called pciback on Linux) that serves as a catch-all driver for PCI
devices that are passed through (so that the driver in dom0 doesn't
bind to them), and also performs a device reset (FLR or otherwise)
between attempts to assign the device.

> What is the relationship between FreeBSD XEN port and Citrix?

Citrix uses FreeBSD in some of it's products, but there's no Citrix
product that uses a FreeBSD Xen PVH dom0.

> It is an
> *unofficial* port and therefore the chances of using GPU Passthrough
> with FreeBSD dom0 in the near future are minimal?

I think it's unlikely for Citrix to have interest in the above
use-case.  However that shouldn't prevent other members in the FreeBSD
community from working on it.  I'm happy to review any Xen or FreeBSD
patches.

> GPU Passthrough (and
> PCI devices in general) is a very popular thing in virtualization.
> It's very hard to say that Xen supports FreeBSD/Dom0, and at the same
> time basic things are missing for ten years ;-) Thanks!

IMO at the end of the day it boils down to whether there's a commercial
product that uses such features and can invest time and money into
implementing and maintaining the features.

Up until very recently (less than 1 year ago) the PVH dom0 code in Xen
itself was still considered experimental, and it probably wasn't used
in any Xen based appliances.  While most products based on Xen still
use a classic PV dom0, it seems there's some interest in getting the
missing features for PVH dom0 implemented upstream, so it has feature
parity with PV dom0.

For the FreeBSD side I can't possibly tell.  I think it will be hard
for me to find time in the near future (6 months) to work on FreeBSD PCI
passthrough support, and that would require that all the Xen code for
PVH dom0 PCI passthrough is finished.

Regards, Roger.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Z7RLFvJ10fnGmveg>