Skip to contentSkip to conversation

drivers: hv: Microsoft Virtual GPU Driver

PATCH NAK Sasha Levin 5 participants 27 messages Aug 14, 2020 – Sep 4, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover drivers: hv: Microsoft Virtual GPU Driver

This is a follow-up on the RFC sent a few months back[1].

Changes since the RFC:

- Move to drivers/hv/
- Address comments from Greg KH
- Misc device initialization
- Remove typedefs/variable defines
- Use the kernel's ioctl declarations
- Clean up random code bugs.

[1] https://lore.kernel.org/lkml/[email protected]/

Sasha Levin (4):
drivers: hv: dxgkrnl: core code
drivers: hv: dxgkrnl: hook up dxgkrnl
drivers: hv: vmbus: hook up dxgkrnl
drivers: hv: dxgkrnl: create a MAINTAINERS entry

 MAINTAINERS                     |    7 +
 drivers/hv/Kconfig              |    2 +
 drivers/hv/Makefile             |    1 +
 drivers/hv/dxgkrnl/Kconfig      |   10 +
 drivers/hv/dxgkrnl/Makefile     |   12 +
 drivers/hv/dxgkrnl/d3dkmthk.h   | 1636 ++++++++++
 drivers/hv/dxgkrnl/dxgadapter.c | 1406 ++++++++
 drivers/hv/dxgkrnl/dxgkrnl.h    |  927 ++++++
 drivers/hv/dxgkrnl/dxgmodule.c  |  656 ++++
 drivers/hv/dxgkrnl/dxgprocess.c |  357 ++
 drivers/hv/dxgkrnl/dxgvmbus.c   | 3084 ++++++++++++++++++
 drivers/hv/dxgkrnl/dxgvmbus.h   |  873 +++++
 drivers/hv/dxgkrnl/hmgr.c       |  604 ++++
 drivers/hv/dxgkrnl/hmgr.h       |  112 +
 drivers/hv/dxgkrnl/ioctl.c      | 5413 +++++++++++++++++++++++++++++++
 drivers/hv/dxgkrnl/misc.c       |  279 ++
 drivers/hv/dxgkrnl/misc.h       |  309 ++
 include/linux/hyperv.h          |   16 +
 18 files changed, 15704 insertions(+)
 create mode 100644 drivers/hv/dxgkrnl/Kconfig
 create mode 100644 drivers/hv/dxgkrnl/Makefile
 create mode 100644 drivers/hv/dxgkrnl/d3dkmthk.h
 create mode 100644 drivers/hv/dxgkrnl/dxgadapter.c
 create mode 100644 drivers/hv/dxgkrnl/dxgkrnl.h
 create mode 100644 drivers/hv/dxgkrnl/dxgmodule.c
 create mode 100644 drivers/hv/dxgkrnl/dxgprocess.c
 create mode 100644 drivers/hv/dxgkrnl/dxgvmbus.c
 create mode 100644 drivers/hv/dxgkrnl/dxgvmbus.h
 create mode 100644 drivers/hv/dxgkrnl/hmgr.c
 create mode 100644 drivers/hv/dxgkrnl/hmgr.h
 create mode 100644 drivers/hv/dxgkrnl/ioctl.c
 create mode 100644 drivers/hv/dxgkrnl/misc.c
 create mode 100644 drivers/hv/dxgkrnl/misc.h
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/4 drivers: hv: dxgkrnl: core code

Add support for a Hyper-V based vGPU implementation that exposes the DirectX API to Linux userspace.

---
 drivers/hv/dxgkrnl/Kconfig      |   10 +
 drivers/hv/dxgkrnl/Makefile     |   12 +
 drivers/hv/dxgkrnl/d3dkmthk.h   | 1636 ++++++++++
 drivers/hv/dxgkrnl/dxgadapter.c | 1406 ++++++++
 drivers/hv/dxgkrnl/dxgkrnl.h    |  927 ++++++
 drivers/hv/dxgkrnl/dxgmodule.c  |  656 ++++
 drivers/hv/dxgkrnl/dxgprocess.c |  357 ++
 drivers/hv/dxgkrnl/dxgvmbus.c   | 3084 ++++++++++++++++++
 drivers/hv/dxgkrnl/dxgvmbus.h   |  873 +++++
 drivers/hv/dxgkrnl/hmgr.c       |  604 ++++
 drivers/hv/dxgkrnl/hmgr.h       |  112 +
 drivers/hv/dxgkrnl/ioctl.c      | 5413 +++++++++++++++++++++++++++++++
 drivers/hv/dxgkrnl/misc.c       |  279 ++
 drivers/hv/dxgkrnl/misc.h       |  309 ++
 14 files changed, 15678 insertions(+)
 create mode 100644 drivers/hv/dxgkrnl/Kconfig
 create mode 100644 drivers/hv/dxgkrnl/Makefile
 create mode 100644 drivers/hv/dxgkrnl/d3dkmthk.h
 create mode 100644 drivers/hv/dxgkrnl/dxgadapter.c
 create mode 100644 drivers/hv/dxgkrnl/dxgkrnl.h
 create mode 100644 drivers/hv/dxgkrnl/dxgmodule.c
 create mode 100644 drivers/hv/dxgkrnl/dxgprocess.c
 create mode 100644 drivers/hv/dxgkrnl/dxgvmbus.c
 create mode 100644 drivers/hv/dxgkrnl/dxgvmbus.h
 create mode 100644 drivers/hv/dxgkrnl/hmgr.c
 create mode 100644 drivers/hv/dxgkrnl/hmgr.h
 create mode 100644 drivers/hv/dxgkrnl/ioctl.c
 create mode 100644 drivers/hv/dxgkrnl/misc.c
 create mode 100644 drivers/hv/dxgkrnl/misc.h
drivers/hv/dxgkrnl/Kconfig new file +10 -0
new file mode 100644
index 000000000000..8bfec781b9a7
@@ -0,0 +1,10 @@
+#
+# dxgkrnl configuration
+#
+
+config DXGKRNL
+	tristate "Microsoft virtual GPU support"
+	depends on HYPERV
+	help
+	  This driver supports Microsoft virtual GPU.
+
drivers/hv/dxgkrnl/Makefile new file +12 -0
new file mode 100644
index 000000000000..11505a153d9d
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0
+# Makefile for the Linux video drivers.
+# 5 Aug 1999, James Simmons, <mailto:[email protected]>
+# Rewritten to use lists instead of if-statements.
+
+# Each configuration option enables a list of files.
+
+# Uncomment to enable printing debug messages by default
+#ccflags-y := -DDEBUG
+
+obj-$(CONFIG_DXGKRNL)	+= dxgkrnl.o
+dxgkrnl-y		:= dxgmodule.o hmgr.o misc.o dxgadapter.o ioctl.o dxgvmbus.o dxgprocess.o
drivers/hv/dxgkrnl/d3dkmthk.h new file +1636 -0

1,636 lines not on this page · raw message

drivers/hv/dxgkrnl/dxgadapter.c new file +1406 -0

1,342 lines not on this page · raw message

drivers/hv/dxgkrnl/dxgkrnl.h new file +927 -0

927 lines not on this page · raw message

drivers/hv/dxgkrnl/dxgmodule.c new file +656 -0

656 lines not on this page · raw message

drivers/hv/dxgkrnl/dxgprocess.c new file +357 -0

357 lines not on this page · raw message

drivers/hv/dxgkrnl/dxgvmbus.c new file +3084 -0

3,084 lines not on this page · raw message

drivers/hv/dxgkrnl/dxgvmbus.h new file +873 -0

873 lines not on this page · raw message

drivers/hv/dxgkrnl/hmgr.c new file +604 -0

604 lines not on this page · raw message

drivers/hv/dxgkrnl/hmgr.h new file +112 -0

112 lines not on this page · raw message

drivers/hv/dxgkrnl/ioctl.c new file +5413 -0

5,413 lines not on this page · raw message

drivers/hv/dxgkrnl/misc.c new file +279 -0

279 lines not on this page · raw message

drivers/hv/dxgkrnl/misc.h new file +309 -0

309 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.25.1

Part of the diff is not shown here. View the raw message.

#2 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

Quoted 4 lines · Sasha Levin

Add support for a Hyper-V based vGPU implementation that exposes the DirectX API to Linux userspace.

Better, but what is this mess:

Quoted 1 line

+#define ISERROR(ret) (ret < 0)

?

Quoted 1 line

+#define EINTERNALERROR EINVAL

And that?

drivers/hv/dxgkrnl/misc.h line 231

Quoted 3 lines
drivers/hv/dxgkrnl/misc.h new file +3 -0
+
+#define DXGKRNL_ASSERT(exp)
+#define UNUSED(x) (void)(x)

Ick, no, please.

Quoted 1 line

+#undef pr_fmt

In a .h file?

drivers/hv/dxgkrnl/misc.h line 236

Quoted 3 lines
drivers/hv/dxgkrnl/misc.h new file +3 -0
+#define pr_fmt(fmt)	"dxgk:err: " fmt
+#define pr_fmt1(fmt)	"dxgk: " fmt
+#define pr_fmt2(fmt)	"dxgk:    " fmt

