Re: [PATCH v2 01/24] drivers: hv: dxgkrnl: Driver initialization and creation of dxgadapter

From: Greg KH
Date: Sat Feb 05 2022 - 03:25:48 EST


On Fri, Feb 04, 2022 at 06:33:59PM -0800, Iouri Tarassov wrote:
> This is the first commit for adding support for a Hyper-V based
> vGPU implementation that exposes the DirectX API to Linux userspace.
>
> - Handle driver loading, registration for the PCI and VM bus device
> notifications
> - Add headers for user mode interfaces, internal driver objects and VM bus
> communication interface

Only add the interfaces for the changes that you need in this commit.
Do not add them all and then use them later, that makes it impossible to
review.

> - Handle initialization of VM bus channels and creation of the dxgadapter
> object
> - Connect the dxgkrnl module to the drivers/hv/ makefile and Kconfig.
> - Create a MAINTAINERS entry
>
> A PCI device is created for each virtual GPU (vGPU) device, projected by
> the host. The device vendor is PCI_VENDOR_ID_MICROSOFT and device id is
> PCI_DEVICE_ID_VIRTUAL_RENDER. dxg_pci_probe_device handles arrival of such
> devices and it creates dxgadapter objects. The PCI config space of the
> vGPU device has luid of the corresponding per GPU VM bus channel. This is
> how the adapters are linked to VM bus channels.
>
> A dxgadapter object represents a virtual GPU, projected to the VM by the
> host. This object can start functioning only when the global VM bus
> channel and the corresponding per vGPU VM bus channel are initialized in
> the guest. Notifications about arrival of vGPU PCI device and VM bus
> channels can happen in any order. Therefore, the initial dxgadapter object
> state is DXGADAPTER_STATE_WAITING_VMBUS. A list of VM bus channels and a
> list of dxgadapter objects are created. When dxgkrnl is notified about a
> VM bus channel arrival, if tries to start all adapters, which are not
> started yet.
>
> VM bus interface version is exchanged by reading/writing the PCI config
> space of the vGPU device.
>
> Signed-off-by: Iouri Tarassov <iourit@xxxxxxxxxxxxxxxxxxx>
> ---
> MAINTAINERS | 7 +
> drivers/hv/Kconfig | 2 +
> drivers/hv/Makefile | 1 +
> drivers/hv/dxgkrnl/Kconfig | 26 +
> drivers/hv/dxgkrnl/Makefile | 5 +
> drivers/hv/dxgkrnl/dxgadapter.c | 172 +++
> drivers/hv/dxgkrnl/dxgkrnl.h | 223 ++++
> drivers/hv/dxgkrnl/dxgmodule.c | 736 ++++++++++++
> drivers/hv/dxgkrnl/dxgprocess.c | 17 +
> drivers/hv/dxgkrnl/dxgvmbus.c | 578 +++++++++
> drivers/hv/dxgkrnl/dxgvmbus.h | 855 ++++++++++++++
> drivers/hv/dxgkrnl/hmgr.c | 23 +
> drivers/hv/dxgkrnl/hmgr.h | 75 ++
> drivers/hv/dxgkrnl/ioctl.c | 24 +
> drivers/hv/dxgkrnl/misc.c | 37 +
> drivers/hv/dxgkrnl/misc.h | 89 ++
> include/linux/hyperv.h | 16 +
> include/uapi/misc/d3dkmthk.h | 1945 +++++++++++++++++++++++++++++++
> 18 files changed, 4831 insertions(+)

Would you want to review a 4800 line patch all at once?

Please take some time and review other commits on the mailing list and
offer up your comments to them. That will help you understand how to
create your own changes better.

thanks,

greg k-h