Re: svn commit: r340181 - in head/sys: amd64/linux32 compat/linux

2018-11-06 Thread Tijl Coosemans
On Tue, 06 Nov 2018 16:17:23 +0100 Alexander Leidinger 
 wrote:
> Targeted for 12.0-release?
> Relnotes yes (linux64 support for NVidia driver)?

Yes, if re@ approves it.  The ports also need to be modified to install
linux64 libraries (PR 217901).
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r340181 - in head/sys: amd64/linux32 compat/linux

2018-11-06 Thread Alexander Leidinger
Targeted for 12.0-release?
Relnotes yes (linux64 support for NVidia driver)?

--
Send from a mobile device, please forgive brevity and misspellings.
Am 06.11.2018 2:51 nachm. schrieb Tijl Coosemans :
>
> Author: tijl 
> Date: Tue Nov  6 13:51:08 2018 
> New Revision: 340181 
> URL: https://svnweb.freebsd.org/changeset/base/340181 
>
> Log: 
>   On amd64 both Linux compat modules, linux.ko and linux64.ko, provide 
>   linux_ioctl_(un)register_handler that allows other driver modules to 
>   register ioctl handlers.  The ioctl syscall implementation in each Linux 
>   compat module iterates over the list of handlers and forwards the call to 
>   the appropriate driver.  Because the registration functions have the same 
>   name in each module it is not possible for a driver to support both 32 and 
>   64 bit linux compatibility. 
>   
>   Move the list of ioctl handlers to linux_common.ko so it is shared by 
>   both Linux modules and all drivers receive both 32 and 64 bit ioctl calls 
>   with one registration.  These ioctl handlers normally forward the call 
>   to the FreeBSD ioctl handler which can handle both 32 and 64 bit. 
>   
>   Keep the special COMPAT_LINUX32 ioctl handlers in linux.ko in a separate 
>   list for now and let the ioctl syscall iterate over that list first. 
>   Later, COMPAT_LINUX32 support can be added to the 64 bit ioctl handlers 
>   via a runtime check for ILP32 like is done for COMPAT_FREEBSD32 and then 
>   this separate list would disappear again.  That is a much bigger effort 
>   however and this commit is meant to be MFCable. 
>   
>   This enables linux64 support in x11/nvidia-driver*. 
>   
>   PR: 206711  http://www.FreeBSD.org/cgi/query-pr.cgi?pr=206711 
>   Reviewed by: kib 
>   MFC after: 3 days 
>
> Modified: 
>   head/sys/amd64/linux32/linux32_sysvec.c 
> https://svnweb.FreeBSD.org/base/head/sys/amd64/linux32/linux32_sysvec 
>   head/sys/compat/linux/linux_common.c 
> https://svnweb.FreeBSD.org/base/head/sys/compat/linux/linux_common 
>   head/sys/compat/linux/linux_ioctl.c 
> https://svnweb.FreeBSD.org/base/head/sys/compat/linux/linux_ioctl 
>   head/sys/compat/linux/linux_ioctl.h 
> https://svnweb.FreeBSD.org/base/head/sys/compat/linux/linux_ioctl 
>
> Modified: head/sys/amd64/linux32/linux32_sysvec.c 
> ==
>  
> --- head/sys/amd64/linux32/linux32_sysvec.c Tue Nov  6 12:57:38 2018 
> (r340180) 
> +++ head/sys/amd64/linux32/linux32_sysvec.c Tue Nov  6 13:51:08 2018 
> (r340181) 
> @@ -1071,7 +1071,7 @@ linux_elf_modevent(module_t mod, int type, void *data) 
> error = EINVAL; 
> if (error == 0) { 
> SET_FOREACH(lihp, linux_ioctl_handler_set) 
> - linux_ioctl_register_handler(*lihp); 
> + linux32_ioctl_register_handler(*lihp); 
> LIST_INIT(&futex_list); 
> mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF); 
> stclohz = (stathz ? stathz : hz); 
> @@ -1093,7 +1093,7 @@ linux_elf_modevent(module_t mod, int type, void *data) 
> } 
> if (error == 0) { 
> SET_FOREACH(lihp, linux_ioctl_handler_set) 
> - linux_ioctl_unregister_handler(*lihp); 
> + linux32_ioctl_unregister_handler(*lihp); 
> mtx_destroy(&futex_mtx); 
> if (bootverbose) 
> printf("Linux ELF exec handler removed\n"); 
>
> Modified: head/sys/compat/linux/linux_common.c 
> ==
>  
> --- head/sys/compat/linux/linux_common.c Tue Nov  6 12:57:38 2018 (r340180) 
> +++ head/sys/compat/linux/linux_common.c Tue Nov  6 13:51:08 2018 (r340181) 
> @@ -35,9 +35,11 @@ __FBSDID("$FreeBSD$"); 
> #include  
> #include  
> #include  
> +#include  
> #include  
>
> #include  
> +#include  
> #include  
> #include  
>
> @@ -47,6 +49,11 @@ FEATURE(linuxulator_v4l2, "V4L2 ioctl wrapper support 
> MODULE_VERSION(linux_common, 1); 
>
> SET_DECLARE(linux_device_handler_set, struct linux_device_handler); 
> + 
> +TAILQ_HEAD(, linux_ioctl_handler_element) linux_ioctl_handlers = 
> +    TAILQ_HEAD_INITIALIZER(linux_ioctl_handlers); 
> +struct sx linux_ioctl_sx; 
> +SX_SYSINIT(linux_ioctl, &linux_ioctl_sx, "Linux ioctl handlers"); 
>
> static eventhandler_tag linux_exec_tag; 
> static eventhandler_tag linux_thread_dtor_tag; 
>
> Modified: head/sys/compat/linux/linux_ioctl.c 
> ==
>  
> --- head/sys/compat/linux/linux_ioctl.c Tue Nov  6 12:57:38 2018 (r340180) 
> +++ head/sys/compat/linux/linux_ioctl.c Tue Nov  6 13:51:08 2018 (r340181) 
> @@ -161,17 +161,19 @@ DATA_SET(linux_ioctl_handler_set, video2_handler); 
> DATA_SET(linux_ioctl_handler_set, fbsd_usb); 
> DATA_SET(linux_ioctl_handler_set, evdev_handler); 
>
> -struct handler_element 
> -{ 
> - TAILQ_ENTRY(handler_element) list; 
> - int (*func)(struct thread *, struct linux_ioctl_args *); 
> - int low, high, span; 
> -}; 
> - 
> -static TAILQ_HEAD(, handler_element) handlers = 
> -    TAILQ_HEAD_INITIALIZER(handlers); 
> +#ifdef __i386__ 
> +static TAILQ_HEAD(, lin

svn commit: r340181 - in head/sys: amd64/linux32 compat/linux

2018-11-06 Thread Tijl Coosemans
Author: tijl
Date: Tue Nov  6 13:51:08 2018
New Revision: 340181
URL: https://svnweb.freebsd.org/changeset/base/340181

Log:
  On amd64 both Linux compat modules, linux.ko and linux64.ko, provide
  linux_ioctl_(un)register_handler that allows other driver modules to
  register ioctl handlers.  The ioctl syscall implementation in each Linux
  compat module iterates over the list of handlers and forwards the call to
  the appropriate driver.  Because the registration functions have the same
  name in each module it is not possible for a driver to support both 32 and
  64 bit linux compatibility.
  
  Move the list of ioctl handlers to linux_common.ko so it is shared by
  both Linux modules and all drivers receive both 32 and 64 bit ioctl calls
  with one registration.  These ioctl handlers normally forward the call
  to the FreeBSD ioctl handler which can handle both 32 and 64 bit.
  
  Keep the special COMPAT_LINUX32 ioctl handlers in linux.ko in a separate
  list for now and let the ioctl syscall iterate over that list first.
  Later, COMPAT_LINUX32 support can be added to the 64 bit ioctl handlers
  via a runtime check for ILP32 like is done for COMPAT_FREEBSD32 and then
  this separate list would disappear again.  That is a much bigger effort
  however and this commit is meant to be MFCable.
  
  This enables linux64 support in x11/nvidia-driver*.
  
  PR:   206711
  Reviewed by:  kib
  MFC after:3 days

Modified:
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/compat/linux/linux_common.c
  head/sys/compat/linux/linux_ioctl.c
  head/sys/compat/linux/linux_ioctl.h

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==
--- head/sys/amd64/linux32/linux32_sysvec.c Tue Nov  6 12:57:38 2018
(r340180)
+++ head/sys/amd64/linux32/linux32_sysvec.c Tue Nov  6 13:51:08 2018
(r340181)
@@ -1071,7 +1071,7 @@ linux_elf_modevent(module_t mod, int type, void *data)
error = EINVAL;
if (error == 0) {
SET_FOREACH(lihp, linux_ioctl_handler_set)
-   linux_ioctl_register_handler(*lihp);
+   linux32_ioctl_register_handler(*lihp);
LIST_INIT(&futex_list);
mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF);
stclohz = (stathz ? stathz : hz);
@@ -1093,7 +1093,7 @@ linux_elf_modevent(module_t mod, int type, void *data)
}
if (error == 0) {
SET_FOREACH(lihp, linux_ioctl_handler_set)
-   linux_ioctl_unregister_handler(*lihp);
+   linux32_ioctl_unregister_handler(*lihp);
mtx_destroy(&futex_mtx);
if (bootverbose)
printf("Linux ELF exec handler removed\n");

Modified: head/sys/compat/linux/linux_common.c
==
--- head/sys/compat/linux/linux_common.cTue Nov  6 12:57:38 2018
(r340180)
+++ head/sys/compat/linux/linux_common.cTue Nov  6 13:51:08 2018
(r340181)
@@ -35,9 +35,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -47,6 +49,11 @@ FEATURE(linuxulator_v4l2, "V4L2 ioctl wrapper support 
 MODULE_VERSION(linux_common, 1);
 
 SET_DECLARE(linux_device_handler_set, struct linux_device_handler);
+
+TAILQ_HEAD(, linux_ioctl_handler_element) linux_ioctl_handlers =
+TAILQ_HEAD_INITIALIZER(linux_ioctl_handlers);
+struct sx linux_ioctl_sx;
+SX_SYSINIT(linux_ioctl, &linux_ioctl_sx, "Linux ioctl handlers");
 
 static eventhandler_tag linux_exec_tag;
 static eventhandler_tag linux_thread_dtor_tag;

Modified: head/sys/compat/linux/linux_ioctl.c
==
--- head/sys/compat/linux/linux_ioctl.c Tue Nov  6 12:57:38 2018
(r340180)
+++ head/sys/compat/linux/linux_ioctl.c Tue Nov  6 13:51:08 2018
(r340181)
@@ -161,17 +161,19 @@ DATA_SET(linux_ioctl_handler_set, video2_handler);
 DATA_SET(linux_ioctl_handler_set, fbsd_usb);
 DATA_SET(linux_ioctl_handler_set, evdev_handler);
 
-struct handler_element
-{
-   TAILQ_ENTRY(handler_element) list;
-   int (*func)(struct thread *, struct linux_ioctl_args *);
-   int low, high, span;
-};
-
-static TAILQ_HEAD(, handler_element) handlers =
-TAILQ_HEAD_INITIALIZER(handlers);
+#ifdef __i386__
+static TAILQ_HEAD(, linux_ioctl_handler_element) linux_ioctl_handlers =
+TAILQ_HEAD_INITIALIZER(linux_ioctl_handlers);
 static struct sx linux_ioctl_sx;
 SX_SYSINIT(linux_ioctl, &linux_ioctl_sx, "Linux ioctl handlers");
+#else
+extern TAILQ_HEAD(, linux_ioctl_handler_element) linux_ioctl_handlers;
+extern struct sx linux_ioctl_sx;
+#endif