Why?

drivers/hv/dxgkrnl/misc.h line 245

Quoted 9 lines
drivers/hv/dxgkrnl/misc.h new file +9 -0
+
+#define DXGKDEBUG 1
+/* #define USEPRINTK 1 */
+
+#ifndef DXGKDEBUG
+#define TRACE_DEBUG(...)
+#define TRACE_DEFINE(...)
+#define TRACE_FUNC_ENTER(...)
+#define TRACE_FUNC_EXIT(...)

No, please do not to custom "trace" printk messages, that is what ftrace is for, no individual driver should ever need to do that.

Just use the normal dev_*() calls for error messages and the like, do not try to come up with a custom tracing framework for one tiny individual driver. If every driver in kernel did that, we would have a nightmare...

thanks,

greg k-h

#3 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

Quoted 9 lines · Greg KH
Quoted 4 lines · Sasha Levin

Add support for a Hyper-V based vGPU implementation that exposes the DirectX API to Linux userspace.

Better, but what is this mess:

Quoted 1 line

+#define ISERROR(ret) (ret < 0)

The VM bus messages return the NTSTATUS error code from the host. NTSTATUS is integer and the positive values indicate success.
The success error code needs to be returned by IOCTLs to the DxCore applications. The ISERROR() macro is used in places where the NTSTATUS success code could be returned from a function. "if (ret)" cannot be used. I will add a comment to the macro in the next patch.

Quoted 4 lines

?

Quoted 1 line

+#define EINTERNALERROR EINVAL

This macro will be removed in the next patch

Quoted 5 lines

And that?

drivers/hv/dxgkrnl/misc.h line 231

Quoted 3 lines
drivers/hv/dxgkrnl/misc.h new file +3 -0
+
+#define DXGKRNL_ASSERT(exp)
+#define UNUSED(x) (void)(x)

The UNUSED macro will be removed.
The DXGKRNL_ASSERT() macro will be changed to generate a memory dump and BUG_ON when DXGDEBUG is enabled. It is used to catch internal errors in the debug code. There will be no bugcheck in the released driver.

Quoted 10 lines

Ick, no, please.

Quoted 1 line

+#undef pr_fmt

In a .h file?

drivers/hv/dxgkrnl/misc.h line 236

Quoted 3 lines
drivers/hv/dxgkrnl/misc.h new file +3 -0
+#define pr_fmt(fmt)	"dxgk:err: " fmt
+#define pr_fmt1(fmt)	"dxgk: " fmt
+#define pr_fmt2(fmt)	"dxgk:    " fmt

This will be fixed in the next patch set.

Quoted 15 lines

Why?

drivers/hv/dxgkrnl/misc.h line 245

Quoted 9 lines
drivers/hv/dxgkrnl/misc.h new file +9 -0
+
+#define DXGKDEBUG 1
+/* #define USEPRINTK 1 */
+
+#ifndef DXGKDEBUG
+#define TRACE_DEBUG(...)
+#define TRACE_DEFINE(...)
+#define TRACE_FUNC_ENTER(...)
+#define TRACE_FUNC_EXIT(...)

No, please do not to custom "trace" printk messages, that is what ftrace is for, no individual driver should ever need to do that.

Quoted 4 lines

Just use the normal dev_*() calls for error messages and the like, do not try to come up with a custom tracing framework for one tiny individual driver. If every driver in kernel did that, we would have a nightmare...

I understand the concern. This will be fixed later when we learn and pick the final tracing technology for the driver. The current implementation allows the hardware vendors to quickly identify issues without learning about ftrace. They just need to enable the WSL debug console and mount debugfs.

Quoted 4 lines

thanks,

greg k-h

Thank you for your time and good comments.
Iouri

#4 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

Quoted 8 lines · Iouri Tarassov
Quoted 7 lines · Greg KH
Quoted 3 lines · Sasha Levin

Add support for a Hyper-V based vGPU implementation that exposes the DirectX API to Linux userspace.

Quoted 1 line

Better, but what is this mess:

Quoted 8 lines
Quoted 1 line
Quoted 1 line

+#define ISERROR(ret) (ret < 0)

The VM bus messages return the NTSTATUS error code from the host. NTSTATUS is integer and the positive values indicate success.
The success error code needs to be returned by IOCTLs to the DxCore applications. The ISERROR() macro is used in places where the NTSTATUS success code could be returned from a function. "if (ret)" cannot be used. I will add a comment to the macro in the next patch.

No, please just "open code" this, there is no need for a macro that is actually more characters than the original test.

Quoted 12 lines
Quoted 12 lines

drivers/hv/dxgkrnl/misc.h line 245

Quoted 8 lines
drivers/hv/dxgkrnl/misc.h new file +8 -0
+#define DXGKDEBUG 1
+/* #define USEPRINTK 1 */
+
+#ifndef DXGKDEBUG
+#define TRACE_DEBUG(...)
+#define TRACE_DEFINE(...)
+#define TRACE_FUNC_ENTER(...)
+#define TRACE_FUNC_EXIT(...)

No, please do not to custom "trace" printk messages, that is what ftrace is for, no individual driver should ever need to do that.

Quoted 6 lines
Quoted 4 lines

Just use the normal dev_*() calls for error messages and the like, do not try to come up with a custom tracing framework for one tiny individual driver. If every driver in kernel did that, we would have a nightmare...

I understand the concern. This will be fixed later when we learn and pick the final tracing technology for the driver.

When is "later"? We don't want to review something that you do not think is ready to be merged, do it now so we don't trip over things that you know you want to fix up.

Quoted 4 lines

The current implementation
allows the hardware vendors to quickly identify issues without learning about ftrace. They just need to enable the WSL debug console and mount debugfs.

Hardware vendors who know Linux already know about ftrace, don't make people have to read up and learn about custom ways to debug just-your-tiny-individual-driver. Instead follow the customs and ways the _WHOLE_ kernel works, that is just polite, don't you think?

thanks,

greg k-h

#5 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

In reply to Sasha Levin
Quoted 2 lines · Sasha Levin

Add support for a Hyper-V based vGPU implementation that exposes the DirectX API to Linux userspace.

Api questions:

drivers/hv/dxgkrnl/misc.h line 61

Quoted 6 lines
drivers/hv/dxgkrnl/misc.h new file +6 -0
+struct d3dkmthandle {
+	union {
+		struct {
+			u32 instance	:  6;
+			u32 index	: 24;
+			u32 unique	: 2;

What is the endian of this?

Quoted 4 lines
drivers/hv/dxgkrnl/misc.h new file +4 -0
+		};
+		u32 v;
+	};
+};

drivers/hv/dxgkrnl/misc.h line 75

Quoted 10 lines
drivers/hv/dxgkrnl/misc.h new file +10 -0
+
+extern const struct d3dkmthandle zerohandle;
+
+struct ntstatus {
+	union {
+		struct {
+			int code	: 16;
+			int facility	: 13;
+			int customer	: 1;
+			int severity	: 2;

Same here.

Are these things that cross the user/kernel boundry?

And why int on one and u32 on the other?

drivers/hv/dxgkrnl/misc.h line 83

Quoted 8 lines
drivers/hv/dxgkrnl/misc.h new file +8 -0
+		};
+		int v;
+	};
+};
+
+struct winluid {
+	uint a;
+	uint b;

And now uint? Come on, be consistent please :)

thanks,

greg k-h

#6 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

Quoted 15 lines · Greg KH
Quoted 2 lines · Sasha Levin

Add support for a Hyper-V based vGPU implementation that exposes the DirectX API to Linux userspace.

Api questions:

drivers/hv/dxgkrnl/misc.h line 61

Quoted 6 lines
drivers/hv/dxgkrnl/misc.h new file +6 -0
+struct d3dkmthandle {
+	union {
+		struct {
+			u32 instance	:  6;
+			u32 index	: 24;
+			u32 unique	: 2;

What is the endian of this?

Quoted 7 lines

drivers/hv/dxgkrnl/misc.h line 68

Quoted 7 lines
drivers/hv/dxgkrnl/misc.h new file +7 -0
+		};
+		u32 v;
+	};
+};
+
+extern const struct d3dkmthandle zerohandle;
+

The definition is the same as on the Windows side. The driver communicates with a Windows host, so I do not expect any issues with endiannes. Windows currently runs only on the little endian platforms.
User mode applications see this as an opaque 32 bit value (D3DKMTHANDLE). I prefer not to use the u32 definition to avoid mistakes when another integer or a 64-bit handle is assigned to the handle or  the handle is assigned to a 64 or 32 bit integer variable. There are many handles in the driver model (shared NT handle, d3dkmthandle, etc). Using a specific type allows to avoid assigning one handle to another.

Quoted 12 lines

drivers/hv/dxgkrnl/misc.h line 75

Quoted 7 lines
drivers/hv/dxgkrnl/misc.h new file +7 -0
+struct ntstatus {
+	union {
+		struct {
+			int code	: 16;
+			int facility	: 13;
+			int customer	: 1;
+			int severity	: 2;

Same here.

Are these things that cross the user/kernel boundry?

Quoted 7 lines

And why int on one and u32 on the other?

drivers/hv/dxgkrnl/misc.h line 80

Quoted 5 lines
drivers/hv/dxgkrnl/misc.h new file +5 -0
+		};
+		int v;
+	};
+};
+

