Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/pgoyette-compat]: src/sys Back out changes on the branch related to kern...



details:   https://anonhg.NetBSD.org/src/rev/8724af210868
branches:  pgoyette-compat
changeset: 321057:8724af210868
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sat Mar 17 06:49:56 2018 +0000

description:
Back out changes on the branch related to kernel microcode compat.

Christos didn't like the way it was done, so waiting for a better
approach/implementation.

diffstat:

 sys/arch/x86/x86/cpu_ucode.c      |   9 ++-------
 sys/compat/common/compat_60_mod.c |  24 ++++--------------------
 sys/kern/kern_cpu.c               |  35 ++++++++---------------------------
 sys/kern/syscalls.master          |   4 ++--
 sys/modules/compat/Makefile       |  12 +-----------
 sys/modules/compat_60/Makefile    |  15 +--------------
 6 files changed, 18 insertions(+), 81 deletions(-)

diffs (270 lines):

diff -r ae80af102ecc -r 8724af210868 sys/arch/x86/x86/cpu_ucode.c
--- a/sys/arch/x86/x86/cpu_ucode.c      Sat Mar 17 02:56:36 2018 +0000
+++ b/sys/arch/x86/x86/cpu_ucode.c      Sat Mar 17 06:49:56 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.c,v 1.5.16.1 2018/03/17 00:41:33 pgoyette Exp $ */
+/* $NetBSD: cpu_ucode.c,v 1.5.16.2 2018/03/17 06:49:56 pgoyette Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.5.16.1 2018/03/17 00:41:33 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.5.16.2 2018/03/17 06:49:56 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_cpu_ucode.h"
@@ -49,8 +49,6 @@
 
 static struct cpu_ucode_softc ucode_softc;
 
-#ifndef _MODULE
-
 int
 cpu_ucode_get_version(struct cpu_ucode_version *data)
 {
@@ -66,7 +64,6 @@
 
        return 0;
 }
-#endif /* ! _MODULE */
 
 #ifdef COMPAT_60
 int
@@ -84,7 +81,6 @@
 }
 #endif /* COMPAT60 */
 
-#ifndef _MODULE
 int
 cpu_ucode_md_open(firmware_handle_t *fwh, int loader_version, const char *fwname)
 {
@@ -127,7 +123,6 @@
        sc->sc_blobsize = 0;
        return error;
 }
-#endif /* ! _MODULE */
 
 #ifdef COMPAT_60
 int
diff -r ae80af102ecc -r 8724af210868 sys/compat/common/compat_60_mod.c
--- a/sys/compat/common/compat_60_mod.c Sat Mar 17 02:56:36 2018 +0000
+++ b/sys/compat/common/compat_60_mod.c Sat Mar 17 06:49:56 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_60_mod.c,v 1.1.2.4 2018/03/17 00:48:19 pgoyette Exp $   */
+/*     $NetBSD: compat_60_mod.c,v 1.1.2.5 2018/03/17 06:49:57 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.4 2018/03/17 00:48:19 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.5 2018/03/17 06:49:57 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -61,11 +61,6 @@
 #define REQUIRED_60 "compat_70"                /* XXX No compat_80 yet */
 MODULE(MODULE_CLASS_EXEC, compat_60, REQUIRED_60);
 
-#ifdef CPU_UCODE
-int (*orig_compat_6_cpu_get_version)(struct compat6_cpu_ucode *);
-int (*orig_compat6_cpu_ucode_apply)(const struct compat6_cpu_ucode *);
-#endif
-
 static const struct syscall_package compat__60_syscalls[] = {
         { SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60_sys__lwp_park },  
         NULL, 0, NULL }
