Skip to contentSkip to conversation

drm/nouveau: fixup the uapi header file.

PATCH In review Dave Airlie 4 participants 6 messages Jul 31, 2023 – Aug 1, 2023

Subsystems (3)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 drm/nouveau: fixup the uapi header file.

From: Dave Airlie <[email protected]>

nouveau > 10 years ago had a plan for new multiplexer inside a multiplexer API using nvif. It never fully reached fruition, fast forward 10 years, and the new vulkan driver is avoiding libdrm and calling ioctls, and these 3 ioctls, getparam, channel alloc + free don't seem to be things we'd want to use nvif for.

Undeprecate and put them into the uapi header so we can just copy it into mesa later.

---
 drivers/gpu/drm/nouveau/nouveau_abi16.h | 41 ---------------------
 include/uapi/drm/nouveau_drm.h          | 48 +++++++++++++++++++++++--
 2 files changed, 45 insertions(+), 44 deletions(-)
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -41
index 27eae85f33e6..d5d80d0d9011 100644
@@ -43,28 +43,6 @@ int  nouveau_abi16_usif(struct drm_file *, void *data, u32 size);
 #define NOUVEAU_GEM_DOMAIN_VRAM      (1 << 1)
 #define NOUVEAU_GEM_DOMAIN_GART      (1 << 2)
 