"struct ntstatus" follows the definition for NTSTATUS on the Windows side. NTSTATUS is an integer where the negative values indicate errors. It is success otherwise. NTSTATUS is returned by the VM bus messages from host. IOCTLs from the driver return Linux negative error code or NTSTATUS positive success codes. DxCore applications expect certain positive success codes. DxCore is a shared library, which translates the D3DKMT* Windows interface to Linux ioctls. Applications link with DxCore to use a paravirtualized GPU. D3DKMTHANDLE is a 32-bit unsigned value (bitfield), not an integer.

Quoted 5 lines

drivers/hv/dxgkrnl/misc.h line 83

Quoted 3 lines
drivers/hv/dxgkrnl/misc.h new file +3 -0
+struct winluid {
+	uint a;
+	uint b;

And now uint? Come on, be consistent please :)

Sorry about this. This came from the Windows size where we use UINT a lot. All uints will be replaced by u32 in the next patch set.

Quoted 5 lines

thanks,

greg k-h

Thank you
Iouri

#7 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

Quoted 17 lines · Iouri Tarassov
Quoted 15 lines · Greg KH
Quoted 2 lines · Sasha Levin

Add support for a Hyper-V based vGPU implementation that exposes the DirectX API to Linux userspace.

Api questions:

drivers/hv/dxgkrnl/misc.h line 61

Quoted 6 lines
drivers/hv/dxgkrnl/misc.h new file +6 -0
+struct d3dkmthandle {
+	union {
+		struct {
+			u32 instance	:  6;
+			u32 index	: 24;
+			u32 unique	: 2;

What is the endian of this?

Quoted 10 lines
Quoted 7 lines

drivers/hv/dxgkrnl/misc.h line 68

Quoted 7 lines
drivers/hv/dxgkrnl/misc.h new file +7 -0
+		};
+		u32 v;
+	};
+};
+
+extern const struct d3dkmthandle zerohandle;
+

The definition is the same as on the Windows side. The driver communicates with a Windows host, so I do not expect any issues with endiannes. Windows currently runs only on the little endian platforms.

As I mentioned before, you need to document that somewhere (like maybe preventing your code from being built on big endian systems?)

Quoted 6 lines

User mode applications see this as an opaque 32 bit value (D3DKMTHANDLE). I prefer not to use the u32 definition to avoid mistakes when another integer or a 64-bit handle is assigned to the handle or  the handle is assigned to a 64 or 32 bit integer variable. There are many handles in the driver model (shared NT handle, d3dkmthandle, etc). Using a specific type allows to avoid assigning one handle to another.

Specific types are great, that is fine.

Quoted 14 lines
Quoted 14 lines

drivers/hv/dxgkrnl/misc.h line 75

Quoted 7 lines
drivers/hv/dxgkrnl/misc.h new file +7 -0
+struct ntstatus {
+	union {
+		struct {
+			int code	: 16;
+			int facility	: 13;
+			int customer	: 1;
+			int severity	: 2;

Same here.

Are these things that cross the user/kernel boundry?

And why int on one and u32 on the other?

Quoted 13 lines
Quoted 5 lines

drivers/hv/dxgkrnl/misc.h line 80

Quoted 5 lines
drivers/hv/dxgkrnl/misc.h new file +5 -0
+		};
+		int v;
+	};
+};
+

"struct ntstatus" follows the definition for NTSTATUS on the Windows side. NTSTATUS is an integer where the negative values indicate errors. It is success otherwise. NTSTATUS is returned by the VM bus messages from host. IOCTLs from the driver return Linux negative error code or NTSTATUS positive success codes. DxCore applications expect certain positive success codes. DxCore is a shared library, which translates the D3DKMT* Windows interface to Linux ioctls. Applications link with DxCore to use a paravirtualized GPU. D3DKMTHANDLE is a 32-bit unsigned value (bitfield), not an integer.

Ok, again, please document this, and as these fields are crossing the kernel/user boundry, use the correct types (hint, 'int' is never that type).

Quoted 7 lines
Quoted 5 lines

drivers/hv/dxgkrnl/misc.h line 83

Quoted 3 lines
drivers/hv/dxgkrnl/misc.h new file +3 -0
+struct winluid {
+	uint a;
+	uint b;

And now uint? Come on, be consistent please :)

Sorry about this. This came from the Windows size where we use UINT a lot. All uints will be replaced by u32 in the next patch set.

thank you.

greg k-h

#8 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

In reply to Sasha Levin
Quoted 4 lines · Sasha Levin

Add support for a Hyper-V based vGPU implementation that exposes the DirectX API to Linux userspace.

Quoted 16 lines
---
 drivers/hv/dxgkrnl/Kconfig      |   10 +
 drivers/hv/dxgkrnl/Makefile     |   12 +
 drivers/hv/dxgkrnl/d3dkmthk.h   | 1636 ++++++++++
 drivers/hv/dxgkrnl/dxgadapter.c | 1406 ++++++++
 drivers/hv/dxgkrnl/dxgkrnl.h    |  927 ++++++
 drivers/hv/dxgkrnl/dxgmodule.c  |  656 ++++
 drivers/hv/dxgkrnl/dxgprocess.c |  357 ++
 drivers/hv/dxgkrnl/dxgvmbus.c   | 3084 ++++++++++++++++++
 drivers/hv/dxgkrnl/dxgvmbus.h   |  873 +++++
 drivers/hv/dxgkrnl/hmgr.c       |  604 ++++
 drivers/hv/dxgkrnl/hmgr.h       |  112 +
 drivers/hv/dxgkrnl/ioctl.c      | 5413 +++++++++++++++++++++++++++++++
 drivers/hv/dxgkrnl/misc.c       |  279 ++
 drivers/hv/dxgkrnl/misc.h       |  309 ++
 14 files changed, 15678 insertions(+)

It's almost impossible to review 15k lines at once, please break this up into reviewable chunks next time.

drivers/hv/dxgkrnl/Kconfig line 10

Quoted 12 lines

+++ b/drivers/hv/dxgkrnl/Kconfig

drivers/hv/dxgkrnl/Kconfig new file +10 -0
@@ -0,0 +1,10 @@
+#
+# dxgkrnl configuration
+#
+
+config DXGKRNL
+	tristate "Microsoft virtual GPU support"
+	depends on HYPERV
+	help
+	  This driver supports Microsoft virtual GPU.
+

You need more text here, this isn't a staging driver submission :)

drivers/hv/dxgkrnl/Makefile line 4

Quoted 10 lines
drivers/hv/dxgkrnl/Makefile new file +4 -0
new file mode 100644
index 000000000000..11505a153d9d
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0
+# Makefile for the Linux video drivers.
+# 5 Aug 1999, James Simmons, <mailto:[email protected]>
+# Rewritten to use lists instead of if-statements.

I really doubt these last 3 lines are relevant.

drivers/hv/dxgkrnl/Makefile line 6

Quoted 2 lines
drivers/hv/dxgkrnl/Makefile new file +2 -0
+
+# Each configuration option enables a list of files.

We know this.

drivers/hv/dxgkrnl/Makefile line 9

Quoted 3 lines
drivers/hv/dxgkrnl/Makefile new file +3 -0
+
+# Uncomment to enable printing debug messages by default
+#ccflags-y := -DDEBUG

No, don't do this please.

Quoted 34 lines
drivers/hv/dxgkrnl/Makefile new file +3 -0
+
+obj-$(CONFIG_DXGKRNL)	+= dxgkrnl.o
+dxgkrnl-y		:= dxgmodule.o hmgr.o misc.o dxgadapter.o ioctl.o dxgvmbus.o dxgprocess.o
drivers/hv/dxgkrnl/d3dkmthk.h new file +25 -0
new file mode 100644
index 000000000000..90cf5134b361
@@ -0,0 +1,1636 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/*
+ * Copyright (c) 2019, Microsoft Corporation.
+ *
+ * Author:
+ *   Iouri Tarassov <[email protected]>
+ *
+ * Dxgkrnl Graphics Port Driver user mode interface
+ *
+ */
+
+#ifndef _D3DKMTHK_H
+#define _D3DKMTHK_H
+
+#include "misc.h"
+
+#define D3DDDI_MAX_WRITTEN_PRIMARIES		16
+#define D3DDDI_MAX_MPO_PRESENT_DIRTY_RECTS	0xFFF
+
+#define D3DKMT_CREATEALLOCATION_MAX		1024
+#define D3DKMT_ADAPTERS_MAX			64
+#define D3DDDI_MAX_BROADCAST_CONTEXT		64
+#define D3DDDI_MAX_OBJECT_WAITED_ON		32
+#define D3DDDI_MAX_OBJECT_SIGNALED		32

drivers/hv/dxgkrnl/d3dkmthk.h line 35

