* [PATCH v2 1/3] Documentation: Bump media IOCTL reserved numbers
2025-05-27 5:56 [PATCH v2 0/3] Document Media Controller IOCTL number assignments Sakari Ailus
@ 2025-05-27 5:56 ` Sakari Ailus
2025-05-27 5:56 ` [PATCH v2 2/3] media: uapi: Document IOCTL number assignment Sakari Ailus
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Sakari Ailus @ 2025-05-27 5:56 UTC (permalink / raw)
To: linux-doc
Cc: Jonathan Corbet, Greg Kroah-Hartman, Madhavan Srinivasan,
Haren Myneni, Bagas Sanjaya, Andrew Donnellan, Michael Ellerman,
Akshay Gupta, linux-kernel, linux-media, hans, laurent.pinchart,
Mauro Carvalho Chehab, Lee Jones
The Media Controller uses IOCTL type '|' with numbers up to 0x81 while
numbers from 0x80 onwards are allocated for samples, creating a conflict
between allocations for MC and samples. Given that nothing appears to be
using numbers between 0x80 and 0x8f for other purposes than MC, even in
the samples allocation (checked with $ git grep "#define.*_IO.*'|'"), just
reassign the numbers up to 0x8f to linux/media.h and bump the samples
allocation by 0x10.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Documentation/userspace-api/ioctl/ioctl-number.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/userspace-api/ioctl/ioctl-number.rst b/Documentation/userspace-api/ioctl/ioctl-number.rst
index bc91756bde73..6b3be3fb0b15 100644
--- a/Documentation/userspace-api/ioctl/ioctl-number.rst
+++ b/Documentation/userspace-api/ioctl/ioctl-number.rst
@@ -312,8 +312,8 @@ Code Seq# Include File Comments
'z' 40-7F CAN bus card conflict!
<mailto:oe@port.de>
'z' 10-4F drivers/s390/crypto/zcrypt_api.h conflict!
-'|' 00-7F linux/media.h
-'|' 80-9F samples/ Any sample and example drivers
+'|' 00-8F linux/media.h
+'|' 90-AF samples/ Any sample and example drivers
0x80 00-1F linux/fb.h
0x81 00-1F linux/vduse.h
0x89 00-06 arch/x86/include/asm/sockios.h
--
2.39.5
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v2 2/3] media: uapi: Document IOCTL number assignment
2025-05-27 5:56 [PATCH v2 0/3] Document Media Controller IOCTL number assignments Sakari Ailus
2025-05-27 5:56 ` [PATCH v2 1/3] Documentation: Bump media IOCTL reserved numbers Sakari Ailus
@ 2025-05-27 5:56 ` Sakari Ailus
2025-05-27 5:56 ` [PATCH v2 3/3] samples: rust_misc_device: Bump IOCTL numbers Sakari Ailus
2025-09-05 10:25 ` [PATCH v2 0/3] Document Media Controller IOCTL number assignments Sakari Ailus
3 siblings, 0 replies; 7+ messages in thread
From: Sakari Ailus @ 2025-05-27 5:56 UTC (permalink / raw)
To: linux-doc
Cc: Jonathan Corbet, Greg Kroah-Hartman, Madhavan Srinivasan,
Haren Myneni, Bagas Sanjaya, Andrew Donnellan, Michael Ellerman,
Akshay Gupta, linux-kernel, linux-media, hans, laurent.pinchart,
Mauro Carvalho Chehab, Lee Jones
Document MC IOCTL number assignment in linux/media.h. In the past the
assignment up to 0x7f was missed so to prevent that from happening again,
document the value here as well.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
include/uapi/linux/media.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index 1c80b1d6bbaf..2808132fcf49 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -381,6 +381,10 @@ struct media_v2_topology {
*/
#define MEDIA_REQUEST_IOC_QUEUE _IO('|', 0x80)
#define MEDIA_REQUEST_IOC_REINIT _IO('|', 0x81)
+/*
+ * Don't allocate new IOCTL numbers past 0x8f, MC IOCTL number assignment ends
+ * there!
+ */
#ifndef __KERNEL__
--
2.39.5
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v2 3/3] samples: rust_misc_device: Bump IOCTL numbers
2025-05-27 5:56 [PATCH v2 0/3] Document Media Controller IOCTL number assignments Sakari Ailus
2025-05-27 5:56 ` [PATCH v2 1/3] Documentation: Bump media IOCTL reserved numbers Sakari Ailus
2025-05-27 5:56 ` [PATCH v2 2/3] media: uapi: Document IOCTL number assignment Sakari Ailus
@ 2025-05-27 5:56 ` Sakari Ailus
2025-09-05 10:25 ` [PATCH v2 0/3] Document Media Controller IOCTL number assignments Sakari Ailus
3 siblings, 0 replies; 7+ messages in thread
From: Sakari Ailus @ 2025-05-27 5:56 UTC (permalink / raw)
To: linux-doc
Cc: Jonathan Corbet, Greg Kroah-Hartman, Madhavan Srinivasan,
Haren Myneni, Bagas Sanjaya, Andrew Donnellan, Michael Ellerman,
Akshay Gupta, linux-kernel, linux-media, hans, laurent.pinchart,
Mauro Carvalho Chehab, Lee Jones
Use 0x90 as the IOCTL number base instead of 0x80, thus avoiding using the
same IOCTL numbers as the Media Controller. The change is also in line
with current IOCTL number documentation.
Also use 0xaf, belonging to the samples IOCTL number range, as the
unimplemented IOCTL.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
samples/rust/rust_misc_device.rs | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/samples/rust/rust_misc_device.rs b/samples/rust/rust_misc_device.rs
index c881fd6dbd08..2bd017d7c7c3 100644
--- a/samples/rust/rust_misc_device.rs
+++ b/samples/rust/rust_misc_device.rs
@@ -14,10 +14,10 @@
//! #include <unistd.h>
//! #include <sys/ioctl.h>
//!
-//! #define RUST_MISC_DEV_FAIL _IO('|', 0)
-//! #define RUST_MISC_DEV_HELLO _IO('|', 0x80)
-//! #define RUST_MISC_DEV_GET_VALUE _IOR('|', 0x81, int)
-//! #define RUST_MISC_DEV_SET_VALUE _IOW('|', 0x82, int)
+//! #define RUST_MISC_DEV_FAIL _IO('|', 0xaf)
+//! #define RUST_MISC_DEV_HELLO _IO('|', 0x90)
+//! #define RUST_MISC_DEV_GET_VALUE _IOR('|', 0x91, int)
+//! #define RUST_MISC_DEV_SET_VALUE _IOW('|', 0x92, int)
//!
//! int main() {
//! int value, new_value;
@@ -110,9 +110,9 @@
uaccess::{UserSlice, UserSliceReader, UserSliceWriter},
};
-const RUST_MISC_DEV_HELLO: u32 = _IO('|' as u32, 0x80);
-const RUST_MISC_DEV_GET_VALUE: u32 = _IOR::<i32>('|' as u32, 0x81);
-const RUST_MISC_DEV_SET_VALUE: u32 = _IOW::<i32>('|' as u32, 0x82);
+const RUST_MISC_DEV_HELLO: u32 = _IO('|' as u32, 0x90);
+const RUST_MISC_DEV_GET_VALUE: u32 = _IOR::<i32>('|' as u32, 0x91);
+const RUST_MISC_DEV_SET_VALUE: u32 = _IOW::<i32>('|' as u32, 0x92);
module! {
type: RustMiscDeviceModule,
--
2.39.5
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v2 0/3] Document Media Controller IOCTL number assignments
2025-05-27 5:56 [PATCH v2 0/3] Document Media Controller IOCTL number assignments Sakari Ailus
` (2 preceding siblings ...)
2025-05-27 5:56 ` [PATCH v2 3/3] samples: rust_misc_device: Bump IOCTL numbers Sakari Ailus
@ 2025-09-05 10:25 ` Sakari Ailus
2025-09-05 10:32 ` Greg Kroah-Hartman
3 siblings, 1 reply; 7+ messages in thread
From: Sakari Ailus @ 2025-09-05 10:25 UTC (permalink / raw)
To: linux-doc, Jonathan Corbet, Greg Kroah-Hartman,
Madhavan Srinivasan, Haren Myneni, Bagas Sanjaya,
Andrew Donnellan, Michael Ellerman, Akshay Gupta, linux-kernel,
linux-media, hans, laurent.pinchart, Mauro Carvalho Chehab,
Lee Jones
Hi Jonathan, Greg, Miguel, others,
On Tue, May 27, 2025 at 08:56:45AM +0300, Sakari Ailus wrote:
> Hello all,
>
> The Media Controller uses IOCTL numbers with '|' type up to 0x81 but the
> range from 0x80 upwards is documented to belong to samples. The samples,
> however, are currently using these values. Solve the problem by bumping
> the top of the MC range and the samples allocation by 0x10 as the samples
> don't require a stable IOCTL interface.
Could you comment on this, please?
I'd prefer to merge this via the media tree if that's ok.
>
> since v1:
>
> - Improved the commit message in the first patch.
>
> - Added a patch to change the IOCTLs also in the Rust sample.
>
> Sakari Ailus (3):
> Documentation: Bump media IOCTL reserved numbers
> media: uapi: Document IOCTL number assignment
> samples: rust_misc_device: Bump IOCTL numbers
>
> Documentation/userspace-api/ioctl/ioctl-number.rst | 4 ++--
> include/uapi/linux/media.h | 4 ++++
> samples/rust/rust_misc_device.rs | 14 +++++++-------
> 3 files changed, 13 insertions(+), 9 deletions(-)
>
--
Kind regards,
Sakari Ailus
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v2 0/3] Document Media Controller IOCTL number assignments
2025-09-05 10:25 ` [PATCH v2 0/3] Document Media Controller IOCTL number assignments Sakari Ailus
@ 2025-09-05 10:32 ` Greg Kroah-Hartman
2025-09-05 11:02 ` Sakari Ailus
0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2025-09-05 10:32 UTC (permalink / raw)
To: Sakari Ailus
Cc: linux-doc, Jonathan Corbet, Madhavan Srinivasan, Haren Myneni,
Bagas Sanjaya, Andrew Donnellan, Michael Ellerman, Akshay Gupta,
linux-kernel, linux-media, hans, laurent.pinchart,
Mauro Carvalho Chehab, Lee Jones
On Fri, Sep 05, 2025 at 01:25:33PM +0300, Sakari Ailus wrote:
> Hi Jonathan, Greg, Miguel, others,
>
> On Tue, May 27, 2025 at 08:56:45AM +0300, Sakari Ailus wrote:
> > Hello all,
> >
> > The Media Controller uses IOCTL numbers with '|' type up to 0x81 but the
> > range from 0x80 upwards is documented to belong to samples. The samples,
> > however, are currently using these values. Solve the problem by bumping
> > the top of the MC range and the samples allocation by 0x10 as the samples
> > don't require a stable IOCTL interface.
>
> Could you comment on this, please?
Why not just live with the overlap? What problem is this causing? It's
the MC subsystem's "bug" in that it took over an ioctl range that was
already documented as being used by something else :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/3] Document Media Controller IOCTL number assignments
2025-09-05 10:32 ` Greg Kroah-Hartman
@ 2025-09-05 11:02 ` Sakari Ailus
0 siblings, 0 replies; 7+ messages in thread
From: Sakari Ailus @ 2025-09-05 11:02 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-doc, Jonathan Corbet, Madhavan Srinivasan, Haren Myneni,
Bagas Sanjaya, Andrew Donnellan, Michael Ellerman, Akshay Gupta,
linux-kernel, linux-media, hans, laurent.pinchart,
Mauro Carvalho Chehab, Lee Jones
Hi Greg,
On Fri, Sep 05, 2025 at 12:32:45PM +0200, Greg Kroah-Hartman wrote:
> On Fri, Sep 05, 2025 at 01:25:33PM +0300, Sakari Ailus wrote:
> > Hi Jonathan, Greg, Miguel, others,
> >
> > On Tue, May 27, 2025 at 08:56:45AM +0300, Sakari Ailus wrote:
> > > Hello all,
> > >
> > > The Media Controller uses IOCTL numbers with '|' type up to 0x81 but the
> > > range from 0x80 upwards is documented to belong to samples. The samples,
> > > however, are currently using these values. Solve the problem by bumping
> > > the top of the MC range and the samples allocation by 0x10 as the samples
> > > don't require a stable IOCTL interface.
> >
> > Could you comment on this, please?
>
> Why not just live with the overlap? What problem is this causing? It's
> the MC subsystem's "bug" in that it took over an ioctl range that was
> already documented as being used by something else :)
I do agree ideally this shouldn't have happened in the first place, but I
think it's also cleaner if we can have separate ranges. Pushing samples out
a little doesn't look like an issue to me. The set also adds a comment on
not adding media IOCTLs beyond the new allocation.
--
Kind regards,
Sakari Ailus
^ permalink raw reply [flat|nested] 7+ messages in thread