-struct drm_nouveau_channel_alloc {
-	uint32_t     fb_ctxdma_handle;
-	uint32_t     tt_ctxdma_handle;
-
-	int          channel;
-	uint32_t     pushbuf_domains;
-
-	/* Notifier memory */
-	uint32_t     notifier_handle;
-
-	/* DRM-enforced subchannel assignments */
-	struct {
-		uint32_t handle;
-		uint32_t grclass;
-	} subchan[8];
-	uint32_t nr_subchan;
-};
-
-struct drm_nouveau_channel_free {
-	int channel;
-};
-
 struct drm_nouveau_grobj_alloc {
 	int      channel;
 	uint32_t handle;
@@ -83,31 +61,12 @@ struct drm_nouveau_gpuobj_free {
 	uint32_t handle;
 };
 
-#define NOUVEAU_GETPARAM_PCI_VENDOR      3
-#define NOUVEAU_GETPARAM_PCI_DEVICE      4
-#define NOUVEAU_GETPARAM_BUS_TYPE        5
-#define NOUVEAU_GETPARAM_FB_SIZE         8
-#define NOUVEAU_GETPARAM_AGP_SIZE        9
-#define NOUVEAU_GETPARAM_CHIPSET_ID      11
-#define NOUVEAU_GETPARAM_VM_VRAM_BASE    12
-#define NOUVEAU_GETPARAM_GRAPH_UNITS     13
-#define NOUVEAU_GETPARAM_PTIMER_TIME     14
-#define NOUVEAU_GETPARAM_HAS_BO_USAGE    15
-#define NOUVEAU_GETPARAM_HAS_PAGEFLIP    16
-struct drm_nouveau_getparam {
-	uint64_t param;
-	uint64_t value;
-};
-
 struct drm_nouveau_setparam {
 	uint64_t param;
 	uint64_t value;
 };
 
-#define DRM_IOCTL_NOUVEAU_GETPARAM           DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GETPARAM, struct drm_nouveau_getparam)
 #define DRM_IOCTL_NOUVEAU_SETPARAM           DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_SETPARAM, struct drm_nouveau_setparam)
-#define DRM_IOCTL_NOUVEAU_CHANNEL_ALLOC      DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_ALLOC, struct drm_nouveau_channel_alloc)
-#define DRM_IOCTL_NOUVEAU_CHANNEL_FREE       DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_FREE, struct drm_nouveau_channel_free)
 #define DRM_IOCTL_NOUVEAU_GROBJ_ALLOC        DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GROBJ_ALLOC, struct drm_nouveau_grobj_alloc)
 #define DRM_IOCTL_NOUVEAU_NOTIFIEROBJ_ALLOC  DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_NOTIFIEROBJ_ALLOC, struct drm_nouveau_notifierobj_alloc)
 #define DRM_IOCTL_NOUVEAU_GPUOBJ_FREE        DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GPUOBJ_FREE, struct drm_nouveau_gpuobj_free)
include/uapi/drm/nouveau_drm.h +45 -3

67 lines not on this page · raw message

Signature · 1 line
2.41.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 158 lines · Dave Airlie

From: Dave Airlie <[email protected]>

nouveau > 10 years ago had a plan for new multiplexer inside a multiplexer API using nvif. It never fully reached fruition, fast forward 10 years, and the new vulkan driver is avoiding libdrm and calling ioctls, and these 3 ioctls, getparam, channel alloc + free don't seem to be things we'd want to use nvif for.

Undeprecate and put them into the uapi header so we can just copy it into mesa later.

---
 drivers/gpu/drm/nouveau/nouveau_abi16.h | 41 ---------------------
 include/uapi/drm/nouveau_drm.h          | 48 +++++++++++++++++++++++--
 2 files changed, 45 insertions(+), 44 deletions(-)
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -41
index 27eae85f33e6..d5d80d0d9011 100644
@@ -43,28 +43,6 @@ int  nouveau_abi16_usif(struct drm_file *, void *data, u32 size);
 #define NOUVEAU_GEM_DOMAIN_VRAM      (1 << 1)
 #define NOUVEAU_GEM_DOMAIN_GART      (1 << 2)
 
-struct drm_nouveau_channel_alloc {
-       uint32_t     fb_ctxdma_handle;
-       uint32_t     tt_ctxdma_handle;
-
-       int          channel;
-       uint32_t     pushbuf_domains;
-
-       /* Notifier memory */
-       uint32_t     notifier_handle;
-
-       /* DRM-enforced subchannel assignments */
-       struct {
-               uint32_t handle;
-               uint32_t grclass;
-       } subchan[8];
-       uint32_t nr_subchan;
-};
-
-struct drm_nouveau_channel_free {
-       int channel;
-};
-
 struct drm_nouveau_grobj_alloc {
        int      channel;
        uint32_t handle;
@@ -83,31 +61,12 @@ struct drm_nouveau_gpuobj_free {
        uint32_t handle;
 };
 
-#define NOUVEAU_GETPARAM_PCI_VENDOR      3
-#define NOUVEAU_GETPARAM_PCI_DEVICE      4
-#define NOUVEAU_GETPARAM_BUS_TYPE        5
-#define NOUVEAU_GETPARAM_FB_SIZE         8
-#define NOUVEAU_GETPARAM_AGP_SIZE        9
-#define NOUVEAU_GETPARAM_CHIPSET_ID      11
-#define NOUVEAU_GETPARAM_VM_VRAM_BASE    12
-#define NOUVEAU_GETPARAM_GRAPH_UNITS     13
-#define NOUVEAU_GETPARAM_PTIMER_TIME     14
-#define NOUVEAU_GETPARAM_HAS_BO_USAGE    15
-#define NOUVEAU_GETPARAM_HAS_PAGEFLIP    16
-struct drm_nouveau_getparam {
-       uint64_t param;
-       uint64_t value;
-};
-
 struct drm_nouveau_setparam {
        uint64_t param;
        uint64_t value;
 };
 
-#define DRM_IOCTL_NOUVEAU_GETPARAM           DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GETPARAM, struct drm_nouveau_getparam)
 #define DRM_IOCTL_NOUVEAU_SETPARAM           DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_SETPARAM, struct drm_nouveau_setparam)
-#define DRM_IOCTL_NOUVEAU_CHANNEL_ALLOC      DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_ALLOC, struct drm_nouveau_channel_alloc)
-#define DRM_IOCTL_NOUVEAU_CHANNEL_FREE       DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_FREE, struct drm_nouveau_channel_free)
 #define DRM_IOCTL_NOUVEAU_GROBJ_ALLOC        DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GROBJ_ALLOC, struct drm_nouveau_grobj_alloc)
 #define DRM_IOCTL_NOUVEAU_NOTIFIEROBJ_ALLOC  DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_NOTIFIEROBJ_ALLOC, struct drm_nouveau_notifierobj_alloc)
 #define DRM_IOCTL_NOUVEAU_GPUOBJ_FREE        DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GPUOBJ_FREE, struct drm_nouveau_gpuobj_free)
include/uapi/drm/nouveau_drm.h +45 -4
index 853a327433d3..1cd97b3d8eda 100644
@@ -33,6 +33,44 @@
 extern "C" {
 #endif
 
+#define NOUVEAU_GETPARAM_PCI_VENDOR      3
+#define NOUVEAU_GETPARAM_PCI_DEVICE      4
+#define NOUVEAU_GETPARAM_BUS_TYPE        5
+#define NOUVEAU_GETPARAM_FB_SIZE         8
+#define NOUVEAU_GETPARAM_AGP_SIZE        9
+#define NOUVEAU_GETPARAM_CHIPSET_ID      11
+#define NOUVEAU_GETPARAM_VM_VRAM_BASE    12
+#define NOUVEAU_GETPARAM_GRAPH_UNITS     13
+#define NOUVEAU_GETPARAM_PTIMER_TIME     14
+#define NOUVEAU_GETPARAM_HAS_BO_USAGE    15
+#define NOUVEAU_GETPARAM_HAS_PAGEFLIP    16
+struct drm_nouveau_getparam {
+       uint64_t param;
+       uint64_t value;
+};
+
+struct drm_nouveau_channel_alloc {
+       uint32_t     fb_ctxdma_handle;
+       uint32_t     tt_ctxdma_handle;
+
+       int          channel;
+       uint32_t     pushbuf_domains;
+
+       /* Notifier memory */
+       uint32_t     notifier_handle;
+
+       /* DRM-enforced subchannel assignments */
+       struct {
+               uint32_t handle;
+               uint32_t grclass;
+       } subchan[8];
+       uint32_t nr_subchan;
+};
+
+struct drm_nouveau_channel_free {
+       int channel;
+};
+
 #define NOUVEAU_GEM_DOMAIN_CPU       (1 << 0)
 #define NOUVEAU_GEM_DOMAIN_VRAM      (1 << 1)
 #define NOUVEAU_GEM_DOMAIN_GART      (1 << 2)
@@ -126,10 +164,10 @@ struct drm_nouveau_gem_cpu_fini {
        __u32 handle;
 };
 
-#define DRM_NOUVEAU_GETPARAM           0x00 /* deprecated */
+#define DRM_NOUVEAU_GETPARAM           0x00
 #define DRM_NOUVEAU_SETPARAM           0x01 /* deprecated */
-#define DRM_NOUVEAU_CHANNEL_ALLOC      0x02 /* deprecated */
-#define DRM_NOUVEAU_CHANNEL_FREE       0x03 /* deprecated */
+#define DRM_NOUVEAU_CHANNEL_ALLOC      0x02
+#define DRM_NOUVEAU_CHANNEL_FREE       0x03
 #define DRM_NOUVEAU_GROBJ_ALLOC        0x04 /* deprecated */
 #define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC  0x05 /* deprecated */
 #define DRM_NOUVEAU_GPUOBJ_FREE        0x06 /* deprecated */
@@ -188,6 +226,10 @@ struct drm_nouveau_svm_bind {
 #define NOUVEAU_SVM_BIND_TARGET__GPU_VRAM               (1UL << 31)
 
 
+#define DRM_IOCTL_NOUVEAU_GETPARAM           DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GETPARAM, struct drm_nouveau_getparam)
+#define DRM_IOCTL_NOUVEAU_CHANNEL_ALLOC      DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_ALLOC, struct drm_nouveau_channel_alloc)
+#define DRM_IOCTL_NOUVEAU_CHANNEL_FREE       DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_FREE, struct drm_nouveau_channel_free)
+
 #define DRM_IOCTL_NOUVEAU_SVM_INIT           DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_SVM_INIT, struct drm_nouveau_svm_init)
 #define DRM_IOCTL_NOUVEAU_SVM_BIND           DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_SVM_BIND, struct drm_nouveau_svm_bind)
 
--
Quoted 2 lines

2.41.0

#2 lore raw
Quoted 113 lines · Karol Herbst
Quoted 4 lines · Dave Airlie

From: Dave Airlie <[email protected]>

nouveau > 10 years ago had a plan for new multiplexer inside a

multiplexer

Quoted 8 lines

API using nvif. It never fully reached fruition, fast forward 10 years, and the new vulkan driver is avoiding libdrm and calling ioctls, and these 3 ioctls, getparam, channel alloc + free don't seem to be things we'd want to use nvif for.

Undeprecate and put them into the uapi header so we can just copy it into mesa later.

Review

Quoted 7 lines
---
 drivers/gpu/drm/nouveau/nouveau_abi16.h | 41 ---------------------
 include/uapi/drm/nouveau_drm.h          | 48 +++++++++++++++++++++++--
 2 files changed, 45 insertions(+), 44 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/nouveau/nouveau_abi16.h

drivers/gpu/drm/nouveau/nouveau_abi16.h int nouveau_abi16_usif(struct drm_file *, void

Quoted 4 lines

index 27eae85f33e6..d5d80d0d9011 100644

drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -0
@@ -43,28 +43,6 @@ int  nouveau_abi16_usif(struct drm_file *, void

*data, u32 size);

Quoted 44 lines
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -34
 #define NOUVEAU_GEM_DOMAIN_VRAM      (1 << 1)
 #define NOUVEAU_GEM_DOMAIN_GART      (1 << 2)
 
-struct drm_nouveau_channel_alloc {
-       uint32_t     fb_ctxdma_handle;
-       uint32_t     tt_ctxdma_handle;
-
-       int          channel;
-       uint32_t     pushbuf_domains;
-
-       /* Notifier memory */
-       uint32_t     notifier_handle;
-
-       /* DRM-enforced subchannel assignments */
-       struct {
-               uint32_t handle;
-               uint32_t grclass;
-       } subchan[8];
-       uint32_t nr_subchan;
-};
-
-struct drm_nouveau_channel_free {
-       int channel;
-};
-
 struct drm_nouveau_grobj_alloc {
        int      channel;
        uint32_t handle;
@@ -83,31 +61,12 @@ struct drm_nouveau_gpuobj_free {
        uint32_t handle;
 };
 
-#define NOUVEAU_GETPARAM_PCI_VENDOR      3
-#define NOUVEAU_GETPARAM_PCI_DEVICE      4
-#define NOUVEAU_GETPARAM_BUS_TYPE        5
-#define NOUVEAU_GETPARAM_FB_SIZE         8
-#define NOUVEAU_GETPARAM_AGP_SIZE        9
-#define NOUVEAU_GETPARAM_CHIPSET_ID      11
-#define NOUVEAU_GETPARAM_VM_VRAM_BASE    12
-#define NOUVEAU_GETPARAM_GRAPH_UNITS     13
-#define NOUVEAU_GETPARAM_PTIMER_TIME     14
-#define NOUVEAU_GETPARAM_HAS_BO_USAGE    15
-#define NOUVEAU_GETPARAM_HAS_PAGEFLIP    16
-struct drm_nouveau_getparam {

drivers/gpu/drm/nouveau/nouveau_abi16.h struct drm_nouveau_gpuobj_free { · line 107

Quoted 10 lines
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -5
-       uint64_t param;
-       uint64_t value;
-};
-
 struct drm_nouveau_setparam {
        uint64_t param;
        uint64_t value;
 };
 
-#define DRM_IOCTL_NOUVEAU_GETPARAM           DRM_IOWR(DRM_COMMAND_BASE

+ DRM_NOUVEAU_GETPARAM, struct drm_nouveau_getparam)

drivers/gpu/drm/nouveau/nouveau_abi16.h struct drm_nouveau_gpuobj_free { · line 69

Quoted 1 line
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -0
 #define DRM_IOCTL_NOUVEAU_SETPARAM           DRM_IOWR(DRM_COMMAND_BASE

+ DRM_NOUVEAU_SETPARAM, struct drm_nouveau_setparam)

drivers/gpu/drm/nouveau/nouveau_abi16.h struct drm_nouveau_gpuobj_free { · line 109

Quoted 1 line
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -1
-#define DRM_IOCTL_NOUVEAU_CHANNEL_ALLOC      DRM_IOWR(DRM_COMMAND_BASE

+ DRM_NOUVEAU_CHANNEL_ALLOC, struct drm_nouveau_channel_alloc)

drivers/gpu/drm/nouveau/nouveau_abi16.h struct drm_nouveau_gpuobj_free { · line 110

Quoted 1 line
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -1
-#define DRM_IOCTL_NOUVEAU_CHANNEL_FREE       DRM_IOW (DRM_COMMAND_BASE

+ DRM_NOUVEAU_CHANNEL_FREE, struct drm_nouveau_channel_free)

drivers/gpu/drm/nouveau/nouveau_abi16.h struct drm_nouveau_gpuobj_free { · line 70

Quoted 1 line
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -0
 #define DRM_IOCTL_NOUVEAU_GROBJ_ALLOC        DRM_IOW (DRM_COMMAND_BASE

+ DRM_NOUVEAU_GROBJ_ALLOC, struct drm_nouveau_grobj_alloc)

drivers/gpu/drm/nouveau/nouveau_abi16.h struct drm_nouveau_gpuobj_free { · line 71

Quoted 1 line
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -0
 #define DRM_IOCTL_NOUVEAU_NOTIFIEROBJ_ALLOC  DRM_IOWR(DRM_COMMAND_BASE

+ DRM_NOUVEAU_NOTIFIEROBJ_ALLOC, struct drm_nouveau_notifierobj_alloc)

drivers/gpu/drm/nouveau/nouveau_abi16.h struct drm_nouveau_gpuobj_free { · line 72

Quoted 1 line
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -0
 #define DRM_IOCTL_NOUVEAU_GPUOBJ_FREE        DRM_IOW (DRM_COMMAND_BASE

+ DRM_NOUVEAU_GPUOBJ_FREE, struct drm_nouveau_gpuobj_free)

Review

Quoted 1 line
(quoted diff) +0 -0

b/include/uapi/drm/nouveau_drm.h

Quoted 17 lines

index 853a327433d3..1cd97b3d8eda 100644

include/uapi/drm/nouveau_drm.h +10 -0
@@ -33,6 +33,44 @@
 extern "C" {
 #endif
 
+#define NOUVEAU_GETPARAM_PCI_VENDOR      3
+#define NOUVEAU_GETPARAM_PCI_DEVICE      4
+#define NOUVEAU_GETPARAM_BUS_TYPE        5
+#define NOUVEAU_GETPARAM_FB_SIZE         8
+#define NOUVEAU_GETPARAM_AGP_SIZE        9
+#define NOUVEAU_GETPARAM_CHIPSET_ID      11
+#define NOUVEAU_GETPARAM_VM_VRAM_BASE    12
+#define NOUVEAU_GETPARAM_GRAPH_UNITS     13
+#define NOUVEAU_GETPARAM_PTIMER_TIME     14
+#define NOUVEAU_GETPARAM_HAS_BO_USAGE    15
Quoted 9 lines

include/uapi/drm/nouveau_drm.h line 53

Quoted 8 lines
include/uapi/drm/nouveau_drm.h +8 -0
+#define NOUVEAU_GETPARAM_HAS_PAGEFLIP    16
+struct drm_nouveau_getparam {
+       uint64_t param;
+       uint64_t value;
+};
+
+struct drm_nouveau_channel_alloc {
+       uint32_t     fb_ctxdma_handle;

Do we want to use uint32_t or __u32 here? It looks like the original headers used uint32_t and then it got switched to __u32 after the deprecation happened. We probably want __u32 given that this is a uapi header.

Quoted 4 lines

include/uapi/drm/nouveau_drm.h line 56

Quoted 3 lines
include/uapi/drm/nouveau_drm.h +3 -0
+       uint32_t     tt_ctxdma_handle;
+
+       int          channel;

IDK what to do about this one. I want to make it __s32. I think that should be safe on all the hardware we care about. Having an unsized type in a UAPI header is concerning.

~Faith

Quoted 57 lines
Quoted 35 lines
include/uapi/drm/nouveau_drm.h +20 -3
+       uint32_t     pushbuf_domains;
+
+       /* Notifier memory */
+       uint32_t     notifier_handle;
+
+       /* DRM-enforced subchannel assignments */
+       struct {
+               uint32_t handle;
+               uint32_t grclass;
+       } subchan[8];
+       uint32_t nr_subchan;
+};
+
+struct drm_nouveau_channel_free {
+       int channel;
+};
+
 #define NOUVEAU_GEM_DOMAIN_CPU       (1 << 0)
 #define NOUVEAU_GEM_DOMAIN_VRAM      (1 << 1)
 #define NOUVEAU_GEM_DOMAIN_GART      (1 << 2)
@@ -126,10 +164,10 @@ struct drm_nouveau_gem_cpu_fini {
        __u32 handle;
 };
 
-#define DRM_NOUVEAU_GETPARAM           0x00 /* deprecated */
+#define DRM_NOUVEAU_GETPARAM           0x00
 #define DRM_NOUVEAU_SETPARAM           0x01 /* deprecated */
-#define DRM_NOUVEAU_CHANNEL_ALLOC      0x02 /* deprecated */
-#define DRM_NOUVEAU_CHANNEL_FREE       0x03 /* deprecated */
+#define DRM_NOUVEAU_CHANNEL_ALLOC      0x02
+#define DRM_NOUVEAU_CHANNEL_FREE       0x03
 #define DRM_NOUVEAU_GROBJ_ALLOC        0x04 /* deprecated */
 #define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC  0x05 /* deprecated */
 #define DRM_NOUVEAU_GPUOBJ_FREE        0x06 /* deprecated */

include/uapi/drm/nouveau_drm.h struct drm_nouveau_svm_bind { · line 229

Quoted 4 lines
include/uapi/drm/nouveau_drm.h +1 -0
@@ -188,6 +226,10 @@ struct drm_nouveau_svm_bind {
 #define NOUVEAU_SVM_BIND_TARGET__GPU_VRAM               (1UL << 31)
 
 
+#define DRM_IOCTL_NOUVEAU_GETPARAM           DRM_IOWR(DRM_COMMAND_BASE

+ DRM_NOUVEAU_GETPARAM, struct drm_nouveau_getparam)

include/uapi/drm/nouveau_drm.h struct drm_nouveau_svm_bind { · line 230

Quoted 1 line
include/uapi/drm/nouveau_drm.h +1 -0
+#define DRM_IOCTL_NOUVEAU_CHANNEL_ALLOC      DRM_IOWR(DRM_COMMAND_BASE

+ DRM_NOUVEAU_CHANNEL_ALLOC, struct drm_nouveau_channel_alloc)

include/uapi/drm/nouveau_drm.h struct drm_nouveau_svm_bind { · line 231

Quoted 1 line
include/uapi/drm/nouveau_drm.h +1 -0
+#define DRM_IOCTL_NOUVEAU_CHANNEL_FREE       DRM_IOW (DRM_COMMAND_BASE

+ DRM_NOUVEAU_CHANNEL_FREE, struct drm_nouveau_channel_free)

include/uapi/drm/nouveau_drm.h struct drm_nouveau_svm_bind { · line 233

Quoted 2 lines
include/uapi/drm/nouveau_drm.h +1 -0
+
 #define DRM_IOCTL_NOUVEAU_SVM_INIT           DRM_IOWR(DRM_COMMAND_BASE

+ DRM_NOUVEAU_SVM_INIT, struct drm_nouveau_svm_init)

include/uapi/drm/nouveau_drm.h struct drm_nouveau_svm_bind { · line 234

Quoted 1 line
include/uapi/drm/nouveau_drm.h +0 -0
 #define DRM_IOCTL_NOUVEAU_SVM_BIND           DRM_IOWR(DRM_COMMAND_BASE

+ DRM_NOUVEAU_SVM_BIND, struct drm_nouveau_svm_bind)

Quoted 4 lines
include/uapi/drm/nouveau_drm.h +0 -1
--

2.41.0

#3 lore raw
Quoted 131 lines · Faith Ekstrand
Quoted 113 lines · Karol Herbst
Quoted 4 lines · Dave Airlie

From: Dave Airlie <[email protected]>

nouveau > 10 years ago had a plan for new multiplexer inside a

multiplexer

Quoted 8 lines

API using nvif. It never fully reached fruition, fast forward 10 years, and the new vulkan driver is avoiding libdrm and calling ioctls, and these 3 ioctls, getparam, channel alloc + free don't seem to be things we'd want to use nvif for.

Undeprecate and put them into the uapi header so we can just copy it into mesa later.

Review

Quoted 7 lines
---
 drivers/gpu/drm/nouveau/nouveau_abi16.h | 41 ---------------------
 include/uapi/drm/nouveau_drm.h          | 48 +++++++++++++++++++++++--
 2 files changed, 45 insertions(+), 44 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/nouveau/nouveau_abi16.h

drivers/gpu/drm/nouveau/nouveau_abi16.h int nouveau_abi16_usif(struct drm_file *, void

Quoted 4 lines

index 27eae85f33e6..d5d80d0d9011 100644

drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -0
@@ -43,28 +43,6 @@ int  nouveau_abi16_usif(struct drm_file *, void

*data, u32 size);

Quoted 44 lines
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -34
 #define NOUVEAU_GEM_DOMAIN_VRAM      (1 << 1)
 #define NOUVEAU_GEM_DOMAIN_GART      (1 << 2)
 
-struct drm_nouveau_channel_alloc {
-       uint32_t     fb_ctxdma_handle;
-       uint32_t     tt_ctxdma_handle;
-
-       int          channel;
-       uint32_t     pushbuf_domains;
-
-       /* Notifier memory */
-       uint32_t     notifier_handle;
-
-       /* DRM-enforced subchannel assignments */
-       struct {
-               uint32_t handle;
-               uint32_t grclass;
-       } subchan[8];
-       uint32_t nr_subchan;
-};
-
-struct drm_nouveau_channel_free {
-       int channel;
-};
-
 struct drm_nouveau_grobj_alloc {
        int      channel;
        uint32_t handle;
@@ -83,31 +61,12 @@ struct drm_nouveau_gpuobj_free {
        uint32_t handle;
 };
 
-#define NOUVEAU_GETPARAM_PCI_VENDOR      3
-#define NOUVEAU_GETPARAM_PCI_DEVICE      4
-#define NOUVEAU_GETPARAM_BUS_TYPE        5
-#define NOUVEAU_GETPARAM_FB_SIZE         8
-#define NOUVEAU_GETPARAM_AGP_SIZE        9
-#define NOUVEAU_GETPARAM_CHIPSET_ID      11
-#define NOUVEAU_GETPARAM_VM_VRAM_BASE    12
-#define NOUVEAU_GETPARAM_GRAPH_UNITS     13
-#define NOUVEAU_GETPARAM_PTIMER_TIME     14
-#define NOUVEAU_GETPARAM_HAS_BO_USAGE    15
-#define NOUVEAU_GETPARAM_HAS_PAGEFLIP    16
-struct drm_nouveau_getparam {

drivers/gpu/drm/nouveau/nouveau_abi16.h struct drm_nouveau_gpuobj_free { · line 107

Quoted 10 lines
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -5
-       uint64_t param;
-       uint64_t value;
-};
-
 struct drm_nouveau_setparam {
        uint64_t param;
        uint64_t value;
 };
 
-#define DRM_IOCTL_NOUVEAU_GETPARAM           DRM_IOWR(DRM_COMMAND_BASE

+ DRM_NOUVEAU_GETPARAM, struct drm_nouveau_getparam)

drivers/gpu/drm/nouveau/nouveau_abi16.h struct drm_nouveau_gpuobj_free { · line 69

Quoted 1 line
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -0
 #define DRM_IOCTL_NOUVEAU_SETPARAM           DRM_IOWR(DRM_COMMAND_BASE

+ DRM_NOUVEAU_SETPARAM, struct drm_nouveau_setparam)

drivers/gpu/drm/nouveau/nouveau_abi16.h struct drm_nouveau_gpuobj_free { · line 109

Quoted 1 line
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -1
-#define DRM_IOCTL_NOUVEAU_CHANNEL_ALLOC      DRM_IOWR(DRM_COMMAND_BASE

+ DRM_NOUVEAU_CHANNEL_ALLOC, struct drm_nouveau_channel_alloc)

drivers/gpu/drm/nouveau/nouveau_abi16.h struct drm_nouveau_gpuobj_free { · line 110

Quoted 1 line
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -1
-#define DRM_IOCTL_NOUVEAU_CHANNEL_FREE       DRM_IOW (DRM_COMMAND_BASE

+ DRM_NOUVEAU_CHANNEL_FREE, struct drm_nouveau_channel_free)

drivers/gpu/drm/nouveau/nouveau_abi16.h struct drm_nouveau_gpuobj_free { · line 70

Quoted 1 line
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -0
 #define DRM_IOCTL_NOUVEAU_GROBJ_ALLOC        DRM_IOW (DRM_COMMAND_BASE

+ DRM_NOUVEAU_GROBJ_ALLOC, struct drm_nouveau_grobj_alloc)

drivers/gpu/drm/nouveau/nouveau_abi16.h struct drm_nouveau_gpuobj_free { · line 71

Quoted 1 line
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -0
 #define DRM_IOCTL_NOUVEAU_NOTIFIEROBJ_ALLOC  DRM_IOWR(DRM_COMMAND_BASE

+ DRM_NOUVEAU_NOTIFIEROBJ_ALLOC, struct drm_nouveau_notifierobj_alloc)

drivers/gpu/drm/nouveau/nouveau_abi16.h struct drm_nouveau_gpuobj_free { · line 72

Quoted 1 line
drivers/gpu/drm/nouveau/nouveau_abi16.h +0 -0
 #define DRM_IOCTL_NOUVEAU_GPUOBJ_FREE        DRM_IOW (DRM_COMMAND_BASE

+ DRM_NOUVEAU_GPUOBJ_FREE, struct drm_nouveau_gpuobj_free)

Review

Quoted 1 line
(quoted diff) +0 -0

b/include/uapi/drm/nouveau_drm.h

Quoted 17 lines

index 853a327433d3..1cd97b3d8eda 100644

include/uapi/drm/nouveau_drm.h +10 -0
@@ -33,6 +33,44 @@
 extern "C" {
 #endif
 
+#define NOUVEAU_GETPARAM_PCI_VENDOR      3
+#define NOUVEAU_GETPARAM_PCI_DEVICE      4
+#define NOUVEAU_GETPARAM_BUS_TYPE        5
+#define NOUVEAU_GETPARAM_FB_SIZE         8
+#define NOUVEAU_GETPARAM_AGP_SIZE        9
+#define NOUVEAU_GETPARAM_CHIPSET_ID      11
+#define NOUVEAU_GETPARAM_VM_VRAM_BASE    12
+#define NOUVEAU_GETPARAM_GRAPH_UNITS     13
+#define NOUVEAU_GETPARAM_PTIMER_TIME     14
+#define NOUVEAU_GETPARAM_HAS_BO_USAGE    15
Quoted 9 lines

include/uapi/drm/nouveau_drm.h line 53

Quoted 8 lines
include/uapi/drm/nouveau_drm.h +8 -0
+#define NOUVEAU_GETPARAM_HAS_PAGEFLIP    16
+struct drm_nouveau_getparam {
+       uint64_t param;
+       uint64_t value;
+};
+
+struct drm_nouveau_channel_alloc {
+       uint32_t     fb_ctxdma_handle;

Do we want to use uint32_t or __u32 here? It looks like the original headers used uint32_t and then it got switched to __u32 after the deprecation happened. We probably want __u32 given that this is a uapi header.

Quoted 10 lines
Quoted 4 lines

include/uapi/drm/nouveau_drm.h line 56

Quoted 3 lines
include/uapi/drm/nouveau_drm.h +3 -0
+       uint32_t     tt_ctxdma_handle;
+
+       int          channel;

IDK what to do about this one. I want to make it __s32. I think that should be safe on all the hardware we care about. Having an unsized type in a UAPI header is concerning.

Do we have any architectures we care about where int isn't __s32? I think on all 32/64 bit x86, ppc and arm it's that way and I don't think we care about anything else?

Quoted 60 lines

~Faith

Quoted 57 lines
Quoted 35 lines
include/uapi/drm/nouveau_drm.h +20 -3
+       uint32_t     pushbuf_domains;
+
+       /* Notifier memory */
+       uint32_t     notifier_handle;
+
+       /* DRM-enforced subchannel assignments */
+       struct {
+               uint32_t handle;
+               uint32_t grclass;
+       } subchan[8];
+       uint32_t nr_subchan;
+};
+
+struct drm_nouveau_channel_free {
+       int channel;
+};
+
 #define NOUVEAU_GEM_DOMAIN_CPU       (1 << 0)
 #define NOUVEAU_GEM_DOMAIN_VRAM      (1 << 1)
 #define NOUVEAU_GEM_DOMAIN_GART      (1 << 2)
@@ -126,10 +164,10 @@ struct drm_nouveau_gem_cpu_fini {
        __u32 handle;
 };
 
-#define DRM_NOUVEAU_GETPARAM           0x00 /* deprecated */
+#define DRM_NOUVEAU_GETPARAM           0x00
 #define DRM_NOUVEAU_SETPARAM           0x01 /* deprecated */
-#define DRM_NOUVEAU_CHANNEL_ALLOC      0x02 /* deprecated */
-#define DRM_NOUVEAU_CHANNEL_FREE       0x03 /* deprecated */
+#define DRM_NOUVEAU_CHANNEL_ALLOC      0x02
+#define DRM_NOUVEAU_CHANNEL_FREE       0x03
 #define DRM_NOUVEAU_GROBJ_ALLOC        0x04 /* deprecated */
 #define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC  0x05 /* deprecated */
 #define DRM_NOUVEAU_GPUOBJ_FREE        0x06 /* deprecated */

include/uapi/drm/nouveau_drm.h struct drm_nouveau_svm_bind { · line 229

Quoted 4 lines
include/uapi/drm/nouveau_drm.h +1 -0
@@ -188,6 +226,10 @@ struct drm_nouveau_svm_bind {
 #define NOUVEAU_SVM_BIND_TARGET__GPU_VRAM               (1UL << 31)
 
 
+#define DRM_IOCTL_NOUVEAU_GETPARAM           DRM_IOWR(DRM_COMMAND_BASE

+ DRM_NOUVEAU_GETPARAM, struct drm_nouveau_getparam)

include/uapi/drm/nouveau_drm.h struct drm_nouveau_svm_bind { · line 230

Quoted 1 line
include/uapi/drm/nouveau_drm.h +1 -0
+#define DRM_IOCTL_NOUVEAU_CHANNEL_ALLOC      DRM_IOWR(DRM_COMMAND_BASE

+ DRM_NOUVEAU_CHANNEL_ALLOC, struct drm_nouveau_channel_alloc)

include/uapi/drm/nouveau_drm.h struct drm_nouveau_svm_bind { · line 231

Quoted 1 line
include/uapi/drm/nouveau_drm.h +1 -0
+#define DRM_IOCTL_NOUVEAU_CHANNEL_FREE       DRM_IOW (DRM_COMMAND_BASE

+ DRM_NOUVEAU_CHANNEL_FREE, struct drm_nouveau_channel_free)

include/uapi/drm/nouveau_drm.h struct drm_nouveau_svm_bind { · line 233

Quoted 2 lines
include/uapi/drm/nouveau_drm.h +1 -0
+
 #define DRM_IOCTL_NOUVEAU_SVM_INIT           DRM_IOWR(DRM_COMMAND_BASE

+ DRM_NOUVEAU_SVM_INIT, struct drm_nouveau_svm_init)

include/uapi/drm/nouveau_drm.h struct drm_nouveau_svm_bind { · line 234

Quoted 1 line
include/uapi/drm/nouveau_drm.h +0 -0
 #define DRM_IOCTL_NOUVEAU_SVM_BIND           DRM_IOWR(DRM_COMMAND_BASE

+ DRM_NOUVEAU_SVM_BIND, struct drm_nouveau_svm_bind)

Quoted 4 lines
include/uapi/drm/nouveau_drm.h +0 -1
--

2.41.0

#4 lore raw
In reply to Dave Airlie
kernel test robot noticed the following build errors:

Hi Dave,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on drm/drm-next drm-exynos/exynos-drm-next drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-tip/drm-tip linus/master v6.5-rc4 next-20230801] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Dave-Airlie/drm-nouveau-fixup-the-uapi-header-file/20230801-031705
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20230731191557.4179175-1-airlied%40gmail.com
patch subject: [PATCH] drm/nouveau: fixup the uapi header file.
config: i386-randconfig-m021-20230730 (https://download.01.org/0day-ci/archive/20230802/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230802/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from <command-line>:

>> ./usr/include/drm/nouveau_drm.h:48:9: error: unknown type name 'uint64_t'
      48 |         uint64_t param;
         |         ^~~~~~~~
   ./usr/include/drm/nouveau_drm.h:49:9: error: unknown type name 'uint64_t'
      49 |         uint64_t value;
         |         ^~~~~~~~
>> ./usr/include/drm/nouveau_drm.h:53:9: error: unknown type name 'uint32_t'
      53 |         uint32_t     fb_ctxdma_handle;
         |         ^~~~~~~~
   ./usr/include/drm/nouveau_drm.h:54:9: error: unknown type name 'uint32_t'
      54 |         uint32_t     tt_ctxdma_handle;
         |         ^~~~~~~~
   ./usr/include/drm/nouveau_drm.h:57:9: error: unknown type name 'uint32_t'
      57 |         uint32_t     pushbuf_domains;
         |         ^~~~~~~~
   ./usr/include/drm/nouveau_drm.h:60:9: error: unknown type name 'uint32_t'
      60 |         uint32_t     notifier_handle;
         |         ^~~~~~~~
   ./usr/include/drm/nouveau_drm.h:64:17: error: unknown type name 'uint32_t'
      64 |                 uint32_t handle;
         |                 ^~~~~~~~
   ./usr/include/drm/nouveau_drm.h:65:17: error: unknown type name 'uint32_t'
      65 |                 uint32_t grclass;
         |                 ^~~~~~~~
   ./usr/include/drm/nouveau_drm.h:67:9: error: unknown type name 'uint32_t'
      67 |         uint32_t nr_subchan;
         |         ^~~~~~~~
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#5 lore raw
In reply to Dave Airlie
kernel test robot noticed the following build errors:

Hi Dave,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on drm/drm-next drm-exynos/exynos-drm-next drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-tip/drm-tip linus/master v6.5-rc4 next-20230801] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Dave-Airlie/drm-nouveau-fixup-the-uapi-header-file/20230801-031705
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20230731191557.4179175-1-airlied%40gmail.com
patch subject: [PATCH] drm/nouveau: fixup the uapi header file.
config: i386-randconfig-i012-20230731 (https://download.01.org/0day-ci/archive/20230802/[email protected]/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce: (https://download.01.org/0day-ci/archive/20230802/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from <built-in>:1:

>> ./usr/include/drm/nouveau_drm.h:48:2: error: unknown type name 'uint64_t'
           uint64_t param;
           ^
   ./usr/include/drm/nouveau_drm.h:49:2: error: unknown type name 'uint64_t'
           uint64_t value;
           ^
>> ./usr/include/drm/nouveau_drm.h:53:2: error: unknown type name 'uint32_t'
           uint32_t     fb_ctxdma_handle;
           ^
   ./usr/include/drm/nouveau_drm.h:54:2: error: unknown type name 'uint32_t'
           uint32_t     tt_ctxdma_handle;
           ^
   ./usr/include/drm/nouveau_drm.h:57:2: error: unknown type name 'uint32_t'
           uint32_t     pushbuf_domains;
           ^
   ./usr/include/drm/nouveau_drm.h:60:2: error: unknown type name 'uint32_t'
           uint32_t     notifier_handle;
           ^
   ./usr/include/drm/nouveau_drm.h:64:3: error: unknown type name 'uint32_t'
                   uint32_t handle;
                   ^
   ./usr/include/drm/nouveau_drm.h:65:3: error: unknown type name 'uint32_t'
                   uint32_t grclass;
                   ^
   ./usr/include/drm/nouveau_drm.h:67:2: error: unknown type name 'uint32_t'
           uint32_t nr_subchan;
           ^

9 errors generated.

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki