IGD assign原理是什么?

从事GPU assign多年,在intel工程师刚开始搞kvmgt的时候我就在关注GPU assign的技术。现在vfio mdev都集成进linux kernel了,时间过得真快。有时候我在问自己,你对GPU assign,GPU share assign的相关技术原理真的了解吗?当年intel,redhat工程师在maillist讨论未来GPU share assign的架构的时候,我看的一头雾水。现在回过头来看,是不是有新的认识了?

/*

* Intel IGD support

*

* Obviously IGD is not a discrete device, this is evidenced not only by it

显然IGD与普通的显卡不同,首先,它是集成在CPU里面的,其次,不同的chipset,不同的BIOS会给IGD带来不同的依赖。

* being integrated into the CPU, but by the various chipset and BIOS

* dependencies that it brings along with it.  Intel is trying to move away

Intel想摆脱这种局面,所以为IGD搞了一个UPT模式(Universal Pass-Through),Broadwell及以上版本的芯片都支持这种模式。

* from this and Broadwell and newer devices can run in what Intel calls

* "Universal Pass-Through" mode, or UPT.  Theoretically in UPT mode, nothing

理论上,以UPT模式透传IGD给VM是不需要做任何特殊处理的,当然有好就有坏,UPT模式有很多局限性,在这种模式下,IGD只能当副显卡,而且不支持任何物理输出。


下面的代码是为了实现IGD的legacy mode assignment,在这种模式下IGD保留最全的物理模式下的功能。为了开启这个功能,IGD在VM上的pci地址一定要是00:02.0,IGD一定要有ROM,我们肯定希望IGD支持VGA,这样VM BIOS就需要保留一些内存,填入一些需要的页表,我们还需要调整revisions,IDs,LPC/ISA bridge。上面这些工作,都是为了让IGD assign在正确的VM PCI bus address。

最新消息,在UPT模式下还是可以支持物理输出的,只需要提供OpRegion table。默认是不打开这个功能的,因为有可能OpRegion已经有了,然而并没有连接物理显示器,或者没有OpRegion,然而物理显示器又有。总之,想要物理输出,就需要OpRegion。

/*

* This presumes the device is already known to be an Intel VGA device, so we

* take liberties in which device ID bits match which generation.  This should

* not be taken as an indication that all the devices are supported, or even

* supportable, some of them don't even support VT-d.

* See linux:include/drm/i915_pciids.h for IDs.

*/

GPU虚拟化现在主流方案就三种:

1 API Forwarding:Virtio GPU,这种是半虚拟化方案,Guest OS中运行Front Driver,Host OS运行Backend Driver,中间通过virtio传输API请求。

2 Direct Pass-through:GPU assign,

3 Mediated Pass-through : Intel GVT-g,

等我好好构思一下应该怎么写!

你可能感兴趣的:(IGD assign原理是什么?)