Re: [RFC PATCH 1/4] gpu: dxgkrnl: core code
From: Greg KH <gregkh@linuxfoundation.org>
Date: 2020-05-19 17:19:10
Also in:
dri-devel, linux-hyperv, lkml
On Tue, May 19, 2020 at 12:32:31PM -0400, Sasha Levin wrote:
+/* + * Dxgkrnl Graphics Port Driver ioctl definitions + * + */ + +#define LX_IOCTL_DIR_WRITE 0x1 +#define LX_IOCTL_DIR_READ 0x2 + +#define LX_IOCTL_DIR(_ioctl) (((_ioctl) >> 30) & 0x3) +#define LX_IOCTL_SIZE(_ioctl) (((_ioctl) >> 16) & 0x3FFF) +#define LX_IOCTL_TYPE(_ioctl) (((_ioctl) >> 8) & 0xFF) +#define LX_IOCTL_CODE(_ioctl) (((_ioctl) >> 0) & 0xFF)
Why create new ioctl macros, can't the "normal" kernel macros work properly?
+#define LX_IOCTL(_dir, _size, _type, _code) ( \ + (((uint)(_dir) & 0x3) << 30) | \ + (((uint)(_size) & 0x3FFF) << 16) | \ + (((uint)(_type) & 0xFF) << 8) | \ + (((uint)(_code) & 0xFF) << 0)) + +#define LX_IO(_type, _code) LX_IOCTL(0, 0, (_type), (_code)) +#define LX_IOR(_type, _code, _size) \ + LX_IOCTL(LX_IOCTL_DIR_READ, (_size), (_type), (_code)) +#define LX_IOW(_type, _code, _size) \ + LX_IOCTL(LX_IOCTL_DIR_WRITE, (_size), (_type), (_code)) +#define LX_IOWR(_type, _code, _size) \ + LX_IOCTL(LX_IOCTL_DIR_WRITE | \ + LX_IOCTL_DIR_READ, (_size), (_type), (_code)) + +#define LX_DXOPENADAPTERFROMLUID \ + LX_IOWR(0x47, 0x01, sizeof(struct d3dkmt_openadapterfromluid))
<snip> These structures do not seem to be all using the correct types for a "real" ioctl in the kernel, so you will have to fix them all up before this will work properly.
+void ioctl_desc_init(void);
Very odd global name you are using here :) Anyway, neat stuff, glad to see it posted, great work! greg k-h