@@ -75,29 +70,19 @@
 int
 compat_60_init(void)
 {
-       int error;
+       int error = 0;
 
        error = syscall_establish(NULL, compat_60_syscalls);
        if (error != 0)
                return error;
-#ifdef CPU_UCODE
-       orig_compat_6_cpu_get_version = vec_compat6_cpu_ucode_get_version;
-       *vec_compat6_cpu_ucode_get_version = compat6_cpu_ucode_get_version;
-       orig_compat6_cpu_ucode_apply = vec_compat6_cpu_ucode_apply;
-       *vec_compat6_cpu_ucode_apply = compat6_cpu_ucode_apply;
-#endif
        return 0;
 }
 
 int
 compat_60_fini(void)
 {
-       int error;
+       int error = 0;
 
-#ifdef CPU_UCODE
-       *vec_compat6_cpu_ucode_get_version = orig_compat_6_cpu_get_version;
-       *vec_compat6_cpu_ucode_apply = orig_compat6_cpu_ucode_apply;
-#endif
        error = syscall_disestablish(NULL, compat_60_syscalls);
 
        return error;
@@ -107,7 +92,6 @@
 static int
 compat_60_modcmd(modcmd_t cmd, void *arg)
 {
-       int error;
 
        switch (cmd) {
        case MODULE_CMD_INIT:
diff -r ae80af102ecc -r 8724af210868 sys/kern/kern_cpu.c
--- a/sys/kern/kern_cpu.c       Sat Mar 17 02:56:36 2018 +0000
+++ b/sys/kern/kern_cpu.c       Sat Mar 17 06:49:56 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_cpu.c,v 1.71.16.5 2018/03/17 02:56:36 pgoyette Exp $      */
+/*     $NetBSD: kern_cpu.c,v 1.71.16.6 2018/03/17 06:49:57 pgoyette Exp $      */
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.5 2018/03/17 02:56:36 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.6 2018/03/17 06:49:57 pgoyette Exp $");
 
 #include "opt_cpu_ucode.h"
 #include "opt_compat_netbsd.h"
@@ -131,27 +131,6 @@
 
 static char cpu_model[128];
 
-#ifdef CPU_UCODE
-/*
- * routine vectors for compat code
- */
-static int stub_compat_6_cpu_ucode_get_version(struct compat6_cpu_ucode *ucode)
-{
-
-       return ENOTTY;
-}
-
-static int stub_compat_6_cpu_ucode_apply(const struct compat6_cpu_ucode *ucode)
-{
-
-       return ENOTTY;
-}
-int (*vec_compat6_cpu_ucode_get_version)(struct compat6_cpu_ucode *) =
-    stub_compat_6_cpu_ucode_get_version;
-int (*vec_compat6_cpu_ucode_apply)(const struct compat6_cpu_ucode *) =
-    stub_compat_6_cpu_ucode_apply;
-#endif
-
 /*
  * mi_cpu_init: early initialisation of MI CPU related structures.
  *
@@ -306,10 +285,11 @@
                error = cpu_ucode_get_version((struct cpu_ucode_version *)data);
                break;
 
+#ifdef COMPAT_60
        case OIOC_CPU_UCODE_GET_VERSION:
-               error = (*vec_compat6_cpu_ucode_get_version)(
-                   (struct compat6_cpu_ucode *)data);
+               error = compat6_cpu_ucode_get_version((struct compat6_cpu_ucode *)data);
                break;
+#endif
 
        case IOC_CPU_UCODE_APPLY:
                error = kauth_authorize_machdep(l->l_cred,
@@ -320,16 +300,17 @@
                error = cpu_ucode_apply((const struct cpu_ucode *)data);
                break;
 
+#ifdef COMPAT_60
        case OIOC_CPU_UCODE_APPLY:
                error = kauth_authorize_machdep(l->l_cred,
                    KAUTH_MACHDEP_CPU_UCODE_APPLY,
                    NULL, NULL, NULL, NULL);
                if (error != 0)
                        break;
-               error = (*vec_compat6_cpu_ucode_apply)(
-                   (const struct compat6_cpu_ucode *)data);
+               error = compat6_cpu_ucode_apply((const struct compat6_cpu_ucode *)data);
                break;
 #endif
+#endif
 
        default:
                error = ENOTTY;
diff -r ae80af102ecc -r 8724af210868 sys/kern/syscalls.master
--- a/sys/kern/syscalls.master  Sat Mar 17 02:56:36 2018 +0000
+++ b/sys/kern/syscalls.master  Sat Mar 17 06:49:56 2018 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.291.2.3 2018/03/16 00:35:40 pgoyette Exp $
+       $NetBSD: syscalls.master,v 1.291.2.4 2018/03/17 06:49:57 pgoyette Exp $
 
 ;      @(#)syscalls.master     8.2 (Berkeley) 1/13/94
 
@@ -878,7 +878,7 @@
                { ssize_t|sys|50|mq_timedreceive(mqd_t mqdes, \
                            char *msg_ptr, size_t msg_len, unsigned *msg_prio, \
                            const struct timespec *abs_timeout); }
-434    COMPAT_60 MODULAR compat_60 \
+434    COMPAT_60 MODULAR compat \
                { int|sys||_lwp_park(const struct timespec *ts, \
                                lwpid_t unpark, const void *hint, \
                                const void *unparkhint); }
diff -r ae80af102ecc -r 8724af210868 sys/modules/compat/Makefile
--- a/sys/modules/compat/Makefile       Sat Mar 17 02:56:36 2018 +0000
+++ b/sys/modules/compat/Makefile       Sat Mar 17 06:49:56 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.14.14.2 2018/03/17 00:48:20 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.14.14.3 2018/03/17 06:49:57 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -45,14 +45,4 @@
 SRCS+= compat_16_machdep.c
 .endif
 
-.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386"
-
-CPPFLAGS+=      -DCPU_UCODE
-
-.PATH:  ${S}/arch/x86/x86
-
-SRCS+=  cpu_ucode.c
-
-.endif
-
 .include <bsd.kmodule.mk>
diff -r ae80af102ecc -r 8724af210868 sys/modules/compat_60/Makefile
--- a/sys/modules/compat_60/Makefile    Sat Mar 17 02:56:36 2018 +0000
+++ b/sys/modules/compat_60/Makefile    Sat Mar 17 06:49:56 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.1.2.4 2018/03/17 00:48:20 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.1.2.5 2018/03/17 06:49:57 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -10,17 +10,4 @@
 
 SRCS+= compat_60_mod.c kern_sa_60.c tty_60.c kern_time_60.c
 
-# If being built for amd64, i386, or XEN3_DOM0 (but _not_ DOMU), we
-# need to add
-
-.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386"
-
-CPPFLAGS+=     -DCPU_UCODE
-
-.PATH: ${S}/arch/x86/x86
-
-SRCS+= cpu_ucode.c
-
-.endif
-
 .include <bsd.kmodule.mk>



Home | Main Index | Thread Index | Old Index