Document Media Controller IOCTL number assignments
Subsystems (5)
Sakari Ailus
maintainerv2 cover Document Media Controller IOCTL number assignments
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.
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(-)
Signature · 1 line
2.39.5
Sakari Ailus
maintainerPATCH v2 1/3 Documentation: Bump media IOCTL reserved numbers
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.
--- Documentation/userspace-api/ioctl/ioctl-number.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/userspace-api/ioctl/ioctl-number.rst +2 -2
@@ -312,8 +312,8 @@ Code Seq# Include File Comments 'z' 40-7F CAN bus card conflict! <mailto:[email protected]> '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
Signature · 1 line
2.39.5
Sakari Ailus
maintainerPATCH v2 2/3 media: uapi: Document IOCTL number assignment
In reply to Sakari AilusDocument 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.
--- include/uapi/linux/media.h | 4 ++++ 1 file changed, 4 insertions(+)
include/uapi/linux/media.h +4 -0
@@ -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__
Signature · 1 line
2.39.5
Sakari Ailus
maintainerPATCH v2 3/3 samples: rust_misc_device: Bump IOCTL numbers
In reply to Sakari AilusUse 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.
--- samples/rust/rust_misc_device.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
samples/rust/rust_misc_device.rs +7 -7
@@ -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 ,
Signature · 1 line
2.39.5
Hi Jonathan, Greg, Miguel, others,
Quoted 7 lines · Sakari Ailus
Hello all,
The Media Controller uses IOCTL numbers with '|' type up to
0x81but the range from0x80upwards 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 by0x10as 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.
Quoted 17 lines
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 numbersDocumentation/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(-)
Signature · 3 lines
Kind regards, Sakari Ailus
Greg Kroah-Hartman
maintainerQuoted 5 lines · Sakari Ailus
Hi Jonathan, Greg, Miguel, others,
Quoted 2 lines · Sakari Ailus
Hello all,
Quoted 7 lines
Quoted 5 lines
The Media Controller uses IOCTL numbers with '|' type up to
0x81but the range from0x80upwards 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 by0x10as 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
Hi Greg,
Quoted 12 lines · Greg Kroah-Hartman
Quoted 11 lines · Sakari Ailus
Hi Jonathan, Greg, Miguel, others,
Quoted 7 lines · Sakari Ailus
Hello all,
The Media Controller uses IOCTL numbers with '|' type up to
0x81but the range from0x80upwards 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 by0x10as the samples don't require a stable IOCTL interface.
Quoted 5 lines
Quoted 1 line
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.
Signature · 3 lines
Kind regards, Sakari Ailus