From owner-svn-src-stable-11@freebsd.org Sun Feb 11 02:27:53 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED24EF10DE5; Sun, 11 Feb 2018 02:27:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9BD167E8A6; Sun, 11 Feb 2018 02:27:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C4571CA94; Sun, 11 Feb 2018 02:27:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1B2RqgS089759; Sun, 11 Feb 2018 02:27:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1B2RoFg089740; Sun, 11 Feb 2018 02:27:50 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802110227.w1B2RoFg089740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 11 Feb 2018 02:27:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329114 - in stable/11: . lib/libstand sbin/geom/class/eli share/mk sys/boot sys/boot/arm/uboot sys/boot/common sys/boot/efi/boot1 sys/boot/efi/include sys/boot/efi/libefi sys/boot/efi/... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: . lib/libstand sbin/geom/class/eli share/mk sys/boot sys/boot/arm/uboot sys/boot/common sys/boot/efi/boot1 sys/boot/efi/include sys/boot/efi/libefi sys/boot/efi/loader sys/boot/efi/loade... X-SVN-Commit-Revision: 329114 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 02:27:53 -0000 Author: kevans Date: Sun Feb 11 02:27:50 2018 New Revision: 329114 URL: https://svnweb.freebsd.org/changeset/base/329114 Log: MFC Loader Fixes 2017q3: r320547,r320553,r321621,r321844,r321969,r321991, r322037,r322038,r322039,r322040,r322056,r322074,r322542,r322592,r322593, r322896,r322923,r323671,r322930,r322931,r322932,r322933,r322934,r322935, r322936,r322937,r322938,r322939,r322941,r323062,r323063,r323064,r323065, r323100,r323131,r323174,r323258,r323261,r323272,r323367,r323379,r323389, r323407,r323428,r323436,r323494,r323496,r323497,r323541,r323554,r323589, r323707,r323867,r323885,r323886,r323895,r323896,r323897,r323905,r323906, r323907,r323908,r323909,r323952,r323991,r324099,r324558,r326445,r326609, r326610 This batch includes a special kludge to fix powerpc loader build; was included after there, causing problems with DEBUG_MALLOC bits. Include a little bit earlier to fix the build with the intention of removing this when eventually libsa silently replaces stdlib.h with stand.h. r320547: Link EFI/uboot loaders with -znotext r320553: Integer underflow in efipart_realstrategy when I/O starts after end of disk r321621: Always set the receive mask in loader.efi. r321844: Clean up style in print_state(..) and pager_printf(..) r321969: Fix the return types for printf and putchar to match their libc r321991: Revert r321969 r322037: Add stpcpy and stpncpy to libstand r322038: Add definitions and utilities for EFI drivers r322039: Move EFI ZFS functions to libefi r322040: Add EFI utility functions to libefi r322056: Move EFI fmtdev functionality to libefi r322074: libefi/time.c cstyle cleanup r322542: loader.efi: repace XXX with real comments in trap.c r322592: Remove unused defines. r322593: Define proposed GUID for FreeBSD boot loader variables. r322896: Make spinconsole platform independent and hook it up into EFI loader r322923: Hide length of geli passphrase during boot. r323671: Fix language used in the r322923. r322930: Move efi_main into efi/loader r322931: Cleanup efi_main return type r322932: Use the loader.efi conventions for the various EFI tables. r322933: No need for MK_ZFS around these: they are by their nature only active when MK_ZFS is true. r322934: _STAND is sometimes defined on the command line. Make the define here match. r322935: Fix warnings due to type mismatch. r322936: Remove useless 'static' for an enum definition. r322937: Forward declare struct dsk to avoid warnings when building libi386. r322938: Link in libefi for boot1 r322939: Use efi_devpath_str for debug path info. r322941: Eliminate redunant device path matching. r323062: Make efichar.c routines available to libefi. r323063: boot1.efi: print more info about where boot1.efi is loaded from r323064: Exit rather than panic for most errors. r323065: Save where we're booted from r323100: libstand: nfs_readlink() should return proper return code r323131: Revert r322941: Eliminate redundant device matching functions r323174: Fix loader bug causing too many pages allocation when bootloader is U-Boot r323258: ucs2len r323261: Fix armv6 build r323272: Be consistent and do return (1); r323367: Mark init_chroot and init_script variables as deprecated. r323379: It's been pointed out that init_script at least is useful w/o r323389: loader.efi: chain loader should provide proper device handle r323407: boot1 generate-fat: generate all templates at once r323428: r323389 breaks the kernel build when WITHOUT_ZFS is defined in src.conf r323436: boot1: remove BOOT1_MAXSIZE default value r323494: loader should support large_dnode r323496: libstand: tftp_open() can leak pkt on error r323497: libefi: efipart_open should check the status from disk_open r323541: libefi: efipart_realstrategy rsize pointer may be NULL r323554: Increase EFI boot file size frok 128k to 384k r323589: loader: biosmem.c cstyle cleanup r323707: loader: biosmem allocate heap just below 4GB r323867: libefi: devicename.c cleanups r323885: libefi: efi_devpath_match() should return bool r323886: libefi: efipart.c should use calloc() r323895: libefi: efi_devpath_match local len should be unsigned r323896: r323885 did miss efilib.h update r323897: efilib.h: typo in structure member description r323905: libefi: pdinfo_t pd_unit and pd_open should be unsigned r323906: libefi: efipart_strategy() should return ENXIO when there is no media r323907: libefi: efipart.c cstyle fix for efipart_print_common() r323908: libefi: efipart_hdinfo_add_filepath should check strtol result r323909: libefi: define EISA PNP constants r323952: After the r317886 support for TFTP and NFS can be enable simultaneously. r323991: libefi: efipart_floppy() will should not pass acpi pointer if the HID test fails r324099: Compile loader as Little-Endian on PPC64/POWER8 r324558: Define prototype for exit and ensure references r326445: Fix random() and srandom() prototypes to match the standard. r326609: Make putenv and getenv match the userland definition r326610: Fix random() prototype to match the system. PR: 219000 221001 222215 Relnotes: yes ("The length of the geli passphrase is hidden during boot") Added: stable/11/sys/boot/efi/boot1/fat-amd64.tmpl.xz - copied unchanged from r323554, head/sys/boot/efi/boot1/fat-amd64.tmpl.xz stable/11/sys/boot/efi/boot1/fat-arm.tmpl.xz - copied unchanged from r323554, head/sys/boot/efi/boot1/fat-arm.tmpl.xz stable/11/sys/boot/efi/boot1/fat-arm64.tmpl.xz - copied unchanged from r323554, head/sys/boot/efi/boot1/fat-arm64.tmpl.xz stable/11/sys/boot/efi/boot1/fat-i386.tmpl.xz - copied unchanged from r323554, head/sys/boot/efi/boot1/fat-i386.tmpl.xz stable/11/sys/boot/efi/include/efi_driver_utils.h - copied unchanged from r322038, head/sys/boot/efi/include/efi_driver_utils.h stable/11/sys/boot/efi/include/efi_drivers.h - copied unchanged from r322038, head/sys/boot/efi/include/efi_drivers.h stable/11/sys/boot/efi/include/efizfs.h - copied, changed from r322039, head/sys/boot/efi/include/efizfs.h stable/11/sys/boot/efi/libefi/devicename.c - copied, changed from r322056, head/sys/boot/efi/libefi/devicename.c stable/11/sys/boot/efi/libefi/efi_driver_utils.c - copied unchanged from r322038, head/sys/boot/efi/libefi/efi_driver_utils.c stable/11/sys/boot/efi/libefi/efizfs.c - copied, changed from r322039, head/sys/boot/efi/libefi/efizfs.c stable/11/sys/boot/efi/loader/efi_main.c - copied, changed from r322930, head/sys/boot/efi/loader/efi_main.c Deleted: stable/11/sys/boot/efi/boot1/fat-amd64.tmpl.bz2.uu stable/11/sys/boot/efi/boot1/fat-arm.tmpl.bz2.uu stable/11/sys/boot/efi/boot1/fat-arm64.tmpl.bz2.uu stable/11/sys/boot/efi/boot1/fat-i386.tmpl.bz2.uu stable/11/sys/boot/efi/loader/devicename.c Modified: stable/11/UPDATING stable/11/lib/libstand/Makefile stable/11/lib/libstand/environment.c stable/11/lib/libstand/libstand.3 stable/11/lib/libstand/nfs.c stable/11/lib/libstand/random.c stable/11/lib/libstand/stand.h stable/11/lib/libstand/tftp.c stable/11/sbin/geom/class/eli/geli.8 stable/11/sbin/geom/class/eli/geom_eli.c stable/11/share/mk/src.opts.mk stable/11/sys/boot/Makefile.inc stable/11/sys/boot/arm/uboot/Makefile stable/11/sys/boot/arm/uboot/conf.c stable/11/sys/boot/common/loader.8 stable/11/sys/boot/efi/boot1/Makefile stable/11/sys/boot/efi/boot1/Makefile.fat stable/11/sys/boot/efi/boot1/boot1.c stable/11/sys/boot/efi/boot1/boot_module.h stable/11/sys/boot/efi/boot1/generate-fat.sh stable/11/sys/boot/efi/boot1/ufs_module.c stable/11/sys/boot/efi/boot1/zfs_module.c stable/11/sys/boot/efi/include/efi.h stable/11/sys/boot/efi/include/efiapi.h stable/11/sys/boot/efi/include/efichar.h stable/11/sys/boot/efi/include/efidevp.h stable/11/sys/boot/efi/include/efilib.h stable/11/sys/boot/efi/include/efiprot.h stable/11/sys/boot/efi/libefi/Makefile stable/11/sys/boot/efi/libefi/devpath.c stable/11/sys/boot/efi/libefi/efichar.c stable/11/sys/boot/efi/libefi/efinet.c stable/11/sys/boot/efi/libefi/efipart.c stable/11/sys/boot/efi/libefi/errno.c stable/11/sys/boot/efi/libefi/libefi.c stable/11/sys/boot/efi/libefi/time.c stable/11/sys/boot/efi/loader/Makefile stable/11/sys/boot/efi/loader/arch/amd64/Makefile.inc stable/11/sys/boot/efi/loader/arch/amd64/trap.c stable/11/sys/boot/efi/loader/arch/i386/Makefile.inc stable/11/sys/boot/efi/loader/bootinfo.c stable/11/sys/boot/efi/loader/conf.c stable/11/sys/boot/efi/loader/loader_efi.h stable/11/sys/boot/efi/loader/main.c stable/11/sys/boot/geli/geliboot.c stable/11/sys/boot/geli/geliboot.h stable/11/sys/boot/geli/geliboot_crypto.c stable/11/sys/boot/geli/geliboot_internal.h stable/11/sys/boot/geli/pwgets.c stable/11/sys/boot/i386/libi386/Makefile stable/11/sys/boot/i386/libi386/biosdisk.c stable/11/sys/boot/i386/libi386/biosmem.c stable/11/sys/boot/i386/libi386/spinconsole.c stable/11/sys/boot/mips/uboot/conf.c stable/11/sys/boot/powerpc/ofw/conf.c stable/11/sys/boot/powerpc/ofw/ofwfdt.c stable/11/sys/boot/powerpc/uboot/conf.c stable/11/sys/boot/userboot/test/test.c stable/11/sys/boot/userboot/userboot.h stable/11/sys/boot/userboot/userboot/main.c stable/11/sys/boot/zfs/zfsimpl.c stable/11/sys/cddl/boot/zfs/zfsimpl.h stable/11/sys/geom/eli/g_eli.c stable/11/sys/geom/eli/g_eli.h stable/11/sys/geom/eli/g_eli_ctl.c stable/11/usr.sbin/bhyveload/bhyveload.c Directory Properties: stable/11/ (props changed) Modified: stable/11/UPDATING ============================================================================== --- stable/11/UPDATING Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/UPDATING Sun Feb 11 02:27:50 2018 (r329114) @@ -16,6 +16,10 @@ from older versions of FreeBSD, try WITHOUT_CLANG and the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20180210: + The geli password typed at boot is now hidden. To restore the previous + behavior, see geli(8) for configuration options. + 20180113: The SW_WATCHDOG option is no longer necessary to enable the hardclock-based software watchdog if no hardware watchdog is Modified: stable/11/lib/libstand/Makefile ============================================================================== --- stable/11/lib/libstand/Makefile Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/lib/libstand/Makefile Sun Feb 11 02:27:50 2018 (r329114) @@ -41,7 +41,7 @@ SRCS+= ntoh.c .PATH: ${LIBC_SRC}/string SRCS+= bcmp.c bcopy.c bzero.c ffs.c fls.c \ memccpy.c memchr.c memcmp.c memcpy.c memmove.c memset.c \ - qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \ + qdivrem.c strcat.c strchr.c strcmp.c strcpy.c stpcpy.c stpncpy.c \ strcspn.c strlcat.c strlcpy.c strlen.c strncat.c strncmp.c strncpy.c \ strnlen.c strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c .if ${MACHINE_CPUARCH} == "arm" Modified: stable/11/lib/libstand/environment.c ============================================================================== --- stable/11/lib/libstand/environment.c Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/lib/libstand/environment.c Sun Feb 11 02:27:50 2018 (r329114) @@ -162,7 +162,7 @@ setenv(const char *name, const char *value, int overwr } int -putenv(const char *string) +putenv(char *string) { char *value, *copy; int result; Modified: stable/11/lib/libstand/libstand.3 ============================================================================== --- stable/11/lib/libstand/libstand.3 Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/lib/libstand/libstand.3 Sun Feb 11 02:27:50 2018 (r329114) @@ -110,7 +110,7 @@ for set/unset hook functions. .Xc .It Xo .Ft int -.Fn putenv "const char *string" +.Fn putenv "char *string" .Xc .It Xo .Ft int @@ -172,7 +172,7 @@ may be used to prevent a variable being unset. .Fn srandom "unsigned long seed" .Xc .It Xo -.Ft "unsigned long" +.Ft "long" .Fn random void .Xc .It Xo Modified: stable/11/lib/libstand/nfs.c ============================================================================== --- stable/11/lib/libstand/nfs.c Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/lib/libstand/nfs.c Sun Feb 11 02:27:50 2018 (r329114) @@ -382,7 +382,7 @@ nfs_readlink(struct nfs_iodesc *d, char *buf) buf[repl->len] = 0; done: free(pkt); - return (0); + return (rc); } #endif Modified: stable/11/lib/libstand/random.c ============================================================================== --- stable/11/lib/libstand/random.c Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/lib/libstand/random.c Sun Feb 11 02:27:50 2018 (r329114) @@ -48,8 +48,8 @@ srandom(seed) * and whatever else we might use it for. The result is uniform on * [0, 2^31 - 1]. */ -u_long -random() +long +random(void) { long x, hi, lo, t; Modified: stable/11/lib/libstand/stand.h ============================================================================== --- stable/11/lib/libstand/stand.h Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/lib/libstand/stand.h Sun Feb 11 02:27:50 2018 (r329114) @@ -282,7 +282,7 @@ extern ssize_t write(int, void *, size_t); extern struct dirent *readdirfd(int); extern void srandom(u_long seed); -extern u_long random(void); +extern long random(void); /* imports from stdlib, locally modified */ extern long strtol(const char *, char **, int); @@ -330,7 +330,7 @@ extern int env_setenv(const char *name, int flags, extern char *getenv(const char *name); extern int setenv(const char *name, const char *value, int overwrite); -extern int putenv(const char *string); +extern int putenv(char *string); extern int unsetenv(const char *name); extern ev_sethook_t env_noset; /* refuse set operation */ @@ -376,6 +376,7 @@ extern int null_readdir(struct open_file *f, struct di * Machine dependent functions and data, must be provided or stubbed by * the consumer */ +extern void exit(int); extern int getchar(void); extern int ischar(void); extern void putchar(int); Modified: stable/11/lib/libstand/tftp.c ============================================================================== --- stable/11/lib/libstand/tftp.c Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/lib/libstand/tftp.c Sun Feb 11 02:27:50 2018 (r329114) @@ -467,6 +467,7 @@ tftp_open(const char *path, struct open_file *f) if (res) { free(tftpfile->path); + free(tftpfile->pkt); free(tftpfile); return (res); } Modified: stable/11/sbin/geom/class/eli/geli.8 ============================================================================== --- stable/11/sbin/geom/class/eli/geli.8 Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/sbin/geom/class/eli/geli.8 Sun Feb 11 02:27:50 2018 (r329114) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 3, 2016 +.Dd September 17, 2017 .Dt GELI 8 .Os .Sh NAME @@ -51,7 +51,7 @@ utility: .Pp .Nm .Cm init -.Op Fl bgPTv +.Op Fl bdgPTv .Op Fl a Ar aalgo .Op Fl B Ar backupfile .Op Fl e Ar ealgo @@ -88,7 +88,7 @@ utility: .Ar prov .Nm .Cm configure -.Op Fl bBgGtT +.Op Fl bBdDgGtT .Ar prov ... .Nm .Cm setkey @@ -279,6 +279,11 @@ To inhibit backups, you can use .Pa none as the .Ar backupfile . +.It Fl d +When entering the passphrase to boot from this encrypted root filesystem, echo +.Ql * +characters. +This makes the length of the passphrase visible. .It Fl e Ar ealgo Encryption algorithm to use. Currently supported algorithms are: @@ -490,6 +495,15 @@ For more information, see the description of the subcommand. .It Fl B Remove the BOOT flag from the given providers. +.It Fl d +When entering the passphrase to boot from this encrypted root filesystem, echo +.Ql * +characters. +This makes the length of the passphrase visible. +.It Fl D +Disable echoing of any characters when a passphrase is entered to boot from this +encrypted root filesystem. +This hides the passphrase length. .It Fl g Enable booting from this encrypted root filesystem. The boot loader prompts for the passphrase and loads Modified: stable/11/sbin/geom/class/eli/geom_eli.c ============================================================================== --- stable/11/sbin/geom/class/eli/geom_eli.c Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/sbin/geom/class/eli/geom_eli.c Sun Feb 11 02:27:50 2018 (r329114) @@ -82,7 +82,7 @@ static int eli_backup_create(struct gctl_req *req, con /* * Available commands: * - * init [-bgPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov + * init [-bdgPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov * label - alias for 'init' * attach [-dprv] [-j passfile] [-k keyfile] prov * detach [-fl] prov ... @@ -107,6 +107,7 @@ struct g_command class_commands[] = { { 'a', "aalgo", "", G_TYPE_STRING }, { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "backupfile", "", G_TYPE_STRING }, + { 'd', "displaypass", NULL, G_TYPE_BOOL }, { 'e', "ealgo", "", G_TYPE_STRING }, { 'g', "geliboot", NULL, G_TYPE_BOOL }, { 'i', "iterations", "-1", G_TYPE_NUMBER }, @@ -119,13 +120,14 @@ struct g_command class_commands[] = { { 'V', "mdversion", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - "[-bgPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov" + "[-bdgPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov" }, { "label", G_FLAG_VERBOSE, eli_main, { { 'a', "aalgo", "", G_TYPE_STRING }, { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "backupfile", "", G_TYPE_STRING }, + { 'd', "displaypass", NULL, G_TYPE_BOOL }, { 'e', "ealgo", "", G_TYPE_STRING }, { 'g', "geliboot", NULL, G_TYPE_BOOL }, { 'i', "iterations", "-1", G_TYPE_NUMBER }, @@ -182,13 +184,15 @@ struct g_command class_commands[] = { { { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "noboot", NULL, G_TYPE_BOOL }, + { 'd', "displaypass", NULL, G_TYPE_BOOL }, + { 'D', "nodisplaypass", NULL, G_TYPE_BOOL }, { 'g', "geliboot", NULL, G_TYPE_BOOL }, { 'G', "nogeliboot", NULL, G_TYPE_BOOL }, { 't', "trim", NULL, G_TYPE_BOOL }, { 'T', "notrim", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - "[-bBgGtT] prov ..." + "[-bBdDgGtT] prov ..." }, { "setkey", G_FLAG_VERBOSE, eli_main, { @@ -708,6 +712,8 @@ eli_init(struct gctl_req *req) md.md_flags |= G_ELI_FLAG_BOOT; if (gctl_get_int(req, "geliboot")) md.md_flags |= G_ELI_FLAG_GELIBOOT; + if (gctl_get_int(req, "displaypass")) + md.md_flags |= G_ELI_FLAG_GELIDISPLAYPASS; if (gctl_get_int(req, "notrim")) md.md_flags |= G_ELI_FLAG_NODELETE; md.md_ealgo = CRYPTO_ALGORITHM_MIN - 1; @@ -912,7 +918,7 @@ eli_attach(struct gctl_req *req) static void eli_configure_detached(struct gctl_req *req, const char *prov, int boot, - int geliboot, int trim) + int geliboot, int displaypass, int trim) { struct g_eli_metadata md; bool changed = 0; @@ -948,6 +954,21 @@ eli_configure_detached(struct gctl_req *req, const cha changed = 1; } + if (displaypass == 1 && (md.md_flags & G_ELI_FLAG_GELIDISPLAYPASS)) { + if (verbose) + printf("GELIDISPLAYPASS flag already configured for %s.\n", prov); + } else if (displaypass == 0 && + !(md.md_flags & G_ELI_FLAG_GELIDISPLAYPASS)) { + if (verbose) + printf("GELIDISPLAYPASS flag not configured for %s.\n", prov); + } else if (displaypass >= 0) { + if (displaypass) + md.md_flags |= G_ELI_FLAG_GELIDISPLAYPASS; + else + md.md_flags &= ~G_ELI_FLAG_GELIDISPLAYPASS; + changed = 1; + } + if (trim == 0 && (md.md_flags & G_ELI_FLAG_NODELETE)) { if (verbose) printf("TRIM disable flag already configured for %s.\n", prov); @@ -971,8 +992,9 @@ static void eli_configure(struct gctl_req *req) { const char *prov; - bool boot, noboot, geliboot, nogeliboot, trim, notrim; - int doboot, dogeliboot, dotrim; + bool boot, noboot, geliboot, nogeliboot, displaypass, nodisplaypass; + bool trim, notrim; + int doboot, dogeliboot, dodisplaypass, dotrim; int i, nargs; nargs = gctl_get_int(req, "nargs"); @@ -985,6 +1007,8 @@ eli_configure(struct gctl_req *req) noboot = gctl_get_int(req, "noboot"); geliboot = gctl_get_int(req, "geliboot"); nogeliboot = gctl_get_int(req, "nogeliboot"); + displaypass = gctl_get_int(req, "displaypass"); + nodisplaypass = gctl_get_int(req, "nodisplaypass"); trim = gctl_get_int(req, "trim"); notrim = gctl_get_int(req, "notrim"); @@ -1008,6 +1032,16 @@ eli_configure(struct gctl_req *req) else if (nogeliboot) dogeliboot = 0; + dodisplaypass = -1; + if (displaypass && nodisplaypass) { + gctl_error(req, "Options -d and -D are mutually exclusive."); + return; + } + if (displaypass) + dodisplaypass = 1; + else if (nodisplaypass) + dodisplaypass = 0; + dotrim = -1; if (trim && notrim) { gctl_error(req, "Options -t and -T are mutually exclusive."); @@ -1018,7 +1052,8 @@ eli_configure(struct gctl_req *req) else if (notrim) dotrim = 0; - if (doboot == -1 && dogeliboot == -1 && dotrim == -1) { + if (doboot == -1 && dogeliboot == -1 && dodisplaypass == -1 && + dotrim == -1) { gctl_error(req, "No option given."); return; } @@ -1028,8 +1063,10 @@ eli_configure(struct gctl_req *req) /* Now the rest. */ for (i = 0; i < nargs; i++) { prov = gctl_get_ascii(req, "arg%d", i); - if (!eli_is_attached(prov)) - eli_configure_detached(req, prov, doboot, dogeliboot, dotrim); + if (!eli_is_attached(prov)) { + eli_configure_detached(req, prov, doboot, dogeliboot, + dodisplaypass, dotrim); + } } } Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/share/mk/src.opts.mk Sun Feb 11 02:27:50 2018 (r329114) @@ -188,6 +188,7 @@ __DEFAULT_NO_OPTIONS = \ HESIOD \ LIBSOFT \ LINT \ + LOADER_FORCE_LE \ NAND \ OFED \ OPENLDAP \ Modified: stable/11/sys/boot/Makefile.inc ============================================================================== --- stable/11/sys/boot/Makefile.inc Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/sys/boot/Makefile.inc Sun Feb 11 02:27:50 2018 (r329114) @@ -1,6 +1,6 @@ # $FreeBSD$ -.include +.include SSP_CFLAGS= @@ -22,3 +22,11 @@ CFLAGS.clang+= -mfpu=none # when this test succeeds rather than require dd to be a bootstrap tool. DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true DD=dd ${DD_NOSTATUS} + +.if ${MK_LOADER_FORCE_LE} != "no" + +.if ${MACHINE_ARCH} == "powerpc64" +CFLAGS+= -mlittle-endian +.endif + +.endif Modified: stable/11/sys/boot/arm/uboot/Makefile ============================================================================== --- stable/11/sys/boot/arm/uboot/Makefile Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/sys/boot/arm/uboot/Makefile Sun Feb 11 02:27:50 2018 (r329114) @@ -100,6 +100,7 @@ CLEANFILES+= loader.help CFLAGS+= -ffreestanding -msoft-float LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH} +LDFLAGS+= -Wl,-znotext # Pull in common loader code .PATH: ${.CURDIR}/../../uboot/common Modified: stable/11/sys/boot/arm/uboot/conf.c ============================================================================== --- stable/11/sys/boot/arm/uboot/conf.c Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/sys/boot/arm/uboot/conf.c Sun Feb 11 02:27:50 2018 (r329114) @@ -36,6 +36,9 @@ __FBSDID("$FreeBSD$"); #include "dev_net.h" #endif +/* Make sure we have an explicit reference to exit so libsa's panic pulls in the MD exit */ +void (*exitfn)(int) = exit; + struct devsw *devsw[] = { #if defined(LOADER_DISK_SUPPORT) || defined(LOADER_CD9660_SUPPORT) &uboot_storage, Modified: stable/11/sys/boot/common/loader.8 ============================================================================== --- stable/11/sys/boot/common/loader.8 Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/sys/boot/common/loader.8 Sun Feb 11 02:27:50 2018 (r329114) @@ -487,6 +487,11 @@ That happens before entering single-user mode or multi mode (but after executing the .Va init_script if enabled). +This functionality has generally been eclipsed by rerooting. +See +.Xr reboot 8 +.Fl r +for details. .It Va init_path Sets the list of binaries which the kernel will try to run as the initial process. @@ -508,6 +513,11 @@ if the script terminates with a non-zero exit code, or if a SIGTERM is delivered to the .Xr init 8 process (PID 1). +This functionality has generally been eclipsed by rerooting. +See +.Xr reboot 8 +.Fl r +for details. .It Va init_shell Defines the shell binary to be used for executing the various shell scripts. The default is Modified: stable/11/sys/boot/efi/boot1/Makefile ============================================================================== --- stable/11/sys/boot/efi/boot1/Makefile Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/sys/boot/efi/boot1/Makefile Sun Feb 11 02:27:50 2018 (r329114) @@ -10,7 +10,13 @@ PROG= boot1.sym INTERNALPROG= WARNS?= 6 -.if ${MK_ZFS} != "no" +# We implement a slightly non-standard %S in that it always takes a +# CHAR16 that's common in UEFI-land instead of a wchar_t. This only +# seems to matter on arm64 where wchar_t defaults to an int instead +# of a short. There's no good cast to use here so just ignore the +# warnings for now. +CWARNFLAGS.boot1.c+= -Wno-format + # Disable warnings that are currently incompatible with the zfs boot code CWARNFLAGS.zfs_module.c += -Wno-array-bounds CWARNFLAGS.zfs_module.c += -Wno-cast-align @@ -25,7 +31,6 @@ CWARNFLAGS.skein.c += -Wno-missing-variable-declaratio .else if ${COMPILER_TYPE} == "gcc" CWARNFLAGS.skein.c += -Wno-missing-declarations .endif -.endif # architecture-specific loader code SRCS= boot1.c self_reloc.c start.S ufs_module.c @@ -68,7 +73,7 @@ FILES= boot1.efi boot1.efifat FILESMODE_boot1.efi= ${BINMODE} LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE} -LDFLAGS+= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared +LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared .if ${MACHINE_CPUARCH} == "aarch64" CFLAGS+= -mgeneral-regs-only @@ -78,13 +83,15 @@ CFLAGS+= -fPIC LDFLAGS+= -Wl,-znocombreloc .endif +LIBEFI= ${.OBJDIR}/../libefi/libefi.a + # # Add libstand for the runtime functions used by the compiler - for example # __aeabi_* (arm) or __divdi3 (i386). # as well as required string and memory functions for all platforms. # -DPADD+= ${LIBSTAND} -LDADD+= -lstand +DPADD+= ${LIBEFI} ${LIBSTAND} +LDADD+= ${LIBEFI} -lstand DPADD+= ${LDSCRIPT} @@ -119,7 +126,6 @@ boot1.o: ${.CURDIR}/../../common/ufsread.c # created by generate-fat.sh .include "${.CURDIR}/Makefile.fat" -BOOT1_MAXSIZE?= 131072 boot1.efifat: boot1.efi @set -- `ls -l ${.ALLSRC}`; \ @@ -129,9 +135,7 @@ boot1.efifat: boot1.efi exit 1; \ fi echo ${.OBJDIR} - uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu - mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2 - bzip2 -f -d ${.TARGET}.bz2 + xz -d -c ${.CURDIR}/fat-${MACHINE}.tmpl.xz > ${.TARGET} ${DD} if=${.ALLSRC} of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc CLEANFILES= boot1.efi boot1.efifat Modified: stable/11/sys/boot/efi/boot1/Makefile.fat ============================================================================== --- stable/11/sys/boot/efi/boot1/Makefile.fat Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/sys/boot/efi/boot1/Makefile.fat Sun Feb 11 02:27:50 2018 (r329114) @@ -1,4 +1,4 @@ # This file autogenerated by generate-fat.sh - DO NOT EDIT # $FreeBSD$ BOOT1_OFFSET=0x2d -BOOT1_MAXSIZE=131072 +BOOT1_MAXSIZE=393216 Modified: stable/11/sys/boot/efi/boot1/boot1.c ============================================================================== --- stable/11/sys/boot/efi/boot1/boot1.c Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/sys/boot/efi/boot1/boot1.c Sun Feb 11 02:27:50 2018 (r329114) @@ -29,10 +29,14 @@ __FBSDID("$FreeBSD$"); #include #include +typedef CHAR16 efi_char; +#include #include "boot_module.h" #include "paths.h" +static void efi_panic(EFI_STATUS s, const char *fmt, ...) __dead2 __printflike(2, 3); + static const boot_module_t *boot_modules[] = { #ifdef EFI_ZFS_BOOT @@ -47,16 +51,11 @@ static const boot_module_t *boot_modules[] = /* The initial number of handles used to query EFI for partitions. */ #define NUM_HANDLES_INIT 24 -EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE* Xsystab); - -EFI_SYSTEM_TABLE *systab; -EFI_BOOT_SERVICES *bs; -static EFI_HANDLE *image; - static EFI_GUID BlockIoProtocolGUID = BLOCK_IO_PROTOCOL; static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL; static EFI_GUID LoadedImageGUID = LOADED_IMAGE_PROTOCOL; static EFI_GUID ConsoleControlGUID = EFI_CONSOLE_CONTROL_PROTOCOL_GUID; +static EFI_GUID FreeBSDBootVarGUID = FREEBSD_BOOT_VAR_GUID; /* * Provide Malloc / Free backed by EFIs AllocatePool / FreePool which ensures @@ -68,7 +67,7 @@ Malloc(size_t len, const char *file __unused, int line { void *out; - if (bs->AllocatePool(EfiLoaderData, len, &out) == EFI_SUCCESS) + if (BS->AllocatePool(EfiLoaderData, len, &out) == EFI_SUCCESS) return (out); return (NULL); @@ -78,9 +77,26 @@ void Free(void *buf, const char *file __unused, int line __unused) { if (buf != NULL) - (void)bs->FreePool(buf); + (void)BS->FreePool(buf); } +static EFI_STATUS +efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr) +{ + CHAR16 *var = NULL; + size_t len; + EFI_STATUS rv; + + utf8_to_ucs2(varname, &var, &len); + if (var == NULL) + return (EFI_OUT_OF_RESOURCES); + rv = RS->SetVariable(var, &FreeBSDBootVarGUID, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + (ucs2len(valstr) + 1) * sizeof(efi_char), valstr); + free(var); + return (rv); +} + /* * nodes_match returns TRUE if the imgpath isn't NULL and the nodes match, * FALSE otherwise. @@ -88,7 +104,7 @@ Free(void *buf, const char *file __unused, int line __ static BOOLEAN nodes_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath) { - int len; + size_t len; if (imgpath == NULL || imgpath->Type != devpath->Type || imgpath->SubType != devpath->SubType) @@ -142,178 +158,6 @@ devpath_last(EFI_DEVICE_PATH *devpath) } /* - * devpath_node_str is a basic output method for a devpath node which - * only understands a subset of the available sub types. - * - * If we switch to UEFI 2.x then we should update it to use: - * EFI_DEVICE_PATH_TO_TEXT_PROTOCOL. - */ -static int -devpath_node_str(char *buf, size_t size, EFI_DEVICE_PATH *devpath) -{ - - switch (devpath->Type) { - case MESSAGING_DEVICE_PATH: - switch (devpath->SubType) { - case MSG_ATAPI_DP: { - ATAPI_DEVICE_PATH *atapi; - - atapi = (ATAPI_DEVICE_PATH *)(void *)devpath; - return snprintf(buf, size, "ata(%s,%s,0x%x)", - (atapi->PrimarySecondary == 1) ? "Sec" : "Pri", - (atapi->SlaveMaster == 1) ? "Slave" : "Master", - atapi->Lun); - } - case MSG_USB_DP: { - USB_DEVICE_PATH *usb; - - usb = (USB_DEVICE_PATH *)devpath; - return snprintf(buf, size, "usb(0x%02x,0x%02x)", - usb->ParentPortNumber, usb->InterfaceNumber); - } - case MSG_SCSI_DP: { - SCSI_DEVICE_PATH *scsi; - - scsi = (SCSI_DEVICE_PATH *)(void *)devpath; - return snprintf(buf, size, "scsi(0x%02x,0x%02x)", - scsi->Pun, scsi->Lun); - } - case MSG_SATA_DP: { - SATA_DEVICE_PATH *sata; - - sata = (SATA_DEVICE_PATH *)(void *)devpath; - return snprintf(buf, size, "sata(0x%x,0x%x,0x%x)", - sata->HBAPortNumber, sata->PortMultiplierPortNumber, - sata->Lun); - } - default: - return snprintf(buf, size, "msg(0x%02x)", - devpath->SubType); - } - break; - case HARDWARE_DEVICE_PATH: - switch (devpath->SubType) { - case HW_PCI_DP: { - PCI_DEVICE_PATH *pci; - - pci = (PCI_DEVICE_PATH *)devpath; - return snprintf(buf, size, "pci(0x%02x,0x%02x)", - pci->Device, pci->Function); - } - default: - return snprintf(buf, size, "hw(0x%02x)", - devpath->SubType); - } - break; - case ACPI_DEVICE_PATH: { - ACPI_HID_DEVICE_PATH *acpi; - - acpi = (ACPI_HID_DEVICE_PATH *)(void *)devpath; - if ((acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { - switch (EISA_ID_TO_NUM(acpi->HID)) { - case 0x0a03: - return snprintf(buf, size, "pciroot(0x%x)", - acpi->UID); - case 0x0a08: - return snprintf(buf, size, "pcieroot(0x%x)", - acpi->UID); - case 0x0604: - return snprintf(buf, size, "floppy(0x%x)", - acpi->UID); - case 0x0301: - return snprintf(buf, size, "keyboard(0x%x)", - acpi->UID); - case 0x0501: - return snprintf(buf, size, "serial(0x%x)", - acpi->UID); - case 0x0401: - return snprintf(buf, size, "parallelport(0x%x)", - acpi->UID); - default: - return snprintf(buf, size, "acpi(pnp%04x,0x%x)", - EISA_ID_TO_NUM(acpi->HID), acpi->UID); - } - } - - return snprintf(buf, size, "acpi(0x%08x,0x%x)", acpi->HID, - acpi->UID); - } - case MEDIA_DEVICE_PATH: - switch (devpath->SubType) { - case MEDIA_CDROM_DP: { - CDROM_DEVICE_PATH *cdrom; - - cdrom = (CDROM_DEVICE_PATH *)(void *)devpath; - return snprintf(buf, size, "cdrom(%x)", - cdrom->BootEntry); - } - case MEDIA_HARDDRIVE_DP: { - HARDDRIVE_DEVICE_PATH *hd; - - hd = (HARDDRIVE_DEVICE_PATH *)(void *)devpath; - return snprintf(buf, size, "hd(%x)", - hd->PartitionNumber); - } - default: - return snprintf(buf, size, "media(0x%02x)", - devpath->SubType); - } - case BBS_DEVICE_PATH: - return snprintf(buf, size, "bbs(0x%02x)", devpath->SubType); - case END_DEVICE_PATH_TYPE: - return (0); - } - - return snprintf(buf, size, "type(0x%02x, 0x%02x)", devpath->Type, - devpath->SubType); -} - -/* - * devpath_strlcat appends a text description of devpath to buf but not more - * than size - 1 characters followed by NUL-terminator. - */ -int -devpath_strlcat(char *buf, size_t size, EFI_DEVICE_PATH *devpath) -{ - size_t len, used; - const char *sep; - - sep = ""; - used = 0; - while (!IsDevicePathEnd(devpath)) { - len = snprintf(buf, size - used, "%s", sep); - used += len; - if (used > size) - return (used); - buf += len; - - len = devpath_node_str(buf, size - used, devpath); - used += len; - if (used > size) - return (used); - buf += len; - devpath = NextDevicePathNode(devpath); - sep = ":"; - } - - return (used); -} - -/* - * devpath_str is convenience method which returns the text description of - * devpath using a static buffer, so it isn't thread safe! - */ -char * -devpath_str(EFI_DEVICE_PATH *devpath) -{ - static char buf[256]; - - devpath_strlcat(buf, sizeof(buf), devpath); - - return buf; -} - -/* * load_loader attempts to load the loader image data. * * It tries each module and its respective devices, identified by mod->probe, @@ -400,14 +244,14 @@ try_boot(void) buf = NULL; } - if ((status = bs->LoadImage(TRUE, image, devpath_last(dev->devpath), + if ((status = BS->LoadImage(TRUE, IH, devpath_last(dev->devpath), loaderbuf, loadersize, &loaderhandle)) != EFI_SUCCESS) { printf("Failed to load image provided by %s, size: %zu, (%lu)\n", mod->name, loadersize, EFI_ERROR_CODE(status)); goto errout; } - if ((status = bs->HandleProtocol(loaderhandle, &LoadedImageGUID, + if ((status = BS->HandleProtocol(loaderhandle, &LoadedImageGUID, (VOID**)&loaded_image)) != EFI_SUCCESS) { printf("Failed to query LoadedImage provided by %s (%lu)\n", mod->name, EFI_ERROR_CODE(status)); @@ -433,7 +277,7 @@ try_boot(void) DSTALL(1000000); DPRINTF(".\n"); - if ((status = bs->StartImage(loaderhandle, NULL, NULL)) != + if ((status = BS->StartImage(loaderhandle, NULL, NULL)) != EFI_SUCCESS) { printf("Failed to start image provided by %s (%lu)\n", mod->name, EFI_ERROR_CODE(status)); @@ -467,7 +311,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B UINTN i; /* Figure out if we're dealing with an actual partition. */ - status = bs->HandleProtocol(h, &DevicePathGUID, (void **)&devpath); + status = BS->HandleProtocol(h, &DevicePathGUID, (void **)&devpath); if (status == EFI_UNSUPPORTED) return (status); @@ -476,10 +320,14 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B EFI_ERROR_CODE(status)); return (status); } - - DPRINTF("probing: %s\n", devpath_str(devpath)); - - status = bs->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); +#ifdef EFI_DEBUG + { + CHAR16 *text = efi_devpath_name(devpath); + DPRINTF("probing: %S\n", text); + efi_free_devpath_name(text); + } +#endif + status = BS->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); if (status == EFI_UNSUPPORTED) return (status); @@ -496,11 +344,9 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B /* Run through each module, see if it can load this partition */ for (i = 0; i < NUM_BOOT_MODULES; i++) { - if ((status = bs->AllocatePool(EfiLoaderData, - sizeof(*devinfo), (void **)&devinfo)) != - EFI_SUCCESS) { - DPRINTF("\nFailed to allocate devinfo (%lu)\n", - EFI_ERROR_CODE(status)); + devinfo = malloc(sizeof(*devinfo)); + if (devinfo == NULL) { + DPRINTF("\nFailed to allocate devinfo\n"); continue; } devinfo->dev = blkio; @@ -513,7 +359,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B status = boot_modules[i]->probe(devinfo); if (status == EFI_SUCCESS) return (EFI_SUCCESS); - (void)bs->FreePool(devinfo); + free(devinfo); } return (EFI_UNSUPPORTED); @@ -565,14 +411,16 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl = NULL; SIMPLE_TEXT_OUTPUT_INTERFACE *conout = NULL; UINTN i, max_dim, best_mode, cols, rows, hsize, nhandles; + CHAR16 *text; /* Basic initialization*/ - systab = Xsystab; - image = Ximage; - bs = Xsystab->BootServices; + ST = Xsystab; + IH = Ximage; + BS = ST->BootServices; + RS = ST->RuntimeServices; /* Set up the console, so printf works. */ - status = bs->LocateProtocol(&ConsoleControlGUID, NULL, + status = BS->LocateProtocol(&ConsoleControlGUID, NULL, (VOID **)&ConsoleControl); if (status == EFI_SUCCESS) (void)ConsoleControl->SetMode(ConsoleControl, @@ -580,7 +428,7 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) /* * Reset the console and find the best text mode. */ - conout = systab->ConOut; + conout = ST->ConOut; conout->Reset(conout, TRUE); max_dim = best_mode = 0; for (i = 0; ; i++) { @@ -607,34 +455,55 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) } putchar('\n'); + /* Determine the devpath of our image so we can prefer it. */ + status = BS->HandleProtocol(IH, &LoadedImageGUID, (VOID**)&img); + imgpath = NULL; + if (status == EFI_SUCCESS) { + text = efi_devpath_name(img->FilePath); + printf(" Load Path: %S\n", text); + efi_setenv_freebsd_wcs("Boot1Path", text); + efi_free_devpath_name(text); + + status = BS->HandleProtocol(img->DeviceHandle, &DevicePathGUID, + (void **)&imgpath); + if (status != EFI_SUCCESS) { + DPRINTF("Failed to get image DevicePath (%lu)\n", + EFI_ERROR_CODE(status)); + } else { + text = efi_devpath_name(imgpath); + printf(" Load Device: %S\n", text); + efi_setenv_freebsd_wcs("Boot1Dev", text); + efi_free_devpath_name(text); + } + + } + /* Get all the device handles */ hsize = (UINTN)NUM_HANDLES_INIT * sizeof(EFI_HANDLE); - if ((status = bs->AllocatePool(EfiLoaderData, hsize, (void **)&handles)) - != EFI_SUCCESS) - panic("Failed to allocate %d handles (%lu)", NUM_HANDLES_INIT, - EFI_ERROR_CODE(status)); + handles = malloc(hsize); + if (handles == NULL) { + printf("Failed to allocate %d handles\n", NUM_HANDLES_INIT); + } - status = bs->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, + status = BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, &hsize, handles); switch (status) { case EFI_SUCCESS: break; case EFI_BUFFER_TOO_SMALL: - (void)bs->FreePool(handles); - if ((status = bs->AllocatePool(EfiLoaderData, hsize, - (void **)&handles)) != EFI_SUCCESS) { - panic("Failed to allocate %zu handles (%lu)", hsize / - sizeof(*handles), EFI_ERROR_CODE(status)); - } - status = bs->LocateHandle(ByProtocol, &BlockIoProtocolGUID, + free(handles); + handles = malloc(hsize); + if (handles == NULL) + efi_panic(EFI_OUT_OF_RESOURCES, "Failed to allocate %d handles\n", + NUM_HANDLES_INIT); + status = BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, &hsize, handles); if (status != EFI_SUCCESS) - panic("Failed to get device handles (%lu)\n", - EFI_ERROR_CODE(status)); + efi_panic(status, "Failed to get device handles\n"); break; default: - panic("Failed to get device handles (%lu)", - EFI_ERROR_CODE(status)); + efi_panic(status, "Failed to get device handles\n"); + break; } /* Scan all partitions, probing with all modules. */ @@ -642,18 +511,6 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) printf(" Probing %zu block devices...", nhandles); DPRINTF("\n"); - /* Determine the devpath of our image so we can prefer it. */ - status = bs->HandleProtocol(image, &LoadedImageGUID, (VOID**)&img); - imgpath = NULL; - if (status == EFI_SUCCESS) { - status = bs->HandleProtocol(img->DeviceHandle, &DevicePathGUID, - (void **)&imgpath); - if (status != EFI_SUCCESS) - DPRINTF("Failed to get image DevicePath (%lu)\n", - EFI_ERROR_CODE(status)); - DPRINTF("boot1 imagepath: %s\n", devpath_str(imgpath)); - } - for (i = 0; i < nhandles; i++) probe_handle_status(handles[i], imgpath); printf(" done\n"); @@ -667,7 +524,7 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) try_boot(); /* If we get here, we're out of luck... */ - panic("No bootable partitions found!"); + efi_panic(EFI_LOAD_ERROR, "No bootable partitions found!"); } /* @@ -689,8 +546,12 @@ add_device(dev_info_t **devinfop, dev_info_t *devinfo) dev->next = devinfo; } -void -panic(const char *fmt, ...) +/* + * OK. We totally give up. Exit back to EFI with a sensible status so + * it can try the next option on the list. + */ +static void +efi_panic(EFI_STATUS s, const char *fmt, ...) { va_list ap; @@ -700,7 +561,7 @@ panic(const char *fmt, ...) va_end(ap); printf("\n"); - while (1) {} + BS->Exit(IH, s, 0, NULL); } void @@ -711,9 +572,9 @@ putchar(int c) if (c == '\n') { buf[0] = '\r'; buf[1] = 0; - systab->ConOut->OutputString(systab->ConOut, buf); + ST->ConOut->OutputString(ST->ConOut, buf); } buf[0] = c; buf[1] = 0; - systab->ConOut->OutputString(systab->ConOut, buf); + ST->ConOut->OutputString(ST->ConOut, buf); } Modified: stable/11/sys/boot/efi/boot1/boot_module.h ============================================================================== --- stable/11/sys/boot/efi/boot1/boot_module.h Sat Feb 10 22:36:42 2018 (r329113) +++ stable/11/sys/boot/efi/boot1/boot_module.h Sun Feb 11 02:27:50 2018 (r329114) @@ -37,7 +37,7 @@ #ifdef EFI_DEBUG #define DPRINTF(fmt, args...) printf(fmt, ##args) -#define DSTALL(d) bs->Stall(d) +#define DSTALL(d) BS->Stall(d) #else #define DPRINTF(fmt, ...) {} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Sun Feb 11 03:10:27 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C02BEF137E0; Sun, 11 Feb 2018 03:10:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7262680C9B; Sun, 11 Feb 2018 03:10:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6D62E1D1DF; Sun, 11 Feb 2018 03:10:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1B3ARv1011132; Sun, 11 Feb 2018 03:10:27 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1B3ARXJ011131; Sun, 11 Feb 2018 03:10:27 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802110310.w1B3ARXJ011131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 11 Feb 2018 03:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329117 - stable/11/usr.sbin/bhyveload X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.sbin/bhyveload X-SVN-Commit-Revision: 329117 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 03:10:27 -0000 Author: kevans Date: Sun Feb 11 03:10:27 2018 New Revision: 329117 URL: https://svnweb.freebsd.org/changeset/base/329117 Log: MFC r326615: De-const to match changes in userboot.h Modified: stable/11/usr.sbin/bhyveload/bhyveload.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyveload/bhyveload.c ============================================================================== --- stable/11/usr.sbin/bhyveload/bhyveload.c Sun Feb 11 03:09:08 2018 (r329116) +++ stable/11/usr.sbin/bhyveload/bhyveload.c Sun Feb 11 03:10:27 2018 (r329117) @@ -511,14 +511,14 @@ cb_getmem(void *arg, uint64_t *ret_lowmem, uint64_t *r } struct env { - const char *str; /* name=value */ + char *str; /* name=value */ SLIST_ENTRY(env) next; }; static SLIST_HEAD(envhead, env) envhead; static void -addenv(const char *str) +addenv(char *str) { struct env *env; From owner-svn-src-stable-11@freebsd.org Sun Feb 11 03:09:09 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A2E8F136F8; Sun, 11 Feb 2018 03:09:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D72380AB9; Sun, 11 Feb 2018 03:09:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 483A71D1D7; Sun, 11 Feb 2018 03:09:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1B399CD010976; Sun, 11 Feb 2018 03:09:09 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1B399kI010975; Sun, 11 Feb 2018 03:09:09 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802110309.w1B399kI010975@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 11 Feb 2018 03:09:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329116 - stable/11/lib/libstand X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/lib/libstand X-SVN-Commit-Revision: 329116 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 03:09:09 -0000 Author: kevans Date: Sun Feb 11 03:09:08 2018 New Revision: 329116 URL: https://svnweb.freebsd.org/changeset/base/329116 Log: Back out exit() change in r329114; stable/11 was not ready for this one yet This is a direct commit to stable/11. Modified: stable/11/lib/libstand/stand.h Modified: stable/11/lib/libstand/stand.h ============================================================================== --- stable/11/lib/libstand/stand.h Sun Feb 11 03:02:29 2018 (r329115) +++ stable/11/lib/libstand/stand.h Sun Feb 11 03:09:08 2018 (r329116) @@ -376,7 +376,6 @@ extern int null_readdir(struct open_file *f, struct di * Machine dependent functions and data, must be provided or stubbed by * the consumer */ -extern void exit(int); extern int getchar(void); extern int ischar(void); extern void putchar(int); From owner-svn-src-stable-11@freebsd.org Sun Feb 11 03:21:07 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70AE4F13C13; Sun, 11 Feb 2018 03:21:07 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 25054812BF; Sun, 11 Feb 2018 03:21:07 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 071281D3CA; Sun, 11 Feb 2018 03:21:07 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1B3L6jZ016402; Sun, 11 Feb 2018 03:21:06 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1B3L6pw016398; Sun, 11 Feb 2018 03:21:06 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802110321.w1B3L6pw016398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 11 Feb 2018 03:21:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329118 - in stable/11/sys/boot: arm/uboot mips/uboot powerpc/ofw powerpc/uboot X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/sys/boot: arm/uboot mips/uboot powerpc/ofw powerpc/uboot X-SVN-Commit-Revision: 329118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 03:21:07 -0000 Author: kevans Date: Sun Feb 11 03:21:06 2018 New Revision: 329118 URL: https://svnweb.freebsd.org/changeset/base/329118 Log: Back out MFC r324558: Define prototype for exit and ensure references This went terribly wrong Modified: stable/11/sys/boot/arm/uboot/conf.c stable/11/sys/boot/mips/uboot/conf.c stable/11/sys/boot/powerpc/ofw/conf.c stable/11/sys/boot/powerpc/uboot/conf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/arm/uboot/conf.c ============================================================================== --- stable/11/sys/boot/arm/uboot/conf.c Sun Feb 11 03:10:27 2018 (r329117) +++ stable/11/sys/boot/arm/uboot/conf.c Sun Feb 11 03:21:06 2018 (r329118) @@ -36,9 +36,6 @@ __FBSDID("$FreeBSD$"); #include "dev_net.h" #endif -/* Make sure we have an explicit reference to exit so libsa's panic pulls in the MD exit */ -void (*exitfn)(int) = exit; - struct devsw *devsw[] = { #if defined(LOADER_DISK_SUPPORT) || defined(LOADER_CD9660_SUPPORT) &uboot_storage, Modified: stable/11/sys/boot/mips/uboot/conf.c ============================================================================== --- stable/11/sys/boot/mips/uboot/conf.c Sun Feb 11 03:10:27 2018 (r329117) +++ stable/11/sys/boot/mips/uboot/conf.c Sun Feb 11 03:21:06 2018 (r329118) @@ -36,9 +36,6 @@ __FBSDID("$FreeBSD$"); #include "dev_net.h" #endif -/* Make sure we have an explicit reference to exit so libsa's panic pulls in the MD exit */ -void (*exitfn)(int) = exit; - struct devsw *devsw[] = { #if defined(LOADER_DISK_SUPPORT) || defined(LOADER_CD9660_SUPPORT) &uboot_storage, Modified: stable/11/sys/boot/powerpc/ofw/conf.c ============================================================================== --- stable/11/sys/boot/powerpc/ofw/conf.c Sun Feb 11 03:10:27 2018 (r329117) +++ stable/11/sys/boot/powerpc/ofw/conf.c Sun Feb 11 03:21:06 2018 (r329118) @@ -36,9 +36,6 @@ __FBSDID("$FreeBSD$"); #include "dev_net.h" #endif -/* Make sure we have an explicit reference to exit so libsa's panic pulls in the MD exit */ -void (*exitfn)(int) = exit; - /* * We could use linker sets for some or all of these, but * then we would have to control what ended up linked into Modified: stable/11/sys/boot/powerpc/uboot/conf.c ============================================================================== --- stable/11/sys/boot/powerpc/uboot/conf.c Sun Feb 11 03:10:27 2018 (r329117) +++ stable/11/sys/boot/powerpc/uboot/conf.c Sun Feb 11 03:21:06 2018 (r329118) @@ -35,9 +35,6 @@ __FBSDID("$FreeBSD$"); #include "dev_net.h" #endif -/* Make sure we have an explicit reference to exit so libsa's panic pulls in the MD exit */ -void (*exitfn)(int) = exit; - /* * We could use linker sets for some or all of these, but * then we would have to control what ended up linked into From owner-svn-src-stable-11@freebsd.org Sun Feb 11 07:00:41 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 653FAF1C248; Sun, 11 Feb 2018 07:00:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 138AA87DB5; Sun, 11 Feb 2018 07:00:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E9C21F75E; Sun, 11 Feb 2018 07:00:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1B70eXb024788; Sun, 11 Feb 2018 07:00:40 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1B70eMH024787; Sun, 11 Feb 2018 07:00:40 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201802110700.w1B70eMH024787@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 11 Feb 2018 07:00:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329120 - stable/11/bin/ps X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/bin/ps X-SVN-Commit-Revision: 329120 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 07:00:41 -0000 Author: eadler Date: Sun Feb 11 07:00:40 2018 New Revision: 329120 URL: https://svnweb.freebsd.org/changeset/base/329120 Log: MFC r304007: Correct the history of where ps first appeared. PR: 211741 Submitted by: Sevan Janiyan Modified: stable/11/bin/ps/ps.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/ps/ps.1 ============================================================================== --- stable/11/bin/ps/ps.1 Sun Feb 11 06:57:20 2018 (r329119) +++ stable/11/bin/ps/ps.1 Sun Feb 11 07:00:40 2018 (r329120) @@ -773,7 +773,8 @@ operating systems. The .Nm command appeared in -.At v4 . +.At v3 +in section 8 of the manual. .Sh BUGS Since .Nm From owner-svn-src-stable-11@freebsd.org Sun Feb 11 07:04:49 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C8CAF1C7D0; Sun, 11 Feb 2018 07:04:49 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DAE52682DA; Sun, 11 Feb 2018 07:04:48 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5B5E1F8E3; Sun, 11 Feb 2018 07:04:48 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1B74mCC029486; Sun, 11 Feb 2018 07:04:48 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1B74mbF029485; Sun, 11 Feb 2018 07:04:48 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201802110704.w1B74mbF029485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sun, 11 Feb 2018 07:04:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329121 - stable/11/sys/dev/uart X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/dev/uart X-SVN-Commit-Revision: 329121 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 07:04:49 -0000 Author: eadler Date: Sun Feb 11 07:04:48 2018 New Revision: 329121 URL: https://svnweb.freebsd.org/changeset/base/329121 Log: MFC r308926: Add Intel Atom Cherryview SOC HSUART support PR: 207910 Submitted by: johannes@brilliantservice.co.jp Modified: stable/11/sys/dev/uart/uart_bus_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/uart/uart_bus_pci.c ============================================================================== --- stable/11/sys/dev/uart/uart_bus_pci.c Sun Feb 11 07:00:40 2018 (r329120) +++ stable/11/sys/dev/uart/uart_bus_pci.c Sun Feb 11 07:04:48 2018 (r329121) @@ -131,6 +131,10 @@ static const struct pci_id pci_ns8250_ids[] = { { 0x8086, 0x1c3d, 0xffff, 0, "Intel AMT - KT Controller", 0x10 }, { 0x8086, 0x1d3d, 0xffff, 0, "Intel C600/X79 Series Chipset KT Controller", 0x10 }, { 0x8086, 0x1e3d, 0xffff, 0, "Intel Panther Point KT Controller", 0x10 }, +{ 0x8086, 0x228a, 0xffff, 0, "Intel Cherryview SIO HSUART#1", 0x10, + 24 * DEFAULT_RCLK, 2 }, +{ 0x8086, 0x228c, 0xffff, 0, "Intel Cherryview SIO HSUART#2", 0x10, + 24 * DEFAULT_RCLK, 2 }, { 0x8086, 0x2a07, 0xffff, 0, "Intel AMT - PM965/GM965 KT Controller", 0x10 }, { 0x8086, 0x2a47, 0xffff, 0, "Mobile 4 Series Chipset KT Controller", 0x10 }, { 0x8086, 0x2e17, 0xffff, 0, "4 Series Chipset Serial KT Controller", 0x10 }, From owner-svn-src-stable-11@freebsd.org Sun Feb 11 07:01:49 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83943F1C3F8; Sun, 11 Feb 2018 07:01:49 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-io0-x22e.google.com (mail-io0-x22e.google.com [IPv6:2607:f8b0:4001:c06::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0EFD26804D; Sun, 11 Feb 2018 07:01:49 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-io0-x22e.google.com with SMTP id l17so14166789ioc.3; Sat, 10 Feb 2018 23:01:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=4aGICFTftFpMQsyaRyQKGTf7Prk/XsUsTaV+72612s0=; b=RPKWlZqmjMxTLiBNV/rUhtdUiUnQz/TPepadBzXNZ72adVNC//vMVvYmRgiMG5Oa1u bdedYWwDrHAf0/rg61yhDVIqpahEp/Hl7txG5wY6eE7ZkvQa8V1pgmWsq88pFpgwQAck KXm/P41hhj++FG22+5asH4RXbyXpOKdEI4SSWU6S3MZcXy0s1Zh0wIAXa6jOznQ8aj6+ J4k0+F8KNfI3Fh/espMU00FaRWRkPUhosmyuTeWyv7ux3lnx59guhn6aAv0tATrZLtTN qMM+u3oFaUEhbcFGSmhv+jLg+PyWwgDeMTGDJsxXkplYtPetuGShm2s5OwGydOG5yikf jZDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=4aGICFTftFpMQsyaRyQKGTf7Prk/XsUsTaV+72612s0=; b=DHliQWOy7tZstjxKbfVJJ/mYhzQsSXKYp0nXkn5gmvksaLGzR0Q170EqkWYSo2s2+v SBYWwplgSVf8SWUXVU5dw5lzpdBSA7L/aGF3pakmEGqe33F3e9CvIWFgwOGdr4Iqbm+Z VrPPRGWkTnpX7ODyE6PYVsHGDlK44MWZzdhKyF78SNJGBTUew+boeIdzXsJJiN1nI9w3 scmTAqXR4o1l36yQ89SIdhKz8ST+mUWhJIIqac/1tC/9YIs5u+/D4s4FjcW4IpwgVPmz 1sYFxe7/5IeQTwx+wxtlOrRb3winNfxicDR4r3MVR0eIjcV3mYcT35itL2EoU9m9N4SD JSNA== X-Gm-Message-State: APf1xPDhCH9/XH8onHRX/5HVMFqW7kYPMnGHWe7TXm1LY+HX4Cpo5Q1h bl7Q3G4KhL6iuDbDD5Zj1MyEh9UbspO/ECg9lwUyCA== X-Google-Smtp-Source: AH8x227RJqh0PW2EhdJqjvYL3guCnoGwYY3E4pXR0hy7tqums0g6CURuT0Q7bJSUdeBhhL571KTw3KHEdcgmdqXcUao= X-Received: by 10.107.142.68 with SMTP id q65mr9067744iod.133.1518332508472; Sat, 10 Feb 2018 23:01:48 -0800 (PST) MIME-Version: 1.0 Sender: antoine.brodin.freebsd@gmail.com Received: by 10.107.143.86 with HTTP; Sat, 10 Feb 2018 23:01:48 -0800 (PST) In-Reply-To: <201802071506.w17F6s5l043163@repo.freebsd.org> References: <201802071506.w17F6s5l043163@repo.freebsd.org> From: Antoine Brodin Date: Sun, 11 Feb 2018 08:01:48 +0100 X-Google-Sender-Auth: sc7kxLvlcqykSPCqpCxUesU0PVE Message-ID: Subject: Re: svn commit: r328973 - in stable/11: include sys/sys To: Hans Petter Selasky Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org, re Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 07:01:49 -0000 On Wed, Feb 7, 2018 at 4:06 PM, Hans Petter Selasky wrote: > Author: hselasky > Date: Wed Feb 7 15:06:54 2018 > New Revision: 328973 > URL: https://svnweb.freebsd.org/changeset/base/328973 > > Log: > MFC r328237: > Use the __alloc_size2 attribute where relevant. > > This follows the documented use in GCC. It is basically only relevant for > calloc(3), reallocarray(3) and mallocarray(9). > > NOTE: Without this change clang 5.0.1 can produce incorrect optimisation > code for static processing of data using the allocated object. For example > this has been seen compiling the mlx4 core module, which allocates a > fixed size array which is then sorted by a fixed order loop. The > optimised result, -O2, is incorrect unless this patch is in place. > > Suggested by: Mark Millard > Reference: https://docs.freebsd.org/cgi/mid.cgi?9DE674C6-EAA3-4E8A-906F-446E74D82FC4 > > Modified: > stable/11/include/stdlib.h > stable/11/sys/sys/malloc.h > Directory Properties: > stable/11/ (props changed) Hi, Please revert this change. Lots of ports that used to build fine on stable/11 are now failing. /usr/include/stdlib.h:93:7: error: expected function body after function declarator __alloc_size2(1, 2); Antoine (with hat: portmgr) From owner-svn-src-stable-11@freebsd.org Sun Feb 11 10:09:44 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1799F081BE; Sun, 11 Feb 2018 10:09:43 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-it0-x234.google.com (mail-it0-x234.google.com [IPv6:2607:f8b0:4001:c0b::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A52170309; Sun, 11 Feb 2018 10:09:43 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-it0-x234.google.com with SMTP id n206so3335919itg.1; Sun, 11 Feb 2018 02:09:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=qlrQqiGgbrAk49RKqRFIdrQKPK4Z511TtS/XGZkjhBg=; b=EgHlkEtUZzQY+HPBX4YMP55SSY8UFdB9ub3eHbc2fb0W+2iuLujL0OI5D7BqHAoEB3 c0tfjCRTifNJshLs+CxkPvStCNYfF9KX+koN6uhfX7aZRxXj32ehx+L7DBYPnqAJfV7S vXWgpvwhzcAHfz9+C7JSHRREVbNCAj3j3iip0or7HgPgspYCMR/rgJJZEoYG5YcmHnrf ubqwyLtQn0Ac5Qd9dwg2p5kd0DJyIr5nu8PAJXvWfBOSUS4/i4/GqgNGKrYkFCzlNczH XQ3iuEWfTDZa8f4BqgfAo3wGMKxGJByMV49ABAwms6FI6qEyJQBrlmsti5vIQLmsPS+f WPUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=qlrQqiGgbrAk49RKqRFIdrQKPK4Z511TtS/XGZkjhBg=; b=gBvEhkkioX/I4a5ZKcq6dU0icK41JSvoeDPWgj4Zuv3yzSLfjse8hlfLmJgTHFa5E8 /Svoq8nuRKT5b3rK9lGLQLA9nzxdSYSgcZm7jyfgKPMHOTQVvRbuFN5nh2NWc+iRm8Bn PirSQV9H74sz/+kwExMKKjRHCDX6Qjk0ky3co4RCrgQtBaCo+o7Y7gsWH6v1XJ51G1U5 2KG2xCdZ9c8zdujqQWpgmHiZfcjxOsSN13hyLL4ZVHoWYhurSt58YHgT/y/rMy/+zx5H ANzwbIdHTf9LYhsuAeyVtbQDMbwGw+34ni7FsoHW1ldo3JTzoEAKaX5dn9hT1XJwdx/p oOUA== X-Gm-Message-State: APf1xPDD3pSEyB/zQQsD3RQPwwPWNNmxdqaXVxCTFVamt0bVoio2BBMq obC75QXwJvUDD+0uivUL4G4ULep/ZhMaNVN47Qbf/LEP X-Google-Smtp-Source: AH8x225drczXBeXWG/pV91A3b0tuf4gJ3UkgDLgB2ng2Ypj20ZigVME+Pa9HSC5LvXQ3A8REtzRZCfHU6auWPM0b+hU= X-Received: by 10.36.58.14 with SMTP id m14mr1413186itm.45.1518343782737; Sun, 11 Feb 2018 02:09:42 -0800 (PST) MIME-Version: 1.0 Sender: antoine.brodin.freebsd@gmail.com Received: by 10.107.143.86 with HTTP; Sun, 11 Feb 2018 02:09:42 -0800 (PST) In-Reply-To: References: <201802071506.w17F6s5l043163@repo.freebsd.org> From: Antoine Brodin Date: Sun, 11 Feb 2018 11:09:42 +0100 X-Google-Sender-Auth: X0a6jQ7qBxIYpLEE-xkoourJbAY Message-ID: Subject: Re: svn commit: r328973 - in stable/11: include sys/sys To: Hans Petter Selasky Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org, re Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 10:09:44 -0000 On Sun, Feb 11, 2018 at 8:01 AM, Antoine Brodin wrote: > On Wed, Feb 7, 2018 at 4:06 PM, Hans Petter Selasky > wrote: >> Author: hselasky >> Date: Wed Feb 7 15:06:54 2018 >> New Revision: 328973 >> URL: https://svnweb.freebsd.org/changeset/base/328973 >> >> Log: >> MFC r328237: >> Use the __alloc_size2 attribute where relevant. >> >> This follows the documented use in GCC. It is basically only relevant for >> calloc(3), reallocarray(3) and mallocarray(9). >> >> NOTE: Without this change clang 5.0.1 can produce incorrect optimisation >> code for static processing of data using the allocated object. For example >> this has been seen compiling the mlx4 core module, which allocates a >> fixed size array which is then sorted by a fixed order loop. The >> optimised result, -O2, is incorrect unless this patch is in place. >> >> Suggested by: Mark Millard >> Reference: https://docs.freebsd.org/cgi/mid.cgi?9DE674C6-EAA3-4E8A-906F-446E74D82FC4 >> >> Modified: >> stable/11/include/stdlib.h >> stable/11/sys/sys/malloc.h >> Directory Properties: >> stable/11/ (props changed) > > Hi, > > Please revert this change. Lots of ports that used to build fine on > stable/11 are now failing. > /usr/include/stdlib.h:93:7: error: expected function body after > function declarator > __alloc_size2(1, 2); Something like this may be needed on stable/11: Index: 11/sys/sys/cdefs.h =================================================================== --- 11/sys/sys/cdefs.h (revision 329121) +++ 11/sys/sys/cdefs.h (working copy) @@ -213,6 +213,7 @@ #define __aligned(x) #define __alloc_align(x) #define __alloc_size(x) +#define __alloc_size2(n, x) #define __section(x) #define __weak_symbol #else Antoine From owner-svn-src-stable-11@freebsd.org Sun Feb 11 10:23:33 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3201DF09696; Sun, 11 Feb 2018 10:23:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D8B4170FA1; Sun, 11 Feb 2018 10:23:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D37CA219E5; Sun, 11 Feb 2018 10:23:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1BANWIl030782; Sun, 11 Feb 2018 10:23:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1BANW2O030781; Sun, 11 Feb 2018 10:23:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802111023.w1BANW2O030781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 11 Feb 2018 10:23:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329122 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 329122 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 10:23:33 -0000 Author: hselasky Date: Sun Feb 11 10:23:32 2018 New Revision: 329122 URL: https://svnweb.freebsd.org/changeset/base/329122 Log: Fix regression issue after r328973: The lint target does no longer exist in FreeBSD head and the __alloc_size2() support for lint was missing when r328973 was MFCed. Add support for __alloc_size2() to the lint target. This is a direct commit. Found by: antoine@ Pointy hat: hselasky@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/sys/cdefs.h Modified: stable/11/sys/sys/cdefs.h ============================================================================== --- stable/11/sys/sys/cdefs.h Sun Feb 11 07:04:48 2018 (r329121) +++ stable/11/sys/sys/cdefs.h Sun Feb 11 10:23:32 2018 (r329122) @@ -213,6 +213,7 @@ #define __aligned(x) #define __alloc_align(x) #define __alloc_size(x) +#define __alloc_size2(n, x) #define __section(x) #define __weak_symbol #else From owner-svn-src-stable-11@freebsd.org Sun Feb 11 10:26:59 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58415F09A86; Sun, 11 Feb 2018 10:26:59 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EABCD7120B; Sun, 11 Feb 2018 10:26:58 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 0D7492605ED; Sun, 11 Feb 2018 11:26:56 +0100 (CET) Subject: Re: svn commit: r328973 - in stable/11: include sys/sys To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org, re References: <201802071506.w17F6s5l043163@repo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Sun, 11 Feb 2018 11:24:02 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 10:26:59 -0000 On 02/11/18 11:09, Antoine Brodin wrote: > On Sun, Feb 11, 2018 at 8:01 AM, Antoine Brodin wrote: >> On Wed, Feb 7, 2018 at 4:06 PM, Hans Petter Selasky >> wrote: >>> Author: hselasky >>> Date: Wed Feb 7 15:06:54 2018 >>> New Revision: 328973 >>> URL: https://svnweb.freebsd.org/changeset/base/328973 >>> >>> Log: >>> MFC r328237: >>> Use the __alloc_size2 attribute where relevant. >>> >>> This follows the documented use in GCC. It is basically only relevant for >>> calloc(3), reallocarray(3) and mallocarray(9). >>> >>> NOTE: Without this change clang 5.0.1 can produce incorrect optimisation >>> code for static processing of data using the allocated object. For example >>> this has been seen compiling the mlx4 core module, which allocates a >>> fixed size array which is then sorted by a fixed order loop. The >>> optimised result, -O2, is incorrect unless this patch is in place. >>> >>> Suggested by: Mark Millard >>> Reference: https://docs.freebsd.org/cgi/mid.cgi?9DE674C6-EAA3-4E8A-906F-446E74D82FC4 >>> >>> Modified: >>> stable/11/include/stdlib.h >>> stable/11/sys/sys/malloc.h >>> Directory Properties: >>> stable/11/ (props changed) >> >> Hi, >> >> Please revert this change. Lots of ports that used to build fine on >> stable/11 are now failing. >> /usr/include/stdlib.h:93:7: error: expected function body after >> function declarator >> __alloc_size2(1, 2); > Hi Antoine, I'm sorry for the inconvenience. Probably I should have sent this patch for portmgr first, to avoid such breakage. This patch is required also for ports, and it is good you are now rebuilding ports which use this define, because they might be broken due to the fact the __alloc_size2() was incorrectly implemented! I hope this will be the end of the breakage: https://svnweb.freebsd.org/changeset/base/329122 Else I will revert both patches and have you test them first. --HPS > Something like this may be needed on stable/11: > > Index: 11/sys/sys/cdefs.h > =================================================================== > --- 11/sys/sys/cdefs.h (revision 329121) > +++ 11/sys/sys/cdefs.h (working copy) > @@ -213,6 +213,7 @@ > #define __aligned(x) > #define __alloc_align(x) > #define __alloc_size(x) > +#define __alloc_size2(n, x) > #define __section(x) > #define __weak_symbol > #else > > Antoine > > From owner-svn-src-stable-11@freebsd.org Sun Feb 11 13:57:16 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55AA4F1A5F6; Sun, 11 Feb 2018 13:57:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D8CB479508; Sun, 11 Feb 2018 13:57:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from coleburn.home.andric.com (coleburn.home.andric.com [192.168.0.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id AAC681DFDD; Sun, 11 Feb 2018 14:57:08 +0100 (CET) From: Dimitry Andric Message-Id: <83191F81-4D50-4B7D-918D-963CC8A0F331@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_72B1D30F-D38F-459A-A74A-F4651EE3F99D"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r328973 - in stable/11: include sys/sys Date: Sun, 11 Feb 2018 14:57:07 +0100 In-Reply-To: Cc: Antoine Brodin , src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org, re To: Hans Petter Selasky References: <201802071506.w17F6s5l043163@repo.freebsd.org> X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 13:57:16 -0000 --Apple-Mail=_72B1D30F-D38F-459A-A74A-F4651EE3F99D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 11 Feb 2018, at 11:24, Hans Petter Selasky wrote: >=20 > On 02/11/18 11:09, Antoine Brodin wrote: >> On Sun, Feb 11, 2018 at 8:01 AM, Antoine Brodin = wrote: >>> On Wed, Feb 7, 2018 at 4:06 PM, Hans Petter Selasky >>> wrote: >>>> Author: hselasky >>>> Date: Wed Feb 7 15:06:54 2018 >>>> New Revision: 328973 >>>> URL: https://svnweb.freebsd.org/changeset/base/328973 >>>>=20 >>>> Log: >>>> MFC r328237: >>>> Use the __alloc_size2 attribute where relevant. >>>>=20 >>>> This follows the documented use in GCC. It is basically only = relevant for >>>> calloc(3), reallocarray(3) and mallocarray(9). >>>>=20 >>>> NOTE: Without this change clang 5.0.1 can produce incorrect = optimisation >>>> code for static processing of data using the allocated object. = For example >>>> this has been seen compiling the mlx4 core module, which = allocates a >>>> fixed size array which is then sorted by a fixed order loop. The >>>> optimised result, -O2, is incorrect unless this patch is in = place. >>>>=20 >>>> Suggested by: Mark Millard >>>> Reference: = https://docs.freebsd.org/cgi/mid.cgi?9DE674C6-EAA3-4E8A-906F-446E74D82FC4 >>>>=20 >>>> Modified: >>>> stable/11/include/stdlib.h >>>> stable/11/sys/sys/malloc.h >>>> Directory Properties: >>>> stable/11/ (props changed) >>>=20 >>> Hi, >>>=20 >>> Please revert this change. Lots of ports that used to build fine on >>> stable/11 are now failing. >>> /usr/include/stdlib.h:93:7: error: expected function body after >>> function declarator >>> __alloc_size2(1, 2); >=20 > Hi Antoine, >=20 > I'm sorry for the inconvenience. Probably I should have sent this = patch for portmgr first, to avoid such breakage. This patch is required = also for ports, and it is good you are now rebuilding ports which use = this define, because they might be broken due to the fact the = __alloc_size2() was incorrectly implemented! >=20 > I hope this will be the end of the breakage: >=20 > https://svnweb.freebsd.org/changeset/base/329122 Hmm, so you add something to the lint path, and that suddenly fixes the = builds? How is that possible? Are all these ports compiled in "lint = mode"? -Dimitry --Apple-Mail=_72B1D30F-D38F-459A-A74A-F4651EE3F99D Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCWoBLswAKCRCwXqMKLiCW o5RBAKDwFd8KBmE6f2Cydy8fFusUEwnHcACgwpPteMH/XmpJHZzOfNPHJxIX14s= =uP8l -----END PGP SIGNATURE----- --Apple-Mail=_72B1D30F-D38F-459A-A74A-F4651EE3F99D-- From owner-svn-src-stable-11@freebsd.org Sun Feb 11 16:54:47 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93DC3F04EE5 for ; Sun, 11 Feb 2018 16:54:47 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic306-35.consmr.mail.ne1.yahoo.com (sonic306-35.consmr.mail.ne1.yahoo.com [66.163.189.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 28146807A6 for ; Sun, 11 Feb 2018 16:54:47 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1518368086; bh=WtDuCuHH7EPhguGbusEbHD1Sp6M3vzSHsINTlFSePJ8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=KyjMMklJ33c+2jQRjtJUnJn8mPFhc0yVsQ82HvFkBXSXER7XTpbpcqUvPpjP3ubfZSOy/9dBaWDaSwNrezAWQiAblEg2otMSNXhEGMaTQPtgdFjZ+jf8K7/9c/SqbaqPz4z7Ai0d7pYFTd4ONGRpdjtxi9MDACsC7FU1g1tJVEQmAW+Le61nIdCnCsTuph/FnBR8ZHZPyCiheDjWsJPxkDCPcZcaBHgT/cA8Y2IFJjgtBgO+nrjNgrd0io7vfVIRgkBIL2dnIwXOLrM27VOH/0FfG8LmTrVtbfeMuFv10OLgBoiEhwDKU8pv75CeG//cjVhhNSUmAhyfnodpL41RAg== X-YMail-OSG: 8pPWtHgVM1lP5hSHImNzSlgBS79d__1dFprm7Igv9GXZpwwm9QfsPhNo7sWon_L cQx9QNjillhtC9fNgI_S.R3.F95w3jsAGPMhVkAxHn2vrNcnLA7.gnPCrvuRTaJ0IW7j740X8dRf Z1_yfVplyAJto9tgaVS4xzNRoVnRwfQ6dz7chMEFLMfFsRRvYaDJsBp97RY_10QkkpHX76b.1D6I cKL8kKv.PdkxwK3Q7qtwEd6updrUnHuV39kj3Fw0KJPj6jdnK4bfCkrbfkVQekxqpgne0JgB.fy3 o.c1F901hfnj1n56JYbKEQZyGAVdHitMKjbvetCqbI4qhBJQGgokpU.zUEw_FUbmdESG8WyeXxEf e01IJfa9LPEpDOs22o66.1aJzP4vGxiIinCYG2HStzmW6Nvr8Udcj8OgnuFKaDhP3xcKbWlzAfwi pXaRbBYP6JQjQJYbf9ncRmGDz9cD2kUaXc7RkX6d7yB5Gu.lbiPmPCAGyFYE0p7Sm.6h0R0s5uUh wFnKF_TM6Kg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.ne1.yahoo.com with HTTP; Sun, 11 Feb 2018 16:54:46 +0000 Received: from smtp230.mail.ne1.yahoo.com (EHLO [192.168.0.8]) ([10.218.253.211]) by smtp409.mail.ne1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID b87cb78e870cdc10322a74f0b8f86ff3; Sun, 11 Feb 2018 16:54:45 +0000 (UTC) Subject: Re: svn commit: r328973 - in stable/11: include sys/sys To: Hans Petter Selasky , Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org, re References: <201802071506.w17F6s5l043163@repo.freebsd.org> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <28983217-7cbf-6ef8-8197-de122af9bf6f@FreeBSD.org> Date: Sun, 11 Feb 2018 11:54:44 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 16:54:47 -0000 ... On 11/02/2018 05:24, Hans Petter Selasky wrote: > On 02/11/18 11:09, Antoine Brodin wrote: >> On Sun, Feb 11, 2018 at 8:01 AM, Antoine Brodin >> wrote: >>> On Wed, Feb 7, 2018 at 4:06 PM, Hans Petter Selasky >>> wrote: >>>> Author: hselasky >>>> Date: Wed Feb  7 15:06:54 2018 >>>> New Revision: 328973 >>>> URL: https://svnweb.freebsd.org/changeset/base/328973 >>>> >>>> Log: >>>>    MFC r328237: >>>>    Use the __alloc_size2 attribute where relevant. >>>> >>>>    This follows the documented use in GCC. It is basically only >>>> relevant for >>>>    calloc(3), reallocarray(3) and  mallocarray(9). >>>> >>>>    NOTE: Without this change clang 5.0.1 can produce incorrect >>>> optimisation >>>>    code for static processing of data using the allocated object. >>>> For example >>>>    this has been seen compiling the mlx4 core module, which >>>> allocates a >>>>    fixed size array which is then sorted by a fixed order loop. The >>>>    optimised result, -O2, is incorrect unless this patch is in place. >>>> >>>>    Suggested by: Mark Millard >>>>    Reference: >>>> https://docs.freebsd.org/cgi/mid.cgi?9DE674C6-EAA3-4E8A-906F-446E74D82FC4 >>>> >>>> Modified: >>>>    stable/11/include/stdlib.h >>>>    stable/11/sys/sys/malloc.h >>>> Directory Properties: >>>>    stable/11/   (props changed) >>> >>> Hi, >>> >>> Please revert this change.  Lots of ports that used to build fine on >>> stable/11 are now failing. >>> /usr/include/stdlib.h:93:7: error: expected function body after >>> function declarator >>>               __alloc_size2(1, 2); >> > > Hi Antoine, > > I'm sorry for the inconvenience. Probably I should have sent this > patch for portmgr first, to avoid such breakage. This patch is > required also for ports, and it is good you are now rebuilding ports > which use this define, because they might be broken due to the fact > the __alloc_size2() was incorrectly implemented! > > I hope this will be the end of the breakage: > > https://svnweb.freebsd.org/changeset/base/329122 > > Else I will revert both patches and have you test them first. > > --HPS > While the lint mode definition was missing, I didn't merge the attribute uses (r328237) on purpose as I knew they could bring issues. Some rather broken ports like to take the standard headers and "fix" them. In essence, any port that requires an attribute defined in sys/cdefs.h is doing something wrong. The most notable offender was GCC but I think that was fixed: in any case, the last time I merged an attribute change I had to wait for the next release to start using it. Cheers, Pedro. From owner-svn-src-stable-11@freebsd.org Sun Feb 11 17:09:44 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8B4DF06086; Sun, 11 Feb 2018 17:09:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F56E8105D; Sun, 11 Feb 2018 17:09:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from coleburn.home.andric.com (coleburn.home.andric.com [192.168.0.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 80E3E1DFF8; Sun, 11 Feb 2018 18:09:42 +0100 (CET) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_B5CEA6CA-1D2A-4A47-AD7B-EA05B59FAFCB"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r328973 - in stable/11: include sys/sys Date: Sun, 11 Feb 2018 18:09:36 +0100 In-Reply-To: <28983217-7cbf-6ef8-8197-de122af9bf6f@FreeBSD.org> Cc: Hans Petter Selasky , Antoine Brodin , src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org, re To: Pedro Giffuni References: <201802071506.w17F6s5l043163@repo.freebsd.org> <28983217-7cbf-6ef8-8197-de122af9bf6f@FreeBSD.org> X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 17:09:44 -0000 --Apple-Mail=_B5CEA6CA-1D2A-4A47-AD7B-EA05B59FAFCB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 11 Feb 2018, at 17:54, Pedro Giffuni wrote: ... > While the lint mode definition was missing, I didn't merge the = attribute uses (r328237) on purpose as I knew they could bring issues. = Some rather broken ports like to take the standard headers and "fix" = them. In essence, any port that requires an attribute defined in = sys/cdefs.h is doing something wrong. >=20 > The most notable offender was GCC but I think that was fixed: in any = case, the last time I merged an attribute change I had to wait for the = next release to start using it. The "fixincludes" feature you are referring to was finally removed by Gerald in r444860 for gcc5, and for other gcc ports in later revisions: https://svnweb.freebsd.org/ports?view=3Drevision&revision=3D444860 so both the latest quarterly and the current package collection should have no more gcc's with mangled system headers. -Dimitry --Apple-Mail=_B5CEA6CA-1D2A-4A47-AD7B-EA05B59FAFCB Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCWoB40AAKCRCwXqMKLiCW o6ZpAJ0SRuI7Mi9X2FxDnEDCH0/DBsFjPQCfXuW3GXP3ZMs+E4oPdspPXtfJErM= =NG6F -----END PGP SIGNATURE----- --Apple-Mail=_B5CEA6CA-1D2A-4A47-AD7B-EA05B59FAFCB-- From owner-svn-src-stable-11@freebsd.org Sun Feb 11 19:30:03 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1073F10913; Sun, 11 Feb 2018 19:30:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5DEEE86712; Sun, 11 Feb 2018 19:30:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58ABA27266; Sun, 11 Feb 2018 19:30:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1BJU2rC000847; Sun, 11 Feb 2018 19:30:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1BJTw3n000776; Sun, 11 Feb 2018 19:29:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802111929.w1BJTw3n000776@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 11 Feb 2018 19:29:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329129 - in stable/11/sys/boot: . arm/uboot common efi/boot1 efi/fdt efi/include efi/libefi efi/loader fdt i386/gptboot i386/gptzfsboot i386/libfirewire i386/libi386 i386/loader i386/z... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/sys/boot: . arm/uboot common efi/boot1 efi/fdt efi/include efi/libefi efi/loader fdt i386/gptboot i386/gptzfsboot i386/libfirewire i386/libi386 i386/loader i386/zfsboot libstand32 mips/be... X-SVN-Commit-Revision: 329129 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 19:30:03 -0000 Author: kevans Date: Sun Feb 11 19:29:58 2018 New Revision: 329129 URL: https://svnweb.freebsd.org/changeset/base/329129 Log: MFC Loader Fixes 2017q4p1: r324321,r324359,r324360,r324388,r324449,r324450, r324451,r324452 r324321: This README file was quite relevant for FreeBSD 3 or 4. No more. r324359: Add efi_devpath_is_prefix r324360: Encapsulate ZFS preferences into efi_zfs_is_preferred r324388: Unbreak building efiboot with MK_ZFS == no r324449: Prefer ${LIBSTAND} to -lstand r324450: Define SASRC and use it r324451: Add missing -I${SASRC} in a couple of places so that stand.h doesn't accidentally come in via host pollution. r324452: Define LIBSA* and use them instead of overloaded LIBSTAND Added: stable/11/sys/boot/userboot/Makefile.inc - copied unchanged from r324450, head/sys/boot/userboot/Makefile.inc Deleted: stable/11/sys/boot/README Modified: stable/11/sys/boot/Makefile.ficl stable/11/sys/boot/Makefile.inc stable/11/sys/boot/arm/uboot/Makefile stable/11/sys/boot/common/Makefile.inc stable/11/sys/boot/efi/boot1/Makefile stable/11/sys/boot/efi/fdt/Makefile stable/11/sys/boot/efi/include/efilib.h stable/11/sys/boot/efi/include/efizfs.h stable/11/sys/boot/efi/libefi/Makefile stable/11/sys/boot/efi/libefi/devpath.c stable/11/sys/boot/efi/libefi/efizfs.c stable/11/sys/boot/efi/loader/Makefile stable/11/sys/boot/efi/loader/main.c stable/11/sys/boot/fdt/Makefile stable/11/sys/boot/i386/gptboot/Makefile stable/11/sys/boot/i386/gptzfsboot/Makefile stable/11/sys/boot/i386/libfirewire/Makefile stable/11/sys/boot/i386/libi386/Makefile stable/11/sys/boot/i386/loader/Makefile stable/11/sys/boot/i386/zfsboot/Makefile stable/11/sys/boot/libstand32/Makefile stable/11/sys/boot/mips/beri/boot2/Makefile stable/11/sys/boot/mips/beri/loader/Makefile stable/11/sys/boot/mips/uboot/Makefile stable/11/sys/boot/ofw/libofw/Makefile stable/11/sys/boot/powerpc/kboot/Makefile stable/11/sys/boot/powerpc/ofw/Makefile stable/11/sys/boot/powerpc/ps3/Makefile stable/11/sys/boot/powerpc/uboot/Makefile stable/11/sys/boot/sparc64/loader/Makefile stable/11/sys/boot/uboot/fdt/Makefile stable/11/sys/boot/uboot/lib/Makefile stable/11/sys/boot/userboot/libstand/Makefile stable/11/sys/boot/userboot/userboot/Makefile stable/11/sys/boot/userboot/zfs/Makefile stable/11/sys/boot/zfs/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/Makefile.ficl ============================================================================== --- stable/11/sys/boot/Makefile.ficl Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/Makefile.ficl Sun Feb 11 19:29:58 2018 (r329129) @@ -27,7 +27,7 @@ CFLAGS+= -m32 -mcpu=powerpc -I. .endif CFLAGS+= -I${FICLDIR} -I${FICLDIR}/${FICL_CPUARCH} \ - -I${FICLDIR}/../common + -I${FICLDIR}/../common -I${SASRC} .if ${MACHINE_CPUARCH} == "amd64" && defined(FICL32) .if !exists(machine) Modified: stable/11/sys/boot/Makefile.inc ============================================================================== --- stable/11/sys/boot/Makefile.inc Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/Makefile.inc Sun Feb 11 19:29:58 2018 (r329129) @@ -2,6 +2,17 @@ .include +.if !defined(__BOOT_MAKEFILE_INC__) +__BOOT_MAKEFILE_INC__=${MFILE} + +SASRC=${SRCTOP}/lib/libstand +# Normal stand alone library +LIBSA=${OBJTOP}/lib/libstand/libstand.a +# stand alone library compiled for 32-bit version of the processor +LIBSA32=${OBJTOP}/sys/boot/libstand32/libstand.a +# stand along library compiled for userboot +LIBSAU=${OBJTOP}/sys/boot/userboot/libstand/libstand.a + SSP_CFLAGS= .if ${MACHINE_CPUARCH} == "arm" @@ -24,9 +35,9 @@ DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && e DD=dd ${DD_NOSTATUS} .if ${MK_LOADER_FORCE_LE} != "no" - .if ${MACHINE_ARCH} == "powerpc64" CFLAGS+= -mlittle-endian +.endif .endif .endif Modified: stable/11/sys/boot/arm/uboot/Makefile ============================================================================== --- stable/11/sys/boot/arm/uboot/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/arm/uboot/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -112,16 +112,15 @@ LIBUBOOT= ${.OBJDIR}/../../uboot/lib/libuboot.a CFLAGS+= -I${.CURDIR}/../../uboot/lib CFLAGS+= -I${.OBJDIR}/../../uboot/lib -# where to get libstand from -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ +CFLAGS+= -I${SASRC} CFLAGS+= -fPIC # clang doesn't understand %D as a specifier to printf NO_WERROR.clang= -DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} -lstand +DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} +LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} OBJS+= ${SRCS:N*.h:R:S/$/.o/g} Modified: stable/11/sys/boot/common/Makefile.inc ============================================================================== --- stable/11/sys/boot/common/Makefile.inc Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/common/Makefile.inc Sun Feb 11 19:29:58 2018 (r329129) @@ -74,7 +74,7 @@ CFLAGS+= -DBOOT_PROMPT_123 .if defined(LOADER_INSTALL_SUPPORT) SRCS+= install.c -CFLAGS+=-I${.CURDIR}/../../../../lib/libstand +CFLAGS+=-I${SASRC} .endif CLEANFILES+= vers.c Modified: stable/11/sys/boot/efi/boot1/Makefile ============================================================================== --- stable/11/sys/boot/efi/boot1/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/efi/boot1/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -90,8 +90,8 @@ LIBEFI= ${.OBJDIR}/../libefi/libefi.a # __aeabi_* (arm) or __divdi3 (i386). # as well as required string and memory functions for all platforms. # -DPADD+= ${LIBEFI} ${LIBSTAND} -LDADD+= ${LIBEFI} -lstand +DPADD+= ${LIBEFI} ${LIBSA} +LDADD+= ${LIBEFI} ${LIBSA} DPADD+= ${LDSCRIPT} Modified: stable/11/sys/boot/efi/fdt/Makefile ============================================================================== --- stable/11/sys/boot/efi/fdt/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/efi/fdt/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -17,7 +17,7 @@ CFLAGS+= -mgeneral-regs-only CFLAGS+= -msoft-float .endif -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ +CFLAGS+= -I${SASRC} # EFI library headers CFLAGS+= -I${.CURDIR}/../include Modified: stable/11/sys/boot/efi/include/efilib.h ============================================================================== --- stable/11/sys/boot/efi/include/efilib.h Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/efi/include/efilib.h Sun Feb 11 19:29:58 2018 (r329129) @@ -82,6 +82,7 @@ EFI_HANDLE efi_devpath_handle(EFI_DEVICE_PATH *); EFI_DEVICE_PATH *efi_devpath_last_node(EFI_DEVICE_PATH *); EFI_DEVICE_PATH *efi_devpath_trim(EFI_DEVICE_PATH *); bool efi_devpath_match(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *); +int efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *); CHAR16 *efi_devpath_name(EFI_DEVICE_PATH *); void efi_free_devpath_name(CHAR16 *); Modified: stable/11/sys/boot/efi/include/efizfs.h ============================================================================== --- stable/11/sys/boot/efi/include/efizfs.h Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/efi/include/efizfs.h Sun Feb 11 19:29:58 2018 (r329129) @@ -27,6 +27,7 @@ */ #include +#include #ifndef _EFIZFS_H_ #define _EFIZFS_H_ @@ -45,6 +46,7 @@ extern uint64_t pool_guid; extern void efi_zfs_probe(void); extern zfsinfo_list_t *efizfs_get_zfsinfo_list(void); +extern bool efi_zfs_is_preferred(EFI_HANDLE *h); extern EFI_HANDLE efizfs_get_handle_by_guid(uint64_t); #endif Modified: stable/11/sys/boot/efi/libefi/Makefile ============================================================================== --- stable/11/sys/boot/efi/libefi/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/efi/libefi/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -37,7 +37,7 @@ CFLAGS+= -fPIC -mno-red-zone .endif CFLAGS+= -I${.CURDIR}/../include CFLAGS+= -I${.CURDIR}/../include/${MACHINE} -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand +CFLAGS+= -I${SASRC} .if ${MK_ZFS} != "no" CFLAGS+= -I${.CURDIR}/../../zfs CFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs Modified: stable/11/sys/boot/efi/libefi/devpath.c ============================================================================== --- stable/11/sys/boot/efi/libefi/devpath.c Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/efi/libefi/devpath.c Sun Feb 11 19:29:58 2018 (r329129) @@ -166,3 +166,32 @@ efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVIC } return (true); } + +int +efi_devpath_is_prefix(EFI_DEVICE_PATH *prefix, EFI_DEVICE_PATH *path) +{ + int len; + + if (prefix == NULL || path == NULL) + return (0); + + while (1) { + if (IsDevicePathEnd(prefix)) + break; + + if (DevicePathType(prefix) != DevicePathType(path) || + DevicePathSubType(prefix) != DevicePathSubType(path)) + return (0); + + len = DevicePathNodeLength(prefix); + if (len != DevicePathNodeLength(path)) + return (0); + + if (memcmp(prefix, path, (size_t)len) != 0) + return (0); + + prefix = NextDevicePathNode(prefix); + path = NextDevicePathNode(path); + } + return (1); +} Modified: stable/11/sys/boot/efi/libefi/efizfs.c ============================================================================== --- stable/11/sys/boot/efi/libefi/efizfs.c Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/efi/libefi/efizfs.c Sun Feb 11 19:29:58 2018 (r329129) @@ -81,12 +81,9 @@ efi_zfs_probe(void) { pdinfo_list_t *hdi; pdinfo_t *hd, *pd = NULL; - EFI_GUID imgid = LOADED_IMAGE_PROTOCOL; - EFI_LOADED_IMAGE *img; char devname[SPECNAMELEN + 1]; uint64_t guid; - BS->HandleProtocol(IH, &imgid, (VOID**)&img); hdi = efiblk_get_pdinfo_list(&efipart_hddev); STAILQ_INIT(&zfsinfo); @@ -105,7 +102,7 @@ efi_zfs_probe(void) if (zfs_probe_dev(devname, &guid) == 0) { insert_zfs(pd->pd_handle, guid); - if (pd->pd_handle == img->DeviceHandle) + if (efi_zfs_is_preferred(pd->pd_handle)) pool_guid = guid; } Modified: stable/11/sys/boot/efi/loader/Makefile ============================================================================== --- stable/11/sys/boot/efi/loader/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/efi/loader/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -37,7 +37,7 @@ CWARNFLAGS.zfs.c+= -Wno-missing-prototypes .endif .if defined(LOADER_NET_SUPPORT) -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand +CFLAGS+= -I${SASRC} .endif .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 @@ -156,9 +156,9 @@ loader.efi: ${PROG} LIBEFI= ${.OBJDIR}/../libefi/libefi.a -DPADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSTAND} \ +DPADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} \ ${LDSCRIPT} -LDADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSTAND} +LDADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} .include Modified: stable/11/sys/boot/efi/loader/main.c ============================================================================== --- stable/11/sys/boot/efi/loader/main.c Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/efi/loader/main.c Sun Feb 11 19:29:58 2018 (r329129) @@ -72,6 +72,16 @@ EFI_GUID debugimg = DEBUG_IMAGE_INFO_TABLE_GUID; EFI_GUID fdtdtb = FDT_TABLE_GUID; EFI_GUID inputid = SIMPLE_TEXT_INPUT_PROTOCOL; +static EFI_LOADED_IMAGE *img; + +#ifdef EFI_ZFS_BOOT +bool +efi_zfs_is_preferred(EFI_HANDLE *h) +{ + return (h == img->DeviceHandle); +} +#endif + static int has_keyboard(void) { @@ -300,7 +310,6 @@ EFI_STATUS main(int argc, CHAR16 *argv[]) { char var[128]; - EFI_LOADED_IMAGE *img; EFI_GUID *guid; int i, j, vargood, howto; UINTN k; @@ -319,6 +328,9 @@ main(int argc, CHAR16 *argv[]) archsw.arch_zfs_probe = efi_zfs_probe; #endif + /* Get our loaded image protocol interface structure. */ + BS->HandleProtocol(IH, &imgid, (VOID**)&img); + /* Init the time source */ efi_time_init(); @@ -445,9 +457,6 @@ main(int argc, CHAR16 *argv[]) for (i = 0; devsw[i] != NULL; i++) if (devsw[i]->dv_init != NULL) (devsw[i]->dv_init)(); - - /* Get our loaded image protocol interface structure. */ - BS->HandleProtocol(IH, &imgid, (VOID**)&img); printf("Command line arguments:"); for (i = 0; i < argc; i++) Modified: stable/11/sys/boot/fdt/Makefile ============================================================================== --- stable/11/sys/boot/fdt/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/fdt/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -12,6 +12,7 @@ SRCS+= fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt # Loader's fdt commands extension sources. SRCS+= fdt_loader_cmd.c +CFLAGS+= -I${SASRC} CFLAGS+= -I${.CURDIR}/../../contrib/libfdt/ -I${.CURDIR}/../common/ CFLAGS+= -ffreestanding Modified: stable/11/sys/boot/i386/gptboot/Makefile ============================================================================== --- stable/11/sys/boot/i386/gptboot/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/i386/gptboot/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -50,8 +50,6 @@ OPENCRYPTO_XTS= xform_aes_xts.o LD_FLAGS=${LD_FLAGS_BIN} -LIBSTAND= ${.OBJDIR}/../../libstand32/libstand.a - # Pick up ../Makefile.inc early. .include @@ -76,7 +74,7 @@ gptboot.bin: gptboot.out ${OBJCOPY} -S -O binary gptboot.out ${.TARGET} gptboot.out: ${BTXCRT} gptboot.o sio.o crc32.o drv.o cons.o util.o ${OPENCRYPTO_XTS} - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSTAND} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSA32} gptboot.o: ${.CURDIR}/../../common/ufsread.c Modified: stable/11/sys/boot/i386/gptzfsboot/Makefile ============================================================================== --- stable/11/sys/boot/i386/gptzfsboot/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/i386/gptzfsboot/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -60,8 +60,6 @@ CFLAGS.gcc+= --param max-inline-insns-single=100 LD_FLAGS=${LD_FLAGS_BIN} -LIBSTAND= ${.OBJDIR}/../../libstand32/libstand.a - # Pick up ../Makefile.inc early. .include @@ -87,7 +85,7 @@ gptzfsboot.bin: gptzfsboot.out gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o util.o \ skein.o skein_block.o ${OPENCRYPTO_XTS} - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSTAND} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSA32} zfsboot.o: ${.CURDIR}/../../zfs/zfsimpl.c Modified: stable/11/sys/boot/i386/libfirewire/Makefile ============================================================================== --- stable/11/sys/boot/i386/libfirewire/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/i386/libfirewire/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -10,7 +10,7 @@ SRCS+= dcons.c fwcrom.c CFLAGS+= -D_BOOT CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I. -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand +CFLAGS+= -I${SASRC} CFLAGS+= -I${.CURDIR}/../btx/lib CFLAGS+= -I${.CURDIR}/../libi386 Modified: stable/11/sys/boot/i386/libi386/Makefile ============================================================================== --- stable/11/sys/boot/i386/libi386/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/i386/libi386/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -60,7 +60,7 @@ CFLAGS+= -I${.CURDIR}/../../ficl -I${.CURDIR}/../../fi -I${.CURDIR}/../../../contrib/dev/acpica/include \ -I${.CURDIR}/../../.. -I. # the location of libstand -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ +CFLAGS+= -I${SASRC} # Handle FreeBSD specific %b and %D printf format specifiers CFLAGS+= ${FORMAT_EXTENSIONS} Modified: stable/11/sys/boot/i386/loader/Makefile ============================================================================== --- stable/11/sys/boot/i386/loader/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/i386/loader/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -29,7 +29,7 @@ LIBZFSBOOT= ${.OBJDIR}/../../zfs/libzfsboot.a .endif .if defined(LOADER_NET_SUPPORT) -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand +CFLAGS+= -I${SASRC} .endif .if defined(LOADER_TFTP_SUPPORT) @@ -90,8 +90,6 @@ LDFLAGS= -static -Ttext 0x0 LIBI386= ${.OBJDIR}/../libi386/libi386.a CFLAGS+= -I${.CURDIR}/.. -LIBSTAND= ${.OBJDIR}/../../libstand32/libstand.a - # BTX components CFLAGS+= -I${.CURDIR}/../btx/lib @@ -127,8 +125,8 @@ FILES+= loader.rc menu.rc # XXX crt0.o needs to be first for pxeboot(8) to work OBJS= ${BTXCRT} -DPADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSTAND} +DPADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} +LDADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} .include Modified: stable/11/sys/boot/i386/zfsboot/Makefile ============================================================================== --- stable/11/sys/boot/i386/zfsboot/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/i386/zfsboot/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -40,8 +40,6 @@ CFLAGS+= -DSKEIN_LOOP=111 LD_FLAGS=${LD_FLAGS_BIN} -LIBSTAND= ${.OBJDIR}/../../libstand32/libstand.a - # Pick up ../Makefile.inc early. .include @@ -83,7 +81,7 @@ zfsboot.bin: zfsboot.out ${OBJCOPY} -S -O binary zfsboot.out ${.TARGET} zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o util.o skein.o skein_block.o - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32} SRCS= zfsboot.c Modified: stable/11/sys/boot/libstand32/Makefile ============================================================================== --- stable/11/sys/boot/libstand32/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/libstand32/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -2,23 +2,25 @@ .include -LIBSTAND_SRC= ${.CURDIR}/../../../lib/libstand +.include "../Makefile.inc" + .if ${MACHINE_CPUARCH} == "amd64" LIBSTAND_CPUARCH=i386 .else LIBSTAND_CPUARCH=${MACHINE_CPUARCH} .endif -LIBC_SRC= ${LIBSTAND_SRC}/../libc +LIBSTAND_SRC= ${SASRC} +LIBC_SRC= ${SRCTOP}/lib/libc INTERNALLIB= INCS= MAN= -.PATH: ${LIBSTAND_SRC} +.PATH: ${SASRC} .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64" CFLAGS+= -m32 -I. .endif -.include "${LIBSTAND_SRC}/Makefile" +.include "${SASRC}/Makefile" .if ${MACHINE_CPUARCH} == "amd64" CLEANFILES+= machine Modified: stable/11/sys/boot/mips/beri/boot2/Makefile ============================================================================== --- stable/11/sys/boot/mips/beri/boot2/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/mips/beri/boot2/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -58,8 +58,7 @@ CFLAGS= -ffreestanding \ -g # where to get libstand from -CFLAGS+= -I${.CURDIR}/../../../../../lib/libstand/ -LIBSTAND= ${.OBJDIR}/../../../../../lib/libstand/libstand.a +CFLAGS+= -I${SASRC} LDFLAGS= -nostdlib \ -static \ @@ -72,7 +71,7 @@ CFLAGS+= -I${.CURDIR}/../common flashboot.elf: relocate.o start.o boot2.o altera_jtag_uart.o cfi.o sdcard.o ${CC} ${LDFLAGS} -T ${.CURDIR}/flashboot.ldscript -o ${.TARGET} \ - ${.ALLSRC} ${LIBSTAND} + ${.ALLSRC} ${LIBSA} flashboot: flashboot.elf ${OBJCOPY} -S -O binary ${.TARGET}.elf ${.TARGET} flashboot.md5: flashboot @@ -80,7 +79,7 @@ flashboot.md5: flashboot jtagboot: start.o boot2.o altera_jtag_uart.o cfi.o sdcard.o ${CC} ${LDFLAGS} -T ${.CURDIR}/jtagboot.ldscript -o ${.TARGET} \ - ${.ALLSRC} ${LIBSTAND} + ${.ALLSRC} ${LIBSA} jtagboot.md5: jtagboot md5 jtagboot > jtagboot.md5 Modified: stable/11/sys/boot/mips/beri/loader/Makefile ============================================================================== --- stable/11/sys/boot/mips/beri/loader/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/mips/beri/loader/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -108,11 +108,10 @@ LDFLAGS= -nostdlib \ -e __start # where to get libstand from -CFLAGS+= -I${.CURDIR}/../../../../../lib/libstand/ -LIBSTAND= ${.OBJDIR}/../../../../../lib/libstand/libstand.a +CFLAGS+= -I${SASRC} -DPADD= ${LIBFICL} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBSTAND} +DPADD= ${LIBFICL} ${LIBSA} +LDADD= ${LIBFICL} ${LIBSA} loader.help: help.common help.mips cat ${.ALLSRC} | \ Modified: stable/11/sys/boot/mips/uboot/Makefile ============================================================================== --- stable/11/sys/boot/mips/uboot/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/mips/uboot/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -116,15 +116,14 @@ CFLAGS+= -I${.CURDIR}/../../uboot/lib CFLAGS+= -I${.OBJDIR}/../../uboot/lib # where to get libstand from -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ -LIBSTAND= ${.OBJDIR}/../../../../lib/libstand/libstand.a +CFLAGS+= -I${SASRC} # clang doesn't understand %D as a specifier to printf #NO_WERROR.clang= #NO_WERROR= -DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND} +DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} +LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} OBJS+= ${SRCS:N*.h:R:S/$/.o/g} Modified: stable/11/sys/boot/ofw/libofw/Makefile ============================================================================== --- stable/11/sys/boot/ofw/libofw/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/ofw/libofw/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -9,7 +9,7 @@ SRCS= devicename.c elf_freebsd.c ofw_console.c ofw_cop .PATH: ${.CURDIR}/../../zfs SRCS+= devicename_stubs.c -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ +CFLAGS+= -I${SASRC} # Pick up the bootstrap header for some interface items CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I. Modified: stable/11/sys/boot/powerpc/kboot/Makefile ============================================================================== --- stable/11/sys/boot/powerpc/kboot/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/powerpc/kboot/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -94,11 +94,10 @@ CFLAGS+= -Wa,-mppc64bridge #.include "${.CURDIR}/../../ofw/common/Makefile.inc" # where to get libstand from -LIBSTAND= ${.OBJDIR}/../../libstand32/libstand.a -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ +CFLAGS+= -I${SASRC} -DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND} +DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA32} +LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA32} loader.help: help.common help.kboot ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ Modified: stable/11/sys/boot/powerpc/ofw/Makefile ============================================================================== --- stable/11/sys/boot/powerpc/ofw/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/powerpc/ofw/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -92,11 +92,10 @@ LIBOFW= ${.OBJDIR}/../../ofw/libofw/libofw.a CFLAGS+= -I${.CURDIR}/../../ofw/libofw # where to get libstand from -LIBSTAND= ${.OBJDIR}/../../libstand32/libstand.a -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ +CFLAGS+= -I${SASRC} -DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND} +DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA32} +LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA32} loader.help: help.common help.ofw ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ Modified: stable/11/sys/boot/powerpc/ps3/Makefile ============================================================================== --- stable/11/sys/boot/powerpc/ps3/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/powerpc/ps3/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -91,11 +91,10 @@ LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powe #.include "${.CURDIR}/../../ofw/common/Makefile.inc" # where to get libstand from -LIBSTAND= ${.OBJDIR}/../../libstand32/libstand.a -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ +CFLAGS+= -I${SASRC} -DPADD= ${LIBFICL} ${LIBOFW} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBOFW} ${LIBSTAND} +DPADD= ${LIBFICL} ${LIBOFW} ${LIBSA32} +LDADD= ${LIBFICL} ${LIBOFW} ${LIBSA32} SC_DFLT_FONT=cp437 Modified: stable/11/sys/boot/powerpc/uboot/Makefile ============================================================================== --- stable/11/sys/boot/powerpc/uboot/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/powerpc/uboot/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -97,11 +97,10 @@ CFLAGS+= -I${.CURDIR}/../../uboot/lib CFLAGS+= -I${.OBJDIR}/../../uboot/lib # where to get libstand from -LIBSTAND= ${.OBJDIR}/../../libstand32/libstand.a -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ +CFLAGS+= -I${SASRC} -DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND} +DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA32} +LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA32} loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ Modified: stable/11/sys/boot/sparc64/loader/Makefile ============================================================================== --- stable/11/sys/boot/sparc64/loader/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/sparc64/loader/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -80,13 +80,13 @@ LIBOFW= ${.OBJDIR}/../../ofw/libofw/libofw.a CFLAGS+= -I${.CURDIR}/../../ofw/libofw/ # where to get libstand from -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ +CFLAGS+= -I${SASRC} # Need sys/ for crypto/intake.h CFLAGS+= -I${SRCTOP}/sys -DPADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} -lstand +DPADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA} +LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA} loader.help: help.common help.sparc64 cat ${.ALLSRC} | \ Modified: stable/11/sys/boot/uboot/fdt/Makefile ============================================================================== --- stable/11/sys/boot/uboot/fdt/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/uboot/fdt/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -12,7 +12,7 @@ SRCS= uboot_fdt.c CFLAGS+= -ffreestanding -msoft-float -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ +CFLAGS+= -I${SASRC} # U-Boot library headers CFLAGS+= -I${.CURDIR}/../lib Modified: stable/11/sys/boot/uboot/lib/Makefile ============================================================================== --- stable/11/sys/boot/uboot/lib/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/uboot/lib/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -13,7 +13,7 @@ SRCS+= module.c net.c reboot.c time.c CFLAGS+= -ffreestanding -msoft-float -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ +CFLAGS+= -I${SASRC} .if !defined(LOADER_NO_DISK_SUPPORT) SRCS+= disk.c Copied: stable/11/sys/boot/userboot/Makefile.inc (from r324450, head/sys/boot/userboot/Makefile.inc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/boot/userboot/Makefile.inc Sun Feb 11 19:29:58 2018 (r329129, copy of r324450, head/sys/boot/userboot/Makefile.inc) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "../Makefile.inc" Modified: stable/11/sys/boot/userboot/libstand/Makefile ============================================================================== --- stable/11/sys/boot/userboot/libstand/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/userboot/libstand/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -1,8 +1,9 @@ # $FreeBSD$ .include +.include "../Makefile.inc" -LIBSTAND_SRC= ${.CURDIR}/../../../../lib/libstand +LIBSTAND_SRC= ${SASRC} INTERNALLIB= INCS= Modified: stable/11/sys/boot/userboot/userboot/Makefile ============================================================================== --- stable/11/sys/boot/userboot/userboot/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/userboot/userboot/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -32,7 +32,7 @@ CFLAGS+= -Wall CFLAGS+= -I${.CURDIR}/.. CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I${.CURDIR}/../../.. -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand +CFLAGS+= -I${SASRC} CFLAGS+= -ffreestanding -I. CWARNFLAGS.main.c += -Wno-implicit-function-declaration @@ -49,8 +49,6 @@ CFLAGS+= -DBF_DICTSIZE=15000 LIBFICL= ${.OBJDIR}/../ficl/libficl.a .endif -LIBSTAND= ${.OBJDIR}/../libstand/libstand.a - .if ${MK_ZFS} != "no" CFLAGS+= -DUSERBOOT_ZFS_SUPPORT LIBZFSBOOT= ${.OBJDIR}/../zfs/libzfsboot.a @@ -61,7 +59,7 @@ LIBZFSBOOT= ${.OBJDIR}/../zfs/libzfsboot.a .include "${.CURDIR}/../../common/Makefile.inc" CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I. -DPADD+= ${LIBFICL} ${LIBZFSBOOT} ${LIBSTAND} -LDADD+= ${LIBFICL} ${LIBZFSBOOT} ${LIBSTAND} +DPADD+= ${LIBFICL} ${LIBZFSBOOT} ${LIBSAU} +LDADD+= ${LIBFICL} ${LIBZFSBOOT} ${LIBSAU} .include Modified: stable/11/sys/boot/userboot/zfs/Makefile ============================================================================== --- stable/11/sys/boot/userboot/zfs/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/userboot/zfs/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -12,7 +12,7 @@ SRCS+= zfs.c skein.c skein_block.c CFLAGS+= -DSKEIN_LOOP=111 CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I. -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand +CFLAGS+= -I${SASRC} CFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs CFLAGS+= -I${.CURDIR}/../../../crypto/skein Modified: stable/11/sys/boot/zfs/Makefile ============================================================================== --- stable/11/sys/boot/zfs/Makefile Sun Feb 11 18:37:08 2018 (r329128) +++ stable/11/sys/boot/zfs/Makefile Sun Feb 11 19:29:58 2018 (r329129) @@ -12,7 +12,7 @@ CFLAGS+= -DSKEIN_LOOP=111 CFLAGS+= -DBOOTPROG=\"zfsloader\" CFLAGS+= -I${.CURDIR}/../common -I${.CURDIR}/../.. -I. -CFLAGS+= -I${.CURDIR}/../../../lib/libstand +CFLAGS+= -I${SASRC} CFLAGS+= -I${.CURDIR}/../../cddl/boot/zfs CFLAGS+= -I${.CURDIR}/../../crypto/skein From owner-svn-src-stable-11@freebsd.org Sun Feb 11 19:33:25 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D50CF10E0B; Sun, 11 Feb 2018 19:33:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0E2CA86B6C; Sun, 11 Feb 2018 19:33:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09279273F3; Sun, 11 Feb 2018 19:33:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1BJXOdt005375; Sun, 11 Feb 2018 19:33:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1BJXOqY005370; Sun, 11 Feb 2018 19:33:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802111933.w1BJXOqY005370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 11 Feb 2018 19:33:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329130 - in stable/11: . lib share/mk sys/boot sys/boot/libsa X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: . lib share/mk sys/boot sys/boot/libsa X-SVN-Commit-Revision: 329130 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 19:33:25 -0000 Author: kevans Date: Sun Feb 11 19:33:24 2018 New Revision: 329130 URL: https://svnweb.freebsd.org/changeset/base/329130 Log: MFC Loader Fixes 2017q4p2: r324453, r324454 r324453: Create sys/boot/libsa and build libstand.a there r324454: Disconnect libstand from the build. Added: stable/11/sys/boot/libsa/ - copied from r324453, head/sys/boot/libsa/ Modified: stable/11/ObsoleteFiles.inc stable/11/lib/Makefile stable/11/share/mk/bsd.libnames.mk stable/11/sys/boot/Makefile stable/11/sys/boot/Makefile.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/ObsoleteFiles.inc ============================================================================== --- stable/11/ObsoleteFiles.inc Sun Feb 11 19:29:58 2018 (r329129) +++ stable/11/ObsoleteFiles.inc Sun Feb 11 19:33:24 2018 (r329130) @@ -38,6 +38,11 @@ # xargs -n1 | sort | uniq -d; # done +# 20180222: Remove libstand +OLD_FILES+=usr/lib/libstand.a +OLD_FILES+=usr/lib/libstand_p.a +OLD_FILES+=usr/include/stand.h +OLD_FILES+=usr/share/man/man3/libstand.3 # 20180202: Convert geli(8) tests to ATF OLD_FILES+=tests/sys/geom/class/eli/nokey_test.sh OLD_FILES+=tests/sys/geom/class/eli/readonly_test.sh Modified: stable/11/lib/Makefile ============================================================================== --- stable/11/lib/Makefile Sun Feb 11 19:29:58 2018 (r329129) +++ stable/11/lib/Makefile Sun Feb 11 19:33:24 2018 (r329130) @@ -98,7 +98,6 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ ${_libsmdb} \ ${_libsmutil} \ libsqlite3 \ - libstand \ libstdbuf \ libstdthreads \ libsysdecode \ Modified: stable/11/share/mk/bsd.libnames.mk ============================================================================== --- stable/11/share/mk/bsd.libnames.mk Sun Feb 11 19:29:58 2018 (r329129) +++ stable/11/share/mk/bsd.libnames.mk Sun Feb 11 19:33:24 2018 (r329130) @@ -138,7 +138,6 @@ LIBSDP?= ${DESTDIR}${LIBDIR_BASE}/libsdp.a LIBSMB?= ${DESTDIR}${LIBDIR_BASE}/libsmb.a LIBSSL?= ${DESTDIR}${LIBDIR_BASE}/libssl.a LIBSSP_NONSHARED?= ${DESTDIR}${LIBDIR_BASE}/libssp_nonshared.a -LIBSTAND?= ${DESTDIR}${LIBDIR_BASE}/libstand.a LIBSTDCPLUSPLUS?= ${DESTDIR}${LIBDIR_BASE}/libstdc++.a LIBSTDTHREADS?= ${DESTDIR}${LIBDIR_BASE}/libstdthreads.a LIBSYSDECODE?= ${DESTDIR}${LIBDIR_BASE}/libsysdecode.a Modified: stable/11/sys/boot/Makefile ============================================================================== --- stable/11/sys/boot/Makefile Sun Feb 11 19:29:58 2018 (r329129) +++ stable/11/sys/boot/Makefile Sun Feb 11 19:33:24 2018 (r329130) @@ -2,6 +2,7 @@ .include +SUBDIR+= libsa .if ${MK_FORTH} != "no" # Build the add-in FORTH interpreter. SUBDIR+= ficl Modified: stable/11/sys/boot/Makefile.inc ============================================================================== --- stable/11/sys/boot/Makefile.inc Sun Feb 11 19:29:58 2018 (r329129) +++ stable/11/sys/boot/Makefile.inc Sun Feb 11 19:33:24 2018 (r329130) @@ -7,7 +7,7 @@ __BOOT_MAKEFILE_INC__=${MFILE} SASRC=${SRCTOP}/lib/libstand # Normal stand alone library -LIBSA=${OBJTOP}/lib/libstand/libstand.a +LIBSA=${OBJTOP}/sys/boot/libsa/libstand.a # stand alone library compiled for 32-bit version of the processor LIBSA32=${OBJTOP}/sys/boot/libstand32/libstand.a # stand along library compiled for userboot From owner-svn-src-stable-11@freebsd.org Sun Feb 11 19:35:46 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F71FF110B9; Sun, 11 Feb 2018 19:35:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BF95586D45; Sun, 11 Feb 2018 19:35:45 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A06EE273F7; Sun, 11 Feb 2018 19:35:45 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1BJZjqN005535; Sun, 11 Feb 2018 19:35:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1BJZhFZ005510; Sun, 11 Feb 2018 19:35:43 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802111935.w1BJZhFZ005510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 11 Feb 2018 19:35:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329131 - in stable/11/sys/boot: . arm/uboot common efi/fdt efi/libefi efi/loader fdt i386/libfirewire i386/libi386 i386/loader mips/beri/boot2 mips/beri/loader mips/uboot ofw/libofw po... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/sys/boot: . arm/uboot common efi/fdt efi/libefi efi/loader fdt i386/libfirewire i386/libi386 i386/loader mips/beri/boot2 mips/beri/loader mips/uboot ofw/libofw powerpc/kboot powerpc/ofw p... X-SVN-Commit-Revision: 329131 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 19:35:46 -0000 Author: kevans Date: Sun Feb 11 19:35:42 2018 New Revision: 329131 URL: https://svnweb.freebsd.org/changeset/base/329131 Log: MFC Loader Fixes 2017q4p3: r324460,r324471 r324460: Rather than laying whack-a-mole with including the path to stand.h, always include it. r324471: Fix typos: `stand alon{e,g}` should be spelled like `standalone` Modified: stable/11/sys/boot/Makefile.ficl stable/11/sys/boot/Makefile.inc stable/11/sys/boot/arm/uboot/Makefile stable/11/sys/boot/common/Makefile.inc stable/11/sys/boot/efi/fdt/Makefile stable/11/sys/boot/efi/libefi/Makefile stable/11/sys/boot/efi/loader/Makefile stable/11/sys/boot/fdt/Makefile stable/11/sys/boot/i386/libfirewire/Makefile stable/11/sys/boot/i386/libi386/Makefile stable/11/sys/boot/i386/loader/Makefile stable/11/sys/boot/mips/beri/boot2/Makefile stable/11/sys/boot/mips/beri/loader/Makefile stable/11/sys/boot/mips/uboot/Makefile stable/11/sys/boot/ofw/libofw/Makefile stable/11/sys/boot/powerpc/kboot/Makefile stable/11/sys/boot/powerpc/ofw/Makefile stable/11/sys/boot/powerpc/ps3/Makefile stable/11/sys/boot/powerpc/uboot/Makefile stable/11/sys/boot/sparc64/loader/Makefile stable/11/sys/boot/uboot/fdt/Makefile stable/11/sys/boot/uboot/lib/Makefile stable/11/sys/boot/userboot/userboot/Makefile stable/11/sys/boot/zfs/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/Makefile.ficl ============================================================================== --- stable/11/sys/boot/Makefile.ficl Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/Makefile.ficl Sun Feb 11 19:35:42 2018 (r329131) @@ -27,7 +27,7 @@ CFLAGS+= -m32 -mcpu=powerpc -I. .endif CFLAGS+= -I${FICLDIR} -I${FICLDIR}/${FICL_CPUARCH} \ - -I${FICLDIR}/../common -I${SASRC} + -I${FICLDIR}/../common .if ${MACHINE_CPUARCH} == "amd64" && defined(FICL32) .if !exists(machine) Modified: stable/11/sys/boot/Makefile.inc ============================================================================== --- stable/11/sys/boot/Makefile.inc Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/Makefile.inc Sun Feb 11 19:35:42 2018 (r329131) @@ -6,12 +6,14 @@ __BOOT_MAKEFILE_INC__=${MFILE} SASRC=${SRCTOP}/lib/libstand -# Normal stand alone library +# Normal standalone library LIBSA=${OBJTOP}/sys/boot/libsa/libstand.a -# stand alone library compiled for 32-bit version of the processor +# Standalone library compiled for 32-bit version of the processor LIBSA32=${OBJTOP}/sys/boot/libstand32/libstand.a -# stand along library compiled for userboot +# Standalone library compiled for userboot LIBSAU=${OBJTOP}/sys/boot/userboot/libstand/libstand.a + +CFLAGS+=-I${SASRC} SSP_CFLAGS= Modified: stable/11/sys/boot/arm/uboot/Makefile ============================================================================== --- stable/11/sys/boot/arm/uboot/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/arm/uboot/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -112,8 +112,6 @@ LIBUBOOT= ${.OBJDIR}/../../uboot/lib/libuboot.a CFLAGS+= -I${.CURDIR}/../../uboot/lib CFLAGS+= -I${.OBJDIR}/../../uboot/lib -CFLAGS+= -I${SASRC} - CFLAGS+= -fPIC # clang doesn't understand %D as a specifier to printf Modified: stable/11/sys/boot/common/Makefile.inc ============================================================================== --- stable/11/sys/boot/common/Makefile.inc Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/common/Makefile.inc Sun Feb 11 19:35:42 2018 (r329131) @@ -74,7 +74,6 @@ CFLAGS+= -DBOOT_PROMPT_123 .if defined(LOADER_INSTALL_SUPPORT) SRCS+= install.c -CFLAGS+=-I${SASRC} .endif CLEANFILES+= vers.c Modified: stable/11/sys/boot/efi/fdt/Makefile ============================================================================== --- stable/11/sys/boot/efi/fdt/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/efi/fdt/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -17,8 +17,6 @@ CFLAGS+= -mgeneral-regs-only CFLAGS+= -msoft-float .endif -CFLAGS+= -I${SASRC} - # EFI library headers CFLAGS+= -I${.CURDIR}/../include CFLAGS+= -I${.CURDIR}/../include/${MACHINE} Modified: stable/11/sys/boot/efi/libefi/Makefile ============================================================================== --- stable/11/sys/boot/efi/libefi/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/efi/libefi/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -37,7 +37,6 @@ CFLAGS+= -fPIC -mno-red-zone .endif CFLAGS+= -I${.CURDIR}/../include CFLAGS+= -I${.CURDIR}/../include/${MACHINE} -CFLAGS+= -I${SASRC} .if ${MK_ZFS} != "no" CFLAGS+= -I${.CURDIR}/../../zfs CFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs Modified: stable/11/sys/boot/efi/loader/Makefile ============================================================================== --- stable/11/sys/boot/efi/loader/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/efi/loader/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -36,10 +36,6 @@ CWARNFLAGS.zfs.c+= -Wno-array-bounds CWARNFLAGS.zfs.c+= -Wno-missing-prototypes .endif -.if defined(LOADER_NET_SUPPORT) -CFLAGS+= -I${SASRC} -.endif - .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized .endif Modified: stable/11/sys/boot/fdt/Makefile ============================================================================== --- stable/11/sys/boot/fdt/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/fdt/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -12,7 +12,6 @@ SRCS+= fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt # Loader's fdt commands extension sources. SRCS+= fdt_loader_cmd.c -CFLAGS+= -I${SASRC} CFLAGS+= -I${.CURDIR}/../../contrib/libfdt/ -I${.CURDIR}/../common/ CFLAGS+= -ffreestanding Modified: stable/11/sys/boot/i386/libfirewire/Makefile ============================================================================== --- stable/11/sys/boot/i386/libfirewire/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/i386/libfirewire/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -10,7 +10,6 @@ SRCS+= dcons.c fwcrom.c CFLAGS+= -D_BOOT CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I. -CFLAGS+= -I${SASRC} CFLAGS+= -I${.CURDIR}/../btx/lib CFLAGS+= -I${.CURDIR}/../libi386 Modified: stable/11/sys/boot/i386/libi386/Makefile ============================================================================== --- stable/11/sys/boot/i386/libi386/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/i386/libi386/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -59,8 +59,6 @@ CFLAGS+= -I${.CURDIR}/../../ficl -I${.CURDIR}/../../fi -I${.CURDIR}/../btx/lib \ -I${.CURDIR}/../../../contrib/dev/acpica/include \ -I${.CURDIR}/../../.. -I. -# the location of libstand -CFLAGS+= -I${SASRC} # Handle FreeBSD specific %b and %D printf format specifiers CFLAGS+= ${FORMAT_EXTENSIONS} Modified: stable/11/sys/boot/i386/loader/Makefile ============================================================================== --- stable/11/sys/boot/i386/loader/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/i386/loader/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -28,10 +28,6 @@ CFLAGS+= -DLOADER_ZFS_SUPPORT LIBZFSBOOT= ${.OBJDIR}/../../zfs/libzfsboot.a .endif -.if defined(LOADER_NET_SUPPORT) -CFLAGS+= -I${SASRC} -.endif - .if defined(LOADER_TFTP_SUPPORT) CFLAGS+= -DLOADER_TFTP_SUPPORT .endif Modified: stable/11/sys/boot/mips/beri/boot2/Makefile ============================================================================== --- stable/11/sys/boot/mips/beri/boot2/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/mips/beri/boot2/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -57,9 +57,6 @@ CFLAGS= -ffreestanding \ -msoft-float \ -g -# where to get libstand from -CFLAGS+= -I${SASRC} - LDFLAGS= -nostdlib \ -static \ -Wl,-N \ Modified: stable/11/sys/boot/mips/beri/loader/Makefile ============================================================================== --- stable/11/sys/boot/mips/beri/loader/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/mips/beri/loader/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -107,9 +107,6 @@ LDFLAGS= -nostdlib \ -L${.CURDIR} \ -e __start -# where to get libstand from -CFLAGS+= -I${SASRC} - DPADD= ${LIBFICL} ${LIBSA} LDADD= ${LIBFICL} ${LIBSA} Modified: stable/11/sys/boot/mips/uboot/Makefile ============================================================================== --- stable/11/sys/boot/mips/uboot/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/mips/uboot/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -115,9 +115,6 @@ LIBUBOOT= ${.OBJDIR}/../../uboot/lib/libuboot.a CFLAGS+= -I${.CURDIR}/../../uboot/lib CFLAGS+= -I${.OBJDIR}/../../uboot/lib -# where to get libstand from -CFLAGS+= -I${SASRC} - # clang doesn't understand %D as a specifier to printf #NO_WERROR.clang= #NO_WERROR= Modified: stable/11/sys/boot/ofw/libofw/Makefile ============================================================================== --- stable/11/sys/boot/ofw/libofw/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/ofw/libofw/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -9,8 +9,6 @@ SRCS= devicename.c elf_freebsd.c ofw_console.c ofw_cop .PATH: ${.CURDIR}/../../zfs SRCS+= devicename_stubs.c -CFLAGS+= -I${SASRC} - # Pick up the bootstrap header for some interface items CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I. Modified: stable/11/sys/boot/powerpc/kboot/Makefile ============================================================================== --- stable/11/sys/boot/powerpc/kboot/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/powerpc/kboot/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -93,9 +93,6 @@ CFLAGS+= -Wa,-mppc64bridge #.PATH: ${.CURDIR}/../../ofw/common #.include "${.CURDIR}/../../ofw/common/Makefile.inc" -# where to get libstand from -CFLAGS+= -I${SASRC} - DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA32} LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA32} Modified: stable/11/sys/boot/powerpc/ofw/Makefile ============================================================================== --- stable/11/sys/boot/powerpc/ofw/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/powerpc/ofw/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -91,9 +91,6 @@ LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powe LIBOFW= ${.OBJDIR}/../../ofw/libofw/libofw.a CFLAGS+= -I${.CURDIR}/../../ofw/libofw -# where to get libstand from -CFLAGS+= -I${SASRC} - DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA32} LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA32} Modified: stable/11/sys/boot/powerpc/ps3/Makefile ============================================================================== --- stable/11/sys/boot/powerpc/ps3/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/powerpc/ps3/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -90,9 +90,6 @@ LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powe #.PATH: ${.CURDIR}/../../ofw/common #.include "${.CURDIR}/../../ofw/common/Makefile.inc" -# where to get libstand from -CFLAGS+= -I${SASRC} - DPADD= ${LIBFICL} ${LIBOFW} ${LIBSA32} LDADD= ${LIBFICL} ${LIBOFW} ${LIBSA32} Modified: stable/11/sys/boot/powerpc/uboot/Makefile ============================================================================== --- stable/11/sys/boot/powerpc/uboot/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/powerpc/uboot/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -96,9 +96,6 @@ LIBUBOOT= ${.OBJDIR}/../../uboot/lib/libuboot.a CFLAGS+= -I${.CURDIR}/../../uboot/lib CFLAGS+= -I${.OBJDIR}/../../uboot/lib -# where to get libstand from -CFLAGS+= -I${SASRC} - DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA32} LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA32} Modified: stable/11/sys/boot/sparc64/loader/Makefile ============================================================================== --- stable/11/sys/boot/sparc64/loader/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/sparc64/loader/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -79,9 +79,6 @@ LDFLAGS= -static LIBOFW= ${.OBJDIR}/../../ofw/libofw/libofw.a CFLAGS+= -I${.CURDIR}/../../ofw/libofw/ -# where to get libstand from -CFLAGS+= -I${SASRC} - # Need sys/ for crypto/intake.h CFLAGS+= -I${SRCTOP}/sys Modified: stable/11/sys/boot/uboot/fdt/Makefile ============================================================================== --- stable/11/sys/boot/uboot/fdt/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/uboot/fdt/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -12,8 +12,6 @@ SRCS= uboot_fdt.c CFLAGS+= -ffreestanding -msoft-float -CFLAGS+= -I${SASRC} - # U-Boot library headers CFLAGS+= -I${.CURDIR}/../lib Modified: stable/11/sys/boot/uboot/lib/Makefile ============================================================================== --- stable/11/sys/boot/uboot/lib/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/uboot/lib/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -13,8 +13,6 @@ SRCS+= module.c net.c reboot.c time.c CFLAGS+= -ffreestanding -msoft-float -CFLAGS+= -I${SASRC} - .if !defined(LOADER_NO_DISK_SUPPORT) SRCS+= disk.c CFLAGS+= -DLOADER_DISK_SUPPORT Modified: stable/11/sys/boot/userboot/userboot/Makefile ============================================================================== --- stable/11/sys/boot/userboot/userboot/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/userboot/userboot/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -32,7 +32,6 @@ CFLAGS+= -Wall CFLAGS+= -I${.CURDIR}/.. CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I${.CURDIR}/../../.. -CFLAGS+= -I${SASRC} CFLAGS+= -ffreestanding -I. CWARNFLAGS.main.c += -Wno-implicit-function-declaration Modified: stable/11/sys/boot/zfs/Makefile ============================================================================== --- stable/11/sys/boot/zfs/Makefile Sun Feb 11 19:33:24 2018 (r329130) +++ stable/11/sys/boot/zfs/Makefile Sun Feb 11 19:35:42 2018 (r329131) @@ -12,7 +12,6 @@ CFLAGS+= -DSKEIN_LOOP=111 CFLAGS+= -DBOOTPROG=\"zfsloader\" CFLAGS+= -I${.CURDIR}/../common -I${.CURDIR}/../.. -I. -CFLAGS+= -I${SASRC} CFLAGS+= -I${.CURDIR}/../../cddl/boot/zfs CFLAGS+= -I${.CURDIR}/../../crypto/skein From owner-svn-src-stable-11@freebsd.org Sun Feb 11 19:51:30 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C7F0F1247E; Sun, 11 Feb 2018 19:51:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2BCA787A87; Sun, 11 Feb 2018 19:51:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26959276F4; Sun, 11 Feb 2018 19:51:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1BJpU8D014825; Sun, 11 Feb 2018 19:51:30 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1BJpTWb014816; Sun, 11 Feb 2018 19:51:29 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802111951.w1BJpTWb014816@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 11 Feb 2018 19:51:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329132 - in stable/11: lib/libstand sys/boot/libsa sys/boot/libsa/amd64 sys/boot/libsa/i386 sys/boot/libsa/mips sys/boot/libsa/powerpc sys/boot/libsa/sparc64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: lib/libstand sys/boot/libsa sys/boot/libsa/amd64 sys/boot/libsa/i386 sys/boot/libsa/mips sys/boot/libsa/powerpc sys/boot/libsa/sparc64 X-SVN-Commit-Revision: 329132 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 19:51:30 -0000 Author: kevans Date: Sun Feb 11 19:51:29 2018 New Revision: 329132 URL: https://svnweb.freebsd.org/changeset/base/329132 Log: MFC r324551: Move lib/libstand to sys/boot/libsa Added: stable/11/sys/boot/libsa/Makefile.depend - copied unchanged from r329131, stable/11/lib/libstand/Makefile.depend stable/11/sys/boot/libsa/__main.c - copied unchanged from r329131, stable/11/lib/libstand/__main.c stable/11/sys/boot/libsa/amd64/ - copied from r329131, stable/11/lib/libstand/amd64/ stable/11/sys/boot/libsa/arp.c - copied unchanged from r329131, stable/11/lib/libstand/arp.c stable/11/sys/boot/libsa/assert.c - copied unchanged from r329131, stable/11/lib/libstand/assert.c stable/11/sys/boot/libsa/bcd.c - copied unchanged from r329131, stable/11/lib/libstand/bcd.c stable/11/sys/boot/libsa/bootp.c - copied unchanged from r329131, stable/11/lib/libstand/bootp.c stable/11/sys/boot/libsa/bootp.h - copied unchanged from r329131, stable/11/lib/libstand/bootp.h stable/11/sys/boot/libsa/bootparam.c - copied unchanged from r329131, stable/11/lib/libstand/bootparam.c stable/11/sys/boot/libsa/bootparam.h - copied unchanged from r329131, stable/11/lib/libstand/bootparam.h stable/11/sys/boot/libsa/bzipfs.c - copied unchanged from r329131, stable/11/lib/libstand/bzipfs.c stable/11/sys/boot/libsa/cd9660.c - copied unchanged from r329131, stable/11/lib/libstand/cd9660.c stable/11/sys/boot/libsa/close.c - copied unchanged from r329131, stable/11/lib/libstand/close.c stable/11/sys/boot/libsa/closeall.c - copied unchanged from r329131, stable/11/lib/libstand/closeall.c stable/11/sys/boot/libsa/dev.c - copied unchanged from r329131, stable/11/lib/libstand/dev.c stable/11/sys/boot/libsa/dosfs.c - copied unchanged from r329131, stable/11/lib/libstand/dosfs.c stable/11/sys/boot/libsa/dosfs.h - copied unchanged from r329131, stable/11/lib/libstand/dosfs.h stable/11/sys/boot/libsa/environment.c - copied unchanged from r329131, stable/11/lib/libstand/environment.c stable/11/sys/boot/libsa/ether.c - copied unchanged from r329131, stable/11/lib/libstand/ether.c stable/11/sys/boot/libsa/ext2fs.c - copied unchanged from r329131, stable/11/lib/libstand/ext2fs.c stable/11/sys/boot/libsa/fstat.c - copied unchanged from r329131, stable/11/lib/libstand/fstat.c stable/11/sys/boot/libsa/getopt.c - copied unchanged from r329131, stable/11/lib/libstand/getopt.c stable/11/sys/boot/libsa/gets.c - copied unchanged from r329131, stable/11/lib/libstand/gets.c stable/11/sys/boot/libsa/globals.c - copied unchanged from r329131, stable/11/lib/libstand/globals.c stable/11/sys/boot/libsa/gzipfs.c - copied unchanged from r329131, stable/11/lib/libstand/gzipfs.c stable/11/sys/boot/libsa/i386/ - copied from r329131, stable/11/lib/libstand/i386/ stable/11/sys/boot/libsa/in_cksum.c - copied unchanged from r329131, stable/11/lib/libstand/in_cksum.c stable/11/sys/boot/libsa/inet_ntoa.c - copied unchanged from r329131, stable/11/lib/libstand/inet_ntoa.c stable/11/sys/boot/libsa/ioctl.c - copied unchanged from r329131, stable/11/lib/libstand/ioctl.c stable/11/sys/boot/libsa/iodesc.h - copied unchanged from r329131, stable/11/lib/libstand/iodesc.h stable/11/sys/boot/libsa/ip.c - copied unchanged from r329131, stable/11/lib/libstand/ip.c stable/11/sys/boot/libsa/libstand.3 - copied unchanged from r329131, stable/11/lib/libstand/libstand.3 stable/11/sys/boot/libsa/lseek.c - copied unchanged from r329131, stable/11/lib/libstand/lseek.c stable/11/sys/boot/libsa/mips/ - copied from r329131, stable/11/lib/libstand/mips/ stable/11/sys/boot/libsa/nandfs.c - copied unchanged from r329131, stable/11/lib/libstand/nandfs.c stable/11/sys/boot/libsa/net.c - copied unchanged from r329131, stable/11/lib/libstand/net.c stable/11/sys/boot/libsa/net.h - copied unchanged from r329131, stable/11/lib/libstand/net.h stable/11/sys/boot/libsa/netif.c - copied unchanged from r329131, stable/11/lib/libstand/netif.c stable/11/sys/boot/libsa/netif.h - copied unchanged from r329131, stable/11/lib/libstand/netif.h stable/11/sys/boot/libsa/nfs.c - copied unchanged from r329131, stable/11/lib/libstand/nfs.c stable/11/sys/boot/libsa/nfsv2.h - copied unchanged from r329131, stable/11/lib/libstand/nfsv2.h stable/11/sys/boot/libsa/nullfs.c - copied unchanged from r329131, stable/11/lib/libstand/nullfs.c stable/11/sys/boot/libsa/open.c - copied unchanged from r329131, stable/11/lib/libstand/open.c stable/11/sys/boot/libsa/pager.c - copied unchanged from r329131, stable/11/lib/libstand/pager.c stable/11/sys/boot/libsa/pkgfs.c - copied unchanged from r329131, stable/11/lib/libstand/pkgfs.c stable/11/sys/boot/libsa/powerpc/ - copied from r329131, stable/11/lib/libstand/powerpc/ stable/11/sys/boot/libsa/printf.c - copied unchanged from r329131, stable/11/lib/libstand/printf.c stable/11/sys/boot/libsa/qdivrem.c - copied unchanged from r329131, stable/11/lib/libstand/qdivrem.c stable/11/sys/boot/libsa/quad.h - copied unchanged from r329131, stable/11/lib/libstand/quad.h stable/11/sys/boot/libsa/random.c - copied unchanged from r329131, stable/11/lib/libstand/random.c stable/11/sys/boot/libsa/rarp.c - copied unchanged from r329131, stable/11/lib/libstand/rarp.c stable/11/sys/boot/libsa/read.c - copied unchanged from r329131, stable/11/lib/libstand/read.c stable/11/sys/boot/libsa/readdir.c - copied unchanged from r329131, stable/11/lib/libstand/readdir.c stable/11/sys/boot/libsa/rpc.c - copied unchanged from r329131, stable/11/lib/libstand/rpc.c stable/11/sys/boot/libsa/rpc.h - copied unchanged from r329131, stable/11/lib/libstand/rpc.h stable/11/sys/boot/libsa/rpcv2.h - copied unchanged from r329131, stable/11/lib/libstand/rpcv2.h stable/11/sys/boot/libsa/saioctl.h - copied unchanged from r329131, stable/11/lib/libstand/saioctl.h stable/11/sys/boot/libsa/sbrk.c - copied unchanged from r329131, stable/11/lib/libstand/sbrk.c stable/11/sys/boot/libsa/sparc64/ - copied from r329131, stable/11/lib/libstand/sparc64/ stable/11/sys/boot/libsa/splitfs.c - copied unchanged from r329131, stable/11/lib/libstand/splitfs.c stable/11/sys/boot/libsa/stand.h - copied unchanged from r329131, stable/11/lib/libstand/stand.h stable/11/sys/boot/libsa/stat.c - copied unchanged from r329131, stable/11/lib/libstand/stat.c stable/11/sys/boot/libsa/strcasecmp.c - copied unchanged from r329131, stable/11/lib/libstand/strcasecmp.c stable/11/sys/boot/libsa/strdup.c - copied unchanged from r329131, stable/11/lib/libstand/strdup.c stable/11/sys/boot/libsa/strerror.c - copied unchanged from r329131, stable/11/lib/libstand/strerror.c stable/11/sys/boot/libsa/strtol.c - copied unchanged from r329131, stable/11/lib/libstand/strtol.c stable/11/sys/boot/libsa/strtoul.c - copied unchanged from r329131, stable/11/lib/libstand/strtoul.c stable/11/sys/boot/libsa/tftp.c - copied unchanged from r329131, stable/11/lib/libstand/tftp.c stable/11/sys/boot/libsa/tftp.h - copied unchanged from r329131, stable/11/lib/libstand/tftp.h stable/11/sys/boot/libsa/twiddle.c - copied unchanged from r329131, stable/11/lib/libstand/twiddle.c stable/11/sys/boot/libsa/udp.c - copied unchanged from r329131, stable/11/lib/libstand/udp.c stable/11/sys/boot/libsa/ufs.c - copied unchanged from r329131, stable/11/lib/libstand/ufs.c stable/11/sys/boot/libsa/uuid_from_string.c - copied unchanged from r329131, stable/11/lib/libstand/uuid_from_string.c stable/11/sys/boot/libsa/uuid_to_string.c - copied unchanged from r329131, stable/11/lib/libstand/uuid_to_string.c stable/11/sys/boot/libsa/write.c - copied unchanged from r329131, stable/11/lib/libstand/write.c stable/11/sys/boot/libsa/zalloc.c - copied unchanged from r329131, stable/11/lib/libstand/zalloc.c stable/11/sys/boot/libsa/zalloc_defs.h - copied unchanged from r329131, stable/11/lib/libstand/zalloc_defs.h stable/11/sys/boot/libsa/zalloc_malloc.c - copied unchanged from r329131, stable/11/lib/libstand/zalloc_malloc.c stable/11/sys/boot/libsa/zalloc_mem.h - copied unchanged from r329131, stable/11/lib/libstand/zalloc_mem.h stable/11/sys/boot/libsa/zalloc_protos.h - copied unchanged from r329131, stable/11/lib/libstand/zalloc_protos.h Deleted: stable/11/lib/libstand/ Modified: stable/11/sys/boot/libsa/Makefile Modified: stable/11/sys/boot/libsa/Makefile ============================================================================== --- stable/11/sys/boot/libsa/Makefile Sun Feb 11 19:35:42 2018 (r329131) +++ stable/11/sys/boot/libsa/Makefile Sun Feb 11 19:51:29 2018 (r329132) @@ -1,14 +1,163 @@ # $FreeBSD$ +# Originally from $NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $ +# +# Notes: +# - We don't use the libc strerror/sys_errlist because the string table is +# quite large. +# +PACKAGE=lib${LIB} +MK_PROFILE= no +MK_SSP= no + .include -.include "../Makefile.inc" +LIBSTAND_SRC?= ${.CURDIR} +LIBSTAND_CPUARCH?=${MACHINE_CPUARCH} +LIBC_SRC= ${LIBSTAND_SRC}/../libc -LIBSTAND_SRC= ${SASRC} -LIBC_SRC= ${SRCTOP}/lib/libc -INTERNALLIB= -INCS= -MAN= -.PATH: ${SASRC} +LIB= stand +NO_PIC= +INCS?= stand.h +MAN?= libstand.3 -.include "${SASRC}/Makefile" +WARNS?= 0 + +CFLAGS+= -I${LIBSTAND_SRC} + +# standalone components and stuff we have modified locally +SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c environment.c getopt.c gets.c \ + globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \ + sbrk.c twiddle.c zalloc.c zalloc_malloc.c + +# private (pruned) versions of libc string functions +SRCS+= strcasecmp.c + +.PATH: ${LIBC_SRC}/net + +SRCS+= ntoh.c + +# string functions from libc +.PATH: ${LIBC_SRC}/string +SRCS+= bcmp.c bcopy.c bzero.c ffs.c fls.c \ + memccpy.c memchr.c memcmp.c memcpy.c memmove.c memset.c \ + qdivrem.c strcat.c strchr.c strcmp.c strcpy.c stpcpy.c stpncpy.c \ + strcspn.c strlcat.c strlcpy.c strlen.c strncat.c strncmp.c strncpy.c \ + strnlen.c strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c +.if ${MACHINE_CPUARCH} == "arm" +.PATH: ${LIBC_SRC}/arm/gen + +# Do not generate movt/movw, because the relocation fixup for them does not +# translate to the -Bsymbolic -pie format required by self_reloc() in loader(8). +# Also, the fpu is not available in a standalone environment. +.if ${COMPILER_VERSION} < 30800 +CFLAGS.clang+= -mllvm -arm-use-movt=0 +.else +CFLAGS.clang+= -mno-movt +.endif +CFLAGS.clang+= -mfpu=none + +# Compiler support functions +.PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/ +# __clzsi2 and ctzsi2 for various builtin functions +SRCS+= clzsi2.c ctzsi2.c +# Divide and modulus functions called by the compiler +SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c +SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c + +.PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/arm/ +SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S +SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S +.endif + +.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv" +.PATH: ${LIBC_SRC}/${MACHINE_CPUARCH}/gen +.endif + +.if ${MACHINE_CPUARCH} == "powerpc" +.PATH: ${LIBC_SRC}/quad +SRCS+= ashldi3.c ashrdi3.c +SRCS+= syncicache.c +.endif + +# uuid functions from libc +.PATH: ${LIBC_SRC}/uuid +SRCS+= uuid_create_nil.c uuid_equal.c uuid_from_string.c uuid_is_nil.c uuid_to_string.c + +# _setjmp/_longjmp +.PATH: ${LIBSTAND_SRC}/${LIBSTAND_CPUARCH} +SRCS+= _setjmp.S + +# decompression functionality from libbz2 +# NOTE: to actually test this functionality after libbz2 upgrade compile +# loader(8) with LOADER_BZIP2_SUPPORT defined +.PATH: ${LIBSTAND_SRC}/../../contrib/bzip2 +CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS +SRCS+= libstand_bzlib_private.h + +.for file in bzlib.c crctable.c decompress.c huffman.c randtable.c +SRCS+= _${file} +CLEANFILES+= _${file} + +_${file}: ${file} + sed "s|bzlib_private\.h|libstand_bzlib_private.h|" \ + ${.ALLSRC} > ${.TARGET} +.endfor + +CLEANFILES+= libstand_bzlib_private.h +libstand_bzlib_private.h: bzlib_private.h + sed -e 's||"stand.h"|' \ + ${.ALLSRC} > ${.TARGET} + +# decompression functionality from zlib +.PATH: ${LIBSTAND_SRC}/../../contrib/zlib +CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../../contrib/zlib +SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h + +.for file in infback.c inffast.c inflate.c inftrees.c zutil.c +SRCS+= _${file} +CLEANFILES+= _${file} + +_${file}: ${file} + sed -e "s|zutil\.h|libstand_zutil.h|" \ + -e "s|gzguts\.h|libstand_gzguts.h|" \ + ${.ALLSRC} > ${.TARGET} +.endfor + +# depend on stand.h being able to be included multiple times +.for file in zutil.h gzguts.h +CLEANFILES+= libstand_${file} +libstand_${file}: ${file} + sed -e 's||"stand.h"|' \ + -e 's||"stand.h"|' \ + -e 's||"stand.h"|' \ + -e 's||"stand.h"|' \ + -e 's||"stand.h"|' \ + ${.ALLSRC} > ${.TARGET} +.endfor + +# io routines +SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \ + fstat.c close.c lseek.c open.c read.c write.c readdir.c + +# network routines +SRCS+= arp.c ether.c ip.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c + +# network info services: +SRCS+= bootp.c rarp.c bootparam.c + +# boot filesystems +SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c +SRCS+= dosfs.c ext2fs.c +SRCS+= splitfs.c +SRCS+= pkgfs.c +.if ${MK_NAND} != "no" +SRCS+= nandfs.c +.endif + +# explicit_bzero +.PATH: ${SRCTOP}/sys/libkern +SRCS+= explicit_bzero.c + +.include +.include Copied: stable/11/sys/boot/libsa/Makefile.depend (from r329131, stable/11/lib/libstand/Makefile.depend) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/boot/libsa/Makefile.depend Sun Feb 11 19:51:29 2018 (r329132, copy of r329131, stable/11/lib/libstand/Makefile.depend) @@ -0,0 +1,15 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + include \ + include/arpa \ + include/xlocale \ + lib/libbz2 \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Copied: stable/11/sys/boot/libsa/__main.c (from r329131, stable/11/lib/libstand/__main.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/boot/libsa/__main.c Sun Feb 11 19:51:29 2018 (r329132, copy of r329131, stable/11/lib/libstand/__main.c) @@ -0,0 +1,43 @@ +/* $NetBSD: __main.c,v 1.4 1996/03/14 18:52:03 christos Exp $ */ + +/* + * Copyright (c) 1993 Christopher G. Demetriou + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christopher G. Demetriou. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +void __main(void); + +void +__main(void) +{ +} Copied: stable/11/sys/boot/libsa/arp.c (from r329131, stable/11/lib/libstand/arp.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/boot/libsa/arp.c Sun Feb 11 19:51:29 2018 (r329132, copy of r329131, stable/11/lib/libstand/arp.c) @@ -0,0 +1,305 @@ +/* $NetBSD: arp.c,v 1.18 1997/07/07 15:52:49 drochner Exp $ */ + +/* + * Copyright (c) 1992 Regents of the University of California. + * All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#) Header: arp.c,v 1.5 93/07/15 05:52:26 leres Exp (LBL) + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include + +#include + +#include "stand.h" +#include "net.h" + +/* Cache stuff */ +#define ARP_NUM 8 /* need at most 3 arp entries */ + +struct arp_list { + struct in_addr addr; + u_char ea[6]; +} arp_list[ARP_NUM] = { + /* XXX - net order `INADDR_BROADCAST' must be a constant */ + { {0xffffffff}, BA } +}; +int arp_num = 1; + +/* Local forwards */ +static ssize_t arpsend(struct iodesc *, void *, size_t); +static ssize_t arprecv(struct iodesc *, void **, void **, time_t); + +/* Broadcast an ARP packet, asking who has addr on interface d */ +u_char * +arpwhohas(struct iodesc *d, struct in_addr addr) +{ + int i; + struct ether_arp *ah; + struct arp_list *al; + void *pkt; + struct { + struct ether_header eh; + struct { + struct ether_arp arp; + u_char pad[18]; /* 60 - sizeof(...) */ + } data; + } wbuf; + + /* Try for cached answer first */ + for (i = 0, al = arp_list; i < arp_num; ++i, ++al) + if (addr.s_addr == al->addr.s_addr) + return (al->ea); + + /* Don't overflow cache */ + if (arp_num > ARP_NUM - 1) { + arp_num = 1; /* recycle */ + printf("arpwhohas: overflowed arp_list!\n"); + } + +#ifdef ARP_DEBUG + if (debug) + printf("arpwhohas: send request for %s\n", inet_ntoa(addr)); +#endif + + bzero((char*)&wbuf.data, sizeof(wbuf.data)); + ah = &wbuf.data.arp; + ah->arp_hrd = htons(ARPHRD_ETHER); + ah->arp_pro = htons(ETHERTYPE_IP); + ah->arp_hln = sizeof(ah->arp_sha); /* hardware address length */ + ah->arp_pln = sizeof(ah->arp_spa); /* protocol address length */ + ah->arp_op = htons(ARPOP_REQUEST); + MACPY(d->myea, ah->arp_sha); + bcopy(&d->myip, ah->arp_spa, sizeof(ah->arp_spa)); + /* Leave zeros in arp_tha */ + bcopy(&addr, ah->arp_tpa, sizeof(ah->arp_tpa)); + + /* Store ip address in cache (incomplete entry). */ + al->addr = addr; + + pkt = NULL; + ah = NULL; + i = sendrecv(d, + arpsend, &wbuf.data, sizeof(wbuf.data), + arprecv, &pkt, (void **)&ah); + if (i == -1) { + panic("arp: no response for %s\n", + inet_ntoa(addr)); + } + + /* Store ethernet address in cache */ +#ifdef ARP_DEBUG + if (debug) { + struct ether_header *eh; + + eh = (struct ether_header *)((uintptr_t)pkt + ETHER_ALIGN); + printf("arp: response from %s\n", + ether_sprintf(eh->ether_shost)); + printf("arp: cacheing %s --> %s\n", + inet_ntoa(addr), ether_sprintf(ah->arp_sha)); + } +#endif + MACPY(ah->arp_sha, al->ea); + ++arp_num; + + free(pkt); + return (al->ea); +} + +static ssize_t +arpsend(struct iodesc *d, void *pkt, size_t len) +{ + +#ifdef ARP_DEBUG + if (debug) + printf("arpsend: called\n"); +#endif + + return (sendether(d, pkt, len, bcea, ETHERTYPE_ARP)); +} + +/* + * Returns 0 if this is the packet we're waiting for + * else -1 (and errno == 0) + */ +static ssize_t +arprecv(struct iodesc *d, void **pkt, void **payload, time_t tleft) +{ + ssize_t n; + struct ether_arp *ah; + u_int16_t etype; /* host order */ + void *ptr; + +#ifdef ARP_DEBUG + if (debug) + printf("arprecv: "); +#endif + + ptr = NULL; + n = readether(d, &ptr, (void **)&ah, tleft, &etype); + errno = 0; /* XXX */ + if (n == -1 || n < sizeof(struct ether_arp)) { +#ifdef ARP_DEBUG + if (debug) + printf("bad len=%d\n", n); +#endif + free(ptr); + return (-1); + } + + if (etype != ETHERTYPE_ARP) { +#ifdef ARP_DEBUG + if (debug) + printf("not arp type=%d\n", etype); +#endif + free(ptr); + return (-1); + } + + /* Ethernet address now checked in readether() */ + if (ah->arp_hrd != htons(ARPHRD_ETHER) || + ah->arp_pro != htons(ETHERTYPE_IP) || + ah->arp_hln != sizeof(ah->arp_sha) || + ah->arp_pln != sizeof(ah->arp_spa) ) + { +#ifdef ARP_DEBUG + if (debug) + printf("bad hrd/pro/hln/pln\n"); +#endif + free(ptr); + return (-1); + } + + if (ah->arp_op == htons(ARPOP_REQUEST)) { +#ifdef ARP_DEBUG + if (debug) + printf("is request\n"); +#endif + arp_reply(d, ah); + free(ptr); + return (-1); + } + + if (ah->arp_op != htons(ARPOP_REPLY)) { +#ifdef ARP_DEBUG + if (debug) + printf("not ARP reply\n"); +#endif + free(ptr); + return (-1); + } + + /* Is the reply from the source we want? */ + if (bcmp(&arp_list[arp_num].addr, + ah->arp_spa, sizeof(ah->arp_spa))) + { +#ifdef ARP_DEBUG + if (debug) + printf("unwanted address\n"); +#endif + free(ptr); + return (-1); + } + /* We don't care who the reply was sent to. */ + + /* We have our answer. */ +#ifdef ARP_DEBUG + if (debug) + printf("got it\n"); +#endif + *pkt = ptr; + *payload = ah; + return (n); +} + +/* + * Convert an ARP request into a reply and send it. + * Notes: Re-uses buffer. Pad to length = 46. + */ +void +arp_reply(struct iodesc *d, void *pkt) +{ + struct ether_arp *arp = pkt; + + if (arp->arp_hrd != htons(ARPHRD_ETHER) || + arp->arp_pro != htons(ETHERTYPE_IP) || + arp->arp_hln != sizeof(arp->arp_sha) || + arp->arp_pln != sizeof(arp->arp_spa) ) + { +#ifdef ARP_DEBUG + if (debug) + printf("arp_reply: bad hrd/pro/hln/pln\n"); +#endif + return; + } + + if (arp->arp_op != htons(ARPOP_REQUEST)) { +#ifdef ARP_DEBUG + if (debug) + printf("arp_reply: not request!\n"); +#endif + return; + } + + /* If we are not the target, ignore the request. */ + if (bcmp(arp->arp_tpa, &d->myip, sizeof(arp->arp_tpa))) + return; + +#ifdef ARP_DEBUG + if (debug) { + printf("arp_reply: to %s\n", ether_sprintf(arp->arp_sha)); + } +#endif + + arp->arp_op = htons(ARPOP_REPLY); + /* source becomes target */ + bcopy(arp->arp_sha, arp->arp_tha, sizeof(arp->arp_tha)); + bcopy(arp->arp_spa, arp->arp_tpa, sizeof(arp->arp_tpa)); + /* here becomes source */ + bcopy(d->myea, arp->arp_sha, sizeof(arp->arp_sha)); + bcopy(&d->myip, arp->arp_spa, sizeof(arp->arp_spa)); + + /* + * No need to get fancy here. If the send fails, the + * requestor will just ask again. + */ + (void) sendether(d, pkt, sizeof(*arp) + 18, + arp->arp_tha, ETHERTYPE_ARP); +} Copied: stable/11/sys/boot/libsa/assert.c (from r329131, stable/11/lib/libstand/assert.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/boot/libsa/assert.c Sun Feb 11 19:51:29 2018 (r329132, copy of r329131, stable/11/lib/libstand/assert.c) @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 1998 Michael Smith. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include "stand.h" + +void +__assert(const char *func, const char *file, int line, const char *expression) +{ + if (func == NULL) + panic("Assertion failed: (%s), file %s, line %d.\n", + expression, file, line); + else + panic( + "Assertion failed: (%s), function %s, file %s, line %d.\n", + expression, func, file, line); +} Copied: stable/11/sys/boot/libsa/bcd.c (from r329131, stable/11/lib/libstand/bcd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/boot/libsa/bcd.c Sun Feb 11 19:51:29 2018 (r329132, copy of r329131, stable/11/lib/libstand/bcd.c) @@ -0,0 +1,38 @@ +/* + * Some data-tables that are often used. + * Cannot be copyrighted. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +u_char const bcd2bin_data[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, 0, 0, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 0, 0, 0, 0, 0, 0, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 0, 0, 0, 0, 0, 0, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 0, 0, 0, 0, 0, 0, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, 0, 0, 0, 0, 0, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 0, 0, 0, 0, 0, 0, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 0, 0, 0, 0, 0, 0, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 +}; + +u_char const bin2bcd_data[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99 +}; + +/* This is actually used with radix [2..36] */ +char const hex2ascii_data[] = "0123456789abcdefghijklmnopqrstuvwxyz"; Copied: stable/11/sys/boot/libsa/bootp.c (from r329131, stable/11/lib/libstand/bootp.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/boot/libsa/bootp.c Sun Feb 11 19:51:29 2018 (r329132, copy of r329131, stable/11/lib/libstand/bootp.c) @@ -0,0 +1,791 @@ +/* $NetBSD: bootp.c,v 1.14 1998/02/16 11:10:54 drochner Exp $ */ + +/* + * Copyright (c) 1992 Regents of the University of California. + * All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#) Header: bootp.c,v 1.4 93/09/11 03:13:51 leres Exp (LBL) + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include + +#define BOOTP_DEBUGxx +#define SUPPORT_DHCP + +#define DHCP_ENV_NOVENDOR 1 /* do not parse vendor options */ +#define DHCP_ENV_PXE 10 /* assume pxe vendor options */ +#define DHCP_ENV_FREEBSD 11 /* assume freebsd vendor options */ +/* set DHCP_ENV to one of the values above to export dhcp options to kenv */ +#define DHCP_ENV DHCP_ENV_NO_VENDOR + +#include "stand.h" +#include "net.h" +#include "netif.h" +#include "bootp.h" + + +struct in_addr servip; + +static time_t bot; + +static char vm_rfc1048[4] = VM_RFC1048; +#ifdef BOOTP_VEND_CMU +static char vm_cmu[4] = VM_CMU; +#endif + +/* Local forwards */ +static ssize_t bootpsend(struct iodesc *, void *, size_t); +static ssize_t bootprecv(struct iodesc *, void **, void **, time_t); +static int vend_rfc1048(u_char *, u_int); +#ifdef BOOTP_VEND_CMU +static void vend_cmu(u_char *); +#endif + +#ifdef DHCP_ENV /* export the dhcp response to kenv */ +struct dhcp_opt; +static void setenv_(u_char *cp, u_char *ep, struct dhcp_opt *opts); +#else +#define setenv_(a, b, c) +#endif + +#ifdef SUPPORT_DHCP +static char expected_dhcpmsgtype = -1, dhcp_ok; +struct in_addr dhcp_serverip; +#endif +struct bootp *bootp_response; +size_t bootp_response_size; + +static void +bootp_fill_request(unsigned char *bp_vend) +{ + /* + * We are booting from PXE, we want to send the string + * 'PXEClient' to the DHCP server so you have the option of + * only responding to PXE aware dhcp requests. + */ + bp_vend[0] = TAG_CLASSID; + bp_vend[1] = 9; + bcopy("PXEClient", &bp_vend[2], 9); + bp_vend[11] = TAG_USER_CLASS; + /* len of each user class + number of user class */ + bp_vend[12] = 8; + /* len of the first user class */ + bp_vend[13] = 7; + bcopy("FreeBSD", &bp_vend[14], 7); + bp_vend[21] = TAG_PARAM_REQ; + bp_vend[22] = 7; + bp_vend[23] = TAG_ROOTPATH; + bp_vend[24] = TAG_HOSTNAME; + bp_vend[25] = TAG_SWAPSERVER; + bp_vend[26] = TAG_GATEWAY; + bp_vend[27] = TAG_SUBNET_MASK; + bp_vend[28] = TAG_INTF_MTU; + bp_vend[29] = TAG_SERVERID; + bp_vend[30] = TAG_END; +} + +/* Fetch required bootp infomation */ +void +bootp(int sock) +{ + void *pkt; + struct iodesc *d; + struct bootp *bp; + struct { + u_char header[HEADER_SIZE]; + struct bootp wbootp; + } wbuf; + struct bootp *rbootp; + +#ifdef BOOTP_DEBUG + if (debug) + printf("bootp: socket=%d\n", sock); +#endif + if (!bot) + bot = getsecs(); + + if (!(d = socktodesc(sock))) { + printf("bootp: bad socket. %d\n", sock); + return; + } +#ifdef BOOTP_DEBUG + if (debug) + printf("bootp: d=%lx\n", (long)d); +#endif + + bp = &wbuf.wbootp; + bzero(bp, sizeof(*bp)); + + bp->bp_op = BOOTREQUEST; + bp->bp_htype = 1; /* 10Mb Ethernet (48 bits) */ + bp->bp_hlen = 6; + bp->bp_xid = htonl(d->xid); + MACPY(d->myea, bp->bp_chaddr); + strncpy(bp->bp_file, bootfile, sizeof(bp->bp_file)); + bcopy(vm_rfc1048, bp->bp_vend, sizeof(vm_rfc1048)); +#ifdef SUPPORT_DHCP + bp->bp_vend[4] = TAG_DHCP_MSGTYPE; + bp->bp_vend[5] = 1; + bp->bp_vend[6] = DHCPDISCOVER; + bootp_fill_request(&bp->bp_vend[7]); + +#else + bp->bp_vend[4] = TAG_END; +#endif + + d->myip.s_addr = INADDR_ANY; + d->myport = htons(IPPORT_BOOTPC); + d->destip.s_addr = INADDR_BROADCAST; + d->destport = htons(IPPORT_BOOTPS); + +#ifdef SUPPORT_DHCP + expected_dhcpmsgtype = DHCPOFFER; + dhcp_ok = 0; +#endif + + if(sendrecv(d, + bootpsend, bp, sizeof(*bp), + bootprecv, &pkt, (void **)&rbootp) == -1) { + printf("bootp: no reply\n"); + return; + } + +#ifdef SUPPORT_DHCP + if(dhcp_ok) { + u_int32_t leasetime; + bp->bp_vend[6] = DHCPREQUEST; + bp->bp_vend[7] = TAG_REQ_ADDR; + bp->bp_vend[8] = 4; + bcopy(&rbootp->bp_yiaddr, &bp->bp_vend[9], 4); + bp->bp_vend[13] = TAG_SERVERID; + bp->bp_vend[14] = 4; + bcopy(&dhcp_serverip.s_addr, &bp->bp_vend[15], 4); + bp->bp_vend[19] = TAG_LEASETIME; + bp->bp_vend[20] = 4; + leasetime = htonl(300); + bcopy(&leasetime, &bp->bp_vend[21], 4); + bootp_fill_request(&bp->bp_vend[25]); + + expected_dhcpmsgtype = DHCPACK; + + free(pkt); + if(sendrecv(d, + bootpsend, bp, sizeof(*bp), + bootprecv, &pkt, (void **)&rbootp) == -1) { + printf("DHCPREQUEST failed\n"); + return; + } + } +#endif + + myip = d->myip = rbootp->bp_yiaddr; + servip = rbootp->bp_siaddr; + if (rootip.s_addr == INADDR_ANY) + rootip = servip; + bcopy(rbootp->bp_file, bootfile, sizeof(bootfile)); + bootfile[sizeof(bootfile) - 1] = '\0'; + + if (!netmask) { + if (IN_CLASSA(ntohl(myip.s_addr))) + netmask = htonl(IN_CLASSA_NET); + else if (IN_CLASSB(ntohl(myip.s_addr))) + netmask = htonl(IN_CLASSB_NET); + else + netmask = htonl(IN_CLASSC_NET); +#ifdef BOOTP_DEBUG + if (debug) + printf("'native netmask' is %s\n", intoa(netmask)); +#endif + } + +#ifdef BOOTP_DEBUG + if (debug) + printf("mask: %s\n", intoa(netmask)); +#endif + + /* We need a gateway if root is on a different net */ + if (!SAMENET(myip, rootip, netmask)) { +#ifdef BOOTP_DEBUG + if (debug) + printf("need gateway for root ip\n"); +#endif + } + + /* Toss gateway if on a different net */ + if (!SAMENET(myip, gateip, netmask)) { +#ifdef BOOTP_DEBUG + if (debug) + printf("gateway ip (%s) bad\n", inet_ntoa(gateip)); +#endif + gateip.s_addr = 0; + } + + /* Bump xid so next request will be unique. */ + ++d->xid; + free(pkt); +} + +/* Transmit a bootp request */ +static ssize_t +bootpsend(struct iodesc *d, void *pkt, size_t len) +{ + struct bootp *bp; + +#ifdef BOOTP_DEBUG + if (debug) + printf("bootpsend: d=%lx called.\n", (long)d); +#endif + + bp = pkt; + bp->bp_secs = htons((u_short)(getsecs() - bot)); + +#ifdef BOOTP_DEBUG + if (debug) + printf("bootpsend: calling sendudp\n"); +#endif + + return (sendudp(d, pkt, len)); +} + +static ssize_t +bootprecv(struct iodesc *d, void **pkt, void **payload, time_t tleft) +{ + ssize_t n; + struct bootp *bp; + void *ptr; + +#ifdef BOOTP_DEBUG + if (debug) + printf("bootp_recvoffer: called\n"); +#endif + + ptr = NULL; + n = readudp(d, &ptr, (void **)&bp, tleft); + if (n == -1 || n < sizeof(struct bootp) - BOOTP_VENDSIZE) + goto bad; + +#ifdef BOOTP_DEBUG + if (debug) + printf("bootprecv: checked. bp = %p, n = %zd\n", bp, n); +#endif + if (bp->bp_xid != htonl(d->xid)) { +#ifdef BOOTP_DEBUG + if (debug) { + printf("bootprecv: expected xid 0x%lx, got 0x%x\n", + d->xid, ntohl(bp->bp_xid)); + } +#endif + goto bad; + } + +#ifdef BOOTP_DEBUG + if (debug) + printf("bootprecv: got one!\n"); +#endif + + /* Suck out vendor info */ + if (bcmp(vm_rfc1048, bp->bp_vend, sizeof(vm_rfc1048)) == 0) { + int vsize = n - offsetof(struct bootp, bp_vend); + if (vend_rfc1048(bp->bp_vend, vsize) != 0) + goto bad; + + /* Save copy of bootp reply or DHCP ACK message */ + if (bp->bp_op == BOOTREPLY && + ((dhcp_ok == 1 && expected_dhcpmsgtype == DHCPACK) || + dhcp_ok == 0)) { + free(bootp_response); + bootp_response = malloc(n); + if (bootp_response != NULL) { + bootp_response_size = n; + bcopy(bp, bootp_response, bootp_response_size); + } + } + } +#ifdef BOOTP_VEND_CMU + else if (bcmp(vm_cmu, bp->bp_vend, sizeof(vm_cmu)) == 0) + vend_cmu(bp->bp_vend); +#endif + else + printf("bootprecv: unknown vendor 0x%lx\n", (long)bp->bp_vend); + + *pkt = ptr; + *payload = bp; + return (n); +bad: + free(ptr); + errno = 0; + return (-1); +} + +int +dhcp_try_rfc1048(u_char *cp, u_int len) +{ + + expected_dhcpmsgtype = DHCPACK; + if (bcmp(vm_rfc1048, cp, sizeof(vm_rfc1048)) == 0) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Sun Feb 11 20:00:28 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A844DF12FD5; Sun, 11 Feb 2018 20:00:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5946B68100; Sun, 11 Feb 2018 20:00:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53BB92774B; Sun, 11 Feb 2018 20:00:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1BK0SoF016447; Sun, 11 Feb 2018 20:00:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1BK0QDc016430; Sun, 11 Feb 2018 20:00:26 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802112000.w1BK0QDc016430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 11 Feb 2018 20:00:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329134 - in stable/11/sys/boot: . common efi/boot1 i386/gptboot i386/gptzfsboot i386/zfsboot libsa libsa32 libstand32 powerpc/boot1.chrp sparc64/boot1 uboot/lib userboot userboot/libst... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/sys/boot: . common efi/boot1 i386/gptboot i386/gptzfsboot i386/zfsboot libsa libsa32 libstand32 powerpc/boot1.chrp sparc64/boot1 uboot/lib userboot userboot/libstand userboot/userboot X-SVN-Commit-Revision: 329134 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 20:00:29 -0000 Author: kevans Date: Sun Feb 11 20:00:26 2018 New Revision: 329134 URL: https://svnweb.freebsd.org/changeset/base/329134 Log: MFC Loader Fixes 2017q4p4: r324552,r324553,r324554,r324555,r324556 r324552: Kill the userboot copy of libstand. r324553: Rename libstand.a to libsa.a and libstand32.a to libsa32.a r324554: Move crc32.c, util.c and gpt.c over to libsa. r324555: Honor CFLAGS modifications in Makefile.inc by using += here. r324556: Move ufsread.c Added: stable/11/sys/boot/libsa/crc32.c - copied unchanged from r324554, head/sys/boot/libsa/crc32.c stable/11/sys/boot/libsa/crc32.h - copied unchanged from r324554, head/sys/boot/libsa/crc32.h stable/11/sys/boot/libsa/gpt.c - copied unchanged from r324554, head/sys/boot/libsa/gpt.c stable/11/sys/boot/libsa/gpt.h - copied unchanged from r324554, head/sys/boot/libsa/gpt.h stable/11/sys/boot/libsa/ufsread.c - copied unchanged from r329133, stable/11/sys/boot/common/ufsread.c stable/11/sys/boot/libsa/util.c - copied unchanged from r324554, head/sys/boot/libsa/util.c stable/11/sys/boot/libsa/util.h - copied unchanged from r324554, head/sys/boot/libsa/util.h stable/11/sys/boot/libsa32/ - copied from r324553, head/sys/boot/libsa32/ Deleted: stable/11/sys/boot/common/crc32.c stable/11/sys/boot/common/crc32.h stable/11/sys/boot/common/gpt.c stable/11/sys/boot/common/gpt.h stable/11/sys/boot/common/ufsread.c stable/11/sys/boot/common/util.c stable/11/sys/boot/common/util.h stable/11/sys/boot/libstand32/ stable/11/sys/boot/userboot/libstand/Makefile stable/11/sys/boot/userboot/libstand/Makefile.depend Modified: stable/11/sys/boot/Makefile.amd64 stable/11/sys/boot/Makefile.i386 stable/11/sys/boot/Makefile.inc stable/11/sys/boot/Makefile.powerpc stable/11/sys/boot/common/Makefile.inc stable/11/sys/boot/efi/boot1/Makefile stable/11/sys/boot/i386/gptboot/Makefile stable/11/sys/boot/i386/gptzfsboot/Makefile stable/11/sys/boot/i386/zfsboot/Makefile stable/11/sys/boot/libsa/Makefile stable/11/sys/boot/powerpc/boot1.chrp/Makefile stable/11/sys/boot/sparc64/boot1/Makefile stable/11/sys/boot/uboot/lib/Makefile stable/11/sys/boot/userboot/Makefile stable/11/sys/boot/userboot/userboot/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/Makefile.amd64 ============================================================================== --- stable/11/sys/boot/Makefile.amd64 Sun Feb 11 19:54:21 2018 (r329133) +++ stable/11/sys/boot/Makefile.amd64 Sun Feb 11 20:00:26 2018 (r329134) @@ -1,7 +1,7 @@ # $FreeBSD$ SUBDIR+= efi -SUBDIR+= libstand32 +SUBDIR+= libsa32 SUBDIR+= zfs SUBDIR+= userboot Modified: stable/11/sys/boot/Makefile.i386 ============================================================================== --- stable/11/sys/boot/Makefile.i386 Sun Feb 11 19:54:21 2018 (r329133) +++ stable/11/sys/boot/Makefile.i386 Sun Feb 11 20:00:26 2018 (r329134) @@ -1,7 +1,7 @@ # $FreeBSD$ SUBDIR+= efi -SUBDIR+= libstand32 +SUBDIR+= libsa32 SUBDIR+= zfs .if !defined(LOADER_NO_GELI_SUPPORT) Modified: stable/11/sys/boot/Makefile.inc ============================================================================== --- stable/11/sys/boot/Makefile.inc Sun Feb 11 19:54:21 2018 (r329133) +++ stable/11/sys/boot/Makefile.inc Sun Feb 11 20:00:26 2018 (r329134) @@ -5,13 +5,11 @@ .if !defined(__BOOT_MAKEFILE_INC__) __BOOT_MAKEFILE_INC__=${MFILE} -SASRC=${SRCTOP}/lib/libstand -# Normal standalone library -LIBSA=${OBJTOP}/sys/boot/libsa/libstand.a +SASRC=${SRCTOP}/sys/boot/libsa +# Normal Standalone library +LIBSA=${OBJTOP}/sys/boot/libsa/libsa.a # Standalone library compiled for 32-bit version of the processor -LIBSA32=${OBJTOP}/sys/boot/libstand32/libstand.a -# Standalone library compiled for userboot -LIBSAU=${OBJTOP}/sys/boot/userboot/libstand/libstand.a +LIBSA32=${OBJTOP}/sys/boot/libsa32/libsa32.a CFLAGS+=-I${SASRC} Modified: stable/11/sys/boot/Makefile.powerpc ============================================================================== --- stable/11/sys/boot/Makefile.powerpc Sun Feb 11 19:54:21 2018 (r329133) +++ stable/11/sys/boot/Makefile.powerpc Sun Feb 11 20:00:26 2018 (r329134) @@ -4,6 +4,6 @@ SUBDIR+= fdt .endif -SUBDIR+= libstand32 +SUBDIR+= libsa32 SUBDIR+= ofw SUBDIR+= uboot Modified: stable/11/sys/boot/common/Makefile.inc ============================================================================== --- stable/11/sys/boot/common/Makefile.inc Sun Feb 11 19:54:21 2018 (r329133) +++ stable/11/sys/boot/common/Makefile.inc Sun Feb 11 20:00:26 2018 (r329134) @@ -1,5 +1,7 @@ # $FreeBSD$ +.PATH: ${SRCTOP}/sys/boot/common ${SRCTOP}/sys/boot/libsa + SRCS+= boot.c commands.c console.c devopen.c interp.c SRCS+= interp_backslash.c interp_parse.c ls.c misc.c SRCS+= module.c panic.c @@ -32,7 +34,6 @@ SRCS+= dev_net.c SRCS+= disk.c part.c CFLAGS+= -DLOADER_DISK_SUPPORT .if !defined(LOADER_NO_GPT_SUPPORT) -SRCS+= crc32.c CFLAGS+= -DLOADER_GPT_SUPPORT .endif .if !defined(LOADER_NO_MBR_SUPPORT) Modified: stable/11/sys/boot/efi/boot1/Makefile ============================================================================== --- stable/11/sys/boot/efi/boot1/Makefile Sun Feb 11 19:54:21 2018 (r329133) +++ stable/11/sys/boot/efi/boot1/Makefile Sun Feb 11 20:00:26 2018 (r329134) @@ -2,7 +2,7 @@ MAN= -.include +.include "../Makefile.inc" MK_SSP= no @@ -120,7 +120,7 @@ boot1.efi: ${PROG} -j .rela.dyn -j .reloc -j .eh_frame \ --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET} -boot1.o: ${.CURDIR}/../../common/ufsread.c +boot1.o: ${SASRC}/ufsread.c # The following inserts our objects into a template FAT file system # created by generate-fat.sh Modified: stable/11/sys/boot/i386/gptboot/Makefile ============================================================================== --- stable/11/sys/boot/i386/gptboot/Makefile Sun Feb 11 19:54:21 2018 (r329133) +++ stable/11/sys/boot/i386/gptboot/Makefile Sun Feb 11 20:00:26 2018 (r329134) @@ -1,7 +1,9 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../boot2 ${.CURDIR}/../common ${.CURDIR}/../../common +.include "../Makefile.inc" +.PATH: ${.CURDIR}/../boot2 ${.CURDIR}/../common ${SASRC} + FILES= gptboot MAN= gptboot.8 @@ -20,7 +22,7 @@ GPTBOOT_UFS?= UFS1_AND_UFS2 #GPTBOOT_UFS?= UFS2_ONLY #GPTBOOT_UFS?= UFS1_ONLY -CFLAGS= -DBOOTPROG=\"gptboot\" \ +CFLAGS+=-DBOOTPROG=\"gptboot\" \ -O1 \ -DGPT \ -D${GPTBOOT_UFS} \ @@ -76,7 +78,7 @@ gptboot.bin: gptboot.out gptboot.out: ${BTXCRT} gptboot.o sio.o crc32.o drv.o cons.o util.o ${OPENCRYPTO_XTS} ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSA32} -gptboot.o: ${.CURDIR}/../../common/ufsread.c +gptboot.o: ${SASRC}/ufsread.c .if ${MACHINE_CPUARCH} == "amd64" beforedepend gptboot.o: machine Modified: stable/11/sys/boot/i386/gptzfsboot/Makefile ============================================================================== --- stable/11/sys/boot/i386/gptzfsboot/Makefile Sun Feb 11 19:54:21 2018 (r329133) +++ stable/11/sys/boot/i386/gptzfsboot/Makefile Sun Feb 11 20:00:26 2018 (r329134) @@ -1,10 +1,10 @@ # $FreeBSD$ -.include +.include "../Makefile.inc" .PATH: ${.CURDIR}/../boot2 ${.CURDIR}/../gptboot \ ${.CURDIR}/../zfsboot ${.CURDIR}/../common \ - ${.CURDIR}/../../common ${.CURDIR}/../../../crypto/skein + ${.CURDIR}/../../../crypto/skein ${SASRC} FILES= gptzfsboot MAN= gptzfsboot.8 @@ -19,7 +19,7 @@ REL1= 0x700 ORG1= 0x7c00 ORG2= 0x0 -CFLAGS= -DBOOTPROG=\"gptzfsboot\" \ +CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \ -O1 \ -DGPT -DZFS -DBOOT2 \ -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ Modified: stable/11/sys/boot/i386/zfsboot/Makefile ============================================================================== --- stable/11/sys/boot/i386/zfsboot/Makefile Sun Feb 11 19:54:21 2018 (r329133) +++ stable/11/sys/boot/i386/zfsboot/Makefile Sun Feb 11 20:00:26 2018 (r329134) @@ -1,7 +1,9 @@ # $FreeBSD$ +.include "../Makefile.inc" + .PATH: ${.CURDIR}/../boot2 ${.CURDIR}/../common \ - ${.CURDIR}/../../common ${.CURDIR}/../../../crypto/skein + ${.CURDIR}/../../../crypto/skein ${SASRC} FILES= zfsboot MAN= zfsboot.8 @@ -16,7 +18,7 @@ REL1= 0x700 ORG1= 0x7c00 ORG2= 0x2000 -CFLAGS= -DBOOTPROG=\"zfsboot\" \ +CFLAGS+=-DBOOTPROG=\"zfsboot\" \ -O1 \ -DZFS -DBOOT2 \ -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ Modified: stable/11/sys/boot/libsa/Makefile ============================================================================== --- stable/11/sys/boot/libsa/Makefile Sun Feb 11 19:54:21 2018 (r329133) +++ stable/11/sys/boot/libsa/Makefile Sun Feb 11 20:00:26 2018 (r329134) @@ -16,7 +16,7 @@ LIBSTAND_SRC?= ${.CURDIR} LIBSTAND_CPUARCH?=${MACHINE_CPUARCH} LIBC_SRC= ${LIBSTAND_SRC}/../libc -LIB= stand +LIB?= sa NO_PIC= INCS?= stand.h MAN?= libstand.3 Copied: stable/11/sys/boot/libsa/crc32.c (from r324554, head/sys/boot/libsa/crc32.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/boot/libsa/crc32.c Sun Feb 11 20:00:26 2018 (r329134, copy of r324554, head/sys/boot/libsa/crc32.c) @@ -0,0 +1,108 @@ +/*- + * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or + * code or tables extracted from it, as desired without restriction. + */ + +/* + * First, the polynomial itself and its table of feedback terms. The + * polynomial is + * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 + * + * Note that we take it "backwards" and put the highest-order term in + * the lowest-order bit. The X^32 term is "implied"; the LSB is the + * X^31 term, etc. The X^0 term (usually shown as "+1") results in + * the MSB being 1 + * + * Note that the usual hardware shift register implementation, which + * is what we're using (we're merely optimizing it by doing eight-bit + * chunks at a time) shifts bits into the lowest-order term. In our + * implementation, that means shifting towards the right. Why do we + * do it this way? Because the calculated CRC must be transmitted in + * order from highest-order term to lowest-order term. UARTs transmit + * characters in order from LSB to MSB. By storing the CRC this way + * we hand it to the UART in the order low-byte to high-byte; the UART + * sends each low-bit to hight-bit; and the result is transmission bit + * by bit from highest- to lowest-order term without requiring any bit + * shuffling on our part. Reception works similarly + * + * The feedback terms table consists of 256, 32-bit entries. Notes + * + * The table can be generated at runtime if desired; code to do so + * is shown later. It might not be obvious, but the feedback + * terms simply represent the results of eight shift/xor opera + * tions for all combinations of data and CRC register values + * + * The values must be right-shifted by eight bits by the "updcrc + * logic; the shift must be unsigned (bring in zeroes). On some + * hardware you could probably optimize the shift in assembler by + * using byte-swap instructions + * polynomial $edb88320 + * + * + * CRC32 code derived from work by Gary S. Brown. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include "crc32.h" + +static const uint32_t crc32_tab[] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, + 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, + 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, + 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, + 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, + 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, + 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, + 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, + 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, + 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, + 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, + 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, + 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, + 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, + 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + +uint32_t +crc32(const void *buf, size_t size) +{ + const uint8_t *p = buf; + uint32_t crc; + + crc = ~0U; + while (size--) + crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8); + return (crc ^ ~0U); +} Copied: stable/11/sys/boot/libsa/crc32.h (from r324554, head/sys/boot/libsa/crc32.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/boot/libsa/crc32.h Sun Feb 11 20:00:26 2018 (r329134, copy of r324554, head/sys/boot/libsa/crc32.h) @@ -0,0 +1,13 @@ +/*- + * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or + * code or tables extracted from it, as desired without restriction. + * + * $FreeBSD$ + */ + +#ifndef _CRC32_H_ +#define _CRC32_H_ + +uint32_t crc32(const void *buf, size_t size); + +#endif /* !_CRC32_H_ */ Copied: stable/11/sys/boot/libsa/gpt.c (from r324554, head/sys/boot/libsa/gpt.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/boot/libsa/gpt.c Sun Feb 11 20:00:26 2018 (r329134, copy of r324554, head/sys/boot/libsa/gpt.c) @@ -0,0 +1,379 @@ +/*- + * Copyright (c) 2010 Pawel Jakub Dawidek + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#ifndef LITTLE_ENDIAN +#error gpt.c works only for little endian architectures +#endif + +#include "crc32.h" +#include "drv.h" +#include "util.h" +#include "gpt.h" + +static struct gpt_hdr hdr_primary, hdr_backup, *gpthdr; +static uint64_t hdr_primary_lba, hdr_backup_lba; +static struct gpt_ent table_primary[MAXTBLENTS], table_backup[MAXTBLENTS]; +static struct gpt_ent *gpttable; +static int curent, bootonce; + +/* + * Buffer below 64kB passed on gptread(), which can hold at least + * one sector of data (512 bytes). + */ +static char *secbuf; + +static void +gptupdate(const char *which, struct dsk *dskp, struct gpt_hdr *hdr, + struct gpt_ent *table) +{ + int entries_per_sec, firstent; + daddr_t slba; + + /* + * We need to update the following for both primary and backup GPT: + * 1. Sector on disk that contains current partition. + * 2. Partition table checksum. + * 3. Header checksum. + * 4. Header on disk. + */ + + entries_per_sec = DEV_BSIZE / hdr->hdr_entsz; + slba = curent / entries_per_sec; + firstent = slba * entries_per_sec; + bcopy(&table[firstent], secbuf, DEV_BSIZE); + slba += hdr->hdr_lba_table; + if (drvwrite(dskp, secbuf, slba, 1)) { + printf("%s: unable to update %s GPT partition table\n", + BOOTPROG, which); + return; + } + hdr->hdr_crc_table = crc32(table, hdr->hdr_entries * hdr->hdr_entsz); + hdr->hdr_crc_self = 0; + hdr->hdr_crc_self = crc32(hdr, hdr->hdr_size); + bzero(secbuf, DEV_BSIZE); + bcopy(hdr, secbuf, hdr->hdr_size); + if (drvwrite(dskp, secbuf, hdr->hdr_lba_self, 1)) { + printf("%s: unable to update %s GPT header\n", BOOTPROG, which); + return; + } +} + +int +gptfind(const uuid_t *uuid, struct dsk *dskp, int part) +{ + struct gpt_ent *ent; + int firsttry; + + if (part >= 0) { + if (part == 0 || part > gpthdr->hdr_entries) { + printf("%s: invalid partition index\n", BOOTPROG); + return (-1); + } + ent = &gpttable[part - 1]; + if (bcmp(&ent->ent_type, uuid, sizeof(uuid_t)) != 0) { + printf("%s: specified partition is not UFS\n", + BOOTPROG); + return (-1); + } + curent = part - 1; + goto found; + } + + firsttry = (curent == -1); + curent++; + if (curent >= gpthdr->hdr_entries) { + curent = gpthdr->hdr_entries; + return (-1); + } + if (bootonce) { + /* + * First look for partition with both GPT_ENT_ATTR_BOOTME and + * GPT_ENT_ATTR_BOOTONCE flags. + */ + for (; curent < gpthdr->hdr_entries; curent++) { + ent = &gpttable[curent]; + if (bcmp(&ent->ent_type, uuid, sizeof(uuid_t)) != 0) + continue; + if (!(ent->ent_attr & GPT_ENT_ATTR_BOOTME)) + continue; + if (!(ent->ent_attr & GPT_ENT_ATTR_BOOTONCE)) + continue; + /* Ok, found one. */ + goto found; + } + bootonce = 0; + curent = 0; + } + for (; curent < gpthdr->hdr_entries; curent++) { + ent = &gpttable[curent]; + if (bcmp(&ent->ent_type, uuid, sizeof(uuid_t)) != 0) + continue; + if (!(ent->ent_attr & GPT_ENT_ATTR_BOOTME)) + continue; + if (ent->ent_attr & GPT_ENT_ATTR_BOOTONCE) + continue; + /* Ok, found one. */ + goto found; + } + if (firsttry) { + /* + * No partition with BOOTME flag was found, try to boot from + * first UFS partition. + */ + for (curent = 0; curent < gpthdr->hdr_entries; curent++) { + ent = &gpttable[curent]; + if (bcmp(&ent->ent_type, uuid, sizeof(uuid_t)) != 0) + continue; + /* Ok, found one. */ + goto found; + } + } + return (-1); +found: + dskp->part = curent + 1; + ent = &gpttable[curent]; + dskp->start = ent->ent_lba_start; + if (ent->ent_attr & GPT_ENT_ATTR_BOOTONCE) { + /* + * Clear BOOTME, but leave BOOTONCE set before trying to + * boot from this partition. + */ + if (hdr_primary_lba > 0) { + table_primary[curent].ent_attr &= ~GPT_ENT_ATTR_BOOTME; + gptupdate("primary", dskp, &hdr_primary, table_primary); + } + if (hdr_backup_lba > 0) { + table_backup[curent].ent_attr &= ~GPT_ENT_ATTR_BOOTME; + gptupdate("backup", dskp, &hdr_backup, table_backup); + } + } + return (0); +} + +static int +gptread_hdr(const char *which, struct dsk *dskp, struct gpt_hdr *hdr, + uint64_t hdrlba) +{ + uint32_t crc; + + if (drvread(dskp, secbuf, hdrlba, 1)) { + printf("%s: unable to read %s GPT header\n", BOOTPROG, which); + return (-1); + } + bcopy(secbuf, hdr, sizeof(*hdr)); + if (bcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig)) != 0 || + hdr->hdr_lba_self != hdrlba || hdr->hdr_revision < 0x00010000 || + hdr->hdr_entsz < sizeof(struct gpt_ent) || + hdr->hdr_entries > MAXTBLENTS || DEV_BSIZE % hdr->hdr_entsz != 0) { + printf("%s: invalid %s GPT header\n", BOOTPROG, which); + return (-1); + } + crc = hdr->hdr_crc_self; + hdr->hdr_crc_self = 0; + if (crc32(hdr, hdr->hdr_size) != crc) { + printf("%s: %s GPT header checksum mismatch\n", BOOTPROG, + which); + return (-1); + } + hdr->hdr_crc_self = crc; + return (0); +} + +void +gptbootfailed(struct dsk *dskp) +{ + + if (!(gpttable[curent].ent_attr & GPT_ENT_ATTR_BOOTONCE)) + return; + + if (hdr_primary_lba > 0) { + table_primary[curent].ent_attr &= ~GPT_ENT_ATTR_BOOTONCE; + table_primary[curent].ent_attr |= GPT_ENT_ATTR_BOOTFAILED; + gptupdate("primary", dskp, &hdr_primary, table_primary); + } + if (hdr_backup_lba > 0) { + table_backup[curent].ent_attr &= ~GPT_ENT_ATTR_BOOTONCE; + table_backup[curent].ent_attr |= GPT_ENT_ATTR_BOOTFAILED; + gptupdate("backup", dskp, &hdr_backup, table_backup); + } +} + +static void +gptbootconv(const char *which, struct dsk *dskp, struct gpt_hdr *hdr, + struct gpt_ent *table) +{ + struct gpt_ent *ent; + daddr_t slba; + int table_updated, sector_updated; + int entries_per_sec, nent, part; + + table_updated = 0; + entries_per_sec = DEV_BSIZE / hdr->hdr_entsz; + for (nent = 0, slba = hdr->hdr_lba_table; + slba < hdr->hdr_lba_table + hdr->hdr_entries / entries_per_sec; + slba++, nent += entries_per_sec) { + sector_updated = 0; + for (part = 0; part < entries_per_sec; part++) { + ent = &table[nent + part]; + if ((ent->ent_attr & (GPT_ENT_ATTR_BOOTME | + GPT_ENT_ATTR_BOOTONCE | + GPT_ENT_ATTR_BOOTFAILED)) != + GPT_ENT_ATTR_BOOTONCE) { + continue; + } + ent->ent_attr &= ~GPT_ENT_ATTR_BOOTONCE; + ent->ent_attr |= GPT_ENT_ATTR_BOOTFAILED; + table_updated = 1; + sector_updated = 1; + } + if (!sector_updated) + continue; + bcopy(&table[nent], secbuf, DEV_BSIZE); + if (drvwrite(dskp, secbuf, slba, 1)) { + printf("%s: unable to update %s GPT partition table\n", + BOOTPROG, which); + } + } + if (!table_updated) + return; + hdr->hdr_crc_table = crc32(table, hdr->hdr_entries * hdr->hdr_entsz); + hdr->hdr_crc_self = 0; + hdr->hdr_crc_self = crc32(hdr, hdr->hdr_size); + bzero(secbuf, DEV_BSIZE); + bcopy(hdr, secbuf, hdr->hdr_size); + if (drvwrite(dskp, secbuf, hdr->hdr_lba_self, 1)) + printf("%s: unable to update %s GPT header\n", BOOTPROG, which); +} + +static int +gptread_table(const char *which, const uuid_t *uuid, struct dsk *dskp, + struct gpt_hdr *hdr, struct gpt_ent *table) +{ + struct gpt_ent *ent; + int entries_per_sec; + int part, nent; + daddr_t slba; + + if (hdr->hdr_entries == 0) + return (0); + + entries_per_sec = DEV_BSIZE / hdr->hdr_entsz; + slba = hdr->hdr_lba_table; + nent = 0; + for (;;) { + if (drvread(dskp, secbuf, slba, 1)) { + printf("%s: unable to read %s GPT partition table\n", + BOOTPROG, which); + return (-1); + } + ent = (struct gpt_ent *)secbuf; + for (part = 0; part < entries_per_sec; part++, ent++) { + bcopy(ent, &table[nent], sizeof(table[nent])); + if (++nent >= hdr->hdr_entries) + break; + } + if (nent >= hdr->hdr_entries) + break; + slba++; + } + if (crc32(table, nent * hdr->hdr_entsz) != hdr->hdr_crc_table) { + printf("%s: %s GPT table checksum mismatch\n", BOOTPROG, which); + return (-1); + } + return (0); +} + +int +gptread(const uuid_t *uuid, struct dsk *dskp, char *buf) +{ + uint64_t altlba; + + /* + * Read and verify both GPT headers: primary and backup. + */ + + secbuf = buf; + hdr_primary_lba = hdr_backup_lba = 0; + curent = -1; + bootonce = 1; + dskp->start = 0; + + if (gptread_hdr("primary", dskp, &hdr_primary, 1) == 0 && + gptread_table("primary", uuid, dskp, &hdr_primary, + table_primary) == 0) { + hdr_primary_lba = hdr_primary.hdr_lba_self; + gpthdr = &hdr_primary; + gpttable = table_primary; + } + + if (hdr_primary_lba > 0) { + /* + * If primary header is valid, we can get backup + * header location from there. + */ + altlba = hdr_primary.hdr_lba_alt; + } else { + altlba = drvsize(dskp); + if (altlba > 0) + altlba--; + } + if (altlba == 0) + printf("%s: unable to locate backup GPT header\n", BOOTPROG); + else if (gptread_hdr("backup", dskp, &hdr_backup, altlba) == 0 && + gptread_table("backup", uuid, dskp, &hdr_backup, + table_backup) == 0) { + hdr_backup_lba = hdr_backup.hdr_lba_self; + if (hdr_primary_lba == 0) { + gpthdr = &hdr_backup; + gpttable = table_backup; + printf("%s: using backup GPT\n", BOOTPROG); + } + } + + /* + * Convert all BOOTONCE without BOOTME flags into BOOTFAILED. + * BOOTONCE without BOOTME means that we tried to boot from it, + * but failed after leaving gptboot and machine was rebooted. + * We don't want to leave partitions marked as BOOTONCE only, + * because when we boot successfully start-up scripts should + * find at most one partition with only BOOTONCE flag and this + * will mean that we booted from that partition. + */ + if (hdr_primary_lba != 0) + gptbootconv("primary", dskp, &hdr_primary, table_primary); + if (hdr_backup_lba != 0) + gptbootconv("backup", dskp, &hdr_backup, table_backup); + + if (hdr_primary_lba == 0 && hdr_backup_lba == 0) + return (-1); + return (0); +} Copied: stable/11/sys/boot/libsa/gpt.h (from r324554, head/sys/boot/libsa/gpt.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/boot/libsa/gpt.h Sun Feb 11 20:00:26 2018 (r329134, copy of r324554, head/sys/boot/libsa/gpt.h) @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2010 Pawel Jakub Dawidek + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _GPT_H_ +#define _GPT_H_ + +#include +#include + +#define MAXTBLENTS 128 + +int gptread(const uuid_t *uuid, struct dsk *dskp, char *buf); +int gptfind(const uuid_t *uuid, struct dsk *dskp, int part); +void gptbootfailed(struct dsk *dskp); + +#endif /* !_GPT_H_ */ Copied: stable/11/sys/boot/libsa/ufsread.c (from r329133, stable/11/sys/boot/common/ufsread.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/boot/libsa/ufsread.c Sun Feb 11 20:00:26 2018 (r329134, copy of r329133, stable/11/sys/boot/common/ufsread.c) @@ -0,0 +1,326 @@ +/*- + * Copyright (c) 2002 McAfee, Inc. + * All rights reserved. + * + * This software was developed for the FreeBSD Project by Marshall + * Kirk McKusick and McAfee Research,, the Security Research Division of + * McAfee, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as + * part of the DARPA CHATS research program + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/*- + * Copyright (c) 1998 Robert Nordier + * All rights reserved. + * + * Redistribution and use in source and binary forms are freely + * permitted provided that the above copyright notice and this + * paragraph and the following disclaimer are duplicated in all + * such forms. + * + * This software is provided "AS IS" and without any express or + * implied warranties, including, without limitation, the implied + * warranties of merchantability and fitness for a particular + * purpose. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#ifdef UFS_SMALL_CGBASE +/* XXX: Revert to old (broken for over 1.5Tb filesystems) version of cgbase + (see sys/ufs/ffs/fs.h rev 1.39) so that small boot loaders (e.g. boot2) can + support both UFS1 and UFS2. */ +#undef cgbase +#define cgbase(fs, c) ((ufs2_daddr_t)((fs)->fs_fpg * (c))) +#endif + +typedef uint32_t ufs_ino_t; + +/* + * We use 4k `virtual' blocks for filesystem data, whatever the actual + * filesystem block size. FFS blocks are always a multiple of 4k. + */ +#define VBLKSHIFT 12 +#define VBLKSIZE (1 << VBLKSHIFT) +#define VBLKMASK (VBLKSIZE - 1) +#define DBPERVBLK (VBLKSIZE / DEV_BSIZE) +#define INDIRPERVBLK(fs) (NINDIR(fs) / ((fs)->fs_bsize >> VBLKSHIFT)) +#define IPERVBLK(fs) (INOPB(fs) / ((fs)->fs_bsize >> VBLKSHIFT)) +#define INO_TO_VBA(fs, ipervblk, x) \ + (fsbtodb(fs, cgimin(fs, ino_to_cg(fs, x))) + \ + (((x) % (fs)->fs_ipg) / (ipervblk) * DBPERVBLK)) +#define INO_TO_VBO(ipervblk, x) ((x) % ipervblk) +#define FS_TO_VBA(fs, fsb, off) (fsbtodb(fs, fsb) + \ + ((off) / VBLKSIZE) * DBPERVBLK) +#define FS_TO_VBO(fs, fsb, off) ((off) & VBLKMASK) + +/* Buffers that must not span a 64k boundary. */ +struct dmadat { + char blkbuf[VBLKSIZE]; /* filesystem blocks */ + char indbuf[VBLKSIZE]; /* indir blocks */ + char sbbuf[SBLOCKSIZE]; /* superblock */ + char secbuf[DEV_BSIZE]; /* for MBR/disklabel */ +}; +static struct dmadat *dmadat; + +static ufs_ino_t lookup(const char *); +static ssize_t fsread(ufs_ino_t, void *, size_t); + +static uint8_t ls, dsk_meta; +static uint32_t fs_off; + +static __inline uint8_t +fsfind(const char *name, ufs_ino_t * ino) +{ + static char buf[DEV_BSIZE]; + static struct direct d; + char *s; + ssize_t n; + + fs_off = 0; + while ((n = fsread(*ino, buf, DEV_BSIZE)) > 0) + for (s = buf; s < buf + DEV_BSIZE;) { + memcpy(&d, s, sizeof(struct direct)); + if (ls) + printf("%s ", d.d_name); + else if (!strcmp(name, d.d_name)) { + *ino = d.d_ino; + return d.d_type; + } + s += d.d_reclen; + } + if (n != -1 && ls) + printf("\n"); + return 0; +} + +static ufs_ino_t +lookup(const char *path) +{ + static char name[MAXNAMLEN + 1]; + const char *s; + ufs_ino_t ino; + ssize_t n; + uint8_t dt; + + ino = ROOTINO; + dt = DT_DIR; + for (;;) { + if (*path == '/') + path++; + if (!*path) + break; + for (s = path; *s && *s != '/'; s++); + if ((n = s - path) > MAXNAMLEN) + return 0; + ls = *path == '?' && n == 1 && !*s; + memcpy(name, path, n); + name[n] = 0; + if (dt != DT_DIR) { + printf("%s: not a directory.\n", name); + return (0); + } + if ((dt = fsfind(name, &ino)) <= 0) + break; + path = s; + } + return dt == DT_REG ? ino : 0; +} + +/* + * Possible superblock locations ordered from most to least likely. + */ +static int sblock_try[] = SBLOCKSEARCH; + +#if defined(UFS2_ONLY) +#define DIP(field) dp2.field +#elif defined(UFS1_ONLY) +#define DIP(field) dp1.field +#else +#define DIP(field) fs.fs_magic == FS_UFS1_MAGIC ? dp1.field : dp2.field +#endif + +static ssize_t +fsread_size(ufs_ino_t inode, void *buf, size_t nbyte, size_t *fsizep) +{ +#ifndef UFS2_ONLY + static struct ufs1_dinode dp1; + ufs1_daddr_t addr1; +#endif +#ifndef UFS1_ONLY + static struct ufs2_dinode dp2; +#endif + static struct fs fs; + static ufs_ino_t inomap; + char *blkbuf; + void *indbuf; + char *s; + size_t n, nb, size, off, vboff; + ufs_lbn_t lbn; + ufs2_daddr_t addr2, vbaddr; + static ufs2_daddr_t blkmap, indmap; + u_int u; + + /* Basic parameter validation. */ + if ((buf == NULL && nbyte != 0) || dmadat == NULL) + return (-1); + + blkbuf = dmadat->blkbuf; + indbuf = dmadat->indbuf; + + /* + * Force probe if inode is zero to ensure we have a valid fs, otherwise + * when probing multiple paritions, reads from subsequent parititions + * will incorrectly succeed. + */ + if (!dsk_meta || inode == 0) { + inomap = 0; + dsk_meta = 0; + for (n = 0; sblock_try[n] != -1; n++) { + if (dskread(dmadat->sbbuf, sblock_try[n] / DEV_BSIZE, + SBLOCKSIZE / DEV_BSIZE)) + return -1; + memcpy(&fs, dmadat->sbbuf, sizeof(struct fs)); + if (( +#if defined(UFS1_ONLY) + fs.fs_magic == FS_UFS1_MAGIC +#elif defined(UFS2_ONLY) + (fs.fs_magic == FS_UFS2_MAGIC && + fs.fs_sblockloc == sblock_try[n]) +#else + fs.fs_magic == FS_UFS1_MAGIC || + (fs.fs_magic == FS_UFS2_MAGIC && + fs.fs_sblockloc == sblock_try[n]) +#endif + ) && + fs.fs_bsize <= MAXBSIZE && + fs.fs_bsize >= (int32_t)sizeof(struct fs)) + break; + } + if (sblock_try[n] == -1) { + return -1; + } + dsk_meta++; + } else + memcpy(&fs, dmadat->sbbuf, sizeof(struct fs)); + if (!inode) + return 0; + if (inomap != inode) { + n = IPERVBLK(&fs); + if (dskread(blkbuf, INO_TO_VBA(&fs, n, inode), DBPERVBLK)) + return -1; + n = INO_TO_VBO(n, inode); +#if defined(UFS1_ONLY) + memcpy(&dp1, (struct ufs1_dinode *)(void *)blkbuf + n, + sizeof(dp1)); +#elif defined(UFS2_ONLY) + memcpy(&dp2, (struct ufs2_dinode *)(void *)blkbuf + n, + sizeof(dp2)); +#else + if (fs.fs_magic == FS_UFS1_MAGIC) + memcpy(&dp1, (struct ufs1_dinode *)(void *)blkbuf + n, + sizeof(dp1)); + else + memcpy(&dp2, (struct ufs2_dinode *)(void *)blkbuf + n, + sizeof(dp2)); +#endif + inomap = inode; + fs_off = 0; + blkmap = indmap = 0; + } + s = buf; + size = DIP(di_size); + n = size - fs_off; + if (nbyte > n) + nbyte = n; + nb = nbyte; + while (nb) { + lbn = lblkno(&fs, fs_off); + off = blkoff(&fs, fs_off); + if (lbn < NDADDR) { + addr2 = DIP(di_db[lbn]); + } else if (lbn < NDADDR + NINDIR(&fs)) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Sun Feb 11 20:04:36 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1E23F13561; Sun, 11 Feb 2018 20:04:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6DF99685F2; Sun, 11 Feb 2018 20:04:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67C19278DD; Sun, 11 Feb 2018 20:04:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1BK4ZtM021165; Sun, 11 Feb 2018 20:04:35 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1BK4ZZf021160; Sun, 11 Feb 2018 20:04:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802112004.w1BK4ZZf021160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 11 Feb 2018 20:04:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329135 - in stable/11/sys/boot: . arm/uboot common efi/boot1 efi/include efi/libefi efi/loader efi/loader/arch/i386 libsa man mips/uboot powerpc/ofw powerpc/uboot X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/sys/boot: . arm/uboot common efi/boot1 efi/include efi/libefi efi/loader efi/loader/arch/i386 libsa man mips/uboot powerpc/ofw powerpc/uboot X-SVN-Commit-Revision: 329135 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 20:04:36 -0000 Author: kevans Date: Sun Feb 11 20:04:34 2018 New Revision: 329135 URL: https://svnweb.freebsd.org/changeset/base/329135 Log: MFC Loader Fixes 2017q4p5: r324557,r324558,r324559,r324646,r324647 r324557: Rename exit to efi_exit to avoid clashing with libsa exit definition r324558: Define prototype for exit and ensure references r324559: Move panic back into libsa. It's documented in libstand(3) to belong there. r324646: Unify boot1 with loader. r324647: Move orphaned man pages into new man directory from common. Added: stable/11/sys/boot/efi/libefi/efi_main.c - copied unchanged from r324646, head/sys/boot/efi/libefi/efi_main.c stable/11/sys/boot/libsa/panic.c - copied unchanged from r324559, head/sys/boot/libsa/panic.c stable/11/sys/boot/man/ - copied from r324647, head/sys/boot/man/ Deleted: stable/11/sys/boot/common/Makefile stable/11/sys/boot/common/loader.8 stable/11/sys/boot/common/panic.c stable/11/sys/boot/common/zfsloader.8 stable/11/sys/boot/efi/boot1/boot_module.h stable/11/sys/boot/efi/boot1/ufs_module.c stable/11/sys/boot/efi/boot1/zfs_module.c stable/11/sys/boot/efi/loader/efi_main.c Modified: stable/11/sys/boot/Makefile stable/11/sys/boot/arm/uboot/conf.c stable/11/sys/boot/common/Makefile.inc stable/11/sys/boot/efi/boot1/Makefile stable/11/sys/boot/efi/boot1/boot1.c stable/11/sys/boot/efi/include/efilib.h stable/11/sys/boot/efi/libefi/Makefile stable/11/sys/boot/efi/loader/Makefile stable/11/sys/boot/efi/loader/arch/i386/exec.c stable/11/sys/boot/libsa/Makefile stable/11/sys/boot/libsa/stand.h stable/11/sys/boot/mips/uboot/conf.c stable/11/sys/boot/powerpc/ofw/conf.c stable/11/sys/boot/powerpc/uboot/conf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/Makefile ============================================================================== --- stable/11/sys/boot/Makefile Sun Feb 11 20:00:26 2018 (r329134) +++ stable/11/sys/boot/Makefile Sun Feb 11 20:04:34 2018 (r329135) @@ -9,7 +9,7 @@ SUBDIR+= ficl SUBDIR+= forth .endif -SUBDIR+= common +SUBDIR+= man .include Modified: stable/11/sys/boot/arm/uboot/conf.c ============================================================================== --- stable/11/sys/boot/arm/uboot/conf.c Sun Feb 11 20:00:26 2018 (r329134) +++ stable/11/sys/boot/arm/uboot/conf.c Sun Feb 11 20:04:34 2018 (r329135) @@ -36,6 +36,9 @@ __FBSDID("$FreeBSD$"); #include "dev_net.h" #endif +/* Make sure we have an explicit reference to exit so libsa's panic pulls in the MD exit */ +void (*exitfn)(int) = exit; + struct devsw *devsw[] = { #if defined(LOADER_DISK_SUPPORT) || defined(LOADER_CD9660_SUPPORT) &uboot_storage, Modified: stable/11/sys/boot/common/Makefile.inc ============================================================================== --- stable/11/sys/boot/common/Makefile.inc Sun Feb 11 20:00:26 2018 (r329134) +++ stable/11/sys/boot/common/Makefile.inc Sun Feb 11 20:04:34 2018 (r329135) @@ -4,7 +4,7 @@ SRCS+= boot.c commands.c console.c devopen.c interp.c SRCS+= interp_backslash.c interp_parse.c ls.c misc.c -SRCS+= module.c panic.c +SRCS+= module.c .if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64" SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c Modified: stable/11/sys/boot/efi/boot1/Makefile ============================================================================== --- stable/11/sys/boot/efi/boot1/Makefile Sun Feb 11 20:00:26 2018 (r329134) +++ stable/11/sys/boot/efi/boot1/Makefile Sun Feb 11 20:04:34 2018 (r329135) @@ -8,8 +8,11 @@ MK_SSP= no PROG= boot1.sym INTERNALPROG= -WARNS?= 6 +WARNS?= 3 +# Include bcache code. +HAVE_BCACHE= yes + # We implement a slightly non-standard %S in that it always takes a # CHAR16 that's common in UEFI-land instead of a wchar_t. This only # seems to matter on arm64 where wchar_t defaults to an int instead @@ -18,13 +21,15 @@ WARNS?= 6 CWARNFLAGS.boot1.c+= -Wno-format # Disable warnings that are currently incompatible with the zfs boot code -CWARNFLAGS.zfs_module.c += -Wno-array-bounds -CWARNFLAGS.zfs_module.c += -Wno-cast-align -CWARNFLAGS.zfs_module.c += -Wno-cast-qual -CWARNFLAGS.zfs_module.c += -Wno-missing-prototypes -CWARNFLAGS.zfs_module.c += -Wno-sign-compare -CWARNFLAGS.zfs_module.c += -Wno-unused-parameter -CWARNFLAGS.zfs_module.c += -Wno-unused-function +CWARNFLAGS.zfs.c += -Wno-incompatible-pointer-types-discards-qualifiers +CWARNFLAGS.zfs.c += -Wno-missing-variable-declarations +CWARNFLAGS.zfs.c += -Wno-array-bounds +CWARNFLAGS.zfs.c += -Wno-cast-align +CWARNFLAGS.zfs.c += -Wno-cast-qual +CWARNFLAGS.zfs.c += -Wno-missing-prototypes +CWARNFLAGS.zfs.c += -Wno-sign-compare +CWARNFLAGS.zfs.c += -Wno-unused-parameter +CWARNFLAGS.zfs.c += -Wno-unused-function CWARNFLAGS.skein.c += -Wno-cast-align .if ${COMPILER_TYPE} == "clang" CWARNFLAGS.skein.c += -Wno-missing-variable-declarations @@ -33,19 +38,27 @@ CWARNFLAGS.skein.c += -Wno-missing-declarations .endif # architecture-specific loader code -SRCS= boot1.c self_reloc.c start.S ufs_module.c +SRCS= boot1.c self_reloc.c start.S .if ${MK_ZFS} != "no" -SRCS+= zfs_module.c +.PATH: ${.CURDIR}/../../../crypto/skein SRCS+= skein.c skein_block.c # Do not unroll skein loops, reduce code size CFLAGS+= -DSKEIN_LOOP=111 -.PATH: ${.CURDIR}/../../../crypto/skein +.PATH: ${.CURDIR}/../../zfs +SRCS+= zfs.c .endif .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized .endif +# Always add MI sources +.PATH: ${.CURDIR}/../../common +.include "${.CURDIR}/../../common/Makefile.inc" +CFLAGS+= -I${.CURDIR}/../../common + +.PATH: ${.CURDIR}/arch/${MACHINE} + CFLAGS+= -I. CFLAGS+= -I${.CURDIR}/../include CFLAGS+= -I${.CURDIR}/../include/${MACHINE} @@ -117,7 +130,7 @@ boot1.efi: ${PROG} SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \ -j .dynamic -j .dynsym -j .rel.dyn \ - -j .rela.dyn -j .reloc -j .eh_frame \ + -j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \ --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET} boot1.o: ${SASRC}/ufsread.c Modified: stable/11/sys/boot/efi/boot1/boot1.c ============================================================================== --- stable/11/sys/boot/efi/boot1/boot1.c Sun Feb 11 20:00:26 2018 (r329134) +++ stable/11/sys/boot/efi/boot1/boot1.c Sun Feb 11 20:04:34 2018 (r329135) @@ -23,61 +23,179 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include +#include #include +#include +#include #include +#ifdef EFI_ZFS_BOOT +#include +#endif typedef CHAR16 efi_char; #include -#include "boot_module.h" +#include + +#include "efi_drivers.h" +#include "efizfs.h" #include "paths.h" static void efi_panic(EFI_STATUS s, const char *fmt, ...) __dead2 __printflike(2, 3); +#ifdef EFI_DEBUG +#define DPRINTF(fmt, args...) printf(fmt, ##args) +#define DSTALL(d) BS->Stall(d) +#else +#define DPRINTF(fmt, ...) {} +#define DSTALL(d) {} +#endif -static const boot_module_t *boot_modules[] = -{ +struct arch_switch archsw; /* MI/MD interface boundary */ + +static const efi_driver_t *efi_drivers[] = { + NULL +}; + +extern struct console efi_console; +#if defined(__amd64__) || defined(__i386__) +extern struct console comconsole; +extern struct console nullconsole; +#endif + #ifdef EFI_ZFS_BOOT - &zfs_module, +uint64_t pool_guid; #endif + +struct fs_ops *file_system[] = { +#ifdef EFI_ZFS_BOOT + &zfs_fsops, +#endif + &dosfs_fsops, #ifdef EFI_UFS_BOOT - &ufs_module + &ufs_fsops, #endif + &cd9660_fsops, + &nfs_fsops, + &gzipfs_fsops, + &bzipfs_fsops, + NULL }; -#define NUM_BOOT_MODULES nitems(boot_modules) +struct devsw *devsw[] = { + &efipart_hddev, + &efipart_fddev, + &efipart_cddev, +#ifdef EFI_ZFS_BOOT + &zfs_dev, +#endif + NULL +}; + +struct console *consoles[] = { + &efi_console, + NULL +}; + +static EFI_LOADED_IMAGE *boot_image; +static EFI_DEVICE_PATH *imgpath; +static EFI_DEVICE_PATH *imgprefix; + +/* Definitions we don't actually need for boot, but we need to define + * to make the linker happy. + */ +struct file_format *file_formats[] = { NULL }; + +struct netif_driver *netif_drivers[] = { NULL }; + +static int +efi_autoload(void) +{ + printf("******** Boot block should not call autoload\n"); + return (-1); +} + +static ssize_t +efi_copyin(const void *src __unused, vm_offset_t dest __unused, + const size_t len __unused) +{ + printf("******** Boot block should not call copyin\n"); + return (-1); +} + +static ssize_t +efi_copyout(vm_offset_t src __unused, void *dest __unused, + const size_t len __unused) +{ + printf("******** Boot block should not call copyout\n"); + return (-1); +} + +static ssize_t +efi_readin(int fd __unused, vm_offset_t dest __unused, + const size_t len __unused) +{ + printf("******** Boot block should not call readin\n"); + return (-1); +} + /* The initial number of handles used to query EFI for partitions. */ #define NUM_HANDLES_INIT 24 -static EFI_GUID BlockIoProtocolGUID = BLOCK_IO_PROTOCOL; static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL; static EFI_GUID LoadedImageGUID = LOADED_IMAGE_PROTOCOL; -static EFI_GUID ConsoleControlGUID = EFI_CONSOLE_CONTROL_PROTOCOL_GUID; static EFI_GUID FreeBSDBootVarGUID = FREEBSD_BOOT_VAR_GUID; -/* - * Provide Malloc / Free backed by EFIs AllocatePool / FreePool which ensures - * memory is correctly aligned avoiding EFI_INVALID_PARAMETER returns from - * EFI methods. - */ -void * -Malloc(size_t len, const char *file __unused, int line __unused) +static EFI_STATUS +do_load(const char *filepath, void **bufp, size_t *bufsize) { - void *out; + struct stat st; + void *buf = NULL; + int fd, err; + size_t fsize, remaining; + ssize_t readsize; - if (BS->AllocatePool(EfiLoaderData, len, &out) == EFI_SUCCESS) - return (out); + if ((fd = open(filepath, O_RDONLY)) < 0) { + return (ENOTSUP); + } - return (NULL); -} + if ((err = fstat(fd, &st)) != 0) { + goto close_file; + } -void -Free(void *buf, const char *file __unused, int line __unused) -{ - if (buf != NULL) - (void)BS->FreePool(buf); + fsize = st.st_size; + + if ((buf = malloc(fsize)) == NULL) { + err = ENOMEM; + goto close_file; + } + + remaining = fsize; + + do { + if ((readsize = read(fd, buf, fsize)) < 0) { + err = (-readsize); + goto free_buf; + } + + remaining -= readsize; + } while(remaining != 0); + + close(fd); + *bufsize = st.st_size; + *bufp = buf; + + close_file: + close(fd); + + return errno_to_efi_status(err); + + free_buf: + free(buf); + goto close_file; } static EFI_STATUS @@ -97,98 +215,275 @@ efi_setenv_freebsd_wcs(const char *varname, CHAR16 *va return (rv); } -/* - * nodes_match returns TRUE if the imgpath isn't NULL and the nodes match, - * FALSE otherwise. - */ -static BOOLEAN -nodes_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath) +static int +probe_fs(const char *filepath) { - size_t len; + int fd; - if (imgpath == NULL || imgpath->Type != devpath->Type || - imgpath->SubType != devpath->SubType) - return (FALSE); + if ((fd = open(filepath, O_RDONLY)) < 0) { + return (ENOTSUP); + } - len = DevicePathNodeLength(imgpath); - if (len != DevicePathNodeLength(devpath)) - return (FALSE); + close(fd); - return (memcmp(imgpath, devpath, (size_t)len) == 0); + return (0); } -/* - * device_paths_match returns TRUE if the imgpath isn't NULL and all nodes - * in imgpath and devpath match up to their respective occurrences of a - * media node, FALSE otherwise. - */ -static BOOLEAN -device_paths_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath) +static int +probe_dev(struct devsw *dev, int unit, const char *filepath) { + struct devdesc currdev; + char *devname; + int err; - if (imgpath == NULL) - return (FALSE); + currdev.d_dev = dev; + currdev.d_type = currdev.d_dev->dv_type; + currdev.d_unit = unit; + currdev.d_opendata = NULL; + devname = efi_fmtdev(&currdev); - while (!IsDevicePathEnd(imgpath) && !IsDevicePathEnd(devpath)) { - if (IsDevicePathType(imgpath, MEDIA_DEVICE_PATH) && - IsDevicePathType(devpath, MEDIA_DEVICE_PATH)) - return (TRUE); + env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, + env_nounset); - if (!nodes_match(imgpath, devpath)) - return (FALSE); + err = probe_fs(filepath); - imgpath = NextDevicePathNode(imgpath); - devpath = NextDevicePathNode(devpath); - } + return (err); +} - return (FALSE); +static bool +check_preferred(EFI_HANDLE *h) +{ + EFI_DEVICE_PATH *path = efi_lookup_devpath(h); + bool out; + + if ((path = efi_lookup_devpath(h)) == NULL) + return (false); + + out = efi_devpath_is_prefix(imgpath, path) || + efi_devpath_is_prefix(imgprefix, path); + + return (out); } -/* - * devpath_last returns the last non-path end node in devpath. - */ -static EFI_DEVICE_PATH * -devpath_last(EFI_DEVICE_PATH *devpath) +bool +efi_zfs_is_preferred(EFI_HANDLE *h) { + return (check_preferred(h)); +} - while (!IsDevicePathEnd(NextDevicePathNode(devpath))) - devpath = NextDevicePathNode(devpath); +static int +load_preferred(EFI_LOADED_IMAGE *img, const char *filepath, void **bufp, + size_t *bufsize, EFI_HANDLE *handlep) +{ + pdinfo_list_t *pdi_list; + pdinfo_t *dp, *pp; + char *devname; - return (devpath); +#ifdef EFI_ZFS_BOOT + /* Did efi_zfs_probe() detect the boot pool? */ + if (pool_guid != 0) { + struct zfs_devdesc currdev; + + currdev.d_dev = &zfs_dev; + currdev.d_unit = 0; + currdev.d_type = currdev.d_dev->dv_type; + currdev.d_opendata = NULL; + currdev.pool_guid = pool_guid; + currdev.root_guid = 0; + devname = efi_fmtdev(&currdev); + + env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, + env_nounset); + + if (probe_fs(filepath) == 0 && + do_load(filepath, bufp, bufsize) == EFI_SUCCESS) { + *handlep = efizfs_get_handle_by_guid(pool_guid); + return (0); + } + } +#endif /* EFI_ZFS_BOOT */ + + /* We have device lists for hd, cd, fd, walk them all. */ + pdi_list = efiblk_get_pdinfo_list(&efipart_hddev); + STAILQ_FOREACH(dp, pdi_list, pd_link) { + struct disk_devdesc currdev; + + currdev.d_dev = &efipart_hddev; + currdev.d_type = currdev.d_dev->dv_type; + currdev.d_unit = dp->pd_unit; + currdev.d_opendata = NULL; + currdev.d_slice = -1; + currdev.d_partition = -1; + devname = efi_fmtdev(&currdev); + + env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, + env_nounset); + + if (check_preferred(dp->pd_handle) && + probe_fs(filepath) == 0 && + do_load(filepath, bufp, bufsize) == EFI_SUCCESS) { + *handlep = dp->pd_handle; + return (0); + } + + /* Assuming GPT partitioning. */ + STAILQ_FOREACH(pp, &dp->pd_part, pd_link) { + if (check_preferred(pp->pd_handle)) { + currdev.d_slice = pp->pd_unit; + currdev.d_partition = 255; + devname = efi_fmtdev(&currdev); + + env_setenv("currdev", EV_VOLATILE, devname, + efi_setcurrdev, env_nounset); + + if (probe_fs(filepath) == 0 && + do_load(filepath, bufp, bufsize) == + EFI_SUCCESS) { + *handlep = pp->pd_handle; + return (0); + } + } + } + } + + pdi_list = efiblk_get_pdinfo_list(&efipart_cddev); + STAILQ_FOREACH(dp, pdi_list, pd_link) { + if ((dp->pd_handle == img->DeviceHandle || + dp->pd_alias == img->DeviceHandle || + check_preferred(dp->pd_handle)) && + probe_dev(&efipart_cddev, dp->pd_unit, filepath) == 0 && + do_load(filepath, bufp, bufsize) == EFI_SUCCESS) { + *handlep = dp->pd_handle; + return (0); + } + } + + pdi_list = efiblk_get_pdinfo_list(&efipart_fddev); + STAILQ_FOREACH(dp, pdi_list, pd_link) { + if ((dp->pd_handle == img->DeviceHandle || + check_preferred(dp->pd_handle)) && + probe_dev(&efipart_cddev, dp->pd_unit, filepath) == 0 && + do_load(filepath, bufp, bufsize) == EFI_SUCCESS) { + *handlep = dp->pd_handle; + return (0); + } + } + + return (ENOENT); } -/* - * load_loader attempts to load the loader image data. - * - * It tries each module and its respective devices, identified by mod->probe, - * in order until a successful load occurs at which point it returns EFI_SUCCESS - * and EFI_NOT_FOUND otherwise. - * - * Only devices which have preferred matching the preferred parameter are tried. - */ -static EFI_STATUS -load_loader(const boot_module_t **modp, dev_info_t **devinfop, void **bufp, - size_t *bufsize, BOOLEAN preferred) +static int +load_all(const char *filepath, void **bufp, size_t *bufsize, + EFI_HANDLE *handlep) { - UINTN i; - dev_info_t *dev; - const boot_module_t *mod; + pdinfo_list_t *pdi_list; + pdinfo_t *dp, *pp; + zfsinfo_list_t *zfsi_list; + zfsinfo_t *zi; + char *devname; - for (i = 0; i < NUM_BOOT_MODULES; i++) { - mod = boot_modules[i]; - for (dev = mod->devices(); dev != NULL; dev = dev->next) { - if (dev->preferred != preferred) - continue; +#ifdef EFI_ZFS_BOOT + zfsi_list = efizfs_get_zfsinfo_list(); + STAILQ_FOREACH(zi, zfsi_list, zi_link) { + struct zfs_devdesc currdev; - if (mod->load(PATH_LOADER_EFI, dev, bufp, bufsize) == - EFI_SUCCESS) { - *devinfop = dev; - *modp = mod; - return (EFI_SUCCESS); + currdev.d_dev = &zfs_dev; + currdev.d_unit = 0; + currdev.d_type = currdev.d_dev->dv_type; + currdev.d_opendata = NULL; + currdev.pool_guid = zi->zi_pool_guid; + currdev.root_guid = 0; + devname = efi_fmtdev(&currdev); + + env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, + env_nounset); + + if (probe_fs(filepath) == 0 && + do_load(filepath, bufp, bufsize) == EFI_SUCCESS) { + *handlep = zi->zi_handle; + + return (0); + } + } +#endif /* EFI_ZFS_BOOT */ + + /* We have device lists for hd, cd, fd, walk them all. */ + pdi_list = efiblk_get_pdinfo_list(&efipart_hddev); + STAILQ_FOREACH(dp, pdi_list, pd_link) { + struct disk_devdesc currdev; + + currdev.d_dev = &efipart_hddev; + currdev.d_type = currdev.d_dev->dv_type; + currdev.d_unit = dp->pd_unit; + currdev.d_opendata = NULL; + currdev.d_slice = -1; + currdev.d_partition = -1; + devname = efi_fmtdev(&currdev); + + env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, + env_nounset); + + if (probe_fs(filepath) == 0 && + do_load(filepath, bufp, bufsize) == EFI_SUCCESS) { + *handlep = dp->pd_handle; + + return (0); + } + + /* Assuming GPT partitioning. */ + STAILQ_FOREACH(pp, &dp->pd_part, pd_link) { + currdev.d_slice = pp->pd_unit; + currdev.d_partition = 255; + devname = efi_fmtdev(&currdev); + + env_setenv("currdev", EV_VOLATILE, devname, + efi_setcurrdev, env_nounset); + + if (probe_fs(filepath) == 0 && + do_load(filepath, bufp, bufsize) == EFI_SUCCESS) { + *handlep = pp->pd_handle; + + return (0); } } } + pdi_list = efiblk_get_pdinfo_list(&efipart_cddev); + STAILQ_FOREACH(dp, pdi_list, pd_link) { + if (probe_dev(&efipart_cddev, dp->pd_unit, filepath) == 0 && + do_load(filepath, bufp, bufsize) == EFI_SUCCESS) { + *handlep = dp->pd_handle; + + return (0); + } + } + + pdi_list = efiblk_get_pdinfo_list(&efipart_fddev); + STAILQ_FOREACH(dp, pdi_list, pd_link) { + if (probe_dev(&efipart_fddev, dp->pd_unit, filepath) == 0 && + do_load(filepath, bufp, bufsize) == EFI_SUCCESS) { + *handlep = dp->pd_handle; + + return (0); + } + } + + return (ENOENT); +} + +static EFI_STATUS +load_loader(EFI_HANDLE *handlep, void **bufp, size_t *bufsize) +{ + /* Try the preferred handles first, then all the handles */ + if (load_preferred(boot_image, PATH_LOADER_EFI, bufp, bufsize, + handlep) == 0) { + return (0); + } + + if (load_all(PATH_LOADER_EFI, bufp, bufsize, handlep) == 0) { + return (0); + } + return (EFI_NOT_FOUND); } @@ -202,20 +497,27 @@ try_boot(void) size_t bufsize, loadersize, cmdsize; void *buf, *loaderbuf; char *cmd; - dev_info_t *dev; - const boot_module_t *mod; + EFI_HANDLE fshandle; EFI_HANDLE loaderhandle; EFI_LOADED_IMAGE *loaded_image; EFI_STATUS status; + EFI_DEVICE_PATH *fspath; - status = load_loader(&mod, &dev, &loaderbuf, &loadersize, TRUE); - if (status != EFI_SUCCESS) { - status = load_loader(&mod, &dev, &loaderbuf, &loadersize, - FALSE); + status = load_loader(&fshandle, &loaderbuf, &loadersize); + + if (status != EFI_SUCCESS) { + return (status); + } + + fspath = NULL; + if (status == EFI_SUCCESS) { + status = BS->OpenProtocol(fshandle, &DevicePathGUID, + (void **)&fspath, IH, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); if (status != EFI_SUCCESS) { - printf("Failed to load '%s'\n", PATH_LOADER_EFI); - return (status); - } + DPRINTF("Failed to get image DevicePath (%lu)\n", + EFI_ERROR_CODE(status)); + } + DPRINTF("filesystem device path: %s\n", devpath_str(fspath)); } /* @@ -230,9 +532,9 @@ try_boot(void) */ cmd = NULL; cmdsize = 0; - status = mod->load(PATH_DOTCONFIG, dev, &buf, &bufsize); + status = do_load(PATH_DOTCONFIG, &buf, &bufsize); if (status == EFI_NOT_FOUND) - status = mod->load(PATH_CONFIG, dev, &buf, &bufsize); + status = do_load(PATH_CONFIG, &buf, &bufsize); if (status == EFI_SUCCESS) { cmdsize = bufsize + 1; cmd = malloc(cmdsize); @@ -244,24 +546,25 @@ try_boot(void) buf = NULL; } - if ((status = BS->LoadImage(TRUE, IH, devpath_last(dev->devpath), + if ((status = BS->LoadImage(TRUE, IH, efi_devpath_last_node(fspath), loaderbuf, loadersize, &loaderhandle)) != EFI_SUCCESS) { - printf("Failed to load image provided by %s, size: %zu, (%lu)\n", - mod->name, loadersize, EFI_ERROR_CODE(status)); + printf("Failed to load image, size: %zu, (%lu)\n", + loadersize, EFI_ERROR_CODE(status)); goto errout; } - if ((status = BS->HandleProtocol(loaderhandle, &LoadedImageGUID, - (VOID**)&loaded_image)) != EFI_SUCCESS) { - printf("Failed to query LoadedImage provided by %s (%lu)\n", - mod->name, EFI_ERROR_CODE(status)); + if ((status = BS->OpenProtocol(loaderhandle, &LoadedImageGUID, + (VOID**)&loaded_image, IH, NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL)) != EFI_SUCCESS) { + printf("Failed to query LoadedImage (%lu)\n", + EFI_ERROR_CODE(status)); goto errout; } if (cmd != NULL) printf(" command args: %s\n", cmd); - loaded_image->DeviceHandle = dev->devhandle; + loaded_image->DeviceHandle = fshandle; loaded_image->LoadOptionsSize = cmdsize; loaded_image->LoadOptions = cmd; @@ -279,8 +582,8 @@ try_boot(void) if ((status = BS->StartImage(loaderhandle, NULL, NULL)) != EFI_SUCCESS) { - printf("Failed to start image provided by %s (%lu)\n", - mod->name, EFI_ERROR_CODE(status)); + printf("Failed to start image (%lu)\n", + EFI_ERROR_CODE(status)); loaded_image->LoadOptionsSize = 0; loaded_image->LoadOptions = NULL; } @@ -296,142 +599,37 @@ errout: return (status); } -/* - * probe_handle determines if the passed handle represents a logical partition - * if it does it uses each module in order to probe it and if successful it - * returns EFI_SUCCESS. - */ -static EFI_STATUS -probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, BOOLEAN *preferred) +EFI_STATUS +main(int argc __unused, CHAR16 *argv[] __unused) { - dev_info_t *devinfo; - EFI_BLOCK_IO *blkio; - EFI_DEVICE_PATH *devpath; - EFI_STATUS status; - UINTN i; + EFI_STATUS status; - /* Figure out if we're dealing with an actual partition. */ - status = BS->HandleProtocol(h, &DevicePathGUID, (void **)&devpath); - if (status == EFI_UNSUPPORTED) - return (status); + SIMPLE_TEXT_OUTPUT_INTERFACE *conout = NULL; + UINTN i, max_dim, best_mode, cols, rows; + CHAR16 *text; - if (status != EFI_SUCCESS) { - DPRINTF("\nFailed to query DevicePath (%lu)\n", - EFI_ERROR_CODE(status)); - return (status); - } -#ifdef EFI_DEBUG - { - CHAR16 *text = efi_devpath_name(devpath); - DPRINTF("probing: %S\n", text); - efi_free_devpath_name(text); - } + archsw.arch_autoload = efi_autoload; + archsw.arch_getdev = efi_getdev; + archsw.arch_copyin = efi_copyin; + archsw.arch_copyout = efi_copyout; + archsw.arch_readin = efi_readin; +#ifdef EFI_ZFS_BOOT + /* Note this needs to be set before ZFS init. */ + archsw.arch_zfs_probe = efi_zfs_probe; #endif - status = BS->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); - if (status == EFI_UNSUPPORTED) - return (status); - if (status != EFI_SUCCESS) { - DPRINTF("\nFailed to query BlockIoProtocol (%lu)\n", - EFI_ERROR_CODE(status)); - return (status); - } + /* Init the time source */ + efi_time_init(); + cons_probe(); - if (!blkio->Media->LogicalPartition) - return (EFI_UNSUPPORTED); - - *preferred = device_paths_match(imgpath, devpath); - - /* Run through each module, see if it can load this partition */ - for (i = 0; i < NUM_BOOT_MODULES; i++) { - devinfo = malloc(sizeof(*devinfo)); - if (devinfo == NULL) { - DPRINTF("\nFailed to allocate devinfo\n"); - continue; - } - devinfo->dev = blkio; - devinfo->devpath = devpath; - devinfo->devhandle = h; - devinfo->devdata = NULL; - devinfo->preferred = *preferred; - devinfo->next = NULL; - - status = boot_modules[i]->probe(devinfo); - if (status == EFI_SUCCESS) - return (EFI_SUCCESS); - free(devinfo); - } - - return (EFI_UNSUPPORTED); -} - -/* - * probe_handle_status calls probe_handle and outputs the returned status - * of the call. - */ -static void -probe_handle_status(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) -{ - EFI_STATUS status; - BOOLEAN preferred; - - preferred = FALSE; - status = probe_handle(h, imgpath, &preferred); - - DPRINTF("probe: "); - switch (status) { - case EFI_UNSUPPORTED: - printf("."); - DPRINTF(" not supported\n"); - break; - case EFI_SUCCESS: - if (preferred) { - printf("%c", '*'); - DPRINTF(" supported (preferred)\n"); - } else { - printf("%c", '+'); - DPRINTF(" supported\n"); - } - break; - default: - printf("x"); - DPRINTF(" error (%lu)\n", EFI_ERROR_CODE(status)); - break; - } - DSTALL(500000); -} - -EFI_STATUS -efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) -{ - EFI_HANDLE *handles; - EFI_LOADED_IMAGE *img; - EFI_DEVICE_PATH *imgpath; - EFI_STATUS status; - EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl = NULL; - SIMPLE_TEXT_OUTPUT_INTERFACE *conout = NULL; - UINTN i, max_dim, best_mode, cols, rows, hsize, nhandles; - CHAR16 *text; - - /* Basic initialization*/ - ST = Xsystab; - IH = Ximage; - BS = ST->BootServices; - RS = ST->RuntimeServices; - - /* Set up the console, so printf works. */ - status = BS->LocateProtocol(&ConsoleControlGUID, NULL, - (VOID **)&ConsoleControl); - if (status == EFI_SUCCESS) - (void)ConsoleControl->SetMode(ConsoleControl, - EfiConsoleControlScreenText); /* * Reset the console and find the best text mode. */ conout = ST->ConOut; conout->Reset(conout, TRUE); max_dim = best_mode = 0; - for (i = 0; ; i++) { + + for (i = 0; ; i++) { status = conout->QueryMode(conout, i, &cols, &rows); if (EFI_ERROR(status)) break; @@ -440,31 +638,37 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) best_mode = i; } } - if (max_dim > 0) + + if (max_dim > 0) conout->SetMode(conout, best_mode); + conout->EnableCursor(conout, TRUE); conout->ClearScreen(conout); + /* Print this here, so people know it's at least starting. */ printf("\n>> FreeBSD EFI boot block\n"); printf(" Loader path: %s\n\n", PATH_LOADER_EFI); - printf(" Initializing modules:"); - for (i = 0; i < NUM_BOOT_MODULES; i++) { - printf(" %s", boot_modules[i]->name); - if (boot_modules[i]->init != NULL) - boot_modules[i]->init(); + + /* Get the image path and trim it to get the disk on which we + * found this loader. + */ + if ((status = BS->OpenProtocol(IH, &LoadedImageGUID, + (VOID**)&boot_image, IH, NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL)) != EFI_SUCCESS) { + panic("Failed to query LoadedImage (%lu)\n", + EFI_ERROR_CODE(status)); } - putchar('\n'); /* Determine the devpath of our image so we can prefer it. */ - status = BS->HandleProtocol(IH, &LoadedImageGUID, (VOID**)&img); + status = BS->HandleProtocol(IH, &LoadedImageGUID, (VOID**)&boot_image); imgpath = NULL; if (status == EFI_SUCCESS) { - text = efi_devpath_name(img->FilePath); + text = efi_devpath_name(boot_image->FilePath); printf(" Load Path: %S\n", text); efi_setenv_freebsd_wcs("Boot1Path", text); efi_free_devpath_name(text); - status = BS->HandleProtocol(img->DeviceHandle, &DevicePathGUID, + status = BS->HandleProtocol(boot_image->DeviceHandle, &DevicePathGUID, (void **)&imgpath); if (status != EFI_SUCCESS) { DPRINTF("Failed to get image DevicePath (%lu)\n", @@ -478,49 +682,36 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) } - /* Get all the device handles */ - hsize = (UINTN)NUM_HANDLES_INIT * sizeof(EFI_HANDLE); - handles = malloc(hsize); - if (handles == NULL) { - printf("Failed to allocate %d handles\n", NUM_HANDLES_INIT); - } + /* The loaded image device path ends with a partition, then a + * file path. Trim them both to get the actual disk. + */ + if ((imgprefix = efi_devpath_trim(imgpath)) == NULL || + (imgprefix = efi_devpath_trim(imgprefix)) == NULL) { + panic("Couldn't trim device path"); + } - status = BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, - &hsize, handles); - switch (status) { - case EFI_SUCCESS: - break; - case EFI_BUFFER_TOO_SMALL: - free(handles); - handles = malloc(hsize); - if (handles == NULL) - efi_panic(EFI_OUT_OF_RESOURCES, "Failed to allocate %d handles\n", - NUM_HANDLES_INIT); - status = BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, - NULL, &hsize, handles); - if (status != EFI_SUCCESS) - efi_panic(status, "Failed to get device handles\n"); - break; - default: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Sun Feb 11 20:06:37 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A776F138BB; Sun, 11 Feb 2018 20:06:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1BE5A68A84; Sun, 11 Feb 2018 20:06:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16E7E278E5; Sun, 11 Feb 2018 20:06:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1BK6axf021678; Sun, 11 Feb 2018 20:06:36 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1BK6a5f021674; Sun, 11 Feb 2018 20:06:36 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802112006.w1BK6a5f021674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 11 Feb 2018 20:06:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329136 - in stable/11/sys/boot: . common efi/libefi ficl X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/sys/boot: . common efi/libefi ficl X-SVN-Commit-Revision: 329136 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 20:06:37 -0000 Author: kevans Date: Sun Feb 11 20:06:36 2018 New Revision: 329136 URL: https://svnweb.freebsd.org/changeset/base/329136 Log: MFC r324648: Rename top level Makefile.ficl to ficl.mk. Added: stable/11/sys/boot/ficl.mk - copied unchanged from r329135, stable/11/sys/boot/Makefile.ficl Deleted: stable/11/sys/boot/Makefile.ficl Modified: stable/11/sys/boot/common/Makefile.inc stable/11/sys/boot/efi/libefi/Makefile stable/11/sys/boot/ficl/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/common/Makefile.inc ============================================================================== --- stable/11/sys/boot/common/Makefile.inc Sun Feb 11 20:04:34 2018 (r329135) +++ stable/11/sys/boot/common/Makefile.inc Sun Feb 11 20:06:36 2018 (r329136) @@ -66,7 +66,7 @@ SRCS+= pnp.c # Forth interpreter .if defined(BOOT_FORTH) SRCS+= interp_forth.c -.include "${SRCTOP}/sys/boot/Makefile.ficl" +.include "../ficl.mk" .endif .if defined(BOOT_PROMPT_123) Modified: stable/11/sys/boot/efi/libefi/Makefile ============================================================================== --- stable/11/sys/boot/efi/libefi/Makefile Sun Feb 11 20:04:34 2018 (r329135) +++ stable/11/sys/boot/efi/libefi/Makefile Sun Feb 11 20:06:36 2018 (r329136) @@ -4,7 +4,7 @@ .if ${MK_FORTH} != "no" CFLAGS+= -DBOOT_FORTH -.include "${.CURDIR}/../../Makefile.ficl" +.include "../../ficl.mk" .endif LIB= efi Copied: stable/11/sys/boot/ficl.mk (from r329135, stable/11/sys/boot/Makefile.ficl) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/boot/ficl.mk Sun Feb 11 20:06:36 2018 (r329136, copy of r329135, stable/11/sys/boot/Makefile.ficl) @@ -0,0 +1,43 @@ +# $FreeBSD$ + +# Common flags to build FICL related files + +FICLDIR?= ${SRCTOP}/sys/boot/ficl + +.if ${MACHINE_CPUARCH} == "amd64" && defined(FICL32) +FICL_CPUARCH= i386 +.elif ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el" +FICL_CPUARCH= mips64 +.else +FICL_CPUARCH= ${MACHINE_CPUARCH} +.endif + +.PATH: ${FICLDIR} ${FICLDIR}/${FICL_CPUARCH} + +.if ${MACHINE_CPUARCH} == "amd64" +.if defined(FICL32) +CFLAGS+= -m32 -I. +.else +CFLAGS+= -fPIC +.endif +.endif + +.if ${MACHINE_ARCH} == "powerpc64" +CFLAGS+= -m32 -mcpu=powerpc -I. +.endif + +CFLAGS+= -I${FICLDIR} -I${FICLDIR}/${FICL_CPUARCH} \ + -I${FICLDIR}/../common + +.if ${MACHINE_CPUARCH} == "amd64" && defined(FICL32) +.if !exists(machine) +${SRCS:M*.c:R:S/$/.o/g}: machine + +beforedepend ${OBJS}: machine +.endif + +machine: .NOMETA + ln -sf ${.CURDIR}/../../i386/include machine + +CLEANFILES+= machine +.endif Modified: stable/11/sys/boot/ficl/Makefile ============================================================================== --- stable/11/sys/boot/ficl/Makefile Sun Feb 11 20:04:34 2018 (r329135) +++ stable/11/sys/boot/ficl/Makefile Sun Feb 11 20:06:36 2018 (r329136) @@ -1,7 +1,7 @@ # $FreeBSD$ # -.include "${.CURDIR}/../Makefile.ficl" +.include "../ficl.mk" BASE_SRCS= dict.c ficl.c fileaccess.c float.c loader.c math64.c \ prefix.c search.c stack.c tools.c vm.c words.c From owner-svn-src-stable-11@freebsd.org Sun Feb 11 20:35:15 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62C17F15E86; Sun, 11 Feb 2018 20:35:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0C1BE69EE7; Sun, 11 Feb 2018 20:35:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD92A27DD5; Sun, 11 Feb 2018 20:35:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1BKZEok036828; Sun, 11 Feb 2018 20:35:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1BKZEJP036827; Sun, 11 Feb 2018 20:35:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802112035.w1BKZEJP036827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 11 Feb 2018 20:35:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329138 - stable/11/sys/boot/libsa X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/boot/libsa X-SVN-Commit-Revision: 329138 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 20:35:15 -0000 Author: kevans Date: Sun Feb 11 20:35:14 2018 New Revision: 329138 URL: https://svnweb.freebsd.org/changeset/base/329138 Log: Fix paths after r329132 This is a direct commit to stable/11 due to svn's handling of merging this move being less than ideal. Modified: stable/11/sys/boot/libsa/Makefile Modified: stable/11/sys/boot/libsa/Makefile ============================================================================== --- stable/11/sys/boot/libsa/Makefile Sun Feb 11 20:15:47 2018 (r329137) +++ stable/11/sys/boot/libsa/Makefile Sun Feb 11 20:35:14 2018 (r329138) @@ -14,13 +14,10 @@ MK_SSP= no LIBSTAND_SRC?= ${.CURDIR} LIBSTAND_CPUARCH?=${MACHINE_CPUARCH} -LIBC_SRC= ${LIBSTAND_SRC}/../libc +LIBC_SRC= ${SRCTOP_LIBC}/../libc LIB?= sa NO_PIC= -INCS?= stand.h -MAN?= libstand.3 - WARNS?= 0 CFLAGS+= -I${LIBSTAND_SRC} @@ -58,14 +55,14 @@ CFLAGS.clang+= -mno-movt CFLAGS.clang+= -mfpu=none # Compiler support functions -.PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/ +.PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins/ # __clzsi2 and ctzsi2 for various builtin functions SRCS+= clzsi2.c ctzsi2.c # Divide and modulus functions called by the compiler SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c -.PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/arm/ +.PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins/arm/ SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S .endif @@ -91,7 +88,7 @@ SRCS+= _setjmp.S # decompression functionality from libbz2 # NOTE: to actually test this functionality after libbz2 upgrade compile # loader(8) with LOADER_BZIP2_SUPPORT defined -.PATH: ${LIBSTAND_SRC}/../../contrib/bzip2 +.PATH: ${SRCTOP}/contrib/bzip2 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS SRCS+= libstand_bzlib_private.h @@ -110,7 +107,7 @@ libstand_bzlib_private.h: bzlib_private.h ${.ALLSRC} > ${.TARGET} # decompression functionality from zlib -.PATH: ${LIBSTAND_SRC}/../../contrib/zlib +.PATH: ${SRCTOP}/contrib/zlib CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../../contrib/zlib SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h From owner-svn-src-stable-11@freebsd.org Sun Feb 11 20:58:03 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF9F3F17818; Sun, 11 Feb 2018 20:58:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 70F1A6AC33; Sun, 11 Feb 2018 20:58:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B8A7139; Sun, 11 Feb 2018 20:58:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1BKw2dd046864; Sun, 11 Feb 2018 20:58:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1BKw0xv046842; Sun, 11 Feb 2018 20:58:00 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802112058.w1BKw0xv046842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 11 Feb 2018 20:58:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329140 - in stable/11: . share/mk sys/arm/include sys/arm64/include sys/boot sys/boot/arm/at91 sys/boot/arm/at91/boot0 sys/boot/arm/at91/boot0iic sys/boot/arm/at91/boot0spi sys/boot/ar... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: . share/mk sys/arm/include sys/arm64/include sys/boot sys/boot/arm/at91 sys/boot/arm/at91/boot0 sys/boot/arm/at91/boot0iic sys/boot/arm/at91/boot0spi sys/boot/arm/at91/boot2 sys/boot/arm... X-SVN-Commit-Revision: 329140 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 20:58:03 -0000 Author: kevans Date: Sun Feb 11 20:58:00 2018 New Revision: 329140 URL: https://svnweb.freebsd.org/changeset/base/329140 Log: MFC Loader Fixes 2017q4p6: r324649,r324650,r324651,r324652,r324653,r324654, r324700,r324702,r324709,r324717,r324719,r324841,r324842,r324843,r324845, r324850,r324876,r324877,r324878,r324879,r324880,r324881,r324883,r324980, r324981,r324982,r324995,r325014,r325093,r325094,r325114,r325170,r325171, r325172,r325173,r325174,r325175,r325176,r325248,r325286,r325310,r325332, r325338,r325339,r325376,r325377,r325379,r325380,r325382,r325478,r325479, r325480,r325482,r325483,r325484,r325485,r325556,r325641,r325681,r325685, r325686,r325687,r325688,r325689,r325690,r325691,r325692,r325693,r325694, r325743,r325744,r325748,r325775,r325779,r325780 r324649: Move common/Makefile.inc to sys/boot/loader.mk. r324650: tweak style r324651: create defs.mk for common definitions r324652: Move all the ficl common code into ficl.mk r324653: LOADER_foo_SUPPORTED r324654: Explicitly inlcude SYSDIR in the include path r324700: loader: initialize dv_cleanup in md.c to eliminate clang warning r324702: We need to include disk.o in libuboot.a when we're building with support for disk access. r324709: Revert "Unify boot1 with loader" change r324646 r324717: libsa/ip.c: misplaced comment, ip_v is half char, not ip_p r324719: libsa/ip: stop read loop on bad fragments r324841: Use BOOTDIR more consistently in defs.mk rather than repeat sys/boot. r324842: Introduce BOOTOBJ: The top level object directory for the boot tree r324843: Stopgap fix to the mistmatch between LOADER_GELI_SUPPORT and LOADER_NO_GELI_SUPPORT. r324845: Use BOOTOBJ and BOOTDIR to find geli includes and libraries. r324850: Define LIBSA32 to LIBSA on i386 to fix build. r324876: Move fdt and uboot defines into common uboot.mk. r324877: End source directories with SRC rather than a hodgepodge of names r324878: Make at91 boot loader compile again. r324879: Prefer SRCTOP paths for bits we're grabbing from libc. r324880: Use BOOTSRC here. r324881: Use SYSDIR instead of ${.CURDIR}/../../sys. r324883: Use preferred defined paths, rather than relative paths in fdt. r324980: Use BOOTDIR consistently. r324981: Move BINDIR definition to defs.mk, and override where it isn't /boot r324982: Remove sys/boot/arm/at91 and ixp425 r324995: loader.efi: Make framebuffer commands available for arm64 r325014: Add a 'place holder' arm struct efi_fb until a real one comes r325093: Define new EFI variables r325094: Cleanup non-arch Makefiles r325114: Use defs.mk defins in most MD code r325170: Use defs.mk values for userboot r325171: Use defs.mk name and prefer bsd.init.mk r325172: Remove the -nostdlib stuff I added. Instead, fix LDFLAGS to be honored correctly with the new Makefile.inc include order. r325173: We don't need to build a special ficl for userboot. r325174: Minor cleanup r325175: For amd64, compile both zfs and zfs32 libraries. r325176: Actually add zfs32/Makefile r325248: loader ptblread() is broken with >512B sectors r325286: efipart_strategy is using wrong offset with >512B sectors r325310: zfs.c:vdev_read() needs to be careful about large sectors r325332: loader: re-enable gzip support for x86 r325338: loader: fix BOOTSRC -> BOOTOBJ in a library path r325339: This used to have bzip2 support too. r325376: WIP: centralize machine links r325377: mostly libsa r325379: Revert "mostly libsa" r325380: Revert "WIP: centralize machine links" r325382: Cleanup stray libstand names to be libsa names. r325478: Powerpc is a 32-bit boot loader. r325479: Define LIBFICL32 to be libficl.a on i386 and libficl32.a on amd64. r325480: Use DO32 for all the places that we need to flag we're building a 32-bit version of a library. r325482: Move machine and other link creation to defs.mk r325483: MACHINE can never be powerpc64, so cleanup code that thinks it can. r325484: Prefer bsd.init.mk to src.opts.mk r325485: Centralize all 32-bit builds on 64-bit platform stuff. r325556: loader: set options before including bsd.init.mk r325641: loader.efi: efi_devpath_is_prefix should return bool r325681: boot1: avoid using NULL device path r325685: libsa32 isn't needed for i386. It's already a 32-bit platform. r325686: Simplify this if to a direct assignment. r325687: Remove all the empty help files from the powerpc build. r325688: FDT support doesn't make sense for ps3, remove it. r325689: Remove LOADER_FDT_SUPPORT as a Makefile variable. r325690: Remove LOADER_ZFS_SUPPORT as a Makefile variable r325691: Remove useless PNP define here. r325692: Replace LOADER_FIREWIRE_SUPPORT variable r325693: Move LOADER_{NO,}_GELI_SUPPORT to MK_LOADER_GELI r325694: Install the 4th files in sys/boot/forth instead of each loader r325743: Make sure the proper loader.rc gets installed. r325744: boot1: also check for NULL device r325748: Use proper include file. r325775: Add loader.conf to the list of files that are MD. r325779: Add /boot/dts to the list of default modules. r325780: Don't add /boot/dt*s* but /boot/dt*b*. Stupid think-o. Added: stable/11/sys/boot/arm/loader/ - copied from r325775, head/sys/boot/arm/loader/ stable/11/sys/boot/defs.mk - copied, changed from r324654, head/sys/boot/defs.mk stable/11/sys/boot/efi/boot1/boot_module.h - copied unchanged from r324709, head/sys/boot/efi/boot1/boot_module.h stable/11/sys/boot/efi/boot1/ufs_module.c - copied unchanged from r324709, head/sys/boot/efi/boot1/ufs_module.c stable/11/sys/boot/efi/boot1/zfs_module.c - copied unchanged from r324709, head/sys/boot/efi/boot1/zfs_module.c stable/11/sys/boot/efi/loader/efi_main.c - copied unchanged from r324709, head/sys/boot/efi/loader/efi_main.c stable/11/sys/boot/efi/loader/framebuffer.c - copied unchanged from r324995, head/sys/boot/efi/loader/framebuffer.c stable/11/sys/boot/efi/loader/framebuffer.h - copied unchanged from r324995, head/sys/boot/efi/loader/framebuffer.h stable/11/sys/boot/fdt.mk - copied unchanged from r325689, head/sys/boot/fdt.mk stable/11/sys/boot/loader.mk - copied, changed from r329139, stable/11/sys/boot/common/Makefile.inc stable/11/sys/boot/uboot.mk - copied, changed from r324881, head/sys/boot/uboot.mk stable/11/sys/boot/zfs32/ - copied from r325176, head/sys/boot/zfs32/ stable/11/tools/build/options/WITHOUT_LOADER_GEIL - copied unchanged from r325693, head/tools/build/options/WITHOUT_LOADER_GEIL stable/11/tools/build/options/WITH_LOADER_FIREWIRE - copied unchanged from r325692, head/tools/build/options/WITH_LOADER_FIREWIRE Replaced: stable/11/sys/boot/arm/loader/loader.conf - copied unchanged from r329139, stable/11/sys/boot/arm/uboot/loader.conf Deleted: stable/11/sys/boot/arm/at91/Makefile stable/11/sys/boot/arm/at91/Makefile.inc stable/11/sys/boot/arm/at91/boot0/Makefile stable/11/sys/boot/arm/at91/boot0/README stable/11/sys/boot/arm/at91/boot0/linker.cfg stable/11/sys/boot/arm/at91/boot0/main.c stable/11/sys/boot/arm/at91/boot0iic/Makefile stable/11/sys/boot/arm/at91/boot0iic/main.c stable/11/sys/boot/arm/at91/boot0spi/Makefile stable/11/sys/boot/arm/at91/boot0spi/main.c stable/11/sys/boot/arm/at91/boot2/Makefile stable/11/sys/boot/arm/at91/boot2/board.h stable/11/sys/boot/arm/at91/boot2/boot2.c stable/11/sys/boot/arm/at91/boot2/bwct_board.c stable/11/sys/boot/arm/at91/boot2/centipad_board.c stable/11/sys/boot/arm/at91/boot2/kb920x_board.c stable/11/sys/boot/arm/at91/bootiic/Makefile stable/11/sys/boot/arm/at91/bootiic/README stable/11/sys/boot/arm/at91/bootiic/env_vars.c stable/11/sys/boot/arm/at91/bootiic/env_vars.h stable/11/sys/boot/arm/at91/bootiic/loader_prompt.c stable/11/sys/boot/arm/at91/bootiic/loader_prompt.h stable/11/sys/boot/arm/at91/bootiic/main.c stable/11/sys/boot/arm/at91/bootspi/Makefile stable/11/sys/boot/arm/at91/bootspi/README stable/11/sys/boot/arm/at91/bootspi/ee.c stable/11/sys/boot/arm/at91/bootspi/ee.h stable/11/sys/boot/arm/at91/bootspi/env_vars.c stable/11/sys/boot/arm/at91/bootspi/env_vars.h stable/11/sys/boot/arm/at91/bootspi/loader_prompt.c stable/11/sys/boot/arm/at91/bootspi/loader_prompt.h stable/11/sys/boot/arm/at91/bootspi/main.c stable/11/sys/boot/arm/at91/libat91/Makefile stable/11/sys/boot/arm/at91/libat91/arm_init.S stable/11/sys/boot/arm/at91/libat91/at91rm9200.h stable/11/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.c stable/11/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.h stable/11/sys/boot/arm/at91/libat91/delay.c stable/11/sys/boot/arm/at91/libat91/eeprom.c stable/11/sys/boot/arm/at91/libat91/emac.c stable/11/sys/boot/arm/at91/libat91/emac.h stable/11/sys/boot/arm/at91/libat91/emac_init.c stable/11/sys/boot/arm/at91/libat91/getc.c stable/11/sys/boot/arm/at91/libat91/lib.h stable/11/sys/boot/arm/at91/libat91/lib_AT91RM9200.h stable/11/sys/boot/arm/at91/libat91/mci_device.h stable/11/sys/boot/arm/at91/libat91/memcmp.c stable/11/sys/boot/arm/at91/libat91/memcpy.c stable/11/sys/boot/arm/at91/libat91/memset.c stable/11/sys/boot/arm/at91/libat91/p_string.c stable/11/sys/boot/arm/at91/libat91/printf.c stable/11/sys/boot/arm/at91/libat91/putchar.c stable/11/sys/boot/arm/at91/libat91/reset.c stable/11/sys/boot/arm/at91/libat91/sd-card.c stable/11/sys/boot/arm/at91/libat91/sd-card.h stable/11/sys/boot/arm/at91/libat91/spi_flash.c stable/11/sys/boot/arm/at91/libat91/spi_flash.h stable/11/sys/boot/arm/at91/libat91/strcmp.c stable/11/sys/boot/arm/at91/libat91/strcpy.c stable/11/sys/boot/arm/at91/libat91/strcvt.c stable/11/sys/boot/arm/at91/libat91/strlen.c stable/11/sys/boot/arm/at91/libat91/tag_list.c stable/11/sys/boot/arm/at91/libat91/tag_list.h stable/11/sys/boot/arm/at91/libat91/xmodem.c stable/11/sys/boot/arm/at91/linker.cfg stable/11/sys/boot/arm/ixp425/Makefile.inc stable/11/sys/boot/arm/ixp425/boot2/Makefile stable/11/sys/boot/arm/ixp425/boot2/arm_init.S stable/11/sys/boot/arm/ixp425/boot2/boot2.c stable/11/sys/boot/arm/ixp425/boot2/cf_ata.h stable/11/sys/boot/arm/ixp425/boot2/ixp425_board.c stable/11/sys/boot/arm/ixp425/boot2/lib.h stable/11/sys/boot/arm/uboot/loader.conf stable/11/sys/boot/common/Makefile.inc stable/11/sys/boot/efi/libefi/efi_main.c stable/11/sys/boot/efi/loader/arch/amd64/framebuffer.c stable/11/sys/boot/efi/loader/arch/amd64/framebuffer.h stable/11/sys/boot/forth/Makefile.inc stable/11/sys/boot/powerpc/kboot/help.kboot stable/11/sys/boot/powerpc/ofw/help.ofw stable/11/sys/boot/powerpc/ps3/help.ps3 stable/11/sys/boot/powerpc/uboot/help.uboot stable/11/sys/boot/uboot/common/Makefile.inc stable/11/sys/boot/userboot/ficl/Makefile stable/11/sys/boot/userboot/ficl/Makefile.depend stable/11/sys/boot/userboot/zfs/Makefile stable/11/sys/boot/userboot/zfs/Makefile.depend Modified: stable/11/UPDATING stable/11/share/mk/src.opts.mk stable/11/sys/arm/include/metadata.h stable/11/sys/arm64/include/metadata.h stable/11/sys/boot/Makefile stable/11/sys/boot/Makefile.amd64 stable/11/sys/boot/Makefile.arm stable/11/sys/boot/Makefile.arm64 stable/11/sys/boot/Makefile.i386 stable/11/sys/boot/Makefile.inc stable/11/sys/boot/Makefile.powerpc stable/11/sys/boot/Makefile.sparc64 stable/11/sys/boot/arm/uboot/Makefile stable/11/sys/boot/common/disk.c stable/11/sys/boot/common/md.c stable/11/sys/boot/efi/Makefile stable/11/sys/boot/efi/Makefile.inc stable/11/sys/boot/efi/boot1/Makefile stable/11/sys/boot/efi/boot1/boot1.c stable/11/sys/boot/efi/fdt/Makefile stable/11/sys/boot/efi/include/efilib.h stable/11/sys/boot/efi/libefi/Makefile stable/11/sys/boot/efi/libefi/devpath.c stable/11/sys/boot/efi/libefi/efipart.c stable/11/sys/boot/efi/loader/Makefile stable/11/sys/boot/efi/loader/arch/amd64/Makefile.inc stable/11/sys/boot/efi/loader/arch/arm/Makefile.inc stable/11/sys/boot/efi/loader/arch/arm64/Makefile.inc stable/11/sys/boot/efi/loader/arch/i386/Makefile.inc stable/11/sys/boot/efi/loader/bootinfo.c stable/11/sys/boot/fdt/Makefile stable/11/sys/boot/ficl.mk stable/11/sys/boot/ficl/Makefile stable/11/sys/boot/ficl32/Makefile stable/11/sys/boot/forth/Makefile stable/11/sys/boot/forth/loader.conf stable/11/sys/boot/geli/Makefile stable/11/sys/boot/i386/Makefile stable/11/sys/boot/i386/Makefile.inc stable/11/sys/boot/i386/boot0/Makefile stable/11/sys/boot/i386/boot2/Makefile stable/11/sys/boot/i386/btx/btx/Makefile stable/11/sys/boot/i386/btx/btxldr/Makefile stable/11/sys/boot/i386/btx/lib/Makefile stable/11/sys/boot/i386/cdboot/Makefile stable/11/sys/boot/i386/gptboot/Makefile stable/11/sys/boot/i386/gptzfsboot/Makefile stable/11/sys/boot/i386/kgzldr/Makefile stable/11/sys/boot/i386/libfirewire/Makefile stable/11/sys/boot/i386/libi386/Makefile stable/11/sys/boot/i386/loader/Makefile stable/11/sys/boot/i386/mbr/Makefile stable/11/sys/boot/i386/pmbr/Makefile stable/11/sys/boot/i386/pxeldr/Makefile stable/11/sys/boot/i386/zfsboot/Makefile stable/11/sys/boot/i386/zfsloader/Makefile stable/11/sys/boot/libsa/Makefile stable/11/sys/boot/libsa/ip.c stable/11/sys/boot/libsa32/Makefile stable/11/sys/boot/man/Makefile stable/11/sys/boot/mips/beri/Makefile.inc stable/11/sys/boot/mips/beri/boot2/Makefile stable/11/sys/boot/mips/beri/loader/Makefile stable/11/sys/boot/mips/uboot/Makefile stable/11/sys/boot/ofw/Makefile.inc stable/11/sys/boot/ofw/libofw/Makefile stable/11/sys/boot/powerpc/Makefile stable/11/sys/boot/powerpc/Makefile.inc stable/11/sys/boot/powerpc/boot1.chrp/Makefile stable/11/sys/boot/powerpc/kboot/Makefile stable/11/sys/boot/powerpc/ofw/Makefile stable/11/sys/boot/powerpc/ps3/Makefile stable/11/sys/boot/powerpc/uboot/Makefile stable/11/sys/boot/sparc64/Makefile stable/11/sys/boot/sparc64/Makefile.inc stable/11/sys/boot/sparc64/boot1/Makefile stable/11/sys/boot/sparc64/loader/Makefile stable/11/sys/boot/sparc64/zfsloader/Makefile stable/11/sys/boot/uboot/Makefile stable/11/sys/boot/uboot/Makefile.inc stable/11/sys/boot/uboot/fdt/Makefile stable/11/sys/boot/uboot/lib/Makefile stable/11/sys/boot/userboot/Makefile stable/11/sys/boot/userboot/test/Makefile stable/11/sys/boot/userboot/test/test.c stable/11/sys/boot/userboot/userboot/Makefile stable/11/sys/boot/zfs/Makefile stable/11/sys/boot/zfs/zfs.c stable/11/sys/boot/zfs32/Makefile stable/11/tools/boot/universe.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/UPDATING ============================================================================== --- stable/11/UPDATING Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/UPDATING Sun Feb 11 20:58:00 2018 (r329140) @@ -16,6 +16,11 @@ from older versions of FreeBSD, try WITHOUT_CLANG and the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20180211: + The LOADER_FIREWIRE_SUPPORT build variable as been renamed to + WITH/OUT_LOADER_FIREWIRE. LOADER_{NO_,}GELI_SUPPORT has been renamed + to WITH/OUT_LOADER_GELI. + 20180210: The geli password typed at boot is now hidden. To restore the previous behavior, see geli(8) for configuration options. Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/share/mk/src.opts.mk Sun Feb 11 20:58:00 2018 (r329140) @@ -123,6 +123,7 @@ __DEFAULT_YES_OPTIONS = \ LIB32 \ LIBPTHREAD \ LIBTHR \ + LOADER_GELI \ LOCALES \ LOCATE \ LPR \ @@ -188,6 +189,7 @@ __DEFAULT_NO_OPTIONS = \ HESIOD \ LIBSOFT \ LINT \ + LOADER_FIREWIRE \ LOADER_FORCE_LE \ NAND \ OFED \ Modified: stable/11/sys/arm/include/metadata.h ============================================================================== --- stable/11/sys/arm/include/metadata.h Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/arm/include/metadata.h Sun Feb 11 20:58:00 2018 (r329140) @@ -39,4 +39,19 @@ struct efi_map_header { uint32_t descriptor_version; }; +/* + * Placeholder for now + */ +struct efi_fb { + uint64_t fb_addr; + uint64_t fb_size; + uint32_t fb_height; + uint32_t fb_width; + uint32_t fb_stride; + uint32_t fb_mask_red; + uint32_t fb_mask_green; + uint32_t fb_mask_blue; + uint32_t fb_mask_reserved; +}; + #endif /* !_MACHINE_METADATA_H_ */ Modified: stable/11/sys/arm64/include/metadata.h ============================================================================== --- stable/11/sys/arm64/include/metadata.h Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/arm64/include/metadata.h Sun Feb 11 20:58:00 2018 (r329140) @@ -31,11 +31,24 @@ #define MODINFOMD_EFI_MAP 0x1001 #define MODINFOMD_DTBP 0x1002 +#define MODINFOMD_EFI_FB 0x1003 struct efi_map_header { size_t memory_size; size_t descriptor_size; uint32_t descriptor_version; +}; + +struct efi_fb { + uint64_t fb_addr; + uint64_t fb_size; + uint32_t fb_height; + uint32_t fb_width; + uint32_t fb_stride; + uint32_t fb_mask_red; + uint32_t fb_mask_green; + uint32_t fb_mask_blue; + uint32_t fb_mask_reserved; }; #endif /* !_MACHINE_METADATA_H_ */ Modified: stable/11/sys/boot/Makefile ============================================================================== --- stable/11/sys/boot/Makefile Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/boot/Makefile Sun Feb 11 20:58:00 2018 (r329140) @@ -13,10 +13,8 @@ SUBDIR+= man .include -# Pick the machine-dependent subdir based on the target architecture. -ADIR= ${MACHINE:S/powerpc64/powerpc/} -.if exists(${.CURDIR}/${ADIR}/.) -SUBDIR+= ${ADIR} +.if exists(${.CURDIR}/${MACHINE}/.) +SUBDIR+= ${MACHINE} .endif .include Modified: stable/11/sys/boot/Makefile.amd64 ============================================================================== --- stable/11/sys/boot/Makefile.amd64 Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/boot/Makefile.amd64 Sun Feb 11 20:58:00 2018 (r329140) @@ -1,16 +1,18 @@ # $FreeBSD$ -SUBDIR+= efi SUBDIR+= libsa32 -SUBDIR+= zfs -SUBDIR+= userboot - -.if !defined(LOADER_NO_GELI_SUPPORT) -SUBDIR+= geli +.if ${MK_ZFS} != "no" +SUBDIR+= zfs zfs32 .endif - .if ${MK_FORTH} != "no" SUBDIR+= ficl32 +.endif + +SUBDIR+= efi +SUBDIR+= userboot + +.if ${LOADER_GELI_SUPPORT:Uyes} == "yes" +SUBDIR+= geli .endif SUBDIR+= i386 Modified: stable/11/sys/boot/Makefile.arm ============================================================================== --- stable/11/sys/boot/Makefile.arm Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/boot/Makefile.arm Sun Feb 11 20:58:00 2018 (r329140) @@ -3,5 +3,8 @@ .if ${MK_FDT} != "no" SUBDIR+= fdt .endif +.if ${MK_ZFS} != "no" +SUBDIR+= zfs +.endif SUBDIR+= efi uboot Modified: stable/11/sys/boot/Makefile.arm64 ============================================================================== --- stable/11/sys/boot/Makefile.arm64 Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/boot/Makefile.arm64 Sun Feb 11 20:58:00 2018 (r329140) @@ -3,5 +3,8 @@ .if ${MK_FDT} != "no" SUBDIR+= fdt .endif +.if ${MK_ZFS} != "no" +SUBDIR+= zfs +.endif SUBDIR+= efi Modified: stable/11/sys/boot/Makefile.i386 ============================================================================== --- stable/11/sys/boot/Makefile.i386 Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/boot/Makefile.i386 Sun Feb 11 20:58:00 2018 (r329140) @@ -1,9 +1,10 @@ # $FreeBSD$ -SUBDIR+= efi -SUBDIR+= libsa32 -SUBDIR+= zfs - -.if !defined(LOADER_NO_GELI_SUPPORT) +.if ${LOADER_GELI_SUPPORT:Uyes} == "yes" SUBDIR+= geli .endif +.if ${MK_ZFS} != "no" +SUBDIR+= zfs +.endif + +SUBDIR+= efi Modified: stable/11/sys/boot/Makefile.inc ============================================================================== --- stable/11/sys/boot/Makefile.inc Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/boot/Makefile.inc Sun Feb 11 20:58:00 2018 (r329140) @@ -1,15 +1,9 @@ # $FreeBSD$ -.include +.include "defs.mk" .if !defined(__BOOT_MAKEFILE_INC__) __BOOT_MAKEFILE_INC__=${MFILE} - -SASRC=${SRCTOP}/sys/boot/libsa -# Normal Standalone library -LIBSA=${OBJTOP}/sys/boot/libsa/libsa.a -# Standalone library compiled for 32-bit version of the processor -LIBSA32=${OBJTOP}/sys/boot/libsa32/libsa32.a CFLAGS+=-I${SASRC} Modified: stable/11/sys/boot/Makefile.powerpc ============================================================================== --- stable/11/sys/boot/Makefile.powerpc Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/boot/Makefile.powerpc Sun Feb 11 20:58:00 2018 (r329140) @@ -4,6 +4,5 @@ SUBDIR+= fdt .endif -SUBDIR+= libsa32 SUBDIR+= ofw SUBDIR+= uboot Modified: stable/11/sys/boot/Makefile.sparc64 ============================================================================== --- stable/11/sys/boot/Makefile.sparc64 Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/boot/Makefile.sparc64 Sun Feb 11 20:58:00 2018 (r329140) @@ -1,4 +1,6 @@ # $FreeBSD$ SUBDIR+= ofw +.if ${MK_ZFS} != "no" SUBDIR+= zfs +.endif Copied: stable/11/sys/boot/arm/loader/loader.conf (from r329139, stable/11/sys/boot/arm/uboot/loader.conf) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/boot/arm/loader/loader.conf Sun Feb 11 20:58:00 2018 (r329140, copy of r329139, stable/11/sys/boot/arm/uboot/loader.conf) @@ -0,0 +1,13 @@ +# This is defaults/loader.conf for ARM, containing defaults for loader(8). +# Do not modify the contents of this file, instead put your customizations +# into /boot/loader.conf or /boot/loader.conf.local +# $FreeBSD$ + +autoboot_delay=10 +bootfile="kernel" # Kernel name (possibly absolute path) +kernel="kernel" # /boot sub-directory containing kernel and modules +loader_conf_files="/boot/loader.conf /boot/loader.conf.local" +module_path="/boot/kernel;/boot/modules;/boot/dtb;/boot/overlays" +nextboot_conf="/boot/nextboot.conf" +nextboot_enable="NO" +verbose_loading="NO" Modified: stable/11/sys/boot/arm/uboot/Makefile ============================================================================== --- stable/11/sys/boot/arm/uboot/Makefile Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/boot/arm/uboot/Makefile Sun Feb 11 20:58:00 2018 (r329140) @@ -1,11 +1,20 @@ # $FreeBSD$ -.include +LOADER_UFS_SUPPORT?= yes +LOADER_CD9660_SUPPORT?= no +LOADER_MSDOS_SUPPORT?= no +LOADER_EXT2FS_SUPPORT?= no +LOADER_NET_SUPPORT?= yes +LOADER_NFS_SUPPORT?= yes +LOADER_TFTP_SUPPORT?= no +LOADER_GZIP_SUPPORT?= no +LOADER_BZIP2_SUPPORT?= no -FILES= ubldr ubldr.bin +.include +FILES+= ubldr ubldr.bin + NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH} -BINDIR?= /boot INSTALLFLAGS= -b WARNS?= 1 # Address at which ubldr will be loaded. @@ -19,113 +28,26 @@ SRCS= start.S conf.c self_reloc.c vers.c CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized .endif -.if !defined(LOADER_NO_DISK_SUPPORT) -LOADER_DISK_SUPPORT?= yes -.else -LOADER_DISK_SUPPORT= no -.endif -LOADER_UFS_SUPPORT?= yes -LOADER_CD9660_SUPPORT?= no -LOADER_EXT2FS_SUPPORT?= no -.if ${MK_NAND} != "no" -LOADER_NANDFS_SUPPORT?= yes -.else -LOADER_NANDFS_SUPPORT?= no -.endif -LOADER_NET_SUPPORT?= yes -LOADER_NFS_SUPPORT?= yes -LOADER_TFTP_SUPPORT?= no -LOADER_GZIP_SUPPORT?= no -LOADER_BZIP2_SUPPORT?= no -.if ${MK_FDT} != "no" -LOADER_FDT_SUPPORT= yes -.else -LOADER_FDT_SUPPORT= no -.endif +HELP_FILES+= help.uboot ${BOOTSRC}/fdt/help.fdt -.if ${LOADER_DISK_SUPPORT} == "yes" -CFLAGS+= -DLOADER_DISK_SUPPORT -.endif -.if ${LOADER_UFS_SUPPORT} == "yes" -CFLAGS+= -DLOADER_UFS_SUPPORT -.endif -.if ${LOADER_CD9660_SUPPORT} == "yes" -CFLAGS+= -DLOADER_CD9660_SUPPORT -.endif -.if ${LOADER_EXT2FS_SUPPORT} == "yes" -CFLAGS+= -DLOADER_EXT2FS_SUPPORT -.endif -.if ${LOADER_NANDFS_SUPPORT} == "yes" -CFLAGS+= -DLOADER_NANDFS_SUPPORT -.endif -.if ${LOADER_GZIP_SUPPORT} == "yes" -CFLAGS+= -DLOADER_GZIP_SUPPORT -.endif -.if ${LOADER_BZIP2_SUPPORT} == "yes" -CFLAGS+= -DLOADER_BZIP2_SUPPORT -.endif -.if ${LOADER_NET_SUPPORT} == "yes" -CFLAGS+= -DLOADER_NET_SUPPORT -.endif -.if ${LOADER_NFS_SUPPORT} == "yes" -CFLAGS+= -DLOADER_NFS_SUPPORT -.endif -.if ${LOADER_TFTP_SUPPORT} == "yes" -CFLAGS+= -DLOADER_TFTP_SUPPORT -.endif -.if ${LOADER_FDT_SUPPORT} == "yes" -CFLAGS+= -I${.CURDIR}/../../fdt -CFLAGS+= -I${.OBJDIR}/../../fdt -CFLAGS+= -DLOADER_FDT_SUPPORT -LIBUBOOT_FDT= ${.OBJDIR}/../../uboot/fdt/libuboot_fdt.a -LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a -.endif - -.if ${MK_FORTH} != "no" -# Enable BootForth -BOOT_FORTH= yes -CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -CFLAGS+= -I${.CURDIR}/../../ficl/arm -LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.endif - # Always add MI sources -.PATH: ${.CURDIR}/../../common -.include "${.CURDIR}/../../common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../common -CFLAGS+= -I. +.include "${BOOTSRC}/loader.mk" -CLEANFILES+= loader.help - CFLAGS+= -ffreestanding -msoft-float LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH} LDFLAGS+= -Wl,-znotext # Pull in common loader code -.PATH: ${.CURDIR}/../../uboot/common -.include "${.CURDIR}/../../uboot/common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../uboot/common +.include "${BOOTSRC}/uboot.mk" -# U-Boot standalone support library -LIBUBOOT= ${.OBJDIR}/../../uboot/lib/libuboot.a -CFLAGS+= -I${.CURDIR}/../../uboot/lib -CFLAGS+= -I${.OBJDIR}/../../uboot/lib - CFLAGS+= -fPIC -# clang doesn't understand %D as a specifier to printf -NO_WERROR.clang= - DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} OBJS+= ${SRCS:N*.h:R:S/$/.o/g} -loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt - cat ${.ALLSRC} | \ - awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} - ldscript.abs: echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >${.TARGET} @@ -144,16 +66,5 @@ ubldr.bin: ubldr.pie ${OBJCOPY} -S -O binary ubldr.pie ${.TARGET} CLEANFILES+= ldscript.abs ldscript.pie ubldr ubldr.pie ubldr.bin - -.if !defined(LOADER_ONLY) -.PATH: ${.CURDIR}/../../forth -.include "${.CURDIR}/../../forth/Makefile.inc" - -# Install loader.rc. -FILES+= loader.rc -# Put sample menu.rc on disk but don't enable it by default. -FILES+= menu.rc -FILESNAME_menu.rc= menu.rc.sample -.endif .include Modified: stable/11/sys/boot/common/disk.c ============================================================================== --- stable/11/sys/boot/common/disk.c Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/boot/common/disk.c Sun Feb 11 20:58:00 2018 (r329140) @@ -89,6 +89,12 @@ ptblread(void *d, void *buf, size_t blocks, uint64_t o od = (struct open_disk *)dev->d_opendata; /* + * The strategy function assumes the offset is in units of 512 byte + * sectors. For larger sector sizes, we need to adjust the offset to + * match the actual sector size. + */ + offset *= (od->sectorsize / 512); + /* * As the GPT backup partition is located at the end of the disk, * to avoid reading past disk end, flag bcache not to use RA. */ Modified: stable/11/sys/boot/common/md.c ============================================================================== --- stable/11/sys/boot/common/md.c Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/boot/common/md.c Sun Feb 11 20:58:00 2018 (r329140) @@ -73,7 +73,8 @@ struct devsw md_dev = { md_open, md_close, noioctl, - md_print + md_print, + NULL }; static int Copied and modified: stable/11/sys/boot/defs.mk (from r324654, head/sys/boot/defs.mk) ============================================================================== --- head/sys/boot/defs.mk Mon Oct 16 03:59:58 2017 (r324654, copy source) +++ stable/11/sys/boot/defs.mk Sun Feb 11 20:58:00 2018 (r329140) @@ -5,19 +5,38 @@ .if !defined(__BOOT_DEFS_MK__) __BOOT_DEFS_MK__=${MFILE} -BOOTDIR= ${SRCTOP}/sys/boot -FICLDIR= ${SRCTOP}/sys/boot/ficl -LDR_MI= ${BOOTDIR}/common -SASRC= ${SRCTOP}/sys/boot/libsa +BOOTSRC= ${SRCTOP}/sys/boot +EFISRC= ${BOOTSRC}/efi +EFIINC= ${EFISRC}/include +EFIINCMD= ${EFIINC}/${MACHINE} +FDTSRC= ${BOOTSRC}/fdt +FICLSRC= ${BOOTSRC}/ficl +LDRSRC= ${BOOTSRC}/common +SASRC= ${BOOTSRC}/libsa SYSDIR= ${SRCTOP}/sys +UBOOTSRC= ${BOOTSRC}/uboot +ZFSSRC= ${BOOTSRC}/zfs +BOOTOBJ= ${OBJTOP}/sys/boot + +# BINDIR is where we install +BINDIR?= /boot + # NB: The makefiles depend on these being empty when we don't build forth. .if ${MK_FORTH} != "no" -LIBFICL= ${OBJTOP}/sys/boot/ficl/libficl.a -LIBFICL32= ${OBJTOP}/sys/boot/ficl32/libficl.a +LIBFICL= ${BOOTOBJ}/ficl/libficl.a +.if ${MACHINE} == "i386" +LIBFICL32= ${LIBFICL} +.else +LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a .endif -LIBSA= ${OBJTOP}/sys/boot/libsa/libsa.a -LIBSA32= ${OBJTOP}/sys/boot/libsa32/libsa32.a +.endif +LIBSA= ${BOOTOBJ}/libsa/libsa.a +.if ${MACHINE} == "i386" +LIBSA32= ${LIBSA} +.else +LIBSA32= ${BOOTOBJ}/libsa32/libsa32.a +.endif # Standard options: @@ -66,9 +85,87 @@ CFLAGS+= -DLOADER_GPT_SUPPORT .if ${LOADER_MBR_SUPPORT:Uyes} == "yes" CFLAGS+= -DLOADER_MBR_SUPPORT .endif -.if ${LOADER_GELI_SUPPORT:Uyes} == "yes" -CFLAGS+= -DLOADER_GELI_SUPPORT + +# GELI Support, with backward compat hooks +.if defined(HAVE_GELI) +.if defined(LOADER_NO_GELI_SUPPORT) +MK_LOADER_GELI=no +.warning "Please move from LOADER_NO_GELI_SUPPORT to WITHOUT_LOADER_GELI" .endif +.if defined(LOADER_GELI_SUPPORT) +MK_LOADER_GELI=yes +.warning "Please move from LOADER_GELI_SUPPORT to WITH_LOADER_GELI" .endif +.if ${MK_LOADER_GELI} == "yes" +CFLAGS+= -DLOADER_GELI_SUPPORT +CFLAGS+= -I${BOOTSRC}/geli +LIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a +.endif +.endif +.endif + +CFLAGS+= -I${SYSDIR} + +# All PowerPC builds are 32 bit. We have no 64-bit loaders on powerpc +# or powerpc64. +.if ${MACHINE_ARCH} == "powerpc64" +CFLAGS+= -m32 -mcpu=powerpc +.endif + +# For amd64, there's a bit of mixed bag. Some of the tree (i386, lib*32) is +# build 32-bit and some 64-bit (lib*, efi). Centralize all the 32-bit magic here +# and activate it when DO32 is explicitly defined to be 1. +.if ${MACHINE_ARCH} == "amd64" && ${DO32:U0} == 1 +CFLAGS+= -m32 -mcpu=i386 +# LD_FLAGS is passed directly to ${LD}, not via ${CC}: +LD_FLAGS+= -m elf_i386_fbsd +AFLAGS+= --32 +.endif + +# Make sure we use the machine link we're about to create +CFLAGS+=-I. + +_ILINKS=machine +.if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" +_ILINKS+=${MACHINE_CPUARCH} +.endif +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +_ILINKS+=x86 +.endif +CLEANFILES+=${_ILINKS} + +all: ${PROG} + +beforedepend: ${_ILINKS} +beforebuild: ${_ILINKS} + +# Ensure that the links exist without depending on it when it exists which +# causes all the modules to be rebuilt when the directory pointed to changes. +.for _link in ${_ILINKS} +.if !exists(${.OBJDIR}/${_link}) +${OBJS}: ${_link} +.endif +.endfor + +.NOPATH: ${_ILINKS} + +${_ILINKS}: + @case ${.TARGET} in \ + machine) \ + if [ ${DO32:U0} -eq 0 ]; then \ + path=${SYSDIR}/${MACHINE}/include ; \ + else \ + path=${SYSDIR}/${MACHINE:C/amd64/i386/}/include ; \ + fi ;; \ + *) \ + path=${SYSDIR}/${.TARGET:T}/include ;; \ + esac ; \ + path=`(cd $$path && /bin/pwd)` ; \ + ${ECHO} ${.TARGET:T} "->" $$path ; \ + ln -fhs $$path ${.TARGET:T} + +# For loader implementations, we generate a loader.help file. This can be suppressed by +# setting HELP_FILES to nothing. +HELP_FILES= ${LDRSRC}/help.common .endif # __BOOT_DEFS_MK__ Modified: stable/11/sys/boot/efi/Makefile ============================================================================== --- stable/11/sys/boot/efi/Makefile Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/boot/efi/Makefile Sun Feb 11 20:58:00 2018 (r329140) @@ -1,6 +1,6 @@ # $FreeBSD$ -.include +.include # In-tree GCC does not support __attribute__((ms_abi)), but gcc newer # than 4.5 supports it. Modified: stable/11/sys/boot/efi/Makefile.inc ============================================================================== --- stable/11/sys/boot/efi/Makefile.inc Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/boot/efi/Makefile.inc Sun Feb 11 20:58:00 2018 (r329140) @@ -1,7 +1,5 @@ # $FreeBSD$ -BINDIR?= /boot - .if ${MACHINE_CPUARCH} == "i386" CFLAGS+= -march=i386 CFLAGS+= -mno-aes Modified: stable/11/sys/boot/efi/boot1/Makefile ============================================================================== --- stable/11/sys/boot/efi/boot1/Makefile Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/boot/efi/boot1/Makefile Sun Feb 11 20:58:00 2018 (r329140) @@ -2,17 +2,15 @@ MAN= -.include "../Makefile.inc" +.include MK_SSP= no +MK_FORTH= no PROG= boot1.sym INTERNALPROG= -WARNS?= 3 +WARNS?= 6 -# Include bcache code. -HAVE_BCACHE= yes - # We implement a slightly non-standard %S in that it always takes a # CHAR16 that's common in UEFI-land instead of a wchar_t. This only # seems to matter on arm64 where wchar_t defaults to an int instead @@ -21,71 +19,46 @@ HAVE_BCACHE= yes CWARNFLAGS.boot1.c+= -Wno-format # Disable warnings that are currently incompatible with the zfs boot code -CWARNFLAGS.zfs.c += -Wno-incompatible-pointer-types-discards-qualifiers -CWARNFLAGS.zfs.c += -Wno-missing-variable-declarations -CWARNFLAGS.zfs.c += -Wno-array-bounds -CWARNFLAGS.zfs.c += -Wno-cast-align -CWARNFLAGS.zfs.c += -Wno-cast-qual -CWARNFLAGS.zfs.c += -Wno-missing-prototypes -CWARNFLAGS.zfs.c += -Wno-sign-compare -CWARNFLAGS.zfs.c += -Wno-unused-parameter -CWARNFLAGS.zfs.c += -Wno-unused-function -CWARNFLAGS.skein.c += -Wno-cast-align -.if ${COMPILER_TYPE} == "clang" -CWARNFLAGS.skein.c += -Wno-missing-variable-declarations -.else if ${COMPILER_TYPE} == "gcc" -CWARNFLAGS.skein.c += -Wno-missing-declarations -.endif +CWARNFLAGS.zfs_module.c += -Wno-array-bounds +CWARNFLAGS.zfs_module.c += -Wno-cast-align +CWARNFLAGS.zfs_module.c += -Wno-cast-qual +CWARNFLAGS.zfs_module.c += -Wno-missing-prototypes +CWARNFLAGS.zfs_module.c += -Wno-sign-compare +CWARNFLAGS.zfs_module.c += -Wno-unused-parameter +CWARNFLAGS.zfs_module.c += -Wno-unused-function # architecture-specific loader code -SRCS= boot1.c self_reloc.c start.S +SRCS= boot1.c self_reloc.c start.S ufs_module.c .if ${MK_ZFS} != "no" -.PATH: ${.CURDIR}/../../../crypto/skein -SRCS+= skein.c skein_block.c -# Do not unroll skein loops, reduce code size -CFLAGS+= -DSKEIN_LOOP=111 -.PATH: ${.CURDIR}/../../zfs -SRCS+= zfs.c +SRCS+= zfs_module.c +CFLAGS+= -I${ZFSSRC} +CFLAGS+= -I${SYSDIR}/cddl/boot/zfs +CFLAGS+= -DEFI_ZFS_BOOT +LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a .endif .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized .endif -# Always add MI sources -.PATH: ${.CURDIR}/../../common -.include "${.CURDIR}/../../common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../common - -.PATH: ${.CURDIR}/arch/${MACHINE} - -CFLAGS+= -I. -CFLAGS+= -I${.CURDIR}/../include -CFLAGS+= -I${.CURDIR}/../include/${MACHINE} -CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include -CFLAGS+= -I${.CURDIR}/../../.. +CFLAGS+= -I${EFIINC} +CFLAGS+= -I${EFIINCMD} +CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include CFLAGS+= -DEFI_UFS_BOOT .ifdef(EFI_DEBUG) CFLAGS+= -DEFI_DEBUG .endif -.if ${MK_ZFS} != "no" -CFLAGS+= -I${.CURDIR}/../../zfs/ -CFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs/ -CFLAGS+= -I${.CURDIR}/../../../crypto/skein -CFLAGS+= -DEFI_ZFS_BOOT -.endif - # Always add MI sources and REGULAR efi loader bits -.PATH: ${.CURDIR}/../loader/arch/${MACHINE} -.PATH: ${.CURDIR}/../loader -.PATH: ${.CURDIR}/../../common -CFLAGS+= -I${.CURDIR}/../../common +.PATH: ${EFISRC}/loader/arch/${MACHINE} +.PATH: ${EFISRC}/loader +.PATH: ${LDRSRC} +CFLAGS+= -I${LDRSRC} FILES= boot1.efi boot1.efifat FILESMODE_boot1.efi= ${BINMODE} -LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE} +LDSCRIPT= ${EFISRC}/loader/arch/${MACHINE}/ldscript.${MACHINE} LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared .if ${MACHINE_CPUARCH} == "aarch64" @@ -96,15 +69,15 @@ CFLAGS+= -fPIC LDFLAGS+= -Wl,-znocombreloc .endif -LIBEFI= ${.OBJDIR}/../libefi/libefi.a +LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a # # Add libstand for the runtime functions used by the compiler - for example # __aeabi_* (arm) or __divdi3 (i386). # as well as required string and memory functions for all platforms. # -DPADD+= ${LIBEFI} ${LIBSA} -LDADD+= ${LIBEFI} ${LIBSA} +DPADD+= ${LIBEFI} ${LIBZFSBOOT} ${LIBSA} +LDADD+= ${LIBEFI} ${LIBZFSBOOT} ${LIBSA} DPADD+= ${LDSCRIPT} @@ -130,7 +103,7 @@ boot1.efi: ${PROG} SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \ -j .dynamic -j .dynsym -j .rel.dyn \ - -j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \ + -j .rela.dyn -j .reloc -j .eh_frame \ --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET} boot1.o: ${SASRC}/ufsread.c @@ -151,21 +124,6 @@ boot1.efifat: boot1.efi xz -d -c ${.CURDIR}/fat-${MACHINE}.tmpl.xz > ${.TARGET} ${DD} if=${.ALLSRC} of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc -CLEANFILES= boot1.efi boot1.efifat +CLEANFILES+= boot1.efi boot1.efifat .include - -beforedepend ${OBJS}: machine - -CLEANFILES+= machine - -machine: .NOMETA - ln -sf ${.CURDIR}/../../../${MACHINE}/include machine - -.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" -beforedepend ${OBJS}: x86 -CLEANFILES+= x86 - -x86: .NOMETA - ln -sf ${.CURDIR}/../../../x86/include x86 -.endif Modified: stable/11/sys/boot/efi/boot1/boot1.c ============================================================================== --- stable/11/sys/boot/efi/boot1/boot1.c Sun Feb 11 20:47:38 2018 (r329139) +++ stable/11/sys/boot/efi/boot1/boot1.c Sun Feb 11 20:58:00 2018 (r329140) @@ -23,179 +23,61 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include -#include #include -#include -#include #include -#ifdef EFI_ZFS_BOOT -#include -#endif typedef CHAR16 efi_char; #include -#include - -#include "efi_drivers.h" -#include "efizfs.h" +#include "boot_module.h" #include "paths.h" static void efi_panic(EFI_STATUS s, const char *fmt, ...) __dead2 __printflike(2, 3); -#ifdef EFI_DEBUG -#define DPRINTF(fmt, args...) printf(fmt, ##args) -#define DSTALL(d) BS->Stall(d) -#else -#define DPRINTF(fmt, ...) {} -#define DSTALL(d) {} -#endif -struct arch_switch archsw; /* MI/MD interface boundary */ - -static const efi_driver_t *efi_drivers[] = { - NULL -}; - -extern struct console efi_console; -#if defined(__amd64__) || defined(__i386__) -extern struct console comconsole; -extern struct console nullconsole; -#endif - +static const boot_module_t *boot_modules[] = +{ #ifdef EFI_ZFS_BOOT -uint64_t pool_guid; + &zfs_module, #endif - -struct fs_ops *file_system[] = { -#ifdef EFI_ZFS_BOOT - &zfs_fsops, -#endif - &dosfs_fsops, #ifdef EFI_UFS_BOOT - &ufs_fsops, + &ufs_module #endif - &cd9660_fsops, - &nfs_fsops, - &gzipfs_fsops, - &bzipfs_fsops, - NULL }; -struct devsw *devsw[] = { - &efipart_hddev, - &efipart_fddev, - &efipart_cddev, -#ifdef EFI_ZFS_BOOT - &zfs_dev, -#endif - NULL -}; - -struct console *consoles[] = { - &efi_console, - NULL -}; - -static EFI_LOADED_IMAGE *boot_image; -static EFI_DEVICE_PATH *imgpath; -static EFI_DEVICE_PATH *imgprefix; - -/* Definitions we don't actually need for boot, but we need to define - * to make the linker happy. - */ -struct file_format *file_formats[] = { NULL }; - -struct netif_driver *netif_drivers[] = { NULL }; - -static int -efi_autoload(void) -{ - printf("******** Boot block should not call autoload\n"); - return (-1); -} - -static ssize_t -efi_copyin(const void *src __unused, vm_offset_t dest __unused, - const size_t len __unused) -{ - printf("******** Boot block should not call copyin\n"); - return (-1); -} - -static ssize_t -efi_copyout(vm_offset_t src __unused, void *dest __unused, - const size_t len __unused) -{ - printf("******** Boot block should not call copyout\n"); - return (-1); -} - -static ssize_t -efi_readin(int fd __unused, vm_offset_t dest __unused, - const size_t len __unused) -{ - printf("******** Boot block should not call readin\n"); - return (-1); -} - +#define NUM_BOOT_MODULES nitems(boot_modules) /* The initial number of handles used to query EFI for partitions. */ #define NUM_HANDLES_INIT 24 +static EFI_GUID BlockIoProtocolGUID = BLOCK_IO_PROTOCOL; static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL; static EFI_GUID LoadedImageGUID = LOADED_IMAGE_PROTOCOL; +static EFI_GUID ConsoleControlGUID = EFI_CONSOLE_CONTROL_PROTOCOL_GUID; static EFI_GUID FreeBSDBootVarGUID = FREEBSD_BOOT_VAR_GUID; -static EFI_STATUS -do_load(const char *filepath, void **bufp, size_t *bufsize) +/* + * Provide Malloc / Free backed by EFIs AllocatePool / FreePool which ensures + * memory is correctly aligned avoiding EFI_INVALID_PARAMETER returns from + * EFI methods. + */ +void * +Malloc(size_t len, const char *file __unused, int line __unused) { - struct stat st; - void *buf = NULL; - int fd, err; - size_t fsize, remaining; - ssize_t readsize; + void *out; - if ((fd = open(filepath, O_RDONLY)) < 0) { - return (ENOTSUP); - } + if (BS->AllocatePool(EfiLoaderData, len, &out) == EFI_SUCCESS) + return (out); - if ((err = fstat(fd, &st)) != 0) { - goto close_file; - } + return (NULL); +} - fsize = st.st_size; - - if ((buf = malloc(fsize)) == NULL) { - err = ENOMEM; - goto close_file; - } - - remaining = fsize; - - do { - if ((readsize = read(fd, buf, fsize)) < 0) { - err = (-readsize); - goto free_buf; - } - - remaining -= readsize; - } while(remaining != 0); - - close(fd); - *bufsize = st.st_size; - *bufp = buf; - - close_file: - close(fd); - - return errno_to_efi_status(err); - - free_buf: - free(buf); - goto close_file; +void +Free(void *buf, const char *file __unused, int line __unused) +{ + if (buf != NULL) + (void)BS->FreePool(buf); } static EFI_STATUS @@ -215,275 +97,98 @@ efi_setenv_freebsd_wcs(const char *varname, CHAR16 *va return (rv); } -static int -probe_fs(const char *filepath) +/* + * nodes_match returns TRUE if the imgpath isn't NULL and the nodes match, + * FALSE otherwise. + */ +static BOOLEAN +nodes_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath) { - int fd; + size_t len; - if ((fd = open(filepath, O_RDONLY)) < 0) { - return (ENOTSUP); - } + if (imgpath == NULL || imgpath->Type != devpath->Type || + imgpath->SubType != devpath->SubType) + return (FALSE); - close(fd); + len = DevicePathNodeLength(imgpath); + if (len != DevicePathNodeLength(devpath)) + return (FALSE); - return (0); + return (memcmp(imgpath, devpath, (size_t)len) == 0); } -static int -probe_dev(struct devsw *dev, int unit, const char *filepath) +/* + * device_paths_match returns TRUE if the imgpath isn't NULL and all nodes + * in imgpath and devpath match up to their respective occurrences of a + * media node, FALSE otherwise. + */ +static BOOLEAN +device_paths_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath) { - struct devdesc currdev; - char *devname; - int err; - currdev.d_dev = dev; - currdev.d_type = currdev.d_dev->dv_type; - currdev.d_unit = unit; - currdev.d_opendata = NULL; - devname = efi_fmtdev(&currdev); + if (imgpath == NULL) + return (FALSE); - env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, - env_nounset); + while (!IsDevicePathEnd(imgpath) && !IsDevicePathEnd(devpath)) { + if (IsDevicePathType(imgpath, MEDIA_DEVICE_PATH) && + IsDevicePathType(devpath, MEDIA_DEVICE_PATH)) + return (TRUE); - err = probe_fs(filepath); + if (!nodes_match(imgpath, devpath)) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Sun Feb 11 21:28:09 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 576CDF19D2F; Sun, 11 Feb 2018 21:28:09 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B78566C148; Sun, 11 Feb 2018 21:28:08 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f48.google.com with SMTP id j193so1988593lfe.0; Sun, 11 Feb 2018 13:28:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=6fpPz9WC9lbJ1aXiyn2ZuvYXwQPfTT2Y3CjPbyW/Axk=; b=V4M8A3Zjugo7zi+WD/56Iz1N3nN/HBBQDFG6GnBxvH3uDotPz2D994ye5Y1KH1Ped5 c8ouCkmJNU/ukpZsZaTtp79fNrVI26fBLemdBMVPCT/jRRS2Bc6jVzjI0ggywtte0FO6 BQbyA074t94t2/lFYbW48f57Uk6ALQXtQnLAYByO8yiuKoRgumKI41mAM4c3mIKYBviv uKk6XxSZDj9c+becAyTwTq91gj8eYfmYiBSr1HZGaO7VCXAqs/31LL0vBncqLs0hBF6X S5CvT3lF4JWc/ssb9y6CGNwZZwD+kkj/oECRGlC0kiEfhIWxdRYFF5uHGpBfwKb9sWS3 a3ug== X-Gm-Message-State: APf1xPCxkeu9w4P8JNBAX/V3toHAxYCEB76BOtyPQn9q4/Epprcc12xL vT2oAP0baeRZSJ2bar2wob2xBgrb X-Google-Smtp-Source: AH8x226Rymw8SkM9TsWSHBiOBKhEoeN4n1qIl5hXFsWu23nD9QjJ3ys62zyyLvapcC0Pa5N1SLslmw== X-Received: by 10.25.78.79 with SMTP id c76mr5525911lfb.98.1518384083596; Sun, 11 Feb 2018 13:21:23 -0800 (PST) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com. [209.85.215.44]) by smtp.gmail.com with ESMTPSA id a197sm1408789lfe.88.2018.02.11.13.21.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Feb 2018 13:21:23 -0800 (PST) Received: by mail-lf0-f44.google.com with SMTP id i24so14796288lfc.7; Sun, 11 Feb 2018 13:21:23 -0800 (PST) X-Received: by 10.46.23.156 with SMTP id 28mr3444223ljx.29.1518384083153; Sun, 11 Feb 2018 13:21:23 -0800 (PST) MIME-Version: 1.0 Received: by 10.46.106.8 with HTTP; Sun, 11 Feb 2018 13:21:02 -0800 (PST) In-Reply-To: <201802112058.w1BKw0xv046842@repo.freebsd.org> References: <201802112058.w1BKw0xv046842@repo.freebsd.org> From: Kyle Evans Date: Sun, 11 Feb 2018 15:21:02 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329140 - in stable/11: . share/mk sys/arm/include sys/arm64/include sys/boot sys/boot/arm/at91 sys/boot/arm/at91/boot0 sys/boot/arm/at91/boot0iic sys/boot/arm/at91/boot0spi sys/boot/ar... To: src-committers Cc: svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 21:28:09 -0000 On Sun, Feb 11, 2018 at 2:58 PM, Kyle Evans wrote: > Author: kevans > Date: Sun Feb 11 20:58:00 2018 > New Revision: 329140 > URL: https://svnweb.freebsd.org/changeset/base/329140 > > Log: > MFC Loader Fixes 2017q4p6: r324649,r324650,r324651,r324652,r324653,r324654, > r324700,r324702,r324709,r324717,r324719,r324841,r324842,r324843,r324845, > r324850,r324876,r324877,r324878,r324879,r324880,r324881,r324883,r324980, > r324981,r324982,r324995,r325014,r325093,r325094,r325114,r325170,r325171, > r325172,r325173,r325174,r325175,r325176,r325248,r325286,r325310,r325332, > r325338,r325339,r325376,r325377,r325379,r325380,r325382,r325478,r325479, > r325480,r325482,r325483,r325484,r325485,r325556,r325641,r325681,r325685, > r325686,r325687,r325688,r325689,r325690,r325691,r325692,r325693,r325694, > r325743,r325744,r325748,r325775,r325779,r325780 > Apologies for all of the breakage/cutting teeth in the last couple hours of this process... A lot of things got moved around, and svn's handling of merging commits that moved things isn't great considering 'svn mv' does a 'copy + delete old'. All of the cherry-picking that we've done came back to haunt us as it tried to wipe out the cherry-picked bits in the process. We can now begin our downhill descent, as the next step is to move everything from sys/boot to stand/ except for sys/boot/fdt/dts and things should be easygoing from there. From owner-svn-src-stable-11@freebsd.org Sun Feb 11 22:16:25 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B141F1DAAB; Sun, 11 Feb 2018 22:16:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CFE206E539; Sun, 11 Feb 2018 22:16:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA5B8E9F; Sun, 11 Feb 2018 22:16:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1BMGO2a086797; Sun, 11 Feb 2018 22:16:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1BMGOFZ086796; Sun, 11 Feb 2018 22:16:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802112216.w1BMGOFZ086796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 11 Feb 2018 22:16:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329143 - stable/11/sys/boot X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/boot X-SVN-Commit-Revision: 329143 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 22:16:25 -0000 Author: kevans Date: Sun Feb 11 22:16:24 2018 New Revision: 329143 URL: https://svnweb.freebsd.org/changeset/base/329143 Log: Correct check: BOOT_FORTH is MK_FORTH in makefiles. This is a direct commit to stable/11. Modified: stable/11/sys/boot/loader.mk Modified: stable/11/sys/boot/loader.mk ============================================================================== --- stable/11/sys/boot/loader.mk Sun Feb 11 22:09:07 2018 (r329142) +++ stable/11/sys/boot/loader.mk Sun Feb 11 22:16:24 2018 (r329143) @@ -68,7 +68,7 @@ SRCS+= pnp.c .endif # Forth interpreter -.if defined(BOOT_FORTH) +.if defined(MK_FORTH) SRCS+= interp_forth.c .include "${BOOTSRC}/ficl.mk" .endif From owner-svn-src-stable-11@freebsd.org Sun Feb 11 22:38:17 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99A9CF1F7F9; Sun, 11 Feb 2018 22:38:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48D736F64E; Sun, 11 Feb 2018 22:38:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43C531226; Sun, 11 Feb 2018 22:38:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1BMcHb2097049; Sun, 11 Feb 2018 22:38:17 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1BMcH9b097047; Sun, 11 Feb 2018 22:38:17 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802112238.w1BMcH9b097047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 11 Feb 2018 22:38:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329144 - stable/11/sys/boot X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/boot X-SVN-Commit-Revision: 329144 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 22:38:18 -0000 Author: kevans Date: Sun Feb 11 22:38:16 2018 New Revision: 329144 URL: https://svnweb.freebsd.org/changeset/base/329144 Log: Re-sync loader.mk and ficl.mk to where they should be This is a direct commit to stable/11 due to changes lost during an MFC of a move. Modified: stable/11/sys/boot/ficl.mk stable/11/sys/boot/loader.mk Modified: stable/11/sys/boot/ficl.mk ============================================================================== --- stable/11/sys/boot/ficl.mk Sun Feb 11 22:16:24 2018 (r329143) +++ stable/11/sys/boot/ficl.mk Sun Feb 11 22:38:16 2018 (r329144) @@ -6,7 +6,7 @@ .if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1 FICL_CPUARCH= i386 -.elif ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el" +.elif ${MACHINE_ARCH:Mmips64*} != "" FICL_CPUARCH= mips64 .else FICL_CPUARCH= ${MACHINE_CPUARCH} Modified: stable/11/sys/boot/loader.mk ============================================================================== --- stable/11/sys/boot/loader.mk Sun Feb 11 22:16:24 2018 (r329143) +++ stable/11/sys/boot/loader.mk Sun Feb 11 22:38:16 2018 (r329144) @@ -1,6 +1,6 @@ # $FreeBSD$ -.PATH: ${SRCTOP}/sys/boot/common ${SRCTOP}/sys/boot/libsa +.include "defs.mk" .PATH: ${LDRSRC} ${BOOTSRC}/libsa @@ -24,29 +24,19 @@ SRCS+= load_elf32.c reloc_elf32.c SRCS+= load_elf64.c reloc_elf64.c .elif ${MACHINE_CPUARCH} == "sparc64" SRCS+= load_elf64.c reloc_elf64.c -.elif ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el" +.elif ${MACHINE_ARCH:Mmips64*} != "" SRCS+= load_elf64.c reloc_elf64.c .elif ${MACHINE} == "mips" SRCS+= load_elf32.c reloc_elf32.c .endif -.if defined(LOADER_NET_SUPPORT) -SRCS+= dev_net.c +.if ${LOADER_DISK_SUPPORT:Uyes} == "yes" +SRCS+= disk.c part.c .endif -.if !defined(LOADER_NO_DISK_SUPPORT) -SRCS+= disk.c part.c -CFLAGS+= -DLOADER_DISK_SUPPORT -.if !defined(LOADER_NO_GPT_SUPPORT) -CFLAGS+= -DLOADER_GPT_SUPPORT +.if ${LOADER_NET_SUPPORT:Uno} == "yes" +SRCS+= dev_net.c .endif -.if !defined(LOADER_NO_MBR_SUPPORT) -CFLAGS+= -DLOADER_MBR_SUPPORT -.endif -.endif -.if !defined(LOADER_NO_GELI_SUPPORT) -CFLAGS+= -DLOADER_GELI_SUPPORT -.endif .if defined(HAVE_BCACHE) SRCS+= bcache.c @@ -68,7 +58,7 @@ SRCS+= pnp.c .endif # Forth interpreter -.if defined(MK_FORTH) +.if ${MK_FORTH} != "no" SRCS+= interp_forth.c .include "${BOOTSRC}/ficl.mk" .endif From owner-svn-src-stable-11@freebsd.org Mon Feb 12 01:08:47 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8073CF07788; Mon, 12 Feb 2018 01:08:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2C99E75834; Mon, 12 Feb 2018 01:08:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26C972AF5; Mon, 12 Feb 2018 01:08:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1C18lgY072463; Mon, 12 Feb 2018 01:08:47 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1C18iU5072435; Mon, 12 Feb 2018 01:08:44 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802120108.w1C18iU5072435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 12 Feb 2018 01:08:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329145 - in stable/11: . lib/libefivar release/powerpc release/tools share/examples/bootforth share/examples/etc share/man/man5 share/man/man7 share/man/man8 stand stand/arm stand/arm6... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: . lib/libefivar release/powerpc release/tools share/examples/bootforth share/examples/etc share/man/man5 share/man/man7 share/man/man8 stand stand/arm stand/arm64 stand/common stand/efi ... X-SVN-Commit-Revision: 329145 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 01:08:48 -0000 Author: kevans Date: Mon Feb 12 01:08:44 2018 New Revision: 329145 URL: https://svnweb.freebsd.org/changeset/base/329145 Log: MFC r325834,r325997,326502: Move sys/boot to stand/ This is effectively a direct commit to stable/11, due to differences between stable/11 and head. Changes to DTS in sys/boot/fdt/dts were often accompanied by kernel changes. Many of these were also risc-v updates that likely had many more dependencies to MFC. Because of this, sys/boot/fdt/dts remains as-is while everything else in sys/boot relocates to stand/. r325834: Move sys/boot to stand. Fix all references to new location r325997: Remove empty directories. r326502: Document the sys/boot -> stand move in hier.7 and the top-level README. Added: stable/11/stand/ stable/11/stand/Makefile - copied unchanged from r329144, stable/11/sys/boot/Makefile stable/11/stand/Makefile.amd64 - copied unchanged from r329144, stable/11/sys/boot/Makefile.amd64 stable/11/stand/Makefile.arm - copied unchanged from r329144, stable/11/sys/boot/Makefile.arm stable/11/stand/Makefile.arm64 - copied unchanged from r329144, stable/11/sys/boot/Makefile.arm64 stable/11/stand/Makefile.i386 - copied unchanged from r329144, stable/11/sys/boot/Makefile.i386 stable/11/stand/Makefile.inc - copied unchanged from r329144, stable/11/sys/boot/Makefile.inc stable/11/stand/Makefile.mips - copied unchanged from r329144, stable/11/sys/boot/Makefile.mips stable/11/stand/Makefile.pc98 - copied unchanged from r329144, stable/11/sys/boot/Makefile.pc98 stable/11/stand/Makefile.powerpc - copied unchanged from r329144, stable/11/sys/boot/Makefile.powerpc stable/11/stand/Makefile.sparc64 - copied unchanged from r329144, stable/11/sys/boot/Makefile.sparc64 stable/11/stand/arm/ - copied from r329144, stable/11/sys/boot/arm/ stable/11/stand/arm64/ - copied from r329144, stable/11/sys/boot/arm64/ stable/11/stand/common/ - copied from r329144, stable/11/sys/boot/common/ stable/11/stand/defs.mk - copied, changed from r329144, stable/11/sys/boot/defs.mk stable/11/stand/efi/ - copied from r329144, stable/11/sys/boot/efi/ stable/11/stand/fdt/ stable/11/stand/fdt.mk - copied unchanged from r329144, stable/11/sys/boot/fdt.mk stable/11/stand/fdt/Makefile - copied unchanged from r329144, stable/11/sys/boot/fdt/Makefile stable/11/stand/fdt/Makefile.depend - copied unchanged from r329144, stable/11/sys/boot/fdt/Makefile.depend stable/11/stand/fdt/fdt_loader_cmd.c - copied unchanged from r329144, stable/11/sys/boot/fdt/fdt_loader_cmd.c stable/11/stand/fdt/fdt_platform.h - copied unchanged from r329144, stable/11/sys/boot/fdt/fdt_platform.h stable/11/stand/fdt/help.fdt - copied unchanged from r329144, stable/11/sys/boot/fdt/help.fdt stable/11/stand/ficl/ - copied from r329144, stable/11/sys/boot/ficl/ stable/11/stand/ficl.mk - copied unchanged from r329144, stable/11/sys/boot/ficl.mk stable/11/stand/ficl32/ - copied from r329144, stable/11/sys/boot/ficl32/ stable/11/stand/forth/ - copied from r329144, stable/11/sys/boot/forth/ stable/11/stand/geli/ - copied from r329144, stable/11/sys/boot/geli/ stable/11/stand/i386/ - copied from r329144, stable/11/sys/boot/i386/ stable/11/stand/kshim/ - copied from r329144, stable/11/sys/boot/kshim/ stable/11/stand/libsa/ - copied from r329144, stable/11/sys/boot/libsa/ stable/11/stand/libsa32/ - copied from r329144, stable/11/sys/boot/libsa32/ stable/11/stand/loader.mk - copied unchanged from r329144, stable/11/sys/boot/loader.mk stable/11/stand/man/ - copied from r329144, stable/11/sys/boot/man/ stable/11/stand/mips/ - copied from r329144, stable/11/sys/boot/mips/ stable/11/stand/ofw/ - copied from r329144, stable/11/sys/boot/ofw/ stable/11/stand/pc98/ - copied from r329144, stable/11/sys/boot/pc98/ stable/11/stand/powerpc/ - copied from r329144, stable/11/sys/boot/powerpc/ stable/11/stand/sparc64/ - copied from r329144, stable/11/sys/boot/sparc64/ stable/11/stand/uboot/ - copied from r329144, stable/11/sys/boot/uboot/ stable/11/stand/uboot.mk - copied unchanged from r329144, stable/11/sys/boot/uboot.mk stable/11/stand/usb/ - copied from r329144, stable/11/sys/boot/usb/ stable/11/stand/userboot/ - copied from r329144, stable/11/sys/boot/userboot/ stable/11/stand/zfs/ - copied from r329144, stable/11/sys/boot/zfs/ stable/11/stand/zfs32/ - copied from r329144, stable/11/sys/boot/zfs32/ Deleted: stable/11/stand/userboot/ficl/ stable/11/stand/userboot/libstand/ stable/11/stand/userboot/zfs/ stable/11/sys/boot/Makefile stable/11/sys/boot/Makefile.amd64 stable/11/sys/boot/Makefile.arm stable/11/sys/boot/Makefile.arm64 stable/11/sys/boot/Makefile.i386 stable/11/sys/boot/Makefile.inc stable/11/sys/boot/Makefile.mips stable/11/sys/boot/Makefile.pc98 stable/11/sys/boot/Makefile.powerpc stable/11/sys/boot/Makefile.sparc64 stable/11/sys/boot/arm/ stable/11/sys/boot/arm64/ stable/11/sys/boot/common/ stable/11/sys/boot/defs.mk stable/11/sys/boot/efi/ stable/11/sys/boot/fdt.mk stable/11/sys/boot/fdt/Makefile stable/11/sys/boot/fdt/Makefile.depend stable/11/sys/boot/fdt/fdt_loader_cmd.c stable/11/sys/boot/fdt/fdt_platform.h stable/11/sys/boot/fdt/help.fdt stable/11/sys/boot/ficl/ stable/11/sys/boot/ficl.mk stable/11/sys/boot/ficl32/ stable/11/sys/boot/forth/ stable/11/sys/boot/geli/ stable/11/sys/boot/i386/ stable/11/sys/boot/kshim/ stable/11/sys/boot/libsa/ stable/11/sys/boot/libsa32/ stable/11/sys/boot/loader.mk stable/11/sys/boot/man/ stable/11/sys/boot/mips/ stable/11/sys/boot/ofw/ stable/11/sys/boot/pc98/ stable/11/sys/boot/powerpc/ stable/11/sys/boot/sparc64/ stable/11/sys/boot/uboot/ stable/11/sys/boot/uboot.mk stable/11/sys/boot/usb/ stable/11/sys/boot/userboot/ stable/11/sys/boot/zfs/ stable/11/sys/boot/zfs32/ Modified: stable/11/MAINTAINERS stable/11/Makefile.inc1 stable/11/README stable/11/lib/libefivar/Makefile stable/11/release/powerpc/generate-hfs.sh stable/11/release/tools/vmimage.subr stable/11/share/examples/bootforth/README stable/11/share/examples/etc/make.conf stable/11/share/man/man5/make.conf.5 stable/11/share/man/man7/hier.7 stable/11/share/man/man8/diskless.8 stable/11/stand/forth/pnp.4th stable/11/stand/forth/support.4th stable/11/stand/i386/Makefile.inc stable/11/stand/pc98/Makefile.inc stable/11/sys/Makefile stable/11/sys/contrib/dev/acpica/acpica_prep.sh stable/11/tools/boot/universe.sh stable/11/tools/tools/bootparttest/Makefile stable/11/tools/tools/zfsboottest/Makefile stable/11/usr.sbin/bhyveload/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/MAINTAINERS ============================================================================== --- stable/11/MAINTAINERS Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/MAINTAINERS Mon Feb 12 01:08:44 2018 (r329145) @@ -87,7 +87,7 @@ sh(1) jilles Pre-commit review requested. This also compiled in as builtins. share/mk imp, bapt, bdrewery, emaste, sjg Make is hard. share/mk/*.test.mk freebsd-testing,ngie (same list as share/mk too) Pre-commit review requested. -sys/boot/forth dteske Pre-commit review requested. +stand/forth dteske Pre-commit review requested. sys/compat/linuxkpi hselasky If in doubt, ask. sys/dev/e1000 erj Pre-commit phabricator review requested. sys/dev/ixgbe erj Pre-commit phabricator review requested. Modified: stable/11/Makefile.inc1 ============================================================================== --- stable/11/Makefile.inc1 Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/Makefile.inc1 Mon Feb 12 01:08:44 2018 (r329145) @@ -252,6 +252,9 @@ SUBDIR+=secure .if !defined(NO_SHARE) SUBDIR+=share .endif +.if ${MK_BOOT} != "no" +SUBDIR+=stand +.endif SUBDIR+=sys usr.bin usr.sbin .if ${MK_TESTS} != "no" SUBDIR+= tests @@ -1903,7 +1906,7 @@ _clang_libs= lib/clang _gcc= gnu/usr.bin/cc .endif .if ${MK_USB} != "no" -_usb_tools= sys/boot/usb/tools +_usb_tools= stand/usb/tools .endif cross-tools: .MAKE .PHONY Modified: stable/11/README ============================================================================== --- stable/11/README Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/README Mon Feb 12 01:08:44 2018 (r329145) @@ -66,6 +66,8 @@ secure Cryptographic libraries and commands. share Shared resources. +stand Boot loader sources. + sys Kernel sources. tests Regression tests which can be run by Kyua. See tests/README Modified: stable/11/lib/libefivar/Makefile ============================================================================== --- stable/11/lib/libefivar/Makefile Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/lib/libefivar/Makefile Mon Feb 12 01:08:44 2018 (r329145) @@ -26,7 +26,7 @@ .include -EFIBOOT=${SRCTOP}/sys/boot/efi +EFIBOOT=${SRCTOP}/stand/efi EDK2INC=${SRCTOP}/sys/contrib/edk2/Include .PATH: ${EFIBOOT}/libefi Modified: stable/11/release/powerpc/generate-hfs.sh ============================================================================== --- stable/11/release/powerpc/generate-hfs.sh Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/release/powerpc/generate-hfs.sh Mon Feb 12 01:08:44 2018 (r329145) @@ -32,7 +32,7 @@ cat > bootinfo.txt << EOF FreeBSD/powerpc bootloader FreeBSD - $FreeBSD: head/sys/boot/powerpc/boot1.chrp/bootinfo.txt 184490 2008-10 + $FreeBSD: head/stand/powerpc/boot1.chrp/bootinfo.txt 184490 2008-10 -31 00:52:31Z nwhitehorn $ Modified: stable/11/release/tools/vmimage.subr ============================================================================== --- stable/11/release/tools/vmimage.subr Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/release/tools/vmimage.subr Mon Feb 12 01:08:44 2018 (r329145) @@ -17,9 +17,9 @@ write_partition_layout() { _OBJDIR="$(make -C ${WORLDDIR} -V .OBJDIR)" _OBJDIR="$(realpath ${_OBJDIR})" if [ -d "${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}" ]; then - BOOTFILES="/${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}/usr/src/sys/boot" + BOOTFILES="/${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}/usr/src/stand" else - BOOTFILES="/${_OBJDIR}/sys/boot" + BOOTFILES="/${_OBJDIR}/stand" fi case "${TARGET}:${TARGET_ARCH}" in Modified: stable/11/share/examples/bootforth/README ============================================================================== --- stable/11/share/examples/bootforth/README Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/share/examples/bootforth/README Mon Feb 12 01:08:44 2018 (r329145) @@ -1,6 +1,6 @@ Here you can find some simple examples how to use BootFORTH (part of the new bootloader) together with terminal emulation code (available when -compiling /sys/boot/i386/libi386 with -DTERM_EMU). +compiling /stand/i386/libi386 with -DTERM_EMU). Normally, you can place the files in /boot as they are here, and they will be automatically loaded by /boot/loader. You must choose between boot.4th or Modified: stable/11/share/examples/etc/make.conf ============================================================================== --- stable/11/share/examples/etc/make.conf Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/share/examples/etc/make.conf Mon Feb 12 01:08:44 2018 (r329145) @@ -171,7 +171,7 @@ #BOOT_COMCONSOLE_SPEED= 115200 # # By default the 'pxeboot' loader retrieves the kernel via NFS. Defining -# this and recompiling /usr/src/sys/boot will cause it to retrieve the kernel +# this and recompiling /usr/src/stand will cause it to retrieve the kernel # via TFTP. This allows pxeboot to load a custom BOOTP diskless kernel yet # still mount the server's '/' (i.e. rather than load the server's kernel). # Modified: stable/11/share/man/man5/make.conf.5 ============================================================================== --- stable/11/share/man/man5/make.conf.5 Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/share/man/man5/make.conf.5 Mon Feb 12 01:08:44 2018 (r329145) @@ -369,7 +369,7 @@ By default the .Xr pxeboot 8 loader retrieves the kernel via NFS. Defining this and recompiling -.Pa /usr/src/sys/boot +.Pa /usr/src/stand will cause it to retrieve the kernel via TFTP. This allows .Xr pxeboot 8 @@ -380,7 +380,7 @@ rather than load the server's kernel. .It Va LOADER_FIREWIRE_SUPPORT .Pq Vt bool Defining this and recompiling -.Pa /usr/src/sys/boot/i386 +.Pa /usr/src/stand/i386 will add .Xr dcons 4 console driver to Modified: stable/11/share/man/man7/hier.7 ============================================================================== --- stable/11/share/man/man7/hier.7 Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/share/man/man7/hier.7 Mon Feb 12 01:08:44 2018 (r329145) @@ -28,7 +28,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd January 15, 2018 +.Dd February 11, 2018 .Dt HIER 7 .Os .Sh NAME @@ -696,6 +696,8 @@ build directory for files in .It Pa share/ source for files in .Pa /usr/share +.It Pa stand/ +boot loader source code .It Pa sys/ kernel source code .Bl -tag -width "opencrypto/" -compact Modified: stable/11/share/man/man8/diskless.8 ============================================================================== --- stable/11/share/man/man8/diskless.8 Sun Feb 11 22:38:16 2018 (r329144) +++ stable/11/share/man/man8/diskless.8 Mon Feb 12 01:08:44 2018 (r329145) @@ -124,7 +124,7 @@ the .Nm machine, which may not be what you want to have happen. .Bd -literal -offset indent -cd /usr/src/sys/boot/i386 +cd /usr/src/stand/i386 make clean; make; make install cp /boot/pxeboot /tftpdir/ .Ed Copied: stable/11/stand/Makefile (from r329144, stable/11/sys/boot/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile) @@ -0,0 +1,20 @@ +# $FreeBSD$ + +.include + +SUBDIR+= libsa +.if ${MK_FORTH} != "no" +# Build the add-in FORTH interpreter. +SUBDIR+= ficl +SUBDIR+= forth +.endif + +SUBDIR+= man + +.include + +.if exists(${.CURDIR}/${MACHINE}/.) +SUBDIR+= ${MACHINE} +.endif + +.include Copied: stable/11/stand/Makefile.amd64 (from r329144, stable/11/sys/boot/Makefile.amd64) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.amd64 Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.amd64) @@ -0,0 +1,18 @@ +# $FreeBSD$ + +SUBDIR+= libsa32 +.if ${MK_ZFS} != "no" +SUBDIR+= zfs zfs32 +.endif +.if ${MK_FORTH} != "no" +SUBDIR+= ficl32 +.endif + +SUBDIR+= efi +SUBDIR+= userboot + +.if ${LOADER_GELI_SUPPORT:Uyes} == "yes" +SUBDIR+= geli +.endif + +SUBDIR+= i386 Copied: stable/11/stand/Makefile.arm (from r329144, stable/11/sys/boot/Makefile.arm) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.arm Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.arm) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +.if ${MK_FDT} != "no" +SUBDIR+= fdt +.endif +.if ${MK_ZFS} != "no" +SUBDIR+= zfs +.endif + +SUBDIR+= efi uboot Copied: stable/11/stand/Makefile.arm64 (from r329144, stable/11/sys/boot/Makefile.arm64) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.arm64 Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.arm64) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +.if ${MK_FDT} != "no" +SUBDIR+= fdt +.endif +.if ${MK_ZFS} != "no" +SUBDIR+= zfs +.endif + +SUBDIR+= efi Copied: stable/11/stand/Makefile.i386 (from r329144, stable/11/sys/boot/Makefile.i386) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.i386 Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.i386) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +.if ${LOADER_GELI_SUPPORT:Uyes} == "yes" +SUBDIR+= geli +.endif +.if ${MK_ZFS} != "no" +SUBDIR+= zfs +.endif + +SUBDIR+= efi Copied: stable/11/stand/Makefile.inc (from r329144, stable/11/sys/boot/Makefile.inc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.inc Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.inc) @@ -0,0 +1,37 @@ +# $FreeBSD$ + +.include "defs.mk" + +.if !defined(__BOOT_MAKEFILE_INC__) +__BOOT_MAKEFILE_INC__=${MFILE} + +CFLAGS+=-I${SASRC} + +SSP_CFLAGS= + +.if ${MACHINE_CPUARCH} == "arm" +# Do not generate movt/movw, because the relocation fixup for them does not +# translate to the -Bsymbolic -pie format required by self_reloc() in loader(8). +# Also, the fpu is not available in a standalone environment. +.if ${COMPILER_VERSION} < 30800 +CFLAGS.clang+= -mllvm -arm-use-movt=0 +.else +CFLAGS.clang+= -mno-movt +.endif +CFLAGS.clang+= -mfpu=none +.endif + +# The boot loader build uses dd status=none, where possible, for reproducible +# build output (since performance varies from run to run). Trouble is that +# option was recently (10.3) added to FreeBSD and is non-standard. Only use it +# when this test succeeds rather than require dd to be a bootstrap tool. +DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true +DD=dd ${DD_NOSTATUS} + +.if ${MK_LOADER_FORCE_LE} != "no" +.if ${MACHINE_ARCH} == "powerpc64" +CFLAGS+= -mlittle-endian +.endif +.endif + +.endif Copied: stable/11/stand/Makefile.mips (from r329144, stable/11/sys/boot/Makefile.mips) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.mips Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.mips) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +.if ${MK_FDT} != "no" +SUBDIR+= fdt +.endif + +SUBDIR+= uboot Copied: stable/11/stand/Makefile.pc98 (from r329144, stable/11/sys/boot/Makefile.pc98) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.pc98 Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.pc98) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +SUBDIR+= libstand32 Copied: stable/11/stand/Makefile.powerpc (from r329144, stable/11/sys/boot/Makefile.powerpc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.powerpc Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.powerpc) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.if ${MK_FDT} != "no" +SUBDIR+= fdt +.endif + +SUBDIR+= ofw +SUBDIR+= uboot Copied: stable/11/stand/Makefile.sparc64 (from r329144, stable/11/sys/boot/Makefile.sparc64) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/Makefile.sparc64 Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/Makefile.sparc64) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +SUBDIR+= ofw +.if ${MK_ZFS} != "no" +SUBDIR+= zfs +.endif Copied and modified: stable/11/stand/defs.mk (from r329144, stable/11/sys/boot/defs.mk) ============================================================================== --- stable/11/sys/boot/defs.mk Sun Feb 11 22:38:16 2018 (r329144, copy source) +++ stable/11/stand/defs.mk Mon Feb 12 01:08:44 2018 (r329145) @@ -5,7 +5,7 @@ .if !defined(__BOOT_DEFS_MK__) __BOOT_DEFS_MK__=${MFILE} -BOOTSRC= ${SRCTOP}/sys/boot +BOOTSRC= ${SRCTOP}/stand EFISRC= ${BOOTSRC}/efi EFIINC= ${EFISRC}/include EFIINCMD= ${EFIINC}/${MACHINE} @@ -17,7 +17,7 @@ SYSDIR= ${SRCTOP}/sys UBOOTSRC= ${BOOTSRC}/uboot ZFSSRC= ${BOOTSRC}/zfs -BOOTOBJ= ${OBJTOP}/sys/boot +BOOTOBJ= ${OBJTOP}/stand # BINDIR is where we install BINDIR?= /boot Copied: stable/11/stand/fdt.mk (from r329144, stable/11/sys/boot/fdt.mk) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/fdt.mk Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/fdt.mk) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +.if ${MK_FDT} == "yes" +CFLAGS+= -I${FDTSRC} +CFLAGS+= -I${BOOTOBJ}/fdt +CFLAGS+= -I${SYSDIR}/contrib/libfdt +CFLAGS+= -DLOADER_FDT_SUPPORT +LIBFDT= ${BOOTOBJ}/fdt/libfdt.a +.endif Copied: stable/11/stand/fdt/Makefile (from r329144, stable/11/sys/boot/fdt/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/fdt/Makefile Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/fdt/Makefile) @@ -0,0 +1,28 @@ +# $FreeBSD$ + +.include + +.PATH: ${SYSDIR}/contrib/libfdt/ + +LIB= fdt +INTERNALLIB= + +# Vendor sources of libfdt. +SRCS+= fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c \ + fdt_empty_tree.c fdt_addresses.c fdt_overlay.c + +# Loader's fdt commands extension sources. +SRCS+= fdt_loader_cmd.c + +CFLAGS+= -I${SYSDIR}/contrib/libfdt/ -I${LDRSRC} + +CFLAGS+= -ffreestanding + +.if ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips" +CFLAGS+= -msoft-float +.endif + +CFLAGS+= -Wformat -Wall + +.include +.include Copied: stable/11/stand/fdt/Makefile.depend (from r329144, stable/11/sys/boot/fdt/Makefile.depend) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/fdt/Makefile.depend Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/fdt/Makefile.depend) @@ -0,0 +1,14 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + include \ + include/xlocale \ + lib/libstand \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Copied: stable/11/stand/fdt/fdt_loader_cmd.c (from r329144, stable/11/sys/boot/fdt/fdt_loader_cmd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/fdt/fdt_loader_cmd.c Mon Feb 12 01:08:44 2018 (r329145, copy of r329144, stable/11/sys/boot/fdt/fdt_loader_cmd.c) @@ -0,0 +1,1796 @@ +/*- + * Copyright (c) 2009-2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Semihalf under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include "bootstrap.h" +#include "fdt_platform.h" + +#ifdef DEBUG +#define debugf(fmt, args...) do { printf("%s(): ", __func__); \ + printf(fmt,##args); } while (0) +#else +#define debugf(fmt, args...) +#endif + +#define FDT_CWD_LEN 256 +#define FDT_MAX_DEPTH 12 + +#define FDT_PROP_SEP " = " + +#define COPYOUT(s,d,l) archsw.arch_copyout(s, d, l) +#define COPYIN(s,d,l) archsw.arch_copyin(s, d, l) + +#define FDT_STATIC_DTB_SYMBOL "fdt_static_dtb" + +#define CMD_REQUIRES_BLOB 0x01 + +/* Location of FDT yet to be loaded. */ +/* This may be in read-only memory, so can't be manipulated directly. */ +static struct fdt_header *fdt_to_load = NULL; +/* Location of FDT on heap. */ +/* This is the copy we actually manipulate. */ +static struct fdt_header *fdtp = NULL; +/* Size of FDT blob */ +static size_t fdtp_size = 0; +/* Location of FDT in kernel or module. */ +/* This won't be set if FDT is loaded from disk or memory. */ +/* If it is set, we'll update it when fdt_copy() gets called. */ +static vm_offset_t fdtp_va = 0; + +static int fdt_load_dtb(vm_offset_t va); +static void fdt_print_overlay_load_error(int err, const char *filename); + +static int fdt_cmd_nyi(int argc, char *argv[]); +static int fdt_load_dtb_overlays_string(const char * filenames); + +static int fdt_cmd_addr(int argc, char *argv[]); +static int fdt_cmd_mkprop(int argc, char *argv[]); +static int fdt_cmd_cd(int argc, char *argv[]); +static int fdt_cmd_hdr(int argc, char *argv[]); +static int fdt_cmd_ls(int argc, char *argv[]); +static int fdt_cmd_prop(int argc, char *argv[]); +static int fdt_cmd_pwd(int argc, char *argv[]); +static int fdt_cmd_rm(int argc, char *argv[]); +static int fdt_cmd_mknode(int argc, char *argv[]); +static int fdt_cmd_mres(int argc, char *argv[]); + +typedef int cmdf_t(int, char *[]); + +struct cmdtab { + const char *name; + cmdf_t *handler; + int flags; +}; + +static const struct cmdtab commands[] = { + { "addr", &fdt_cmd_addr, 0 }, + { "alias", &fdt_cmd_nyi, 0 }, + { "cd", &fdt_cmd_cd, CMD_REQUIRES_BLOB }, + { "header", &fdt_cmd_hdr, CMD_REQUIRES_BLOB }, + { "ls", &fdt_cmd_ls, CMD_REQUIRES_BLOB }, + { "mknode", &fdt_cmd_mknode, CMD_REQUIRES_BLOB }, + { "mkprop", &fdt_cmd_mkprop, CMD_REQUIRES_BLOB }, + { "mres", &fdt_cmd_mres, CMD_REQUIRES_BLOB }, + { "prop", &fdt_cmd_prop, CMD_REQUIRES_BLOB }, + { "pwd", &fdt_cmd_pwd, CMD_REQUIRES_BLOB }, + { "rm", &fdt_cmd_rm, CMD_REQUIRES_BLOB }, + { NULL, NULL } +}; + +static char cwd[FDT_CWD_LEN] = "/"; + +static vm_offset_t +fdt_find_static_dtb() +{ + Elf_Ehdr *ehdr; + Elf_Shdr *shdr; + Elf_Sym sym; + vm_offset_t strtab, symtab, fdt_start; + uint64_t offs; + struct preloaded_file *kfp; + struct file_metadata *md; + char *strp; + int i, sym_count; + + debugf("fdt_find_static_dtb()\n"); + + sym_count = symtab = strtab = 0; + strp = NULL; + + offs = __elfN(relocation_offset); + + kfp = file_findfile(NULL, NULL); + if (kfp == NULL) + return (0); + + /* Locate the dynamic symbols and strtab. */ + md = file_findmetadata(kfp, MODINFOMD_ELFHDR); + if (md == NULL) + return (0); + ehdr = (Elf_Ehdr *)md->md_data; + + md = file_findmetadata(kfp, MODINFOMD_SHDR); + if (md == NULL) + return (0); + shdr = (Elf_Shdr *)md->md_data; + + for (i = 0; i < ehdr->e_shnum; ++i) { + if (shdr[i].sh_type == SHT_DYNSYM && symtab == 0) { + symtab = shdr[i].sh_addr + offs; + sym_count = shdr[i].sh_size / sizeof(Elf_Sym); + } else if (shdr[i].sh_type == SHT_STRTAB && strtab == 0) { + strtab = shdr[i].sh_addr + offs; + } + } + + /* + * The most efficient way to find a symbol would be to calculate a + * hash, find proper bucket and chain, and thus find a symbol. + * However, that would involve code duplication (e.g. for hash + * function). So we're using simpler and a bit slower way: we're + * iterating through symbols, searching for the one which name is + * 'equal' to 'fdt_static_dtb'. To speed up the process a little bit, + * we are eliminating symbols type of which is not STT_NOTYPE, or(and) + * those which binding attribute is not STB_GLOBAL. + */ + fdt_start = 0; + while (sym_count > 0 && fdt_start == 0) { + COPYOUT(symtab, &sym, sizeof(sym)); + symtab += sizeof(sym); + --sym_count; + if (ELF_ST_BIND(sym.st_info) != STB_GLOBAL || + ELF_ST_TYPE(sym.st_info) != STT_NOTYPE) + continue; + strp = strdupout(strtab + sym.st_name); + if (strcmp(strp, FDT_STATIC_DTB_SYMBOL) == 0) + fdt_start = (vm_offset_t)sym.st_value + offs; + free(strp); + } + return (fdt_start); +} + +static int +fdt_load_dtb(vm_offset_t va) +{ + struct fdt_header header; + int err; + + debugf("fdt_load_dtb(0x%08jx)\n", (uintmax_t)va); + + COPYOUT(va, &header, sizeof(header)); + err = fdt_check_header(&header); + if (err < 0) { + if (err == -FDT_ERR_BADVERSION) { + snprintf(command_errbuf, sizeof(command_errbuf), + "incompatible blob version: %d, should be: %d", + fdt_version(fdtp), FDT_LAST_SUPPORTED_VERSION); + } else { + snprintf(command_errbuf, sizeof(command_errbuf), + "error validating blob: %s", fdt_strerror(err)); + } + return (1); + } + + /* + * Release previous blob + */ + if (fdtp) + free(fdtp); + + fdtp_size = fdt_totalsize(&header); + fdtp = malloc(fdtp_size); + + if (fdtp == NULL) { + command_errmsg = "can't allocate memory for device tree copy"; + return (1); + } + + fdtp_va = va; + COPYOUT(va, fdtp, fdtp_size); + debugf("DTB blob found at 0x%jx, size: 0x%jx\n", (uintmax_t)va, (uintmax_t)fdtp_size); + + return (0); +} + +int +fdt_load_dtb_addr(struct fdt_header *header) +{ + int err; + + debugf("fdt_load_dtb_addr(%p)\n", header); + + fdtp_size = fdt_totalsize(header); + err = fdt_check_header(header); + if (err < 0) { + snprintf(command_errbuf, sizeof(command_errbuf), + "error validating blob: %s", fdt_strerror(err)); + return (err); + } + free(fdtp); + if ((fdtp = malloc(fdtp_size)) == NULL) { + command_errmsg = "can't allocate memory for device tree copy"; + return (1); + } + + fdtp_va = 0; // Don't write this back into module or kernel. + bcopy(header, fdtp, fdtp_size); + return (0); +} + +int +fdt_load_dtb_file(const char * filename) +{ + struct preloaded_file *bfp, *oldbfp; + int err; + + debugf("fdt_load_dtb_file(%s)\n", filename); + + oldbfp = file_findfile(NULL, "dtb"); + + /* Attempt to load and validate a new dtb from a file. */ + if ((bfp = file_loadraw(filename, "dtb", 1)) == NULL) { + snprintf(command_errbuf, sizeof(command_errbuf), + "failed to load file '%s'", filename); + return (1); + } + if ((err = fdt_load_dtb(bfp->f_addr)) != 0) { + file_discard(bfp); + return (err); + } + + /* A new dtb was validated, discard any previous file. */ + if (oldbfp) + file_discard(oldbfp); + return (0); +} + +static int +fdt_load_dtb_overlay(const char * filename) +{ + struct preloaded_file *bfp; + struct fdt_header header; + int err; + + debugf("fdt_load_dtb_overlay(%s)\n", filename); + + /* Attempt to load and validate a new dtb from a file. FDT_ERR_NOTFOUND + * is normally a libfdt error code, but libfdt would actually return + * -FDT_ERR_NOTFOUND. We re-purpose the error code here to convey a + * similar meaning: the file itself was not found, which can still be + * considered an error dealing with FDT pieces. + */ + if ((bfp = file_loadraw(filename, "dtbo", 1)) == NULL) + return (FDT_ERR_NOTFOUND); + + COPYOUT(bfp->f_addr, &header, sizeof(header)); + err = fdt_check_header(&header); + + if (err < 0) { + file_discard(bfp); + return (err); + } + + return (0); +} + +static void +fdt_print_overlay_load_error(int err, const char *filename) +{ + + switch (err) { + case FDT_ERR_NOTFOUND: + printf("%s: failed to load file\n", filename); + break; + case -FDT_ERR_BADVERSION: + printf("%s: incompatible blob version: %d, should be: %d\n", + filename, fdt_version(fdtp), + FDT_LAST_SUPPORTED_VERSION); + break; + default: + /* libfdt errs are negative */ + if (err < 0) + printf("%s: error validating blob: %s\n", + filename, fdt_strerror(err)); + else + printf("%s: unknown load error\n", filename); + break; + } +} + +static int +fdt_load_dtb_overlays_string(const char * filenames) +{ + char *names; + char *name, *name_ext; + char *comaptr; + int err, namesz; + + debugf("fdt_load_dtb_overlays_string(%s)\n", filenames); + + names = strdup(filenames); + if (names == NULL) + return (1); + name = names; + do { + comaptr = strchr(name, ','); + if (comaptr) + *comaptr = '\0'; + err = fdt_load_dtb_overlay(name); + if (err == FDT_ERR_NOTFOUND) { + /* Allocate enough to append ".dtbo" */ + namesz = strlen(name) + 6; + name_ext = malloc(namesz); + if (name_ext == NULL) { + fdt_print_overlay_load_error(err, name); + name = comaptr + 1; + continue; + } + snprintf(name_ext, namesz, "%s.dtbo", name); + err = fdt_load_dtb_overlay(name_ext); + free(name_ext); + } + /* Catch error with either initial load or fallback load */ + if (err != 0) + fdt_print_overlay_load_error(err, name); + name = comaptr + 1; + } while(comaptr); + + free(names); + return (0); +} + +void +fdt_apply_overlays() +{ + struct preloaded_file *fp; + size_t max_overlay_size, next_fdtp_size; + size_t current_fdtp_size; + void *current_fdtp; + void *next_fdtp; + void *overlay; + int rv; + + if ((fdtp == NULL) || (fdtp_size == 0)) + return; + + max_overlay_size = 0; + for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) { + if (max_overlay_size < fp->f_size) + max_overlay_size = fp->f_size; + } + + /* Nothing to apply */ + if (max_overlay_size == 0) + return; + + overlay = malloc(max_overlay_size); + if (overlay == NULL) { + printf("failed to allocate memory for DTB blob with overlays\n"); + return; + } + current_fdtp = fdtp; + current_fdtp_size = fdtp_size; + for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) { + printf("applying DTB overlay '%s'\n", fp->f_name); + next_fdtp_size = current_fdtp_size + fp->f_size; + next_fdtp = malloc(next_fdtp_size); + if (next_fdtp == NULL) { + /* + * Output warning, then move on to applying other + * overlays in case this one is simply too large. + */ + printf("failed to allocate memory for overlay base\n"); + continue; + } + rv = fdt_open_into(current_fdtp, next_fdtp, next_fdtp_size); + if (rv != 0) { + free(next_fdtp); + printf("failed to open base dtb into overlay base\n"); + continue; + } + COPYOUT(fp->f_addr, overlay, fp->f_size); + /* Both overlay and next_fdtp may be modified in place */ + rv = fdt_overlay_apply(next_fdtp, overlay); + if (rv == 0) { + /* Rotate next -> current */ + if (current_fdtp != fdtp) + free(current_fdtp); + current_fdtp = next_fdtp; + current_fdtp_size = next_fdtp_size; + } else { + /* + * Assume here that the base we tried to apply on is + * either trashed or in an inconsistent state. Trying to + * load it might work, but it's better to discard it and + * play it safe. */ + free(next_fdtp); + printf("failed to apply overlay: %s\n", + fdt_strerror(rv)); + } + } + /* We could have failed to apply all overlays; then we do nothing */ + if (current_fdtp != fdtp) { + free(fdtp); + fdtp = current_fdtp; + fdtp_size = current_fdtp_size; + } + free(overlay); +} + +int +fdt_setup_fdtp() +{ + struct preloaded_file *bfp; + vm_offset_t va; + + debugf("fdt_setup_fdtp()\n"); + + /* If we already loaded a file, use it. */ + if ((bfp = file_findfile(NULL, "dtb")) != NULL) { + if (fdt_load_dtb(bfp->f_addr) == 0) { + printf("Using DTB from loaded file '%s'.\n", + bfp->f_name); + return (0); + } + } + + /* If we were given the address of a valid blob in memory, use it. */ + if (fdt_to_load != NULL) { + if (fdt_load_dtb_addr(fdt_to_load) == 0) { + printf("Using DTB from memory address %p.\n", + fdt_to_load); + return (0); + } + } + + if (fdt_platform_load_dtb() == 0) + return (0); + + /* If there is a dtb compiled into the kernel, use it. */ + if ((va = fdt_find_static_dtb()) != 0) { + if (fdt_load_dtb(va) == 0) { + printf("Using DTB compiled into kernel.\n"); + return (0); + } + } + + command_errmsg = "No device tree blob found!\n"; + return (1); +} + +#define fdt_strtovect(str, cellbuf, lim, cellsize) _fdt_strtovect((str), \ + (cellbuf), (lim), (cellsize), 0); + +/* Force using base 16 */ +#define fdt_strtovectx(str, cellbuf, lim, cellsize) _fdt_strtovect((str), \ + (cellbuf), (lim), (cellsize), 16); + +static int +_fdt_strtovect(const char *str, void *cellbuf, int lim, unsigned char cellsize, + uint8_t base) +{ + const char *buf = str; + const char *end = str + strlen(str) - 2; + uint32_t *u32buf = NULL; + uint8_t *u8buf = NULL; + int cnt = 0; + + if (cellsize == sizeof(uint32_t)) + u32buf = (uint32_t *)cellbuf; + else + u8buf = (uint8_t *)cellbuf; + + if (lim == 0) + return (0); + + while (buf < end) { + + /* Skip white whitespace(s)/separators */ + while (!isxdigit(*buf) && buf < end) + buf++; + + if (u32buf != NULL) + u32buf[cnt] = + cpu_to_fdt32((uint32_t)strtol(buf, NULL, base)); + + else + u8buf[cnt] = (uint8_t)strtol(buf, NULL, base); + + if (cnt + 1 <= lim - 1) + cnt++; + else + break; + buf++; + /* Find another number */ + while ((isxdigit(*buf) || *buf == 'x') && buf < end) + buf++; + } + return (cnt); +} + +void +fdt_fixup_ethernet(const char *str, char *ethstr, int len) +{ + uint8_t tmp_addr[6]; + + /* Convert macaddr string into a vector of uints */ + fdt_strtovectx(str, &tmp_addr, 6, sizeof(uint8_t)); + /* Set actual property to a value from vect */ + fdt_setprop(fdtp, fdt_path_offset(fdtp, ethstr), + "local-mac-address", &tmp_addr, 6 * sizeof(uint8_t)); +} + +void +fdt_fixup_cpubusfreqs(unsigned long cpufreq, unsigned long busfreq) +{ + int lo, o = 0, o2, maxo = 0, depth; + const uint32_t zero = 0; + + /* We want to modify every subnode of /cpus */ + o = fdt_path_offset(fdtp, "/cpus"); + if (o < 0) + return; + + /* maxo should contain offset of node next to /cpus */ + depth = 0; + maxo = o; + while (depth != -1) + maxo = fdt_next_node(fdtp, maxo, &depth); + + /* Find CPU frequency properties */ + o = fdt_node_offset_by_prop_value(fdtp, o, "clock-frequency", + &zero, sizeof(uint32_t)); + + o2 = fdt_node_offset_by_prop_value(fdtp, o, "bus-frequency", &zero, + sizeof(uint32_t)); + + lo = MIN(o, o2); + + while (o != -FDT_ERR_NOTFOUND && o2 != -FDT_ERR_NOTFOUND) { + + o = fdt_node_offset_by_prop_value(fdtp, lo, + "clock-frequency", &zero, sizeof(uint32_t)); + + o2 = fdt_node_offset_by_prop_value(fdtp, lo, "bus-frequency", + &zero, sizeof(uint32_t)); + + /* We're only interested in /cpus subnode(s) */ + if (lo > maxo) + break; + + fdt_setprop_inplace_cell(fdtp, lo, "clock-frequency", + (uint32_t)cpufreq); + + fdt_setprop_inplace_cell(fdtp, lo, "bus-frequency", + (uint32_t)busfreq); + + lo = MIN(o, o2); + } +} + +#ifdef notyet +static int *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Mon Feb 12 01:17:10 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08A2AF08347; Mon, 12 Feb 2018 01:17:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 92F9B7604A; Mon, 12 Feb 2018 01:17:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74C7B2C8E; Mon, 12 Feb 2018 01:17:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1C1H9Bf077511; Mon, 12 Feb 2018 01:17:09 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1C1H7Xq077487; Mon, 12 Feb 2018 01:17:07 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802120117.w1C1H7Xq077487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 12 Feb 2018 01:17:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329146 - in stable/11/stand: . arm/uboot efi efi/fdt fdt i386 i386/gptzfsboot i386/libi386 mips/beri mips/beri/boot2 mips/beri/loader mips/uboot ofw/libofw powerpc/boot1.chrp powerpc/k... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand: . arm/uboot efi efi/fdt fdt i386 i386/gptzfsboot i386/libi386 mips/beri mips/beri/boot2 mips/beri/loader mips/uboot ofw/libofw powerpc/boot1.chrp powerpc/kboot powerpc/ofw powerpc/... X-SVN-Commit-Revision: 329146 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 01:17:10 -0000 Author: kevans Date: Mon Feb 12 01:17:06 2018 New Revision: 329146 URL: https://svnweb.freebsd.org/changeset/base/329146 Log: MFC r326038,r326069,r326072: More stand simplification and fixes r326038: Move some more common stuff up to Makefile.inc. r326069: Fix gptzfsboot for cases with GELI. r326072: Unbreak riscv build in universe. Modified: stable/11/stand/Makefile.inc stable/11/stand/arm/uboot/Makefile stable/11/stand/efi/Makefile.inc stable/11/stand/efi/fdt/Makefile stable/11/stand/fdt/Makefile stable/11/stand/i386/Makefile.inc stable/11/stand/i386/gptzfsboot/Makefile stable/11/stand/i386/libi386/Makefile stable/11/stand/mips/beri/Makefile.inc stable/11/stand/mips/beri/boot2/Makefile stable/11/stand/mips/beri/loader/Makefile stable/11/stand/mips/uboot/Makefile stable/11/stand/ofw/libofw/Makefile stable/11/stand/powerpc/boot1.chrp/Makefile stable/11/stand/powerpc/kboot/Makefile stable/11/stand/powerpc/ofw/Makefile stable/11/stand/powerpc/ps3/Makefile stable/11/stand/powerpc/uboot/Makefile stable/11/stand/sparc64/Makefile.inc stable/11/stand/uboot/fdt/Makefile stable/11/stand/uboot/lib/Makefile stable/11/stand/usb/Makefile stable/11/stand/usb/Makefile.test stable/11/stand/userboot/userboot/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/Makefile.inc ============================================================================== --- stable/11/stand/Makefile.inc Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/Makefile.inc Mon Feb 12 01:17:06 2018 (r329146) @@ -9,6 +9,22 @@ CFLAGS+=-I${SASRC} SSP_CFLAGS= +# Add in the no float / no SIMD stuff and announce we're freestanding +# aarch64 and riscv don't have -msoft-float, but all others do. riscv +# currently has no /boot/loader, but may soon. +CFLAGS+= -ffreestanding ${CFLAGS_NO_SIMD} +.if ${MACHINE_CPUARCH} == "aarch64" +CFLAGS+= -mgeneral-regs-only +.elif ${MACHINE_CPUARCH} != "riscv" +CFLAGS+= -msoft-float +.endif + +.if ${MACHINE_CPUARCH} == "i386" || (${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1) +CFLAGS+= -march=i386 +CFLAGS.gcc+= -mpreferred-stack-boundary=2 +.endif + + .if ${MACHINE_CPUARCH} == "arm" # Do not generate movt/movw, because the relocation fixup for them does not # translate to the -Bsymbolic -pie format required by self_reloc() in loader(8). Modified: stable/11/stand/arm/uboot/Makefile ============================================================================== --- stable/11/stand/arm/uboot/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/arm/uboot/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -33,8 +33,6 @@ HELP_FILES+= help.uboot ${BOOTSRC}/fdt/help.fdt # Always add MI sources .include "${BOOTSRC}/loader.mk" -CFLAGS+= -ffreestanding -msoft-float - LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH} LDFLAGS+= -Wl,-znotext Modified: stable/11/stand/efi/Makefile.inc ============================================================================== --- stable/11/stand/efi/Makefile.inc Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/efi/Makefile.inc Mon Feb 12 01:17:06 2018 (r329146) @@ -1,23 +1,13 @@ # $FreeBSD$ -.if ${MACHINE_CPUARCH} == "i386" -CFLAGS+= -march=i386 -CFLAGS+= -mno-aes -.endif - # Options used when building app-specific efi components # See conf/kern.mk for the correct set of these -CFLAGS+= -ffreestanding -Wformat ${CFLAGS_NO_SIMD} +CFLAGS+= -Wformat LDFLAGS+= -nostdlib -.if ${MACHINE_CPUARCH} != "aarch64" -CFLAGS+= -msoft-float -.endif - .if ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -fshort-wchar CFLAGS+= -mno-red-zone -CFLAGS+= -mno-aes .endif .if ${MACHINE_CPUARCH} == "aarch64" Modified: stable/11/stand/efi/fdt/Makefile ============================================================================== --- stable/11/stand/efi/fdt/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/efi/fdt/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -10,13 +10,6 @@ WARNS?= 6 SRCS= efi_fdt.c -CFLAGS+= -ffreestanding -.if ${MACHINE_CPUARCH} == "aarch64" -CFLAGS+= -mgeneral-regs-only -.else -CFLAGS+= -msoft-float -.endif - # EFI library headers CFLAGS+= -I${EFISRC}/include CFLAGS+= -I${EFISRC}/include/${MACHINE} Modified: stable/11/stand/fdt/Makefile ============================================================================== --- stable/11/stand/fdt/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/fdt/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -16,12 +16,6 @@ SRCS+= fdt_loader_cmd.c CFLAGS+= -I${SYSDIR}/contrib/libfdt/ -I${LDRSRC} -CFLAGS+= -ffreestanding - -.if ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips" -CFLAGS+= -msoft-float -.endif - CFLAGS+= -Wformat -Wall .include Modified: stable/11/stand/i386/Makefile.inc ============================================================================== --- stable/11/stand/i386/Makefile.inc Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/i386/Makefile.inc Mon Feb 12 01:17:06 2018 (r329146) @@ -3,9 +3,6 @@ # $FreeBSD$ LOADER_ADDRESS?=0x200000 -CFLAGS+= -march=i386 -ffreestanding -CFLAGS.gcc+= -mpreferred-stack-boundary=2 -CFLAGS+= ${CFLAGS_NO_SIMD} -msoft-float LDFLAGS+= -nostdlib # BTX components Modified: stable/11/stand/i386/gptzfsboot/Makefile ============================================================================== --- stable/11/stand/i386/gptzfsboot/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/i386/gptzfsboot/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -1,6 +1,6 @@ # $FreeBSD$ -HAVE_GPT= yes +HAVE_GELI= yes .include @@ -70,12 +70,12 @@ gptldr.out: gptldr.o ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o CLEANFILES+= gptzfsboot.bin gptzfsboot.out zfsboot.o sio.o cons.o \ - drv.o gpt.o util.o ${OPENCRYPTO_XTS} + drv.o gpt.o ${OPENCRYPTO_XTS} gptzfsboot.bin: gptzfsboot.out ${OBJCOPY} -S -O binary gptzfsboot.out ${.TARGET} -gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o util.o \ +gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o \ ${OPENCRYPTO_XTS} ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBZFSBOOT} ${LIBSA32} Modified: stable/11/stand/i386/libi386/Makefile ============================================================================== --- stable/11/stand/i386/libi386/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/i386/libi386/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -1,6 +1,5 @@ # $FreeBSD$ -HAVE_GPT= yes HAVE_GELI= yes .include Modified: stable/11/stand/mips/beri/Makefile.inc ============================================================================== --- stable/11/stand/mips/beri/Makefile.inc Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/mips/beri/Makefile.inc Mon Feb 12 01:17:06 2018 (r329146) @@ -1,6 +1,5 @@ # $FreeBSD$ -CFLAGS+= -ffreestanding LDFLAGS+= -nostdlib .include "../Makefile.inc" Modified: stable/11/stand/mips/beri/boot2/Makefile ============================================================================== --- stable/11/stand/mips/beri/boot2/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/mips/beri/boot2/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -47,15 +47,13 @@ MAN= AFLAGS= -G0 -CFLAGS= -ffreestanding \ - -I${.CURDIR} \ +CFLAGS+= -I${.CURDIR} \ -I${SASRC} \ -I${LDRSRC} \ -D_KERNEL \ -Wall \ -G0 \ -fno-pic -mno-abicalls \ - -msoft-float \ -g LDFLAGS= -nostdlib \ Modified: stable/11/stand/mips/beri/loader/Makefile ============================================================================== --- stable/11/stand/mips/beri/loader/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/mips/beri/loader/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -83,7 +83,6 @@ CFLAGS+= -I${.CURDIR} CFLAGS+= -G0 \ -fno-pic \ -mno-abicalls \ - -msoft-float \ -g LDFLAGS= -nostdlib \ Modified: stable/11/stand/mips/uboot/Makefile ============================================================================== --- stable/11/stand/mips/uboot/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/mips/uboot/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -29,7 +29,7 @@ HELP_FILES+= help.uboot ${BOOTSRC}/fdt/help.fdt # Always add MI sources .include "${BOOTSRC}/loader.mk" -CFLAGS+= -ffreestanding -msoft-float -g +CFLAGS+= -g LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH} Modified: stable/11/stand/ofw/libofw/Makefile ============================================================================== --- stable/11/stand/ofw/libofw/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/ofw/libofw/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -14,9 +14,7 @@ SRCS+= devicename_stubs.c # Pick up the bootstrap header for some interface items CFLAGS+= -I${LDRSRC} -CFLAGS+= -ffreestanding .if ${MACHINE_CPUARCH} == "powerpc" -CFLAGS+= -msoft-float SRCS+= ppc64_elf_freebsd.c .endif Modified: stable/11/stand/powerpc/boot1.chrp/Makefile ============================================================================== --- stable/11/stand/powerpc/boot1.chrp/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/powerpc/boot1.chrp/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -13,9 +13,7 @@ SRCS= boot1.c ashldi3.c syncicache.c MAN= -CFLAGS= -ffreestanding -msoft-float \ - -I${LDRSRC} -I${SYSDIR} -I${SASRC} \ - -D_STANDALONE +CFLAGS= -I${LDRSRC} -I${SYSDIR} -I${SASRC} -D_STANDALONE LDFLAGS=-nostdlib -static -Wl,-N .PATH: ${SYSDIR}/libkern ${SRCTOP}/lib/libc/powerpc/gen ${.CURDIR} Modified: stable/11/stand/powerpc/kboot/Makefile ============================================================================== --- stable/11/stand/powerpc/kboot/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/powerpc/kboot/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -32,7 +32,7 @@ HELP_FILES= # Disable .include "${BOOTSRC}/loader.mk" .PATH: ${SYSDIR}/libkern -CFLAGS+= -Wall -ffreestanding -msoft-float -DAIM +CFLAGS+= -Wall -DAIM # load address. set in linker script RELOC?= 0x0 CFLAGS+= -DRELOC=${RELOC} Modified: stable/11/stand/powerpc/ofw/Makefile ============================================================================== --- stable/11/stand/powerpc/ofw/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/powerpc/ofw/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -34,7 +34,6 @@ HELP_FILES+= ${FDTSRC}/help.fdt .PATH: ${SYSDIR}/libkern -CFLAGS+= -ffreestanding -msoft-float # load address. set in linker script RELOC?= 0x1C00000 CFLAGS+= -DRELOC=${RELOC} Modified: stable/11/stand/powerpc/ps3/Makefile ============================================================================== --- stable/11/stand/powerpc/ps3/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/powerpc/ps3/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -30,7 +30,7 @@ HELP_FILES= # Disable .include "${BOOTSRC}/loader.mk" .PATH: ${SYSDIR}/libkern -CFLAGS+= -Wall -ffreestanding -msoft-float -DAIM +CFLAGS+= -Wall -DAIM # load address. set in linker script RELOC?= 0x0 CFLAGS+= -DRELOC=${RELOC} Modified: stable/11/stand/powerpc/uboot/Makefile ============================================================================== --- stable/11/stand/powerpc/uboot/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/powerpc/uboot/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -25,8 +25,6 @@ HELP_FILES= # Disable .include "${BOOTSRC}/loader.mk" .PATH: ${SYSDIR}/libkern -CFLAGS+= -ffreestanding - LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powerpc .include "${BOOTSRC}/uboot.mk" Modified: stable/11/stand/sparc64/Makefile.inc ============================================================================== --- stable/11/stand/sparc64/Makefile.inc Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/sparc64/Makefile.inc Mon Feb 12 01:17:06 2018 (r329146) @@ -1,6 +1,5 @@ # $FreeBSD$ -CFLAGS+= -ffreestanding LDFLAGS+= -nostdlib .include "../Makefile.inc" Modified: stable/11/stand/uboot/fdt/Makefile ============================================================================== --- stable/11/stand/uboot/fdt/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/uboot/fdt/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -10,8 +10,6 @@ WARNS?= 2 SRCS= uboot_fdt.c -CFLAGS+= -ffreestanding -msoft-float - # U-Boot library headers CFLAGS+= -I${UBOOTSRC}/lib Modified: stable/11/stand/uboot/lib/Makefile ============================================================================== --- stable/11/stand/uboot/lib/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/uboot/lib/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -11,8 +11,6 @@ WARNS?= 2 SRCS= console.c copy.c devicename.c elf_freebsd.c glue.c SRCS+= module.c net.c reboot.c time.c -CFLAGS+= -ffreestanding -msoft-float - .if ${LOADER_DISK_SUPPORT:Uyes} == "yes" SRCS+= disk.c .endif Modified: stable/11/stand/usb/Makefile ============================================================================== --- stable/11/stand/usb/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/usb/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -36,15 +36,10 @@ INTERNALLIB= CFLAGS+= -DBOOTPROG=\"usbloader\" CFLAGS+= -ffunction-sections -fdata-sections -CFLAGS+= -ffreestanding CFLAGS+= -Wformat -Wall CFLAGS+= -g CFLAGS+= -fno-pic -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" -CFLAGS+= -march=i386 -CFLAGS.gcc+= -mpreferred-stack-boundary=2 -.endif .if ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -m32 .endif Modified: stable/11/stand/usb/Makefile.test ============================================================================== --- stable/11/stand/usb/Makefile.test Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/usb/Makefile.test Mon Feb 12 01:17:06 2018 (r329146) @@ -38,10 +38,6 @@ SRCS= CFLAGS+= -Wall CFLAGS+= -g -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" -CFLAGS+= -march=i386 -CFLAGS.gcc+= -mpreferred-stack-boundary=2 -.endif .if ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -m32 .endif Modified: stable/11/stand/userboot/userboot/Makefile ============================================================================== --- stable/11/stand/userboot/userboot/Makefile Mon Feb 12 01:08:44 2018 (r329145) +++ stable/11/stand/userboot/userboot/Makefile Mon Feb 12 01:17:06 2018 (r329146) @@ -36,7 +36,6 @@ SRCS+= vers.c CFLAGS+= -Wall CFLAGS+= -I${BOOTSRC}/userboot -CFLAGS+= -ffreestanding CWARNFLAGS.main.c += -Wno-implicit-function-declaration From owner-svn-src-stable-11@freebsd.org Mon Feb 12 05:28:53 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95BB4F19F26; Mon, 12 Feb 2018 05:28:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3BC29800AC; Mon, 12 Feb 2018 05:28:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36B8A5A46; Mon, 12 Feb 2018 05:28:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1C5SrkL002103; Mon, 12 Feb 2018 05:28:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1C5SriY002102; Mon, 12 Feb 2018 05:28:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802120528.w1C5SriY002102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 12 Feb 2018 05:28:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329151 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 329151 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 05:28:53 -0000 Author: kevans Date: Mon Feb 12 05:28:52 2018 New Revision: 329151 URL: https://svnweb.freebsd.org/changeset/base/329151 Log: Record-only merge of r326857 and r326888 These are equal and opposite commits*; one to flip GELI support off by default and another to flip it back on. They were made to circumvent some GELI breakage in head that didn't apply to stable/11. The former commit shows up when looking at MFC candidates for stand/, hence the desire for this record. * Equal and opposite except in that r326857 added a comment to zfsldr.S that likely should not have been added at that time. Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-stable-11@freebsd.org Mon Feb 12 05:55:45 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6478F1B833; Mon, 12 Feb 2018 05:55:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8D8D181043; Mon, 12 Feb 2018 05:55:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 885095F23; Mon, 12 Feb 2018 05:55:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1C5tiWm017011; Mon, 12 Feb 2018 05:55:44 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1C5tiZ1017010; Mon, 12 Feb 2018 05:55:44 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802120555.w1C5tiZ1017010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 12 Feb 2018 05:55:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329152 - stable/11/stand/fdt X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/fdt X-SVN-Commit-Revision: 329152 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 05:55:45 -0000 Author: kevans Date: Mon Feb 12 05:55:44 2018 New Revision: 329152 URL: https://svnweb.freebsd.org/changeset/base/329152 Log: MFC r328505,r328659: stand/fdt improvements r328505: stand/fdt: Check /compatible property on overlay if it exists r328659: stand/fdt: Rip out FDT VA tracking Modified: stable/11/stand/fdt/fdt_loader_cmd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/fdt/fdt_loader_cmd.c ============================================================================== --- stable/11/stand/fdt/fdt_loader_cmd.c Mon Feb 12 05:28:52 2018 (r329151) +++ stable/11/stand/fdt/fdt_loader_cmd.c Mon Feb 12 05:55:44 2018 (r329152) @@ -67,13 +67,10 @@ static struct fdt_header *fdt_to_load = NULL; static struct fdt_header *fdtp = NULL; /* Size of FDT blob */ static size_t fdtp_size = 0; -/* Location of FDT in kernel or module. */ -/* This won't be set if FDT is loaded from disk or memory. */ -/* If it is set, we'll update it when fdt_copy() gets called. */ -static vm_offset_t fdtp_va = 0; static int fdt_load_dtb(vm_offset_t va); static void fdt_print_overlay_load_error(int err, const char *filename); +static int fdt_check_overlay_compatible(void *base_fdt, void *overlay_fdt); static int fdt_cmd_nyi(int argc, char *argv[]); static int fdt_load_dtb_overlays_string(const char * filenames); @@ -220,7 +217,6 @@ fdt_load_dtb(vm_offset_t va) return (1); } - fdtp_va = va; COPYOUT(va, fdtp, fdtp_size); debugf("DTB blob found at 0x%jx, size: 0x%jx\n", (uintmax_t)va, (uintmax_t)fdtp_size); @@ -247,7 +243,6 @@ fdt_load_dtb_addr(struct fdt_header *header) return (1); } - fdtp_va = 0; // Don't write this back into module or kernel. bcopy(header, fdtp, fdtp_size); return (0); } @@ -374,6 +369,62 @@ fdt_load_dtb_overlays_string(const char * filenames) return (0); } +/* + * fdt_check_overlay_compatible - check that the overlay_fdt is compatible with + * base_fdt before we attempt to apply it. It will need to re-calculate offsets + * in the base every time, rather than trying to cache them earlier in the + * process, because the overlay application process can/will invalidate a lot of + * offsets. + */ +static int +fdt_check_overlay_compatible(void *base_fdt, void *overlay_fdt) +{ + const char *compat; + int compat_len, ocompat_len; + int oroot_offset, root_offset; + int slidx, sllen; + + oroot_offset = fdt_path_offset(overlay_fdt, "/"); + if (oroot_offset < 0) + return (oroot_offset); + /* + * If /compatible in the overlay does not exist or if it is empty, then + * we're automatically compatible. We do this for the sake of rapid + * overlay development for overlays that aren't intended to be deployed. + * The user assumes the risk of using an overlay without /compatible. + */ + if (fdt_get_property(overlay_fdt, oroot_offset, "compatible", + &ocompat_len) == NULL || ocompat_len == 0) + return (0); + root_offset = fdt_path_offset(base_fdt, "/"); + if (root_offset < 0) + return (root_offset); + /* + * However, an empty or missing /compatible on the base is an error, + * because allowing this offers no advantages. + */ + if (fdt_get_property(base_fdt, root_offset, "compatible", + &compat_len) == NULL) + return (compat_len); + else if(compat_len == 0) + return (1); + + slidx = 0; + compat = fdt_stringlist_get(overlay_fdt, oroot_offset, "compatible", + slidx, &sllen); + while (compat != NULL) { + if (fdt_stringlist_search(base_fdt, root_offset, "compatible", + compat) >= 0) + return (0); + ++slidx; + compat = fdt_stringlist_get(overlay_fdt, oroot_offset, + "compatible", slidx, &sllen); + }; + + /* We've exhausted the overlay's /compatible property... no match */ + return (1); +} + void fdt_apply_overlays() { @@ -406,6 +457,13 @@ fdt_apply_overlays() current_fdtp = fdtp; current_fdtp_size = fdtp_size; for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) { + COPYOUT(fp->f_addr, overlay, fp->f_size); + /* Check compatible first to avoid unnecessary allocation */ + rv = fdt_check_overlay_compatible(current_fdtp, overlay); + if (rv != 0) { + printf("DTB overlay '%s' not compatible\n", fp->f_name); + continue; + } printf("applying DTB overlay '%s'\n", fp->f_name); next_fdtp_size = current_fdtp_size + fp->f_size; next_fdtp = malloc(next_fdtp_size); @@ -423,7 +481,6 @@ fdt_apply_overlays() printf("failed to open base dtb into overlay base\n"); continue; } - COPYOUT(fp->f_addr, overlay, fp->f_size); /* Both overlay and next_fdtp may be modified in place */ rv = fdt_overlay_apply(next_fdtp, overlay); if (rv == 0) { @@ -899,11 +956,6 @@ fdt_copy(vm_offset_t va) if (fdt_fixup() == 0) return (0); - if (fdtp_va != 0) { - /* Overwrite the FDT with the fixed version. */ - /* XXX Is this really appropriate? */ - COPYIN(fdtp, fdtp_va, fdtp_size); - } COPYIN(fdtp, va, fdtp_size); return (fdtp_size); } From owner-svn-src-stable-11@freebsd.org Mon Feb 12 10:34:16 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6FDEF0C4C4; Mon, 12 Feb 2018 10:34:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 68BD66C870; Mon, 12 Feb 2018 10:34:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6392E10C51; Mon, 12 Feb 2018 10:34:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1CAYGYr056783; Mon, 12 Feb 2018 10:34:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1CAYGlZ056782; Mon, 12 Feb 2018 10:34:16 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802121034.w1CAYGlZ056782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 12 Feb 2018 10:34:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329156 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 329156 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 10:34:16 -0000 Author: kib Date: Mon Feb 12 10:34:15 2018 New Revision: 329156 URL: https://svnweb.freebsd.org/changeset/base/329156 Log: MFC r328880: On munlock(), unwire correct page. Modified: stable/11/sys/vm/vm_object.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_object.c ============================================================================== --- stable/11/sys/vm/vm_object.c Mon Feb 12 06:52:49 2018 (r329155) +++ stable/11/sys/vm/vm_object.c Mon Feb 12 10:34:15 2018 (r329156) @@ -2268,7 +2268,7 @@ void vm_object_unwire(vm_object_t object, vm_ooffset_t offset, vm_size_t length, uint8_t queue) { - vm_object_t tobject; + vm_object_t tobject, t1object; vm_page_t m, tm; vm_pindex_t end_pindex, pindex, tpindex; int depth, locked_depth; @@ -2282,6 +2282,7 @@ vm_object_unwire(vm_object_t object, vm_ooffset_t offs return; pindex = OFF_TO_IDX(offset); end_pindex = pindex + atop(length); +again: locked_depth = 1; VM_OBJECT_RLOCK(object); m = vm_page_find_least(object, pindex); @@ -2315,16 +2316,26 @@ vm_object_unwire(vm_object_t object, vm_ooffset_t offs m = TAILQ_NEXT(m, listq); } vm_page_lock(tm); + if (vm_page_xbusied(tm)) { + for (tobject = object; locked_depth >= 1; + locked_depth--) { + t1object = tobject->backing_object; + VM_OBJECT_RUNLOCK(tobject); + tobject = t1object; + } + vm_page_busy_sleep(tm, "unwbo", true); + goto again; + } vm_page_unwire(tm, queue); vm_page_unlock(tm); next_page: pindex++; } /* Release the accumulated object locks. */ - for (depth = 0; depth < locked_depth; depth++) { - tobject = object->backing_object; - VM_OBJECT_RUNLOCK(object); - object = tobject; + for (tobject = object; locked_depth >= 1; locked_depth--) { + t1object = tobject->backing_object; + VM_OBJECT_RUNLOCK(tobject); + tobject = t1object; } } From owner-svn-src-stable-11@freebsd.org Mon Feb 12 12:41:55 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE6A9F1733E; Mon, 12 Feb 2018 12:41:54 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 947C87281B; Mon, 12 Feb 2018 12:41:54 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F37B12011; Mon, 12 Feb 2018 12:41:54 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1CCfsJr021904; Mon, 12 Feb 2018 12:41:54 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1CCfsb4021900; Mon, 12 Feb 2018 12:41:54 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201802121241.w1CCfsb4021900@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 12 Feb 2018 12:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329157 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 329157 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 12:41:55 -0000 Author: ae Date: Mon Feb 12 12:41:53 2018 New Revision: 329157 URL: https://svnweb.freebsd.org/changeset/base/329157 Log: MFC r328876: Modify ip6_get_prevhdr() to be able use it safely. Instead of returning pointer to the previous header, return its offset. In frag6_input() use m_copyback() and determined offset to store next header instead of accessing to it by pointer and assuming that the memory is contiguous. In rip6_input() use offset returned by ip6_get_prevhdr() instead of calculating it from pointers arithmetic, because IP header can belong to another mbuf in the chain. Reported by: Maxime Villard Modified: stable/11/sys/netinet6/frag6.c stable/11/sys/netinet6/ip6_input.c stable/11/sys/netinet6/ip6_var.h stable/11/sys/netinet6/raw_ip6.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/frag6.c ============================================================================== --- stable/11/sys/netinet6/frag6.c Mon Feb 12 10:34:15 2018 (r329156) +++ stable/11/sys/netinet6/frag6.c Mon Feb 12 12:41:53 2018 (r329157) @@ -575,10 +575,8 @@ insert: /* * Store NXT to the original. */ - { - char *prvnxtp = ip6_get_prevhdr(m, offset); /* XXX */ - *prvnxtp = nxt; - } + m_copyback(m, ip6_get_prevhdr(m, offset), sizeof(uint8_t), + (caddr_t)&nxt); frag6_remque(q6); V_frag6_nfrags -= q6->ip6q_nfrag; Modified: stable/11/sys/netinet6/ip6_input.c ============================================================================== --- stable/11/sys/netinet6/ip6_input.c Mon Feb 12 10:34:15 2018 (r329156) +++ stable/11/sys/netinet6/ip6_input.c Mon Feb 12 12:41:53 2018 (r329157) @@ -1625,49 +1625,39 @@ ip6_pullexthdr(struct mbuf *m, size_t off, int nxt) /* * Get pointer to the previous header followed by the header * currently processed. - * XXX: This function supposes that - * M includes all headers, - * the next header field and the header length field of each header - * are valid, and - * the sum of each header length equals to OFF. - * Because of these assumptions, this function must be called very - * carefully. Moreover, it will not be used in the near future when - * we develop `neater' mechanism to process extension headers. */ -char * +int ip6_get_prevhdr(const struct mbuf *m, int off) { - struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct ip6_ext ip6e; + struct ip6_hdr *ip6; + int len, nlen, nxt; if (off == sizeof(struct ip6_hdr)) - return (&ip6->ip6_nxt); - else { - int len, nxt; - struct ip6_ext *ip6e = NULL; + return (offsetof(struct ip6_hdr, ip6_nxt)); + if (off < sizeof(struct ip6_hdr)) + panic("%s: off < sizeof(struct ip6_hdr)", __func__); - nxt = ip6->ip6_nxt; - len = sizeof(struct ip6_hdr); - while (len < off) { - ip6e = (struct ip6_ext *)(mtod(m, caddr_t) + len); - - switch (nxt) { - case IPPROTO_FRAGMENT: - len += sizeof(struct ip6_frag); - break; - case IPPROTO_AH: - len += (ip6e->ip6e_len + 2) << 2; - break; - default: - len += (ip6e->ip6e_len + 1) << 3; - break; - } - nxt = ip6e->ip6e_nxt; + ip6 = mtod(m, struct ip6_hdr *); + nxt = ip6->ip6_nxt; + len = sizeof(struct ip6_hdr); + nlen = 0; + while (len < off) { + m_copydata(m, len, sizeof(ip6e), (caddr_t)&ip6e); + switch (nxt) { + case IPPROTO_FRAGMENT: + nlen = sizeof(struct ip6_frag); + break; + case IPPROTO_AH: + nlen = (ip6e.ip6e_len + 2) << 2; + break; + default: + nlen = (ip6e.ip6e_len + 1) << 3; } - if (ip6e) - return (&ip6e->ip6e_nxt); - else - return NULL; + len += nlen; + nxt = ip6e.ip6e_nxt; } + return (len - nlen); } /* Modified: stable/11/sys/netinet6/ip6_var.h ============================================================================== --- stable/11/sys/netinet6/ip6_var.h Mon Feb 12 10:34:15 2018 (r329156) +++ stable/11/sys/netinet6/ip6_var.h Mon Feb 12 12:41:53 2018 (r329157) @@ -362,7 +362,7 @@ void ip6_direct_input(struct mbuf *); void ip6_freepcbopts(struct ip6_pktopts *); int ip6_unknown_opt(u_int8_t *, struct mbuf *, int); -char * ip6_get_prevhdr(const struct mbuf *, int); +int ip6_get_prevhdr(const struct mbuf *, int); int ip6_nexthdr(const struct mbuf *, int, int, int *); int ip6_lasthdr(const struct mbuf *, int, int, int *); Modified: stable/11/sys/netinet6/raw_ip6.c ============================================================================== --- stable/11/sys/netinet6/raw_ip6.c Mon Feb 12 10:34:15 2018 (r329156) +++ stable/11/sys/netinet6/raw_ip6.c Mon Feb 12 12:41:53 2018 (r329157) @@ -323,12 +323,10 @@ rip6_input(struct mbuf **mp, int *offp, int proto) RIP6STAT_INC(rip6s_nosockmcast); if (proto == IPPROTO_NONE) m_freem(m); - else { - char *prvnxtp = ip6_get_prevhdr(m, *offp); /* XXX */ + else icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_NEXTHEADER, - prvnxtp - mtod(m, char *)); - } + ip6_get_prevhdr(m, *offp)); IP6STAT_DEC(ip6s_delivered); } return (IPPROTO_DONE); From owner-svn-src-stable-11@freebsd.org Mon Feb 12 13:56:58 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68847F1C8BA; Mon, 12 Feb 2018 13:56:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 16BC275531; Mon, 12 Feb 2018 13:56:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10B4912C9E; Mon, 12 Feb 2018 13:56:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1CDuvX2057275; Mon, 12 Feb 2018 13:56:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1CDuvgC057268; Mon, 12 Feb 2018 13:56:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802121356.w1CDuvgC057268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 12 Feb 2018 13:56:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329159 - in stable/11/sys: amd64/conf conf dev/mlx4 dev/mlx4/mlx4_core dev/mlx4/mlx4_en dev/mlx4/mlx4_ib i386/conf modules modules/mlx4 modules/mlx4en modules/mlx4ib modules/mlxen ofed... X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: amd64/conf conf dev/mlx4 dev/mlx4/mlx4_core dev/mlx4/mlx4_en dev/mlx4/mlx4_ib i386/conf modules modules/mlx4 modules/mlx4en modules/mlx4ib modules/mlxen ofed/drivers/infiniband/hw/ml... X-SVN-Commit-Revision: 329159 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 13:56:58 -0000 Author: hselasky Date: Mon Feb 12 13:56:57 2018 New Revision: 329159 URL: https://svnweb.freebsd.org/changeset/base/329159 Log: MFC r306486-r325841: Update the mlx4, mlx4ib(4) and mlx4en(4) drivers to match FreeBSD-head prior to the Linux 4.9 RoCE/infiniband upgrade. Sponsored by: Mellanox Technologies MFC r306486: Move the ConnectX-3 and ConnectX-2 driver from sys/ofed into sys/dev/mlx4 like other PCI network drivers. The sys/ofed directory is now mainly reserved for generic infiniband code, with exception of the mthca driver. - Add new manual page, mlx4en(4), describing how to configure and load mlx4en. - All relevant driver C-files are now prefixed mlx4, mlx4_en and mlx4_ib respectivly to avoid object filename collisions when compiling the kernel. This also fixes an issue with proper dependency file generation for the C-files in question. - Device mlxen is now device mlx4en and depends on device mlx4, see mlx4en(4). Only the network device name remains unchanged. - The mlx4 and mlx4en modules are now built by default on i386 and amd64 targets. Only building the mlx4ib module depends on WITH_OFED=YES . Sponsored by: Mellanox Technologies MFC r310425: mlx: avoid use of __DATE__ to make build reproducible Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D8886 MFC r310488: mlx(4): remove date from log message Further to r310425, go one step further and just remove the date. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D8888 MFC r324200: Implement SIOCGIFRSS{KEY,HASH} for the mlx4en(4) driver. Differential Revision: https://reviews.freebsd.org/D12176 Sponsored by: Mellanox Technologies MFC r324201: Setup mbuf hash type properly when receiving IP packets in the mlx4en(4) driver. Submitted by: sephe@ Differential Revision: https://reviews.freebsd.org/D12229 Sponsored by: Mellanox Technologies MFC r324621: mlx4: use enum constants instead of const vars for case exprs Follow up from r324201 to fix compilation with gcc, which complains about non-ICE case expressions. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D12675 MFC r325841: Update the mlx4 core and mlx4en(4) modules towards Linux v4.9. Background: The coming ibcore update forces an update of mlx4ib(4) which in turn requires an updated mlx4 core module. This also affects the mlx4en(4) module because commonly used APIs are updated. This commit is a middle step updating the mlx4 modules towards the new ibcore. This change contains no major new features. Changes in mlx4: a) Improved error handling when mlx4 PCI devices are detached inside VMs. b) Major update of codebase towards Linux 4.9. Changes in mlx4ib(4): a) Minimal changes needed in order to compile using the updated mlx4 core APIs. Changes in mlx4en(4): a) Update flow steering code in mlx4en to use new APIs for registering MAC addresses and IP addresses. b) Update all statistics counters to be 64-bit. c) Minimal changes needed in order to compile using the updated mlx4 core APIs. Sponsored by: Mellanox Technologies Added: stable/11/sys/dev/mlx4/ - copied from r306486, head/sys/dev/mlx4/ stable/11/sys/dev/mlx4/mlx4_core/fw_qos.h (contents, props changed) stable/11/sys/dev/mlx4/mlx4_core/mlx4_fw_qos.c (contents, props changed) stable/11/sys/modules/mlx4en/ - copied from r306486, head/sys/modules/mlx4en/ Deleted: stable/11/sys/dev/mlx4/mlx4_core/mlx4_sys_tune.c stable/11/sys/modules/mlxen/ stable/11/sys/ofed/drivers/infiniband/hw/mlx4/ stable/11/sys/ofed/drivers/net/ stable/11/sys/ofed/include/linux/ Modified: stable/11/sys/amd64/conf/NOTES stable/11/sys/conf/files stable/11/sys/dev/mlx4/cmd.h stable/11/sys/dev/mlx4/cq.h stable/11/sys/dev/mlx4/device.h stable/11/sys/dev/mlx4/driver.h stable/11/sys/dev/mlx4/mlx4_core/fw.h stable/11/sys/dev/mlx4/mlx4_core/icm.h stable/11/sys/dev/mlx4/mlx4_core/mlx4.h stable/11/sys/dev/mlx4/mlx4_core/mlx4_alloc.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_catas.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_cmd.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_cq.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_eq.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_fw.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_icm.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_intf.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_main.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_mcg.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_mr.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_pd.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_port.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_profile.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_qp.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_reset.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_resource_tracker.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_sense.c stable/11/sys/dev/mlx4/mlx4_core/mlx4_srq.c stable/11/sys/dev/mlx4/mlx4_en/en.h stable/11/sys/dev/mlx4/mlx4_en/en_port.h stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_cq.c stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_main.c stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_port.c stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_resources.c stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib.h stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_mad.c stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_mr.c stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_srq.c stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_sysfs.c stable/11/sys/dev/mlx4/qp.h stable/11/sys/dev/mlx4/stats.h stable/11/sys/i386/conf/NOTES stable/11/sys/modules/Makefile stable/11/sys/modules/mlx4/Makefile stable/11/sys/modules/mlx4en/Makefile stable/11/sys/modules/mlx4ib/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/conf/NOTES ============================================================================== --- stable/11/sys/amd64/conf/NOTES Mon Feb 12 13:52:58 2018 (r329158) +++ stable/11/sys/amd64/conf/NOTES Mon Feb 12 13:56:57 2018 (r329159) @@ -324,7 +324,7 @@ options DRM_DEBUG # Include debug printfs (slow) # ixl: Intel XL710 40Gbe PCIE Ethernet # ixlv: Intel XL710 40Gbe VF PCIE Ethernet # mlx4ib: Mellanox ConnectX HCA InfiniBand -# mlxen: Mellanox ConnectX HCA Ethernet +# mlx4en: Mellanox ConnectX HCA Ethernet # mthca: Mellanox HCA InfiniBand # nfe: nVidia nForce MCP on-board Ethernet Networking (BSD open source) # sfxge: Solarflare SFC9000 family 10Gb Ethernet adapters @@ -343,8 +343,9 @@ device iwn # Intel 4965/1000/5000/6000 wireless NICs device ixl # Intel XL710 40Gbe PCIE Ethernet options IXL_IW # Enable iWARP Client Interface in ixl(4) device ixlv # Intel XL710 40Gbe VF PCIE Ethernet +device mlx4 # Shared code module between IB and Ethernet device mlx4ib # Mellanox ConnectX HCA InfiniBand -device mlxen # Mellanox ConnectX HCA Ethernet +device mlx4en # Mellanox ConnectX HCA Ethernet device mthca # Mellanox HCA InfiniBand device nfe # nVidia nForce MCP on-board Ethernet device sfxge # Solarflare SFC9000 10Gb Ethernet Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Mon Feb 12 13:52:58 2018 (r329158) +++ stable/11/sys/conf/files Mon Feb 12 13:56:57 2018 (r329159) @@ -4286,131 +4286,90 @@ ofed/drivers/infiniband/ulp/sdp/sdp_cma.c optional sdp ofed/drivers/infiniband/ulp/sdp/sdp_tx.c optional sdp inet \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" -ofed/drivers/infiniband/hw/mlx4/alias_GUID.c optional mlx4ib \ - no-depend obj-prefix "mlx4ib_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" -ofed/drivers/infiniband/hw/mlx4/mcg.c optional mlx4ib \ - no-depend obj-prefix "mlx4ib_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" -ofed/drivers/infiniband/hw/mlx4/sysfs.c optional mlx4ib \ - no-depend obj-prefix "mlx4ib_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" -ofed/drivers/infiniband/hw/mlx4/cm.c optional mlx4ib \ - no-depend obj-prefix "mlx4ib_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" -ofed/drivers/infiniband/hw/mlx4/ah.c optional mlx4ib \ - no-depend obj-prefix "mlx4ib_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" -ofed/drivers/infiniband/hw/mlx4/cq.c optional mlx4ib \ - no-depend obj-prefix "mlx4ib_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" -ofed/drivers/infiniband/hw/mlx4/doorbell.c optional mlx4ib \ - no-depend obj-prefix "mlx4ib_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" -ofed/drivers/infiniband/hw/mlx4/mad.c optional mlx4ib \ - no-depend obj-prefix "mlx4ib_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" -ofed/drivers/infiniband/hw/mlx4/main.c optional mlx4ib \ - no-depend obj-prefix "mlx4ib_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" -ofed/drivers/infiniband/hw/mlx4/mlx4_exp.c optional mlx4ib \ - no-depend obj-prefix "mlx4ib_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" -ofed/drivers/infiniband/hw/mlx4/mr.c optional mlx4ib \ - no-depend obj-prefix "mlx4ib_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" -ofed/drivers/infiniband/hw/mlx4/qp.c optional mlx4ib \ - no-depend obj-prefix "mlx4ib_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" -ofed/drivers/infiniband/hw/mlx4/srq.c optional mlx4ib \ - no-depend obj-prefix "mlx4ib_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" -ofed/drivers/infiniband/hw/mlx4/wc.c optional mlx4ib \ - no-depend obj-prefix "mlx4ib_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" +dev/mlx4/mlx4_ib/mlx4_ib_alias_GUID.c optional mlx4ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_ib/mlx4_ib_mcg.c optional mlx4ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_ib/mlx4_ib_sysfs.c optional mlx4ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_ib/mlx4_ib_cm.c optional mlx4ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_ib/mlx4_ib_ah.c optional mlx4ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_ib/mlx4_ib_cq.c optional mlx4ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_ib/mlx4_ib_doorbell.c optional mlx4ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_ib/mlx4_ib_mad.c optional mlx4ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_ib/mlx4_ib_main.c optional mlx4ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_ib/mlx4_ib_exp.c optional mlx4ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_ib/mlx4_ib_mr.c optional mlx4ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_ib/mlx4_ib_qp.c optional mlx4ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_ib/mlx4_ib_srq.c optional mlx4ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_ib/mlx4_ib_wc.c optional mlx4ib pci ofed \ + compile-with "${OFED_C}" -ofed/drivers/net/mlx4/alloc.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/catas.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/cmd.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/cq.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/eq.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/fw.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/icm.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/intf.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/main.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/mcg.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/ -Wno-unused" -ofed/drivers/net/mlx4/mr.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/pd.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/port.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/profile.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/qp.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/reset.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/sense.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/srq.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/resource_tracker.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/sys_tune.c optional mlx4ib | mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" +dev/mlx4/mlx4_core/mlx4_alloc.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_catas.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_cmd.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_cq.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_eq.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_fw.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_fw_qos.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_icm.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_intf.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_main.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_mcg.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_mr.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_pd.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_port.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_profile.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_qp.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_reset.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_sense.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_srq.c optional mlx4 pci \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_core/mlx4_resource_tracker.c optional mlx4 pci \ + compile-with "${OFED_C}" -ofed/drivers/net/mlx4/en_cq.c optional mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/en_main.c optional mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/en_netdev.c optional mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/en_port.c optional mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/en_resources.c optional mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/en_rx.c optional mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/en_tx.c optional mlxen \ - no-depend obj-prefix "mlx4_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" +dev/mlx4/mlx4_en/mlx4_en_cq.c optional mlx4en pci inet inet6 \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_en/mlx4_en_main.c optional mlx4en pci inet inet6 \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_en/mlx4_en_netdev.c optional mlx4en pci inet inet6 \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_en/mlx4_en_port.c optional mlx4en pci inet inet6 \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_en/mlx4_en_resources.c optional mlx4en pci inet inet6 \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_en/mlx4_en_rx.c optional mlx4en pci inet inet6 \ + compile-with "${OFED_C}" +dev/mlx4/mlx4_en/mlx4_en_tx.c optional mlx4en pci inet inet6 \ + compile-with "${OFED_C}" dev/mlx5/mlx5_ib/mlx5_ib_ah.c optional mlx5ib pci ofed \ compile-with "${OFED_C}" Modified: stable/11/sys/dev/mlx4/cmd.h ============================================================================== --- head/sys/dev/mlx4/cmd.h Fri Sep 30 08:23:06 2016 (r306486) +++ stable/11/sys/dev/mlx4/cmd.h Mon Feb 12 13:56:57 2018 (r329159) @@ -36,6 +36,8 @@ #include #include +struct mlx4_counter; + enum { /* initialization and general commands */ MLX4_CMD_SYS_EN = 0x1, @@ -67,8 +69,13 @@ enum { MLX4_CMD_MAP_ICM_AUX = 0xffc, MLX4_CMD_UNMAP_ICM_AUX = 0xffb, MLX4_CMD_SET_ICM_SIZE = 0xffd, + MLX4_CMD_ACCESS_REG = 0x3b, + MLX4_CMD_ALLOCATE_VPP = 0x80, + MLX4_CMD_SET_VPORT_QOS = 0x81, + /*master notify fw on finish for slave's flr*/ MLX4_CMD_INFORM_FLR_DONE = 0x5b, + MLX4_CMD_VIRT_PORT_MAP = 0x5c, MLX4_CMD_GET_OP_REQ = 0x59, /* TPT commands */ @@ -116,6 +123,7 @@ enum { /* special QP and management commands */ MLX4_CMD_CONF_SPECIAL_QP = 0x23, MLX4_CMD_MAD_IFC = 0x24, + MLX4_CMD_MAD_DEMUX = 0x203, /* multicast commands */ MLX4_CMD_READ_MCG = 0x25, @@ -125,6 +133,7 @@ enum { /* miscellaneous commands */ MLX4_CMD_DIAG_RPRT = 0x30, MLX4_CMD_NOP = 0x31, + MLX4_CMD_CONFIG_DEV = 0x3a, MLX4_CMD_ACCESS_MEM = 0x2e, MLX4_CMD_SET_VEP = 0x52, @@ -158,6 +167,9 @@ enum { MLX4_QP_FLOW_STEERING_ATTACH = 0x65, MLX4_QP_FLOW_STEERING_DETACH = 0x66, MLX4_FLOW_STEERING_IB_UC_QP_RANGE = 0x64, + + /* Update and read QCN parameters */ + MLX4_CMD_CONGESTION_CTRL_OPCODE = 0x68, }; enum { @@ -167,27 +179,85 @@ enum { }; enum { + /* virtual to physical port mapping opcode modifiers */ + MLX4_GET_PORT_VIRT2PHY = 0x0, + MLX4_SET_PORT_VIRT2PHY = 0x1, +}; + +enum { MLX4_MAILBOX_SIZE = 4096, MLX4_ACCESS_MEM_ALIGN = 256, }; enum { - /* set port opcode modifiers */ - MLX4_SET_PORT_GENERAL = 0x0, - MLX4_SET_PORT_RQP_CALC = 0x1, - MLX4_SET_PORT_MAC_TABLE = 0x2, - MLX4_SET_PORT_VLAN_TABLE = 0x3, - MLX4_SET_PORT_PRIO_MAP = 0x4, - MLX4_SET_PORT_GID_TABLE = 0x5, - MLX4_SET_PORT_PRIO2TC = 0x8, - MLX4_SET_PORT_SCHEDULER = 0x9 + /* Set port opcode modifiers */ + MLX4_SET_PORT_IB_OPCODE = 0x0, + MLX4_SET_PORT_ETH_OPCODE = 0x1, + MLX4_SET_PORT_BEACON_OPCODE = 0x4, }; enum { + /* Set port Ethernet input modifiers */ + MLX4_SET_PORT_GENERAL = 0x0, + MLX4_SET_PORT_RQP_CALC = 0x1, + MLX4_SET_PORT_MAC_TABLE = 0x2, + MLX4_SET_PORT_VLAN_TABLE = 0x3, + MLX4_SET_PORT_PRIO_MAP = 0x4, + MLX4_SET_PORT_GID_TABLE = 0x5, + MLX4_SET_PORT_PRIO2TC = 0x8, + MLX4_SET_PORT_SCHEDULER = 0x9, + MLX4_SET_PORT_VXLAN = 0xB, + MLX4_SET_PORT_ROCE_ADDR = 0xD +}; + +enum { + MLX4_CMD_MAD_DEMUX_CONFIG = 0, + MLX4_CMD_MAD_DEMUX_QUERY_STATE = 1, + MLX4_CMD_MAD_DEMUX_QUERY_RESTR = 2, /* Query mad demux restrictions */ +}; + +enum { MLX4_CMD_WRAPPED, MLX4_CMD_NATIVE }; +/* + * MLX4_RX_CSUM_MODE_VAL_NON_TCP_UDP - + * Receive checksum value is reported in CQE also for non TCP/UDP packets. + * + * MLX4_RX_CSUM_MODE_L4 - + * L4_CSUM bit in CQE, which indicates whether or not L4 checksum + * was validated correctly, is supported. + * + * MLX4_RX_CSUM_MODE_IP_OK_IP_NON_TCP_UDP - + * IP_OK CQE's field is supported also for non TCP/UDP IP packets. + * + * MLX4_RX_CSUM_MODE_MULTI_VLAN - + * Receive Checksum offload is supported for packets with more than 2 vlan headers. + */ +enum mlx4_rx_csum_mode { + MLX4_RX_CSUM_MODE_VAL_NON_TCP_UDP = 1UL << 0, + MLX4_RX_CSUM_MODE_L4 = 1UL << 1, + MLX4_RX_CSUM_MODE_IP_OK_IP_NON_TCP_UDP = 1UL << 2, + MLX4_RX_CSUM_MODE_MULTI_VLAN = 1UL << 3 +}; + +struct mlx4_config_dev_params { + u16 vxlan_udp_dport; + u8 rx_csum_flags_port_1; + u8 rx_csum_flags_port_2; +}; + +enum mlx4_en_congestion_control_algorithm { + MLX4_CTRL_ALGO_802_1_QAU_REACTION_POINT = 0, +}; + +enum mlx4_en_congestion_control_opmod { + MLX4_CONGESTION_CONTROL_GET_PARAMS, + MLX4_CONGESTION_CONTROL_GET_STATISTICS, + MLX4_CONGESTION_CONTROL_SET_PARAMS = 4, +}; + struct mlx4_dev; struct mlx4_cmd_mailbox { @@ -233,26 +303,28 @@ static inline int mlx4_cmd_imm(struct mlx4_dev *dev, u struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev); void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox); +int mlx4_get_counter_stats(struct mlx4_dev *dev, int counter_index, + struct mlx4_counter *counter_stats, int reset); u32 mlx4_comm_get_version(void); -int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u8 *mac); -int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos); +int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac); +int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, + u8 qos, __be16 proto); +int mlx4_set_vf_rate(struct mlx4_dev *dev, int port, int vf, int min_tx_rate, + int max_tx_rate); int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting); -int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state); -int mlx4_get_vf_link_state(struct mlx4_dev *dev, int port, int vf); +int mlx4_config_dev_retrieval(struct mlx4_dev *dev, + struct mlx4_config_dev_params *params); +void mlx4_cmd_wake_completions(struct mlx4_dev *dev); +void mlx4_report_internal_err_comm_event(struct mlx4_dev *dev); /* * mlx4_get_slave_default_vlan - - * retrun true if VST ( default vlan) - * if VST will fill vlan & qos (if not NULL) + * return true if VST ( default vlan) + * if VST, will return vlan & qos (if not NULL) */ -bool mlx4_get_slave_default_vlan(struct mlx4_dev *dev, int port, int slave, u16 *vlan, u8 *qos); +bool mlx4_get_slave_default_vlan(struct mlx4_dev *dev, int port, int slave, + u16 *vlan, u8 *qos); -enum { - IFLA_VF_LINK_STATE_AUTO, /* link state of the uplink */ - IFLA_VF_LINK_STATE_ENABLE, /* link always up */ - IFLA_VF_LINK_STATE_DISABLE, /* link always down */ - __IFLA_VF_LINK_STATE_MAX, -}; - #define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8) +#define COMM_CHAN_EVENT_INTERNAL_ERR (1 << 17) #endif /* MLX4_CMD_H */ Modified: stable/11/sys/dev/mlx4/cq.h ============================================================================== --- head/sys/dev/mlx4/cq.h Fri Sep 30 08:23:06 2016 (r306486) +++ stable/11/sys/dev/mlx4/cq.h Mon Feb 12 13:56:57 2018 (r329159) @@ -42,31 +42,22 @@ struct mlx4_cqe { __be32 vlan_my_qpn; __be32 immed_rss_invalid; __be32 g_mlpath_rqpn; + __be16 sl_vid; union { struct { - union { - struct { - __be16 sl_vid; - __be16 rlid; - }; - __be32 timestamp_16_47; - }; + __be16 rlid; __be16 status; u8 ipv6_ext_mask; u8 badfcs_enc; }; - struct { - __be16 reserved1; - u8 smac[6]; - }; + u8 smac[ETH_ALEN]; }; __be32 byte_cnt; __be16 wqe_index; __be16 checksum; - u8 reserved2[1]; - __be16 timestamp_0_15; + u8 reserved[3]; u8 owner_sr_opcode; -} __packed; +}; struct mlx4_err_cqe { __be32 my_qpn; @@ -95,7 +86,13 @@ struct mlx4_ts_cqe { } __packed; enum { - MLX4_CQE_VLAN_PRESENT_MASK = 1 << 29, + MLX4_CQE_L2_TUNNEL_IPOK = 1 << 31, + MLX4_CQE_CVLAN_PRESENT_MASK = 1 << 29, + MLX4_CQE_SVLAN_PRESENT_MASK = 1 << 30, + MLX4_CQE_L2_TUNNEL = 1 << 27, + MLX4_CQE_L2_TUNNEL_CSUM = 1 << 26, + MLX4_CQE_L2_TUNNEL_IPV4 = 1 << 25, + MLX4_CQE_QPN_MASK = 0xffffff, MLX4_CQE_VID_MASK = 0xfff, }; @@ -177,5 +174,5 @@ int mlx4_cq_modify(struct mlx4_dev *dev, struct mlx4_c u16 count, u16 period); int mlx4_cq_resize(struct mlx4_dev *dev, struct mlx4_cq *cq, int entries, struct mlx4_mtt *mtt); -int mlx4_cq_ignore_overrun(struct mlx4_dev *dev, struct mlx4_cq *cq); + #endif /* MLX4_CQ_H */ Modified: stable/11/sys/dev/mlx4/device.h ============================================================================== --- head/sys/dev/mlx4/device.h Fri Sep 30 08:23:06 2016 (r306486) +++ stable/11/sys/dev/mlx4/device.h Mon Feb 12 13:56:57 2018 (r329159) @@ -39,20 +39,21 @@ #include #include #include +#include +#include + #include #include +#define DEFAULT_UAR_PAGE_SHIFT 12 + #define MAX_MSIX_P_PORT 17 #define MAX_MSIX 64 -#define MSIX_LEGACY_SZ 4 #define MIN_MSIX_P_PORT 5 +#define MLX4_IS_LEGACY_EQ_MODE(dev_cap) ((dev_cap).num_comp_vectors < \ + (dev_cap).num_ports * MIN_MSIX_P_PORT) -#define MLX4_ROCE_MAX_GIDS 128 -#define MLX4_ROCE_PF_GIDS 16 - -#define MLX4_NUM_UP 8 -#define MLX4_NUM_TC 8 #define MLX4_MAX_100M_UNITS_VAL 255 /* * work around: can't set values * greater then this value when @@ -62,6 +63,9 @@ #define MLX4_RATELIMIT_1G_UNITS 4 /* 1 Gbps */ #define MLX4_RATELIMIT_DEFAULT 0x00ff +#define MLX4_ROCE_MAX_GIDS 128 +#define MLX4_ROCE_PF_GIDS 16 + #define CORE_CLOCK_MASK 0xffffffffffffULL enum { @@ -70,8 +74,9 @@ enum { MLX4_FLAG_MASTER = 1 << 2, MLX4_FLAG_SLAVE = 1 << 3, MLX4_FLAG_SRIOV = 1 << 4, - MLX4_FLAG_DEV_NUM_STR = 1 << 5, - MLX4_FLAG_OLD_REG_MAC = 1 << 6, + MLX4_FLAG_OLD_REG_MAC = 1 << 6, + MLX4_FLAG_BONDED = 1 << 7, + MLX4_FLAG_SECURE_HOST = 1 << 8, }; enum { @@ -81,7 +86,8 @@ enum { enum { MLX4_MAX_PORTS = 2, - MLX4_MAX_PORT_PKEYS = 128 + MLX4_MAX_PORT_PKEYS = 128, + MLX4_MAX_PORT_GIDS = 128 }; /* base qkey for use in sriov tunnel-qp/proxy-qp communication. @@ -92,14 +98,14 @@ enum { #define MLX4_RESERVED_QKEY_MASK (0xFFFF0000) enum { - MLX4_BOARD_ID_LEN = 64, - MLX4_VSD_LEN = 208 + MLX4_BOARD_ID_LEN = 64 }; enum { MLX4_MAX_NUM_PF = 16, - MLX4_MAX_NUM_VF = 64, - MLX4_MFUNC_MAX = 80, + MLX4_MAX_NUM_VF = 126, + MLX4_MAX_NUM_VF_P_PORT = 64, + MLX4_MFUNC_MAX = 128, MLX4_MAX_EQ_NUM = 1024, MLX4_MFUNC_EQ_NUM = 4, MLX4_MFUNC_MAX_EQES = 8, @@ -119,6 +125,14 @@ enum { MLX4_STEERING_MODE_DEVICE_MANAGED }; +enum { + MLX4_STEERING_DMFS_A0_DEFAULT, + MLX4_STEERING_DMFS_A0_DYNAMIC, + MLX4_STEERING_DMFS_A0_STATIC, + MLX4_STEERING_DMFS_A0_DISABLE, + MLX4_STEERING_DMFS_A0_NOT_SUPPORTED +}; + static inline const char *mlx4_steering_mode_str(int steering_mode) { switch (steering_mode) { @@ -137,6 +151,11 @@ static inline const char *mlx4_steering_mode_str(int s } enum { + MLX4_TUNNEL_OFFLOAD_MODE_NONE, + MLX4_TUNNEL_OFFLOAD_MODE_VXLAN +}; + +enum { MLX4_DEV_CAP_FLAG_RC = 1LL << 0, MLX4_DEV_CAP_FLAG_UC = 1LL << 1, MLX4_DEV_CAP_FLAG_UD = 1LL << 2, @@ -161,12 +180,10 @@ enum { MLX4_DEV_CAP_FLAG_UDP_RSS = 1LL << 40, MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, - MLX4_DEV_CAP_FLAG_CROSS_CHANNEL = 1LL << 44, MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48, - MLX4_DEV_CAP_FLAG_COUNTERS_EXT = 1LL << 49, - MLX4_DEV_CAP_FLAG_SET_PORT_ETH_SCHED = 1LL << 53, + MLX4_DEV_CAP_FLAG_RSS_IP_FRAG = 1LL << 52, + MLX4_DEV_CAP_FLAG_SET_ETH_SCHED = 1LL << 53, MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55, - MLX4_DEV_CAP_FLAG_FAST_DROP = 1LL << 57, MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59, MLX4_DEV_CAP_FLAG_64B_EQE = 1LL << 61, MLX4_DEV_CAP_FLAG_64B_CQE = 1LL << 62 @@ -177,30 +194,51 @@ enum { MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1, MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2, MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3, - MLX4_DEV_CAP_FLAG2_FSM = 1LL << 4, - MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 5, - MLX4_DEV_CAP_FLAG2_UPDATE_QP = 1LL << 6, - MLX4_DEV_CAP_FLAG2_LB_SRC_CHK = 1LL << 7, - MLX4_DEV_CAP_FLAG2_DMFS_IPOIB = 1LL << 8, - MLX4_DEV_CAP_FLAG2_ETS_CFG = 1LL << 9, - MLX4_DEV_CAP_FLAG2_ETH_BACKPL_AN_REP = 1LL << 10, - MLX4_DEV_CAP_FLAG2_FLOWSTATS_EN = 1LL << 11, - MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT = 1LL << 12, - MLX4_DEV_CAP_FLAG2_TS = 1LL << 13, - MLX4_DEV_CAP_FLAG2_DRIVER_VERSION_TO_FW = 1LL << 14, - MLX4_DEV_CAP_FLAG2_REASSIGN_MAC_EN = 1LL << 15, - MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 16, - MLX4_DEV_CAP_FLAG2_FS_EN_NCSI = 1LL << 17, + MLX4_DEV_CAP_FLAG2_REASSIGN_MAC_EN = 1LL << 4, + MLX4_DEV_CAP_FLAG2_TS = 1LL << 5, + MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6, + MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7, + MLX4_DEV_CAP_FLAG2_UPDATE_QP = 1LL << 8, + MLX4_DEV_CAP_FLAG2_DMFS_IPOIB = 1LL << 9, + MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 10, + MLX4_DEV_CAP_FLAG2_MAD_DEMUX = 1LL << 11, + MLX4_DEV_CAP_FLAG2_CQE_STRIDE = 1LL << 12, + MLX4_DEV_CAP_FLAG2_EQE_STRIDE = 1LL << 13, + MLX4_DEV_CAP_FLAG2_ETH_PROT_CTRL = 1LL << 14, + MLX4_DEV_CAP_FLAG2_ETH_BACKPL_AN_REP = 1LL << 15, + MLX4_DEV_CAP_FLAG2_CONFIG_DEV = 1LL << 16, + MLX4_DEV_CAP_FLAG2_SYS_EQS = 1LL << 17, MLX4_DEV_CAP_FLAG2_80_VFS = 1LL << 18, - MLX4_DEV_CAP_FLAG2_DMFS_TAG_MODE = 1LL << 19, - MLX4_DEV_CAP_FLAG2_ROCEV2 = 1LL << 20, - MLX4_DEV_CAP_FLAG2_ETH_PROT_CTRL = 1LL << 21, - MLX4_DEV_CAP_FLAG2_CQE_STRIDE = 1LL << 22, - MLX4_DEV_CAP_FLAG2_EQE_STRIDE = 1LL << 23, - MLX4_DEV_CAP_FLAG2_UPDATE_QP_SRC_CHECK_LB = 1LL << 24, - MLX4_DEV_CAP_FLAG2_RX_CSUM_MODE = 1LL << 25, + MLX4_DEV_CAP_FLAG2_FS_A0 = 1LL << 19, + MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT = 1LL << 20, + MLX4_DEV_CAP_FLAG2_PORT_REMAP = 1LL << 21, + MLX4_DEV_CAP_FLAG2_QCN = 1LL << 22, + MLX4_DEV_CAP_FLAG2_QP_RATE_LIMIT = 1LL << 23, + MLX4_DEV_CAP_FLAG2_FLOWSTATS_EN = 1LL << 24, + MLX4_DEV_CAP_FLAG2_QOS_VPP = 1LL << 25, + MLX4_DEV_CAP_FLAG2_ETS_CFG = 1LL << 26, + MLX4_DEV_CAP_FLAG2_PORT_BEACON = 1LL << 27, + MLX4_DEV_CAP_FLAG2_IGNORE_FCS = 1LL << 28, + MLX4_DEV_CAP_FLAG2_PHV_EN = 1LL << 29, + MLX4_DEV_CAP_FLAG2_SKIP_OUTER_VLAN = 1LL << 30, + MLX4_DEV_CAP_FLAG2_UPDATE_QP_SRC_CHECK_LB = 1ULL << 31, + MLX4_DEV_CAP_FLAG2_LB_SRC_CHK = 1ULL << 32, + MLX4_DEV_CAP_FLAG2_ROCE_V1_V2 = 1ULL << 33, + MLX4_DEV_CAP_FLAG2_DMFS_UC_MC_SNIFFER = 1ULL << 34, + MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT = 1ULL << 35, + MLX4_DEV_CAP_FLAG2_SVLAN_BY_QP = 1ULL << 36, + MLX4_DEV_CAP_FLAG2_SL_TO_VL_CHANGE_EVENT = 1ULL << 37, }; +enum { + MLX4_QUERY_FUNC_FLAGS_BF_RES_QP = 1LL << 0, + MLX4_QUERY_FUNC_FLAGS_A0_RES_QP = 1LL << 1 +}; + +enum { + MLX4_VF_CAP_FLAG_RESET = 1 << 0 +}; + /* bit enums for an 8-bit flags field indicating special use * QPs which require special handling in qp_reserve_range. * Currently, this only includes QPs used by the ETH interface, @@ -210,38 +248,47 @@ enum { * This enum may use only bits 0..7. */ enum { - MLX4_RESERVE_BF_QP = 1 << 7, + MLX4_RESERVE_A0_QP = 1 << 6, + MLX4_RESERVE_ETH_BF_QP = 1 << 7, }; enum { - MLX4_DEV_CAP_CQ_FLAG_IO = 1 << 0 -}; - -enum { MLX4_DEV_CAP_64B_EQE_ENABLED = 1LL << 0, - MLX4_DEV_CAP_64B_CQE_ENABLED = 1LL << 1 + MLX4_DEV_CAP_64B_CQE_ENABLED = 1LL << 1, + MLX4_DEV_CAP_CQE_STRIDE_ENABLED = 1LL << 2, + MLX4_DEV_CAP_EQE_STRIDE_ENABLED = 1LL << 3 }; enum { - MLX4_USER_DEV_CAP_64B_CQE = 1L << 0 + MLX4_USER_DEV_CAP_LARGE_CQE = 1L << 0 }; enum { - MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0 + MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0, + MLX4_FUNC_CAP_EQE_CQE_STRIDE = 1L << 1, + MLX4_FUNC_CAP_DMFS_A0_STATIC = 1L << 2 }; #define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) enum { - MLX4_BMME_FLAG_WIN_TYPE_2B = 1 << 1, + MLX4_BMME_FLAG_WIN_TYPE_2B = 1 << 1, MLX4_BMME_FLAG_LOCAL_INV = 1 << 6, MLX4_BMME_FLAG_REMOTE_INV = 1 << 7, MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, MLX4_BMME_FLAG_RESERVED_LKEY = 1 << 10, MLX4_BMME_FLAG_FAST_REG_WR = 1 << 11, + MLX4_BMME_FLAG_ROCE_V1_V2 = 1 << 19, + MLX4_BMME_FLAG_PORT_REMAP = 1 << 24, + MLX4_BMME_FLAG_VSD_INIT2RTR = 1 << 28, }; +enum { + MLX4_FLAG_PORT_REMAP = MLX4_BMME_FLAG_PORT_REMAP, + MLX4_FLAG_ROCE_V1_V2 = MLX4_BMME_FLAG_ROCE_V1_V2 +}; + enum mlx4_event { MLX4_EVENT_TYPE_COMP = 0x00, MLX4_EVENT_TYPE_PATH_MIG = 0x01, @@ -311,6 +358,7 @@ enum { MLX4_PERM_REMOTE_WRITE = 1 << 13, MLX4_PERM_ATOMIC = 1 << 14, MLX4_PERM_BIND_MW = 1 << 15, + MLX4_PERM_MASK = 0xFC00 }; enum { @@ -355,12 +403,10 @@ enum { MLX4_MTT_FLAG_PRESENT = 1 }; -enum { - MLX4_MAX_MTT_SHIFT = 31 -}; - enum mlx4_qp_region { MLX4_QP_REGION_FW = 0, + MLX4_QP_REGION_RSS_RAW_ETH, + MLX4_QP_REGION_BOTTOM = MLX4_QP_REGION_RSS_RAW_ETH, MLX4_QP_REGION_ETH_ADDR, MLX4_QP_REGION_FC_ADDR, MLX4_QP_REGION_FC_EXCH, @@ -371,8 +417,7 @@ enum mlx4_port_type { MLX4_PORT_TYPE_NONE = 0, MLX4_PORT_TYPE_IB = 1, MLX4_PORT_TYPE_ETH = 2, - MLX4_PORT_TYPE_AUTO = 3, - MLX4_PORT_TYPE_NA = 4 + MLX4_PORT_TYPE_AUTO = 3 }; enum mlx4_special_vlan_idx { @@ -396,9 +441,21 @@ enum { }; enum { + /* + * Max wqe size for rdma read is 512 bytes, so this + * limits our max_sge_rd as the wqe needs to fit: + * - ctrl segment (16 bytes) + * - rdma segment (16 bytes) + * - scatter elements (16 bytes each) + */ + MLX4_MAX_SGE_RD = (512 - 16 - 16) / 16 +}; + +enum { MLX4_DEV_PMC_SUBTYPE_GUID_INFO = 0x14, MLX4_DEV_PMC_SUBTYPE_PORT_INFO = 0x15, MLX4_DEV_PMC_SUBTYPE_PKEY_TABLE = 0x16, + MLX4_DEV_PMC_SUBTYPE_SL_TO_VL_MAP = 0x17, }; /* Port mgmt change event handling */ @@ -410,16 +467,46 @@ enum { MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK = 1 << 4, }; +union sl2vl_tbl_to_u64 { + u8 sl8[8]; + u64 sl64; +}; + +enum { + MLX4_DEVICE_STATE_UP = 1 << 0, + MLX4_DEVICE_STATE_INTERNAL_ERROR = 1 << 1, +}; + +enum { + MLX4_INTERFACE_STATE_UP = 1 << 0, + MLX4_INTERFACE_STATE_DELETION = 1 << 1, +}; + #define MSTR_SM_CHANGE_MASK (MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK | \ MLX4_EQ_PORT_INFO_MSTR_SM_LID_CHANGE_MASK) enum mlx4_module_id { - MLX4_MODULE_ID_SFP = 0x3, - MLX4_MODULE_ID_QSFP = 0xC, - MLX4_MODULE_ID_QSFP_PLUS = 0xD, - MLX4_MODULE_ID_QSFP28 = 0x11, + MLX4_MODULE_ID_SFP = 0x3, + MLX4_MODULE_ID_QSFP = 0xC, + MLX4_MODULE_ID_QSFP_PLUS = 0xD, + MLX4_MODULE_ID_QSFP28 = 0x11, }; +enum { /* rl */ + MLX4_QP_RATE_LIMIT_NONE = 0, + MLX4_QP_RATE_LIMIT_KBS = 1, + MLX4_QP_RATE_LIMIT_MBS = 2, + MLX4_QP_RATE_LIMIT_GBS = 3 +}; + +struct mlx4_rate_limit_caps { + u16 num_rates; /* Number of different rates */ + u8 min_unit; + u16 min_val; + u8 max_unit; + u16 max_val; +}; + static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) { return (major << 32) | (minor << 16) | subminor; @@ -462,6 +549,8 @@ struct mlx4_caps { int max_rq_desc_sz; int max_qp_init_rdma; int max_qp_dest_rdma; + int max_tc_eth; + u32 *qp0_qkey; u32 *qp0_proxy; u32 *qp1_proxy; u32 *qp0_tunnel; @@ -473,13 +562,13 @@ struct mlx4_caps { int num_cqs; int max_cqes; int reserved_cqs; + int num_sys_eqs; int num_eqs; int reserved_eqs; int num_comp_vectors; - int comp_pool; int num_mpts; int max_fmr_maps; - u64 num_mtts; + int num_mtts; int fmr_reserved_mtts; int reserved_mtts; int reserved_mrws; @@ -489,6 +578,8 @@ struct mlx4_caps { int reserved_mcgs; int num_qp_per_mgm; int steering_mode; + int dmfs_high_steer_mode; + int fs_log_max_ucast_qp_range_size; int num_pds; int reserved_pds; int max_xrcds; @@ -501,7 +592,6 @@ struct mlx4_caps { u32 bmme_flags; u32 reserved_lkey; u16 stat_rate_support; - u8 cq_timestamp; u8 port_width_cap[MLX4_MAX_PORTS + 1]; int max_gso_sz; int max_rss_tbl_sz; @@ -519,18 +609,21 @@ struct mlx4_caps { u32 max_counters; u8 port_ib_mtu[MLX4_MAX_PORTS + 1]; u16 sqp_demux; - u32 sync_qp; - u32 cq_flags; u32 eqe_size; u32 cqe_size; u8 eqe_factor; - u32 userspace_caps; /* userspace must be aware to */ - u32 function_caps; /* functions must be aware to */ - u8 fast_drop; + u32 userspace_caps; /* userspace must be aware of these */ + u32 function_caps; /* VFs must be aware of these */ u16 hca_core_clock; - u32 max_basic_counters; - u32 max_extended_counters; - u8 def_counter_index[MLX4_MAX_PORTS + 1]; + u64 phys_port_id[MLX4_MAX_PORTS + 1]; + int tunnel_offload_mode; + u8 rx_checksum_flags_port[MLX4_MAX_PORTS + 1]; + u8 phv_bit[MLX4_MAX_PORTS + 1]; + u8 alloc_res_qp_mask; + u32 dmfs_high_rate_qpn_base; + u32 dmfs_high_rate_qpn_range; + u32 vf_caps; + struct mlx4_rate_limit_caps rl_caps; }; struct mlx4_buf_list { @@ -627,7 +720,7 @@ struct mlx4_uar { }; struct mlx4_bf { - unsigned long offset; + unsigned int offset; int buf_size; struct mlx4_uar *uar; void __iomem *reg; @@ -641,6 +734,7 @@ struct mlx4_cq { u32 cons_index; + u16 irq; __be32 *set_ci_db; __be32 *arm_db; int arm_sn; @@ -650,8 +744,8 @@ struct mlx4_cq { atomic_t refcount; struct completion free; - int eqn; - u16 irq; + int reset_notify_added; + struct list_head reset_notify; }; struct mlx4_qp { @@ -700,9 +794,9 @@ struct mlx4_eth_av { __be32 sl_tclass_flowlabel; u8 dgid[16]; u8 s_mac[6]; - u8 reserved4[2]; + u8 reserved4[2]; __be16 vlan; - u8 mac[6]; + u8 mac[ETH_ALEN]; }; union mlx4_ext_av { @@ -710,66 +804,17 @@ union mlx4_ext_av { struct mlx4_eth_av eth; }; -struct mlx4_if_stat_control { - u8 reserved1[3]; - /* Extended counters enabled */ - u8 cnt_mode; - /* Number of interfaces */ - __be32 num_of_if; - __be32 reserved[2]; +struct mlx4_counter { + u8 reserved1[3]; + u8 counter_mode; + __be32 num_ifc; + u32 reserved2[2]; + __be64 rx_frames; + __be64 rx_bytes; + __be64 tx_frames; + __be64 tx_bytes; }; -struct mlx4_if_stat_basic { - struct mlx4_if_stat_control control; - struct { - __be64 IfRxFrames; - __be64 IfRxOctets; - __be64 IfTxFrames; - __be64 IfTxOctets; - } counters[]; -}; -#define MLX4_IF_STAT_BSC_SZ(ports)(sizeof(struct mlx4_if_stat_extended) +\ - sizeof(((struct mlx4_if_stat_extended *)0)->\ - counters[0]) * ports) - -struct mlx4_if_stat_extended { - struct mlx4_if_stat_control control; - struct { - __be64 IfRxUnicastFrames; - __be64 IfRxUnicastOctets; - __be64 IfRxMulticastFrames; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Mon Feb 12 13:59:04 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D927BF1CB7D; Mon, 12 Feb 2018 13:59:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 879CA7570A; Mon, 12 Feb 2018 13:59:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E6C712C9F; Mon, 12 Feb 2018 13:59:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1CDx4bk057407; Mon, 12 Feb 2018 13:59:04 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1CDx4EG057405; Mon, 12 Feb 2018 13:59:04 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802121359.w1CDx4EG057405@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 12 Feb 2018 13:59:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329160 - in stable/11/sys/dev/mlx4: mlx4_core mlx4_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx4: mlx4_core mlx4_en X-SVN-Commit-Revision: 329160 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 13:59:05 -0000 Author: hselasky Date: Mon Feb 12 13:59:04 2018 New Revision: 329160 URL: https://svnweb.freebsd.org/changeset/base/329160 Log: MFC r326666: mlx4: Remove redundant declarations to fix GCC build These were made redundant in r325841. Reviewed by: hselasky Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D13401 Modified: stable/11/sys/dev/mlx4/mlx4_core/icm.h stable/11/sys/dev/mlx4/mlx4_en/en.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx4/mlx4_core/icm.h ============================================================================== --- stable/11/sys/dev/mlx4/mlx4_core/icm.h Mon Feb 12 13:56:57 2018 (r329159) +++ stable/11/sys/dev/mlx4/mlx4_core/icm.h Mon Feb 12 13:59:04 2018 (r329160) @@ -124,7 +124,4 @@ static inline unsigned long mlx4_icm_size(struct mlx4_ return sg_dma_len(&iter->chunk->mem[iter->page_idx]); } -int mlx4_MAP_ICM_AUX(struct mlx4_dev *dev, struct mlx4_icm *icm); -int mlx4_UNMAP_ICM_AUX(struct mlx4_dev *dev); - #endif /* MLX4_ICM_H */ Modified: stable/11/sys/dev/mlx4/mlx4_en/en.h ============================================================================== --- stable/11/sys/dev/mlx4/mlx4_en/en.h Mon Feb 12 13:56:57 2018 (r329159) +++ stable/11/sys/dev/mlx4/mlx4_en/en.h Mon Feb 12 13:59:04 2018 (r329160) @@ -832,7 +832,6 @@ void mlx4_en_destroy_drop_qp(struct mlx4_en_priv *priv int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring); void mlx4_en_rx_irq(struct mlx4_cq *mcq); -int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode); int mlx4_SET_VLAN_FLTR(struct mlx4_dev *dev, struct mlx4_en_priv *priv); int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset); From owner-svn-src-stable-11@freebsd.org Mon Feb 12 15:44:29 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94765F0207C for ; Mon, 12 Feb 2018 15:44:29 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B38067ADB3 for ; Mon, 12 Feb 2018 15:44:28 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-wm0-x232.google.com with SMTP id r71so10442429wmd.1 for ; Mon, 12 Feb 2018 07:44:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=WVvFVtR2F9hm/5YLS2qiepJZqfVEGYRkq9awaMozxZI=; b=wY47SOV+aE3itkKwaltnW3yJmp8Pm/+vzGkVcvNiTlP43pyQXX7Nh1J10aKPt/fcob bb4h/9D7ruoE10UZ5InQZIC16mCzsoBPZagbD9L1l7Y/er1EJ+VTOX40Xx7cButh5gNC a4+roIX17ghTaHA7vrKcgScvt13Hd83iab/1ubD4p5xypzeo9LEvgWhsB4U4hC4TRNAx xbGs5nHZtGS9CqFJMMrrTk0Yl1Sitv5mGHty27VkAvkS1SgCCqHYRfnklrQGHEnRze4F 2oyKYATD7TlAX4BL82FMCF5hF+zFPC05EFddFcUK/w2do7qyfZ77BRXRpbsFqdzxyqUZ Z0cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WVvFVtR2F9hm/5YLS2qiepJZqfVEGYRkq9awaMozxZI=; b=ZqnUUAfpIL6LHmj+CDCLKRAfgYFUc6TeBw3eSTCAFV7RcPvhLtgQDCyTYCAJWtd9iw wM5E7ZJa2OuMR+W8PeUe0L8VtxxrDauWMRmjkqbGox2x6/mqaGwePxiZYtUmM3sv6k48 nTZPgRF1jQTlyHL1gvnHQxXEPXuYXi5wUZHb5ZKh2vbFrxGFAXNieme3+raNKCSvdDiR ecj7QtJf1xjLiyHCvM634FjDKFVPZE0Lfupmx17e5MoNRPX4SYI2uvOKDWskE/mxK061 EGAPPUPhh7xSsnM6M5ydnADLjQnhpwlc+V1UzvhXD3XrEbkA53hdW63NFJ/8b4ysEkNp inXw== X-Gm-Message-State: APf1xPDmYrftTlGYpvzBDOv83IgPmHtIC/zwjYfF3+36XrFFCmYTpYm8 YtmU9VjwGL7DbKbIAnMxY+Tt2Q== X-Google-Smtp-Source: AH8x226VY6gZgprL82o3o3x4bx2Uizzv9D9L6VsjN57RSa1FvNdSMhcE0xRn8IU1Iftpx8lPoTDovg== X-Received: by 10.80.142.194 with SMTP id x2mr17070553edx.274.1518450267298; Mon, 12 Feb 2018 07:44:27 -0800 (PST) Received: from mutt-hbsd (ori.enn.lu. [85.248.227.163]) by smtp.gmail.com with ESMTPSA id g30sm5307408edb.48.2018.02.12.07.44.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 07:44:26 -0800 (PST) Date: Mon, 12 Feb 2018 10:44:14 -0500 From: Shawn Webb To: Kyle Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r329140 - in stable/11: . share/mk sys/arm/include sys/arm64/include sys/boot sys/boot/arm/at91 sys/boot/arm/at91/boot0 sys/boot/arm/at91/boot0iic sys/boot/arm/at91/boot0spi sys/boot/ar... Message-ID: <20180212154355.2jiwz3r6ffeaawhe@mutt-hbsd> References: <201802112058.w1BKw0xv046842@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hzct5awhjtsq44yb" Content-Disposition: inline In-Reply-To: <201802112058.w1BKw0xv046842@repo.freebsd.org> X-Operating-System: FreeBSD mutt-hbsd 12.0-CURRENT FreeBSD 12.0-CURRENT X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: NeoMutt/20171215 X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 15:44:29 -0000 --hzct5awhjtsq44yb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Feb 11, 2018 at 08:58:00PM +0000, Kyle Evans wrote: > Author: kevans > Date: Sun Feb 11 20:58:00 2018 > New Revision: 329140 > URL: https://svnweb.freebsd.org/changeset/base/329140 > [snip] > Added: > [snip] > stable/11/tools/build/options/WITHOUT_LOADER_GEIL > - copied unchanged from r325693, head/tools/build/options/WITHOUT_LO= ADER_GEIL Shouldn't this be WITHOUT_LOADER_GELI? Thanks, --=20 Shawn Webb Cofounder and Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --hzct5awhjtsq44yb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIyBAEBCAAdFiEEKrq2ve9q9Ia+iT2eaoRlj1JFbu4FAlqBtk4ACgkQaoRlj1JF bu6GSw/470h6MWam3fvvnR5jmM2YA3UO8hR/50g9lJ5JTkC7DloIzcX4cqO4y1ge vvawpuXQs7b3Z/kgzfSo/Reduchg19O4j8y5UT1u1sRNbrop4e3ziJAp44z1SudR pVr+0y1+8wNWxk2j0bzfu3jPdzgOX35hR8MlPNcnP//02w7D7PVcmB1UEcWcfF6I HQMT28XI2DaDwIBPydnrwPfJm192en6b7EqE3W9QbIJJ3Pi/Z4RR0q4tS2eDQGbs g+OWNXSqSjNFFIIcdLWIIpl8GhJS5aAE6fDrDR0Feum0rflkIwn9xyd/1chCCkME fW32BAc7vVy80fF0jHQM6Eow02odkzeAzy4c08bnCAl/71dS83+xABq1kDhazzRW 9b8FrpjSeyykgvUva6HqVIf0evpJqDPEKlBNsLOshGT9xEeHFBnbgfyAyYXyUk7/ tFPyIvsmR2y8MAuHCyBXF9ZnApGYu/BaqRPE8qQYp67vBQBZV11shBFP2dByK+AN EvXjHeNtn8jJZdPya/OwZpQcmyDBPchFczb46JgFEVYvDswhl0DH7rHxvabpxI5k TIO1bnios4hoOKuATIaOryHY9r9Je6GNrErHbjBoVs50fT+nAjuKcaXdA0Gk1IeN qfRpoLKlPmj6dEeW1+p7aw1CSULVJgun2N1ZQnDIlSh17G1a8Q== =2EUQ -----END PGP SIGNATURE----- --hzct5awhjtsq44yb-- From owner-svn-src-stable-11@freebsd.org Mon Feb 12 15:48:13 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75C22F024F9; Mon, 12 Feb 2018 15:48:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 237527B139; Mon, 12 Feb 2018 15:48:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E25513E99; Mon, 12 Feb 2018 15:48:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1CFmC31013729; Mon, 12 Feb 2018 15:48:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1CFmCNT013728; Mon, 12 Feb 2018 15:48:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802121548.w1CFmCNT013728@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 12 Feb 2018 15:48:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329169 - stable/11/tools/build/options X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/tools/build/options X-SVN-Commit-Revision: 329169 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 15:48:13 -0000 Author: kevans Date: Mon Feb 12 15:48:12 2018 New Revision: 329169 URL: https://svnweb.freebsd.org/changeset/base/329169 Log: MFC r325718: Fix typo in filename. Noticed by: Shawn Webb (again) Added: stable/11/tools/build/options/WITHOUT_LOADER_GELI - copied unchanged from r325718, head/tools/build/options/WITHOUT_LOADER_GELI Deleted: stable/11/tools/build/options/WITHOUT_LOADER_GEIL Modified: Directory Properties: stable/11/ (props changed) Copied: stable/11/tools/build/options/WITHOUT_LOADER_GELI (from r325718, head/tools/build/options/WITHOUT_LOADER_GELI) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_LOADER_GELI Mon Feb 12 15:48:12 2018 (r329169, copy of r325718, head/tools/build/options/WITHOUT_LOADER_GELI) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Disable inclusion of GELI crypto support in the boot chain binaries. From owner-svn-src-stable-11@freebsd.org Mon Feb 12 15:50:13 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0500DF02757; Mon, 12 Feb 2018 15:50:13 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com [209.85.215.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6CDB37B3AC; Mon, 12 Feb 2018 15:50:12 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f53.google.com with SMTP id w10so8260220lfc.9; Mon, 12 Feb 2018 07:50:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=voY22C7WAcuIh995wDOqLmZAz/iT47JMU5WLzNWGnoQ=; b=mZ8PcvSXdb2XWZlfHWe7va/DLCtQ2PElO4KV2PjrARaQoNd3FX4lpeceqId/JtlenG PCEatIGnhNcLtIvoBAGEijBYX7c59u8fvyUbxZ8RTIJpjFSUxqcz7+eOqqf/oHx+2uQD s5i2q/wahhsUWPXUtHhgx13AJ1DBasZcPjv0vimMaKJUVyKbQ2l+qLpopmnUCVuRrmFI JtTJJ2iMI/R+lmpIfXByvKN2Uzoj+3anRbj42DEpCsMB7TxefGjyOdpZ7wUbIw+0O5IV 6GrKNAi+epeXHLSazviqTE1xf9UIvKzcvnSVhK6IoQ4sASG1gJGzPX3ulaE16Cd6wkOO Fq+A== X-Gm-Message-State: APf1xPDlrk3AaOv4JyqYKM9CHD8sh1nzd4soBwhB3CTzOiNKxRj5dWaR aNaNL5l3Cp0kXTKHp7aV581KuJ1C X-Google-Smtp-Source: AH8x225GSViMuSyLe1/RgYAqj/i7YcF+6804frdtiO+/fSJIZcRd7pxnNZViSxwQJuqbYpyMujblMw== X-Received: by 10.46.15.26 with SMTP id 26mr7943695ljp.52.1518450604473; Mon, 12 Feb 2018 07:50:04 -0800 (PST) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com. [209.85.215.49]) by smtp.gmail.com with ESMTPSA id h7sm1655713ljf.37.2018.02.12.07.50.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Feb 2018 07:50:03 -0800 (PST) Received: by mail-lf0-f49.google.com with SMTP id j193so5072984lfe.0; Mon, 12 Feb 2018 07:50:03 -0800 (PST) X-Received: by 10.46.101.65 with SMTP id z62mr3029051ljb.37.1518450603543; Mon, 12 Feb 2018 07:50:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.46.106.8 with HTTP; Mon, 12 Feb 2018 07:49:43 -0800 (PST) In-Reply-To: <20180212154355.2jiwz3r6ffeaawhe@mutt-hbsd> References: <201802112058.w1BKw0xv046842@repo.freebsd.org> <20180212154355.2jiwz3r6ffeaawhe@mutt-hbsd> From: Kyle Evans Date: Mon, 12 Feb 2018 09:49:43 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r329140 - in stable/11: . share/mk sys/arm/include sys/arm64/include sys/boot sys/boot/arm/at91 sys/boot/arm/at91/boot0 sys/boot/arm/at91/boot0iic sys/boot/arm/at91/boot0spi sys/boot/ar... To: Shawn Webb Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 15:50:13 -0000 On Mon, Feb 12, 2018 at 9:44 AM, Shawn Webb wrote: > On Sun, Feb 11, 2018 at 08:58:00PM +0000, Kyle Evans wrote: >> Author: kevans >> Date: Sun Feb 11 20:58:00 2018 >> New Revision: 329140 >> URL: https://svnweb.freebsd.org/changeset/base/329140 >> [snip] >> Added: >> [snip] >> stable/11/tools/build/options/WITHOUT_LOADER_GEIL >> - copied unchanged from r325693, head/tools/build/options/WITHOUT_LOADER_GEIL > > Shouldn't this be WITHOUT_LOADER_GELI? > You're now 2 for 2 on catching that. ;) Fixd in r329169, thanks! From owner-svn-src-stable-11@freebsd.org Mon Feb 12 17:44:39 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D98BF0C20D; Mon, 12 Feb 2018 17:44:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AAEC781736; Mon, 12 Feb 2018 17:44:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A0D4315219; Mon, 12 Feb 2018 17:44:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1CHic0m073996; Mon, 12 Feb 2018 17:44:38 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1CHiZmV073963; Mon, 12 Feb 2018 17:44:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802121744.w1CHiZmV073963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 12 Feb 2018 17:44:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329175 - in stable/11: contrib/compiler-rt/lib/builtins lib/libc/stdlib stand stand/arm/uboot stand/common stand/efi/boot1 stand/efi/include stand/efi/libefi stand/efi/loader stand/fic... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: contrib/compiler-rt/lib/builtins lib/libc/stdlib stand stand/arm/uboot stand/common stand/efi/boot1 stand/efi/include stand/efi/libefi stand/efi/loader stand/ficl stand/geli stand/i386 s... X-SVN-Commit-Revision: 329175 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 17:44:39 -0000 Author: kevans Date: Mon Feb 12 17:44:35 2018 New Revision: 329175 URL: https://svnweb.freebsd.org/changeset/base/329175 Log: MFC Loader Fixes 2017q4p7: r324844,r326089,r326926,r326440,r326484,r326494, r326588,r326708,r326784,r326914,r327390,r328446,r326090,r326143,r326144, r326182,r326384,r326421,r326440,r326441,r326442,r326443,r326444,r326445, r326446,r326447,r326448,r326484,r326485,r326486,r326487,r326488,r326490, r326491,r326492,r326493,r326494,r326495,r326504,r326507,r326509,r326584, r326585,r326586,r326587,r326588,r326589,r326590,r326591,r326592,r326593, r326594,r326600,r326616,r326671,r326707,r326708,r326709,r326710,r326711, r326712,r326714,r326720,r326768,r326772,r326784,r326792,r326812,r326854, r326855,r326856,r326858,r326886,r326887,r326914,r326926,r326927,r326960, r326961,r326962,r326963,r327351,r327453,r327390,r327523,r327524,r326489, r327880,r328437,r328438,r328439,r328441,r328446,r328448,r328449,r328612, r328613,r328615 While here, undo our libfdt hack of not including if we're compiling _STANDALONE. r324844: When building standalone, don't define errno. Let the definition from stand.h override. This is similar to what we do in the kernel. r326089: loader.efi: efipart does not recognize partitionless disks r326090: net_parse_rootpath() has no parameters r326143: Fix theoretical integer overflow issues. If the product here is r326144: Mark the func pointer as __dead2. It looks up loader_main, which r326182: Modify all FreeBSD bootloaders on PowerPC AIM (Book-S) systems r326384: Use const pointers to avoid casting away constness. r326421: loader.efi: efipart should exclude iPXE stub block protocol r326440: Remove stale dependency on ufsread.c r326441: Minor flags cleanup r326442: Cleanup CFALGS usage here r326443: We don't need both _STAND and _STANDALONE, use the latter. r326444: Move geli to common DO32 stuff r326445: Fix random() and srandom() prototypes to match the standard. r326446: Undefine _STANDALONE since this is test code. r326447: Tweaks to the beri boot loader so that it builds w/o warnings. r326448: Fix all warnings related to geli and ZFS support on x86. r326484: Const poison the propname. r326485: Delcare md_load in libofw.h. Make all prototypes match for ofw r326486: Include machine/md_var to pick up __syncicache prototype. r326487: Cast mdp (a vm_offset_t) to void * to match prototype. r326488: e_entry can be smaller than a pointer. Cast it to an intptr_t r326490: Declare our strange brand of main(). r326491: Disconnet ps3 from the build. There's too many warnings to fix. r326492: Cast void * pointer to char * so the arg matches the %s format. r326493: Provide a md_load64 prototype. r326494: Mark two things as unused (since they are only sometimes used) r326495: Now it's safe to bump WARNS to 1. r326504: Switch to proper MK_LOADER_GELI tests. r326507: increase maximum size of zfsboot r326509: loader.efi: add note about iPXE into the efipart.c r326584: When building standalone, include stand.h rather than the kernel r326585: Include ficl.h before anything else r326586: No need to include the userland md5.h, the kernel one is just fine. r326587: Use the kernel relative paths, rather than the userland relative paths r326588: Need to include skein in the include path r326589: Make sure we include the right path for skein.h r326590: Prefer stdint.h to inttypes.h r326591: This isn't NetBSD specific code. Include these for any kernel / r326592: Don't inherit CFLAGS. This a specialized test program. r326593: Stop building with the standard system headers. r326594: Now that we offer a semi-sane standards-ish set of #include files, stop hacking includes with sed. r326600: Since this is contrib code, create an upstreamable version of my r326616: dhcp_try_rfc1048() is not used any more r326671: Avoid setting -Wno-tentative-definition-incomplete-type with gcc. r326707: Add partial support signal.h functioanlity. Pull in machine/signal.h r326708: Remove _KERNEL hack now that errno.h does the right thing when built standalone. r326709: Provide implementations for iscntrl, ispunct and isgraph. r326710: Put the files we're copying over into a few variables and clean hings up. r326711: Const poison a couple of interfaces. r326712: Create interp class. r326714: boot1.c needs EFI_ZFS_BOOT too, so add it globally. r326720: This path belongs in ficl/Makefile, not the common defines for users r326768: Fix a comment to be more accurate r326772: Fix regression with lua import r326784: Revert part of 362772. It was causing problems for includes r326792: Attempt to unbreak buildworld r326812: Revert r326792, r326784, r326772, r326712 r326854: libefi: make efichar.h more usable in stand code r326855: Cargo cut a fix for the regressions r326585 caused. r326856: Fix comments after bump in size. r326858: Revert r326855: Cargo cut a fix for the regressions r326585 caused. r326886: Panic in sbrk if setheap hasn't been called yet. This is preferable o a mysterious crash r326887: Remove the 'mini libstand in libstand' that util.[ch] provided. r326914: Move loader-only defines to loader.mk from defs.mk r326926: Move loader help file definitions to being 100% inside of loader.mk. r326927: libficl is only ever used in a loader (never a boot) program. Move it. r326960: Simplify things a little. The RETURN macro isn't required. r326961: Interact is always called with NULL. Simplify code a little r326962: Hoist btx include stuff to i386/Makefile.inc r326963: No need to use relative paths like this here. r327351: Fix ubldr. uboot/lib uses defines for the loader. r327453: Add a validbcd() routine that uses the bcd2bin_data[] array r327390: Garbage-collect loader.ps3. It is currently disconnected from the build and kboot replaces. r327523: Don't clobber system LDFLAGS for beri boot loaders. r327524: Use 'extern uint8_t' instead of 'extern void' for external symbols. r326489: Allow this file to be used in libsa without warning... r327880: Move getsecs() prototype to stand.h from net.h so it can be used r328437: Split panic routine r328438: Implement abort() as a call to panic. r328439: Provide abs form stdlib.h. r328441: abort() should be marked __dead2 since it won't return. r328446: Now that exit is __dead2, we need to tag ub_exit() as __dead2. r328448: Make exit() never return until host_exit can be written. r328449: Tag unreachable places as such. I left the while (1); in place r328612: Move strtold wrapper from strtol.c to its own strtold.c. r328613: Kill copies of strtol and strtoul. r328615: Update stand.h for changes for strto*l PR: 223969 Added: stable/11/lib/libc/stdlib/strtold.c - copied unchanged from r328612, head/lib/libc/stdlib/strtold.c stable/11/stand/libsa/abort.c - copied unchanged from r328438, head/stand/libsa/abort.c stable/11/stand/libsa/xlocale_private.h - copied unchanged from r328613, head/stand/libsa/xlocale_private.h Deleted: stable/11/stand/libsa/strtol.c stable/11/stand/libsa/strtoul.c stable/11/stand/libsa/util.c stable/11/stand/libsa/util.h stable/11/stand/powerpc/ps3/ Modified: stable/11/contrib/compiler-rt/lib/builtins/int_lib.h stable/11/lib/libc/stdlib/Makefile.inc stable/11/lib/libc/stdlib/strtol.c stable/11/stand/Makefile.amd64 stable/11/stand/Makefile.i386 stable/11/stand/Makefile.inc stable/11/stand/arm/uboot/Makefile stable/11/stand/common/bootstrap.h stable/11/stand/common/dev_net.c stable/11/stand/common/interp.c stable/11/stand/common/interp_backslash.c stable/11/stand/common/interp_forth.c stable/11/stand/common/interp_parse.c stable/11/stand/common/load_elf.c stable/11/stand/common/load_elf_obj.c stable/11/stand/common/reloc_elf.c stable/11/stand/defs.mk stable/11/stand/efi/boot1/Makefile stable/11/stand/efi/boot1/boot1.c stable/11/stand/efi/include/efichar.h stable/11/stand/efi/libefi/Makefile stable/11/stand/efi/libefi/efichar.c stable/11/stand/efi/libefi/efipart.c stable/11/stand/efi/loader/Makefile stable/11/stand/efi/loader/main.c stable/11/stand/ficl.mk stable/11/stand/ficl/Makefile stable/11/stand/ficl/float.c stable/11/stand/geli/Makefile stable/11/stand/geli/geliboot.c stable/11/stand/geli/geliboot_internal.h stable/11/stand/i386/Makefile.inc stable/11/stand/i386/boot2/Makefile stable/11/stand/i386/common/cons.c stable/11/stand/i386/common/drv.c stable/11/stand/i386/gptboot/Makefile stable/11/stand/i386/gptboot/gptboot.c stable/11/stand/i386/gptboot/gptldr.S stable/11/stand/i386/gptzfsboot/Makefile stable/11/stand/i386/libfirewire/Makefile stable/11/stand/i386/libi386/Makefile stable/11/stand/i386/libi386/biosdisk.c stable/11/stand/i386/libi386/multiboot.c stable/11/stand/i386/loader/Makefile stable/11/stand/i386/loader/main.c stable/11/stand/i386/zfsboot/Makefile stable/11/stand/i386/zfsboot/zfsboot.c stable/11/stand/libsa/Makefile stable/11/stand/libsa/bootp.c stable/11/stand/libsa/bootp.h stable/11/stand/libsa/cd9660.c stable/11/stand/libsa/gpt.c stable/11/stand/libsa/net.h stable/11/stand/libsa/panic.c stable/11/stand/libsa/sbrk.c stable/11/stand/libsa/stand.h stable/11/stand/loader.mk stable/11/stand/mips/beri/boot2/Makefile stable/11/stand/mips/beri/boot2/boot2.c stable/11/stand/mips/beri/common/altera_jtag_uart.c stable/11/stand/mips/beri/common/cfi.c stable/11/stand/mips/beri/common/sdcard.c stable/11/stand/mips/beri/loader/Makefile stable/11/stand/mips/beri/loader/devicename.c stable/11/stand/mips/beri/loader/exec.c stable/11/stand/mips/beri/loader/loader.h stable/11/stand/mips/beri/loader/main.c stable/11/stand/mips/uboot/Makefile stable/11/stand/mips/uboot/conf.c stable/11/stand/ofw/common/main.c stable/11/stand/ofw/libofw/elf_freebsd.c stable/11/stand/ofw/libofw/libofw.h stable/11/stand/ofw/libofw/openfirm.c stable/11/stand/ofw/libofw/openfirm.h stable/11/stand/ofw/libofw/ppc64_elf_freebsd.c stable/11/stand/powerpc/Makefile stable/11/stand/powerpc/boot1.chrp/Makefile stable/11/stand/powerpc/boot1.chrp/boot1.c stable/11/stand/powerpc/kboot/Makefile stable/11/stand/powerpc/kboot/host_syscall.h stable/11/stand/powerpc/kboot/hostdisk.c stable/11/stand/powerpc/kboot/kbootfdt.c stable/11/stand/powerpc/kboot/main.c stable/11/stand/powerpc/kboot/ppc64_elf_freebsd.c stable/11/stand/powerpc/ofw/Makefile stable/11/stand/powerpc/ofw/start.c stable/11/stand/powerpc/uboot/Makefile stable/11/stand/sparc64/boot1/Makefile stable/11/stand/sparc64/loader/Makefile stable/11/stand/sparc64/loader/main.c stable/11/stand/sparc64/loader/metadata.c stable/11/stand/uboot/common/main.c stable/11/stand/uboot/lib/glue.c stable/11/stand/uboot/lib/glue.h stable/11/stand/userboot/test/Makefile stable/11/stand/userboot/test/test.c stable/11/stand/userboot/userboot/Makefile stable/11/stand/userboot/userboot/main.c stable/11/stand/zfs/zfsimpl.c stable/11/sys/cddl/boot/zfs/zfssubr.c stable/11/sys/contrib/libfdt/libfdt_env.h stable/11/sys/geom/eli/g_eli_hmac.c stable/11/sys/geom/eli/pkcs5v2.c stable/11/sys/opencrypto/xform_userland.h stable/11/sys/sys/errno.h stable/11/sys/sys/libkern.h stable/11/sys/sys/syslimits.h Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/compiler-rt/lib/builtins/int_lib.h ============================================================================== --- stable/11/contrib/compiler-rt/lib/builtins/int_lib.h Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/contrib/compiler-rt/lib/builtins/int_lib.h Mon Feb 12 17:44:35 2018 (r329175) @@ -55,12 +55,16 @@ #define UNUSED __attribute__((unused)) #endif -#if defined(__NetBSD__) && (defined(_KERNEL) || defined(_STANDALONE)) +#if (defined(__FreeBSD__) || defined(__NetBSD__)) && (defined(_KERNEL) || defined(_STANDALONE)) /* * Kernel and boot environment can't use normal headers, * so use the equivalent system headers. */ +#ifdef __FreeBSD__ +# include +#else # include +#endif # include # include #else Modified: stable/11/lib/libc/stdlib/Makefile.inc ============================================================================== --- stable/11/lib/libc/stdlib/Makefile.inc Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/lib/libc/stdlib/Makefile.inc Mon Feb 12 17:44:35 2018 (r329175) @@ -15,7 +15,7 @@ MISRCS+=C99_Exit.c a64l.c abort.c abs.c atexit.c atof. radixsort.c rand.c \ random.c reallocarray.c reallocf.c realpath.c remque.c \ set_constraint_handler_s.c strfmon.c strtoimax.c \ - strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ + strtol.c strtold.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c # Work around an issue on case-insensitive file systems. Modified: stable/11/lib/libc/stdlib/strtol.c ============================================================================== --- stable/11/lib/libc/stdlib/strtol.c Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/lib/libc/stdlib/strtol.c Mon Feb 12 17:44:35 2018 (r329175) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include "xlocale_private.h" - /* * Convert a string to a long integer. * @@ -150,9 +149,4 @@ long strtol(const char * __restrict nptr, char ** __restrict endptr, int base) { return strtol_l(nptr, endptr, base, __get_locale()); -} -long double -strtold(const char * __restrict nptr, char ** __restrict endptr) -{ - return strtold_l(nptr, endptr, __get_locale()); } Copied: stable/11/lib/libc/stdlib/strtold.c (from r328612, head/lib/libc/stdlib/strtold.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libc/stdlib/strtold.c Mon Feb 12 17:44:35 2018 (r329175, copy of r328612, head/lib/libc/stdlib/strtold.c) @@ -0,0 +1,45 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2011 The FreeBSD Foundation + * All rights reserved. + * Portions of this software were developed by David Chisnall + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include "xlocale_private.h" + +long double +strtold(const char * __restrict nptr, char ** __restrict endptr) +{ + + return strtold_l(nptr, endptr, __get_locale()); +} Modified: stable/11/stand/Makefile.amd64 ============================================================================== --- stable/11/stand/Makefile.amd64 Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/Makefile.amd64 Mon Feb 12 17:44:35 2018 (r329175) @@ -11,7 +11,7 @@ SUBDIR+= ficl32 SUBDIR+= efi SUBDIR+= userboot -.if ${LOADER_GELI_SUPPORT:Uyes} == "yes" +.if ${MK_LOADER_GELI} == "yes" SUBDIR+= geli .endif Modified: stable/11/stand/Makefile.i386 ============================================================================== --- stable/11/stand/Makefile.i386 Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/Makefile.i386 Mon Feb 12 17:44:35 2018 (r329175) @@ -1,6 +1,6 @@ # $FreeBSD$ -.if ${LOADER_GELI_SUPPORT:Uyes} == "yes" +.if ${MK_LOADER_GELI} == "yes" SUBDIR+= geli .endif .if ${MK_ZFS} != "no" Modified: stable/11/stand/Makefile.inc ============================================================================== --- stable/11/stand/Makefile.inc Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/Makefile.inc Mon Feb 12 17:44:35 2018 (r329175) @@ -1,53 +1,3 @@ # $FreeBSD$ .include "defs.mk" - -.if !defined(__BOOT_MAKEFILE_INC__) -__BOOT_MAKEFILE_INC__=${MFILE} - -CFLAGS+=-I${SASRC} - -SSP_CFLAGS= - -# Add in the no float / no SIMD stuff and announce we're freestanding -# aarch64 and riscv don't have -msoft-float, but all others do. riscv -# currently has no /boot/loader, but may soon. -CFLAGS+= -ffreestanding ${CFLAGS_NO_SIMD} -.if ${MACHINE_CPUARCH} == "aarch64" -CFLAGS+= -mgeneral-regs-only -.elif ${MACHINE_CPUARCH} != "riscv" -CFLAGS+= -msoft-float -.endif - -.if ${MACHINE_CPUARCH} == "i386" || (${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1) -CFLAGS+= -march=i386 -CFLAGS.gcc+= -mpreferred-stack-boundary=2 -.endif - - -.if ${MACHINE_CPUARCH} == "arm" -# Do not generate movt/movw, because the relocation fixup for them does not -# translate to the -Bsymbolic -pie format required by self_reloc() in loader(8). -# Also, the fpu is not available in a standalone environment. -.if ${COMPILER_VERSION} < 30800 -CFLAGS.clang+= -mllvm -arm-use-movt=0 -.else -CFLAGS.clang+= -mno-movt -.endif -CFLAGS.clang+= -mfpu=none -.endif - -# The boot loader build uses dd status=none, where possible, for reproducible -# build output (since performance varies from run to run). Trouble is that -# option was recently (10.3) added to FreeBSD and is non-standard. Only use it -# when this test succeeds rather than require dd to be a bootstrap tool. -DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true -DD=dd ${DD_NOSTATUS} - -.if ${MK_LOADER_FORCE_LE} != "no" -.if ${MACHINE_ARCH} == "powerpc64" -CFLAGS+= -mlittle-endian -.endif -.endif - -.endif Modified: stable/11/stand/arm/uboot/Makefile ============================================================================== --- stable/11/stand/arm/uboot/Makefile Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/arm/uboot/Makefile Mon Feb 12 17:44:35 2018 (r329175) @@ -28,7 +28,7 @@ SRCS= start.S conf.c self_reloc.c vers.c CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized .endif -HELP_FILES+= help.uboot ${BOOTSRC}/fdt/help.fdt +HELP_FILES= ${.CURDIR}/help.uboot ${BOOTSRC}/fdt/help.fdt # Always add MI sources .include "${BOOTSRC}/loader.mk" Modified: stable/11/stand/common/bootstrap.h ============================================================================== --- stable/11/stand/common/bootstrap.h Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/common/bootstrap.h Mon Feb 12 17:44:35 2018 (r329175) @@ -45,17 +45,17 @@ extern char command_errbuf[COMMAND_ERRBUFSZ]; #define CMD_FATAL 4 /* interp.c */ -void interact(const char *rc); +void interact(void); int include(const char *filename); /* interp_backslash.c */ -char *backslash(char *str); +char *backslash(const char *str); /* interp_parse.c */ -int parse(int *argc, char ***argv, char *str); +int parse(int *argc, char ***argv, const char *str); /* interp_forth.c */ -void bf_init(const char *rc); +void bf_init(void); int bf_run(char *line); /* boot.c */ Modified: stable/11/stand/common/dev_net.c ============================================================================== --- stable/11/stand/common/dev_net.c Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/common/dev_net.c Mon Feb 12 17:44:35 2018 (r329175) @@ -382,7 +382,7 @@ net_print(int verbose) * It leaves just the pathname in the global rootpath. */ uint32_t -net_parse_rootpath() +net_parse_rootpath(void) { n_long addr = htonl(INADDR_NONE); size_t i; Modified: stable/11/stand/common/interp.c ============================================================================== --- stable/11/stand/common/interp.c Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/common/interp.c Mon Feb 12 17:44:35 2018 (r329175) @@ -39,11 +39,7 @@ __FBSDID("$FreeBSD$"); #ifdef BOOT_FORTH #include "ficl.h" -#define RETURN(x) stackPushINT(bf_vm->pStack,!x); return(x) - extern FICL_VM *bf_vm; -#else -#define RETURN(x) return(x) #endif #define MAXARGS 20 /* maximum number of arguments allowed */ @@ -51,12 +47,10 @@ extern FICL_VM *bf_vm; static void prompt(void); #ifndef BOOT_FORTH -static int perform(int argc, char *argv[]); - /* * Perform the command */ -int +static int perform(int argc, char *argv[]) { int result; @@ -82,7 +76,7 @@ perform(int argc, char *argv[]) } else { command_errmsg = "unknown command"; } - RETURN(result); + return(result); } #endif /* ! BOOT_FORTH */ @@ -90,7 +84,7 @@ perform(int argc, char *argv[]) * Interactive mode */ void -interact(const char *rc) +interact(void) { static char input[256]; /* big enough? */ #ifndef BOOT_FORTH @@ -99,14 +93,11 @@ interact(const char *rc) #endif #ifdef BOOT_FORTH - bf_init((rc) ? "" : NULL); + bf_init(); #endif - if (rc == NULL) { - /* Read our default configuration. */ - include("/boot/loader.rc"); - } else if (*rc != '\0') - include(rc); + /* Read our default configuration. */ + include("/boot/loader.rc"); printf("\n"); Modified: stable/11/stand/common/interp_backslash.c ============================================================================== --- stable/11/stand/common/interp_backslash.c Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/common/interp_backslash.c Mon Feb 12 17:44:35 2018 (r329175) @@ -28,7 +28,7 @@ __FBSDID("$FreeBSD$"); * processing" done on it. Original can be free'd if desired. */ char * -backslash(char *str) +backslash(const char *str) { /* * Remove backslashes from the strings. Turn \040 etc. into a single Modified: stable/11/stand/common/interp_forth.c ============================================================================== --- stable/11/stand/common/interp_forth.c Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/common/interp_forth.c Mon Feb 12 17:44:35 2018 (r329175) @@ -250,7 +250,7 @@ bf_command(FICL_VM *vm) * Initialise the Forth interpreter, create all our commands as words. */ void -bf_init(const char *rc) +bf_init(void) { struct bootblk_command **cmdp; char create_buf[41]; /* 31 characters-long builtins */ @@ -280,14 +280,9 @@ bf_init(const char *rc) ficlSetEnv(bf_sys, "loader_version", bootprog_rev); /* try to load and run init file if present */ - if (rc == NULL) - rc = "/boot/boot.4th"; - if (*rc != '\0') { - fd = open(rc, O_RDONLY); - if (fd != -1) { - (void)ficlExecFD(bf_vm, fd); - close(fd); - } + if ((fd = open("/boot/boot.4th", O_RDONLY)) != -1) { + (void)ficlExecFD(bf_vm, fd); + close(fd); } } Modified: stable/11/stand/common/interp_parse.c ============================================================================== --- stable/11/stand/common/interp_parse.c Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/common/interp_parse.c Mon Feb 12 17:44:35 2018 (r329175) @@ -7,7 +7,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Jordan K. Hubbard * 29 August 1998 * @@ -82,7 +82,7 @@ isdquote(int ch) } int -parse(int *argc, char ***argv, char *str) +parse(int *argc, char ***argv, const char *str) { int ac; char *val, *p, *q, *copy = NULL; Modified: stable/11/stand/common/load_elf.c ============================================================================== --- stable/11/stand/common/load_elf.c Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/common/load_elf.c Mon Feb 12 17:44:35 2018 (r329175) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #define FREEBSD_ELF -#include +#include #include "bootstrap.h" @@ -456,7 +456,7 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ * think the rule is going to have to be that you must strip a * file to remove symbols before gzipping it. */ - chunk = ehdr->e_shnum * ehdr->e_shentsize; + chunk = (size_t)ehdr->e_shnum * (size_t)ehdr->e_shentsize; if (chunk == 0 || ehdr->e_shoff == 0) goto nosyms; shdr = alloc_pread(ef->fd, ehdr->e_shoff, chunk); @@ -747,7 +747,7 @@ __elfN(load_modmetadata)(struct preloaded_file *fp, u_ goto out; } - size = ef.ehdr->e_shnum * ef.ehdr->e_shentsize; + size = (size_t)ef.ehdr->e_shnum * (size_t)ef.ehdr->e_shentsize; shdr = alloc_pread(ef.fd, ef.ehdr->e_shoff, size); if (shdr == NULL) { err = ENOMEM; Modified: stable/11/stand/common/load_elf_obj.c ============================================================================== --- stable/11/stand/common/load_elf_obj.c Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/common/load_elf_obj.c Mon Feb 12 17:44:35 2018 (r329175) @@ -33,12 +33,12 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include #define FREEBSD_ELF -#include +#include #include "bootstrap.h" Modified: stable/11/stand/common/reloc_elf.c ============================================================================== --- stable/11/stand/common/reloc_elf.c Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/common/reloc_elf.c Mon Feb 12 17:44:35 2018 (r329175) @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$"); #include #define FREEBSD_ELF -#include +#include #include "bootstrap.h" Modified: stable/11/stand/defs.mk ============================================================================== --- stable/11/stand/defs.mk Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/defs.mk Mon Feb 12 17:44:35 2018 (r329175) @@ -2,6 +2,8 @@ .include +WARNS?=1 + .if !defined(__BOOT_DEFS_MK__) __BOOT_DEFS_MK__=${MFILE} @@ -22,15 +24,6 @@ BOOTOBJ= ${OBJTOP}/stand # BINDIR is where we install BINDIR?= /boot -# NB: The makefiles depend on these being empty when we don't build forth. -.if ${MK_FORTH} != "no" -LIBFICL= ${BOOTOBJ}/ficl/libficl.a -.if ${MACHINE} == "i386" -LIBFICL32= ${LIBFICL} -.else -LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a -.endif -.endif LIBSA= ${BOOTOBJ}/libsa/libsa.a .if ${MACHINE} == "i386" LIBSA32= ${LIBSA} @@ -39,54 +32,16 @@ LIBSA32= ${BOOTOBJ}/libsa32/libsa32.a .endif # Standard options: - -# Filesystem support -.if ${LOADER_CD9660_SUPPORT:Uno} == "yes" -CFLAGS+= -DLOADER_CD9660_SUPPORT +CFLAGS+= -nostdinc +.if ${MACHINE_ARCH} == "amd64" && ${DO32:U0} == 1 +CFLAGS+= -I${BOOTOBJ}/libsa32 +.else +CFLAGS+= -I${BOOTOBJ}/libsa .endif -.if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes" -CFLAGS+= -DLOADER_EXT2FS_SUPPORT -.endif -.if ${LOADER_MSDOS_SUPPORT:Uno} == "yes" -CFLAGS+= -DLOADER_MSDOS_SUPPORT -.endif -.if ${LOADER_NANDFS_SUPPORT:U${MK_NAND}} == "yes" -CFLAGS+= -DLOADER_NANDFS_SUPPORT -.endif -.if ${LOADER_UFS_SUPPORT:Uyes} == "yes" -CFLAGS+= -DLOADER_UFS_SUPPORT -.endif +CFLAGS+= -I${SASRC} -D_STANDALONE +CFLAGS+= -I${SYSDIR} -# Compression -.if ${LOADER_GZIP_SUPPORT:Uno} == "yes" -CFLAGS+= -DLOADER_GZIP_SUPPORT -.endif -.if ${LOADER_BZIP2_SUPPORT:Uno} == "yes" -CFLAGS+= -DLOADER_BZIP2_SUPPORT -.endif - -# Network related things -.if ${LOADER_NET_SUPPORT:Uno} == "yes" -CFLAGS+= -DLOADER_NET_SUPPORT -.endif -.if ${LOADER_NFS_SUPPORT:Uno} == "yes" -CFLAGS+= -DLOADER_NFS_SUPPORT -.endif -.if ${LOADER_TFTP_SUPPORT:Uno} == "yes" -CFLAGS+= -DLOADER_TFTP_SUPPORT -.endif - -# Disk and partition support -.if ${LOADER_DISK_SUPPORT:Uyes} == "yes" -CFLAGS+= -DLOADER_DISK_SUPPORT -.if ${LOADER_GPT_SUPPORT:Uyes} == "yes" -CFLAGS+= -DLOADER_GPT_SUPPORT -.endif -.if ${LOADER_MBR_SUPPORT:Uyes} == "yes" -CFLAGS+= -DLOADER_MBR_SUPPORT -.endif - -# GELI Support, with backward compat hooks +# GELI Support, with backward compat hooks (mostly) .if defined(HAVE_GELI) .if defined(LOADER_NO_GELI_SUPPORT) MK_LOADER_GELI=no @@ -100,11 +55,17 @@ MK_LOADER_GELI=yes CFLAGS+= -DLOADER_GELI_SUPPORT CFLAGS+= -I${BOOTSRC}/geli LIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a +.endif # MK_LOADER_GELI +.endif # HAVE_GELI + +# These should be confined to loader.mk, but can't because uboot/lib +# also uses it. It's part of loader, but isn't a loader so we can't +# just include loader.mk +.if ${LOADER_DISK_SUPPORT:Uyes} == "yes" +CFLAGS+= -DLOADER_DISK_SUPPORT .endif -.endif -.endif -CFLAGS+= -I${SYSDIR} +# Machine specific flags for all builds here # All PowerPC builds are 32 bit. We have no 64-bit loaders on powerpc # or powerpc64. @@ -122,6 +83,49 @@ LD_FLAGS+= -m elf_i386_fbsd AFLAGS+= --32 .endif +SSP_CFLAGS= + +# Add in the no float / no SIMD stuff and announce we're freestanding +# aarch64 and riscv don't have -msoft-float, but all others do. riscv +# currently has no /boot/loader, but may soon. +CFLAGS+= -ffreestanding ${CFLAGS_NO_SIMD} +.if ${MACHINE_CPUARCH} == "aarch64" +CFLAGS+= -mgeneral-regs-only +.elif ${MACHINE_CPUARCH} != "riscv" +CFLAGS+= -msoft-float +.endif + +.if ${MACHINE_CPUARCH} == "i386" || (${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1) +CFLAGS+= -march=i386 +CFLAGS.gcc+= -mpreferred-stack-boundary=2 +.endif + + +.if ${MACHINE_CPUARCH} == "arm" +# Do not generate movt/movw, because the relocation fixup for them does not +# translate to the -Bsymbolic -pie format required by self_reloc() in loader(8). +# Also, the fpu is not available in a standalone environment. +.if ${COMPILER_VERSION} < 30800 +CFLAGS.clang+= -mllvm -arm-use-movt=0 +.else +CFLAGS.clang+= -mno-movt +.endif +CFLAGS.clang+= -mfpu=none +.endif + +# The boot loader build uses dd status=none, where possible, for reproducible +# build output (since performance varies from run to run). Trouble is that +# option was recently (10.3) added to FreeBSD and is non-standard. Only use it +# when this test succeeds rather than require dd to be a bootstrap tool. +DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true +DD=dd ${DD_NOSTATUS} + +.if ${MK_LOADER_FORCE_LE} != "no" +.if ${MACHINE_ARCH} == "powerpc64" +CFLAGS+= -mlittle-endian +.endif +.endif + # Make sure we use the machine link we're about to create CFLAGS+=-I. @@ -163,9 +167,5 @@ ${_ILINKS}: path=`(cd $$path && /bin/pwd)` ; \ ${ECHO} ${.TARGET:T} "->" $$path ; \ ln -fhs $$path ${.TARGET:T} - -# For loader implementations, we generate a loader.help file. This can be suppressed by -# setting HELP_FILES to nothing. -HELP_FILES= ${LDRSRC}/help.common .endif # __BOOT_DEFS_MK__ Modified: stable/11/stand/efi/boot1/Makefile ============================================================================== --- stable/11/stand/efi/boot1/Makefile Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/efi/boot1/Makefile Mon Feb 12 17:44:35 2018 (r329175) @@ -31,8 +31,9 @@ CWARNFLAGS.zfs_module.c += -Wno-unused-function SRCS= boot1.c self_reloc.c start.S ufs_module.c .if ${MK_ZFS} != "no" SRCS+= zfs_module.c -CFLAGS+= -I${ZFSSRC} -CFLAGS+= -I${SYSDIR}/cddl/boot/zfs +CFLAGS.zfs_module.c+= -I${ZFSSRC} +CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/boot/zfs +CFLAGS.zfs_module.c+= -I${SYSDIR}/crypto/skein CFLAGS+= -DEFI_ZFS_BOOT LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a .endif @@ -105,8 +106,6 @@ boot1.efi: ${PROG} -j .dynamic -j .dynsym -j .rel.dyn \ -j .rela.dyn -j .reloc -j .eh_frame \ --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET} - -boot1.o: ${SASRC}/ufsread.c # The following inserts our objects into a template FAT file system # created by generate-fat.sh Modified: stable/11/stand/efi/boot1/boot1.c ============================================================================== --- stable/11/stand/efi/boot1/boot1.c Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/efi/boot1/boot1.c Mon Feb 12 17:44:35 2018 (r329175) @@ -29,7 +29,6 @@ __FBSDID("$FreeBSD$"); #include #include -typedef CHAR16 efi_char; #include #include "boot_module.h" Modified: stable/11/stand/efi/include/efichar.h ============================================================================== --- stable/11/stand/efi/include/efichar.h Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/efi/include/efichar.h Mon Feb 12 17:44:35 2018 (r329175) @@ -29,6 +29,12 @@ #ifndef _BOOT_EFI_EFICHAR_H_ #define _BOOT_EFI_EFICHAR_H_ +#ifdef _STANDALONE +#include + +typedef CHAR16 efi_char; +#endif + int ucs2_to_utf8(const efi_char *, char **); int utf8_to_ucs2(const char *, efi_char **, size_t *); int ucs2len(const efi_char *); Modified: stable/11/stand/efi/libefi/Makefile ============================================================================== --- stable/11/stand/efi/libefi/Makefile Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/efi/libefi/Makefile Mon Feb 12 17:44:35 2018 (r329175) @@ -52,6 +52,4 @@ CFLAGS+= ${FORMAT_EXTENSIONS} CFLAGS+= -DTERM_EMU .endif -CFLAGS+= -DLIBEFI - .include Modified: stable/11/stand/efi/libefi/efichar.c ============================================================================== --- stable/11/stand/efi/libefi/efichar.c Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/efi/libefi/efichar.c Mon Feb 12 17:44:35 2018 (r329175) @@ -29,16 +29,16 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef LIBEFI +#ifdef _STANDALONE #include #else #include #include #include #include -#endif #include #include +#endif #include "efichar.h" Modified: stable/11/stand/efi/libefi/efipart.c ============================================================================== --- stable/11/stand/efi/libefi/efipart.c Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/efi/libefi/efipart.c Mon Feb 12 17:44:35 2018 (r329175) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL; @@ -196,6 +197,82 @@ efipart_floppy(EFI_DEVICE_PATH *node) } /* + * Determine if the provided device path is hdd. + * + * There really is no simple fool proof way to classify the devices. + * Since we do build three lists of devices - floppy, cd and hdd, we + * will try to see if the device is floppy or cd, and list anything else + * as hdd. + */ +static bool +efipart_hdd(EFI_DEVICE_PATH *dp) +{ + unsigned i, nin; + EFI_DEVICE_PATH *devpath, *node; + EFI_BLOCK_IO *blkio; + EFI_STATUS status; + + if (dp == NULL) + return (false); + + if ((node = efi_devpath_last_node(dp)) == NULL) + return (false); + + if (efipart_floppy(node) != NULL) + return (false); + + /* + * Test every EFI BLOCK IO handle to make sure dp is not device path + * for CD/DVD. + */ + nin = efipart_nhandles / sizeof (*efipart_handles); + for (i = 0; i < nin; i++) { + devpath = efi_lookup_devpath(efipart_handles[i]); + if (devpath == NULL) + return (false); + + /* Only continue testing when dp is prefix in devpath. */ + if (!efi_devpath_is_prefix(dp, devpath)) + continue; + + /* + * The device path has to have last node describing the + * device, or we can not test the type. + */ + if ((node = efi_devpath_last_node(devpath)) == NULL) + return (false); + + if (DevicePathType(node) == MEDIA_DEVICE_PATH && + DevicePathSubType(node) == MEDIA_CDROM_DP) { + return (false); + } + + /* Make sure we do have the media. */ + status = BS->HandleProtocol(efipart_handles[i], + &blkio_guid, (void **)&blkio); + if (EFI_ERROR(status)) + return (false); + + /* USB or SATA cd without the media. */ + if (blkio->Media->RemovableMedia && + !blkio->Media->MediaPresent) { + return (false); + } + + /* + * We assume the block size 512 or greater power of 2. + * iPXE is known to insert stub BLOCK IO device with + * BlockSize 1. + */ + if (blkio->Media->BlockSize < 512 || + !powerof2(blkio->Media->BlockSize)) { + return (false); + } + } + return (true); +} + +/* * Add or update entries with new handle data. */ static int @@ -308,9 +385,13 @@ efipart_updatecd(void) if ((node = efi_devpath_last_node(devpath)) == NULL) continue; + if (efipart_floppy(node) != NULL) continue; + if (efipart_hdd(devpath)) + continue; + status = BS->HandleProtocol(efipart_handles[i], &blkio_guid, (void **)&blkio); if (EFI_ERROR(status)) @@ -380,13 +461,21 @@ efipart_hdinfo_add(EFI_HANDLE disk_handle, EFI_HANDLE pdinfo_t *hd, *pd, *last; disk_devpath = efi_lookup_devpath(disk_handle); - part_devpath = efi_lookup_devpath(part_handle); - if (disk_devpath == NULL || part_devpath == NULL) { + if (disk_devpath == NULL) return (ENOENT); + + if (part_handle != NULL) { + part_devpath = efi_lookup_devpath(part_handle); + if (part_devpath == NULL) + return (ENOENT); + node = (HARDDRIVE_DEVICE_PATH *) + efi_devpath_last_node(part_devpath); + if (node == NULL) + return (ENOENT); /* This should not happen. */ + } else { + part_devpath = NULL; + node = NULL; } - node = (HARDDRIVE_DEVICE_PATH *)efi_devpath_last_node(part_devpath); - if (node == NULL) - return (ENOENT); /* This should not happen. */ pd = calloc(1, sizeof(pdinfo_t)); if (pd == NULL) { @@ -397,6 +486,9 @@ efipart_hdinfo_add(EFI_HANDLE disk_handle, EFI_HANDLE STAILQ_FOREACH(hd, &hdinfo, pd_link) { if (efi_devpath_match(hd->pd_devpath, disk_devpath) == true) { + if (part_devpath == NULL) + return (0); + /* Add the partition. */ pd->pd_handle = part_handle; pd->pd_unit = node->PartitionNumber; @@ -419,6 +511,9 @@ efipart_hdinfo_add(EFI_HANDLE disk_handle, EFI_HANDLE hd->pd_devpath = disk_devpath; STAILQ_INSERT_TAIL(&hdinfo, hd, pd_link); + if (part_devpath == NULL) + return (0); + pd = calloc(1, sizeof(pdinfo_t)); if (pd == NULL) { printf("Failed to add partition, out of memory\n"); @@ -470,8 +565,7 @@ efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle) unit = 0; /* FILEPATH_DEVICE_PATH has 0 terminated string */ - for (len = 0; node->PathName[len] != 0; len++) - ; + len = ucs2len(node->PathName); if ((pathname = malloc(len + 1)) == NULL) { printf("Failed to add disk, out of memory\n"); free(pd); @@ -541,7 +635,8 @@ efipart_updatehd(void) if ((node = efi_devpath_last_node(devpath)) == NULL) continue; - if (efipart_floppy(node) != NULL) + + if (!efipart_hdd(devpath)) continue; status = BS->HandleProtocol(efipart_handles[i], @@ -550,6 +645,12 @@ efipart_updatehd(void) continue; if (DevicePathType(node) == MEDIA_DEVICE_PATH && + DevicePathSubType(node) == MEDIA_FILEPATH_DP) { + efipart_hdinfo_add_filepath(efipart_handles[i]); + continue; + } + + if (DevicePathType(node) == MEDIA_DEVICE_PATH && DevicePathSubType(node) == MEDIA_HARDDRIVE_DP) { devpathcpy = efi_devpath_trim(devpath); if (devpathcpy == NULL) @@ -568,18 +669,16 @@ efipart_updatehd(void) continue; if ((node = efi_devpath_last_node(devpathcpy)) == NULL) continue; + if (DevicePathType(node) == MEDIA_DEVICE_PATH && DevicePathSubType(node) == MEDIA_HARDDRIVE_DP) continue; + efipart_hdinfo_add(handle, efipart_handles[i]); continue; } - if (DevicePathType(node) == MEDIA_DEVICE_PATH && - DevicePathSubType(node) == MEDIA_FILEPATH_DP) { - efipart_hdinfo_add_filepath(efipart_handles[i]); - continue; - } + efipart_hdinfo_add(efipart_handles[i], NULL); } } Modified: stable/11/stand/efi/loader/Makefile ============================================================================== --- stable/11/stand/efi/loader/Makefile Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/efi/loader/Makefile Mon Feb 12 17:44:35 2018 (r329175) @@ -89,7 +89,6 @@ CFLAGS+= -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE} .endif # Always add MI sources -HELP_FILES= .include "${BOOTSRC}/loader.mk" FILES+= loader.efi Modified: stable/11/stand/efi/loader/main.c ============================================================================== --- stable/11/stand/efi/loader/main.c Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/efi/loader/main.c Mon Feb 12 17:44:35 2018 (r329175) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include @@ -501,7 +501,7 @@ main(int argc, CHAR16 *argv[]) #endif } - interact(NULL); /* doesn't return */ + interact(); /* doesn't return */ return (EFI_SUCCESS); /* keep compiler happy */ } Modified: stable/11/stand/ficl.mk ============================================================================== --- stable/11/stand/ficl.mk Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/ficl.mk Mon Feb 12 17:44:35 2018 (r329175) @@ -12,8 +12,6 @@ FICL_CPUARCH= mips64 FICL_CPUARCH= ${MACHINE_CPUARCH} .endif -.PATH: ${FICLSRC} ${FICLSRC}/${FICL_CPUARCH} - .if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 0 CFLAGS+= -fPIC .endif Modified: stable/11/stand/ficl/Makefile ============================================================================== --- stable/11/stand/ficl/Makefile Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/ficl/Makefile Mon Feb 12 17:44:35 2018 (r329175) @@ -4,6 +4,8 @@ .include .include "${BOOTSRC}/ficl.mk" +.PATH: ${FICLSRC} ${FICLSRC}/${FICL_CPUARCH} + BASE_SRCS= dict.c ficl.c fileaccess.c float.c loader.c math64.c \ prefix.c search.c stack.c tools.c vm.c words.c Modified: stable/11/stand/ficl/float.c ============================================================================== --- stable/11/stand/ficl/float.c Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/ficl/float.c Mon Feb 12 17:44:35 2018 (r329175) @@ -43,14 +43,14 @@ /* $FreeBSD$ */ +#include "ficl.h" + +#if FICL_WANT_FLOAT #include #include #include #include #include -#include "ficl.h" - -#if FICL_WANT_FLOAT /******************************************************************* ** Do float addition r1 + r2. Modified: stable/11/stand/geli/Makefile ============================================================================== --- stable/11/stand/geli/Makefile Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/geli/Makefile Mon Feb 12 17:44:35 2018 (r329175) @@ -2,6 +2,7 @@ # libgeliboot MAN= +DO32=1 .include MK_SSP= no @@ -11,19 +12,6 @@ INTERNALLIB= MK_PROFILE= no NO_PIC= -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" -CFLAGS+= -march=i386 -.endif -.if ${MACHINE_ARCH} == "amd64" -CFLAGS+= -m32 -.endif - -WARNS?= 0 - -# string functions from libc -.PATH: ${SRCTOP}/lib/libc/string -SRCS+= bcmp.c bcopy.c bzero.c - # Our password input method SRCS+= pwgets.c @@ -45,7 +33,6 @@ SRCS+= rijndael-alg-fst.c rijndael-api-fst.c rijndael # local GELI Implementation .PATH: ${SYSDIR}/geom/eli -CFLAGS+= -D_STAND SRCS+= geliboot_crypto.c g_eli_hmac.c g_eli_key.c g_eli_key_cache.c pkcs5v2.c # aes Modified: stable/11/stand/geli/geliboot.c ============================================================================== --- stable/11/stand/geli/geliboot.c Mon Feb 12 17:42:28 2018 (r329174) +++ stable/11/stand/geli/geliboot.c Mon Feb 12 17:44:35 2018 (r329175) @@ -222,7 +222,7 @@ geli_taste(int read_func(void *vdev, void *priv, off_t */ static int geli_attach(struct geli_entry *ge, struct dsk *dskp, const char *passphrase, - const u_char *mkeyp) + u_char *mkeyp) { u_char key[G_ELI_USERKEYLEN], mkey[G_ELI_DATAIVKEYLEN], *mkp; u_int keynum; @@ -248,7 +248,7 @@ geli_attach(struct geli_entry *ge, struct dsk *dskp, c } else if (geli_e->md.md_iterations == 0) { g_eli_crypto_hmac_update(&ctx, geli_e->md.md_salt, sizeof(geli_e->md.md_salt)); - g_eli_crypto_hmac_update(&ctx, passphrase, + g_eli_crypto_hmac_update(&ctx, (const uint8_t *)passphrase, strlen(passphrase)); } else if (geli_e->md.md_iterations > 0) { printf("Calculating GELI Decryption Key disk%dp%d @ %d" @@ -294,7 +294,7 @@ found_key: /* * The encryption key is: ekey = HMAC_SHA512(Data-Key, 0x10) */ - g_eli_crypto_hmac(mkp, G_ELI_MAXKEYLEN, "\x10", 1, + g_eli_crypto_hmac(mkp, G_ELI_MAXKEYLEN, (const uint8_t *)"\x10", 1, geli_e->sc.sc_ekey, 0); } explicit_bzero(mkey, sizeof(mkey)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Mon Feb 12 18:30:21 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49DE0F0FABB; Mon, 12 Feb 2018 18:30:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EB4BC8398F; Mon, 12 Feb 2018 18:30:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1DB4158C9; Mon, 12 Feb 2018 18:30:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1CIUKg1094240; Mon, 12 Feb 2018 18:30:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1CIUKFu094238; Mon, 12 Feb 2018 18:30:20 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802121830.w1CIUKFu094238@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 12 Feb 2018 18:30:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329176 - in stable/11/stand/mips/beri: boot2 common X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand/mips/beri: boot2 common X-SVN-Commit-Revision: 329176 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 18:30:21 -0000 Author: kevans Date: Mon Feb 12 18:30:20 2018 New Revision: 329176 URL: https://svnweb.freebsd.org/changeset/base/329176 Log: MFC r327705,r328447: Fix BERI bootloader build r327705: Use instead of and in boot code. r328447: BERI isn't BTX, so we don't have to provide exit(). Modified: stable/11/stand/mips/beri/boot2/boot2.c stable/11/stand/mips/beri/common/sdcard.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/mips/beri/boot2/boot2.c ============================================================================== --- stable/11/stand/mips/beri/boot2/boot2.c Mon Feb 12 17:44:35 2018 (r329175) +++ stable/11/stand/mips/beri/boot2/boot2.c Mon Feb 12 18:30:20 2018 (r329176) @@ -139,7 +139,6 @@ static int comspeed = SIOSPD; struct bootinfo bootinfo; static uint8_t ioctrl = IO_KEYBOARD; -void exit(int); void putchar(int); static void boot_fromdram(void); static void boot_fromfs(void); @@ -277,12 +276,6 @@ main(u_int argc, const char *argv[], const char *envv[ else load(); } -} - -/* XXX - Needed for btxld to link the boot2 binary; do not remove. */ -void -exit(int x) -{ } static void Modified: stable/11/stand/mips/beri/common/sdcard.c ============================================================================== --- stable/11/stand/mips/beri/common/sdcard.c Mon Feb 12 17:44:35 2018 (r329175) +++ stable/11/stand/mips/beri/common/sdcard.c Mon Feb 12 18:30:20 2018 (r329176) @@ -33,8 +33,7 @@ #include #include -#include -#include +#include /* From owner-svn-src-stable-11@freebsd.org Mon Feb 12 18:40:20 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87E33F1097B; Mon, 12 Feb 2018 18:40:20 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 39AE5845DC; Mon, 12 Feb 2018 18:40:20 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 348A715A91; Mon, 12 Feb 2018 18:40:20 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1CIeKr8099790; Mon, 12 Feb 2018 18:40:20 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1CIeJ4l099785; Mon, 12 Feb 2018 18:40:19 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201802121840.w1CIeJ4l099785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 12 Feb 2018 18:40:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329177 - in stable/11/sys: compat/freebsd32 kern X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/11/sys: compat/freebsd32 kern X-SVN-Commit-Revision: 329177 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 18:40:20 -0000 Author: brooks Date: Mon Feb 12 18:40:19 2018 New Revision: 329177 URL: https://svnweb.freebsd.org/changeset/base/329177 Log: MFC r328799: Add kern.ipc.{msqids,semsegs,sema} sysctls for FreeBSD32. Stop leaking kernel pointers though theses sysctls and make sure that the padding in the structures is zeroed on allocation to avoid other leaks. Reviewed by: gordon, kib Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D13459 Modified: stable/11/sys/compat/freebsd32/freebsd32_ipc.h stable/11/sys/kern/sysv_msg.c stable/11/sys/kern/sysv_sem.c stable/11/sys/kern/sysv_shm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/freebsd32/freebsd32_ipc.h ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_ipc.h Mon Feb 12 18:30:20 2018 (r329176) +++ stable/11/sys/compat/freebsd32/freebsd32_ipc.h Mon Feb 12 18:40:19 2018 (r329177) @@ -47,6 +47,18 @@ struct semid_ds32 { int32_t sem_ctime; }; +#ifdef _KERNEL +struct semid_kernel32 { + /* Data structure exposed to user space. */ + struct semid_ds32 u; + + /* Kernel-private components of the semaphore. */ + int32_t label; + int32_t cred; +}; +#endif /* _KERNEL */ + + union semun32 { int val; uint32_t buf; @@ -67,6 +79,17 @@ struct msqid_ds32 { int32_t msg_ctime; }; +#ifdef _KERNEL +struct msqid_kernel32 { + /* Data structure exposed to user space. */ + struct msqid_ds32 u; + + /* Kernel-private components of the message queue. */ + uint32_t label; + uint32_t cred; +}; +#endif + struct shmid_ds32 { struct ipc_perm32 shm_perm; int32_t shm_segsz; @@ -77,6 +100,15 @@ struct shmid_ds32 { int32_t shm_dtime; int32_t shm_ctime; }; + +#ifdef _KERNEL +struct shmid_kernel32 { + struct shmid_ds32 u; + int32_t *object; + int32_t *label; + int32_t *cred; +}; +#endif struct shm_info32 { int32_t used_ids; Modified: stable/11/sys/kern/sysv_msg.c ============================================================================== --- stable/11/sys/kern/sysv_msg.c Mon Feb 12 18:30:20 2018 (r329176) +++ stable/11/sys/kern/sysv_msg.c Mon Feb 12 18:40:19 2018 (r329177) @@ -220,7 +220,7 @@ msginit() msgmaps = malloc(sizeof(struct msgmap) * msginfo.msgseg, M_MSG, M_WAITOK); msghdrs = malloc(sizeof(struct msg) * msginfo.msgtql, M_MSG, M_WAITOK); msqids = malloc(sizeof(struct msqid_kernel) * msginfo.msgmni, M_MSG, - M_WAITOK); + M_WAITOK | M_ZERO); /* * msginfo.msgssz should be a power of two for efficiency reasons. @@ -1417,7 +1417,12 @@ static int sysctl_msqids(SYSCTL_HANDLER_ARGS) { struct msqid_kernel tmsqk; +#ifdef COMPAT_FREEBSD32 + struct msqid_kernel32 tmsqk32; +#endif struct prison *pr, *rpr; + void *outaddr; + size_t outsize; int error, i; pr = req->td->td_ucred->cr_prison; @@ -1434,7 +1439,40 @@ sysctl_msqids(SYSCTL_HANDLER_ARGS) tmsqk.u.msg_perm.key = IPC_PRIVATE; } mtx_unlock(&msq_mtx); - error = SYSCTL_OUT(req, &tmsqk, sizeof(tmsqk)); +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) { + bzero(&tmsqk32, sizeof(tmsqk32)); + freebsd32_ipcperm_out(&tmsqk.u.msg_perm, + &tmsqk32.u.msg_perm); + /* Don't copy u.msg_first or u.msg_last */ + CP(tmsqk, tmsqk32, u.msg_cbytes); + CP(tmsqk, tmsqk32, u.msg_qnum); + CP(tmsqk, tmsqk32, u.msg_qbytes); + CP(tmsqk, tmsqk32, u.msg_lspid); + CP(tmsqk, tmsqk32, u.msg_lrpid); + CP(tmsqk, tmsqk32, u.msg_stime); + CP(tmsqk, tmsqk32, u.msg_rtime); + CP(tmsqk, tmsqk32, u.msg_ctime); + /* Don't copy label or cred */ + outaddr = &tmsqk32; + outsize = sizeof(tmsqk32); + } else +#endif + { + /* Don't leak kernel pointers */ + tmsqk.u.msg_first = NULL; + tmsqk.u.msg_last = NULL; + tmsqk.label = NULL; + tmsqk.cred = NULL; + /* + * XXX: some padding also exists, but we take care to + * allocate our pool of msqid_kernel structs with + * zeroed memory so this should be OK. + */ + outaddr = &tmsqk; + outsize = sizeof(tmsqk); + } + error = SYSCTL_OUT(req, outaddr, outsize); if (error != 0) break; } Modified: stable/11/sys/kern/sysv_sem.c ============================================================================== --- stable/11/sys/kern/sysv_sem.c Mon Feb 12 18:30:20 2018 (r329176) +++ stable/11/sys/kern/sysv_sem.c Mon Feb 12 18:40:19 2018 (r329177) @@ -271,7 +271,7 @@ seminit(void) sem = malloc(sizeof(struct sem) * seminfo.semmns, M_SEM, M_WAITOK); sema = malloc(sizeof(struct semid_kernel) * seminfo.semmni, M_SEM, - M_WAITOK); + M_WAITOK | M_ZERO); sema_mtx = malloc(sizeof(struct mtx) * seminfo.semmni, M_SEM, M_WAITOK | M_ZERO); semu = malloc(seminfo.semmnu * seminfo.semusz, M_SEM, M_WAITOK); @@ -1467,6 +1467,11 @@ sysctl_sema(SYSCTL_HANDLER_ARGS) { struct prison *pr, *rpr; struct semid_kernel tsemak; +#ifdef COMPAT_FREEBSD32 + struct semid_kernel32 tsemak32; +#endif + void *outaddr; + size_t outsize; int error, i; pr = req->td->td_ucred->cr_prison; @@ -1483,7 +1488,28 @@ sysctl_sema(SYSCTL_HANDLER_ARGS) tsemak.u.sem_perm.key = IPC_PRIVATE; } mtx_unlock(&sema_mtx[i]); - error = SYSCTL_OUT(req, &tsemak, sizeof(tsemak)); +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) { + bzero(&tsemak32, sizeof(tsemak32)); + freebsd32_ipcperm_out(&tsemak.u.sem_perm, + &tsemak32.u.sem_perm); + /* Don't copy u.sem_base */ + CP(tsemak, tsemak32, u.sem_nsems); + CP(tsemak, tsemak32, u.sem_otime); + CP(tsemak, tsemak32, u.sem_ctime); + /* Don't copy label or cred */ + outaddr = &tsemak32; + outsize = sizeof(tsemak32); + } else +#endif + { + tsemak.u.sem_base = NULL; + tsemak.label = NULL; + tsemak.cred = NULL; + outaddr = &tsemak; + outsize = sizeof(tsemak); + } + error = SYSCTL_OUT(req, outaddr, outsize); if (error != 0) break; } Modified: stable/11/sys/kern/sysv_shm.c ============================================================================== --- stable/11/sys/kern/sysv_shm.c Mon Feb 12 18:30:20 2018 (r329176) +++ stable/11/sys/kern/sysv_shm.c Mon Feb 12 18:40:19 2018 (r329177) @@ -844,7 +844,8 @@ shmrealloc(void) if (shmalloced >= shminfo.shmmni) return; - newsegs = malloc(shminfo.shmmni * sizeof(*newsegs), M_SHM, M_WAITOK); + newsegs = malloc(shminfo.shmmni * sizeof(*newsegs), M_SHM, + M_WAITOK | M_ZERO); for (i = 0; i < shmalloced; i++) bcopy(&shmsegs[i], &newsegs[i], sizeof(newsegs[0])); for (; i < shminfo.shmmni; i++) { @@ -922,7 +923,8 @@ shminit(void) } } shmalloced = shminfo.shmmni; - shmsegs = malloc(shmalloced * sizeof(shmsegs[0]), M_SHM, M_WAITOK); + shmsegs = malloc(shmalloced * sizeof(shmsegs[0]), M_SHM, + M_WAITOK|M_ZERO); for (i = 0; i < shmalloced; i++) { shmsegs[i].u.shm_perm.mode = SHMSEG_FREE; shmsegs[i].u.shm_perm.seq = 0; @@ -1009,7 +1011,12 @@ static int sysctl_shmsegs(SYSCTL_HANDLER_ARGS) { struct shmid_kernel tshmseg; +#ifdef COMPAT_FREEBSD32 + struct shmid_kernel32 tshmseg32; +#endif struct prison *pr, *rpr; + void *outaddr; + size_t outsize; int error, i; SYSVSHM_LOCK(); @@ -1026,7 +1033,31 @@ sysctl_shmsegs(SYSCTL_HANDLER_ARGS) if (tshmseg.cred->cr_prison != pr) tshmseg.u.shm_perm.key = IPC_PRIVATE; } - error = SYSCTL_OUT(req, &tshmseg, sizeof(tshmseg)); +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) { + bzero(&tshmseg32, sizeof(tshmseg32)); + freebsd32_ipcperm_out(&tshmseg.u.shm_perm, + &tshmseg32.u.shm_perm); + CP(tshmseg, tshmseg32, u.shm_segsz); + CP(tshmseg, tshmseg32, u.shm_lpid); + CP(tshmseg, tshmseg32, u.shm_cpid); + CP(tshmseg, tshmseg32, u.shm_nattch); + CP(tshmseg, tshmseg32, u.shm_atime); + CP(tshmseg, tshmseg32, u.shm_dtime); + CP(tshmseg, tshmseg32, u.shm_ctime); + /* Don't copy object, label, or cred */ + outaddr = &tshmseg32; + outsize = sizeof(tshmseg32); + } else +#endif + { + tshmseg.object = NULL; + tshmseg.label = NULL; + tshmseg.cred = NULL; + outaddr = &tshmseg; + outsize = sizeof(tshmseg); + } + error = SYSCTL_OUT(req, outaddr, outsize); if (error != 0) break; } From owner-svn-src-stable-11@freebsd.org Mon Feb 12 18:53:00 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DB19F11EEB; Mon, 12 Feb 2018 18:53:00 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DDF1F85B61; Mon, 12 Feb 2018 18:52:59 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8D3115DC0; Mon, 12 Feb 2018 18:52:59 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1CIqx66009539; Mon, 12 Feb 2018 18:52:59 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1CIqxD5009538; Mon, 12 Feb 2018 18:52:59 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201802121852.w1CIqxD5009538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Mon, 12 Feb 2018 18:52:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329178 - stable/11/share/examples/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: stable/11/share/examples/bhyve X-SVN-Commit-Revision: 329178 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 18:53:00 -0000 Author: rgrimes Date: Mon Feb 12 18:52:59 2018 New Revision: 329178 URL: https://svnweb.freebsd.org/changeset/base/329178 Log: MFC: r316746 Add UEFI support to vmrun.sh Adds: -E: Use UEFI mode -f: path to UEFI firmware image (default: path to uefi-edk2-bhyve package) -F: UEFI framebuffer size (default: w=1024,h=768) -L: IP to listen for VNC connections on (default: 127.0.0.1) -P: Port to listen for VNC connections on (default: 5900) -T: Enable tablnet device (for VNC) -v: Wait for VNC client before booting VM Submitted by: Shawn Webb Approved by: grehan(mentor),allanjude(original committer) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D10378 Modified: stable/11/share/examples/bhyve/vmrun.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/share/examples/bhyve/vmrun.sh ============================================================================== --- stable/11/share/examples/bhyve/vmrun.sh Mon Feb 12 18:40:19 2018 (r329177) +++ stable/11/share/examples/bhyve/vmrun.sh Mon Feb 12 18:52:59 2018 (r329178) @@ -46,10 +46,12 @@ errmsg() { usage() { local msg=$1 - echo "Usage: vmrun.sh [-aAhi] [-c ] [-C ] [-d ]" - echo " [-e ] [-g ] [-H ]" + echo "Usage: vmrun.sh [-aAEhiTv] [-c ] [-C ] [-d ]" + echo " [-e ] [-f ] [-F ]" + echo " [-g ] [-H ]" echo " [-I ] [-l ]" - echo " [-m ] [-t ] " + echo " [-L ]" + echo " [-m ] [-P ] [-t ] " echo "" echo " -h: display this help message" echo " -a: force memory mapped local APIC access" @@ -58,15 +60,22 @@ usage() { echo " -C: console device (default is ${DEFAULT_CONSOLE})" echo " -d: virtio diskdev file (default is ${DEFAULT_VIRTIO_DISK})" echo " -e: set FreeBSD loader environment variable" + echo " -E: Use UEFI mode" + echo " -f: Use a specific UEFI firmware" + echo " -F: Use a custom UEFI GOP framebuffer size (default: w=1024,h=768)" echo " -g: listen for connection from kgdb at " echo " -H: host filesystem to export to the loader" echo " -i: force boot of the Installation CDROM image" echo " -I: Installation CDROM image location (default is ${DEFAULT_ISOFILE})" echo " -l: the OS loader to use (default is /boot/userboot.so)" + echo " -L: IP address for UEFI GOP VNC server (default: 127.0.0.1)" echo " -m: memory size (default is ${DEFAULT_MEMSIZE})" echo " -p: pass-through a host PCI device at bus/slot/func (e.g. 10/0/0)" + echo " -P: UEFI GOP VNC port (default: 5900)" echo " -t: tap device for virtio-net (default is $DEFAULT_TAPDEV)" + echo " -T: Enable tablet device (for UEFI GOP)" echo " -u: RTC keeps UTC time" + echo " -v: Wait for VNC client connection before booting VM" echo " -w: ignore unimplemented MSRs" echo "" [ -n "$msg" ] && errmsg "$msg" @@ -97,7 +106,16 @@ loader_opt="" bhyverun_opt="-H -A -P" pass_total=0 -while getopts aAc:C:d:e:g:hH:iI:l:m:p:t:uw c ; do +# EFI-specific options +efi_mode=0 +efi_firmware="/usr/local/share/uefi-firmware/BHYVE_UEFI.fd" +vncwait="" +vnchost="127.0.0.1" +vncport=5900 +fbsize="w=1024,h=768" +tablet="" + +while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:p:P:t:Tuvw c ; do case $c in a) bhyverun_opt="${bhyverun_opt} -a" @@ -121,6 +139,15 @@ while getopts aAc:C:d:e:g:hH:iI:l:m:p:t:uw c ; do e) loader_opt="${loader_opt} -e ${OPTARG}" ;; + E) + efi_mode=1 + ;; + f) + efi_firmware="${OPTARG}" + ;; + F) + fbsize="${OPTARG}" + ;; g) gdbport=${OPTARG} ;; @@ -136,6 +163,9 @@ while getopts aAc:C:d:e:g:hH:iI:l:m:p:t:uw c ; do l) loader_opt="${loader_opt} -l ${OPTARG}" ;; + L) + vnchost="${OPTARG}" + ;; m) memsize=${OPTARG} ;; @@ -143,13 +173,22 @@ while getopts aAc:C:d:e:g:hH:iI:l:m:p:t:uw c ; do eval "pass_dev${pass_total}=\"${OPTARG}\"" pass_total=$(($pass_total + 1)) ;; + P) + vncport="${OPTARG}" + ;; t) eval "tap_dev${tap_total}=\"${OPTARG}\"" tap_total=$(($tap_total + 1)) ;; + T) + tablet="-s 30,xhci,tablet" + ;; u) bhyverun_opt="${bhyverun_opt} -u" ;; + v) + vncwait=",wait" + ;; w) bhyverun_opt="${bhyverun_opt} -w" ;; @@ -186,6 +225,13 @@ if [ ${pass_total} -gt 0 ]; then bhyverun_opt="${bhyverun_opt} -S" fi +if [ ${efi_mode} -gt 0 ]; then + if [ ! -f ${efi_firmware} ]; then + echo "Error: EFI Firmware ${efi_firmware} doesn't exist. Try: pkg install uefi-edk2-bhyve" + exit 1 + fi +fi + make_and_check_diskdev() { local virtio_diskdev="$1" @@ -248,11 +294,13 @@ while [ 1 ]; do installer_opt="" fi - ${LOADER} -c ${console} -m ${memsize} ${BOOTDISKS} ${loader_opt} \ - ${vmname} - bhyve_exit=$? - if [ $bhyve_exit -ne 0 ]; then - break + if [ ${efi_mode} -eq 0 ]; then + ${LOADER} -c ${console} -m ${memsize} ${BOOTDISKS} ${loader_opt} \ + ${vmname} + bhyve_exit=$? + if [ $bhyve_exit -ne 0 ]; then + break + fi fi # @@ -286,10 +334,18 @@ while [ 1 ]; do i=$(($i + 1)) done + efiargs="" + if [ ${efi_mode} -gt 0 ]; then + efiargs="-s 29,fbuf,tcp=${vnchost}:${vncport},${fbsize}${vncwait}" + efiargs="${efiargs} -l bootrom,${efi_firmware}" + efiargs="${efiargs} ${tablet}" + fi + ${FBSDRUN} -c ${cpus} -m ${memsize} ${bhyverun_opt} \ -g ${gdbport} \ -s 0:0,hostbridge \ -s 1:0,lpc \ + ${efiargs} \ ${devargs} \ -l com1,${console} \ ${installer_opt} \ From owner-svn-src-stable-11@freebsd.org Mon Feb 12 19:08:17 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9D5BF13692; Mon, 12 Feb 2018 19:08:17 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 652FC87CA6; Mon, 12 Feb 2018 19:08:17 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B44A15FB1; Mon, 12 Feb 2018 19:08:17 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1CJ8Hbu017827; Mon, 12 Feb 2018 19:08:17 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1CJ8H5i017826; Mon, 12 Feb 2018 19:08:17 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201802121908.w1CJ8H5i017826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Mon, 12 Feb 2018 19:08:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329179 - stable/11/share/examples/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: stable/11/share/examples/bhyve X-SVN-Commit-Revision: 329179 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 19:08:18 -0000 Author: rgrimes Date: Mon Feb 12 19:08:17 2018 New Revision: 329179 URL: https://svnweb.freebsd.org/changeset/base/329179 Log: MFC: r328695,r328720,r328784,r328795 share/examples/bhyve/vmrun.sh additions and cleanups r328695: Add option '-n' network device emulation type which has a default of virtio-net PR: 225558 Submitted by: Johannes Lundberg r328720: Add -n to usage synopsis forgotten in r328695. Fix long lines in usage. Consistently use "default:" rather than "default is" r328784: Clean up long lines. r328795: Fold constants and unify vnc variable names. Approved by: grehan (mentor) PR: 225558 Modified: stable/11/share/examples/bhyve/vmrun.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/share/examples/bhyve/vmrun.sh ============================================================================== --- stable/11/share/examples/bhyve/vmrun.sh Mon Feb 12 18:52:59 2018 (r329178) +++ stable/11/share/examples/bhyve/vmrun.sh Mon Feb 12 19:08:17 2018 (r329179) @@ -36,9 +36,15 @@ DEFAULT_CPUS=2 DEFAULT_TAPDEV=tap0 DEFAULT_CONSOLE=stdio +DEFAULT_NIC=virtio-net +DEFAULT_DISK=virtio-blk DEFAULT_VIRTIO_DISK="./diskdev" DEFAULT_ISOFILE="./release.iso" +DEFAULT_VNCHOST="127.0.0.1" +DEFAULT_VNCPORT=5900 +DEFAULT_VNCSIZE="w=1024,h=768" + errmsg() { echo "*** $1" } @@ -46,33 +52,43 @@ errmsg() { usage() { local msg=$1 - echo "Usage: vmrun.sh [-aAEhiTv] [-c ] [-C ] [-d ]" - echo " [-e ] [-f ] [-F ]" + echo "Usage: vmrun.sh [-aAEhiTv] [-c ] [-C ]" \ + "[-d ]" + echo " [-e ] [-f ]" \ + "[-F ]" echo " [-g ] [-H ]" echo " [-I ] [-l ]" echo " [-L ]" - echo " [-m ] [-P ] [-t ] " + echo " [-m ]" \ + "[-n ]" + echo " [-P ] [-t ] " echo "" echo " -h: display this help message" echo " -a: force memory mapped local APIC access" - echo " -A: use AHCI disk emulation instead of virtio" - echo " -c: number of virtual cpus (default is ${DEFAULT_CPUS})" - echo " -C: console device (default is ${DEFAULT_CONSOLE})" - echo " -d: virtio diskdev file (default is ${DEFAULT_VIRTIO_DISK})" + echo " -A: use AHCI disk emulation instead of ${DEFAULT_DISK}" + echo " -c: number of virtual cpus (default: ${DEFAULT_CPUS})" + echo " -C: console device (default: ${DEFAULT_CONSOLE})" + echo " -d: virtio diskdev file (default: ${DEFAULT_VIRTIO_DISK})" echo " -e: set FreeBSD loader environment variable" echo " -E: Use UEFI mode" echo " -f: Use a specific UEFI firmware" - echo " -F: Use a custom UEFI GOP framebuffer size (default: w=1024,h=768)" + echo " -F: Use a custom UEFI GOP framebuffer size" \ + "(default: ${DEFAULT_VNCSIZE}" echo " -g: listen for connection from kgdb at " echo " -H: host filesystem to export to the loader" echo " -i: force boot of the Installation CDROM image" - echo " -I: Installation CDROM image location (default is ${DEFAULT_ISOFILE})" - echo " -l: the OS loader to use (default is /boot/userboot.so)" - echo " -L: IP address for UEFI GOP VNC server (default: 127.0.0.1)" - echo " -m: memory size (default is ${DEFAULT_MEMSIZE})" - echo " -p: pass-through a host PCI device at bus/slot/func (e.g. 10/0/0)" - echo " -P: UEFI GOP VNC port (default: 5900)" - echo " -t: tap device for virtio-net (default is $DEFAULT_TAPDEV)" + echo " -I: Installation CDROM image location" \ + "(default: ${DEFAULT_ISOFILE})" + echo " -l: the OS loader to use (default: /boot/userboot.so)" + echo " -L: IP address for UEFI GOP VNC server" \ + "(default: ${DEFAULT_VNCHOST}" + echo " -m: memory size (default: ${DEFAULT_MEMSIZE})" + echo " -n: network adapter emulation type" \ + "(default: ${DEFAULT_NIC})" + echo " -p: pass-through a host PCI device at bus/slot/func" \ + "(e.g. 10/0/0)" + echo " -P: UEFI GOP VNC port (default: ${DEFAULT_VNCPORT})" + echo " -t: tap device for virtio-net (default: $DEFAULT_TAPDEV)" echo " -T: Enable tablet device (for UEFI GOP)" echo " -u: RTC keeps UTC time" echo " -v: Wait for VNC client connection before booting VM" @@ -98,9 +114,10 @@ isofile=${DEFAULT_ISOFILE} memsize=${DEFAULT_MEMSIZE} console=${DEFAULT_CONSOLE} cpus=${DEFAULT_CPUS} +nic=${DEFAULT_NIC} tap_total=0 disk_total=0 -disk_emulation="virtio-blk" +disk_emulation=${DEFAULT_DISK} gdbport=0 loader_opt="" bhyverun_opt="-H -A -P" @@ -110,12 +127,12 @@ pass_total=0 efi_mode=0 efi_firmware="/usr/local/share/uefi-firmware/BHYVE_UEFI.fd" vncwait="" -vnchost="127.0.0.1" -vncport=5900 -fbsize="w=1024,h=768" +vnchost=${DEFAULT_VNCHOST} +vncport=${DEFAULT_VNCPORT} +vncsize=${DEFAULT_VNCSIZE} tablet="" -while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:p:P:t:Tuvw c ; do +while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:n:p:P:t:Tuvw c ; do case $c in a) bhyverun_opt="${bhyverun_opt} -a" @@ -146,7 +163,7 @@ while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:p:P:t:Tuvw c efi_firmware="${OPTARG}" ;; F) - fbsize="${OPTARG}" + vncsize="${OPTARG}" ;; g) gdbport=${OPTARG} @@ -169,6 +186,9 @@ while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:p:P:t:Tuvw c m) memsize=${OPTARG} ;; + n) + nic=${OPTARG} + ;; p) eval "pass_dev${pass_total}=\"${OPTARG}\"" pass_total=$(($pass_total + 1)) @@ -227,7 +247,8 @@ fi if [ ${efi_mode} -gt 0 ]; then if [ ! -f ${efi_firmware} ]; then - echo "Error: EFI Firmware ${efi_firmware} doesn't exist. Try: pkg install uefi-edk2-bhyve" + echo "Error: EFI Firmware ${efi_firmware} doesn't exist." \ + "Try: pkg install uefi-edk2-bhyve" exit 1 fi fi @@ -264,7 +285,8 @@ while [ 1 ]; do file -s ${first_diskdev} | grep "boot sector" > /dev/null rc=$? if [ $rc -ne 0 ]; then - file -s ${first_diskdev} | grep ": Unix Fast File sys" > /dev/null + file -s ${first_diskdev} | \ + grep ": Unix Fast File sys" > /dev/null rc=$? fi if [ $rc -ne 0 ]; then @@ -295,8 +317,8 @@ while [ 1 ]; do fi if [ ${efi_mode} -eq 0 ]; then - ${LOADER} -c ${console} -m ${memsize} ${BOOTDISKS} ${loader_opt} \ - ${vmname} + ${LOADER} -c ${console} -m ${memsize} ${BOOTDISKS} \ + ${loader_opt} ${vmname} bhyve_exit=$? if [ $bhyve_exit -ne 0 ]; then break @@ -311,7 +333,7 @@ while [ 1 ]; do i=0 while [ $i -lt $tap_total ] ; do eval "tapname=\$tap_dev${i}" - devargs="$devargs -s $nextslot:0,virtio-net,${tapname} " + devargs="$devargs -s $nextslot:0,${nic},${tapname} " nextslot=$(($nextslot + 1)) i=$(($i + 1)) done @@ -336,7 +358,8 @@ while [ 1 ]; do efiargs="" if [ ${efi_mode} -gt 0 ]; then - efiargs="-s 29,fbuf,tcp=${vnchost}:${vncport},${fbsize}${vncwait}" + efiargs="-s 29,fbuf,tcp=${vnchost}:${vncport}," + efiargs="${efiargs}${vncsize}${vncwait}" efiargs="${efiargs} -l bootrom,${efi_firmware}" efiargs="${efiargs} ${tablet}" fi From owner-svn-src-stable-11@freebsd.org Mon Feb 12 19:50:44 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26C69F16D30; Mon, 12 Feb 2018 19:50:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD6056A150; Mon, 12 Feb 2018 19:50:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C84A416662; Mon, 12 Feb 2018 19:50:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1CJohav038786; Mon, 12 Feb 2018 19:50:43 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1CJohFV038785; Mon, 12 Feb 2018 19:50:43 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802121950.w1CJohFV038785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 12 Feb 2018 19:50:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329182 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 329182 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 19:50:44 -0000 Author: kevans Date: Mon Feb 12 19:50:43 2018 New Revision: 329182 URL: https://svnweb.freebsd.org/changeset/base/329182 Log: Correct date in ObsoleteFiles Getting a little ahead of myself here- correct the date to today. Modified: stable/11/ObsoleteFiles.inc Modified: stable/11/ObsoleteFiles.inc ============================================================================== --- stable/11/ObsoleteFiles.inc Mon Feb 12 19:49:20 2018 (r329181) +++ stable/11/ObsoleteFiles.inc Mon Feb 12 19:50:43 2018 (r329182) @@ -38,7 +38,7 @@ # xargs -n1 | sort | uniq -d; # done -# 20180222: Remove libstand +# 20180212: Remove libstand OLD_FILES+=usr/lib/libstand.a OLD_FILES+=usr/lib/libstand_p.a OLD_FILES+=usr/include/stand.h From owner-svn-src-stable-11@freebsd.org Mon Feb 12 20:51:29 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAA56F1BA81; Mon, 12 Feb 2018 20:51:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 578506D0ED; Mon, 12 Feb 2018 20:51:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3855A1707B; Mon, 12 Feb 2018 20:51:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1CKpT0U072131; Mon, 12 Feb 2018 20:51:29 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1CKpSxw072122; Mon, 12 Feb 2018 20:51:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802122051.w1CKpSxw072122@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 12 Feb 2018 20:51:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329183 - in stable/11: . stand stand/arm/uboot stand/common stand/efi/boot1 stand/efi/fdt stand/efi/include stand/efi/libefi stand/efi/loader stand/efi/loader/arch/arm stand/efi/loader... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: . stand stand/arm/uboot stand/common stand/efi/boot1 stand/efi/fdt stand/efi/include stand/efi/libefi stand/efi/loader stand/efi/loader/arch/arm stand/efi/loader/arch/i386 stand/fdt stan... X-SVN-Commit-Revision: 329183 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 20:51:30 -0000 Author: kevans Date: Mon Feb 12 20:51:28 2018 New Revision: 329183 URL: https://svnweb.freebsd.org/changeset/base/329183 Log: MFC Loader Fixes Final: r327612,r327703,r327704,r327878,r327879,r327881, r328007,r328029,r328030,r328031,r328061,r328156,r328169,r328288,r328289, r328290,r328291,r328292,r328411,r328536,r328603,r328614,r328642,r328769, r328779,r328780,r328781,r328782,r328783,r328806,r328808,r328826,r328835, r328911,r328986,r328987,r328990,r328999,r329000,r329019,r329050,r329054, r329060 r327612: Invent new #defines for the biospci_{read,write}_config function r327703: Define __dmadat after #include'ing ufsread.c. r327704: Fix printf missing format variables warnings. r327878: Add GUID for UEFI boot manager variables. r327879: Report the boot order and where we are in that boot order. r327881: Allow this file to be included r328007: Fix booting on some arm64 systems after r327879 by fixing the call to utf8_to_ucs2 r328029: When returning an error and freeing allocated memory from ucs2_to_utf8, NULL the return pointer. r328030: Check the return value from utf8_to_ucs2 instead of whether or not uv is NULL. r328031: Need to free uv after we're done using it. r328061: utf8_to_ucs2() should check for malloc failure r328156: stand: Move sections around to fix stand/ build with ld.lld on armv7 r328169: Remove extra copy of bootinfo.c. It's a bit rotted copy of the one in efi/loader. r328288: Fix some resource leaks. r328289: Don't leak memory when displaying help. r328290: On malloc failure, be sure to close the include file that triggered it. r328291: getenv does not return tainted data in the boot loader. Attempt to clue Coverity into that fact. r328292: There's no tainted data here, tag it as such to avoid false positives. r328411: loader.efi: add missing EFI GUIDs r328536: loader: support for mixed-endianness ELF/loader and POWER8 r328603: Add missing non-POWERPC case to give the scr value something non-zero. r328614: Move libstand.3 to libsa.3. Update libsa.3 to include functions r328642: Break out the interpreters (simple and forth) w/o ifdefs. r328769: Centralize several variables. r328779: Retire pnp.4th and the code needed only for 4th words used here. r328780: These 4th words were an attempt to allow integration into the boot loader scripts. However, that path won't be taken after all it seems. r328781: Remove pcibios forth support. r328782: Now that we no longer conditionally compile some files outside of ficl r328783: Invent new LDR_INTERP for the loader interpreter to use. r328806: We need more heap space to properly load newer powerpc kernels. r328808: Implement strcoll as strcmp. r328826: Make cross-endian loader changes apply only to powerpc r328835: Fix regression introduced in r328806, preventing boot on many platforms. r328911: Ignore relocation tables for non-memory-resident sections. r328986: Fix relative location of USB sources after recent move. r328987: A more definitions to kernel emulation shim in order to build stand/usb. r328990: Move the stand/usb test loader into its own directory. r328999: Fix indentation to FreeBSD standard for interp files r329000: Move simple interpreter 'perform' into interp.c and call it r329019: Move to tabs for indentation and to 8-space notches, per style(9). r329050: Fix build of userboot.so r329054: Set script.lang in the environment to either 'forth' or 'simple' to reflect what scripting language was compiled into the loader. r329060: loader: fix endianness conversion PR: 225323 Added: stable/11/stand/common/interp_simple.c - copied, changed from r328642, head/stand/common/interp_simple.c stable/11/stand/libsa/libsa.3 - copied, changed from r329182, stable/11/stand/libsa/libstand.3 stable/11/stand/usb/test/ - copied from r328990, head/stand/usb/test/ Deleted: stable/11/stand/efi/loader/arch/i386/bootinfo.c stable/11/stand/forth/pcibios.4th stable/11/stand/forth/pnp.4th stable/11/stand/libsa/libstand.3 stable/11/stand/usb/Makefile.test stable/11/stand/usb/bsd_usbloader_test.c Modified: stable/11/ObsoleteFiles.inc stable/11/stand/arm/uboot/Makefile stable/11/stand/arm/uboot/ldscript.arm stable/11/stand/common/boot.c stable/11/stand/common/bootstrap.h stable/11/stand/common/commands.c stable/11/stand/common/install.c stable/11/stand/common/interp.c stable/11/stand/common/interp_backslash.c stable/11/stand/common/interp_forth.c stable/11/stand/common/interp_parse.c stable/11/stand/common/load_elf.c stable/11/stand/common/load_elf_obj.c stable/11/stand/common/misc.c stable/11/stand/common/pnp.c stable/11/stand/defs.mk stable/11/stand/efi/boot1/Makefile stable/11/stand/efi/boot1/boot1.c stable/11/stand/efi/fdt/Makefile stable/11/stand/efi/include/efi.h stable/11/stand/efi/include/efiapi.h stable/11/stand/efi/libefi/Makefile stable/11/stand/efi/libefi/efichar.c stable/11/stand/efi/libefi/env.c stable/11/stand/efi/loader/Makefile stable/11/stand/efi/loader/arch/arm/ldscript.arm stable/11/stand/efi/loader/main.c stable/11/stand/fdt/Makefile stable/11/stand/ficl.mk stable/11/stand/ficl/Makefile stable/11/stand/forth/Makefile stable/11/stand/forth/loader.4th stable/11/stand/geli/Makefile stable/11/stand/i386/boot0/Makefile stable/11/stand/i386/btx/btx/Makefile stable/11/stand/i386/btx/btxldr/Makefile stable/11/stand/i386/btx/lib/Makefile stable/11/stand/i386/cdboot/Makefile stable/11/stand/i386/kgzldr/Makefile stable/11/stand/i386/libfirewire/Makefile stable/11/stand/i386/libfirewire/firewire.c stable/11/stand/i386/libi386/Makefile stable/11/stand/i386/libi386/biospci.c stable/11/stand/i386/libi386/comconsole.c stable/11/stand/i386/libi386/libi386.h stable/11/stand/i386/loader/Makefile stable/11/stand/i386/mbr/Makefile stable/11/stand/i386/pmbr/Makefile stable/11/stand/kshim/bsd_kernel.h stable/11/stand/libsa/Makefile stable/11/stand/libsa/environment.c stable/11/stand/libsa/stand.h stable/11/stand/loader.mk stable/11/stand/mips/beri/boot2/Makefile stable/11/stand/mips/beri/boot2/boot2.c stable/11/stand/mips/beri/loader/Makefile stable/11/stand/mips/beri/loader/exec.c stable/11/stand/mips/uboot/Makefile stable/11/stand/ofw/common/main.c stable/11/stand/ofw/libofw/Makefile stable/11/stand/ofw/libofw/elf_freebsd.c stable/11/stand/ofw/libofw/libofw.h stable/11/stand/ofw/libofw/ofw_copy.c stable/11/stand/ofw/libofw/ofw_memory.c stable/11/stand/ofw/libofw/ppc64_elf_freebsd.c stable/11/stand/powerpc/boot1.chrp/Makefile stable/11/stand/powerpc/kboot/Makefile stable/11/stand/powerpc/kboot/conf.c stable/11/stand/powerpc/kboot/host_syscall.S stable/11/stand/powerpc/kboot/host_syscall.h stable/11/stand/powerpc/kboot/hostdisk.c stable/11/stand/powerpc/kboot/kerneltramp.S stable/11/stand/powerpc/kboot/main.c stable/11/stand/powerpc/kboot/metadata.c stable/11/stand/powerpc/kboot/ppc64_elf_freebsd.c stable/11/stand/powerpc/ofw/Makefile stable/11/stand/powerpc/ofw/ldscript.powerpc stable/11/stand/powerpc/uboot/Makefile stable/11/stand/sparc64/boot1/Makefile stable/11/stand/sparc64/loader/Makefile stable/11/stand/uboot/fdt/Makefile stable/11/stand/uboot/lib/Makefile stable/11/stand/usb/usbcore.mk stable/11/stand/userboot/test/Makefile stable/11/stand/userboot/userboot/Makefile stable/11/stand/zfs/Makefile stable/11/sys/kern/link_elf_obj.c Directory Properties: stable/11/ (props changed) Modified: stable/11/ObsoleteFiles.inc ============================================================================== --- stable/11/ObsoleteFiles.inc Mon Feb 12 19:50:43 2018 (r329182) +++ stable/11/ObsoleteFiles.inc Mon Feb 12 20:51:28 2018 (r329183) @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20180212: Obsolete forth files +OLD_FILES+=boot/efi.4th +OLD_FILES+=boot/pcibios.4th # 20180212: Remove libstand OLD_FILES+=usr/lib/libstand.a OLD_FILES+=usr/lib/libstand_p.a Modified: stable/11/stand/arm/uboot/Makefile ============================================================================== --- stable/11/stand/arm/uboot/Makefile Mon Feb 12 19:50:43 2018 (r329182) +++ stable/11/stand/arm/uboot/Makefile Mon Feb 12 20:51:28 2018 (r329183) @@ -41,8 +41,8 @@ LDFLAGS+= -Wl,-znotext CFLAGS+= -fPIC -DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} -LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} +DPADD= ${LDR_INTERP} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} +LDADD= ${LDR_INTERP} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} OBJS+= ${SRCS:N*.h:R:S/$/.o/g} Modified: stable/11/stand/arm/uboot/ldscript.arm ============================================================================== --- stable/11/stand/arm/uboot/ldscript.arm Mon Feb 12 19:50:43 2018 (r329182) +++ stable/11/stand/arm/uboot/ldscript.arm Mon Feb 12 20:51:28 2018 (r329183) @@ -32,6 +32,11 @@ SECTIONS .rela.got : { *(.rela.got) } .rela.got1 : { *(.rela.got1) } .rela.got2 : { *(.rela.got2) } + .dynamic : { *(.dynamic) } + PROVIDE (_GOT_START_ = .); + .got : { *(.got) } + .got.plt : { *(.got.plt) } + PROVIDE (_GOT_END_ = .); .rela.ctors : { *(.rela.ctors) } .rela.dtors : { *(.rela.dtors) } .rela.init : { *(.rela.init) } @@ -58,7 +63,6 @@ SECTIONS } .data1 : { *(.data1) } .got1 : { *(.got1) } - .dynamic : { *(.dynamic) } /* Put .ctors and .dtors next to the .got2 section, so that the pointers get relocated with -mrelocatable. Also put in the .fixup pointers. The current compiler no longer needs this, but keep it around for 2.7.2 */ @@ -74,10 +78,6 @@ SECTIONS .fixup : { *(.fixup) } PROVIDE (_FIXUP_END_ = .); PROVIDE (_GOT2_END_ = .); - PROVIDE (_GOT_START_ = .); - .got : { *(.got) } - .got.plt : { *(.got.plt) } - PROVIDE (_GOT_END_ = .); /* We want the small data sections together, so single-instruction offsets can access them all, and initialized data all before uninitialized, so we can shorten the on-disk segment size. */ Modified: stable/11/stand/common/boot.c ============================================================================== --- stable/11/stand/common/boot.c Mon Feb 12 19:50:43 2018 (r329182) +++ stable/11/stand/common/boot.c Mon Feb 12 20:51:28 2018 (r329183) @@ -52,60 +52,60 @@ COMMAND_SET(boot, "boot", "boot a file or loaded kerne static int command_boot(int argc, char *argv[]) { - struct preloaded_file *fp; + struct preloaded_file *fp; - /* - * See if the user has specified an explicit kernel to boot. - */ - if ((argc > 1) && (argv[1][0] != '-')) { + /* + * See if the user has specified an explicit kernel to boot. + */ + if ((argc > 1) && (argv[1][0] != '-')) { - /* XXX maybe we should discard everything and start again? */ - if (file_findfile(NULL, NULL) != NULL) { - snprintf(command_errbuf, sizeof(command_errbuf), - "can't boot '%s', kernel module already loaded", argv[1]); - return(CMD_ERROR); + /* XXX maybe we should discard everything and start again? */ + if (file_findfile(NULL, NULL) != NULL) { + snprintf(command_errbuf, sizeof(command_errbuf), + "can't boot '%s', kernel module already loaded", argv[1]); + return(CMD_ERROR); + } + + /* find/load the kernel module */ + if (mod_loadkld(argv[1], argc - 2, argv + 2) != 0) + return(CMD_ERROR); + /* we have consumed all arguments */ + argc = 1; } - /* find/load the kernel module */ - if (mod_loadkld(argv[1], argc - 2, argv + 2) != 0) - return(CMD_ERROR); - /* we have consumed all arguments */ - argc = 1; - } + /* + * See if there is a kernel module already loaded + */ + if (file_findfile(NULL, NULL) == NULL) + if (loadakernel(0, argc - 1, argv + 1)) + /* we have consumed all arguments */ + argc = 1; - /* - * See if there is a kernel module already loaded - */ - if (file_findfile(NULL, NULL) == NULL) - if (loadakernel(0, argc - 1, argv + 1)) - /* we have consumed all arguments */ - argc = 1; + /* + * Loaded anything yet? + */ + if ((fp = file_findfile(NULL, NULL)) == NULL) { + command_errmsg = "no bootable kernel"; + return(CMD_ERROR); + } - /* - * Loaded anything yet? - */ - if ((fp = file_findfile(NULL, NULL)) == NULL) { - command_errmsg = "no bootable kernel"; - return(CMD_ERROR); - } + /* + * If we were given arguments, discard any previous. + * XXX should we merge arguments? Hard to DWIM. + */ + if (argc > 1) { + if (fp->f_args != NULL) + free(fp->f_args); + fp->f_args = unargv(argc - 1, argv + 1); + } - /* - * If we were given arguments, discard any previous. - * XXX should we merge arguments? Hard to DWIM. - */ - if (argc > 1) { - if (fp->f_args != NULL) - free(fp->f_args); - fp->f_args = unargv(argc - 1, argv + 1); - } + /* Hook for platform-specific autoloading of modules */ + if (archsw.arch_autoload() != 0) + return(CMD_ERROR); - /* Hook for platform-specific autoloading of modules */ - if (archsw.arch_autoload() != 0) + /* Call the exec handler from the loader matching the kernel */ + file_formats[fp->f_loader]->l_exec(fp); return(CMD_ERROR); - - /* Call the exec handler from the loader matching the kernel */ - file_formats[fp->f_loader]->l_exec(fp); - return(CMD_ERROR); } @@ -118,29 +118,29 @@ COMMAND_SET(autoboot, "autoboot", "boot automatically static int command_autoboot(int argc, char *argv[]) { - int howlong; - char *cp, *prompt; + int howlong; + char *cp, *prompt; - prompt = NULL; - howlong = -1; - switch(argc) { - case 3: - prompt = argv[2]; - /* FALLTHROUGH */ - case 2: - howlong = strtol(argv[1], &cp, 0); - if (*cp != 0) { - snprintf(command_errbuf, sizeof(command_errbuf), - "bad delay '%s'", argv[1]); - return(CMD_ERROR); + prompt = NULL; + howlong = -1; + switch(argc) { + case 3: + prompt = argv[2]; + /* FALLTHROUGH */ + case 2: + howlong = strtol(argv[1], &cp, 0); + if (*cp != 0) { + snprintf(command_errbuf, sizeof(command_errbuf), + "bad delay '%s'", argv[1]); + return(CMD_ERROR); + } + /* FALLTHROUGH */ + case 1: + return(autoboot(howlong, prompt)); } - /* FALLTHROUGH */ - case 1: - return(autoboot(howlong, prompt)); - } - command_errmsg = "too many arguments"; - return(CMD_ERROR); + command_errmsg = "too many arguments"; + return(CMD_ERROR); } /* @@ -150,103 +150,103 @@ command_autoboot(int argc, char *argv[]) void autoboot_maybe() { - char *cp; + char *cp; - cp = getenv("autoboot_delay"); - if ((autoboot_tried == 0) && ((cp == NULL) || strcasecmp(cp, "NO"))) - autoboot(-1, NULL); /* try to boot automatically */ + cp = getenv("autoboot_delay"); + if ((autoboot_tried == 0) && ((cp == NULL) || strcasecmp(cp, "NO"))) + autoboot(-1, NULL); /* try to boot automatically */ } int autoboot(int timeout, char *prompt) { - time_t when, otime, ntime; - int c, yes; - char *argv[2], *cp, *ep; - char *kernelname; + time_t when, otime, ntime; + int c, yes; + char *argv[2], *cp, *ep; + char *kernelname; #ifdef BOOT_PROMPT_123 - const char *seq = "123", *p = seq; + const char *seq = "123", *p = seq; #endif - autoboot_tried = 1; + autoboot_tried = 1; - if (timeout == -1) { - timeout = 10; - /* try to get a delay from the environment */ - if ((cp = getenv("autoboot_delay"))) { - timeout = strtol(cp, &ep, 0); - if (cp == ep) - timeout = 10; /* Unparseable? Set default! */ + if (timeout == -1) { + timeout = 10; + /* try to get a delay from the environment */ + if ((cp = getenv("autoboot_delay"))) { + timeout = strtol(cp, &ep, 0); + if (cp == ep) + timeout = 10; /* Unparseable? Set default! */ + } } - } - kernelname = getenv("kernelname"); - if (kernelname == NULL) { - argv[0] = NULL; - loadakernel(0, 0, argv); kernelname = getenv("kernelname"); if (kernelname == NULL) { - command_errmsg = "no valid kernel found"; - return(CMD_ERROR); + argv[0] = NULL; + loadakernel(0, 0, argv); + kernelname = getenv("kernelname"); + if (kernelname == NULL) { + command_errmsg = "no valid kernel found"; + return(CMD_ERROR); + } } - } - if (timeout >= 0) { - otime = time(NULL); - when = otime + timeout; /* when to boot */ + if (timeout >= 0) { + otime = time(NULL); + when = otime + timeout; /* when to boot */ - yes = 0; + yes = 0; #ifdef BOOT_PROMPT_123 - printf("%s\n", (prompt == NULL) ? "Hit [Enter] to boot immediately, or " - "1 2 3 sequence for command prompt." : prompt); + printf("%s\n", (prompt == NULL) ? "Hit [Enter] to boot immediately, or " + "1 2 3 sequence for command prompt." : prompt); #else - printf("%s\n", (prompt == NULL) ? "Hit [Enter] to boot immediately, or any other key for command prompt." : prompt); + printf("%s\n", (prompt == NULL) ? "Hit [Enter] to boot immediately, or any other key for command prompt." : prompt); #endif - for (;;) { - if (ischar()) { - c = getchar(); + for (;;) { + if (ischar()) { + c = getchar(); #ifdef BOOT_PROMPT_123 - if ((c == '\r') || (c == '\n')) { - yes = 1; - break; - } else if (c != *p++) - p = seq; - if (*p == 0) - break; + if ((c == '\r') || (c == '\n')) { + yes = 1; + break; + } else if (c != *p++) + p = seq; + if (*p == 0) + break; #else - if ((c == '\r') || (c == '\n')) - yes = 1; - break; + if ((c == '\r') || (c == '\n')) + yes = 1; + break; #endif - } - ntime = time(NULL); - if (ntime >= when) { - yes = 1; - break; - } + } + ntime = time(NULL); + if (ntime >= when) { + yes = 1; + break; + } - if (ntime != otime) { - printf("\rBooting [%s] in %d second%s... ", - kernelname, (int)(when - ntime), - (when-ntime)==1?"":"s"); - otime = ntime; - } - } - } else { - yes = 1; - } + if (ntime != otime) { + printf("\rBooting [%s] in %d second%s... ", + kernelname, (int)(when - ntime), + (when-ntime)==1?"":"s"); + otime = ntime; + } + } + } else { + yes = 1; + } - if (yes) - printf("\rBooting [%s]... ", kernelname); - putchar('\n'); - if (yes) { - argv[0] = "boot"; - argv[1] = NULL; - return(command_boot(1, argv)); - } - return(CMD_OK); + if (yes) + printf("\rBooting [%s]... ", kernelname); + putchar('\n'); + if (yes) { + argv[0] = "boot"; + argv[1] = NULL; + return(command_boot(1, argv)); + } + return(CMD_OK); } /* @@ -255,43 +255,43 @@ autoboot(int timeout, char *prompt) static char * getbootfile(int try) { - static char *name = NULL; - const char *spec, *ep; - size_t len; + static char *name = NULL; + const char *spec, *ep; + size_t len; - /* we use dynamic storage */ - if (name != NULL) { - free(name); - name = NULL; - } + /* we use dynamic storage */ + if (name != NULL) { + free(name); + name = NULL; + } - /* - * Try $bootfile, then try our builtin default - */ - if ((spec = getenv("bootfile")) == NULL) - spec = default_bootfiles; + /* + * Try $bootfile, then try our builtin default + */ + if ((spec = getenv("bootfile")) == NULL) + spec = default_bootfiles; - while ((try > 0) && (spec != NULL)) { - spec = strchr(spec, ';'); - if (spec) - spec++; /* skip over the leading ';' */ - try--; - } - if (spec != NULL) { - if ((ep = strchr(spec, ';')) != NULL) { - len = ep - spec; - } else { - len = strlen(spec); + while ((try > 0) && (spec != NULL)) { + spec = strchr(spec, ';'); + if (spec) + spec++; /* skip over the leading ';' */ + try--; } - name = malloc(len + 1); - strncpy(name, spec, len); - name[len] = 0; - } - if (name && name[0] == 0) { - free(name); - name = NULL; - } - return(name); + if (spec != NULL) { + if ((ep = strchr(spec, ';')) != NULL) { + len = ep - spec; + } else { + len = strlen(spec); + } + name = malloc(len + 1); + strncpy(name, spec, len); + name[len] = 0; + } + if (name && name[0] == 0) { + free(name); + name = NULL; + } + return(name); } /* @@ -307,104 +307,109 @@ getbootfile(int try) int getrootmount(char *rootdev) { - char lbuf[128], *cp, *ep, *dev, *fstyp, *options; - int fd, error; + char lbuf[128], *cp, *ep, *dev, *fstyp, *options; + int fd, error; - if (getenv("vfs.root.mountfrom") != NULL) - return(0); + if (getenv("vfs.root.mountfrom") != NULL) + return(0); - error = 1; - sprintf(lbuf, "%s/etc/fstab", rootdev); - if ((fd = open(lbuf, O_RDONLY)) < 0) - goto notfound; + error = 1; + sprintf(lbuf, "%s/etc/fstab", rootdev); + if ((fd = open(lbuf, O_RDONLY)) < 0) + goto notfound; - /* loop reading lines from /etc/fstab What was that about sscanf again? */ - while (fgetstr(lbuf, sizeof(lbuf), fd) >= 0) { - if ((lbuf[0] == 0) || (lbuf[0] == '#')) - continue; + /* loop reading lines from /etc/fstab What was that about sscanf again? */ + fstyp = NULL; + dev = NULL; + while (fgetstr(lbuf, sizeof(lbuf), fd) >= 0) { + if ((lbuf[0] == 0) || (lbuf[0] == '#')) + continue; - /* skip device name */ - for (cp = lbuf; (*cp != 0) && !isspace(*cp); cp++) - ; - if (*cp == 0) /* misformatted */ - continue; - /* delimit and save */ - *cp++ = 0; - dev = strdup(lbuf); + /* skip device name */ + for (cp = lbuf; (*cp != 0) && !isspace(*cp); cp++) + ; + if (*cp == 0) /* misformatted */ + continue; + /* delimit and save */ + *cp++ = 0; + free(dev); + dev = strdup(lbuf); - /* skip whitespace up to mountpoint */ - while ((*cp != 0) && isspace(*cp)) - cp++; - /* must have / to be root */ - if ((*cp == 0) || (*cp != '/') || !isspace(*(cp + 1))) - continue; - /* skip whitespace up to fstype */ - cp += 2; - while ((*cp != 0) && isspace(*cp)) - cp++; - if (*cp == 0) /* misformatted */ - continue; - /* skip text to end of fstype and delimit */ - ep = cp; - while ((*cp != 0) && !isspace(*cp)) - cp++; - *cp = 0; - fstyp = strdup(ep); + /* skip whitespace up to mountpoint */ + while ((*cp != 0) && isspace(*cp)) + cp++; + /* must have / to be root */ + if ((*cp == 0) || (*cp != '/') || !isspace(*(cp + 1))) + continue; + /* skip whitespace up to fstype */ + cp += 2; + while ((*cp != 0) && isspace(*cp)) + cp++; + if (*cp == 0) /* misformatted */ + continue; + /* skip text to end of fstype and delimit */ + ep = cp; + while ((*cp != 0) && !isspace(*cp)) + cp++; + *cp = 0; + free(fstyp); + fstyp = strdup(ep); - /* skip whitespace up to mount options */ - cp += 1; - while ((*cp != 0) && isspace(*cp)) - cp++; - if (*cp == 0) /* misformatted */ - continue; - /* skip text to end of mount options and delimit */ - ep = cp; - while ((*cp != 0) && !isspace(*cp)) - cp++; - *cp = 0; - options = strdup(ep); - /* Build the : and save it in vfs.root.mountfrom */ - sprintf(lbuf, "%s:%s", fstyp, dev); + /* skip whitespace up to mount options */ + cp += 1; + while ((*cp != 0) && isspace(*cp)) + cp++; + if (*cp == 0) /* misformatted */ + continue; + /* skip text to end of mount options and delimit */ + ep = cp; + while ((*cp != 0) && !isspace(*cp)) + cp++; + *cp = 0; + options = strdup(ep); + /* Build the : and save it in vfs.root.mountfrom */ + sprintf(lbuf, "%s:%s", fstyp, dev); + setenv("vfs.root.mountfrom", lbuf, 0); + + /* Don't override vfs.root.mountfrom.options if it is already set */ + if (getenv("vfs.root.mountfrom.options") == NULL) { + /* save mount options */ + setenv("vfs.root.mountfrom.options", options, 0); + } + free(options); + error = 0; + break; + } + close(fd); free(dev); free(fstyp); - setenv("vfs.root.mountfrom", lbuf, 0); - /* Don't override vfs.root.mountfrom.options if it is already set */ - if (getenv("vfs.root.mountfrom.options") == NULL) { - /* save mount options */ - setenv("vfs.root.mountfrom.options", options, 0); - } - free(options); - error = 0; - break; - } - close(fd); - notfound: - if (error) { - const char *currdev; + if (error) { + const char *currdev; - currdev = getenv("currdev"); - if (currdev != NULL && strncmp("zfs:", currdev, 4) == 0) { - cp = strdup(currdev); - cp[strlen(cp) - 1] = '\0'; - setenv("vfs.root.mountfrom", cp, 0); - error = 0; + currdev = getenv("currdev"); + if (currdev != NULL && strncmp("zfs:", currdev, 4) == 0) { + cp = strdup(currdev); + cp[strlen(cp) - 1] = '\0'; + setenv("vfs.root.mountfrom", cp, 0); + error = 0; + free(cp); + } } - } - return(error); + return(error); } static int loadakernel(int try, int argc, char* argv[]) { - char *cp; + char *cp; for (try = 0; (cp = getbootfile(try)) != NULL; try++) - if (mod_loadkld(cp, argc - 1, argv + 1) != 0) - printf("can't load '%s'\n", cp); - else - return 1; + if (mod_loadkld(cp, argc - 1, argv + 1) != 0) + printf("can't load '%s'\n", cp); + else + return 1; return 0; } Modified: stable/11/stand/common/bootstrap.h ============================================================================== --- stable/11/stand/common/bootstrap.h Mon Feb 12 19:50:43 2018 (r329182) +++ stable/11/stand/common/bootstrap.h Mon Feb 12 20:51:28 2018 (r329183) @@ -46,18 +46,20 @@ extern char command_errbuf[COMMAND_ERRBUFSZ]; /* interp.c */ void interact(void); -int include(const char *filename); +void interp_emit_prompt(void); +int interp_builtin_cmd(int argc, char *argv[]); +/* Called by interp.c for interp_*.c embedded interpreters */ +int interp_include(const char *filename); /* Execute commands from filename */ +void interp_init(void); /* Initialize interpreater */ +int interp_run(const char *line); /* Run a single command */ + /* interp_backslash.c */ char *backslash(const char *str); /* interp_parse.c */ int parse(int *argc, char ***argv, const char *str); -/* interp_forth.c */ -void bf_init(void); -int bf_run(char *line); - /* boot.c */ int autoboot(int timeout, char *prompt); void autoboot_maybe(void); @@ -315,6 +317,9 @@ struct arch_switch /* Probe ZFS pool(s), if needed. */ void (*arch_zfs_probe)(void); + + /* For kexec-type loaders, get ksegment structure */ + void (*arch_kexec_kseg_get)(int *nseg, void **kseg); }; extern struct arch_switch archsw; Modified: stable/11/stand/common/commands.c ============================================================================== --- stable/11/stand/common/commands.c Mon Feb 12 19:50:43 2018 (r329182) +++ stable/11/stand/common/commands.c Mon Feb 12 20:51:28 2018 (r329183) @@ -91,10 +91,8 @@ help_getnext(int fd, char **topic, char **subtopic, ch cp = ep; } if (*topic == NULL) { - if (*subtopic != NULL) - free(*subtopic); - if (*desc != NULL) - free(*desc); + free(*subtopic); + free(*desc); continue; } return(1); @@ -169,7 +167,7 @@ command_help(int argc, char *argv[]) } else if (strcmp(topic, t)) { /* topic mismatch */ - if(matched) /* nothing more on this topic, stop scanning */ + if (matched) /* nothing more on this topic, stop scanning */ break; } else { @@ -178,7 +176,7 @@ command_help(int argc, char *argv[]) if (((subtopic == NULL) && (s == NULL)) || ((subtopic != NULL) && (s != NULL) && !strcmp(subtopic, s))) { /* exact match, print text */ - while((fgetstr(buf, 80, hfd) >= 0) && (buf[0] != '#')) { + while ((fgetstr(buf, 80, hfd) >= 0) && (buf[0] != '#')) { if (pager_output(buf)) break; if (pager_output("\n")) @@ -193,23 +191,24 @@ command_help(int argc, char *argv[]) free(t); free(s); free(d); + t = s = d = NULL; } + free(t); + free(s); + free(d); pager_close(); close(hfd); if (!matched) { snprintf(command_errbuf, sizeof(command_errbuf), "no help available for '%s'", topic); free(topic); - if (subtopic) - free(subtopic); + free(subtopic); return(CMD_ERROR); } free(topic); - if (subtopic) - free(subtopic); + free(subtopic); return(CMD_OK); } - COMMAND_SET(commandlist, "?", "list commands", command_commandlist); Modified: stable/11/stand/common/install.c ============================================================================== --- stable/11/stand/common/install.c Mon Feb 12 19:50:43 2018 (r329182) +++ stable/11/stand/common/install.c Mon Feb 12 20:51:28 2018 (r329183) @@ -286,7 +286,7 @@ install(char *pkgname) fd = open(s, O_RDONLY); if (fd != -1) { close(fd); - error = include(s); + error = inter_include(s); if (error == CMD_ERROR) goto fail; } Modified: stable/11/stand/common/interp.c ============================================================================== --- stable/11/stand/common/interp.c Mon Feb 12 19:50:43 2018 (r329182) +++ stable/11/stand/common/interp.c Mon Feb 12 20:51:28 2018 (r329183) @@ -37,102 +37,40 @@ __FBSDID("$FreeBSD$"); #include #include "bootstrap.h" -#ifdef BOOT_FORTH -#include "ficl.h" -extern FICL_VM *bf_vm; -#endif - #define MAXARGS 20 /* maximum number of arguments allowed */ -static void prompt(void); - -#ifndef BOOT_FORTH /* - * Perform the command - */ -static int -perform(int argc, char *argv[]) -{ - int result; - struct bootblk_command **cmdp; - bootblk_cmd_t *cmd; - - if (argc < 1) - return(CMD_OK); - - /* set return defaults; a successful command will override these */ - command_errmsg = command_errbuf; - strcpy(command_errbuf, "no error message"); - cmd = NULL; - result = CMD_ERROR; - - /* search the command set for the command */ - SET_FOREACH(cmdp, Xcommand_set) { - if (((*cmdp)->c_name != NULL) && !strcmp(argv[0], (*cmdp)->c_name)) - cmd = (*cmdp)->c_fn; - } - if (cmd != NULL) { - result = (cmd)(argc, argv); - } else { - command_errmsg = "unknown command"; - } - return(result); -} -#endif /* ! BOOT_FORTH */ - -/* * Interactive mode */ void interact(void) { - static char input[256]; /* big enough? */ -#ifndef BOOT_FORTH - int argc; - char **argv; -#endif + static char input[256]; /* big enough? */ -#ifdef BOOT_FORTH - bf_init(); -#endif + interp_init(); - /* Read our default configuration. */ - include("/boot/loader.rc"); + printf("\n"); - printf("\n"); + /* + * Before interacting, we might want to autoboot. + */ + autoboot_maybe(); - /* - * Before interacting, we might want to autoboot. - */ - autoboot_maybe(); - - /* - * Not autobooting, go manual - */ - printf("\nType '?' for a list of commands, 'help' for more detailed help.\n"); - if (getenv("prompt") == NULL) - setenv("prompt", "${interpret}", 1); - if (getenv("interpret") == NULL) - setenv("interpret", "OK", 1); - + /* + * Not autobooting, go manual + */ + printf("\nType '?' for a list of commands, 'help' for more detailed help.\n"); + if (getenv("prompt") == NULL) + setenv("prompt", "${interpret}", 1); + if (getenv("interpret") == NULL) + setenv("interpret", "OK", 1); - for (;;) { - input[0] = '\0'; - prompt(); - ngets(input, sizeof(input)); -#ifdef BOOT_FORTH - bf_vm->sourceID.i = 0; - bf_run(input); -#else - if (!parse(&argc, &argv, input)) { - if (perform(argc, argv)) - printf("%s: %s\n", argv[0], command_errmsg); - free(argv); - } else { - printf("parse error\n"); + for (;;) { + input[0] = '\0'; + interp_emit_prompt(); + ngets(input, sizeof(input)); + interp_run(input); } -#endif - } } /* @@ -149,214 +87,87 @@ COMMAND_SET(include, "include", "read commands from a static int command_include(int argc, char *argv[]) { - int i; - int res; - char **argvbuf; + int i; + int res; + char **argvbuf; - /* - * Since argv is static, we need to save it here. - */ - argvbuf = (char**) calloc((u_int)argc, sizeof(char*)); - for (i = 0; i < argc; i++) - argvbuf[i] = strdup(argv[i]); + /* + * Since argv is static, we need to save it here. + */ + argvbuf = (char**) calloc((u_int)argc, sizeof(char*)); + for (i = 0; i < argc; i++) + argvbuf[i] = strdup(argv[i]); - res=CMD_OK; - for (i = 1; (i < argc) && (res == CMD_OK); i++) - res = include(argvbuf[i]); + res=CMD_OK; + for (i = 1; (i < argc) && (res == CMD_OK); i++) + res = interp_include(argvbuf[i]); - for (i = 0; i < argc; i++) - free(argvbuf[i]); - free(argvbuf); + for (i = 0; i < argc; i++) + free(argvbuf[i]); + free(argvbuf); - return(res); + return(res); } /* - * Header prepended to each line. The text immediately follows the header. - * We try to make this short in order to save memory -- the loader has - * limited memory available, and some of the forth files are very long. + * Emit the current prompt; use the same syntax as the parser + * for embedding environment variables. Does not accept input. */ -struct includeline +void +interp_emit_prompt(void) { - struct includeline *next; -#ifndef BOOT_FORTH - int flags; - int line; -#define SL_QUIET (1<<0) -#define SL_IGNOREERR (1<<1) -#endif - char text[0]; -}; + char *pr, *p, *cp, *ev; -int -include(const char *filename) -{ - struct includeline *script, *se, *sp; - char input[256]; /* big enough? */ -#ifdef BOOT_FORTH - int res; - char *cp; - int prevsrcid, fd, line; -#else - int argc,res; - char **argv, *cp; - int fd, flags, line; -#endif + if ((cp = getenv("prompt")) == NULL) + cp = ">"; + pr = p = strdup(cp); - if (((fd = open(filename, O_RDONLY)) == -1)) { - snprintf(command_errbuf, sizeof(command_errbuf), - "can't open '%s': %s", filename, strerror(errno)); - return(CMD_ERROR); - } + while (*p != 0) { + if ((*p == '$') && (*(p+1) == '{')) { + for (cp = p + 2; (*cp != 0) && (*cp != '}'); cp++) + ; + *cp = 0; + ev = getenv(p + 2); - /* - * Read the script into memory. - */ - script = se = NULL; - line = 0; - - while (fgetstr(input, sizeof(input), fd) >= 0) { - line++; -#ifdef BOOT_FORTH - cp = input; -#else - flags = 0; - /* Discard comments */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Tue Feb 13 02:11:41 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14A24F12B62; Tue, 13 Feb 2018 02:11:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BBD1A7C793; Tue, 13 Feb 2018 02:11:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E2281A677; Tue, 13 Feb 2018 02:11:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1D2BeZi031290; Tue, 13 Feb 2018 02:11:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1D2BdXX031284; Tue, 13 Feb 2018 02:11:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802130211.w1D2BdXX031284@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 13 Feb 2018 02:11:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329189 - in stable/11/sys/dev: mpr mps X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/dev: mpr mps X-SVN-Commit-Revision: 329189 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 02:11:41 -0000 Author: mav Date: Tue Feb 13 02:11:39 2018 New Revision: 329189 URL: https://svnweb.freebsd.org/changeset/base/329189 Log: MFC r328937: Fix queue length reporting in mps(4) and mpr(4). Both drivers were found to report CAM bigger queue depth then they really can handle. It made them later under high load with many disks return some of submitted requests back with CAM_REQUEUE_REQ status for later resubmission. Modified: stable/11/sys/dev/mpr/mpr.c stable/11/sys/dev/mpr/mpr_sas.c stable/11/sys/dev/mpr/mprvar.h stable/11/sys/dev/mps/mps.c stable/11/sys/dev/mps/mps_sas.c stable/11/sys/dev/mps/mpsvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mpr/mpr.c ============================================================================== --- stable/11/sys/dev/mpr/mpr.c Mon Feb 12 23:53:38 2018 (r329188) +++ stable/11/sys/dev/mpr/mpr.c Tue Feb 13 02:11:39 2018 (r329189) @@ -503,7 +503,10 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at * Size the queues. Since the reply queues always need one free * entry, we'll just deduct one reply message here. */ - sc->num_reqs = MIN(MPR_REQ_FRAMES, sc->facts->RequestCredit); + sc->num_prireqs = MIN(MPR_PRI_REQ_FRAMES, + sc->facts->HighPriorityCredit); + sc->num_reqs = MIN(MPR_REQ_FRAMES, sc->facts->RequestCredit) + + sc->num_prireqs; sc->num_replies = MIN(MPR_REPLY_FRAMES + MPR_EVT_REPLY_FRAMES, sc->facts->MaxReplyDescriptorPostQueueDepth) - 1; @@ -1362,7 +1365,7 @@ mpr_alloc_requests(struct mpr_softc *sc) /* XXX Is a failure here a critical problem? */ if (bus_dmamap_create(sc->buffer_dmat, 0, &cm->cm_dmamap) == 0) { - if (i <= sc->facts->HighPriorityCredit) + if (i <= sc->num_prireqs) mpr_free_high_priority_command(sc, cm); else mpr_free_command(sc, cm); Modified: stable/11/sys/dev/mpr/mpr_sas.c ============================================================================== --- stable/11/sys/dev/mpr/mpr_sas.c Mon Feb 12 23:53:38 2018 (r329188) +++ stable/11/sys/dev/mpr/mpr_sas.c Tue Feb 13 02:11:39 2018 (r329189) @@ -728,7 +728,7 @@ mpr_attach_sas(struct mpr_softc *sc) { struct mprsas_softc *sassc; cam_status status; - int unit, error = 0; + int unit, error = 0, reqs; MPR_FUNCTRACE(sc); @@ -757,7 +757,8 @@ mpr_attach_sas(struct mpr_softc *sc) sc->sassc = sassc; sassc->sc = sc; - if ((sassc->devq = cam_simq_alloc(sc->num_reqs)) == NULL) { + reqs = sc->num_reqs - sc->num_prireqs - 1; + if ((sassc->devq = cam_simq_alloc(reqs)) == NULL) { mpr_dprint(sc, MPR_ERROR, "Cannot allocate SIMQ\n"); error = ENOMEM; goto out; @@ -765,7 +766,7 @@ mpr_attach_sas(struct mpr_softc *sc) unit = device_get_unit(sc->mpr_dev); sassc->sim = cam_sim_alloc(mprsas_action, mprsas_poll, "mpr", sassc, - unit, &sc->mpr_mtx, sc->num_reqs, sc->num_reqs, sassc->devq); + unit, &sc->mpr_mtx, reqs, reqs, sassc->devq); if (sassc->sim == NULL) { mpr_dprint(sc, MPR_ERROR, "Cannot allocate SIM\n"); error = EINVAL; Modified: stable/11/sys/dev/mpr/mprvar.h ============================================================================== --- stable/11/sys/dev/mpr/mprvar.h Mon Feb 12 23:53:38 2018 (r329188) +++ stable/11/sys/dev/mpr/mprvar.h Tue Feb 13 02:11:39 2018 (r329189) @@ -38,6 +38,7 @@ #define MPR_DB_MAX_WAIT 2500 #define MPR_REQ_FRAMES 1024 +#define MPR_PRI_REQ_FRAMES 128 #define MPR_EVT_REPLY_FRAMES 32 #define MPR_REPLY_FRAMES MPR_REQ_FRAMES #define MPR_CHAIN_FRAMES 2048 @@ -328,6 +329,7 @@ struct mpr_softc { MPI2_IOC_FACTS_REPLY *facts; int num_reqs; + int num_prireqs; int num_replies; int fqdepth; /* Free queue */ int pqdepth; /* Post queue */ Modified: stable/11/sys/dev/mps/mps.c ============================================================================== --- stable/11/sys/dev/mps/mps.c Mon Feb 12 23:53:38 2018 (r329188) +++ stable/11/sys/dev/mps/mps.c Tue Feb 13 02:11:39 2018 (r329189) @@ -489,7 +489,10 @@ mps_iocfacts_allocate(struct mps_softc *sc, uint8_t at * Size the queues. Since the reply queues always need one free * entry, we'll just deduct one reply message here. */ - sc->num_reqs = MIN(MPS_REQ_FRAMES, sc->facts->RequestCredit); + sc->num_prireqs = MIN(MPS_PRI_REQ_FRAMES, + sc->facts->HighPriorityCredit); + sc->num_reqs = MIN(MPS_REQ_FRAMES, sc->facts->RequestCredit) + + sc->num_prireqs; sc->num_replies = MIN(MPS_REPLY_FRAMES + MPS_EVT_REPLY_FRAMES, sc->facts->MaxReplyDescriptorPostQueueDepth) - 1; @@ -1303,7 +1306,7 @@ mps_alloc_requests(struct mps_softc *sc) /* XXX Is a failure here a critical problem? */ if (bus_dmamap_create(sc->buffer_dmat, 0, &cm->cm_dmamap) == 0) - if (i <= sc->facts->HighPriorityCredit) + if (i <= sc->num_prireqs) mps_free_high_priority_command(sc, cm); else mps_free_command(sc, cm); Modified: stable/11/sys/dev/mps/mps_sas.c ============================================================================== --- stable/11/sys/dev/mps/mps_sas.c Mon Feb 12 23:53:38 2018 (r329188) +++ stable/11/sys/dev/mps/mps_sas.c Tue Feb 13 02:11:39 2018 (r329189) @@ -716,7 +716,7 @@ mps_attach_sas(struct mps_softc *sc) { struct mpssas_softc *sassc; cam_status status; - int unit, error = 0; + int unit, error = 0, reqs; MPS_FUNCTRACE(sc); @@ -745,7 +745,8 @@ mps_attach_sas(struct mps_softc *sc) sc->sassc = sassc; sassc->sc = sc; - if ((sassc->devq = cam_simq_alloc(sc->num_reqs)) == NULL) { + reqs = sc->num_reqs - sc->num_prireqs - 1; + if ((sassc->devq = cam_simq_alloc(reqs)) == NULL) { mps_dprint(sc, MPS_ERROR, "Cannot allocate SIMQ\n"); error = ENOMEM; goto out; @@ -753,7 +754,7 @@ mps_attach_sas(struct mps_softc *sc) unit = device_get_unit(sc->mps_dev); sassc->sim = cam_sim_alloc(mpssas_action, mpssas_poll, "mps", sassc, - unit, &sc->mps_mtx, sc->num_reqs, sc->num_reqs, sassc->devq); + unit, &sc->mps_mtx, reqs, reqs, sassc->devq); if (sassc->sim == NULL) { mps_dprint(sc, MPS_ERROR, "Cannot allocate SIM\n"); error = EINVAL; Modified: stable/11/sys/dev/mps/mpsvar.h ============================================================================== --- stable/11/sys/dev/mps/mpsvar.h Mon Feb 12 23:53:38 2018 (r329188) +++ stable/11/sys/dev/mps/mpsvar.h Tue Feb 13 02:11:39 2018 (r329189) @@ -38,6 +38,7 @@ #define MPS_DB_MAX_WAIT 2500 #define MPS_REQ_FRAMES 1024 +#define MPS_PRI_REQ_FRAMES 128 #define MPS_EVT_REPLY_FRAMES 32 #define MPS_REPLY_FRAMES MPS_REQ_FRAMES #define MPS_CHAIN_FRAMES 2048 @@ -314,6 +315,7 @@ struct mps_softc { MPI2_IOC_FACTS_REPLY *facts; int num_reqs; + int num_prireqs; int num_replies; int fqdepth; /* Free queue */ int pqdepth; /* Post queue */ From owner-svn-src-stable-11@freebsd.org Tue Feb 13 04:10:11 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AA8DF1CD6F; Tue, 13 Feb 2018 04:10:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 18D33820CE; Tue, 13 Feb 2018 04:10:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E60681BAD3; Tue, 13 Feb 2018 04:10:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1D4AAVa091441; Tue, 13 Feb 2018 04:10:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1D4AAZZ091439; Tue, 13 Feb 2018 04:10:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802130410.w1D4AAZZ091439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 13 Feb 2018 04:10:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329191 - in stable/11: stand/common sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: stand/common sys/kern X-SVN-Commit-Revision: 329191 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 04:10:11 -0000 Author: kevans Date: Tue Feb 13 04:10:10 2018 New Revision: 329191 URL: https://svnweb.freebsd.org/changeset/base/329191 Log: Revert MFC r328911 from r329183 jhb@ had specified an MFC timer of 1-month, and I clobbered his efforts by MFC'ing it way prematurely. Back out that part of r329183 so it may be MFC'd when jhb is ready. Modified: stable/11/stand/common/load_elf_obj.c stable/11/sys/kern/link_elf_obj.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/common/load_elf_obj.c ============================================================================== --- stable/11/stand/common/load_elf_obj.c Tue Feb 13 03:44:50 2018 (r329190) +++ stable/11/stand/common/load_elf_obj.c Tue Feb 13 04:10:10 2018 (r329191) @@ -280,8 +280,6 @@ __elfN(obj_loadimage)(struct preloaded_file *fp, elf_f switch (shdr[i].sh_type) { case SHT_REL: case SHT_RELA: - if ((shdr[shdr[i].sh_info].sh_flags & SHF_ALLOC) == 0) - break; lastaddr = roundup(lastaddr, shdr[i].sh_addralign); shdr[i].sh_addr = (Elf_Addr)lastaddr; lastaddr += shdr[i].sh_size; Modified: stable/11/sys/kern/link_elf_obj.c ============================================================================== --- stable/11/sys/kern/link_elf_obj.c Tue Feb 13 03:44:50 2018 (r329190) +++ stable/11/sys/kern/link_elf_obj.c Tue Feb 13 04:10:10 2018 (r329191) @@ -267,17 +267,9 @@ link_elf_link_preload(linker_class_t cls, const char * symstrindex = shdr[i].sh_link; break; case SHT_REL: - /* - * Ignore relocation tables for sections not - * loaded by the loader. - */ - if (shdr[shdr[i].sh_info].sh_addr == 0) - break; ef->nreltab++; break; case SHT_RELA: - if (shdr[shdr[i].sh_info].sh_addr == 0) - break; ef->nrelatab++; break; } @@ -399,16 +391,12 @@ link_elf_link_preload(linker_class_t cls, const char * pb++; break; case SHT_REL: - if (shdr[shdr[i].sh_info].sh_addr == 0) - break; ef->reltab[rl].rel = (Elf_Rel *)shdr[i].sh_addr; ef->reltab[rl].nrel = shdr[i].sh_size / sizeof(Elf_Rel); ef->reltab[rl].sec = shdr[i].sh_info; rl++; break; case SHT_RELA: - if (shdr[shdr[i].sh_info].sh_addr == 0) - break; ef->relatab[ra].rela = (Elf_Rela *)shdr[i].sh_addr; ef->relatab[ra].nrela = shdr[i].sh_size / sizeof(Elf_Rela); @@ -619,17 +607,9 @@ link_elf_load_file(linker_class_t cls, const char *fil symstrindex = shdr[i].sh_link; break; case SHT_REL: - /* - * Ignore relocation tables for unallocated - * sections. - */ - if ((shdr[shdr[i].sh_info].sh_flags & SHF_ALLOC) == 0) - break; ef->nreltab++; break; case SHT_RELA: - if ((shdr[shdr[i].sh_info].sh_flags & SHF_ALLOC) == 0) - break; ef->nrelatab++; break; case SHT_STRTAB: @@ -883,8 +863,6 @@ link_elf_load_file(linker_class_t cls, const char *fil pb++; break; case SHT_REL: - if ((shdr[shdr[i].sh_info].sh_flags & SHF_ALLOC) == 0) - break; ef->reltab[rl].rel = malloc(shdr[i].sh_size, M_LINKER, M_WAITOK); ef->reltab[rl].nrel = shdr[i].sh_size / sizeof(Elf_Rel); @@ -903,8 +881,6 @@ link_elf_load_file(linker_class_t cls, const char *fil rl++; break; case SHT_RELA: - if ((shdr[shdr[i].sh_info].sh_flags & SHF_ALLOC) == 0) - break; ef->relatab[ra].rela = malloc(shdr[i].sh_size, M_LINKER, M_WAITOK); ef->relatab[ra].nrela = From owner-svn-src-stable-11@freebsd.org Tue Feb 13 04:28:14 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A233AF1E660; Tue, 13 Feb 2018 04:28:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4AEE182BE7; Tue, 13 Feb 2018 04:28:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2AD1B1BE0D; Tue, 13 Feb 2018 04:28:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1D4SELD001617; Tue, 13 Feb 2018 04:28:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1D4SDMm001614; Tue, 13 Feb 2018 04:28:13 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802130428.w1D4SDMm001614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 13 Feb 2018 04:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329192 - in stable/11/stand: efi/loader i386/zfsboot powerpc/ofw X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand: efi/loader i386/zfsboot powerpc/ofw X-SVN-Commit-Revision: 329192 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 04:28:15 -0000 Author: kevans Date: Tue Feb 13 04:28:13 2018 New Revision: 329192 URL: https://svnweb.freebsd.org/changeset/base/329192 Log: stand: Clean up some unintentional inconsistencies This is a direct commit to stable/11 to address the following final unintended inconsistencies between stable/11 and head: - Some unused LIBSTAND= cruft left in efi/loader/Makefie - A comment that flew in with unrelated changes - An #include that may go away now that stand is basically self-contained Modified: stable/11/stand/efi/loader/Makefile stable/11/stand/i386/zfsboot/zfsldr.S stable/11/stand/powerpc/ofw/ofwfdt.c Modified: stable/11/stand/efi/loader/Makefile ============================================================================== --- stable/11/stand/efi/loader/Makefile Tue Feb 13 04:10:10 2018 (r329191) +++ stable/11/stand/efi/loader/Makefile Tue Feb 13 04:28:13 2018 (r329192) @@ -54,12 +54,6 @@ CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include CFLAGS+= -I${BOOTSRC}/i386/libi386 CFLAGS+= -DNO_PCI -DEFI -# make buildenv doesn't set DESTDIR, this means LIBSTAND -# will be wrong when crossbuilding. -.if exists(${.OBJDIR}/../../../../lib/libstand/libstand.a) -LIBSTAND= ${.OBJDIR}/../../../../lib/libstand/libstand.a -.endif - .if !defined(BOOT_HIDE_SERIAL_NUMBERS) # Export serial numbers, UUID, and asset tag from loader. CFLAGS+= -DSMBIOS_SERIAL_NUMBERS Modified: stable/11/stand/i386/zfsboot/zfsldr.S ============================================================================== --- stable/11/stand/i386/zfsboot/zfsldr.S Tue Feb 13 04:10:10 2018 (r329191) +++ stable/11/stand/i386/zfsboot/zfsldr.S Tue Feb 13 04:28:13 2018 (r329192) @@ -33,7 +33,7 @@ .set SIZ_PAG,0x1000 # Page size .set SIZ_SEC,0x200 # Sector size .set COPY_BLKS,0x8 # Number of blocks - # to copy for boot2 + # to copy for boot2 (<= 15) .set COPY_BLK_SZ,0x8000 # Copy in 32k blocks; must be # a multiple of 16 bytes .set NSECT,(COPY_BLK_SZ / SIZ_SEC * COPY_BLKS) Modified: stable/11/stand/powerpc/ofw/ofwfdt.c ============================================================================== --- stable/11/stand/powerpc/ofw/ofwfdt.c Tue Feb 13 04:10:10 2018 (r329191) +++ stable/11/stand/powerpc/ofw/ofwfdt.c Tue Feb 13 04:28:13 2018 (r329192) @@ -26,11 +26,6 @@ #include __FBSDID("$FreeBSD$"); -/* - * Include stdlib.h because of DEBUG_MALLOC shenanigans in stand.h for now. - * This will be removed in the future, when libsa silently replaces stdlib.h. - */ -#include #include #include #include From owner-svn-src-stable-11@freebsd.org Tue Feb 13 12:54:04 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7B49F1FF00; Tue, 13 Feb 2018 12:54:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 88DB576F71; Tue, 13 Feb 2018 12:54:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83BEE2109F; Tue, 13 Feb 2018 12:54:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DCs3mB054360; Tue, 13 Feb 2018 12:54:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DCs3ca054357; Tue, 13 Feb 2018 12:54:03 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802131254.w1DCs3ca054357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 13 Feb 2018 12:54:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329199 - in stable/11/sys: conf i386/i386 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: conf i386/i386 X-SVN-Commit-Revision: 329199 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 12:54:04 -0000 Author: kib Date: Tue Feb 13 12:54:03 2018 New Revision: 329199 URL: https://svnweb.freebsd.org/changeset/base/329199 Log: MFC r328913: Move signal trampolines out of locore.s into separate source file. Added: stable/11/sys/i386/i386/sigtramp.s - copied unchanged from r328913, head/sys/i386/i386/sigtramp.s Modified: stable/11/sys/conf/files.i386 stable/11/sys/i386/i386/locore.s Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files.i386 ============================================================================== --- stable/11/sys/conf/files.i386 Tue Feb 13 11:43:57 2018 (r329198) +++ stable/11/sys/conf/files.i386 Tue Feb 13 12:54:03 2018 (r329199) @@ -504,6 +504,7 @@ i386/i386/mpboot.s optional smp i386/i386/perfmon.c optional perfmon i386/i386/pmap.c standard i386/i386/ptrace_machdep.c standard +i386/i386/sigtramp.s standard i386/i386/support.s standard i386/i386/swtch.s standard i386/i386/sys_machdep.c standard Modified: stable/11/sys/i386/i386/locore.s ============================================================================== --- stable/11/sys/i386/i386/locore.s Tue Feb 13 11:43:57 2018 (r329198) +++ stable/11/sys/i386/i386/locore.s Tue Feb 13 12:54:03 2018 (r329199) @@ -44,7 +44,6 @@ #include "opt_nfsroot.h" #include "opt_pmap.h" -#include #include #include @@ -327,77 +326,6 @@ begin: call mi_startup /* autoconfiguration, mountroot etc */ /* NOTREACHED */ addl $0,%esp /* for db_numargs() again */ - -/* - * Signal trampoline, copied to top of user stack - */ -NON_GPROF_ENTRY(sigcode) - calll *SIGF_HANDLER(%esp) - leal SIGF_UC(%esp),%eax /* get ucontext */ - pushl %eax - testl $PSL_VM,UC_EFLAGS(%eax) - jne 1f - mov UC_GS(%eax),%gs /* restore %gs */ -1: - movl $SYS_sigreturn,%eax - pushl %eax /* junk to fake return addr. */ - int $0x80 /* enter kernel with args */ - /* on stack */ -1: - jmp 1b - -#ifdef COMPAT_FREEBSD4 - ALIGN_TEXT -freebsd4_sigcode: - calll *SIGF_HANDLER(%esp) - leal SIGF_UC4(%esp),%eax /* get ucontext */ - pushl %eax - testl $PSL_VM,UC4_EFLAGS(%eax) - jne 1f - mov UC4_GS(%eax),%gs /* restore %gs */ -1: - movl $344,%eax /* 4.x SYS_sigreturn */ - pushl %eax /* junk to fake return addr. */ - int $0x80 /* enter kernel with args */ - /* on stack */ -1: - jmp 1b -#endif - -#ifdef COMPAT_43 - ALIGN_TEXT -osigcode: - call *SIGF_HANDLER(%esp) /* call signal handler */ - lea SIGF_SC(%esp),%eax /* get sigcontext */ - pushl %eax - testl $PSL_VM,SC_PS(%eax) - jne 9f - mov SC_GS(%eax),%gs /* restore %gs */ -9: - movl $103,%eax /* 3.x SYS_sigreturn */ - pushl %eax /* junk to fake return addr. */ - int $0x80 /* enter kernel with args */ -0: jmp 0b -#endif /* COMPAT_43 */ - - ALIGN_TEXT -esigcode: - - .data - .globl szsigcode -szsigcode: - .long esigcode-sigcode -#ifdef COMPAT_FREEBSD4 - .globl szfreebsd4_sigcode -szfreebsd4_sigcode: - .long esigcode-freebsd4_sigcode -#endif -#ifdef COMPAT_43 - .globl szosigcode -szosigcode: - .long esigcode-osigcode -#endif - .text /********************************************************************** * Copied: stable/11/sys/i386/i386/sigtramp.s (from r328913, head/sys/i386/i386/sigtramp.s) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/i386/i386/sigtramp.s Tue Feb 13 12:54:03 2018 (r329199, copy of r328913, head/sys/i386/i386/sigtramp.s) @@ -0,0 +1,118 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)locore.s 7.3 (Berkeley) 5/13/91 + * $FreeBSD$ + * + * originally from: locore.s, by William F. Jolitz + * + * Substantially rewritten by David Greenman, Rod Grimes, + * Bruce Evans, Wolfgang Solfrank, Poul-Henning Kamp + * and many others. + */ + +#include "opt_compat.h" + +#include +#include +#include + +#include "assym.s" + +/* + * Signal trampoline, copied to top of user stack + */ +NON_GPROF_ENTRY(sigcode) + calll *SIGF_HANDLER(%esp) + leal SIGF_UC(%esp),%eax /* get ucontext */ + pushl %eax + testl $PSL_VM,UC_EFLAGS(%eax) + jne 1f + mov UC_GS(%eax),%gs /* restore %gs */ +1: + movl $SYS_sigreturn,%eax + pushl %eax /* junk to fake return addr. */ + int $0x80 /* enter kernel with args */ + /* on stack */ +1: + jmp 1b + +#ifdef COMPAT_FREEBSD4 + ALIGN_TEXT +freebsd4_sigcode: + calll *SIGF_HANDLER(%esp) + leal SIGF_UC4(%esp),%eax /* get ucontext */ + pushl %eax + testl $PSL_VM,UC4_EFLAGS(%eax) + jne 1f + mov UC4_GS(%eax),%gs /* restore %gs */ +1: + movl $344,%eax /* 4.x SYS_sigreturn */ + pushl %eax /* junk to fake return addr. */ + int $0x80 /* enter kernel with args */ + /* on stack */ +1: + jmp 1b +#endif + +#ifdef COMPAT_43 + ALIGN_TEXT +osigcode: + call *SIGF_HANDLER(%esp) /* call signal handler */ + lea SIGF_SC(%esp),%eax /* get sigcontext */ + pushl %eax + testl $PSL_VM,SC_PS(%eax) + jne 9f + mov SC_GS(%eax),%gs /* restore %gs */ +9: + movl $103,%eax /* 3.x SYS_sigreturn */ + pushl %eax /* junk to fake return addr. */ + int $0x80 /* enter kernel with args */ +0: jmp 0b +#endif /* COMPAT_43 */ + + ALIGN_TEXT +esigcode: + + .data + .globl szsigcode +szsigcode: + .long esigcode-sigcode +#ifdef COMPAT_FREEBSD4 + .globl szfreebsd4_sigcode +szfreebsd4_sigcode: + .long esigcode-freebsd4_sigcode +#endif +#ifdef COMPAT_43 + .globl szosigcode +szosigcode: + .long esigcode-osigcode +#endif From owner-svn-src-stable-11@freebsd.org Tue Feb 13 14:37:23 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FBB1F052DB; Tue, 13 Feb 2018 14:37:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 095EC7B5BF; Tue, 13 Feb 2018 14:37:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF1C0220CB; Tue, 13 Feb 2018 14:37:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DEbMLw004437; Tue, 13 Feb 2018 14:37:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DEbM64004427; Tue, 13 Feb 2018 14:37:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802131437.w1DEbM64004427@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 13 Feb 2018 14:37:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329200 - in stable/11/sys: conf dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: conf dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5 X-SVN-Commit-Revision: 329200 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 14:37:23 -0000 Author: hselasky Date: Tue Feb 13 14:37:21 2018 New Revision: 329200 URL: https://svnweb.freebsd.org/changeset/base/329200 Log: MFC r325638 and r325976: Refactor the flowsteering APIs used by mlx5en(4). This change is needed by the coming ibcore and mlx5ib updates in order to support traffic redirection to so-called raw ethernet QPs. Remove unused E-switch related routines and files while at it. Sponsored by: Mellanox Technologies Added: stable/11/sys/dev/mlx5/fs.h - copied unchanged from r325638, head/sys/dev/mlx5/fs.h stable/11/sys/dev/mlx5/mlx5_core/fs_core.h - copied unchanged from r325638, head/sys/dev/mlx5/mlx5_core/fs_core.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_fs_cmd.c - copied unchanged from r325638, head/sys/dev/mlx5/mlx5_core/mlx5_fs_cmd.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c - copied, changed from r325638, head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c Deleted: stable/11/sys/dev/mlx5/eswitch_vacl.h stable/11/sys/dev/mlx5/flow_table.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_eswitch_vacl.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_flow_table.c Modified: stable/11/sys/conf/files stable/11/sys/dev/mlx5/device.h stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c stable/11/sys/dev/mlx5/mlx5_ifc.h stable/11/sys/modules/mlx5/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Tue Feb 13 12:54:03 2018 (r329199) +++ stable/11/sys/conf/files Tue Feb 13 14:37:21 2018 (r329200) @@ -4402,7 +4402,9 @@ dev/mlx5/mlx5_core/mlx5_diagnostics.c optional mlx5 p compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_eq.c optional mlx5 pci \ compile-with "${OFED_C}" -dev/mlx5/mlx5_core/mlx5_flow_table.c optional mlx5 pci \ +dev/mlx5/mlx5_core/mlx5_fs_cmd.c optional mlx5 pci \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_fs_tree.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_fw.c optional mlx5 pci \ compile-with "${OFED_C}" Modified: stable/11/sys/dev/mlx5/device.h ============================================================================== --- stable/11/sys/dev/mlx5/device.h Tue Feb 13 12:54:03 2018 (r329199) +++ stable/11/sys/dev/mlx5/device.h Tue Feb 13 14:37:21 2018 (r329200) @@ -1085,6 +1085,7 @@ enum { MLX5_FLOW_TABLE_TYPE_ESWITCH = 4, MLX5_FLOW_TABLE_TYPE_SNIFFER_RX = 5, MLX5_FLOW_TABLE_TYPE_SNIFFER_TX = 6, + MLX5_FLOW_TABLE_TYPE_NIC_RX_RDMA = 7, }; enum { Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Tue Feb 13 12:54:03 2018 (r329199) +++ stable/11/sys/dev/mlx5/driver.h Tue Feb 13 14:37:21 2018 (r329200) @@ -582,6 +582,7 @@ struct mlx5_special_contexts { int resd_lkey; }; +struct mlx5_flow_root_namespace; struct mlx5_core_dev { struct pci_dev *pdev; char board_id[MLX5_BOARD_ID_LEN]; @@ -600,6 +601,12 @@ struct mlx5_core_dev { u32 issi; struct mlx5_special_contexts special_contexts; unsigned int module_status[MLX5_MAX_PORTS]; + struct mlx5_flow_root_namespace *root_ns; + struct mlx5_flow_root_namespace *fdb_root_ns; + struct mlx5_flow_root_namespace *esw_egress_root_ns; + struct mlx5_flow_root_namespace *esw_ingress_root_ns; + struct mlx5_flow_root_namespace *sniffer_rx_root_ns; + struct mlx5_flow_root_namespace *sniffer_tx_root_ns; u32 num_q_counter_allocated[MLX5_INTERFACE_NUMBER]; }; Copied: stable/11/sys/dev/mlx5/fs.h (from r325638, head/sys/dev/mlx5/fs.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/mlx5/fs.h Tue Feb 13 14:37:21 2018 (r329200, copy of r325638, head/sys/dev/mlx5/fs.h) @@ -0,0 +1,232 @@ +/*- + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MLX5_FS_ +#define _MLX5_FS_ + +#include + +#include +#include +#include + +enum { + MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO = 1 << 16, +}; + +/*Flow tag*/ +enum { + MLX5_FS_DEFAULT_FLOW_TAG = 0xFFFFFF, + MLX5_FS_ETH_FLOW_TAG = 0xFFFFFE, + MLX5_FS_SNIFFER_FLOW_TAG = 0xFFFFFD, +}; + +enum { + MLX5_FS_FLOW_TAG_MASK = 0xFFFFFF, +}; + +#define FS_MAX_TYPES 10 +#define FS_MAX_ENTRIES 32000U + +enum mlx5_flow_namespace_type { + MLX5_FLOW_NAMESPACE_BYPASS, + MLX5_FLOW_NAMESPACE_KERNEL, + MLX5_FLOW_NAMESPACE_LEFTOVERS, + MLX5_FLOW_NAMESPACE_SNIFFER_RX, + MLX5_FLOW_NAMESPACE_SNIFFER_TX, + MLX5_FLOW_NAMESPACE_FDB, + MLX5_FLOW_NAMESPACE_ESW_EGRESS, + MLX5_FLOW_NAMESPACE_ESW_INGRESS, +}; + +struct mlx5_flow_table; +struct mlx5_flow_group; +struct mlx5_flow_rule; +struct mlx5_flow_namespace; + +struct mlx5_flow_spec { + u8 match_criteria_enable; + u32 match_criteria[MLX5_ST_SZ_DW(fte_match_param)]; + u32 match_value[MLX5_ST_SZ_DW(fte_match_param)]; +}; + +struct mlx5_flow_destination { + u32 type; + union { + u32 tir_num; + struct mlx5_flow_table *ft; + u32 vport_num; + }; +}; + +#define FT_NAME_STR_SZ 20 +#define LEFTOVERS_RULE_NUM 2 +static inline void build_leftovers_ft_param(char *name, + unsigned int *priority, + int *n_ent, + int *n_grp) +{ + snprintf(name, FT_NAME_STR_SZ, "leftovers"); + *priority = 0; /*Priority of leftovers_prio-0*/ + *n_ent = LEFTOVERS_RULE_NUM + 1; /*1: star rules*/ + *n_grp = LEFTOVERS_RULE_NUM; +} + +static inline bool outer_header_zero(u32 *match_criteria) +{ + int size = MLX5_ST_SZ_BYTES(fte_match_param); + char *outer_headers_c = MLX5_ADDR_OF(fte_match_param, match_criteria, + outer_headers); + + return outer_headers_c[0] == 0 && !memcmp(outer_headers_c, + outer_headers_c + 1, + size - 1); +} + +struct mlx5_flow_namespace * +mlx5_get_flow_namespace(struct mlx5_core_dev *dev, + enum mlx5_flow_namespace_type type); + +/* The underlying implementation create two more entries for + * chaining flow tables. the user should be aware that if he pass + * max_num_ftes as 2^N it will result in doubled size flow table + */ +struct mlx5_flow_table * +mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns, + int prio, + const char *name, + int num_flow_table_entries, + int max_num_groups); + +struct mlx5_flow_table * +mlx5_create_vport_flow_table(struct mlx5_flow_namespace *ns, + u16 vport, + int prio, + const char *name, + int num_flow_table_entries); + +struct mlx5_flow_table * +mlx5_create_flow_table(struct mlx5_flow_namespace *ns, + int prio, + const char *name, + int num_flow_table_entries); +int mlx5_destroy_flow_table(struct mlx5_flow_table *ft); + +/* inbox should be set with the following values: + * start_flow_index + * end_flow_index + * match_criteria_enable + * match_criteria + */ +struct mlx5_flow_group * +mlx5_create_flow_group(struct mlx5_flow_table *ft, u32 *in); +void mlx5_destroy_flow_group(struct mlx5_flow_group *fg); + +/* Single destination per rule. + * Group ID is implied by the match criteria. + */ +struct mlx5_flow_rule * +mlx5_add_flow_rule(struct mlx5_flow_table *ft, + u8 match_criteria_enable, + u32 *match_criteria, + u32 *match_value, + u32 action, + u32 flow_tag, + struct mlx5_flow_destination *dest); +void mlx5_del_flow_rule(struct mlx5_flow_rule *fr); + +/*The following API is for sniffer*/ +typedef int (*rule_event_fn)(struct mlx5_flow_rule *rule, + bool ctx_changed, + void *client_data, + void *context); + +struct mlx5_flow_handler; + +struct flow_client_priv_data; + +void mlx5e_sniffer_roce_mode_notify( + struct mlx5_core_dev *mdev, + int action); + +int mlx5_set_rule_private_data(struct mlx5_flow_rule *rule, struct + mlx5_flow_handler *handler, void + *client_data); + +struct mlx5_flow_handler *mlx5_register_rule_notifier(struct mlx5_core_dev *dev, + enum mlx5_flow_namespace_type ns_type, + rule_event_fn add_cb, + rule_event_fn del_cb, + void *context); + +void mlx5_unregister_rule_notifier(struct mlx5_flow_handler *handler); + +void mlx5_flow_iterate_existing_rules(struct mlx5_flow_namespace *ns, + rule_event_fn cb, + void *context); + +void mlx5_get_match_criteria(u32 *match_criteria, + struct mlx5_flow_rule *rule); + +void mlx5_get_match_value(u32 *match_value, + struct mlx5_flow_rule *rule); + +u8 mlx5_get_match_criteria_enable(struct mlx5_flow_rule *rule); + +struct mlx5_flow_rules_list *get_roce_flow_rules(u8 roce_mode); + +void mlx5_del_flow_rules_list(struct mlx5_flow_rules_list *rules_list); + +struct mlx5_flow_rules_list { + struct list_head head; +}; + +struct mlx5_flow_rule_node { + struct list_head list; + u32 match_criteria[MLX5_ST_SZ_DW(fte_match_param)]; + u32 match_value[MLX5_ST_SZ_DW(fte_match_param)]; + u8 match_criteria_enable; +}; + +struct mlx5_core_fs_mask { + u8 match_criteria_enable; + u32 match_criteria[MLX5_ST_SZ_DW(fte_match_param)]; +}; + +bool fs_match_exact_val( + struct mlx5_core_fs_mask *mask, + void *val1, + void *val2); + +bool fs_match_exact_mask( + u8 match_criteria_enable1, + u8 match_criteria_enable2, + void *mask1, + void *mask2); +/**********end API for sniffer**********/ + +#endif Copied: stable/11/sys/dev/mlx5/mlx5_core/fs_core.h (from r325638, head/sys/dev/mlx5/mlx5_core/fs_core.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/mlx5/mlx5_core/fs_core.h Tue Feb 13 14:37:21 2018 (r329200, copy of r325638, head/sys/dev/mlx5/mlx5_core/fs_core.h) @@ -0,0 +1,300 @@ +/*- + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MLX5_FS_CORE_ +#define _MLX5_FS_CORE_ + +#include +#include +#include +#include + +enum fs_type { + FS_TYPE_NAMESPACE, + FS_TYPE_PRIO, + FS_TYPE_FLOW_TABLE, + FS_TYPE_FLOW_GROUP, + FS_TYPE_FLOW_ENTRY, + FS_TYPE_FLOW_DEST +}; + +enum fs_ft_type { + FS_FT_NIC_RX = 0x0, + FS_FT_ESW_EGRESS_ACL = 0x2, + FS_FT_ESW_INGRESS_ACL = 0x3, + FS_FT_FDB = 0X4, + FS_FT_SNIFFER_RX = 0x5, + FS_FT_SNIFFER_TX = 0x6 +}; + +enum fs_fte_status { + FS_FTE_STATUS_EXISTING = 1UL << 0, +}; + +/* Should always be the first variable in the struct */ +struct fs_base { + struct list_head list; + struct fs_base *parent; + enum fs_type type; + struct kref refcount; + /* lock the node for writing and traversing */ + struct mutex lock; + struct completion complete; + atomic_t users_refcount; + const char *name; +}; + +struct mlx5_flow_rule { + struct fs_base base; + struct mlx5_flow_destination dest_attr; + struct list_head clients_data; + /*protect clients lits*/ + struct mutex clients_lock; +}; + +struct fs_fte { + struct fs_base base; + u32 val[MLX5_ST_SZ_DW(fte_match_param)]; + uint32_t dests_size; + uint32_t flow_tag; + struct list_head dests; + uint32_t index; /* index in ft */ + u8 action; /* MLX5_FLOW_CONTEXT_ACTION */ + enum fs_fte_status status; +}; + +struct fs_star_rule { + struct mlx5_flow_group *fg; + struct fs_fte *fte; +}; + +struct mlx5_flow_table { + struct fs_base base; + /* sorted list by start_index */ + struct list_head fgs; + struct { + bool active; + unsigned int max_types; + unsigned int num_types; + } autogroup; + unsigned int max_fte; + unsigned int level; + uint32_t id; + u16 vport; + enum fs_ft_type type; + struct fs_star_rule star_rule; + unsigned int shared_refcount; +}; + +enum fs_prio_flags { + MLX5_CORE_FS_PRIO_SHARED = 1 +}; + +struct fs_prio { + struct fs_base base; + struct list_head objs; /* each object is a namespace or ft */ + unsigned int max_ft; + unsigned int num_ft; + unsigned int max_ns; + unsigned int prio; + /*When create shared flow table, this lock should be taken*/ + struct mutex shared_lock; + u8 flags; +}; + +struct mlx5_flow_namespace { + /* parent == NULL => root ns */ + struct fs_base base; + /* sorted by priority number */ + struct list_head prios; /* list of fs_prios */ + struct list_head list_notifiers; + struct rw_semaphore notifiers_rw_sem; + struct rw_semaphore dests_rw_sem; +}; + +struct mlx5_flow_root_namespace { + struct mlx5_flow_namespace ns; + struct mlx5_flow_table *ft_level_0; + enum fs_ft_type table_type; + struct mlx5_core_dev *dev; + struct mlx5_flow_table *root_ft; + /* When chaining flow-tables, this lock should be taken */ + struct mutex fs_chain_lock; +}; + +struct mlx5_flow_group { + struct fs_base base; + struct list_head ftes; + struct mlx5_core_fs_mask mask; + uint32_t start_index; + uint32_t max_ftes; + uint32_t num_ftes; + uint32_t id; +}; + +struct mlx5_flow_handler { + struct list_head list; + rule_event_fn add_dst_cb; + rule_event_fn del_dst_cb; + void *client_context; + struct mlx5_flow_namespace *ns; +}; + +struct fs_client_priv_data { + struct mlx5_flow_handler *fs_handler; + struct list_head list; + void *client_dst_data; +}; + +void _fs_remove_node(struct kref *kref); +#define fs_get_obj(v, _base) {v = container_of((_base), typeof(*v), base); } +#define fs_get_parent(v, child) {v = (child)->base.parent ? \ + container_of((child)->base.parent, \ + typeof(*v), base) : NULL; } + +#define fs_list_for_each_entry(pos, cond, root) \ + list_for_each_entry(pos, root, base.list) \ + if (!(cond)) {} else + +#define fs_list_for_each_entry_continue(pos, cond, root) \ + list_for_each_entry_continue(pos, root, base.list) \ + if (!(cond)) {} else + +#define fs_list_for_each_entry_reverse(pos, cond, root) \ + list_for_each_entry_reverse(pos, root, base.list) \ + if (!(cond)) {} else + +#define fs_list_for_each_entry_continue_reverse(pos, cond, root) \ + list_for_each_entry_continue_reverse(pos, root, base.list) \ + if (!(cond)) {} else + +#define fs_for_each_ft(pos, prio) \ + fs_list_for_each_entry(pos, (pos)->base.type == FS_TYPE_FLOW_TABLE, \ + &(prio)->objs) + +#define fs_for_each_ft_reverse(pos, prio) \ + fs_list_for_each_entry_reverse(pos, \ + (pos)->base.type == FS_TYPE_FLOW_TABLE, \ + &(prio)->objs) + +#define fs_for_each_ns(pos, prio) \ + fs_list_for_each_entry(pos, \ + (pos)->base.type == FS_TYPE_NAMESPACE, \ + &(prio)->objs) + +#define fs_for_each_ns_or_ft_reverse(pos, prio) \ + list_for_each_entry_reverse(pos, &(prio)->objs, list) \ + if (!((pos)->type == FS_TYPE_NAMESPACE || \ + (pos)->type == FS_TYPE_FLOW_TABLE)) {} else + +#define fs_for_each_ns_or_ft(pos, prio) \ + list_for_each_entry(pos, &(prio)->objs, list) \ + if (!((pos)->type == FS_TYPE_NAMESPACE || \ + (pos)->type == FS_TYPE_FLOW_TABLE)) {} else + +#define fs_for_each_ns_or_ft_continue_reverse(pos, prio) \ + list_for_each_entry_continue_reverse(pos, &(prio)->objs, list) \ + if (!((pos)->type == FS_TYPE_NAMESPACE || \ + (pos)->type == FS_TYPE_FLOW_TABLE)) {} else + +#define fs_for_each_ns_or_ft_continue(pos, prio) \ + list_for_each_entry_continue(pos, &(prio)->objs, list) \ + if (!((pos)->type == FS_TYPE_NAMESPACE || \ + (pos)->type == FS_TYPE_FLOW_TABLE)) {} else + +#define fs_for_each_prio(pos, ns) \ + fs_list_for_each_entry(pos, (pos)->base.type == FS_TYPE_PRIO, \ + &(ns)->prios) + +#define fs_for_each_prio_reverse(pos, ns) \ + fs_list_for_each_entry_reverse(pos, (pos)->base.type == FS_TYPE_PRIO, \ + &(ns)->prios) + +#define fs_for_each_prio_continue(pos, ns) \ + fs_list_for_each_entry_continue(pos, (pos)->base.type == FS_TYPE_PRIO, \ + &(ns)->prios) + +#define fs_for_each_prio_continue_reverse(pos, ns) \ + fs_list_for_each_entry_continue_reverse(pos, \ + (pos)->base.type == FS_TYPE_PRIO, \ + &(ns)->prios) + +#define fs_for_each_fg(pos, ft) \ + fs_list_for_each_entry(pos, (pos)->base.type == FS_TYPE_FLOW_GROUP, \ + &(ft)->fgs) + +#define fs_for_each_fte(pos, fg) \ + fs_list_for_each_entry(pos, (pos)->base.type == FS_TYPE_FLOW_ENTRY, \ + &(fg)->ftes) +#define fs_for_each_dst(pos, fte) \ + fs_list_for_each_entry(pos, (pos)->base.type == FS_TYPE_FLOW_DEST, \ + &(fte)->dests) + +int mlx5_cmd_fs_create_ft(struct mlx5_core_dev *dev, + u16 vport, + enum fs_ft_type type, unsigned int level, + unsigned int log_size, unsigned int *table_id); + +int mlx5_cmd_fs_destroy_ft(struct mlx5_core_dev *dev, + u16 vport, + enum fs_ft_type type, unsigned int table_id); + +int mlx5_cmd_fs_create_fg(struct mlx5_core_dev *dev, + u32 *in, + u16 vport, + enum fs_ft_type type, unsigned int table_id, + unsigned int *group_id); + +int mlx5_cmd_fs_destroy_fg(struct mlx5_core_dev *dev, + u16 vport, + enum fs_ft_type type, unsigned int table_id, + unsigned int group_id); + + +int mlx5_cmd_fs_set_fte(struct mlx5_core_dev *dev, + u16 vport, + enum fs_fte_status *fte_status, + u32 *match_val, + enum fs_ft_type type, unsigned int table_id, + unsigned int index, unsigned int group_id, + unsigned int flow_tag, + unsigned short action, int dest_size, + struct list_head *dests); /* mlx5_flow_desination */ + +int mlx5_cmd_fs_delete_fte(struct mlx5_core_dev *dev, + u16 vport, + enum fs_fte_status *fte_status, + enum fs_ft_type type, unsigned int table_id, + unsigned int index); + +int mlx5_cmd_update_root_ft(struct mlx5_core_dev *dev, + enum fs_ft_type type, + unsigned int id); + +int mlx5_init_fs(struct mlx5_core_dev *dev); +void mlx5_cleanup_fs(struct mlx5_core_dev *dev); +#endif Copied: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fs_cmd.c (from r325638, head/sys/dev/mlx5/mlx5_core/mlx5_fs_cmd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fs_cmd.c Tue Feb 13 14:37:21 2018 (r329200, copy of r325638, head/sys/dev/mlx5/mlx5_core/mlx5_fs_cmd.c) @@ -0,0 +1,302 @@ +/*- + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include + +#include "fs_core.h" +#include "mlx5_core.h" + +int mlx5_cmd_update_root_ft(struct mlx5_core_dev *dev, + enum fs_ft_type type, + unsigned int id) +{ + u32 in[MLX5_ST_SZ_DW(set_flow_table_root_in)]; + u32 out[MLX5_ST_SZ_DW(set_flow_table_root_out)]; + + if (!dev) + return -EINVAL; + memset(in, 0, sizeof(in)); + + MLX5_SET(set_flow_table_root_in, in, opcode, + MLX5_CMD_OP_SET_FLOW_TABLE_ROOT); + MLX5_SET(set_flow_table_root_in, in, table_type, type); + MLX5_SET(set_flow_table_root_in, in, table_id, id); + + memset(out, 0, sizeof(out)); + return mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, + sizeof(out)); +} + +int mlx5_cmd_fs_create_ft(struct mlx5_core_dev *dev, + u16 vport, + enum fs_ft_type type, unsigned int level, + unsigned int log_size, unsigned int *table_id) +{ + u32 in[MLX5_ST_SZ_DW(create_flow_table_in)]; + u32 out[MLX5_ST_SZ_DW(create_flow_table_out)]; + int err; + + if (!dev) + return -EINVAL; + memset(in, 0, sizeof(in)); + + MLX5_SET(create_flow_table_in, in, opcode, + MLX5_CMD_OP_CREATE_FLOW_TABLE); + + MLX5_SET(create_flow_table_in, in, table_type, type); + MLX5_SET(create_flow_table_in, in, flow_table_context.level, level); + MLX5_SET(create_flow_table_in, in, flow_table_context.log_size, + log_size); + if (vport) { + MLX5_SET(create_flow_table_in, in, vport_number, vport); + MLX5_SET(create_flow_table_in, in, other_vport, 1); + } + + memset(out, 0, sizeof(out)); + err = mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, + sizeof(out)); + if (err) + return err; + + *table_id = MLX5_GET(create_flow_table_out, out, table_id); + + return 0; +} + +int mlx5_cmd_fs_destroy_ft(struct mlx5_core_dev *dev, + u16 vport, + enum fs_ft_type type, unsigned int table_id) +{ + u32 in[MLX5_ST_SZ_DW(destroy_flow_table_in)]; + u32 out[MLX5_ST_SZ_DW(destroy_flow_table_out)]; + + if (!dev) + return -EINVAL; + memset(in, 0, sizeof(in)); + memset(out, 0, sizeof(out)); + + MLX5_SET(destroy_flow_table_in, in, opcode, + MLX5_CMD_OP_DESTROY_FLOW_TABLE); + MLX5_SET(destroy_flow_table_in, in, table_type, type); + MLX5_SET(destroy_flow_table_in, in, table_id, table_id); + if (vport) { + MLX5_SET(destroy_flow_table_in, in, vport_number, vport); + MLX5_SET(destroy_flow_table_in, in, other_vport, 1); + } + + return mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out)); +} + +int mlx5_cmd_fs_create_fg(struct mlx5_core_dev *dev, + u32 *in, + u16 vport, + enum fs_ft_type type, unsigned int table_id, + unsigned int *group_id) +{ + u32 out[MLX5_ST_SZ_DW(create_flow_group_out)]; + int err; + int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in); + if (!dev) + return -EINVAL; + memset(out, 0, sizeof(out)); + + MLX5_SET(create_flow_group_in, in, opcode, + MLX5_CMD_OP_CREATE_FLOW_GROUP); + MLX5_SET(create_flow_group_in, in, table_type, type); + MLX5_SET(create_flow_group_in, in, table_id, table_id); + if (vport) { + MLX5_SET(create_flow_group_in, in, vport_number, vport); + MLX5_SET(create_flow_group_in, in, other_vport, 1); + } + + err = mlx5_cmd_exec_check_status(dev, in, + inlen, out, + sizeof(out)); + if (!err) + *group_id = MLX5_GET(create_flow_group_out, out, group_id); + + return err; +} + +int mlx5_cmd_fs_destroy_fg(struct mlx5_core_dev *dev, + u16 vport, + enum fs_ft_type type, unsigned int table_id, + unsigned int group_id) +{ + u32 in[MLX5_ST_SZ_DW(destroy_flow_group_in)]; + u32 out[MLX5_ST_SZ_DW(destroy_flow_group_out)]; + + if (!dev) + return -EINVAL; + memset(in, 0, sizeof(in)); + memset(out, 0, sizeof(out)); + + MLX5_SET(destroy_flow_group_in, in, opcode, + MLX5_CMD_OP_DESTROY_FLOW_GROUP); + MLX5_SET(destroy_flow_group_in, in, table_type, type); + MLX5_SET(destroy_flow_group_in, in, table_id, table_id); + MLX5_SET(destroy_flow_group_in, in, group_id, group_id); + if (vport) { + MLX5_SET(destroy_flow_group_in, in, vport_number, vport); + MLX5_SET(destroy_flow_group_in, in, other_vport, 1); + } + + return mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out)); +} + +int mlx5_cmd_fs_set_fte(struct mlx5_core_dev *dev, + u16 vport, + enum fs_fte_status *fte_status, + u32 *match_val, + enum fs_ft_type type, unsigned int table_id, + unsigned int index, unsigned int group_id, + unsigned int flow_tag, + unsigned short action, int dest_size, + struct list_head *dests) /* mlx5_flow_desination */ +{ + u32 out[MLX5_ST_SZ_DW(set_fte_out)]; + u32 *in; + unsigned int inlen; + struct mlx5_flow_rule *dst; + void *in_flow_context; + void *in_match_value; + void *in_dests; + int err; + int opmod = 0; + int modify_mask = 0; + int atomic_mod_cap; + + if (action != MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) + dest_size = 0; + + inlen = MLX5_ST_SZ_BYTES(set_fte_in) + + dest_size * MLX5_ST_SZ_BYTES(dest_format_struct); + + if (!dev) + return -EINVAL; + + if (*fte_status & FS_FTE_STATUS_EXISTING) { + atomic_mod_cap = MLX5_CAP_FLOWTABLE(dev, + flow_table_properties_nic_receive. + flow_modify_en); + if (!atomic_mod_cap) + return -ENOTSUPP; + opmod = 1; + modify_mask = 1 << + MLX5_SET_FTE_MODIFY_ENABLE_MASK_DESTINATION_LIST; + } + + in = mlx5_vzalloc(inlen); + if (!in) { + mlx5_core_warn(dev, "failed to allocate inbox\n"); + return -ENOMEM; + } + + MLX5_SET(set_fte_in, in, opcode, MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY); + MLX5_SET(set_fte_in, in, op_mod, opmod); + MLX5_SET(set_fte_in, in, modify_enable_mask, modify_mask); + MLX5_SET(set_fte_in, in, table_type, type); + MLX5_SET(set_fte_in, in, table_id, table_id); + MLX5_SET(set_fte_in, in, flow_index, index); + if (vport) { + MLX5_SET(set_fte_in, in, vport_number, vport); + MLX5_SET(set_fte_in, in, other_vport, 1); + } + + in_flow_context = MLX5_ADDR_OF(set_fte_in, in, flow_context); + MLX5_SET(flow_context, in_flow_context, group_id, group_id); + MLX5_SET(flow_context, in_flow_context, flow_tag, flow_tag); + MLX5_SET(flow_context, in_flow_context, action, action); + MLX5_SET(flow_context, in_flow_context, destination_list_size, + dest_size); + in_match_value = MLX5_ADDR_OF(flow_context, in_flow_context, + match_value); + memcpy(in_match_value, match_val, MLX5_ST_SZ_BYTES(fte_match_param)); + if (dest_size) { + in_dests = MLX5_ADDR_OF(flow_context, in_flow_context, destination); + list_for_each_entry(dst, dests, base.list) { + unsigned int id; + + MLX5_SET(dest_format_struct, in_dests, destination_type, + dst->dest_attr.type); + if (dst->dest_attr.type == + MLX5_FLOW_CONTEXT_DEST_TYPE_FLOW_TABLE) + id = dst->dest_attr.ft->id; + else + id = dst->dest_attr.tir_num; + MLX5_SET(dest_format_struct, in_dests, destination_id, id); + in_dests += MLX5_ST_SZ_BYTES(dest_format_struct); + } + } + memset(out, 0, sizeof(out)); + err = mlx5_cmd_exec_check_status(dev, in, inlen, out, + sizeof(out)); + if (!err) + *fte_status |= FS_FTE_STATUS_EXISTING; + + kvfree(in); + + return err; +} + +int mlx5_cmd_fs_delete_fte(struct mlx5_core_dev *dev, + u16 vport, + enum fs_fte_status *fte_status, + enum fs_ft_type type, unsigned int table_id, + unsigned int index) +{ + u32 in[MLX5_ST_SZ_DW(delete_fte_in)]; + u32 out[MLX5_ST_SZ_DW(delete_fte_out)]; + int err; + + if (!(*fte_status & FS_FTE_STATUS_EXISTING)) + return 0; + + if (!dev) + return -EINVAL; + memset(in, 0, sizeof(in)); + memset(out, 0, sizeof(out)); + + MLX5_SET(delete_fte_in, in, opcode, MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY); + MLX5_SET(delete_fte_in, in, table_type, type); + MLX5_SET(delete_fte_in, in, table_id, table_id); + MLX5_SET(delete_fte_in, in, flow_index, index); + if (vport) { + MLX5_SET(delete_fte_in, in, vport_number, vport); + MLX5_SET(delete_fte_in, in, other_vport, 1); + } + + err = mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out)); + if (!err) + *fte_status = 0; + + return err; +} Copied and modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c (from r325638, head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c) ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c Fri Nov 10 09:49:08 2017 (r325638, copy source) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c Tue Feb 13 14:37:21 2018 (r329200) @@ -2553,10 +2553,6 @@ static void iterate_rules_in_ft(struct mlx5_flow_table mutex_unlock(&ft->base.lock); } -static void iterate_rules_in_ns(struct mlx5_flow_namespace *ns, - rule_event_fn add_rule_cb, - void *context); - static void iterate_rules_in_prio(struct fs_prio *prio, rule_event_fn add_rule_cb, void *context) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Tue Feb 13 12:54:03 2018 (r329199) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Tue Feb 13 14:37:21 2018 (r329200) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -42,6 +42,7 @@ #include #include #include "mlx5_core.h" +#include "fs_core.h" MODULE_AUTHOR("Eli Cohen "); MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 core driver"); @@ -794,8 +795,21 @@ static int mlx5_dev_init(struct mlx5_core_dev *dev, st mlx5_init_srq_table(dev); mlx5_init_mr_table(dev); + err = mlx5_init_fs(dev); + if (err) { + mlx5_core_err(dev, "flow steering init %d\n", err); + goto err_init_tables; + } + return 0; +err_init_tables: + mlx5_cleanup_mr_table(dev); + mlx5_cleanup_srq_table(dev); + mlx5_cleanup_qp_table(dev); + mlx5_cleanup_cq_table(dev); + unmap_bf_area(dev); + err_stop_eqs: mlx5_stop_eqs(dev); @@ -848,6 +862,7 @@ static void mlx5_dev_cleanup(struct mlx5_core_dev *dev { struct mlx5_priv *priv = &dev->priv; + mlx5_cleanup_fs(dev); mlx5_cleanup_mr_table(dev); mlx5_cleanup_srq_table(dev); mlx5_cleanup_qp_table(dev); Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Tue Feb 13 12:54:03 2018 (r329199) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Tue Feb 13 14:37:21 2018 (r329200) @@ -590,10 +590,13 @@ enum { MLX5E_NUM_RQT = 2, }; +struct mlx5_flow_rule; + struct mlx5e_eth_addr_info { u8 addr [ETH_ALEN + 2]; u32 tt_vec; - u32 ft_ix[MLX5E_NUM_TT]; /* flow table index per traffic type */ + /* flow table rule per traffic type */ + struct mlx5_flow_rule *ft_rule[MLX5E_NUM_TT]; }; #define MLX5E_ETH_ADDR_HASH_SIZE (1 << BITS_PER_BYTE) @@ -622,17 +625,26 @@ enum { struct mlx5e_vlan_db { unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; - u32 active_vlans_ft_ix[VLAN_N_VID]; - u32 untagged_rule_ft_ix; - u32 any_vlan_rule_ft_ix; + struct mlx5_flow_rule *active_vlans_ft_rule[VLAN_N_VID]; + struct mlx5_flow_rule *untagged_ft_rule; + struct mlx5_flow_rule *any_cvlan_ft_rule; + struct mlx5_flow_rule *any_svlan_ft_rule; bool filter_disabled; }; struct mlx5e_flow_table { - void *vlan; - void *main; + int num_groups; + struct mlx5_flow_table *t; + struct mlx5_flow_group **g; }; +struct mlx5e_flow_tables { + struct mlx5_flow_namespace *ns; + struct mlx5e_flow_table vlan; + struct mlx5e_flow_table main; + struct mlx5e_flow_table inner_rss; +}; + struct mlx5e_priv { /* priv data path fields - start */ int order_base_2_num_channels; @@ -657,7 +669,7 @@ struct mlx5e_priv { u32 rqtn; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Tue Feb 13 14:45:06 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F543F05E6C; Tue, 13 Feb 2018 14:45:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 02AC67BD9C; Tue, 13 Feb 2018 14:45:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED6132225E; Tue, 13 Feb 2018 14:45:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DEj51c009372; Tue, 13 Feb 2018 14:45:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DEj5V5009370; Tue, 13 Feb 2018 14:45:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802131445.w1DEj5V5009370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 13 Feb 2018 14:45:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329201 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 329201 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 14:45:06 -0000 Author: hselasky Date: Tue Feb 13 14:45:05 2018 New Revision: 329201 URL: https://svnweb.freebsd.org/changeset/base/329201 Log: MFC r325655: Add API function to query virtual port counters in mlx5 core. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c stable/11/sys/dev/mlx5/vport.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c Tue Feb 13 14:37:21 2018 (r329200) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c Tue Feb 13 14:45:05 2018 (r329201) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -965,6 +965,43 @@ int mlx5_nic_vport_disable_roce(struct mlx5_core_dev * return mlx5_nic_vport_enable_disable_roce(mdev, 0); } EXPORT_SYMBOL_GPL(mlx5_nic_vport_disable_roce); + +int mlx5_core_query_vport_counter(struct mlx5_core_dev *dev, u8 other_vport, + int vf, u8 port_num, void *out, + size_t out_sz) +{ + int in_sz = MLX5_ST_SZ_BYTES(query_vport_counter_in); + int is_group_manager; + void *in; + int err; + + is_group_manager = MLX5_CAP_GEN(dev, vport_group_manager); + in = mlx5_vzalloc(in_sz); + if (!in) { + err = -ENOMEM; + return err; + } + + MLX5_SET(query_vport_counter_in, in, opcode, + MLX5_CMD_OP_QUERY_VPORT_COUNTER); + if (other_vport) { + if (is_group_manager) { + MLX5_SET(query_vport_counter_in, in, other_vport, 1); + MLX5_SET(query_vport_counter_in, in, vport_number, vf + 1); + } else { + err = -EPERM; + goto free; + } + } + if (MLX5_CAP_GEN(dev, num_ports) == 2) + MLX5_SET(query_vport_counter_in, in, port_num, port_num); + + err = mlx5_cmd_exec(dev, in, in_sz, out, out_sz); +free: + kvfree(in); + return err; +} +EXPORT_SYMBOL_GPL(mlx5_core_query_vport_counter); int mlx5_query_hca_vport_context(struct mlx5_core_dev *mdev, u8 port_num, u8 vport_num, u32 *out, Modified: stable/11/sys/dev/mlx5/vport.h ============================================================================== --- stable/11/sys/dev/mlx5/vport.h Tue Feb 13 14:37:21 2018 (r329200) +++ stable/11/sys/dev/mlx5/vport.h Tue Feb 13 14:45:05 2018 (r329201) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -101,6 +101,9 @@ int mlx5_set_nic_vport_permanent_mac(struct mlx5_core_ u8 *addr); int mlx5_nic_vport_enable_roce(struct mlx5_core_dev *mdev); int mlx5_nic_vport_disable_roce(struct mlx5_core_dev *mdev); +int mlx5_core_query_vport_counter(struct mlx5_core_dev *dev, u8 other_vport, + int vf, u8 port_num, void *out, + size_t out_sz); int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev, u64 *system_image_guid); int mlx5_query_vport_system_image_guid(struct mlx5_core_dev *dev, From owner-svn-src-stable-11@freebsd.org Tue Feb 13 14:46:30 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D642F06084; Tue, 13 Feb 2018 14:46:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 367CC7BF3C; Tue, 13 Feb 2018 14:46:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E06E2225F; Tue, 13 Feb 2018 14:46:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DEkTMR009477; Tue, 13 Feb 2018 14:46:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DEkTtL009475; Tue, 13 Feb 2018 14:46:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802131446.w1DEkTtL009475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 13 Feb 2018 14:46:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329202 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 329202 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 14:46:30 -0000 Author: hselasky Date: Tue Feb 13 14:46:29 2018 New Revision: 329202 URL: https://svnweb.freebsd.org/changeset/base/329202 Log: MFC r325656: Add API functions to query and modify local loopback of multicast and unicast traffic in mlx5 core. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c stable/11/sys/dev/mlx5/vport.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c Tue Feb 13 14:45:05 2018 (r329201) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c Tue Feb 13 14:46:29 2018 (r329202) @@ -1485,6 +1485,72 @@ int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev } EXPORT_SYMBOL_GPL(mlx5_modify_nic_vport_promisc); +int mlx5_nic_vport_modify_local_lb(struct mlx5_core_dev *mdev, + enum mlx5_local_lb_selection selection, + u8 value) +{ + void *in; + int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in); + int err; + + in = mlx5_vzalloc(inlen); + if (!in) { + mlx5_core_warn(mdev, "failed to allocate inbox\n"); + return -ENOMEM; + } + + MLX5_SET(modify_nic_vport_context_in, in, vport_number, 0); + + if (selection == MLX5_LOCAL_MC_LB) { + MLX5_SET(modify_nic_vport_context_in, in, + field_select.disable_mc_local_lb, 1); + MLX5_SET(modify_nic_vport_context_in, in, + nic_vport_context.disable_mc_local_lb, + value); + } else { + MLX5_SET(modify_nic_vport_context_in, in, + field_select.disable_uc_local_lb, 1); + MLX5_SET(modify_nic_vport_context_in, in, + nic_vport_context.disable_uc_local_lb, + value); + } + + err = mlx5_modify_nic_vport_context(mdev, in, inlen); + + kvfree(in); + return err; +} +EXPORT_SYMBOL_GPL(mlx5_nic_vport_modify_local_lb); + +int mlx5_nic_vport_query_local_lb(struct mlx5_core_dev *mdev, + enum mlx5_local_lb_selection selection, + u8 *value) +{ + void *out; + int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out); + int err; + + out = kzalloc(outlen, GFP_KERNEL); + if (!out) + return -ENOMEM; + + err = mlx5_query_nic_vport_context(mdev, 0, out, outlen); + if (err) + goto done; + + if (selection == MLX5_LOCAL_MC_LB) + *value = MLX5_GET(query_nic_vport_context_out, out, + nic_vport_context.disable_mc_local_lb); + else + *value = MLX5_GET(query_nic_vport_context_out, out, + nic_vport_context.disable_uc_local_lb); + +done: + kfree(out); + return err; +} +EXPORT_SYMBOL_GPL(mlx5_nic_vport_query_local_lb); + int mlx5_query_vport_counter(struct mlx5_core_dev *dev, u8 port_num, u16 vport_num, void *out, int out_size) Modified: stable/11/sys/dev/mlx5/vport.h ============================================================================== --- stable/11/sys/dev/mlx5/vport.h Tue Feb 13 14:45:05 2018 (r329201) +++ stable/11/sys/dev/mlx5/vport.h Tue Feb 13 14:46:29 2018 (r329202) @@ -41,7 +41,17 @@ int mlx5_vport_query_q_counter(struct mlx5_core_dev *m int mlx5_vport_query_out_of_rx_buffer(struct mlx5_core_dev *mdev, u16 counter_set_id, u32 *out_of_rx_buffer); +enum mlx5_local_lb_selection { + MLX5_LOCAL_MC_LB, + MLX5_LOCAL_UC_LB +}; +int mlx5_nic_vport_query_local_lb(struct mlx5_core_dev *mdev, + enum mlx5_local_lb_selection selection, + u8 *value); +int mlx5_nic_vport_modify_local_lb(struct mlx5_core_dev *mdev, + enum mlx5_local_lb_selection selection, + u8 value); u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport); u8 mlx5_query_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport); From owner-svn-src-stable-11@freebsd.org Tue Feb 13 14:47:45 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19842F062C3; Tue, 13 Feb 2018 14:47:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BF57B7C102; Tue, 13 Feb 2018 14:47:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA47122262; Tue, 13 Feb 2018 14:47:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DElirw009575; Tue, 13 Feb 2018 14:47:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DEliRG009573; Tue, 13 Feb 2018 14:47:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802131447.w1DEliRG009573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 13 Feb 2018 14:47:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329203 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 329203 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 14:47:45 -0000 Author: hselasky Date: Tue Feb 13 14:47:44 2018 New Revision: 329203 URL: https://svnweb.freebsd.org/changeset/base/329203 Log: MFC r325657: Add API function to query port performance counters for infiniband and RoCE traffic in mlx5 core. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c stable/11/sys/dev/mlx5/vport.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c Tue Feb 13 14:46:29 2018 (r329202) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_vport.c Tue Feb 13 14:47:44 2018 (r329203) @@ -1757,3 +1757,25 @@ out: return err; } EXPORT_SYMBOL_GPL(mlx5_query_hca_vport_state); + +int mlx5_core_query_ib_ppcnt(struct mlx5_core_dev *dev, + u8 port_num, void *out, size_t sz) +{ + u32 *in; + int err; + + in = mlx5_vzalloc(sz); + if (!in) { + err = -ENOMEM; + return err; + } + + MLX5_SET(ppcnt_reg, in, local_port, port_num); + + MLX5_SET(ppcnt_reg, in, grp, MLX5_INFINIBAND_PORT_COUNTERS_GROUP); + err = mlx5_core_access_reg(dev, in, sz, out, + sz, MLX5_REG_PPCNT, 0, 0); + + kvfree(in); + return err; +} Modified: stable/11/sys/dev/mlx5/vport.h ============================================================================== --- stable/11/sys/dev/mlx5/vport.h Tue Feb 13 14:46:29 2018 (r329202) +++ stable/11/sys/dev/mlx5/vport.h Tue Feb 13 14:47:44 2018 (r329203) @@ -143,4 +143,6 @@ int mlx5_query_vport_counter(struct mlx5_core_dev *dev void *out, int out_size); int mlx5_get_vport_counters(struct mlx5_core_dev *dev, u8 port_num, struct mlx5_vport_counters *vc); +int mlx5_core_query_ib_ppcnt(struct mlx5_core_dev *dev, + u8 port_num, void *out, size_t sz); #endif /* __MLX5_VPORT_H__ */ From owner-svn-src-stable-11@freebsd.org Tue Feb 13 14:57:35 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 954A6F06E12; Tue, 13 Feb 2018 14:57:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A41A7C7B9; Tue, 13 Feb 2018 14:57:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44EEE22405; Tue, 13 Feb 2018 14:57:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DEvZKS014845; Tue, 13 Feb 2018 14:57:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DEvYKC014840; Tue, 13 Feb 2018 14:57:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802131457.w1DEvYKC014840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 13 Feb 2018 14:57:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329204 - in stable/11/sys/dev/mlx5: . mlx5_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_ib X-SVN-Commit-Revision: 329204 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 14:57:35 -0000 Author: hselasky Date: Tue Feb 13 14:57:34 2018 New Revision: 329204 URL: https://svnweb.freebsd.org/changeset/base/329204 Log: MFC r325662: Add more and update existing mlx5 core firmware structure definitions and bits. This change is part of coming ibcore and mlx5ib updates. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/device.h stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c stable/11/sys/dev/mlx5/mlx5_ifc.h stable/11/sys/dev/mlx5/qp.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/device.h ============================================================================== --- stable/11/sys/dev/mlx5/device.h Tue Feb 13 14:47:44 2018 (r329203) +++ stable/11/sys/dev/mlx5/device.h Tue Feb 13 14:57:34 2018 (r329204) @@ -100,6 +100,35 @@ __mlx5_mask(typ, fld)) #define MLX5_GET64(typ, p, fld) be64_to_cpu(*((__be64 *)(p) + __mlx5_64_off(typ, fld))) +#define MLX5_GET64_BE(typ, p, fld) (*((__be64 *)(p) +\ + __mlx5_64_off(typ, fld))) + +#define MLX5_GET_BE(type_t, typ, p, fld) ({ \ + type_t tmp; \ + switch (sizeof(tmp)) { \ + case sizeof(u8): \ + tmp = (__force type_t)MLX5_GET(typ, p, fld); \ + break; \ + case sizeof(u16): \ + tmp = (__force type_t)cpu_to_be16(MLX5_GET(typ, p, fld)); \ + break; \ + case sizeof(u32): \ + tmp = (__force type_t)cpu_to_be32(MLX5_GET(typ, p, fld)); \ + break; \ + case sizeof(u64): \ + tmp = (__force type_t)MLX5_GET64_BE(typ, p, fld); \ + break; \ + } \ + tmp; \ + }) + +#define MLX5_BY_PASS_NUM_REGULAR_PRIOS 8 +#define MLX5_BY_PASS_NUM_DONT_TRAP_PRIOS 8 +#define MLX5_BY_PASS_NUM_MULTICAST_PRIOS 1 +#define MLX5_BY_PASS_NUM_PRIOS (MLX5_BY_PASS_NUM_REGULAR_PRIOS +\ + MLX5_BY_PASS_NUM_DONT_TRAP_PRIOS +\ + MLX5_BY_PASS_NUM_MULTICAST_PRIOS) + enum { MLX5_MAX_COMMANDS = 32, MLX5_CMD_DATA_BLOCK_SIZE = 512, @@ -326,6 +355,17 @@ enum { MLX5_CAP_OFF_CMDIF_CSUM = 46, }; +enum { + /* + * Max wqe size for rdma read is 512 bytes, so this + * limits our max_sge_rd as the wqe needs to fit: + * - ctrl segment (16 bytes) + * - rdma segment (16 bytes) + * - scatter elements (16 bytes each) + */ + MLX5_MAX_SGE_RD = (512 - 16 - 16) / 16 +}; + struct mlx5_inbox_hdr { __be16 opcode; u8 rsvd[4]; @@ -642,9 +682,9 @@ enum { }; enum { - CQE_ROCE_L3_HEADER_TYPE_GRH = 0x0, - CQE_ROCE_L3_HEADER_TYPE_IPV6 = 0x1, - CQE_ROCE_L3_HEADER_TYPE_IPV4 = 0x2, + MLX5_CQE_ROCE_L3_HEADER_TYPE_GRH = 0x0, + MLX5_CQE_ROCE_L3_HEADER_TYPE_IPV6 = 0x1, + MLX5_CQE_ROCE_L3_HEADER_TYPE_IPV4 = 0x2, }; enum { @@ -1282,6 +1322,7 @@ enum { MLX5_PER_PRIORITY_COUNTERS_GROUP = 0x10, MLX5_PER_TRAFFIC_CLASS_COUNTERS_GROUP = 0x11, MLX5_PHYSICAL_LAYER_COUNTERS_GROUP = 0x12, + MLX5_PHYSICAL_LAYER_STATISTICAL_GROUP = 0x16, MLX5_INFINIBAND_PORT_COUNTERS_GROUP = 0x20, }; Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Tue Feb 13 14:47:44 2018 (r329203) +++ stable/11/sys/dev/mlx5/driver.h Tue Feb 13 14:57:34 2018 (r329204) @@ -306,6 +306,11 @@ struct cmd_msg_cache { }; +struct mlx5_traffic_counter { + u64 packets; + u64 octets; +}; + struct mlx5_cmd_stats { u64 sum; u64 n; @@ -742,6 +747,13 @@ struct mlx5_pas { u8 log_sz; }; +enum port_state_policy { + MLX5_POLICY_DOWN = 0, + MLX5_POLICY_UP = 1, + MLX5_POLICY_FOLLOW = 2, + MLX5_POLICY_INVALID = 0xffffffff +}; + static inline void * mlx5_buf_offset(struct mlx5_buf *buf, int offset) { @@ -808,6 +820,11 @@ static inline void *mlx5_vmalloc(unsigned long size) if (!rtn) rtn = vmalloc(size); return rtn; +} + +static inline u32 mlx5_base_mkey(const u32 key) +{ + return key & 0xffffff00u; } void mlx5_enter_error_state(struct mlx5_core_dev *dev); Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Tue Feb 13 14:47:44 2018 (r329203) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Tue Feb 13 14:57:34 2018 (r329204) @@ -59,13 +59,6 @@ enum { MLX5_IB_CACHE_LINE_SIZE = 64, }; -enum { - MLX5_RQ_NUM_STATE = MLX5_RQC_STATE_ERR + 1, - MLX5_SQ_NUM_STATE = MLX5_SQC_STATE_ERR + 1, - MLX5_QP_STATE = MLX5_QP_NUM_STATE + 1, - MLX5_QP_STATE_BAD = MLX5_QP_STATE + 1, -}; - static const u32 mlx5_ib_opcode[] = { [IB_WR_SEND] = MLX5_OPCODE_SEND, [IB_WR_SEND_WITH_IMM] = MLX5_OPCODE_SEND_IMM, Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ifc.h Tue Feb 13 14:47:44 2018 (r329203) +++ stable/11/sys/dev/mlx5/mlx5_ifc.h Tue Feb 13 14:57:34 2018 (r329204) @@ -756,7 +756,8 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_b u8 multi_pkt_send_wqe[0x2]; u8 wqe_inline_mode[0x2]; u8 rss_ind_tbl_cap[0x4]; - u8 reserved_1[0x3]; + u8 scatter_fcs[0x1]; + u8 reserved_1[0x2]; u8 tunnel_lso_const_out_ip_id[0x1]; u8 tunnel_lro_gre[0x1]; u8 tunnel_lro_vxlan[0x1]; @@ -1045,10 +1046,12 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 cd[0x1]; u8 atm[0x1]; u8 apm[0x1]; - u8 reserved_32[0x7]; + u8 imaicl[0x1]; + u8 reserved_32[0x6]; u8 qkv[0x1]; u8 pkv[0x1]; - u8 reserved_33[0x4]; + u8 set_deth_sqpn[0x1]; + u8 reserved_33[0x3]; u8 xrc[0x1]; u8 ud[0x1]; u8 uc[0x1]; @@ -1800,7 +1803,7 @@ enum { struct mlx5_ifc_qpc_bits { u8 state[0x4]; - u8 reserved_0[0x4]; + u8 lag_tx_port_affinity[0x4]; u8 st[0x8]; u8 reserved_1[0x3]; u8 pm_state[0x2]; @@ -1862,8 +1865,11 @@ struct mlx5_ifc_qpc_bits { u8 reserved_16[0x8]; u8 cqn_snd[0x18]; - u8 reserved_17[0x40]; + u8 reserved_at_400[0x8]; + u8 deth_sqpn[0x18]; + u8 reserved_17[0x20]; + u8 reserved_18[0x8]; u8 last_acked_psn[0x18]; @@ -2060,7 +2066,11 @@ struct mlx5_ifc_traffic_counter_bits { }; struct mlx5_ifc_tisc_bits { - u8 reserved_0[0xc]; + u8 strict_lag_tx_port_affinity[0x1]; + u8 reserved_at_1[0x3]; + u8 lag_tx_port_affinity[0x04]; + + u8 reserved_at_8[0x4]; u8 prio[0x4]; u8 reserved_1[0x10]; @@ -4657,30 +4667,29 @@ struct mlx5_ifc_query_flow_group_in_bits { struct mlx5_ifc_query_flow_counter_out_bits { u8 status[0x8]; - u8 reserved_0[0x18]; + u8 reserved_at_8[0x18]; u8 syndrome[0x20]; - u8 reserved_1[0x40]; + u8 reserved_at_40[0x40]; - struct mlx5_ifc_traffic_counter_bits flow_statistics; - - u8 reserved_2[0x700]; + struct mlx5_ifc_traffic_counter_bits flow_statistics[0]; }; struct mlx5_ifc_query_flow_counter_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 reserved_at_10[0x10]; - u8 reserved_1[0x10]; + u8 reserved_at_20[0x10]; u8 op_mod[0x10]; - u8 reserved_2[0x80]; + u8 reserved_at_40[0x80]; u8 clear[0x1]; - u8 reserved_3[0x1f]; + u8 reserved_at_c1[0xf]; + u8 num_of_counters[0x10]; - u8 reserved_4[0x10]; + u8 reserved_at_e0[0x10]; u8 flow_counter_id[0x10]; }; @@ -5106,6 +5115,15 @@ struct mlx5_ifc_modify_tis_out_bits { u8 reserved_1[0x40]; }; +struct mlx5_ifc_modify_tis_bitmask_bits { + u8 reserved_at_0[0x20]; + + u8 reserved_at_20[0x1d]; + u8 lag_tx_port_affinity[0x1]; + u8 strict_lag_tx_port_affinity[0x1]; + u8 prio[0x1]; +}; + struct mlx5_ifc_modify_tis_in_bits { u8 opcode[0x10]; u8 reserved_0[0x10]; @@ -5118,7 +5136,7 @@ struct mlx5_ifc_modify_tis_in_bits { u8 reserved_3[0x20]; - u8 modify_bitmask[0x40]; + struct mlx5_ifc_modify_tis_bitmask_bits bitmask; u8 reserved_4[0x40]; @@ -5266,12 +5284,9 @@ struct mlx5_ifc_modify_rq_out_bits { u8 reserved_1[0x40]; }; -struct mlx5_ifc_rq_bitmask_bits { - u8 reserved[0x20]; - - u8 reserved1[0x1e]; - u8 vlan_strip_disable[0x1]; - u8 reserved2[0x1]; +enum { + MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_VSD = 1ULL << 1, + MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_MODIFY_RQ_COUNTER_SET_ID = 1ULL << 3, }; struct mlx5_ifc_modify_rq_in_bits { @@ -5287,7 +5302,7 @@ struct mlx5_ifc_modify_rq_in_bits { u8 reserved_3[0x20]; - struct mlx5_ifc_rq_bitmask_bits bitmask; + u8 modify_bitmask[0x40]; u8 reserved_4[0x40]; @@ -8126,6 +8141,36 @@ struct mlx5_ifc_phys_layer_cntrs_bits { u8 successful_recovery_events[0x20]; u8 reserved_0[0x180]; +}; + +struct mlx5_ifc_ib_port_cntrs_grp_data_layout_bits { + u8 symbol_error_counter[0x10]; + + u8 link_error_recovery_counter[0x8]; + + u8 link_downed_counter[0x8]; + + u8 port_rcv_errors[0x10]; + + u8 port_rcv_remote_physical_errors[0x10]; + + u8 port_rcv_switch_relay_errors[0x10]; + + u8 port_xmit_discards[0x10]; + + u8 port_xmit_constraint_errors[0x8]; + + u8 port_rcv_constraint_errors[0x8]; + + u8 reserved_at_70[0x8]; + + u8 link_overrun_errors[0x8]; + + u8 reserved_at_80[0x10]; + + u8 vl_15_dropped[0x10]; + + u8 reserved_at_a0[0xa0]; }; struct mlx5_ifc_phys_layer_statistical_cntrs_bits { Modified: stable/11/sys/dev/mlx5/qp.h ============================================================================== --- stable/11/sys/dev/mlx5/qp.h Tue Feb 13 14:47:44 2018 (r329203) +++ stable/11/sys/dev/mlx5/qp.h Tue Feb 13 14:57:34 2018 (r329204) @@ -28,9 +28,7 @@ #ifndef MLX5_QP_H #define MLX5_QP_H -#include #include -#include #define MLX5_INVALID_LKEY 0x100 #define MLX5_SIG_WQE_SIZE (MLX5_SEND_WQE_BB * 5) @@ -45,6 +43,7 @@ #define MLX5_BSF_REPEAT_BLOCK (1 << 7) #define MLX5_BSF_APPTAG_ESCAPE 0x1 #define MLX5_BSF_APPREF_ESCAPE 0x2 +#define MLX5_WQE_DS_UNITS 16 enum mlx5_qp_optpar { MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0, @@ -78,10 +77,19 @@ enum mlx5_qp_state { MLX5_QP_STATE_ERR = 6, MLX5_QP_STATE_SQ_DRAINING = 7, MLX5_QP_STATE_SUSPENDED = 9, - MLX5_QP_NUM_STATE + MLX5_QP_NUM_STATE, + MLX5_QP_STATE, + MLX5_QP_STATE_BAD, }; enum { + MLX5_SQ_STATE_NA = MLX5_SQC_STATE_ERR + 1, + MLX5_SQ_NUM_STATE = MLX5_SQ_STATE_NA + 1, + MLX5_RQ_STATE_NA = MLX5_RQC_STATE_ERR + 1, + MLX5_RQ_NUM_STATE = MLX5_RQ_STATE_NA + 1, +}; + +enum { MLX5_QP_ST_RC = 0x0, MLX5_QP_ST_UC = 0x1, MLX5_QP_ST_UD = 0x2, @@ -157,6 +165,7 @@ enum { enum { MLX5_FENCE_MODE_NONE = 0 << 5, MLX5_FENCE_MODE_INITIATOR_SMALL = 1 << 5, + MLX5_FENCE_MODE_FENCE = 2 << 5, MLX5_FENCE_MODE_STRONG_ORDERING = 3 << 5, MLX5_FENCE_MODE_SMALL_AND_FENCE = 4 << 5, }; @@ -198,6 +207,8 @@ struct mlx5_wqe_ctrl_seg { __be32 imm; }; +#define MLX5_WQE_CTRL_DS_MASK 0x3f + enum { MLX5_MLX_FLAG_MASK_VL15 = 0x40, MLX5_MLX_FLAG_MASK_SLR = 0x20, @@ -221,10 +232,10 @@ enum { }; enum { - MLX5_ETH_WQE_SWP_OUTER_L3_TYPE = 1 << 0, - MLX5_ETH_WQE_SWP_OUTER_L4_TYPE = 1 << 1, - MLX5_ETH_WQE_SWP_INNER_L3_TYPE = 1 << 4, - MLX5_ETH_WQE_SWP_INNER_L4_TYPE = 1 << 5, + MLX5_ETH_WQE_SWP_INNER_L3_TYPE = 1 << 0, + MLX5_ETH_WQE_SWP_INNER_L4_TYPE = 1 << 1, + MLX5_ETH_WQE_SWP_OUTER_L3_TYPE = 1 << 4, + MLX5_ETH_WQE_SWP_OUTER_L4_TYPE = 1 << 5, }; struct mlx5_wqe_eth_seg { @@ -415,6 +426,42 @@ struct mlx5_stride_block_ctrl_seg { __be16 num_entries; }; +enum mlx5_pagefault_flags { + MLX5_PFAULT_REQUESTOR = 1 << 0, + MLX5_PFAULT_WRITE = 1 << 1, + MLX5_PFAULT_RDMA = 1 << 2, +}; + +/* Contains the details of a pagefault. */ +struct mlx5_pagefault { + u32 bytes_committed; + u8 event_subtype; + enum mlx5_pagefault_flags flags; + union { + /* Initiator or send message responder pagefault details. */ + struct { + /* Received packet size, only valid for responders. */ + u32 packet_size; + /* + * WQE index. Refers to either the send queue or + * receive queue, according to event_subtype. + */ + u16 wqe_index; + } wqe; + /* RDMA responder pagefault details */ + struct { + u32 r_key; + /* + * Received packet size, minimal size page fault + * resolution required for forward progress. + */ + u32 packet_size; + u32 rdma_op_len; + u64 rdma_va; + } rdma; + }; +}; + struct mlx5_core_qp { struct mlx5_core_rsc_common common; /* must be first */ void (*event) (struct mlx5_core_qp *, int); @@ -462,7 +509,8 @@ struct mlx5_qp_context { u8 reserved2[4]; __be32 next_send_psn; __be32 cqn_send; - u8 reserved3[8]; + __be32 deth_sqpn; + u8 reserved3[4]; __be32 last_acked_psn; __be32 ssn; __be32 params2; From owner-svn-src-stable-11@freebsd.org Tue Feb 13 15:05:24 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51F9CF077E5; Tue, 13 Feb 2018 15:05:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 018427CFA3; Tue, 13 Feb 2018 15:05:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0C69225AC; Tue, 13 Feb 2018 15:05:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DF5NsT019651; Tue, 13 Feb 2018 15:05:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DF5Nos019649; Tue, 13 Feb 2018 15:05:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802131505.w1DF5Nos019649@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 13 Feb 2018 15:05:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329205 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 329205 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 15:05:24 -0000 Author: hselasky Date: Tue Feb 13 15:05:23 2018 New Revision: 329205 URL: https://svnweb.freebsd.org/changeset/base/329205 Log: MFC r325648: Implement support for decoding general port notification event in the mlx5 core module. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/device.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/device.h ============================================================================== --- stable/11/sys/dev/mlx5/device.h Tue Feb 13 14:57:34 2018 (r329204) +++ stable/11/sys/dev/mlx5/device.h Tue Feb 13 15:05:23 2018 (r329205) @@ -526,6 +526,11 @@ struct mlx5_eqe_port_module_event { u8 error_type; }; +struct mlx5_eqe_general_notification_event { + u32 rq_user_index_delay_drop; + u32 rsvd0[6]; +}; + union ev_data { __be32 raw[7]; struct mlx5_eqe_cmd cmd; @@ -539,6 +544,7 @@ union ev_data { struct mlx5_eqe_page_req req_pages; struct mlx5_eqe_port_module_event port_module_event; struct mlx5_eqe_vport_change vport_change; + struct mlx5_eqe_general_notification_event general_notifications; } __packed; struct mlx5_eqe { @@ -1427,6 +1433,10 @@ static inline int mlx5_get_cqe_format(const struct mlx { return (cqe->op_own & MLX5E_CQE_FORMAT_MASK) >> 2; } + +enum { + MLX5_GEN_EVENT_SUBTYPE_DELAY_DROP_TIMEOUT = 0x1, +}; /* 8 regular priorities + 1 for multicast */ #define MLX5_NUM_BYPASS_FTS 9 Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Tue Feb 13 14:57:34 2018 (r329204) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Tue Feb 13 15:05:23 2018 (r329205) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -80,6 +80,8 @@ struct cre_des_eq { /*Function prototype*/ static void mlx5_port_module_event(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe); +static void mlx5_port_general_notification_event(struct mlx5_core_dev *dev, + struct mlx5_eqe *eqe); static int mlx5_cmd_destroy_eq(struct mlx5_core_dev *dev, u8 eqn) { @@ -157,6 +159,8 @@ static const char *eqe_type_str(u8 type) return "MLX5_EVENT_TYPE_NIC_VPORT_CHANGE"; case MLX5_EVENT_TYPE_CODING_DCBX_CHANGE_EVENT: return "MLX5_EVENT_TYPE_CODING_DCBX_CHANGE_EVENT"; + case MLX5_EVENT_TYPE_CODING_GENERAL_NOTIFICATION_EVENT: + return "MLX5_EVENT_TYPE_CODING_GENERAL_NOTIFICATION_EVENT"; default: return "Unrecognized event"; } @@ -296,6 +300,10 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, stru } break; + case MLX5_EVENT_TYPE_CODING_GENERAL_NOTIFICATION_EVENT: + mlx5_port_general_notification_event(dev, eqe); + break; + case MLX5_EVENT_TYPE_CQ_ERROR: cqn = be32_to_cpu(eqe->data.cq_err.cqn) & 0xffffff; mlx5_core_warn(dev, "CQ error on CQN 0x%x, syndrom 0x%x\n", @@ -665,5 +673,26 @@ static void mlx5_port_module_event(struct mlx5_core_de /* store module status */ if (module_num < MLX5_MAX_PORTS) dev->module_status[module_num] = module_status; +} + +static void mlx5_port_general_notification_event(struct mlx5_core_dev *dev, + struct mlx5_eqe *eqe) +{ + u8 port = (eqe->data.port.port >> 4) & 0xf; + u32 rqn = 0; + struct mlx5_eqe_general_notification_event *general_event = NULL; + + switch (eqe->sub_type) { + case MLX5_GEN_EVENT_SUBTYPE_DELAY_DROP_TIMEOUT: + general_event = &eqe->data.general_notifications; + rqn = be32_to_cpu(general_event->rq_user_index_delay_drop) & + 0xffffff; + break; + default: + mlx5_core_warn(dev, + "general event with unrecognized subtype: port %d, sub_type %d\n", + port, eqe->sub_type); + break; + } } From owner-svn-src-stable-11@freebsd.org Tue Feb 13 15:07:40 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2837AF07ABC; Tue, 13 Feb 2018 15:07:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CEBFE7D1B3; Tue, 13 Feb 2018 15:07:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5738225AF; Tue, 13 Feb 2018 15:07:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DF7d1X019777; Tue, 13 Feb 2018 15:07:39 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DF7dvq019775; Tue, 13 Feb 2018 15:07:39 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802131507.w1DF7dvq019775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 13 Feb 2018 15:07:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329206 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 329206 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 15:07:40 -0000 Author: hselasky Date: Tue Feb 13 15:07:39 2018 New Revision: 329206 URL: https://svnweb.freebsd.org/changeset/base/329206 Log: MFC r325650: Add const keyword to input-only argument in mlx5 core. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_mad.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Tue Feb 13 15:05:23 2018 (r329205) +++ stable/11/sys/dev/mlx5/driver.h Tue Feb 13 15:07:39 2018 (r329206) @@ -879,7 +879,7 @@ int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev u32 *mkey); int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn); int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn); -int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb, +int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, const void *inb, void *outb, u16 opmod, u8 port); void mlx5_fwp_flush(struct mlx5_fw_page *fwp); void mlx5_fwp_invalidate(struct mlx5_fw_page *fwp); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_mad.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_mad.c Tue Feb 13 15:05:23 2018 (r329205) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_mad.c Tue Feb 13 15:07:39 2018 (r329206) @@ -30,7 +30,7 @@ #include #include "mlx5_core.h" -int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb, +int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, const void *inb, void *outb, u16 opmod, u8 port) { struct mlx5_mad_ifc_mbox_in *in = NULL; From owner-svn-src-stable-11@freebsd.org Tue Feb 13 15:09:04 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5014AF07C99; Tue, 13 Feb 2018 15:09:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 029AF7D32D; Tue, 13 Feb 2018 15:09:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1912225B0; Tue, 13 Feb 2018 15:09:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DF93A4019882; Tue, 13 Feb 2018 15:09:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DF93b6019880; Tue, 13 Feb 2018 15:09:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802131509.w1DF93b6019880@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 13 Feb 2018 15:09:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329207 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 329207 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 15:09:04 -0000 Author: hselasky Date: Tue Feb 13 15:09:03 2018 New Revision: 329207 URL: https://svnweb.freebsd.org/changeset/base/329207 Log: MFC r325653: Add API functions to set and query dropless port mode in mlx5 core. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Tue Feb 13 15:07:39 2018 (r329206) +++ stable/11/sys/dev/mlx5/driver.h Tue Feb 13 15:09:03 2018 (r329207) @@ -983,6 +983,8 @@ int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, i void mlx5_core_put_rsc(struct mlx5_core_rsc_common *common); u8 mlx5_is_wol_supported(struct mlx5_core_dev *dev); int mlx5_set_wol(struct mlx5_core_dev *dev, u8 wol_mode); +int mlx5_set_dropless_mode(struct mlx5_core_dev *dev, u16 timeout); +int mlx5_query_dropless_mode(struct mlx5_core_dev *dev, u16 *timeout); int mlx5_query_wol(struct mlx5_core_dev *dev, u8 *wol_mode); int mlx5_core_access_pvlc(struct mlx5_core_dev *dev, struct mlx5_pvlc_reg *pvlc, int write); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c Tue Feb 13 15:07:39 2018 (r329206) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c Tue Feb 13 15:09:03 2018 (r329207) @@ -459,6 +459,46 @@ int mlx5_set_wol(struct mlx5_core_dev *dev, u8 wol_mod } EXPORT_SYMBOL_GPL(mlx5_set_wol); +int mlx5_query_dropless_mode(struct mlx5_core_dev *dev, u16 *timeout) +{ + u32 in[MLX5_ST_SZ_DW(query_delay_drop_params_in)]; + u32 out[MLX5_ST_SZ_DW(query_delay_drop_params_out)]; + int err = 0; + + memset(in, 0, sizeof(in)); + memset(out, 0, sizeof(out)); + + MLX5_SET(query_delay_drop_params_in, in, opcode, + MLX5_CMD_OP_QUERY_DELAY_DROP_PARAMS); + + err = mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out)); + if (err) + return err; + + *timeout = MLX5_GET(query_delay_drop_params_out, out, + delay_drop_timeout); + + return 0; +} +EXPORT_SYMBOL_GPL(mlx5_query_dropless_mode); + +int mlx5_set_dropless_mode(struct mlx5_core_dev *dev, u16 timeout) +{ + u32 in[MLX5_ST_SZ_DW(set_delay_drop_params_in)]; + u32 out[MLX5_ST_SZ_DW(set_delay_drop_params_out)]; + + memset(in, 0, sizeof(in)); + memset(out, 0, sizeof(out)); + + MLX5_SET(set_delay_drop_params_in, in, opcode, + MLX5_CMD_OP_SET_DELAY_DROP_PARAMS); + MLX5_SET(set_delay_drop_params_in, in, delay_drop_timeout, timeout); + + return mlx5_cmd_exec_check_status(dev, in, sizeof(in), + out, sizeof(out)); +} +EXPORT_SYMBOL_GPL(mlx5_set_dropless_mode); + int mlx5_core_access_pvlc(struct mlx5_core_dev *dev, struct mlx5_pvlc_reg *pvlc, int write) { From owner-svn-src-stable-11@freebsd.org Tue Feb 13 15:11:01 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADB7CF07EDF; Tue, 13 Feb 2018 15:11:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5B8D17D51E; Tue, 13 Feb 2018 15:11:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 568B9226D2; Tue, 13 Feb 2018 15:11:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DFB1xx022914; Tue, 13 Feb 2018 15:11:01 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DFB1t0022913; Tue, 13 Feb 2018 15:11:01 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802131511.w1DFB1t0022913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 13 Feb 2018 15:11:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329208 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 329208 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 15:11:01 -0000 Author: hselasky Date: Tue Feb 13 15:11:00 2018 New Revision: 329208 URL: https://svnweb.freebsd.org/changeset/base/329208 Log: MFC r325649: Make local variable 64-bits to avoid masking away bits in mlx5 core. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Tue Feb 13 15:09:03 2018 (r329207) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Tue Feb 13 15:11:00 2018 (r329208) @@ -510,7 +510,7 @@ void mlx5_eq_cleanup(struct mlx5_core_dev *dev) int mlx5_start_eqs(struct mlx5_core_dev *dev) { struct mlx5_eq_table *table = &dev->priv.eq_table; - u32 async_event_mask = MLX5_ASYNC_EVENT_MASK; + u64 async_event_mask = MLX5_ASYNC_EVENT_MASK; int err; if (MLX5_CAP_GEN(dev, port_module_event)) From owner-svn-src-stable-11@freebsd.org Tue Feb 13 15:13:16 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DD80F08307; Tue, 13 Feb 2018 15:13:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F6CE7D916; Tue, 13 Feb 2018 15:13:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A59622740; Tue, 13 Feb 2018 15:13:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DFDFwG024516; Tue, 13 Feb 2018 15:13:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DFDFWi024514; Tue, 13 Feb 2018 15:13:15 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802131513.w1DFDFWi024514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 13 Feb 2018 15:13:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329209 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 329209 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 15:13:16 -0000 Author: hselasky Date: Tue Feb 13 15:13:15 2018 New Revision: 329209 URL: https://svnweb.freebsd.org/changeset/base/329209 Log: MFC r325651: Set ATOMIC endian mode in mlx5 core. The hardware is capable of 2 requestor endianness modes for standard 8 byte atomics: BE (0x0) and host endianness (0x1). Read the supported modes from hca atomic capabilities and configure HW to host endianness mode if supported. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/11/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Tue Feb 13 15:11:00 2018 (r329208) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Tue Feb 13 15:13:15 2018 (r329209) @@ -74,6 +74,11 @@ struct mlx5_device_context { void *context; }; +enum { + MLX5_ATOMIC_REQ_MODE_BE = 0x0, + MLX5_ATOMIC_REQ_MODE_HOST_ENDIANNESS = 0x1, +}; + static struct mlx5_profile profiles[] = { [0] = { .mask = 0, @@ -393,6 +398,53 @@ query_ex: return err; } +static int handle_hca_cap_atomic(struct mlx5_core_dev *dev) +{ + void *set_ctx; + void *set_hca_cap; + int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in); + int req_endianness; + int err; + + if (MLX5_CAP_GEN(dev, atomic)) { + err = mlx5_core_get_caps(dev, MLX5_CAP_ATOMIC, + HCA_CAP_OPMOD_GET_MAX); + if (err) + return err; + + err = mlx5_core_get_caps(dev, MLX5_CAP_ATOMIC, + HCA_CAP_OPMOD_GET_CUR); + if (err) + return err; + } else { + return 0; + } + + req_endianness = + MLX5_CAP_ATOMIC(dev, + supported_atomic_req_8B_endianess_mode_1); + + if (req_endianness != MLX5_ATOMIC_REQ_MODE_HOST_ENDIANNESS) + return 0; + + set_ctx = kzalloc(set_sz, GFP_KERNEL); + if (!set_ctx) + return -ENOMEM; + + MLX5_SET(set_hca_cap_in, set_ctx, op_mod, + MLX5_SET_HCA_CAP_OP_MOD_ATOMIC << 1); + set_hca_cap = MLX5_ADDR_OF(set_hca_cap_in, set_ctx, capability); + + /* Set requestor to host endianness */ + MLX5_SET(atomic_caps, set_hca_cap, atomic_req_8B_endianess_mode, + MLX5_ATOMIC_REQ_MODE_HOST_ENDIANNESS); + + err = set_caps(dev, set_ctx, set_sz); + + kfree(set_ctx); + return err; +} + static int set_hca_ctrl(struct mlx5_core_dev *dev) { struct mlx5_reg_host_endianess he_in; @@ -717,15 +769,21 @@ static int mlx5_dev_init(struct mlx5_core_dev *dev, st goto err_pagealloc_stop; } + err = set_hca_ctrl(dev); + if (err) { + device_printf((&pdev->dev)->bsddev, "ERR: ""set_hca_ctrl failed\n"); + goto reclaim_boot_pages; + } + err = handle_hca_cap(dev); if (err) { device_printf((&pdev->dev)->bsddev, "ERR: ""handle_hca_cap failed\n"); goto reclaim_boot_pages; } - err = set_hca_ctrl(dev); + err = handle_hca_cap_atomic(dev); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""set_hca_ctrl failed\n"); + device_printf((&pdev->dev)->bsddev, "ERR: ""handle_hca_cap_atomic failed\n"); goto reclaim_boot_pages; } Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ifc.h Tue Feb 13 15:11:00 2018 (r329208) +++ stable/11/sys/dev/mlx5/mlx5_ifc.h Tue Feb 13 15:13:15 2018 (r329209) @@ -74,6 +74,11 @@ enum { }; enum { + MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE = 0x0, + MLX5_SET_HCA_CAP_OP_MOD_ATOMIC = 0x3, +}; + +enum { MLX5_CMD_OP_QUERY_HCA_CAP = 0x100, MLX5_CMD_OP_QUERY_ADAPTER = 0x101, MLX5_CMD_OP_INIT_HCA = 0x102, From owner-svn-src-stable-11@freebsd.org Tue Feb 13 15:14:33 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E515F0852B; Tue, 13 Feb 2018 15:14:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 034DA7DBEE; Tue, 13 Feb 2018 15:14:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F26DD22742; Tue, 13 Feb 2018 15:14:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DFEWJH024660; Tue, 13 Feb 2018 15:14:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DFEW76024659; Tue, 13 Feb 2018 15:14:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802131514.w1DFEW76024659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 13 Feb 2018 15:14:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329211 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 329211 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 15:14:33 -0000 Author: hselasky Date: Tue Feb 13 15:14:32 2018 New Revision: 329211 URL: https://svnweb.freebsd.org/changeset/base/329211 Log: MFC r325652: Prevent mlx5 core from accessing host memory after shutdown by disabling PCI busmaster. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Tue Feb 13 15:13:43 2018 (r329210) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Tue Feb 13 15:14:32 2018 (r329211) @@ -1134,6 +1134,12 @@ static void remove_one(struct pci_dev *pdev) kfree(dev); } +static void shutdown_one(struct pci_dev *pdev) +{ + /* prevent device from accessing host memory after shutdown */ + pci_clear_master(pdev); +} + static const struct pci_device_id mlx5_core_pci_table[] = { { PCI_VDEVICE(MELLANOX, 4113) }, /* Connect-IB */ { PCI_VDEVICE(MELLANOX, 4114) }, /* Connect-IB VF */ @@ -1175,6 +1181,7 @@ MODULE_DEVICE_TABLE(pci, mlx5_core_pci_table); static struct pci_driver mlx5_core_driver = { .name = DRIVER_NAME, .id_table = mlx5_core_pci_table, + .shutdown = shutdown_one, .probe = init_one, .remove = remove_one }; From owner-svn-src-stable-11@freebsd.org Tue Feb 13 15:16:11 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1991F08783; Tue, 13 Feb 2018 15:16:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5DB417DDA7; Tue, 13 Feb 2018 15:16:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52B2F22745; Tue, 13 Feb 2018 15:16:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DFGBkh024787; Tue, 13 Feb 2018 15:16:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DFGBnb024785; Tue, 13 Feb 2018 15:16:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802131516.w1DFGBnb024785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 13 Feb 2018 15:16:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329212 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 329212 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 15:16:11 -0000 Author: hselasky Date: Tue Feb 13 15:16:10 2018 New Revision: 329212 URL: https://svnweb.freebsd.org/changeset/base/329212 Log: MFC r325658: Make physical address of init segment available in the priv of mlx5 core. This change is needed by mlx5ib(4). Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Tue Feb 13 15:14:32 2018 (r329211) +++ stable/11/sys/dev/mlx5/driver.h Tue Feb 13 15:16:10 2018 (r329212) @@ -595,6 +595,7 @@ struct mlx5_core_dev { struct mlx5_port_caps port_caps[MLX5_MAX_PORTS]; u32 hca_caps_cur[MLX5_CAP_NUM][MLX5_UN_SZ_DW(hca_cap_union)]; u32 hca_caps_max[MLX5_CAP_NUM][MLX5_UN_SZ_DW(hca_cap_union)]; + phys_addr_t iseg_base; struct mlx5_init_seg __iomem *iseg; enum mlx5_device_state state; void (*event) (struct mlx5_core_dev *dev, Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Tue Feb 13 15:14:32 2018 (r329211) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Tue Feb 13 15:16:10 2018 (r329212) @@ -716,8 +716,8 @@ static int mlx5_dev_init(struct mlx5_core_dev *dev, st goto err_clr_master; } - dev->iseg = ioremap(pci_resource_start(dev->pdev, 0), - sizeof(*dev->iseg)); + dev->iseg_base = pci_resource_start(dev->pdev, 0); + dev->iseg = ioremap(dev->iseg_base, sizeof(*dev->iseg)); if (!dev->iseg) { err = -ENOMEM; device_printf((&pdev->dev)->bsddev, "ERR: ""Failed mapping initialization segment, aborting\n"); From owner-svn-src-stable-11@freebsd.org Tue Feb 13 15:18:12 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 956D8F08A5B; Tue, 13 Feb 2018 15:18:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 473A57DF77; Tue, 13 Feb 2018 15:18:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E0DB22747; Tue, 13 Feb 2018 15:18:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DFIBc1024905; Tue, 13 Feb 2018 15:18:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DFIBNp024903; Tue, 13 Feb 2018 15:18:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802131518.w1DFIBNp024903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 13 Feb 2018 15:18:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329213 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 329213 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 15:18:12 -0000 Author: hselasky Date: Tue Feb 13 15:18:11 2018 New Revision: 329213 URL: https://svnweb.freebsd.org/changeset/base/329213 Log: MFC r325654: Add API functions to modify the transport interface send object, TIS, in mlx5 core. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_transobj.c stable/11/sys/dev/mlx5/mlx5_core/transobj.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_transobj.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_transobj.c Tue Feb 13 15:16:10 2018 (r329212) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_transobj.c Tue Feb 13 15:18:11 2018 (r329213) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -208,6 +208,17 @@ int mlx5_core_create_tis(struct mlx5_core_dev *dev, u3 *tisn = MLX5_GET(create_tis_out, out, tisn); return err; +} + +int mlx5_core_modify_tis(struct mlx5_core_dev *dev, u32 tisn, u32 *in, + int inlen) +{ + u32 out[MLX5_ST_SZ_DW(modify_tis_out)] = {0}; + + MLX5_SET(modify_tis_in, in, tisn, tisn); + MLX5_SET(modify_tis_in, in, opcode, MLX5_CMD_OP_MODIFY_TIS); + + return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); } void mlx5_core_destroy_tis(struct mlx5_core_dev *dev, u32 tisn) Modified: stable/11/sys/dev/mlx5/mlx5_core/transobj.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/transobj.h Tue Feb 13 15:16:10 2018 (r329212) +++ stable/11/sys/dev/mlx5/mlx5_core/transobj.h Tue Feb 13 15:18:11 2018 (r329213) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -45,6 +45,8 @@ int mlx5_core_create_tir(struct mlx5_core_dev *dev, u3 void mlx5_core_destroy_tir(struct mlx5_core_dev *dev, u32 tirn); int mlx5_core_create_tis(struct mlx5_core_dev *dev, u32 *in, int inlen, u32 *tisn); +int mlx5_core_modify_tis(struct mlx5_core_dev *dev, u32 tisn, u32 *in, + int inlen); void mlx5_core_destroy_tis(struct mlx5_core_dev *dev, u32 tisn); int mlx5_core_create_rmp(struct mlx5_core_dev *dev, u32 *in, int inlen, u32 *rmpn); int mlx5_core_modify_rmp(struct mlx5_core_dev *dev, u32 *in, int inlen); From owner-svn-src-stable-11@freebsd.org Tue Feb 13 15:55:32 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BDF2F0BB34; Tue, 13 Feb 2018 15:55:32 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D0BA37FB71; Tue, 13 Feb 2018 15:55:31 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C772122DC3; Tue, 13 Feb 2018 15:55:31 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DFtVsH044747; Tue, 13 Feb 2018 15:55:31 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DFtVYJ044746; Tue, 13 Feb 2018 15:55:31 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201802131555.w1DFtVYJ044746@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Tue, 13 Feb 2018 15:55:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329217 - stable/11/share/man/man9 X-SVN-Group: stable-11 X-SVN-Commit-Author: bryanv X-SVN-Commit-Paths: stable/11/share/man/man9 X-SVN-Commit-Revision: 329217 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 15:55:32 -0000 Author: bryanv Date: Tue Feb 13 15:55:31 2018 New Revision: 329217 URL: https://svnweb.freebsd.org/changeset/base/329217 Log: MFC 328917: Correct structure name used in bus_map_resource(9) example Modified: stable/11/share/man/man9/bus_map_resource.9 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/bus_map_resource.9 ============================================================================== --- stable/11/share/man/man9/bus_map_resource.9 Tue Feb 13 15:44:35 2018 (r329216) +++ stable/11/share/man/man9/bus_map_resource.9 Tue Feb 13 15:55:31 2018 (r329217) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2016 +.Dd February 5, 2018 .Dt BUS_MAP_RESOURCE 9 .Os .Sh NAME @@ -143,16 +143,16 @@ reads the first 32-bit word: .Bd -literal struct resource *r; struct resource_map map; - struct resource_map_args args; + struct resource_map_request req; uint32_t val; int rid; rid = PCIR_BAR(0); r = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE | RF_UNMAPPED); - resource_init_map_request(&args); - args.memattr = VM_MEMATTR_WRITE_COMBINING; - bus_map_resource(dev, SYS_RES_MEMORY, r, &args, &map); + resource_init_map_request(&req); + req.memattr = VM_MEMATTR_WRITE_COMBINING; + bus_map_resource(dev, SYS_RES_MEMORY, r, &req, &map); val = bus_read_4(&map, 0); .Ed .Sh SEE ALSO From owner-svn-src-stable-11@freebsd.org Tue Feb 13 21:11:28 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F731F00D71; Tue, 13 Feb 2018 21:11:28 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 01235719C5; Tue, 13 Feb 2018 21:11:28 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F01B6261D4; Tue, 13 Feb 2018 21:11:27 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DLBRmj005174; Tue, 13 Feb 2018 21:11:27 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DLBRfJ005171; Tue, 13 Feb 2018 21:11:27 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201802132111.w1DLBRfJ005171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 13 Feb 2018 21:11:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329242 - in stable/11: . secure/lib/libcrypto secure/usr.bin/openssl secure/usr.bin/openssl/man X-SVN-Group: stable-11 X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in stable/11: . secure/lib/libcrypto secure/usr.bin/openssl secure/usr.bin/openssl/man X-SVN-Commit-Revision: 329242 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 21:11:28 -0000 Author: jkim Date: Tue Feb 13 21:11:27 2018 New Revision: 329242 URL: https://svnweb.freebsd.org/changeset/base/329242 Log: MFC: r329024 Remove c_rehash(1) to not confuse users. Deleted: stable/11/secure/usr.bin/openssl/man/c_rehash.1 Modified: stable/11/ObsoleteFiles.inc stable/11/secure/lib/libcrypto/Makefile.inc stable/11/secure/usr.bin/openssl/Makefile.man Directory Properties: stable/11/ (props changed) Modified: stable/11/ObsoleteFiles.inc ============================================================================== --- stable/11/ObsoleteFiles.inc Tue Feb 13 20:07:40 2018 (r329241) +++ stable/11/ObsoleteFiles.inc Tue Feb 13 21:11:27 2018 (r329242) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20180213: remove c_rehash(1) +OLD_FILES+=usr/share/openssl/man/man1/c_rehash.1.gz # 20180212: Obsolete forth files OLD_FILES+=boot/efi.4th OLD_FILES+=boot/pcibios.4th Modified: stable/11/secure/lib/libcrypto/Makefile.inc ============================================================================== --- stable/11/secure/lib/libcrypto/Makefile.inc Tue Feb 13 20:07:40 2018 (r329241) +++ stable/11/secure/lib/libcrypto/Makefile.inc Tue Feb 13 21:11:27 2018 (r329242) @@ -64,14 +64,11 @@ MANDIR= ${SHAREDIR}/openssl/man/man .if defined(LIB) _docs= ${LIB} -.if ${LIB} == ssl -_docs+= man3 -.endif _skip= SSLeay_version des_modes _sec= 3 .else _docs= apps -_skip= config +_skip= c_rehash config _sec= 1 .endif Modified: stable/11/secure/usr.bin/openssl/Makefile.man ============================================================================== --- stable/11/secure/usr.bin/openssl/Makefile.man Tue Feb 13 20:07:40 2018 (r329241) +++ stable/11/secure/usr.bin/openssl/Makefile.man Tue Feb 13 21:11:27 2018 (r329242) @@ -2,7 +2,6 @@ # DO NOT EDIT: generated from man-makefile-update target MAN+= CA.pl.1 MAN+= asn1parse.1 -MAN+= c_rehash.1 MAN+= ca.1 MAN+= ciphers.1 MAN+= cms.1 From owner-svn-src-stable-11@freebsd.org Tue Feb 13 21:14:28 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22CDCF01171; Tue, 13 Feb 2018 21:14:28 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C4F7C71F0C; Tue, 13 Feb 2018 21:14:27 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5EF02631A; Tue, 13 Feb 2018 21:14:27 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DLERKC009286; Tue, 13 Feb 2018 21:14:27 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DLER6X009285; Tue, 13 Feb 2018 21:14:27 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201802132114.w1DLER6X009285@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 13 Feb 2018 21:14:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329243 - stable/11/crypto/openssl/doc/man3 X-SVN-Group: stable-11 X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: stable/11/crypto/openssl/doc/man3 X-SVN-Commit-Revision: 329243 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 21:14:28 -0000 Author: jkim Date: Tue Feb 13 21:14:27 2018 New Revision: 329243 URL: https://svnweb.freebsd.org/changeset/base/329243 Log: MFC: r329022 Remove an empty directory. Deleted: stable/11/crypto/openssl/doc/man3/ Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-stable-11@freebsd.org Tue Feb 13 22:37:55 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DB14F073AB; Tue, 13 Feb 2018 22:37:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 003A675E1D; Tue, 13 Feb 2018 22:37:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE9DB27038; Tue, 13 Feb 2018 22:37:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DMbslP049425; Tue, 13 Feb 2018 22:37:54 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DMbs7p049423; Tue, 13 Feb 2018 22:37:54 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201802132237.w1DMbs7p049423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 13 Feb 2018 22:37:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329246 - stable/11/usr.sbin/kldxref X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.sbin/kldxref X-SVN-Commit-Revision: 329246 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 22:37:55 -0000 Author: emaste Date: Tue Feb 13 22:37:54 2018 New Revision: 329246 URL: https://svnweb.freebsd.org/changeset/base/329246 Log: MFC r327503: kldxref: correct function names in warning messages Sponsored by: The FreeBSD Foundation Modified: stable/11/usr.sbin/kldxref/ef.c stable/11/usr.sbin/kldxref/ef_obj.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/kldxref/ef.c ============================================================================== --- stable/11/usr.sbin/kldxref/ef.c Tue Feb 13 21:33:40 2018 (r329245) +++ stable/11/usr.sbin/kldxref/ef.c Tue Feb 13 22:37:54 2018 (r329246) @@ -473,7 +473,7 @@ ef_seg_read_rel(elf_file_t ef, Elf_Off offset, size_t if (ofs == 0) { if (ef->ef_verbose) - warnx("ef_seg_read(%s): zero offset (%lx:%ld)", + warnx("ef_seg_read_rel(%s): zero offset (%lx:%ld)", ef->ef_name, (long)offset, ofs); return EFAULT; } Modified: stable/11/usr.sbin/kldxref/ef_obj.c ============================================================================== --- stable/11/usr.sbin/kldxref/ef_obj.c Tue Feb 13 21:33:40 2018 (r329245) +++ stable/11/usr.sbin/kldxref/ef_obj.c Tue Feb 13 22:37:54 2018 (r329246) @@ -225,7 +225,7 @@ ef_obj_seg_read(elf_file_t ef, Elf_Off offset, size_t if (offset + len > ef->size) { if (ef->ef_verbose) - warnx("ef_seg_read_rel(%s): bad offset/len (%lx:%ld)", + warnx("ef_obj_seg_read(%s): bad offset/len (%lx:%ld)", ef->ef_name, (long)offset, (long)len); return (EFAULT); } @@ -244,7 +244,7 @@ ef_obj_seg_read_rel(elf_file_t ef, Elf_Off offset, siz if (offset + len > ef->size) { if (ef->ef_verbose) - warnx("ef_seg_read_rel(%s): bad offset/len (%lx:%ld)", + warnx("ef_obj_seg_read_rel(%s): bad offset/len (%lx:%ld)", ef->ef_name, (long)offset, (long)len); return (EFAULT); } From owner-svn-src-stable-11@freebsd.org Tue Feb 13 22:40:34 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47BE4F0769F; Tue, 13 Feb 2018 22:40:34 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED7FE7601C; Tue, 13 Feb 2018 22:40:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E22A727040; Tue, 13 Feb 2018 22:40:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DMeX65051793; Tue, 13 Feb 2018 22:40:33 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DMeX2m051789; Tue, 13 Feb 2018 22:40:33 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201802132240.w1DMeX2m051789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 13 Feb 2018 22:40:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329247 - stable/11/usr.sbin/kldxref X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.sbin/kldxref X-SVN-Commit-Revision: 329247 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 22:40:34 -0000 Author: emaste Date: Tue Feb 13 22:40:33 2018 New Revision: 329247 URL: https://svnweb.freebsd.org/changeset/base/329247 Log: MFC r328052: kldxref: handle modules with md_cval at end of allocated secs Attempting to retrieve an md_cval string from a kernel module with kldxref would throw a offset error for modules created using lld, since this value would be placed at the end of all allocated sections. Add an ef_read_seg_string method to the ef interface, to allow reading strings of varying size without attempting to read beyond the segment's bounds. PR: 224875 Submitted by: Mitchell Horne Sponsored by: The FreeBSD Foundation Modified: stable/11/usr.sbin/kldxref/ef.c stable/11/usr.sbin/kldxref/ef.h stable/11/usr.sbin/kldxref/ef_obj.c stable/11/usr.sbin/kldxref/kldxref.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/kldxref/ef.c ============================================================================== --- stable/11/usr.sbin/kldxref/ef.c Tue Feb 13 22:37:54 2018 (r329246) +++ stable/11/usr.sbin/kldxref/ef.c Tue Feb 13 22:40:33 2018 (r329247) @@ -88,6 +88,8 @@ static int ef_read_entry(elf_file_t ef, Elf_Off offset static int ef_seg_read(elf_file_t ef, Elf_Off offset, size_t len, void *dest); static int ef_seg_read_rel(elf_file_t ef, Elf_Off offset, size_t len, void *dest); +static int ef_seg_read_string(elf_file_t ef, Elf_Off offset, size_t len, + char *dest); static int ef_seg_read_entry(elf_file_t ef, Elf_Off offset, size_t len, void **ptr); static int ef_seg_read_entry_rel(elf_file_t ef, Elf_Off offset, size_t len, @@ -104,6 +106,7 @@ static struct elf_file_ops ef_file_ops = { ef_read_entry, ef_seg_read, ef_seg_read_rel, + ef_seg_read_string, ef_seg_read_entry, ef_seg_read_entry_rel, ef_symaddr, @@ -492,6 +495,28 @@ ef_seg_read_rel(elf_file_t ef, Elf_Off offset, size_t if (error != 0) return (error); } + return (0); +} + +static int +ef_seg_read_string(elf_file_t ef, Elf_Off offset, size_t len, char *dest) +{ + u_long ofs = ef_get_offset(ef, offset); + ssize_t r; + + if (ofs == 0 || ofs == (Elf_Off)-1) { + if (ef->ef_verbose) + warnx("ef_seg_read_string(%s): bad offset (%lx:%ld)", + ef->ef_name, (long)offset, ofs); + return (EFAULT); + } + + r = pread(ef->ef_fd, dest, len, ofs); + if (r < 0) + return (errno); + if (strnlen(dest, len) == len) + return (EFAULT); + return (0); } Modified: stable/11/usr.sbin/kldxref/ef.h ============================================================================== --- stable/11/usr.sbin/kldxref/ef.h Tue Feb 13 22:37:54 2018 (r329246) +++ stable/11/usr.sbin/kldxref/ef.h Tue Feb 13 22:40:33 2018 (r329247) @@ -21,6 +21,8 @@ (ef)->ef_ops->seg_read((ef)->ef_ef, offset, len, dest) #define EF_SEG_READ_REL(ef, offset, len, dest) \ (ef)->ef_ops->seg_read_rel((ef)->ef_ef, offset, len, dest) +#define EF_SEG_READ_STRING(ef, offset, len, dest) \ + (ef)->ef_ops->seg_read_string((ef)->ef_ef, offset, len, dest) #define EF_SEG_READ_ENTRY(ef, offset, len, ptr) \ (ef)->ef_ops->seg_read_entry((ef)->kf_ef, offset, len, ptr) #define EF_SEG_READ_ENTRY_REL(ef, offset, len, ptr) \ @@ -44,6 +46,8 @@ struct elf_file_ops { int (*seg_read)(elf_file_t ef, Elf_Off offset, size_t len, void *dest); int (*seg_read_rel)(elf_file_t ef, Elf_Off offset, size_t len, void *dest); + int (*seg_read_string)(elf_file_t, Elf_Off offset, size_t len, + char *dest); int (*seg_read_entry)(elf_file_t ef, Elf_Off offset, size_t len, void**ptr); int (*seg_read_entry_rel)(elf_file_t ef, Elf_Off offset, size_t len, Modified: stable/11/usr.sbin/kldxref/ef_obj.c ============================================================================== --- stable/11/usr.sbin/kldxref/ef_obj.c Tue Feb 13 22:37:54 2018 (r329246) +++ stable/11/usr.sbin/kldxref/ef_obj.c Tue Feb 13 22:40:33 2018 (r329247) @@ -108,6 +108,8 @@ static int ef_obj_seg_read(elf_file_t ef, Elf_Off offs void *dest); static int ef_obj_seg_read_rel(elf_file_t ef, Elf_Off offset, size_t len, void *dest); +static int ef_obj_seg_read_string(elf_file_t ef, Elf_Off offset, size_t len, + char *dest); static int ef_obj_seg_read_entry(elf_file_t ef, Elf_Off offset, size_t len, void **ptr); static int ef_obj_seg_read_entry_rel(elf_file_t ef, Elf_Off offset, size_t len, @@ -124,6 +126,7 @@ static struct elf_file_ops ef_obj_file_ops = { ef_obj_read_entry, ef_obj_seg_read, ef_obj_seg_read_rel, + ef_obj_seg_read_string, ef_obj_seg_read_entry, ef_obj_seg_read_entry_rel, ef_obj_symaddr, @@ -293,6 +296,27 @@ ef_obj_seg_read_rel(elf_file_t ef, Elf_Off offset, siz return (error); } } + return (0); +} + +static int +ef_obj_seg_read_string(elf_file_t ef, Elf_Off offset, size_t len, char *dest) +{ + + if (offset >= ef->size) { + if (ef->ef_verbose) + warnx("ef_obj_seg_read_string(%s): bad offset (%lx)", + ef->ef_name, (long)offset); + return (EFAULT); + } + + if (ef->size - offset < len) + len = ef->size - offset; + + if (strnlen(ef->address + offset, len) == len) + return (EFAULT); + + memcpy(dest, ef->address + offset, len); return (0); } Modified: stable/11/usr.sbin/kldxref/kldxref.c ============================================================================== --- stable/11/usr.sbin/kldxref/kldxref.c Tue Feb 13 22:37:54 2018 (r329246) +++ stable/11/usr.sbin/kldxref/kldxref.c Tue Feb 13 22:40:33 2018 (r329247) @@ -569,9 +569,8 @@ read_kld(char *filename, char *kldname) check(EF_SEG_READ_REL(&ef, (Elf_Off)*p, sizeof(md), &md)); p++; - check(EF_SEG_READ(&ef, (Elf_Off)md.md_cval, + check(EF_SEG_READ_STRING(&ef, (Elf_Off)md.md_cval, sizeof(cval), cval)); - cval[MAXMODNAME] = '\0'; parse_entry(&md, cval, &ef, kldname); } if (error) From owner-svn-src-stable-11@freebsd.org Tue Feb 13 22:43:09 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6B80F07BA9; Tue, 13 Feb 2018 22:43:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 98731765BB; Tue, 13 Feb 2018 22:43:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93589271CD; Tue, 13 Feb 2018 22:43:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DMh8kc054407; Tue, 13 Feb 2018 22:43:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DMh7IY054400; Tue, 13 Feb 2018 22:43:07 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201802132243.w1DMh7IY054400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 13 Feb 2018 22:43:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329249 - in stable/11: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety cddl/contrib/opensolaris/lib/libdtrace/common cddl/usr.sbin/dtrace/tests/common/safety cddl/usr.sbin/d... X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety cddl/contrib/opensolaris/lib/libdtrace/common cddl/usr.sbin/dtrace/tests/common/safety cddl/usr.sbin/dtrace/tests/tools sys/cdd... X-SVN-Commit-Revision: 329249 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 22:43:09 -0000 Author: markj Date: Tue Feb 13 22:43:07 2018 New Revision: 329249 URL: https://svnweb.freebsd.org/changeset/base/329249 Log: MFC r327888, r327972, r327973: Add "jid" and "jailname" variables to DTrace. Added: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d - copied unchanged from r327888, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d - copied unchanged from r327888, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c stable/11/cddl/usr.sbin/dtrace/tests/common/safety/Makefile stable/11/cddl/usr.sbin/dtrace/tests/tools/exclude.sh stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Directory Properties: stable/11/ (props changed) Copied: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d (from r327888, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d Tue Feb 13 22:43:07 2018 (r329249, copy of r327888, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jailname.d) @@ -0,0 +1,44 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2018 Domagoj Stolfa . + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * ASSERTION: + * collect jailname at every fbt probe and at every firing of a + * high-frequency profile probe + */ + +fbt::: +{ + @a[jailname] = count(); +} + +profile-4999hz +{ + @a[jailname] = count(); +} + +tick-1sec +/n++ == 10/ +{ + exit(0); +} Copied: stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d (from r327888, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d Tue Feb 13 22:43:07 2018 (r329249, copy of r327888, head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.jid.d) @@ -0,0 +1,44 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2018 Domagoj Stolfa . + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * ASSERTION: + * collect jid at every fbt probe and at every firing of a + * high-frequency profile probe + */ + +fbt::: +{ + @a[jid] = count(); +} + +profile-4999hz +{ + @a[jid] = count(); +} + +tick-1sec +/n++ == 10/ +{ + exit(0); +} Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Tue Feb 13 22:42:25 2018 (r329248) +++ stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Tue Feb 13 22:43:07 2018 (r329249) @@ -311,6 +311,12 @@ static const dt_ident_t _dtrace_globals[] = { DT_VERS_1_5, &dt_idops_func, "string(int, void *)" }, { "ipl", DT_IDENT_SCALAR, 0, DIF_VAR_IPL, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "uint_t" }, +#ifdef __FreeBSD__ +{ "jailname", DT_IDENT_SCALAR, 0, DIF_VAR_JAILNAME, + DT_ATTR_STABCMN, DT_VERS_1_13, &dt_idops_type, "string" }, +{ "jid", DT_IDENT_SCALAR, 0, DIF_VAR_JID, DT_ATTR_STABCMN, DT_VERS_1_13, + &dt_idops_type, "int" }, +#endif { "json", DT_IDENT_FUNC, 0, DIF_SUBR_JSON, DT_ATTR_STABCMN, DT_VERS_1_11, &dt_idops_func, "string(const char *, const char *)" }, { "jstack", DT_IDENT_ACTFUNC, 0, DT_ACT_JSTACK, DT_ATTR_STABCMN, DT_VERS_1_0, @@ -530,10 +536,8 @@ static const dt_ident_t _dtrace_globals[] = { { "walltimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_WALLTIMESTAMP, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "int64_t" }, -#ifdef illumos { "zonename", DT_IDENT_SCALAR, 0, DIF_VAR_ZONENAME, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" }, -#endif #ifndef illumos { "cpu", DT_IDENT_SCALAR, 0, DIF_VAR_CPU, Modified: stable/11/cddl/usr.sbin/dtrace/tests/common/safety/Makefile ============================================================================== --- stable/11/cddl/usr.sbin/dtrace/tests/common/safety/Makefile Tue Feb 13 22:42:25 2018 (r329248) +++ stable/11/cddl/usr.sbin/dtrace/tests/common/safety/Makefile Tue Feb 13 22:43:07 2018 (r329249) @@ -19,6 +19,8 @@ ${PACKAGE}FILES= \ tst.gid.d \ tst.hton.d \ tst.index.d \ + tst.jailname.d \ + tst.jid.d \ tst.msgdsize.d \ tst.msgsize.d \ tst.null.d \ Modified: stable/11/cddl/usr.sbin/dtrace/tests/tools/exclude.sh ============================================================================== --- stable/11/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Tue Feb 13 22:42:25 2018 (r329248) +++ stable/11/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Tue Feb 13 22:43:07 2018 (r329249) @@ -41,7 +41,6 @@ exclude EXFAIL common/misc/tst.include.ksh exclude EXFAIL common/safety/tst.copyin2.d exclude EXFAIL common/safety/tst.msgdsize.d exclude EXFAIL common/safety/tst.msgsize.d -exclude EXFAIL common/safety/tst.zonename.d exclude EXFAIL common/scalars/tst.misc.d exclude EXFAIL common/scalars/tst.selfarray2.d exclude EXFAIL common/sched/tst.enqueue.d Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Feb 13 22:42:25 2018 (r329248) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Feb 13 22:43:07 2018 (r329249) @@ -3537,6 +3537,24 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_st return (dtrace_dif_varstr( (uintptr_t)curthread->t_procp->p_zone->zone_name, state, mstate)); +#elif defined(__FreeBSD__) + /* + * On FreeBSD, we introduce compatibility to zonename by falling through + * into jailname. + */ + case DIF_VAR_JAILNAME: + if (!dtrace_priv_kernel(state)) + return (0); + + return (dtrace_dif_varstr( + (uintptr_t)curthread->td_ucred->cr_prison->pr_name, + state, mstate)); + + case DIF_VAR_JID: + if (!dtrace_priv_kernel(state)) + return (0); + + return ((uint64_t)curthread->td_ucred->cr_prison->pr_id); #else return (0); #endif Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Tue Feb 13 22:42:25 2018 (r329248) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Tue Feb 13 22:43:07 2018 (r329249) @@ -254,6 +254,8 @@ typedef enum dtrace_probespec { #define DIF_VAR_GID 0x011f /* process group ID */ #define DIF_VAR_ERRNO 0x0120 /* thread errno */ #define DIF_VAR_EXECARGS 0x0121 /* process arguments */ +#define DIF_VAR_JID 0x0122 /* process jail id */ +#define DIF_VAR_JAILNAME 0x0123 /* process jail name */ #ifndef illumos #define DIF_VAR_CPU 0x0200 From owner-svn-src-stable-11@freebsd.org Wed Feb 14 00:31:38 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 655A8F0FDD1; Wed, 14 Feb 2018 00:31:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 17EC07ABA7; Wed, 14 Feb 2018 00:31:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 129AE2E0; Wed, 14 Feb 2018 00:31:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1E0VbRA009300; Wed, 14 Feb 2018 00:31:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1E0VbCg009299; Wed, 14 Feb 2018 00:31:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201802140031.w1E0VbCg009299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 14 Feb 2018 00:31:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329253 - stable/11/usr.bin/sort X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/usr.bin/sort X-SVN-Commit-Revision: 329253 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Feb 2018 00:31:38 -0000 Author: markj Date: Wed Feb 14 00:31:37 2018 New Revision: 329253 URL: https://svnweb.freebsd.org/changeset/base/329253 Log: MFC r312667 (by pfg): sort - Don't live-loop threads. Modified: stable/11/usr.bin/sort/radixsort.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/sort/radixsort.c ============================================================================== --- stable/11/usr.bin/sort/radixsort.c Wed Feb 14 00:25:18 2018 (r329252) +++ stable/11/usr.bin/sort/radixsort.c Wed Feb 14 00:31:37 2018 (r329253) @@ -83,12 +83,12 @@ static struct level_stack *g_ls; #if defined(SORT_THREADS) /* stack guarding mutex */ +static pthread_cond_t g_ls_cond; static pthread_mutex_t g_ls_mutex; /* counter: how many items are left */ static size_t sort_left; /* guarding mutex */ -static pthread_mutex_t sort_left_mutex; /* semaphore to count threads */ static sem_t mtsem; @@ -99,23 +99,25 @@ static sem_t mtsem; static inline void sort_left_dec(size_t n) { - - pthread_mutex_lock(&sort_left_mutex); + pthread_mutex_lock(&g_ls_mutex); sort_left -= n; - pthread_mutex_unlock(&sort_left_mutex); + if (sort_left == 0 && nthreads > 1) + pthread_cond_broadcast(&g_ls_cond); + pthread_mutex_unlock(&g_ls_mutex); } /* * Do we have something to sort ? + * + * This routine does not need to be locked. */ static inline bool have_sort_left(void) { bool ret; - pthread_mutex_lock(&sort_left_mutex); ret = (sort_left > 0); - pthread_mutex_unlock(&sort_left_mutex); + return (ret); } @@ -146,6 +148,11 @@ push_ls(struct sort_level *sl) #if defined(SORT_THREADS) if (nthreads > 1) + pthread_cond_signal(&g_ls_cond); +#endif + +#if defined(SORT_THREADS) + if (nthreads > 1) pthread_mutex_unlock(&g_ls_mutex); #endif } @@ -184,13 +191,19 @@ pop_ls_mt(void) pthread_mutex_lock(&g_ls_mutex); - if (g_ls) { - sl = g_ls->sl; - saved_ls = g_ls; - g_ls = g_ls->next; - } else { + for (;;) { + if (g_ls) { + sl = g_ls->sl; + saved_ls = g_ls; + g_ls = g_ls->next; + break; + } sl = NULL; saved_ls = NULL; + + if (have_sort_left() == 0) + break; + pthread_cond_wait(&g_ls_cond, &g_ls_mutex); } pthread_mutex_unlock(&g_ls_mutex); @@ -495,13 +508,8 @@ run_sort_cycle_mt(void) for (;;) { slc = pop_ls_mt(); - if (slc == NULL) { - if (have_sort_left()) { - pthread_yield(); - continue; - } + if (slc == NULL) break; - } run_sort_level_next(slc); } } @@ -512,9 +520,7 @@ run_sort_cycle_mt(void) static void* sort_thread(void* arg) { - run_sort_cycle_mt(); - sem_post(&mtsem); return (arg); @@ -610,8 +616,7 @@ run_top_sort_level(struct sort_level *sl) pthread_t pth; pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, - PTHREAD_DETACHED); + pthread_attr_setdetachstate(&attr, PTHREAD_DETACHED); for (;;) { int res = pthread_create(&pth, &attr, @@ -628,7 +633,7 @@ run_top_sort_level(struct sort_level *sl) pthread_attr_destroy(&attr); } - for(i = 0; i < nthreads; ++i) + for (i = 0; i < nthreads; ++i) sem_wait(&mtsem); } #endif /* defined(SORT_THREADS) */ @@ -651,7 +656,7 @@ run_sort(struct sort_list_item **base, size_t nmemb) pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_ADAPTIVE_NP); pthread_mutex_init(&g_ls_mutex, &mattr); - pthread_mutex_init(&sort_left_mutex, &mattr); + pthread_cond_init(&g_ls_cond, NULL); pthread_mutexattr_destroy(&mattr); @@ -679,7 +684,6 @@ run_sort(struct sort_list_item **base, size_t nmemb) if (nthreads > 1) { sem_destroy(&mtsem); pthread_mutex_destroy(&g_ls_mutex); - pthread_mutex_destroy(&sort_left_mutex); } nthreads = nthreads_save; #endif From owner-svn-src-stable-11@freebsd.org Wed Feb 14 00:32:20 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAFBCF10059; Wed, 14 Feb 2018 00:32:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C0E97AF87; Wed, 14 Feb 2018 00:32:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46F51417; Wed, 14 Feb 2018 00:32:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1E0WK0S009440; Wed, 14 Feb 2018 00:32:20 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1E0WKKl009439; Wed, 14 Feb 2018 00:32:20 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201802140032.w1E0WKKl009439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 14 Feb 2018 00:32:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329255 - stable/11/usr.bin/sort X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/usr.bin/sort X-SVN-Commit-Revision: 329255 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Feb 2018 00:32:20 -0000 Author: markj Date: Wed Feb 14 00:32:19 2018 New Revision: 329255 URL: https://svnweb.freebsd.org/changeset/base/329255 Log: MFC r328995: Fix the WITH_SORT_THREADS build. PR: 201664 Modified: stable/11/usr.bin/sort/radixsort.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/sort/radixsort.c ============================================================================== --- stable/11/usr.bin/sort/radixsort.c Wed Feb 14 00:31:45 2018 (r329254) +++ stable/11/usr.bin/sort/radixsort.c Wed Feb 14 00:32:19 2018 (r329255) @@ -127,6 +127,14 @@ have_sort_left(void) #endif /* SORT_THREADS */ +static void +_push_ls(struct level_stack *ls) +{ + + ls->next = g_ls; + g_ls = ls; +} + /* * Push sort level to the stack */ @@ -139,22 +147,14 @@ push_ls(struct sort_level *sl) new_ls->sl = sl; #if defined(SORT_THREADS) - if (nthreads > 1) + if (nthreads > 1) { pthread_mutex_lock(&g_ls_mutex); -#endif - - new_ls->next = g_ls; - g_ls = new_ls; - -#if defined(SORT_THREADS) - if (nthreads > 1) + _push_ls(new_ls); pthread_cond_signal(&g_ls_cond); -#endif - -#if defined(SORT_THREADS) - if (nthreads > 1) pthread_mutex_unlock(&g_ls_mutex); + } else #endif + _push_ls(new_ls); } /* From owner-svn-src-stable-11@freebsd.org Wed Feb 14 06:19:15 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE2A8F03D76; Wed, 14 Feb 2018 06:19:15 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-io0-x241.google.com (mail-io0-x241.google.com [IPv6:2607:f8b0:4001:c06::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 539398627B; Wed, 14 Feb 2018 06:19:15 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-io0-x241.google.com with SMTP id d13so23978851iog.5; Tue, 13 Feb 2018 22:19:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Q24D08PLB+VMpZdmFuKySDriX7hpl1Mr9E4ht/thHsc=; b=jQ8eg59ImzXq+oZfzWBp7SO84QQyE3jnrdzGILjOQ1W8W+c5ajo8yhJhOqqEMyeMFg vnqYyRCQn8IDHviUefU+9HFvnLHVWTa1T0atgVcH4/B2oboU9ml4RnEevWQZBINX6LbI JiZCWfuaaPDPJ7I4QJaygyslmYzvFfsCPoV8aLrPj8AwyhQsUlT74IBFSGdbZP3kY+FM SGIva3kT47T0jPYgQ0O7TYLeFn3r4W09vRsz27U3vN0G4sZa7H9Ch35cfcQiV0y3Uiu1 mc5GNxdaoKLVAlo8xav3ShlBlWI8g29yKkLvQtAwRVvpR+bEPOP7jNqnkZtiKlprX20d A1bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Q24D08PLB+VMpZdmFuKySDriX7hpl1Mr9E4ht/thHsc=; b=K+zhqF1SZv8dzpFmJAdkYB0hlIR9Xhl949otAwgqjeiJh8ryu+8HdoVwGuXjVnHgoj kcAoqtozPkysipX6ZFj5GQaBtFCGoWCvqgLe+8r3EswqVN6G6Wng1yQffFnn67cGTYwO t2WZkg/7fPcPmButa9po/oobUgwtV79KPluiL57AqU/RVMz9Sw4GnvjJri+ZjXSJqoi6 /6ttHEZI9CYvWs5Q7OFCvIzU8fwS1T7Sp4GsgsyEtbs2OKOu9gbvbgHUBp5oLSdBwKA+ Hm+virIp1puLJ2gKwGsBRhheEy3Gph0Bmv2ZtsHL1aYIqJFlb1vc+j/Ce4EPheGXriv3 2fCA== X-Gm-Message-State: APf1xPDFwfsDXzM6bSxADFRQkhSTiMTBDyaEU1CTrgrcCtFDSBwCtN+q LT3sMihXgO80EYYvWYZY4oIXDd2OCOip4tZN71J1UA== X-Google-Smtp-Source: AH8x226uL80RZv+09Ci2dy0sgMQAjj2WlokincCACt/02L1lU6yLXGCUc4cLGjrBDhgllIbYQHW2x/uJrfO1wPyi08A= X-Received: by 10.107.27.19 with SMTP id b19mr4322851iob.202.1518589154550; Tue, 13 Feb 2018 22:19:14 -0800 (PST) MIME-Version: 1.0 Sender: antoine.brodin.freebsd@gmail.com Received: by 10.107.143.86 with HTTP; Tue, 13 Feb 2018 22:19:14 -0800 (PST) In-Reply-To: <201802132243.w1DMh7IY054400@repo.freebsd.org> References: <201802132243.w1DMh7IY054400@repo.freebsd.org> From: Antoine Brodin Date: Wed, 14 Feb 2018 07:19:14 +0100 X-Google-Sender-Auth: 6rDv9OxtqGB8_HhB8lx3NR8ah3Y Message-ID: Subject: Re: svn commit: r329249 - in stable/11: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety cddl/contrib/opensolaris/lib/libdtrace/common cddl/usr.sbin/dtrace/tests/common/safety cddl/usr.sbin/d... To: Mark Johnston Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Feb 2018 06:19:16 -0000 On Tue, Feb 13, 2018 at 11:43 PM, Mark Johnston wrote: > Author: markj > Date: Tue Feb 13 22:43:07 2018 > New Revision: 329249 > URL: https://svnweb.freebsd.org/changeset/base/329249 > > Log: > MFC r327888, r327972, r327973: > Add "jid" and "jailname" variables to DTrace. > Hi, stable/11 fails to build: /poudriere/jails/11stable-amd64/usr/src/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c:316:19: error: use of undeclared identifier 'DT_VERS_1_13' DT_ATTR_STABCMN, DT_VERS_1_13, &dt_idops_type, "string" }, ^ /poudriere/jails/11stable-amd64/usr/src/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c:317:60: error: use of undeclared identifier 'DT_VERS_1_13' { "jid", DT_IDENT_SCALAR, 0, DIF_VAR_JID, DT_ATTR_STABCMN, DT_VERS_1_13, ^ 2 errors generated. Antoine From owner-svn-src-stable-11@freebsd.org Wed Feb 14 09:53:24 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34F1FF12402; Wed, 14 Feb 2018 09:53:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB4D36E312; Wed, 14 Feb 2018 09:53:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D64D7639A; Wed, 14 Feb 2018 09:53:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1E9rN1T087408; Wed, 14 Feb 2018 09:53:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1E9rNQx087407; Wed, 14 Feb 2018 09:53:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802140953.w1E9rNQx087407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 14 Feb 2018 09:53:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329260 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 329260 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Feb 2018 09:53:24 -0000 Author: hselasky Date: Wed Feb 14 09:53:23 2018 New Revision: 329260 URL: https://svnweb.freebsd.org/changeset/base/329260 Log: MFC r328971: Fix implementation of ktime_add_ns() and ktime_sub_ns() in the LinuxKPI to actually return the computed result instead of the input value. This is a regression issue after r289572. Found by: gcc6 Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h Wed Feb 14 07:59:30 2018 (r329259) +++ stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h Wed Feb 14 09:53:23 2018 (r329260) @@ -88,18 +88,14 @@ ktime_to_timeval(ktime_t kt) static inline ktime_t ktime_add_ns(ktime_t kt, int64_t ns) { - ktime_t res; - - res.tv64 = kt.tv64 + ns; + kt.tv64 += ns; return kt; } static inline ktime_t ktime_sub_ns(ktime_t kt, int64_t ns) { - ktime_t res; - - res.tv64 = kt.tv64 - ns; + kt.tv64 -= ns; return kt; } From owner-svn-src-stable-11@freebsd.org Wed Feb 14 14:29:12 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B325F02FFC; Wed, 14 Feb 2018 14:29:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 171887AA54; Wed, 14 Feb 2018 14:29:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11E6B10FD6; Wed, 14 Feb 2018 14:29:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1EETB6G024834; Wed, 14 Feb 2018 14:29:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1EETBvS024833; Wed, 14 Feb 2018 14:29:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201802141429.w1EETBvS024833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 14 Feb 2018 14:29:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329261 - stable/11/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Commit-Revision: 329261 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Feb 2018 14:29:12 -0000 Author: markj Date: Wed Feb 14 14:29:11 2018 New Revision: 329261 URL: https://svnweb.freebsd.org/changeset/base/329261 Log: Add DT_VERS_1_13 to libdtrace to unbreak the build. This is a direct commit to stable/11. PR: 225889 Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Modified: stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Wed Feb 14 09:53:23 2018 (r329260) +++ stable/11/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Wed Feb 14 14:29:11 2018 (r329261) @@ -130,8 +130,9 @@ #define DT_VERS_1_11 DT_VERSION_NUMBER(1, 11, 0) #define DT_VERS_1_12 DT_VERSION_NUMBER(1, 12, 0) #define DT_VERS_1_12_1 DT_VERSION_NUMBER(1, 12, 1) -#define DT_VERS_LATEST DT_VERS_1_12_1 -#define DT_VERS_STRING "Sun D 1.12.1" +#define DT_VERS_1_13 DT_VERSION_NUMBER(1, 13, 0) +#define DT_VERS_LATEST DT_VERS_1_13 +#define DT_VERS_STRING "Sun D 1.13" const dt_version_t _dtrace_versions[] = { DT_VERS_1_0, /* D API 1.0.0 (PSARC 2001/466) Solaris 10 FCS */ @@ -157,6 +158,7 @@ const dt_version_t _dtrace_versions[] = { DT_VERS_1_11, /* D API 1.11 */ DT_VERS_1_12, /* D API 1.12 */ DT_VERS_1_12_1, /* D API 1.12.1 */ + DT_VERS_1_13, /* D API 1.13 */ 0 }; From owner-svn-src-stable-11@freebsd.org Wed Feb 14 14:31:03 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F38D1F03282; Wed, 14 Feb 2018 14:31:02 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-io0-x22c.google.com (mail-io0-x22c.google.com [IPv6:2607:f8b0:4001:c06::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 82EFD7AE4A; Wed, 14 Feb 2018 14:31:02 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-io0-x22c.google.com with SMTP id t126so2071786iof.4; Wed, 14 Feb 2018 06:31:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=luITXd1n8lHtl8ERjdk7KLbprRxmDD6LbrBitvG3ZPk=; b=P1uxrXn0o5rHcMxRIctwaBxuLr/UUNaJRKiDKZTfkOqIiA9Z0EnEFuMpaGLyWz88+B 9nVnZ9YTMakS0nBE/ehitfERhOIDOPIEs22ZBbZL9YZ0uO5JM1X9w4rTNJmcQmIWBdUr UsbwiF0dJBjj5ZynOcOa6e7uh1V0C4BBP9uUOtNMlj6Pr0Z0YxZA/1qDg+iLIEwuoi2P 0OlWYSXfVa2V9ReGoGw5ggbr/CvUiPesF3Rb3OuXxkuKqcNtdNUpJy+lX2ugCwzf0pS6 gT1chCvQwgNmTSIhx5WuF6cn5itAEQ5Un9QFetqDVJawpXjGV9GNCXCs6hoScsF67VN8 RIgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=luITXd1n8lHtl8ERjdk7KLbprRxmDD6LbrBitvG3ZPk=; b=bKSoV9AHpPyaxUHUhFCbUpHqtVtjqtb/Pt4uoJATkHkZjE/pSGNH3DjThGsviB2hqr 9OMMpeZ3h+w7/RW0JTIaOv44ceMZZ5HoHvOcEp9KvlZ8qFlsrZ+TRpWYxpcPTyQqHL01 05URdjEJurq/Lr41KZ2/CNKb5/T+nG+S978Vd9b6J2UH9lsTGzrg539dNAtYNEdEdsDA gmoro8tY0CIpvNh4uRXeCPe2M2WubTfEQ3++0baX+kezL7n6Dk5vbmj7S1Gkc+ewyNWr JfLVhWF3ZEdJB+KYb0N3ry9gpd0alkNCGyorVkexrDOWL34Cv9KjgrU+SxBW6w+s9Afm /aRA== X-Gm-Message-State: APf1xPDBP/TLhNZyfniEfkCabVLj7sLiVwWuCmzAwHc5kE63/cYahfPT H8RRQuUW7FGRtjQJXby/fsMR8Rud X-Google-Smtp-Source: AH8x226lCAjGgMvtsVrE5muBhcVU4JqreTM4k6NBJxGtJRr1B9B36kd5di6yJ8eBdyrziMJQWY47Ww== X-Received: by 10.107.165.19 with SMTP id o19mr5445915ioe.87.1518618661002; Wed, 14 Feb 2018 06:31:01 -0800 (PST) Received: from raichu (toroon0560w-lp130-01-174-88-76-226.dsl.bell.ca. [174.88.76.226]) by smtp.gmail.com with ESMTPSA id b72sm8632096iob.50.2018.02.14.06.30.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Feb 2018 06:30:59 -0800 (PST) Sender: Mark Johnston Date: Wed, 14 Feb 2018 09:30:57 -0500 From: Mark Johnston To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r329249 - in stable/11: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety cddl/contrib/opensolaris/lib/libdtrace/common cddl/usr.sbin/dtrace/tests/common/safety cddl/usr.sbin/d... Message-ID: <20180214143057.GB17626@raichu> References: <201802132243.w1DMh7IY054400@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Feb 2018 14:31:03 -0000 On Wed, Feb 14, 2018 at 07:19:14AM +0100, Antoine Brodin wrote: > On Tue, Feb 13, 2018 at 11:43 PM, Mark Johnston wrote: > > Author: markj > > Date: Tue Feb 13 22:43:07 2018 > > New Revision: 329249 > > URL: https://svnweb.freebsd.org/changeset/base/329249 > > > > Log: > > MFC r327888, r327972, r327973: > > Add "jid" and "jailname" variables to DTrace. > > > > Hi, > > stable/11 fails to build: > > /poudriere/jails/11stable-amd64/usr/src/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c:316:19: > error: use of undeclared identifier 'DT_VERS_1_13' > DT_ATTR_STABCMN, DT_VERS_1_13, &dt_idops_type, "string" }, > ^ > /poudriere/jails/11stable-amd64/usr/src/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c:317:60: > error: use of undeclared identifier 'DT_VERS_1_13' > { "jid", DT_IDENT_SCALAR, 0, DIF_VAR_JID, DT_ATTR_STABCMN, DT_VERS_1_13, > ^ > 2 errors generated. This should be fixed now. My apologies for the breakage. From owner-svn-src-stable-11@freebsd.org Wed Feb 14 15:14:21 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D813AF0634C; Wed, 14 Feb 2018 15:14:20 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8972A7D105; Wed, 14 Feb 2018 15:14:20 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84535117F6; Wed, 14 Feb 2018 15:14:20 +0000 (UTC) (envelope-from skra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1EFEK5j049711; Wed, 14 Feb 2018 15:14:20 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1EFEKxg049710; Wed, 14 Feb 2018 15:14:20 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201802141514.w1EFEKxg049710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus Date: Wed, 14 Feb 2018 15:14:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329263 - stable/11/sys/arm/arm X-SVN-Group: stable-11 X-SVN-Commit-Author: skra X-SVN-Commit-Paths: stable/11/sys/arm/arm X-SVN-Commit-Revision: 329263 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Feb 2018 15:14:21 -0000 Author: skra Date: Wed Feb 14 15:14:20 2018 New Revision: 329263 URL: https://svnweb.freebsd.org/changeset/base/329263 Log: MFC r325321: Take into account race conditions in case of accessed or modified bit emulation in fast path of data/prefetch abort common routine. Process these bits only if related page table entries are consistent with provided abort info. In case of inconsistency, do nothing and let processor to signal new abort if still needed. Modified: stable/11/sys/arm/arm/pmap-v6.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/pmap-v6.c ============================================================================== --- stable/11/sys/arm/arm/pmap-v6.c Wed Feb 14 15:12:09 2018 (r329262) +++ stable/11/sys/arm/arm/pmap-v6.c Wed Feb 14 15:14:20 2018 (r329263) @@ -6433,6 +6433,22 @@ pmap_fault(pmap_t pmap, vm_offset_t far, uint32_t fsr, */ PMAP_LOCK(pmap); +#ifdef INVARIANTS + pte1 = pte1_load(pmap_pte1(pmap, far)); + if (pte1_is_link(pte1)) { + /* + * Check in advance that associated L2 page table is mapped into + * PT2MAP space. Note that faulty access to not mapped L2 page + * table is caught in more general check above where "far" is + * checked that it does not lay in PT2MAP space. Note also that + * L1 page table and PT2TAB always exist and are mapped. + */ + pte2 = pt2tab_load(pmap_pt2tab_entry(pmap, far)); + if (!pte2_is_valid(pte2)) + panic("%s: missing L2 page table (%p, %#x)", + __func__, pmap, far); + } +#endif #ifdef SMP /* * Special treatment is due to break-before-make approach done when @@ -6453,10 +6469,23 @@ pmap_fault(pmap_t pmap, vm_offset_t far, uint32_t fsr, * for aborts from user mode. */ if (idx == FAULT_ACCESS_L2) { - pte2p = pt2map_entry(far); - pte2 = pte2_load(pte2p); - if (pte2_is_valid(pte2)) { - pte2_store(pte2p, pte2 | PTE2_A); + pte1 = pte1_load(pmap_pte1(pmap, far)); + if (pte1_is_link(pte1)) { + /* L2 page table should exist and be mapped. */ + pte2p = pt2map_entry(far); + pte2 = pte2_load(pte2p); + if (pte2_is_valid(pte2)) { + pte2_store(pte2p, pte2 | PTE2_A); + PMAP_UNLOCK(pmap); + return (KERN_SUCCESS); + } + } else { + /* + * We got L2 access fault but PTE1 is not a link. + * Probably some race happened, do nothing. + */ + CTR3(KTR_PMAP, "%s: FAULT_ACCESS_L2 - pmap %#x far %#x", + __func__, pmap, far); PMAP_UNLOCK(pmap); return (KERN_SUCCESS); } @@ -6468,6 +6497,15 @@ pmap_fault(pmap_t pmap, vm_offset_t far, uint32_t fsr, pte1_store(pte1p, pte1 | PTE1_A); PMAP_UNLOCK(pmap); return (KERN_SUCCESS); + } else { + /* + * We got L1 access fault but PTE1 is not section + * mapping. Probably some race happened, do nothing. + */ + CTR3(KTR_PMAP, "%s: FAULT_ACCESS_L1 - pmap %#x far %#x", + __func__, pmap, far); + PMAP_UNLOCK(pmap); + return (KERN_SUCCESS); } } @@ -6480,12 +6518,25 @@ pmap_fault(pmap_t pmap, vm_offset_t far, uint32_t fsr, * for aborts from user mode. */ if ((fsr & FSR_WNR) && (idx == FAULT_PERM_L2)) { - pte2p = pt2map_entry(far); - pte2 = pte2_load(pte2p); - if (pte2_is_valid(pte2) && !(pte2 & PTE2_RO) && - (pte2 & PTE2_NM)) { - pte2_store(pte2p, pte2 & ~PTE2_NM); - tlb_flush(trunc_page(far)); + pte1 = pte1_load(pmap_pte1(pmap, far)); + if (pte1_is_link(pte1)) { + /* L2 page table should exist and be mapped. */ + pte2p = pt2map_entry(far); + pte2 = pte2_load(pte2p); + if (pte2_is_valid(pte2) && !(pte2 & PTE2_RO) && + (pte2 & PTE2_NM)) { + pte2_store(pte2p, pte2 & ~PTE2_NM); + tlb_flush(trunc_page(far)); + PMAP_UNLOCK(pmap); + return (KERN_SUCCESS); + } + } else { + /* + * We got L2 permission fault but PTE1 is not a link. + * Probably some race happened, do nothing. + */ + CTR3(KTR_PMAP, "%s: FAULT_PERM_L2 - pmap %#x far %#x", + __func__, pmap, far); PMAP_UNLOCK(pmap); return (KERN_SUCCESS); } @@ -6493,10 +6544,20 @@ pmap_fault(pmap_t pmap, vm_offset_t far, uint32_t fsr, if ((fsr & FSR_WNR) && (idx == FAULT_PERM_L1)) { pte1p = pmap_pte1(pmap, far); pte1 = pte1_load(pte1p); - if (pte1_is_section(pte1) && !(pte1 & PTE1_RO) && - (pte1 & PTE1_NM)) { - pte1_store(pte1p, pte1 & ~PTE1_NM); - tlb_flush(pte1_trunc(far)); + if (pte1_is_section(pte1)) { + if (!(pte1 & PTE1_RO) && (pte1 & PTE1_NM)) { + pte1_store(pte1p, pte1 & ~PTE1_NM); + tlb_flush(pte1_trunc(far)); + PMAP_UNLOCK(pmap); + return (KERN_SUCCESS); + } + } else { + /* + * We got L1 permission fault but PTE1 is not section + * mapping. Probably some race happened, do nothing. + */ + CTR3(KTR_PMAP, "%s: FAULT_PERM_L1 - pmap %#x far %#x", + __func__, pmap, far); PMAP_UNLOCK(pmap); return (KERN_SUCCESS); } @@ -6507,33 +6568,6 @@ pmap_fault(pmap_t pmap, vm_offset_t far, uint32_t fsr, * modify bits aborts, could be moved to ASM. Now we are * starting to deal with not fast aborts. */ - -#ifdef INVARIANTS - /* - * Read an entry in PT2TAB associated with both pmap and far. - * It's safe because PT2TAB is always mapped. - */ - pte2 = pt2tab_load(pmap_pt2tab_entry(pmap, far)); - if (pte2_is_valid(pte2)) { - /* - * Now, when we know that L2 page table is allocated, - * we can use PT2MAP to get L2 page table entry. - */ - pte2 = pte2_load(pt2map_entry(far)); - if (pte2_is_valid(pte2)) { - /* - * If L2 page table entry is valid, make sure that - * L1 page table entry is valid too. Note that we - * leave L2 page entries untouched when promoted. - */ - pte1 = pte1_load(pmap_pte1(pmap, far)); - if (!pte1_is_valid(pte1)) { - panic("%s: missing L1 page entry (%p, %#x)", - __func__, pmap, far); - } - } - } -#endif PMAP_UNLOCK(pmap); return (KERN_FAILURE); } From owner-svn-src-stable-11@freebsd.org Wed Feb 14 20:01:40 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DCFEF1BC51; Wed, 14 Feb 2018 20:01:40 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EDAC76A43C; Wed, 14 Feb 2018 20:01:39 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8B2E14752; Wed, 14 Feb 2018 20:01:39 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1EK1dg0092028; Wed, 14 Feb 2018 20:01:39 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1EK1doJ092027; Wed, 14 Feb 2018 20:01:39 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201802142001.w1EK1doJ092027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 14 Feb 2018 20:01:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329272 - stable/11/sys/dev/spibus X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/11/sys/dev/spibus X-SVN-Commit-Revision: 329272 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Feb 2018 20:01:40 -0000 Author: gonzo Date: Wed Feb 14 20:01:39 2018 New Revision: 329272 URL: https://svnweb.freebsd.org/changeset/base/329272 Log: MFC r308895 by manu: Enable the use of spigen on FDT platform Modified: stable/11/sys/dev/spibus/spigen.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/spibus/spigen.c ============================================================================== --- stable/11/sys/dev/spibus/spigen.c Wed Feb 14 18:43:50 2018 (r329271) +++ stable/11/sys/dev/spibus/spigen.c Wed Feb 14 20:01:39 2018 (r329272) @@ -25,6 +25,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_platform.h" + #include #include #include @@ -65,6 +67,17 @@ struct spigen_softc { int sc_debug; }; +#ifdef FDT +static void +spigen_identify(driver_t *driver, device_t parent) +{ + if (device_find_child(parent, "spigen", -1) != NULL) + return; + if (BUS_ADD_CHILD(parent, 0, "spigen", -1) == NULL) + device_printf(parent, "add child failed\n"); +} +#endif + static int spigen_probe(device_t dev) { @@ -393,6 +406,9 @@ static devclass_t spigen_devclass; static device_method_t spigen_methods[] = { /* Device interface */ +#ifdef FDT + DEVMETHOD(device_identify, spigen_identify), +#endif DEVMETHOD(device_probe, spigen_probe), DEVMETHOD(device_attach, spigen_attach), DEVMETHOD(device_detach, spigen_detach), From owner-svn-src-stable-11@freebsd.org Wed Feb 14 21:14:30 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC815F20CBB; Wed, 14 Feb 2018 21:14:29 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A2C46D942; Wed, 14 Feb 2018 21:14:29 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8175A15316; Wed, 14 Feb 2018 21:14:29 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1ELETw4031186; Wed, 14 Feb 2018 21:14:29 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1ELETkO031184; Wed, 14 Feb 2018 21:14:29 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201802142114.w1ELETkO031184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 14 Feb 2018 21:14:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329278 - in stable/11/sys: dev/spibus modules modules/spigen X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in stable/11/sys: dev/spibus modules modules/spigen X-SVN-Commit-Revision: 329278 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Feb 2018 21:14:30 -0000 Author: gonzo Date: Wed Feb 14 21:14:28 2018 New Revision: 329278 URL: https://svnweb.freebsd.org/changeset/base/329278 Log: MFC r314933-r314934 r314933: [spigen] make spigen device ready to be compiled as a module - Add flag to indicate that device is opened by userland - Replace "always fail" detach method with proper detach implementation r314934: [spigen] Add spigen module spigen provides userland API to SPI bus. Make it available as a loadable module so people using official ARM images can enabled it on devices like BBB or RPi without re-building kernel Added: stable/11/sys/modules/spigen/ - copied from r314934, head/sys/modules/spigen/ Modified: stable/11/sys/dev/spibus/spigen.c stable/11/sys/modules/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/spibus/spigen.c ============================================================================== --- stable/11/sys/dev/spibus/spigen.c Wed Feb 14 21:02:38 2018 (r329277) +++ stable/11/sys/dev/spibus/spigen.c Wed Feb 14 21:14:28 2018 (r329278) @@ -53,6 +53,9 @@ __FBSDID("$FreeBSD$"); #include "spibus_if.h" +#define SPIGEN_OPEN (1 << 0) +#define SPIGEN_MMAP_BUSY (1 << 1) + struct spigen_softc { device_t sc_dev; struct cdev *sc_cdev; @@ -63,8 +66,8 @@ struct spigen_softc { vm_object_t sc_mmap_buffer; /* command, then data */ vm_offset_t sc_mmap_kvaddr; size_t sc_mmap_buffer_size; - int sc_mmap_busy; int sc_debug; + int sc_flags; }; #ifdef FDT @@ -191,10 +194,24 @@ spigen_attach(device_t dev) } static int -spigen_open(struct cdev *dev, int oflags, int devtype, struct thread *td) +spigen_open(struct cdev *cdev, int oflags, int devtype, struct thread *td) { + int error; + device_t dev; + struct spigen_softc *sc; - return (0); + error = 0; + dev = cdev->si_drv1; + sc = device_get_softc(dev); + + mtx_lock(&sc->sc_mtx); + if (sc->sc_flags & SPIGEN_OPEN) + error = EBUSY; + else + sc->sc_flags |= SPIGEN_OPEN; + mtx_unlock(&sc->sc_mtx); + + return (error); } static int @@ -264,7 +281,7 @@ spigen_transfer_mmapped(struct cdev *cdev, struct spig int error = 0; mtx_lock(&sc->sc_mtx); - if (sc->sc_mmap_busy) + if (sc->sc_flags & SPIGEN_MMAP_BUSY) error = EBUSY; else if (stm->stm_command_length > sc->sc_command_length_max || stm->stm_data_length > sc->sc_data_length_max) @@ -275,7 +292,7 @@ spigen_transfer_mmapped(struct cdev *cdev, struct spig stm->stm_command_length + stm->stm_data_length) error = ENOMEM; if (error == 0) - sc->sc_mmap_busy = 1; + sc->sc_flags |= SPIGEN_MMAP_BUSY; mtx_unlock(&sc->sc_mtx); if (error) return (error); @@ -288,8 +305,8 @@ spigen_transfer_mmapped(struct cdev *cdev, struct spig error = SPIBUS_TRANSFER(device_get_parent(dev), dev, &transfer); mtx_lock(&sc->sc_mtx); - KASSERT(sc->sc_mmap_busy, ("mmap no longer marked busy")); - sc->sc_mmap_busy = 0; + KASSERT((sc->sc_flags & SPIGEN_MMAP_BUSY), ("mmap no longer marked busy")); + sc->sc_flags &= ~(SPIGEN_MMAP_BUSY); mtx_unlock(&sc->sc_mtx); return (error); } @@ -391,6 +408,7 @@ spigen_close(struct cdev *cdev, int fflag, int devtype sc->sc_mmap_buffer = NULL; sc->sc_mmap_buffer_size = 0; } + sc->sc_flags &= ~(SPIGEN_OPEN); mtx_unlock(&sc->sc_mtx); return (0); } @@ -398,8 +416,23 @@ spigen_close(struct cdev *cdev, int fflag, int devtype static int spigen_detach(device_t dev) { + struct spigen_softc *sc; - return (EIO); + sc = device_get_softc(dev); + + mtx_lock(&sc->sc_mtx); + if (sc->sc_flags & SPIGEN_OPEN) { + mtx_unlock(&sc->sc_mtx); + return (EBUSY); + } + mtx_unlock(&sc->sc_mtx); + + mtx_destroy(&sc->sc_mtx); + + if (sc->sc_cdev) + destroy_dev(sc->sc_cdev); + + return (0); } static devclass_t spigen_devclass; Modified: stable/11/sys/modules/Makefile ============================================================================== --- stable/11/sys/modules/Makefile Wed Feb 14 21:02:38 2018 (r329277) +++ stable/11/sys/modules/Makefile Wed Feb 14 21:14:28 2018 (r329278) @@ -359,6 +359,7 @@ SUBDIR= \ snp \ sound \ ${_speaker} \ + spigen \ ${_splash} \ ${_sppp} \ ste \ From owner-svn-src-stable-11@freebsd.org Wed Feb 14 21:39:11 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C174F22AB0; Wed, 14 Feb 2018 21:39:11 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 224736EDC4; Wed, 14 Feb 2018 21:39:11 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 191031568A; Wed, 14 Feb 2018 21:39:11 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1ELdArD042365; Wed, 14 Feb 2018 21:39:10 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1ELdAHl042364; Wed, 14 Feb 2018 21:39:10 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201802142139.w1ELdAHl042364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 14 Feb 2018 21:39:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329280 - stable/11/sys/arm/arm X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/11/sys/arm/arm X-SVN-Commit-Revision: 329280 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Feb 2018 21:39:11 -0000 Author: gonzo Date: Wed Feb 14 21:39:10 2018 New Revision: 329280 URL: https://svnweb.freebsd.org/changeset/base/329280 Log: MFC r320387: [arm] Use correct index value when checking range validity Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D9145 Modified: stable/11/sys/arm/arm/gic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/gic.c ============================================================================== --- stable/11/sys/arm/arm/gic.c Wed Feb 14 21:17:44 2018 (r329279) +++ stable/11/sys/arm/arm/gic.c Wed Feb 14 21:39:10 2018 (r329280) @@ -1656,11 +1656,11 @@ arm_gicv2m_alloc_msi(device_t dev, device_t child, int break; } - KASSERT((psc->gic_irqs[irq].gi_flags & GI_FLAG_MSI)!= 0, + KASSERT((psc->gic_irqs[end_irq].gi_flags & GI_FLAG_MSI)!= 0, ("%s: Non-MSI interrupt found", __func__)); /* This is already used */ - if ((psc->gic_irqs[irq].gi_flags & GI_FLAG_MSI_USED) == + if ((psc->gic_irqs[end_irq].gi_flags & GI_FLAG_MSI_USED) == GI_FLAG_MSI_USED) { found = false; break; From owner-svn-src-stable-11@freebsd.org Wed Feb 14 23:51:45 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70161F076C2; Wed, 14 Feb 2018 23:51:45 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2151A740CB; Wed, 14 Feb 2018 23:51:45 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BC7216D3C; Wed, 14 Feb 2018 23:51:45 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1ENpij8009991; Wed, 14 Feb 2018 23:51:44 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1ENpi1u009989; Wed, 14 Feb 2018 23:51:44 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201802142351.w1ENpi1u009989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 14 Feb 2018 23:51:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329283 - in stable/11: share/man/man4 sys/dev/vt/colors X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/dev/vt/colors X-SVN-Commit-Revision: 329283 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Feb 2018 23:51:45 -0000 Author: gonzo Date: Wed Feb 14 23:51:44 2018 New Revision: 329283 URL: https://svnweb.freebsd.org/changeset/base/329283 Log: MFC r327444, r327449, r327454 r327444: vt(4): add support for configurable console palette Introduce new set of loader tunables kern.vt.color.N.rgb, where N is a number from 0 to 15. The value is either comma-separated list decimal numbers ranging from 0 to 255 that represent values of red, green, and blue components respectively (i.e. "128,128,128") or 6-digit hex triplet commonly used to represent colors in HTML or xterm settings (i.e. #808080) Each tunable overrides one of the 16 hardcoded palette codes and can be set in loader.conf(5) Reviewed by: bcr(docs), jilles, manu, ray Differential Revision: https://reviews.freebsd.org/D13645 r327449: Unbreak build broken by r327444 During review iterations function signature has changed in definition but not in actual call. Fix call to match the definition. Reported by: Herbert J. Skuhra Pointyhat to: gonzo r327454: Fix GCC build broken by r32744 Indicate in function declaration that vt_palette_init does not take any arguments Modified: stable/11/share/man/man4/vt.4 stable/11/sys/dev/vt/colors/vt_termcolors.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/vt.4 ============================================================================== --- stable/11/share/man/man4/vt.4 Wed Feb 14 23:47:04 2018 (r329282) +++ stable/11/share/man/man4/vt.4 Wed Feb 14 23:51:44 2018 (r329283) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 19, 2016 +.Dd December 28, 2017 .Dt "VT" 4 .Os .Sh NAME @@ -45,6 +45,7 @@ In .Xr loader.conf 5 : .Cd hw.vga.textmode=1 .Cd kern.vty=vt +.Cd kern.vt.color..rgb="" .Cd kern.vt.fb.default_mode="x" .Cd kern.vt.fb.modes.="x" .Pp @@ -205,6 +206,16 @@ If not set, the default in the .Pa GENERIC kernel is .Nm . +.It Va kern.vt.color. Ns Ar colornum Ns Va .rgb +Set this value to override default palette entry for color +.Pa colornum +which should be in a range from 0 to 15 inclusive. +The value should be either a comma-separated triplet of +red, green, and blue values in a range from 0 to 255 or +HTML-like hex triplet. +See +.Sx EXAMPLES +below. .It Va kern.vt.fb.default_mode Set this value to a graphic mode to override the default mode picked by the .Nm @@ -309,6 +320,11 @@ The connector name was found in .Dl info: [drm] Connector LVDS-1: get mode from tunables: .Dl info: [drm] - kern.vt.fb.modes.LVDS-1 .Dl info: [drm] - kern.vt.fb.default_mode +.Pp +To set black and white colors of console palette +.Pp +.Dl kern.vt.color.0.rgb="10,10,10" +.Dl kern.vt.color.15.rgb="#f0f0f0" .Sh SEE ALSO .Xr kbdcontrol 1 , .Xr login 1 , Modified: stable/11/sys/dev/vt/colors/vt_termcolors.c ============================================================================== --- stable/11/sys/dev/vt/colors/vt_termcolors.c Wed Feb 14 23:47:04 2018 (r329282) +++ stable/11/sys/dev/vt/colors/vt_termcolors.c Wed Feb 14 23:51:44 2018 (r329283) @@ -31,14 +31,18 @@ __FBSDID("$FreeBSD$"); #include +#include +#include #include -static const struct { +#define NCOLORS 16 + +static struct { unsigned char r; /* Red percentage value. */ unsigned char g; /* Green percentage value. */ unsigned char b; /* Blue percentage value. */ -} color_def[16] = { +} color_def[NCOLORS] = { {0, 0, 0}, /* black */ {50, 0, 0}, /* dark red */ {0, 50, 0}, /* dark green */ @@ -63,19 +67,112 @@ static const struct { * - blue and red are swapped (1 <-> 4) * - yellow ad cyan are swapped (3 <-> 6) */ -static const int cons_to_vga_colors[16] = { +static const int cons_to_vga_colors[NCOLORS] = { 0, 4, 2, 6, 1, 5, 3, 7, 0, 4, 2, 6, 1, 5, 3, 7 }; +static int +vt_parse_rgb_triplet(const char *rgb, unsigned char *r, + unsigned char *g, unsigned char *b) +{ + unsigned long v; + const char *ptr; + char *endptr; + + ptr = rgb; + + /* Handle #rrggbb case */ + if (*ptr == '#') { + if (strlen(ptr) != 7) + return (-1); + v = strtoul(ptr + 1, &endptr, 16); + if (*endptr != '\0') + return (-1); + + *r = (v >> 16) & 0xff; + *g = (v >> 8) & 0xff; + *b = v & 0xff; + + return (0); + } + + /* "r, g, b" case */ + v = strtoul(ptr, &endptr, 10); + if (ptr == endptr) + return (-1); + if (v > 255) + return (-1); + *r = v & 0xff; + ptr = endptr; + + /* skip separator */ + while (*ptr == ',' || *ptr == ' ') + ptr++; + + v = strtoul(ptr, &endptr, 10); + if (ptr == endptr) + return (-1); + if (v > 255) + return (-1); + *g = v & 0xff; + ptr = endptr; + + /* skip separator */ + while (*ptr == ',' || *ptr == ' ') + ptr++; + + v = strtoul(ptr, &endptr, 10); + if (ptr == endptr) + return (-1); + if (v > 255) + return (-1); + *b = v & 0xff; + ptr = endptr; + + /* skip trailing spaces */ + while (*ptr == ' ') + ptr++; + + /* unexpected characters at the end of the string */ + if (*ptr != 0) + return (-1); + + return (0); +} + +static void +vt_palette_init(void) +{ + int i; + char rgb[32]; + char tunable[32]; + unsigned char r, g, b; + + for (i = 0; i < NCOLORS; i++) { + snprintf(tunable, sizeof(tunable), + "kern.vt.color.%d.rgb", i); + if (TUNABLE_STR_FETCH(tunable, rgb, sizeof(rgb))) { + if (vt_parse_rgb_triplet(rgb, &r, &g, &b) == 0) { + /* convert to percentages */ + color_def[i].r = r*100/255; + color_def[i].g = g*100/255; + color_def[i].b = b*100/255; + } + } + } +} + int vt_generate_cons_palette(uint32_t *palette, int format, uint32_t rmax, int roffset, uint32_t gmax, int goffset, uint32_t bmax, int boffset) { int i; + vt_palette_init(); + #define CF(_f, _i) ((_f ## max * color_def[(_i)]._f / 100) << _f ## offset) - for (i = 0; i < 16; i++) { + for (i = 0; i < NCOLORS; i++) { switch (format) { case COLOR_FORMAT_VGA: palette[i] = cons_to_vga_colors[i]; From owner-svn-src-stable-11@freebsd.org Thu Feb 15 08:43:23 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B03E7F08421; Thu, 15 Feb 2018 08:43:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6637F69D1F; Thu, 15 Feb 2018 08:43:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6107C1C75C; Thu, 15 Feb 2018 08:43:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1F8hNi6077667; Thu, 15 Feb 2018 08:43:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1F8hN3D077666; Thu, 15 Feb 2018 08:43:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802150843.w1F8hN3D077666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 15 Feb 2018 08:43:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329298 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 329298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 08:43:23 -0000 Author: hselasky Date: Thu Feb 15 08:43:23 2018 New Revision: 329298 URL: https://svnweb.freebsd.org/changeset/base/329298 Log: MFC r328774: Slightly bump the maximum OID path for loading tunable SYSCTLs. Coming updates to the mlx5en(4) driver will require this. Sponsored by: Mellanox Technologies Modified: stable/11/sys/kern/kern_sysctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_sysctl.c ============================================================================== --- stable/11/sys/kern/kern_sysctl.c Thu Feb 15 07:23:41 2018 (r329297) +++ stable/11/sys/kern/kern_sysctl.c Thu Feb 15 08:43:23 2018 (r329298) @@ -188,7 +188,7 @@ sysctl_load_tunable_by_oid_locked(struct sysctl_oid *o struct sysctl_req req; struct sysctl_oid *curr; char *penv = NULL; - char path[64]; + char path[96]; ssize_t rem = sizeof(path); ssize_t len; uint8_t val_8; From owner-svn-src-stable-11@freebsd.org Thu Feb 15 08:46:21 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17368F08754; Thu, 15 Feb 2018 08:46:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BC68769EF1; Thu, 15 Feb 2018 08:46:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B74651C75F; Thu, 15 Feb 2018 08:46:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1F8kKPs077864; Thu, 15 Feb 2018 08:46:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1F8kKEL077863; Thu, 15 Feb 2018 08:46:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802150846.w1F8kKEL077863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 15 Feb 2018 08:46:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329299 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 329299 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 08:46:21 -0000 Author: hselasky Date: Thu Feb 15 08:46:20 2018 New Revision: 329299 URL: https://svnweb.freebsd.org/changeset/base/329299 Log: MFC r328591: Move the mlx5 core device pointer first in the mlx5en priv. This help simplify checks to recognize own network devices when using mlx5ib. This patch fixes an issues where mlx5ib fails to recognize mceX network devices for use with RoCE. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Feb 15 08:43:23 2018 (r329298) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Feb 15 08:46:20 2018 (r329299) @@ -646,6 +646,8 @@ struct mlx5e_flow_tables { }; struct mlx5e_priv { + struct mlx5_core_dev *mdev; /* must be first */ + /* priv data path fields - start */ int order_base_2_num_channels; int queue_mapping_channel_mask; @@ -683,7 +685,6 @@ struct mlx5e_priv { struct work_struct set_rx_mode_work; MLX5_DECLARE_DOORBELL_LOCK(doorbell_lock) - struct mlx5_core_dev *mdev; struct ifnet *ifp; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_ifnet; From owner-svn-src-stable-11@freebsd.org Thu Feb 15 08:50:44 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFEFBF08CB1; Thu, 15 Feb 2018 08:50:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 628FD6A551; Thu, 15 Feb 2018 08:50:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D0BB1C773; Thu, 15 Feb 2018 08:50:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1F8oiom078257; Thu, 15 Feb 2018 08:50:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1F8oiTg078255; Thu, 15 Feb 2018 08:50:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802150850.w1F8oiTg078255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 15 Feb 2018 08:50:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329301 - in stable/11/sys/dev/usb: . serial X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/usb: . serial X-SVN-Commit-Revision: 329301 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 08:50:44 -0000 Author: hselasky Date: Thu Feb 15 08:50:43 2018 New Revision: 329301 URL: https://svnweb.freebsd.org/changeset/base/329301 Log: MFC r328830: Add new USB ID. PR: 225641 Submitted by: Ryan Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/usb/serial/uslcom.c stable/11/sys/dev/usb/usbdevs Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/serial/uslcom.c ============================================================================== --- stable/11/sys/dev/usb/serial/uslcom.c Thu Feb 15 08:48:04 2018 (r329300) +++ stable/11/sys/dev/usb/serial/uslcom.c Thu Feb 15 08:50:43 2018 (r329301) @@ -313,6 +313,7 @@ static const STRUCT_USB_HOST_ID uslcom_devs[] = { USLCOM_DEV(SILABS, EMS_C1007), USLCOM_DEV(SILABS, HAMLINKUSB), USLCOM_DEV(SILABS, HELICOM), + USLCOM_DEV(SILABS, HUBZ), USLCOM_DEV(SILABS, IMS_USB_RS422), USLCOM_DEV(SILABS, INFINITY_MIC), USLCOM_DEV(SILABS, INGENI_ZIGBEE), Modified: stable/11/sys/dev/usb/usbdevs ============================================================================== --- stable/11/sys/dev/usb/usbdevs Thu Feb 15 08:48:04 2018 (r329300) +++ stable/11/sys/dev/usb/usbdevs Thu Feb 15 08:50:43 2018 (r329301) @@ -4174,6 +4174,7 @@ product SILABS AC_SERV_CAN 0x8664 AC-Services CAN Inte product SILABS AC_SERV_OBD 0x8665 AC-Services OBD Interface product SILABS MMB_ZIGBEE 0x88a4 MMB Networks ZigBee product SILABS INGENI_ZIGBEE 0x88a5 Planet Innovation Ingeni ZigBee +product SILABS HUBZ 0x8a2a HubZ dual ZigBee and Z-Wave product SILABS CP2102 0xea60 SILABS USB UART product SILABS CP210X_2 0xea61 CP210x Serial product SILABS CP210X_3 0xea70 CP210x Serial From owner-svn-src-stable-11@freebsd.org Thu Feb 15 08:56:04 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79E55F09549; Thu, 15 Feb 2018 08:56:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2A5896ADD2; Thu, 15 Feb 2018 08:56:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20B721C8FC; Thu, 15 Feb 2018 08:56:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1F8u3KG083399; Thu, 15 Feb 2018 08:56:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1F8u3tR083397; Thu, 15 Feb 2018 08:56:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802150856.w1F8u3tR083397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 15 Feb 2018 08:56:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329303 - in stable/11/sys/dev/usb: . serial X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/usb: . serial X-SVN-Commit-Revision: 329303 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 08:56:04 -0000 Author: hselasky Date: Thu Feb 15 08:56:03 2018 New Revision: 329303 URL: https://svnweb.freebsd.org/changeset/base/329303 Log: MFC r328163: Add new USB ID to U3G driver. PR: 134299 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/usb/serial/u3g.c stable/11/sys/dev/usb/usbdevs Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/serial/u3g.c ============================================================================== --- stable/11/sys/dev/usb/serial/u3g.c Thu Feb 15 08:52:58 2018 (r329302) +++ stable/11/sys/dev/usb/serial/u3g.c Thu Feb 15 08:56:03 2018 (r329303) @@ -200,6 +200,7 @@ static driver_t u3g_driver = { static const STRUCT_USB_HOST_ID u3g_devs[] = { #define U3G_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } + U3G_DEV(ABIT, AK_020, 0), U3G_DEV(ACERP, H10, 0), U3G_DEV(AIRPLUS, MCD650, 0), U3G_DEV(AIRPRIME, PC5220, 0), Modified: stable/11/sys/dev/usb/usbdevs ============================================================================== --- stable/11/sys/dev/usb/usbdevs Thu Feb 15 08:52:58 2018 (r329302) +++ stable/11/sys/dev/usb/usbdevs Thu Feb 15 08:56:03 2018 (r329303) @@ -666,6 +666,7 @@ vendor SOUNDGRAPH 0x15c2 Soundgraph, Inc. vendor AMIT2 0x15c5 AMIT vendor TEXTECH 0x15ca Textech International Ltd. vendor SOHOWARE 0x15e8 SOHOware +vendor ABIT 0x15eb ABIT Corporation vendor UMAX 0x1606 UMAX Data Systems vendor INSIDEOUT 0x1608 Inside Out Networks vendor AMOI 0x1614 Amoi Electronics @@ -807,6 +808,9 @@ product 3COMUSR OFFICECONN 0x0082 3Com OfficeConnect A product 3COMUSR USRISDN 0x008f 3Com U.S. Robotics Pro ISDN TA product 3COMUSR HOMECONN 0x009d 3Com HomeConnect Camera product 3COMUSR USR56K 0x3021 U.S. Robotics 56000 Voice FaxModem Pro + +/* ABIT products */ +product ABIT AK_020 0x7d0e 3G modem /* AboCom products */ product ABOCOM XX1 0x110c XX1 From owner-svn-src-stable-11@freebsd.org Thu Feb 15 09:00:12 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1786F09C08; Thu, 15 Feb 2018 09:00:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 417A76B1CC; Thu, 15 Feb 2018 09:00:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C75B1C904; Thu, 15 Feb 2018 09:00:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1F90CAi083731; Thu, 15 Feb 2018 09:00:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1F90CqU083730; Thu, 15 Feb 2018 09:00:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802150900.w1F90CqU083730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 15 Feb 2018 09:00:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329305 - stable/11/sys/dev/vt X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/vt X-SVN-Commit-Revision: 329305 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 09:00:12 -0000 Author: hselasky Date: Thu Feb 15 09:00:11 2018 New Revision: 329305 URL: https://svnweb.freebsd.org/changeset/base/329305 Log: MFC r325724: Implement missing KDGETMODE IOCTL in VT. Obtained from: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/vt/vt_core.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/vt/vt_core.c ============================================================================== --- stable/11/sys/dev/vt/vt_core.c Thu Feb 15 08:57:14 2018 (r329304) +++ stable/11/sys/dev/vt/vt_core.c Thu Feb 15 09:00:11 2018 (r329305) @@ -2150,6 +2150,10 @@ skip_thunk: return (error); } + case KDGETMODE: + *(int *)data = (vw->vw_flags & VWF_GRAPHICS) ? + KD_GRAPHICS : KD_TEXT; + return (0); case KDGKBMODE: { error = 0; From owner-svn-src-stable-11@freebsd.org Thu Feb 15 09:04:07 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 569A2F0A1AF; Thu, 15 Feb 2018 09:04:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 065526B827; Thu, 15 Feb 2018 09:04:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB1811CAAF; Thu, 15 Feb 2018 09:04:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1F946DG088757; Thu, 15 Feb 2018 09:04:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1F946Kb088754; Thu, 15 Feb 2018 09:04:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802150904.w1F946Kb088754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 15 Feb 2018 09:04:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329306 - in stable/11/sys: dev/mlx5/mlx5_ib ofed/drivers/infiniband/hw/mthca ofed/include/rdma X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: dev/mlx5/mlx5_ib ofed/drivers/infiniband/hw/mthca ofed/include/rdma X-SVN-Commit-Revision: 329306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 09:04:07 -0000 Author: hselasky Date: Thu Feb 15 09:04:06 2018 New Revision: 329306 URL: https://svnweb.freebsd.org/changeset/base/329306 Log: MFC r325807: Make sure the ib_wr_opcode enum is signed by adding a negative dummy element. Different compilers may optimise the enum type in different ways. This ensures coherency when range checking the value of enums in ibcore. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c stable/11/sys/ofed/drivers/infiniband/hw/mthca/mthca_qp.c stable/11/sys/ofed/include/rdma/ib_verbs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Thu Feb 15 09:00:11 2018 (r329305) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Thu Feb 15 09:04:06 2018 (r329306) @@ -2497,7 +2497,7 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_se } for (nreq = 0; wr; nreq++, wr = wr->next) { - if (unlikely(wr->opcode >= ARRAY_SIZE(mlx5_ib_opcode))) { + if (unlikely(wr->opcode < 0 || wr->opcode >= ARRAY_SIZE(mlx5_ib_opcode))) { mlx5_ib_warn(dev, "Invalid opcode 0x%x\n", wr->opcode); err = -EINVAL; *bad_wr = wr; Modified: stable/11/sys/ofed/drivers/infiniband/hw/mthca/mthca_qp.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/hw/mthca/mthca_qp.c Thu Feb 15 09:00:11 2018 (r329305) +++ stable/11/sys/ofed/drivers/infiniband/hw/mthca/mthca_qp.c Thu Feb 15 09:04:06 2018 (r329306) @@ -1765,7 +1765,7 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct i qp->wrid[ind] = wr->wr_id; - if (wr->opcode >= ARRAY_SIZE(mthca_opcode)) { + if (wr->opcode < 0 || wr->opcode >= ARRAY_SIZE(mthca_opcode)) { mthca_err(dev, "opcode invalid\n"); err = -EINVAL; *bad_wr = wr; Modified: stable/11/sys/ofed/include/rdma/ib_verbs.h ============================================================================== --- stable/11/sys/ofed/include/rdma/ib_verbs.h Thu Feb 15 09:00:11 2018 (r329305) +++ stable/11/sys/ofed/include/rdma/ib_verbs.h Thu Feb 15 09:04:06 2018 (r329306) @@ -1136,6 +1136,8 @@ enum ib_wr_opcode { IB_WR_RESERVED8, IB_WR_RESERVED9, IB_WR_RESERVED10, + + IB_WR_DUMMY = -1, /* force enum type signed */ }; enum ib_send_flags { From owner-svn-src-stable-11@freebsd.org Thu Feb 15 09:05:29 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEA26F0A397; Thu, 15 Feb 2018 09:05:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 87A756B9CC; Thu, 15 Feb 2018 09:05:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7FF031CAB3; Thu, 15 Feb 2018 09:05:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1F95TLn088863; Thu, 15 Feb 2018 09:05:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1F95TQa088862; Thu, 15 Feb 2018 09:05:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802150905.w1F95TQa088862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 15 Feb 2018 09:05:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329307 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 329307 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 09:05:30 -0000 Author: hselasky Date: Thu Feb 15 09:05:29 2018 New Revision: 329307 URL: https://svnweb.freebsd.org/changeset/base/329307 Log: MFC r325806: Make sure a valid VNET is set before trying to access the V_ip6_v6only variable. Access the variable directly instead of going through the sysctl() interface in the kernel. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/cma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/cma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/cma.c Thu Feb 15 09:04:06 2018 (r329306) +++ stable/11/sys/ofed/drivers/infiniband/core/cma.c Thu Feb 15 09:05:29 2018 (r329307) @@ -2734,10 +2734,6 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct socka { struct rdma_id_private *id_priv; int ret; -#if defined(INET6) - int ipv6only; - size_t var_size = sizeof(int); -#endif if (addr->sa_family != AF_INET && addr->sa_family != AF_INET6) return -EAFNOSUPPORT; @@ -2765,9 +2761,11 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct socka if (addr->sa_family == AF_INET) id_priv->afonly = 1; #if defined(INET6) - else if (addr->sa_family == AF_INET6) - id_priv->afonly = kernel_sysctlbyname(&thread0, "net.inet6.ip6.v6only", - &ipv6only, &var_size, NULL, 0, NULL, 0); + else if (addr->sa_family == AF_INET6) { + CURVNET_SET_QUIET(&init_net); + id_priv->afonly = V_ip6_v6only; + CURVNET_RESTORE(); + } #endif } ret = cma_get_port(id_priv); From owner-svn-src-stable-11@freebsd.org Thu Feb 15 09:07:38 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A839F0A61C; Thu, 15 Feb 2018 09:07:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0C0056BCD0; Thu, 15 Feb 2018 09:07:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 071841CAB7; Thu, 15 Feb 2018 09:07:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1F97bXv089123; Thu, 15 Feb 2018 09:07:37 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1F97bA1089122; Thu, 15 Feb 2018 09:07:37 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802150907.w1F97bA1089122@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 15 Feb 2018 09:07:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329308 - stable/11/sys/contrib/rdma/krping X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/contrib/rdma/krping X-SVN-Commit-Revision: 329308 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 09:07:38 -0000 Author: hselasky Date: Thu Feb 15 09:07:37 2018 New Revision: 329308 URL: https://svnweb.freebsd.org/changeset/base/329308 Log: MFC r325805: Set the default VNET in krping before calling ifunit_ref(). Else using IPv6 link-local addresses when VIMAGE is enabled will cause a so-called NULL pointer dereferencing issue. Sponsored by: Mellanox Technologies Modified: stable/11/sys/contrib/rdma/krping/krping.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/contrib/rdma/krping/krping.c ============================================================================== --- stable/11/sys/contrib/rdma/krping/krping.c Thu Feb 15 09:05:29 2018 (r329307) +++ stable/11/sys/contrib/rdma/krping/krping.c Thu Feb 15 09:07:37 2018 (r329308) @@ -3185,7 +3185,9 @@ krping_get_ipv6_scope_id(char *name) if (name == NULL) return (0); + CURVNET_SET_QUIET(TD_TO_VNET(curthread)); ifp = ifunit_ref(name); + CURVNET_RESTORE(); if (ifp == NULL) return (0); retval = ifp->if_index; From owner-svn-src-stable-11@freebsd.org Thu Feb 15 09:09:43 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51355F0A8DD; Thu, 15 Feb 2018 09:09:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 05C876BEE2; Thu, 15 Feb 2018 09:09:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00B7A1CAB9; Thu, 15 Feb 2018 09:09:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1F99g9I089248; Thu, 15 Feb 2018 09:09:42 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1F99gi2089247; Thu, 15 Feb 2018 09:09:42 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802150909.w1F99gi2089247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 15 Feb 2018 09:09:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329309 - stable/11/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 329309 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 09:09:43 -0000 Author: hselasky Date: Thu Feb 15 09:09:42 2018 New Revision: 329309 URL: https://svnweb.freebsd.org/changeset/base/329309 Log: MFC r325637: Mark ipoib device as initialized on device open. Set the IPOIB_FLAG_INITIALIZED on dev_open and clear it on dev_stop to avoid a race between ipoib load and the underlying device driver. The device module must dispatch the IB_EVENT_PORT_ACTIVE event before ipoib module is loaded. Otherwise, the flush will fail since no one set the IPOIB_FLAG_INITIALIZED. Submitted by: Slava Shwartsman Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Thu Feb 15 09:07:37 2018 (r329308) +++ stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Thu Feb 15 09:09:42 2018 (r329309) @@ -638,6 +638,8 @@ int ipoib_ib_dev_open(struct ipoib_dev_priv *priv) clear_bit(IPOIB_STOP_REAPER, &priv->flags); queue_delayed_work(ipoib_workqueue, &priv->ah_reap_task, HZ); + set_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); + return 0; } @@ -744,6 +746,8 @@ int ipoib_ib_dev_stop(struct ipoib_dev_priv *priv, int unsigned long begin; struct ipoib_tx_buf *tx_req; int i; + + clear_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); ipoib_cm_dev_stop(priv); From owner-svn-src-stable-11@freebsd.org Thu Feb 15 09:12:09 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E54FCF0ACB3; Thu, 15 Feb 2018 09:12:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 97EE66C3A5; Thu, 15 Feb 2018 09:12:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 92F961CC2A; Thu, 15 Feb 2018 09:12:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1F9C8a3091824; Thu, 15 Feb 2018 09:12:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1F9C8g7091820; Thu, 15 Feb 2018 09:12:08 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802150912.w1F9C8g7091820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 15 Feb 2018 09:12:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329310 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 329310 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 09:12:09 -0000 Author: hselasky Date: Thu Feb 15 09:12:07 2018 New Revision: 329310 URL: https://svnweb.freebsd.org/changeset/base/329310 Log: MFC r323350: Remove unsafe access to the LinuxKPI file structure from ibcore. selwakeup() is now done by the wake_up() family of functions. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ucm.c stable/11/sys/ofed/drivers/infiniband/core/ucma.c stable/11/sys/ofed/drivers/infiniband/core/user_mad.c stable/11/sys/ofed/drivers/infiniband/core/uverbs_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ucm.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ucm.c Thu Feb 15 09:09:42 2018 (r329309) +++ stable/11/sys/ofed/drivers/infiniband/core/ucm.c Thu Feb 15 09:12:07 2018 (r329310) @@ -378,8 +378,6 @@ static int ib_ucm_event_handler(struct ib_cm_id *cm_id list_add_tail(&uevent->file_list, &ctx->file->events); list_add_tail(&uevent->ctx_list, &ctx->events); wake_up_interruptible(&ctx->file->poll_wait); - if (ctx->file->filp) - selwakeup(&ctx->file->filp->f_selinfo); mutex_unlock(&ctx->file->file_mutex); return 0; Modified: stable/11/sys/ofed/drivers/infiniband/core/ucma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ucma.c Thu Feb 15 09:09:42 2018 (r329309) +++ stable/11/sys/ofed/drivers/infiniband/core/ucma.c Thu Feb 15 09:12:07 2018 (r329310) @@ -287,8 +287,6 @@ static int ucma_event_handler(struct rdma_cm_id *cm_id list_add_tail(&uevent->list, &ctx->file->event_list); wake_up_interruptible(&ctx->file->poll_wait); - if (ctx->file->filp) - selwakeup(&ctx->file->filp->f_selinfo); out: mutex_unlock(&ctx->file->mut); return ret; Modified: stable/11/sys/ofed/drivers/infiniband/core/user_mad.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/user_mad.c Thu Feb 15 09:09:42 2018 (r329309) +++ stable/11/sys/ofed/drivers/infiniband/core/user_mad.c Thu Feb 15 09:12:07 2018 (r329310) @@ -236,7 +236,6 @@ static int queue_packet(struct ib_umad_file *file, packet->mad.hdr.id++) if (agent == __get_agent(file, packet->mad.hdr.id)) { list_add_tail(&packet->list, &file->recv_list); - selwakeup(&file->filp->f_selinfo); wake_up_interruptible(&file->recv_wait); ret = 0; break; Modified: stable/11/sys/ofed/drivers/infiniband/core/uverbs_main.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/uverbs_main.c Thu Feb 15 09:09:42 2018 (r329309) +++ stable/11/sys/ofed/drivers/infiniband/core/uverbs_main.c Thu Feb 15 09:12:07 2018 (r329310) @@ -519,8 +519,6 @@ void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq spin_unlock_irqrestore(&file->lock, flags); wake_up_interruptible(&file->poll_wait); - if (file->filp) - selwakeup(&file->filp->f_selinfo); kill_fasync(&file->async_queue, SIGIO, POLL_IN); } @@ -554,8 +552,6 @@ static void ib_uverbs_async_handler(struct ib_uverbs_f spin_unlock_irqrestore(&file->async_file->lock, flags); wake_up_interruptible(&file->async_file->poll_wait); - if (file->async_file->filp) - selwakeup(&file->async_file->filp->f_selinfo); kill_fasync(&file->async_file->async_queue, SIGIO, POLL_IN); } From owner-svn-src-stable-11@freebsd.org Thu Feb 15 15:33:19 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C748DF01CDC; Thu, 15 Feb 2018 15:33:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6CC7E7E274; Thu, 15 Feb 2018 15:33:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67BDB209E2; Thu, 15 Feb 2018 15:33:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1FFXIG7089694; Thu, 15 Feb 2018 15:33:18 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1FFXI0B089691; Thu, 15 Feb 2018 15:33:18 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201802151533.w1FFXI0B089691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 15 Feb 2018 15:33:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329316 - in stable/11/sys: cam/scsi geom X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/11/sys: cam/scsi geom X-SVN-Commit-Revision: 329316 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 15:33:19 -0000 Author: avg Date: Thu Feb 15 15:33:17 2018 New Revision: 329316 URL: https://svnweb.freebsd.org/changeset/base/329316 Log: MFC r327996: geom_disk / scsi_da: deny opening write-protected disks for writing Ths change consists of two parts. geom_disk: deny opening a disk for writing if it's marked as write-protected. A new disk(9) flag is added to mark write protected disks. A possible alternative could be to add another parameter to d_open, so that the open mode could be passed to it and the disk drivers could make the decision internally, but the flag required less churn. scsi_da: add a new phase of disk probing to query the all pages mode sense page. We can determine if the disk is write protected using bit 7 of the device specific field in the mode parameter header returned by MODE SENSE. PR: 224037 Modified: stable/11/sys/cam/scsi/scsi_da.c stable/11/sys/geom/geom_disk.c stable/11/sys/geom/geom_disk.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_da.c Thu Feb 15 15:01:07 2018 (r329315) +++ stable/11/sys/cam/scsi/scsi_da.c Thu Feb 15 15:33:17 2018 (r329316) @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); * ATA -> LOGDIR -> IDDIR -> SUP -> ATA_ZONE */ typedef enum { + DA_STATE_PROBE_WP, DA_STATE_PROBE_RC, DA_STATE_PROBE_RC16, DA_STATE_PROBE_LBP, @@ -155,6 +156,7 @@ typedef enum { DA_CCB_PROBE_ATA_IDDIR = 0x0F, DA_CCB_PROBE_ATA_SUP = 0x10, DA_CCB_PROBE_ATA_ZONE = 0x11, + DA_CCB_PROBE_WP = 0x12, DA_CCB_TYPE_MASK = 0x1F, DA_CCB_RETRY_UA = 0x20 } da_ccb_state; @@ -2402,7 +2404,7 @@ daregister(struct cam_periph *periph, void *arg) } LIST_INIT(&softc->pending_ccbs); - softc->state = DA_STATE_PROBE_RC; + softc->state = DA_STATE_PROBE_WP; bioq_init(&softc->delete_run_queue); if (SID_IS_REMOVABLE(&cgd->inq_data)) softc->flags |= DA_FLAG_PACK_REMOVABLE; @@ -2506,7 +2508,6 @@ daregister(struct cam_periph *periph, void *arg) if (SID_ANSI_REV(&cgd->inq_data) >= SCSI_REV_SPC3 && (softc->quirks & DA_Q_NO_RC16) == 0) { softc->flags |= DA_FLAG_CAN_RC16; - softc->state = DA_STATE_PROBE_RC16; } /* @@ -3070,6 +3071,36 @@ out: daschedule(periph); break; } + case DA_STATE_PROBE_WP: + { + void *mode_buf; + int mode_buf_len; + + mode_buf_len = 192; + mode_buf = malloc(mode_buf_len, M_SCSIDA, M_NOWAIT); + if (mode_buf == NULL) { + xpt_print(periph->path, "Unable to send mode sense - " + "malloc failure\n"); + softc->state = DA_STATE_PROBE_RC; + goto skipstate; + } + scsi_mode_sense_len(&start_ccb->csio, + /*retries*/ da_retry_count, + /*cbfcnp*/ dadone, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*dbd*/ FALSE, + /*pc*/ SMS_PAGE_CTRL_CURRENT, + /*page*/ SMS_ALL_PAGES_PAGE, + /*param_buf*/ mode_buf, + /*param_len*/ mode_buf_len, + /*minimum_cmd_size*/ softc->minimum_cmd_size, + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ da_default_timeout * 1000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = DA_CCB_PROBE_WP; + xpt_action(start_ccb); + break; + } case DA_STATE_PROBE_RC: { struct scsi_read_capacity_data *rcap; @@ -4219,6 +4250,52 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) biodone(bp); return; } + case DA_CCB_PROBE_WP: + { + struct scsi_mode_header_6 *mode_hdr6; + struct scsi_mode_header_10 *mode_hdr10; + uint8_t dev_spec; + + if (softc->minimum_cmd_size > 6) { + mode_hdr10 = (struct scsi_mode_header_10 *)csio->data_ptr; + dev_spec = mode_hdr10->dev_spec; + } else { + mode_hdr6 = (struct scsi_mode_header_6 *)csio->data_ptr; + dev_spec = mode_hdr6->dev_spec; + } + if (cam_ccb_status(done_ccb) == CAM_REQ_CMP) { + if ((dev_spec & 0x80) != 0) + softc->disk->d_flags |= DISKFLAG_WRITE_PROTECT; + else + softc->disk->d_flags &= ~DISKFLAG_WRITE_PROTECT; + } else { + int error; + + error = daerror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA|SF_NO_PRINT); + if (error == ERESTART) + return; + else if (error != 0) { + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { + /* Don't wedge this device's queue */ + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + } + } + } + + free(csio->data_ptr, M_SCSIDA); + xpt_release_ccb(done_ccb); + if ((softc->flags & DA_FLAG_CAN_RC16) != 0) + softc->state = DA_STATE_PROBE_RC16; + else + softc->state = DA_STATE_PROBE_RC; + xpt_schedule(periph, priority); + return; + } case DA_CCB_PROBE_RC: case DA_CCB_PROBE_RC16: { @@ -5286,11 +5363,7 @@ dareprobe(struct cam_periph *periph) KASSERT(status == CAM_REQ_CMP, ("dareprobe: cam_periph_acquire failed")); - if (softc->flags & DA_FLAG_CAN_RC16) - softc->state = DA_STATE_PROBE_RC16; - else - softc->state = DA_STATE_PROBE_RC; - + softc->state = DA_STATE_PROBE_WP; xpt_schedule(periph, CAM_PRIORITY_DEV); } Modified: stable/11/sys/geom/geom_disk.c ============================================================================== --- stable/11/sys/geom/geom_disk.c Thu Feb 15 15:01:07 2018 (r329315) +++ stable/11/sys/geom/geom_disk.c Thu Feb 15 15:33:17 2018 (r329316) @@ -118,14 +118,18 @@ g_disk_access(struct g_provider *pp, int r, int w, int e += pp->ace; error = 0; if ((pp->acr + pp->acw + pp->ace) == 0 && (r + w + e) > 0) { - if (dp->d_open != NULL) { + /* + * It would be better to defer this decision to d_open if + * it was able to take flags. + */ + if (w > 0 && (dp->d_flags & DISKFLAG_WRITE_PROTECT) != 0) + error = EROFS; + if (error == 0 && dp->d_open != NULL) error = dp->d_open(dp); - if (bootverbose && error != 0) - printf("Opened disk %s -> %d\n", - pp->name, error); - if (error != 0) - return (error); - } + if (bootverbose && error != 0) + printf("Opened disk %s -> %d\n", pp->name, error); + if (error != 0) + return (error); pp->sectorsize = dp->d_sectorsize; if (dp->d_maxsize == 0) { printf("WARNING: Disk drive %s%d has no d_maxsize\n", Modified: stable/11/sys/geom/geom_disk.h ============================================================================== --- stable/11/sys/geom/geom_disk.h Thu Feb 15 15:01:07 2018 (r329315) +++ stable/11/sys/geom/geom_disk.h Thu Feb 15 15:33:17 2018 (r329316) @@ -116,13 +116,14 @@ struct disk { void *d_drv1; }; -#define DISKFLAG_RESERVED 0x1 /* Was NEEDSGIANT */ -#define DISKFLAG_OPEN 0x2 -#define DISKFLAG_CANDELETE 0x4 -#define DISKFLAG_CANFLUSHCACHE 0x8 -#define DISKFLAG_UNMAPPED_BIO 0x10 -#define DISKFLAG_DIRECT_COMPLETION 0x20 -#define DISKFLAG_CANZONE 0x80 +#define DISKFLAG_RESERVED 0x0001 /* Was NEEDSGIANT */ +#define DISKFLAG_OPEN 0x0002 +#define DISKFLAG_CANDELETE 0x0004 +#define DISKFLAG_CANFLUSHCACHE 0x0008 +#define DISKFLAG_UNMAPPED_BIO 0x0010 +#define DISKFLAG_DIRECT_COMPLETION 0x0020 +#define DISKFLAG_CANZONE 0x0080 +#define DISKFLAG_WRITE_PROTECT 0x0100 struct disk *disk_alloc(void); void disk_create(struct disk *disk, int version); From owner-svn-src-stable-11@freebsd.org Thu Feb 15 17:09:49 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57AE6F08A07; Thu, 15 Feb 2018 17:09:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0555982DCA; Thu, 15 Feb 2018 17:09:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0054D21847; Thu, 15 Feb 2018 17:09:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1FH9mkX048791; Thu, 15 Feb 2018 17:09:48 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1FH9mBA048790; Thu, 15 Feb 2018 17:09:48 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201802151709.w1FH9mBA048790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 15 Feb 2018 17:09:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329320 - stable/11/sys/amd64/vmm/amd X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/amd64/vmm/amd X-SVN-Commit-Revision: 329320 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 17:09:49 -0000 Author: avg Date: Thu Feb 15 17:09:48 2018 New Revision: 329320 URL: https://svnweb.freebsd.org/changeset/base/329320 Log: MFC r328622: vmm/svm: post LAPIC interrupts using event injection PR: 215972 Modified: stable/11/sys/amd64/vmm/amd/svm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/vmm/amd/svm.c ============================================================================== --- stable/11/sys/amd64/vmm/amd/svm.c Thu Feb 15 16:31:35 2018 (r329319) +++ stable/11/sys/amd64/vmm/amd/svm.c Thu Feb 15 17:09:48 2018 (r329320) @@ -928,7 +928,6 @@ svm_update_virqinfo(struct svm_softc *sc, int vcpu) struct vm *vm; struct vlapic *vlapic; struct vmcb_ctrl *ctrl; - int pending; vm = sc->vm; vlapic = vm_lapic(vm, vcpu); @@ -937,20 +936,9 @@ svm_update_virqinfo(struct svm_softc *sc, int vcpu) /* Update %cr8 in the emulated vlapic */ vlapic_set_cr8(vlapic, ctrl->v_tpr); - /* - * If V_IRQ indicates that the interrupt injection attempted on then - * last VMRUN was successful then update the vlapic accordingly. - */ - if (ctrl->v_intr_vector != 0) { - pending = ctrl->v_irq; - KASSERT(ctrl->v_intr_vector >= 16, ("%s: invalid " - "v_intr_vector %d", __func__, ctrl->v_intr_vector)); - KASSERT(!ctrl->v_ign_tpr, ("%s: invalid v_ign_tpr", __func__)); - VCPU_CTR2(vm, vcpu, "v_intr_vector %d %s", ctrl->v_intr_vector, - pending ? "pending" : "accepted"); - if (!pending) - vlapic_intr_accepted(vlapic, ctrl->v_intr_vector); - } + /* Virtual interrupt injection is not used. */ + KASSERT(ctrl->v_intr_vector == 0, ("%s: invalid " + "v_intr_vector %d", __func__, ctrl->v_intr_vector)); } static void @@ -1019,12 +1007,7 @@ disable_intr_window_exiting(struct svm_softc *sc, int return; } -#ifdef KTR - if (ctrl->v_intr_vector == 0) - VCPU_CTR0(sc->vm, vcpu, "Disable intr window exiting"); - else - VCPU_CTR0(sc->vm, vcpu, "Clearing V_IRQ interrupt injection"); -#endif + VCPU_CTR0(sc->vm, vcpu, "Disable intr window exiting"); ctrl->v_irq = 0; ctrl->v_intr_vector = 0; svm_set_dirty(sc, vcpu, VMCB_CACHE_TPR); @@ -1569,14 +1552,14 @@ svm_inj_interrupts(struct svm_softc *sc, int vcpu, str struct vmcb_state *state; struct svm_vcpu *vcpustate; uint8_t v_tpr; - int vector, need_intr_window, pending_apic_vector; + int vector, need_intr_window; + int extint_pending; state = svm_get_vmcb_state(sc, vcpu); ctrl = svm_get_vmcb_ctrl(sc, vcpu); vcpustate = svm_get_vcpu(sc, vcpu); need_intr_window = 0; - pending_apic_vector = 0; if (vcpustate->nextrip != state->rip) { ctrl->intr_shadow = 0; @@ -1646,40 +1629,19 @@ svm_inj_interrupts(struct svm_softc *sc, int vcpu, str } } - if (!vm_extint_pending(sc->vm, vcpu)) { - /* - * APIC interrupts are delivered using the V_IRQ offload. - * - * The primary benefit is that the hypervisor doesn't need to - * deal with the various conditions that inhibit interrupts. - * It also means that TPR changes via CR8 will be handled - * without any hypervisor involvement. - * - * Note that the APIC vector must remain pending in the vIRR - * until it is confirmed that it was delivered to the guest. - * This can be confirmed based on the value of V_IRQ at the - * next #VMEXIT (1 = pending, 0 = delivered). - * - * Also note that it is possible that another higher priority - * vector can become pending before this vector is delivered - * to the guest. This is alright because vcpu_notify_event() - * will send an IPI and force the vcpu to trap back into the - * hypervisor. The higher priority vector will be injected on - * the next VMRUN. - */ - if (vlapic_pending_intr(vlapic, &vector)) { - KASSERT(vector >= 16 && vector <= 255, - ("invalid vector %d from local APIC", vector)); - pending_apic_vector = vector; - } - goto done; + extint_pending = vm_extint_pending(sc->vm, vcpu); + if (!extint_pending) { + if (!vlapic_pending_intr(vlapic, &vector)) + goto done; + KASSERT(vector >= 16 && vector <= 255, + ("invalid vector %d from local APIC", vector)); + } else { + /* Ask the legacy pic for a vector to inject */ + vatpic_pending_intr(sc->vm, &vector); + KASSERT(vector >= 0 && vector <= 255, + ("invalid vector %d from INTR", vector)); } - /* Ask the legacy pic for a vector to inject */ - vatpic_pending_intr(sc->vm, &vector); - KASSERT(vector >= 0 && vector <= 255, ("invalid vector %d from INTR", - vector)); - /* * If the guest has disabled interrupts or is in an interrupt shadow * then we cannot inject the pending interrupt. @@ -1705,14 +1667,14 @@ svm_inj_interrupts(struct svm_softc *sc, int vcpu, str goto done; } - /* - * Legacy PIC interrupts are delivered via the event injection - * mechanism. - */ svm_eventinject(sc, vcpu, VMCB_EVENTINJ_TYPE_INTR, vector, 0, false); - vm_extint_clear(sc->vm, vcpu); - vatpic_intr_accepted(sc->vm, vector); + if (!extint_pending) { + vlapic_intr_accepted(vlapic, vector); + } else { + vm_extint_clear(sc->vm, vcpu); + vatpic_intr_accepted(sc->vm, vector); + } /* * Force a VM-exit as soon as the vcpu is ready to accept another @@ -1742,21 +1704,7 @@ done: svm_set_dirty(sc, vcpu, VMCB_CACHE_TPR); } - if (pending_apic_vector) { - /* - * If an APIC vector is being injected then interrupt window - * exiting is not possible on this VMRUN. - */ - KASSERT(!need_intr_window, ("intr_window exiting impossible")); - VCPU_CTR1(sc->vm, vcpu, "Injecting vector %d using V_IRQ", - pending_apic_vector); - - ctrl->v_irq = 1; - ctrl->v_ign_tpr = 0; - ctrl->v_intr_vector = pending_apic_vector; - ctrl->v_intr_prio = pending_apic_vector >> 4; - svm_set_dirty(sc, vcpu, VMCB_CACHE_TPR); - } else if (need_intr_window) { + if (need_intr_window) { /* * We use V_IRQ in conjunction with the VINTR intercept to * trap into the hypervisor as soon as a virtual interrupt From owner-svn-src-stable-11@freebsd.org Thu Feb 15 21:27:25 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFE44F1BD46; Thu, 15 Feb 2018 21:27:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8DE2671479; Thu, 15 Feb 2018 21:27:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88AF024375; Thu, 15 Feb 2018 21:27:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1FLROeG004639; Thu, 15 Feb 2018 21:27:24 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1FLRO9D004636; Thu, 15 Feb 2018 21:27:24 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201802152127.w1FLRO9D004636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 15 Feb 2018 21:27:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329343 - in stable/11: sys/opencrypto tools/tools/crypto X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable/11: sys/opencrypto tools/tools/crypto X-SVN-Commit-Revision: 329343 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 21:27:25 -0000 Author: jhb Date: Thu Feb 15 21:27:24 2018 New Revision: 329343 URL: https://svnweb.freebsd.org/changeset/base/329343 Log: MFC 318090,319475: Use const with some read-only buffers in opencrypto APIs. 318090: Use const with some read-only buffers in opencrypto APIs. - Mark the source buffer for a copyback operation as const in the kernel API. - Use const with input-only buffers in crypto ioctl structures used with /dev/crypto. 319475: Fix some new errors and a warning in cryptotest. - Use a new 'char *key' to allocate storage for keys and assign the pointer to the session2_op 'const char *' members after the key is initialized. - Mark the 'find' variable used in crfind() static so that crfind() doesn't return a pointer to stack garbage. Sponsored by: Chelsio Communications Modified: stable/11/sys/opencrypto/criov.c stable/11/sys/opencrypto/cryptodev.h stable/11/tools/tools/crypto/cryptotest.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/opencrypto/criov.c ============================================================================== --- stable/11/sys/opencrypto/criov.c Thu Feb 15 21:24:43 2018 (r329342) +++ stable/11/sys/opencrypto/criov.c Thu Feb 15 21:27:24 2018 (r329343) @@ -79,7 +79,7 @@ cuio_copydata(struct uio* uio, int off, int len, caddr } void -cuio_copyback(struct uio* uio, int off, int len, caddr_t cp) +cuio_copyback(struct uio* uio, int off, int len, c_caddr_t cp) { struct iovec *iov = uio->uio_iov; int iol = uio->uio_iovcnt; @@ -155,7 +155,7 @@ cuio_apply(struct uio *uio, int off, int len, int (*f) } void -crypto_copyback(int flags, caddr_t buf, int off, int size, caddr_t in) +crypto_copyback(int flags, caddr_t buf, int off, int size, c_caddr_t in) { if ((flags & CRYPTO_F_IMBUF) != 0) Modified: stable/11/sys/opencrypto/cryptodev.h ============================================================================== --- stable/11/sys/opencrypto/cryptodev.h Thu Feb 15 21:24:43 2018 (r329342) +++ stable/11/sys/opencrypto/cryptodev.h Thu Feb 15 21:27:24 2018 (r329343) @@ -211,9 +211,9 @@ struct session_op { u_int32_t mac; /* ie. CRYPTO_MD5_HMAC */ u_int32_t keylen; /* cipher key */ - caddr_t key; + c_caddr_t key; int mackeylen; /* mac key */ - caddr_t mackey; + c_caddr_t mackey; u_int32_t ses; /* returns: session # */ }; @@ -223,9 +223,9 @@ struct session2_op { u_int32_t mac; /* ie. CRYPTO_MD5_HMAC */ u_int32_t keylen; /* cipher key */ - caddr_t key; + c_caddr_t key; int mackeylen; /* mac key */ - caddr_t mackey; + c_caddr_t mackey; u_int32_t ses; /* returns: session # */ int crid; /* driver id + flags (rw) */ @@ -240,9 +240,10 @@ struct crypt_op { u_int16_t flags; #define COP_F_BATCH 0x0008 /* Batch op if possible */ u_int len; - caddr_t src, dst; /* become iov[] inside kernel */ + c_caddr_t src; /* become iov[] inside kernel */ + caddr_t dst; caddr_t mac; /* must be big enough for chosen MAC */ - caddr_t iv; + c_caddr_t iv; }; /* op and flags the same as crypt_op */ @@ -253,10 +254,11 @@ struct crypt_aead { u_int len; u_int aadlen; u_int ivlen; - caddr_t src, dst; /* become iov[] inside kernel */ - caddr_t aad; /* additional authenticated data */ + c_caddr_t src; /* become iov[] inside kernel */ + caddr_t dst; + c_caddr_t aad; /* additional authenticated data */ caddr_t tag; /* must fit for chosen TAG length */ - caddr_t iv; + c_caddr_t iv; }; /* @@ -503,7 +505,7 @@ extern int crypto_devallowsoft; /* only use hardware c */ struct uio; extern void cuio_copydata(struct uio* uio, int off, int len, caddr_t cp); -extern void cuio_copyback(struct uio* uio, int off, int len, caddr_t cp); +extern void cuio_copyback(struct uio* uio, int off, int len, c_caddr_t cp); extern int cuio_getptr(struct uio *uio, int loc, int *off); extern int cuio_apply(struct uio *uio, int off, int len, int (*f)(void *, void *, u_int), void *arg); @@ -514,7 +516,7 @@ extern int crypto_mbuftoiov(struct mbuf *mbuf, struct int *cnt, int *allocated); extern void crypto_copyback(int flags, caddr_t buf, int off, int size, - caddr_t in); + c_caddr_t in); extern void crypto_copydata(int flags, caddr_t buf, int off, int size, caddr_t out); extern int crypto_apply(int flags, caddr_t buf, int off, int len, Modified: stable/11/tools/tools/crypto/cryptotest.c ============================================================================== --- stable/11/tools/tools/crypto/cryptotest.c Thu Feb 15 21:24:43 2018 (r329342) +++ stable/11/tools/tools/crypto/cryptotest.c Thu Feb 15 21:27:24 2018 (r329343) @@ -216,7 +216,7 @@ crlookup(const char *devname) const char * crfind(int crid) { - struct crypt_find_op find; + static struct crypt_find_op find; bzero(&find, sizeof(find)); find.crid = crid; @@ -252,7 +252,7 @@ runtest(struct alg *alg, int count, int size, u_long c { int i, fd = crget(); struct timeval start, stop, dt; - char *cleartext, *ciphertext, *originaltext; + char *cleartext, *ciphertext, *originaltext, *key; struct session2_op sop; struct crypt_op cop; char iv[EALG_MAX_BLOCK_LEN]; @@ -260,19 +260,21 @@ runtest(struct alg *alg, int count, int size, u_long c bzero(&sop, sizeof(sop)); if (!alg->ishash) { sop.keylen = (alg->minkeylen + alg->maxkeylen)/2; - sop.key = (char *) malloc(sop.keylen); - if (sop.key == NULL) + key = (char *) malloc(sop.keylen); + if (key == NULL) err(1, "malloc (key)"); for (i = 0; i < sop.keylen; i++) - sop.key[i] = rdigit(); + key[i] = rdigit(); + sop.key = key; sop.cipher = alg->code; } else { sop.mackeylen = (alg->minkeylen + alg->maxkeylen)/2; - sop.mackey = (char *) malloc(sop.mackeylen); - if (sop.mackey == NULL) + key = (char *) malloc(sop.mackeylen); + if (key == NULL) err(1, "malloc (mac)"); for (i = 0; i < sop.mackeylen; i++) - sop.mackey[i] = rdigit(); + key[i] = rdigit(); + sop.mackey = key; sop.mac = alg->code; } sop.crid = crid; From owner-svn-src-stable-11@freebsd.org Fri Feb 16 16:05:03 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F407BF20DBF; Fri, 16 Feb 2018 16:05:02 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5F3082DFB; Fri, 16 Feb 2018 16:05:02 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A09597E0D; Fri, 16 Feb 2018 16:05:02 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1GG526v076411; Fri, 16 Feb 2018 16:05:02 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1GG527J076410; Fri, 16 Feb 2018 16:05:02 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201802161605.w1GG527J076410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 16 Feb 2018 16:05:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329379 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 329379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Feb 2018 16:05:03 -0000 Author: mjg Date: Fri Feb 16 16:05:02 2018 New Revision: 329379 URL: https://svnweb.freebsd.org/changeset/base/329379 Log: MFC r327874: vfs: tidy up vdrop Skip vfs_refcount_release_if_not_last if the interlock is held and just go straight to refcount_release. While here do cosmetic rearrangement of _vhold to better show it contains equivalent behaviour. Modified: stable/11/sys/kern/vfs_subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_subr.c ============================================================================== --- stable/11/sys/kern/vfs_subr.c Fri Feb 16 16:01:39 2018 (r329378) +++ stable/11/sys/kern/vfs_subr.c Fri Feb 16 16:05:02 2018 (r329379) @@ -2769,14 +2769,14 @@ _vhold(struct vnode *vp, bool locked) else ASSERT_VI_UNLOCKED(vp, __func__); CTR2(KTR_VFS, "%s: vp %p", __func__, vp); - if (!locked && vfs_refcount_acquire_if_not_zero(&vp->v_holdcnt)) { - VNASSERT((vp->v_iflag & VI_FREE) == 0, vp, - ("_vhold: vnode with holdcnt is free")); - return; - } - - if (!locked) + if (!locked) { + if (vfs_refcount_acquire_if_not_zero(&vp->v_holdcnt)) { + VNASSERT((vp->v_iflag & VI_FREE) == 0, vp, + ("_vhold: vnode with holdcnt is free")); + return; + } VI_LOCK(vp); + } if ((vp->v_iflag & VI_FREE) == 0) { refcount_acquire(&vp->v_holdcnt); if (!locked) @@ -2830,14 +2830,11 @@ _vdrop(struct vnode *vp, bool locked) CTR2(KTR_VFS, "%s: vp %p", __func__, vp); if ((int)vp->v_holdcnt <= 0) panic("vdrop: holdcnt %d", vp->v_holdcnt); - if (vfs_refcount_release_if_not_last(&vp->v_holdcnt)) { - if (locked) - VI_UNLOCK(vp); - return; - } - - if (!locked) + if (!locked) { + if (vfs_refcount_release_if_not_last(&vp->v_holdcnt)) + return; VI_LOCK(vp); + } if (refcount_release(&vp->v_holdcnt) == 0) { VI_UNLOCK(vp); return; From owner-svn-src-stable-11@freebsd.org Fri Feb 16 16:07:59 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AA6DF210FD; Fri, 16 Feb 2018 16:07:59 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E01F18301C; Fri, 16 Feb 2018 16:07:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0ABD7E11; Fri, 16 Feb 2018 16:07:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1GG7w2R076567; Fri, 16 Feb 2018 16:07:58 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1GG7wRo076564; Fri, 16 Feb 2018 16:07:58 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201802161607.w1GG7wRo076564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 16 Feb 2018 16:07:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329380 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 329380 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Feb 2018 16:07:59 -0000 Author: mjg Date: Fri Feb 16 16:07:58 2018 New Revision: 329380 URL: https://svnweb.freebsd.org/changeset/base/329380 Log: MFC r327875,r327905,r327914: mtx: use fcmpset to cover setting MTX_CONTESTED === rwlock: try regular read unlock even in the hard path Saves on turnstile trips if the lock got more readers. === sx: retry hard shared unlock just like in r327905 for rwlocks Modified: stable/11/sys/kern/kern_mutex.c stable/11/sys/kern/kern_rwlock.c stable/11/sys/kern/kern_sx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_mutex.c ============================================================================== --- stable/11/sys/kern/kern_mutex.c Fri Feb 16 16:05:02 2018 (r329379) +++ stable/11/sys/kern/kern_mutex.c Fri Feb 16 16:07:58 2018 (r329380) @@ -576,6 +576,7 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v) ts = turnstile_trywait(&m->lock_object); v = MTX_READ_VALUE(m); +retry_turnstile: /* * Check if the lock has been released while spinning for @@ -607,10 +608,8 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v) * or the state of the MTX_RECURSED bit changed. */ if ((v & MTX_CONTESTED) == 0 && - !atomic_cmpset_ptr(&m->mtx_lock, v, v | MTX_CONTESTED)) { - turnstile_cancel(ts); - v = MTX_READ_VALUE(m); - continue; + !atomic_fcmpset_ptr(&m->mtx_lock, &v, v | MTX_CONTESTED)) { + goto retry_turnstile; } /* Modified: stable/11/sys/kern/kern_rwlock.c ============================================================================== --- stable/11/sys/kern/kern_rwlock.c Fri Feb 16 16:05:02 2018 (r329379) +++ stable/11/sys/kern/kern_rwlock.c Fri Feb 16 16:07:58 2018 (r329380) @@ -769,9 +769,9 @@ __rw_runlock_hard(struct rwlock *rw, struct thread *td turnstile_chain_lock(&rw->lock_object); v = RW_READ_VALUE(rw); retry_ts: - if (__predict_false(RW_READERS(v) > 1)) { + if (__rw_runlock_try(rw, td, &v)) { turnstile_chain_unlock(&rw->lock_object); - continue; + break; } v &= (RW_LOCK_WAITERS | RW_LOCK_WRITE_SPINNER); Modified: stable/11/sys/kern/kern_sx.c ============================================================================== --- stable/11/sys/kern/kern_sx.c Fri Feb 16 16:05:02 2018 (r329379) +++ stable/11/sys/kern/kern_sx.c Fri Feb 16 16:07:58 2018 (r329380) @@ -1191,7 +1191,7 @@ _sx_sunlock_try(struct sx *sx, uintptr_t *xp) static void __noinline _sx_sunlock_hard(struct sx *sx, uintptr_t x LOCK_FILE_LINE_ARG_DEF) { - int wakeup_swapper; + int wakeup_swapper = 0; uintptr_t setx; if (SCHEDULER_STOPPED()) @@ -1211,6 +1211,9 @@ _sx_sunlock_hard(struct sx *sx, uintptr_t x LOCK_FILE_ for (;;) { MPASS(x & SX_LOCK_EXCLUSIVE_WAITERS); MPASS(!(x & SX_LOCK_SHARED_WAITERS)); + if (_sx_sunlock_try(sx, &x)) + break; + /* * Wake up semantic here is quite simple: * Just wake up all the exclusive waiters. From owner-svn-src-stable-11@freebsd.org Fri Feb 16 16:16:34 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39202F21B20; Fri, 16 Feb 2018 16:16:34 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE42983644; Fri, 16 Feb 2018 16:16:33 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8D737FA2; Fri, 16 Feb 2018 16:16:33 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1GGGXOT081843; Fri, 16 Feb 2018 16:16:33 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1GGGX23081840; Fri, 16 Feb 2018 16:16:33 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201802161616.w1GGGX23081840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 16 Feb 2018 16:16:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329381 - in stable/11/sys: sys vm X-SVN-Group: stable-11 X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in stable/11/sys: sys vm X-SVN-Commit-Revision: 329381 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Feb 2018 16:16:34 -0000 Author: mjg Date: Fri Feb 16 16:16:33 2018 New Revision: 329381 URL: https://svnweb.freebsd.org/changeset/base/329381 Log: MFC r324610: Reduce traffic on vm_cnt.v_free_count The variable is modified with the highly contended page free queue lock. It unnecessarily shares a cacheline with purely read-only fields and is re-read after the lock is dropped in the page allocation code making the hold time longer. Pad the variable just like the others and store the value as found with the lock held instead of re-reading. Provides a modest 1%-ish speed up in concurrent page faults. Due to KBI constraints the field is not moved in this commit, only re-read is avoided. Modified: stable/11/sys/sys/vmmeter.h stable/11/sys/vm/vm_page.c stable/11/sys/vm/vm_phys.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/vmmeter.h ============================================================================== --- stable/11/sys/sys/vmmeter.h Fri Feb 16 16:07:58 2018 (r329380) +++ stable/11/sys/sys/vmmeter.h Fri Feb 16 16:16:33 2018 (r329381) @@ -175,10 +175,10 @@ vm_paging_target(void) * Returns TRUE if the pagedaemon needs to be woken up. */ static inline int -vm_paging_needed(void) +vm_paging_needed(u_int free_count) { - return (vm_cnt.v_free_count < vm_pageout_wakeup_thresh); + return (free_count < vm_pageout_wakeup_thresh); } /* Modified: stable/11/sys/vm/vm_page.c ============================================================================== --- stable/11/sys/vm/vm_page.c Fri Feb 16 16:07:58 2018 (r329380) +++ stable/11/sys/vm/vm_page.c Fri Feb 16 16:16:33 2018 (r329381) @@ -1601,6 +1601,7 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_t pi { vm_page_t m; int flags, req_class; + u_int free_count; KASSERT((object != NULL) == ((req & VM_ALLOC_NOOBJ) == 0) && (object != NULL || (req & VM_ALLOC_SBUSY) == 0) && @@ -1672,7 +1673,7 @@ again: * At this point we had better have found a good page. */ KASSERT(m != NULL, ("missing page")); - vm_phys_freecnt_adj(m, -1); + free_count = vm_phys_freecnt_adj(m, -1); if ((m->flags & PG_ZERO) != 0) vm_page_zero_count--; mtx_unlock(&vm_page_queue_free_mtx); @@ -1737,7 +1738,7 @@ again: * Don't wakeup too often - wakeup the pageout daemon when * we would be nearly out of memory. */ - if (vm_paging_needed()) + if (vm_paging_needed(free_count)) pagedaemon_wakeup(); return (m); @@ -1933,7 +1934,7 @@ retry: pmap_page_set_memattr(m, memattr); pindex++; } - if (vm_paging_needed()) + if (vm_paging_needed(vm_cnt.v_free_count)) pagedaemon_wakeup(); return (m_ret); } @@ -1982,7 +1983,7 @@ vm_page_t vm_page_alloc_freelist(int flind, int req) { vm_page_t m; - u_int flags; + u_int flags, free_count; int req_class; req_class = req & VM_ALLOC_CLASS_MASK; @@ -2013,7 +2014,7 @@ again: mtx_unlock(&vm_page_queue_free_mtx); return (NULL); } - vm_phys_freecnt_adj(m, -1); + free_count = vm_phys_freecnt_adj(m, -1); if ((m->flags & PG_ZERO) != 0) vm_page_zero_count--; mtx_unlock(&vm_page_queue_free_mtx); @@ -2037,7 +2038,7 @@ again: } /* Unmanaged pages don't use "act_count". */ m->oflags = VPO_UNMANAGED; - if (vm_paging_needed()) + if (vm_paging_needed(free_count)) pagedaemon_wakeup(); return (m); } Modified: stable/11/sys/vm/vm_phys.h ============================================================================== --- stable/11/sys/vm/vm_phys.h Fri Feb 16 16:07:58 2018 (r329380) +++ stable/11/sys/vm/vm_phys.h Fri Feb 16 16:16:33 2018 (r329381) @@ -112,13 +112,13 @@ vm_phys_domain(vm_page_t m) #endif } -static inline void +static inline u_int vm_phys_freecnt_adj(vm_page_t m, int adj) { mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); - vm_cnt.v_free_count += adj; vm_phys_domain(m)->vmd_free_count += adj; + return (vm_cnt.v_free_count += adj); } #endif /* _KERNEL */ From owner-svn-src-stable-11@freebsd.org Fri Feb 16 16:41:20 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55155F239ED; Fri, 16 Feb 2018 16:41:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0751E84A2C; Fri, 16 Feb 2018 16:41:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC0EC1042F; Fri, 16 Feb 2018 16:41:19 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1GGfJo3091776; Fri, 16 Feb 2018 16:41:19 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1GGfJFr091773; Fri, 16 Feb 2018 16:41:19 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201802161641.w1GGfJFr091773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 16 Feb 2018 16:41:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329383 - in stable/11: share/man/man9 sys/amd64/include sys/i386/include X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11: share/man/man9 sys/amd64/include sys/i386/include X-SVN-Commit-Revision: 329383 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Feb 2018 16:41:20 -0000 Author: markj Date: Fri Feb 16 16:41:19 2018 New Revision: 329383 URL: https://svnweb.freebsd.org/changeset/base/329383 Log: MFC r315718, r316031: Add support for 8- and 16-bit atomic_(f)cmpset to x86. Modified: stable/11/share/man/man9/atomic.9 stable/11/sys/amd64/include/atomic.h stable/11/sys/i386/include/atomic.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/atomic.9 ============================================================================== --- stable/11/share/man/man9/atomic.9 Fri Feb 16 16:22:54 2018 (r329382) +++ stable/11/share/man/man9/atomic.9 Fri Feb 16 16:41:19 2018 (r329383) @@ -328,9 +328,9 @@ if (*dst == old) { .Ed .El .Pp -The +Some architectures do not implement the .Fn atomic_cmpset -functions are not implemented for the types +functions for the types .Dq Li char , .Dq Li short , .Dq Li 8 , @@ -367,9 +367,9 @@ function also returns despite .Dl *old == *dst . .Pp -The +Some architectures do not implement the .Fn atomic_fcmpset -functions are not implemented for the types +functions for the types .Dq Li char , .Dq Li short , .Dq Li 8 , Modified: stable/11/sys/amd64/include/atomic.h ============================================================================== --- stable/11/sys/amd64/include/atomic.h Fri Feb 16 16:22:54 2018 (r329382) +++ stable/11/sys/amd64/include/atomic.h Fri Feb 16 16:41:19 2018 (r329383) @@ -99,8 +99,13 @@ void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \ void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v) +int atomic_cmpset_char(volatile u_char *dst, u_char expect, u_char src); +int atomic_cmpset_short(volatile u_short *dst, u_short expect, u_short src); int atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src); int atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src); +int atomic_fcmpset_char(volatile u_char *dst, u_char *expect, u_char src); +int atomic_fcmpset_short(volatile u_short *dst, u_short *expect, + u_short src); int atomic_fcmpset_int(volatile u_int *dst, u_int *expect, u_int src); int atomic_fcmpset_long(volatile u_long *dst, u_long *expect, u_long src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); @@ -157,85 +162,62 @@ atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_## struct __hack /* - * Atomic compare and set, used by the mutex functions + * Atomic compare and set, used by the mutex functions. * - * if (*dst == expect) *dst = src (all 32 bit words) + * cmpset: + * if (*dst == expect) + * *dst = src * - * Returns 0 on failure, non-zero on success + * fcmpset: + * if (*dst == *expect) + * *dst = src + * else + * *expect = *dst + * + * Returns 0 on failure, non-zero on success. */ - -static __inline int -atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src) -{ - u_char res; - - __asm __volatile( - " " MPLOCKED " " - " cmpxchgl %3,%1 ; " - " sete %0 ; " - "# atomic_cmpset_int" - : "=q" (res), /* 0 */ - "+m" (*dst), /* 1 */ - "+a" (expect) /* 2 */ - : "r" (src) /* 3 */ - : "memory", "cc"); - return (res); +#define ATOMIC_CMPSET(TYPE) \ +static __inline int \ +atomic_cmpset_##TYPE(volatile u_##TYPE *dst, u_##TYPE expect, u_##TYPE src) \ +{ \ + u_char res; \ + \ + __asm __volatile( \ + " " MPLOCKED " " \ + " cmpxchg %3,%1 ; " \ + " sete %0 ; " \ + "# atomic_cmpset_" #TYPE " " \ + : "=q" (res), /* 0 */ \ + "+m" (*dst), /* 1 */ \ + "+a" (expect) /* 2 */ \ + : "r" (src) /* 3 */ \ + : "memory", "cc"); \ + return (res); \ +} \ + \ +static __inline int \ +atomic_fcmpset_##TYPE(volatile u_##TYPE *dst, u_##TYPE *expect, u_##TYPE src) \ +{ \ + u_char res; \ + \ + __asm __volatile( \ + " " MPLOCKED " " \ + " cmpxchg %3,%1 ; " \ + " sete %0 ; " \ + "# atomic_fcmpset_" #TYPE " " \ + : "=q" (res), /* 0 */ \ + "+m" (*dst), /* 1 */ \ + "+a" (*expect) /* 2 */ \ + : "r" (src) /* 3 */ \ + : "memory", "cc"); \ + return (res); \ } -static __inline int -atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src) -{ - u_char res; +ATOMIC_CMPSET(char); +ATOMIC_CMPSET(short); +ATOMIC_CMPSET(int); +ATOMIC_CMPSET(long); - __asm __volatile( - " " MPLOCKED " " - " cmpxchgq %3,%1 ; " - " sete %0 ; " - "# atomic_cmpset_long" - : "=q" (res), /* 0 */ - "+m" (*dst), /* 1 */ - "+a" (expect) /* 2 */ - : "r" (src) /* 3 */ - : "memory", "cc"); - return (res); -} - -static __inline int -atomic_fcmpset_int(volatile u_int *dst, u_int *expect, u_int src) -{ - u_char res; - - __asm __volatile( - " " MPLOCKED " " - " cmpxchgl %3,%1 ; " - " sete %0 ; " - "# atomic_fcmpset_int" - : "=r" (res), /* 0 */ - "+m" (*dst), /* 1 */ - "+a" (*expect) /* 2 */ - : "r" (src) /* 3 */ - : "memory", "cc"); - return (res); -} - -static __inline int -atomic_fcmpset_long(volatile u_long *dst, u_long *expect, u_long src) -{ - u_char res; - - __asm __volatile( - " " MPLOCKED " " - " cmpxchgq %3,%1 ; " - " sete %0 ; " - "# atomic_fcmpset_long" - : "=r" (res), /* 0 */ - "+m" (*dst), /* 1 */ - "+a" (*expect) /* 2 */ - : "r" (src) /* 3 */ - : "memory", "cc"); - return (res); -} - /* * Atomically add the value of v to the integer pointed to by p and return * the previous value of *p. @@ -524,6 +506,10 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_add_rel_char atomic_add_barr_char #define atomic_subtract_acq_char atomic_subtract_barr_char #define atomic_subtract_rel_char atomic_subtract_barr_char +#define atomic_cmpset_acq_char atomic_cmpset_char +#define atomic_cmpset_rel_char atomic_cmpset_char +#define atomic_fcmpset_acq_char atomic_fcmpset_char +#define atomic_fcmpset_rel_char atomic_fcmpset_char #define atomic_set_acq_short atomic_set_barr_short #define atomic_set_rel_short atomic_set_barr_short @@ -533,6 +519,10 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_add_rel_short atomic_add_barr_short #define atomic_subtract_acq_short atomic_subtract_barr_short #define atomic_subtract_rel_short atomic_subtract_barr_short +#define atomic_cmpset_acq_short atomic_cmpset_short +#define atomic_cmpset_rel_short atomic_cmpset_short +#define atomic_fcmpset_acq_short atomic_fcmpset_short +#define atomic_fcmpset_rel_short atomic_fcmpset_short #define atomic_set_acq_int atomic_set_barr_int #define atomic_set_rel_int atomic_set_barr_int @@ -544,8 +534,8 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_subtract_rel_int atomic_subtract_barr_int #define atomic_cmpset_acq_int atomic_cmpset_int #define atomic_cmpset_rel_int atomic_cmpset_int -#define atomic_fcmpset_acq_int atomic_fcmpset_int -#define atomic_fcmpset_rel_int atomic_fcmpset_int +#define atomic_fcmpset_acq_int atomic_fcmpset_int +#define atomic_fcmpset_rel_int atomic_fcmpset_int #define atomic_set_acq_long atomic_set_barr_long #define atomic_set_rel_long atomic_set_barr_long @@ -557,8 +547,8 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_subtract_rel_long atomic_subtract_barr_long #define atomic_cmpset_acq_long atomic_cmpset_long #define atomic_cmpset_rel_long atomic_cmpset_long -#define atomic_fcmpset_acq_long atomic_fcmpset_long -#define atomic_fcmpset_rel_long atomic_fcmpset_long +#define atomic_fcmpset_acq_long atomic_fcmpset_long +#define atomic_fcmpset_rel_long atomic_fcmpset_long #define atomic_readandclear_int(p) atomic_swap_int(p, 0) #define atomic_readandclear_long(p) atomic_swap_long(p, 0) @@ -578,6 +568,12 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_subtract_rel_8 atomic_subtract_rel_char #define atomic_load_acq_8 atomic_load_acq_char #define atomic_store_rel_8 atomic_store_rel_char +#define atomic_cmpset_8 atomic_cmpset_char +#define atomic_cmpset_acq_8 atomic_cmpset_acq_char +#define atomic_cmpset_rel_8 atomic_cmpset_rel_char +#define atomic_fcmpset_8 atomic_fcmpset_char +#define atomic_fcmpset_acq_8 atomic_fcmpset_acq_char +#define atomic_fcmpset_rel_8 atomic_fcmpset_rel_char /* Operations on 16-bit words. */ #define atomic_set_16 atomic_set_short @@ -594,6 +590,12 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_subtract_rel_16 atomic_subtract_rel_short #define atomic_load_acq_16 atomic_load_acq_short #define atomic_store_rel_16 atomic_store_rel_short +#define atomic_cmpset_16 atomic_cmpset_short +#define atomic_cmpset_acq_16 atomic_cmpset_acq_short +#define atomic_cmpset_rel_16 atomic_cmpset_rel_short +#define atomic_fcmpset_16 atomic_fcmpset_short +#define atomic_fcmpset_acq_16 atomic_fcmpset_acq_short +#define atomic_fcmpset_rel_16 atomic_fcmpset_rel_short /* Operations on 32-bit double words. */ #define atomic_set_32 atomic_set_int Modified: stable/11/sys/i386/include/atomic.h ============================================================================== --- stable/11/sys/i386/include/atomic.h Fri Feb 16 16:22:54 2018 (r329382) +++ stable/11/sys/i386/include/atomic.h Fri Feb 16 16:41:19 2018 (r329383) @@ -107,7 +107,12 @@ __mbu(void) void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \ void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v) +int atomic_cmpset_char(volatile u_char *dst, u_char expect, u_char src); +int atomic_cmpset_short(volatile u_short *dst, u_short expect, u_short src); int atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src); +int atomic_fcmpset_char(volatile u_char *dst, u_char *expect, u_char src); +int atomic_fcmpset_short(volatile u_short *dst, u_short *expect, + u_short src); int atomic_fcmpset_int(volatile u_int *dst, u_int *expect, u_int src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); int atomic_testandset_int(volatile u_int *p, u_int v); @@ -166,49 +171,61 @@ atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_## struct __hack /* - * Atomic compare and set, used by the mutex functions + * Atomic compare and set, used by the mutex functions. * - * if (*dst == expect) *dst = src (all 32 bit words) + * cmpset: + * if (*dst == expect) + * *dst = src * - * Returns 0 on failure, non-zero on success + * fcmpset: + * if (*dst == *expect) + * *dst = src + * else + * *expect = *dst + * + * Returns 0 on failure, non-zero on success. */ - -static __inline int -atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src) -{ - u_char res; - - __asm __volatile( - " " MPLOCKED " " - " cmpxchgl %3,%1 ; " - " sete %0 ; " - "# atomic_cmpset_int" - : "=q" (res), /* 0 */ - "+m" (*dst), /* 1 */ - "+a" (expect) /* 2 */ - : "r" (src) /* 3 */ - : "memory", "cc"); - return (res); +#define ATOMIC_CMPSET(TYPE, CONS) \ +static __inline int \ +atomic_cmpset_##TYPE(volatile u_##TYPE *dst, u_##TYPE expect, u_##TYPE src) \ +{ \ + u_char res; \ + \ + __asm __volatile( \ + " " MPLOCKED " " \ + " cmpxchg %3,%1 ; " \ + " sete %0 ; " \ + "# atomic_cmpset_" #TYPE " " \ + : "=q" (res), /* 0 */ \ + "+m" (*dst), /* 1 */ \ + "+a" (expect) /* 2 */ \ + : CONS (src) /* 3 */ \ + : "memory", "cc"); \ + return (res); \ +} \ + \ +static __inline int \ +atomic_fcmpset_##TYPE(volatile u_##TYPE *dst, u_##TYPE *expect, u_##TYPE src) \ +{ \ + u_char res; \ + \ + __asm __volatile( \ + " " MPLOCKED " " \ + " cmpxchg %3,%1 ; " \ + " sete %0 ; " \ + "# atomic_fcmpset_" #TYPE " " \ + : "=q" (res), /* 0 */ \ + "+m" (*dst), /* 1 */ \ + "+a" (*expect) /* 2 */ \ + : CONS (src) /* 3 */ \ + : "memory", "cc"); \ + return (res); \ } -static __inline int -atomic_fcmpset_int(volatile u_int *dst, u_int *expect, u_int src) -{ - u_char res; +ATOMIC_CMPSET(char, "q"); +ATOMIC_CMPSET(short, "r"); +ATOMIC_CMPSET(int, "r"); - __asm __volatile( - " " MPLOCKED " " - " cmpxchgl %3,%1 ; " - " sete %0 ; " - "# atomic_cmpset_int" - : "=q" (res), /* 0 */ - "+m" (*dst), /* 1 */ - "+a" (*expect) /* 2 */ - : "r" (src) /* 3 */ - : "memory", "cc"); - return (res); -} - /* * Atomically add the value of v to the integer pointed to by p and return * the previous value of *p. @@ -668,6 +685,10 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_add_rel_char atomic_add_barr_char #define atomic_subtract_acq_char atomic_subtract_barr_char #define atomic_subtract_rel_char atomic_subtract_barr_char +#define atomic_cmpset_acq_char atomic_cmpset_char +#define atomic_cmpset_rel_char atomic_cmpset_char +#define atomic_fcmpset_acq_char atomic_fcmpset_char +#define atomic_fcmpset_rel_char atomic_fcmpset_char #define atomic_set_acq_short atomic_set_barr_short #define atomic_set_rel_short atomic_set_barr_short @@ -677,6 +698,10 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_add_rel_short atomic_add_barr_short #define atomic_subtract_acq_short atomic_subtract_barr_short #define atomic_subtract_rel_short atomic_subtract_barr_short +#define atomic_cmpset_acq_short atomic_cmpset_short +#define atomic_cmpset_rel_short atomic_cmpset_short +#define atomic_fcmpset_acq_short atomic_fcmpset_short +#define atomic_fcmpset_rel_short atomic_fcmpset_short #define atomic_set_acq_int atomic_set_barr_int #define atomic_set_rel_int atomic_set_barr_int @@ -722,6 +747,12 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_subtract_rel_8 atomic_subtract_rel_char #define atomic_load_acq_8 atomic_load_acq_char #define atomic_store_rel_8 atomic_store_rel_char +#define atomic_cmpset_8 atomic_cmpset_char +#define atomic_cmpset_acq_8 atomic_cmpset_acq_char +#define atomic_cmpset_rel_8 atomic_cmpset_rel_char +#define atomic_fcmpset_8 atomic_fcmpset_char +#define atomic_fcmpset_acq_8 atomic_fcmpset_acq_char +#define atomic_fcmpset_rel_8 atomic_fcmpset_rel_char /* Operations on 16-bit words. */ #define atomic_set_16 atomic_set_short @@ -738,6 +769,12 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_subtract_rel_16 atomic_subtract_rel_short #define atomic_load_acq_16 atomic_load_acq_short #define atomic_store_rel_16 atomic_store_rel_short +#define atomic_cmpset_16 atomic_cmpset_short +#define atomic_cmpset_acq_16 atomic_cmpset_acq_short +#define atomic_cmpset_rel_16 atomic_cmpset_rel_short +#define atomic_fcmpset_16 atomic_fcmpset_short +#define atomic_fcmpset_acq_16 atomic_fcmpset_acq_short +#define atomic_fcmpset_rel_16 atomic_fcmpset_rel_short /* Operations on 32-bit double words. */ #define atomic_set_32 atomic_set_int From owner-svn-src-stable-11@freebsd.org Fri Feb 16 18:23:28 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A36FAF0610C; Fri, 16 Feb 2018 18:23:28 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 50F1B6A306; Fri, 16 Feb 2018 18:23:28 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4905811531; Fri, 16 Feb 2018 18:23:28 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1GINSI3047776; Fri, 16 Feb 2018 18:23:28 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1GINSU2047775; Fri, 16 Feb 2018 18:23:28 GMT (envelope-from np@FreeBSD.org) Message-Id: <201802161823.w1GINSU2047775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 16 Feb 2018 18:23:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329391 - stable/11/sys/dev/cxgbe/iw_cxgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/11/sys/dev/cxgbe/iw_cxgbe X-SVN-Commit-Revision: 329391 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Feb 2018 18:23:28 -0000 Author: np Date: Fri Feb 16 18:23:27 2018 New Revision: 329391 URL: https://svnweb.freebsd.org/changeset/base/329391 Log: iw_cxgbe: Follow-up fix to r329017, which updated the code associated with QP flush. This is a direct commit to stable/11. Sponsored by: Chelsio Communications Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/qp.c Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/qp.c ============================================================================== --- stable/11/sys/dev/cxgbe/iw_cxgbe/qp.c Fri Feb 16 18:07:04 2018 (r329390) +++ stable/11/sys/dev/cxgbe/iw_cxgbe/qp.c Fri Feb 16 18:23:27 2018 (r329391) @@ -1036,7 +1036,8 @@ static void __flush_qp(struct c4iw_qp *qhp, struct c4i /* locking heirarchy: cq lock first, then qp lock. */ spin_lock_irqsave(&schp->lock, flag); spin_lock(&qhp->lock); - c4iw_flush_hw_cq(schp); + if (schp != rchp) + c4iw_flush_hw_cq(schp); flushed = c4iw_flush_sq(qhp); spin_unlock(&qhp->lock); spin_unlock_irqrestore(&schp->lock, flag); From owner-svn-src-stable-11@freebsd.org Fri Feb 16 18:49:51 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE65EF07D9F; Fri, 16 Feb 2018 18:49:50 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 91B4D6B372; Fri, 16 Feb 2018 18:49:50 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C8171187E; Fri, 16 Feb 2018 18:49:50 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1GInoLL058847; Fri, 16 Feb 2018 18:49:50 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1GInoPU058846; Fri, 16 Feb 2018 18:49:50 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201802161849.w1GInoPU058846@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Fri, 16 Feb 2018 18:49:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329392 - stable/11/usr.sbin/mountd X-SVN-Group: stable-11 X-SVN-Commit-Author: brd X-SVN-Commit-Paths: stable/11/usr.sbin/mountd X-SVN-Commit-Revision: 329392 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Feb 2018 18:49:51 -0000 Author: brd (doc,ports committer) Date: Fri Feb 16 18:49:50 2018 New Revision: 329392 URL: https://svnweb.freebsd.org/changeset/base/329392 Log: MFC r329009 mountd(8): Produce vaguely meaningful error messages Approved by: cem, will Modified: stable/11/usr.sbin/mountd/mountd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/mountd/mountd.c ============================================================================== --- stable/11/usr.sbin/mountd/mountd.c Fri Feb 16 18:23:27 2018 (r329391) +++ stable/11/usr.sbin/mountd/mountd.c Fri Feb 16 18:49:50 2018 (r329392) @@ -199,7 +199,7 @@ static struct hostlist *get_ht(void); static int get_line(void); static void get_mountlist(void); static int get_net(char *, struct netmsk *, int); -static void getexp_err(struct exportlist *, struct grouplist *); +static void getexp_err(struct exportlist *, struct grouplist *, const char *); static struct grouplist *get_grp(void); static void hang_dirp(struct dirlist *, struct grouplist *, struct exportlist *, int); @@ -1448,12 +1448,13 @@ get_exportlist_one(void) tgrp = grp = get_grp(); while (len > 0) { if (len > MNTNAMLEN) { - getexp_err(ep, tgrp); + getexp_err(ep, tgrp, "mountpoint too long"); goto nextline; } if (*cp == '-') { if (ep == (struct exportlist *)NULL) { - getexp_err(ep, tgrp); + getexp_err(ep, tgrp, + "flag before export path definition"); goto nextline; } if (debug) @@ -1461,7 +1462,7 @@ get_exportlist_one(void) got_nondir = 1; if (do_opt(&cp, &endcp, ep, grp, &has_host, &exflags, &anon)) { - getexp_err(ep, tgrp); + getexp_err(ep, tgrp, NULL); goto nextline; } } else if (*cp == '/') { @@ -1469,8 +1470,7 @@ get_exportlist_one(void) *endcp = '\0'; if (v4root_phase > 1) { if (dirp != NULL) { - syslog(LOG_ERR, "Multiple V4 dirs"); - getexp_err(ep, tgrp); + getexp_err(ep, tgrp, "Multiple V4 dirs"); goto nextline; } } @@ -1480,14 +1480,12 @@ get_exportlist_one(void) syslog(LOG_ERR, "Warning: exporting of " "automounted fs %s not supported", cp); if (got_nondir) { - syslog(LOG_ERR, "dirs must be first"); - getexp_err(ep, tgrp); + getexp_err(ep, tgrp, "dirs must be first"); goto nextline; } if (v4root_phase == 1) { if (dirp != NULL) { - syslog(LOG_ERR, "Multiple V4 dirs"); - getexp_err(ep, tgrp); + getexp_err(ep, tgrp, "Multiple V4 dirs"); goto nextline; } if (strlen(v4root_dirpath) == 0) { @@ -1497,7 +1495,7 @@ get_exportlist_one(void) != 0) { syslog(LOG_ERR, "different V4 dirpath %s", cp); - getexp_err(ep, tgrp); + getexp_err(ep, tgrp, NULL); goto nextline; } dirp = cp; @@ -1510,7 +1508,8 @@ get_exportlist_one(void) fsb.f_fsid.val[0] || ep->ex_fs.val[1] != fsb.f_fsid.val[1]) { - getexp_err(ep, tgrp); + getexp_err(ep, tgrp, + "fsid mismatch"); goto nextline; } } else { @@ -1543,7 +1542,8 @@ get_exportlist_one(void) dirplen = len; } } else { - getexp_err(ep, tgrp); + getexp_err(ep, tgrp, + "symbolic link in export path or statfs failed"); goto nextline; } *endcp = savedc; @@ -1552,7 +1552,8 @@ get_exportlist_one(void) *endcp = '\0'; got_nondir = 1; if (ep == (struct exportlist *)NULL) { - getexp_err(ep, tgrp); + getexp_err(ep, tgrp, + "host(s) before export path definition"); goto nextline; } @@ -1590,7 +1591,7 @@ get_exportlist_one(void) len = endcp - cp; } if (check_options(dirhead)) { - getexp_err(ep, tgrp); + getexp_err(ep, tgrp, NULL); goto nextline; } if (!has_host) { @@ -1603,8 +1604,7 @@ get_exportlist_one(void) * host(s) on the same line. */ } else if ((opt_flags & OP_NET) && tgrp->gr_next) { - syslog(LOG_ERR, "network/host conflict"); - getexp_err(ep, tgrp); + getexp_err(ep, tgrp, "network/host conflict"); goto nextline; /* @@ -1616,14 +1616,13 @@ get_exportlist_one(void) while (grp && grp->gr_type == GT_IGNORE) grp = grp->gr_next; if (! grp) { - getexp_err(ep, tgrp); + getexp_err(ep, tgrp, "no valid entries"); goto nextline; } } if (v4root_phase == 1) { - syslog(LOG_ERR, "V4:root, no dirp, ignored"); - getexp_err(ep, tgrp); + getexp_err(ep, tgrp, "V4:root, no dirp, ignored"); goto nextline; } @@ -1636,7 +1635,7 @@ get_exportlist_one(void) do { if (do_mount(ep, grp, exflags, &anon, dirp, dirplen, &fsb)) { - getexp_err(ep, tgrp); + getexp_err(ep, tgrp, NULL); goto nextline; } } while (grp->gr_next && (grp = grp->gr_next)); @@ -1878,12 +1877,17 @@ get_grp(void) * Clean up upon an error in get_exportlist(). */ static void -getexp_err(struct exportlist *ep, struct grouplist *grp) +getexp_err(struct exportlist *ep, struct grouplist *grp, const char *reason) { struct grouplist *tgrp; - if (!(opt_flags & OP_QUIET)) - syslog(LOG_ERR, "bad exports list line %s", line); + if (!(opt_flags & OP_QUIET)) { + if (reason != NULL) + syslog(LOG_ERR, "bad exports list line '%s': %s", line, + reason); + else + syslog(LOG_ERR, "bad exports list line '%s'", line); + } if (ep && (ep->ex_flag & EX_LINKED) == 0) free_exp(ep); while (grp) { From owner-svn-src-stable-11@freebsd.org Sat Feb 17 02:14:02 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24D32F03C2A; Sat, 17 Feb 2018 02:14:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CC7E67F7B1; Sat, 17 Feb 2018 02:14:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7543163B3; Sat, 17 Feb 2018 02:14:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1H2E1if085544; Sat, 17 Feb 2018 02:14:01 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1H2E1Vg085541; Sat, 17 Feb 2018 02:14:01 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802170214.w1H2E1Vg085541@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 17 Feb 2018 02:14:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329423 - stable/11/stand/libsa X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/libsa X-SVN-Commit-Revision: 329423 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Feb 2018 02:14:02 -0000 Author: kevans Date: Sat Feb 17 02:14:01 2018 New Revision: 329423 URL: https://svnweb.freebsd.org/changeset/base/329423 Log: MFC r329264: libsa: Fix IP recv timeout [This is slightly modified to not set `t` in the middle of the loop so that the connection will eventually timeout after MAXTMO] readip() doesn't, at the moment, properly indicate to callers that it has timed out. One can tell that it's timed out if errno == EAGAIN when it returns, but this is not ideal. Restructure it a little bit to explicitly set errno to ETIMEDOUT if we've exhausted tleft. I found two places that care about where it timed out or not: sendrecv in net.c and sendrecv_tftp. Both are structured to pass smaller timeout values to readip while tracking a larger timeout. Neither of them were able to do this properly with readip not indicating ETIMEDOUT, so fix it. While here, straighten out the time (t/t1) usage in sendrecv_tftp. This would have manifested itself in periodic failures to NFS/TFTP boot for no apparent reason because MINTMO/MAXTMO were not actually being respected properly. Problems were not reported with NFS, only TFTP. Modified: stable/11/stand/libsa/ip.c stable/11/stand/libsa/net.c stable/11/stand/libsa/tftp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/libsa/ip.c ============================================================================== --- stable/11/stand/libsa/ip.c Sat Feb 17 00:24:50 2018 (r329422) +++ stable/11/stand/libsa/ip.c Sat Feb 17 02:14:01 2018 (r329423) @@ -416,8 +416,13 @@ readip(struct iodesc *d, void **pkt, void **payload, t while ((getsecs() - t) < tleft) { errno = 0; ret = readipv4(d, pkt, payload, tleft, proto); + if (ret >= 0) + return (ret); + /* Bubble up the error if it wasn't successful */ if (errno != EAGAIN) - break; + return (-1); } - return (ret); + /* We've exhausted tleft; timeout */ + errno = ETIMEDOUT; + return (-1); } Modified: stable/11/stand/libsa/net.c ============================================================================== --- stable/11/stand/libsa/net.c Sat Feb 17 00:24:50 2018 (r329422) +++ stable/11/stand/libsa/net.c Sat Feb 17 02:14:01 2018 (r329423) @@ -118,7 +118,7 @@ sendrecv(struct iodesc *d, /* Try to get a packet and process it. */ cc = (*rproc)(d, pkt, payload, tleft); /* Return on data, EOF or real error. */ - if (cc != -1 || errno != 0) + if (cc != -1 || (errno != 0 && errno != ETIMEDOUT)) return (cc); /* Timed out or didn't get the packet we're waiting for */ Modified: stable/11/stand/libsa/tftp.c ============================================================================== --- stable/11/stand/libsa/tftp.c Sat Feb 17 00:24:50 2018 (r329422) +++ stable/11/stand/libsa/tftp.c Sat Feb 17 02:14:01 2018 (r329423) @@ -638,14 +638,20 @@ sendrecv_tftp(struct tftp_handle *h, if (cc == -1) { /* Error on transmit; wait before retrying */ while ((getsecs() - t1) < tleft); + t1 = getsecs(); continue; } + t1 = getsecs(); recvnext: + if ((getsecs() - t) > MAXTMO) { + errno = ETIMEDOUT; + return -1; + } /* Try to get a packet and process it. */ cc = (*rproc)(h, pkt, payload, tleft, rtype); /* Return on data, EOF or real error. */ - if (cc != -1 || errno != 0) + if (cc != -1 || (errno != 0 && errno != ETIMEDOUT)) return (cc); if ((getsecs() - t1) < tleft) { goto recvnext; From owner-svn-src-stable-11@freebsd.org Sat Feb 17 09:58:54 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 472F8F21BBA; Sat, 17 Feb 2018 09:58:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E901A720E1; Sat, 17 Feb 2018 09:58:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E401C1B1D8; Sat, 17 Feb 2018 09:58:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1H9wrPx017173; Sat, 17 Feb 2018 09:58:53 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1H9wrCg017172; Sat, 17 Feb 2018 09:58:53 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802170958.w1H9wrCg017172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 17 Feb 2018 09:58:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329450 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 329450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Feb 2018 09:58:54 -0000 Author: hselasky Date: Sat Feb 17 09:58:53 2018 New Revision: 329450 URL: https://svnweb.freebsd.org/changeset/base/329450 Log: Bump the FreeBSD version after r329383 to indicate that the cmpxchg() macro is now fully functional in the LinuxKPI. This is a direct commit. Sponsored by: Mellanox Technologies Modified: stable/11/sys/sys/param.h Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Sat Feb 17 09:03:11 2018 (r329449) +++ stable/11/sys/sys/param.h Sat Feb 17 09:58:53 2018 (r329450) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1101509 /* Master, propagated to newvers */ +#define __FreeBSD_version 1101510 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable-11@freebsd.org Sat Feb 17 18:00:03 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B81BAF24847; Sat, 17 Feb 2018 18:00:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 67DF48C08C; Sat, 17 Feb 2018 18:00:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48A3420073; Sat, 17 Feb 2018 18:00:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1HI02Y3064030; Sat, 17 Feb 2018 18:00:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1HI01KX064024; Sat, 17 Feb 2018 18:00:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201802171800.w1HI01KX064024@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 17 Feb 2018 18:00:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329462 - in stable/11/sys: amd64/amd64 amd64/ia32 amd64/include amd64/vmm amd64/vmm/intel dev/cpuctl dev/hyperv/vmbus dev/hyperv/vmbus/amd64 dev/hyperv/vmbus/i386 i386/i386 x86/include... X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 amd64/ia32 amd64/include amd64/vmm amd64/vmm/intel dev/cpuctl dev/hyperv/vmbus dev/hyperv/vmbus/amd64 dev/hyperv/vmbus/i386 i386/i386 x86/include x86/isa x86/x86 x86/xen X-SVN-Commit-Revision: 329462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Feb 2018 18:00:03 -0000 Author: kib Date: Sat Feb 17 18:00:01 2018 New Revision: 329462 URL: https://svnweb.freebsd.org/changeset/base/329462 Log: MFC r328083,328096,328116,328119,328120,328128,328135,328153,328157, 328166,328177,328199,328202,328205,328468,328470,328624,328625,328627, 328628,329214,329297,329365: Meltdown mitigation by PTI, PCID optimization of PTI, and kernel use of IBRS for some mitigations of Spectre. Tested by: emaste, Arshan Khanifar Discussed with: jkim Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/amd64/amd64/apic_vector.S stable/11/sys/amd64/amd64/atpic_vector.S stable/11/sys/amd64/amd64/cpu_switch.S stable/11/sys/amd64/amd64/db_trace.c stable/11/sys/amd64/amd64/exception.S stable/11/sys/amd64/amd64/genassym.c stable/11/sys/amd64/amd64/initcpu.c stable/11/sys/amd64/amd64/machdep.c stable/11/sys/amd64/amd64/mp_machdep.c stable/11/sys/amd64/amd64/pmap.c stable/11/sys/amd64/amd64/support.S stable/11/sys/amd64/amd64/sys_machdep.c stable/11/sys/amd64/amd64/trap.c stable/11/sys/amd64/amd64/vm_machdep.c stable/11/sys/amd64/ia32/ia32_exception.S stable/11/sys/amd64/ia32/ia32_syscall.c stable/11/sys/amd64/include/asmacros.h stable/11/sys/amd64/include/frame.h stable/11/sys/amd64/include/intr_machdep.h stable/11/sys/amd64/include/md_var.h stable/11/sys/amd64/include/pcb.h stable/11/sys/amd64/include/pcpu.h stable/11/sys/amd64/include/pmap.h stable/11/sys/amd64/include/smp.h stable/11/sys/amd64/vmm/intel/vmx.c stable/11/sys/amd64/vmm/vmm.c stable/11/sys/dev/cpuctl/cpuctl.c stable/11/sys/dev/hyperv/vmbus/amd64/vmbus_vector.S stable/11/sys/dev/hyperv/vmbus/i386/vmbus_vector.S stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/i386/i386/apic_vector.s stable/11/sys/i386/i386/atpic_vector.s stable/11/sys/i386/i386/exception.s stable/11/sys/i386/i386/machdep.c stable/11/sys/i386/i386/pmap.c stable/11/sys/i386/i386/support.s stable/11/sys/i386/i386/vm_machdep.c stable/11/sys/x86/include/apicvar.h stable/11/sys/x86/include/specialreg.h stable/11/sys/x86/include/x86_smp.h stable/11/sys/x86/include/x86_var.h stable/11/sys/x86/isa/atpic.c stable/11/sys/x86/x86/cpu_machdep.c stable/11/sys/x86/x86/identcpu.c stable/11/sys/x86/x86/local_apic.c stable/11/sys/x86/x86/mp_x86.c stable/11/sys/x86/xen/pv.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/apic_vector.S ============================================================================== --- stable/11/sys/amd64/amd64/apic_vector.S Sat Feb 17 17:23:43 2018 (r329461) +++ stable/11/sys/amd64/amd64/apic_vector.S Sat Feb 17 18:00:01 2018 (r329462) @@ -2,7 +2,13 @@ * Copyright (c) 1989, 1990 William F. Jolitz. * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2014-2018 The FreeBSD Foundation + * All rights reserved. * + * Portions of this software were developed by + * Konstantin Belousov under sponsorship from + * the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -38,12 +44,12 @@ #include "opt_smp.h" +#include "assym.s" + #include #include #include -#include "assym.s" - #ifdef SMP #define LK lock ; #else @@ -73,30 +79,28 @@ as_lapic_eoi: * translates that into a vector, and passes the vector to the * lapic_handle_intr() function. */ -#define ISR_VEC(index, vec_name) \ - .text ; \ - SUPERALIGN_TEXT ; \ -IDTVEC(vec_name) ; \ - PUSH_FRAME ; \ - FAKE_MCOUNT(TF_RIP(%rsp)) ; \ - cmpl $0,x2apic_mode ; \ - je 1f ; \ - movl $(MSR_APIC_ISR0 + index),%ecx ; \ - rdmsr ; \ - jmp 2f ; \ -1: ; \ - movq lapic_map, %rdx ; /* pointer to local APIC */ \ - movl LA_ISR + 16 * (index)(%rdx), %eax ; /* load ISR */ \ -2: ; \ - bsrl %eax, %eax ; /* index of highest set bit in ISR */ \ - jz 3f ; \ - addl $(32 * index),%eax ; \ - movq %rsp, %rsi ; \ - movl %eax, %edi ; /* pass the IRQ */ \ - call lapic_handle_intr ; \ -3: ; \ - MEXITCOUNT ; \ + .macro ISR_VEC index, vec_name + INTR_HANDLER \vec_name + FAKE_MCOUNT(TF_RIP(%rsp)) + cmpl $0,x2apic_mode + je 1f + movl $(MSR_APIC_ISR0 + \index),%ecx + rdmsr + jmp 2f +1: + movq lapic_map, %rdx /* pointer to local APIC */ + movl LA_ISR + 16 * (\index)(%rdx), %eax /* load ISR */ +2: + bsrl %eax, %eax /* index of highest set bit in ISR */ + jz 3f + addl $(32 * \index),%eax + movq %rsp, %rsi + movl %eax, %edi /* pass the IRQ */ + call lapic_handle_intr +3: + MEXITCOUNT jmp doreti + .endm /* * Handle "spurious INTerrupts". @@ -108,26 +112,21 @@ IDTVEC(vec_name) ; \ .text SUPERALIGN_TEXT IDTVEC(spuriousint) - /* No EOI cycle used here */ - jmp doreti_iret - ISR_VEC(1, apic_isr1) - ISR_VEC(2, apic_isr2) - ISR_VEC(3, apic_isr3) - ISR_VEC(4, apic_isr4) - ISR_VEC(5, apic_isr5) - ISR_VEC(6, apic_isr6) - ISR_VEC(7, apic_isr7) + ISR_VEC 1, apic_isr1 + ISR_VEC 2, apic_isr2 + ISR_VEC 3, apic_isr3 + ISR_VEC 4, apic_isr4 + ISR_VEC 5, apic_isr5 + ISR_VEC 6, apic_isr6 + ISR_VEC 7, apic_isr7 /* * Local APIC periodic timer handler. */ - .text - SUPERALIGN_TEXT -IDTVEC(timerint) - PUSH_FRAME + INTR_HANDLER timerint FAKE_MCOUNT(TF_RIP(%rsp)) movq %rsp, %rdi call lapic_handle_timer @@ -137,10 +136,7 @@ IDTVEC(timerint) /* * Local APIC CMCI handler. */ - .text - SUPERALIGN_TEXT -IDTVEC(cmcint) - PUSH_FRAME + INTR_HANDLER cmcint FAKE_MCOUNT(TF_RIP(%rsp)) call lapic_handle_cmc MEXITCOUNT @@ -149,10 +145,7 @@ IDTVEC(cmcint) /* * Local APIC error interrupt handler. */ - .text - SUPERALIGN_TEXT -IDTVEC(errorint) - PUSH_FRAME + INTR_HANDLER errorint FAKE_MCOUNT(TF_RIP(%rsp)) call lapic_handle_error MEXITCOUNT @@ -163,10 +156,7 @@ IDTVEC(errorint) * Xen event channel upcall interrupt handler. * Only used when the hypervisor supports direct vector callbacks. */ - .text - SUPERALIGN_TEXT -IDTVEC(xen_intr_upcall) - PUSH_FRAME + INTR_HANDLER xen_intr_upcall FAKE_MCOUNT(TF_RIP(%rsp)) movq %rsp, %rdi call xen_intr_handle_upcall @@ -183,74 +173,68 @@ IDTVEC(xen_intr_upcall) SUPERALIGN_TEXT invltlb_ret: call as_lapic_eoi - POP_FRAME - jmp doreti_iret + jmp ld_regs SUPERALIGN_TEXT -IDTVEC(invltlb) - PUSH_FRAME - + INTR_HANDLER invltlb call invltlb_handler jmp invltlb_ret -IDTVEC(invltlb_pcid) - PUSH_FRAME - + INTR_HANDLER invltlb_pcid call invltlb_pcid_handler jmp invltlb_ret -IDTVEC(invltlb_invpcid) - PUSH_FRAME - + INTR_HANDLER invltlb_invpcid_nopti call invltlb_invpcid_handler jmp invltlb_ret + INTR_HANDLER invltlb_invpcid_pti + call invltlb_invpcid_pti_handler + jmp invltlb_ret + /* * Single page TLB shootdown */ - .text + INTR_HANDLER invlpg + call invlpg_handler + jmp invltlb_ret - SUPERALIGN_TEXT -IDTVEC(invlpg) - PUSH_FRAME + INTR_HANDLER invlpg_invpcid + call invlpg_invpcid_handler + jmp invltlb_ret - call invlpg_handler + INTR_HANDLER invlpg_pcid + call invlpg_pcid_handler jmp invltlb_ret /* * Page range TLB shootdown. */ - .text - SUPERALIGN_TEXT -IDTVEC(invlrng) - PUSH_FRAME - + INTR_HANDLER invlrng call invlrng_handler jmp invltlb_ret + INTR_HANDLER invlrng_invpcid + call invlrng_invpcid_handler + jmp invltlb_ret + + INTR_HANDLER invlrng_pcid + call invlrng_pcid_handler + jmp invltlb_ret + /* * Invalidate cache. */ - .text - SUPERALIGN_TEXT -IDTVEC(invlcache) - PUSH_FRAME - + INTR_HANDLER invlcache call invlcache_handler jmp invltlb_ret /* * Handler for IPIs sent via the per-cpu IPI bitmap. */ - .text - SUPERALIGN_TEXT -IDTVEC(ipi_intr_bitmap_handler) - PUSH_FRAME - + INTR_HANDLER ipi_intr_bitmap_handler call as_lapic_eoi - FAKE_MCOUNT(TF_RIP(%rsp)) - call ipi_bitmap_handler MEXITCOUNT jmp doreti @@ -258,24 +242,15 @@ IDTVEC(ipi_intr_bitmap_handler) /* * Executed by a CPU when it receives an IPI_STOP from another CPU. */ - .text - SUPERALIGN_TEXT -IDTVEC(cpustop) - PUSH_FRAME - + INTR_HANDLER cpustop call as_lapic_eoi - call cpustop_handler jmp doreti /* * Executed by a CPU when it receives an IPI_SUSPEND from another CPU. */ - .text - SUPERALIGN_TEXT -IDTVEC(cpususpend) - PUSH_FRAME - + INTR_HANDLER cpususpend call cpususpend_handler call as_lapic_eoi jmp doreti @@ -285,10 +260,7 @@ IDTVEC(cpususpend) * * - Calls the generic rendezvous action function. */ - .text - SUPERALIGN_TEXT -IDTVEC(rendezvous) - PUSH_FRAME + INTR_HANDLER rendezvous #ifdef COUNT_IPIS movl PCPU(CPUID), %eax movq ipi_rendezvous_counts(,%rax,8), %rax @@ -327,5 +299,9 @@ IDTVEC(justreturn) popq %rcx popq %rax jmp doreti_iret + + INTR_HANDLER justreturn1 + call as_lapic_eoi + jmp doreti #endif /* SMP */ Modified: stable/11/sys/amd64/amd64/atpic_vector.S ============================================================================== --- stable/11/sys/amd64/amd64/atpic_vector.S Sat Feb 17 17:23:43 2018 (r329461) +++ stable/11/sys/amd64/amd64/atpic_vector.S Sat Feb 17 18:00:01 2018 (r329462) @@ -36,38 +36,35 @@ * master and slave interrupt controllers. */ +#include "assym.s" #include -#include "assym.s" - /* * Macros for interrupt entry, call to handler, and exit. */ -#define INTR(irq_num, vec_name) \ - .text ; \ - SUPERALIGN_TEXT ; \ -IDTVEC(vec_name) ; \ - PUSH_FRAME ; \ - FAKE_MCOUNT(TF_RIP(%rsp)) ; \ - movq %rsp, %rsi ; \ - movl $irq_num, %edi; /* pass the IRQ */ \ - call atpic_handle_intr ; \ - MEXITCOUNT ; \ + .macro INTR irq_num, vec_name + INTR_HANDLER \vec_name + FAKE_MCOUNT(TF_RIP(%rsp)) + movq %rsp, %rsi + movl $\irq_num, %edi /* pass the IRQ */ + call atpic_handle_intr + MEXITCOUNT jmp doreti + .endm - INTR(0, atpic_intr0) - INTR(1, atpic_intr1) - INTR(2, atpic_intr2) - INTR(3, atpic_intr3) - INTR(4, atpic_intr4) - INTR(5, atpic_intr5) - INTR(6, atpic_intr6) - INTR(7, atpic_intr7) - INTR(8, atpic_intr8) - INTR(9, atpic_intr9) - INTR(10, atpic_intr10) - INTR(11, atpic_intr11) - INTR(12, atpic_intr12) - INTR(13, atpic_intr13) - INTR(14, atpic_intr14) - INTR(15, atpic_intr15) + INTR 0, atpic_intr0 + INTR 1, atpic_intr1 + INTR 2, atpic_intr2 + INTR 3, atpic_intr3 + INTR 4, atpic_intr4 + INTR 5, atpic_intr5 + INTR 6, atpic_intr6 + INTR 7, atpic_intr7 + INTR 8, atpic_intr8 + INTR 9, atpic_intr9 + INTR 10, atpic_intr10 + INTR 11, atpic_intr11 + INTR 12, atpic_intr12 + INTR 13, atpic_intr13 + INTR 14, atpic_intr14 + INTR 15, atpic_intr15 Modified: stable/11/sys/amd64/amd64/cpu_switch.S ============================================================================== --- stable/11/sys/amd64/amd64/cpu_switch.S Sat Feb 17 17:23:43 2018 (r329461) +++ stable/11/sys/amd64/amd64/cpu_switch.S Sat Feb 17 18:00:01 2018 (r329462) @@ -215,8 +215,10 @@ done_tss: movq %r8,PCPU(RSP0) movq %r8,PCPU(CURPCB) /* Update the TSS_RSP0 pointer for the next interrupt */ + cmpb $0,pti(%rip) + jne 1f movq %r8,TSS_RSP0(%rdx) - movq %r12,PCPU(CURTHREAD) /* into next thread */ +1: movq %r12,PCPU(CURTHREAD) /* into next thread */ /* Test if debug registers should be restored. */ testl $PCB_DBREGS,PCB_FLAGS(%r8) @@ -293,7 +295,12 @@ do_tss: movq %rdx,PCPU(TSSP) shrq $8,%rcx movl %ecx,8(%rax) movb $0x89,5(%rax) /* unset busy */ - movl $TSSSEL,%eax + cmpb $0,pti(%rip) + je 1f + movq PCPU(PRVSPACE),%rax + addq $PC_PTI_STACK+PC_PTI_STACK_SZ*8,%rax + movq %rax,TSS_RSP0(%rdx) +1: movl $TSSSEL,%eax ltr %ax jmp done_tss Modified: stable/11/sys/amd64/amd64/db_trace.c ============================================================================== --- stable/11/sys/amd64/amd64/db_trace.c Sat Feb 17 17:23:43 2018 (r329461) +++ stable/11/sys/amd64/amd64/db_trace.c Sat Feb 17 18:00:01 2018 (r329462) @@ -200,6 +200,7 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, s if (name != NULL) { if (strcmp(name, "calltrap") == 0 || strcmp(name, "fork_trampoline") == 0 || + strcmp(name, "mchk_calltrap") == 0 || strcmp(name, "nmi_calltrap") == 0 || strcmp(name, "Xdblfault") == 0) frame_type = TRAP; Modified: stable/11/sys/amd64/amd64/exception.S ============================================================================== --- stable/11/sys/amd64/amd64/exception.S Sat Feb 17 17:23:43 2018 (r329461) +++ stable/11/sys/amd64/amd64/exception.S Sat Feb 17 18:00:01 2018 (r329462) @@ -1,12 +1,16 @@ /*- * Copyright (c) 1989, 1990 William F. Jolitz. * Copyright (c) 1990 The Regents of the University of California. - * Copyright (c) 2007 The FreeBSD Foundation + * Copyright (c) 2007-2018 The FreeBSD Foundation * All rights reserved. * * Portions of this software were developed by A. Joseph Koshy under * sponsorship from the FreeBSD Foundation and Google, Inc. * + * Portions of this software were developed by + * Konstantin Belousov under sponsorship from + * the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -38,13 +42,13 @@ #include "opt_compat.h" #include "opt_hwpmc_hooks.h" +#include "assym.s" + #include #include #include #include -#include "assym.s" - #ifdef KDTRACE_HOOKS .bss .globl dtrace_invop_jump_addr @@ -100,69 +104,62 @@ dtrace_invop_calltrap_addr: MCOUNT_LABEL(user) MCOUNT_LABEL(btrap) -/* Traps that we leave interrupts disabled for.. */ -#define TRAP_NOEN(a) \ - subq $TF_RIP,%rsp; \ - movl $(a),TF_TRAPNO(%rsp) ; \ - movq $0,TF_ADDR(%rsp) ; \ - movq $0,TF_ERR(%rsp) ; \ +/* Traps that we leave interrupts disabled for. */ + .macro TRAP_NOEN l, trapno + PTI_ENTRY \l,X\l + .globl X\l + .type X\l,@function +X\l: subq $TF_RIP,%rsp + movl $\trapno,TF_TRAPNO(%rsp) + movq $0,TF_ADDR(%rsp) + movq $0,TF_ERR(%rsp) jmp alltraps_noen -IDTVEC(dbg) - TRAP_NOEN(T_TRCTRAP) -IDTVEC(bpt) - TRAP_NOEN(T_BPTFLT) + .endm + + TRAP_NOEN dbg, T_TRCTRAP + TRAP_NOEN bpt, T_BPTFLT #ifdef KDTRACE_HOOKS -IDTVEC(dtrace_ret) - TRAP_NOEN(T_DTRACE_RET) + TRAP_NOEN dtrace_ret, T_DTRACE_RET #endif /* Regular traps; The cpu does not supply tf_err for these. */ -#define TRAP(a) \ - subq $TF_RIP,%rsp; \ - movl $(a),TF_TRAPNO(%rsp) ; \ - movq $0,TF_ADDR(%rsp) ; \ - movq $0,TF_ERR(%rsp) ; \ + .macro TRAP l, trapno + PTI_ENTRY \l,X\l + .globl X\l + .type X\l,@function +X\l: + subq $TF_RIP,%rsp + movl $\trapno,TF_TRAPNO(%rsp) + movq $0,TF_ADDR(%rsp) + movq $0,TF_ERR(%rsp) jmp alltraps -IDTVEC(div) - TRAP(T_DIVIDE) -IDTVEC(ofl) - TRAP(T_OFLOW) -IDTVEC(bnd) - TRAP(T_BOUND) -IDTVEC(ill) - TRAP(T_PRIVINFLT) -IDTVEC(dna) - TRAP(T_DNA) -IDTVEC(fpusegm) - TRAP(T_FPOPFLT) -IDTVEC(mchk) - TRAP(T_MCHK) -IDTVEC(rsvd) - TRAP(T_RESERVED) -IDTVEC(fpu) - TRAP(T_ARITHTRAP) -IDTVEC(xmm) - TRAP(T_XMMFLT) + .endm -/* This group of traps have tf_err already pushed by the cpu */ -#define TRAP_ERR(a) \ - subq $TF_ERR,%rsp; \ - movl $(a),TF_TRAPNO(%rsp) ; \ - movq $0,TF_ADDR(%rsp) ; \ + TRAP div, T_DIVIDE + TRAP ofl, T_OFLOW + TRAP bnd, T_BOUND + TRAP ill, T_PRIVINFLT + TRAP dna, T_DNA + TRAP fpusegm, T_FPOPFLT + TRAP rsvd, T_RESERVED + TRAP fpu, T_ARITHTRAP + TRAP xmm, T_XMMFLT + +/* This group of traps have tf_err already pushed by the cpu. */ + .macro TRAP_ERR l, trapno + PTI_ENTRY \l,X\l,has_err=1 + .globl X\l + .type X\l,@function +X\l: + subq $TF_ERR,%rsp + movl $\trapno,TF_TRAPNO(%rsp) + movq $0,TF_ADDR(%rsp) jmp alltraps -IDTVEC(tss) - TRAP_ERR(T_TSSFLT) -IDTVEC(missing) - subq $TF_ERR,%rsp - movl $T_SEGNPFLT,TF_TRAPNO(%rsp) - jmp prot_addrf -IDTVEC(stk) - subq $TF_ERR,%rsp - movl $T_STKFLT,TF_TRAPNO(%rsp) - jmp prot_addrf -IDTVEC(align) - TRAP_ERR(T_ALIGNFLT) + .endm + TRAP_ERR tss, T_TSSFLT + TRAP_ERR align, T_ALIGNFLT + /* * alltraps entry point. Use swapgs if this is the first time in the * kernel from userland. Reenable interrupts if they were enabled @@ -174,24 +171,22 @@ IDTVEC(align) alltraps: movq %rdi,TF_RDI(%rsp) testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ - jz alltraps_testi /* already running with kernel GS.base */ + jz 1f /* already running with kernel GS.base */ swapgs movq PCPU(CURPCB),%rdi andl $~PCB_FULL_IRET,PCB_FLAGS(%rdi) - movw %fs,TF_FS(%rsp) - movw %gs,TF_GS(%rsp) - movw %es,TF_ES(%rsp) - movw %ds,TF_DS(%rsp) -alltraps_testi: - testl $PSL_I,TF_RFLAGS(%rsp) - jz alltraps_pushregs_no_rdi - sti -alltraps_pushregs_no_rdi: +1: SAVE_SEGS movq %rdx,TF_RDX(%rsp) movq %rax,TF_RAX(%rsp) + movq %rcx,TF_RCX(%rsp) + testb $SEL_RPL_MASK,TF_CS(%rsp) + jz 2f + call handle_ibrs_entry +2: testl $PSL_I,TF_RFLAGS(%rsp) + jz alltraps_pushregs_no_rax + sti alltraps_pushregs_no_rax: movq %rsi,TF_RSI(%rsp) - movq %rcx,TF_RCX(%rsp) movq %r8,TF_R8(%rsp) movq %r9,TF_R9(%rsp) movq %rbx,TF_RBX(%rsp) @@ -249,15 +244,18 @@ calltrap: alltraps_noen: movq %rdi,TF_RDI(%rsp) testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ - jz 1f /* already running with kernel GS.base */ + jz 1f /* already running with kernel GS.base */ swapgs movq PCPU(CURPCB),%rdi andl $~PCB_FULL_IRET,PCB_FLAGS(%rdi) -1: movw %fs,TF_FS(%rsp) - movw %gs,TF_GS(%rsp) - movw %es,TF_ES(%rsp) - movw %ds,TF_DS(%rsp) - jmp alltraps_pushregs_no_rdi +1: SAVE_SEGS + movq %rdx,TF_RDX(%rsp) + movq %rax,TF_RAX(%rsp) + movq %rcx,TF_RCX(%rsp) + testb $SEL_RPL_MASK,TF_CS(%rsp) + jz alltraps_pushregs_no_rax + call handle_ibrs_entry + jmp alltraps_pushregs_no_rax IDTVEC(dblfault) subq $TF_ERR,%rsp @@ -279,56 +277,110 @@ IDTVEC(dblfault) movq %r13,TF_R13(%rsp) movq %r14,TF_R14(%rsp) movq %r15,TF_R15(%rsp) - movw %fs,TF_FS(%rsp) - movw %gs,TF_GS(%rsp) - movw %es,TF_ES(%rsp) - movw %ds,TF_DS(%rsp) + SAVE_SEGS movl $TF_HASSEGS,TF_FLAGS(%rsp) cld testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ jz 1f /* already running with kernel GS.base */ swapgs 1: - movq %rsp,%rdi + movq PCPU(KCR3),%rax + cmpq $~0,%rax + je 2f + movq %rax,%cr3 +2: movq %rsp,%rdi call dblfault_handler -2: - hlt - jmp 2b +3: hlt + jmp 3b + ALIGN_TEXT +IDTVEC(page_pti) + testb $SEL_RPL_MASK,PTI_CS-2*8(%rsp) + jz Xpage + swapgs + pushq %rax + pushq %rdx + movq %cr3,%rax + movq %rax,PCPU(SAVED_UCR3) + PTI_UUENTRY has_err=1 + subq $TF_ERR,%rsp + movq %rdi,TF_RDI(%rsp) + movq %rax,TF_RAX(%rsp) + movq %rdx,TF_RDX(%rsp) + movq %rcx,TF_RCX(%rsp) + jmp page_u IDTVEC(page) subq $TF_ERR,%rsp - movl $T_PAGEFLT,TF_TRAPNO(%rsp) - movq %rdi,TF_RDI(%rsp) /* free up a GP register */ + movq %rdi,TF_RDI(%rsp) /* free up GP registers */ + movq %rax,TF_RAX(%rsp) + movq %rdx,TF_RDX(%rsp) + movq %rcx,TF_RCX(%rsp) testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ - jz 1f /* already running with kernel GS.base */ + jz page_cr2 /* already running with kernel GS.base */ swapgs - movq PCPU(CURPCB),%rdi +page_u: movq PCPU(CURPCB),%rdi andl $~PCB_FULL_IRET,PCB_FLAGS(%rdi) -1: movq %cr2,%rdi /* preserve %cr2 before .. */ + movq PCPU(SAVED_UCR3),%rax + movq %rax,PCB_SAVED_UCR3(%rdi) + call handle_ibrs_entry +page_cr2: + movq %cr2,%rdi /* preserve %cr2 before .. */ movq %rdi,TF_ADDR(%rsp) /* enabling interrupts. */ - movw %fs,TF_FS(%rsp) - movw %gs,TF_GS(%rsp) - movw %es,TF_ES(%rsp) - movw %ds,TF_DS(%rsp) + SAVE_SEGS + movl $T_PAGEFLT,TF_TRAPNO(%rsp) testl $PSL_I,TF_RFLAGS(%rsp) - jz alltraps_pushregs_no_rdi + jz alltraps_pushregs_no_rax sti - jmp alltraps_pushregs_no_rdi + jmp alltraps_pushregs_no_rax /* * We have to special-case this one. If we get a trap in doreti() at * the iretq stage, we'll reenter with the wrong gs state. We'll have * to do a special the swapgs in this case even coming from the kernel. * XXX linux has a trap handler for their equivalent of load_gs(). + * + * On the stack, we have the hardware interrupt frame to return + * to usermode (faulted) and another frame with error code, for + * fault. For PTI, copy both frames to the main thread stack. */ -IDTVEC(prot) + .macro PROTF_ENTRY name,trapno +\name\()_pti_doreti: + pushq %rax + pushq %rdx + swapgs + movq PCPU(KCR3),%rax + movq %rax,%cr3 + movq PCPU(RSP0),%rax + subq $2*PTI_SIZE-3*8,%rax /* no err, %rax, %rdx in faulted frame */ + MOVE_STACKS (PTI_SIZE / 4 - 3) + movq %rax,%rsp + popq %rdx + popq %rax + swapgs + jmp X\name +IDTVEC(\name\()_pti) + cmpq $doreti_iret,PTI_RIP-2*8(%rsp) + je \name\()_pti_doreti + testb $SEL_RPL_MASK,PTI_CS-2*8(%rsp) /* %rax, %rdx not yet pushed */ + jz X\name + PTI_UENTRY has_err=1 + swapgs +IDTVEC(\name) subq $TF_ERR,%rsp - movl $T_PROTFLT,TF_TRAPNO(%rsp) + movl $\trapno,TF_TRAPNO(%rsp) + jmp prot_addrf + .endm + + PROTF_ENTRY missing, T_SEGNPFLT + PROTF_ENTRY stk, T_STKFLT + PROTF_ENTRY prot, T_PROTFLT + prot_addrf: movq $0,TF_ADDR(%rsp) movq %rdi,TF_RDI(%rsp) /* free up a GP register */ movq %rax,TF_RAX(%rsp) movq %rdx,TF_RDX(%rsp) + movq %rcx,TF_RCX(%rsp) movw %fs,TF_FS(%rsp) movw %gs,TF_GS(%rsp) leaq doreti_iret(%rip),%rdi @@ -354,7 +406,8 @@ prot_addrf: 3: cmpw $KUG32SEL,TF_GS(%rsp) jne 4f movq %rdx,PCB_GSBASE(%rdi) -4: orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* always full iret from GPF */ +4: call handle_ibrs_entry + orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* always full iret from GPF */ movw %es,TF_ES(%rsp) movw %ds,TF_DS(%rsp) testl $PSL_I,TF_RFLAGS(%rsp) @@ -375,8 +428,18 @@ prot_addrf: * We do not support invoking this from a custom segment registers, * esp. %cs, %ss, %fs, %gs, e.g. using entries from an LDT. */ + SUPERALIGN_TEXT +IDTVEC(fast_syscall_pti) + swapgs + movq %rax,PCPU(SCRATCH_RAX) + movq PCPU(KCR3),%rax + movq %rax,%cr3 + jmp fast_syscall_common + SUPERALIGN_TEXT IDTVEC(fast_syscall) swapgs + movq %rax,PCPU(SCRATCH_RAX) +fast_syscall_common: movq %rsp,PCPU(SCRATCH_RSP) movq PCPU(RSP0),%rsp /* Now emulate a trapframe. Make the 8 byte alignment odd for call. */ @@ -386,10 +449,11 @@ IDTVEC(fast_syscall) movq %rcx,TF_RIP(%rsp) /* %rcx original value is in %r10 */ movq PCPU(SCRATCH_RSP),%r11 /* %r11 already saved */ movq %r11,TF_RSP(%rsp) /* user stack pointer */ - movw %fs,TF_FS(%rsp) - movw %gs,TF_GS(%rsp) - movw %es,TF_ES(%rsp) - movw %ds,TF_DS(%rsp) + movq PCPU(SCRATCH_RAX),%rax + movq %rax,TF_RAX(%rsp) /* syscall number */ + movq %rdx,TF_RDX(%rsp) /* arg 3 */ + SAVE_SEGS + call handle_ibrs_entry movq PCPU(CURPCB),%r11 andl $~PCB_FULL_IRET,PCB_FLAGS(%r11) sti @@ -398,11 +462,9 @@ IDTVEC(fast_syscall) movq $2,TF_ERR(%rsp) movq %rdi,TF_RDI(%rsp) /* arg 1 */ movq %rsi,TF_RSI(%rsp) /* arg 2 */ - movq %rdx,TF_RDX(%rsp) /* arg 3 */ movq %r10,TF_RCX(%rsp) /* arg 4 */ movq %r8,TF_R8(%rsp) /* arg 5 */ movq %r9,TF_R9(%rsp) /* arg 6 */ - movq %rax,TF_RAX(%rsp) /* syscall number */ movq %rbx,TF_RBX(%rsp) /* C preserved */ movq %rbp,TF_RBP(%rsp) /* C preserved */ movq %r12,TF_R12(%rsp) /* C preserved */ @@ -420,11 +482,12 @@ IDTVEC(fast_syscall) /* Disable interrupts before testing PCB_FULL_IRET. */ cli testl $PCB_FULL_IRET,PCB_FLAGS(%rax) - jnz 3f + jnz 4f /* Check for and handle AST's on return to userland. */ movq PCPU(CURTHREAD),%rax testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%rax) - jne 2f + jne 3f + call handle_ibrs_exit /* Restore preserved registers. */ MEXITCOUNT movq TF_RDI(%rsp),%rdi /* bonus; preserve arg 1 */ @@ -434,16 +497,21 @@ IDTVEC(fast_syscall) movq TF_RFLAGS(%rsp),%r11 /* original %rflags */ movq TF_RIP(%rsp),%rcx /* original %rip */ movq TF_RSP(%rsp),%rsp /* user stack pointer */ - swapgs + cmpb $0,pti + je 2f + movq PCPU(UCR3),%r9 + movq %r9,%cr3 + xorl %r9d,%r9d +2: swapgs sysretq -2: /* AST scheduled. */ +3: /* AST scheduled. */ sti movq %rsp,%rdi call ast jmp 1b -3: /* Requested full context restore, use doreti for that. */ +4: /* Requested full context restore, use doreti for that. */ MEXITCOUNT jmp doreti @@ -499,17 +567,15 @@ IDTVEC(nmi) movq %r13,TF_R13(%rsp) movq %r14,TF_R14(%rsp) movq %r15,TF_R15(%rsp) - movw %fs,TF_FS(%rsp) - movw %gs,TF_GS(%rsp) - movw %es,TF_ES(%rsp) - movw %ds,TF_DS(%rsp) + SAVE_SEGS movl $TF_HASSEGS,TF_FLAGS(%rsp) cld xorl %ebx,%ebx testb $SEL_RPL_MASK,TF_CS(%rsp) jnz nmi_fromuserspace /* - * We've interrupted the kernel. Preserve GS.base in %r12. + * We've interrupted the kernel. Preserve GS.base in %r12, + * %cr3 in %r13, and possibly lower half of MSR_IA32_SPEC_CTL in %r14d. */ movl $MSR_GSBASE,%ecx rdmsr @@ -521,27 +587,45 @@ IDTVEC(nmi) movl %edx,%eax shrq $32,%rdx wrmsr + movq %cr3,%r13 + movq PCPU(KCR3),%rax + cmpq $~0,%rax + je 1f + movq %rax,%cr3 +1: testl $CPUID_STDEXT3_IBPB,cpu_stdext_feature3(%rip) + je nmi_calltrap + movl $MSR_IA32_SPEC_CTRL,%ecx + rdmsr + movl %eax,%r14d + call handle_ibrs_entry jmp nmi_calltrap nmi_fromuserspace: incl %ebx swapgs - testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip) - jz 2f + movq %cr3,%r13 + movq PCPU(KCR3),%rax + cmpq $~0,%rax + je 1f + movq %rax,%cr3 +1: call handle_ibrs_entry movq PCPU(CURPCB),%rdi testq %rdi,%rdi - jz 2f + jz 3f + orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) + testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip) + jz 3f cmpw $KUF32SEL,TF_FS(%rsp) - jne 1f + jne 2f rdfsbase %rax movq %rax,PCB_FSBASE(%rdi) -1: cmpw $KUG32SEL,TF_GS(%rsp) - jne 2f +2: cmpw $KUG32SEL,TF_GS(%rsp) + jne 3f movl $MSR_KGSBASE,%ecx rdmsr shlq $32,%rdx orq %rdx,%rax movq %rax,PCB_GSBASE(%rdi) -2: +3: /* Note: this label is also used by ddb and gdb: */ nmi_calltrap: FAKE_MCOUNT(TF_RIP(%rsp)) @@ -564,26 +648,29 @@ nmi_calltrap: movq PCPU(CURTHREAD),%rax orq %rax,%rax /* curthread present? */ jz nocallchain - testl $TDP_CALLCHAIN,TD_PFLAGS(%rax) /* flagged for capture? */ - jz nocallchain /* - * A user callchain is to be captured, so: - * - Move execution to the regular kernel stack, to allow for - * nested NMI interrupts. - * - Take the processor out of "NMI" mode by faking an "iret". - * - Enable interrupts, so that copyin() can work. + * Move execution to the regular kernel stack, because we + * committed to return through doreti. */ movq %rsp,%rsi /* source stack pointer */ movq $TF_SIZE,%rcx movq PCPU(RSP0),%rdx subq %rcx,%rdx movq %rdx,%rdi /* destination stack pointer */ - shrq $3,%rcx /* trap frame size in long words */ cld rep movsq /* copy trapframe */ + movq %rdx,%rsp /* we are on the regular kstack */ + testl $TDP_CALLCHAIN,TD_PFLAGS(%rax) /* flagged for capture? */ + jz nocallchain + /* + * A user callchain is to be captured, so: + * - Take the processor out of "NMI" mode by faking an "iret", + * to allow for nested NMI interrupts. + * - Enable interrupts, so that copyin() can work. + */ movl %ss,%eax pushq %rax /* tf_ss */ pushq %rdx /* tf_rsp (on kernel stack) */ @@ -613,33 +700,139 @@ outofnmi: cli nocallchain: #endif - testl %ebx,%ebx + testl %ebx,%ebx /* %ebx == 0 => return to userland */ jnz doreti_exit -nmi_kernelexit: /* + * Restore speculation control MSR, if preserved. + */ + testl $CPUID_STDEXT3_IBPB,cpu_stdext_feature3(%rip) + je 1f + movl %r14d,%eax + xorl %edx,%edx + movl $MSR_IA32_SPEC_CTRL,%ecx + wrmsr + /* * Put back the preserved MSR_GSBASE value. */ +1: movl $MSR_GSBASE,%ecx + movq %r12,%rdx + movl %edx,%eax + shrq $32,%rdx + wrmsr + movq %r13,%cr3 + RESTORE_REGS + addq $TF_RIP,%rsp + jmp doreti_iret + +/* + * MC# handling is similar to NMI. + * + * As with NMIs, machine check exceptions do not respect RFLAGS.IF and + * can occur at any time with a GS.base value that does not correspond + * to the privilege level in CS. + * + * Machine checks are not unblocked by iretq, but it is best to run *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Sat Feb 17 23:05:20 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5835DF19317; Sat, 17 Feb 2018 23:05:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EC81671F6D; Sat, 17 Feb 2018 23:05:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8A9123412; Sat, 17 Feb 2018 23:05:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1HN5JXB021286; Sat, 17 Feb 2018 23:05:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1HN5J6T021285; Sat, 17 Feb 2018 23:05:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802172305.w1HN5J6T021285@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 17 Feb 2018 23:05:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329478 - stable/11/cddl/contrib/opensolaris/cmd/zpool X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/zpool X-SVN-Commit-Revision: 329478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Feb 2018 23:05:20 -0000 Author: mav Date: Sat Feb 17 23:05:19 2018 New Revision: 329478 URL: https://svnweb.freebsd.org/changeset/base/329478 Log: MFC r319671: SHA-512 and Skein have been supported by the boot loader for some time. Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Sat Feb 17 22:45:15 2018 (r329477) +++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Sat Feb 17 23:05:19 2018 (r329478) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 31, 2016 +.Dd June 7, 2017 .Dt ZPOOL-FEATURES 7 .Os .Sh NAME @@ -497,10 +497,6 @@ and will return to being once all filesystems that have ever had their checksum set to .Sy sha512 are destroyed. -.Pp -Booting off of a pools utilizing SHA-512/256 is -.Em NOT -yet supported. .It Sy skein .Bl -column "READ\-ONLY COMPATIBLE" "org.illumos:skein" .It GUID Ta org.illumos:skein @@ -543,12 +539,6 @@ and will return to being once all filesystems that have ever had their checksum set to .Sy skein are destroyed. -.Pp -Booting off of pools using -.Sy skein -is -.Em NOT -supported. .El .Sh SEE ALSO .Xr zpool 8 From owner-svn-src-stable-11@freebsd.org Sat Feb 17 23:51:16 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24387F1D157; Sat, 17 Feb 2018 23:51:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CAE1473C7B; Sat, 17 Feb 2018 23:51:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C57DA23AE2; Sat, 17 Feb 2018 23:51:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1HNpF1j044179; Sat, 17 Feb 2018 23:51:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1HNpFnp044178; Sat, 17 Feb 2018 23:51:15 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802172351.w1HNpFnp044178@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 17 Feb 2018 23:51:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329481 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 329481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Feb 2018 23:51:16 -0000 Author: mav Date: Sat Feb 17 23:51:15 2018 New Revision: 329481 URL: https://svnweb.freebsd.org/changeset/base/329481 Log: MFC r321104 (by jhibbits): Make ZFS not crash on mount on 32-bit systems ZPL_VERSION is unsigned long long, not an int. With this change, a zpool can be created on a 32-bit system (tested on powerpcspe) and mounted correctly. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c Sat Feb 17 23:39:10 2018 (r329480) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c Sat Feb 17 23:51:15 2018 (r329481) @@ -539,7 +539,7 @@ void spa_history_log_version(spa_t *spa, const char *operation) { spa_history_log_internal(spa, operation, NULL, - "pool version %llu; software version %llu/%d; uts %s %s %s %s", + "pool version %llu; software version %llu/%llu; uts %s %s %s %s", (u_longlong_t)spa_version(spa), SPA_VERSION, ZPL_VERSION, utsname.nodename, utsname.release, utsname.version, utsname.machine); From owner-svn-src-stable-11@freebsd.org Sat Feb 17 23:55:00 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D81DF1D81B; Sat, 17 Feb 2018 23:55:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 173D87411F; Sat, 17 Feb 2018 23:55:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F05D23C3C; Sat, 17 Feb 2018 23:55:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1HNsxYm045831; Sat, 17 Feb 2018 23:54:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1HNsxIw045830; Sat, 17 Feb 2018 23:54:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802172354.w1HNsxIw045830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 17 Feb 2018 23:54:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329482 - stable/11/sys/cddl/contrib/opensolaris/common/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/common/zfs X-SVN-Commit-Revision: 329482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Feb 2018 23:55:00 -0000 Author: mav Date: Sat Feb 17 23:54:59 2018 New Revision: 329482 URL: https://svnweb.freebsd.org/changeset/base/329482 Log: MFC r323002 (by emaste): zfs: do not advertise edonr which is not yet supported illumos 4185 ("add new cryptographic checksums to ZFS: SHA-512, Skein, Edon-R") was intentionally merged only partially in r289422, without adding support for skein, sha512 and edonr on FreeBSD. Support for skein and sha512 was added later on, but edonr is still not implemented in FreeBSD. Prior to this commit zfs(8) correctly rejected edonr, but with an error message that claimed support: fk@r500 ~ $zfs set checksum=edonr tank cannot set property for 'tank': 'checksum' must be one of 'on | off | fletcher2 | fletcher4 | sha256 | sha512 | skein | edonr' Modified: stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c Sat Feb 17 23:51:15 2018 (r329481) +++ stable/11/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c Sat Feb 17 23:54:59 2018 (r329482) @@ -242,11 +242,11 @@ zfs_prop_init(void) ZIO_CHECKSUM_DEFAULT, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, "on | off | fletcher2 | fletcher4 | sha256 | sha512 | " - "skein | edonr", "CHECKSUM", checksum_table); + "skein", "CHECKSUM", checksum_table); zprop_register_index(ZFS_PROP_DEDUP, "dedup", ZIO_CHECKSUM_OFF, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, "on | off | verify | sha256[,verify], sha512[,verify], " - "skein[,verify], edonr,verify", "DEDUP", dedup_table); + "skein[,verify]", "DEDUP", dedup_table); zprop_register_index(ZFS_PROP_COMPRESSION, "compression", ZIO_COMPRESS_DEFAULT, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,