Quoted 10 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +10 -0
+
+struct d3dkmt_adapterinfo {
+	struct d3dkmthandle		adapter_handle;
+	struct winluid			adapter_luid;
+	uint				num_sources;
+	uint				present_move_regions_preferred;
+};
+
+struct d3dkmt_enumadapters2 {
+	uint				num_adapters;

Use kernel types please, here and everywhere. u32?

drivers/hv/dxgkrnl/d3dkmthk.h line 41

Quoted 6 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +6 -0
+	struct d3dkmt_adapterinfo	*adapters;
+};
+
+struct d3dkmt_closeadapter {
+	struct d3dkmthandle		adapter_handle;
+};

A "handle"? And that has to be one of the most difficult structure names ever :)

Why not just use the "handle" for the structure as obviously that's all that is needed here.

Quoted 4 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +4 -0
+
+struct d3dkmt_openadapterfromluid {
+	struct winluid			adapter_luid;
+	struct d3dkmthandle		adapter_handle;

drivers/hv/dxgkrnl/d3dkmthk.h line 55

Quoted 10 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +10 -0
+};
+
+struct d3dddi_allocationlist {
+	struct d3dkmthandle		allocation;
+	union {
+		struct {
+			uint		write_operation		:1;
+			uint		do_not_retire_instance	:1;
+			uint		offer_priority		:3;
+			uint		reserved		:27;

endian issues?

If not, why are these bit fields?

drivers/hv/dxgkrnl/d3dkmthk.h line 100

Quoted 3 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +3 -0
+struct d3dkmt_destroydevice {
+	struct d3dkmthandle		device;
+};

Again, single entity structures?

Are you trying to pass around "handles" and cast them backwards?

If so, great, but then use the real kernel structures for that like 'struct device' if these are actually devices.

Quoted 10 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +10 -0
+
+enum d3dkmt_clienthint {
+	D3DKMT_CLIENTHINT_UNKNOWN	= 0,
+	D3DKMT_CLIENTHINT_OPENGL	= 1,
+	D3DKMT_CLIENTHINT_CDD		= 2,
+	D3DKMT_CLIENTHINT_DX7		= 7,
+	D3DKMT_CLIENTHINT_DX8		= 8,
+	D3DKMT_CLIENTHINT_DX9		= 9,
+	D3DKMT_CLIENTHINT_DX10		= 10,
+};

drivers/hv/dxgkrnl/d3dkmthk.h line 120

Quoted 10 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +10 -0
+
+struct d3dddi_createcontextflags {
+	union {
+		struct {
+			uint		null_rendering:1;
+			uint		initial_data:1;
+			uint		disable_gpu_timeout:1;
+			uint		synchronization_only:1;
+			uint		hw_queue_supported:1;
+			uint		reserved:27;

Endian?

Quoted 4 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +4 -0
+		};
+		uint			value;
+	};
+};

<...>

Quoted 28 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +28 -0
+static int dxgglobal_init_global_channel(struct hv_device *hdev)
+{
+	int ret = 0;
+
+	TRACE_DEBUG(1, "%s %x  %x", __func__, hdev->vendor_id, hdev->device_id);
+	{
+		TRACE_DEBUG(1, "device type   : %pUb\n", &hdev->dev_type);
+		TRACE_DEBUG(1, "device channel: %pUb %p primary: %p\n",
+			    &hdev->channel->offermsg.offer.if_type,
+			    hdev->channel, hdev->channel->primary_channel);
+	}
+
+	if (dxgglobal->hdev) {
+		/* This device should appear only once */
+		pr_err("dxgglobal already initialized\n");
+		ret = -EBADE;
+		goto error;
+	}
+
+	dxgglobal->hdev = hdev;
+
+	ret = dxgvmbuschannel_init(&dxgglobal->channel, hdev);
+	if (ret) {
+		pr_err("dxgvmbuschannel_init failed: %d\n", ret);
+		goto error;
+	}
+
+	ret = dxgglobal_getiospace(dxgglobal);

drivers/hv/dxgkrnl/d3dkmthk.h

Quoted 10 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +10 -0
+	if (ret) {
+		pr_err("getiospace failed: %d\n", ret);
+		goto error;
+	}
+
+	ret = dxgvmb_send_set_iospace_region(dxgglobal->mmiospace_base,
+					     dxgglobal->mmiospace_size, 0);
+	if (ISERROR(ret)) {
+		pr_err("send_set_iospace_region failed");
+		goto error;

You forgot to unwind from the things you initialized above :(

drivers/hv/dxgkrnl/d3dkmthk.h

Quoted 12 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +12 -0
+	}
+
+	hv_set_drvdata(hdev, dxgglobal);
+
+	dxgglobal->dxgdevice.minor = MISC_DYNAMIC_MINOR;
+	dxgglobal->dxgdevice.name = "dxg";
+	dxgglobal->dxgdevice.fops = &dxgk_fops;
+	dxgglobal->dxgdevice.mode = 0666;
+	ret = misc_register(&dxgglobal->dxgdevice);
+	if (ret) {
+		pr_err("misc_register failed: %d", ret);
+		goto error;

Again, no cleanups so you leak resources? Not nice :(

Quoted 4 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +4 -0
+	}
+	dxgglobaldev = dxgglobal->dxgdevice.this_device;
+	dxgglobal->device_initialized = true;
+

drivers/hv/dxgkrnl/d3dkmthk.h

Quoted 10 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +10 -0
+error:
+	return ret;
+}
+
+static void dxgglobal_destroy_global_channel(void)
+{
+	dxglockorder_acquire(DXGLOCK_GLOBAL_CHANNEL);
+	down_write(&dxgglobal->channel_lock);
+
+	TRACE_DEBUG(1, "%s", __func__);

ftrace is your friend :)

#9 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

Quoted 22 lines · Greg KH
Quoted 4 lines · Sasha Levin

Add support for a Hyper-V based vGPU implementation that exposes the DirectX API to Linux userspace.

Quoted 16 lines
---
 drivers/hv/dxgkrnl/Kconfig      |   10 +
 drivers/hv/dxgkrnl/Makefile     |   12 +
 drivers/hv/dxgkrnl/d3dkmthk.h   | 1636 ++++++++++
 drivers/hv/dxgkrnl/dxgadapter.c | 1406 ++++++++
 drivers/hv/dxgkrnl/dxgkrnl.h    |  927 ++++++
 drivers/hv/dxgkrnl/dxgmodule.c  |  656 ++++
 drivers/hv/dxgkrnl/dxgprocess.c |  357 ++
 drivers/hv/dxgkrnl/dxgvmbus.c   | 3084 ++++++++++++++++++
 drivers/hv/dxgkrnl/dxgvmbus.h   |  873 +++++
 drivers/hv/dxgkrnl/hmgr.c       |  604 ++++
 drivers/hv/dxgkrnl/hmgr.h       |  112 +
 drivers/hv/dxgkrnl/ioctl.c      | 5413 +++++++++++++++++++++++++++++++
 drivers/hv/dxgkrnl/misc.c       |  279 ++
 drivers/hv/dxgkrnl/misc.h       |  309 ++
 14 files changed, 15678 insertions(+)
Quoted 2 lines

It's almost impossible to review 15k lines at once, please break this up into reviewable chunks next time.

Sorry about this, but we had to replace a lot of typedefs, which are not allowed by the coding style.
We expect one more big patch, which cannot be split in my opinion. The VM vbus message format was changed to include additional header. As the result, every function in dxgvmbus.c needs to be changed to handle the new header. I do not see how this can be split to multiple patches so each patch produces a working driver.

Quoted 15 lines

drivers/hv/dxgkrnl/Kconfig line 10

Quoted 13 lines

+++ b/drivers/hv/dxgkrnl/Kconfig

drivers/hv/dxgkrnl/Kconfig new file +10 -0
@@ -0,0 +1,10 @@
+#
+# dxgkrnl configuration
+#
+
+config DXGKRNL
+	tristate "Microsoft virtual GPU support"
+	depends on HYPERV
+	help
+	  This driver supports Microsoft virtual GPU.
+

You need more text here, this isn't a staging driver submission :)

Is the the proposed description good enough?
"This driver handles paravirtualized GPU devices exposed by Microsoft Hyper-V when Linux is running inside of a virtual machine hosted by Windows."

Quoted 19 lines

drivers/hv/dxgkrnl/Makefile line 4

Quoted 11 lines
drivers/hv/dxgkrnl/Makefile new file +4 -0
new file mode 100644
index 000000000000..11505a153d9d
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0
+# Makefile for the Linux video drivers.
+# 5 Aug 1999, James Simmons, <mailto:[email protected]>
+# Rewritten to use lists instead of if-statements.

I really doubt these last 3 lines are relevant.

drivers/hv/dxgkrnl/Makefile line 6

Quoted 2 lines
drivers/hv/dxgkrnl/Makefile new file +2 -0
+
+# Each configuration option enables a list of files.

We know this.

Quoted 5 lines

drivers/hv/dxgkrnl/Makefile line 9

Quoted 3 lines
drivers/hv/dxgkrnl/Makefile new file +3 -0
+
+# Uncomment to enable printing debug messages by default
+#ccflags-y := -DDEBUG

No, don't do this please.

These lines will be removed.

Quoted 39 lines
Quoted 39 lines
drivers/hv/dxgkrnl/Makefile new file +3 -0
+
+obj-$(CONFIG_DXGKRNL)	+= dxgkrnl.o
+dxgkrnl-y		:= dxgmodule.o hmgr.o misc.o dxgadapter.o ioctl.o dxgvmbus.o dxgprocess.o
drivers/hv/dxgkrnl/d3dkmthk.h new file +29 -0
new file mode 100644
index 000000000000..90cf5134b361
@@ -0,0 +1,1636 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/*
+ * Copyright (c) 2019, Microsoft Corporation.
+ *
+ * Author:
+ *   Iouri Tarassov <[email protected]>
+ *
+ * Dxgkrnl Graphics Port Driver user mode interface
+ *
+ */
+
+#ifndef _D3DKMTHK_H
+#define _D3DKMTHK_H
+
+#include "misc.h"
+
+#define D3DDDI_MAX_WRITTEN_PRIMARIES		16
+#define D3DDDI_MAX_MPO_PRESENT_DIRTY_RECTS	0xFFF
+
+#define D3DKMT_CREATEALLOCATION_MAX		1024
+#define D3DKMT_ADAPTERS_MAX			64
+#define D3DDDI_MAX_BROADCAST_CONTEXT		64
+#define D3DDDI_MAX_OBJECT_WAITED_ON		32
+#define D3DDDI_MAX_OBJECT_SIGNALED		32
+
+struct d3dkmt_adapterinfo {
+	struct d3dkmthandle		adapter_handle;
+	struct winluid			adapter_luid;
Quoted 8 lines

drivers/hv/dxgkrnl/d3dkmthk.h line 35

Quoted 6 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +6 -0
+	uint				num_sources;
+	uint				present_move_regions_preferred;
+};
+
+struct d3dkmt_enumadapters2 {
+	uint				num_adapters;

Use kernel types please, here and everywhere. u32?

The definition will be changed to u32.

Quoted 11 lines

drivers/hv/dxgkrnl/d3dkmthk.h line 41

Quoted 7 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +6 -0
+	struct d3dkmt_adapterinfo	*adapters;
+};
+
+struct d3dkmt_closeadapter {
+	struct d3dkmthandle		adapter_handle;
+};

A "handle"? And that has to be one of the most difficult structure names ever :)

Quoted 2 lines

Why not just use the "handle" for the structure as obviously that's all that is needed here.

The structure definition matches the Windows D3DKMT interface. Some input structures to the interface functions have only one member. But there is possibility that new member could be added in the future. We prefer to have matching names between Windows and Linux to avoid confusion.

Quoted 17 lines
Quoted 4 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +4 -0
+
+struct d3dkmt_openadapterfromluid {
+	struct winluid			adapter_luid;
+	struct d3dkmthandle		adapter_handle;

drivers/hv/dxgkrnl/d3dkmthk.h line 55

Quoted 10 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +10 -0
+};
+
+struct d3dddi_allocationlist {
+	struct d3dkmthandle		allocation;
+	union {
+		struct {
+			uint		write_operation		:1;
+			uint		do_not_retire_instance	:1;
+			uint		offer_priority		:3;
+			uint		reserved		:27;

endian issues?

Quoted 1 line

If not, why are these bit fields?

This matches the definition on the Windows side. Windows only works on little endian platforms.

Quoted 7 lines

drivers/hv/dxgkrnl/d3dkmthk.h line 100

Quoted 4 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +3 -0
+struct d3dkmt_destroydevice {
+	struct d3dkmthandle		device;
+};

Again, single entity structures?

Quoted 5 lines

Are you trying to pass around "handles" and cast them backwards?

If so, great, but then use the real kernel structures for that like 'struct device' if these are actually devices.

Again. The structure matches the definition on the Windows side to avoid confusion.

Quoted 23 lines
Quoted 10 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +10 -0
+
+enum d3dkmt_clienthint {
+	D3DKMT_CLIENTHINT_UNKNOWN	= 0,
+	D3DKMT_CLIENTHINT_OPENGL	= 1,
+	D3DKMT_CLIENTHINT_CDD		= 2,
+	D3DKMT_CLIENTHINT_DX7		= 7,
+	D3DKMT_CLIENTHINT_DX8		= 8,
+	D3DKMT_CLIENTHINT_DX9		= 9,
+	D3DKMT_CLIENTHINT_DX10		= 10,
+};

drivers/hv/dxgkrnl/d3dkmthk.h line 120

Quoted 10 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +10 -0
+
+struct d3dddi_createcontextflags {
+	union {
+		struct {
+			uint		null_rendering:1;
+			uint		initial_data:1;
+			uint		disable_gpu_timeout:1;
+			uint		synchronization_only:1;
+			uint		hw_queue_supported:1;
+			uint		reserved:27;

Endian?

Quoted 6 lines
Quoted 4 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +4 -0
+		};
+		uint			value;
+	};
+};

<...>

The structure matches definition on the Windows side.

Quoted 33 lines
Quoted 33 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +32 -0
+static int dxgglobal_init_global_channel(struct hv_device *hdev)
+{
+	int ret = 0;
+
+	TRACE_DEBUG(1, "%s %x  %x", __func__, hdev->vendor_id, hdev->device_id);
+	{
+		TRACE_DEBUG(1, "device type   : %pUb\n", &hdev->dev_type);
+		TRACE_DEBUG(1, "device channel: %pUb %p primary: %p\n",
+			    &hdev->channel->offermsg.offer.if_type,
+			    hdev->channel, hdev->channel->primary_channel);
+	}
+
+	if (dxgglobal->hdev) {
+		/* This device should appear only once */
+		pr_err("dxgglobal already initialized\n");
+		ret = -EBADE;
+		goto error;
+	}
+
+	dxgglobal->hdev = hdev;
+
+	ret = dxgvmbuschannel_init(&dxgglobal->channel, hdev);
+	if (ret) {
+		pr_err("dxgvmbuschannel_init failed: %d\n", ret);
+		goto error;
+	}
+
+	ret = dxgglobal_getiospace(dxgglobal);
+	if (ret) {
+		pr_err("getiospace failed: %d\n", ret);
+		goto error;
+	}
Quoted 8 lines

drivers/hv/dxgkrnl/d3dkmthk.h

Quoted 6 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +6 -0
+
+	ret = dxgvmb_send_set_iospace_region(dxgglobal->mmiospace_base,
+					     dxgglobal->mmiospace_size, 0);
+	if (ISERROR(ret)) {
+		pr_err("send_set_iospace_region failed");
+		goto error;

You forgot to unwind from the things you initialized above :(

The caller of dxgglobal_init_global_channel() checks the return value and calls dxgglobal_destroy_global_channel() in case of an error, which does the cleanup. If preferred the call to destroy the channel could be moved to the end of this function.

Quoted 17 lines

drivers/hv/dxgkrnl/d3dkmthk.h

Quoted 13 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +12 -0
+	}
+
+	hv_set_drvdata(hdev, dxgglobal);
+
+	dxgglobal->dxgdevice.minor = MISC_DYNAMIC_MINOR;
+	dxgglobal->dxgdevice.name = "dxg";
+	dxgglobal->dxgdevice.fops = &dxgk_fops;
+	dxgglobal->dxgdevice.mode = 0666;
+	ret = misc_register(&dxgglobal->dxgdevice);
+	if (ret) {
+		pr_err("misc_register failed: %d", ret);
+		goto error;

Again, no cleanups so you leak resources? Not nice :(

Quoted 16 lines
Quoted 4 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +4 -0
+	}
+	dxgglobaldev = dxgglobal->dxgdevice.this_device;
+	dxgglobal->device_initialized = true;
+

drivers/hv/dxgkrnl/d3dkmthk.h

Quoted 10 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +10 -0
+error:
+	return ret;
+}
+
+static void dxgglobal_destroy_global_channel(void)
+{
+	dxglockorder_acquire(DXGLOCK_GLOBAL_CHANNEL);
+	down_write(&dxgglobal->channel_lock);
+
+	TRACE_DEBUG(1, "%s", __func__);

ftrace is your friend :)

I mentioned in other mail that these macros will be removed when we pick to final tracing technology for the driver.

Quoted 2 lines

Thank you
Iouri

#10 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

Quoted 23 lines · Iouri Tarassov
Quoted 21 lines · Greg KH
Quoted 19 lines · Sasha Levin

Add support for a Hyper-V based vGPU implementation that exposes the DirectX API to Linux userspace.

Quoted 1 line
---
 drivers/hv/dxgkrnl/Kconfig      |   10 +
 drivers/hv/dxgkrnl/Makefile     |   12 +
 drivers/hv/dxgkrnl/d3dkmthk.h   | 1636 ++++++++++
 drivers/hv/dxgkrnl/dxgadapter.c | 1406 ++++++++
 drivers/hv/dxgkrnl/dxgkrnl.h    |  927 ++++++
 drivers/hv/dxgkrnl/dxgmodule.c  |  656 ++++
 drivers/hv/dxgkrnl/dxgprocess.c |  357 ++
 drivers/hv/dxgkrnl/dxgvmbus.c   | 3084 ++++++++++++++++++
 drivers/hv/dxgkrnl/dxgvmbus.h   |  873 +++++
 drivers/hv/dxgkrnl/hmgr.c       |  604 ++++
 drivers/hv/dxgkrnl/hmgr.h       |  112 +
 drivers/hv/dxgkrnl/ioctl.c      | 5413 +++++++++++++++++++++++++++++++
 drivers/hv/dxgkrnl/misc.c       |  279 ++
 drivers/hv/dxgkrnl/misc.h       |  309 ++
 14 files changed, 15678 insertions(+)
Quoted 5 lines
Quoted 2 lines

It's almost impossible to review 15k lines at once, please break this up into reviewable chunks next time.

Sorry about this, but we had to replace a lot of typedefs, which are not allowed by the coding style.

Ok, nice work, but that has nothing to do with how you submit a patch to us for review.

Quoted 1 line

We expect one more big patch, which cannot be split in my opinion.

I disagree with that opinion, and so do thousands of other Linux kernel developers who have done this successfully in the past :)

Remember, it is your job to make this as simple and as easy as possible for me to review your code, such that it is trivial for me to understand and accept it. That takes more work on your side to do this, as we have thousands of developers, but very few reviewers. We know we waste engineering time on this type of thing, but the end result makes for better reviews and consequentially, better reviews.

So don't ignore this advice, remember, you are wanting me to do something for you, for free. Make it easy for me to do so.

Quoted 5 lines

The VM
vbus message format was changed to include additional header. As the result, every function in dxgvmbus.c needs to be changed to handle the new header. I do not see how this can be split to multiple patches so each patch produces a working driver.

It doesn't have to "work" fully, see many many examples of how to do this every week submitted to us. It's not an impossible task at all.

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines

+++ b/drivers/hv/dxgkrnl/Kconfig

drivers/hv/dxgkrnl/Kconfig new file +4 -0
@@ -0,0 +1,10 @@
+#
+# dxgkrnl configuration
+#
+
Quoted 8 lines

drivers/hv/dxgkrnl/Kconfig line 10

Quoted 6 lines
drivers/hv/dxgkrnl/Kconfig new file +6 -0
+config DXGKRNL
+	tristate "Microsoft virtual GPU support"
+	depends on HYPERV
+	help
+	  This driver supports Microsoft virtual GPU.
+

You need more text here, this isn't a staging driver submission :)

Quoted 1 line

Is the the proposed description good enough?

What proposed description?

Quoted 3 lines

"This driver handles paravirtualized GPU devices exposed by Microsoft Hyper-V when Linux is running inside of a virtual machine hosted by Windows."

That's better, but really, when a tiny serial port driver has more text than this huge thing, you might want to consider expanding on exactly what you want people to understand...

Quoted 7 lines
Quoted 7 lines

drivers/hv/dxgkrnl/d3dkmthk.h line 41

Quoted 3 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +3 -0
+struct d3dkmt_closeadapter {
+	struct d3dkmthandle		adapter_handle;
+};

A "handle"? And that has to be one of the most difficult structure names ever :)

Quoted 6 lines
Quoted 2 lines

Why not just use the "handle" for the structure as obviously that's all that is needed here.

The structure definition matches the Windows D3DKMT interface. Some input structures to the interface functions have only one member. But there is possibility that new member could be added in the future. We prefer to have matching names between Windows and Linux to avoid confusion.

Don't write code because "it might change in the future". Write code for what you have today. If it does change in the future, wonderful, go and change the code. You have the full ability to do so then, no need to hurt all of us today for that potential.

As for "matching names", why does that matter? Who sees both names at the same time?

Quoted 17 lines
Quoted 17 lines
Quoted 4 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +4 -0
+
+struct d3dkmt_openadapterfromluid {
+	struct winluid			adapter_luid;
+	struct d3dkmthandle		adapter_handle;

drivers/hv/dxgkrnl/d3dkmthk.h line 55

Quoted 10 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +10 -0
+};
+
+struct d3dddi_allocationlist {
+	struct d3dkmthandle		allocation;
+	union {
+		struct {
+			uint		write_operation		:1;
+			uint		do_not_retire_instance	:1;
+			uint		offer_priority		:3;
+			uint		reserved		:27;

endian issues?

Quoted 3 lines
Quoted 1 line

If not, why are these bit fields?

This matches the definition on the Windows side. Windows only works on little endian platforms.

But Linux works on both, so you need to properly document/handle this somehow.

Quoted 7 lines
Quoted 7 lines

drivers/hv/dxgkrnl/d3dkmthk.h line 100

Quoted 4 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +3 -0
+struct d3dkmt_destroydevice {
+	struct d3dkmthandle		device;
+};

Again, single entity structures?

Quoted 7 lines
Quoted 5 lines

Are you trying to pass around "handles" and cast them backwards?

If so, great, but then use the real kernel structures for that like 'struct device' if these are actually devices.

Again. The structure matches the definition on the Windows side to avoid confusion.

Who is confused here? We accept naming conventions that do not match the normal Linux style when they are referring to external sources of the data. Examples of this are USB device field names, and other hardware specifications that are public. You aren't sharing code with a Windows system, so please follow the Linux coding style rules, as you want Linux developers to be helping you maintain this code, not developers who have ever read code from other operating systems.

So please follow the rule of, "unless these fields and structures are publically defined somewhere, use Linux naming rules", like all of the rest of us do.

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
drivers/hv/dxgkrnl/dxgmodule.c new file +5 -0
+	ret = dxgglobal_getiospace(dxgglobal);
+	if (ret) {
+		pr_err("getiospace failed: %d\n", ret);
+		goto error;
+	}
Quoted 8 lines

drivers/hv/dxgkrnl/dxgmodule.c line 350

Quoted 6 lines
drivers/hv/dxgkrnl/dxgmodule.c new file +6 -0
+
+	ret = dxgvmb_send_set_iospace_region(dxgglobal->mmiospace_base,
+					     dxgglobal->mmiospace_size, 0);
+	if (ISERROR(ret)) {
+		pr_err("send_set_iospace_region failed");
+		goto error;

You forgot to unwind from the things you initialized above :(

Quoted 4 lines

The caller of dxgglobal_init_global_channel() checks the return value and calls dxgglobal_destroy_global_channel() in case of an error, which does the cleanup. If preferred the call to destroy the channel could be moved to the end of this function.

It is generally a good idea for a function to clean up after itself if things go wrong as it is almost impossible for a reader of the code, or automated tools, to determine that these resources are freed up by an external call later on in the code path.

So yes, please fix this up.

Quoted 10 lines
Quoted 8 lines

drivers/hv/dxgkrnl/dxgmodule.c line 376

Quoted 6 lines
drivers/hv/dxgkrnl/dxgmodule.c new file +6 -0
+static void dxgglobal_destroy_global_channel(void)
+{
+	dxglockorder_acquire(DXGLOCK_GLOBAL_CHANNEL);
+	down_write(&dxgglobal->channel_lock);
+
+	TRACE_DEBUG(1, "%s", __func__);

ftrace is your friend :)

I mentioned in other mail that these macros will be removed when we pick to final tracing technology for the driver.

Please pick now, no need to wait :)

thanks,

greg k-h

#11 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

Hi Greg,

I appreciate your comments and working to address them.

Quoted 11 lines · Greg KH

As for "matching names", why does that matter? Who sees both names at the same time?

Quoted 6 lines
Quoted 4 lines

endian issues?

If not, why are these bit fields?

This matches the definition on the Windows side. Windows only works on little endian platforms.

But Linux works on both, so you need to properly document/handle this somehow.

This driver works only in a Linux container in conjunction with the Windows host. The structure definitions are  the same on the host and the container. The driver will not be enabled or work on platforms, where Windows does not run.

Quoted 24 lines
Quoted 8 lines
Quoted 8 lines

drivers/hv/dxgkrnl/d3dkmthk.h line 100

Quoted 5 lines
drivers/hv/dxgkrnl/d3dkmthk.h new file +3 -0
+struct d3dkmt_destroydevice {
+	struct d3dkmthandle		device;
+};

Again, single entity structures?

Quoted 7 lines
Quoted 5 lines

Are you trying to pass around "handles" and cast them backwards?

If so, great, but then use the real kernel structures for that like 'struct device' if these are actually devices.

Again. The structure matches the definition on the Windows side to avoid confusion.

Who is confused here? We accept naming conventions that do not match the normal Linux style when they are referring to external sources of the data. Examples of this are USB device field names, and other hardware specifications that are public. You aren't sharing code with a Windows system, so please follow the Linux coding style rules, as you want Linux developers to be helping you maintain this code, not developers who have ever read code from other operating systems.

Quoted 4 lines

So please follow the rule of, "unless these fields and structures are publically defined somewhere, use Linux naming rules", like all of the rest of us do.

The d3dkmt* structures, like d3dkmt_destroydevice are publicly documented on MSDN (https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/d3dkmthk/ns-d3dkmthk-_d3dkmt_destroydevice). I am using the same definitions in the driver, so it is easy to find the corresponding definition and description of the structure. I have no problem to change the names, but I think using the same public definition will help the driver maintainers.

Thanks

Iouri

#12 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

Quoted 10 lines · Iouri Tarassov

Hi Greg,

I appreciate your comments and working to address them.

Quoted 5 lines · Greg KH

As for "matching names", why does that matter? Who sees both names at the same time?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

endian issues?
If not, why are these bit fields?

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

This matches the definition on the Windows side. Windows only works on little endian platforms.

But Linux works on both, so you need to properly document/handle this somehow.

This driver works only in a Linux container in conjunction with the Windows host. The structure definitions are  the same on the host and the container. The driver will not be enabled or work on platforms, where Windows does not run.

That's fine, you can create your structures in a way that works no matter what endian is in use, in very simple ways. Don't rely on bit fields like this in a structure to actually work the way you think they work (hint, compilers hate them and do horrible things with them usually...)

So do it that way please, especially for when you are passing things across the user/kernel boundry. It's much simpler and easier to do it right now, than to have to fix it up later.

thanks,

greg k-h

maintainer
#13 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

In reply to Sasha Levin

On Fri, Aug 14, 2020 at 08:38:53AM -0400, Sasha Levin wrote:
[...]

drivers/hv/dxgkrnl/dxgadapter.c line 26

Quoted 9 lines
drivers/hv/dxgkrnl/dxgadapter.c new file +9 -0
+
+#include "dxgkrnl.h"
+
+int dxgadapter_init(struct dxgadapter *adapter, struct hv_device *hdev)
+{
+	int ret = 0;
+	char s[80];
+
+	UNUSED(s);

If s is not used, why not just remove it?

Indeed it is not used anywhere in this function. That saves you 80 bytes on stack.

drivers/hv/dxgkrnl/ioctl.c line 899

Quoted 7 lines
drivers/hv/dxgkrnl/ioctl.c new file +7 -0
+static int dxgk_destroy_hwcontext(struct dxgprocess *process,
+					      void *__user inargs)
+{
+	/* This is obsolete entry point */
+	return ENOTTY;
+}
+

Other places have been using negative numbers for errors. I guess you want -ENOTTY here too.

Wei.

#14 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

Quoted 29 lines · Wei Liu

On Fri, Aug 14, 2020 at 08:38:53AM -0400, Sasha Levin wrote:
[...]

drivers/hv/dxgkrnl/dxgadapter.c line 26

Quoted 9 lines
drivers/hv/dxgkrnl/dxgadapter.c new file +9 -0
+
+#include "dxgkrnl.h"
+
+int dxgadapter_init(struct dxgadapter *adapter, struct hv_device *hdev)
+{
+	int ret = 0;
+	char s[80];
+
+	UNUSED(s);

If s is not used, why not just remove it?

Indeed it is not used anywhere in this function. That saves you 80 bytes on stack.

drivers/hv/dxgkrnl/ioctl.c line 899

Quoted 7 lines
drivers/hv/dxgkrnl/ioctl.c new file +7 -0
+static int dxgk_destroy_hwcontext(struct dxgprocess *process,
+					      void *__user inargs)
+{
+	/* This is obsolete entry point */
+	return ENOTTY;
+}
+

Other places have been using negative numbers for errors. I guess you want -ENOTTY here too.

Wei.

#15 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

In reply to Wei Liu

Hello

Quoted 31 lines · Wei Liu

On Fri, Aug 14, 2020 at 08:38:53AM -0400, Sasha Levin wrote:
[...]

drivers/hv/dxgkrnl/dxgadapter.c line 26

Quoted 9 lines
drivers/hv/dxgkrnl/dxgadapter.c new file +9 -0
+
+#include "dxgkrnl.h"
+
+int dxgadapter_init(struct dxgadapter *adapter, struct hv_device *hdev)
+{
+	int ret = 0;
+	char s[80];
+
+	UNUSED(s);

If s is not used, why not just remove it?

Indeed it is not used anywhere in this function. That saves you 80 bytes on stack.

drivers/hv/dxgkrnl/ioctl.c line 899

Quoted 7 lines
drivers/hv/dxgkrnl/ioctl.c new file +7 -0
+static int dxgk_destroy_hwcontext(struct dxgprocess *process,
+					      void *__user inargs)
+{
+	/* This is obsolete entry point */
+	return ENOTTY;
+}
+

Other places have been using negative numbers for errors. I guess you want -ENOTTY here too.

Wei.

#16 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

In reply to Wei Liu

Thank you,Wei. These issues will be fixed in the next patchset.

Iouri

Quoted 31 lines · Wei Liu

On Fri, Aug 14, 2020 at 08:38:53AM -0400, Sasha Levin wrote:
[...]

drivers/hv/dxgkrnl/dxgadapter.c line 26

Quoted 9 lines
drivers/hv/dxgkrnl/dxgadapter.c new file +9 -0
+
+#include "dxgkrnl.h"
+
+int dxgadapter_init(struct dxgadapter *adapter, struct hv_device *hdev)
+{
+	int ret = 0;
+	char s[80];
+
+	UNUSED(s);

If s is not used, why not just remove it?

Indeed it is not used anywhere in this function. That saves you 80 bytes on stack.

drivers/hv/dxgkrnl/ioctl.c line 899

Quoted 7 lines
drivers/hv/dxgkrnl/ioctl.c new file +7 -0
+static int dxgk_destroy_hwcontext(struct dxgprocess *process,
+					      void *__user inargs)
+{
+	/* This is obsolete entry point */
+	return ENOTTY;
+}
+

Other places have been using negative numbers for errors. I guess you want -ENOTTY here too.

Wei.

#17 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

In reply to Sasha Levin
Quoted 2 lines · Sasha Levin

Add support for a Hyper-V based vGPU implementation that exposes the DirectX API to Linux userspace.

NAK.

Kernel APIs should be documented. ... in tree and with suitable license.

drivers/hv/dxgkrnl/dxgadapter.c line 26

Quoted 6 lines
drivers/hv/dxgkrnl/dxgadapter.c new file +6 -0
+int dxgadapter_init(struct dxgadapter *adapter, struct hv_device *hdev)
+{
+	int ret = 0;
+	char s[80];
+
+	UNUSED(s);

What is going on here?

drivers/hv/dxgkrnl/dxgadapter.c line 1012

Quoted 5 lines
drivers/hv/dxgkrnl/dxgadapter.c new file +5 -0
+{
+	struct dxgprocess_adapter *adapter_info = dxgmem_alloc(process,
+							       DXGMEM_PROCESS_ADAPTER,
+							       sizeof
+							       (*adapter_info));

We normally use kernel functions in kernel code.

drivers/hv/dxgkrnl/dxgadapter.c line 1124

Quoted 1 line
drivers/hv/dxgkrnl/dxgadapter.c new file +1 -0
+	dxgmutex_unlock(&device->adapter_info->device_list_mutex);

And you should not have private locking primitives, either.

drivers/hv/dxgkrnl/dxgadapter.c line 1400

Quoted 4 lines
drivers/hv/dxgkrnl/dxgadapter.c new file +4 -0
+bool dxghwqueue_acquire_reference(struct dxghwqueue *hwqueue)
+{
+	return refcount_inc_not_zero(&hwqueue->refcount);
+}

Midlayers are evil.

Best regards,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#18 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

Hi Pavel,

Thanks for your time reviewing the driver.

Quoted 7 lines · Pavel Machek
Quoted 2 lines · Sasha Levin

Add support for a Hyper-V based vGPU implementation that exposes the DirectX API to Linux userspace.

NAK.

Kernel APIs should be documented. ... in tree and with suitable license.

We are considering to add required documentation. The design is that the driver IOCTLs will not be called directly by user mode drivers or applications. They will instead link with libdxcore.so and use the D3DKMT* interface to send requests to the driver.  libdxcore will translate the request to driver IOCTLs and do some additional work. For example, it will translate the path of the user mode driver name to the Linux namespace. The D3DKMTinterface is documented on MSDN. Do you suggest that the IOCTL interface needs to be documented or the D3DKMT interface?

Quoted 9 lines

drivers/hv/dxgkrnl/dxgadapter.c line 26

Quoted 7 lines
drivers/hv/dxgkrnl/dxgadapter.c new file +6 -0
+int dxgadapter_init(struct dxgadapter *adapter, struct hv_device *hdev)
+{
+	int ret = 0;
+	char s[80];
+
+	UNUSED(s);

What is going on here?

This is a mistake, which will be fixed.

Quoted 8 lines

drivers/hv/dxgkrnl/dxgadapter.c line 1012

Quoted 6 lines
drivers/hv/dxgkrnl/dxgadapter.c new file +5 -0
+{
+	struct dxgprocess_adapter *adapter_info = dxgmem_alloc(process,
+							       DXGMEM_PROCESS_ADAPTER,
+							       sizeof
+							       (*adapter_info));

We normally use kernel functions in kernel code.

Using a custom memory allocation function allows us to track memory allocations per DXGPROCESS and catch memory leaks when a DXGPROCESS is destroyed or when the driver is unloaded. It also allows to easily change the memory allocation implementation if needed.

Quoted 4 lines

drivers/hv/dxgkrnl/dxgadapter.c line 1124

Quoted 2 lines
drivers/hv/dxgkrnl/dxgadapter.c new file +1 -0
+	dxgmutex_unlock(&device->adapter_info->device_list_mutex);

And you should not have private locking primitives, either.

This is done to allow the implementation of custom lock order verification. We learnt recently about lock dependency checking in kernel and will evaluate if it can replace the custom lock order verification.

Quoted 7 lines

drivers/hv/dxgkrnl/dxgadapter.c line 1400

Quoted 5 lines
drivers/hv/dxgkrnl/dxgadapter.c new file +4 -0
+bool dxghwqueue_acquire_reference(struct dxghwqueue *hwqueue)
+{
+	return refcount_inc_not_zero(&hwqueue->refcount);
+}

Midlayers are evil.

I strongly agree in general, but think that in our case the layers are very small. It allows to quickly find all places where a reference/dereference on an object is done and addition of debug tracing to catch errors.

Quoted 3 lines

Best regards,
Pavel

Thank you
Iouri

#19 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

Quoted 11 lines · Iouri Tarassov
Quoted 7 lines

drivers/hv/dxgkrnl/dxgadapter.c line 1012

Quoted 5 lines
drivers/hv/dxgkrnl/dxgadapter.c new file +5 -0
+{
+	struct dxgprocess_adapter *adapter_info = dxgmem_alloc(process,
+							       DXGMEM_PROCESS_ADAPTER,
+							       sizeof
+							       (*adapter_info));

We normally use kernel functions in kernel code.

Using a custom memory allocation function allows us to track memory allocations per DXGPROCESS and catch memory leaks when a DXGPROCESS is destroyed or when the driver is unloaded. It also allows to easily change the memory allocation implementation if needed.

There is only one "memory allocation implementation" in the kernel, please use that and not any wrapper functions. You wouldn't want to see 1000's of different memory allocation functions, each driver having a unique one, right?

Remember, your code is becoming part of the larger kernel, so follow the guidelines and rules of it. There is nothing different from your code and a serial port driver when it comes to these expectations.

thanks,

greg k-h

#20 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

In reply to Iouri Tarassov
Quoted 9 lines · Iouri Tarassov
Quoted 6 lines

drivers/hv/dxgkrnl/dxgadapter.c line 1400

Quoted 4 lines
drivers/hv/dxgkrnl/dxgadapter.c new file +4 -0
+bool dxghwqueue_acquire_reference(struct dxghwqueue *hwqueue)
+{
+	return refcount_inc_not_zero(&hwqueue->refcount);
+}

Midlayers are evil.

I strongly agree in general, but think that in our case the layers are very small. It allows to quickly find all places where a reference/dereference on an object is done and addition of debug tracing to catch errors.

Again, no, please remove all layers like this. They just make it impossible for others to review and understand the code over time.

Also, in this specific case, it would have allowed me to easily realize that you are doing this type of call incorrectly and should be using a different data structure :)

thanks,

greg k-h

#21 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

Hi Greg,

Quoted 11 lines · Greg KH
Quoted 9 lines · Iouri Tarassov
Quoted 6 lines

drivers/hv/dxgkrnl/dxgadapter.c line 1400

Quoted 4 lines
drivers/hv/dxgkrnl/dxgadapter.c new file +4 -0
+bool dxghwqueue_acquire_reference(struct dxghwqueue *hwqueue)
+{
+	return refcount_inc_not_zero(&hwqueue->refcount);
+}

Midlayers are evil.

I strongly agree in general, but think that in our case the layers are very small. It allows to quickly find all places where a reference/dereference on an object is done and addition of debug tracing to catch errors.

Quoted 6 lines

Again, no, please remove all layers like this. They just make it impossible for others to review and understand the code over time.

Also, in this specific case, it would have allowed me to easily realize that you are doing this type of call incorrectly and should be using a different data structure :)

Are you suggesting that the current code is incorrect? Could you comment what changes need to be done?

Thanks
Iouri

#22 lore raw

Re: [PATCH 1/4] drivers: hv: dxgkrnl: core code

Quoted 16 lines · Iouri Tarassov

Hi Greg,

Quoted 13 lines · Greg KH
Quoted 8 lines · Iouri Tarassov
Quoted 5 lines
Quoted 5 lines
drivers/hv/dxgkrnl/dxgadapter.c new file +4 -0
+bool dxghwqueue_acquire_reference(struct dxghwqueue *hwqueue)
+{
+	return refcount_inc_not_zero(&hwqueue->refcount);
+}
Quoted 1 line

Midlayers are evil.

I strongly agree in general, but think that in our case the layers are very small. It allows to quickly find all places where a reference/dereference on an object is done and addition of debug tracing to catch errors.

Again, no, please remove all layers like this. They just make it impossible for others to review and understand the code over time.

Quoted 6 lines
Quoted 3 lines

Also, in this specific case, it would have allowed me to easily realize that you are doing this type of call incorrectly and should be using a different data structure :)

Are you suggesting that the current code is incorrect? Could you comment what changes need to be done?

You should be using the built-in reference counting object (a kref) and not trying to roll your own as you did here. That way we "know" you got the logic right and do not have to audit your codebase to prove that your hand-made one is correct.

thanks,

greg k-h

#23 lore raw

PATCH 2/4 drivers: hv: dxgkrnl: hook up dxgkrnl

In reply to Sasha Levin

Connect the dxgkrnl module to the drivers/hv/ makefile and Kconfig.

---
 drivers/hv/Kconfig  | 2 ++
 drivers/hv/Makefile | 1 +
 2 files changed, 3 insertions(+)
drivers/hv/Kconfig +2 -0
index 79e5356a737a..07d4e7c36e3a 100644
@@ -26,4 +26,6 @@ config HYPERV_BALLOON
 	help
 	  Select this option to enable Hyper-V Balloon driver.
 
+source "drivers/hv/dxgkrnl/Kconfig"
+
 endmenu
drivers/hv/Makefile +1 -0
index 94daf8240c95..2474b70c161d 100644
@@ -2,6 +2,7 @@
 obj-$(CONFIG_HYPERV)		+= hv_vmbus.o
 obj-$(CONFIG_HYPERV_UTILS)	+= hv_utils.o
 obj-$(CONFIG_HYPERV_BALLOON)	+= hv_balloon.o
+obj-$(CONFIG_DXGKRNL)		+= dxgkrnl/
 
 CFLAGS_hv_trace.o = -I$(src)
 CFLAGS_hv_balloon.o = -I$(src)
Signature · 1 line
2.25.1
#24 lore raw

PATCH 3/4 drivers: hv: vmbus: hook up dxgkrnl

In reply to Sasha Levin

Register a new device type with vmbus.

---
 include/linux/hyperv.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
include/linux/hyperv.h +16 -0
index 40df3103e890..40fff19ecde3 100644
@@ -1343,6 +1343,22 @@ void vmbus_free_mmio(resource_size_t start, resource_size_t size);
 	.guid = GUID_INIT(0xda0a7802, 0xe377, 0x4aac, 0x8e, 0x77, \
 			  0x05, 0x58, 0xeb, 0x10, 0x73, 0xf8)
 
+/*
+ * GPU paravirtualization global DXGK channel
+ * {DDE9CBC0-5060-4436-9448-EA1254A5D177}
+ */
+#define HV_GPUP_DXGK_GLOBAL_GUID \
+	.guid = GUID_INIT(0xdde9cbc0, 0x5060, 0x4436, 0x94, 0x48, \
+			  0xea, 0x12, 0x54, 0xa5, 0xd1, 0x77)
+
+/*
+ * GPU paravirtualization per virtual GPU DXGK channel
+ * {6E382D18-3336-4F4B-ACC4-2B7703D4DF4A}
+ */
+#define HV_GPUP_DXGK_VGPU_GUID \
+	.guid = GUID_INIT(0x6e382d18, 0x3336, 0x4f4b, 0xac, 0xc4, \
+			  0x2b, 0x77, 0x3, 0xd4, 0xdf, 0x4a)
+
 /*
  * Synthetic FC GUID
  * {2f9bcc4a-0069-4af3-b76b-6fd0be528cda}
Signature · 1 line
2.25.1
#25 lore raw

PATCH 4/4 drivers: hv: dxgkrnl: create a MAINTAINERS entry

In reply to Sasha Levin
---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index 4e2698cc7e23..1e725a9e6335 100644
@@ -8003,6 +8003,13 @@ F:	Documentation/devicetree/bindings/mtd/ti,am654-hbmc.txt
 F:	drivers/mtd/hyperbus/
 F:	include/linux/mtd/hyperbus.h
 
+Hyper-V vGPU DRIVER
+M:	Sasha Levin <[email protected]>
+M:	Iouri Tarassov <[email protected]>
+L:	[email protected]
+S:	Supported
+F:	drivers/hv/dxgkrnl/
+
 HYPERVISOR VIRTUAL CONSOLE DRIVER
 L:	[email protected]
 S:	Odd Fixes
Signature · 1 line
2.25.1