From owner-svn-src-all@freebsd.org Sun Apr 3 00:11:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD062B01D17; Sun, 3 Apr 2016 00:11:28 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi0-f54.google.com (mail-oi0-f54.google.com [209.85.218.54]) (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 7EADA1D68; Sun, 3 Apr 2016 00:11:28 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-oi0-f54.google.com with SMTP id p188so121700782oih.2; Sat, 02 Apr 2016 17:11:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :date:message-id:subject:from:to:cc; bh=eWa0oBOHf0uhynlxPJ9JgT24iTreZZwvFmua6o2VfrU=; b=SJW9t4OTHnxoo08YuuGue7QTTRmCPWWmh/F4DeH6aAnsc1Ciz11H478Tyy0+w37ddp E6tXyXk0TrQJvCAoMO3hRTuFmA1PdoQkHV5LHhP9nIw14aXWj3coJhrb1PcdlijJ/vzQ rA6tFHCTmxIXo6dYRi+OxzpZN1dlgG9fu3GCHst6cHMdABoqCr6DbyrdB67uXRoT90af skQJbpOrZRIqgmFZo30VoC32nz0AV/qlP6uIOXdYlzKYQJ9hCriMo9MVBr6jBKeG2rDH p1WnKiawO4RKsnsDBDWyoW4YM423rLR6dG8TRuL2on+E0VFGg4+nJRme+kmNEUwc0KN2 xArg== X-Gm-Message-State: AD7BkJLZAGji6Xh5rUg8MlvieekjZWwudD5Gq4Vm860cXdJ09pNIrHXzFfEMAS71nstJOA== X-Received: by 10.202.51.130 with SMTP id z124mr5094606oiz.27.1459642281176; Sat, 02 Apr 2016 17:11:21 -0700 (PDT) Received: from mail-oi0-f46.google.com (mail-oi0-f46.google.com. [209.85.218.46]) by smtp.gmail.com with ESMTPSA id 7sm6378188otd.25.2016.04.02.17.11.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Apr 2016 17:11:21 -0700 (PDT) Received: by mail-oi0-f46.google.com with SMTP id s79so22735258oie.1; Sat, 02 Apr 2016 17:11:20 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.157.13.9 with SMTP id 9mr7618819oti.39.1459642280526; Sat, 02 Apr 2016 17:11:20 -0700 (PDT) Reply-To: cem@FreeBSD.org Received: by 10.157.22.215 with HTTP; Sat, 2 Apr 2016 17:11:20 -0700 (PDT) In-Reply-To: <201603280422.u2S4MMRH012240@repo.freebsd.org> References: <201603280422.u2S4MMRH012240@repo.freebsd.org> Date: Sat, 2 Apr 2016 17:11:20 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r297331 - head/sbin/devd From: Conrad Meyer To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 00:11:28 -0000 Should this be: On Sun, Mar 27, 2016 at 9:22 PM, Warner Losh wrote: > Author: imp > Date: Mon Mar 28 04:22:22 2016 > New Revision: 297331 > URL: https://svnweb.freebsd.org/changeset/base/297331 > ... > @@ -793,10 +793,15 @@ process_event(char *buffer) > devdlog(LOG_INFO, "Processing event '%s'\n", buffer); > type = *buffer++; > cfg.push_var_table(); > + // $* is the entire line > + cfg.set_variable("*", buffer - 1); > + // $_ is the entire line without the initial character > + cfg.set_variable("_", buffer - 1); 'buffer', not 'buffer - 1'? Best, Conrad From owner-svn-src-all@freebsd.org Sun Apr 3 06:22:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A54A9ADE7EC; Sun, 3 Apr 2016 06:22:37 +0000 (UTC) (envelope-from dchagin@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 mx1.freebsd.org (Postfix) with ESMTPS id 62A7D140F; Sun, 3 Apr 2016 06:22:37 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u336MaBm006005; Sun, 3 Apr 2016 06:22:36 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u336Ma9s006004; Sun, 3 Apr 2016 06:22:36 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201604030622.u336Ma9s006004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 3 Apr 2016 06:22:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297518 - stable/10/sys/compat/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 06:22:37 -0000 Author: dchagin Date: Sun Apr 3 06:22:36 2016 New Revision: 297518 URL: https://svnweb.freebsd.org/changeset/base/297518 Log: MFC r297309: Whitespaces and style(9) fix. No functional changes. Modified: stable/10/sys/compat/linux/linux_socket.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/linux/linux_socket.c ============================================================================== --- stable/10/sys/compat/linux/linux_socket.c Sat Apr 2 19:42:12 2016 (r297517) +++ stable/10/sys/compat/linux/linux_socket.c Sun Apr 3 06:22:36 2016 (r297518) @@ -448,7 +448,7 @@ linux_to_bsd_msg_flags(int flags) if (flags & LINUX_MSG_ERRQUEUE) ; #endif - return ret_flags; + return (ret_flags); } /* @@ -463,15 +463,12 @@ bsd_to_linux_sockaddr(struct sockaddr *a struct sockaddr sa; size_t sa_len = sizeof(struct sockaddr); int error; - + if ((error = copyin(arg, &sa, sa_len))) return (error); - + *(u_short *)&sa = sa.sa_family; - - error = copyout(&sa, arg, sa_len); - - return (error); + return (copyout(&sa, arg, sa_len)); } static int @@ -486,10 +483,7 @@ linux_to_bsd_sockaddr(struct sockaddr *a sa.sa_family = *(sa_family_t *)&sa; sa.sa_len = len; - - error = copyout(&sa, arg, sa_len); - - return (error); + return (copyout(&sa, arg, sa_len)); } static int @@ -511,11 +505,7 @@ linux_sa_put(struct osockaddr *osa) return (EINVAL); sa.sa_family = bdom; - error = copyout(&sa, osa, sizeof(sa.sa_family)); - if (error) - return (error); - - return (0); + return (copyout(&sa, osa, sizeof(sa.sa_family))); } static int @@ -898,10 +888,7 @@ linux_getsockname(struct thread *td, str bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.asa); if (error) return (error); - error = linux_sa_put(PTRIN(args->addr)); - if (error) - return (error); - return (0); + return (linux_sa_put(PTRIN(args->addr))); } int @@ -921,10 +908,7 @@ linux_getpeername(struct thread *td, str bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.asa); if (error) return (error); - error = linux_sa_put(PTRIN(args->addr)); - if (error) - return (error); - return (0); + return (linux_sa_put(PTRIN(args->addr))); } int @@ -989,7 +973,7 @@ linux_send(struct thread *td, struct lin bsd_args.flags = args->flags; bsd_args.to = NULL; bsd_args.tolen = 0; - return sys_sendto(td, &bsd_args); + return (sys_sendto(td, &bsd_args)); } struct linux_recv_args { @@ -1026,7 +1010,6 @@ linux_sendto(struct thread *td, struct l { struct msghdr msg; struct iovec aiov; - int error; if (linux_check_hdrincl(td, args->s) == 0) /* IP_HDRINCL set, tweak the packet before sending */ @@ -1040,9 +1023,8 @@ linux_sendto(struct thread *td, struct l msg.msg_flags = 0; aiov.iov_base = PTRIN(args->msg); aiov.iov_len = args->len; - error = linux_sendit(td, args->s, &msg, args->flags, NULL, - UIO_USERSPACE); - return (error); + return (linux_sendit(td, args->s, &msg, args->flags, NULL, + UIO_USERSPACE)); } int From owner-svn-src-all@freebsd.org Sun Apr 3 06:33:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59D65ADEDC7; Sun, 3 Apr 2016 06:33:17 +0000 (UTC) (envelope-from dchagin@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 mx1.freebsd.org (Postfix) with ESMTPS id 29C0E1988; Sun, 3 Apr 2016 06:33:17 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u336XGBd008972; Sun, 3 Apr 2016 06:33:16 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u336XG50008971; Sun, 3 Apr 2016 06:33:16 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201604030633.u336XG50008971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 3 Apr 2016 06:33:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297519 - head/sys/compat/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 06:33:17 -0000 Author: dchagin Date: Sun Apr 3 06:33:16 2016 New Revision: 297519 URL: https://svnweb.freebsd.org/changeset/base/297519 Log: Move Linux specific times tests up to guarantee the values are defined. CID: 1305178 Submitted by: pfg@ MFC after: 1 week Modified: head/sys/compat/linux/linux_misc.c Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sun Apr 3 06:22:36 2016 (r297518) +++ head/sys/compat/linux/linux_misc.c Sun Apr 3 06:33:16 2016 (r297519) @@ -895,13 +895,14 @@ linux_utimensat(struct thread *td, struc break; } timesp = times; - } - if (times[0].tv_nsec == UTIME_OMIT && times[1].tv_nsec == UTIME_OMIT) + if (times[0].tv_nsec == UTIME_OMIT && + times[1].tv_nsec == UTIME_OMIT) /* This breaks POSIX, but is what the Linux kernel does * _on purpose_ (documented in the man page for utimensat(2)), * so we must follow that behaviour. */ return (0); + } if (args->pathname != NULL) LCONVPATHEXIST_AT(td, args->pathname, &path, dfd); From owner-svn-src-all@freebsd.org Sun Apr 3 07:40:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F730AEB080; Sun, 3 Apr 2016 07:40:35 +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 mx1.freebsd.org (Postfix) with ESMTPS id E52561044; Sun, 3 Apr 2016 07:40:34 +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 u337eYAC027048; Sun, 3 Apr 2016 07:40:34 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u337eY8T027047; Sun, 3 Apr 2016 07:40:34 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201604030740.u337eY8T027047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sun, 3 Apr 2016 07:40:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297520 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 07:40:35 -0000 Author: avg Date: Sun Apr 3 07:40:33 2016 New Revision: 297520 URL: https://svnweb.freebsd.org/changeset/base/297520 Log: zfs receive: -u can be ignored sometimes When force-receiving a filesystem that was already mounted the re-created filesystem is mounted despite -u flag. Also see https://www.illumos.org/issues/6412. PR: 204705 Tested by: Vladimir Krstulja MFC after: 2 weeks X-Needs-Upstreaming: illumos Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sun Apr 3 06:33:16 2016 (r297519) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sun Apr 3 07:40:33 2016 (r297520) @@ -3479,7 +3479,8 @@ zfs_receive_one(libzfs_handle_t *hdl, in } if (clp) { - err |= changelist_postfix(clp); + if (!flags->nomount) + err |= changelist_postfix(clp); changelist_free(clp); } From owner-svn-src-all@freebsd.org Sun Apr 3 07:42:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8238AEB240; Sun, 3 Apr 2016 07:42:14 +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 mx1.freebsd.org (Postfix) with ESMTPS id 8792012CA; Sun, 3 Apr 2016 07:42:14 +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 u337gDVk029917; Sun, 3 Apr 2016 07:42:13 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u337gD1e029916; Sun, 3 Apr 2016 07:42:13 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201604030742.u337gD1e029916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sun, 3 Apr 2016 07:42:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297521 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 07:42:14 -0000 Author: avg Date: Sun Apr 3 07:42:13 2016 New Revision: 297521 URL: https://svnweb.freebsd.org/changeset/base/297521 Log: fix zfs set canmount=off on an unmounted filesystem Previously this operation tried to unmount and remount children. Also see https://www.illumos.org/issues/6428. MFC after: 2 weeks X-Needs-Upstreaming: illumos Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Apr 3 07:40:33 2016 (r297520) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Apr 3 07:42:13 2016 (r297521) @@ -1633,8 +1633,9 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvl * its canmount property to 'on' or 'noauto'. We only use * the changelist logic to unmount when setting canmount=off. */ - if (!(prop == ZFS_PROP_CANMOUNT && - fnvpair_value_uint64(elem) != ZFS_CANMOUNT_OFF)) { + if (prop != ZFS_PROP_CANMOUNT || + (fnvpair_value_uint64(elem) == ZFS_CANMOUNT_OFF && + zfs_is_mounted(zhp, NULL))) { cls[cl_idx] = changelist_gather(zhp, prop, 0, 0); if (cls[cl_idx] == NULL) goto error; From owner-svn-src-all@freebsd.org Sun Apr 3 11:18:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 233B0AEC420; Sun, 3 Apr 2016 11:18:22 +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 mx1.freebsd.org (Postfix) with ESMTPS id E1AB71224; Sun, 3 Apr 2016 11:18:21 +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 u33BIL1L093026; Sun, 3 Apr 2016 11:18:21 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u33BILE6093024; Sun, 3 Apr 2016 11:18:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604031118.u33BILE6093024@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 3 Apr 2016 11:18:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297522 - head/sys/dev/xen/blkfront X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 11:18:22 -0000 Author: mav Date: Sun Apr 3 11:18:20 2016 New Revision: 297522 URL: https://svnweb.freebsd.org/changeset/base/297522 Log: Pass through some new block device features. MFC after: 1 month Modified: head/sys/dev/xen/blkfront/blkfront.c head/sys/dev/xen/blkfront/block.h Modified: head/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- head/sys/dev/xen/blkfront/blkfront.c Sun Apr 3 07:42:13 2016 (r297521) +++ head/sys/dev/xen/blkfront/blkfront.c Sun Apr 3 11:18:20 2016 (r297522) @@ -855,6 +855,20 @@ xbd_feature_string(struct xbd_softc *sc, feature_cnt++; } + if ((sc->xbd_flags & XBDF_DISCARD) != 0) { + if (feature_cnt != 0) + sbuf_printf(&sb, ", "); + sbuf_printf(&sb, "discard"); + feature_cnt++; + } + + if ((sc->xbd_flags & XBDF_PERSISTENT) != 0) { + if (feature_cnt != 0) + sbuf_printf(&sb, ", "); + sbuf_printf(&sb, "persistent_grants"); + feature_cnt++; + } + (void) sbuf_finish(&sb); return (sbuf_len(&sb)); } @@ -985,7 +999,8 @@ xbd_vdevice_to_unit(uint32_t vdevice, in int xbd_instance_create(struct xbd_softc *sc, blkif_sector_t sectors, - int vdevice, uint16_t vdisk_info, unsigned long sector_size) + int vdevice, uint16_t vdisk_info, unsigned long sector_size, + unsigned long phys_sector_size) { char features[80]; int unit, error = 0; @@ -1013,6 +1028,8 @@ xbd_instance_create(struct xbd_softc *sc sc->xbd_disk->d_name = name; sc->xbd_disk->d_drv1 = sc; sc->xbd_disk->d_sectorsize = sector_size; + sc->xbd_disk->d_stripesize = phys_sector_size; + sc->xbd_disk->d_stripeoffset = 0; sc->xbd_disk->d_mediasize = sectors * sector_size; sc->xbd_disk->d_maxsize = sc->xbd_max_request_size; @@ -1206,7 +1223,7 @@ static void xbd_connect(struct xbd_softc *sc) { device_t dev = sc->xbd_dev; - unsigned long sectors, sector_size; + unsigned long sectors, sector_size, phys_sector_size; unsigned int binfo; int err, feature_barrier, feature_flush; int i, j; @@ -1229,6 +1246,11 @@ xbd_connect(struct xbd_softc *sc) return; } err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), + "physical-sector-size", "%lu", &phys_sector_size, + NULL); + if (err || phys_sector_size <= sector_size) + phys_sector_size = 0; + err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), "feature-barrier", "%lu", &feature_barrier, NULL); if (err == 0 && feature_barrier != 0) @@ -1330,7 +1352,7 @@ xbd_connect(struct xbd_softc *sc) bus_print_child_footer(device_get_parent(dev), dev); xbd_instance_create(sc, sectors, sc->xbd_vdevice, binfo, - sector_size); + sector_size, phys_sector_size); } (void)xenbus_set_state(dev, XenbusStateConnected); Modified: head/sys/dev/xen/blkfront/block.h ============================================================================== --- head/sys/dev/xen/blkfront/block.h Sun Apr 3 07:42:13 2016 (r297521) +++ head/sys/dev/xen/blkfront/block.h Sun Apr 3 11:18:20 2016 (r297522) @@ -159,10 +159,12 @@ typedef enum { XBDF_READY = 1 << 3, /* Is ready */ XBDF_CM_SHORTAGE = 1 << 4, /* Free cm resource shortage active. */ XBDF_GNT_SHORTAGE = 1 << 5, /* Grant ref resource shortage active */ - XBDF_WAIT_IDLE = 1 << 6 /* + XBDF_WAIT_IDLE = 1 << 6, /* * No new work until oustanding work * completes. */ + XBDF_DISCARD = 1 << 7, /* backend supports discard */ + XBDF_PERSISTENT = 1 << 8 /* backend supports persistent grants */ } xbd_flag_t; /* @@ -200,7 +202,8 @@ struct xbd_softc { }; int xbd_instance_create(struct xbd_softc *, blkif_sector_t sectors, int device, - uint16_t vdisk_info, unsigned long sector_size); + uint16_t vdisk_info, unsigned long sector_size, + unsigned long phys_sector_size); static inline void xbd_added_qentry(struct xbd_softc *sc, xbd_q_index_t index) From owner-svn-src-all@freebsd.org Sun Apr 3 14:38:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 335DAB00C41; Sun, 3 Apr 2016 14:38:04 +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 mx1.freebsd.org (Postfix) with ESMTPS id 039881FAF; Sun, 3 Apr 2016 14:38:03 +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 u33Ec3oF054707; Sun, 3 Apr 2016 14:38:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u33Ec3OS054706; Sun, 3 Apr 2016 14:38:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604031438.u33Ec3OS054706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 3 Apr 2016 14:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297523 - stable/10/sys/fs/devfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 14:38:04 -0000 Author: mav Date: Sun Apr 3 14:38:02 2016 New Revision: 297523 URL: https://svnweb.freebsd.org/changeset/base/297523 Log: MFC r287109 (by trasz): Make it possible to forcibly unmount devfs. Modified: stable/10/sys/fs/devfs/devfs_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/devfs/devfs_vfsops.c ============================================================================== --- stable/10/sys/fs/devfs/devfs_vfsops.c Sun Apr 3 11:18:20 2016 (r297522) +++ stable/10/sys/fs/devfs/devfs_vfsops.c Sun Apr 3 14:38:02 2016 (r297523) @@ -182,6 +182,8 @@ devfs_unmount(struct mount *mp, int mntf fmp = VFSTODEVFS(mp); KASSERT(fmp->dm_mount != NULL, ("devfs_unmount unmounted devfs_mount")); + if (mntflags & MNT_FORCE) + flags |= FORCECLOSE; /* There is 1 extra root vnode reference from devfs_mount(). */ error = vflush(mp, 1, flags, curthread); if (error) From owner-svn-src-all@freebsd.org Sun Apr 3 14:38:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59752B00C9E; Sun, 3 Apr 2016 14:38:28 +0000 (UTC) (envelope-from avos@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 mx1.freebsd.org (Postfix) with ESMTPS id 26EF71110; Sun, 3 Apr 2016 14:38:28 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u33EcRp0054764; Sun, 3 Apr 2016 14:38:27 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u33EcRe5054762; Sun, 3 Apr 2016 14:38:27 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201604031438.u33EcRe5054762@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 3 Apr 2016 14:38:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297524 - in head/sys/dev: iwn wpi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 14:38:28 -0000 Author: avos Date: Sun Apr 3 14:38:26 2016 New Revision: 297524 URL: https://svnweb.freebsd.org/changeset/base/297524 Log: wpi, iwn: fix check in find_eeprom_channel() Return correct eeprom_chan structure pointer for 7, 8, 11 and 12 5Ghz channels. Modified: head/sys/dev/iwn/if_iwn.c head/sys/dev/wpi/if_wpi.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun Apr 3 14:38:02 2016 (r297523) +++ head/sys/dev/iwn/if_iwn.c Sun Apr 3 14:38:26 2016 (r297524) @@ -2554,7 +2554,8 @@ iwn_find_eeprom_channel(struct iwn_softc } else { for (j = 0; j < 5; j++) { for (i = 0; i < iwn_bands[j].nchan; i++) { - if (iwn_bands[j].chan[i] == c->ic_ieee) + if (iwn_bands[j].chan[i] == c->ic_ieee && + ((j == 0) ^ IEEE80211_IS_CHAN_A(c)) == 1) return &sc->eeprom_channels[j][i]; } } Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Sun Apr 3 14:38:02 2016 (r297523) +++ head/sys/dev/wpi/if_wpi.c Sun Apr 3 14:38:26 2016 (r297524) @@ -1503,7 +1503,8 @@ wpi_find_eeprom_channel(struct wpi_softc for (j = 0; j < WPI_CHAN_BANDS_COUNT; j++) for (i = 0; i < wpi_bands[j].nchan; i++) - if (wpi_bands[j].chan[i] == c->ic_ieee) + if (wpi_bands[j].chan[i] == c->ic_ieee && + ((j == 0) ^ IEEE80211_IS_CHAN_A(c)) == 1) return &sc->eeprom_channels[j][i]; return NULL; From owner-svn-src-all@freebsd.org Sun Apr 3 14:40:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9AB5B00E8D; Sun, 3 Apr 2016 14:40:55 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id 8AF8E1342; Sun, 3 Apr 2016 14:40:55 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u33EescU057020; Sun, 3 Apr 2016 14:40:54 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u33EesB7057019; Sun, 3 Apr 2016 14:40:54 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604031440.u33EesB7057019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 3 Apr 2016 14:40:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297525 - head/sys/compat/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 14:40:55 -0000 Author: pfg Date: Sun Apr 3 14:40:54 2016 New Revision: 297525 URL: https://svnweb.freebsd.org/changeset/base/297525 Log: Fix indentation oops. Modified: head/sys/compat/linux/linux_misc.c Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sun Apr 3 14:38:26 2016 (r297524) +++ head/sys/compat/linux/linux_misc.c Sun Apr 3 14:40:54 2016 (r297525) @@ -896,12 +896,12 @@ linux_utimensat(struct thread *td, struc } timesp = times; - if (times[0].tv_nsec == UTIME_OMIT && - times[1].tv_nsec == UTIME_OMIT) /* This breaks POSIX, but is what the Linux kernel does * _on purpose_ (documented in the man page for utimensat(2)), * so we must follow that behaviour. */ - return (0); + if (times[0].tv_nsec == UTIME_OMIT && + times[1].tv_nsec == UTIME_OMIT) + return (0); } if (args->pathname != NULL) From owner-svn-src-all@freebsd.org Sun Apr 3 16:25:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8F82ADFD8F; Sun, 3 Apr 2016 16:25:52 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id 9B25E1AD0; Sun, 3 Apr 2016 16:25:52 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u33GPpHx088912; Sun, 3 Apr 2016 16:25:51 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u33GPpnK088911; Sun, 3 Apr 2016 16:25:51 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604031625.u33GPpnK088911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 3 Apr 2016 16:25:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297526 - head/sys/geom/sched X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 16:25:52 -0000 Author: pfg Date: Sun Apr 3 16:25:51 2016 New Revision: 297526 URL: https://svnweb.freebsd.org/changeset/base/297526 Log: g_sched_destroy(): prevent return of uninitialized scalar variable. For the !gsp case there some chance of returning an uninitialized return value. Prevent that from happening by initializing the error value. CID: 1006421 Modified: head/sys/geom/sched/g_sched.c Modified: head/sys/geom/sched/g_sched.c ============================================================================== --- head/sys/geom/sched/g_sched.c Sun Apr 3 14:40:54 2016 (r297525) +++ head/sys/geom/sched/g_sched.c Sun Apr 3 16:25:51 2016 (r297526) @@ -1316,7 +1316,8 @@ g_sched_destroy(struct g_geom *gp, boole gsp->gs_fini(sc->sc_data); g_gsched_unref(gsp); sc->sc_gsched = NULL; - } + } else + error = 0; if ((sc->sc_flags & G_SCHED_PROXYING) && oldpp) { error = g_destroy_proxy(gp, oldpp); From owner-svn-src-all@freebsd.org Sun Apr 3 16:38:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21913B01102; Sun, 3 Apr 2016 16:38:17 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id E687E1FF7; Sun, 3 Apr 2016 16:38:16 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u33GcGbn092205; Sun, 3 Apr 2016 16:38:16 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u33GcGsa092204; Sun, 3 Apr 2016 16:38:16 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604031638.u33GcGsa092204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 3 Apr 2016 16:38:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297527 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 16:38:17 -0000 Author: pfg Date: Sun Apr 3 16:38:15 2016 New Revision: 297527 URL: https://svnweb.freebsd.org/changeset/base/297527 Log: chdone(): Prevent returning uninitialized scalar value. If there is an error different from ERESTART, there is some chance that we may end up accessing an uninitialized value. This doesn't seem likely/possible but initialize announce_buf[0], just in case. CID: 1006486 Modified: head/sys/cam/scsi/scsi_ch.c Modified: head/sys/cam/scsi/scsi_ch.c ============================================================================== --- head/sys/cam/scsi/scsi_ch.c Sun Apr 3 16:25:51 2016 (r297526) +++ head/sys/cam/scsi/scsi_ch.c Sun Apr 3 16:38:15 2016 (r297527) @@ -651,6 +651,7 @@ chdone(struct cam_periph *periph, union } else { int error; + announce_buf[0] = '\0'; error = cherror(done_ccb, CAM_RETRY_SELTO, SF_RETRY_UA | SF_NO_PRINT); /* From owner-svn-src-all@freebsd.org Sun Apr 3 16:59:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4653B01979; Sun, 3 Apr 2016 16:59:49 +0000 (UTC) (envelope-from kevlo@ns.kevlo.org) Received: from ns.kevlo.org (220-135-115-6.HINET-IP.hinet.net [220.135.115.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "ns.kevlo.org", Issuer "ns.kevlo.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4172518B1; Sun, 3 Apr 2016 16:59:48 +0000 (UTC) (envelope-from kevlo@ns.kevlo.org) Received: from ns.kevlo.org (localhost [127.0.0.1]) by ns.kevlo.org (8.15.2/8.15.2) with ESMTPS id u33GwSJU024865 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 4 Apr 2016 00:58:29 +0800 (CST) (envelope-from kevlo@ns.kevlo.org) Received: (from kevlo@localhost) by ns.kevlo.org (8.15.2/8.15.2/Submit) id u33GwSVd024864; Mon, 4 Apr 2016 00:58:28 +0800 (CST) (envelope-from kevlo) Date: Mon, 4 Apr 2016 00:58:27 +0800 From: Kevin Lo To: "Pedro F. Giffuni" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297526 - head/sys/geom/sched Message-ID: <20160403165827.GA24850@ns.kevlo.org> References: <201604031625.u33GPpnK088911@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201604031625.u33GPpnK088911@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 16:59:49 -0000 On Sun, Apr 03, 2016 at 04:25:51PM +0000, Pedro F. Giffuni wrote: > > Author: pfg > Date: Sun Apr 3 16:25:51 2016 > New Revision: 297526 > URL: https://svnweb.freebsd.org/changeset/base/297526 > > Log: > g_sched_destroy(): prevent return of uninitialized scalar variable. > > For the !gsp case there some chance of returning an uninitialized > return value. Prevent that from happening by initializing the > error value. Hmm, wouldn't it be better to initialize 'error' before use? Index: sys/geom/sched/g_sched.c =================================================================== --- sys/geom/sched/g_sched.c (revision 297527) +++ sys/geom/sched/g_sched.c (working copy) @@ -1236,7 +1236,7 @@ g_sched_destroy(struct g_geom *gp, boolean_t force struct g_provider *pp, *oldpp = NULL; struct g_sched_softc *sc; struct g_gsched *gsp; - int error; + int error = 0; g_topology_assert(); sc = gp->softc; @@ -1316,8 +1316,7 @@ g_sched_destroy(struct g_geom *gp, boolean_t force gsp->gs_fini(sc->sc_data); g_gsched_unref(gsp); sc->sc_gsched = NULL; - } else - error = 0; + } if ((sc->sc_flags & G_SCHED_PROXYING) && oldpp) { error = g_destroy_proxy(gp, oldpp); > > CID: 1006421 > > Modified: > head/sys/geom/sched/g_sched.c > > Modified: head/sys/geom/sched/g_sched.c > ============================================================================== > --- head/sys/geom/sched/g_sched.c Sun Apr 3 14:40:54 2016 (r297525) > +++ head/sys/geom/sched/g_sched.c Sun Apr 3 16:25:51 2016 (r297526) > @@ -1316,7 +1316,8 @@ g_sched_destroy(struct g_geom *gp, boole > gsp->gs_fini(sc->sc_data); > g_gsched_unref(gsp); > sc->sc_gsched = NULL; > - } > + } else > + error = 0; > > if ((sc->sc_flags & G_SCHED_PROXYING) && oldpp) { > error = g_destroy_proxy(gp, oldpp); > > From owner-svn-src-all@freebsd.org Sun Apr 3 18:01:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B81D6B01E31 for ; Sun, 3 Apr 2016 18:01:27 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm39.bullet.mail.bf1.yahoo.com (nm39.bullet.mail.bf1.yahoo.com [72.30.239.69]) (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 718F81355 for ; Sun, 3 Apr 2016 18:01:27 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1459706109; bh=UbLz1xp2rQSasSVimXaG0roESG9csrVkuUgoqADoE5w=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=sccl/YHUfhDC8WJ1yilSbVrW7aXwK8wGqNRg+5BfwOIw3QNh2dKFjop9OSvu0TJNpayVAFjj7X/Yk3c27Xm1aLbquQGgm1BjqHr8KVG7LTGsqyJZJWV5rOO6Dcd95KrLnjKKvxtnfe1y5+1d6mxB37S22A9pzaWSWIb1CoS8v+rlorhyu9uegbBaXSXO61sWYHQa7XOG0vHncRoi8Vje8YaZk36SBoQiu+5egs4Xt0GPPiq4DUo4Kju3NJ260M2xosbOYkTep8TE9XIHv8CKDvZTcUvlPF34jZOadclVwjBA8cu9ElBHsaskGaf7WxLQIEbp49+VBrHltP0NZJ2PZA== Received: from [98.139.215.143] by nm39.bullet.mail.bf1.yahoo.com with NNFMP; 03 Apr 2016 17:55:09 -0000 Received: from [98.139.211.206] by tm14.bullet.mail.bf1.yahoo.com with NNFMP; 03 Apr 2016 17:55:09 -0000 Received: from [127.0.0.1] by smtp215.mail.bf1.yahoo.com with NNFMP; 03 Apr 2016 17:55:09 -0000 X-Yahoo-Newman-Id: 667111.73775.bm@smtp215.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: ZP6n67cVM1lm48S2x5UXEcGC2U8z2lw8Htom._SpfW.7q0l fmufoIoB5DYHSIaA0gK0cXCbd2qoF9CnFG3wmsgRWutNl6A2Abs38D0DVZcm ZTQ8J31IHVEBDwzzLTcAliKnFp.DNj1mTPcClliDtW6XbBhXikj7_Xvt2pnG RJJkkWwLqFoq7n0tbmFycR4Zjo4xVzAkZi64LVFOmVH1p3BTboHaT9wYw47Q O1ZgNLkxfifhKpGnuiw3L7Kie56biL5VODpgDANytKGLMIRWxXM5mGxkrTyw 4z9sKAuwdqfTcgEzk9eqPybjTZ0ham.Ga_lr92dawLMfQRYUOeAWxqHpHt9u ZdLIdecC141vH2k1oDJ0sA031DduLGUfVb22i6IKXn8E31j1BCztwBFrPMMn H.5sGj1l.PmAqRnOS77ijajbTFLeBUzPrMKVRcYV6M0mj4JD4u4I5BXB6gfw 0JjPBjzu1XrFilf.Se5HOgIwXc.DHYPoecm.oCsFfaRg74vvA.4fc5oB2Zyz xoPjCbcb9RI6XYkMT7RGsuUZQN1j_Ki_c X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r297526 - head/sys/geom/sched To: Kevin Lo References: <201604031625.u33GPpnK088911@repo.freebsd.org> <20160403165827.GA24850@ns.kevlo.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Pedro Giffuni Message-ID: <5701595A.9070605@FreeBSD.org> Date: Sun, 3 Apr 2016 12:56:42 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <20160403165827.GA24850@ns.kevlo.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 18:01:27 -0000 On 04/03/16 11:58, Kevin Lo wrote: > On Sun, Apr 03, 2016 at 04:25:51PM +0000, Pedro F. Giffuni wrote: >> >> Author: pfg >> Date: Sun Apr 3 16:25:51 2016 >> New Revision: 297526 >> URL: https://svnweb.freebsd.org/changeset/base/297526 >> >> Log: >> g_sched_destroy(): prevent return of uninitialized scalar variable. >> >> For the !gsp case there some chance of returning an uninitialized >> return value. Prevent that from happening by initializing the >> error value. > > Hmm, wouldn't it be better to initialize 'error' before use? > No. The if case initializes error on line 1278, the only problem is the else case. > Index: sys/geom/sched/g_sched.c > =================================================================== > --- sys/geom/sched/g_sched.c (revision 297527) > +++ sys/geom/sched/g_sched.c (working copy) > @@ -1236,7 +1236,7 @@ g_sched_destroy(struct g_geom *gp, boolean_t force > struct g_provider *pp, *oldpp = NULL; > struct g_sched_softc *sc; > struct g_gsched *gsp; > - int error; > + int error = 0; > > g_topology_assert(); > sc = gp->softc; Even when this is frequent, it is against style(9). Pedro. From owner-svn-src-all@freebsd.org Sun Apr 3 18:58:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D913AB0101F; Sun, 3 Apr 2016 18:58:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id A4E3B1A08; Sun, 3 Apr 2016 18:58:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c110-21-41-193.carlnfd1.nsw.optusnet.com.au (c110-21-41-193.carlnfd1.nsw.optusnet.com.au [110.21.41.193]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id ED5E94228C9; Mon, 4 Apr 2016 04:58:14 +1000 (AEST) Date: Mon, 4 Apr 2016 04:58:13 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pedro Giffuni cc: Kevin Lo , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297526 - head/sys/geom/sched In-Reply-To: <5701595A.9070605@FreeBSD.org> Message-ID: <20160404043525.P816@besplex.bde.org> References: <201604031625.u33GPpnK088911@repo.freebsd.org> <20160403165827.GA24850@ns.kevlo.org> <5701595A.9070605@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=EfU1O6SC c=1 sm=1 tr=0 a=73JWPhLeruqQCjN69UNZtQ==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=QsJJmg0kW5a1Qme-mrcA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 18:58:21 -0000 On Sun, 3 Apr 2016, Pedro Giffuni wrote: > On 04/03/16 11:58, Kevin Lo wrote: >> On Sun, Apr 03, 2016 at 04:25:51PM +0000, Pedro F. Giffuni wrote: >>> Log: >>> g_sched_destroy(): prevent return of uninitialized scalar variable. >>> >>> For the !gsp case there some chance of returning an uninitialized >>> return value. Prevent that from happening by initializing the >>> error value. >> >> Hmm, wouldn't it be better to initialize 'error' before use? > > No. The if case initializes error on line 1278, the only problem > is the else case. Indeed. >> Index: sys/geom/sched/g_sched.c >> =================================================================== >> --- sys/geom/sched/g_sched.c (revision 297527) >> +++ sys/geom/sched/g_sched.c (working copy) >> @@ -1236,7 +1236,7 @@ g_sched_destroy(struct g_geom *gp, boolean_t force >> struct g_provider *pp, *oldpp = NULL; >> struct g_sched_softc *sc; >> struct g_gsched *gsp; >> - int error; >> + int error = 0; >> >> g_topology_assert(); >> sc = gp->softc; > > Even when this is frequent, it is against style(9). style(9) itself was broken to not FORBID initializing variables in declarations. The style bug is frequent for "fixing" -Wuninitialised warnings -- the code had an obscure flow of control that is too hard for compilers and humans to understand, and the "fix" is to make it even harder to understand by initializing the variable to a value that is probably wrong if it is ever used. It would be better to do the reverse and initialize variables immediately before use and kill them after their use so that their lifetime is clear without a deep analysis, but the kill operations would take large code and isn't in C. You can approximate it using neted declarations, but I don't like that and style(9) forbids it. You can approximate it by a macro kill() that might expand to assigning a NaN to the variables. Compilers would probably object to this macro if it actually assigns a NaN. Bruce From owner-svn-src-all@freebsd.org Sun Apr 3 19:11:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64EACB014D8; Sun, 3 Apr 2016 19:11:44 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 30A9110F6; Sun, 3 Apr 2016 19:11:43 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c110-21-41-193.carlnfd1.nsw.optusnet.com.au (c110-21-41-193.carlnfd1.nsw.optusnet.com.au [110.21.41.193]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 5E989D63115; Mon, 4 Apr 2016 05:11:35 +1000 (AEST) Date: Mon, 4 Apr 2016 05:11:35 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Pedro F. Giffuni" cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297525 - head/sys/compat/linux In-Reply-To: <201604031440.u33EesB7057019@repo.freebsd.org> Message-ID: <20160404045828.M816@besplex.bde.org> References: <201604031440.u33EesB7057019@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=EfU1O6SC c=1 sm=1 tr=0 a=73JWPhLeruqQCjN69UNZtQ==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=RwOoYL7EEKuF5z8t64wA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 19:11:44 -0000 On Sun, 3 Apr 2016, Pedro F. Giffuni wrote: > Author: pfg > Log: > Fix indentation oops. > > Modified: > head/sys/compat/linux/linux_misc.c > > Modified: head/sys/compat/linux/linux_misc.c > ============================================================================== > --- head/sys/compat/linux/linux_misc.c Sun Apr 3 14:38:26 2016 (r297524) > +++ head/sys/compat/linux/linux_misc.c Sun Apr 3 14:40:54 2016 (r297525) > @@ -896,12 +896,12 @@ linux_utimensat(struct thread *td, struc > } > timesp = times; > > - if (times[0].tv_nsec == UTIME_OMIT && > - times[1].tv_nsec == UTIME_OMIT) > /* This breaks POSIX, but is what the Linux kernel does > * _on purpose_ (documented in the man page for utimensat(2)), > * so we must follow that behaviour. */ > - return (0); > + if (times[0].tv_nsec == UTIME_OMIT && > + times[1].tv_nsec == UTIME_OMIT) > + return (0); > } > > if (args->pathname != NULL) The comment is still not written in BSD style. The patch shows a bug in svn(?) diff. The comment was moved, but the patch shows movement of the if statement. The indentation was only changed in the return statement. The comment was also misindented. Moving it fixes this, but I prefer it where it was. Comments are often placed before an if statement and not properly worded for that placement. They say that something is done unconditionally but that is clearly wrong since the action is conditional on the if statement. Here "this" in the comment used to refer to the action of returning, but is ambiguous enough to still make sense after the move. It now refers to the action of doing the check and sometimes returning. The block of code is short enough that the ambiguity is easy to resolve. Bruce From owner-svn-src-all@freebsd.org Sun Apr 3 19:23:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59874B01C36 for ; Sun, 3 Apr 2016 19:23:59 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm26-vm0.bullet.mail.bf1.yahoo.com (nm26-vm0.bullet.mail.bf1.yahoo.com [98.139.213.74]) (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 134FF1949 for ; Sun, 3 Apr 2016 19:23:59 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1459711437; bh=53/zzjPG23ht642/3kmfol6Z3Jz6OCEWb3y+EBOuBhk=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=gekNb4x1drWFSUrpr45FA9l+gUpltVQ9g2zdpc+ZfylsFZ+Yvm8ygDwGM5DngCYn9ikBJCqBc5a3xAHbRChbxA0rDc1YaQKUd6Fy/HDytVfd1EjwMT3nsRlEeJTyhKyw79TyzTOsPdoW0UjSg3x9BlghBIew9ypjzY6aP8gcYiRayRhILA7BLLEoPM1kBVKhKGnEr7L+p6hgL4eVZiuDca1Sp6fr2matow5wTHZm2/Z7tE0MNCNmGAaw7QGChxk4ema3GHxSUM7L0O6M+fiknZP1G9qjFQFXzvHCzaLdRixUdXC4QQp4E4m0X+or/IJav2Arz4gF+9MZXbIepUDa1w== Received: from [98.139.170.181] by nm26.bullet.mail.bf1.yahoo.com with NNFMP; 03 Apr 2016 19:23:57 -0000 Received: from [68.142.230.64] by tm24.bullet.mail.bf1.yahoo.com with NNFMP; 03 Apr 2016 19:23:57 -0000 Received: from [127.0.0.1] by smtp221.mail.bf1.yahoo.com with NNFMP; 03 Apr 2016 19:23:57 -0000 X-Yahoo-Newman-Id: 264709.64855.bm@smtp221.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: yLDj23oVM1n15f7.kmdYGZuut.fxlOtdr0gRygFKEanApKJ k1Bm9b5AgN9pUCHMT6odhs6nB43TbnVQXcYIMxsAyHg5R5WESUYxlJb30jC3 GuLyiMQIMc9i97bmbWfblbKFQ0ViNIES65ZPmNYvkuN7eK4_JJT5wc7CZyuC hMhyqb7IcLQ5C8NOx.Fitz86KpMeEfMKqiFY5GANHVamHSU4gRBS3ITWvudw s4gHhul9WeBPp0F0bUE2AC2eFUxodCGeyKsn5jd388Vq9vvrGkrjPYTv55g. IWx0iR017wmR9Q2Z0wtLRBkTl69m.93Yv_sPbVFkfVPtNqb24q_OQzSCWBvV xg5uv6miaZiNSg3HUSFm.H2.MWuuyJamzRIHBP8XcTjEC0cFlLwJ4N8w5qZy SgZxuiKW7QsPdJ1oXmClDVAsd7jNOY_oPu2jLdsgXFenLs.paqYeNpM5jCB_ 7nNgQoCvUpj6k6EAiZddfrnyUN8mZJk9XEUSqAAzYDFRQV3sagAUam3LRbOa LucKD5A2GE_5maG8eIRRnQH2bXBgB2cvh6g-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r297525 - head/sys/compat/linux To: Bruce Evans References: <201604031440.u33EesB7057019@repo.freebsd.org> <20160404045828.M816@besplex.bde.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Pedro Giffuni Message-ID: <57016E2A.4060301@FreeBSD.org> Date: Sun, 3 Apr 2016 14:25:30 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <20160404045828.M816@besplex.bde.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 19:23:59 -0000 On 03/04/2016 14:11, Bruce Evans wrote: > On Sun, 3 Apr 2016, Pedro F. Giffuni wrote: > >> Author: pfg >> Log: >> Fix indentation oops. >> >> Modified: >> head/sys/compat/linux/linux_misc.c >> >> Modified: head/sys/compat/linux/linux_misc.c >> ============================================================================== >> >> --- head/sys/compat/linux/linux_misc.c Sun Apr 3 14:38:26 2016 >> (r297524) >> +++ head/sys/compat/linux/linux_misc.c Sun Apr 3 14:40:54 2016 >> (r297525) >> @@ -896,12 +896,12 @@ linux_utimensat(struct thread *td, struc >> } >> timesp = times; >> >> - if (times[0].tv_nsec == UTIME_OMIT && >> - times[1].tv_nsec == UTIME_OMIT) >> /* This breaks POSIX, but is what the Linux kernel does >> * _on purpose_ (documented in the man page for utimensat(2)), >> * so we must follow that behaviour. */ >> - return (0); >> + if (times[0].tv_nsec == UTIME_OMIT && >> + times[1].tv_nsec == UTIME_OMIT) >> + return (0); >> } >> >> if (args->pathname != NULL) > > The comment is still not written in BSD style. > I didn't change the original. Is it worth it to do another commit to add lines for a beginning and end comment delimiters ? > The patch shows a bug in svn(?) diff. The comment was moved, but the > patch shows movement of the if statement. The indentation was only > changed in the return statement. > > The comment was also misindented. Moving it fixes this, but I prefer > it where it was. Precisely .. I moved the "if" so I would not have to indent further the comment. I find it more readable. > Comments are often placed before an if statement and > not properly worded for that placement. They say that something is > done unconditionally but that is clearly wrong since the action is > conditional on the if statement. Here "this" in the comment used to > refer to the action of returning, but is ambiguous enough to still make > sense after the move. It now refers to the action of doing the check > and sometimes returning. The block of code is short enough that the > ambiguity is easy to resolve. > > Bruce Pedro. From owner-svn-src-all@freebsd.org Sun Apr 3 19:31:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A97EB01F43 for ; Sun, 3 Apr 2016 19:31:23 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm4.bullet.mail.bf1.yahoo.com (nm4.bullet.mail.bf1.yahoo.com [98.139.212.163]) (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 445561CB7 for ; Sun, 3 Apr 2016 19:31:23 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1459711876; bh=1yMhh91ktnqVsr1l9142YjB9xHPpu3m2ZsgnlWtRzqE=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=mnLJQVmU1C0y/5iayEqvFLucjrhs0IyTj0Pmf1njuBt1Sq1Qyb41V3M62KuXLO6mvtEjgdRut1BgHdqcJFPHcula2g8+s4pvPwE6cPjaCd6FHz6iGgQG020lFfW179/bOzYsNLmxlf/dWmxBGNOQDJ20CrAyNKgAcAW0RGdJurZryOj/r1S01eD4Iue6evFvHk2ICiyd1WdLhOUfVn5ex5763ejhdi6SmEbnixd6CxmdL4nMH8mqDrUh8qB2p+x6SIpK5nTLlOR6HhY95ICAnxAmNHsFmjDHkzWpQXQpiXQwM/K3BGEomltEcNlGPmrfgqPS2HIqFjmUqiVZPRWzJg== Received: from [66.196.81.172] by nm4.bullet.mail.bf1.yahoo.com with NNFMP; 03 Apr 2016 19:31:16 -0000 Received: from [98.139.211.195] by tm18.bullet.mail.bf1.yahoo.com with NNFMP; 03 Apr 2016 19:31:16 -0000 Received: from [127.0.0.1] by smtp204.mail.bf1.yahoo.com with NNFMP; 03 Apr 2016 19:31:16 -0000 X-Yahoo-Newman-Id: 378561.33015.bm@smtp204.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: nxScPWMVM1nn8bNxo2Ukuz5srFN_vdvrJGAjbTgp9udtEIT zqfUO69b9cuOrbJjpdON0qU6LgnGGiWcLTY57Bn.6CB3EwLulUUxf6PEFeqi jZyEhcCSadjBrHtukTjPYeUb7I7U0sXA4f9oqufPHAoDN9cQMJ.xuHpX7Jic 4PbTfqAgp4hrUWVkzRuwxTzOKm6h7mSvqLQVxKZkozik3otNgsEpBPTKfRzj THAmC81ccw2r2cwnhI26xPnfQt2aSetNkAM8tcOh9AXmfO05MoN4._jIuDt1 OIs_o3FxrGqhPjPdReeI.AFeRWaUlja2iq9eDX1OQt_V7HeAXd_4YegxryE0 A_0t4m98ENcuSUR6vDriES9jIIvUkp1M.O3rRwTerZCvuftc.AsjD59GRvNk pXl0W5D2LCG0YHZLBo1gT07hUhputi92B9xeZvZZJWBAf_.Y68hU5m2xxi7f 1s0oD2pt07VCisyPW6ig_kiZze7z0f2It13FUeNmflqixvRoQnfz8qDpn_bp KnLU44Ltn7s5vkKPdLFfPB5r8A2LelFm55Q-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r297527 - head/sys/cam/scsi To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201604031638.u33GcGsa092204@repo.freebsd.org> From: Pedro Giffuni Message-ID: <57016FE2.1070607@FreeBSD.org> Date: Sun, 3 Apr 2016 14:32:50 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <201604031638.u33GcGsa092204@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 19:31:23 -0000 On 03/04/2016 11:38, Pedro F. Giffuni wrote: > Author: pfg > Date: Sun Apr 3 16:38:15 2016 > New Revision: 297527 > URL: https://svnweb.freebsd.org/changeset/base/297527 > > Log: > chdone(): Prevent returning uninitialized scalar value. > > If there is an error different from ERESTART, there is some > chance that we may end up accessing an uninitialized value. This > doesn't seem likely/possible but initialize announce_buf[0], > just in case. > > CID: 1006486 > > Modified: > head/sys/cam/scsi/scsi_ch.c > > Modified: head/sys/cam/scsi/scsi_ch.c > ============================================================================== > --- head/sys/cam/scsi/scsi_ch.c Sun Apr 3 16:25:51 2016 (r297526) > +++ head/sys/cam/scsi/scsi_ch.c Sun Apr 3 16:38:15 2016 (r297527) > @@ -651,6 +651,7 @@ chdone(struct cam_periph *periph, union > } else { > int error; > > + announce_buf[0] = '\0'; > error = cherror(done_ccb, CAM_RETRY_SELTO, > SF_RETRY_UA | SF_NO_PRINT); > /* > This one is rather tricky ... I wanted to play it safe so I initialized it here but I think that: 1) The late initialization in line 718 is now reduntant. 2) I could have instead moved the initialization in line 718 down one loop and it would have had the same effect. The code would be more difficult to understand if I had done it though. Perhaps someone more familiar with the code wants to review this (I tried with the author but he didn't reply and this code is old so I don't blame him). Pedro. From owner-svn-src-all@freebsd.org Sun Apr 3 20:29:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62292B000FE; Sun, 3 Apr 2016 20:29:22 +0000 (UTC) (envelope-from imp@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 mx1.freebsd.org (Postfix) with ESMTPS id 2E91B16D1; Sun, 3 Apr 2016 20:29:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u33KTLcv062592; Sun, 3 Apr 2016 20:29:21 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u33KTL8M062590; Sun, 3 Apr 2016 20:29:21 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201604032029.u33KTL8M062590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 3 Apr 2016 20:29:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297529 - head/sbin/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 20:29:22 -0000 Author: imp Date: Sun Apr 3 20:29:21 2016 New Revision: 297529 URL: https://svnweb.freebsd.org/changeset/base/297529 Log: Add a timestamp variable to the environment. This is when the event was read from the kernel by devd. Modified: head/sbin/devd/devd.cc head/sbin/devd/devd.conf.5 Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Sun Apr 3 20:29:14 2016 (r297528) +++ head/sbin/devd/devd.cc Sun Apr 3 20:29:21 2016 (r297529) @@ -788,6 +788,8 @@ process_event(char *buffer) { char type; char *sp; + struct timeval tv; + char *timestr; sp = buffer + 1; devdlog(LOG_INFO, "Processing event '%s'\n", buffer); @@ -797,7 +799,15 @@ process_event(char *buffer) cfg.set_variable("*", buffer - 1); // $_ is the entire line without the initial character cfg.set_variable("_", buffer); - // No match doesn't have a device, and the format is a little + + // Save the time this happened (as approximated by when we got + // around to processing it). + gettimeofday(&tv, NULL); + asprintf(×tr, "%jd.%06ld", (uintmax_t)tv.tv_sec, tv.tv_usec); + cfg.set_variable("timestamp", timestr); + free(timestr); + + // Match doesn't have a device, and the format is a little // different, so handle it separately. switch (type) { case notify: Modified: head/sbin/devd/devd.conf.5 ============================================================================== --- head/sbin/devd/devd.conf.5 Sun Apr 3 20:29:14 2016 (r297528) +++ head/sbin/devd/devd.conf.5 Sun Apr 3 20:29:21 2016 (r297529) @@ -245,6 +245,8 @@ Variables for other classes of events ar The entire message from the current event .It Li _ The entire message from the current event, after the initial type character +.It Li timestamp +The time this event was processed, in seconds since 1970 dot fraction .It Li bus Device name of parent bus. .It Li cdev From owner-svn-src-all@freebsd.org Sun Apr 3 20:29:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D77C5B000F9; Sun, 3 Apr 2016 20:29:15 +0000 (UTC) (envelope-from imp@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 mx1.freebsd.org (Postfix) with ESMTPS id A50CD16D0; Sun, 3 Apr 2016 20:29:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u33KTEMi062545; Sun, 3 Apr 2016 20:29:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u33KTETH062544; Sun, 3 Apr 2016 20:29:14 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201604032029.u33KTETH062544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 3 Apr 2016 20:29:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297528 - head/sbin/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 20:29:15 -0000 Author: imp Date: Sun Apr 3 20:29:14 2016 New Revision: 297528 URL: https://svnweb.freebsd.org/changeset/base/297528 Log: Make $_ match the docs. Modified: head/sbin/devd/devd.cc Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Sun Apr 3 16:38:15 2016 (r297527) +++ head/sbin/devd/devd.cc Sun Apr 3 20:29:14 2016 (r297528) @@ -796,7 +796,7 @@ process_event(char *buffer) // $* is the entire line cfg.set_variable("*", buffer - 1); // $_ is the entire line without the initial character - cfg.set_variable("_", buffer - 1); + cfg.set_variable("_", buffer); // No match doesn't have a device, and the format is a little // different, so handle it separately. switch (type) { From owner-svn-src-all@freebsd.org Sun Apr 3 22:11:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FE43B0180D; Sun, 3 Apr 2016 22:11:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 054431862; Sun, 3 Apr 2016 22:11:33 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c110-21-41-193.carlnfd1.nsw.optusnet.com.au (c110-21-41-193.carlnfd1.nsw.optusnet.com.au [110.21.41.193]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id E601C7814CF; Mon, 4 Apr 2016 08:11:29 +1000 (AEST) Date: Mon, 4 Apr 2016 08:11:29 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pedro Giffuni cc: Bruce Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297525 - head/sys/compat/linux In-Reply-To: <57016E2A.4060301@FreeBSD.org> Message-ID: <20160404080837.N1636@besplex.bde.org> References: <201604031440.u33EesB7057019@repo.freebsd.org> <20160404045828.M816@besplex.bde.org> <57016E2A.4060301@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=c+ZWOkJl c=1 sm=1 tr=0 a=73JWPhLeruqQCjN69UNZtQ==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=Ly1XLu6md58Vy3ulvrUA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 22:11:34 -0000 On Sun, 3 Apr 2016, Pedro Giffuni wrote: > On 03/04/2016 14:11, Bruce Evans wrote: >> On Sun, 3 Apr 2016, Pedro F. Giffuni wrote: >> >>> Author: pfg >>> Log: >>> Fix indentation oops. >>> >>> Modified: >>> head/sys/compat/linux/linux_misc.c >>> >>> Modified: head/sys/compat/linux/linux_misc.c >>> ============================================================================== >>> --- head/sys/compat/linux/linux_misc.c Sun Apr 3 14:38:26 2016 >>> (r297524) >>> +++ head/sys/compat/linux/linux_misc.c Sun Apr 3 14:40:54 2016 >>> (r297525) >>> @@ -896,12 +896,12 @@ linux_utimensat(struct thread *td, struc >>> } >>> timesp = times; >>> >>> - if (times[0].tv_nsec == UTIME_OMIT && >>> - times[1].tv_nsec == UTIME_OMIT) >>> /* This breaks POSIX, but is what the Linux kernel does >>> * _on purpose_ (documented in the man page for utimensat(2)), >>> * so we must follow that behaviour. */ >>> - return (0); >>> + if (times[0].tv_nsec == UTIME_OMIT && >>> + times[1].tv_nsec == UTIME_OMIT) >>> + return (0); >>> } >>> >>> if (args->pathname != NULL) >> >> The comment is still not written in BSD style. >> > I didn't change the original. Is it worth it to do another commit to add > lines for a beginning and end comment delimiters ? Not really. Bruce From owner-svn-src-all@freebsd.org Sun Apr 3 23:03:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44B4DB024B0; Sun, 3 Apr 2016 23:03:56 +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 mx1.freebsd.org (Postfix) with ESMTPS id 1AC171E06; Sun, 3 Apr 2016 23:03:56 +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 u33N3tkL010949; Sun, 3 Apr 2016 23:03:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u33N3shh010945; Sun, 3 Apr 2016 23:03:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201604032303.u33N3shh010945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sun, 3 Apr 2016 23:03:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297530 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 23:03:56 -0000 Author: jhb Date: Sun Apr 3 23:03:54 2016 New Revision: 297530 URL: https://svnweb.freebsd.org/changeset/base/297530 Log: Move i386/i386/autoconf.c to sys/x86/x86 and use it on both amd64 and i386. Added: head/sys/x86/x86/autoconf.c - copied, changed from r297529, head/sys/i386/i386/autoconf.c Deleted: head/sys/amd64/amd64/autoconf.c head/sys/i386/i386/autoconf.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/conf/files.pc98 Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Sun Apr 3 20:29:21 2016 (r297529) +++ head/sys/conf/files.amd64 Sun Apr 3 23:03:54 2016 (r297530) @@ -104,7 +104,6 @@ acpi_wakedata.h optional acpi \ amd64/amd64/amd64_mem.c optional mem #amd64/amd64/apic_vector.S standard amd64/amd64/atomic.c standard -amd64/amd64/autoconf.c standard amd64/amd64/bios.c standard amd64/amd64/bpf_jit_machdep.c optional bpf_jitter amd64/amd64/cpu_switch.S standard @@ -596,6 +595,7 @@ x86/isa/nmi.c standard x86/isa/orm.c optional isa x86/pci/pci_bus.c optional pci x86/pci/qpi.c optional pci +x86/x86/autoconf.c standard x86/x86/bus_machdep.c standard x86/x86/busdma_bounce.c standard x86/x86/busdma_machdep.c standard Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Sun Apr 3 20:29:21 2016 (r297529) +++ head/sys/conf/files.i386 Sun Apr 3 23:03:54 2016 (r297530) @@ -452,7 +452,6 @@ i386/bios/smapi_bios.S optional smapi #i386/i386/apic_vector.s optional apic i386/i386/atomic.c standard \ compile-with "${CC} -c ${CFLAGS} ${DEFINED_PROF:S/^$/-fomit-frame-pointer/} ${.IMPSRC}" -i386/i386/autoconf.c standard i386/i386/bios.c standard i386/i386/bioscall.s standard i386/i386/bpf_jit_machdep.c optional bpf_jitter @@ -591,6 +590,7 @@ x86/isa/nmi.c standard x86/isa/orm.c optional isa x86/pci/pci_bus.c optional pci x86/pci/qpi.c optional pci +x86/x86/autoconf.c standard x86/x86/bus_machdep.c standard x86/x86/busdma_bounce.c standard x86/x86/busdma_machdep.c standard Modified: head/sys/conf/files.pc98 ============================================================================== --- head/sys/conf/files.pc98 Sun Apr 3 20:29:21 2016 (r297529) +++ head/sys/conf/files.pc98 Sun Apr 3 23:03:54 2016 (r297530) @@ -147,7 +147,6 @@ i386/bios/apm.c optional apm #i386/i386/apic_vector.s optional apic i386/i386/atomic.c standard \ compile-with "${CC} -c ${CFLAGS} ${DEFINED_PROF:S/^$/-fomit-frame-pointer/} ${.IMPSRC}" -i386/i386/autoconf.c standard i386/i386/bios.c standard i386/i386/bioscall.s standard i386/i386/bpf_jit_machdep.c optional bpf_jitter @@ -258,6 +257,7 @@ x86/isa/atpic.c optional atpic x86/isa/clock.c standard x86/isa/isa.c optional isa x86/pci/pci_bus.c optional pci +x86/x86/autoconf.c standard x86/x86/busdma_bounce.c standard x86/x86/busdma_machdep.c standard x86/x86/cpu_machdep.c standard Copied and modified: head/sys/x86/x86/autoconf.c (from r297529, head/sys/i386/i386/autoconf.c) ============================================================================== --- head/sys/i386/i386/autoconf.c Sun Apr 3 20:29:21 2016 (r297529, copy source) +++ head/sys/x86/x86/autoconf.c Sun Apr 3 23:03:54 2016 (r297530) @@ -65,7 +65,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef PC98 #include +#endif #include #ifdef DEV_ISA @@ -92,7 +94,7 @@ configure_first(dummy) void *dummy; { - /* nexus0 is the top of the i386 device tree */ + /* nexus0 is the top of the x86 device tree */ device_add_child(root_bus, "nexus", 0); } From owner-svn-src-all@freebsd.org Sun Apr 3 23:40:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E3EAB02C26; Sun, 3 Apr 2016 23:40:00 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id E46BD19FB; Sun, 3 Apr 2016 23:39:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u33Ndxop020219; Sun, 3 Apr 2016 23:39:59 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u33NdxjM020218; Sun, 3 Apr 2016 23:39:59 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604032339.u33NdxjM020218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 3 Apr 2016 23:39:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297531 - head/sys/dev/iwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 23:40:00 -0000 Author: adrian Date: Sun Apr 3 23:39:58 2016 New Revision: 297531 URL: https://svnweb.freebsd.org/changeset/base/297531 Log: [iwn] Don't try to seamlessly recover from a firmware panic; just restart the interface. I know this may be unpopular, but iwn is not yet completely ready for a transparent firmware restart. I have this thing panic my laptop reliably because 11n state isn't kept in sync and the TX completion path ends up trying to free a null node reference. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun Apr 3 23:03:54 2016 (r297530) +++ head/sys/dev/iwn/if_iwn.c Sun Apr 3 23:39:58 2016 (r297531) @@ -8701,7 +8701,9 @@ iwn_panicked(void *arg0, int pending) struct iwn_softc *sc = arg0; struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); +#if 0 int error; +#endif if (vap == NULL) { printf("%s: null vap\n", __func__); @@ -8709,8 +8711,18 @@ iwn_panicked(void *arg0, int pending) } device_printf(sc->sc_dev, "%s: controller panicked, iv_state = %d; " - "resetting...\n", __func__, vap->iv_state); + "restarting\n", __func__, vap->iv_state); + /* + * This is not enough work. We need to also reinitialise + * the correct transmit state for aggregation enabled queues, + * which has a very specific requirement of + * ring index = 802.11 seqno % 256. If we don't do this (which + * we definitely don't!) then the firmware will just panic again. + */ +#if 1 + ieee80211_restart_all(ic); +#else IWN_LOCK(sc); iwn_stop_locked(sc); @@ -8727,6 +8739,7 @@ iwn_panicked(void *arg0, int pending) } IWN_UNLOCK(sc); +#endif } static void From owner-svn-src-all@freebsd.org Mon Apr 4 02:43:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0768EB0240C; Mon, 4 Apr 2016 02:43:37 +0000 (UTC) (envelope-from ache@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 mx1.freebsd.org (Postfix) with ESMTPS id CC8B91CDA; Mon, 4 Apr 2016 02:43:36 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u342haD0077862; Mon, 4 Apr 2016 02:43:36 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u342haaD077861; Mon, 4 Apr 2016 02:43:36 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201604040243.u342haaD077861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Mon, 4 Apr 2016 02:43:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297532 - head/lib/libc/locale X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 02:43:37 -0000 Author: ache Date: Mon Apr 4 02:43:35 2016 New Revision: 297532 URL: https://svnweb.freebsd.org/changeset/base/297532 Log: EUC-type encodings don't have single byte characters >= 128 This change should not be MFCed until new collate will be MFCed first, because our old EUC tables have some hacks for missing codesets. Modified: head/lib/libc/locale/euc.c Modified: head/lib/libc/locale/euc.c ============================================================================== --- head/lib/libc/locale/euc.c Sun Apr 3 23:39:58 2016 (r297531) +++ head/lib/libc/locale/euc.c Mon Apr 4 02:43:35 2016 (r297532) @@ -132,7 +132,7 @@ _EUC_CN_init(struct xlocale_ctype *l, _R l->runes = rl; l->__mb_cur_max = 4; - l->__mb_sb_limit = 256; + l->__mb_sb_limit = 128; return (0); } @@ -226,7 +226,7 @@ _EUC_JP_init(struct xlocale_ctype *l, _R l->runes = rl; l->__mb_cur_max = 3; - l->__mb_sb_limit = 196; + l->__mb_sb_limit = 128; return (0); } @@ -273,7 +273,7 @@ _EUC_TW_init(struct xlocale_ctype *l, _R l->runes = rl; l->__mb_cur_max = 4; - l->__mb_sb_limit = 256; + l->__mb_sb_limit = 128; return (0); } From owner-svn-src-all@freebsd.org Mon Apr 4 06:49:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C16C0B015ED; Mon, 4 Apr 2016 06:49:21 +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 mx1.freebsd.org (Postfix) with ESMTPS id 79AA11A65; Mon, 4 Apr 2016 06:49:21 +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 u346nKCn051615; Mon, 4 Apr 2016 06:49:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u346nK9t051613; Mon, 4 Apr 2016 06:49:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201604040649.u346nK9t051613@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 4 Apr 2016 06:49:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297533 - stable/10/lib/libthr/thread X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 06:49:21 -0000 Author: kib Date: Mon Apr 4 06:49:20 2016 New Revision: 297533 URL: https://svnweb.freebsd.org/changeset/base/297533 Log: MFC r297139: From libthr, remove special and strange code to set up session and control terminal, activated when running with pid 1. Modified: stable/10/lib/libthr/thread/thr_init.c stable/10/lib/libthr/thread/thr_rtld.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libthr/thread/thr_init.c ============================================================================== --- stable/10/lib/libthr/thread/thr_init.c Mon Apr 4 02:43:35 2016 (r297532) +++ stable/10/lib/libthr/thread/thr_init.c Mon Apr 4 06:49:20 2016 (r297533) @@ -303,7 +303,7 @@ _thread_init_hack(void) void _libpthread_init(struct pthread *curthread) { - int fd, first, dlopened; + int first, dlopened; /* Check if this function has already been called: */ if ((_thr_initial != NULL) && (curthread == NULL)) @@ -319,27 +319,6 @@ _libpthread_init(struct pthread *curthre memcpy(__thr_jtable, jmp_table, sizeof(jmp_table)); __thr_interpose_libc(); - /* - * Check for the special case of this process running as - * or in place of init as pid = 1: - */ - if ((_thr_pid = getpid()) == 1) { - /* - * Setup a new session for this process which is - * assumed to be running as root. - */ - if (setsid() == -1) - PANIC("Can't set session ID"); - if (revoke(_PATH_CONSOLE) != 0) - PANIC("Can't revoke console"); - if ((fd = __sys_open(_PATH_CONSOLE, O_RDWR)) < 0) - PANIC("Can't open console"); - if (setlogin("root") == -1) - PANIC("Can't set login to root"); - if (_ioctl(fd, TIOCSCTTY, (char *) NULL) == -1) - PANIC("Can't set controlling terminal"); - } - /* Initialize pthread private data. */ init_private(); Modified: stable/10/lib/libthr/thread/thr_rtld.c ============================================================================== --- stable/10/lib/libthr/thread/thr_rtld.c Mon Apr 4 02:43:35 2016 (r297532) +++ stable/10/lib/libthr/thread/thr_rtld.c Mon Apr 4 06:49:20 2016 (r297533) @@ -227,6 +227,7 @@ _thr_rtld_init(void) _rtld_atfork_post(NULL); _malloc_prefork(); _malloc_postfork(); + getpid(); syscall(SYS_getpid); /* mask signals, also force to resolve __sys_sigprocmask PLT */ From owner-svn-src-all@freebsd.org Mon Apr 4 06:55:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CB39B018E6; Mon, 4 Apr 2016 06:55:50 +0000 (UTC) (envelope-from sgalabov@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 mx1.freebsd.org (Postfix) with ESMTPS id ECDCC1E20; Mon, 4 Apr 2016 06:55:49 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u346tn6r054496; Mon, 4 Apr 2016 06:55:49 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u346tn4G054494; Mon, 4 Apr 2016 06:55:49 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201604040655.u346tn4G054494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Mon, 4 Apr 2016 06:55:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297534 - head/sys/dev/flash X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 06:55:50 -0000 Author: sgalabov Date: Mon Apr 4 06:55:48 2016 New Revision: 297534 URL: https://svnweb.freebsd.org/changeset/base/297534 Log: Enable 4-byte address support for the mx25l family of SPI flash devices. Introduce 2 new flags: - FL_ENABLE_4B_ADDR (forces the use of 4-byte addresses) - FL_DISABLE_4B_ADDR (forces the use of 3-byte addresses) If an SPI flash chip is defined with FL_ENABLE_4B_ADDR in its flags, then an 'Enter 4-byte mode' command is sent to the chip at attach time and, later, all commands that require addressing are issued with 4-byte addresses. If an SPI flash chip is defined with FL_DISABLE_4B_ADDR in its flags, then an 'Exit 4-byte mode' command is sent to the chip at attach time and, later, all commands that require addressing are issued with 3-byte addresses. For chips that do not have any of these flags defined the behaviour is unchanged. This change also adds support for the MX25L25735F and MX25L25635E chips (vendor id 0xc2, device id 0x2019), which support 4-byte mode and enables 4-byte mode for them. These are 256Mbit devices (32MiB) and, as such, can only be fully addressed by using 4-byte addresses. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5808 Modified: head/sys/dev/flash/mx25l.c head/sys/dev/flash/mx25lreg.h Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Mon Apr 4 06:49:20 2016 (r297533) +++ head/sys/dev/flash/mx25l.c Mon Apr 4 06:55:48 2016 (r297534) @@ -56,6 +56,8 @@ __FBSDID("$FreeBSD$"); #define FL_NONE 0x00 #define FL_ERASE_4K 0x01 #define FL_ERASE_32K 0x02 +#define FL_ENABLE_4B_ADDR 0x04 +#define FL_DISABLE_4B_ADDR 0x08 /* * Define the sectorsize to be a smaller size rather than the flash @@ -113,6 +115,7 @@ struct mx25l_flash_ident flash_devices[] { "mx25ll32", 0xc2, 0x2016, 64 * 1024, 64, FL_NONE }, { "mx25ll64", 0xc2, 0x2017, 64 * 1024, 128, FL_NONE }, { "mx25ll128", 0xc2, 0x2018, 64 * 1024, 256, FL_ERASE_4K | FL_ERASE_32K }, + { "mx25ll256", 0xc2, 0x2019, 64 * 1024, 512, FL_ERASE_4K | FL_ERASE_32K | FL_ENABLE_4B_ADDR }, { "s25fl032", 0x01, 0x0215, 64 * 1024, 64, FL_NONE }, { "s25fl064", 0x01, 0x0216, 64 * 1024, 128, FL_NONE }, { "s25fl128", 0x01, 0x2018, 64 * 1024, 256, FL_NONE }, @@ -219,10 +222,13 @@ mx25l_set_writable(device_t dev, int wri static void mx25l_erase_cmd(device_t dev, off_t sector, uint8_t ecmd) { - uint8_t txBuf[4], rxBuf[4]; + struct mx25l_softc *sc; + uint8_t txBuf[5], rxBuf[5]; struct spi_command cmd; int err; + sc = device_get_softc(dev); + mx25l_wait_for_device_ready(dev); mx25l_set_writable(dev, 1); @@ -233,11 +239,20 @@ mx25l_erase_cmd(device_t dev, off_t sect txBuf[0] = ecmd; cmd.tx_cmd = txBuf; cmd.rx_cmd = rxBuf; - cmd.rx_cmd_sz = 4; - cmd.tx_cmd_sz = 4; - txBuf[1] = ((sector >> 16) & 0xff); - txBuf[2] = ((sector >> 8) & 0xff); - txBuf[3] = (sector & 0xff); + if (sc->sc_flags & FL_ENABLE_4B_ADDR) { + cmd.rx_cmd_sz = 5; + cmd.tx_cmd_sz = 5; + txBuf[1] = ((sector >> 24) & 0xff); + txBuf[2] = ((sector >> 16) & 0xff); + txBuf[3] = ((sector >> 8) & 0xff); + txBuf[4] = (sector & 0xff); + } else { + cmd.rx_cmd_sz = 4; + cmd.tx_cmd_sz = 4; + txBuf[1] = ((sector >> 16) & 0xff); + txBuf[2] = ((sector >> 8) & 0xff); + txBuf[3] = (sector & 0xff); + } err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd); } @@ -255,8 +270,13 @@ mx25l_write(device_t dev, off_t offset, pdev = device_get_parent(dev); sc = device_get_softc(dev); - cmd.tx_cmd_sz = 4; - cmd.rx_cmd_sz = 4; + if (sc->sc_flags & FL_ENABLE_4B_ADDR) { + cmd.tx_cmd_sz = 5; + cmd.rx_cmd_sz = 5; + } else { + cmd.tx_cmd_sz = 4; + cmd.rx_cmd_sz = 4; + } bytes_writen = 0; write_offset = offset; @@ -290,9 +310,16 @@ mx25l_write(device_t dev, off_t offset, mx25l_erase_cmd(dev, offset + bytes_writen, CMD_SECTOR_ERASE); txBuf[0] = CMD_PAGE_PROGRAM; - txBuf[1] = ((write_offset >> 16) & 0xff); - txBuf[2] = ((write_offset >> 8) & 0xff); - txBuf[3] = (write_offset & 0xff); + if (sc->sc_flags & FL_ENABLE_4B_ADDR) { + txBuf[1] = ((write_offset >> 24) & 0xff); + txBuf[2] = ((write_offset >> 16) & 0xff); + txBuf[3] = ((write_offset >> 8) & 0xff); + txBuf[4] = (write_offset & 0xff); + } else { + txBuf[1] = ((write_offset >> 16) & 0xff); + txBuf[2] = ((write_offset >> 8) & 0xff); + txBuf[3] = (write_offset & 0xff); + } bytes_to_write = MIN(FLASH_PAGE_SIZE, count - bytes_writen); @@ -344,14 +371,26 @@ mx25l_read(device_t dev, off_t offset, c return (EIO); txBuf[0] = CMD_FAST_READ; - cmd.tx_cmd_sz = 5; - cmd.rx_cmd_sz = 5; - - txBuf[1] = ((offset >> 16) & 0xff); - txBuf[2] = ((offset >> 8) & 0xff); - txBuf[3] = (offset & 0xff); - /* Dummy byte */ - txBuf[4] = 0; + if (sc->sc_flags & FL_ENABLE_4B_ADDR) { + cmd.tx_cmd_sz = 6; + cmd.rx_cmd_sz = 6; + + txBuf[1] = ((offset >> 24) & 0xff); + txBuf[2] = ((offset >> 16) & 0xff); + txBuf[3] = ((offset >> 8) & 0xff); + txBuf[4] = (offset & 0xff); + /* Dummy byte */ + txBuf[5] = 0; + } else { + cmd.tx_cmd_sz = 5; + cmd.rx_cmd_sz = 5; + + txBuf[1] = ((offset >> 16) & 0xff); + txBuf[2] = ((offset >> 8) & 0xff); + txBuf[3] = (offset & 0xff); + /* Dummy byte */ + txBuf[4] = 0; + } cmd.tx_cmd = txBuf; cmd.rx_cmd = rxBuf; @@ -366,6 +405,34 @@ mx25l_read(device_t dev, off_t offset, c } static int +mx25l_set_4b_mode(device_t dev, uint8_t command) +{ + uint8_t txBuf[1], rxBuf[1]; + struct spi_command cmd; + device_t pdev; + int err; + + memset(&cmd, 0, sizeof(cmd)); + memset(txBuf, 0, sizeof(txBuf)); + memset(rxBuf, 0, sizeof(rxBuf)); + + pdev = device_get_parent(dev); + + cmd.tx_cmd_sz = cmd.rx_cmd_sz = 1; + + cmd.tx_cmd = txBuf; + cmd.rx_cmd = rxBuf; + + txBuf[0] = command; + + err = SPIBUS_TRANSFER(pdev, dev, &cmd); + + mx25l_wait_for_device_ready(dev); + + return (err); +} + +static int mx25l_probe(device_t dev) { @@ -413,6 +480,12 @@ mx25l_attach(device_t dev) sc->sc_sectorsize = ident->sectorsize; sc->sc_flags = ident->flags; + if (sc->sc_flags & FL_ENABLE_4B_ADDR) + mx25l_set_4b_mode(dev, CMD_ENTER_4B_MODE); + + if (sc->sc_flags & FL_DISABLE_4B_ADDR) + mx25l_set_4b_mode(dev, CMD_EXIT_4B_MODE); + /* NB: use stripesize to hold the erase/region size for RedBoot */ sc->sc_disk->d_stripesize = ident->sectorsize; Modified: head/sys/dev/flash/mx25lreg.h ============================================================================== --- head/sys/dev/flash/mx25lreg.h Mon Apr 4 06:49:20 2016 (r297533) +++ head/sys/dev/flash/mx25lreg.h Mon Apr 4 06:55:48 2016 (r297534) @@ -45,6 +45,8 @@ #define CMD_BULK_ERASE 0xC7 #define CMD_BLOCK_4K_ERASE 0x20 #define CMD_BLOCK_32K_ERASE 0x52 +#define CMD_ENTER_4B_MODE 0xB7 +#define CMD_EXIT_4B_MODE 0xE9 /* * Status register flags From owner-svn-src-all@freebsd.org Mon Apr 4 06:59:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15400B019CC; Mon, 4 Apr 2016 06:59:01 +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 mx1.freebsd.org (Postfix) with ESMTPS id D725F1FF4; Mon, 4 Apr 2016 06:59:00 +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 u346x0b7054659; Mon, 4 Apr 2016 06:59:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u346wxKf054653; Mon, 4 Apr 2016 06:58:59 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201604040658.u346wxKf054653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 4 Apr 2016 06:58:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297535 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 06:59:01 -0000 Author: kib Date: Mon Apr 4 06:58:59 2016 New Revision: 297535 URL: https://svnweb.freebsd.org/changeset/base/297535 Log: Remove unused variable. It was write-only before r297139. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/lib/libthr/thread/thr_init.c head/lib/libthr/thread/thr_private.h Modified: head/lib/libthr/thread/thr_init.c ============================================================================== --- head/lib/libthr/thread/thr_init.c Mon Apr 4 06:55:48 2016 (r297534) +++ head/lib/libthr/thread/thr_init.c Mon Apr 4 06:58:59 2016 (r297535) @@ -108,7 +108,6 @@ struct pthread_cond_attr _pthread_condat .c_clockid = CLOCK_REALTIME }; -pid_t _thr_pid; int _thr_is_smp = 0; size_t _thr_guard_default; size_t _thr_stack_default = THR_STACK_DEFAULT; Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Mon Apr 4 06:55:48 2016 (r297534) +++ head/lib/libthr/thread/thr_private.h Mon Apr 4 06:58:59 2016 (r297535) @@ -725,7 +725,6 @@ extern struct pthread_cond_attr _pthread extern struct pthread_prio _thr_priorities[] __hidden; -extern pid_t _thr_pid __hidden; extern int _thr_is_smp __hidden; extern size_t _thr_guard_default __hidden; From owner-svn-src-all@freebsd.org Mon Apr 4 07:06:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0E00B01C27; Mon, 4 Apr 2016 07:06:21 +0000 (UTC) (envelope-from wma@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 mx1.freebsd.org (Postfix) with ESMTPS id C7624140F; Mon, 4 Apr 2016 07:06:21 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3476KS7057588; Mon, 4 Apr 2016 07:06:20 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3476KhI057585; Mon, 4 Apr 2016 07:06:20 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201604040706.u3476KhI057585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Mon, 4 Apr 2016 07:06:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297536 - in head/sys: arm64/arm64 arm64/include conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 07:06:22 -0000 Author: wma Date: Mon Apr 4 07:06:20 2016 New Revision: 297536 URL: https://svnweb.freebsd.org/changeset/base/297536 Log: arm64: bzero optimization This optimization attempts to utylize as wide as possible register store instructions to zero large buffers. The implementation, if possible, will use 'dc zva' to zero buffer by cache lines. Speedup: 60x faster memory zeroing Submitted by: Dominik Ermel Obtained from: Semihalf Sponsored by: Cavium Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D5726 Modified: head/sys/arm64/arm64/machdep.c head/sys/arm64/include/armreg.h head/sys/conf/files.arm64 Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Mon Apr 4 06:58:59 2016 (r297535) +++ head/sys/arm64/arm64/machdep.c Mon Apr 4 07:06:20 2016 (r297536) @@ -108,6 +108,7 @@ struct kva_md_info kmi; int64_t dcache_line_size; /* The minimum D cache line size */ int64_t icache_line_size; /* The minimum I cache line size */ int64_t idcache_line_size; /* The minimum cache line size */ +int64_t dczva_line_size; /* The size of cache line the dc zva zeroes */ static void cpu_startup(void *dummy) @@ -129,16 +130,6 @@ cpu_idle_wakeup(int cpu) return (0); } -void -bzero(void *buf, size_t len) -{ - uint8_t *p; - - p = buf; - while(len-- > 0) - *p++ = 0; -} - int fill_regs(struct thread *td, struct reg *regs) { @@ -800,8 +791,9 @@ try_load_dtb(caddr_t kmdp) static void cache_setup(void) { - int dcache_line_shift, icache_line_shift; + int dcache_line_shift, icache_line_shift, dczva_line_shift; uint32_t ctr_el0; + uint32_t dczid_el0; ctr_el0 = READ_SPECIALREG(ctr_el0); @@ -815,6 +807,17 @@ cache_setup(void) icache_line_size = sizeof(int) << icache_line_shift; idcache_line_size = MIN(dcache_line_size, icache_line_size); + + dczid_el0 = READ_SPECIALREG(dczid_el0); + + /* Check if dc zva is not prohibited */ + if (dczid_el0 & DCZID_DZP) + dczva_line_size = 0; + else { + /* Same as with above calculations */ + dczva_line_shift = DCZID_BS_SIZE(dczid_el0); + dczva_line_size = sizeof(int) << dczva_line_shift; + } } void Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Mon Apr 4 06:58:59 2016 (r297535) +++ head/sys/arm64/include/armreg.h Mon Apr 4 07:06:20 2016 (r297536) @@ -66,6 +66,12 @@ #define CTR_ILINE_MASK (0xf << CTR_ILINE_SHIFT) #define CTR_ILINE_SIZE(reg) (((reg) & CTR_ILINE_MASK) >> CTR_ILINE_SHIFT) +/* DCZID_EL0 - Data Cache Zero ID register */ +#define DCZID_DZP (1 << 4) /* DC ZVA prohibited if non-0 */ +#define DCZID_BS_SHIFT 0 +#define DCZID_BS_MASK (0xf << DCZID_BS_SHIFT) +#define DCZID_BS_SIZE(reg) (((reg) & DCZID_BS_MASK) >> DCZID_BS_SHIFT) + /* ESR_ELx */ #define ESR_ELx_ISS_MASK 0x00ffffff #define ISS_INSN_FnV (0x01 << 10) Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Mon Apr 4 06:58:59 2016 (r297535) +++ head/sys/conf/files.arm64 Mon Apr 4 07:06:20 2016 (r297536) @@ -12,6 +12,7 @@ arm64/arm64/bus_machdep.c standard arm64/arm64/bus_space_asm.S standard arm64/arm64/busdma_bounce.c standard arm64/arm64/busdma_machdep.c standard +arm64/arm64/bzero.S standard arm64/arm64/clock.c standard arm64/arm64/copyinout.S standard arm64/arm64/copystr.c standard From owner-svn-src-all@freebsd.org Mon Apr 4 07:11:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D103FB02007; Mon, 4 Apr 2016 07:11:34 +0000 (UTC) (envelope-from wma@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 mx1.freebsd.org (Postfix) with ESMTPS id A890819A1; Mon, 4 Apr 2016 07:11:34 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u347BXbk060609; Mon, 4 Apr 2016 07:11:33 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u347BXxv060608; Mon, 4 Apr 2016 07:11:33 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201604040711.u347BXxv060608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Mon, 4 Apr 2016 07:11:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297537 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 07:11:34 -0000 Author: wma Date: Mon Apr 4 07:11:33 2016 New Revision: 297537 URL: https://svnweb.freebsd.org/changeset/base/297537 Log: Add bzero.S to ARM64 machdep Add fille missing from https://svnweb.freebsd.org/changeset/base/297536 Added: head/sys/arm64/arm64/bzero.S (contents, props changed) Added: head/sys/arm64/arm64/bzero.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/arm64/bzero.S Mon Apr 4 07:11:33 2016 (r297537) @@ -0,0 +1,206 @@ +/*- + * Copyright (C) 2016 Cavium Inc. + * All rights reserved. + * + * Developed by Semihalf. + * + * 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 "assym.s" + + /* + * void bzero(void *p, size_t size) + * + * x0 - p + * x1 - size + */ +ENTRY(bzero) + cbz x1, ending + + /* + * x5 is number of cache lines to zero - calculated later and + * will become non-zero if buffer is long enough to zero by + * cache lines (and if it is allowed.) + * We need to zero it before proceeding with buffers of size + * smaller than 16 bytes - otherwise the x5 will not be + * calculated and will retain random value. + * "normal" is used for buffers <= 16 bytes and to align buffer + * to cache line for buffers bigger than cache line; non-0 x5 + * after "normal" has completed indicates that it has been used + * to align buffer to cache line and now zero by cache lines will + * be performed, and x5 is amount of cache lines to loop through. + */ + mov x5, xzr + + /* No use of cache assisted zero for buffers with size <= 16 */ + cmp x1, #0x10 + b.le normal + + /* + * Load size of line that will be cleaned by dc zva call. + * 0 means that the instruction is not allowed + */ + ldr x7, =dczva_line_size + ldr x7, [x7] + cbz x7, normal + + /* + * Buffer must be larger than cache line for using cache zeroing + * (and cache line aligned but this is checked after jump) + */ + cmp x1, x7 + b.lt normal + + /* + * Calculate number of bytes to cache aligned address (x4) nad + * number of full cache lines (x5). x6 is final address to zero. + */ + sub x2, x7, #0x01 + mov x3, -1 + eor x3, x3, x2 + add x4, x0, x2 + and x4, x4, x3 + subs x4, x4, x0 + b.eq normal + + /* Calculate number of "lines" in buffer */ + sub x5, x1, x4 + rbit x2, x7 + clz x2, x2 + lsr x5, x5, x2 + + /* + * If number of cache lines is 0, we will not be able to zero + * by cache lines, so go normal way. + */ + cbz x5, normal + /* x6 is final address to zero */ + add x6, x0, x1 + + /* + * We are here because x5 is non-0 so normal will be used to + * align buffer before cache zeroing. x4 holds number of bytes + * needed for alignment. + */ + mov x1, x4 + + /* When jumping here: x0 holds pointer, x1 holds size */ +normal: + /* + * Get buffer offset into 16 byte aligned address; 0 means pointer + * is aligned. + */ + ands x2, x0, #0x0f + b.eq aligned_to_16 + /* Calculate one-byte loop runs to 8 byte aligned address. */ + ands x2, x2, #0x07 + mov x3, #0x08 + sub x2, x3, x2 + /* x2 is number of bytes missing for alignment, x1 is buffer size */ + cmp x1, x2 + csel x2, x1, x2, le + sub x1, x1, x2 + + /* + * Byte by byte copy will copy at least enough bytes to align + * pointer and at most "size". + */ +align: + strb wzr, [x0], #0x01 + subs x2, x2, #0x01 + b.ne align + + /* Now pointer is aligned to 8 bytes */ + cmp x1, #0x10 + b.lt lead_out + /* + * Check if copy of another 8 bytes is needed to align to 16 byte + * address and do it + */ + tbz x0, #0x03, aligned_to_16 + str xzr, [x0], #0x08 + sub x1, x1, #0x08 + + /* While jumping here: x0 is 16 byte alligned address, x1 is size */ +aligned_to_16: + /* If size is less than 16 bytes, use lead_out to copy what remains */ + cmp x1, #0x10 + b.lt lead_out + + lsr x2, x1, #0x04 +zero_by_16: + stp xzr, xzr, [x0], #0x10 + subs x2, x2, #0x01 + b.ne zero_by_16 + + /* + * Lead out requires addresses to be aligned to 8 bytes. It is used to + * zero buffers with sizes < 16 and what can not be zeroed by + * zero_by_16 loop. + */ + ands x1, x1, #0x0f + b.eq lead_out_end +lead_out: + tbz x1, #0x03, lead_out_dword + str xzr, [x0], #0x08 +lead_out_dword: + tbz x1, #0x02, lead_out_word + str wzr, [x0], #0x04 +lead_out_word: + tbz x1, #0x01, lead_out_byte + strh wzr, [x0], #0x02 +lead_out_byte: + tbz x1, #0x00, lead_out_end + strb wzr, [x0], #0x01 + +lead_out_end: + /* + * If x5 is non-zero, this means that normal has been used as + * a lead in to align buffer address to cache size + */ + cbz x5, ending + + /* + * Here x5 holds number of lines to zero; x6 is final address of + * buffer. x0 is cache line aligned pointer. x7 is cache line size + * in bytes + */ +cache_line_zero: + dc zva, x0 + add x0, x0, x7 + subs x5, x5, #0x01 + b.ne cache_line_zero + + /* Need to zero remaining bytes? */ + subs x1, x6, x0 + b.ne normal + +ending: + ret + +END(bzero) + From owner-svn-src-all@freebsd.org Mon Apr 4 07:16:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66EB0B022F8; Mon, 4 Apr 2016 07:16:45 +0000 (UTC) (envelope-from wma@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 mx1.freebsd.org (Postfix) with ESMTPS id 3E9121CE5; Mon, 4 Apr 2016 07:16:45 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u347Gib3060838; Mon, 4 Apr 2016 07:16:44 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u347Gi5o060834; Mon, 4 Apr 2016 07:16:44 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201604040716.u347Gi5o060834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Mon, 4 Apr 2016 07:16:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297538 - in head/sys/arm64: arm64 include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 07:16:45 -0000 Author: wma Date: Mon Apr 4 07:16:43 2016 New Revision: 297538 URL: https://svnweb.freebsd.org/changeset/base/297538 Log: arm64: pagezero improvement This change has been provided to improve pagezero call performance. Submitted by: Dominik Ermel Obtained from: Semihalf Sponsored by: Cavium Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D5741 Modified: head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/pmap.c head/sys/arm64/arm64/support.S head/sys/arm64/include/machdep.h Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Mon Apr 4 07:11:33 2016 (r297537) +++ head/sys/arm64/arm64/machdep.c Mon Apr 4 07:16:43 2016 (r297538) @@ -110,6 +110,13 @@ int64_t icache_line_size; /* The minimum int64_t idcache_line_size; /* The minimum cache line size */ int64_t dczva_line_size; /* The size of cache line the dc zva zeroes */ +/* pagezero_* implementations are provided in support.S */ +void pagezero_simple(void *); +void pagezero_cache(void *); + +/* pagezero_simple is default pagezero */ +void (*pagezero)(void *p) = pagezero_simple; + static void cpu_startup(void *dummy) { @@ -817,6 +824,9 @@ cache_setup(void) /* Same as with above calculations */ dczva_line_shift = DCZID_BS_SIZE(dczid_el0); dczva_line_size = sizeof(int) << dczva_line_shift; + + /* Change pagezero function */ + pagezero = pagezero_cache; } } Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Mon Apr 4 07:11:33 2016 (r297537) +++ head/sys/arm64/arm64/pmap.c Mon Apr 4 07:16:43 2016 (r297538) @@ -271,13 +271,6 @@ pagecopy(void *s, void *d) memcpy(d, s, PAGE_SIZE); } -static __inline void -pagezero(void *p) -{ - - bzero(p, PAGE_SIZE); -} - #define pmap_l0_index(va) (((va) >> L0_SHIFT) & L0_ADDR_MASK) #define pmap_l1_index(va) (((va) >> L1_SHIFT) & Ln_ADDR_MASK) #define pmap_l2_index(va) (((va) >> L2_SHIFT) & Ln_ADDR_MASK) Modified: head/sys/arm64/arm64/support.S ============================================================================== --- head/sys/arm64/arm64/support.S Mon Apr 4 07:11:33 2016 (r297537) +++ head/sys/arm64/arm64/support.S Mon Apr 4 07:16:43 2016 (r297538) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include "assym.s" @@ -290,3 +291,38 @@ ENTRY(longjmp) mov x0, x1 ret END(longjmp) + +/* + * pagezero, simple implementation + */ +ENTRY(pagezero_simple) + add x1, x0, #PAGE_SIZE + +1: + stp xzr, xzr, [x0], #0x10 + stp xzr, xzr, [x0], #0x10 + stp xzr, xzr, [x0], #0x10 + stp xzr, xzr, [x0], #0x10 + cmp x0, x1 + b.ne 1b + ret + +END(pagezero_simple) + +/* + * pagezero, cache assisted + */ +ENTRY(pagezero_cache) + add x1, x0, #PAGE_SIZE + + ldr x2, =dczva_line_size + ldr x2, [x2] + +1: + dc zva, x0 + add x0, x0, x2 + cmp x0, x1 + b.ne 1b + ret + +END(pagezero_cache) Modified: head/sys/arm64/include/machdep.h ============================================================================== --- head/sys/arm64/include/machdep.h Mon Apr 4 07:11:33 2016 (r297537) +++ head/sys/arm64/include/machdep.h Mon Apr 4 07:16:43 2016 (r297538) @@ -41,5 +41,6 @@ extern vm_paddr_t physmap[]; extern u_int physmap_idx; void initarm(struct arm64_bootparams *); +extern void (*pagezero)(void *); #endif /* _MACHINE_MACHDEP_H_ */ From owner-svn-src-all@freebsd.org Mon Apr 4 09:15:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15385B02468; Mon, 4 Apr 2016 09:15:27 +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 mx1.freebsd.org (Postfix) with ESMTPS id CD58F1767; Mon, 4 Apr 2016 09:15:26 +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 u349FQxY096505; Mon, 4 Apr 2016 09:15:26 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u349FPNt096500; Mon, 4 Apr 2016 09:15:25 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201604040915.u349FPNt096500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus Date: Mon, 4 Apr 2016 09:15:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297539 - in head/sys: arm/arm arm/freescale/imx arm/include arm/mv arm/nvidia arm/ti/omap4 kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 09:15:27 -0000 Author: skra Date: Mon Apr 4 09:15:25 2016 New Revision: 297539 URL: https://svnweb.freebsd.org/changeset/base/297539 Log: Remove FDT specific parts from INTRNG. Change its interface to make it universal. (1) New struct intr_map_data is defined as a container for arbitrary description of an interrupt used by a device. Typically, an interrupt number and configuration relevant to an interrupt controller is encoded in such description. However, any additional information may be encoded too like a set of cpus on which an interrupt should be enabled or vendor specific data needed for setup of an interrupt in controller. The struct intr_map_data itself is meant to be opaque for INTRNG. (2) An intr_map_irq() function is created which takes an interrupt controller identification and struct intr_map_data as arguments and returns global interrupt number which identifies an interrupt. (3) A set of functions to be used by bus drivers is created as well as a corresponding set of methods for interrupt controller drivers. These sets take both struct resource and struct intr_map_data as one of the arguments. There is a goal to keep struct intr_map_data in struct resource, however, this way a final solution is not limited to that. (4) Other small changes are done to reflect new situation. This is only first step aiming to create stable interface for interrupt controller drivers. Thus, some temporary solution is taken. Interrupt descriptions for devices are stored in INTRNG and two specific mapping function are created to be temporary used by bus drivers. That's why the struct intr_map_data is not opaque for INTRNG now. This temporary solution will be replaced by final one in next step. Differential Revision: https://reviews.freebsd.org/D5730 Modified: head/sys/arm/arm/gic.c head/sys/arm/arm/machdep_intr.c head/sys/arm/arm/nexus.c head/sys/arm/freescale/imx/imx_gpio.c head/sys/arm/include/intr.h head/sys/arm/mv/mpic.c head/sys/arm/nvidia/tegra_lic.c head/sys/arm/ti/omap4/omap4_wugen.c head/sys/kern/pic_if.m head/sys/kern/subr_intr.c head/sys/sys/intr.h Modified: head/sys/arm/arm/gic.c ============================================================================== --- head/sys/arm/arm/gic.c Mon Apr 4 07:16:43 2016 (r297538) +++ head/sys/arm/arm/gic.c Mon Apr 4 09:15:25 2016 (r297539) @@ -36,8 +36,6 @@ __FBSDID("$FreeBSD$"); #include "opt_platform.h" -#include "opt_platform.h" - #include #include #include @@ -118,13 +116,20 @@ __FBSDID("$FreeBSD$"); #endif #ifdef ARM_INTRNG +struct gic_irqsrc { + struct intr_irqsrc gi_isrc; + uint32_t gi_irq; + enum intr_polarity gi_pol; + enum intr_trigger gi_trig; +}; + static u_int gic_irq_cpu; static int arm_gic_intr(void *); -static int arm_gic_bind(device_t dev, struct intr_irqsrc *isrc); +static int arm_gic_bind_intr(device_t dev, struct intr_irqsrc *isrc); #ifdef SMP u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1]; -#define ISRC_IPI(isrc) sgi_to_ipi[isrc->isrc_data - GIC_FIRST_SGI] +u_int sgi_first_unused = GIC_FIRST_SGI; #endif #endif @@ -132,7 +137,7 @@ struct arm_gic_softc { device_t gic_dev; #ifdef ARM_INTRNG void * gic_intrhand; - struct intr_irqsrc ** gic_irqs; + struct gic_irqsrc * gic_irqs; #endif struct resource * gic_res[3]; bus_space_tag_t gic_c_bst; @@ -147,6 +152,10 @@ struct arm_gic_softc { #endif }; +#ifdef ARM_INTRNG +#define GIC_INTR_ISRC(sc, irq) (&sc->gic_irqs[irq].gi_isrc) +#endif + static struct resource_spec arm_gic_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, /* Distributor registers */ { SYS_RES_MEMORY, 1, RF_ACTIVE }, /* CPU Interrupt Intf. registers */ @@ -243,7 +252,7 @@ arm_gic_init_secondary(device_t dev) /* Unmask attached SGI interrupts. */ for (irq = GIC_FIRST_SGI; irq <= GIC_LAST_SGI; irq++) { - isrc = sc->gic_irqs[irq]; + isrc = GIC_INTR_ISRC(sc, irq); if (isrc != NULL && isrc->isrc_handlers != 0) { CPU_SET(PCPU_GET(cpuid), &isrc->isrc_cpu); gic_irq_unmask(sc, irq); @@ -252,7 +261,7 @@ arm_gic_init_secondary(device_t dev) /* Unmask attached PPI interrupts. */ for (irq = GIC_FIRST_PPI; irq <= GIC_LAST_PPI; irq++) { - isrc = sc->gic_irqs[irq]; + isrc = GIC_INTR_ISRC(sc, irq); if (isrc == NULL || isrc->isrc_handlers == 0) continue; if (isrc->isrc_flags & INTR_ISRCF_BOUND) { @@ -369,6 +378,46 @@ gic_xref(device_t dev) return (0); #endif } + +static int +arm_gic_register_isrcs(struct arm_gic_softc *sc, uint32_t num) +{ + int error; + uint32_t irq; + struct gic_irqsrc *irqs; + struct intr_irqsrc *isrc; + const char *name; + + irqs = malloc(num * sizeof(struct gic_irqsrc), M_DEVBUF, + M_WAITOK | M_ZERO); + + name = device_get_nameunit(sc->gic_dev); + for (irq = 0; irq < num; irq++) { + irqs[irq].gi_irq = irq; + irqs[irq].gi_pol = INTR_POLARITY_CONFORM; + irqs[irq].gi_trig = INTR_TRIGGER_CONFORM; + + isrc = &irqs[irq].gi_isrc; + if (irq <= GIC_LAST_SGI) { + error = intr_isrc_register(isrc, sc->gic_dev, + INTR_ISRCF_IPI, "%s,i%u", name, irq - GIC_FIRST_SGI); + } else if (irq <= GIC_LAST_PPI) { + error = intr_isrc_register(isrc, sc->gic_dev, + INTR_ISRCF_PPI, "%s,p%u", name, irq - GIC_FIRST_PPI); + } else { + error = intr_isrc_register(isrc, sc->gic_dev, 0, + "%s,s%u", name, irq - GIC_FIRST_SPI); + } + if (error != 0) { + /* XXX call intr_isrc_deregister() */ + free(irqs, M_DEVBUF); + return (error); + } + } + sc->gic_irqs = irqs; + sc->nirqs = num; + return (0); +} #endif static int @@ -376,7 +425,7 @@ arm_gic_attach(device_t dev) { struct arm_gic_softc *sc; int i; - uint32_t icciidr, mask; + uint32_t icciidr, mask, nirqs; #ifdef ARM_INTRNG phandle_t pxref; intptr_t xref = gic_xref(dev); @@ -410,13 +459,17 @@ arm_gic_attach(device_t dev) gic_d_write_4(sc, GICD_CTLR, 0x00); /* Get the number of interrupts */ - sc->nirqs = gic_d_read_4(sc, GICD_TYPER); - sc->nirqs = 32 * ((sc->nirqs & 0x1f) + 1); + nirqs = gic_d_read_4(sc, GICD_TYPER); + nirqs = 32 * ((nirqs & 0x1f) + 1); #ifdef ARM_INTRNG - sc->gic_irqs = malloc(sc->nirqs * sizeof (*sc->gic_irqs), M_DEVBUF, - M_WAITOK | M_ZERO); + if (arm_gic_register_isrcs(sc, nirqs)) { + device_printf(dev, "could not register irqs\n"); + goto cleanup; + } #else + sc->nirqs = nirqs; + /* Set up function pointers */ arm_post_filter = gic_post_filter; arm_config_irq = gic_config_irq; @@ -496,20 +549,20 @@ arm_gic_attach(device_t dev) if (intr_pic_claim_root(dev, xref, arm_gic_intr, sc, GIC_LAST_SGI - GIC_FIRST_SGI + 1) != 0) { device_printf(dev, "could not set PIC as a root\n"); - intr_pic_unregister(dev, xref); + intr_pic_deregister(dev, xref); goto cleanup; } } else { if (sc->gic_res[2] == NULL) { device_printf(dev, "not root PIC must have defined interrupt\n"); - intr_pic_unregister(dev, xref); + intr_pic_deregister(dev, xref); goto cleanup; } if (bus_setup_intr(dev, sc->gic_res[2], INTR_TYPE_CLK, arm_gic_intr, NULL, sc, &sc->gic_intrhand)) { device_printf(dev, "could not setup irq handler\n"); - intr_pic_unregister(dev, xref); + intr_pic_deregister(dev, xref); goto cleanup; } } @@ -533,7 +586,7 @@ static int arm_gic_intr(void *arg) { struct arm_gic_softc *sc = arg; - struct intr_irqsrc *isrc; + struct gic_irqsrc *gi; uint32_t irq_active_reg, irq; struct trapframe *tf; @@ -569,14 +622,7 @@ arm_gic_intr(void *arg) tf = curthread->td_intr_frame; dispatch_irq: - isrc = sc->gic_irqs[irq]; - if (isrc == NULL) { - device_printf(sc->gic_dev, "Stray interrupt %u detected\n", irq); - gic_irq_mask(sc, irq); - gic_c_write_4(sc, GICC_EOIR, irq_active_reg); - goto next_irq; - } - + gi = sc->gic_irqs + irq; /* * Note that GIC_FIRST_SGI is zero and is not used in 'if' statement * as compiler complains that comparing u_int >= 0 is always true. @@ -585,7 +631,7 @@ dispatch_irq: #ifdef SMP /* Call EOI for all IPI before dispatch. */ gic_c_write_4(sc, GICC_EOIR, irq_active_reg); - intr_ipi_dispatch(ISRC_IPI(isrc), tf); + intr_ipi_dispatch(sgi_to_ipi[gi->gi_irq], tf); goto next_irq; #else device_printf(sc->gic_dev, "SGI %u on UP system detected\n", @@ -598,10 +644,15 @@ dispatch_irq: #ifdef GIC_DEBUG_SPURIOUS sc->last_irq[PCPU_GET(cpuid)] = irq; #endif - if (isrc->isrc_trig == INTR_TRIGGER_EDGE) + if (gi->gi_trig == INTR_TRIGGER_EDGE) gic_c_write_4(sc, GICC_EOIR, irq_active_reg); - intr_irq_dispatch(isrc, tf); + if (intr_isrc_dispatch(&gi->gi_isrc, tf) != 0) { + gic_irq_mask(sc, irq); + if (gi->gi_trig != INTR_TRIGGER_EDGE) + gic_c_write_4(sc, GICC_EOIR, irq_active_reg); + device_printf(sc->gic_dev, "Stray irq %u disabled\n", irq); + } next_irq: arm_irq_memory_barrier(irq); @@ -613,52 +664,6 @@ next_irq: return (FILTER_HANDLED); } -static int -gic_attach_isrc(struct arm_gic_softc *sc, struct intr_irqsrc *isrc, u_int irq) -{ - const char *name; - - /* - * 1. The link between ISRC and controller must be set atomically. - * 2. Just do things only once in rare case when consumers - * of shared interrupt came here at the same moment. - */ - mtx_lock_spin(&sc->mutex); - if (sc->gic_irqs[irq] != NULL) { - mtx_unlock_spin(&sc->mutex); - return (sc->gic_irqs[irq] == isrc ? 0 : EEXIST); - } - sc->gic_irqs[irq] = isrc; - isrc->isrc_data = irq; - mtx_unlock_spin(&sc->mutex); - - name = device_get_nameunit(sc->gic_dev); - if (irq <= GIC_LAST_SGI) - intr_irq_set_name(isrc, "%s,i%u", name, irq - GIC_FIRST_SGI); - else if (irq <= GIC_LAST_PPI) - intr_irq_set_name(isrc, "%s,p%u", name, irq - GIC_FIRST_PPI); - else - intr_irq_set_name(isrc, "%s,s%u", name, irq - GIC_FIRST_SPI); - return (0); -} - -static int -gic_detach_isrc(struct arm_gic_softc *sc, struct intr_irqsrc *isrc, u_int irq) -{ - - mtx_lock_spin(&sc->mutex); - if (sc->gic_irqs[irq] != isrc) { - mtx_unlock_spin(&sc->mutex); - return (sc->gic_irqs[irq] == NULL ? 0 : EINVAL); - } - sc->gic_irqs[irq] = NULL; - isrc->isrc_data = 0; - mtx_unlock_spin(&sc->mutex); - - intr_irq_set_name(isrc, ""); - return (0); -} - static void gic_config(struct arm_gic_softc *sc, u_int irq, enum intr_trigger trig, enum intr_polarity pol) @@ -716,127 +721,163 @@ gic_bind(struct arm_gic_softc *sc, u_int return (0); } +#ifdef FDT static int -gic_irq_from_nspc(struct arm_gic_softc *sc, u_int type, u_int num, u_int *irqp) +gic_map_fdt(device_t dev, u_int ncells, pcell_t *cells, u_int *irqp, + enum intr_polarity *polp, enum intr_trigger *trigp) { - switch (type) { - case INTR_IRQ_NSPC_PLAIN: - *irqp = num; - return (*irqp < sc->nirqs ? 0 : EINVAL); - - case INTR_IRQ_NSPC_IRQ: - *irqp = num + GIC_FIRST_PPI; - return (*irqp < sc->nirqs ? 0 : EINVAL); - - case INTR_IRQ_NSPC_IPI: - *irqp = num + GIC_FIRST_SGI; - return (*irqp < GIC_LAST_SGI ? 0 : EINVAL); - - default: - return (EINVAL); + if (ncells == 1) { + *irqp = cells[0]; + *polp = INTR_POLARITY_CONFORM; + *trigp = INTR_TRIGGER_CONFORM; + return (0); } -} + if (ncells == 3) { + u_int irq, tripol; -static int -gic_map_nspc(struct arm_gic_softc *sc, struct intr_irqsrc *isrc, u_int *irqp) -{ - int error; + /* + * The 1st cell is the interrupt type: + * 0 = SPI + * 1 = PPI + * The 2nd cell contains the interrupt number: + * [0 - 987] for SPI + * [0 - 15] for PPI + * The 3rd cell is the flags, encoded as follows: + * bits[3:0] trigger type and level flags + * 1 = low-to-high edge triggered + * 2 = high-to-low edge triggered + * 4 = active high level-sensitive + * 8 = active low level-sensitive + * bits[15:8] PPI interrupt cpu mask + * Each bit corresponds to each of the 8 possible cpus + * attached to the GIC. A bit set to '1' indicated + * the interrupt is wired to that CPU. + */ + switch (cells[0]) { + case 0: + irq = GIC_FIRST_SPI + cells[1]; + /* SPI irq is checked later. */ + break; + case 1: + irq = GIC_FIRST_PPI + cells[1]; + if (irq > GIC_LAST_PPI) { + device_printf(dev, "unsupported PPI interrupt " + "number %u\n", cells[1]); + return (EINVAL); + } + break; + default: + device_printf(dev, "unsupported interrupt type " + "configuration %u\n", cells[0]); + return (EINVAL); + } - error = gic_irq_from_nspc(sc, isrc->isrc_nspc_type, isrc->isrc_nspc_num, - irqp); - if (error != 0) - return (error); - return (gic_attach_isrc(sc, isrc, *irqp)); + tripol = cells[2] & 0xff; + if (tripol & 0xf0 || (tripol & 0x0a && cells[0] == 0)) + device_printf(dev, "unsupported trigger/polarity " + "configuration 0x%02x\n", tripol); + + *irqp = irq; + *polp = INTR_POLARITY_CONFORM; + *trigp = tripol & 0x03 ? INTR_TRIGGER_EDGE : INTR_TRIGGER_LEVEL; + return (0); + } + return (EINVAL); } +#endif -#ifdef FDT static int -gic_map_fdt(struct arm_gic_softc *sc, struct intr_irqsrc *isrc, u_int *irqp) +gic_map_intr(device_t dev, struct intr_map_data *data, u_int *irqp, + enum intr_polarity *polp, enum intr_trigger *trigp) { - u_int irq, tripol; - enum intr_trigger trig; + u_int irq; enum intr_polarity pol; - int error; - - if (isrc->isrc_ncells == 1) { - irq = isrc->isrc_cells[0]; - pol = INTR_POLARITY_CONFORM; - trig = INTR_TRIGGER_CONFORM; - } else if (isrc->isrc_ncells == 3) { - if (isrc->isrc_cells[0] == 0) - irq = isrc->isrc_cells[1] + GIC_FIRST_SPI; - else - irq = isrc->isrc_cells[1] + GIC_FIRST_PPI; + enum intr_trigger trig; + struct arm_gic_softc *sc; - /* - * In intr[2], bits[3:0] are trigger type and level flags. - * 1 = low-to-high edge triggered - * 2 = high-to-low edge triggered - * 4 = active high level-sensitive - * 8 = active low level-sensitive - * The hardware only supports active-high-level or rising-edge. - */ - tripol = isrc->isrc_cells[2]; - if (tripol & 0x0a && irq >= GIC_FIRST_SPI) { - device_printf(sc->gic_dev, - "unsupported trigger/polarity configuration " - "0x%02x\n", tripol & 0x0f); - } - pol = INTR_POLARITY_CONFORM; - if (tripol & 0x03) - trig = INTR_TRIGGER_EDGE; - else - trig = INTR_TRIGGER_LEVEL; - } else + sc = device_get_softc(dev); + switch (data->type) { +#ifdef FDT + case INTR_MAP_DATA_FDT: + if (gic_map_fdt(dev, data->fdt.ncells, data->fdt.cells, &irq, + &pol, &trig) != 0) + return (EINVAL); + break; +#endif + default: return (EINVAL); + } if (irq >= sc->nirqs) return (EINVAL); - - error = gic_attach_isrc(sc, isrc, irq); - if (error != 0) - return (error); - - isrc->isrc_nspc_type = INTR_IRQ_NSPC_PLAIN; - isrc->isrc_nspc_num = irq; - isrc->isrc_trig = trig; - isrc->isrc_pol = pol; + if (pol != INTR_POLARITY_CONFORM && pol != INTR_POLARITY_LOW && + pol != INTR_POLARITY_HIGH) + return (EINVAL); + if (trig != INTR_TRIGGER_CONFORM && trig != INTR_TRIGGER_EDGE && + trig != INTR_TRIGGER_LEVEL) + return (EINVAL); *irqp = irq; + if (polp != NULL) + *polp = pol; + if (trigp != NULL) + *trigp = trig; return (0); } -#endif static int -arm_gic_register(device_t dev, struct intr_irqsrc *isrc, boolean_t *is_percpu) +arm_gic_map_intr(device_t dev, struct intr_map_data *data, + struct intr_irqsrc **isrcp) { - struct arm_gic_softc *sc = device_get_softc(dev); - u_int irq; int error; + u_int irq; + struct arm_gic_softc *sc; - if (isrc->isrc_type == INTR_ISRCT_NAMESPACE) - error = gic_map_nspc(sc, isrc, &irq); -#ifdef FDT - else if (isrc->isrc_type == INTR_ISRCT_FDT) - error = gic_map_fdt(sc, isrc, &irq); -#endif - else - return (EINVAL); - - if (error == 0) - *is_percpu = irq < GIC_FIRST_SPI ? TRUE : FALSE; + error = gic_map_intr(dev, data, &irq, NULL, NULL); + if (error == 0) { + sc = device_get_softc(dev); + *isrcp = GIC_INTR_ISRC(sc, irq); + } return (error); } -static void -arm_gic_enable_intr(device_t dev, struct intr_irqsrc *isrc) +static int +arm_gic_setup_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) { struct arm_gic_softc *sc = device_get_softc(dev); - u_int irq = isrc->isrc_data; + struct gic_irqsrc *gi = (struct gic_irqsrc *)isrc; + u_int irq; + enum intr_trigger trig; + enum intr_polarity pol; + + if (data == NULL) + return (ENOTSUP); + + /* Get config for resource. */ + if (gic_map_intr(dev, data, &irq, &pol, &trig)) + return (EINVAL); + + if (gi->gi_irq != irq) + return (EINVAL); + + /* Compare config if this is not first setup. */ + if (isrc->isrc_handlers != 0) { + if ((pol != INTR_POLARITY_CONFORM && pol != gi->gi_pol) || + (trig != INTR_TRIGGER_CONFORM && trig != gi->gi_trig)) + return (EINVAL); + else + return (0); + } + + if (pol == INTR_POLARITY_CONFORM) + pol = INTR_POLARITY_LOW; /* just pick some */ + if (trig == INTR_TRIGGER_CONFORM) + trig = INTR_TRIGGER_EDGE; /* just pick some */ - if (isrc->isrc_trig == INTR_TRIGGER_CONFORM) - isrc->isrc_trig = INTR_TRIGGER_LEVEL; + gi->gi_pol = pol; + gi->gi_trig = trig; /* * XXX - In case that per CPU interrupt is going to be enabled in time @@ -845,48 +886,54 @@ arm_gic_enable_intr(device_t dev, struct * pic_enable_source() and pic_disable_source() should act on * per CPU basis only. Thus, it should be solved here somehow. */ - if (isrc->isrc_flags & INTR_ISRCF_PERCPU) + if (isrc->isrc_flags & INTR_ISRCF_PPI) CPU_SET(PCPU_GET(cpuid), &isrc->isrc_cpu); - gic_config(sc, irq, isrc->isrc_trig, isrc->isrc_pol); - arm_gic_bind(dev, isrc); + gic_config(sc, gi->gi_irq, trig, pol); + arm_gic_bind_intr(dev, isrc); + return (0); } -static void -arm_gic_enable_source(device_t dev, struct intr_irqsrc *isrc) +static int +arm_gic_teardown_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) { - struct arm_gic_softc *sc = device_get_softc(dev); - u_int irq = isrc->isrc_data; + struct gic_irqsrc *gi = (struct gic_irqsrc *)isrc; - arm_irq_memory_barrier(irq); - gic_irq_unmask(sc, irq); + if (isrc->isrc_handlers == 0) { + gi->gi_pol = INTR_POLARITY_CONFORM; + gi->gi_trig = INTR_TRIGGER_CONFORM; + } + return (0); } static void -arm_gic_disable_source(device_t dev, struct intr_irqsrc *isrc) +arm_gic_enable_intr(device_t dev, struct intr_irqsrc *isrc) { struct arm_gic_softc *sc = device_get_softc(dev); - u_int irq = isrc->isrc_data; + struct gic_irqsrc *gi = (struct gic_irqsrc *)isrc; - gic_irq_mask(sc, irq); + arm_irq_memory_barrier(gi->gi_irq); + gic_irq_unmask(sc, gi->gi_irq); } -static int -arm_gic_unregister(device_t dev, struct intr_irqsrc *isrc) +static void +arm_gic_disable_intr(device_t dev, struct intr_irqsrc *isrc) { struct arm_gic_softc *sc = device_get_softc(dev); - u_int irq = isrc->isrc_data; + struct gic_irqsrc *gi = (struct gic_irqsrc *)isrc; - return (gic_detach_isrc(sc, isrc, irq)); + gic_irq_mask(sc, gi->gi_irq); } static void arm_gic_pre_ithread(device_t dev, struct intr_irqsrc *isrc) { struct arm_gic_softc *sc = device_get_softc(dev); + struct gic_irqsrc *gi = (struct gic_irqsrc *)isrc; - arm_gic_disable_source(dev, isrc); - gic_c_write_4(sc, GICC_EOIR, isrc->isrc_data); + arm_gic_disable_intr(dev, isrc); + gic_c_write_4(sc, GICC_EOIR, gi->gi_irq); } static void @@ -894,65 +941,65 @@ arm_gic_post_ithread(device_t dev, struc { arm_irq_memory_barrier(0); - arm_gic_enable_source(dev, isrc); + arm_gic_enable_intr(dev, isrc); } static void arm_gic_post_filter(device_t dev, struct intr_irqsrc *isrc) { struct arm_gic_softc *sc = device_get_softc(dev); + struct gic_irqsrc *gi = (struct gic_irqsrc *)isrc; /* EOI for edge-triggered done earlier. */ - if (isrc->isrc_trig == INTR_TRIGGER_EDGE) + if (gi->gi_trig == INTR_TRIGGER_EDGE) return; arm_irq_memory_barrier(0); - gic_c_write_4(sc, GICC_EOIR, isrc->isrc_data); + gic_c_write_4(sc, GICC_EOIR, gi->gi_irq); } static int -arm_gic_bind(device_t dev, struct intr_irqsrc *isrc) +arm_gic_bind_intr(device_t dev, struct intr_irqsrc *isrc) { struct arm_gic_softc *sc = device_get_softc(dev); - uint32_t irq = isrc->isrc_data; + struct gic_irqsrc *gi = (struct gic_irqsrc *)isrc; - if (irq < GIC_FIRST_SPI) + if (gi->gi_irq < GIC_FIRST_SPI) return (EINVAL); if (CPU_EMPTY(&isrc->isrc_cpu)) { gic_irq_cpu = intr_irq_next_cpu(gic_irq_cpu, &all_cpus); CPU_SETOF(gic_irq_cpu, &isrc->isrc_cpu); } - return (gic_bind(sc, irq, &isrc->isrc_cpu)); + return (gic_bind(sc, gi->gi_irq, &isrc->isrc_cpu)); } #ifdef SMP static void -arm_gic_ipi_send(device_t dev, struct intr_irqsrc *isrc, cpuset_t cpus) +arm_gic_ipi_send(device_t dev, struct intr_irqsrc *isrc, cpuset_t cpus, + u_int ipi) { struct arm_gic_softc *sc = device_get_softc(dev); - uint32_t irq, val = 0, i; - - irq = isrc->isrc_data; + struct gic_irqsrc *gi = (struct gic_irqsrc *)isrc; + uint32_t val = 0, i; for (i = 0; i < MAXCPU; i++) if (CPU_ISSET(i, &cpus)) val |= 1 << (16 + i); - gic_d_write_4(sc, GICD_SGIR(0), val | irq); + gic_d_write_4(sc, GICD_SGIR(0), val | gi->gi_irq); } static int -arm_gic_ipi_setup(device_t dev, u_int ipi, struct intr_irqsrc *isrc) +arm_gic_ipi_setup(device_t dev, u_int ipi, struct intr_irqsrc **isrcp) { struct arm_gic_softc *sc = device_get_softc(dev); - u_int irq; - int error; - error = gic_map_nspc(sc, isrc, &irq); - if (error != 0) - return (error); - sgi_to_ipi[irq - GIC_FIRST_SGI] = ipi; + if (sgi_first_unused > GIC_LAST_SGI) + return (ENOSPC); + + *isrcp = GIC_INTR_ISRC(sc, sgi_first_unused); + sgi_to_ipi[sgi_first_unused++] = ipi; return (0); } #endif @@ -1171,16 +1218,16 @@ static device_method_t arm_gic_methods[] DEVMETHOD(device_attach, arm_gic_attach), #ifdef ARM_INTRNG /* Interrupt controller interface */ - DEVMETHOD(pic_disable_source, arm_gic_disable_source), + DEVMETHOD(pic_disable_intr, arm_gic_disable_intr), DEVMETHOD(pic_enable_intr, arm_gic_enable_intr), - DEVMETHOD(pic_enable_source, arm_gic_enable_source), + DEVMETHOD(pic_map_intr, arm_gic_map_intr), + DEVMETHOD(pic_setup_intr, arm_gic_setup_intr), + DEVMETHOD(pic_teardown_intr, arm_gic_teardown_intr), DEVMETHOD(pic_post_filter, arm_gic_post_filter), DEVMETHOD(pic_post_ithread, arm_gic_post_ithread), DEVMETHOD(pic_pre_ithread, arm_gic_pre_ithread), - DEVMETHOD(pic_register, arm_gic_register), - DEVMETHOD(pic_unregister, arm_gic_unregister), #ifdef SMP - DEVMETHOD(pic_bind, arm_gic_bind), + DEVMETHOD(pic_bind_intr, arm_gic_bind_intr), DEVMETHOD(pic_init_secondary, arm_gic_init_secondary), DEVMETHOD(pic_ipi_send, arm_gic_ipi_send), DEVMETHOD(pic_ipi_setup, arm_gic_ipi_setup), Modified: head/sys/arm/arm/machdep_intr.c ============================================================================== --- head/sys/arm/arm/machdep_intr.c Mon Apr 4 07:16:43 2016 (r297538) +++ head/sys/arm/arm/machdep_intr.c Mon Apr 4 09:15:25 2016 (r297539) @@ -1,8 +1,6 @@ -/* $NetBSD: intr.c,v 1.12 2003/07/15 00:24:41 lukem Exp $ */ - /*- - * Copyright (c) 2004 Olivier Houchard. - * Copyright (c) 1994-1998 Mark Brinicombe. + * Copyright (c) 2015-2016 Svatopluk Kraus + * Copyright (c) 2015-2016 Michal Meloun * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -13,27 +11,18 @@ * 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 Mark Brinicombe - * for the NetBSD Project. - * 4. The name of the company nor the name of the author may 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 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) + * + * 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. - * - * Soft interrupt and other generic interrupt functions. */ #include "opt_platform.h" @@ -76,7 +65,6 @@ struct intr_ipi { }; static struct intr_ipi ipi_sources[INTR_IPI_COUNT]; -u_int ipi_next_num; #endif #endif @@ -184,7 +172,7 @@ intr_ipi_send(cpuset_t cpus, u_int ipi) if (ii->ii_count == NULL) panic("%s: not setup IPI %u", __func__, ipi); - ii->ii_send(ii->ii_send_arg, cpus); + ii->ii_send(ii->ii_send_arg, cpus, ipi); } void @@ -211,11 +199,11 @@ intr_ipi_setup(u_int ipi, const char *na * Send IPI thru interrupt controller. */ static void -pic_ipi_send(void *arg, cpuset_t cpus) +pic_ipi_send(void *arg, cpuset_t cpus, u_int ipi) { KASSERT(intr_irq_root_dev != NULL, ("%s: no root attached", __func__)); - PIC_IPI_SEND(intr_irq_root_dev, arg, cpus); + PIC_IPI_SEND(intr_irq_root_dev, arg, cpus, ipi); } /* @@ -232,18 +220,11 @@ intr_pic_ipi_setup(u_int ipi, const char KASSERT(intr_irq_root_dev != NULL, ("%s: no root attached", __func__)); - isrc = intr_isrc_alloc(INTR_ISRCT_NAMESPACE, 0); - isrc->isrc_nspc_type = INTR_IRQ_NSPC_IPI; - isrc->isrc_nspc_num = ipi_next_num; - - error = PIC_IPI_SETUP(intr_irq_root_dev, ipi, isrc); + error = PIC_IPI_SETUP(intr_irq_root_dev, ipi, &isrc); if (error != 0) return (error); - ipi_next_num++; - - isrc->isrc_dev = intr_irq_root_dev; - isrc->isrc_handlers = 1; + isrc->isrc_handlers++; intr_ipi_setup(ipi, name, hand, arg, pic_ipi_send, isrc); return (0); } Modified: head/sys/arm/arm/nexus.c ============================================================================== --- head/sys/arm/arm/nexus.c Mon Apr 4 07:16:43 2016 (r297538) +++ head/sys/arm/arm/nexus.c Mon Apr 4 09:15:25 2016 (r297539) @@ -281,7 +281,8 @@ nexus_config_intr(device_t dev, int irq, int ret = ENODEV; #ifdef ARM_INTRNG - ret = intr_irq_config(irq, trig, pol); + device_printf(dev, "bus_config_intr is obsolete and not supported!\n"); + ret = EOPNOTSUPP; #else if (arm_config_irq) ret = (*arm_config_irq)(irq, trig, pol); @@ -293,22 +294,23 @@ static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { +#ifndef ARM_INTRNG int irq; +#endif if ((rman_get_flags(res) & RF_SHAREABLE) == 0) flags |= INTR_EXCL; - for (irq = rman_get_start(res); irq <= rman_get_end(res); irq++) { #ifdef ARM_INTRNG - intr_irq_add_handler(child, filt, intr, arg, irq, flags, - cookiep); + return(intr_setup_irq(child, res, filt, intr, arg, flags, cookiep)); #else + for (irq = rman_get_start(res); irq <= rman_get_end(res); irq++) { arm_setup_irqhandler(device_get_nameunit(child), filt, intr, arg, irq, flags, cookiep); arm_unmask_irq(irq); -#endif } return (0); +#endif } static int @@ -316,7 +318,7 @@ nexus_teardown_intr(device_t dev, device { #ifdef ARM_INTRNG - return (intr_irq_remove_handler(child, rman_get_start(r), ih)); + return (intr_teardown_irq(child, r, ih)); #else return (arm_remove_irqhandler(rman_get_start(r), ih)); #endif @@ -328,7 +330,7 @@ nexus_describe_intr(device_t dev, device void *cookie, const char *descr) { - return (intr_irq_describe(rman_get_start(irq), cookie, descr)); + return (intr_describe_irq(child, irq, cookie, descr)); } #ifdef SMP @@ -336,7 +338,7 @@ static int nexus_bind_intr(device_t dev, device_t child, struct resource *irq, int cpu) { - return (intr_irq_bind(rman_get_start(irq), cpu)); + return (intr_bind_irq(child, irq, cpu)); } #endif #endif Modified: head/sys/arm/freescale/imx/imx_gpio.c ============================================================================== --- head/sys/arm/freescale/imx/imx_gpio.c Mon Apr 4 07:16:43 2016 (r297538) +++ head/sys/arm/freescale/imx/imx_gpio.c Mon Apr 4 09:15:25 2016 (r297539) @@ -91,6 +91,15 @@ __FBSDID("$FreeBSD$"); #define DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT) #define NGPIO 32 +#ifdef ARM_INTRNG +struct gpio_irqsrc { + struct intr_irqsrc gi_isrc; + u_int gi_irq; + enum intr_polarity gi_pol; + enum intr_trigger gi_trig; +}; +#endif + struct imx51_gpio_softc { device_t dev; device_t sc_busdev; @@ -101,7 +110,9 @@ struct imx51_gpio_softc { bus_space_handle_t sc_ioh; int gpio_npins; struct gpio_pin gpio_pins[NGPIO]; - struct intr_irqsrc *gpio_pic_irqsrc[NGPIO]; +#ifdef ARM_INTRNG + struct gpio_irqsrc gpio_pic_irqsrc[NGPIO]; +#endif }; static struct ofw_compat_data compat_data[] = { @@ -145,8 +156,30 @@ static int imx51_gpio_pin_get(device_t, static int imx51_gpio_pin_toggle(device_t, uint32_t pin); #ifdef ARM_INTRNG +static int +gpio_pic_teardown_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ + struct imx51_gpio_softc *sc; + struct gpio_irqsrc *gi; + + sc = device_get_softc(dev); + if (isrc->isrc_handlers == 0) { + gi = (struct gpio_irqsrc *)isrc; + gi->gi_pol = INTR_POLARITY_CONFORM; + gi->gi_trig = INTR_TRIGGER_CONFORM; + + // XXX Not sure this is necessary + mtx_lock_spin(&sc->sc_mtx); + CLEAR4(sc, IMX_GPIO_IMR_REG, (1U << gi->gi_irq)); + WRITE4(sc, IMX_GPIO_ISR_REG, (1U << gi->gi_irq)); + mtx_unlock_spin(&sc->sc_mtx); + } + return (0); +} + /* - * this is teardown_intr + * this is mask_intr */ static void gpio_pic_disable_intr(device_t dev, struct intr_irqsrc *isrc) @@ -155,55 +188,143 @@ gpio_pic_disable_intr(device_t dev, stru u_int irq; sc = device_get_softc(dev); - irq = isrc->isrc_data; + irq = ((struct gpio_irqsrc *)isrc)->gi_irq; - // XXX Not sure this is necessary mtx_lock_spin(&sc->sc_mtx); CLEAR4(sc, IMX_GPIO_IMR_REG, (1U << irq)); - WRITE4(sc, IMX_GPIO_ISR_REG, (1U << irq)); mtx_unlock_spin(&sc->sc_mtx); } -/* - * this is mask_intr - */ -static void -gpio_pic_disable_source(device_t dev, struct intr_irqsrc *isrc) +static int +gpio_pic_map_fdt(device_t dev, u_int ncells, pcell_t *cells, u_int *irqp, + enum intr_polarity *polp, enum intr_trigger *trigp) { struct imx51_gpio_softc *sc; + u_int irq, tripol; + enum intr_polarity pol; + enum intr_trigger trig; sc = device_get_softc(dev); - mtx_lock_spin(&sc->sc_mtx); - CLEAR4(sc, IMX_GPIO_IMR_REG, (1U << isrc->isrc_data)); - mtx_unlock_spin(&sc->sc_mtx); + /* + * From devicetree/bindings/gpio/fsl-imx-gpio.txt: + * #interrupt-cells: 2. The first cell is the GPIO number. The second + * cell bits[3:0] is used to specify trigger type and level flags: + * 1 = low-to-high edge triggered. + * 2 = high-to-low edge triggered. + * 4 = active high level-sensitive. + * 8 = active low level-sensitive. + * We can do any single one of these modes, but nothing in combo. + */ + + if (ncells != 2) { + device_printf(sc->dev, "Invalid #interrupt-cells"); + return (EINVAL); + } + + irq = cells[0]; + tripol = cells[1]; + if (irq >= sc->gpio_npins) { + device_printf(sc->dev, "Invalid interrupt number %d", irq); + return (EINVAL); + } + switch (tripol) { + case 1: + trig = INTR_TRIGGER_EDGE; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Apr 4 09:23:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 542FBB02895; Mon, 4 Apr 2016 09:23:23 +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 mx1.freebsd.org (Postfix) with ESMTPS id 2BC6D1CFE; Mon, 4 Apr 2016 09:23:23 +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 u349NMgO099454; Mon, 4 Apr 2016 09:23:22 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u349NM9F099452; Mon, 4 Apr 2016 09:23:22 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201604040923.u349NM9F099452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus Date: Mon, 4 Apr 2016 09:23:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297540 - in head/sys/arm: conf ti X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 09:23:23 -0000 Author: skra Date: Mon Apr 4 09:23:21 2016 New Revision: 297540 URL: https://svnweb.freebsd.org/changeset/base/297540 Log: Rework am33xx interrupt controller for INTRNG and enable it on BEAGLEBONE by default. Reviewed by: gonzo Differential Revision: https://reviews.freebsd.org/D5805 Modified: head/sys/arm/conf/BEAGLEBONE head/sys/arm/ti/aintc.c Modified: head/sys/arm/conf/BEAGLEBONE ============================================================================== --- head/sys/arm/conf/BEAGLEBONE Mon Apr 4 09:15:25 2016 (r297539) +++ head/sys/arm/conf/BEAGLEBONE Mon Apr 4 09:23:21 2016 (r297540) @@ -28,6 +28,8 @@ include "../ti/am335x/std.am335x" makeoptions MODULES_EXTRA="dtb/am335x am335x_dmtpps" +options ARM_INTRNG + options HZ=100 options SCHED_4BSD # 4BSD scheduler options PLATFORM Modified: head/sys/arm/ti/aintc.c ============================================================================== --- head/sys/arm/ti/aintc.c Mon Apr 4 09:15:25 2016 (r297539) +++ head/sys/arm/ti/aintc.c Mon Apr 4 09:23:21 2016 (r297540) @@ -30,12 +30,15 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_platform.h" + #include #include #include #include #include #include +#include #include #include #include @@ -45,6 +48,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef ARM_INTRNG +#include "pic_if.h" +#endif + #define INTC_REVISION 0x00 #define INTC_SYSCONFIG 0x10 #define INTC_SYSSTATUS 0x14 @@ -56,12 +63,27 @@ __FBSDID("$FreeBSD$"); #define INTC_ISR_SET(x) (0x90 + ((x) * 0x20)) #define INTC_ISR_CLEAR(x) (0x94 + ((x) * 0x20)) +#define INTC_SIR_SPURIOUS_MASK 0xffffff80 +#define INTS_SIR_ACTIVE_MASK 0x7f + +#define INTC_NIRQS 128 + +#ifdef ARM_INTRNG +struct ti_aintc_irqsrc { + struct intr_irqsrc tai_isrc; + u_int tai_irq; +}; +#endif + struct ti_aintc_softc { device_t sc_dev; struct resource * aintc_res[3]; bus_space_tag_t aintc_bst; bus_space_handle_t aintc_bsh; uint8_t ver; +#ifdef ARM_INTRNG + struct ti_aintc_irqsrc aintc_isrcs[INTC_NIRQS]; +#endif }; static struct resource_spec ti_aintc_spec[] = { @@ -83,6 +105,141 @@ static struct ofw_compat_data compat_dat {NULL, 0}, }; +#ifdef ARM_INTRNG +static inline void +ti_aintc_irq_eoi(struct ti_aintc_softc *sc) +{ + + aintc_write_4(sc, INTC_CONTROL, 1); +} + +static inline void +ti_aintc_irq_mask(struct ti_aintc_softc *sc, u_int irq) +{ + + aintc_write_4(sc, INTC_MIR_SET(irq >> 5), (1UL << (irq & 0x1F))); +} + +static inline void +ti_aintc_irq_unmask(struct ti_aintc_softc *sc, u_int irq) +{ + + aintc_write_4(sc, INTC_MIR_CLEAR(irq >> 5), (1UL << (irq & 0x1F))); +} + +static int +ti_aintc_intr(void *arg) +{ + uint32_t irq; + struct ti_aintc_softc *sc = arg; + + /* Get active interrupt */ + irq = aintc_read_4(sc, INTC_SIR_IRQ); + if ((irq & INTC_SIR_SPURIOUS_MASK) != 0) { + device_printf(sc->sc_dev, + "Spurious interrupt detected (0x%08x)\n", irq); + ti_aintc_irq_eoi(sc); + return (FILTER_HANDLED); + } + + /* Only level-sensitive interrupts detection is supported. */ + irq &= INTS_SIR_ACTIVE_MASK; + if (intr_isrc_dispatch(&sc->aintc_isrcs[irq].tai_isrc, + curthread->td_intr_frame) != 0) { + ti_aintc_irq_mask(sc, irq); + ti_aintc_irq_eoi(sc); + device_printf(sc->sc_dev, "Stray irq %u disabled\n", irq); + } + + arm_irq_memory_barrier(irq); /* XXX */ + return (FILTER_HANDLED); +} + +static void +ti_aintc_enable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + u_int irq = ((struct ti_aintc_irqsrc *)isrc)->tai_irq; + struct ti_aintc_softc *sc = device_get_softc(dev); + + arm_irq_memory_barrier(irq); + ti_aintc_irq_unmask(sc, irq); +} + +static void +ti_aintc_disable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + u_int irq = ((struct ti_aintc_irqsrc *)isrc)->tai_irq; + struct ti_aintc_softc *sc = device_get_softc(dev); + + ti_aintc_irq_mask(sc, irq); +} + +static int +ti_aintc_map_intr(device_t dev, struct intr_map_data *data, + struct intr_irqsrc **isrcp) +{ + struct ti_aintc_softc *sc; + + if (data->type != INTR_MAP_DATA_FDT || data->fdt.ncells != 1 || + data->fdt.cells[0] >= INTC_NIRQS) + return (EINVAL); + + sc = device_get_softc(dev); + *isrcp = &sc->aintc_isrcs[data->fdt.cells[0]].tai_isrc; + return (0); +} + +static void +ti_aintc_pre_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + u_int irq = ((struct ti_aintc_irqsrc *)isrc)->tai_irq; + struct ti_aintc_softc *sc = device_get_softc(dev); + + ti_aintc_irq_mask(sc, irq); + ti_aintc_irq_eoi(sc); +} + +static void +ti_aintc_post_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + + ti_aintc_enable_intr(dev, isrc); +} + +static void +ti_aintc_post_filter(device_t dev, struct intr_irqsrc *isrc) +{ + + ti_aintc_irq_eoi(device_get_softc(dev)); +} + +static int +ti_aintc_pic_attach(struct ti_aintc_softc *sc) +{ + int error; + uint32_t irq; + const char *name; + intptr_t xref; + + name = device_get_nameunit(sc->sc_dev); + for (irq = 0; irq < INTC_NIRQS; irq++) { + sc->aintc_isrcs[irq].tai_irq = irq; + + error = intr_isrc_register(&sc->aintc_isrcs[irq].tai_isrc, + sc->sc_dev, 0, "%s,%u", name, irq); + if (error != 0) + return (error); + } + + xref = OF_xref_from_node(ofw_bus_get_node(sc->sc_dev)); + error = intr_pic_register(sc->sc_dev, xref); + if (error != 0) + return (error); + + return (intr_pic_claim_root(sc->sc_dev, xref, ti_aintc_intr, sc, 0)); +} + +#else static void aintc_post_filter(void *arg) { @@ -90,6 +247,7 @@ aintc_post_filter(void *arg) arm_irq_memory_barrier(0); aintc_write_4(ti_aintc_sc, INTC_CONTROL, 1); /* EOI */ } +#endif static int ti_aintc_probe(device_t dev) @@ -137,14 +295,30 @@ ti_aintc_attach(device_t dev) /*Set Priority Threshold */ aintc_write_4(sc, INTC_THRESHOLD, 0xFF); +#ifndef ARM_INTRNG arm_post_filter = aintc_post_filter; - +#else + if (ti_aintc_pic_attach(sc) != 0) { + device_printf(dev, "could not attach PIC\n"); + return (ENXIO); + } +#endif return (0); } static device_method_t ti_aintc_methods[] = { DEVMETHOD(device_probe, ti_aintc_probe), DEVMETHOD(device_attach, ti_aintc_attach), + +#ifdef ARM_INTRNG + DEVMETHOD(pic_disable_intr, ti_aintc_disable_intr), + DEVMETHOD(pic_enable_intr, ti_aintc_enable_intr), + DEVMETHOD(pic_map_intr, ti_aintc_map_intr), + DEVMETHOD(pic_post_filter, ti_aintc_post_filter), + DEVMETHOD(pic_post_ithread, ti_aintc_post_ithread), + DEVMETHOD(pic_pre_ithread, ti_aintc_pre_ithread), +#endif + { 0, 0 } }; @@ -160,6 +334,7 @@ EARLY_DRIVER_MODULE(aintc, simplebus, ti 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); SIMPLEBUS_PNP_INFO(compat_data); +#ifndef ARM_INTRNG int arm_get_next_irq(int last_irq) { @@ -200,3 +375,4 @@ arm_unmask_irq(uintptr_t nb) arm_irq_memory_barrier(nb); aintc_write_4(sc, INTC_MIR_CLEAR(nb >> 5), (1UL << (nb & 0x1F))); } +#endif From owner-svn-src-all@freebsd.org Mon Apr 4 09:29:32 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E989B02B18; Mon, 4 Apr 2016 09:29:32 +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 mx1.freebsd.org (Postfix) with ESMTPS id 168F81F93; Mon, 4 Apr 2016 09:29:32 +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 u349TVFe099681; Mon, 4 Apr 2016 09:29:31 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u349TVA3099678; Mon, 4 Apr 2016 09:29:31 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201604040929.u349TVA3099678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus Date: Mon, 4 Apr 2016 09:29:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297541 - in head/sys/arm/ti: . omap4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 09:29:32 -0000 Author: skra Date: Mon Apr 4 09:29:30 2016 New Revision: 297541 URL: https://svnweb.freebsd.org/changeset/base/297541 Log: Rework TI gpio interrupt controller for INTRNG. It's used on PANDABOARD and BEAGLEBONE where INTRNG is already enabled by default. Reviewed by: gonzo Differential Revision: https://reviews.freebsd.org/D5806 Modified: head/sys/arm/ti/omap4/omap4_gpio.c head/sys/arm/ti/ti_gpio.c head/sys/arm/ti/ti_gpio.h Modified: head/sys/arm/ti/omap4/omap4_gpio.c ============================================================================== --- head/sys/arm/ti/omap4/omap4_gpio.c Mon Apr 4 09:23:21 2016 (r297540) +++ head/sys/arm/ti/omap4/omap4_gpio.c Mon Apr 4 09:29:30 2016 (r297541) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/arm/ti/ti_gpio.c ============================================================================== --- head/sys/arm/ti/ti_gpio.c Mon Apr 4 09:23:21 2016 (r297540) +++ head/sys/arm/ti/ti_gpio.c Mon Apr 4 09:29:30 2016 (r297541) @@ -33,12 +33,15 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_platform.h" + #include #include #include #include #include +#include #include #include #include @@ -46,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -62,6 +66,9 @@ __FBSDID("$FreeBSD$"); #include "gpio_if.h" #include "ti_gpio_if.h" +#ifdef ARM_INTRNG +#include "pic_if.h" +#endif #if !defined(SOC_OMAP4) && !defined(SOC_TI_AM335X) #error "Unknown SoC" @@ -72,12 +79,12 @@ __FBSDID("$FreeBSD$"); #define TI_GPIO_SYSCONFIG 0x0010 #define TI_GPIO_IRQSTATUS_RAW_0 0x0024 #define TI_GPIO_IRQSTATUS_RAW_1 0x0028 -#define TI_GPIO_IRQSTATUS_0 0x002C -#define TI_GPIO_IRQSTATUS_1 0x0030 -#define TI_GPIO_IRQSTATUS_SET_0 0x0034 -#define TI_GPIO_IRQSTATUS_SET_1 0x0038 -#define TI_GPIO_IRQSTATUS_CLR_0 0x003C -#define TI_GPIO_IRQSTATUS_CLR_1 0x0040 +#define TI_GPIO_IRQSTATUS_0 0x002C /* writing a 0 has no effect */ +#define TI_GPIO_IRQSTATUS_1 0x0030 /* writing a 0 has no effect */ +#define TI_GPIO_IRQSTATUS_SET_0 0x0034 /* writing a 0 has no effect */ +#define TI_GPIO_IRQSTATUS_SET_1 0x0038 /* writing a 0 has no effect */ +#define TI_GPIO_IRQSTATUS_CLR_0 0x003C /* writing a 0 has no effect */ +#define TI_GPIO_IRQSTATUS_CLR_1 0x0040 /* writing a 0 has no effect */ #define TI_GPIO_IRQWAKEN_0 0x0044 #define TI_GPIO_IRQWAKEN_1 0x0048 #define TI_GPIO_SYSSTATUS 0x0114 @@ -90,10 +97,10 @@ __FBSDID("$FreeBSD$"); #define TI_GPIO_OE 0x0134 #define TI_GPIO_DATAIN 0x0138 #define TI_GPIO_DATAOUT 0x013C -#define TI_GPIO_LEVELDETECT0 0x0140 -#define TI_GPIO_LEVELDETECT1 0x0144 -#define TI_GPIO_RISINGDETECT 0x0148 -#define TI_GPIO_FALLINGDETECT 0x014C +#define TI_GPIO_LEVELDETECT0 0x0140 /* RW register */ +#define TI_GPIO_LEVELDETECT1 0x0144 /* RW register */ +#define TI_GPIO_RISINGDETECT 0x0148 /* RW register */ +#define TI_GPIO_FALLINGDETECT 0x014C /* RW register */ #define TI_GPIO_DEBOUNCENABLE 0x0150 #define TI_GPIO_DEBOUNCINGTIME 0x0154 #define TI_GPIO_CLEARWKUPENA 0x0180 @@ -111,8 +118,14 @@ __FBSDID("$FreeBSD$"); #define PINS_PER_BANK 32 #define TI_GPIO_MASK(p) (1U << ((p) % PINS_PER_BANK)) +static int ti_gpio_intr(void *arg); static int ti_gpio_detach(device_t); +#ifdef ARM_INTRNG +static int ti_gpio_pic_attach(struct ti_gpio_softc *sc); +static int ti_gpio_pic_detach(struct ti_gpio_softc *sc); +#endif + static u_int ti_first_gpio_bank(void) { @@ -533,6 +546,7 @@ ti_gpio_pin_toggle(device_t dev, uint32_ return (0); } +#ifndef ARM_INTRNG /** * ti_gpio_intr - ISR for all GPIO modules * @arg: the soft context pointer @@ -567,6 +581,7 @@ ti_gpio_intr(void *arg) return (FILTER_HANDLED); } +#endif static int ti_gpio_bank_init(device_t dev) @@ -640,7 +655,9 @@ static int ti_gpio_attach(device_t dev) { struct ti_gpio_softc *sc; +#ifndef ARM_INTRNG unsigned int i; +#endif int err; sc = device_get_softc(dev); @@ -679,6 +696,13 @@ ti_gpio_attach(device_t dev) return (ENXIO); } +#ifdef ARM_INTRNG + if (ti_gpio_pic_attach(sc) != 0) { + device_printf(dev, "WARNING: unable to attach PIC\n"); + ti_gpio_detach(dev); + return (ENXIO); + } +#else /* * Initialize the interrupt settings. The default is active-low * interrupts. @@ -699,7 +723,7 @@ ti_gpio_attach(device_t dev) sc->sc_mask_args = malloc(sizeof(struct ti_gpio_mask_arg) * sc->sc_maxpin, M_DEVBUF, M_WAITOK | M_ZERO); - +#endif /* We need to go through each block and ensure the clocks are running and * the module is enabled. It might be better to do this only when the * pins are configured which would result in less power used if the GPIO @@ -747,6 +771,10 @@ ti_gpio_detach(device_t dev) if (sc->sc_mem_res != NULL) ti_gpio_intr_clr(sc, 0xffffffff); gpiobus_detach_bus(dev); +#ifdef ARM_INTRNG + if (sc->sc_isrcs != NULL) + ti_gpio_pic_detach(sc); +#else if (sc->sc_events) free(sc->sc_events, M_DEVBUF); if (sc->sc_mask_args) @@ -755,6 +783,7 @@ ti_gpio_detach(device_t dev) free(sc->sc_irq_polarity, M_DEVBUF); if (sc->sc_irq_trigger) free(sc->sc_irq_trigger, M_DEVBUF); +#endif /* Release the memory and IRQ resources. */ if (sc->sc_irq_hdl) { bus_teardown_intr(dev, sc->sc_irq_res, @@ -769,6 +798,282 @@ ti_gpio_detach(device_t dev) return (0); } +#ifdef ARM_INTRNG +static inline void +ti_gpio_rwreg_set(struct ti_gpio_softc *sc, uint32_t reg, uint32_t mask) +{ + + ti_gpio_write_4(sc, reg, ti_gpio_read_4(sc, reg) | mask); +} + +static inline void +ti_gpio_rwreg_clr(struct ti_gpio_softc *sc, uint32_t reg, uint32_t mask) +{ + + ti_gpio_write_4(sc, reg, ti_gpio_read_4(sc, reg) & ~mask); +} + +static inline void +ti_gpio_isrc_mask(struct ti_gpio_softc *sc, struct ti_gpio_irqsrc *tgi) +{ + + /* Writing a 0 has no effect. */ + ti_gpio_intr_clr(sc, tgi->tgi_mask); +} + +static inline void +ti_gpio_isrc_unmask(struct ti_gpio_softc *sc, struct ti_gpio_irqsrc *tgi) +{ + + /* Writing a 0 has no effect. */ + ti_gpio_intr_set(sc, tgi->tgi_mask); +} + +static inline void +ti_gpio_isrc_eoi(struct ti_gpio_softc *sc, struct ti_gpio_irqsrc *tgi) +{ + + /* Writing a 0 has no effect. */ + ti_gpio_intr_ack(sc, tgi->tgi_mask); +} + +static inline bool +ti_gpio_isrc_is_level(struct ti_gpio_irqsrc *tgi) +{ + + return (tgi->tgi_cfgreg == TI_GPIO_LEVELDETECT0 || + tgi->tgi_cfgreg == TI_GPIO_LEVELDETECT1); +} + +static int +ti_gpio_intr(void *arg) +{ + u_int irq; + uint32_t reg; + struct ti_gpio_softc *sc; + struct trapframe *tf; + struct ti_gpio_irqsrc *tgi; + + sc = (struct ti_gpio_softc *)arg; + tf = curthread->td_intr_frame; + + reg = ti_gpio_intr_status(sc); + for (irq = 0; irq < sc->sc_maxpin; irq++) { + tgi = &sc->sc_isrcs[irq]; + if ((reg & tgi->tgi_mask) == 0) + continue; + if (!ti_gpio_isrc_is_level(tgi)) + ti_gpio_isrc_eoi(sc, tgi); + if (intr_isrc_dispatch(&tgi->tgi_isrc, tf) != 0) { + ti_gpio_isrc_mask(sc, tgi); + if (ti_gpio_isrc_is_level(tgi)) + ti_gpio_isrc_eoi(sc, tgi); + device_printf(sc->sc_dev, "Stray irq %u disabled\n", + irq); + } + } + return (FILTER_HANDLED); +} + +static int +ti_gpio_pic_attach(struct ti_gpio_softc *sc) +{ + int error; + uint32_t irq; + const char *name; + + sc->sc_isrcs = malloc(sizeof(*sc->sc_isrcs) * sc->sc_maxpin, M_DEVBUF, + M_WAITOK | M_ZERO); + + name = device_get_nameunit(sc->sc_dev); + for (irq = 0; irq < sc->sc_maxpin; irq++) { + sc->sc_isrcs[irq].tgi_irq = irq; + sc->sc_isrcs[irq].tgi_mask = TI_GPIO_MASK(irq); + sc->sc_isrcs[irq].tgi_cfgreg = 0; + + error = intr_isrc_register(&sc->sc_isrcs[irq].tgi_isrc, + sc->sc_dev, 0, "%s,%u", name, irq); + if (error != 0) + return (error); /* XXX deregister ISRCs */ + } + return (intr_pic_register(sc->sc_dev, + OF_xref_from_node(ofw_bus_get_node(sc->sc_dev)))); +} + +static int +ti_gpio_pic_detach(struct ti_gpio_softc *sc) +{ + + /* + * There has not been established any procedure yet + * how to detach PIC from living system correctly. + */ + device_printf(sc->sc_dev, "%s: not implemented yet\n", __func__); + return (EBUSY); +} + +static void +ti_gpio_pic_disable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct ti_gpio_softc *sc = device_get_softc(dev); + struct ti_gpio_irqsrc *tgi = (struct ti_gpio_irqsrc *)isrc; + + ti_gpio_isrc_mask(sc, tgi); +} + +static void +ti_gpio_pic_enable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct ti_gpio_softc *sc = device_get_softc(dev); + struct ti_gpio_irqsrc *tgi = (struct ti_gpio_irqsrc *)isrc; + + arm_irq_memory_barrier(tgi->tgi_irq); + ti_gpio_isrc_unmask(sc, tgi); +} + +static int +ti_gpio_pic_map_fdt(struct ti_gpio_softc *sc, u_int ncells, pcell_t *cells, + u_int *irqp, uint32_t *regp) +{ + uint32_t reg; + + /* + * The first cell is the interrupt number. + * The second cell is used to specify flags: + * bits[3:0] trigger type and level flags: + * 1 = low-to-high edge triggered. + * 2 = high-to-low edge triggered. + * 4 = active high level-sensitive. + * 8 = active low level-sensitive. + */ + if (ncells != 2 || cells[0] >= sc->sc_maxpin) + return (EINVAL); + + /* + * All interrupt types could be set for an interrupt at one moment. + * At least, the combination of 'low-to-high' and 'high-to-low' edge + * triggered interrupt types can make a sense. However, no combo is + * supported now. + */ + if (cells[1] == 1) + reg = TI_GPIO_RISINGDETECT; + else if (cells[1] == 2) + reg = TI_GPIO_FALLINGDETECT; + else if (cells[1] == 4) + reg = TI_GPIO_LEVELDETECT1; + else if (cells[1] == 8) + reg = TI_GPIO_LEVELDETECT0; + else + return (EINVAL); + + *irqp = cells[0]; + if (regp != NULL) + *regp = reg; + return (0); +} + +static int +ti_gpio_pic_map_intr(device_t dev, struct intr_map_data *data, + struct intr_irqsrc **isrcp) +{ + int error; + u_int irq; + struct ti_gpio_softc *sc; + + if (data->type != INTR_MAP_DATA_FDT) + return (ENOTSUP); + + sc = device_get_softc(dev); + error = ti_gpio_pic_map_fdt(sc, data->fdt.ncells, data->fdt.cells, &irq, + NULL); + if (error == 0) + *isrcp = &sc->sc_isrcs[irq].tgi_isrc; + return (error); +} + +static void +ti_gpio_pic_post_filter(device_t dev, struct intr_irqsrc *isrc) +{ + struct ti_gpio_softc *sc = device_get_softc(dev); + struct ti_gpio_irqsrc *tgi = (struct ti_gpio_irqsrc *)isrc; + + if (ti_gpio_isrc_is_level(tgi)) + ti_gpio_isrc_eoi(sc, tgi); +} + +static void +ti_gpio_pic_post_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + + ti_gpio_pic_enable_intr(dev, isrc); +} + +static void +ti_gpio_pic_pre_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + struct ti_gpio_softc *sc = device_get_softc(dev); + struct ti_gpio_irqsrc *tgi = (struct ti_gpio_irqsrc *)isrc; + + ti_gpio_isrc_mask(sc, tgi); + if (ti_gpio_isrc_is_level(tgi)) + ti_gpio_isrc_eoi(sc, tgi); +} + +static int +ti_gpio_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ + u_int irq; + uint32_t cfgreg; + struct ti_gpio_softc *sc; + struct ti_gpio_irqsrc *tgi; + + if (data == NULL || data->type != INTR_MAP_DATA_FDT) + return (ENOTSUP); + + sc = device_get_softc(dev); + tgi = (struct ti_gpio_irqsrc *)isrc; + + /* Get and check config for an interrupt. */ + if (ti_gpio_pic_map_fdt(sc, data->fdt.ncells, data->fdt.cells, &irq, + &cfgreg) != 0 || tgi->tgi_irq != irq) + return (EINVAL); + + /* + * If this is a setup for another handler, + * only check that its configuration match. + */ + if (isrc->isrc_handlers != 0) + return (tgi->tgi_cfgreg == cfgreg ? 0 : EINVAL); + + TI_GPIO_LOCK(sc); + ti_gpio_rwreg_clr(sc, TI_GPIO_RISINGDETECT, tgi->tgi_mask); + ti_gpio_rwreg_clr(sc, TI_GPIO_FALLINGDETECT, tgi->tgi_mask); + ti_gpio_rwreg_clr(sc, TI_GPIO_LEVELDETECT1, tgi->tgi_mask); + ti_gpio_rwreg_clr(sc, TI_GPIO_LEVELDETECT0, tgi->tgi_mask); + tgi->tgi_cfgreg = cfgreg; + ti_gpio_rwreg_set(sc, cfgreg, tgi->tgi_mask); + TI_GPIO_UNLOCK(sc); + return (0); +} + +static int +ti_gpio_pic_teardown_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ + struct ti_gpio_softc *sc = device_get_softc(dev); + struct ti_gpio_irqsrc *tgi = (struct ti_gpio_irqsrc *)isrc; + + if (isrc->isrc_handlers == 0) { + TI_GPIO_LOCK(sc); + ti_gpio_rwreg_clr(sc, tgi->tgi_cfgreg, tgi->tgi_mask); + tgi->tgi_cfgreg = 0; + TI_GPIO_UNLOCK(sc); + } + return (0); +} + +#else static uint32_t ti_gpio_intr_reg(struct ti_gpio_softc *sc, int irq) { @@ -970,6 +1275,7 @@ ti_gpio_teardown_intr(device_t dev, devi return (err); } +#endif static phandle_t ti_gpio_get_node(device_t bus, device_t dev) @@ -994,12 +1300,24 @@ static device_method_t ti_gpio_methods[] DEVMETHOD(gpio_pin_set, ti_gpio_pin_set), DEVMETHOD(gpio_pin_toggle, ti_gpio_pin_toggle), +#ifdef ARM_INTRNG + /* Interrupt controller interface */ + DEVMETHOD(pic_disable_intr, ti_gpio_pic_disable_intr), + DEVMETHOD(pic_enable_intr, ti_gpio_pic_enable_intr), + DEVMETHOD(pic_map_intr, ti_gpio_pic_map_intr), + DEVMETHOD(pic_setup_intr, ti_gpio_pic_setup_intr), + DEVMETHOD(pic_teardown_intr, ti_gpio_pic_teardown_intr), + DEVMETHOD(pic_post_filter, ti_gpio_pic_post_filter), + DEVMETHOD(pic_post_ithread, ti_gpio_pic_post_ithread), + DEVMETHOD(pic_pre_ithread, ti_gpio_pic_pre_ithread), +#else /* Bus interface */ DEVMETHOD(bus_activate_resource, ti_gpio_activate_resource), DEVMETHOD(bus_deactivate_resource, ti_gpio_deactivate_resource), DEVMETHOD(bus_config_intr, ti_gpio_config_intr), DEVMETHOD(bus_setup_intr, ti_gpio_setup_intr), DEVMETHOD(bus_teardown_intr, ti_gpio_teardown_intr), +#endif /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, ti_gpio_get_node), Modified: head/sys/arm/ti/ti_gpio.h ============================================================================== --- head/sys/arm/ti/ti_gpio.h Mon Apr 4 09:23:21 2016 (r297540) +++ head/sys/arm/ti/ti_gpio.h Mon Apr 4 09:29:30 2016 (r297541) @@ -39,10 +39,19 @@ */ #define MAX_GPIO_INTRS 8 +#ifndef ARM_INTRNG struct ti_gpio_mask_arg { void *softc; int pin; }; +#else +struct ti_gpio_irqsrc { + struct intr_irqsrc tgi_isrc; + u_int tgi_irq; + uint32_t tgi_mask; + uint32_t tgi_cfgreg; +}; +#endif /** * Structure that stores the driver context. @@ -52,11 +61,11 @@ struct ti_gpio_mask_arg { struct ti_gpio_softc { device_t sc_dev; device_t sc_busdev; - +#ifndef ARM_INTRNG /* Interrupt trigger type and level. */ enum intr_trigger *sc_irq_trigger; enum intr_polarity *sc_irq_polarity; - +#endif int sc_bank; int sc_maxpin; struct mtx sc_mtx; @@ -65,11 +74,13 @@ struct ti_gpio_softc { struct resource *sc_mem_res; int sc_irq_rid; struct resource *sc_irq_res; - +#ifndef ARM_INTRNG /* Interrupt events. */ struct intr_event **sc_events; struct ti_gpio_mask_arg *sc_mask_args; - +#else + struct ti_gpio_irqsrc *sc_isrcs; +#endif /* The handle for the register IRQ handlers. */ void *sc_irq_hdl; }; From owner-svn-src-all@freebsd.org Mon Apr 4 09:30:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8EABFB02CA0; Mon, 4 Apr 2016 09:30:59 +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 mx1.freebsd.org (Postfix) with ESMTPS id 5A8B61189; Mon, 4 Apr 2016 09:30:59 +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 u349Uwmn001860; Mon, 4 Apr 2016 09:30:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u349Uv32001852; Mon, 4 Apr 2016 09:30:57 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604040930.u349Uv32001852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 4 Apr 2016 09:30:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297542 - in stable/10: cddl/contrib/opensolaris/head sys/cddl/contrib/opensolaris/uts/common/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 09:30:59 -0000 Author: mav Date: Mon Apr 4 09:30:57 2016 New Revision: 297542 URL: https://svnweb.freebsd.org/changeset/base/297542 Log: MFC r270382 (by delphij): MFV r270197: Illumos issue: 5066 remove support for non-ANSI compilation 5068 Remove SCCSID() macro from Modified: stable/10/cddl/contrib/opensolaris/head/libintl.h stable/10/cddl/contrib/opensolaris/head/nlist.h stable/10/cddl/contrib/opensolaris/head/synch.h stable/10/cddl/contrib/opensolaris/head/thread.h stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/feature_tests.h stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/processor.h Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/head/libintl.h ============================================================================== --- stable/10/cddl/contrib/opensolaris/head/libintl.h Mon Apr 4 09:29:30 2016 (r297541) +++ stable/10/cddl/contrib/opensolaris/head/libintl.h Mon Apr 4 09:30:57 2016 (r297542) @@ -19,6 +19,8 @@ * CDDL HEADER END */ /* + * Copyright 2014 Garrett D'Amore + * * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -27,8 +29,6 @@ #ifndef _LIBINTL_H #define _LIBINTL_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include #ifdef __cplusplus @@ -64,7 +64,6 @@ typedef long wchar_t; #define __GNU_GETTEXT_SUPPORTED_REVISION(m) \ ((((m) == 0) || ((m) == 1)) ? 1 : -1) -#ifdef __STDC__ extern char *dcgettext(const char *, const char *, const int); extern char *dgettext(const char *, const char *); extern char *gettext(const char *); @@ -91,33 +90,6 @@ extern wchar_t *wddelim(wchar_t, wchar_t extern wchar_t mcfiller(void); extern int mcwrap(void); -#else -extern char *dcgettext(); -extern char *dgettext(); -extern char *gettext(); -extern char *textdomain(); -extern char *bindtextdomain(); - -/* - * LI18NUX 2000 Globalization Specification Version 1.0 - * with Amendment 2 - */ -extern char *dcngettext(); -extern char *dngettext(); -extern char *ngettext(); -extern char *bind_textdomain_codeset(); - -/* Word handling functions --- requires dynamic linking */ -/* Warning: these are experimental and subject to change. */ -extern int wdinit(); -extern int wdchkind(); -extern int wdbindf(); -extern wchar_t *wddelim(); -extern wchar_t mcfiller(); -extern int mcwrap(); - -#endif - #ifdef __cplusplus } #endif Modified: stable/10/cddl/contrib/opensolaris/head/nlist.h ============================================================================== --- stable/10/cddl/contrib/opensolaris/head/nlist.h Mon Apr 4 09:29:30 2016 (r297541) +++ stable/10/cddl/contrib/opensolaris/head/nlist.h Mon Apr 4 09:30:57 2016 (r297542) @@ -19,6 +19,9 @@ * * CDDL HEADER END */ +/* + * Copyright 2014 Garrett D'Amore + */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ @@ -26,8 +29,6 @@ #ifndef _NLIST_H #define _NLIST_H -#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8.2.4 */ - #ifdef __cplusplus extern "C" { #endif @@ -41,11 +42,7 @@ struct nlist { char n_numaux; /* number of aux. entries */ }; -#if defined(__STDC__) extern int nlist(const char *, struct nlist *); -#else /* __STDC__ */ -extern int nlist(); -#endif /* __STDC__ */ #ifdef __cplusplus } Modified: stable/10/cddl/contrib/opensolaris/head/synch.h ============================================================================== --- stable/10/cddl/contrib/opensolaris/head/synch.h Mon Apr 4 09:29:30 2016 (r297541) +++ stable/10/cddl/contrib/opensolaris/head/synch.h Mon Apr 4 09:30:57 2016 (r297542) @@ -20,6 +20,7 @@ */ /* + * Copyright 2014 Garrett D'Amore * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved. */ @@ -86,7 +87,6 @@ typedef struct _rwlock { cond_t writercv; /* used only to indicate ownership */ } rwlock_t; -#ifdef __STDC__ int _lwp_mutex_lock(lwp_mutex_t *); int _lwp_mutex_unlock(lwp_mutex_t *); int _lwp_mutex_trylock(lwp_mutex_t *); @@ -127,50 +127,6 @@ int sema_reltimedwait(sema_t *, const ti int sema_post(sema_t *); int sema_trywait(sema_t *); -#else /* __STDC__ */ - -int _lwp_mutex_lock(); -int _lwp_mutex_unlock(); -int _lwp_mutex_trylock(); -int _lwp_cond_wait(); -int _lwp_cond_timedwait(); -int _lwp_cond_reltimedwait(); -int _lwp_cond_signal(); -int _lwp_cond_broadcast(); -int _lwp_sema_init(); -int _lwp_sema_wait(); -int _lwp_sema_trywait(); -int _lwp_sema_post(); -int cond_init(); -int cond_destroy(); -int cond_wait(); -int cond_timedwait(); -int cond_reltimedwait(); -int cond_signal(); -int cond_broadcast(); -int mutex_init(); -int mutex_destroy(); -int mutex_consistent(); -int mutex_lock(); -int mutex_trylock(); -int mutex_unlock(); -int rwlock_init(); -int rwlock_destroy(); -int rw_rdlock(); -int rw_wrlock(); -int rw_unlock(); -int rw_tryrdlock(); -int rw_trywrlock(); -int sema_init(); -int sema_destroy(); -int sema_wait(); -int sema_timedwait(); -int sema_reltimedwait(); -int sema_post(); -int sema_trywait(); - -#endif /* __STDC__ */ - #endif /* _ASM */ /* "Magic numbers" tagging synchronization object types */ @@ -238,8 +194,6 @@ int sema_trywait(); #ifndef _ASM -#ifdef __STDC__ - /* * The *_held() functions apply equally well to Solaris threads * and to Posix threads synchronization objects, but the formal @@ -252,21 +206,8 @@ int _rw_read_held(void *); /* rwlock_t int _rw_write_held(void *); /* rwlock_t or pthread_rwlock_t */ int _mutex_held(void *); /* mutex_t or pthread_mutex_t */ -#else /* __STDC__ */ - -int _sema_held(); -int _rw_read_held(); -int _rw_write_held(); -int _mutex_held(); - -#endif /* __STDC__ */ - /* Pause API */ -#ifdef __STDC__ void smt_pause(void); -#else /* __STDC__ */ -void smt_pause(); -#endif /* __STDC__ */ #endif /* _ASM */ Modified: stable/10/cddl/contrib/opensolaris/head/thread.h ============================================================================== --- stable/10/cddl/contrib/opensolaris/head/thread.h Mon Apr 4 09:29:30 2016 (r297541) +++ stable/10/cddl/contrib/opensolaris/head/thread.h Mon Apr 4 09:30:57 2016 (r297542) @@ -20,6 +20,8 @@ */ /* + * Copyright 2014 Garrett D'Amore + * * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -27,8 +29,6 @@ #ifndef _THREAD_H #define _THREAD_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h Mon Apr 4 09:29:30 2016 (r297541) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h Mon Apr 4 09:30:57 2016 (r297542) @@ -19,6 +19,8 @@ * CDDL HEADER END */ /* + * Copyright 2014 Garrett D'Amore + * * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -300,13 +302,8 @@ extern int cmp2acls(void *, void *); #endif /* !defined(_KERNEL) */ -#if defined(__STDC__) extern int acl(const char *path, int cmd, int cnt, void *buf); extern int facl(int fd, int cmd, int cnt, void *buf); -#else /* !__STDC__ */ -extern int acl(); -extern int facl(); -#endif /* defined(__STDC__) */ #ifdef __cplusplus } Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h Mon Apr 4 09:29:30 2016 (r297541) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h Mon Apr 4 09:30:57 2016 (r297542) @@ -19,6 +19,8 @@ * CDDL HEADER END */ /* + * Copyright 2014 Garrett D'Amore + * * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -48,7 +50,6 @@ extern "C" { * ASSERT and is evaluated on both debug and non-debug kernels. */ -#if defined(__STDC__) extern int assfail(const char *, const char *, int); #define VERIFY(EX) ((void)((EX) || assfail(#EX, __FILE__, __LINE__))) #ifdef DEBUG @@ -56,15 +57,6 @@ extern int assfail(const char *, const c #else #define ASSERT(x) ((void)0) #endif -#else /* defined(__STDC__) */ -extern int assfail(); -#define VERIFY(EX) ((void)((EX) || assfail("EX", __FILE__, __LINE__))) -#ifdef DEBUG -#define ASSERT(EX) ((void)((EX) || assfail("EX", __FILE__, __LINE__))) -#else -#define ASSERT(x) ((void)0) -#endif -#endif /* defined(__STDC__) */ /* * Assertion variants sensitive to the compilation data model Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/feature_tests.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/feature_tests.h Mon Apr 4 09:29:30 2016 (r297541) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/feature_tests.h Mon Apr 4 09:30:57 2016 (r297542) @@ -20,6 +20,8 @@ */ /* + * Copyright 2013 Garrett D'Amore + * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -42,15 +44,16 @@ extern "C" { * 199309L POSIX.1b-1993 compilation (Real Time) * 199506L POSIX.1c-1995 compilation (POSIX Threads) * 200112L POSIX.1-2001 compilation (Austin Group Revision) + * 200809L POSIX.1-2008 compilation */ #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) #define _POSIX_C_SOURCE 1 #endif /* - * The feature test macros __XOPEN_OR_POSIX, _STRICT_STDC, and _STDC_C99 - * are Sun implementation specific macros created in order to compress - * common standards specified feature test macros for easier reading. + * The feature test macros __XOPEN_OR_POSIX, _STRICT_STDC, _STRICT_SYMBOLS, + * and _STDC_C99 are Sun implementation specific macros created in order to + * compress common standards specified feature test macros for easier reading. * These macros should not be used by the application developer as * unexpected results may occur. Instead, the user should reference * standards(5) for correct usage of the standards feature test macros. @@ -76,6 +79,10 @@ extern "C" { * the C standard. A value of 199901L indicates a * compiler that complies with ISO/IEC 9899:1999, other- * wise known as the C99 standard. + * + * _STRICT_SYMBOLS Used in cases where symbol visibility is restricted + * by the standards, and the user has not explicitly + * relaxed the strictness via __EXTENSIONS__. */ #if defined(_XOPEN_SOURCE) || defined(_POSIX_C_SOURCE) @@ -145,6 +152,14 @@ extern "C" { #endif /* + * Use strict symbol visibility. + */ +#if (defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX)) && \ + !defined(__EXTENSIONS__) +#define _STRICT_SYMBOLS +#endif + +/* * Large file interfaces: * * _LARGEFILE_SOURCE @@ -223,6 +238,8 @@ extern "C" { * X/Open CAE Specification, Issue 5 (XPG5) * Open Group Technical Standard, Issue 6 (XPG6), also referred to as * IEEE Std. 1003.1-2001 and ISO/IEC 9945:2002. + * Open Group Technical Standard, Issue 7 (XPG7), also referred to as + * IEEE Std. 1003.1-2008 and ISO/IEC 9945:2009. * * XPG4v2 is also referred to as UNIX 95 (SUS or SUSv1). * XPG5 is also referred to as UNIX 98 or the Single Unix Specification, @@ -230,6 +247,7 @@ extern "C" { * XPG6 is the result of a merge of the X/Open and POSIX specifications * and as such is also referred to as IEEE Std. 1003.1-2001 in * addition to UNIX 03 and SUSv3. + * XPG7 is also referred to as UNIX 08 and SUSv4. * * When writing a conforming X/Open application, as per the specification * requirements, the appropriate feature test macros must be defined at @@ -242,6 +260,7 @@ extern "C" { * _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED = 1 XPG4v2 * _XOPEN_SOURCE = 500 XPG5 * _XOPEN_SOURCE = 600 (or POSIX_C_SOURCE=200112L) XPG6 + * _XOPEN_SOURCE = 700 (or POSIX_C_SOURCE=200809L) XPG7 * * In order to simplify the guards within the headers, the following * implementation private test macros have been created. Applications @@ -261,6 +280,7 @@ extern "C" { * _XPG4_2 X/Open CAE Specification, Issue 4, Version 2 (XPG4v2/UNIX 95/SUS) * _XPG5 X/Open CAE Specification, Issue 5 (XPG5/UNIX 98/SUSv2) * _XPG6 Open Group Technical Standard, Issue 6 (XPG6/UNIX 03/SUSv3) + * _XPG7 Open Group Technical Standard, Issue 7 (XPG7/UNIX 08/SUSv4) */ /* X/Open Portability Guide, Issue 3 */ @@ -295,6 +315,19 @@ extern "C" { #define _POSIX_C_SOURCE 200112L #undef _XOPEN_SOURCE #define _XOPEN_SOURCE 600 + +/* Open Group Technical Standard, Issue 7 */ +#elif (_XOPEN_SOURCE - 0 == 700) || (_POSIX_C_SOURCE - 0 == 200809L) +#define _XPG7 +#define _XPG6 +#define _XPG5 +#define _XPG4_2 +#define _XPG4 +#define _XPG3 +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200809L +#undef _XOPEN_SOURCE +#define _XOPEN_SOURCE 700 #endif /* @@ -305,12 +338,15 @@ extern "C" { * with the value of 4 indicates an XPG4 or XPG4v2 (UNIX 95) application. * _XOPEN_VERSION defined with a value of 500 indicates an XPG5 (UNIX 98) * application and with a value of 600 indicates an XPG6 (UNIX 03) - * application. The appropriate version is determined by the use of the + * application and with a value of 700 indicates an XPG7 (UNIX 08). + * The appropriate version is determined by the use of the * feature test macros described earlier. The value of _XOPEN_VERSION * defaults to 3 otherwise indicating support for XPG3 applications. */ #ifndef _XOPEN_VERSION -#ifdef _XPG6 +#if defined(_XPG7) +#define _XOPEN_VERSION 700 +#elif defined(_XPG6) #define _XOPEN_VERSION 600 #elif defined(_XPG5) #define _XOPEN_VERSION 500 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/processor.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/processor.h Mon Apr 4 09:29:30 2016 (r297541) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/processor.h Mon Apr 4 09:30:57 2016 (r297542) @@ -25,6 +25,8 @@ */ /* + * Copyright 2014 Garrett D'Amore + * * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -112,7 +114,6 @@ typedef struct { * User-level system call interface prototypes */ #ifndef _KERNEL -#ifdef __STDC__ extern int p_online(processorid_t processorid, int flag); extern int processor_info(processorid_t processorid, @@ -122,16 +123,6 @@ extern int processor_bind(idtype_t idtyp extern processorid_t getcpuid(void); extern lgrpid_t gethomelgroup(void); -#else - -extern int p_online(); -extern int processor_info(); -extern int processor_bind(); -extern processorid_t getcpuid(); -extern lgrpid_t gethomelgroup(); - -#endif /* __STDC__ */ - #else /* _KERNEL */ /* From owner-svn-src-all@freebsd.org Mon Apr 4 09:35:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FC35B02E70; Mon, 4 Apr 2016 09:35:38 +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 mx1.freebsd.org (Postfix) with ESMTPS id E58EB15F8; Mon, 4 Apr 2016 09:35:37 +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 u349ZbB6002736; Mon, 4 Apr 2016 09:35:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u349Zb5b002735; Mon, 4 Apr 2016 09:35:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604040935.u349Zb5b002735@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 4 Apr 2016 09:35:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297543 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 09:35:38 -0000 Author: mav Date: Mon Apr 4 09:35:36 2016 New Revision: 297543 URL: https://svnweb.freebsd.org/changeset/base/297543 Log: MFC r277450 (by will): Use the "zfs_gfs" tag for GFS vnodes to make them easier to identify. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Mon Apr 4 09:30:57 2016 (r297542) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Mon Apr 4 09:35:36 2016 (r297543) @@ -489,7 +489,7 @@ gfs_file_create(size_t size, vnode_t *pv * Allocate vnode and internal data structure */ fp = kmem_zalloc(size, KM_SLEEP); - error = getnewvnode("zfs", vfsp, ops, &vp); + error = getnewvnode("zfs_gfs", vfsp, ops, &vp); ASSERT(error == 0); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); vp->v_data = (caddr_t)fp; From owner-svn-src-all@freebsd.org Mon Apr 4 09:36:57 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAA9DB02FA8; Mon, 4 Apr 2016 09:36:57 +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 mx1.freebsd.org (Postfix) with ESMTPS id BB9B5180E; Mon, 4 Apr 2016 09:36:57 +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 u349auPP002840; Mon, 4 Apr 2016 09:36:56 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u349auLA002839; Mon, 4 Apr 2016 09:36:56 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604040936.u349auLA002839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 4 Apr 2016 09:36:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297544 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 09:36:58 -0000 Author: mav Date: Mon Apr 4 09:36:56 2016 New Revision: 297544 URL: https://svnweb.freebsd.org/changeset/base/297544 Log: MFC r277504 (by will): Remove commented log messages. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Mon Apr 4 09:35:36 2016 (r297543) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Mon Apr 4 09:36:56 2016 (r297544) @@ -2093,7 +2093,6 @@ zil_replay(objset_t *os, void *arg, zil_ zil_destroy(zilog, B_TRUE); return; } - //printf("ZFS: Replaying ZIL on %s...\n", os->os->os_spa->spa_name); zr.zr_replay = replay_func; zr.zr_arg = arg; @@ -2115,7 +2114,6 @@ zil_replay(objset_t *os, void *arg, zil_ zil_destroy(zilog, B_FALSE); txg_wait_synced(zilog->zl_dmu_pool, zilog->zl_destroy_txg); zilog->zl_replay = B_FALSE; - //printf("ZFS: Replay of ZIL on %s finished.\n", os->os->os_spa->spa_name); } boolean_t From owner-svn-src-all@freebsd.org Mon Apr 4 09:41:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0908B011A1; Mon, 4 Apr 2016 09:41:23 +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 mx1.freebsd.org (Postfix) with ESMTPS id 55FD51B11; Mon, 4 Apr 2016 09:41:23 +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 u349fMNt005172; Mon, 4 Apr 2016 09:41:22 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u349fMJa005170; Mon, 4 Apr 2016 09:41:22 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201604040941.u349fMJa005170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus Date: Mon, 4 Apr 2016 09:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297545 - in head/sys: arm/broadcom/bcm2835 boot/fdt/dts/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 09:41:23 -0000 Author: skra Date: Mon Apr 4 09:41:22 2016 New Revision: 297545 URL: https://svnweb.freebsd.org/changeset/base/297545 Log: Define local-intc for BCM2836 platform (RPI2) and make BCM2835 intc a child of it. This is done in conformity with Linux dts files and as preparation for rework of BCM2836 interrupt controller for INTRNG. Reviewed by: gonzo Differential Revision: https://reviews.freebsd.org/D5807 Modified: head/sys/arm/broadcom/bcm2835/bcm2835_common.c head/sys/boot/fdt/dts/arm/bcm2836.dtsi Modified: head/sys/arm/broadcom/bcm2835/bcm2835_common.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_common.c Mon Apr 4 09:36:56 2016 (r297544) +++ head/sys/arm/broadcom/bcm2835/bcm2835_common.c Mon Apr 4 09:41:22 2016 (r297545) @@ -56,14 +56,21 @@ fdt_intc_decode_ic(phandle_t node, pcell int *pol) { - if (!fdt_is_compatible(node, "broadcom,bcm2835-armctrl-ic")) - return (ENXIO); - - *interrupt = fdt32_to_cpu(intr[0]); - *trig = INTR_TRIGGER_CONFORM; - *pol = INTR_POLARITY_CONFORM; - - return (0); + if (fdt_is_compatible(node, "broadcom,bcm2835-armctrl-ic")) { + *interrupt = fdt32_to_cpu(intr[0]); + *trig = INTR_TRIGGER_CONFORM; + *pol = INTR_POLARITY_CONFORM; + return (0); + } +#ifdef SOC_BCM2836 + if (fdt_is_compatible(node, "brcm,bcm2836-l1-intc")) { + *interrupt = fdt32_to_cpu(intr[0]) + 72; + *trig = INTR_TRIGGER_CONFORM; + *pol = INTR_POLARITY_CONFORM; + return (0); + } +#endif + return (ENXIO); } Modified: head/sys/boot/fdt/dts/arm/bcm2836.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/bcm2836.dtsi Mon Apr 4 09:36:56 2016 (r297544) +++ head/sys/boot/fdt/dts/arm/bcm2836.dtsi Mon Apr 4 09:41:22 2016 (r297545) @@ -32,8 +32,8 @@ timer { compatible = "arm,armv7-timer"; clock-frequency = <19200000>; - interrupts = <72 73 75 74>; - interrupt-parent = <&intc>; + interrupts = <0 1 3 2>; + interrupt-parent = <&local_intc>; }; SOC: axi { @@ -41,12 +41,23 @@ #address-cells = <1>; #size-cells = <1>; reg = <0x3f000000 0x01000000>; - ranges = <0 0x3f000000 0x01000000>; + ranges = <0 0x3f000000 0x01000000>, + <0x40000000 0x40000000 0x00001000>; + + local_intc: local_intc { + compatible = "brcm,bcm2836-l1-intc"; + reg = <0x40000000 0x100>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&local_intc>; + }; intc: interrupt-controller { compatible = "broadcom,bcm2835-armctrl-ic", "broadcom,bcm2708-armctrl-ic"; reg = <0xB200 0x200>; + interrupt-parent = <&local_intc>; + interrupts = <8>; interrupt-controller; #interrupt-cells = <1>; From owner-svn-src-all@freebsd.org Mon Apr 4 09:47:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF305B01361; Mon, 4 Apr 2016 09:47: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 mx1.freebsd.org (Postfix) with ESMTPS id ACEE61F44; Mon, 4 Apr 2016 09:47: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 u349ldFB006191; Mon, 4 Apr 2016 09:47:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u349ldbc006190; Mon, 4 Apr 2016 09:47:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604040947.u349ldbc006190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 4 Apr 2016 09:47:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297546 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 09:47:41 -0000 Author: mav Date: Mon Apr 4 09:47:39 2016 New Revision: 297546 URL: https://svnweb.freebsd.org/changeset/base/297546 Log: MFC r297232: Unify ignoring EEXIST from zvol_create_minor(). This fixes creation of zvol devices for snapshots during zfs receive, that previously failed with "ZFS WARNING: Unable to create ZVOL" message. This solution is not perfect, but IMHO better then it was before. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Apr 4 09:41:22 2016 (r297545) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Apr 4 09:47:39 2016 (r297546) @@ -2841,7 +2841,8 @@ zvol_create_snapshots(objset_t *os, cons break; } - if ((error = zvol_create_minor(sname)) != 0) { + error = zvol_create_minor(sname); + if (error != 0 && error != EEXIST) { printf("ZFS WARNING: Unable to create ZVOL %s (error=%d).\n", sname, error); break; From owner-svn-src-all@freebsd.org Mon Apr 4 09:49:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27305B01409; Mon, 4 Apr 2016 09:49: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 mx1.freebsd.org (Postfix) with ESMTPS id E90C010EA; Mon, 4 Apr 2016 09:48:59 +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 u349mxDH006467; Mon, 4 Apr 2016 09:48:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u349mxVQ006466; Mon, 4 Apr 2016 09:48:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604040948.u349mxVQ006466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 4 Apr 2016 09:48:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297547 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 09:49:00 -0000 Author: mav Date: Mon Apr 4 09:48:58 2016 New Revision: 297547 URL: https://svnweb.freebsd.org/changeset/base/297547 Log: MFC r297337: Pass through error code from make_dev_p(). ENAMETOOLONG is much more informative in logs then ENXIO. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Apr 4 09:47:39 2016 (r297546) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Apr 4 09:48:58 2016 (r297547) @@ -686,13 +686,14 @@ zvol_create_minor(const char *name) bioq_init(&zv->zv_queue); mtx_init(&zv->zv_queue_mtx, "zvol", NULL, MTX_DEF); } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) { - if (make_dev_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, + error = make_dev_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, &dev, &zvol_cdevsw, NULL, UID_ROOT, GID_OPERATOR, - 0640, "%s/%s", ZVOL_DRIVER, name) != 0) { + 0640, "%s/%s", ZVOL_DRIVER, name); + if (error != 0) { kmem_free(zv, sizeof(*zv)); dmu_objset_disown(os, FTAG); mutex_exit(&zfsdev_state_lock); - return (SET_ERROR(ENXIO)); + return (error); } zv->zv_dev = dev; dev->si_iosize_max = MAXPHYS; From owner-svn-src-all@freebsd.org Mon Apr 4 09:49:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE14BB014DC; Mon, 4 Apr 2016 09:49:46 +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 mx1.freebsd.org (Postfix) with ESMTPS id 999351444; Mon, 4 Apr 2016 09:49:46 +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 u349njoh006682; Mon, 4 Apr 2016 09:49:45 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u349njJW006681; Mon, 4 Apr 2016 09:49:45 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604040949.u349njJW006681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 4 Apr 2016 09:49:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297548 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 09:49:46 -0000 Author: mav Date: Mon Apr 4 09:49:45 2016 New Revision: 297548 URL: https://svnweb.freebsd.org/changeset/base/297548 Log: MFC r297420: Switch from using make_dev_p() to make_dev_s() to close races. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Apr 4 09:48:58 2016 (r297547) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Apr 4 09:49:45 2016 (r297548) @@ -587,7 +587,6 @@ zvol_create_minor(const char *name) minor_t minor = 0; char chrbuf[30], blkbuf[30]; #else - struct cdev *dev; struct g_provider *pp; struct g_geom *gp; uint64_t volsize, mode; @@ -686,18 +685,25 @@ zvol_create_minor(const char *name) bioq_init(&zv->zv_queue); mtx_init(&zv->zv_queue_mtx, "zvol", NULL, MTX_DEF); } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) { - error = make_dev_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, - &dev, &zvol_cdevsw, NULL, UID_ROOT, GID_OPERATOR, - 0640, "%s/%s", ZVOL_DRIVER, name); + struct make_dev_args args; + + make_dev_args_init(&args); + args.mda_flags = MAKEDEV_CHECKNAME | MAKEDEV_WAITOK; + args.mda_devsw = &zvol_cdevsw; + args.mda_cr = NULL; + args.mda_uid = UID_ROOT; + args.mda_gid = GID_OPERATOR; + args.mda_mode = 0640; + args.mda_si_drv2 = zv; + error = make_dev_s(&args, &zv->zv_dev, + "%s/%s", ZVOL_DRIVER, name); if (error != 0) { kmem_free(zv, sizeof(*zv)); dmu_objset_disown(os, FTAG); mutex_exit(&zfsdev_state_lock); return (error); } - zv->zv_dev = dev; - dev->si_iosize_max = MAXPHYS; - dev->si_drv2 = zv; + zv->zv_dev->si_iosize_max = MAXPHYS; } LIST_INSERT_HEAD(&all_zvols, zv, zv_links); #endif /* illumos */ @@ -2952,18 +2958,24 @@ zvol_rename_minor(zvol_state_t *zv, cons g_error_provider(pp, 0); g_topology_unlock(); } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) { + struct make_dev_args args; + dev = zv->zv_dev; ASSERT(dev != NULL); zv->zv_dev = NULL; destroy_dev(dev); - if (make_dev_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, - &dev, &zvol_cdevsw, NULL, UID_ROOT, GID_OPERATOR, - 0640, "%s/%s", ZVOL_DRIVER, newname) == 0) { - zv->zv_dev = dev; - dev->si_iosize_max = MAXPHYS; - dev->si_drv2 = zv; - } + make_dev_args_init(&args); + args.mda_flags = MAKEDEV_CHECKNAME | MAKEDEV_WAITOK; + args.mda_devsw = &zvol_cdevsw; + args.mda_cr = NULL; + args.mda_uid = UID_ROOT; + args.mda_gid = GID_OPERATOR; + args.mda_mode = 0640; + args.mda_si_drv2 = zv; + if (make_dev_s(&args, &zv->zv_dev, + "%s/%s", ZVOL_DRIVER, newname) == 0) + zv->zv_dev->si_iosize_max = MAXPHYS; } strlcpy(zv->zv_name, newname, sizeof(zv->zv_name)); } @@ -3010,16 +3022,10 @@ zvol_rename_minors(const char *oldname, static int zvol_d_open(struct cdev *dev, int flags, int fmt, struct thread *td) { - zvol_state_t *zv; + zvol_state_t *zv = dev->si_drv2; int err = 0; mutex_enter(&zfsdev_state_lock); - zv = dev->si_drv2; - if (zv == NULL) { - mutex_exit(&zfsdev_state_lock); - return(ENXIO); /* zvol_create_minor() not done yet */ - } - if (zv->zv_total_opens == 0) err = zvol_first_open(zv); if (err) { @@ -3057,16 +3063,9 @@ out: static int zvol_d_close(struct cdev *dev, int flags, int fmt, struct thread *td) { - zvol_state_t *zv; - int err = 0; + zvol_state_t *zv = dev->si_drv2; mutex_enter(&zfsdev_state_lock); - zv = dev->si_drv2; - if (zv == NULL) { - mutex_exit(&zfsdev_state_lock); - return(ENXIO); - } - if (zv->zv_flags & ZVOL_EXCL) { ASSERT(zv->zv_total_opens == 1); zv->zv_flags &= ~ZVOL_EXCL; From owner-svn-src-all@freebsd.org Mon Apr 4 09:50:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AED61B01576; Mon, 4 Apr 2016 09:50:29 +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 mx1.freebsd.org (Postfix) with ESMTPS id 7F10C15F1; Mon, 4 Apr 2016 09:50:29 +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 u349oS1r006777; Mon, 4 Apr 2016 09:50:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u349oSo7006776; Mon, 4 Apr 2016 09:50:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604040950.u349oSo7006776@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 4 Apr 2016 09:50:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297549 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 09:50:29 -0000 Author: mav Date: Mon Apr 4 09:50:28 2016 New Revision: 297549 URL: https://svnweb.freebsd.org/changeset/base/297549 Log: MFC r297421: Plug open count leak on zvol rename. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Apr 4 09:49:45 2016 (r297548) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Apr 4 09:50:28 2016 (r297549) @@ -2964,6 +2964,11 @@ zvol_rename_minor(zvol_state_t *zv, cons ASSERT(dev != NULL); zv->zv_dev = NULL; destroy_dev(dev); + if (zv->zv_total_opens > 0) { + zv->zv_flags &= ~ZVOL_EXCL; + zv->zv_total_opens = 0; + zvol_last_close(zv); + } make_dev_args_init(&args); args.mda_flags = MAKEDEV_CHECKNAME | MAKEDEV_WAITOK; From owner-svn-src-all@freebsd.org Mon Apr 4 10:03:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE58EB01D7A; Mon, 4 Apr 2016 10:03:07 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id 9AC491EB4; Mon, 4 Apr 2016 10:03:07 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u34A36w8012406; Mon, 4 Apr 2016 10:03:06 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34A36bv012405; Mon, 4 Apr 2016 10:03:06 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201604041003.u34A36bv012405@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 4 Apr 2016 10:03:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297550 - head/sys/dev/extres/clk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 10:03:07 -0000 Author: andrew Date: Mon Apr 4 10:03:06 2016 New Revision: 297550 URL: https://svnweb.freebsd.org/changeset/base/297550 Log: Fix a format string when uint64_t is not unsigned long long by casting through uintmax_t. Modified: head/sys/dev/extres/clk/clk.c Modified: head/sys/dev/extres/clk/clk.c ============================================================================== --- head/sys/dev/extres/clk/clk.c Mon Apr 4 09:50:28 2016 (r297549) +++ head/sys/dev/extres/clk/clk.c Mon Apr 4 10:03:06 2016 (r297550) @@ -487,10 +487,10 @@ clkdom_dump(struct clkdom * clkdom) CLK_TOPO_SLOCK(); TAILQ_FOREACH(clknode, &clkdom->clknode_list, clkdom_link) { rv = clknode_get_freq(clknode, &freq); - printf("Clock: %s, parent: %s(%d), freq: %llu\n", clknode->name, + printf("Clock: %s, parent: %s(%d), freq: %ju\n", clknode->name, clknode->parent == NULL ? "(NULL)" : clknode->parent->name, clknode->parent_idx, - ((rv == 0) ? freq: rv)); + (uintmax_t)((rv == 0) ? freq: rv)); } CLK_TOPO_UNLOCK(); } From owner-svn-src-all@freebsd.org Mon Apr 4 10:27:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36C02B02631; Mon, 4 Apr 2016 10:27:49 +0000 (UTC) (envelope-from maxim@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 mx1.freebsd.org (Postfix) with ESMTPS id 0722E1ABF; Mon, 4 Apr 2016 10:27:48 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u34ARmDu018767; Mon, 4 Apr 2016 10:27:48 GMT (envelope-from maxim@FreeBSD.org) Received: (from maxim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34ARmOH018766; Mon, 4 Apr 2016 10:27:48 GMT (envelope-from maxim@FreeBSD.org) Message-Id: <201604041027.u34ARmOH018766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: maxim set sender to maxim@FreeBSD.org using -f From: Maxim Konovalov Date: Mon, 4 Apr 2016 10:27:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297551 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 10:27:49 -0000 Author: maxim Date: Mon Apr 4 10:27:48 2016 New Revision: 297551 URL: https://svnweb.freebsd.org/changeset/base/297551 Log: OpenBSD 5.9 and FreeBSD 10.3 releases added. Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Mon Apr 4 10:03:06 2016 (r297550) +++ head/share/misc/bsd-family-tree Mon Apr 4 10:27:48 2016 (r297551) @@ -333,9 +333,11 @@ FreeBSD 5.2 | | | | | | | DragonFly 4.2.0 | FreeBSD | | | | | 10.2 | | | | - | OS X NetBSD 7.0 | | - | 10.11 | OpenBSD 5.8 | - | | | | DragonFly 4.4.1 + | | OS X NetBSD 7.0 | | + | | 10.11 | OpenBSD 5.8 | + | | | | | DragonFly 4.4.1 + | FreeBSD | | OpenBSD 5.9 | + | 10.3 | | | | | | | | | FreeBSD 11 -current | NetBSD -current OpenBSD -current DragonFly -current | | | | | @@ -683,6 +685,8 @@ NetBSD 7.0 2015-09-25 [NBD] OS X 10.11 2015-09-30 [APL] OpenBSD 5.8 2015-10-18 [OBD] DragonFly 4.4.1 2015-12-07 [DFB] +OpenBSD 5.9 2016-03-29 [OBD] +FreeBSD 10.3 2016-04-04 [FBD] Bibliography ------------------------ From owner-svn-src-all@freebsd.org Mon Apr 4 10:52:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B358B02176; Mon, 4 Apr 2016 10:52:44 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id 26CA71B79; Mon, 4 Apr 2016 10:52:44 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u34AqhnX028128; Mon, 4 Apr 2016 10:52:43 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34AqhK2028127; Mon, 4 Apr 2016 10:52:43 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201604041052.u34AqhK2028127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 4 Apr 2016 10:52:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297552 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 10:52:44 -0000 Author: andrew Date: Mon Apr 4 10:52:43 2016 New Revision: 297552 URL: https://svnweb.freebsd.org/changeset/base/297552 Log: Include sys/rman.h directly rather than relying on header pollution. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/subr_intr.c Modified: head/sys/kern/subr_intr.c ============================================================================== --- head/sys/kern/subr_intr.c Mon Apr 4 10:27:48 2016 (r297551) +++ head/sys/kern/subr_intr.c Mon Apr 4 10:52:43 2016 (r297552) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From owner-svn-src-all@freebsd.org Mon Apr 4 12:04:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39991B019D7; Mon, 4 Apr 2016 12:04:34 +0000 (UTC) (envelope-from marius@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 mx1.freebsd.org (Postfix) with ESMTPS id E18681973; Mon, 4 Apr 2016 12:04:33 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u34C4XVK048983; Mon, 4 Apr 2016 12:04:33 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34C4Xoi048982; Mon, 4 Apr 2016 12:04:33 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201604041204.u34C4Xoi048982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 4 Apr 2016 12:04:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-release@freebsd.org Subject: svn commit: r297553 - release/10.3.0 X-SVN-Group: release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 12:04:34 -0000 Author: marius Date: Mon Apr 4 12:04:32 2016 New Revision: 297553 URL: https://svnweb.freebsd.org/changeset/base/297553 Log: Tag releng/10.3@297264 as release/10.3.0 (10.3-RELEASE). Added: release/10.3.0/ - copied from r297552, releng/10.3/ From owner-svn-src-all@freebsd.org Mon Apr 4 12:15:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4316B01E29; Mon, 4 Apr 2016 12:15:07 +0000 (UTC) (envelope-from marius@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 mx1.freebsd.org (Postfix) with ESMTPS id 93CD7107E; Mon, 4 Apr 2016 12:15:07 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u34CF6cb052289; Mon, 4 Apr 2016 12:15:06 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34CF6sd052288; Mon, 4 Apr 2016 12:15:06 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201604041215.u34CF6sd052288@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 4 Apr 2016 12:15:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297554 - stable/10/sys/conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 12:15:07 -0000 Author: marius Date: Mon Apr 4 12:15:06 2016 New Revision: 297554 URL: https://svnweb.freebsd.org/changeset/base/297554 Log: Now that 10.3-RELEASE is out, move stable/10 back to STABLE. Approved by: re (implicit) Modified: stable/10/sys/conf/newvers.sh Modified: stable/10/sys/conf/newvers.sh ============================================================================== --- stable/10/sys/conf/newvers.sh Mon Apr 4 12:04:32 2016 (r297553) +++ stable/10/sys/conf/newvers.sh Mon Apr 4 12:15:06 2016 (r297554) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.3" -BRANCH="PRERELEASE" +BRANCH="STABLE" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@freebsd.org Mon Apr 4 12:21:05 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF0DAB0204E; Mon, 4 Apr 2016 12:21:05 +0000 (UTC) (envelope-from marius@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 mx1.freebsd.org (Postfix) with ESMTPS id CA3BF14C5; Mon, 4 Apr 2016 12:21:05 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u34CL5YM054481; Mon, 4 Apr 2016 12:21:05 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34CL42b054478; Mon, 4 Apr 2016 12:21:04 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201604041221.u34CL42b054478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 4 Apr 2016 12:21:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297555 - in stable/10/sys/boot/efi/loader: . arch/amd64 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 12:21:06 -0000 Author: marius Date: Mon Apr 4 12:21:04 2016 New Revision: 297555 URL: https://svnweb.freebsd.org/changeset/base/297555 Log: MFC: r292563 loader.efi: strip trailing whitespace MFC: r293244 (remainder missing in r294275) Introduce and use new EFI_ERROR_CODE macro for EFI errors Modified: stable/10/sys/boot/efi/loader/Makefile stable/10/sys/boot/efi/loader/arch/amd64/framebuffer.c stable/10/sys/boot/efi/loader/devicename.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/efi/loader/Makefile ============================================================================== --- stable/10/sys/boot/efi/loader/Makefile Mon Apr 4 12:15:06 2016 (r297554) +++ stable/10/sys/boot/efi/loader/Makefile Mon Apr 4 12:21:04 2016 (r297555) @@ -65,7 +65,7 @@ HAVE_BCACHE= yes CFLAGS+= -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE} .endif -# Always add MI sources +# Always add MI sources .PATH: ${.CURDIR}/../../common .include "${.CURDIR}/../../common/Makefile.inc" CFLAGS+= -I${.CURDIR}/../../common Modified: stable/10/sys/boot/efi/loader/arch/amd64/framebuffer.c ============================================================================== --- stable/10/sys/boot/efi/loader/arch/amd64/framebuffer.c Mon Apr 4 12:15:06 2016 (r297554) +++ stable/10/sys/boot/efi/loader/arch/amd64/framebuffer.c Mon Apr 4 12:21:04 2016 (r297555) @@ -180,7 +180,7 @@ efifb_uga_find_pixel(EFI_UGA_DRAW_PROTOC printf("No change detected in frame buffer"); fail: - printf(" -- error %lu\n", status & ~EFI_ERROR_MASK); + printf(" -- error %lu\n", EFI_ERROR_CODE(status)); free(data1); return (-1); } @@ -305,7 +305,7 @@ efifb_from_uga(struct efi_fb *efifb, EFI * offset within the frame buffer of the visible region, nor * the stride. Our only option is to look at the system and * fill in the blanks based on that. Luckily, UGA was mostly - * only used on Apple hardware. + * only used on Apple hardware. */ offset = -1; ev = getenv("smbios.system.maker"); @@ -475,7 +475,7 @@ command_gop(int argc, char *argv[]) status = BS->LocateProtocol(&gop_guid, NULL, (VOID **)&gop); if (EFI_ERROR(status)) { sprintf(command_errbuf, "%s: Graphics Output Protocol not " - "present (error=%lu)", argv[0], status & ~EFI_ERROR_MASK); + "present (error=%lu)", argv[0], EFI_ERROR_CODE(status)); return (CMD_ERROR); } @@ -496,7 +496,7 @@ command_gop(int argc, char *argv[]) if (EFI_ERROR(status)) { sprintf(command_errbuf, "%s: Unable to set mode to " "%u (error=%lu)", argv[0], mode, - status & ~EFI_ERROR_MASK); + EFI_ERROR_CODE(status)); return (CMD_ERROR); } } else if (!strcmp(argv[1], "get")) { @@ -543,7 +543,7 @@ command_uga(int argc, char *argv[]) status = BS->LocateProtocol(&uga_guid, NULL, (VOID **)&uga); if (EFI_ERROR(status)) { sprintf(command_errbuf, "%s: UGA Protocol not present " - "(error=%lu)", argv[0], status & ~EFI_ERROR_MASK); + "(error=%lu)", argv[0], EFI_ERROR_CODE(status)); return (CMD_ERROR); } Modified: stable/10/sys/boot/efi/loader/devicename.c ============================================================================== --- stable/10/sys/boot/efi/loader/devicename.c Mon Apr 4 12:15:06 2016 (r297554) +++ stable/10/sys/boot/efi/loader/devicename.c Mon Apr 4 12:21:04 2016 (r297555) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); static int efi_parsedev(struct devdesc **, const char *, const char **); -/* +/* * Point (dev) at an allocated device specifier for the device matching the * path in (devspec). If it contains an explicit device specification, * use that. If not, use the default device. From owner-svn-src-all@freebsd.org Mon Apr 4 15:10:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA025B02806; Mon, 4 Apr 2016 15:10:07 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) by mx1.freebsd.org (Postfix) with ESMTP id A968B1047; Mon, 4 Apr 2016 15:10:06 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from sweettea.beer.town (unknown [76.164.8.130]) by smtp.vangyzen.net (Postfix) with ESMTPSA id C32EA564B7; Mon, 4 Apr 2016 10:09:59 -0500 (CDT) Subject: Re: svn commit: r297501 - head/usr.sbin/pciconf To: Oliver Pinter , John Baldwin References: <201604020159.u321xr2V087305@repo.freebsd.org> Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Hans Petter Selasky From: Eric van Gyzen X-Enigmail-Draft-Status: N1110 Message-ID: <570283C3.1020702@vangyzen.net> Date: Mon, 4 Apr 2016 10:09:55 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 15:10:08 -0000 On 04/02/2016 04:49, Oliver Pinter wrote: > > + printf(" slot %d", (cap & PCIEM_SLOT_CAP_PSN) >> 19); > + printf(" power limit %d mW", slot_power(cap)); > + if (cap & PCIEM_SLOT_CAP_HPC) > + printf(" HotPlug(%s)", sta & PCIEM_SLOT_STA_PDS ? > "present" : > + "empty"); > + if (cap & PCIEM_SLOT_CAP_HPS) > + printf(" surprise"); > > > What is this surprise string or state? Or is this a forgotten debug > string? >From the "PCI EXPRESS BASE SPECIFICATION, REV. 3.1a": """ 6.7.2.9. Port Capabilities and Slot Information Registers Hot-Plug Surprise (Slot Capabilities) – When Set, this bit indicates that adapter removal from the system without any prior notification is permitted for the associated form factor. """ However, John committed this on April 1, so it /could/ be an easter egg, intended for Hans Petter Selasky. ;-) > + if (cap & PCIEM_SLOT_CAP_APB) > + printf(" Attn Button"); > + if (cap & PCIEM_SLOT_CAP_PCP) > + printf(" PC(%s)", ctl & PCIEM_SLOT_CTL_PCC ? "on" > : "off"); > + if (cap & PCIEM_SLOT_CAP_MRLSP) > + printf(" MRL(%s)", sta & PCIEM_SLOT_STA_MRLSS ? > "open" : > + "closed"); > } > From owner-svn-src-all@freebsd.org Mon Apr 4 15:13:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9B59B029AC; Mon, 4 Apr 2016 15:13:18 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id 6C98B144E; Mon, 4 Apr 2016 15:13:18 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u34FDHcf006096; Mon, 4 Apr 2016 15:13:17 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34FDHbC006095; Mon, 4 Apr 2016 15:13:17 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201604041513.u34FDHbC006095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 4 Apr 2016 15:13:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297556 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 15:13:18 -0000 Author: andrew Date: Mon Apr 4 15:13:17 2016 New Revision: 297556 URL: https://svnweb.freebsd.org/changeset/base/297556 Log: Reduce the diff for when we switch to intrng. The IPI interrupts will be split out to multiple handlers. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/mp_machdep.c Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Mon Apr 4 12:21:04 2016 (r297555) +++ head/sys/arm64/arm64/mp_machdep.c Mon Apr 4 15:13:17 2016 (r297556) @@ -80,6 +80,12 @@ static device_identify_t arm64_cpu_ident static device_probe_t arm64_cpu_probe; static device_attach_t arm64_cpu_attach; +static void ipi_ast(void *); +static void ipi_hardclock(void *); +static void ipi_preempt(void *); +static void ipi_rendezvous(void *); +static void ipi_stop(void *); + static int ipi_handler(void *arg); struct mtx ap_boot_mtx; @@ -271,6 +277,58 @@ init_secondary(uint64_t cpu) /* NOTREACHED */ } +static void +ipi_ast(void *dummy __unused) +{ + + CTR0(KTR_SMP, "IPI_AST"); +} + +static void +ipi_hardclock(void *dummy __unused) +{ + + CTR1(KTR_SMP, "%s: IPI_HARDCLOCK", __func__); + hardclockintr(); +} + +static void +ipi_preempt(void *dummy __unused) +{ + CTR1(KTR_SMP, "%s: IPI_PREEMPT", __func__); + sched_preempt(curthread); +} + +static void +ipi_rendezvous(void *dummy __unused) +{ + + CTR0(KTR_SMP, "IPI_RENDEZVOUS"); + smp_rendezvous_action(); +} + +static void +ipi_stop(void *dummy __unused) +{ + u_int cpu; + + CTR0(KTR_SMP, "IPI_STOP"); + + cpu = PCPU_GET(cpuid); + savectx(&stoppcbs[cpu]); + + /* Indicate we are stopped */ + CPU_SET_ATOMIC(cpu, &stopped_cpus); + + /* Wait for restart */ + while (!CPU_ISSET(cpu, &started_cpus)) + cpu_spinwait(); + + CPU_CLR_ATOMIC(cpu, &started_cpus); + CPU_CLR_ATOMIC(cpu, &stopped_cpus); + CTR0(KTR_SMP, "IPI_STOP (restart)"); +} + static int ipi_handler(void *arg) { @@ -285,35 +343,20 @@ ipi_handler(void *arg) switch(ipi) { case IPI_AST: - CTR0(KTR_SMP, "IPI_AST"); + ipi_ast(NULL); break; case IPI_PREEMPT: - CTR1(KTR_SMP, "%s: IPI_PREEMPT", __func__); - sched_preempt(curthread); + ipi_preempt(NULL); break; case IPI_RENDEZVOUS: - CTR0(KTR_SMP, "IPI_RENDEZVOUS"); - smp_rendezvous_action(); + ipi_rendezvous(NULL); break; case IPI_STOP: case IPI_STOP_HARD: - CTR0(KTR_SMP, (ipi == IPI_STOP) ? "IPI_STOP" : "IPI_STOP_HARD"); - savectx(&stoppcbs[cpu]); - - /* Indicate we are stopped */ - CPU_SET_ATOMIC(cpu, &stopped_cpus); - - /* Wait for restart */ - while (!CPU_ISSET(cpu, &started_cpus)) - cpu_spinwait(); - - CPU_CLR_ATOMIC(cpu, &started_cpus); - CPU_CLR_ATOMIC(cpu, &stopped_cpus); - CTR0(KTR_SMP, "IPI_STOP (restart)"); + ipi_stop(NULL); break; case IPI_HARDCLOCK: - CTR1(KTR_SMP, "%s: IPI_HARDCLOCK", __func__); - hardclockintr(); + ipi_hardclock(NULL); break; default: panic("Unknown IPI %#0x on cpu %d", ipi, curcpu); From owner-svn-src-all@freebsd.org Mon Apr 4 15:56:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 492AEB018EE; Mon, 4 Apr 2016 15:56:15 +0000 (UTC) (envelope-from ache@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 mx1.freebsd.org (Postfix) with ESMTPS id 1539B1DB9; Mon, 4 Apr 2016 15:56:15 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u34FuEf0019484; Mon, 4 Apr 2016 15:56:14 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34FuELD019483; Mon, 4 Apr 2016 15:56:14 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201604041556.u34FuELD019483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Mon, 4 Apr 2016 15:56:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297557 - head/lib/libc/locale X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 15:56:15 -0000 Author: ache Date: Mon Apr 4 15:56:14 2016 New Revision: 297557 URL: https://svnweb.freebsd.org/changeset/base/297557 Log: SJIS encoding don't have single byte characters >= 224 MFC after: 1 week Modified: head/lib/libc/locale/mskanji.c Modified: head/lib/libc/locale/mskanji.c ============================================================================== --- head/lib/libc/locale/mskanji.c Mon Apr 4 15:13:17 2016 (r297556) +++ head/lib/libc/locale/mskanji.c Mon Apr 4 15:56:14 2016 (r297557) @@ -83,7 +83,7 @@ _MSKanji_init(struct xlocale_ctype *l, _ l->__mbsinit = _MSKanji_mbsinit; l->runes = rl; l->__mb_cur_max = 2; - l->__mb_sb_limit = 256; + l->__mb_sb_limit = 224; return (0); } From owner-svn-src-all@freebsd.org Mon Apr 4 16:09:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89036B01EC0; Mon, 4 Apr 2016 16:09:30 +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 mx1.freebsd.org (Postfix) with ESMTPS id 55D811603; Mon, 4 Apr 2016 16:09:30 +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 u34G9TtD022551; Mon, 4 Apr 2016 16:09:29 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34G9TCd022548; Mon, 4 Apr 2016 16:09:29 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201604041609.u34G9TCd022548@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 4 Apr 2016 16:09:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297558 - in head/sys: kern sys x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 16:09:30 -0000 Author: avg Date: Mon Apr 4 16:09:29 2016 New Revision: 297558 URL: https://svnweb.freebsd.org/changeset/base/297558 Log: new x86 smp topology detection code Previously, the code determined a topology of processing units (hardware threads, cores, packages) and then deduced a cache topology using certain assumptions. The new code builds a topology that includes both processing units and caches using the information provided by the hardware. At the moment, the discovered full topology is used only to creeate a scheduling topology for SCHED_ULE. There is no KPI for other kernel uses. Summary: - based on APIC ID derivation rules for Intel and AMD CPUs - can handle non-uniform topologies - requires homogeneous APIC ID assignment (same bit widths for ID components) - topology for dual-node AMD CPUs may not be optimal - topology for latest AMD CPU models may not be optimal as the code is several years old - supports only thread/package/core/cache nodes Todo: - AMD dual-node processors - latest AMD processors - NUMA nodes - checking for homogeneity of the APIC ID assignment across packages - more flexible cache placement within topology - expose topology to userland, e.g., via sysctl nodes Long term todo: - KPI for CPU sharing and affinity with respect to various resources (e.g., two logical processors may share the same FPU, etc) Reviewed by: mav Tested by: mav MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D2728 Modified: head/sys/kern/subr_smp.c head/sys/sys/smp.h head/sys/x86/x86/mp_x86.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Mon Apr 4 15:56:14 2016 (r297557) +++ head/sys/kern/subr_smp.c Mon Apr 4 16:09:29 2016 (r297558) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -51,6 +52,10 @@ __FBSDID("$FreeBSD$"); #include "opt_sched.h" #ifdef SMP +MALLOC_DEFINE(M_TOPO, "toponodes", "SMP topology data"); +#endif + +#ifdef SMP volatile cpuset_t stopped_cpus; volatile cpuset_t started_cpus; volatile cpuset_t suspended_cpus; @@ -556,7 +561,7 @@ smp_rendezvous(void (* setup_func)(void smp_rendezvous_cpus(all_cpus, setup_func, action_func, teardown_func, arg); } -static struct cpu_group group[MAXCPU]; +static struct cpu_group group[MAXCPU * MAX_CACHE_LEVELS + 1]; struct cpu_group * smp_topo(void) @@ -616,6 +621,17 @@ smp_topo(void) } struct cpu_group * +smp_topo_alloc(u_int count) +{ + static u_int index; + u_int curr; + + curr = index; + index += count; + return (&group[curr]); +} + +struct cpu_group * smp_topo_none(void) { struct cpu_group *top; @@ -861,3 +877,233 @@ sysctl_kern_smp_active(SYSCTL_HANDLER_AR return (error); } + +#ifdef SMP +void +topo_init_node(struct topo_node *node) +{ + + bzero(node, sizeof(*node)); + TAILQ_INIT(&node->children); +} + +void +topo_init_root(struct topo_node *root) +{ + + topo_init_node(root); + root->type = TOPO_TYPE_SYSTEM; +} + +struct topo_node * +topo_add_node_by_hwid(struct topo_node *parent, int hwid, + topo_node_type type, uintptr_t subtype) +{ + struct topo_node *node; + + TAILQ_FOREACH_REVERSE(node, &parent->children, + topo_children, siblings) { + if (node->hwid == hwid + && node->type == type && node->subtype == subtype) { + return (node); + } + } + + node = malloc(sizeof(*node), M_TOPO, M_WAITOK); + topo_init_node(node); + node->parent = parent; + node->hwid = hwid; + node->type = type; + node->subtype = subtype; + TAILQ_INSERT_TAIL(&parent->children, node, siblings); + parent->nchildren++; + + return (node); +} + +struct topo_node * +topo_find_node_by_hwid(struct topo_node *parent, int hwid, + topo_node_type type, uintptr_t subtype) +{ + + struct topo_node *node; + + TAILQ_FOREACH(node, &parent->children, siblings) { + if (node->hwid == hwid + && node->type == type && node->subtype == subtype) { + return (node); + } + } + + return (NULL); +} + +void +topo_promote_child(struct topo_node *child) +{ + struct topo_node *next; + struct topo_node *node; + struct topo_node *parent; + + parent = child->parent; + next = TAILQ_NEXT(child, siblings); + TAILQ_REMOVE(&parent->children, child, siblings); + TAILQ_INSERT_HEAD(&parent->children, child, siblings); + + while (next != NULL) { + node = next; + next = TAILQ_NEXT(node, siblings); + TAILQ_REMOVE(&parent->children, node, siblings); + TAILQ_INSERT_AFTER(&parent->children, child, node, siblings); + child = node; + } +} + +struct topo_node * +topo_next_node(struct topo_node *top, struct topo_node *node) +{ + struct topo_node *next; + + if ((next = TAILQ_FIRST(&node->children)) != NULL) + return (next); + + if ((next = TAILQ_NEXT(node, siblings)) != NULL) + return (next); + + while ((node = node->parent) != top) + if ((next = TAILQ_NEXT(node, siblings)) != NULL) + return (next); + + return (NULL); +} + +struct topo_node * +topo_next_nonchild_node(struct topo_node *top, struct topo_node *node) +{ + struct topo_node *next; + + if ((next = TAILQ_NEXT(node, siblings)) != NULL) + return (next); + + while ((node = node->parent) != top) + if ((next = TAILQ_NEXT(node, siblings)) != NULL) + return (next); + + return (NULL); +} + +void +topo_set_pu_id(struct topo_node *node, cpuid_t id) +{ + + KASSERT(node->type == TOPO_TYPE_PU, + ("topo_set_pu_id: wrong node type: %u", node->type)); + KASSERT(CPU_EMPTY(&node->cpuset) && node->cpu_count == 0, + ("topo_set_pu_id: cpuset already not empty")); + node->id = id; + CPU_SET(id, &node->cpuset); + node->cpu_count = 1; + node->subtype = 1; + + while ((node = node->parent) != NULL) { + if (CPU_ISSET(id, &node->cpuset)) + break; + CPU_SET(id, &node->cpuset); + node->cpu_count++; + } +} + +int +topo_analyze(struct topo_node *topo_root, int all, + int *pkg_count, int *cores_per_pkg, int *thrs_per_core) +{ + struct topo_node *pkg_node; + struct topo_node *core_node; + struct topo_node *pu_node; + int thrs_per_pkg; + int cpp_counter; + int tpc_counter; + int tpp_counter; + + *pkg_count = 0; + *cores_per_pkg = -1; + *thrs_per_core = -1; + thrs_per_pkg = -1; + pkg_node = topo_root; + while (pkg_node != NULL) { + if (pkg_node->type != TOPO_TYPE_PKG) { + pkg_node = topo_next_node(topo_root, pkg_node); + continue; + } + if (!all && CPU_EMPTY(&pkg_node->cpuset)) { + pkg_node = topo_next_nonchild_node(topo_root, pkg_node); + continue; + } + + (*pkg_count)++; + + cpp_counter = 0; + tpp_counter = 0; + core_node = pkg_node; + while (core_node != NULL) { + if (core_node->type == TOPO_TYPE_CORE) { + if (!all && CPU_EMPTY(&core_node->cpuset)) { + core_node = + topo_next_nonchild_node(pkg_node, + core_node); + continue; + } + + cpp_counter++; + + tpc_counter = 0; + pu_node = core_node; + while (pu_node != NULL) { + if (pu_node->type == TOPO_TYPE_PU && + (all || !CPU_EMPTY(&pu_node->cpuset))) + tpc_counter++; + pu_node = topo_next_node(core_node, + pu_node); + } + + if (*thrs_per_core == -1) + *thrs_per_core = tpc_counter; + else if (*thrs_per_core != tpc_counter) + return (0); + + core_node = topo_next_nonchild_node(pkg_node, + core_node); + } else { + /* PU node directly under PKG. */ + if (core_node->type == TOPO_TYPE_PU && + (all || !CPU_EMPTY(&core_node->cpuset))) + tpp_counter++; + core_node = topo_next_node(pkg_node, + core_node); + } + } + + if (*cores_per_pkg == -1) + *cores_per_pkg = cpp_counter; + else if (*cores_per_pkg != cpp_counter) + return (0); + if (thrs_per_pkg == -1) + thrs_per_pkg = tpp_counter; + else if (thrs_per_pkg != tpp_counter) + return (0); + + pkg_node = topo_next_nonchild_node(topo_root, pkg_node); + } + + KASSERT(*pkg_count > 0, + ("bug in topology or analysis")); + if (*cores_per_pkg == 0) { + KASSERT(*thrs_per_core == -1 && thrs_per_pkg > 0, + ("bug in topology or analysis")); + *thrs_per_core = thrs_per_pkg; + } + + return (1); +} +#endif /* SMP */ + Modified: head/sys/sys/smp.h ============================================================================== --- head/sys/sys/smp.h Mon Apr 4 15:56:14 2016 (r297557) +++ head/sys/sys/smp.h Mon Apr 4 16:09:29 2016 (r297558) @@ -17,9 +17,52 @@ #ifndef LOCORE #include +#include /* - * Topology of a NUMA or HTT system. + * Types of nodes in the topological tree. + */ +typedef enum { + /* No node has this type; can be used in topo API calls. */ + TOPO_TYPE_DUMMY, + /* Processing unit aka computing unit aka logical CPU. */ + TOPO_TYPE_PU, + /* Physical subdivision of a package. */ + TOPO_TYPE_CORE, + /* CPU L1/L2/L3 cache. */ + TOPO_TYPE_CACHE, + /* Package aka chip, equivalent to socket. */ + TOPO_TYPE_PKG, + /* NUMA node. */ + TOPO_TYPE_NODE, + /* Other logical or physical grouping of PUs. */ + /* E.g. PUs on the same dye, or PUs sharing an FPU. */ + TOPO_TYPE_GROUP, + /* The whole system. */ + TOPO_TYPE_SYSTEM +} topo_node_type; + +/* Hardware indenitifier of a topology component. */ +typedef unsigned int hwid_t; +/* Logical CPU idenitifier. */ +typedef int cpuid_t; + +/* A node in the topology. */ +struct topo_node { + struct topo_node *parent; + TAILQ_HEAD(topo_children, topo_node) children; + TAILQ_ENTRY(topo_node) siblings; + cpuset_t cpuset; + topo_node_type type; + uintptr_t subtype; + hwid_t hwid; + cpuid_t id; + int nchildren; + int cpu_count; +}; + +/* + * Scheduling topology of a NUMA or SMP system. * * The top level topology is an array of pointers to groups. Each group * contains a bitmask of cpus in its group or subgroups. It may also @@ -52,6 +95,8 @@ typedef struct cpu_group *cpu_group_t; #define CG_SHARE_L2 2 #define CG_SHARE_L3 3 +#define MAX_CACHE_LEVELS CG_SHARE_L3 + /* * Behavior modifiers for load balancing and affinity. */ @@ -60,10 +105,29 @@ typedef struct cpu_group *cpu_group_t; #define CG_FLAG_THREAD (CG_FLAG_HTT | CG_FLAG_SMT) /* Any threading. */ /* - * Convenience routines for building topologies. + * Convenience routines for building and traversing topologies. */ #ifdef SMP +void topo_init_node(struct topo_node *node); +void topo_init_root(struct topo_node *root); +struct topo_node * topo_add_node_by_hwid(struct topo_node *parent, int hwid, + topo_node_type type, uintptr_t subtype); +struct topo_node * topo_find_node_by_hwid(struct topo_node *parent, int hwid, + topo_node_type type, uintptr_t subtype); +void topo_promote_child(struct topo_node *child); +struct topo_node * topo_next_node(struct topo_node *top, + struct topo_node *node); +struct topo_node * topo_next_nonchild_node(struct topo_node *top, + struct topo_node *node); +void topo_set_pu_id(struct topo_node *node, cpuid_t id); +int topo_analyze(struct topo_node *topo_root, int all, int *pkg_count, + int *cores_per_pkg, int *thrs_per_core); + +#define TOPO_FOREACH(i, root) \ + for (i = root; i != NULL; i = topo_next_node(root, i)) + struct cpu_group *smp_topo(void); +struct cpu_group *smp_topo_alloc(u_int count); struct cpu_group *smp_topo_none(void); struct cpu_group *smp_topo_1level(int l1share, int l1count, int l1flags); struct cpu_group *smp_topo_2level(int l2share, int l2count, int l1share, Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Mon Apr 4 15:56:14 2016 (r297557) +++ head/sys/x86/x86/mp_x86.c Mon Apr 4 16:09:29 2016 (r297558) @@ -133,19 +133,28 @@ volatile int aps_ready = 0; * the APs. */ struct cpu_info cpu_info[MAX_APIC_ID + 1]; -int cpu_apic_ids[MAXCPU]; int apic_cpuids[MAX_APIC_ID + 1]; +int cpu_apic_ids[MAXCPU]; /* Holds pending bitmap based IPIs per CPU */ volatile u_int cpu_ipi_pending[MAXCPU]; -int cpu_logical; /* logical cpus per core */ -int cpu_cores; /* cores per package */ - static void release_aps(void *dummy); -static u_int hyperthreading_cpus; /* logical cpus sharing L1 cache */ static int hyperthreading_allowed = 1; +SYSCTL_INT(_machdep, OID_AUTO, hyperthreading_allowed, CTLFLAG_RDTUN, + &hyperthreading_allowed, 0, "Use Intel HTT logical CPUs"); + +static struct topo_node topo_root; + +static int pkg_id_shift; +static int core_id_shift; +static int disabled_cpus; + +struct cache_info { + int id_shift; + int present; +} static caches[MAX_CACHE_LEVELS]; void mem_range_AP_init(void) @@ -155,60 +164,125 @@ mem_range_AP_init(void) mem_range_softc.mr_op->initAP(&mem_range_softc); } -static void -topo_probe_amd(void) +/* + * Round up to the next power of two, if necessary, and then + * take log2. + * Returns -1 if argument is zero. + */ +static __inline int +mask_width(u_int x) { - int core_id_bits; - int id; - /* AMD processors do not support HTT. */ - cpu_logical = 1; + return (fls(x << (1 - powerof2(x))) - 1); +} + +static int +add_deterministic_cache(int type, int level, int share_count) +{ - if ((amd_feature2 & AMDID2_CMP) == 0) { - cpu_cores = 1; - return; + if (type == 0) + return (0); + if (type > 3) { + printf("unexpected cache type %d\n", type); + return (1); } - - core_id_bits = (cpu_procinfo2 & AMDID_COREID_SIZE) >> - AMDID_COREID_SIZE_SHIFT; - if (core_id_bits == 0) { - cpu_cores = (cpu_procinfo2 & AMDID_CMP_CORES) + 1; - return; + if (type == 2) /* ignore instruction cache */ + return (1); + if (level == 0 || level > MAX_CACHE_LEVELS) { + printf("unexpected cache level %d\n", type); + return (1); } - /* Fam 10h and newer should get here. */ - for (id = 0; id <= MAX_APIC_ID; id++) { - /* Check logical CPU availability. */ - if (!cpu_info[id].cpu_present || cpu_info[id].cpu_disabled) - continue; - /* Check if logical CPU has the same package ID. */ - if ((id >> core_id_bits) != (boot_cpu_id >> core_id_bits)) - continue; - cpu_cores++; + if (caches[level - 1].present) { + printf("WARNING: multiple entries for L%u data cache\n", level); + printf("%u => %u\n", caches[level - 1].id_shift, + mask_width(share_count)); + } + caches[level - 1].id_shift = mask_width(share_count); + caches[level - 1].present = 1; + + if (caches[level - 1].id_shift > pkg_id_shift) { + printf("WARNING: L%u data cache covers more " + "APIC IDs than a package\n", level); + printf("%u > %u\n", caches[level - 1].id_shift, pkg_id_shift); + caches[level - 1].id_shift = pkg_id_shift; + } + if (caches[level - 1].id_shift < core_id_shift) { + printf("WARNING: L%u data cache covers less " + "APIC IDs than a core\n", level); + printf("%u < %u\n", caches[level - 1].id_shift, core_id_shift); + caches[level - 1].id_shift = core_id_shift; } + + return (1); } -/* - * Round up to the next power of two, if necessary, and then - * take log2. - * Returns -1 if argument is zero. - */ -static __inline int -mask_width(u_int x) +static void +topo_probe_amd(void) { + u_int p[4]; + int level; + int share_count; + int type; + int i; - return (fls(x << (1 - powerof2(x))) - 1); + /* No multi-core capability. */ + if ((amd_feature2 & AMDID2_CMP) == 0) + return; + + /* For families 10h and newer. */ + pkg_id_shift = (cpu_procinfo2 & AMDID_COREID_SIZE) >> + AMDID_COREID_SIZE_SHIFT; + + /* For 0Fh family. */ + if (pkg_id_shift == 0) + pkg_id_shift = + mask_width((cpu_procinfo2 & AMDID_CMP_CORES) + 1); + + if ((amd_feature2 & AMDID2_TOPOLOGY) != 0) { + for (i = 0; ; i++) { + cpuid_count(0x8000001d, i, p); + type = p[0] & 0x1f; + level = (p[0] >> 5) & 0x7; + share_count = 1 + ((p[0] >> 14) & 0xfff); + + if (!add_deterministic_cache(type, level, share_count)) + break; + } + } else { + if (cpu_exthigh >= 0x80000005) { + cpuid_count(0x80000005, 0, p); + if (((p[2] >> 24) & 0xff) != 0) { + caches[0].id_shift = 0; + caches[0].present = 1; + } + } + if (cpu_exthigh >= 0x80000006) { + cpuid_count(0x80000006, 0, p); + if (((p[2] >> 16) & 0xffff) != 0) { + caches[1].id_shift = 0; + caches[1].present = 1; + } + if (((p[3] >> 18) & 0x3fff) != 0) { + + /* + * TODO: Account for dual-node processors + * where each node within a package has its own + * L3 cache. + */ + caches[2].id_shift = pkg_id_shift; + caches[2].present = 1; + } + } + } } static void -topo_probe_0x4(void) +topo_probe_intel_0x4(void) { u_int p[4]; - int pkg_id_bits; - int core_id_bits; int max_cores; int max_logical; - int id; /* Both zero and one here mean one logical processor per package. */ max_logical = (cpu_feature & CPUID_HTT) != 0 ? @@ -216,180 +290,432 @@ topo_probe_0x4(void) if (max_logical <= 1) return; - /* - * Because of uniformity assumption we examine only - * those logical processors that belong to the same - * package as BSP. Further, we count number of - * logical processors that belong to the same core - * as BSP thus deducing number of threads per core. - */ if (cpu_high >= 0x4) { cpuid_count(0x04, 0, p); max_cores = ((p[0] >> 26) & 0x3f) + 1; } else max_cores = 1; - core_id_bits = mask_width(max_logical/max_cores); - if (core_id_bits < 0) - return; - pkg_id_bits = core_id_bits + mask_width(max_cores); - - for (id = 0; id <= MAX_APIC_ID; id++) { - /* Check logical CPU availability. */ - if (!cpu_info[id].cpu_present || cpu_info[id].cpu_disabled) - continue; - /* Check if logical CPU has the same package ID. */ - if ((id >> pkg_id_bits) != (boot_cpu_id >> pkg_id_bits)) - continue; - cpu_cores++; - /* Check if logical CPU has the same package and core IDs. */ - if ((id >> core_id_bits) == (boot_cpu_id >> core_id_bits)) - cpu_logical++; - } - KASSERT(cpu_cores >= 1 && cpu_logical >= 1, - ("topo_probe_0x4 couldn't find BSP")); - - cpu_cores /= cpu_logical; - hyperthreading_cpus = cpu_logical; + core_id_shift = mask_width(max_logical/max_cores); + KASSERT(core_id_shift >= 0, + ("intel topo: max_cores > max_logical\n")); + pkg_id_shift = core_id_shift + mask_width(max_cores); } static void -topo_probe_0xb(void) +topo_probe_intel_0xb(void) { u_int p[4]; int bits; - int cnt; - int i; - int logical; int type; - int x; + int i; + + /* Fall back if CPU leaf 11 doesn't really exist. */ + cpuid_count(0x0b, 0, p); + if (p[1] == 0) { + topo_probe_intel_0x4(); + return; + } /* We only support three levels for now. */ - for (i = 0; i < 3; i++) { + for (i = 0; ; i++) { cpuid_count(0x0b, i, p); - /* Fall back if CPU leaf 11 doesn't really exist. */ - if (i == 0 && p[1] == 0) { - topo_probe_0x4(); - return; - } - bits = p[0] & 0x1f; - logical = p[1] &= 0xffff; type = (p[2] >> 8) & 0xff; - if (type == 0 || logical == 0) + + if (type == 0) break; - /* - * Because of uniformity assumption we examine only - * those logical processors that belong to the same - * package as BSP. - */ - for (cnt = 0, x = 0; x <= MAX_APIC_ID; x++) { - if (!cpu_info[x].cpu_present || - cpu_info[x].cpu_disabled) - continue; - if (x >> bits == boot_cpu_id >> bits) - cnt++; - } + + /* TODO: check for duplicate (re-)assignment */ if (type == CPUID_TYPE_SMT) - cpu_logical = cnt; + core_id_shift = bits; else if (type == CPUID_TYPE_CORE) - cpu_cores = cnt; + pkg_id_shift = bits; + else + printf("unknown CPU level type %d\n", type); + } + + if (pkg_id_shift < core_id_shift) { + printf("WARNING: core covers more APIC IDs than a package\n"); + core_id_shift = pkg_id_shift; + } +} + +static void +topo_probe_intel_caches(void) +{ + u_int p[4]; + int level; + int share_count; + int type; + int i; + + if (cpu_high < 0x4) { + /* + * Available cache level and sizes can be determined + * via CPUID leaf 2, but that requires a huge table of hardcoded + * values, so for now just assume L1 and L2 caches potentially + * shared only by HTT processing units, if HTT is present. + */ + caches[0].id_shift = pkg_id_shift; + caches[0].present = 1; + caches[1].id_shift = pkg_id_shift; + caches[1].present = 1; + return; + } + + for (i = 0; ; i++) { + cpuid_count(0x4, i, p); + type = p[0] & 0x1f; + level = (p[0] >> 5) & 0x7; + share_count = 1 + ((p[0] >> 14) & 0xfff); + + if (!add_deterministic_cache(type, level, share_count)) + break; } - if (cpu_logical == 0) - cpu_logical = 1; - cpu_cores /= cpu_logical; +} + +static void +topo_probe_intel(void) +{ + + /* + * See Intel(R) 64 Architecture Processor + * Topology Enumeration article for details. + * + * Note that 0x1 <= cpu_high < 4 case should be + * compatible with topo_probe_intel_0x4() logic when + * CPUID.1:EBX[23:16] > 0 (cpu_cores will be 1) + * or it should trigger the fallback otherwise. + */ + if (cpu_high >= 0xb) + topo_probe_intel_0xb(); + else if (cpu_high >= 0x1) + topo_probe_intel_0x4(); + + topo_probe_intel_caches(); } /* - * Both topology discovery code and code that consumes topology - * information assume top-down uniformity of the topology. - * That is, all physical packages must be identical and each - * core in a package must have the same number of threads. * Topology information is queried only on BSP, on which this * code runs and for which it can query CPUID information. - * Then topology is extrapolated on all packages using the - * uniformity assumption. + * Then topology is extrapolated on all packages using an + * assumption that APIC ID to hardware component ID mapping is + * homogenious. + * That doesn't necesserily imply that the topology is uniform. */ void topo_probe(void) { static int cpu_topo_probed = 0; + struct x86_topo_layer { + int type; + int subtype; + int id_shift; + } topo_layers[MAX_CACHE_LEVELS + 3]; + struct topo_node *parent; + struct topo_node *node; + int layer; + int nlayers; + int node_id; + int i; if (cpu_topo_probed) return; CPU_ZERO(&logical_cpus_mask); + if (mp_ncpus <= 1) - cpu_cores = cpu_logical = 1; + ; /* nothing */ else if (cpu_vendor_id == CPU_VENDOR_AMD) topo_probe_amd(); - else if (cpu_vendor_id == CPU_VENDOR_INTEL) { - /* - * See Intel(R) 64 Architecture Processor - * Topology Enumeration article for details. - * - * Note that 0x1 <= cpu_high < 4 case should be - * compatible with topo_probe_0x4() logic when - * CPUID.1:EBX[23:16] > 0 (cpu_cores will be 1) - * or it should trigger the fallback otherwise. - */ - if (cpu_high >= 0xb) - topo_probe_0xb(); - else if (cpu_high >= 0x1) - topo_probe_0x4(); - } + else if (cpu_vendor_id == CPU_VENDOR_INTEL) + topo_probe_intel(); + + KASSERT(pkg_id_shift >= core_id_shift, + ("bug in APIC topology discovery")); + + nlayers = 0; + bzero(topo_layers, sizeof(topo_layers)); + + topo_layers[nlayers].type = TOPO_TYPE_PKG; + topo_layers[nlayers].id_shift = pkg_id_shift; + if (bootverbose) + printf("Package ID shift: %u\n", topo_layers[nlayers].id_shift); + nlayers++; /* - * Fallback: assume each logical CPU is in separate - * physical package. That is, no multi-core, no SMT. - */ - if (cpu_cores == 0 || cpu_logical == 0) - cpu_cores = cpu_logical = 1; + * Consider all caches to be within a package/chip + * and "in front" of all sub-components like + * cores and hardware threads. + */ + for (i = MAX_CACHE_LEVELS - 1; i >= 0; --i) { + if (caches[i].present) { + KASSERT(caches[i].id_shift <= pkg_id_shift, + ("bug in APIC topology discovery")); + KASSERT(caches[i].id_shift >= core_id_shift, + ("bug in APIC topology discovery")); + + topo_layers[nlayers].type = TOPO_TYPE_CACHE; + topo_layers[nlayers].subtype = i + 1; + topo_layers[nlayers].id_shift = caches[i].id_shift; + if (bootverbose) + printf("L%u cache ID shift: %u\n", + topo_layers[nlayers].subtype, + topo_layers[nlayers].id_shift); + nlayers++; + } + } + + if (pkg_id_shift > core_id_shift) { + topo_layers[nlayers].type = TOPO_TYPE_CORE; + topo_layers[nlayers].id_shift = core_id_shift; + if (bootverbose) + printf("Core ID shift: %u\n", + topo_layers[nlayers].id_shift); + nlayers++; + } + + topo_layers[nlayers].type = TOPO_TYPE_PU; + topo_layers[nlayers].id_shift = 0; + nlayers++; + + topo_init_root(&topo_root); + for (i = 0; i <= MAX_APIC_ID; ++i) { + if (!cpu_info[i].cpu_present) + continue; + + parent = &topo_root; + for (layer = 0; layer < nlayers; ++layer) { + node_id = i >> topo_layers[layer].id_shift; + parent = topo_add_node_by_hwid(parent, node_id, + topo_layers[layer].type, + topo_layers[layer].subtype); + } + } + + parent = &topo_root; + for (layer = 0; layer < nlayers; ++layer) { + node_id = boot_cpu_id >> topo_layers[layer].id_shift; + node = topo_find_node_by_hwid(parent, node_id, + topo_layers[layer].type, + topo_layers[layer].subtype); + topo_promote_child(node); + parent = node; + } + cpu_topo_probed = 1; } -struct cpu_group * -cpu_topo(void) +/* + * Assign logical CPU IDs to local APICs. + */ +void +assign_cpu_ids(void) { - int cg_flags; + struct topo_node *node; + u_int smt_mask; + + smt_mask = (1u << core_id_shift) - 1; /* - * Determine whether any threading flags are - * necessry. + * Assign CPU IDs to local APIC IDs and disable any CPUs + * beyond MAXCPU. CPU 0 is always assigned to the BSP. */ - topo_probe(); - if (cpu_logical > 1 && hyperthreading_cpus) - cg_flags = CG_FLAG_HTT; - else if (cpu_logical > 1) - cg_flags = CG_FLAG_SMT; + mp_ncpus = 0; + TOPO_FOREACH(node, &topo_root) { + if (node->type != TOPO_TYPE_PU) + continue; + + if ((node->hwid & smt_mask) != (boot_cpu_id & smt_mask)) + cpu_info[node->hwid].cpu_hyperthread = 1; + + if (resource_disabled("lapic", node->hwid)) { + if (node->hwid != boot_cpu_id) + cpu_info[node->hwid].cpu_disabled = 1; + else + printf("Cannot disable BSP, APIC ID = %d\n", + node->hwid); + } + + if (!hyperthreading_allowed && + cpu_info[node->hwid].cpu_hyperthread) + cpu_info[node->hwid].cpu_disabled = 1; + + if (mp_ncpus >= MAXCPU) + cpu_info[node->hwid].cpu_disabled = 1; + + if (cpu_info[node->hwid].cpu_disabled) { + disabled_cpus++; + continue; + } + + cpu_apic_ids[mp_ncpus] = node->hwid; + apic_cpuids[node->hwid] = mp_ncpus; + topo_set_pu_id(node, mp_ncpus); + mp_ncpus++; + } + + KASSERT(mp_maxid >= mp_ncpus - 1, + ("%s: counters out of sync: max %d, count %d", __func__, mp_maxid, + mp_ncpus)); +} + +/* + * Print various information about the SMP system hardware and setup. + */ +void +cpu_mp_announce(void) +{ + struct topo_node *node; + const char *hyperthread; + int pkg_count; + int cores_per_pkg; + int thrs_per_core; + + printf("FreeBSD/SMP: "); + if (topo_analyze(&topo_root, 1, &pkg_count, + &cores_per_pkg, &thrs_per_core)) { + printf("%d package(s)", pkg_count); + if (cores_per_pkg > 0) + printf(" x %d core(s)", cores_per_pkg); + if (thrs_per_core > 1) + printf(" x %d hardware threads", thrs_per_core); + } else { + printf("Non-uniform topology"); + } + printf("\n"); + + if (disabled_cpus) { + printf("FreeBSD/SMP Online: "); + if (topo_analyze(&topo_root, 0, &pkg_count, + &cores_per_pkg, &thrs_per_core)) { + printf("%d package(s)", pkg_count); + if (cores_per_pkg > 0) + printf(" x %d core(s)", cores_per_pkg); + if (thrs_per_core > 1) + printf(" x %d hardware threads", thrs_per_core); + } else { + printf("Non-uniform topology"); + } + printf("\n"); + } + + if (!bootverbose) + return; + + TOPO_FOREACH(node, &topo_root) { + switch (node->type) { + case TOPO_TYPE_PKG: + printf("Package HW ID = %u (%#x)\n", + node->hwid, node->hwid); + break; + case TOPO_TYPE_CORE: + printf("\tCore HW ID = %u (%#x)\n", *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Apr 4 16:20:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D531B021CA; Mon, 4 Apr 2016 16:20:47 +0000 (UTC) (envelope-from wblock@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 mx1.freebsd.org (Postfix) with ESMTPS id 5DF211BFA; Mon, 4 Apr 2016 16:20:47 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u34GKkxI027639; Mon, 4 Apr 2016 16:20:46 GMT (envelope-from wblock@FreeBSD.org) Received: (from wblock@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34GKkEo027638; Mon, 4 Apr 2016 16:20:46 GMT (envelope-from wblock@FreeBSD.org) Message-Id: <201604041620.u34GKkEo027638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wblock set sender to wblock@FreeBSD.org using -f From: Warren Block Date: Mon, 4 Apr 2016 16:20:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297559 - stable/10/usr.sbin/pw X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 16:20:47 -0000 Author: wblock (doc committer) Date: Mon Apr 4 16:20:46 2016 New Revision: 297559 URL: https://svnweb.freebsd.org/changeset/base/297559 Log: MFC r297330: Adjust misleading wording of the -G option and simplify a few surrounding sentences. From a discussion on -ports. Modified: stable/10/usr.sbin/pw/pw.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pw/pw.8 ============================================================================== --- stable/10/usr.sbin/pw/pw.8 Mon Apr 4 16:09:29 2016 (r297558) +++ stable/10/usr.sbin/pw/pw.8 Mon Apr 4 16:20:46 2016 (r297559) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 14, 2015 +.Dd March 27, 2016 .Dt PW 8 .Os .Sh NAME @@ -420,18 +420,16 @@ Set the account's primary group to the g .Ar group may be defined by either its name or group number. .It Fl G Ar grouplist -Set additional group memberships for an account. +Set secondary group memberships for an account. .Ar grouplist -is a comma, space or tab-separated list of group names or group numbers. -The user's name is added to the group lists in -.Pa /etc/group , -and -removed from any groups not specified in -.Ar grouplist . -Note: a user should not be added to their primary group with +is a comma, space, or tab-separated list of group names or group numbers. +The user is added to the groups specified in +.Ar grouplist , +and removed from all groups not specified. +The current login session is not affected by group membership changes, +which only take effect when the user reconnects. +Note: do not add a user to their primary group with .Ar grouplist . -Also, group membership changes do not take effect for current user login -sessions, requiring the user to reconnect to be affected by the changes. .It Fl L Ar class This option sets the login class for the user being created. See From owner-svn-src-all@freebsd.org Mon Apr 4 16:41:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43680B02B5A; Mon, 4 Apr 2016 16:41:37 +0000 (UTC) (envelope-from wblock@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 mx1.freebsd.org (Postfix) with ESMTPS id 1545B1A3D; Mon, 4 Apr 2016 16:41:37 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u34GfaWZ033950; Mon, 4 Apr 2016 16:41:36 GMT (envelope-from wblock@FreeBSD.org) Received: (from wblock@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34GfaTp033948; Mon, 4 Apr 2016 16:41:36 GMT (envelope-from wblock@FreeBSD.org) Message-Id: <201604041641.u34GfaTp033948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wblock set sender to wblock@FreeBSD.org using -f From: Warren Block Date: Mon, 4 Apr 2016 16:41:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297560 - in stable/10/share/man: man4 man9 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 16:41:37 -0000 Author: wblock (doc committer) Date: Mon Apr 4 16:41:35 2016 New Revision: 297560 URL: https://svnweb.freebsd.org/changeset/base/297560 Log: MFC r297364: Fix two more unhappy instances of "user land". Modified: stable/10/share/man/man4/iscsi_initiator.4 stable/10/share/man/man9/kqueue.9 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/iscsi_initiator.4 ============================================================================== --- stable/10/share/man/man4/iscsi_initiator.4 Mon Apr 4 16:20:46 2016 (r297559) +++ stable/10/share/man/man4/iscsi_initiator.4 Mon Apr 4 16:41:35 2016 (r297560) @@ -57,7 +57,7 @@ instead. The .Nm implements the kernel side of the Internet SCSI (iSCSI) network -protocol standard, the user land companion is +protocol standard, the userland companion is .Xr iscontrol 8 , and permits access to remote .Em virtual Modified: stable/10/share/man/man9/kqueue.9 ============================================================================== --- stable/10/share/man/man9/kqueue.9 Mon Apr 4 16:20:46 2016 (r297559) +++ stable/10/share/man/man9/kqueue.9 Mon Apr 4 16:41:35 2016 (r297560) @@ -372,7 +372,7 @@ The function will not be called, and the .Vt knote will not be returned on the next scan. -Using this function could leak user land resources if a process uses the +Using this function could leak userland resources if a process uses the .Vt knote to track resources. .Pp From owner-svn-src-all@freebsd.org Mon Apr 4 17:04:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D2CEB03239; Mon, 4 Apr 2016 17:04:34 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id 4868B162C; Mon, 4 Apr 2016 17:04:34 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u34H4XKw040672; Mon, 4 Apr 2016 17:04:33 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34H4XK6040670; Mon, 4 Apr 2016 17:04:33 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201604041704.u34H4XK6040670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 4 Apr 2016 17:04:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297561 - in head/sys: arm/arm arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 17:04:34 -0000 Author: andrew Date: Mon Apr 4 17:04:33 2016 New Revision: 297561 URL: https://svnweb.freebsd.org/changeset/base/297561 Log: Add a table to map from the FreeBSD CPUID space to the GIC CPUID space. On many SoCs these two are the same, however there is no requirement for this to be the case, e.g. on the ARM Juno we boot on what the GIC thinks of as CPU 2, but FreeBSD numbers it CPU 0. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/arm/gic.c head/sys/arm64/arm64/gic.c Modified: head/sys/arm/arm/gic.c ============================================================================== --- head/sys/arm/arm/gic.c Mon Apr 4 16:41:35 2016 (r297560) +++ head/sys/arm/arm/gic.c Mon Apr 4 17:04:33 2016 (r297561) @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #define GICD_ITARGETSR(n) (0x0800 + ((n) * 4)) /* v1 ICDIPTR */ #define GICD_ICFGR(n) (0x0C00 + ((n) * 4)) /* v1 ICDICFR */ #define GICD_SGIR(n) (0x0F00 + ((n) * 4)) /* v1 ICDSGIR */ +#define GICD_SGI_TARGET_SHIFT 16 /* CPU Registers */ #define GICC_CTLR 0x0000 /* v1 ICCICR */ @@ -165,6 +166,8 @@ static struct resource_spec arm_gic_spec { -1, 0 } }; +static u_int arm_gic_map[MAXCPU]; + static struct arm_gic_softc *gic_sc = NULL; #define gic_c_read_4(_sc, _reg) \ @@ -224,6 +227,29 @@ gic_irq_mask(struct arm_gic_softc *sc, u } #endif +static uint8_t +gic_cpu_mask(struct arm_gic_softc *sc) +{ + uint32_t mask; + int i; + + /* Read the current cpuid mask by reading ITARGETSR{0..7} */ + for (i = 0; i < 8; i++) { + mask = gic_d_read_4(sc, GICD_ITARGETSR(i)); + if (mask != 0) + break; + } + /* No mask found, assume we are on CPU interface 0 */ + if (mask == 0) + return (1); + + /* Collect the mask in the lower byte */ + mask |= mask >> 16; + mask |= mask >> 8; + + return (mask); +} + #ifdef SMP #ifdef ARM_INTRNG static void @@ -233,6 +259,9 @@ arm_gic_init_secondary(device_t dev) struct intr_irqsrc *isrc; u_int irq; + /* Set the mask so we can find this CPU to send it IPIs */ + arm_gic_map[PCPU_GET(cpuid)] = gic_cpu_mask(sc); + for (irq = 0; irq < sc->nirqs; irq += 4) gic_d_write_4(sc, GICD_IPRIORITYR(irq >> 2), 0); @@ -280,6 +309,9 @@ arm_gic_init_secondary(device_t dev) struct arm_gic_softc *sc = device_get_softc(dev); int i; + /* Set the mask so we can find this CPU to send it IPIs */ + arm_gic_map[PCPU_GET(cpuid)] = gic_cpu_mask(sc); + for (i = 0; i < sc->nirqs; i += 4) gic_d_write_4(sc, GICD_IPRIORITYR(i >> 2), 0); @@ -490,20 +522,11 @@ arm_gic_attach(device_t dev) gic_d_write_4(sc, GICD_ICENABLER(i >> 5), 0xFFFFFFFF); } - /* Read the current cpuid mask by reading ITARGETSR{0..7} */ - for (i = 0; i < 8; i++) { - mask = gic_d_read_4(sc, GICD_ITARGETSR(i)); - if (mask != 0) - break; - } - /* No mask found, assume we are on CPU interface 0 */ - if (mask == 0) - mask = 1; - - /* Collect the mask in the lower byte */ - mask |= mask >> 16; - mask |= mask >> 8; - /* Distribute this back to the upper bytes */ + /* Find the current cpu mask */ + mask = gic_cpu_mask(sc); + /* Set the mask so we can find this CPU to send it IPIs */ + arm_gic_map[PCPU_GET(cpuid)] = mask; + /* Set all four targets to this cpu */ mask |= mask << 8; mask |= mask << 16; @@ -985,7 +1008,7 @@ arm_gic_ipi_send(device_t dev, struct in for (i = 0; i < MAXCPU; i++) if (CPU_ISSET(i, &cpus)) - val |= 1 << (16 + i); + val |= arm_gic_map[i] << GICD_SGI_TARGET_SHIFT; gic_d_write_4(sc, GICD_SGIR(0), val | gi->gi_irq); } @@ -1113,7 +1136,7 @@ arm_gic_ipi_send(device_t dev, cpuset_t for (i = 0; i < MAXCPU; i++) if (CPU_ISSET(i, &cpus)) - val |= 1 << (16 + i); + val |= arm_gic_map[i] << GICD_SGI_TARGET_SHIFT; gic_d_write_4(sc, GICD_SGIR(0), val | ipi); } Modified: head/sys/arm64/arm64/gic.c ============================================================================== --- head/sys/arm64/arm64/gic.c Mon Apr 4 16:41:35 2016 (r297560) +++ head/sys/arm64/arm64/gic.c Mon Apr 4 17:04:33 2016 (r297561) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); #define GICD_ITARGETSR(n) (0x0800 + ((n) * 4)) /* v1 ICDIPTR */ #define GICD_ICFGR(n) (0x0C00 + ((n) * 4)) /* v1 ICDICFR */ #define GICD_SGIR(n) (0x0F00 + ((n) * 4)) /* v1 ICDSGIR */ +#define GICD_SGI_TARGET_SHIFT 16 /* CPU Registers */ #define GICC_CTLR 0x0000 /* v1 ICCICR */ @@ -108,6 +109,8 @@ static struct resource_spec arm_gic_spec { -1, 0 } }; +static u_int arm_gic_map[MAXCPU]; + static struct arm_gic_softc *arm_gic_sc = NULL; #define gic_c_read_4(_sc, _reg) \ @@ -124,6 +127,29 @@ static pic_eoi_t gic_eoi; static pic_mask_t gic_mask_irq; static pic_unmask_t gic_unmask_irq; +static uint8_t +gic_cpu_mask(struct arm_gic_softc *sc) +{ + uint32_t mask; + int i; + + /* Read the current cpuid mask by reading ITARGETSR{0..7} */ + for (i = 0; i < 8; i++) { + mask = gic_d_read_4(sc, GICD_ITARGETSR(i)); + if (mask != 0) + break; + } + /* No mask found, assume we are on CPU interface 0 */ + if (mask == 0) + return (1); + + /* Collect the mask in the lower byte */ + mask |= mask >> 16; + mask |= mask >> 8; + + return (mask); +} + #ifdef SMP static void gic_init_secondary(device_t dev) @@ -131,6 +157,9 @@ gic_init_secondary(device_t dev) struct arm_gic_softc *sc = device_get_softc(dev); int i; + /* Set the mask so we can find this CPU to send it IPIs */ + arm_gic_map[PCPU_GET(cpuid)] = gic_cpu_mask(sc); + for (i = 0; i < sc->nirqs; i += 4) gic_d_write_4(sc, GICD_IPRIORITYR(i >> 2), 0); @@ -212,20 +241,11 @@ arm_gic_attach(device_t dev) gic_d_write_4(sc, GICD_ICENABLER(i >> 5), 0xFFFFFFFF); } - /* Read the current cpuid mask by reading ITARGETSR{0..7} */ - for (i = 0; i < 8; i++) { - mask = gic_d_read_4(sc, GICD_ITARGETSR(i)); - if (mask != 0) - break; - } - /* No mask found, assume we are on CPU interface 0 */ - if (mask == 0) - mask = 1; - - /* Collect the mask in the lower byte */ - mask |= mask >> 16; - mask |= mask >> 8; - /* Distribute this back to the upper bytes */ + /* Find the current cpu mask */ + mask = gic_cpu_mask(sc); + /* Set the mask so we can find this CPU to send it IPIs */ + arm_gic_map[PCPU_GET(cpuid)] = mask; + /* Set all four targets to this cpu */ mask |= mask << 8; mask |= mask << 16; @@ -317,7 +337,7 @@ gic_ipi_send(device_t dev, cpuset_t cpus for (i = 0; i < MAXCPU; i++) if (CPU_ISSET(i, &cpus)) - val |= 1 << (16 + i); + val |= arm_gic_map[i] << GICD_SGI_TARGET_SHIFT; gic_d_write_4(sc, GICD_SGIR(0), val | ipi); } From owner-svn-src-all@freebsd.org Mon Apr 4 17:14:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 670A4B0358B; Mon, 4 Apr 2016 17:14:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 470851D5D; Mon, 4 Apr 2016 17:14:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 5F729B9A9; Mon, 4 Apr 2016 13:14:54 -0400 (EDT) From: John Baldwin To: Oliver Pinter Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r297501 - head/usr.sbin/pciconf Date: Sun, 03 Apr 2016 15:55:54 -0700 Message-ID: <1801560.qVehiR5EY7@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: References: <201604020159.u321xr2V087305@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 04 Apr 2016 13:14:54 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 17:14:55 -0000 On Saturday, April 02, 2016 11:49:53 AM Oliver Pinter wrote: > > + if (cap & PCIEM_SLOT_CAP_HPS) > > + printf(" surprise"); > > > What is this surprise string or state? Or is this a forgotten debug string? It's an actual thing in the spec. "Surprise" insertion/removal means that devices can be hotplugged without requiring notification to the OS ahead of time. The expresscard slots in my x220 actually report this: pcib3@pci0:0:28:3: class=0x060400 card=0x21da17aa chip=0x1c168086 rev=0xb4 hdr=0x01 cap 10[40] = PCI-Express 2 root port max data 128(128) link x0(x1) speed 0.0(5.0) ASPM L0s/L1(L0s/L1) slot 3 power limit 100 mW HotPlug(empty) surprise cap 05[80] = MSI supports 1 message cap 0d[90] = PCI Bridge card=0x21da17aa cap 01[a0] = powerspec 2 supports D0 D3 current D0 and after inserting a card: pcib3@pci0:0:28:3: class=0x060400 card=0x21da17aa chip=0x1c168086 rev=0xb4 hdr=0x01 cap 10[40] = PCI-Express 2 root port max data 128(128) link x1(x1) speed 2.5(5.0) ASPM disabled(L0s/L1) slot 3 power limit 100 mW HotPlug(present) surprise cap 05[80] = MSI supports 1 message cap 0d[90] = PCI Bridge card=0x21da17aa cap 01[a0] = powerspec 2 supports D0 D3 current D0 -- John Baldwin From owner-svn-src-all@freebsd.org Mon Apr 4 17:33:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BF29B03BC0 for ; Mon, 4 Apr 2016 17:33:37 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-lb0-x231.google.com (mail-lb0-x231.google.com [IPv6:2a00:1450:4010:c04::231]) (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 C438E1A82 for ; Mon, 4 Apr 2016 17:33:36 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-lb0-x231.google.com with SMTP id bc4so170126576lbc.2 for ; Mon, 04 Apr 2016 10:33:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=DnvoCWeiKx4cke3VaIza/ZQE5oOMGL8wK1AdSJK0Uq0=; b=vPJFK0tVKyRIZbZZ21Hz7G0oTEzvpzs5EBw1bY7ObUGeYCP1gBNtxYm8g4Ugk5uPRK DopburuAnAgY7jxYKQrz7/eC+Oz2jh56SjVjF9/TpUCyU/8mrNAiaEdckx6WOwEYRKDt 0GW+0+THBk3Y0lH3i6OEMIDytninjbmZHJzwZIfhqTXtOAJ4Skj6h+CebDkRtqAsNyQP A0TaWZSQYEhVn2IB6FAsKibRzHrfbwyIOKTlUo97EQ5kEH+OYCGX3I/8kFMTaflmombE QplE2sh5QtmJhW2BNHC9xb7m82vuA8ZiJ2zrhP/hCJ/tCUquYq3y0tF+P1L98OnHtE+N uC1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=DnvoCWeiKx4cke3VaIza/ZQE5oOMGL8wK1AdSJK0Uq0=; b=YiqQABgQ3OmB19dkpVt6iILMP0kbhcjsuJ+337bBmCK3Hlkov3AXCfOeAdoL4t0z9K bjrUNBn3oy3QEDwl/OxnoKhybH4ljvyvbehbzehnpNoSmrS5E3n0UZAFlbbxswKlg5Hn Q76dguUjlUBBRrgo69wQy3UVFQk3e1eVgcW1YPbDCEvv0OKbYxiHhygwurGvJN55xAsK Q0LP75usa/Cpem84ztP0i1uvuYfTpdGbM7ixCu4KeHkuiQfgb2rM0wNgOL4HUsRu1I7J 0uV/Ovb+5xaWkwuJgIPpsofL/Ea7/OT0LYyEA83a5kF2KS2jGm/CmMTYdyuh8kElOZRs QP5Q== X-Gm-Message-State: AD7BkJLYffsUw4ylh9vC0WZe1YAdHl53axrvtShZvAXxSQreva36BqUX5ZPJNjHZoRZ3qL68TgE2v44CXDW9RnSH MIME-Version: 1.0 X-Received: by 10.28.216.141 with SMTP id p135mr13477703wmg.22.1459791213595; Mon, 04 Apr 2016 10:33:33 -0700 (PDT) Received: by 10.194.243.98 with HTTP; Mon, 4 Apr 2016 10:33:33 -0700 (PDT) In-Reply-To: <1801560.qVehiR5EY7@ralph.baldwin.cx> References: <201604020159.u321xr2V087305@repo.freebsd.org> <1801560.qVehiR5EY7@ralph.baldwin.cx> Date: Mon, 4 Apr 2016 19:33:33 +0200 Message-ID: Subject: Re: svn commit: r297501 - head/usr.sbin/pciconf From: Oliver Pinter To: John Baldwin Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 17:33:37 -0000 On Monday, April 4, 2016, John Baldwin wrote: > On Saturday, April 02, 2016 11:49:53 AM Oliver Pinter wrote: > > > + if (cap & PCIEM_SLOT_CAP_HPS) > > > + printf(" surprise"); > > > > > > What is this surprise string or state? Or is this a forgotten debug > string? > > It's an actual thing in the spec. "Surprise" insertion/removal means that > devices > can be hotplugged without requiring notification to the OS ahead of time. > The > expresscard slots in my x220 actually report this: Okay, thanks for the clarification. > > pcib3@pci0:0:28:3: class=0x060400 card=0x21da17aa chip=0x1c168086 > rev=0xb4 hdr=0x01 > cap 10[40] = PCI-Express 2 root port max data 128(128) > link x0(x1) speed 0.0(5.0) ASPM L0s/L1(L0s/L1) > slot 3 power limit 100 mW HotPlug(empty) surprise > cap 05[80] = MSI supports 1 message > cap 0d[90] = PCI Bridge card=0x21da17aa > cap 01[a0] = powerspec 2 supports D0 D3 current D0 > > and after inserting a card: > > pcib3@pci0:0:28:3: class=0x060400 card=0x21da17aa chip=0x1c168086 > rev=0xb4 hdr=0x01 > cap 10[40] = PCI-Express 2 root port max data 128(128) > link x1(x1) speed 2.5(5.0) ASPM disabled(L0s/L1) > slot 3 power limit 100 mW HotPlug(present) surprise > cap 05[80] = MSI supports 1 message > cap 0d[90] = PCI Bridge card=0x21da17aa > cap 01[a0] = powerspec 2 supports D0 D3 current D0 > > -- > John Baldwin > From owner-svn-src-all@freebsd.org Mon Apr 4 20:32:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05A54B033B0; Mon, 4 Apr 2016 20:32:33 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id CB6C41218; Mon, 4 Apr 2016 20:32:32 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u34KWW4Y004957; Mon, 4 Apr 2016 20:32:32 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34KWWmc004956; Mon, 4 Apr 2016 20:32:32 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604042032.u34KWWmc004956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 4 Apr 2016 20:32:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297562 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 20:32:33 -0000 Author: adrian Date: Mon Apr 4 20:32:31 2016 New Revision: 297562 URL: https://svnweb.freebsd.org/changeset/base/297562 Log: [net80211] add amsdu and fast frames encap failure counters in the ioctl definition. The code to set these will come in a subsequent commit (when I start fleshing out A-MSDU support.) Modified: head/sys/net80211/ieee80211_ioctl.h Modified: head/sys/net80211/ieee80211_ioctl.h ============================================================================== --- head/sys/net80211/ieee80211_ioctl.h Mon Apr 4 17:04:33 2016 (r297561) +++ head/sys/net80211/ieee80211_ioctl.h Mon Apr 4 20:32:31 2016 (r297562) @@ -246,7 +246,10 @@ struct ieee80211_stats { uint32_t is_ampdu_bar_tx_retry; /* A-MPDU BAR frames TX rtry */ uint32_t is_ampdu_bar_tx_fail; /* A-MPDU BAR frames TX fail */ - uint32_t is_spare[7]; + uint32_t is_ff_encapfail; /* failed FF encap */ + uint32_t is_amsdu_encapfail; /* failed A-MSDU encap */ + + uint32_t is_spare[5]; }; /* From owner-svn-src-all@freebsd.org Mon Apr 4 20:33:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2853B03414; Mon, 4 Apr 2016 20:33:17 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id A42B11398; Mon, 4 Apr 2016 20:33:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u34KXGxZ005040; Mon, 4 Apr 2016 20:33:16 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34KXGq0005039; Mon, 4 Apr 2016 20:33:16 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604042033.u34KXGq0005039@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 4 Apr 2016 20:33:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297563 - head/tools/tools/net80211/wlanstats X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 20:33:17 -0000 Author: adrian Date: Mon Apr 4 20:33:16 2016 New Revision: 297563 URL: https://svnweb.freebsd.org/changeset/base/297563 Log: [net80211] teach wlanstats about the ff_encapfail field. Without this it just displays a blank, short column which is just plainly not useful. Modified: head/tools/tools/net80211/wlanstats/wlanstats.c Modified: head/tools/tools/net80211/wlanstats/wlanstats.c ============================================================================== --- head/tools/tools/net80211/wlanstats/wlanstats.c Mon Apr 4 20:32:31 2016 (r297562) +++ head/tools/tools/net80211/wlanstats/wlanstats.c Mon Apr 4 20:33:16 2016 (r297563) @@ -767,6 +767,7 @@ wlan_get_curstat(struct bsdstat *sf, int case S_FF_SPLIT: STAT(ff_split); case S_FF_DECAP: STAT(ff_decap); case S_FF_ENCAP: STAT(ff_encap); + case S_FF_ENCAPFAIL: STAT(ff_encapfail); case S_RX_BADBINTVAL: STAT(rx_badbintval); case S_RX_MGMT: STAT(rx_mgmt); case S_RX_DEMICFAIL: STAT(rx_demicfail); @@ -929,6 +930,7 @@ wlan_get_totstat(struct bsdstat *sf, int case S_FF_SPLIT: STAT(ff_split); case S_FF_DECAP: STAT(ff_decap); case S_FF_ENCAP: STAT(ff_encap); + case S_FF_ENCAPFAIL: STAT(ff_encapfail); case S_RX_BADBINTVAL: STAT(rx_badbintval); case S_RX_MGMT: STAT(rx_mgmt); case S_RX_DEMICFAIL: STAT(rx_demicfail); From owner-svn-src-all@freebsd.org Mon Apr 4 21:06:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE626B03B0F; Mon, 4 Apr 2016 21:06:45 +0000 (UTC) (envelope-from glebius@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 mx1.freebsd.org (Postfix) with ESMTPS id 95D6B139F; Mon, 4 Apr 2016 21:06:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u34L6iZO014442; Mon, 4 Apr 2016 21:06:44 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34L6ivX014440; Mon, 4 Apr 2016 21:06:44 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201604042106.u34L6ivX014440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 4 Apr 2016 21:06:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297564 - head/tools/tools/nanobsd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 21:06:46 -0000 Author: glebius Date: Mon Apr 4 21:06:44 2016 New Revision: 297564 URL: https://svnweb.freebsd.org/changeset/base/297564 Log: Add early_customize_cmd() that allows to register custom functions run before the build stage. Reviewed by: imp Obtained from: Netflix Modified: head/tools/tools/nanobsd/defaults.sh head/tools/tools/nanobsd/nanobsd.sh Modified: head/tools/tools/nanobsd/defaults.sh ============================================================================== --- head/tools/tools/nanobsd/defaults.sh Mon Apr 4 20:33:16 2016 (r297563) +++ head/tools/tools/nanobsd/defaults.sh Mon Apr 4 21:06:44 2016 (r297564) @@ -83,6 +83,9 @@ NANO_KERNEL=GENERIC # Use "default" to install all built modules. NANO_MODULES= +# Early customize commands. +NANO_EARLY_CUSTOMIZE="" + # Customize commands. NANO_CUSTOMIZE="" @@ -450,6 +453,22 @@ native_xtools ( ) ( ) # +# Run the requested set of early customization scripts, run before +# buildworld. +# +run_early_customize() { + + pprint 2 "run early customize scripts" + for c in $NANO_EARLY_CUSTOMIZE + do + pprint 2 "early customize \"$c\"" + pprint 3 "log: ${NANO_LOG}/_.early_cust.$c" + pprint 4 "`type $c`" + { set -x ; $c ; set +x ; } >${NANO_LOG}/_.early_cust.$c 2>&1 + done +} + +# # Run the requested set of customization scripts, run after we've # done an installworld, installed the etc files, installed the kernel # and tweaked them in the standard way. @@ -961,6 +980,15 @@ cust_pkgng ( ) ( ####################################################################### # Convenience function: +# Register all args as early customize function to run just before +# build commences. + +early_customize_cmd () { + NANO_EARLY_CUSTOMIZE="$NANO_EARLY_CUSTOMIZE $*" +} + +####################################################################### +# Convenience function: # Register all args as customize function. customize_cmd ( ) { Modified: head/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- head/tools/tools/nanobsd/nanobsd.sh Mon Apr 4 20:33:16 2016 (r297563) +++ head/tools/tools/nanobsd/nanobsd.sh Mon Apr 4 21:06:44 2016 (r297564) @@ -139,6 +139,8 @@ fi pprint 1 "NanoBSD image ${NANO_NAME} build starting" +run_early_customize + if $do_world ; then if $do_clean ; then clean_build From owner-svn-src-all@freebsd.org Mon Apr 4 22:10:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BCBEB02A53; Mon, 4 Apr 2016 22:10:53 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id 5047E1D6F; Mon, 4 Apr 2016 22:10:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u34MAqQV032510; Mon, 4 Apr 2016 22:10:52 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34MAql7032509; Mon, 4 Apr 2016 22:10:52 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604042210.u34MAql7032509@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 4 Apr 2016 22:10:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297565 - head/tools/tools/net80211/wlanstats X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 22:10:53 -0000 Author: adrian Date: Mon Apr 4 22:10:52 2016 New Revision: 297565 URL: https://svnweb.freebsd.org/changeset/base/297565 Log: [net80211] Add an A-MSDU debug output shortcut. Modified: head/tools/tools/net80211/wlanstats/main.c Modified: head/tools/tools/net80211/wlanstats/main.c ============================================================================== --- head/tools/tools/net80211/wlanstats/main.c Mon Apr 4 21:06:44 2016 (r297564) +++ head/tools/tools/net80211/wlanstats/main.c Mon Apr 4 22:10:52 2016 (r297565) @@ -61,6 +61,10 @@ static struct { "ampdu_drop,ampdu_bar,ampdu_baroow,ampdu_barmove,ampdu_bartx," "ampdu_bartxfail,ampdu_bartxretry,rssi,rate" }, + { + "amsdu", + "input,output,amsdu_tooshort,amsdu_split,amsdu_decap,amsdu_encap,rssi,rate" + }, }; static const char * From owner-svn-src-all@freebsd.org Mon Apr 4 23:15:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00EE1B03BD5; Mon, 4 Apr 2016 23:15:58 +0000 (UTC) (envelope-from bdrewery@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 mx1.freebsd.org (Postfix) with ESMTPS id B74751CD4; Mon, 4 Apr 2016 23:15:58 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u34NFvYx053759; Mon, 4 Apr 2016 23:15:57 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u34NFvdO053758; Mon, 4 Apr 2016 23:15:57 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201604042315.u34NFvdO053758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 4 Apr 2016 23:15:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297566 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 23:15:59 -0000 Author: bdrewery Date: Mon Apr 4 23:15:57 2016 New Revision: 297566 URL: https://svnweb.freebsd.org/changeset/base/297566 Log: DIRDEPS_BUILD: Use 1 parameter for defining -rpath-link. Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/local.meta.sys.mk Modified: head/share/mk/local.meta.sys.mk ============================================================================== --- head/share/mk/local.meta.sys.mk Mon Apr 4 22:10:52 2016 (r297565) +++ head/share/mk/local.meta.sys.mk Mon Apr 4 23:15:57 2016 (r297566) @@ -179,7 +179,7 @@ STAGE_INCSDIR= ${STAGE_OBJTOP}${INCSDIR: # the target is usually an absolute path STAGE_SYMLINKS_DIR= ${STAGE_OBJTOP} -LDFLAGS_LAST+= -Wl,-rpath-link -Wl,${STAGE_LIBDIR} +LDFLAGS_LAST+= -Wl,-rpath-link,${STAGE_LIBDIR} .if ${MK_SYSROOT} == "yes" SYSROOT?= ${STAGE_OBJTOP} .else From owner-svn-src-all@freebsd.org Tue Apr 5 00:08:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B77A5B03BDA; Tue, 5 Apr 2016 00:08:43 +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 mx1.freebsd.org (Postfix) with ESMTPS id 80B061095; Tue, 5 Apr 2016 00:08:43 +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 u3508g8U068937; Tue, 5 Apr 2016 00:08:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3508gWj068936; Tue, 5 Apr 2016 00:08:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201604050008.u3508gWj068936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 5 Apr 2016 00:08:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297568 - head/sys/dev/fdc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 00:08:43 -0000 Author: jhb Date: Tue Apr 5 00:08:42 2016 New Revision: 297568 URL: https://svnweb.freebsd.org/changeset/base/297568 Log: Don't wakeup the fdc worker thread once a second when idle. The fdc worker thread was using a one second timeout while waiting for a new bio to arrive or for the device to detach. However, the driver already does a wakeup when queueing a new bio or asking the thread to detach, so the timeout only served to waste CPU time waking up the thread once a second just so it could go right back to sleep. Use an infinite timeout instead. Discussed with: phk Sponsored by: Netflix Modified: head/sys/dev/fdc/fdc.c Modified: head/sys/dev/fdc/fdc.c ============================================================================== --- head/sys/dev/fdc/fdc.c Mon Apr 4 23:55:32 2016 (r297567) +++ head/sys/dev/fdc/fdc.c Tue Apr 5 00:08:42 2016 (r297568) @@ -968,7 +968,7 @@ fdc_worker(struct fdc_data *fdc) fdc->bp = bioq_takefirst(&fdc->head); if (fdc->bp == NULL) msleep(&fdc->head, &fdc->fdc_mtx, - PRIBIO, "-", hz); + PRIBIO, "-", 0); } while (fdc->bp == NULL && (fdc->flags & FDC_KTHREAD_EXIT) == 0); mtx_unlock(&fdc->fdc_mtx); From owner-svn-src-all@freebsd.org Tue Apr 5 00:09:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFAE2B03C51; Tue, 5 Apr 2016 00:09:20 +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 mx1.freebsd.org (Postfix) with ESMTPS id BE4C611F9; Tue, 5 Apr 2016 00:09:20 +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 u3509Jjl069001; Tue, 5 Apr 2016 00:09:19 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3509J2p069000; Tue, 5 Apr 2016 00:09:19 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201604050009.u3509J2p069000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 5 Apr 2016 00:09:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297569 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 00:09:21 -0000 Author: jhb Date: Tue Apr 5 00:09:19 2016 New Revision: 297569 URL: https://svnweb.freebsd.org/changeset/base/297569 Log: Remove an unneeded check. CPUs with valid per-CPU data are not absent. Sponsored by: Netflix Modified: head/sys/net/netisr.c Modified: head/sys/net/netisr.c ============================================================================== --- head/sys/net/netisr.c Tue Apr 5 00:08:42 2016 (r297568) +++ head/sys/net/netisr.c Tue Apr 5 00:09:19 2016 (r297569) @@ -1167,9 +1167,6 @@ netisr_start(void *arg) STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { if (nws_count >= netisr_maxthreads) break; - /* XXXRW: Is skipping absent CPUs still required here? */ - if (CPU_ABSENT(pc->pc_cpuid)) - continue; /* Worker will already be present for boot CPU. */ if (pc->pc_netisr != NULL) continue; From owner-svn-src-all@freebsd.org Tue Apr 5 00:10:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B8FEB03CBE; Tue, 5 Apr 2016 00:10:08 +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 mx1.freebsd.org (Postfix) with ESMTPS id 3CD5E1369; Tue, 5 Apr 2016 00:10:08 +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 u350A78d069086; Tue, 5 Apr 2016 00:10:07 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u350A7tU069085; Tue, 5 Apr 2016 00:10:07 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201604050010.u350A7tU069085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 5 Apr 2016 00:10:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297570 - head/sys/dev/xen/control X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 00:10:08 -0000 Author: jhb Date: Tue Apr 5 00:10:07 2016 New Revision: 297570 URL: https://svnweb.freebsd.org/changeset/base/297570 Log: Remove a redundant check. cpu_suspend_map is always empty if smp_started is false. Sponsored by: Netflix Modified: head/sys/dev/xen/control/control.c Modified: head/sys/dev/xen/control/control.c ============================================================================== --- head/sys/dev/xen/control/control.c Tue Apr 5 00:09:19 2016 (r297569) +++ head/sys/dev/xen/control/control.c Tue Apr 5 00:10:07 2016 (r297570) @@ -260,7 +260,7 @@ xctrl_suspend() #ifdef SMP /* Send an IPI_BITMAP in case there are pending bitmap IPIs. */ lapic_ipi_vectored(IPI_BITMAP_VECTOR, APIC_IPI_DEST_ALL); - if (smp_started && !CPU_EMPTY(&cpu_suspend_map)) { + if (!CPU_EMPTY(&cpu_suspend_map)) { /* * Now that event channels have been initialized, * resume CPUs. From owner-svn-src-all@freebsd.org Tue Apr 5 01:12:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A9E0B0228E; Tue, 5 Apr 2016 01:12:58 +0000 (UTC) (envelope-from wblock@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 mx1.freebsd.org (Postfix) with ESMTPS id DFEE61EE8; Tue, 5 Apr 2016 01:12:57 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u351Cvbi089393; Tue, 5 Apr 2016 01:12:57 GMT (envelope-from wblock@FreeBSD.org) Received: (from wblock@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u351CvuU089392; Tue, 5 Apr 2016 01:12:57 GMT (envelope-from wblock@FreeBSD.org) Message-Id: <201604050112.u351CvuU089392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wblock set sender to wblock@FreeBSD.org using -f From: Warren Block Date: Tue, 5 Apr 2016 01:12:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297571 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 01:12:58 -0000 Author: wblock (doc committer) Date: Tue Apr 5 01:12:56 2016 New Revision: 297571 URL: https://svnweb.freebsd.org/changeset/base/297571 Log: Add another real-life example of setting a quirk for a USB gaming keyboard. From forum thread: https://forums.freebsd.org/threads/55717/ MFC after: 1 week Modified: head/share/man/man4/usb_quirk.4 Modified: head/share/man/man4/usb_quirk.4 ============================================================================== --- head/share/man/man4/usb_quirk.4 Tue Apr 5 00:10:07 2016 (r297570) +++ head/share/man/man4/usb_quirk.4 Tue Apr 5 01:12:56 2016 (r297571) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 26, 2015 +.Dd April 4, 2016 .Dt USB_QUIRK 4 .Os .Sh NAME @@ -234,6 +234,12 @@ device which appears as a USB device on usbconfig -d ugen0.3 add_quirk UQ_MSC_EJECT_WAIT .Ed .Pp +Enable a Holtec/Keep Out F85 gaming keyboard on +.Pa ugen1.4 : +.Bd -literal -offset indent +usbconfig -d ugen1.4 add_quirk UQ_KBD_BOOTPROTO +.Ed +.Pp To install a quirk at boot time, place one or several lines like the following in .Xr loader.conf 5 : From owner-svn-src-all@freebsd.org Tue Apr 5 01:14:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E638B02360; Tue, 5 Apr 2016 01:14:46 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 551501080; Tue, 5 Apr 2016 01:14:46 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 53ECC1DFD; Tue, 5 Apr 2016 01:14:46 +0000 (UTC) Date: Tue, 5 Apr 2016 01:14:46 +0000 From: Alexey Dokuchaev To: Andriy Gapon Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297558 - in head/sys: kern sys x86/x86 Message-ID: <20160405011446.GA41944@FreeBSD.org> References: <201604041609.u34G9TCd022548@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201604041609.u34G9TCd022548@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 01:14:46 -0000 On Mon, Apr 04, 2016 at 04:09:29PM +0000, Andriy Gapon wrote: > New Revision: 297558 > URL: https://svnweb.freebsd.org/changeset/base/297558 > > Log: > new x86 smp topology detection code > > Previously, the code determined a topology of processing units > (hardware threads, cores, packages) and then deduced a cache topology > using certain assumptions. The new code builds a topology that > includes both processing units and caches using the information > provided by the hardware. Good work! On a related note, would it make it easier/possible to start thinking about if FreeBSD can export CPU cache information into userland? Some applications want these bits... Linux exports them via sysconf(3), back in 2003 bms@ proposed preliminary design [1] and suggested sysctl(3). ./danfe [1] https://lists.freebsd.org/pipermail/freebsd-hackers/2003-October/003604.html From owner-svn-src-all@freebsd.org Tue Apr 5 02:27:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21810B03BEA; Tue, 5 Apr 2016 02:27:03 +0000 (UTC) (envelope-from jhibbits@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 mx1.freebsd.org (Postfix) with ESMTPS id E30F1126E; Tue, 5 Apr 2016 02:27:02 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u352R26N011233; Tue, 5 Apr 2016 02:27:02 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u352R2PO011232; Tue, 5 Apr 2016 02:27:02 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201604050227.u352R2PO011232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 5 Apr 2016 02:27:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297572 - head/sys/powerpc/mpc85xx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 02:27:03 -0000 Author: jhibbits Date: Tue Apr 5 02:27:01 2016 New Revision: 297572 URL: https://svnweb.freebsd.org/changeset/base/297572 Log: Make i2c device child auto-probe work for MPC85xx and QorIQ SoCs. OFW i2c probing requires a new method ofw_bus_get_node(), and the bus device is assumed iichb. With these changes, i2c devices attached in fdt are probed and attached automagically. Modified: head/sys/powerpc/mpc85xx/i2c.c Modified: head/sys/powerpc/mpc85xx/i2c.c ============================================================================== --- head/sys/powerpc/mpc85xx/i2c.c Tue Apr 5 01:12:56 2016 (r297571) +++ head/sys/powerpc/mpc85xx/i2c.c Tue Apr 5 02:27:01 2016 (r297572) @@ -97,6 +97,7 @@ static int i2c_stop(device_t dev); static int i2c_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr); static int i2c_read(device_t dev, char *buf, int len, int *read, int last, int delay); static int i2c_write(device_t dev, const char *buf, int len, int *sent, int timeout); +static phandle_t i2c_get_node(device_t bus, device_t dev); static device_method_t i2c_methods[] = { DEVMETHOD(device_probe, i2c_probe), @@ -110,12 +111,13 @@ static device_method_t i2c_methods[] = { DEVMETHOD(iicbus_read, i2c_read), DEVMETHOD(iicbus_write, i2c_write), DEVMETHOD(iicbus_transfer, iicbus_transfer_gen), + DEVMETHOD(ofw_bus_get_node, i2c_get_node), { 0, 0 } }; static driver_t i2c_driver = { - "i2c", + "iichb", i2c_methods, sizeof(struct i2c_softc), }; @@ -425,3 +427,11 @@ i2c_write(device_t dev, const char *buf, return (IIC_NOERR); } + +static phandle_t +i2c_get_node(device_t bus, device_t dev) +{ + + /* Share controller node with iibus device. */ + return (ofw_bus_get_node(bus)); +} From owner-svn-src-all@freebsd.org Tue Apr 5 03:27:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D4A5B02F9F; Tue, 5 Apr 2016 03:27:35 +0000 (UTC) (envelope-from jhibbits@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 mx1.freebsd.org (Postfix) with ESMTPS id EC4F61C22; Tue, 5 Apr 2016 03:27:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u353RYXP029337; Tue, 5 Apr 2016 03:27:34 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u353RYJJ029335; Tue, 5 Apr 2016 03:27:34 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201604050327.u353RYJJ029335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 5 Apr 2016 03:27:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297573 - head/sys/dev/iicbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 03:27:35 -0000 Author: jhibbits Date: Tue Apr 5 03:27:33 2016 New Revision: 297573 URL: https://svnweb.freebsd.org/changeset/base/297573 Log: Add support for the Microchip mcp7941x. This is compatible with the ds1307, but comparing the mcp7941x datasheet vs the ds1307 code, appears there is one bit placement difference, so that is now accounted for. Relnotes: yes Modified: head/sys/dev/iicbus/ds1307.c head/sys/dev/iicbus/ds1307reg.h Modified: head/sys/dev/iicbus/ds1307.c ============================================================================== --- head/sys/dev/iicbus/ds1307.c Tue Apr 5 02:27:01 2016 (r297572) +++ head/sys/dev/iicbus/ds1307.c Tue Apr 5 03:27:33 2016 (r297573) @@ -60,10 +60,20 @@ struct ds1307_softc { struct intr_config_hook enum_hook; uint16_t sc_addr; /* DS1307 slave address. */ uint8_t sc_ctrl; + int sc_mcp7941x; }; static void ds1307_start(void *); +#ifdef FDT +static const struct ofw_compat_data ds1307_compat_data[] = { + {"dallas,ds1307", (uintptr_t)"Maxim DS1307 RTC"}, + {"maxim,ds1307", (uintptr_t)"Maxim DS1307 RTC"}, + {"microchip,mcp7941x", (uintptr_t)"Microchip MCP7941x RTC"}, + { NULL, 0 } +}; +#endif + static int ds1307_read(device_t dev, uint16_t addr, uint8_t reg, uint8_t *data, size_t len) { @@ -167,21 +177,25 @@ ds1307_set_24hrs_mode(struct ds1307_soft static int ds1307_sqwe_sysctl(SYSCTL_HANDLER_ARGS) { - int sqwe, error, newv; + int sqwe, error, newv, sqwe_bit; struct ds1307_softc *sc; sc = (struct ds1307_softc *)arg1; error = ds1307_ctrl_read(sc); if (error != 0) return (error); - sqwe = newv = (sc->sc_ctrl & DS1307_CTRL_SQWE) ? 1 : 0; + if (sc->sc_mcp7941x) + sqwe_bit = MCP7941X_CTRL_SQWE; + else + sqwe_bit = DS1307_CTRL_SQWE; + sqwe = newv = (sc->sc_ctrl & sqwe_bit) ? 1 : 0; error = sysctl_handle_int(oidp, &newv, 0, req); if (error != 0 || req->newptr == NULL) return (error); if (sqwe != newv) { - sc->sc_ctrl &= ~DS1307_CTRL_SQWE; + sc->sc_ctrl &= ~sqwe_bit; if (newv) - sc->sc_ctrl |= DS1307_CTRL_SQWE; + sc->sc_ctrl |= sqwe_bit; error = ds1307_ctrl_write(sc); if (error != 0) return (error); @@ -252,17 +266,25 @@ ds1307_sqw_out_sysctl(SYSCTL_HANDLER_ARG static int ds1307_probe(device_t dev) { - #ifdef FDT + const struct ofw_compat_data *compat; + if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "dallas,ds1307") && - !ofw_bus_is_compatible(dev, "maxim,ds1307")) + + compat = ofw_bus_search_compatible(dev, ds1307_compat_data); + + if (compat == NULL) return (ENXIO); -#endif + + device_set_desc(dev, (const char *)compat->ocd_data); + + return (BUS_PROBE_DEFAULT); +#else device_set_desc(dev, "Maxim DS1307 RTC"); return (BUS_PROBE_DEFAULT); +#endif } static int @@ -277,6 +299,9 @@ ds1307_attach(device_t dev) sc->enum_hook.ich_func = ds1307_start; sc->enum_hook.ich_arg = dev; + if (ofw_bus_is_compatible(dev, "microchip,mcp7941x")) + sc->sc_mcp7941x = 1; + /* * We have to wait until interrupts are enabled. Usually I2C read * and write only works when the interrupts are available. Modified: head/sys/dev/iicbus/ds1307reg.h ============================================================================== --- head/sys/dev/iicbus/ds1307reg.h Tue Apr 5 02:27:01 2016 (r297572) +++ head/sys/dev/iicbus/ds1307reg.h Tue Apr 5 03:27:33 2016 (r297573) @@ -50,6 +50,7 @@ #define DS1307_YEAR_MASK 0xff #define DS1307_CONTROL 0x07 #define DS1307_CTRL_OUT (1 << 7) +#define MCP7941X_CTRL_SQWE (1 << 6) #define DS1307_CTRL_SQWE (1 << 4) #define DS1307_CTRL_RS1 (1 << 1) #define DS1307_CTRL_RS0 (1 << 0) From owner-svn-src-all@freebsd.org Tue Apr 5 05:26:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 351B7B03DAC; Tue, 5 Apr 2016 05:26:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id EB1DD15FA; Tue, 5 Apr 2016 05:26:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id IAA21233; Tue, 05 Apr 2016 08:26:14 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1anJVG-0008Go-KW; Tue, 05 Apr 2016 08:26:14 +0300 Subject: Re: svn commit: r297558 - in head/sys: kern sys x86/x86 To: Alexey Dokuchaev References: <201604041609.u34G9TCd022548@repo.freebsd.org> <20160405011446.GA41944@FreeBSD.org> Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org From: Andriy Gapon Message-ID: <57034C3E.6080404@FreeBSD.org> Date: Tue, 5 Apr 2016 08:25:18 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <20160405011446.GA41944@FreeBSD.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 05:26:24 -0000 On 05/04/2016 04:14, Alexey Dokuchaev wrote: > On Mon, Apr 04, 2016 at 04:09:29PM +0000, Andriy Gapon wrote: >> New Revision: 297558 >> URL: https://svnweb.freebsd.org/changeset/base/297558 >> >> Log: >> new x86 smp topology detection code >> >> Previously, the code determined a topology of processing units >> (hardware threads, cores, packages) and then deduced a cache topology >> using certain assumptions. The new code builds a topology that >> includes both processing units and caches using the information >> provided by the hardware. > > Good work! On a related note, would it make it easier/possible to start > thinking about if FreeBSD can export CPU cache information into userland? Yes, this was somewhere in the long to-do list in the commit message :-) > Some applications want these bits... Linux exports them via sysconf(3), > back in 2003 bms@ proposed preliminary design [1] and suggested sysctl(3). > > ./danfe > > [1] https://lists.freebsd.org/pipermail/freebsd-hackers/2003-October/003604.html > -- Andriy Gapon From owner-svn-src-all@freebsd.org Tue Apr 5 06:38:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 055ACB03266; Tue, 5 Apr 2016 06:38: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 mx1.freebsd.org (Postfix) with ESMTPS id D10A3119E; Tue, 5 Apr 2016 06:37:59 +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 u356bwRn085329; Tue, 5 Apr 2016 06:37:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u356bwDT085328; Tue, 5 Apr 2016 06:37:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604050637.u356bwDT085328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 5 Apr 2016 06:37:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297574 - stable/10/sys/dev/ipmi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 06:38:00 -0000 Author: mav Date: Tue Apr 5 06:37:58 2016 New Revision: 297574 URL: https://svnweb.freebsd.org/changeset/base/297574 Log: MFC r297179: Optimize IPMI watchdog patting. Set watchdog timer parameters only when they really need to be changed. In other cases just restart the timer with single Reset command instead of two (Set and Reset). From one side this visually reduces amount of CPU time burned in tight loop waiting while some slow BMC configures its watchdog hardware, that seems to be much more complicated task then just resetting the timer. From another side on some BMCs those slow Set commands sometimes tend to timeout, that leads to noisy log messages and even more CPU time burned, so avoiding them can provide even bigger bonuses. Modified: stable/10/sys/dev/ipmi/ipmi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ipmi/ipmi.c ============================================================================== --- stable/10/sys/dev/ipmi/ipmi.c Tue Apr 5 03:27:33 2016 (r297573) +++ stable/10/sys/dev/ipmi/ipmi.c Tue Apr 5 06:37:58 2016 (r297574) @@ -603,6 +603,20 @@ ipmi_polled_enqueue_request(struct ipmi_ */ static int +ipmi_reset_watchdog(struct ipmi_softc *sc) +{ + struct ipmi_request *req; + int error; + + IPMI_ALLOC_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0), + IPMI_RESET_WDOG, 0, 0); + error = ipmi_submit_driver_request(sc, req, 0); + if (error) + device_printf(sc->ipmi_dev, "Failed to reset watchdog\n"); + return (error); +} + +static int ipmi_set_watchdog(struct ipmi_softc *sc, unsigned int sec) { struct ipmi_request *req; @@ -613,7 +627,6 @@ ipmi_set_watchdog(struct ipmi_softc *sc, IPMI_ALLOC_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0), IPMI_SET_WDOG, 6, 0); - if (sec) { req->ir_request[0] = IPMI_SET_WD_TIMER_DONT_STOP | IPMI_SET_WD_TIMER_SMS_OS; @@ -630,24 +643,10 @@ ipmi_set_watchdog(struct ipmi_softc *sc, req->ir_request[4] = 0; req->ir_request[5] = 0; } - error = ipmi_submit_driver_request(sc, req, 0); if (error) device_printf(sc->ipmi_dev, "Failed to set watchdog\n"); - else if (sec) { - IPMI_INIT_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0), - IPMI_RESET_WDOG, 0, 0); - - error = ipmi_submit_driver_request(sc, req, 0); - if (error) - device_printf(sc->ipmi_dev, - "Failed to reset watchdog\n"); - } - return (error); - /* - dump_watchdog(sc); - */ } static void @@ -665,12 +664,24 @@ ipmi_wd_event(void *arg, unsigned int cm timeout = ((uint64_t)1 << cmd) / 1000000000; if (timeout == 0) timeout = 1; - e = ipmi_set_watchdog(sc, timeout); - if (e == 0) { - *error = 0; - sc->ipmi_watchdog_active = 1; - } else - (void)ipmi_set_watchdog(sc, 0); + if (timeout != sc->ipmi_watchdog_active) { + e = ipmi_set_watchdog(sc, timeout); + if (e == 0) { + sc->ipmi_watchdog_active = timeout; + } else { + (void)ipmi_set_watchdog(sc, 0); + sc->ipmi_watchdog_active = 0; + } + } + if (sc->ipmi_watchdog_active != 0) { + e = ipmi_reset_watchdog(sc); + if (e == 0) { + *error = 0; + } else { + (void)ipmi_set_watchdog(sc, 0); + sc->ipmi_watchdog_active = 0; + } + } } else if (atomic_readandclear_int(&sc->ipmi_watchdog_active) != 0) { e = ipmi_set_watchdog(sc, 0); if (e != 0 && cmd == 0) From owner-svn-src-all@freebsd.org Tue Apr 5 08:16:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0725B036AB; Tue, 5 Apr 2016 08:16:47 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id B6A3110F4; Tue, 5 Apr 2016 08:16:47 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id B4F7C1B2F; Tue, 5 Apr 2016 08:16:47 +0000 (UTC) Date: Tue, 5 Apr 2016 08:16:47 +0000 From: Alexey Dokuchaev To: Andriy Gapon Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r297558 - in head/sys: kern sys x86/x86 Message-ID: <20160405081647.GA40784@FreeBSD.org> References: <201604041609.u34G9TCd022548@repo.freebsd.org> <20160405011446.GA41944@FreeBSD.org> <57034C3E.6080404@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <57034C3E.6080404@FreeBSD.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 08:16:47 -0000 On Tue, Apr 05, 2016 at 08:25:18AM +0300, Andriy Gapon wrote: > On 05/04/2016 04:14, Alexey Dokuchaev wrote: > > On Mon, Apr 04, 2016 at 04:09:29PM +0000, Andriy Gapon wrote: > >> New Revision: 297558 > >> URL: https://svnweb.freebsd.org/changeset/base/297558 > >> > >> Log: > >> new x86 smp topology detection code > >> > >> Previously, the code determined a topology of processing units > >> (hardware threads, cores, packages) and then deduced a cache topology > >> using certain assumptions. The new code builds a topology that > >> includes both processing units and caches using the information > >> provided by the hardware. > > > > Good work! On a related note, would it make it easier/possible to start > > thinking about if FreeBSD can export CPU cache information into userland? > > Yes, this was somewhere in the long to-do list in the commit message :-) Ah right, missed it, sorry. Awesome, looking forward for this feature! ./danfe From owner-svn-src-all@freebsd.org Tue Apr 5 08:37:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E05E9B03F87; Tue, 5 Apr 2016 08:37:22 +0000 (UTC) (envelope-from dumbbell@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 mx1.freebsd.org (Postfix) with ESMTPS id A2D291ED8; Tue, 5 Apr 2016 08:37:22 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u358bLJY021712; Tue, 5 Apr 2016 08:37:21 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u358bLZp021710; Tue, 5 Apr 2016 08:37:21 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201604050837.u358bLZp021710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= Date: Tue, 5 Apr 2016 08:37:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297575 - in stable/10/sys/cam: ata scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 08:37:23 -0000 Author: dumbbell Date: Tue Apr 5 08:37:21 2016 New Revision: 297575 URL: https://svnweb.freebsd.org/changeset/base/297575 Log: CAM: Generalize 4k quirk to all Samsung MZ7* SSDs This adds Samsung PM851 to the list. It can be found in Lenovo Thinkpad T440 for instance. MFC of: r297370 Reviewed by: Kevin Bowling , Jason Wolfe Approved by: Kevin Bowling , Jason Wolfe Differential Revision: https://reviews.freebsd.org/D5753 Modified: stable/10/sys/cam/ata/ata_da.c stable/10/sys/cam/scsi/scsi_da.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ata/ata_da.c ============================================================================== --- stable/10/sys/cam/ata/ata_da.c Tue Apr 5 06:37:58 2016 (r297574) +++ stable/10/sys/cam/ata/ata_da.c Tue Apr 5 08:37:21 2016 (r297575) @@ -466,14 +466,6 @@ static struct ada_quirk_entry ada_quirk_ }, { /* - * Samsung 843T Series SSDs - * 4k optimised - */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG MZ7WD*", "*" }, - /*quirks*/ADA_Q_4K - }, - { - /* * Samsung 850 SSDs * 4k optimised */ @@ -482,10 +474,13 @@ static struct ada_quirk_entry ada_quirk_ }, { /* - * Samsung PM853T Series SSDs + * Samsung 843T Series SSDs (MZ7WD*) + * Samsung PM851 Series SSDs (MZ7TE*) + * Samsung PM853T Series SSDs (MZ7GE*) + * Samsung SM863 Series SSDs (MZ7KM*) * 4k optimised */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG MZ7GE*", "*" }, + { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG MZ7*", "*" }, /*quirks*/ADA_Q_4K }, { Modified: stable/10/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_da.c Tue Apr 5 06:37:58 2016 (r297574) +++ stable/10/sys/cam/scsi/scsi_da.c Tue Apr 5 08:37:21 2016 (r297575) @@ -1138,14 +1138,6 @@ static struct da_quirk_entry da_quirk_ta }, { /* - * Samsung 843T Series SSDs - * 4k optimised - */ - { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG MZ7WD*", "*" }, - /*quirks*/DA_Q_4K - }, - { - /* * Samsung 850 SSDs * 4k optimised & trim only works in 4k requests + 4k aligned */ @@ -1154,10 +1146,13 @@ static struct da_quirk_entry da_quirk_ta }, { /* - * Samsung PM853T Series SSDs + * Samsung 843T Series SSDs (MZ7WD*) + * Samsung PM851 Series SSDs (MZ7TE*) + * Samsung PM853T Series SSDs (MZ7GE*) + * Samsung SM863 Series SSDs (MZ7KM*) * 4k optimised */ - { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG MZ7GE*", "*" }, + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG MZ7*", "*" }, /*quirks*/DA_Q_4K }, { From owner-svn-src-all@freebsd.org Tue Apr 5 09:20:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB95FB0248B; Tue, 5 Apr 2016 09:20:53 +0000 (UTC) (envelope-from mmel@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 mx1.freebsd.org (Postfix) with ESMTPS id B6AE21AF9; Tue, 5 Apr 2016 09:20:53 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u359Kq7A033812; Tue, 5 Apr 2016 09:20:52 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u359Kqr6033809; Tue, 5 Apr 2016 09:20:52 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201604050920.u359Kqr6033809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Tue, 5 Apr 2016 09:20:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297576 - head/sys/arm/nvidia/tegra124 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 09:20:54 -0000 Author: mmel Date: Tue Apr 5 09:20:52 2016 New Revision: 297576 URL: https://svnweb.freebsd.org/changeset/base/297576 Log: TEGRA: Fix CPU frequency switching. The PLL_X, base CPU frequency source, doesn't have a bypass switch and thus we must use another frequency source for CPU while changing its frequency. PLL_P is ideal for this, it runs at 480MHz and CPU can be clocked at this frequency at any CPU voltage. Modified: head/sys/arm/nvidia/tegra124/tegra124_clk_pll.c head/sys/arm/nvidia/tegra124/tegra124_clk_super.c head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c Modified: head/sys/arm/nvidia/tegra124/tegra124_clk_pll.c ============================================================================== --- head/sys/arm/nvidia/tegra124/tegra124_clk_pll.c Tue Apr 5 08:37:21 2016 (r297575) +++ head/sys/arm/nvidia/tegra124/tegra124_clk_pll.c Tue Apr 5 09:20:52 2016 (r297576) @@ -823,12 +823,10 @@ pllx_set_freq(struct pll_sc *sc, uint64_ return (0); } - /* Set bypass. */ + /* PLLX doesn't have bypass, disable it first. */ RD4(sc, sc->base_reg, ®); - reg |= PLL_BASE_BYPASS; + reg &= ~PLL_BASE_ENABLE; WR4(sc, sc->base_reg, reg); - RD4(sc, sc->base_reg, ®); - DELAY(100); /* Set PLL. */ RD4(sc, sc->base_reg, ®); @@ -840,16 +838,16 @@ pllx_set_freq(struct pll_sc *sc, uint64_ RD4(sc, sc->base_reg, ®); DELAY(100); + /* Enable lock detection. */ + RD4(sc, sc->misc_reg, ®); + reg |= sc->lock_enable; + WR4(sc, sc->misc_reg, reg); + /* Enable PLL. */ RD4(sc, sc->base_reg, ®); reg |= PLL_BASE_ENABLE; WR4(sc, sc->base_reg, reg); - /* Enable lock detection */ - RD4(sc, sc->misc_reg, ®); - reg |= sc->lock_enable; - WR4(sc, sc->misc_reg, reg); - rv = wait_for_lock(sc); if (rv != 0) { /* Disable PLL */ @@ -860,10 +858,6 @@ pllx_set_freq(struct pll_sc *sc, uint64_ } RD4(sc, sc->misc_reg, ®); - /* Clear bypass. */ - RD4(sc, sc->base_reg, ®); - reg &= ~PLL_BASE_BYPASS; - WR4(sc, sc->base_reg, reg); *fout = ((fin / m) * n) / p; return (0); } Modified: head/sys/arm/nvidia/tegra124/tegra124_clk_super.c ============================================================================== --- head/sys/arm/nvidia/tegra124/tegra124_clk_super.c Tue Apr 5 08:37:21 2016 (r297575) +++ head/sys/arm/nvidia/tegra124/tegra124_clk_super.c Tue Apr 5 09:20:52 2016 (r297576) @@ -205,8 +205,7 @@ super_mux_set_mux(struct clknode *clk, i (state != SUPER_MUX_STATE_IDLE)) { panic("Unexpected super mux state: %u", state); } - - shift = state * SUPER_MUX_MUX_WIDTH; + shift = (state - 1) * SUPER_MUX_MUX_WIDTH; sc->mux = idx; if (sc->flags & SMF_HAVE_DIVIDER_2) { if (idx == sc->src_div2) { @@ -222,6 +221,7 @@ super_mux_set_mux(struct clknode *clk, i } reg &= ~(((1 << SUPER_MUX_MUX_WIDTH) - 1) << shift); reg |= idx << shift; + WR4(sc, sc->base_reg, reg); RD4(sc, sc->base_reg, &dummy); DEVICE_UNLOCK(sc); Modified: head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c ============================================================================== --- head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c Tue Apr 5 08:37:21 2016 (r297575) +++ head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c Tue Apr 5 09:20:52 2016 (r297576) @@ -335,12 +335,27 @@ set_cpu_freq(struct tegra124_cpufreq_sof if (rv != 0) return (rv); } - rv = clk_set_freq(sc->clk_cpu_g, point->freq, CLK_SET_ROUND_DOWN); + + /* Switch supermux to PLLP first */ + rv = clk_set_parent_by_clk(sc->clk_cpu_g, sc->clk_pll_p); + if (rv != 0) { + device_printf(sc->dev, "Can't set parent to PLLP\n"); + return (rv); + } + + /* Set PLLX frequency */ + rv = clk_set_freq(sc->clk_pll_x, point->freq, CLK_SET_ROUND_DOWN); if (rv != 0) { device_printf(sc->dev, "Can't set CPU clock frequency\n"); return (rv); } + rv = clk_set_parent_by_clk(sc->clk_cpu_g, sc->clk_pll_x); + if (rv != 0) { + device_printf(sc->dev, "Can't set parent to PLLX\n"); + return (rv); + } + if (sc->act_speed_point->uvolt > point->uvolt) { /* set cpu voltage */ rv = regulator_set_voltage(sc->supply_vdd_cpu, From owner-svn-src-all@freebsd.org Tue Apr 5 10:36:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 630E4B0132D; Tue, 5 Apr 2016 10:36:41 +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 mx1.freebsd.org (Postfix) with ESMTPS id 251DA12D4; Tue, 5 Apr 2016 10:36:41 +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 u35Aae12057424; Tue, 5 Apr 2016 10:36:40 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35AaelA057422; Tue, 5 Apr 2016 10:36:40 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201604051036.u35AaelA057422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 5 Apr 2016 10:36:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297577 - in head/sys: kern x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 10:36:41 -0000 Author: avg Date: Tue Apr 5 10:36:40 2016 New Revision: 297577 URL: https://svnweb.freebsd.org/changeset/base/297577 Log: x86 topo: add some comments, descriptions and references to documentation Plus a minor cosmetic change. MFC after: 1 month Modified: head/sys/kern/subr_smp.c head/sys/x86/x86/mp_x86.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Tue Apr 5 09:20:52 2016 (r297576) +++ head/sys/kern/subr_smp.c Tue Apr 5 10:36:40 2016 (r297577) @@ -53,9 +53,7 @@ __FBSDID("$FreeBSD$"); #ifdef SMP MALLOC_DEFINE(M_TOPO, "toponodes", "SMP topology data"); -#endif -#ifdef SMP volatile cpuset_t stopped_cpus; volatile cpuset_t started_cpus; volatile cpuset_t suspended_cpus; @@ -895,6 +893,10 @@ topo_init_root(struct topo_node *root) root->type = TOPO_TYPE_SYSTEM; } +/* + * Add a child node with the given ID under the given parent. + * Do nothing if there is already a child with that ID. + */ struct topo_node * topo_add_node_by_hwid(struct topo_node *parent, int hwid, topo_node_type type, uintptr_t subtype) @@ -921,6 +923,9 @@ topo_add_node_by_hwid(struct topo_node * return (node); } +/* + * Find a child node with the given ID under the given parent. + */ struct topo_node * topo_find_node_by_hwid(struct topo_node *parent, int hwid, topo_node_type type, uintptr_t subtype) @@ -938,6 +943,12 @@ topo_find_node_by_hwid(struct topo_node return (NULL); } +/* + * Given a node change the order of its parent's child nodes such + * that the node becomes the firt child while preserving the cyclic + * order of the children. In other words, the given node is promoted + * by rotation. + */ void topo_promote_child(struct topo_node *child) { @@ -959,6 +970,10 @@ topo_promote_child(struct topo_node *chi } } +/* + * Iterate to the next node in the depth-first search (traversal) of + * the topology tree. + */ struct topo_node * topo_next_node(struct topo_node *top, struct topo_node *node) { @@ -977,6 +992,10 @@ topo_next_node(struct topo_node *top, st return (NULL); } +/* + * Iterate to the next node in the depth-first search of the topology tree, + * but without descending below the current node. + */ struct topo_node * topo_next_nonchild_node(struct topo_node *top, struct topo_node *node) { @@ -992,6 +1011,10 @@ topo_next_nonchild_node(struct topo_node return (NULL); } +/* + * Assign the given ID to the given topology node that represents a logical + * processor. + */ void topo_set_pu_id(struct topo_node *node, cpuid_t id) { @@ -1013,6 +1036,14 @@ topo_set_pu_id(struct topo_node *node, c } } +/* + * Check if the topology is uniform, that is, each package has the same number + * of cores in it and each core has the same number of threads (logical + * processors) in it. If so, calculate the number of package, the number of + * cores per package and the number of logical processors per core. + * 'all' parameter tells whether to include administratively disabled logical + * processors into the analysis. + */ int topo_analyze(struct topo_node *topo_root, int all, int *pkg_count, int *cores_per_pkg, int *thrs_per_core) Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Tue Apr 5 09:20:52 2016 (r297576) +++ head/sys/x86/x86/mp_x86.c Tue Apr 5 10:36:40 2016 (r297577) @@ -176,6 +176,9 @@ mask_width(u_int x) return (fls(x << (1 - powerof2(x))) - 1); } +/* + * Add a cache level to the cache topology description. + */ static int add_deterministic_cache(int type, int level, int share_count) { @@ -217,6 +220,16 @@ add_deterministic_cache(int type, int le return (1); } +/* + * Determine topology of processing units and caches for AMD CPUs. + * See: + * - AMD CPUID Specification (Publication # 25481) + * - BKDG For AMD Family 10h Processors (Publication # 31116), section 2.15 + * - BKDG for AMD NPT Family 0Fh Processors (Publication # 32559) + * XXX At the moment the code does not recognize grouping of AMD CMT threads, + * if supported, into cores, so each thread is treated as being in its own + * core. In other words, each logical CPU is considered to be a core. + */ static void topo_probe_amd(void) { @@ -277,6 +290,15 @@ topo_probe_amd(void) } } +/* + * Determine topology of processing units for Intel CPUs + * using CPUID Leaf 1 and Leaf 4, if supported. + * See: + * - Intel 64 Architecture Processor Topology Enumeration + * - Intel 64 and IA-32 ArchitecturesSoftware Developer’s Manual, + * Volume 3A: System Programming Guide, PROGRAMMING CONSIDERATIONS + * FOR HARDWARE MULTI-THREADING CAPABLE PROCESSORS + */ static void topo_probe_intel_0x4(void) { @@ -302,6 +324,15 @@ topo_probe_intel_0x4(void) pkg_id_shift = core_id_shift + mask_width(max_cores); } +/* + * Determine topology of processing units for Intel CPUs + * using CPUID Leaf 11, if supported. + * See: + * - Intel 64 Architecture Processor Topology Enumeration + * - Intel 64 and IA-32 ArchitecturesSoftware Developer’s Manual, + * Volume 3A: System Programming Guide, PROGRAMMING CONSIDERATIONS + * FOR HARDWARE MULTI-THREADING CAPABLE PROCESSORS + */ static void topo_probe_intel_0xb(void) { @@ -342,6 +373,14 @@ topo_probe_intel_0xb(void) } } +/* + * Determine topology of caches for Intel CPUs. + * See: + * - Intel 64 Architecture Processor Topology Enumeration + * - Intel 64 and IA-32 Architectures Software Developer’s Manual + * Volume 2A: Instruction Set Reference, A-M, + * CPUID instruction + */ static void topo_probe_intel_caches(void) { @@ -376,14 +415,16 @@ topo_probe_intel_caches(void) } } +/* + * Determine topology of processing units and caches for Intel CPUs. + * See: + * - Intel 64 Architecture Processor Topology Enumeration + */ static void topo_probe_intel(void) { /* - * See Intel(R) 64 Architecture Processor - * Topology Enumeration article for details. - * * Note that 0x1 <= cpu_high < 4 case should be * compatible with topo_probe_intel_0x4() logic when * CPUID.1:EBX[23:16] > 0 (cpu_cores will be 1) @@ -640,6 +681,12 @@ cpu_mp_announce(void) } } +/* + * Add a scheduling group, a group of logical processors sharing + * a particular cache (and, thus having an affinity), to the scheduling + * topology. + * This function recursively works on lower level caches. + */ static void x86topo_add_sched_group(struct topo_node *root, struct cpu_group *cg_root) { @@ -657,6 +704,11 @@ x86topo_add_sched_group(struct topo_node else cg_root->cg_level = root->subtype; + /* + * Check how many core nodes we have under the given root node. + * If we have multiple logical processors, but not multiple + * cores, then those processors must be hardware threads. + */ ncores = 0; node = root; while (node != NULL) { @@ -673,6 +725,13 @@ x86topo_add_sched_group(struct topo_node root->cpu_count > 1 && ncores < 2) cg_root->cg_flags = CG_FLAG_SMT; + /* + * Find out how many cache nodes we have under the given root node. + * We ignore cache nodes that cover all the same processors as the + * root node. Also, we do not descend below found cache nodes. + * That is, we count top-level "non-redundant" caches under the root + * node. + */ nchildren = 0; node = root; while (node != NULL) { @@ -689,6 +748,10 @@ x86topo_add_sched_group(struct topo_node cg_root->cg_child = smp_topo_alloc(nchildren); cg_root->cg_children = nchildren; + /* + * Now find again the same cache nodes as above and recursively + * build scheduling topologies for them. + */ node = root; i = 0; while (node != NULL) { @@ -705,6 +768,9 @@ x86topo_add_sched_group(struct topo_node } } +/* + * Build the MI scheduling topology from the discovered hardware topology. + */ struct cpu_group * cpu_topo(void) { @@ -719,6 +785,9 @@ cpu_topo(void) } +/* + * Add a logical CPU to the topology. + */ void cpu_add(u_int apic_id, char boot_cpu) { From owner-svn-src-all@freebsd.org Tue Apr 5 11:30:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 987C7B03A7E; Tue, 5 Apr 2016 11:30:53 +0000 (UTC) (envelope-from trasz@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 mx1.freebsd.org (Postfix) with ESMTPS id 629441F85; Tue, 5 Apr 2016 11:30:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u35BUqkr072382; Tue, 5 Apr 2016 11:30:52 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35BUqN0072380; Tue, 5 Apr 2016 11:30:52 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201604051130.u35BUqN0072380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 5 Apr 2016 11:30:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297578 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 11:30:53 -0000 Author: trasz Date: Tue Apr 5 11:30:52 2016 New Revision: 297578 URL: https://svnweb.freebsd.org/changeset/base/297578 Log: Use proper locking macros in RACCT in RCTL. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_racct.c head/sys/kern/kern_rctl.c Modified: head/sys/kern/kern_racct.c ============================================================================== --- head/sys/kern/kern_racct.c Tue Apr 5 10:36:40 2016 (r297577) +++ head/sys/kern/kern_racct.c Tue Apr 5 11:30:52 2016 (r297578) @@ -93,6 +93,10 @@ SYSCTL_UINT(_kern_racct, OID_AUTO, pcpu_ static struct mtx racct_lock; MTX_SYSINIT(racct_lock, &racct_lock, "racct lock", MTX_DEF); +#define RACCT_LOCK() mtx_lock(&racct_lock) +#define RACCT_UNLOCK() mtx_unlock(&racct_lock) +#define RACCT_LOCK_ASSERT() mtx_assert(&racct_lock, MA_OWNED) + static uma_zone_t racct_zone; static void racct_sub_racct(struct racct *dest, const struct racct *src); @@ -391,7 +395,7 @@ racct_add_racct(struct racct *dest, cons int i; ASSERT_RACCT_ENABLED(); - mtx_assert(&racct_lock, MA_OWNED); + RACCT_LOCK_ASSERT(); /* * Update resource usage in dest. @@ -413,7 +417,7 @@ racct_sub_racct(struct racct *dest, cons int i; ASSERT_RACCT_ENABLED(); - mtx_assert(&racct_lock, MA_OWNED); + RACCT_LOCK_ASSERT(); /* * Update resource usage in dest. @@ -466,7 +470,7 @@ racct_destroy_locked(struct racct **racc SDT_PROBE1(racct, , racct, destroy, racctp); - mtx_assert(&racct_lock, MA_OWNED); + RACCT_LOCK_ASSERT(); KASSERT(racctp != NULL, ("NULL racctp")); KASSERT(*racctp != NULL, ("NULL racct")); @@ -493,9 +497,9 @@ racct_destroy(struct racct **racct) if (!racct_enable) return; - mtx_lock(&racct_lock); + RACCT_LOCK(); racct_destroy_locked(racct); - mtx_unlock(&racct_lock); + RACCT_UNLOCK(); } /* @@ -509,7 +513,7 @@ racct_adjust_resource(struct racct *racc { ASSERT_RACCT_ENABLED(); - mtx_assert(&racct_lock, MA_OWNED); + RACCT_LOCK_ASSERT(); KASSERT(racct != NULL, ("NULL racct")); racct->r_resources[resource] += amount; @@ -574,9 +578,9 @@ racct_add(struct proc *p, int resource, SDT_PROBE3(racct, , rusage, add, p, resource, amount); - mtx_lock(&racct_lock); + RACCT_LOCK(); error = racct_add_locked(p, resource, amount, 0); - mtx_unlock(&racct_lock); + RACCT_UNLOCK(); return (error); } @@ -593,9 +597,9 @@ racct_add_force(struct proc *p, int reso SDT_PROBE3(racct, , rusage, add__force, p, resource, amount); - mtx_lock(&racct_lock); + RACCT_LOCK(); racct_add_locked(p, resource, amount, 1); - mtx_unlock(&racct_lock); + RACCT_UNLOCK(); } static void @@ -625,9 +629,9 @@ racct_add_cred(struct ucred *cred, int r if (!racct_enable) return; - mtx_lock(&racct_lock); + RACCT_LOCK(); racct_add_cred_locked(cred, resource, amount); - mtx_unlock(&racct_lock); + RACCT_UNLOCK(); } static int @@ -703,9 +707,9 @@ racct_set(struct proc *p, int resource, SDT_PROBE3(racct, , rusage, set__force, p, resource, amount); - mtx_lock(&racct_lock); + RACCT_LOCK(); error = racct_set_locked(p, resource, amount, 0); - mtx_unlock(&racct_lock); + RACCT_UNLOCK(); return (error); } @@ -718,9 +722,9 @@ racct_set_force(struct proc *p, int reso SDT_PROBE3(racct, , rusage, set, p, resource, amount); - mtx_lock(&racct_lock); + RACCT_LOCK(); racct_set_locked(p, resource, amount, 1); - mtx_unlock(&racct_lock); + RACCT_UNLOCK(); } /* @@ -800,7 +804,7 @@ racct_sub(struct proc *p, int resource, KASSERT(RACCT_CAN_DROP(resource), ("%s: called for non-droppable resource %d", __func__, resource)); - mtx_lock(&racct_lock); + RACCT_LOCK(); KASSERT(amount <= p->p_racct->r_resources[resource], ("%s: freeing %ju of resource %d, which is more " "than allocated %jd for %s (pid %d)", __func__, amount, resource, @@ -808,7 +812,7 @@ racct_sub(struct proc *p, int resource, racct_adjust_resource(p->p_racct, resource, -amount); racct_sub_cred_locked(p->p_ucred, resource, amount); - mtx_unlock(&racct_lock); + RACCT_UNLOCK(); } static void @@ -843,9 +847,9 @@ racct_sub_cred(struct ucred *cred, int r if (!racct_enable) return; - mtx_lock(&racct_lock); + RACCT_LOCK(); racct_sub_cred_locked(cred, resource, amount); - mtx_unlock(&racct_lock); + RACCT_UNLOCK(); } /* @@ -866,7 +870,7 @@ racct_proc_fork(struct proc *parent, str PROC_LOCK(parent); PROC_LOCK(child); - mtx_lock(&racct_lock); + RACCT_LOCK(); #ifdef RCTL error = rctl_proc_fork(parent, child); @@ -896,7 +900,7 @@ racct_proc_fork(struct proc *parent, str error += racct_add_locked(child, RACCT_NTHR, 1, 0); out: - mtx_unlock(&racct_lock); + RACCT_UNLOCK(); PROC_UNLOCK(child); PROC_UNLOCK(parent); @@ -919,10 +923,10 @@ racct_proc_fork_done(struct proc *child) if (!racct_enable) return; - mtx_lock(&racct_lock); + RACCT_LOCK(); rctl_enforce(child, RACCT_NPROC, 0); rctl_enforce(child, RACCT_NTHR, 0); - mtx_unlock(&racct_lock); + RACCT_UNLOCK(); #endif } @@ -958,7 +962,7 @@ racct_proc_exit(struct proc *p) pct_estimate = 0; pct = racct_getpcpu(p, pct_estimate); - mtx_lock(&racct_lock); + RACCT_LOCK(); racct_set_locked(p, RACCT_CPU, runtime, 0); racct_add_cred_locked(p->p_ucred, RACCT_PCTCPU, pct); @@ -970,7 +974,7 @@ racct_proc_exit(struct proc *p) racct_set_locked(p, i, 0, 0); } - mtx_unlock(&racct_lock); + RACCT_UNLOCK(); PROC_UNLOCK(p); #ifdef RCTL @@ -1003,7 +1007,7 @@ racct_proc_ucred_changed(struct proc *p, newpr = newcred->cr_prison; oldpr = oldcred->cr_prison; - mtx_lock(&racct_lock); + RACCT_LOCK(); if (newuip != olduip) { racct_sub_racct(olduip->ui_racct, p->p_racct); racct_add_racct(newuip->ui_racct, p->p_racct); @@ -1020,7 +1024,7 @@ racct_proc_ucred_changed(struct proc *p, racct_add_racct(pr->pr_prison_racct->prr_racct, p->p_racct); } - mtx_unlock(&racct_lock); + RACCT_UNLOCK(); #ifdef RCTL rctl_proc_ucred_changed(p, newcred); @@ -1033,12 +1037,10 @@ racct_move(struct racct *dest, struct ra ASSERT_RACCT_ENABLED(); - mtx_lock(&racct_lock); - + RACCT_LOCK(); racct_add_racct(dest, src); racct_sub_racct(src, src); - - mtx_unlock(&racct_lock); + RACCT_UNLOCK(); } static void @@ -1112,7 +1114,7 @@ racct_decay_callback(struct racct *racct int64_t r_old, r_new; ASSERT_RACCT_ENABLED(); - mtx_assert(&racct_lock, MA_OWNED); + RACCT_LOCK_ASSERT(); r_old = racct->r_resources[RACCT_PCTCPU]; @@ -1128,14 +1130,14 @@ static void racct_decay_pre(void) { - mtx_lock(&racct_lock); + RACCT_LOCK(); } static void racct_decay_post(void) { - mtx_unlock(&racct_lock); + RACCT_UNLOCK(); } static void @@ -1203,13 +1205,13 @@ racctd(void) } else pct_estimate = 0; pct = racct_getpcpu(p, pct_estimate); - mtx_lock(&racct_lock); + RACCT_LOCK(); racct_set_locked(p, RACCT_PCTCPU, pct, 1); racct_set_locked(p, RACCT_CPU, runtime, 0); racct_set_locked(p, RACCT_WALLCLOCK, (uint64_t)wallclock.tv_sec * 1000000 + wallclock.tv_usec, 0); - mtx_unlock(&racct_lock); + RACCT_UNLOCK(); PROC_UNLOCK(p); } Modified: head/sys/kern/kern_rctl.c ============================================================================== --- head/sys/kern/kern_rctl.c Tue Apr 5 10:36:40 2016 (r297577) +++ head/sys/kern/kern_rctl.c Tue Apr 5 11:30:52 2016 (r297578) @@ -181,6 +181,13 @@ static uma_zone_t rctl_rule_zone; static struct rwlock rctl_lock; RW_SYSINIT(rctl_lock, &rctl_lock, "RCTL lock"); +#define RCTL_RLOCK() rw_rlock(&rctl_lock) +#define RCTL_RUNLOCK() rw_runlock(&rctl_lock) +#define RCTL_WLOCK() rw_wlock(&rctl_lock) +#define RCTL_WUNLOCK() rw_wunlock(&rctl_lock) +#define RCTL_LOCK_ASSERT() rw_assert(&rctl_lock, RA_LOCKED) +#define RCTL_WLOCK_ASSERT() rw_assert(&rctl_lock, RA_WLOCKED) + static int rctl_rule_fully_specified(const struct rctl_rule *rule); static void rctl_rule_to_sbuf(struct sbuf *sb, const struct rctl_rule *rule); @@ -231,7 +238,7 @@ rctl_proc_rule_to_racct(const struct pro struct ucred *cred = p->p_ucred; ASSERT_RACCT_ENABLED(); - rw_assert(&rctl_lock, RA_LOCKED); + RCTL_LOCK_ASSERT(); switch (rule->rr_per) { case RCTL_SUBJECT_TYPE_PROCESS: @@ -258,7 +265,7 @@ rctl_available_resource(const struct pro const struct racct *racct; ASSERT_RACCT_ENABLED(); - rw_assert(&rctl_lock, RA_LOCKED); + RCTL_LOCK_ASSERT(); racct = rctl_proc_rule_to_racct(p, rule); available = rule->rr_amount - racct->r_resources[rule->rr_resource]; @@ -277,8 +284,7 @@ rctl_would_exceed(const struct proc *p, int64_t available; ASSERT_RACCT_ENABLED(); - - rw_assert(&rctl_lock, RA_LOCKED); + RCTL_LOCK_ASSERT(); available = rctl_available_resource(p, rule); if (available >= amount) @@ -302,7 +308,7 @@ rctl_pcpu_available(const struct proc *p minavailable = INT64_MAX; limit = 0; - rw_rlock(&rctl_lock); + RCTL_RLOCK(); LIST_FOREACH(link, &p->p_racct->r_rule_links, rrl_next) { rule = link->rrl_rule; @@ -317,7 +323,7 @@ rctl_pcpu_available(const struct proc *p } } - rw_runlock(&rctl_lock); + RCTL_RUNLOCK(); /* * Return slightly less than actual value of the available @@ -352,7 +358,7 @@ rctl_enforce(struct proc *p, int resourc ASSERT_RACCT_ENABLED(); - rw_rlock(&rctl_lock); + RCTL_RLOCK(); /* * There may be more than one matching rule; go through all of them. @@ -460,7 +466,7 @@ rctl_enforce(struct proc *p, int resourc } } - rw_runlock(&rctl_lock); + RCTL_RUNLOCK(); if (should_deny) { /* @@ -482,7 +488,7 @@ rctl_get_limit(struct proc *p, int resou ASSERT_RACCT_ENABLED(); - rw_rlock(&rctl_lock); + RCTL_RLOCK(); /* * There may be more than one matching rule; go through all of them. @@ -498,7 +504,7 @@ rctl_get_limit(struct proc *p, int resou amount = rule->rr_amount; } - rw_runlock(&rctl_lock); + RCTL_RUNLOCK(); return (amount); } @@ -514,7 +520,7 @@ rctl_get_available(struct proc *p, int r ASSERT_RACCT_ENABLED(); - rw_rlock(&rctl_lock); + RCTL_RLOCK(); /* * There may be more than one matching rule; go through all of them. @@ -531,7 +537,7 @@ rctl_get_available(struct proc *p, int r minavailable = available; } - rw_runlock(&rctl_lock); + RCTL_RUNLOCK(); /* * XXX: Think about this _hard_. @@ -675,9 +681,9 @@ rctl_racct_add_rule(struct racct *racct, link->rrl_rule = rule; link->rrl_exceeded = 0; - rw_wlock(&rctl_lock); + RCTL_WLOCK(); LIST_INSERT_HEAD(&racct->r_rule_links, link, rrl_next); - rw_wunlock(&rctl_lock); + RCTL_WUNLOCK(); } static int @@ -687,7 +693,7 @@ rctl_racct_add_rule_locked(struct racct ASSERT_RACCT_ENABLED(); KASSERT(rctl_rule_fully_specified(rule), ("rule not fully specified")); - rw_assert(&rctl_lock, RA_WLOCKED); + RCTL_WLOCK_ASSERT(); link = uma_zalloc(rctl_rule_link_zone, M_NOWAIT); if (link == NULL) @@ -713,7 +719,7 @@ rctl_racct_remove_rules(struct racct *ra struct rctl_rule_link *link, *linktmp; ASSERT_RACCT_ENABLED(); - rw_assert(&rctl_lock, RA_WLOCKED); + RCTL_WLOCK_ASSERT(); LIST_FOREACH_SAFE(link, &racct->r_rule_links, rrl_next, linktmp) { if (!rctl_rule_matches(link->rrl_rule, filter)) @@ -1172,14 +1178,14 @@ static void rctl_rule_pre_callback(void) { - rw_wlock(&rctl_lock); + RCTL_WLOCK(); } static void rctl_rule_post_callback(void) { - rw_wunlock(&rctl_lock); + RCTL_WUNLOCK(); } static void @@ -1189,7 +1195,7 @@ rctl_rule_remove_callback(struct racct * int found = 0; ASSERT_RACCT_ENABLED(); - rw_assert(&rctl_lock, RA_WLOCKED); + RCTL_WLOCK_ASSERT(); found += rctl_racct_remove_rules(racct, filter); @@ -1210,9 +1216,9 @@ rctl_rule_remove(struct rctl_rule *filte if (filter->rr_subject_type == RCTL_SUBJECT_TYPE_PROCESS && filter->rr_subject.rs_proc != NULL) { p = filter->rr_subject.rs_proc; - rw_wlock(&rctl_lock); + RCTL_WLOCK(); found = rctl_racct_remove_rules(p->p_racct, filter); - rw_wunlock(&rctl_lock); + RCTL_WUNLOCK(); if (found) return (0); return (ESRCH); @@ -1229,11 +1235,11 @@ rctl_rule_remove(struct rctl_rule *filte filter, (void *)&found); sx_assert(&allproc_lock, SA_LOCKED); - rw_wlock(&rctl_lock); + RCTL_WLOCK(); FOREACH_PROC_IN_SYSTEM(p) { found += rctl_racct_remove_rules(p->p_racct, filter); } - rw_wunlock(&rctl_lock); + RCTL_WUNLOCK(); if (found) return (0); @@ -1460,7 +1466,7 @@ rctl_get_rules_callback(struct racct *ra struct sbuf *sb = (struct sbuf *)arg3; ASSERT_RACCT_ENABLED(); - rw_assert(&rctl_lock, RA_LOCKED); + RCTL_LOCK_ASSERT(); LIST_FOREACH(link, &racct->r_rule_links, rrl_next) { if (!rctl_rule_matches(link->rrl_rule, filter)) @@ -1511,7 +1517,7 @@ sys_rctl_get_rules(struct thread *td, st KASSERT(sb != NULL, ("sbuf_new failed")); FOREACH_PROC_IN_SYSTEM(p) { - rw_rlock(&rctl_lock); + RCTL_RLOCK(); LIST_FOREACH(link, &p->p_racct->r_rule_links, rrl_next) { /* * Non-process rules will be added to the buffer later. @@ -1525,7 +1531,7 @@ sys_rctl_get_rules(struct thread *td, st rctl_rule_to_sbuf(sb, link->rrl_rule); sbuf_printf(sb, ","); } - rw_runlock(&rctl_lock); + RCTL_RUNLOCK(); } loginclass_racct_foreach(rctl_get_rules_callback, @@ -1612,13 +1618,13 @@ sys_rctl_get_limits(struct thread *td, s sb = sbuf_new(NULL, buf, bufsize, SBUF_FIXEDLEN); KASSERT(sb != NULL, ("sbuf_new failed")); - rw_rlock(&rctl_lock); + RCTL_RLOCK(); LIST_FOREACH(link, &filter->rr_subject.rs_proc->p_racct->r_rule_links, rrl_next) { rctl_rule_to_sbuf(sb, link->rrl_rule); sbuf_printf(sb, ","); } - rw_runlock(&rctl_lock); + RCTL_RUNLOCK(); if (sbuf_error(sb) == ENOMEM) { error = ERANGE; goto out; @@ -1743,7 +1749,7 @@ again: * credentials. */ rulecnt = 0; - rw_rlock(&rctl_lock); + RCTL_RLOCK(); LIST_FOREACH(link, &p->p_racct->r_rule_links, rrl_next) { if (link->rrl_rule->rr_subject_type == RCTL_SUBJECT_TYPE_PROCESS) @@ -1755,7 +1761,7 @@ again: rulecnt++; LIST_FOREACH(link, &newprr->prr_racct->r_rule_links, rrl_next) rulecnt++; - rw_runlock(&rctl_lock); + RCTL_RUNLOCK(); /* * Create temporary list. We've dropped the rctl_lock in order @@ -1773,7 +1779,7 @@ again: /* * Assign rules to the newly allocated list entries. */ - rw_wlock(&rctl_lock); + RCTL_WLOCK(); LIST_FOREACH(link, &p->p_racct->r_rule_links, rrl_next) { if (link->rrl_rule->rr_subject_type == RCTL_SUBJECT_TYPE_PROCESS) { @@ -1841,13 +1847,13 @@ again: newlink, rrl_next); } - rw_wunlock(&rctl_lock); + RCTL_WUNLOCK(); return; } goaround: - rw_wunlock(&rctl_lock); + RCTL_WUNLOCK(); /* * Rule list changed while we were not holding the rctl_lock. @@ -1879,7 +1885,7 @@ rctl_proc_fork(struct proc *parent, stru ASSERT_RACCT_ENABLED(); KASSERT(parent->p_racct != NULL, ("process without racct; p = %p", parent)); - rw_wlock(&rctl_lock); + RCTL_WLOCK(); /* * Go through limits applicable to the parent and assign them @@ -1908,7 +1914,7 @@ rctl_proc_fork(struct proc *parent, stru } } - rw_wunlock(&rctl_lock); + RCTL_WUNLOCK(); return (0); fail: @@ -1918,7 +1924,7 @@ fail: rctl_rule_release(link->rrl_rule); uma_zfree(rctl_rule_link_zone, link); } - rw_wunlock(&rctl_lock); + RCTL_WUNLOCK(); return (EAGAIN); } @@ -1932,14 +1938,14 @@ rctl_racct_release(struct racct *racct) ASSERT_RACCT_ENABLED(); - rw_wlock(&rctl_lock); + RCTL_WLOCK(); while (!LIST_EMPTY(&racct->r_rule_links)) { link = LIST_FIRST(&racct->r_rule_links); LIST_REMOVE(link, rrl_next); rctl_rule_release(link->rrl_rule); uma_zfree(rctl_rule_link_zone, link); } - rw_wunlock(&rctl_lock); + RCTL_WUNLOCK(); } static void From owner-svn-src-all@freebsd.org Tue Apr 5 12:13:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F766B04E9F; Tue, 5 Apr 2016 12:13:55 +0000 (UTC) (envelope-from mmel@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 mx1.freebsd.org (Postfix) with ESMTPS id 034691A41; Tue, 5 Apr 2016 12:13:54 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u35CDsJK086993; Tue, 5 Apr 2016 12:13:54 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35CDseX086990; Tue, 5 Apr 2016 12:13:54 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201604051213.u35CDseX086990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Tue, 5 Apr 2016 12:13:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297579 - in head/sys: arm/nvidia dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 12:13:55 -0000 Author: mmel Date: Tue Apr 5 12:13:53 2016 New Revision: 297579 URL: https://svnweb.freebsd.org/changeset/base/297579 Log: ehci_interrupt is MPSAFE code. Most drivers in tree calls bus_setup_intr with MPSAFE, some are not. Fix those. Submitted by: Howard Su Differential Revision: https://reviews.freebsd.org/D5755 Modified: head/sys/arm/nvidia/tegra_ehci.c head/sys/dev/usb/controller/ehci_fsl.c head/sys/dev/usb/controller/ehci_imx.c Modified: head/sys/arm/nvidia/tegra_ehci.c ============================================================================== --- head/sys/arm/nvidia/tegra_ehci.c Tue Apr 5 11:30:52 2016 (r297578) +++ head/sys/arm/nvidia/tegra_ehci.c Tue Apr 5 12:13:53 2016 (r297579) @@ -253,8 +253,8 @@ tegra_ehci_attach(device_t dev) } /* Setup interrupt handler. */ - rv = bus_setup_intr(dev, sc->ehci_irq_res, INTR_TYPE_BIO, NULL, - (driver_intr_t *)ehci_interrupt, esc, &esc->sc_intr_hdl); + rv = bus_setup_intr(dev, sc->ehci_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + NULL, (driver_intr_t *)ehci_interrupt, esc, &esc->sc_intr_hdl); if (rv != 0) { device_printf(dev, "Could not setup IRQ\n"); goto out; Modified: head/sys/dev/usb/controller/ehci_fsl.c ============================================================================== --- head/sys/dev/usb/controller/ehci_fsl.c Tue Apr 5 11:30:52 2016 (r297578) +++ head/sys/dev/usb/controller/ehci_fsl.c Tue Apr 5 12:13:53 2016 (r297579) @@ -294,7 +294,7 @@ fsl_ehci_attach(device_t self) } /* Setup interrupt handler */ - err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO, + err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, NULL, (driver_intr_t *)ehci_interrupt, sc, &sc->sc_intr_hdl); if (err) { device_printf(self, "Could not setup irq, %d\n", err); Modified: head/sys/dev/usb/controller/ehci_imx.c ============================================================================== --- head/sys/dev/usb/controller/ehci_imx.c Tue Apr 5 11:30:52 2016 (r297578) +++ head/sys/dev/usb/controller/ehci_imx.c Tue Apr 5 12:13:53 2016 (r297579) @@ -261,8 +261,8 @@ imx_ehci_attach(device_t dev) } /* Setup interrupt handler. */ - err = bus_setup_intr(dev, sc->ehci_irq_res, INTR_TYPE_BIO, NULL, - (driver_intr_t *)ehci_interrupt, esc, &esc->sc_intr_hdl); + err = bus_setup_intr(dev, sc->ehci_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + NULL, (driver_intr_t *)ehci_interrupt, esc, &esc->sc_intr_hdl); if (err != 0) { device_printf(dev, "Could not setup IRQ\n"); goto out; From owner-svn-src-all@freebsd.org Tue Apr 5 13:37:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B1F0B032BC; Tue, 5 Apr 2016 13:37:04 +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 mx1.freebsd.org (Postfix) with ESMTPS id 62C851746; Tue, 5 Apr 2016 13:37:04 +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 u35Db3wX011376; Tue, 5 Apr 2016 13:37:03 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35Db3wj011374; Tue, 5 Apr 2016 13:37:03 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201604051337.u35Db3wj011374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus Date: Tue, 5 Apr 2016 13:37:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297580 - in head/sys/arm: broadcom/bcm2835 conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 13:37:04 -0000 Author: skra Date: Tue Apr 5 13:37:03 2016 New Revision: 297580 URL: https://svnweb.freebsd.org/changeset/base/297580 Log: Rework bcm283x interrupt controller for INTRNG and enable it on RPI-B by default. Reviewed by: gonzo Differential Revision: https://reviews.freebsd.org/D5809 Modified: head/sys/arm/broadcom/bcm2835/bcm2835_intr.c head/sys/arm/conf/RPI-B Modified: head/sys/arm/broadcom/bcm2835/bcm2835_intr.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_intr.c Tue Apr 5 12:13:53 2016 (r297579) +++ head/sys/arm/broadcom/bcm2835/bcm2835_intr.c Tue Apr 5 13:37:03 2016 (r297580) @@ -30,12 +30,15 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_platform.h" + #include #include #include #include #include #include +#include #include #include #include @@ -49,6 +52,10 @@ __FBSDID("$FreeBSD$"); #include #endif +#ifdef ARM_INTRNG +#include "pic_if.h" +#endif + #define INTC_PENDING_BASIC 0x00 #define INTC_PENDING_BANK1 0x04 #define INTC_PENDING_BANK2 0x08 @@ -60,17 +67,55 @@ __FBSDID("$FreeBSD$"); #define INTC_DISABLE_BANK2 0x20 #define INTC_DISABLE_BASIC 0x24 +#define INTC_PENDING_BASIC_ARM 0x0000FF +#define INTC_PENDING_BASIC_GPU1_PEND 0x000100 +#define INTC_PENDING_BASIC_GPU2_PEND 0x000200 +#define INTC_PENDING_BASIC_GPU1_7 0x000400 +#define INTC_PENDING_BASIC_GPU1_9 0x000800 +#define INTC_PENDING_BASIC_GPU1_10 0x001000 +#define INTC_PENDING_BASIC_GPU1_18 0x002000 +#define INTC_PENDING_BASIC_GPU1_19 0x004000 +#define INTC_PENDING_BASIC_GPU2_21 0x008000 +#define INTC_PENDING_BASIC_GPU2_22 0x010000 +#define INTC_PENDING_BASIC_GPU2_23 0x020000 +#define INTC_PENDING_BASIC_GPU2_24 0x040000 +#define INTC_PENDING_BASIC_GPU2_25 0x080000 +#define INTC_PENDING_BASIC_GPU2_30 0x100000 +#define INTC_PENDING_BASIC_MASK 0x1FFFFF + +#define INTC_PENDING_BASIC_GPU1_MASK (INTC_PENDING_BASIC_GPU1_7 | \ + INTC_PENDING_BASIC_GPU1_9 | \ + INTC_PENDING_BASIC_GPU1_10 | \ + INTC_PENDING_BASIC_GPU1_18 | \ + INTC_PENDING_BASIC_GPU1_19) + +#define INTC_PENDING_BASIC_GPU2_MASK (INTC_PENDING_BASIC_GPU2_21 | \ + INTC_PENDING_BASIC_GPU2_22 | \ + INTC_PENDING_BASIC_GPU2_23 | \ + INTC_PENDING_BASIC_GPU2_24 | \ + INTC_PENDING_BASIC_GPU2_25 | \ + INTC_PENDING_BASIC_GPU2_30) + +#define INTC_PENDING_BANK1_MASK (~((1 << 7) | (1 << 9) | (1 << 10) | \ + (1 << 18) | (1 << 19))) +#define INTC_PENDING_BANK2_MASK (~((1 << 21) | (1 << 22) | (1 << 23) | \ + (1 << 24) | (1 << 25) | (1 << 30))) + #define BANK1_START 8 #define BANK1_END (BANK1_START + 32 - 1) #define BANK2_START (BANK1_START + 32) #define BANK2_END (BANK2_START + 32 - 1) +#ifndef ARM_INTRNG #define BANK3_START (BANK2_START + 32) #define BANK3_END (BANK3_START + 32 - 1) +#endif #define IS_IRQ_BASIC(n) (((n) >= 0) && ((n) < BANK1_START)) #define IS_IRQ_BANK1(n) (((n) >= BANK1_START) && ((n) <= BANK1_END)) #define IS_IRQ_BANK2(n) (((n) >= BANK2_START) && ((n) <= BANK2_END)) +#ifndef ARM_INTRNG #define ID_IRQ_BCM2836(n) (((n) >= BANK3_START) && ((n) <= BANK3_END)) +#endif #define IRQ_BANK1(n) ((n) - BANK1_START) #define IRQ_BANK2(n) ((n) - BANK2_START) @@ -80,11 +125,28 @@ __FBSDID("$FreeBSD$"); #define dprintf(fmt, args...) #endif +#ifdef ARM_INTRNG +#define BCM_INTC_NIRQS 72 /* 8 + 32 + 32 */ + +struct bcm_intc_irqsrc { + struct intr_irqsrc bii_isrc; + u_int bii_irq; + uint16_t bii_disable_reg; + uint16_t bii_enable_reg; + uint32_t bii_mask; +}; +#endif + struct bcm_intc_softc { device_t sc_dev; struct resource * intc_res; bus_space_tag_t intc_bst; bus_space_handle_t intc_bsh; +#ifdef ARM_INTRNG + struct resource * intc_irq_res; + void * intc_irq_hdl; + struct bcm_intc_irqsrc intc_isrcs[BCM_INTC_NIRQS]; +#endif }; static struct bcm_intc_softc *bcm_intc_sc = NULL; @@ -94,6 +156,192 @@ static struct bcm_intc_softc *bcm_intc_s #define intc_write_4(_sc, reg, val) \ bus_space_write_4((_sc)->intc_bst, (_sc)->intc_bsh, (reg), (val)) +#ifdef ARM_INTRNG +static inline void +bcm_intc_isrc_mask(struct bcm_intc_softc *sc, struct bcm_intc_irqsrc *bii) +{ + + intc_write_4(sc, bii->bii_disable_reg, bii->bii_mask); +} + +static inline void +bcm_intc_isrc_unmask(struct bcm_intc_softc *sc, struct bcm_intc_irqsrc *bii) +{ + + intc_write_4(sc, bii->bii_enable_reg, bii->bii_mask); +} + +static inline int +bcm2835_intc_active_intr(struct bcm_intc_softc *sc) +{ + uint32_t pending, pending_gpu; + + pending = intc_read_4(sc, INTC_PENDING_BASIC) & INTC_PENDING_BASIC_MASK; + if (pending == 0) + return (-1); + if (pending & INTC_PENDING_BASIC_ARM) + return (ffs(pending) - 1); + if (pending & INTC_PENDING_BASIC_GPU1_MASK) { + if (pending & INTC_PENDING_BASIC_GPU1_7) + return (BANK1_START + 7); + if (pending & INTC_PENDING_BASIC_GPU1_9) + return (BANK1_START + 9); + if (pending & INTC_PENDING_BASIC_GPU1_10) + return (BANK1_START + 10); + if (pending & INTC_PENDING_BASIC_GPU1_18) + return (BANK1_START + 18); + if (pending & INTC_PENDING_BASIC_GPU1_19) + return (BANK1_START + 19); + } + if (pending & INTC_PENDING_BASIC_GPU2_MASK) { + if (pending & INTC_PENDING_BASIC_GPU2_21) + return (BANK2_START + 21); + if (pending & INTC_PENDING_BASIC_GPU2_22) + return (BANK2_START + 22); + if (pending & INTC_PENDING_BASIC_GPU2_23) + return (BANK2_START + 23); + if (pending & INTC_PENDING_BASIC_GPU2_24) + return (BANK2_START + 24); + if (pending & INTC_PENDING_BASIC_GPU2_25) + return (BANK2_START + 25); + if (pending & INTC_PENDING_BASIC_GPU2_30) + return (BANK2_START + 30); + } + if (pending & INTC_PENDING_BASIC_GPU1_PEND) { + pending_gpu = intc_read_4(sc, INTC_PENDING_BANK1); + pending_gpu &= INTC_PENDING_BANK1_MASK; + if (pending_gpu != 0) + return (BANK1_START + ffs(pending_gpu) - 1); + } + if (pending & INTC_PENDING_BASIC_GPU2_PEND) { + pending_gpu = intc_read_4(sc, INTC_PENDING_BANK2); + pending_gpu &= INTC_PENDING_BANK2_MASK; + if (pending_gpu != 0) + return (BANK2_START + ffs(pending_gpu) - 1); + } + return (-1); /* It shouldn't end here, but it's hardware. */ +} + +static int +bcm2835_intc_intr(void *arg) +{ + int irq, num; + struct bcm_intc_softc *sc = arg; + + for (num = 0; ; num++) { + irq = bcm2835_intc_active_intr(sc); + if (irq == -1) + break; + if (intr_isrc_dispatch(&sc->intc_isrcs[irq].bii_isrc, + curthread->td_intr_frame) != 0) { + bcm_intc_isrc_mask(sc, &sc->intc_isrcs[irq]); + device_printf(sc->sc_dev, "Stray irq %u disabled\n", + irq); + } + arm_irq_memory_barrier(0); /* XXX */ + } + if (num == 0) + device_printf(sc->sc_dev, "Spurious interrupt detected\n"); + + return (FILTER_HANDLED); +} + +static void +bcm_intc_enable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct bcm_intc_irqsrc *bii = (struct bcm_intc_irqsrc *)isrc; + + arm_irq_memory_barrier(bii->bii_irq); + bcm_intc_isrc_unmask(device_get_softc(dev), bii); +} + +static void +bcm_intc_disable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + + bcm_intc_isrc_mask(device_get_softc(dev), + (struct bcm_intc_irqsrc *)isrc); +} + +static int +bcm_intc_map_intr(device_t dev, struct intr_map_data *data, + struct intr_irqsrc **isrcp) +{ + u_int irq; + struct bcm_intc_softc *sc; + + if (data->type != INTR_MAP_DATA_FDT) + return (ENOTSUP); + if (data->fdt.ncells == 1) + irq = data->fdt.cells[0]; + else if (data->fdt.ncells == 2) + irq = data->fdt.cells[0] * 32 + data->fdt.cells[1]; + else + return (EINVAL); + + if (irq >= BCM_INTC_NIRQS) + return (EINVAL); + + sc = device_get_softc(dev); + *isrcp = &sc->intc_isrcs[irq].bii_isrc; + return (0); +} + +static void +bcm_intc_pre_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + + bcm_intc_disable_intr(dev, isrc); +} + +static void +bcm_intc_post_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + + bcm_intc_enable_intr(dev, isrc); +} + +static void +bcm_intc_post_filter(device_t dev, struct intr_irqsrc *isrc) +{ +} + +static int +bcm_intc_pic_register(struct bcm_intc_softc *sc, intptr_t xref) +{ + struct bcm_intc_irqsrc *bii; + int error; + uint32_t irq; + const char *name; + + name = device_get_nameunit(sc->sc_dev); + for (irq = 0; irq < BCM_INTC_NIRQS; irq++) { + bii = &sc->intc_isrcs[irq]; + bii->bii_irq = irq; + if (IS_IRQ_BASIC(irq)) { + bii->bii_disable_reg = INTC_DISABLE_BASIC; + bii->bii_enable_reg = INTC_ENABLE_BASIC; + bii->bii_mask = 1 << irq; + } else if (IS_IRQ_BANK1(irq)) { + bii->bii_disable_reg = INTC_DISABLE_BANK1; + bii->bii_enable_reg = INTC_ENABLE_BANK1; + bii->bii_mask = 1 << IRQ_BANK1(irq); + } else if (IS_IRQ_BANK2(irq)) { + bii->bii_disable_reg = INTC_DISABLE_BANK2; + bii->bii_enable_reg = INTC_ENABLE_BANK2; + bii->bii_mask = 1 << IRQ_BANK2(irq); + } else + return (ENXIO); + + error = intr_isrc_register(&bii->bii_isrc, sc->sc_dev, 0, + "%s,%u", name, irq); + if (error != 0) + return (error); + } + return (intr_pic_register(sc->sc_dev, xref)); +} +#endif + static int bcm_intc_probe(device_t dev) { @@ -112,7 +360,9 @@ bcm_intc_attach(device_t dev) { struct bcm_intc_softc *sc = device_get_softc(dev); int rid = 0; - +#ifdef ARM_INTRNG + intptr_t xref; +#endif sc->sc_dev = dev; if (bcm_intc_sc) @@ -124,6 +374,32 @@ bcm_intc_attach(device_t dev) return (ENXIO); } +#ifdef ARM_INTRNG + xref = OF_xref_from_node(ofw_bus_get_node(dev)); + if (bcm_intc_pic_register(sc, xref) != 0) { + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->intc_res); + device_printf(dev, "could not register PIC\n"); + return (ENXIO); + } + + rid = 0; + sc->intc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (sc->intc_irq_res == NULL) { + if (intr_pic_claim_root(dev, xref, bcm2835_intc_intr, sc, 0) != 0) { + /* XXX clean up */ + device_printf(dev, "could not set PIC as a root\n"); + return (ENXIO); + } + } else { + if (bus_setup_intr(dev, sc->intc_irq_res, INTR_TYPE_CLK, + bcm2835_intc_intr, NULL, sc, &sc->intc_irq_hdl)) { + /* XXX clean up */ + device_printf(dev, "could not setup irq handler\n"); + return (ENXIO); + } + } +#endif sc->intc_bst = rman_get_bustag(sc->intc_res); sc->intc_bsh = rman_get_bushandle(sc->intc_res); @@ -135,6 +411,16 @@ bcm_intc_attach(device_t dev) static device_method_t bcm_intc_methods[] = { DEVMETHOD(device_probe, bcm_intc_probe), DEVMETHOD(device_attach, bcm_intc_attach), + +#ifdef ARM_INTRNG + DEVMETHOD(pic_disable_intr, bcm_intc_disable_intr), + DEVMETHOD(pic_enable_intr, bcm_intc_enable_intr), + DEVMETHOD(pic_map_intr, bcm_intc_map_intr), + DEVMETHOD(pic_post_filter, bcm_intc_post_filter), + DEVMETHOD(pic_post_ithread, bcm_intc_post_ithread), + DEVMETHOD(pic_pre_ithread, bcm_intc_pre_ithread), +#endif + { 0, 0 } }; @@ -148,6 +434,7 @@ static devclass_t bcm_intc_devclass; DRIVER_MODULE(intc, simplebus, bcm_intc_driver, bcm_intc_devclass, 0, 0); +#ifndef ARM_INTRNG int arm_get_next_irq(int last_irq) { @@ -247,3 +534,4 @@ intr_pic_init_secondary(void) { } #endif +#endif Modified: head/sys/arm/conf/RPI-B ============================================================================== --- head/sys/arm/conf/RPI-B Tue Apr 5 12:13:53 2016 (r297579) +++ head/sys/arm/conf/RPI-B Tue Apr 5 13:37:03 2016 (r297580) @@ -24,6 +24,8 @@ include "std.armv6" include "../broadcom/bcm2835/std.rpi" include "../broadcom/bcm2835/std.bcm2835" +options ARM_INTRNG + options HZ=100 options SCHED_4BSD # 4BSD scheduler options PLATFORM From owner-svn-src-all@freebsd.org Tue Apr 5 13:41:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29464B0338C; Tue, 5 Apr 2016 13:41:53 +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 mx1.freebsd.org (Postfix) with ESMTPS id EA4711B67; Tue, 5 Apr 2016 13:41:52 +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 u35DfqUF013534; Tue, 5 Apr 2016 13:41:52 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35DfpQo013530; Tue, 5 Apr 2016 13:41:51 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201604051341.u35DfpQo013530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus Date: Tue, 5 Apr 2016 13:41:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297581 - in head/sys/arm: broadcom/bcm2835 conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 13:41:53 -0000 Author: skra Date: Tue Apr 5 13:41:51 2016 New Revision: 297581 URL: https://svnweb.freebsd.org/changeset/base/297581 Log: Implement bcm2836 interrupt controller for INTRNG and enable it on RPI2 by default. Differential Revision: https://reviews.freebsd.org/D5822 Modified: head/sys/arm/broadcom/bcm2835/bcm2836.c head/sys/arm/broadcom/bcm2835/bcm2836.h head/sys/arm/broadcom/bcm2835/bcm2836_mp.c head/sys/arm/conf/RPI2 Modified: head/sys/arm/broadcom/bcm2835/bcm2836.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2836.c Tue Apr 5 13:37:03 2016 (r297580) +++ head/sys/arm/broadcom/bcm2835/bcm2836.c Tue Apr 5 13:41:51 2016 (r297581) @@ -1,5 +1,6 @@ /* * Copyright 2015 Andrew Turner. + * Copyright 2016 Svatopluk Kraus * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,19 +29,33 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_platform.h" + #include #include #include +#include #include #include +#include #include +#ifdef SMP +#include +#endif #include +#include #include +#ifdef SMP +#include +#endif #include #include +#ifdef ARM_INTRNG +#include "pic_if.h" +#else #include #define ARM_LOCAL_BASE 0x40000000 @@ -55,7 +70,703 @@ __FBSDID("$FreeBSD$"); #define INT_PENDING_MASK 0x011f #define MAILBOX0_IRQ 4 #define MAILBOX0_IRQEN (1 << 0) +#endif + +#ifdef ARM_INTRNG +#define BCM_LINTC_CONTROL_REG 0x00 +#define BCM_LINTC_PRESCALER_REG 0x08 +#define BCM_LINTC_GPU_ROUTING_REG 0x0c +#define BCM_LINTC_PMU_ROUTING_SET_REG 0x10 +#define BCM_LINTC_PMU_ROUTING_CLR_REG 0x14 +#define BCM_LINTC_TIMER_CFG_REG(n) (0x40 + (n) * 4) +#define BCM_LINTC_MBOX_CFG_REG(n) (0x50 + (n) * 4) +#define BCM_LINTC_PENDING_REG(n) (0x60 + (n) * 4) +#define BCM_LINTC_MBOX0_SET_REG(n) (0x80 + (n) * 16) +#define BCM_LINTC_MBOX1_SET_REG(n) (0x84 + (n) * 16) +#define BCM_LINTC_MBOX2_SET_REG(n) (0x88 + (n) * 16) +#define BCM_LINTC_MBOX3_SET_REG(n) (0x8C + (n) * 16) +#define BCM_LINTC_MBOX0_CLR_REG(n) (0xC0 + (n) * 16) +#define BCM_LINTC_MBOX1_CLR_REG(n) (0xC4 + (n) * 16) +#define BCM_LINTC_MBOX2_CLR_REG(n) (0xC8 + (n) * 16) +#define BCM_LINTC_MBOX3_CLR_REG(n) (0xCC + (n) * 16) + +/* Prescaler Register */ +#define BCM_LINTC_PSR_19_2 0x80000000 /* 19.2 MHz */ + +/* GPU Interrupt Routing Register */ +#define BCM_LINTC_GIRR_IRQ_CORE(n) (n) +#define BCM_LINTC_GIRR_FIQ_CORE(n) ((n) << 2) + +/* PMU Interrupt Routing Register */ +#define BCM_LINTC_PIRR_IRQ_EN_CORE(n) (1 << (n)) +#define BCM_LINTC_PIRR_FIQ_EN_CORE(n) (1 << ((n) + 4)) + +/* Timer Config Register */ +#define BCM_LINTC_TCR_IRQ_EN_TIMER(n) (1 << (n)) +#define BCM_LINTC_TCR_FIQ_EN_TIMER(n) (1 << ((n) + 4)) + +/* MBOX Config Register */ +#define BCM_LINTC_MCR_IRQ_EN_MBOX(n) (1 << (n)) +#define BCM_LINTC_MCR_FIQ_EN_MBOX(n) (1 << ((n) + 4)) + +#define BCM_LINTC_CNTPSIRQ_IRQ 0 +#define BCM_LINTC_CNTPNSIRQ_IRQ 1 +#define BCM_LINTC_CNTHPIRQ_IRQ 2 +#define BCM_LINTC_CNTVIRQ_IRQ 3 +#define BCM_LINTC_MBOX0_IRQ 4 +#define BCM_LINTC_MBOX1_IRQ 5 +#define BCM_LINTC_MBOX2_IRQ 6 +#define BCM_LINTC_MBOX3_IRQ 7 +#define BCM_LINTC_GPU_IRQ 8 +#define BCM_LINTC_PMU_IRQ 9 +#define BCM_LINTC_AXI_IRQ 10 +#define BCM_LINTC_LTIMER_IRQ 11 + +#define BCM_LINTC_NIRQS 12 + +#define BCM_LINTC_TIMER0_IRQ BCM_LINTC_CNTPSIRQ_IRQ +#define BCM_LINTC_TIMER1_IRQ BCM_LINTC_CNTPNSIRQ_IRQ +#define BCM_LINTC_TIMER2_IRQ BCM_LINTC_CNTHPIRQ_IRQ +#define BCM_LINTC_TIMER3_IRQ BCM_LINTC_CNTVIRQ_IRQ + +#define BCM_LINTC_TIMER0_IRQ_MASK (1 << BCM_LINTC_TIMER0_IRQ) +#define BCM_LINTC_TIMER1_IRQ_MASK (1 << BCM_LINTC_TIMER1_IRQ) +#define BCM_LINTC_TIMER2_IRQ_MASK (1 << BCM_LINTC_TIMER2_IRQ) +#define BCM_LINTC_TIMER3_IRQ_MASK (1 << BCM_LINTC_TIMER3_IRQ) +#define BCM_LINTC_MBOX0_IRQ_MASK (1 << BCM_LINTC_MBOX0_IRQ) +#define BCM_LINTC_GPU_IRQ_MASK (1 << BCM_LINTC_GPU_IRQ) +#define BCM_LINTC_PMU_IRQ_MASK (1 << BCM_LINTC_PMU_IRQ) + +#define BCM_LINTC_UP_PENDING_MASK \ + (BCM_LINTC_TIMER0_IRQ_MASK | \ + BCM_LINTC_TIMER1_IRQ_MASK | \ + BCM_LINTC_TIMER2_IRQ_MASK | \ + BCM_LINTC_TIMER3_IRQ_MASK | \ + BCM_LINTC_GPU_IRQ_MASK | \ + BCM_LINTC_PMU_IRQ_MASK) + +#define BCM_LINTC_SMP_PENDING_MASK \ + (BCM_LINTC_UP_PENDING_MASK | \ + BCM_LINTC_MBOX0_IRQ_MASK) + +#ifdef SMP +#define BCM_LINTC_PENDING_MASK BCM_LINTC_SMP_PENDING_MASK +#else +#define BCM_LINTC_PENDING_MASK BCM_LINTC_UP_PENDING_MASK +#endif + +struct bcm_lintc_irqsrc { + struct intr_irqsrc bli_isrc; + u_int bli_irq; + union { + u_int bli_mask; /* for timers */ + u_int bli_value; /* for GPU */ + }; +}; + +struct bcm_lintc_softc { + device_t bls_dev; + struct mtx bls_mtx; + struct resource * bls_mem; + bus_space_tag_t bls_bst; + bus_space_handle_t bls_bsh; + struct bcm_lintc_irqsrc bls_isrcs[BCM_LINTC_NIRQS]; +}; + +static struct bcm_lintc_softc *bcm_lintc_sc; + +#ifdef SMP +#define BCM_LINTC_NIPIS 32 /* only mailbox 0 is used for IPI */ +CTASSERT(INTR_IPI_COUNT <= BCM_LINTC_NIPIS); +#endif + +#define BCM_LINTC_LOCK(sc) mtx_lock_spin(&(sc)->bls_mtx) +#define BCM_LINTC_UNLOCK(sc) mtx_unlock_spin(&(sc)->bls_mtx) +#define BCM_LINTC_LOCK_INIT(sc) mtx_init(&(sc)->bls_mtx, \ + device_get_nameunit((sc)->bls_dev), "bmc_local_intc", MTX_SPIN) +#define BCM_LINTC_LOCK_DESTROY(sc) mtx_destroy(&(sc)->bls_mtx) + +#define bcm_lintc_read_4(sc, reg) \ + bus_space_read_4((sc)->bls_bst, (sc)->bls_bsh, (reg)) +#define bcm_lintc_write_4(sc, reg, val) \ + bus_space_write_4((sc)->bls_bst, (sc)->bls_bsh, (reg), (val)) + +static inline void +bcm_lintc_rwreg_clr(struct bcm_lintc_softc *sc, uint32_t reg, + uint32_t mask) +{ + + bcm_lintc_write_4(sc, reg, bcm_lintc_read_4(sc, reg) & ~mask); +} + +static inline void +bcm_lintc_rwreg_set(struct bcm_lintc_softc *sc, uint32_t reg, + uint32_t mask) +{ + + bcm_lintc_write_4(sc, reg, bcm_lintc_read_4(sc, reg) | mask); +} + +static void +bcm_lintc_timer_mask(struct bcm_lintc_softc *sc, struct bcm_lintc_irqsrc *bli) +{ + cpuset_t *cpus; + uint32_t cpu; + + cpus = &bli->bli_isrc.isrc_cpu; + + BCM_LINTC_LOCK(sc); + for (cpu = 0; cpu < 4; cpu++) + if (CPU_ISSET(cpu, cpus)) + bcm_lintc_rwreg_clr(sc, BCM_LINTC_TIMER_CFG_REG(cpu), + bli->bli_mask); + BCM_LINTC_UNLOCK(sc); +} + +static void +bcm_lintc_timer_unmask(struct bcm_lintc_softc *sc, struct bcm_lintc_irqsrc *bli) +{ + cpuset_t *cpus; + uint32_t cpu; + + cpus = &bli->bli_isrc.isrc_cpu; + + BCM_LINTC_LOCK(sc); + for (cpu = 0; cpu < 4; cpu++) + if (CPU_ISSET(cpu, cpus)) + bcm_lintc_rwreg_set(sc, BCM_LINTC_TIMER_CFG_REG(cpu), + bli->bli_mask); + BCM_LINTC_UNLOCK(sc); +} + +static inline void +bcm_lintc_gpu_mask(struct bcm_lintc_softc *sc, struct bcm_lintc_irqsrc *bli) +{ + + /* It's accessed just and only by one core. */ + bcm_lintc_write_4(sc, BCM_LINTC_GPU_ROUTING_REG, 0); +} + +static inline void +bcm_lintc_gpu_unmask(struct bcm_lintc_softc *sc, struct bcm_lintc_irqsrc *bli) +{ + + /* It's accessed just and only by one core. */ + bcm_lintc_write_4(sc, BCM_LINTC_GPU_ROUTING_REG, bli->bli_value); +} + +static inline void +bcm_lintc_pmu_mask(struct bcm_lintc_softc *sc, struct bcm_lintc_irqsrc *bli) +{ + cpuset_t *cpus; + uint32_t cpu, mask; + + mask = 0; + cpus = &bli->bli_isrc.isrc_cpu; + + BCM_LINTC_LOCK(sc); + for (cpu = 0; cpu < 4; cpu++) + if (CPU_ISSET(cpu, cpus)) + mask |= BCM_LINTC_PIRR_IRQ_EN_CORE(cpu); + /* Write-clear register. */ + bcm_lintc_write_4(sc, BCM_LINTC_PMU_ROUTING_CLR_REG, mask); + BCM_LINTC_UNLOCK(sc); +} + +static inline void +bcm_lintc_pmu_unmask(struct bcm_lintc_softc *sc, struct bcm_lintc_irqsrc *bli) +{ + cpuset_t *cpus; + uint32_t cpu, mask; + + mask = 0; + cpus = &bli->bli_isrc.isrc_cpu; + + BCM_LINTC_LOCK(sc); + for (cpu = 0; cpu < 4; cpu++) + if (CPU_ISSET(cpu, cpus)) + mask |= BCM_LINTC_PIRR_IRQ_EN_CORE(cpu); + /* Write-set register. */ + bcm_lintc_write_4(sc, BCM_LINTC_PMU_ROUTING_SET_REG, mask); + BCM_LINTC_UNLOCK(sc); +} + +static void +bcm_lintc_mask(struct bcm_lintc_softc *sc, struct bcm_lintc_irqsrc *bli) +{ + + switch (bli->bli_irq) { + case BCM_LINTC_TIMER0_IRQ: + case BCM_LINTC_TIMER1_IRQ: + case BCM_LINTC_TIMER2_IRQ: + case BCM_LINTC_TIMER3_IRQ: + bcm_lintc_timer_mask(sc, bli); + return; + case BCM_LINTC_MBOX0_IRQ: + case BCM_LINTC_MBOX1_IRQ: + case BCM_LINTC_MBOX2_IRQ: + case BCM_LINTC_MBOX3_IRQ: + return; + case BCM_LINTC_GPU_IRQ: + bcm_lintc_gpu_mask(sc, bli); + return; + case BCM_LINTC_PMU_IRQ: + bcm_lintc_pmu_mask(sc, bli); + return; + default: + panic("%s: not implemented for irq %u", __func__, bli->bli_irq); + } +} + +static void +bcm_lintc_unmask(struct bcm_lintc_softc *sc, struct bcm_lintc_irqsrc *bli) +{ + + switch (bli->bli_irq) { + case BCM_LINTC_TIMER0_IRQ: + case BCM_LINTC_TIMER1_IRQ: + case BCM_LINTC_TIMER2_IRQ: + case BCM_LINTC_TIMER3_IRQ: + bcm_lintc_timer_unmask(sc, bli); + return; + case BCM_LINTC_MBOX0_IRQ: + case BCM_LINTC_MBOX1_IRQ: + case BCM_LINTC_MBOX2_IRQ: + case BCM_LINTC_MBOX3_IRQ: + return; + case BCM_LINTC_GPU_IRQ: + bcm_lintc_gpu_unmask(sc, bli); + return; + case BCM_LINTC_PMU_IRQ: + bcm_lintc_pmu_unmask(sc, bli); + return; + default: + panic("%s: not implemented for irq %u", __func__, bli->bli_irq); + } +} + +#ifdef SMP +static inline void +bcm_lintc_ipi_write(struct bcm_lintc_softc *sc, cpuset_t cpus, u_int ipi) +{ + u_int cpu; + uint32_t mask; + + mask = 1 << ipi; + for (cpu = 0; cpu < mp_ncpus; cpu++) + if (CPU_ISSET(cpu, &cpus)) + bcm_lintc_write_4(sc, BCM_LINTC_MBOX0_SET_REG(cpu), + mask); +} + +static inline void +bcm_lintc_ipi_dispatch(struct bcm_lintc_softc *sc, u_int cpu, + struct trapframe *tf) +{ + u_int ipi; + uint32_t mask; + + mask = bcm_lintc_read_4(sc, BCM_LINTC_MBOX0_CLR_REG(cpu)); + if (mask == 0) { + device_printf(sc->bls_dev, "Spurious ipi detected\n"); + return; + } + + for (ipi = 0; mask != 0; mask >>= 1, ipi++) { + if ((mask & 0x01) == 0) + continue; + /* + * Clear an IPI before dispatching to not miss anyone + * and make sure that it's observed by everybody. + */ + bcm_lintc_write_4(sc, BCM_LINTC_MBOX0_CLR_REG(cpu), 1 << ipi); + dsb(); + intr_ipi_dispatch(ipi, tf); + } +} +#endif + +static inline void +bcm_lintc_irq_dispatch(struct bcm_lintc_softc *sc, u_int irq, + struct trapframe *tf) +{ + struct bcm_lintc_irqsrc *bli; + + bli = &sc->bls_isrcs[irq]; + if (intr_isrc_dispatch(&bli->bli_isrc, tf) != 0) + device_printf(sc->bls_dev, "Stray irq %u detected\n", irq); +} + +static int +bcm_lintc_intr(void *arg) +{ + struct bcm_lintc_softc *sc; + u_int cpu; + uint32_t num, reg; + struct trapframe *tf; + + sc = arg; + cpu = PCPU_GET(cpuid); + tf = curthread->td_intr_frame; + + for (num = 0; ; num++) { + reg = bcm_lintc_read_4(sc, BCM_LINTC_PENDING_REG(cpu)); + if ((reg & BCM_LINTC_PENDING_MASK) == 0) + break; +#ifdef SMP + if (reg & BCM_LINTC_MBOX0_IRQ_MASK) + bcm_lintc_ipi_dispatch(sc, cpu, tf); +#endif + if (reg & BCM_LINTC_TIMER0_IRQ_MASK) + bcm_lintc_irq_dispatch(sc, BCM_LINTC_TIMER0_IRQ, tf); + if (reg & BCM_LINTC_TIMER1_IRQ_MASK) + bcm_lintc_irq_dispatch(sc, BCM_LINTC_TIMER1_IRQ, tf); + if (reg & BCM_LINTC_TIMER2_IRQ_MASK) + bcm_lintc_irq_dispatch(sc, BCM_LINTC_TIMER2_IRQ, tf); + if (reg & BCM_LINTC_TIMER3_IRQ_MASK) + bcm_lintc_irq_dispatch(sc, BCM_LINTC_TIMER3_IRQ, tf); + if (reg & BCM_LINTC_GPU_IRQ_MASK) + bcm_lintc_irq_dispatch(sc, BCM_LINTC_GPU_IRQ, tf); + if (reg & BCM_LINTC_PMU_IRQ_MASK) + bcm_lintc_irq_dispatch(sc, BCM_LINTC_PMU_IRQ, tf); + + arm_irq_memory_barrier(0); /* XXX */ + } + reg &= ~BCM_LINTC_PENDING_MASK; + if (reg != 0) + device_printf(sc->bls_dev, "Unknown interrupt(s) %x\n", reg); + else if (num == 0) + device_printf(sc->bls_dev, "Spurious interrupt detected\n"); + + return (FILTER_HANDLED); +} + +static void +bcm_lintc_disable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + + bcm_lintc_mask(device_get_softc(dev), (struct bcm_lintc_irqsrc *)isrc); +} + +static void +bcm_lintc_enable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct bcm_lintc_irqsrc *bli = (struct bcm_lintc_irqsrc *)isrc; + + arm_irq_memory_barrier(bli->bli_irq); + bcm_lintc_unmask(device_get_softc(dev), bli); +} + +static int +bcm_lintc_map_intr(device_t dev, struct intr_map_data *data, + struct intr_irqsrc **isrcp) +{ + struct bcm_lintc_softc *sc; + + if (data->type != INTR_MAP_DATA_FDT) + return (ENOTSUP); + if (data->fdt.ncells != 1 || data->fdt.cells[0] >= BCM_LINTC_NIRQS) + return (EINVAL); + + sc = device_get_softc(dev); + *isrcp = &sc->bls_isrcs[data->fdt.cells[0]].bli_isrc; + return (0); +} +static void +bcm_lintc_pre_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + struct bcm_lintc_irqsrc *bli = (struct bcm_lintc_irqsrc *)isrc; + + if (bli->bli_irq == BCM_LINTC_GPU_IRQ) + bcm_lintc_gpu_mask(device_get_softc(dev), bli); + else { + /* + * Handler for PPI interrupt does not make sense much unless + * there is one bound ithread for each core for it. Thus the + * interrupt can be masked on current core only while ithread + * bounded to this core ensures unmasking on the same core. + */ + panic ("%s: handlers are not supported", __func__); + } +} + +static void +bcm_lintc_post_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + struct bcm_lintc_irqsrc *bli = (struct bcm_lintc_irqsrc *)isrc; + + if (bli->bli_irq == BCM_LINTC_GPU_IRQ) + bcm_lintc_gpu_unmask(device_get_softc(dev), bli); + else { + /* See comment in bcm_lintc_pre_ithread(). */ + panic ("%s: handlers are not supported", __func__); + } +} + +static void +bcm_lintc_post_filter(device_t dev, struct intr_irqsrc *isrc) +{ +} + +static int +bcm_lintc_setup_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ + struct bcm_lintc_softc *sc; + + if (isrc->isrc_handlers == 0 && isrc->isrc_flags & INTR_ISRCF_PPI) { + sc = device_get_softc(dev); + BCM_LINTC_LOCK(sc); + CPU_SET(PCPU_GET(cpuid), &isrc->isrc_cpu); + BCM_LINTC_UNLOCK(sc); + } + return (0); +} + +#ifdef SMP +static bool +bcm_lint_init_on_ap(struct bcm_lintc_softc *sc, struct bcm_lintc_irqsrc *bli, + u_int cpu) +{ + struct intr_irqsrc *isrc; + + isrc = &bli->bli_isrc; + + KASSERT(isrc->isrc_flags & INTR_ISRCF_PPI, + ("%s: irq %d is not PPI", __func__, bli->bli_irq)); + + if (isrc->isrc_handlers == 0) + return (false); + if (isrc->isrc_flags & INTR_ISRCF_BOUND) + return (CPU_ISSET(cpu, &isrc->isrc_cpu)); + + CPU_SET(cpu, &isrc->isrc_cpu); + return (true); +} + +static void +bcm_lintc_init_rwreg_on_ap(struct bcm_lintc_softc *sc, u_int cpu, u_int irq, + uint32_t reg, uint32_t mask) +{ + + if (bcm_lint_init_on_ap(sc, &sc->bls_isrcs[irq], cpu)) + bcm_lintc_rwreg_set(sc, reg, mask); +} + +static void +bcm_lintc_init_pmu_on_ap(struct bcm_lintc_softc *sc, u_int cpu) +{ + + if (bcm_lint_init_on_ap(sc, &sc->bls_isrcs[BCM_LINTC_PMU_IRQ], cpu)) { + /* Write-set register. */ + bcm_lintc_write_4(sc, BCM_LINTC_PMU_ROUTING_SET_REG, + BCM_LINTC_PIRR_IRQ_EN_CORE(cpu)); + } +} + +static void +bcm_lintc_init_secondary(device_t dev) +{ + u_int cpu; + struct bcm_lintc_softc *sc; + + cpu = PCPU_GET(cpuid); + sc = device_get_softc(dev); + + BCM_LINTC_LOCK(sc); + bcm_lintc_init_rwreg_on_ap(sc, cpu, BCM_LINTC_TIMER0_IRQ, + BCM_LINTC_TIMER_CFG_REG(cpu), BCM_LINTC_TCR_IRQ_EN_TIMER(0)); + bcm_lintc_init_rwreg_on_ap(sc, cpu, BCM_LINTC_TIMER1_IRQ, + BCM_LINTC_TIMER_CFG_REG(cpu), BCM_LINTC_TCR_IRQ_EN_TIMER(1)); + bcm_lintc_init_rwreg_on_ap(sc, cpu, BCM_LINTC_TIMER2_IRQ, + BCM_LINTC_TIMER_CFG_REG(cpu), BCM_LINTC_TCR_IRQ_EN_TIMER(2)); + bcm_lintc_init_rwreg_on_ap(sc, cpu, BCM_LINTC_TIMER3_IRQ, + BCM_LINTC_TIMER_CFG_REG(cpu), BCM_LINTC_TCR_IRQ_EN_TIMER(3)); + bcm_lintc_init_pmu_on_ap(sc, cpu); + BCM_LINTC_UNLOCK(sc); +} + +static void +bcm_lintc_ipi_send(device_t dev, struct intr_irqsrc *isrc, cpuset_t cpus, + u_int ipi) +{ + struct bcm_lintc_softc *sc = device_get_softc(dev); + + KASSERT(isrc == &sc->bls_isrcs[BCM_LINTC_MBOX0_IRQ].bli_isrc, + ("%s: bad ISRC %p argument", __func__, isrc)); + bcm_lintc_ipi_write(sc, cpus, ipi); +} + +static int +bcm_lintc_ipi_setup(device_t dev, u_int ipi, struct intr_irqsrc **isrcp) +{ + struct bcm_lintc_softc *sc = device_get_softc(dev); + + KASSERT(ipi < BCM_LINTC_NIPIS, ("%s: too high ipi %u", __func__, ipi)); + + *isrcp = &sc->bls_isrcs[BCM_LINTC_MBOX0_IRQ].bli_isrc; + return (0); +} +#endif + +static int +bcm_lintc_pic_attach(struct bcm_lintc_softc *sc) +{ + struct bcm_lintc_irqsrc *bisrcs; + int error; + u_int flags; + uint32_t irq; + const char *name; + intptr_t xref; + + bisrcs = sc->bls_isrcs; + name = device_get_nameunit(sc->bls_dev); + for (irq = 0; irq < BCM_LINTC_NIRQS; irq++) { + bisrcs[irq].bli_irq = irq; + switch (irq) { + case BCM_LINTC_TIMER0_IRQ: + bisrcs[irq].bli_mask = BCM_LINTC_TCR_IRQ_EN_TIMER(0); + flags = INTR_ISRCF_PPI; + break; + case BCM_LINTC_TIMER1_IRQ: + bisrcs[irq].bli_mask = BCM_LINTC_TCR_IRQ_EN_TIMER(1); + flags = INTR_ISRCF_PPI; + break; + case BCM_LINTC_TIMER2_IRQ: + bisrcs[irq].bli_mask = BCM_LINTC_TCR_IRQ_EN_TIMER(2); + flags = INTR_ISRCF_PPI; + break; + case BCM_LINTC_TIMER3_IRQ: + bisrcs[irq].bli_mask = BCM_LINTC_TCR_IRQ_EN_TIMER(3); + flags = INTR_ISRCF_PPI; + break; + case BCM_LINTC_MBOX0_IRQ: + case BCM_LINTC_MBOX1_IRQ: + case BCM_LINTC_MBOX2_IRQ: + case BCM_LINTC_MBOX3_IRQ: + bisrcs[irq].bli_value = 0; /* not used */ + flags = INTR_ISRCF_IPI; + break; + case BCM_LINTC_GPU_IRQ: + bisrcs[irq].bli_value = BCM_LINTC_GIRR_IRQ_CORE(0); + flags = 0; + break; + case BCM_LINTC_PMU_IRQ: + bisrcs[irq].bli_value = 0; /* not used */ + flags = INTR_ISRCF_PPI; + break; + default: + bisrcs[irq].bli_value = 0; /* not used */ + flags = 0; + break; + } + + error = intr_isrc_register(&bisrcs[irq].bli_isrc, sc->bls_dev, + flags, "%s,%u", name, irq); + if (error != 0) + return (error); + } + + xref = OF_xref_from_node(ofw_bus_get_node(sc->bls_dev)); + error = intr_pic_register(sc->bls_dev, xref); + if (error != 0) + return (error); + + return (intr_pic_claim_root(sc->bls_dev, xref, bcm_lintc_intr, sc, 0)); +} + +static int +bcm_lintc_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "brcm,bcm2836-l1-intc")) + return (ENXIO); + device_set_desc(dev, "BCM2836 Interrupt Controller"); + return (BUS_PROBE_DEFAULT); +} + +static int +bcm_lintc_attach(device_t dev) +{ + struct bcm_lintc_softc *sc; + int cpu, rid; + + sc = device_get_softc(dev); + + sc->bls_dev = dev; + if (bcm_lintc_sc != NULL) + return (ENXIO); + + rid = 0; + sc->bls_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->bls_mem == NULL) { + device_printf(dev, "could not allocate memory resource\n"); + return (ENXIO); + } + + sc->bls_bst = rman_get_bustag(sc->bls_mem); + sc->bls_bsh = rman_get_bushandle(sc->bls_mem); + + bcm_lintc_write_4(sc, BCM_LINTC_CONTROL_REG, 0); + bcm_lintc_write_4(sc, BCM_LINTC_PRESCALER_REG, BCM_LINTC_PSR_19_2); + + /* Disable all timers on all cores. */ + for (cpu = 0; cpu < 4; cpu++) + bcm_lintc_write_4(sc, BCM_LINTC_TIMER_CFG_REG(cpu), 0); + +#ifdef SMP + /* Enable mailbox 0 on all cores used for IPI. */ + for (cpu = 0; cpu < 4; cpu++) + bcm_lintc_write_4(sc, BCM_LINTC_MBOX_CFG_REG(cpu), + BCM_LINTC_MCR_IRQ_EN_MBOX(0)); +#endif + + if (bcm_lintc_pic_attach(sc) != 0) { + device_printf(dev, "could not attach PIC\n"); + return (ENXIO); + } + + BCM_LINTC_LOCK_INIT(sc); + bcm_lintc_sc = sc; + return (0); +} + +static device_method_t bcm_lintc_methods[] = { + DEVMETHOD(device_probe, bcm_lintc_probe), + DEVMETHOD(device_attach, bcm_lintc_attach), + + DEVMETHOD(pic_disable_intr, bcm_lintc_disable_intr), + DEVMETHOD(pic_enable_intr, bcm_lintc_enable_intr), + DEVMETHOD(pic_map_intr, bcm_lintc_map_intr), + DEVMETHOD(pic_post_filter, bcm_lintc_post_filter), + DEVMETHOD(pic_post_ithread, bcm_lintc_post_ithread), + DEVMETHOD(pic_pre_ithread, bcm_lintc_pre_ithread), + DEVMETHOD(pic_setup_intr, bcm_lintc_setup_intr), +#ifdef SMP + DEVMETHOD(pic_init_secondary, bcm_lintc_init_secondary), + DEVMETHOD(pic_ipi_send, bcm_lintc_ipi_send), + DEVMETHOD(pic_ipi_setup, bcm_lintc_ipi_setup), +#endif + + DEVMETHOD_END +}; + +static driver_t bcm_lintc_driver = { + "local_intc", + bcm_lintc_methods, + sizeof(struct bcm_lintc_softc), +}; + +static devclass_t bcm_lintc_devclass; + +EARLY_DRIVER_MODULE(local_intc, simplebus, bcm_lintc_driver, bcm_lintc_devclass, + 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); +#else /* * A driver for features of the bcm2836. */ @@ -214,3 +925,4 @@ static driver_t bcm2836_driver = { EARLY_DRIVER_MODULE(bcm2836, nexus, bcm2836_driver, bcm2836_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); +#endif Modified: head/sys/arm/broadcom/bcm2835/bcm2836.h ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2836.h Tue Apr 5 13:37:03 2016 (r297580) +++ head/sys/arm/broadcom/bcm2835/bcm2836.h Tue Apr 5 13:41:51 2016 (r297581) @@ -30,10 +30,11 @@ #ifndef _BCM2815_BCM2836_H #define _BCM2815_BCM2836_H +#ifndef ARM_INTRNG #define BCM2836_GPU_IRQ 8 int bcm2836_get_next_irq(int); void bcm2836_mask_irq(uintptr_t); void bcm2836_unmask_irq(uintptr_t); - +#endif #endif Modified: head/sys/arm/broadcom/bcm2835/bcm2836_mp.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2836_mp.c Tue Apr 5 13:37:03 2016 (r297580) +++ head/sys/arm/broadcom/bcm2835/bcm2836_mp.c Tue Apr 5 13:41:51 2016 (r297581) @@ -139,6 +139,7 @@ platform_mp_start_ap(void) } } +#ifndef ARM_INTRNG void pic_ipi_send(cpuset_t cpus, u_int ipi) { @@ -176,3 +177,4 @@ void pic_ipi_clear(int ipi) { } +#endif Modified: head/sys/arm/conf/RPI2 ============================================================================== --- head/sys/arm/conf/RPI2 Tue Apr 5 13:37:03 2016 (r297580) +++ head/sys/arm/conf/RPI2 Tue Apr 5 13:41:51 2016 (r297581) @@ -24,6 +24,8 @@ include "std.armv6" include "../broadcom/bcm2835/std.rpi" include "../broadcom/bcm2835/std.bcm2836" +options ARM_INTRNG + options HZ=100 options SCHED_ULE # ULE scheduler options SMP # Enable multiple cores From owner-svn-src-all@freebsd.org Tue Apr 5 13:45:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DF23B03608; Tue, 5 Apr 2016 13:45:25 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0DFFA1DF2; Tue, 5 Apr 2016 13:45:24 +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 u35DjOxZ014330; Tue, 5 Apr 2016 13:45:24 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35DjONw014327; Tue, 5 Apr 2016 13:45:24 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201604051345.u35DjONw014327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus Date: Tue, 5 Apr 2016 13:45:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297582 - in head/sys: arm/broadcom/bcm2835 boot/fdt/dts/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 13:45:25 -0000 Author: skra Date: Tue Apr 5 13:45:23 2016 New Revision: 297582 URL: https://svnweb.freebsd.org/changeset/base/297582 Log: Rework BCM283x gpio interrupt controller for INTRNG. It's used on RPI-B and RPI2 where INTRNG is already enabled by default. Differential Revision: https://reviews.freebsd.org/D5810 Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c head/sys/boot/fdt/dts/arm/bcm2835.dtsi head/sys/boot/fdt/dts/arm/bcm2836.dtsi Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Tue Apr 5 13:41:51 2016 (r297581) +++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Tue Apr 5 13:45:23 2016 (r297582) @@ -28,6 +28,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_platform.h" + #include #include #include @@ -37,10 +39,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include @@ -49,6 +53,10 @@ __FBSDID("$FreeBSD$"); #include "gpio_if.h" +#ifdef ARM_INTRNG +#include "pic_if.h" +#endif + #ifdef DEBUG #define dprintf(fmt, args...) do { printf("%s(): ", __func__); \ printf(fmt,##args); } while (0) @@ -64,10 +72,10 @@ __FBSDID("$FreeBSD$"); static struct resource_spec bcm_gpio_res_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, - { SYS_RES_IRQ, 0, RF_ACTIVE }, - { SYS_RES_IRQ, 1, RF_ACTIVE }, - { SYS_RES_IRQ, 2, RF_ACTIVE }, - { SYS_RES_IRQ, 3, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE }, /* bank 0 interrupt */ + { SYS_RES_IRQ, 1, RF_ACTIVE }, /* bank 1 interrupt */ + { SYS_RES_IRQ, 2, RF_ACTIVE }, /* bank 1 interrupt (mirrored) */ + { SYS_RES_IRQ, 3, RF_ACTIVE }, /* bank 0-1 interrupt (united) */ { -1, 0, 0 } }; @@ -76,6 +84,15 @@ struct bcm_gpio_sysctl { uint32_t pin; }; +#ifdef ARM_INTRNG +struct bcm_gpio_irqsrc { + struct intr_irqsrc bgi_isrc; + uint32_t bgi_irq; + uint32_t bgi_reg; + uint32_t bgi_mask; +}; +#endif + struct bcm_gpio_softc { device_t sc_dev; device_t sc_busdev; @@ -88,10 +105,16 @@ struct bcm_gpio_softc { int sc_ro_npins; int sc_ro_pins[BCM_GPIO_PINS]; struct gpio_pin sc_gpio_pins[BCM_GPIO_PINS]; +#ifndef ARM_INTRNG struct intr_event * sc_events[BCM_GPIO_PINS]; +#endif struct bcm_gpio_sysctl sc_sysctl[BCM_GPIO_PINS]; +#ifdef ARM_INTRNG + struct bcm_gpio_irqsrc sc_isrcs[BCM_GPIO_PINS]; +#else enum intr_trigger sc_irq_trigger[BCM_GPIO_PINS]; enum intr_polarity sc_irq_polarity[BCM_GPIO_PINS]; +#endif }; enum bcm_gpio_pud { @@ -130,6 +153,13 @@ enum bcm_gpio_pud { static struct bcm_gpio_softc *bcm_gpio_sc = NULL; +#ifdef ARM_INTRNG +static int bcm_gpio_intr_bank0(void *arg); +static int bcm_gpio_intr_bank1(void *arg); +static int bcm_gpio_pic_attach(struct bcm_gpio_softc *sc); +static int bcm_gpio_pic_detach(struct bcm_gpio_softc *sc); +#endif + static int bcm_gpio_pin_is_ro(struct bcm_gpio_softc *sc, int pin) { @@ -661,6 +691,7 @@ bcm_gpio_get_reserved_pins(struct bcm_gp return (0); } +#ifndef ARM_INTRNG static int bcm_gpio_intr(void *arg) { @@ -694,6 +725,7 @@ bcm_gpio_intr(void *arg) return (FILTER_HANDLED); } +#endif static int bcm_gpio_probe(device_t dev) @@ -709,6 +741,49 @@ bcm_gpio_probe(device_t dev) return (BUS_PROBE_DEFAULT); } +#ifdef ARM_INTRNG +static int +bcm_gpio_intr_attach(device_t dev) +{ + struct bcm_gpio_softc *sc; + + /* + * Only first two interrupt lines are used. Third line is + * mirrored second line and forth line is common for all banks. + */ + sc = device_get_softc(dev); + if (sc->sc_res[1] == NULL || sc->sc_res[2] == NULL) + return (-1); + + if (bcm_gpio_pic_attach(sc) != 0) { + device_printf(dev, "unable to attach PIC\n"); + return (-1); + } + if (bus_setup_intr(dev, sc->sc_res[1], INTR_TYPE_MISC | INTR_MPSAFE, + bcm_gpio_intr_bank0, NULL, sc, &sc->sc_intrhand[0]) != 0) + return (-1); + if (bus_setup_intr(dev, sc->sc_res[2], INTR_TYPE_MISC | INTR_MPSAFE, + bcm_gpio_intr_bank1, NULL, sc, &sc->sc_intrhand[1]) != 0) + return (-1); + + return (0); +} + +static void +bcm_gpio_intr_detach(device_t dev) +{ + struct bcm_gpio_softc *sc; + + sc = device_get_softc(dev); + if (sc->sc_intrhand[0] != NULL) + bus_teardown_intr(dev, sc->sc_res[1], sc->sc_intrhand[0]); + if (sc->sc_intrhand[1] != NULL) + bus_teardown_intr(dev, sc->sc_res[2], sc->sc_intrhand[1]); + + bcm_gpio_pic_detach(sc); +} + +#else static int bcm_gpio_intr_attach(device_t dev) { @@ -741,6 +816,7 @@ bcm_gpio_intr_detach(device_t dev) } } } +#endif static int bcm_gpio_attach(device_t dev) @@ -786,9 +862,11 @@ bcm_gpio_attach(device_t dev) sc->sc_gpio_pins[i].gp_pin = j; sc->sc_gpio_pins[i].gp_caps = BCM_GPIO_DEFAULT_CAPS; sc->sc_gpio_pins[i].gp_flags = bcm_gpio_func_flag(func); +#ifndef ARM_INTRNG /* The default is active-low interrupts. */ sc->sc_irq_trigger[i] = INTR_TRIGGER_LEVEL; sc->sc_irq_polarity[i] = INTR_POLARITY_LOW; +#endif i++; } sc->sc_gpio_npins = i; @@ -814,6 +892,289 @@ bcm_gpio_detach(device_t dev) return (EBUSY); } +#ifdef ARM_INTRNG +static inline void +bcm_gpio_isrc_eoi(struct bcm_gpio_softc *sc, struct bcm_gpio_irqsrc *bgi) +{ + uint32_t bank; + + /* Write 1 to clear. */ + bank = BCM_GPIO_BANK(bgi->bgi_irq); + BCM_GPIO_WRITE(sc, BCM_GPIO_GPEDS(bank), bgi->bgi_mask); +} + +static inline bool +bcm_gpio_isrc_is_level(struct bcm_gpio_irqsrc *bgi) +{ + uint32_t bank; + + bank = BCM_GPIO_BANK(bgi->bgi_irq); + return (bgi->bgi_reg == BCM_GPIO_GPHEN(bank) || + bgi->bgi_reg == BCM_GPIO_GPLEN(bank)); +} + +static inline void +bcm_gpio_isrc_mask(struct bcm_gpio_softc *sc, struct bcm_gpio_irqsrc *bgi) +{ + + BCM_GPIO_LOCK(sc); + BCM_GPIO_CLEAR_BITS(sc, bgi->bgi_reg, bgi->bgi_mask); + BCM_GPIO_UNLOCK(bcm_gpio_sc); +} + +static inline void +bcm_gpio_isrc_unmask(struct bcm_gpio_softc *sc, struct bcm_gpio_irqsrc *bgi) +{ + + BCM_GPIO_LOCK(sc); + BCM_GPIO_SET_BITS(sc, bgi->bgi_reg, bgi->bgi_mask); + BCM_GPIO_UNLOCK(sc); +} + +static int +bcm_gpio_intr_internal(struct bcm_gpio_softc *sc, uint32_t bank) +{ + u_int irq; + struct bcm_gpio_irqsrc *bgi; + uint32_t reg; + + /* Do not care of spurious interrupt on GPIO. */ + reg = BCM_GPIO_READ(sc, BCM_GPIO_GPEDS(bank)); + while (reg != 0) { + irq = BCM_GPIO_PINS_PER_BANK * bank + ffs(reg) - 1; + bgi = sc->sc_isrcs + irq; + if (!bcm_gpio_isrc_is_level(bgi)) + bcm_gpio_isrc_eoi(sc, bgi); + if (intr_isrc_dispatch(&bgi->bgi_isrc, + curthread->td_intr_frame) != 0) { + bcm_gpio_isrc_mask(sc, bgi); + if (bcm_gpio_isrc_is_level(bgi)) + bcm_gpio_isrc_eoi(sc, bgi); + device_printf(sc->sc_dev, "Stray irq %u disabled\n", + irq); + } + reg &= ~bgi->bgi_mask; + } + return (FILTER_HANDLED); +} + +static int +bcm_gpio_intr_bank0(void *arg) +{ + + return (bcm_gpio_intr_internal(arg, 0)); +} + +static int +bcm_gpio_intr_bank1(void *arg) +{ + + return (bcm_gpio_intr_internal(arg, 1)); +} + +static int +bcm_gpio_pic_attach(struct bcm_gpio_softc *sc) +{ + int error; + uint32_t irq; + const char *name; + + name = device_get_nameunit(sc->sc_dev); + for (irq = 0; irq < BCM_GPIO_PINS; irq++) { + sc->sc_isrcs[irq].bgi_irq = irq; + sc->sc_isrcs[irq].bgi_mask = BCM_GPIO_MASK(irq); + sc->sc_isrcs[irq].bgi_reg = 0; + + error = intr_isrc_register(&sc->sc_isrcs[irq].bgi_isrc, + sc->sc_dev, 0, "%s,%u", name, irq); + if (error != 0) + return (error); /* XXX deregister ISRCs */ + } + return (intr_pic_register(sc->sc_dev, + OF_xref_from_node(ofw_bus_get_node(sc->sc_dev)))); +} + +static int +bcm_gpio_pic_detach(struct bcm_gpio_softc *sc) +{ + + /* + * There has not been established any procedure yet + * how to detach PIC from living system correctly. + */ + device_printf(sc->sc_dev, "%s: not implemented yet\n", __func__); + return (EBUSY); +} + +static void +bcm_gpio_pic_disable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct bcm_gpio_softc *sc = device_get_softc(dev); + struct bcm_gpio_irqsrc *bgi = (struct bcm_gpio_irqsrc *)isrc; + + bcm_gpio_isrc_mask(sc, bgi); +} + +static void +bcm_gpio_pic_enable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct bcm_gpio_softc *sc = device_get_softc(dev); + struct bcm_gpio_irqsrc *bgi = (struct bcm_gpio_irqsrc *)isrc; + + arm_irq_memory_barrier(bgi->bgi_irq); + bcm_gpio_isrc_unmask(sc, bgi); +} + +static int +bcm_gpio_pic_map_fdt(struct bcm_gpio_softc *sc, u_int ncells, pcell_t *cells, + u_int *irqp, uint32_t *regp) +{ + u_int irq; + uint32_t reg, bank; + + /* + * The first cell is the interrupt number. + * The second cell is used to specify flags: + * bits[3:0] trigger type and level flags: + * 1 = low-to-high edge triggered. + * 2 = high-to-low edge triggered. + * 4 = active high level-sensitive. + * 8 = active low level-sensitive. + */ + if (ncells != 2) + return (EINVAL); + + irq = cells[0]; + if (irq >= BCM_GPIO_PINS || bcm_gpio_pin_is_ro(sc, irq)) + return (EINVAL); + + /* + * All interrupt types could be set for an interrupt at one moment. + * At least, the combination of 'low-to-high' and 'high-to-low' edge + * triggered interrupt types can make a sense. However, no combo is + * supported now. + */ + bank = BCM_GPIO_BANK(irq); + if (cells[1] == 1) + reg = BCM_GPIO_GPREN(bank); + else if (cells[1] == 2) + reg = BCM_GPIO_GPFEN(bank); + else if (cells[1] == 4) + reg = BCM_GPIO_GPHEN(bank); + else if (cells[1] == 8) + reg = BCM_GPIO_GPLEN(bank); + else + return (EINVAL); + + *irqp = irq; + if (regp != NULL) + *regp = reg; + return (0); +} + +static int +bcm_gpio_pic_map_intr(device_t dev, struct intr_map_data *data, + struct intr_irqsrc **isrcp) +{ + int error; + u_int irq; + struct bcm_gpio_softc *sc; + + if (data->type != INTR_MAP_DATA_FDT) + return (ENOTSUP); + + sc = device_get_softc(dev); + error = bcm_gpio_pic_map_fdt(sc, data->fdt.ncells, data->fdt.cells, + &irq, NULL); + if (error == 0) + *isrcp = &sc->sc_isrcs[irq].bgi_isrc; + return (error); +} + +static void +bcm_gpio_pic_post_filter(device_t dev, struct intr_irqsrc *isrc) +{ + struct bcm_gpio_softc *sc = device_get_softc(dev); + struct bcm_gpio_irqsrc *bgi = (struct bcm_gpio_irqsrc *)isrc; + + if (bcm_gpio_isrc_is_level(bgi)) + bcm_gpio_isrc_eoi(sc, bgi); +} + +static void +bcm_gpio_pic_post_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + + bcm_gpio_pic_enable_intr(dev, isrc); +} + +static void +bcm_gpio_pic_pre_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + struct bcm_gpio_softc *sc = device_get_softc(dev); + struct bcm_gpio_irqsrc *bgi = (struct bcm_gpio_irqsrc *)isrc; + + bcm_gpio_isrc_mask(sc, bgi); + if (bcm_gpio_isrc_is_level(bgi)) + bcm_gpio_isrc_eoi(sc, bgi); +} + +static int +bcm_gpio_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ + u_int irq; + uint32_t bank, reg; + struct bcm_gpio_softc *sc; + struct bcm_gpio_irqsrc *bgi; + + if (data == NULL || data->type != INTR_MAP_DATA_FDT) + return (ENOTSUP); + + sc = device_get_softc(dev); + bgi = (struct bcm_gpio_irqsrc *)isrc; + + /* Get and check config for an interrupt. */ + if (bcm_gpio_pic_map_fdt(sc, data->fdt.ncells, data->fdt.cells, &irq, + ®) != 0 || bgi->bgi_irq != irq) + return (EINVAL); + + /* + * If this is a setup for another handler, + * only check that its configuration match. + */ + if (isrc->isrc_handlers != 0) + return (bgi->bgi_reg == reg ? 0 : EINVAL); + + bank = BCM_GPIO_BANK(irq); + BCM_GPIO_LOCK(sc); + BCM_GPIO_CLEAR_BITS(sc, BCM_GPIO_GPREN(bank), bgi->bgi_mask); + BCM_GPIO_CLEAR_BITS(sc, BCM_GPIO_GPFEN(bank), bgi->bgi_mask); + BCM_GPIO_CLEAR_BITS(sc, BCM_GPIO_GPHEN(bank), bgi->bgi_mask); + BCM_GPIO_CLEAR_BITS(sc, BCM_GPIO_GPLEN(bank), bgi->bgi_mask); + bgi->bgi_reg = reg; + BCM_GPIO_SET_BITS(sc, reg, bgi->bgi_mask); + BCM_GPIO_UNLOCK(sc); + return (0); +} + +static int +bcm_gpio_pic_teardown_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ + struct bcm_gpio_softc *sc = device_get_softc(dev); + struct bcm_gpio_irqsrc *bgi = (struct bcm_gpio_irqsrc *)isrc; + + if (isrc->isrc_handlers == 0) { + BCM_GPIO_LOCK(sc); + BCM_GPIO_CLEAR_BITS(sc, bgi->bgi_reg, bgi->bgi_mask); + bgi->bgi_reg = 0; + BCM_GPIO_UNLOCK(sc); + } + return (0); +} + +#else static uint32_t bcm_gpio_intr_reg(struct bcm_gpio_softc *sc, unsigned int irq, uint32_t bank) { @@ -984,6 +1345,7 @@ bcm_gpio_teardown_intr(device_t dev, dev return (err); } +#endif static phandle_t bcm_gpio_get_node(device_t bus, device_t dev) @@ -1010,13 +1372,24 @@ static device_method_t bcm_gpio_methods[ DEVMETHOD(gpio_pin_set, bcm_gpio_pin_set), DEVMETHOD(gpio_pin_toggle, bcm_gpio_pin_toggle), +#ifdef ARM_INTRNG + /* Interrupt controller interface */ + DEVMETHOD(pic_disable_intr, bcm_gpio_pic_disable_intr), + DEVMETHOD(pic_enable_intr, bcm_gpio_pic_enable_intr), + DEVMETHOD(pic_map_intr, bcm_gpio_pic_map_intr), + DEVMETHOD(pic_post_filter, bcm_gpio_pic_post_filter), + DEVMETHOD(pic_post_ithread, bcm_gpio_pic_post_ithread), + DEVMETHOD(pic_pre_ithread, bcm_gpio_pic_pre_ithread), + DEVMETHOD(pic_setup_intr, bcm_gpio_pic_setup_intr), + DEVMETHOD(pic_teardown_intr, bcm_gpio_pic_teardown_intr), +#else /* Bus interface */ DEVMETHOD(bus_activate_resource, bcm_gpio_activate_resource), DEVMETHOD(bus_deactivate_resource, bcm_gpio_deactivate_resource), DEVMETHOD(bus_config_intr, bcm_gpio_config_intr), DEVMETHOD(bus_setup_intr, bcm_gpio_setup_intr), DEVMETHOD(bus_teardown_intr, bcm_gpio_teardown_intr), - +#endif /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, bcm_gpio_get_node), Modified: head/sys/boot/fdt/dts/arm/bcm2835.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/bcm2835.dtsi Tue Apr 5 13:41:51 2016 (r297581) +++ head/sys/boot/fdt/dts/arm/bcm2835.dtsi Tue Apr 5 13:45:23 2016 (r297582) @@ -144,7 +144,7 @@ #gpio-cells = <2>; interrupt-controller; - #interrupt-cells = <1>; + #interrupt-cells = <2>; pinctrl-names = "default"; pinctrl-0 = <&pins_reserved>; Modified: head/sys/boot/fdt/dts/arm/bcm2836.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/bcm2836.dtsi Tue Apr 5 13:41:51 2016 (r297581) +++ head/sys/boot/fdt/dts/arm/bcm2836.dtsi Tue Apr 5 13:45:23 2016 (r297582) @@ -137,7 +137,7 @@ #gpio-cells = <2>; interrupt-controller; - #interrupt-cells = <1>; + #interrupt-cells = <2>; pinctrl-names = "default"; pinctrl-0 = <&pins_reserved>; From owner-svn-src-all@freebsd.org Tue Apr 5 13:47:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31895B0368E; Tue, 5 Apr 2016 13:47:08 +0000 (UTC) (envelope-from ian@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 mx1.freebsd.org (Postfix) with ESMTPS id E54EB1F88; Tue, 5 Apr 2016 13:47:07 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u35Dl7Nu014425; Tue, 5 Apr 2016 13:47:07 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35Dl7KL014424; Tue, 5 Apr 2016 13:47:07 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201604051347.u35Dl7KL014424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 5 Apr 2016 13:47:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297583 - head/sys/dev/usb/serial X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 13:47:08 -0000 Author: ian Date: Tue Apr 5 13:47:06 2016 New Revision: 297583 URL: https://svnweb.freebsd.org/changeset/base/297583 Log: Add more DPRINTF() to the ftdi driver. Now everything that can change the chip's state has a DPRINTF, with things that happen repeatedly at debug=2 level and things that happen frequently (like per-transfer IO) at debug=3. Modified: head/sys/dev/usb/serial/uftdi.c Modified: head/sys/dev/usb/serial/uftdi.c ============================================================================== --- head/sys/dev/usb/serial/uftdi.c Tue Apr 5 13:45:23 2016 (r297582) +++ head/sys/dev/usb/serial/uftdi.c Tue Apr 5 13:47:06 2016 (r297583) @@ -1178,7 +1178,7 @@ uftdi_cfg_open(struct ucom_softc *ucom) * DPRINTF() so that you can see the point at which open gets called * when debugging is enabled. */ - DPRINTF(""); + DPRINTF("\n"); } static void @@ -1190,7 +1190,7 @@ uftdi_cfg_close(struct ucom_softc *ucom) * DPRINTF() so that you can see the point at which close gets called * when debugging is enabled. */ - DPRINTF(""); + DPRINTF("\n"); } static void @@ -1202,6 +1202,8 @@ uftdi_write_callback(struct usb_xfer *xf uint32_t buflen; uint8_t buf[1]; + DPRINTFN(3, "\n"); + switch (USB_GET_STATE(xfer)) { default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -1262,6 +1264,8 @@ uftdi_read_callback(struct usb_xfer *xfe int pktmax; int offset; + DPRINTFN(3, "\n"); + usbd_xfer_status(xfer, &buflen, NULL, NULL, NULL); switch (USB_GET_STATE(xfer)) { @@ -1343,6 +1347,8 @@ uftdi_cfg_set_dtr(struct ucom_softc *uco uint16_t wValue; struct usb_device_request req; + DPRINTFN(2, "DTR=%u\n", onoff); + wValue = onoff ? FTDI_SIO_SET_DTR_HIGH : FTDI_SIO_SET_DTR_LOW; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; @@ -1362,6 +1368,8 @@ uftdi_cfg_set_rts(struct ucom_softc *uco uint16_t wValue; struct usb_device_request req; + DPRINTFN(2, "RTS=%u\n", onoff); + wValue = onoff ? FTDI_SIO_SET_RTS_HIGH : FTDI_SIO_SET_RTS_LOW; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; @@ -1381,6 +1389,8 @@ uftdi_cfg_set_break(struct ucom_softc *u uint16_t wValue; struct usb_device_request req; + DPRINTFN(2, "BREAK=%u\n", onoff); + if (onoff) { sc->sc_last_lcr |= FTDI_SIO_SET_BREAK; } else { @@ -1618,14 +1628,14 @@ uftdi_cfg_param(struct ucom_softc *ucom, struct uftdi_param_config cfg; struct usb_device_request req; + DPRINTF("\n"); + if (uftdi_set_parm_soft(ucom, t, &cfg)) { /* should not happen */ return; } sc->sc_last_lcr = cfg.lcr; - DPRINTF("\n"); - req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = FTDI_SIO_SET_BAUD_RATE; USETW(req.wValue, cfg.baud_lobits); @@ -1656,8 +1666,7 @@ uftdi_cfg_get_status(struct ucom_softc * { struct uftdi_softc *sc = ucom->sc_parent; - DPRINTF("msr=0x%02x lsr=0x%02x\n", - sc->sc_msr, sc->sc_lsr); + DPRINTFN(3, "msr=0x%02x lsr=0x%02x\n", sc->sc_msr, sc->sc_lsr); *msr = sc->sc_msr; *lsr = sc->sc_lsr; @@ -1669,6 +1678,8 @@ uftdi_reset(struct ucom_softc *ucom, int struct uftdi_softc *sc = ucom->sc_parent; usb_device_request_t req; + DPRINTFN(2, "\n"); + req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = FTDI_SIO_RESET; @@ -1686,6 +1697,8 @@ uftdi_set_bitmode(struct ucom_softc *uco usb_device_request_t req; int rv; + DPRINTFN(2, "\n"); + req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = FTDI_SIO_SET_BITMODE; @@ -1710,6 +1723,8 @@ uftdi_get_bitmode(struct ucom_softc *uco struct uftdi_softc *sc = ucom->sc_parent; usb_device_request_t req; + DPRINTFN(2, "\n"); + req.bmRequestType = UT_READ_VENDOR_DEVICE; req.bRequest = FTDI_SIO_GET_BITMODE; @@ -1727,6 +1742,8 @@ uftdi_set_latency(struct ucom_softc *uco struct uftdi_softc *sc = ucom->sc_parent; usb_device_request_t req; + DPRINTFN(2, "\n"); + if (latency < 0 || latency > 255) return (USB_ERR_INVAL); @@ -1748,6 +1765,8 @@ uftdi_get_latency(struct ucom_softc *uco usb_error_t err; uint8_t buf; + DPRINTFN(2, "\n"); + req.bmRequestType = UT_READ_VENDOR_DEVICE; req.bRequest = FTDI_SIO_GET_LATENCY; @@ -1768,6 +1787,8 @@ uftdi_set_event_char(struct ucom_softc * usb_device_request_t req; uint8_t enable; + DPRINTFN(2, "\n"); + enable = (echar == -1) ? 0 : 1; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; @@ -1787,6 +1808,8 @@ uftdi_set_error_char(struct ucom_softc * usb_device_request_t req; uint8_t enable; + DPRINTFN(2, "\n"); + enable = (echar == -1) ? 0 : 1; req.bmRequestType = UT_WRITE_VENDOR_DEVICE; @@ -1807,6 +1830,8 @@ uftdi_read_eeprom(struct ucom_softc *uco usb_error_t err; uint16_t widx, wlength, woffset; + DPRINTFN(3, "\n"); + /* Offset and length must both be evenly divisible by two. */ if ((eeio->offset | eeio->length) & 0x01) return (EINVAL); @@ -1835,6 +1860,8 @@ uftdi_write_eeprom(struct ucom_softc *uc usb_error_t err; uint16_t widx, wlength, woffset; + DPRINTFN(3, "\n"); + /* Offset and length must both be evenly divisible by two. */ if ((eeio->offset | eeio->length) & 0x01) return (EINVAL); @@ -1861,6 +1888,8 @@ uftdi_erase_eeprom(struct ucom_softc *uc usb_device_request_t req; usb_error_t err; + DPRINTFN(2, "\n"); + /* Small effort to prevent accidental erasure. */ if (confirmation != UFTDI_CONFIRM_ERASE) return (EINVAL); @@ -1883,8 +1912,6 @@ uftdi_ioctl(struct ucom_softc *ucom, uin int err; struct uftdi_bitmode * mode; - DPRINTF("portno: %d cmd: %#x\n", ucom->sc_portno, cmd); - switch (cmd) { case UFTDIIOC_RESET_IO: case UFTDIIOC_RESET_RX: From owner-svn-src-all@freebsd.org Tue Apr 5 13:56:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74740B03990; Tue, 5 Apr 2016 13:56:44 +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 mx1.freebsd.org (Postfix) with ESMTPS id 42398152F; Tue, 5 Apr 2016 13:56:44 +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 u35Duhtu017402; Tue, 5 Apr 2016 13:56:43 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35DuhPe017401; Tue, 5 Apr 2016 13:56:43 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201604051356.u35DuhPe017401@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus Date: Tue, 5 Apr 2016 13:56:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297584 - head/sys/arm/ti X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 13:56:44 -0000 Author: skra Date: Tue Apr 5 13:56:43 2016 New Revision: 297584 URL: https://svnweb.freebsd.org/changeset/base/297584 Log: Fix typo. No functional change. Modified: head/sys/arm/ti/aintc.c Modified: head/sys/arm/ti/aintc.c ============================================================================== --- head/sys/arm/ti/aintc.c Tue Apr 5 13:47:06 2016 (r297583) +++ head/sys/arm/ti/aintc.c Tue Apr 5 13:56:43 2016 (r297584) @@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$"); #define INTC_ISR_CLEAR(x) (0x94 + ((x) * 0x20)) #define INTC_SIR_SPURIOUS_MASK 0xffffff80 -#define INTS_SIR_ACTIVE_MASK 0x7f +#define INTC_SIR_ACTIVE_MASK 0x7f #define INTC_NIRQS 128 @@ -143,7 +143,7 @@ ti_aintc_intr(void *arg) } /* Only level-sensitive interrupts detection is supported. */ - irq &= INTS_SIR_ACTIVE_MASK; + irq &= INTC_SIR_ACTIVE_MASK; if (intr_isrc_dispatch(&sc->aintc_isrcs[irq].tai_isrc, curthread->td_intr_frame) != 0) { ti_aintc_irq_mask(sc, irq); From owner-svn-src-all@freebsd.org Tue Apr 5 14:41:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4C9FB045CF; Tue, 5 Apr 2016 14:41:35 +0000 (UTC) (envelope-from ume@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 mx1.freebsd.org (Postfix) with ESMTPS id 75D3E1BB7; Tue, 5 Apr 2016 14:41:35 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u35EfYfS029566; Tue, 5 Apr 2016 14:41:34 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35EfYZF029565; Tue, 5 Apr 2016 14:41:34 GMT (envelope-from ume@FreeBSD.org) Message-Id: <201604051441.u35EfYZF029565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Tue, 5 Apr 2016 14:41:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297585 - stable/10/bin/csh X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 14:41:35 -0000 Author: ume Date: Tue Apr 5 14:41:34 2016 New Revision: 297585 URL: https://svnweb.freebsd.org/changeset/base/297585 Log: MFC r295147: Make dynamic link of libiconv from ports work again. The symbols of libiconv from ports were changed to have prefixed. Since we have iconv in our libc these days, we don't need it on 10.X and later. However, 9.X still need this. Modified: stable/10/bin/csh/iconv_stub.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/csh/iconv_stub.c ============================================================================== --- stable/10/bin/csh/iconv_stub.c Tue Apr 5 13:56:43 2016 (r297584) +++ stable/10/bin/csh/iconv_stub.c Tue Apr 5 14:41:34 2016 (r297585) @@ -36,9 +36,9 @@ #undef iconv_close #define ICONVLIB "libiconv.so" -#define ICONV_ENGINE "iconv" -#define ICONV_OPEN "iconv_open" -#define ICONV_CLOSE "iconv_close" +#define ICONV_ENGINE "libiconv" +#define ICONV_OPEN "libiconv_open" +#define ICONV_CLOSE "libiconv_close" typedef iconv_t iconv_open_t(const char *, const char *); From owner-svn-src-all@freebsd.org Tue Apr 5 18:07:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B91D2B04CAD; Tue, 5 Apr 2016 18:07:14 +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 mx1.freebsd.org (Postfix) with ESMTPS id 8633C14D1; Tue, 5 Apr 2016 18:07:14 +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 u35I7DgW094307; Tue, 5 Apr 2016 18:07:13 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35I7Di1094306; Tue, 5 Apr 2016 18:07:13 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201604051807.u35I7Di1094306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 5 Apr 2016 18:07:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297587 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 18:07:14 -0000 Author: gonzo Date: Tue Apr 5 18:07:13 2016 New Revision: 297587 URL: https://svnweb.freebsd.org/changeset/base/297587 Log: Remove misleading comment. musb supports host mode for more than two years now Spotted by: jmcneill Modified: head/sys/dev/usb/controller/musb_otg.c Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Tue Apr 5 16:06:58 2016 (r297586) +++ head/sys/dev/usb/controller/musb_otg.c Tue Apr 5 18:07:13 2016 (r297587) @@ -33,7 +33,6 @@ * This file contains the driver for the Mentor Graphics Inventra USB * 2.0 High Speed Dual-Role controller. * - * NOTE: The current implementation only supports Device Side Mode! */ #ifdef USB_GLOBAL_INCLUDE_FILE From owner-svn-src-all@freebsd.org Tue Apr 5 18:27:48 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84AEFB036C9; Tue, 5 Apr 2016 18:27:48 +0000 (UTC) (envelope-from sbruno@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 mx1.freebsd.org (Postfix) with ESMTPS id 564BF12DE; Tue, 5 Apr 2016 18:27:48 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u35IRlxn000870; Tue, 5 Apr 2016 18:27:47 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35IRlwc000869; Tue, 5 Apr 2016 18:27:47 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201604051827.u35IRlwc000869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 5 Apr 2016 18:27:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297588 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 18:27:48 -0000 Author: sbruno Date: Tue Apr 5 18:27:47 2016 New Revision: 297588 URL: https://svnweb.freebsd.org/changeset/base/297588 Log: MFC r297488 Repair an overflow condition where a user could submit a string that was not getting a proper bounds check. PR: 206761 Submitted by: sson Reviewed by: cturt@hardenedbsd.org Modified: stable/10/sys/kern/imgact_binmisc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/imgact_binmisc.c ============================================================================== --- stable/10/sys/kern/imgact_binmisc.c Tue Apr 5 18:07:13 2016 (r297587) +++ stable/10/sys/kern/imgact_binmisc.c Tue Apr 5 18:27:47 2016 (r297588) @@ -1,5 +1,5 @@ -/*- - * Copyright (c) 2013, Stacey D. Son +/* + * Copyright (c) 2013-16, Stacey D. Son * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -222,16 +222,17 @@ imgact_binmisc_add_entry(ximgact_binmisc { imgact_binmisc_entry_t *ibe; char *p; + int cnt; if (xbe->xbe_msize > IBE_MAGIC_MAX) return (EINVAL); - for(p = xbe->xbe_name; *p != 0; p++) - if (!isascii((int)*p)) + for(cnt = 0, p = xbe->xbe_name; *p != 0; cnt++, p++) + if (cnt >= IBE_NAME_MAX || !isascii((int)*p)) return (EINVAL); - for(p = xbe->xbe_interpreter; *p != 0; p++) - if (!isascii((int)*p)) + for(cnt = 0, p = xbe->xbe_interpreter; *p != 0; cnt++, p++) + if (cnt >= IBE_INTERP_LEN_MAX || !isascii((int)*p)) return (EINVAL); /* Make sure we don't have any invalid #'s. */ @@ -268,8 +269,6 @@ imgact_binmisc_add_entry(ximgact_binmisc mtx_unlock(&interp_list_mtx); ibe = imgact_binmisc_new_entry(xbe); - if (!ibe) - return (ENOMEM); mtx_lock(&interp_list_mtx); SLIST_INSERT_HEAD(&interpreter_list, ibe, link); From owner-svn-src-all@freebsd.org Tue Apr 5 19:30:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40ED0B04992; Tue, 5 Apr 2016 19:30:20 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id 0EA711F66; Tue, 5 Apr 2016 19:30:19 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u35JUJ8n019143; Tue, 5 Apr 2016 19:30:19 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35JUJ5k019141; Tue, 5 Apr 2016 19:30:19 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604051930.u35JUJ5k019141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 5 Apr 2016 19:30:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297589 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 19:30:20 -0000 Author: pfg Date: Tue Apr 5 19:30:19 2016 New Revision: 297589 URL: https://svnweb.freebsd.org/changeset/base/297589 Log: bhyve: Remove unneeded variable ncq. ncq was not being inititialized properly but it was not actually necessary either, so make the code smaller by removing it. CID: 1248842 Reviewed by: grehan Modified: head/usr.sbin/bhyve/pci_ahci.c Modified: head/usr.sbin/bhyve/pci_ahci.c ============================================================================== --- head/usr.sbin/bhyve/pci_ahci.c Tue Apr 5 18:27:47 2016 (r297588) +++ head/usr.sbin/bhyve/pci_ahci.c Tue Apr 5 19:30:19 2016 (r297589) @@ -427,7 +427,6 @@ ahci_port_stop(struct ahci_port *p) struct ahci_ioreq *aior; uint8_t *cfis; int slot; - int ncq; int error; assert(pthread_mutex_isowned_np(&p->pr_sc->mtx)); @@ -445,10 +444,7 @@ ahci_port_stop(struct ahci_port *p) if (cfis[2] == ATA_WRITE_FPDMA_QUEUED || cfis[2] == ATA_READ_FPDMA_QUEUED || cfis[2] == ATA_SEND_FPDMA_QUEUED) - ncq = 1; - - if (ncq) - p->sact &= ~(1 << slot); + p->sact &= ~(1 << slot); /* NCQ */ else p->ci &= ~(1 << slot); From owner-svn-src-all@freebsd.org Tue Apr 5 20:34:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD8C3B03E9F; Tue, 5 Apr 2016 20:34:21 +0000 (UTC) (envelope-from sbruno@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 mx1.freebsd.org (Postfix) with ESMTPS id 7CF421110; Tue, 5 Apr 2016 20:34:21 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u35KYKkS040244; Tue, 5 Apr 2016 20:34:20 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35KYKQu040239; Tue, 5 Apr 2016 20:34:20 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201604052034.u35KYKQu040239@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 5 Apr 2016 20:34:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297590 - in stable/10/usr.sbin: . mpsutil X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 20:34:21 -0000 Author: sbruno Date: Tue Apr 5 20:34:20 2016 New Revision: 297590 URL: https://svnweb.freebsd.org/changeset/base/297590 Log: MFC 290102 - Include usr.sbin/mpsutil for management of mps(4) and mpr(4) utilities. - Thanks to scottl and bapt for making this happen. Submitted by: bapt scottl Reviewed by: kbowling Relnotes: yes Differential Revision: https://reviews.freebsd.org/D5529 Added: stable/10/usr.sbin/mpsutil/ stable/10/usr.sbin/mpsutil/Makefile (contents, props changed) stable/10/usr.sbin/mpsutil/mpr_ioctl.h (contents, props changed) stable/10/usr.sbin/mpsutil/mps_cmd.c (contents, props changed) stable/10/usr.sbin/mpsutil/mps_flash.c (contents, props changed) stable/10/usr.sbin/mpsutil/mps_ioctl.h (contents, props changed) stable/10/usr.sbin/mpsutil/mps_show.c (contents, props changed) stable/10/usr.sbin/mpsutil/mpsutil.8 (contents, props changed) stable/10/usr.sbin/mpsutil/mpsutil.c (contents, props changed) stable/10/usr.sbin/mpsutil/mpsutil.h (contents, props changed) Modified: stable/10/usr.sbin/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/Makefile ============================================================================== --- stable/10/usr.sbin/Makefile Tue Apr 5 19:30:19 2016 (r297589) +++ stable/10/usr.sbin/Makefile Tue Apr 5 20:34:20 2016 (r297590) @@ -46,6 +46,7 @@ SUBDIR= adduser \ mlxcontrol \ mountd \ mount_smbfs \ + mpsutil \ mptutil \ mtest \ ${_mtree} \ Added: stable/10/usr.sbin/mpsutil/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/usr.sbin/mpsutil/Makefile Tue Apr 5 20:34:20 2016 (r297590) @@ -0,0 +1,21 @@ +# $FreeBSD$ + +PROG= mpsutil +SRCS= mps_cmd.c mps_flash.c mps_show.c mpsutil.c +MAN= mpsutil.8 + +WARNS?= 3 + +#LIBADD= cam util +LINKS= ${BINDIR}/mpsutil ${BINDIR}/mprutil +MLINKS= mpsutil.8 mprutil.8 + +CFLAGS+= -I${.CURDIR}/../../sys -I. -DUSE_MPT_IOCTLS + + +# Here be dragons +.ifdef DEBUG +CFLAGS+= -DDEBUG +.endif + +.include Added: stable/10/usr.sbin/mpsutil/mpr_ioctl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/usr.sbin/mpsutil/mpr_ioctl.h Tue Apr 5 20:34:20 2016 (r297590) @@ -0,0 +1,388 @@ +/*- + * Copyright (c) 2008 Yahoo!, Inc. + * All rights reserved. + * Written by: John Baldwin + * + * 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 author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * 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. + * + * LSI MPT-Fusion Host Adapter FreeBSD userland interface + * + * $FreeBSD$ + */ +/*- + * Copyright (c) 2011-2014 LSI Corp. + * 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. + * + * LSI MPT-Fusion Host Adapter FreeBSD + * + * $FreeBSD$ + */ + +#ifndef _MPR_IOCTL_H_ +#define _MPR_IOCTL_H_ + +#include +#include +#include +#include + +/* + * For the read header requests, the header should include the page + * type or extended page type, page number, and page version. The + * buffer and length are unused. The completed header is returned in + * the 'header' member. + * + * For the read page and write page requests, 'buf' should point to a + * buffer of 'len' bytes which holds the entire page (including the + * header). + * + * All requests specify the page address in 'page_address'. + */ +struct mpr_cfg_page_req { + MPI2_CONFIG_PAGE_HEADER header; + uint32_t page_address; + void *buf; + int len; + uint16_t ioc_status; +}; + +struct mpr_ext_cfg_page_req { + MPI2_CONFIG_EXTENDED_PAGE_HEADER header; + uint32_t page_address; + void *buf; + int len; + uint16_t ioc_status; +}; + +struct mpr_raid_action { + uint8_t action; + uint8_t volume_bus; + uint8_t volume_id; + uint8_t phys_disk_num; + uint32_t action_data_word; + void *buf; + int len; + uint32_t volume_status; + uint32_t action_data[4]; + uint16_t action_status; + uint16_t ioc_status; + uint8_t write; +}; + +struct mpr_usr_command { + void *req; + uint32_t req_len; + void *rpl; + uint32_t rpl_len; + void *buf; + int len; + uint32_t flags; +}; + +typedef struct mpr_pci_bits +{ + union { + struct { + uint32_t DeviceNumber :5; + uint32_t FunctionNumber :3; + uint32_t BusNumber :24; + } bits; + uint32_t AsDWORD; + } u; + uint32_t PciSegmentId; +} mpr_pci_bits_t; + +/* + * The following is the MPRIOCTL_GET_ADAPTER_DATA data structure. This data + * structure is setup so that we hopefully are properly aligned for both + * 32-bit and 64-bit mode applications. + * + * Adapter Type - Value = 6 = SCSI Protocol through SAS-3 adapter + * + * MPI Port Number - The PCI Function number for this device + * + * PCI Device HW Id - The PCI device number for this device + * + */ +#define MPRIOCTL_ADAPTER_TYPE_SAS3 6 +typedef struct mpr_adapter_data +{ + uint32_t StructureLength; + uint32_t AdapterType; + uint32_t MpiPortNumber; + uint32_t PCIDeviceHwId; + uint32_t PCIDeviceHwRev; + uint32_t SubSystemId; + uint32_t SubsystemVendorId; + uint32_t Reserved1; + uint32_t MpiFirmwareVersion; + uint32_t BiosVersion; + uint8_t DriverVersion[32]; + uint8_t Reserved2; + uint8_t ScsiId; + uint16_t Reserved3; + mpr_pci_bits_t PciInformation; +} mpr_adapter_data_t; + + +typedef struct mpr_update_flash +{ + uint64_t PtrBuffer; + uint32_t ImageChecksum; + uint32_t ImageOffset; + uint32_t ImageSize; + uint32_t ImageType; +} mpr_update_flash_t; + + +#define MPR_PASS_THRU_DIRECTION_NONE 0 +#define MPR_PASS_THRU_DIRECTION_READ 1 +#define MPR_PASS_THRU_DIRECTION_WRITE 2 +#define MPR_PASS_THRU_DIRECTION_BOTH 3 + +typedef struct mpr_pass_thru +{ + uint64_t PtrRequest; + uint64_t PtrReply; + uint64_t PtrData; + uint32_t RequestSize; + uint32_t ReplySize; + uint32_t DataSize; + uint32_t DataDirection; + uint64_t PtrDataOut; + uint32_t DataOutSize; + uint32_t Timeout; +} mpr_pass_thru_t; + + +/* + * Event queue defines + */ +#define MPR_EVENT_QUEUE_SIZE (50) /* Max Events stored in driver */ +#define MPR_MAX_EVENT_DATA_LENGTH (48) /* Size of each event in Dwords */ + +typedef struct mpr_event_query +{ + uint16_t Entries; + uint16_t Reserved; + uint32_t Types[4]; +} mpr_event_query_t; + +typedef struct mpr_event_enable +{ + uint32_t Types[4]; +} mpr_event_enable_t; + +/* + * Event record entry for ioctl. + */ +typedef struct mpr_event_entry +{ + uint32_t Type; + uint32_t Number; + uint32_t Data[MPR_MAX_EVENT_DATA_LENGTH]; +} mpr_event_entry_t; + +typedef struct mpr_event_report +{ + uint32_t Size; + uint64_t PtrEvents; +} mpr_event_report_t; + + +typedef struct mpr_pci_info +{ + uint32_t BusNumber; + uint8_t DeviceNumber; + uint8_t FunctionNumber; + uint16_t InterruptVector; + uint8_t PciHeader[256]; +} mpr_pci_info_t; + + +typedef struct mpr_diag_action +{ + uint32_t Action; + uint32_t Length; + uint64_t PtrDiagAction; + uint32_t ReturnCode; +} mpr_diag_action_t; + +#define MPR_FW_DIAGNOSTIC_UID_NOT_FOUND (0xFF) + +#define MPR_FW_DIAG_NEW (0x806E6577) + +#define MPR_FW_DIAG_TYPE_REGISTER (0x00000001) +#define MPR_FW_DIAG_TYPE_UNREGISTER (0x00000002) +#define MPR_FW_DIAG_TYPE_QUERY (0x00000003) +#define MPR_FW_DIAG_TYPE_READ_BUFFER (0x00000004) +#define MPR_FW_DIAG_TYPE_RELEASE (0x00000005) + +#define MPR_FW_DIAG_INVALID_UID (0x00000000) + +#define MPR_DIAG_SUCCESS 0 +#define MPR_DIAG_FAILURE 1 + +#define MPR_FW_DIAG_ERROR_SUCCESS (0x00000000) +#define MPR_FW_DIAG_ERROR_FAILURE (0x00000001) +#define MPR_FW_DIAG_ERROR_INVALID_PARAMETER (0x00000002) +#define MPR_FW_DIAG_ERROR_POST_FAILED (0x00000010) +#define MPR_FW_DIAG_ERROR_INVALID_UID (0x00000011) +#define MPR_FW_DIAG_ERROR_RELEASE_FAILED (0x00000012) +#define MPR_FW_DIAG_ERROR_NO_BUFFER (0x00000013) +#define MPR_FW_DIAG_ERROR_ALREADY_RELEASED (0x00000014) + + +typedef struct mpr_fw_diag_register +{ + uint8_t ExtendedType; + uint8_t BufferType; + uint16_t ApplicationFlags; + uint32_t DiagnosticFlags; + uint32_t ProductSpecific[23]; + uint32_t RequestedBufferSize; + uint32_t UniqueId; +} mpr_fw_diag_register_t; + +typedef struct mpr_fw_diag_unregister +{ + uint32_t UniqueId; +} mpr_fw_diag_unregister_t; + +#define MPR_FW_DIAG_FLAG_APP_OWNED (0x0001) +#define MPR_FW_DIAG_FLAG_BUFFER_VALID (0x0002) +#define MPR_FW_DIAG_FLAG_FW_BUFFER_ACCESS (0x0004) + +typedef struct mpr_fw_diag_query +{ + uint8_t ExtendedType; + uint8_t BufferType; + uint16_t ApplicationFlags; + uint32_t DiagnosticFlags; + uint32_t ProductSpecific[23]; + uint32_t TotalBufferSize; + uint32_t DriverAddedBufferSize; + uint32_t UniqueId; +} mpr_fw_diag_query_t; + +typedef struct mpr_fw_diag_release +{ + uint32_t UniqueId; +} mpr_fw_diag_release_t; + +#define MPR_FW_DIAG_FLAG_REREGISTER (0x0001) +#define MPR_FW_DIAG_FLAG_FORCE_RELEASE (0x0002) + +typedef struct mpr_diag_read_buffer +{ + uint8_t Status; + uint8_t Reserved; + uint16_t Flags; + uint32_t StartingOffset; + uint32_t BytesToRead; + uint32_t UniqueId; + uint64_t PtrDataBuffer; +} mpr_diag_read_buffer_t; + +/* + * Register Access + */ +#define REG_IO_READ 1 +#define REG_IO_WRITE 2 +#define REG_MEM_READ 3 +#define REG_MEM_WRITE 4 + +typedef struct mpr_reg_access +{ + uint32_t Command; + uint32_t RegOffset; + uint32_t RegData; +} mpr_reg_access_t; + +typedef struct mpr_btdh_mapping +{ + uint16_t TargetID; + uint16_t Bus; + uint16_t DevHandle; + uint16_t Reserved; +} mpr_btdh_mapping_t; + +#define MPRIO_MPR_COMMAND_FLAG_VERBOSE 0x01 +#define MPRIO_MPR_COMMAND_FLAG_DEBUG 0x02 +#define MPRIO_READ_CFG_HEADER _IOWR('M', 200, struct mpr_cfg_page_req) +#define MPRIO_READ_CFG_PAGE _IOWR('M', 201, struct mpr_cfg_page_req) +#define MPRIO_READ_EXT_CFG_HEADER _IOWR('M', 202, struct mpr_ext_cfg_page_req) +#define MPRIO_READ_EXT_CFG_PAGE _IOWR('M', 203, struct mpr_ext_cfg_page_req) +#define MPRIO_WRITE_CFG_PAGE _IOWR('M', 204, struct mpr_cfg_page_req) +#define MPRIO_RAID_ACTION _IOWR('M', 205, struct mpr_raid_action) +#define MPRIO_MPR_COMMAND _IOWR('M', 210, struct mpr_usr_command) + +#ifndef MPTIOCTL +#define MPTIOCTL ('I') +#define MPTIOCTL_GET_ADAPTER_DATA _IOWR(MPTIOCTL, 1,\ + struct mpr_adapter_data) +#define MPTIOCTL_UPDATE_FLASH _IOWR(MPTIOCTL, 2,\ + struct mpr_update_flash) +#define MPTIOCTL_RESET_ADAPTER _IO(MPTIOCTL, 3) +#define MPTIOCTL_PASS_THRU _IOWR(MPTIOCTL, 4,\ + struct mpr_pass_thru) +#define MPTIOCTL_EVENT_QUERY _IOWR(MPTIOCTL, 5,\ + struct mpr_event_query) +#define MPTIOCTL_EVENT_ENABLE _IOWR(MPTIOCTL, 6,\ + struct mpr_event_enable) +#define MPTIOCTL_EVENT_REPORT _IOWR(MPTIOCTL, 7,\ + struct mpr_event_report) +#define MPTIOCTL_GET_PCI_INFO _IOWR(MPTIOCTL, 8,\ + struct mpr_pci_info) +#define MPTIOCTL_DIAG_ACTION _IOWR(MPTIOCTL, 9,\ + struct mpr_diag_action) +#define MPTIOCTL_REG_ACCESS _IOWR(MPTIOCTL, 10,\ + struct mpr_reg_access) +#define MPTIOCTL_BTDH_MAPPING _IOWR(MPTIOCTL, 11,\ + struct mpr_btdh_mapping) +#endif + +#endif /* !_MPR_IOCTL_H_ */ Added: stable/10/usr.sbin/mpsutil/mps_cmd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/usr.sbin/mpsutil/mps_cmd.c Tue Apr 5 20:34:20 2016 (r297590) @@ -0,0 +1,731 @@ +/*- + * Copyright (c) 2015 Baptiste Daroussin + * + * Copyright (c) 2015 Netflix, Inc. + * All rights reserved. + * Written by: Scott Long + * + * Copyright (c) 2008 Yahoo!, Inc. + * All rights reserved. + * Written by: John Baldwin + * + * 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 author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * 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 +__RCSID("$FreeBSD$"); + +#include +#include +#include +#if 0 +#include +#else +#include "mps_ioctl.h" +#include "mpr_ioctl.h" +#endif +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "mpsutil.h" + +#ifndef USE_MPT_IOCTLS +#define USE_MPT_IOCTLS +#endif + +static const char *mps_ioc_status_codes[] = { + "Success", /* 0x0000 */ + "Invalid function", + "Busy", + "Invalid scatter-gather list", + "Internal error", + "Reserved", + "Insufficient resources", + "Invalid field", + "Invalid state", /* 0x0008 */ + "Operation state not supported", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0010 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0018 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Invalid configuration action", /* 0x0020 */ + "Invalid configuration type", + "Invalid configuration page", + "Invalid configuration data", + "No configuration defaults", + "Unable to commit configuration change", + NULL, + NULL, + NULL, /* 0x0028 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0030 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0038 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Recovered SCSI error", /* 0x0040 */ + "Invalid SCSI bus", + "Invalid SCSI target ID", + "SCSI device not there", + "SCSI data overrun", + "SCSI data underrun", + "SCSI I/O error", + "SCSI protocol error", + "SCSI task terminated", /* 0x0048 */ + "SCSI residual mismatch", + "SCSI task management failed", + "SCSI I/O controller terminated", + "SCSI external controller terminated", + "EEDP guard error", + "EEDP reference tag error", + "EEDP application tag error", + NULL, /* 0x0050 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0058 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "SCSI target priority I/O", /* 0x0060 */ + "Invalid SCSI target port", + "Invalid SCSI target I/O index", + "SCSI target aborted", + "No connection retryable", + "No connection", + "FC aborted", + "Invalid FC receive ID", + "FC did invalid", /* 0x0068 */ + "FC node logged out", + "Transfer count mismatch", + "STS data not set", + "FC exchange canceled", + "Data offset error", + "Too much write data", + "IU too short", + "ACK NAK timeout", /* 0x0070 */ + "NAK received", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, /* 0x0078 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "LAN device not found", /* 0x0080 */ + "LAN device failure", + "LAN transmit error", + "LAN transmit aborted", + "LAN receive error", + "LAN receive aborted", + "LAN partial packet", + "LAN canceled", + NULL, /* 0x0088 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "SAS SMP request failed", /* 0x0090 */ + "SAS SMP data overrun", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Inband aborted", /* 0x0098 */ + "No inband connection", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Diagnostic released", /* 0x00A0 */ +}; + +struct mprs_pass_thru { + uint64_t PtrRequest; + uint64_t PtrReply; + uint64_t PtrData; + uint32_t RequestSize; + uint32_t ReplySize; + uint32_t DataSize; + uint32_t DataDirection; + uint64_t PtrDataOut; + uint32_t DataOutSize; + uint32_t Timeout; +}; + +struct mprs_btdh_mapping { + uint16_t TargetID; + uint16_t Bus; + uint16_t DevHandle; + uint16_t Reserved; +}; + +const char * +mps_ioc_status(U16 IOCStatus) +{ + static char buffer[16]; + + IOCStatus &= MPI2_IOCSTATUS_MASK; + if (IOCStatus < sizeof(mps_ioc_status_codes) / sizeof(char *) && + mps_ioc_status_codes[IOCStatus] != NULL) + return (mps_ioc_status_codes[IOCStatus]); + snprintf(buffer, sizeof(buffer), "Status: 0x%04x", IOCStatus); + return (buffer); +} + +#ifdef USE_MPT_IOCTLS +int +mps_map_btdh(int fd, uint16_t *devhandle, uint16_t *bus, uint16_t *target) +{ + int error; + struct mprs_btdh_mapping map; + + map.Bus = *bus; + map.TargetID = *target; + map.DevHandle = *devhandle; + + if ((error = ioctl(fd, MPTIOCTL_BTDH_MAPPING, &map)) != 0) { + error = errno; + warn("Failed to map bus/target/device"); + return (error); + } + + *bus = map.Bus; + *target = map.TargetID; + *devhandle = map.DevHandle; + + return (0); +} + +int +mps_read_config_page_header(int fd, U8 PageType, U8 PageNumber, U32 PageAddress, + MPI2_CONFIG_PAGE_HEADER *header, U16 *IOCStatus) +{ + MPI2_CONFIG_REQUEST req; + MPI2_CONFIG_REPLY reply; + + bzero(&req, sizeof(req)); + req.Function = MPI2_FUNCTION_CONFIG; + req.Action = MPI2_CONFIG_ACTION_PAGE_HEADER; + req.Header.PageType = PageType; + req.Header.PageNumber = PageNumber; + req.PageAddress = PageAddress; + + if (mps_pass_command(fd, &req, sizeof(req), &reply, sizeof(reply), + NULL, 0, NULL, 0, 30)) + return (errno); + + if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) { + if (IOCStatus != NULL) + *IOCStatus = reply.IOCStatus; + return (EIO); + } + if (header == NULL) + return (EINVAL); + *header = reply.Header; + return (0); +} + +int +mps_read_ext_config_page_header(int fd, U8 ExtPageType, U8 PageNumber, U32 PageAddress, MPI2_CONFIG_PAGE_HEADER *header, U16 *ExtPageLength, U16 *IOCStatus) +{ + MPI2_CONFIG_REQUEST req; + MPI2_CONFIG_REPLY reply; + + bzero(&req, sizeof(req)); + req.Function = MPI2_FUNCTION_CONFIG; + req.Action = MPI2_CONFIG_ACTION_PAGE_HEADER; + req.Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; + req.ExtPageType = ExtPageType; + req.Header.PageNumber = PageNumber; + req.PageAddress = PageAddress; + + if (mps_pass_command(fd, &req, sizeof(req), &reply, sizeof(reply), + NULL, 0, NULL, 0, 30)) + return (errno); + + if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) { + if (IOCStatus != NULL) + *IOCStatus = reply.IOCStatus; + return (EIO); + } + if ((header == NULL) || (ExtPageLength == NULL)) + return (EINVAL); + *header = reply.Header; + *ExtPageLength = reply.ExtPageLength; + return (0); +} + +void * +mps_read_config_page(int fd, U8 PageType, U8 PageNumber, U32 PageAddress, + U16 *IOCStatus) +{ + MPI2_CONFIG_REQUEST req; + MPI2_CONFIG_PAGE_HEADER header; + MPI2_CONFIG_REPLY reply; + void *buf; + int error, len; + + bzero(&header, sizeof(header)); + error = mps_read_config_page_header(fd, PageType, PageNumber, + PageAddress, &header, IOCStatus); + if (error) { + errno = error; + return (NULL); + } + + bzero(&req, sizeof(req)); + req.Function = MPI2_FUNCTION_CONFIG; + req.Action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; + req.PageAddress = PageAddress; + req.Header = header; + req.Header.PageLength = reply.Header.PageLength; + if (reply.Header.PageLength == 0) + req.Header.PageLength = 4; + + len = req.Header.PageLength * 4; + buf = malloc(len); + if (mps_pass_command(fd, &req, sizeof(req), &reply, sizeof(reply), + buf, len, NULL, 0, 30)) { + error = errno; + free(buf); + errno = error; + return (NULL); + } + if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) { + if (IOCStatus != NULL) + *IOCStatus = reply.IOCStatus; + else + warnx("Reading config page failed: 0x%x %s", + reply.IOCStatus, mps_ioc_status(reply.IOCStatus)); + free(buf); + errno = EIO; + return (NULL); + } + return (buf); +} + +void * +mps_read_extended_config_page(int fd, U8 ExtPageType, U8 PageVersion, + U8 PageNumber, U32 PageAddress, U16 *IOCStatus) +{ + MPI2_CONFIG_REQUEST req; + MPI2_CONFIG_PAGE_HEADER header; + MPI2_CONFIG_REPLY reply; + U16 pagelen; + void *buf; + int error, len; + + if (IOCStatus != NULL) + *IOCStatus = MPI2_IOCSTATUS_SUCCESS; + bzero(&header, sizeof(header)); + error = mps_read_ext_config_page_header(fd, ExtPageType, PageNumber, + PageAddress, &header, &pagelen, IOCStatus); + if (error) { + errno = error; + return (NULL); + } + + bzero(&req, sizeof(req)); + req.Function = MPI2_FUNCTION_CONFIG; + req.Action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; + req.PageAddress = PageAddress; + req.Header = header; + if (pagelen == 0) + pagelen = 4; + req.ExtPageLength = pagelen; + req.ExtPageType = ExtPageType; + + len = pagelen * 4; + buf = malloc(len); + if (mps_pass_command(fd, &req, sizeof(req), &reply, sizeof(reply), + buf, len, NULL, 0, 30)) { + error = errno; + free(buf); + errno = error; + return (NULL); + } + if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) { + if (IOCStatus != NULL) + *IOCStatus = reply.IOCStatus; + else + warnx("Reading extended config page failed: %s", + mps_ioc_status(reply.IOCStatus)); + free(buf); + errno = EIO; + return (NULL); + } + return (buf); +} + +int +mps_firmware_send(int fd, unsigned char *fw, uint32_t len, bool bios) +{ + MPI2_FW_DOWNLOAD_REQUEST req; + MPI2_FW_DOWNLOAD_REPLY reply; + + bzero(&req, sizeof(req)); + bzero(&reply, sizeof(reply)); + req.Function = MPI2_FUNCTION_FW_DOWNLOAD; + req.ImageType = bios ? MPI2_FW_DOWNLOAD_ITYPE_BIOS : MPI2_FW_DOWNLOAD_ITYPE_FW; + req.TotalImageSize = len; + req.MsgFlags = MPI2_FW_DOWNLOAD_MSGFLGS_LAST_SEGMENT; + + if (mps_user_command(fd, &req, sizeof(req), &reply, sizeof(reply), + fw, len, 0)) { + return (-1); + } + return (0); +} + +int +mps_firmware_get(int fd, unsigned char **firmware, bool bios) +{ + MPI2_FW_UPLOAD_REQUEST req; + MPI2_FW_UPLOAD_REPLY reply; + int size; + + *firmware = NULL; + bzero(&req, sizeof(req)); + bzero(&reply, sizeof(reply)); + req.Function = MPI2_FUNCTION_FW_UPLOAD; + req.ImageType = bios ? MPI2_FW_DOWNLOAD_ITYPE_BIOS : MPI2_FW_DOWNLOAD_ITYPE_FW; + + if (mps_user_command(fd, &req, sizeof(req), &reply, sizeof(reply), + NULL, 0, 0)) { + return (-1); + } + if (reply.ActualImageSize == 0) { + return (-1); + } + + size = reply.ActualImageSize; + *firmware = calloc(1, sizeof(unsigned char) * size); + if (*firmware == NULL) { + warn("calloc"); + return (-1); + } + if (mps_user_command(fd, &req, sizeof(req), &reply, sizeof(reply), + *firmware, size, 0)) { + free(*firmware); + return (-1); + } + + return (size); +} + +#else + +int +mps_read_config_page_header(int fd, U8 PageType, U8 PageNumber, U32 PageAddress, + MPI2_CONFIG_PAGE_HEADER *header, U16 *IOCStatus) +{ + struct mps_cfg_page_req req; + + if (IOCStatus != NULL) + *IOCStatus = MPI2_IOCSTATUS_SUCCESS; + if (header == NULL) + return (EINVAL); + bzero(&req, sizeof(req)); + req.header.PageType = PageType; + req.header.PageNumber = PageNumber; + req.page_address = PageAddress; + if (ioctl(fd, MPSIO_READ_CFG_HEADER, &req) < 0) + return (errno); + if (!IOC_STATUS_SUCCESS(req.ioc_status)) { + if (IOCStatus != NULL) + *IOCStatus = req.ioc_status; + return (EIO); + } + bcopy(&req.header, header, sizeof(*header)); + return (0); +} + +void * +mps_read_config_page(int fd, U8 PageType, U8 PageNumber, U32 PageAddress, + U16 *IOCStatus) +{ + struct mps_cfg_page_req req; + void *buf; + int error; + + error = mps_read_config_page_header(fd, PageType, PageNumber, + PageAddress, &req.header, IOCStatus); + if (error) { + errno = error; + return (NULL); + } + + if (req.header.PageLength == 0) + req.header.PageLength = 4; + req.len = req.header.PageLength * 4; + buf = malloc(req.len); + req.buf = buf; + bcopy(&req.header, buf, sizeof(req.header)); + if (ioctl(fd, MPSIO_READ_CFG_PAGE, &req) < 0) { + error = errno; + free(buf); + errno = error; + return (NULL); + } + if (!IOC_STATUS_SUCCESS(req.ioc_status)) { + if (IOCStatus != NULL) + *IOCStatus = req.ioc_status; + else + warnx("Reading config page failed: 0x%x %s", + req.ioc_status, mps_ioc_status(req.ioc_status)); + free(buf); + errno = EIO; + return (NULL); + } + return (buf); +} + +void * +mps_read_extended_config_page(int fd, U8 ExtPageType, U8 PageVersion, + U8 PageNumber, U32 PageAddress, U16 *IOCStatus) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Apr 5 21:12:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85EA0B04A72; Tue, 5 Apr 2016 21:12:04 +0000 (UTC) (envelope-from bdrewery@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 mx1.freebsd.org (Postfix) with ESMTPS id 570221389; Tue, 5 Apr 2016 21:12:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u35LC3Zu050333; Tue, 5 Apr 2016 21:12:03 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35LC3Ub050331; Tue, 5 Apr 2016 21:12:03 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201604052112.u35LC3Ub050331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 5 Apr 2016 21:12:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297591 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 21:12:04 -0000 Author: bdrewery Date: Tue Apr 5 21:12:03 2016 New Revision: 297591 URL: https://svnweb.freebsd.org/changeset/base/297591 Log: Remove leftover _LDSCRIPTROOT missed in r297270. Sponsored by: EMC / Isilon Storage Division Modified: head/Makefile.inc1 head/Makefile.libcompat Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Apr 5 20:34:20 2016 (r297590) +++ head/Makefile.inc1 Tue Apr 5 21:12:03 2016 (r297591) @@ -450,7 +450,7 @@ LIBCOMPAT= SOFT WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP} -IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*} +IMAKEENV= ${CROSSENV} IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \ ${IMAKE_INSTALL} ${IMAKE_MTREE} .if empty(.MAKEFLAGS:M-n) Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Tue Apr 5 20:34:20 2016 (r297590) +++ head/Makefile.libcompat Tue Apr 5 21:12:03 2016 (r297591) @@ -97,7 +97,7 @@ LIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCO MK_TESTS=no LIBCOMPATWMAKE+= ${LIBCOMPATWMAKEENV} ${MAKE} ${LIBCOMPATWMAKEFLAGS} \ MK_MAN=no MK_HTML=no -LIBCOMPATIMAKE+= ${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} \ +LIBCOMPATIMAKE+= ${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*} \ MK_TOOLCHAIN=no ${IMAKE_INSTALL} \ -DLIBRARIES_ONLY From owner-svn-src-all@freebsd.org Tue Apr 5 21:29:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF010B04D3E; Tue, 5 Apr 2016 21:29:12 +0000 (UTC) (envelope-from avos@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 mx1.freebsd.org (Postfix) with ESMTPS id 92B9019E2; Tue, 5 Apr 2016 21:29:12 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u35LTBux055484; Tue, 5 Apr 2016 21:29:11 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35LTBpR055481; Tue, 5 Apr 2016 21:29:11 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201604052129.u35LTBpR055481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Tue, 5 Apr 2016 21:29:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297592 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 21:29:13 -0000 Author: avos Date: Tue Apr 5 21:29:11 2016 New Revision: 297592 URL: https://svnweb.freebsd.org/changeset/base/297592 Log: net80211: copy MAC address into iv_myaddr[] instead of aliasing it. Since IF_LLADDR() returns a non-constant pointer to the MAC address preserve a copy of it in iv_myaddr. PR: 208505 Modified: head/sys/net80211/ieee80211.c head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Tue Apr 5 21:12:03 2016 (r297591) +++ head/sys/net80211/ieee80211.c Tue Apr 5 21:29:11 2016 (r297592) @@ -483,7 +483,7 @@ ieee80211_vap_setup(struct ieee80211com vap->iv_htextcaps = ic->ic_htextcaps; vap->iv_opmode = opmode; vap->iv_caps |= ieee80211_opcap[opmode]; - vap->iv_myaddr = ic->ic_macaddr; + IEEE80211_ADDR_COPY(vap->iv_myaddr, ic->ic_macaddr); switch (opmode) { case IEEE80211_M_WDS: /* @@ -603,7 +603,7 @@ ieee80211_vap_attach(struct ieee80211vap ifp->if_baudrate = IF_Mbps(maxrate); ether_ifattach(ifp, macaddr); - vap->iv_myaddr = IF_LLADDR(ifp); + IEEE80211_ADDR_COPY(vap->iv_myaddr, IF_LLADDR(ifp)); /* hook output method setup by ether_ifattach */ vap->iv_output = ifp->if_output; ifp->if_output = ieee80211_output; Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Tue Apr 5 21:12:03 2016 (r297591) +++ head/sys/net80211/ieee80211_var.h Tue Apr 5 21:29:11 2016 (r297592) @@ -362,7 +362,8 @@ struct ieee80211vap { TAILQ_ENTRY(ieee80211vap) iv_next; /* list of vap instances */ struct ieee80211com *iv_ic; /* back ptr to common state */ - const uint8_t *iv_myaddr; /* MAC address: ifp or ic */ + /* MAC address: ifp or ic */ + uint8_t iv_myaddr[IEEE80211_ADDR_LEN]; uint32_t iv_debug; /* debug msg flags */ struct ieee80211_stats iv_stats; /* statistics */ From owner-svn-src-all@freebsd.org Tue Apr 5 21:54:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D523B0479E; Tue, 5 Apr 2016 21:54:09 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id E39F71A04; Tue, 5 Apr 2016 21:54:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u35Ls8MW064434; Tue, 5 Apr 2016 21:54:08 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35Ls8Ec064433; Tue, 5 Apr 2016 21:54:08 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604052154.u35Ls8Ec064433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 5 Apr 2016 21:54:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297593 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 21:54:09 -0000 Author: adrian Date: Tue Apr 5 21:54:07 2016 New Revision: 297593 URL: https://svnweb.freebsd.org/changeset/base/297593 Log: [net80211] Add a new capability flag to indicate that the stack should do software A-MSDU encapsulation. Right now there's AMSDU TX/RX capability bits and they're mostly unused, however I'd like to maintain those as the general configuration, not also "please software encap AMSDU." For platforms that can do A-MSDU in firmware (iwn, iwm, etc) then their init paths can read this flag to configure A-MSDU. Modified: head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Tue Apr 5 21:29:11 2016 (r297592) +++ head/sys/net80211/ieee80211_var.h Tue Apr 5 21:54:07 2016 (r297593) @@ -648,6 +648,7 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_C_DFS 0x00020000 /* CAPABILITY: DFS/radar avail*/ #define IEEE80211_C_MBSS 0x00040000 /* CAPABILITY: MBSS available */ #define IEEE80211_C_SWSLEEP 0x00080000 /* CAPABILITY: do sleep here */ +#define IEEE80211_C_SWAMSDUTX 0x00100000 /* CAPABILITY: software A-MSDU TX */ /* 0x7c0000 available */ #define IEEE80211_C_WPA1 0x00800000 /* CAPABILITY: WPA1 avail */ #define IEEE80211_C_WPA2 0x01000000 /* CAPABILITY: WPA2 avail */ From owner-svn-src-all@freebsd.org Tue Apr 5 21:54:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70C32B04808; Tue, 5 Apr 2016 21:54:43 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id 4217B1BAF; Tue, 5 Apr 2016 21:54:43 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u35Lsgve064493; Tue, 5 Apr 2016 21:54:42 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35LsgwC064492; Tue, 5 Apr 2016 21:54:42 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604052154.u35LsgwC064492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 5 Apr 2016 21:54:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297594 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 21:54:43 -0000 Author: adrian Date: Tue Apr 5 21:54:42 2016 New Revision: 297594 URL: https://svnweb.freebsd.org/changeset/base/297594 Log: [net80211] note that M_FF will soon mean "fast-frames" or "A-MSDU." Modified: head/sys/net80211/ieee80211_freebsd.h Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Tue Apr 5 21:54:07 2016 (r297593) +++ head/sys/net80211/ieee80211_freebsd.h Tue Apr 5 21:54:42 2016 (r297594) @@ -263,7 +263,7 @@ struct mbuf *ieee80211_getmgtframe(uint8 #define M_EAPOL M_PROTO3 /* PAE/EAPOL frame */ #define M_PWR_SAV M_PROTO4 /* bypass PS handling */ #define M_MORE_DATA M_PROTO5 /* more data frames to follow */ -#define M_FF M_PROTO6 /* fast frame */ +#define M_FF M_PROTO6 /* fast frame / A-MSDU */ #define M_TXCB M_PROTO7 /* do tx complete callback */ #define M_AMPDU_MPDU M_PROTO8 /* ok for A-MPDU aggregation */ #define M_FRAG M_PROTO9 /* frame fragmentation */ From owner-svn-src-all@freebsd.org Tue Apr 5 22:01:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 455E3B04BDA; Tue, 5 Apr 2016 22:01:58 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id 16DD91223; Tue, 5 Apr 2016 22:01:58 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u35M1vuu067387; Tue, 5 Apr 2016 22:01:57 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35M1vT3067385; Tue, 5 Apr 2016 22:01:57 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604052201.u35M1vT3067385@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 5 Apr 2016 22:01:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297595 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 22:01:58 -0000 Author: adrian Date: Tue Apr 5 22:01:56 2016 New Revision: 297595 URL: https://svnweb.freebsd.org/changeset/base/297595 Log: [net80211] rename 11n rate macros into a useful spot * begin moving the 11n macros out of ieee80211_phy.c and into a header so they can be used elsewhere. * rename some of them into the IEEE80211_* namespace. * convert HT_RC_2_MCS() to work with three-stream rates. Modified: head/sys/net80211/ieee80211_phy.c head/sys/net80211/ieee80211_phy.h Modified: head/sys/net80211/ieee80211_phy.c ============================================================================== --- head/sys/net80211/ieee80211_phy.c Tue Apr 5 21:54:42 2016 (r297594) +++ head/sys/net80211/ieee80211_phy.c Tue Apr 5 22:01:56 2016 (r297595) @@ -590,7 +590,7 @@ static const uint16_t ht40_bps[32] = { #define HT_STF 4 #define HT_LTF(n) ((n) * 4) -#define HT_RC_2_MCS(_rc) ((_rc) & 0xf) +#define HT_RC_2_MCS(_rc) ((_rc) & 0x1f) #define HT_RC_2_STREAMS(_rc) ((((_rc) & 0x78) >> 3) + 1) #define IS_HT_RATE(_rc) ( (_rc) & IEEE80211_RATE_MCS) Modified: head/sys/net80211/ieee80211_phy.h ============================================================================== --- head/sys/net80211/ieee80211_phy.h Tue Apr 5 21:54:42 2016 (r297594) +++ head/sys/net80211/ieee80211_phy.h Tue Apr 5 22:01:56 2016 (r297595) @@ -194,6 +194,14 @@ uint8_t ieee80211_plcp2rate(uint8_t, en */ uint8_t ieee80211_rate2plcp(int, enum ieee80211_phytype); +/* + * 802.11n rate manipulation. + */ + +#define IEEE80211_HT_RC_2_MCS(_rc) ((_rc) & 0x1f) +#define IEEE80211_HT_RC_2_STREAMS(_rc) ((((_rc) & 0x78) >> 3) + 1) +#define IEEE80211_IS_HT_RATE(_rc) ( (_rc) & IEEE80211_RATE_MCS) + uint32_t ieee80211_compute_duration_ht(uint32_t frameLen, uint16_t rate, int streams, int isht40, int isShortGI); From owner-svn-src-all@freebsd.org Tue Apr 5 22:14:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19CD6B04FE6; Tue, 5 Apr 2016 22:14:23 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id E7E2C1AE0; Tue, 5 Apr 2016 22:14:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u35MEMh8070722; Tue, 5 Apr 2016 22:14:22 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35MEMJM070720; Tue, 5 Apr 2016 22:14:22 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604052214.u35MEMJM070720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 5 Apr 2016 22:14:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297596 - head/sys/dev/urtwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 22:14:23 -0000 Author: adrian Date: Tue Apr 5 22:14:21 2016 New Revision: 297596 URL: https://svnweb.freebsd.org/changeset/base/297596 Log: [urtwn] first cut of getting the fast-frames / amsdu support in shape. The urtwn hardware transmits FF/A-MSDU just fine - it takes an 802.11 frame and will dutifully send the thing. So: * bump RX queue up from 1. Why's it 1? That's really silly. * Add the "software A-MSDU" encap capability bit. * bump the TX buffer size up so we can at least send A-MSDU frames. * track active frames submitted to the NIC - we can't make assumptions about how many are in flight in the NIC though. For 88E parts we could use per-packet TX indication, but for R92 parts we can't. So, just fake it somewhat. * Kick the transmit queue when we finish reception; try to avoid stalls. * Kick the FF queue a little more regularly. A-MSDU TX won't happen until the net80211 side is done, but atheros fast-frames support should now work. Tested: * urtwn0: MAC/BB RTL8188EU, RF 6052 1T1R ; A-MSDU transmit. Modified: head/sys/dev/urtwn/if_urtwn.c head/sys/dev/urtwn/if_urtwnvar.h Modified: head/sys/dev/urtwn/if_urtwn.c ============================================================================== --- head/sys/dev/urtwn/if_urtwn.c Tue Apr 5 22:01:56 2016 (r297595) +++ head/sys/dev/urtwn/if_urtwn.c Tue Apr 5 22:14:21 2016 (r297596) @@ -70,6 +70,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef IEEE80211_SUPPORT_SUPERG +#include +#endif #include #include @@ -577,6 +580,8 @@ urtwn_attach(device_t self) #endif | IEEE80211_C_WPA /* 802.11i */ | IEEE80211_C_WME /* 802.11e */ + | IEEE80211_C_SWAMSDUTX /* Do software A-MSDU TX */ + | IEEE80211_C_FF /* Atheros fast-frames */ ; ic->ic_cryptocaps = @@ -894,6 +899,15 @@ urtwn_report_intr(struct usb_xfer *xfer, buf = data->buf; stat = (struct r92c_rx_stat *)buf; + /* + * For 88E chips we can tie the FF flushing here; + * this is where we do know exactly how deep the + * transmit queue is. + * + * But it won't work for R92 chips, so we can't + * take the easy way out. + */ + if (sc->chip & URTWN_CHIP_88E) { int report_sel = MS(le32toh(stat->rxdw3), R88E_RXDW3_RPT); @@ -1101,7 +1115,7 @@ tr_setup: data = STAILQ_FIRST(&sc->sc_rx_inactive); if (data == NULL) { KASSERT(m == NULL, ("mbuf isn't NULL")); - return; + goto finish; } STAILQ_REMOVE_HEAD(&sc->sc_rx_inactive, next); STAILQ_INSERT_TAIL(&sc->sc_rx_active, data, next); @@ -1131,7 +1145,6 @@ tr_setup: (void)ieee80211_input_all(ic, m, rssi - nf, nf); } - URTWN_LOCK(sc); m = next; } @@ -1150,6 +1163,20 @@ tr_setup: } break; } +finish: + /* Finished receive; age anything left on the FF queue by a little bump */ + /* + * XXX TODO: just make this a callout timer schedule so we can + * flush the FF staging queue if we're approaching idle. + */ +#ifdef IEEE80211_SUPPORT_SUPERG + URTWN_UNLOCK(sc); + ieee80211_ff_age_all(ic, 1); + URTWN_LOCK(sc); +#endif + + /* Kick-start more transmit in case we stalled */ + urtwn_start(sc); } static void @@ -1161,6 +1188,9 @@ urtwn_txeof(struct urtwn_softc *sc, stru if (data->ni != NULL) /* not a beacon frame */ ieee80211_tx_complete(data->ni, data->m, status); + if (sc->sc_tx_n_active > 0) + sc->sc_tx_n_active--; + data->ni = NULL; data->m = NULL; @@ -1269,6 +1299,9 @@ static void urtwn_bulk_tx_callback(struct usb_xfer *xfer, usb_error_t error) { struct urtwn_softc *sc = usbd_xfer_softc(xfer); +#ifdef IEEE80211_SUPPORT_SUPERG + struct ieee80211com *ic = &sc->sc_ic; +#endif struct urtwn_data *data; URTWN_ASSERT_LOCKED(sc); @@ -1287,12 +1320,14 @@ tr_setup: if (data == NULL) { URTWN_DPRINTF(sc, URTWN_DEBUG_XMIT, "%s: empty pending queue\n", __func__); + sc->sc_tx_n_active = 0; goto finish; } STAILQ_REMOVE_HEAD(&sc->sc_tx_pending, next); STAILQ_INSERT_TAIL(&sc->sc_tx_active, data, next); usbd_xfer_set_frame_data(xfer, 0, data->buf, data->buflen); usbd_transfer_submit(xfer); + sc->sc_tx_n_active++; break; default: data = STAILQ_FIRST(&sc->sc_tx_active); @@ -1307,6 +1342,35 @@ tr_setup: break; } finish: +#ifdef IEEE80211_SUPPORT_SUPERG + /* + * If the TX active queue drops below a certain + * threshold, ensure we age fast-frames out so they're + * transmitted. + */ + if (sc->sc_tx_n_active <= 1) { + /* XXX ew - net80211 should defer this for us! */ + + /* + * Note: this sc_tx_n_active currently tracks + * the number of pending transmit submissions + * and not the actual depth of the TX frames + * pending to the hardware. That means that + * we're going to end up with some sub-optimal + * aggregation behaviour. + */ + /* + * XXX TODO: just make this a callout timer schedule so we can + * flush the FF staging queue if we're approaching idle. + */ + URTWN_UNLOCK(sc); + ieee80211_ff_flush(ic, WME_AC_VO); + ieee80211_ff_flush(ic, WME_AC_VI); + ieee80211_ff_flush(ic, WME_AC_BE); + ieee80211_ff_flush(ic, WME_AC_BK); + URTWN_LOCK(sc); + } +#endif /* Kick-start more transmit */ urtwn_start(sc); } @@ -3153,6 +3217,11 @@ urtwn_start(struct urtwn_softc *sc) } ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; m->m_pkthdr.rcvif = NULL; + + URTWN_DPRINTF(sc, URTWN_DEBUG_XMIT, "%s: called; m=%p\n", + __func__, + m); + if (urtwn_tx_data(sc, ni, m, bf) != 0) { if_inc_counter(ni->ni_vap->iv_ifp, IFCOUNTER_OERRORS, 1); @@ -5326,6 +5395,10 @@ urtwn_raw_xmit(struct ieee80211_node *ni struct urtwn_data *bf; int error; + URTWN_DPRINTF(sc, URTWN_DEBUG_XMIT, "%s: called; m=%p\n", + __func__, + m); + /* prevent management frames from being sent if we're not ready */ URTWN_LOCK(sc); if (!(sc->sc_flags & URTWN_RUNNING)) { Modified: head/sys/dev/urtwn/if_urtwnvar.h ============================================================================== --- head/sys/dev/urtwn/if_urtwnvar.h Tue Apr 5 22:01:56 2016 (r297595) +++ head/sys/dev/urtwn/if_urtwnvar.h Tue Apr 5 22:14:21 2016 (r297596) @@ -17,12 +17,14 @@ * $FreeBSD$ */ -#define URTWN_RX_LIST_COUNT 1 +#define URTWN_RX_LIST_COUNT 64 #define URTWN_TX_LIST_COUNT 8 #define URTWN_HOST_CMD_RING_COUNT 32 -#define URTWN_RXBUFSZ (16 * 1024) -#define URTWN_TXBUFSZ (sizeof(struct r92c_tx_desc) + IEEE80211_MAX_LEN) +#define URTWN_RXBUFSZ (8 * 1024) +//#define URTWN_TXBUFSZ (sizeof(struct r92c_tx_desc) + IEEE80211_MAX_LEN) +/* Leave enough space for an A-MSDU frame */ +#define URTWN_TXBUFSZ (16 * 1024) #define URTWN_RX_DESC_SIZE (sizeof(struct r92c_rx_stat)) #define URTWN_TX_DESC_SIZE (sizeof(struct r92c_tx_desc)) @@ -195,6 +197,7 @@ struct urtwn_softc { urtwn_datahead sc_rx_inactive; struct urtwn_data sc_tx[URTWN_TX_LIST_COUNT]; urtwn_datahead sc_tx_active; + int sc_tx_n_active; urtwn_datahead sc_tx_inactive; urtwn_datahead sc_tx_pending; From owner-svn-src-all@freebsd.org Tue Apr 5 22:36:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E378B036AA; Tue, 5 Apr 2016 22:36:50 +0000 (UTC) (envelope-from bapt@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 mx1.freebsd.org (Postfix) with ESMTPS id 254681498; Tue, 5 Apr 2016 22:36:50 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u35Manxr076793; Tue, 5 Apr 2016 22:36:49 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u35ManwQ076790; Tue, 5 Apr 2016 22:36:49 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201604052236.u35ManwQ076790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 5 Apr 2016 22:36:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297597 - in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 22:36:50 -0000 Author: bapt Date: Tue Apr 5 22:36:48 2016 New Revision: 297597 URL: https://svnweb.freebsd.org/changeset/base/297597 Log: Add kern.features flags for linux and linux64 modules kern.features.linux: 1 meaning linux 32 bits binaries are supported kern.features.linux64: 1 meaning linux 64 bits binaries are supported The goal here is to help 3rd party applications (including ports) to determine if the host do support linux emulation Reviewed by: dchagin MFC after: 1 week Relnotes: yes Differential Revision: D5830 Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Tue Apr 5 22:14:21 2016 (r297596) +++ head/sys/amd64/linux/linux_sysvec.c Tue Apr 5 22:36:48 2016 (r297597) @@ -992,3 +992,4 @@ static moduledata_t linux64_elf_mod = { DECLARE_MODULE_TIED(linux64elf, linux64_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); MODULE_DEPEND(linux64elf, linux_common, 1, 1, 1); +FEATURE(linux64, "Linux 64bit support"); Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Tue Apr 5 22:14:21 2016 (r297596) +++ head/sys/amd64/linux32/linux32_sysvec.c Tue Apr 5 22:36:48 2016 (r297597) @@ -1205,3 +1205,4 @@ static moduledata_t linux_elf_mod = { DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); MODULE_DEPEND(linuxelf, linux_common, 1, 1, 1); +FEATURE(linux, "Linux 32bit support"); Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Tue Apr 5 22:14:21 2016 (r297596) +++ head/sys/i386/linux/linux_sysvec.c Tue Apr 5 22:36:48 2016 (r297597) @@ -1197,3 +1197,4 @@ static moduledata_t linux_elf_mod = { }; DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); +FEATURE(linux, "Linux 32bit support"); From owner-svn-src-all@freebsd.org Wed Apr 6 00:01:05 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35973B04F12; Wed, 6 Apr 2016 00:01:05 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id 0218D1576; Wed, 6 Apr 2016 00:01:04 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36014wk001666; Wed, 6 Apr 2016 00:01:04 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36014jC001665; Wed, 6 Apr 2016 00:01:04 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604060001.u36014jC001665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 6 Apr 2016 00:01:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297599 - head/usr.sbin/bhyveload X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 00:01:05 -0000 Author: pfg Date: Wed Apr 6 00:01:03 2016 New Revision: 297599 URL: https://svnweb.freebsd.org/changeset/base/297599 Log: bhyveload: fix from loading undefined size. We were setting an incorrect/undefined size and as it came out the st struct was not really being used at all. This was actually a bug but by sheer luck it had no visual effect. CID: 1194320 Reviewed by: grehan Modified: head/usr.sbin/bhyveload/bhyveload.c Modified: head/usr.sbin/bhyveload/bhyveload.c ============================================================================== --- head/usr.sbin/bhyveload/bhyveload.c Tue Apr 5 23:24:17 2016 (r297598) +++ head/usr.sbin/bhyveload/bhyveload.c Wed Apr 6 00:01:03 2016 (r297599) @@ -152,7 +152,6 @@ struct cb_file { static int cb_open(void *arg, const char *filename, void **hp) { - struct stat st; struct cb_file *cf; char path[PATH_MAX]; @@ -169,7 +168,7 @@ cb_open(void *arg, const char *filename, return (errno); } - cf->cf_size = st.st_size; + cf->cf_size = cf->cf_stat.st_size; if (S_ISDIR(cf->cf_stat.st_mode)) { cf->cf_isdir = 1; cf->cf_u.dir = opendir(path); From owner-svn-src-all@freebsd.org Wed Apr 6 00:41:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 225E8B03AA9; Wed, 6 Apr 2016 00:41:08 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id E41541488; Wed, 6 Apr 2016 00:41:07 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u360f7ef013712; Wed, 6 Apr 2016 00:41:07 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u360f7Qj013711; Wed, 6 Apr 2016 00:41:07 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604060041.u360f7Qj013711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 6 Apr 2016 00:41:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297600 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 00:41:08 -0000 Author: adrian Date: Wed Apr 6 00:41:06 2016 New Revision: 297600 URL: https://svnweb.freebsd.org/changeset/base/297600 Log: [rsu] We don't do A-MPDU transmit right now, so don't bother registering for it. Modified: head/sys/dev/usb/wlan/if_rsu.c Modified: head/sys/dev/usb/wlan/if_rsu.c ============================================================================== --- head/sys/dev/usb/wlan/if_rsu.c Wed Apr 6 00:01:03 2016 (r297599) +++ head/sys/dev/usb/wlan/if_rsu.c Wed Apr 6 00:41:06 2016 (r297600) @@ -521,7 +521,9 @@ rsu_attach(device_t self) /* Enable basic HT */ ic->ic_htcaps = IEEE80211_HTC_HT | +#if 0 IEEE80211_HTC_AMPDU | +#endif IEEE80211_HTC_AMSDU | IEEE80211_HTCAP_MAXAMSDU_3839 | IEEE80211_HTCAP_SMPS_OFF; From owner-svn-src-all@freebsd.org Wed Apr 6 00:52:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9717CB03E55; Wed, 6 Apr 2016 00:52:31 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id 689D91AF7; Wed, 6 Apr 2016 00:52:31 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u360qU2L018702; Wed, 6 Apr 2016 00:52:30 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u360qUFx018701; Wed, 6 Apr 2016 00:52:30 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604060052.u360qUFx018701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 6 Apr 2016 00:52:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297601 - head/sys/dev/urtwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 00:52:31 -0000 Author: adrian Date: Wed Apr 6 00:52:30 2016 New Revision: 297601 URL: https://svnweb.freebsd.org/changeset/base/297601 Log: [urtwn] disable doing AMPDU TX. We don't do AMPDU TX for now, so don't bother setting this. Modified: head/sys/dev/urtwn/if_urtwn.c Modified: head/sys/dev/urtwn/if_urtwn.c ============================================================================== --- head/sys/dev/urtwn/if_urtwn.c Wed Apr 6 00:41:06 2016 (r297600) +++ head/sys/dev/urtwn/if_urtwn.c Wed Apr 6 00:52:30 2016 (r297601) @@ -593,7 +593,9 @@ urtwn_attach(device_t self) if (urtwn_enable_11n) { device_printf(self, "enabling 11n\n"); ic->ic_htcaps = IEEE80211_HTC_HT | +#if 0 IEEE80211_HTC_AMPDU | +#endif IEEE80211_HTC_AMSDU | IEEE80211_HTCAP_MAXAMSDU_3839 | IEEE80211_HTCAP_SMPS_OFF; From owner-svn-src-all@freebsd.org Wed Apr 6 00:55:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C6CEB03F3D; Wed, 6 Apr 2016 00:55:41 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id F22351CC4; Wed, 6 Apr 2016 00:55:40 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u360teG9018862; Wed, 6 Apr 2016 00:55:40 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u360teox018860; Wed, 6 Apr 2016 00:55:40 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604060055.u360teox018860@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 6 Apr 2016 00:55:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297602 - in head: sys/sys usr.bin/sed X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 00:55:41 -0000 Author: pfg Date: Wed Apr 6 00:55:39 2016 New Revision: 297602 URL: https://svnweb.freebsd.org/changeset/base/297602 Log: Fix sed functions 'i' and 'a' from discarding leading white space. This appears to be implementation dependent but convenient and makes our sed behave more like GNU sed. Given that it is not the historic behavior, bump FreeBSD_version should userland/ports somehow depend on it. Obtained from: NetBSD (bin/49872) Reviewed by: bdrewery PR: 208554 Merge after: NEVER Modified: head/sys/sys/param.h head/usr.bin/sed/compile.c Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Wed Apr 6 00:52:30 2016 (r297601) +++ head/sys/sys/param.h Wed Apr 6 00:55:39 2016 (r297602) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100104 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100105 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/usr.bin/sed/compile.c ============================================================================== --- head/usr.bin/sed/compile.c Wed Apr 6 00:52:30 2016 (r297601) +++ head/usr.bin/sed/compile.c Wed Apr 6 00:55:39 2016 (r297602) @@ -730,7 +730,7 @@ compile_tr(char *p, struct s_tr **py) } /* - * Compile the text following an a or i command. + * Compile the text following an a, c, or i command. */ static char * compile_text(void) @@ -746,7 +746,6 @@ compile_text(void) while (cu_fgets(lbuf, sizeof(lbuf), NULL)) { op = s = text + size; p = lbuf; - EATSPACE(); for (esc_nl = 0; *p != '\0'; p++) { if (*p == '\\' && p[1] != '\0' && *++p == '\n') esc_nl = 1; From owner-svn-src-all@freebsd.org Wed Apr 6 01:21:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D8E7B04550; Wed, 6 Apr 2016 01:21:53 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id DD60016E8; Wed, 6 Apr 2016 01:21:52 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u361Lq7f027688; Wed, 6 Apr 2016 01:21:52 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u361LpBN027682; Wed, 6 Apr 2016 01:21:51 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604060121.u361LpBN027682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 6 Apr 2016 01:21:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297603 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 01:21:53 -0000 Author: adrian Date: Wed Apr 6 01:21:51 2016 New Revision: 297603 URL: https://svnweb.freebsd.org/changeset/base/297603 Log: [net80211] Initial A-MSDU support for testing / evaluation A-MSDU is another 11n aggregation mechanism where multiple ethernet frames get LLC encapsulated (so they have a length field), padded, and put in a single MPDU (802.11 MAC frame.) This means it gets sent out as a single frame, with a single seqno, it's acked as one frame, etc. It turns out that, hah, atheros fast frames is almost but not quite like this, so I'm reusing all of the current superg/fast-frames stuff in order to actually transmit A-MSDU. Yes, this means that A-MSDU frames are also only aggregated two at a time, so it's not necessarily a huge win, but it's better than nothing. This doesn't do anything by default - the driver needs to say it does A-MSDU as well as set the AMSDU software TX capability so this code path gets exercised. For now, the only driver that enables this is urtwn. I'll enable it for rsu at some point soon. Tested: * Add an amsdu encap path to aggregate two frames, same as the fast-frames path. * Always do the superg init/teardown and node init/teardown stuff, regardless of whether the nodes are doing fast-frames (the ATH capability stuff.) That way we can reuse it for amsdu. * Don't do AMSDU for multicast/broadcast and EAPOL frames. * If we're doing A-MPDU, then don't bother doing FF/A-MSDU. We can likely do both together, but I don't want to change behaviour. * Teach the fast frames approx txtime logic to support the 11n rates. But, since we don't currently have a full "current rate" support, assume it's HT20, long-gi, etc. That way we overshoot on the TX time estimation, so we're always inside the requirements. (And we only aggregate two frames for now, so we're not really going to exceed that.) * Drop the maximum FF age default down to 2ms, otherwise we end up with some very annoyingly large latencies. TODO: * We only aggregate two ethernet frames, so I'm not checking the max A-MSDU size. But when it comes time to support >2 frames, we should obey that. Tested: * urtwn(4) Modified: head/sys/net80211/ieee80211_ht.h head/sys/net80211/ieee80211_node.c head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_sta.c head/sys/net80211/ieee80211_superg.c head/sys/net80211/ieee80211_superg.h Modified: head/sys/net80211/ieee80211_ht.h ============================================================================== --- head/sys/net80211/ieee80211_ht.h Wed Apr 6 00:55:39 2016 (r297602) +++ head/sys/net80211/ieee80211_ht.h Wed Apr 6 01:21:51 2016 (r297603) @@ -65,6 +65,10 @@ struct ieee80211_tx_ampdu { #define IEEE80211_AMPDU_RUNNING(tap) \ (((tap)->txa_flags & IEEE80211_AGGR_RUNNING) != 0) +/* return non-zero if AMPDU tx for the TID was NACKed */ +#define IEEE80211_AMPDU_NACKED(tap)\ + (!! ((tap)->txa_flags & IEEE80211_AGGR_NAK)) + /* return non-zero if AMPDU tx for the TID is running or started */ #define IEEE80211_AMPDU_REQUESTED(tap) \ (((tap)->txa_flags & \ Modified: head/sys/net80211/ieee80211_node.c ============================================================================== --- head/sys/net80211/ieee80211_node.c Wed Apr 6 00:55:39 2016 (r297602) +++ head/sys/net80211/ieee80211_node.c Wed Apr 6 01:21:51 2016 (r297603) @@ -1014,8 +1014,8 @@ node_cleanup(struct ieee80211_node *ni) if (ni->ni_flags & IEEE80211_NODE_HT) ieee80211_ht_node_cleanup(ni); #ifdef IEEE80211_SUPPORT_SUPERG - else if (ni->ni_ath_flags & IEEE80211_NODE_ATH) - ieee80211_ff_node_cleanup(ni); + /* Always do FF node cleanup; for A-MSDU */ + ieee80211_ff_node_cleanup(ni); #endif #ifdef IEEE80211_SUPPORT_MESH /* Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Wed Apr 6 00:55:39 2016 (r297602) +++ head/sys/net80211/ieee80211_output.c Wed Apr 6 01:21:51 2016 (r297603) @@ -191,51 +191,68 @@ ieee80211_vap_pkt_send_dest(struct ieee8 * otherwise unable to establish a BA stream. */ if ((ni->ni_flags & IEEE80211_NODE_AMPDU_TX) && - (vap->iv_flags_ht & IEEE80211_FHT_AMPDU_TX) && - (m->m_flags & M_EAPOL) == 0) { - int tid = WME_AC_TO_TID(M_WME_GETAC(m)); - struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[tid]; - - ieee80211_txampdu_count_packet(tap); - if (IEEE80211_AMPDU_RUNNING(tap)) { - /* - * Operational, mark frame for aggregation. - * - * XXX do tx aggregation here - */ - m->m_flags |= M_AMPDU_MPDU; - } else if (!IEEE80211_AMPDU_REQUESTED(tap) && - ic->ic_ampdu_enable(ni, tap)) { - /* - * Not negotiated yet, request service. - */ - ieee80211_ampdu_request(ni, tap); - /* XXX hold frame for reply? */ + (vap->iv_flags_ht & IEEE80211_FHT_AMPDU_TX)) { + if ((m->m_flags & M_EAPOL) == 0) { + int tid = WME_AC_TO_TID(M_WME_GETAC(m)); + struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[tid]; + + ieee80211_txampdu_count_packet(tap); + if (IEEE80211_AMPDU_RUNNING(tap)) { + /* + * Operational, mark frame for aggregation. + * + * XXX do tx aggregation here + */ + m->m_flags |= M_AMPDU_MPDU; + } else if (!IEEE80211_AMPDU_REQUESTED(tap) && + ic->ic_ampdu_enable(ni, tap)) { + /* + * Not negotiated yet, request service. + */ + ieee80211_ampdu_request(ni, tap); + /* XXX hold frame for reply? */ + } } } +#ifdef IEEE80211_SUPPORT_SUPERG /* - * XXX If we aren't doing AMPDU TX then we /could/ do - * fast-frames encapsulation, however right now this - * output logic doesn't handle that case. + * Check for AMSDU/FF; queue for aggregation * - * So we'll be limited to "fast-frames" xmit for non-11n STA - * and "no fast frames" xmit for 11n STAs. - * It'd be nice to eventually test fast-frames out by - * gracefully falling from failing A-MPDU transmission - * (driver says no, fail to negotiate it with peer) to - * using fast-frames. + * Note: we don't bother trying to do fast frames or + * A-MSDU encapsulation for 802.3 drivers. Now, we + * likely could do it for FF (because it's a magic + * atheros tunnel LLC type) but I don't think we're going + * to really need to. For A-MSDU we'd have to set the + * A-MSDU QoS bit in the wifi header, so we just plain + * can't do it. * - * Note: we can actually put A-MSDU's inside an A-MPDU, - * so hopefully we can figure out how to make that particular - * combination work right. - */ -#ifdef IEEE80211_SUPPORT_SUPERG - else if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF)) { - m = ieee80211_ff_check(ni, m); - if (m == NULL) { - /* NB: any ni ref held on stageq */ - return (0); + * Strictly speaking, we could actually /do/ A-MSDU / FF + * with A-MPDU together which for certain circumstances + * is beneficial (eg A-MSDU of TCK ACKs.) However, + * I'll ignore that for now so existing behaviour is maintained. + * Later on it would be good to make "amsdu + ampdu" configurable. + */ + else if (__predict_true((vap->iv_caps & IEEE80211_C_8023ENCAP) == 0)) { + if ((! mcast) && ieee80211_amsdu_tx_ok(ni)) { + m = ieee80211_amsdu_check(ni, m); + if (m == NULL) { + /* NB: any ni ref held on stageq */ + IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, + "%s: amsdu_check queued frame\n", + __func__); + return (0); + } + } else if ((! mcast) && IEEE80211_ATH_CAP(vap, ni, + IEEE80211_NODE_FF)) { + m = ieee80211_ff_check(ni, m); + if (m == NULL) { + /* NB: any ni ref held on stageq */ + IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, + "%s: ff_check queued frame\n", + __func__); + return (0); + } } } #endif /* IEEE80211_SUPPORT_SUPERG */ @@ -1229,6 +1246,7 @@ ieee80211_encap(struct ieee80211vap *vap ieee80211_seq seqno; int meshhdrsize, meshae; uint8_t *qos; + int is_amsdu = 0; IEEE80211_TX_LOCK_ASSERT(ic); @@ -1383,9 +1401,19 @@ ieee80211_encap(struct ieee80211vap *vap } else { #ifdef IEEE80211_SUPPORT_SUPERG /* - * Aggregated frame. - */ - m = ieee80211_ff_encap(vap, m, hdrspace + meshhdrsize, key); + * Aggregated frame. Check if it's for AMSDU or FF. + * + * XXX TODO: IEEE80211_NODE_AMSDU* isn't implemented + * anywhere for some reason. But, since 11n requires + * AMSDU RX, we can just assume "11n" == "AMSDU". + */ + IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, "%s: called; M_FF\n", __func__); + if (ieee80211_amsdu_tx_ok(ni)) { + m = ieee80211_amsdu_encap(vap, m, hdrspace + meshhdrsize, key); + is_amsdu = 1; + } else { + m = ieee80211_ff_encap(vap, m, hdrspace + meshhdrsize, key); + } if (m == NULL) #endif goto bad; @@ -1521,6 +1549,13 @@ ieee80211_encap(struct ieee80211vap *vap qos[1] = 0; wh->i_fc[0] |= IEEE80211_FC0_SUBTYPE_QOS; + /* + * If this is an A-MSDU then ensure we set the + * relevant field. + */ + if (is_amsdu) + qos[0] |= IEEE80211_QOS_AMSDU; + if ((m->m_flags & M_AMPDU_MPDU) == 0) { /* * NB: don't assign a sequence # to potential @@ -1544,6 +1579,14 @@ ieee80211_encap(struct ieee80211vap *vap *(uint16_t *)wh->i_seq = htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); M_SEQNO_SET(m, seqno); + + /* + * XXX TODO: we shouldn't allow EAPOL, etc that would + * be forced to be non-QoS traffic to be A-MSDU encapsulated. + */ + if (is_amsdu) + printf("%s: XXX ERROR: is_amsdu set; not QoS!\n", + __func__); } Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Wed Apr 6 00:55:39 2016 (r297602) +++ head/sys/net80211/ieee80211_sta.c Wed Apr 6 01:21:51 2016 (r297603) @@ -1703,12 +1703,8 @@ sta_recv_mgmt(struct ieee80211_node *ni, ieee80211_setup_basic_htrates(ni, htinfo); ieee80211_node_setuptxparms(ni); ieee80211_ratectl_node_init(ni); - } else { -#ifdef IEEE80211_SUPPORT_SUPERG - if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_ATH)) - ieee80211_ff_node_init(ni); -#endif } + /* * Configure state now that we are associated. * Modified: head/sys/net80211/ieee80211_superg.c ============================================================================== --- head/sys/net80211/ieee80211_superg.c Wed Apr 6 00:55:39 2016 (r297602) +++ head/sys/net80211/ieee80211_superg.c Wed Apr 6 01:21:51 2016 (r297603) @@ -99,18 +99,22 @@ ieee80211_superg_attach(struct ieee80211 { struct ieee80211_superg *sg; - if (ic->ic_caps & IEEE80211_C_FF) { - sg = (struct ieee80211_superg *) IEEE80211_MALLOC( - sizeof(struct ieee80211_superg), M_80211_VAP, - IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); - if (sg == NULL) { - printf("%s: cannot allocate SuperG state block\n", - __func__); - return; - } - ic->ic_superg = sg; + sg = (struct ieee80211_superg *) IEEE80211_MALLOC( + sizeof(struct ieee80211_superg), M_80211_VAP, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); + if (sg == NULL) { + printf("%s: cannot allocate SuperG state block\n", + __func__); + return; } - ieee80211_ffagemax = msecs_to_ticks(150); + ic->ic_superg = sg; + + /* + * Default to not being so aggressive for FF/AMSDU + * aging, otherwise we may hold a frame around + * for way too long before we expire it out. + */ + ieee80211_ffagemax = msecs_to_ticks(2); } void @@ -353,16 +357,15 @@ ieee80211_ff_encap(struct ieee80211vap * goto bad; } m1->m_nextpkt = NULL; + /* - * Include fast frame headers in adjusting header layout. + * Adjust to include 802.11 header requirement. */ KASSERT(m1->m_len >= sizeof(eh1), ("no ethernet header!")); ETHER_HEADER_COPY(&eh1, mtod(m1, caddr_t)); - m1 = ieee80211_mbuf_adjust(vap, - hdrspace + sizeof(struct llc) + sizeof(uint32_t) + 2 + - sizeof(struct ether_header), - key, m1); + m1 = ieee80211_mbuf_adjust(vap, hdrspace, key, m1); if (m1 == NULL) { + printf("%s: failed initial mbuf_adjust\n", __func__); /* NB: ieee80211_mbuf_adjust handles msgs+statistics */ m_freem(m2); goto bad; @@ -370,17 +373,15 @@ ieee80211_ff_encap(struct ieee80211vap * /* * Copy second frame's Ethernet header out of line - * and adjust for encapsulation headers. Note that - * we make room for padding in case there isn't room + * and adjust for possible padding in case there isn't room * at the end of first frame. */ KASSERT(m2->m_len >= sizeof(eh2), ("no ethernet header!")); ETHER_HEADER_COPY(&eh2, mtod(m2, caddr_t)); - m2 = ieee80211_mbuf_adjust(vap, - ATH_FF_MAX_HDR_PAD + sizeof(struct ether_header), - NULL, m2); + m2 = ieee80211_mbuf_adjust(vap, 4, NULL, m2); if (m2 == NULL) { /* NB: ieee80211_mbuf_adjust handles msgs+statistics */ + printf("%s: failed second \n", __func__); goto bad; } @@ -418,9 +419,8 @@ ieee80211_ff_encap(struct ieee80211vap * } /* - * Now, stick 'em together and prepend the tunnel headers; - * first the Atheros tunnel header (all zero for now) and - * then a special fast frame LLC. + * A-MSDU's are just appended; the "I'm A-MSDU!" bit is in the + * QoS header. * * XXX optimize by prepending together */ @@ -454,6 +454,7 @@ ieee80211_ff_encap(struct ieee80211vap * return m1; bad: + vap->iv_stats.is_ff_encapfail++; if (m1 != NULL) m_freem(m1); if (m2 != NULL) @@ -461,6 +462,114 @@ bad: return NULL; } +/* + * A-MSDU encapsulation. + * + * This assumes just two frames for now, since we're borrowing the + * same queuing code and infrastructure as fast-frames. + * + * There must be two packets chained with m_nextpkt. + * We do header adjustment for each, and then concatenate the mbuf chains + * to form a single frame for transmission. + */ +struct mbuf * +ieee80211_amsdu_encap(struct ieee80211vap *vap, struct mbuf *m1, int hdrspace, + struct ieee80211_key *key) +{ + struct mbuf *m2; + struct ether_header eh1, eh2; + struct mbuf *m; + int pad; + + m2 = m1->m_nextpkt; + if (m2 == NULL) { + IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, + "%s: only one frame\n", __func__); + goto bad; + } + m1->m_nextpkt = NULL; + + /* + * Include A-MSDU header in adjusting header layout. + */ + KASSERT(m1->m_len >= sizeof(eh1), ("no ethernet header!")); + ETHER_HEADER_COPY(&eh1, mtod(m1, caddr_t)); + m1 = ieee80211_mbuf_adjust(vap, + hdrspace + sizeof(struct llc) + sizeof(uint32_t) + + sizeof(struct ether_header), + key, m1); + if (m1 == NULL) { + /* NB: ieee80211_mbuf_adjust handles msgs+statistics */ + m_freem(m2); + goto bad; + } + + /* + * Copy second frame's Ethernet header out of line + * and adjust for encapsulation headers. Note that + * we make room for padding in case there isn't room + * at the end of first frame. + */ + KASSERT(m2->m_len >= sizeof(eh2), ("no ethernet header!")); + ETHER_HEADER_COPY(&eh2, mtod(m2, caddr_t)); + m2 = ieee80211_mbuf_adjust(vap, 4, NULL, m2); + if (m2 == NULL) { + /* NB: ieee80211_mbuf_adjust handles msgs+statistics */ + goto bad; + } + + /* + * Now do tunnel encapsulation. First, each + * frame gets a standard encapsulation. + */ + m1 = ieee80211_ff_encap1(vap, m1, &eh1); + if (m1 == NULL) + goto bad; + m2 = ieee80211_ff_encap1(vap, m2, &eh2); + if (m2 == NULL) + goto bad; + + /* + * Pad leading frame to a 4-byte boundary. If there + * is space at the end of the first frame, put it + * there; otherwise prepend to the front of the second + * frame. We know doing the second will always work + * because we reserve space above. We prefer appending + * as this typically has better DMA alignment properties. + */ + for (m = m1; m->m_next != NULL; m = m->m_next) + ; + pad = roundup2(m1->m_pkthdr.len, 4) - m1->m_pkthdr.len; + if (pad) { + if (M_TRAILINGSPACE(m) < pad) { /* prepend to second */ + m2->m_data -= pad; + m2->m_len += pad; + m2->m_pkthdr.len += pad; + } else { /* append to first */ + m->m_len += pad; + m1->m_pkthdr.len += pad; + } + } + + /* + * Now, stick 'em together. + */ + m->m_next = m2; /* NB: last mbuf from above */ + m1->m_pkthdr.len += m2->m_pkthdr.len; + + vap->iv_stats.is_amsdu_encap++; + + return m1; +bad: + vap->iv_stats.is_amsdu_encapfail++; + if (m1 != NULL) + m_freem(m1); + if (m2 != NULL) + m_freem(m2); + return NULL; +} + + static void ff_transmit(struct ieee80211_node *ni, struct mbuf *m) { @@ -605,6 +714,7 @@ ff_approx_txtime(struct ieee80211_node * struct ieee80211com *ic = ni->ni_ic; struct ieee80211vap *vap = ni->ni_vap; uint32_t framelen; + uint32_t frame_time; /* * Approximate the frame length to be transmitted. A swag to add @@ -621,7 +731,21 @@ ff_approx_txtime(struct ieee80211_node * framelen += 24; if (m2 != NULL) framelen += m2->m_pkthdr.len; - return ieee80211_compute_duration(ic->ic_rt, framelen, ni->ni_txrate, 0); + + /* + * For now, we assume non-shortgi, 20MHz, just because I want to + * at least test 802.11n. + */ + if (ni->ni_txrate & IEEE80211_RATE_MCS) + frame_time = ieee80211_compute_duration_ht(framelen, + ni->ni_txrate, + IEEE80211_HT_RC_2_STREAMS(ni->ni_txrate), + 0, /* isht40 */ + 0); /* isshortgi */ + else + frame_time = ieee80211_compute_duration(ic->ic_rt, framelen, + ni->ni_txrate, 0); + return (frame_time); } /* @@ -753,6 +877,30 @@ ieee80211_ff_check(struct ieee80211_node return mstaged; } +struct mbuf * +ieee80211_amsdu_check(struct ieee80211_node *ni, struct mbuf *m) +{ + /* + * XXX TODO: actually enforce the node support + * and HTCAP requirements for the maximum A-MSDU + * size. + */ + + /* First: software A-MSDU transmit? */ + if (! ieee80211_amsdu_tx_ok(ni)) + return (m); + + /* Next - EAPOL? Nope, don't aggregate; we don't QoS encap them */ + if (m->m_flags & (M_EAPOL | M_MCAST | M_BCAST)) + return (m); + + /* Next - needs to be a data frame, non-broadcast, etc */ + if (ETHER_IS_MULTICAST(mtod(m, struct ether_header *)->ether_dhost)) + return (m); + + return (ieee80211_ff_check(ni, m)); +} + void ieee80211_ff_node_init(struct ieee80211_node *ni) { Modified: head/sys/net80211/ieee80211_superg.h ============================================================================== --- head/sys/net80211/ieee80211_superg.h Wed Apr 6 00:55:39 2016 (r297602) +++ head/sys/net80211/ieee80211_superg.h Wed Apr 6 01:21:51 2016 (r297603) @@ -82,6 +82,27 @@ int ieee80211_parse_athparams(struct iee void ieee80211_ff_node_init(struct ieee80211_node *); void ieee80211_ff_node_cleanup(struct ieee80211_node *); +static inline int +ieee80211_amsdu_tx_ok(struct ieee80211_node *ni) +{ + + /* First: software A-MSDU transmit? */ + if ((ni->ni_ic->ic_caps & IEEE80211_C_SWAMSDUTX) == 0) + return (0); + + /* Next: does the VAP have AMSDU TX enabled? */ + if ((ni->ni_vap->iv_flags_ht & IEEE80211_FHT_AMSDU_TX) == 0) + return (0); + + /* Next: 11n node? (assumed that A-MSDU TX to HT nodes is ok */ + if ((ni->ni_flags & IEEE80211_NODE_HT) == 0) + return (0); + + /* ok, we can at least /do/ AMSDU to this node */ + return (1); +} + +struct mbuf * ieee80211_amsdu_check(struct ieee80211_node *ni, struct mbuf *m); struct mbuf *ieee80211_ff_check(struct ieee80211_node *, struct mbuf *); void ieee80211_ff_age(struct ieee80211com *, struct ieee80211_stageq *, int quanta); @@ -122,6 +143,8 @@ ieee80211_ff_age_all(struct ieee80211com struct mbuf *ieee80211_ff_encap(struct ieee80211vap *, struct mbuf *, int, struct ieee80211_key *); +struct mbuf * ieee80211_amsdu_encap(struct ieee80211vap *vap, struct mbuf *m1, + int hdrspace, struct ieee80211_key *key); struct mbuf *ieee80211_ff_decap(struct ieee80211_node *, struct mbuf *); From owner-svn-src-all@freebsd.org Wed Apr 6 01:22:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D46A6B0465C; Wed, 6 Apr 2016 01:22:21 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id A650C1939; Wed, 6 Apr 2016 01:22:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u361MKq4027766; Wed, 6 Apr 2016 01:22:20 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u361MK7Q027765; Wed, 6 Apr 2016 01:22:20 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604060122.u361MK7Q027765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 6 Apr 2016 01:22:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297604 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 01:22:21 -0000 Author: adrian Date: Wed Apr 6 01:22:20 2016 New Revision: 297604 URL: https://svnweb.freebsd.org/changeset/base/297604 Log: [net80211] missed commit from last one - always cleanup superg state. Modified: head/sys/net80211/ieee80211_hostap.c Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Wed Apr 6 01:21:51 2016 (r297603) +++ head/sys/net80211/ieee80211_hostap.c Wed Apr 6 01:22:20 2016 (r297604) @@ -2078,8 +2078,8 @@ hostap_recv_mgmt(struct ieee80211_node * } else if (ni->ni_flags & IEEE80211_NODE_HT) ieee80211_ht_node_cleanup(ni); #ifdef IEEE80211_SUPPORT_SUPERG - else if (ni->ni_ath_flags & IEEE80211_NODE_ATH) - ieee80211_ff_node_cleanup(ni); + /* Always do ff node cleanup; for A-MSDU */ + ieee80211_ff_node_cleanup(ni); #endif /* * Allow AMPDU operation only with unencrypted traffic @@ -2097,6 +2097,10 @@ hostap_recv_mgmt(struct ieee80211_node * "capinfo 0x%x ucastcipher %d", capinfo, rsnparms.rsn_ucastcipher); ieee80211_ht_node_cleanup(ni); +#ifdef IEEE80211_SUPPORT_SUPERG + /* Always do ff node cleanup; for A-MSDU */ + ieee80211_ff_node_cleanup(ni); +#endif vap->iv_stats.is_ht_assoc_downgrade++; } /* From owner-svn-src-all@freebsd.org Wed Apr 6 01:33:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2369DB04914; Wed, 6 Apr 2016 01:33:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04C2E1EC5; Wed, 6 Apr 2016 01:33:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 9F5E5B93A; Tue, 5 Apr 2016 21:33:06 -0400 (EDT) From: John Baldwin To: Baptiste Daroussin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297597 - in head/sys: amd64/linux amd64/linux32 i386/linux Date: Tue, 05 Apr 2016 18:32:16 -0700 Message-ID: <2270129.DEqYKEiVDZ@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201604052236.u35ManwQ076790@repo.freebsd.org> References: <201604052236.u35ManwQ076790@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 05 Apr 2016 21:33:06 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 01:33:08 -0000 On Tuesday, April 05, 2016 10:36:49 PM Baptiste Daroussin wrote: > Author: bapt > Date: Tue Apr 5 22:36:48 2016 > New Revision: 297597 > URL: https://svnweb.freebsd.org/changeset/base/297597 > > Log: > Add kern.features flags for linux and linux64 modules > > kern.features.linux: 1 meaning linux 32 bits binaries are supported > kern.features.linux64: 1 meaning linux 64 bits binaries are supported > > The goal here is to help 3rd party applications (including ports) to determine > if the host do support linux emulation > > Reviewed by: dchagin > MFC after: 1 week > Relnotes: yes > Differential Revision: D5830 Other parts of the system (e.g. libsysdecode, the various symbols exported by the modules, etc.) use "linux" to mean supporting Linux binaries of the same ABI as the host (so x86-64 on amd64 and i386 on i386) and "linux32" to mean supporting 32-bit Linux binaries on a 64-bit host. Note that we used to have linux.ko on Alpha which was a 64-bit ABI, not 32-bit. It is unfortunate that we called linux32.ko linux.ko, but we shouldn't perpetuate that mistake further IMO. For example, I think if we grow Linux/aarch64 ABI support on FreeBSD/arm64, that should be called 'linux.ko', not 'linux64.ko'. Similarly, Linux/armv6 on FreeBSD/armv6 would also be 'linux.ko'. I would also list the names in the feature description (so Linux/i386, not Linux 32-bit, since Linux/armv6 is a 32-bit binary, but linux.ko on FreeBSD/i386 can't run it). -- John Baldwin From owner-svn-src-all@freebsd.org Wed Apr 6 03:12:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 291D0B03895; Wed, 6 Apr 2016 03:12:46 +0000 (UTC) (envelope-from ngie@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 mx1.freebsd.org (Postfix) with ESMTPS id EBA891FAD; Wed, 6 Apr 2016 03:12:45 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u363Cj8k061900; Wed, 6 Apr 2016 03:12:45 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u363CjOc061899; Wed, 6 Apr 2016 03:12:45 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201604060312.u363CjOc061899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 6 Apr 2016 03:12:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297606 - head/usr.sbin/etcupdate/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 03:12:46 -0000 Author: ngie Date: Wed Apr 6 03:12:44 2016 New Revision: 297606 URL: https://svnweb.freebsd.org/changeset/base/297606 Log: Chase r296204 by renaming tzsetup(1) to tzsetup(8) in the tests MFC after: 3 days X-MFC with: r296204 Sponsored by: EMC / Isilon Storage Division Modified: head/usr.sbin/etcupdate/tests/tzsetup_test.sh Modified: head/usr.sbin/etcupdate/tests/tzsetup_test.sh ============================================================================== --- head/usr.sbin/etcupdate/tests/tzsetup_test.sh Wed Apr 6 01:44:21 2016 (r297605) +++ head/usr.sbin/etcupdate/tests/tzsetup_test.sh Wed Apr 6 03:12:44 2016 (r297606) @@ -196,7 +196,7 @@ $COMMAND -nr -d $WORKDIR -D $TEST > $WOR cat > $WORKDIR/correct.out < Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4887EB03B30; Wed, 6 Apr 2016 03:22:41 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id 0015F143A; Wed, 6 Apr 2016 03:22:40 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u363MeiY064844; Wed, 6 Apr 2016 03:22:40 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u363MeX2064842; Wed, 6 Apr 2016 03:22:40 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604060322.u363MeX2064842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 6 Apr 2016 03:22:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297607 - head/tools/tools/net80211/wlanstats X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 03:22:41 -0000 Author: adrian Date: Wed Apr 6 03:22:39 2016 New Revision: 297607 URL: https://svnweb.freebsd.org/changeset/base/297607 Log: [wlanstats] Convert rssi / signal / rate to use float. * Convert rssi/signal/rate to be a single digit precision float * rssi is actually in 1/2 dBm units, so divide it by 2 Modified: head/tools/tools/net80211/wlanstats/wlanstats.c Modified: head/tools/tools/net80211/wlanstats/wlanstats.c ============================================================================== --- head/tools/tools/net80211/wlanstats/wlanstats.c Wed Apr 6 03:12:44 2016 (r297606) +++ head/tools/tools/net80211/wlanstats/wlanstats.c Wed Apr 6 03:22:39 2016 (r297607) @@ -365,13 +365,13 @@ static const struct fmt wlanstats[] = { #define S_TX_MCAST AFTER(S_TX_UCAST) { 8, "tx_mcast", "tx_mcast", "multicast data frames sent" }, #define S_RATE AFTER(S_TX_MCAST) - { 5, "rate", "rate", "current transmit rate" }, + { 7, "rate", "rate", "current transmit rate" }, #define S_RSSI AFTER(S_RATE) - { 5, "rssi", "rssi", "current rssi" }, + { 6, "rssi", "rssi", "current rssi" }, #define S_NOISE AFTER(S_RSSI) { 5, "noise", "noise", "current noise floor (dBm)" }, #define S_SIGNAL AFTER(S_NOISE) - { 5, "signal", "sig", "current signal (dBm)" }, + { 6, "signal", "sig", "current signal (dBm)" }, #define S_BEACON_BAD AFTER(S_SIGNAL) { 9, "beacon_bad", "beaconbad", "bad beacons received" }, #define S_AMPDU_BARTX AFTER(S_BEACON_BAD) @@ -635,16 +635,17 @@ wlan_getinfo(struct wlanstatfoo_p *wf, i switch (s) { case S_RATE: - snprintf(b, bs, "%uM", si->isi_txmbps/2); + snprintf(b, bs, "%.1fM", (float) si->isi_txmbps/2.0); return 1; case S_RSSI: - snprintf(b, bs, "%d", si->isi_rssi); + snprintf(b, bs, "%.1f", (float) si->isi_rssi/2.0); return 1; case S_NOISE: snprintf(b, bs, "%d", si->isi_noise); return 1; case S_SIGNAL: - snprintf(b, bs, "%d", si->isi_rssi + si->isi_noise); + snprintf(b, bs, "%.1f", (float) si->isi_rssi/2.0 + + (float) si->isi_noise); return 1; case S_RX_AUTH_FAIL_CODE: if (wf->cur.is_rx_authfail_code == 0) From owner-svn-src-all@freebsd.org Wed Apr 6 04:10:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EB46B046BD; Wed, 6 Apr 2016 04:10: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 mx1.freebsd.org (Postfix) with ESMTPS id D472E169E; Wed, 6 Apr 2016 04:10:23 +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 u364ANHf077697; Wed, 6 Apr 2016 04:10:23 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u364AMJ3077689; Wed, 6 Apr 2016 04:10:22 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201604060410.u364AMJ3077689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 6 Apr 2016 04:10:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297608 - in head/sys: dev/acpica dev/cardbus dev/pci powerpc/ofw sparc64/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 04:10:24 -0000 Author: jhb Date: Wed Apr 6 04:10:22 2016 New Revision: 297608 URL: https://svnweb.freebsd.org/changeset/base/297608 Log: Convert pci_delete_child() to a bus_child_deleted() method. Instead of providing a wrapper around device_delete_child() that the PCI bus and child bus drivers must call explicitly, move the bulk of the logic from pci_delete_child() into a bus_child_deleted() method (pci_child_deleted()). This allows PCI devices to be safely deleted via device_delete_child(). - Add a bus_child_deleted method to the ACPI PCI bus which clears the device_t associated with the corresponding ACPI handle in addition to the normal PCI bus cleanup. - Change cardbus_detach_card to call device_delete_children() and move CardBus-specific delete logic into a new cardbus_child_deleted() method. - Use device_delete_child() instead of pci_delete_child() in the SRIOV code. - Add a bus_child_deleted method to the OpenFirmware PCI bus drivers which frees the OpenFirmware device info for each PCI device. Reviewed by: imp Tested on: amd64 (CardBus and PCI-e hotplug) Differential Revision: https://reviews.freebsd.org/D5831 Modified: head/sys/dev/acpica/acpi_pci.c head/sys/dev/cardbus/cardbus.c head/sys/dev/pci/pci.c head/sys/dev/pci/pci_iov.c head/sys/dev/pci/pci_private.h head/sys/powerpc/ofw/ofw_pcibus.c head/sys/sparc64/pci/ofw_pcibus.c Modified: head/sys/dev/acpica/acpi_pci.c ============================================================================== --- head/sys/dev/acpica/acpi_pci.c Wed Apr 6 03:22:39 2016 (r297607) +++ head/sys/dev/acpica/acpi_pci.c Wed Apr 6 04:10:22 2016 (r297608) @@ -70,6 +70,7 @@ CTASSERT(ACPI_STATE_D2 == PCI_POWERSTATE CTASSERT(ACPI_STATE_D3 == PCI_POWERSTATE_D3); static int acpi_pci_attach(device_t dev); +static void acpi_pci_child_deleted(device_t dev, device_t child); static int acpi_pci_child_location_str_method(device_t cbdev, device_t child, char *buf, size_t buflen); static int acpi_pci_probe(device_t dev); @@ -97,6 +98,7 @@ static device_method_t acpi_pci_methods[ /* Bus interface */ DEVMETHOD(bus_read_ivar, acpi_pci_read_ivar), DEVMETHOD(bus_write_ivar, acpi_pci_write_ivar), + DEVMETHOD(bus_child_deleted, acpi_pci_child_deleted), DEVMETHOD(bus_child_location_str, acpi_pci_child_location_str_method), DEVMETHOD(bus_get_dma_tag, acpi_pci_get_dma_tag), DEVMETHOD(bus_get_domain, acpi_get_domain), @@ -153,6 +155,16 @@ acpi_pci_write_ivar(device_t dev, device return (pci_write_ivar(dev, child, which, value)); } +static void +acpi_pci_child_deleted(device_t dev, device_t child) +{ + struct acpi_pci_devinfo *dinfo = device_get_ivars(child); + + if (acpi_get_device(dinfo->ap_handle) == child) + AcpiDetachData(dinfo->ap_handle, acpi_fake_objhandler); + pci_child_deleted(dev, child); +} + static int acpi_pci_child_location_str_method(device_t cbdev, device_t child, char *buf, size_t buflen) Modified: head/sys/dev/cardbus/cardbus.c ============================================================================== --- head/sys/dev/cardbus/cardbus.c Wed Apr 6 03:22:39 2016 (r297607) +++ head/sys/dev/cardbus/cardbus.c Wed Apr 6 04:10:22 2016 (r297608) @@ -226,31 +226,30 @@ cardbus_attach_card(device_t cbdev) return (ENOENT); } +static void +cardbus_child_deleted(device_t cbdev, device_t child) +{ + struct cardbus_devinfo *dinfo = device_get_ivars(child); + + if (dinfo->pci.cfg.dev != child) + device_printf(cbdev, "devinfo dev mismatch\n"); + cardbus_device_destroy(dinfo); + pci_child_deleted(cbdev, child); +} + static int cardbus_detach_card(device_t cbdev) { - int numdevs; - device_t *devlist; - int tmp; int err = 0; - if (device_get_children(cbdev, &devlist, &numdevs) != 0) - return (ENOENT); - if (numdevs == 0) { - free(devlist, M_TEMP); - return (ENOENT); - } - - for (tmp = 0; tmp < numdevs; tmp++) { - struct cardbus_devinfo *dinfo = device_get_ivars(devlist[tmp]); + err = bus_generic_detach(cbdev); + if (err) + return (err); + err = device_delete_children(cbdev); + if (err) + return (err); - if (dinfo->pci.cfg.dev != devlist[tmp]) - device_printf(cbdev, "devinfo dev mismatch\n"); - cardbus_device_destroy(dinfo); - pci_delete_child(cbdev, devlist[tmp]); - } POWER_DISABLE_SOCKET(device_get_parent(cbdev), cbdev); - free(devlist, M_TEMP); return (err); } @@ -335,6 +334,7 @@ static device_method_t cardbus_methods[] DEVMETHOD(device_resume, cardbus_resume), /* Bus interface */ + DEVMETHOD(bus_child_deleted, cardbus_child_deleted), DEVMETHOD(bus_get_dma_tag, bus_generic_get_dma_tag), DEVMETHOD(bus_read_ivar, cardbus_read_ivar), DEVMETHOD(bus_driver_added, cardbus_driver_added), Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Wed Apr 6 03:22:39 2016 (r297607) +++ head/sys/dev/pci/pci.c Wed Apr 6 04:10:22 2016 (r297608) @@ -161,6 +161,7 @@ static device_method_t pci_methods[] = { DEVMETHOD(bus_release_resource, pci_release_resource), DEVMETHOD(bus_activate_resource, pci_activate_resource), DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), + DEVMETHOD(bus_child_deleted, pci_child_deleted), DEVMETHOD(bus_child_detached, pci_child_detached), DEVMETHOD(bus_child_pnpinfo_str, pci_child_pnpinfo_str_method), DEVMETHOD(bus_child_location_str, pci_child_location_str_method), @@ -5194,7 +5195,7 @@ pci_deactivate_resource(device_t dev, de } void -pci_delete_child(device_t dev, device_t child) +pci_child_deleted(device_t dev, device_t child) { struct resource_list_entry *rle; struct resource_list *rl; @@ -5203,12 +5204,13 @@ pci_delete_child(device_t dev, device_t dinfo = device_get_ivars(child); rl = &dinfo->resources; - if (device_is_attached(child)) - device_detach(child); - /* Turn off access to resources we're about to free */ - pci_write_config(child, PCIR_COMMAND, pci_read_config(child, - PCIR_COMMAND, 2) & ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN), 2); + if (bus_child_present(child) != 0) { + pci_write_config(child, PCIR_COMMAND, pci_read_config(child, + PCIR_COMMAND, 2) & ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN), 2); + + pci_disable_busmaster(child); + } /* Free all allocated resources */ STAILQ_FOREACH(rle, rl, link) { @@ -5229,7 +5231,6 @@ pci_delete_child(device_t dev, device_t } resource_list_free(rl); - device_delete_child(dev, child); pci_freecfg(dinfo); } Modified: head/sys/dev/pci/pci_iov.c ============================================================================== --- head/sys/dev/pci/pci_iov.c Wed Apr 6 03:22:39 2016 (r297607) +++ head/sys/dev/pci/pci_iov.c Wed Apr 6 04:10:22 2016 (r297608) @@ -640,7 +640,7 @@ pci_iov_enumerate_vfs(struct pci_devinfo error = PCI_IOV_ADD_VF(dev, i, driver_config); if (error != 0) { device_printf(dev, "Failed to add VF %d\n", i); - pci_delete_child(bus, vf); + device_delete_child(bus, vf); } } @@ -833,7 +833,7 @@ pci_iov_delete(struct cdev *cdev) vf = devlist[i]; if (pci_iov_is_child_vf(iov, vf)) - pci_delete_child(bus, vf); + device_delete_child(bus, vf); } PCI_IOV_UNINIT(dev); Modified: head/sys/dev/pci/pci_private.h ============================================================================== --- head/sys/dev/pci/pci_private.h Wed Apr 6 03:22:39 2016 (r297607) +++ head/sys/dev/pci/pci_private.h Wed Apr 6 04:10:22 2016 (r297608) @@ -57,7 +57,6 @@ void pci_add_resources(device_t bus, de uint32_t prefetchmask); void pci_add_resources_ea(device_t bus, device_t dev, int alloc_iov); int pci_attach_common(device_t dev); -void pci_delete_child(device_t dev, device_t child); void pci_driver_added(device_t dev, driver_t *driver); int pci_ea_is_enabled(device_t dev, int rid); int pci_print_child(device_t dev, device_t child); @@ -122,6 +121,7 @@ struct pci_devinfo *pci_read_device(devi size_t size); void pci_print_verbose(struct pci_devinfo *dinfo); int pci_freecfg(struct pci_devinfo *dinfo); +void pci_child_deleted(device_t dev, device_t child); void pci_child_detached(device_t dev, device_t child); int pci_child_location_str_method(device_t cbdev, device_t child, char *buf, size_t buflen); Modified: head/sys/powerpc/ofw/ofw_pcibus.c ============================================================================== --- head/sys/powerpc/ofw/ofw_pcibus.c Wed Apr 6 03:22:39 2016 (r297607) +++ head/sys/powerpc/ofw/ofw_pcibus.c Wed Apr 6 04:10:22 2016 (r297608) @@ -61,6 +61,7 @@ static device_probe_t ofw_pcibus_probe; static device_attach_t ofw_pcibus_attach; static pci_assign_interrupt_t ofw_pcibus_assign_interrupt; static ofw_bus_get_devinfo_t ofw_pcibus_get_devinfo; +static bus_child_deleted_t ofw_pcibus_child_deleted; static int ofw_pcibus_child_pnpinfo_str_method(device_t cbdev, device_t child, char *buf, size_t buflen); @@ -73,6 +74,7 @@ static device_method_t ofw_pcibus_method DEVMETHOD(device_attach, ofw_pcibus_attach), /* Bus interface */ + DEVMETHOD(bus_child_deleted, ofw_pcibus_child_deleted), DEVMETHOD(bus_child_pnpinfo_str, ofw_pcibus_child_pnpinfo_str_method), /* PCI interface */ @@ -269,6 +271,16 @@ ofw_pcibus_enum_bus(device_t dev, u_int } } +static void +ofw_pcibus_child_deleted(device_t dev, device_t child) +{ + struct ofw_pcibus_devinfo *dinfo; + + dinfo = device_get_ivars(dev); + ofw_bus_gen_destroy_devinfo(&dinfo->opd_obdinfo); + pci_child_deleted(dev, child); +} + static int ofw_pcibus_child_pnpinfo_str_method(device_t cbdev, device_t child, char *buf, size_t buflen) Modified: head/sys/sparc64/pci/ofw_pcibus.c ============================================================================== --- head/sys/sparc64/pci/ofw_pcibus.c Wed Apr 6 03:22:39 2016 (r297607) +++ head/sys/sparc64/pci/ofw_pcibus.c Wed Apr 6 04:10:22 2016 (r297608) @@ -65,6 +65,7 @@ static void ofw_pcibus_setup_device(devi u_int busno, u_int slot, u_int func); /* Methods */ +static bus_child_deleted_t ofw_pcibus_child_deleted; static bus_child_pnpinfo_str_t ofw_pcibus_pnpinfo_str; static device_attach_t ofw_pcibus_attach; static device_probe_t ofw_pcibus_probe; @@ -77,6 +78,7 @@ static device_method_t ofw_pcibus_method DEVMETHOD(device_attach, ofw_pcibus_attach), /* Bus interface */ + DEVMETHOD(bus_child_deleted, ofw_pcibus_child_deleted), DEVMETHOD(bus_child_pnpinfo_str, ofw_pcibus_pnpinfo_str), /* PCI interface */ @@ -327,6 +329,16 @@ ofw_pcibus_get_devinfo(device_t bus, dev return (&dinfo->opd_obdinfo); } +static void +ofw_pcibus_child_deleted(device_t dev, device_t child) +{ + struct ofw_pcibus_devinfo *dinfo; + + dinfo = device_get_ivars(dev); + ofw_bus_gen_destroy_devinfo(&dinfo->opd_obdinfo); + pci_child_deleted(dev, child); +} + static int ofw_pcibus_pnpinfo_str(device_t dev, device_t child, char *buf, size_t buflen) From owner-svn-src-all@freebsd.org Wed Apr 6 04:50:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FF06B04FE2; Wed, 6 Apr 2016 04:50:29 +0000 (UTC) (envelope-from rpokala@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 mx1.freebsd.org (Postfix) with ESMTPS id 68A2C1671; Wed, 6 Apr 2016 04:50:29 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u364oSmc089746; Wed, 6 Apr 2016 04:50:28 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u364oSQu089743; Wed, 6 Apr 2016 04:50:28 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201604060450.u364oSQu089743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Wed, 6 Apr 2016 04:50:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297609 - in head/sys: dev/isci/scil net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 04:50:29 -0000 Author: rpokala Date: Wed Apr 6 04:50:28 2016 New Revision: 297609 URL: https://svnweb.freebsd.org/changeset/base/297609 Log: Storage Controller Interface driver - typo in unimplemented macro in scic_sds_controller_registers.h s/contoller/controller/ PR: 207336 Submitted by: Tony Narlock Modified: head/sys/dev/isci/scil/scic_sds_controller_registers.h head/sys/net/if_lagg.c head/sys/net/if_lagg.h Modified: head/sys/dev/isci/scil/scic_sds_controller_registers.h ============================================================================== --- head/sys/dev/isci/scil/scic_sds_controller_registers.h Wed Apr 6 04:10:22 2016 (r297608) +++ head/sys/dev/isci/scil/scic_sds_controller_registers.h Wed Apr 6 04:50:28 2016 (r297609) @@ -586,7 +586,7 @@ extern "C" { #define SCU_PTSGRTC_READ(controller) \ scu_ptsg_register_read( \ - contoller, \ + controller, \ real_time_clock \ ) /*@}*/ Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Wed Apr 6 04:10:22 2016 (r297608) +++ head/sys/net/if_lagg.c Wed Apr 6 04:50:28 2016 (r297609) @@ -101,7 +101,11 @@ static const char laggname[] = "lagg"; static void lagg_lladdr(struct lagg_softc *, uint8_t *); static void lagg_capabilities(struct lagg_softc *); static void lagg_port_lladdr(struct lagg_port *, uint8_t *, lagg_llqtype); -static void lagg_port_setlladdr(void *, int); +static void lagg_port_ops(void *, int); +static void lagg_llq_action_mtu(struct lagg_softc *, + struct lagg_llq_slist_entry *); +static void lagg_llq_action_lladdr(struct lagg_softc *, + struct lagg_llq_slist_entry *); static int lagg_port_create(struct lagg_softc *, struct ifnet *); static int lagg_port_destroy(struct lagg_port *, int); static struct mbuf *lagg_input(struct ifnet *, struct mbuf *); @@ -130,6 +134,9 @@ static int lagg_media_change(struct ifne static void lagg_media_status(struct ifnet *, struct ifmediareq *); static struct lagg_port *lagg_link_active(struct lagg_softc *, struct lagg_port *); +static int lagg_change_mtu(struct ifnet *, struct ifreq *); +static void _lagg_free_llq_entries(struct lagg_llq_slist_entry *); +static void lagg_free_llq_entries(struct lagg_softc *, lagg_llq_idx); /* Simple round robin */ static void lagg_rr_attach(struct lagg_softc *); @@ -165,6 +172,24 @@ static struct mbuf *lagg_lacp_input(stru struct mbuf *); static void lagg_lacp_lladdr(struct lagg_softc *); +/* + * This action handler shall be called from taskqueue handler for each + * submitted operation + */ +typedef void (*lagg_llq_action)(struct lagg_softc *, + struct lagg_llq_slist_entry *); + +/* + * lagg llq action Table: Called at the taskqueue context for each + * submitted operations. + * Contents SHOULD be in sync with lagg_llq_idx index. + * New entries shall be appended. + */ +static const lagg_llq_action llq_action[LAGG_LLQ_MAX] = { + lagg_llq_action_lladdr, /* Maps to LAGG_LLQ_LLADDR index */ + lagg_llq_action_mtu, /* Maps to LAGG_LLQ_MTU index */ +}; + /* lagg protocol table */ static const struct lagg_proto { lagg_proto pr_num; @@ -487,7 +512,7 @@ lagg_clone_create(struct if_clone *ifc, LAGG_LOCK_INIT(sc); SLIST_INIT(&sc->sc_ports); - TASK_INIT(&sc->sc_lladdr_task, 0, lagg_port_setlladdr, sc); + TASK_INIT(&sc->sc_llq_task, 0, lagg_port_ops, sc); /* Initialise pseudo media types */ ifmedia_init(&sc->sc_media, 0, lagg_media_change, @@ -505,6 +530,10 @@ lagg_clone_create(struct if_clone *ifc, ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST; ifp->if_capenable = ifp->if_capabilities = IFCAP_HWSTATS; + mtx_init(&sc->sc_mtu_ctxt.mtu_sync.lock, ifp->if_xname, + "mtu_sync_lock", MTX_DEF); + cv_init(&sc->sc_mtu_ctxt.mtu_sync.cv, "mtu_sync_cv"); + /* * Attach as an ordinary ethernet device, children will be attached * as special device IFT_IEEE8023ADLAG. @@ -553,7 +582,9 @@ lagg_clone_destroy(struct ifnet *ifp) SLIST_REMOVE(&V_lagg_list, sc, lagg_softc, sc_entries); LAGG_LIST_UNLOCK(); - taskqueue_drain(taskqueue_swi, &sc->sc_lladdr_task); + taskqueue_drain(taskqueue_swi, &sc->sc_llq_task); + cv_destroy(&sc->sc_mtu_ctxt.mtu_sync.cv); + mtx_destroy(&sc->sc_mtu_ctxt.mtu_sync.lock); LAGG_LOCK_DESTROY(sc); free(sc, M_DEVBUF); } @@ -645,7 +676,8 @@ lagg_port_lladdr(struct lagg_port *lp, u { struct lagg_softc *sc = lp->lp_softc; struct ifnet *ifp = lp->lp_ifp; - struct lagg_llq *llq; + struct lagg_llq_slist_entry *cmn_llq; + struct lagg_lladdr_llq_ctxt *llq_ctxt; LAGG_WLOCK_ASSERT(sc); @@ -658,51 +690,213 @@ lagg_port_lladdr(struct lagg_port *lp, u return; /* Check to make sure its not already queued to be changed */ - SLIST_FOREACH(llq, &sc->sc_llq_head, llq_entries) { - if (llq->llq_ifp == ifp) { + SLIST_FOREACH(cmn_llq, &sc->sc_llq[LAGG_LLQ_LLADDR], + llq_entries) { + llq_ctxt = (struct lagg_lladdr_llq_ctxt *)cmn_llq; + if (llq_ctxt->llq_ifp == ifp) { /* Update lladdr, it may have changed */ - bcopy(lladdr, llq->llq_lladdr, ETHER_ADDR_LEN); + bcopy(lladdr, llq_ctxt->llq_lladdr, ETHER_ADDR_LEN); return; } } - llq = malloc(sizeof(struct lagg_llq), M_DEVBUF, M_NOWAIT | M_ZERO); - if (llq == NULL) /* XXX what to do */ + llq_ctxt = malloc(sizeof(struct lagg_lladdr_llq_ctxt), M_DEVBUF, + M_NOWAIT | M_ZERO); + if (llq_ctxt == NULL) /* XXX what to do */ return; - llq->llq_ifp = ifp; - llq->llq_type = llq_type; - bcopy(lladdr, llq->llq_lladdr, ETHER_ADDR_LEN); + llq_ctxt->llq_ifp = ifp; + llq_ctxt->llq_type = llq_type; + bcopy(lladdr, llq_ctxt->llq_lladdr, ETHER_ADDR_LEN); /* XXX: We should insert to tail */ - SLIST_INSERT_HEAD(&sc->sc_llq_head, llq, llq_entries); + SLIST_INSERT_HEAD(&sc->sc_llq[LAGG_LLQ_LLADDR], + (struct lagg_llq_slist_entry *)llq_ctxt, llq_entries); - taskqueue_enqueue(taskqueue_swi, &sc->sc_lladdr_task); + taskqueue_enqueue(taskqueue_swi, &sc->sc_llq_task); } /* - * Set the interface MAC address from a taskqueue to avoid a LOR. + * Set the interface MTU, MAC address from a taskqueue to avoid a LOR. * * Set noinline to be dtrace-friendly */ static __noinline void -lagg_port_setlladdr(void *arg, int pending) +lagg_port_ops(void *arg, int pending) { struct lagg_softc *sc = (struct lagg_softc *)arg; - struct lagg_llq *llq, *head; - struct ifnet *ifp; + struct lagg_llq_slist_entry *llq_first; + lagg_llq_idx llq_idx; + + for (llq_idx = LAGG_LLQ_MIN; llq_idx < LAGG_LLQ_MAX; llq_idx++) { + LAGG_WLOCK(sc); + llq_first = SLIST_FIRST(&sc->sc_llq[llq_idx]); + SLIST_INIT(&sc->sc_llq[llq_idx]); + LAGG_WUNLOCK(sc); + + if (llq_first != NULL) + llq_action[llq_idx](sc, llq_first); + } +} + +static void +lagg_llq_action_mtu(struct lagg_softc *sc, struct lagg_llq_slist_entry *first) +{ + struct lagg_llq_slist_entry *llq; + int err; + + /* Set the new MTU on the lagg interface */ + LAGG_WLOCK(sc); + sc->sc_ifp->if_mtu = ((struct lagg_mtu_llq_ctxt *)first)->llq_ifr.ifr_mtu; + LAGG_WUNLOCK(sc); + + /* + * Traverse the queue and set the mtu on each ifp. It is safe to do + * unlocked as we have the only reference to it. + */ + err = EIO; /* In case the list is empty. */ + llq = first; + SLIST_FOREACH_FROM(llq, (struct __llqhd *)NULL, llq_entries) { + struct lagg_mtu_llq_ctxt *llq_ctxt; + + llq_ctxt = (struct lagg_mtu_llq_ctxt *)llq; + /* Set the new MTU on the physical interface */ + err = (*llq_ctxt->llq_ioctl)(llq_ctxt->llq_ifp, SIOCSIFMTU, + (caddr_t)&llq_ctxt->llq_ifr); + if (err) { + if_printf(llq_ctxt->llq_ifp, + "Failed to change MTU from %d to %d (err %d)\n", + llq_ctxt->llq_old_mtu, llq_ctxt->llq_ifr.ifr_mtu, err); + break; + } + } + + if (err) { + /* Restore the old MTU on the lagg interface */ + LAGG_WLOCK(sc); + sc->sc_ifp->if_mtu = ((struct lagg_mtu_llq_ctxt *)first)->llq_old_mtu; + LAGG_WUNLOCK(sc); + + /* Restore the old MTU on the physical interface */ + llq = first; + SLIST_FOREACH_FROM(llq, (struct __llqhd *)NULL, llq_entries) { + struct lagg_mtu_llq_ctxt *llq_ctxt; + + llq_ctxt = (struct lagg_mtu_llq_ctxt *)llq; + llq_ctxt->llq_ifr.ifr_mtu = llq_ctxt->llq_old_mtu; + err = (*llq_ctxt->llq_ioctl) + (llq_ctxt->llq_ifp, SIOCSIFMTU, (caddr_t)&llq_ctxt->llq_ifr); + if (err) { + if_printf(llq_ctxt->llq_ifp, + "Failed to restore MTU to %d (err %d)\n", + llq_ctxt->llq_old_mtu, err); + } + } + } + + /* Free the MTU LLQ entries */ + _lagg_free_llq_entries(first); + + mtx_lock(&sc->sc_mtu_ctxt.mtu_sync.lock); + sc->sc_mtu_ctxt.mtu_cmd_ret = err; + /* Signal for command completion */ + cv_signal(&sc->sc_mtu_ctxt.mtu_sync.cv); + mtx_unlock(&sc->sc_mtu_ctxt.mtu_sync.lock); +} + +static void +_lagg_free_llq_entries(struct lagg_llq_slist_entry *llq) +{ + struct lagg_llq_slist_entry *tmp_llq; - /* Grab a local reference of the queue and remove it from the softc */ + SLIST_FOREACH_FROM_SAFE(llq, (struct __llqhd *)NULL, llq_entries, + tmp_llq) { + free(llq, M_DEVBUF); + } +} + +static void +lagg_free_llq_entries(struct lagg_softc *sc, lagg_llq_idx idx) +{ + struct lagg_llq_slist_entry *llq; + + LAGG_WLOCK_ASSERT(sc); + + llq = SLIST_FIRST(&sc->sc_llq[idx]); + SLIST_INIT(&sc->sc_llq[idx]); + + _lagg_free_llq_entries(llq); +} + +static int +lagg_change_mtu(struct ifnet *ifp, struct ifreq *ifr) +{ + struct lagg_softc *sc; + struct lagg_port *lp; + struct lagg_mtu_llq_ctxt *llq_ctxt; + int ret; + + sc = (struct lagg_softc *)ifp->if_softc; + ret = 0; + + LAGG_WLOCK(sc); + if (SLIST_EMPTY(&sc->sc_ports)) { + LAGG_WUNLOCK(sc); + return (EIO); + } else if (sc->sc_mtu_ctxt.busy) { + LAGG_WUNLOCK(sc); + return (EBUSY); + } else if (ifp->if_mtu == ifr->ifr_mtu) { + LAGG_WUNLOCK(sc); + return (0); + } + sc->sc_mtu_ctxt.busy = TRUE; + + SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { + llq_ctxt = malloc(sizeof(struct lagg_mtu_llq_ctxt), M_DEVBUF, + M_NOWAIT); + if (llq_ctxt == NULL) { + lagg_free_llq_entries(sc, LAGG_LLQ_MTU); + ret = ENOMEM; + goto out; + } + SLIST_INSERT_HEAD(&sc->sc_llq[LAGG_LLQ_MTU], + (struct lagg_llq_slist_entry *)llq_ctxt, llq_entries); + + bcopy(ifr, &llq_ctxt->llq_ifr, sizeof(struct ifreq)); + llq_ctxt->llq_old_mtu = ifp->if_mtu; + llq_ctxt->llq_ifp = lp->lp_ifp; + llq_ctxt->llq_ioctl = lp->lp_ioctl; + } + mtx_lock(&sc->sc_mtu_ctxt.mtu_sync.lock); + taskqueue_enqueue(taskqueue_swi, &sc->sc_llq_task); + LAGG_WUNLOCK(sc); + + /* Wait for the command completion */ + cv_wait(&sc->sc_mtu_ctxt.mtu_sync.cv, &sc->sc_mtu_ctxt.mtu_sync.lock); + ret = sc->sc_mtu_ctxt.mtu_cmd_ret; + mtx_unlock(&sc->sc_mtu_ctxt.mtu_sync.lock); LAGG_WLOCK(sc); - head = SLIST_FIRST(&sc->sc_llq_head); - SLIST_FIRST(&sc->sc_llq_head) = NULL; + +out: + sc->sc_mtu_ctxt.busy = FALSE; LAGG_WUNLOCK(sc); + return (ret); +} + +static void +lagg_llq_action_lladdr(struct lagg_softc *sc, struct lagg_llq_slist_entry *head) +{ + struct lagg_lladdr_llq_ctxt *llq_ctxt; + struct lagg_llq_slist_entry *llq; + struct ifnet *ifp; /* * Traverse the queue and set the lladdr on each ifp. It is safe to do * unlocked as we have the only reference to it. */ for (llq = head; llq != NULL; llq = head) { - ifp = llq->llq_ifp; + llq_ctxt = (struct lagg_lladdr_llq_ctxt *)llq; + ifp = llq_ctxt->llq_ifp; CURVNET_SET(ifp->if_vnet); @@ -711,9 +905,8 @@ lagg_port_setlladdr(void *arg, int pendi * Note that if_setlladdr() or iflladdr_event handler * may result in arp transmission / lltable updates. */ - if (llq->llq_type == LAGG_LLQTYPE_PHYS) - if_setlladdr(ifp, llq->llq_lladdr, - ETHER_ADDR_LEN); + if (llq_ctxt->llq_type == LAGG_LLQTYPE_PHYS) + if_setlladdr(ifp, llq_ctxt->llq_lladdr, ETHER_ADDR_LEN); else EVENTHANDLER_INVOKE(iflladdr_event, ifp); CURVNET_RESTORE(); @@ -877,7 +1070,8 @@ lagg_port_destroy(struct lagg_port *lp, { struct lagg_softc *sc = lp->lp_softc; struct lagg_port *lp_ptr, *lp0; - struct lagg_llq *llq; + struct lagg_llq_slist_entry *cmn_llq; + struct lagg_lladdr_llq_ctxt *llq_ctxt; struct ifnet *ifp = lp->lp_ifp; uint64_t *pval, vdiff; int i; @@ -940,11 +1134,12 @@ lagg_port_destroy(struct lagg_port *lp, /* Remove any pending lladdr changes from the queue */ if (lp->lp_detaching) { - SLIST_FOREACH(llq, &sc->sc_llq_head, llq_entries) { - if (llq->llq_ifp == ifp) { - SLIST_REMOVE(&sc->sc_llq_head, llq, lagg_llq, - llq_entries); - free(llq, M_DEVBUF); + SLIST_FOREACH(cmn_llq, &sc->sc_llq[LAGG_LLQ_LLADDR], llq_entries) { + llq_ctxt = (struct lagg_lladdr_llq_ctxt *)cmn_llq; + if (llq_ctxt->llq_ifp == ifp) { + SLIST_REMOVE(&sc->sc_llq[LAGG_LLQ_LLADDR], cmn_llq, + lagg_llq_slist_entry, llq_entries); + free(cmn_llq, M_DEVBUF); break; /* Only appears once */ } } @@ -1537,10 +1732,12 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd break; case SIOCSIFCAP: - case SIOCSIFMTU: - /* Do not allow the MTU or caps to be directly changed */ + /* Do not allow the CAPs to be directly changed. */ error = EINVAL; break; + case SIOCSIFMTU: + error = lagg_change_mtu(ifp, ifr); + break; default: error = ether_ioctl(ifp, cmd, data); Modified: head/sys/net/if_lagg.h ============================================================================== --- head/sys/net/if_lagg.h Wed Apr 6 04:10:22 2016 (r297608) +++ head/sys/net/if_lagg.h Wed Apr 6 04:50:28 2016 (r297609) @@ -21,6 +21,8 @@ #ifndef _NET_LAGG_H #define _NET_LAGG_H +#include + /* * Global definitions */ @@ -207,18 +209,55 @@ typedef enum { LAGG_LLQTYPE_VIRT, /* Task related to lagg interface itself */ } lagg_llqtype; -/* List of interfaces to have the MAC address modified */ -struct lagg_llq { +/* Adding new entry here, SHOULD also have relevant entry in llq_action */ +typedef enum { + LAGG_LLQ_MIN = 0, + LAGG_LLQ_LLADDR = LAGG_LLQ_MIN, /* MAC Address index */ + LAGG_LLQ_MTU, /* MTU index */ + LAGG_LLQ_MAX /* This SHOULD be the last entry */ +} lagg_llq_idx; + +/* Common list entry definition for each taskq operation */ +struct lagg_llq_slist_entry { + SLIST_ENTRY(lagg_llq_slist_entry) llq_entries; +}; + +/* Context for lladdr llq operation part of lagg soft context */ +struct lagg_lladdr_llq_ctxt { + struct lagg_llq_slist_entry llq_cmn; /* This SHOULD be the first + member */ struct ifnet *llq_ifp; uint8_t llq_lladdr[ETHER_ADDR_LEN]; lagg_llqtype llq_type; - SLIST_ENTRY(lagg_llq) llq_entries; +}; + +/* Context for mtu llq operation part of lagg soft context */ +struct lagg_mtu_llq_ctxt { + struct lagg_llq_slist_entry llq_cmn; /* This SHOULD be the first + member */ + struct ifnet *llq_ifp; + struct ifreq llq_ifr; + uint32_t llq_old_mtu; + int (*llq_ioctl)(struct ifnet *, u_long, caddr_t); }; struct lagg_counters { uint64_t val[IFCOUNTERS]; }; +/* Conditional variables context for lagg operations */ +struct lagg_signal { + struct mtx lock; + struct cv cv; +}; + +/* Lagg MTU context */ +struct lagg_mtu_ctxt { + struct lagg_signal mtu_sync; /* Synchronize cmd completion */ + int mtu_cmd_ret; + bool busy; +}; + struct lagg_softc { struct ifnet *sc_ifp; /* virtual interface */ struct rmlock sc_mtx; @@ -236,9 +275,12 @@ struct lagg_softc { SLIST_HEAD(__tplhd, lagg_port) sc_ports; /* list of interfaces */ SLIST_ENTRY(lagg_softc) sc_entries; - struct task sc_lladdr_task; - SLIST_HEAD(__llqhd, lagg_llq) sc_llq_head; /* interfaces to program - the lladdr on */ + struct task sc_llq_task; /* SYNC & ASYNC ops + enqueued here */ + struct lagg_mtu_ctxt sc_mtu_ctxt; /* MTU programming */ + /* List of LLQs */ + SLIST_HEAD(__llqhd, lagg_llq_slist_entry) sc_llq[LAGG_LLQ_MAX]; + eventhandler_tag vlan_attach; eventhandler_tag vlan_detach; struct callout sc_callout; From owner-svn-src-all@freebsd.org Wed Apr 6 04:55:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B14FCB041EC; Wed, 6 Apr 2016 04:55:59 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x230.google.com (mail-pf0-x230.google.com [IPv6:2607:f8b0:400e:c00::230]) (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 88E731AFE; Wed, 6 Apr 2016 04:55:56 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x230.google.com with SMTP id 184so25549757pff.0; Tue, 05 Apr 2016 21:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=bRiokslzPT0BkPSJbxjY6M0t3ZuG4CGVX1SAwQavzzM=; b=XIkU/sJJJcJdaofDvTZuVzAIvui9Usj7PXhMhG2y6qVAnAEc8r09tX1AOkmQ4x7Z5P AieD8bXCUDyLPR/K50PXnp8FNVglbgtk5OMo6lHqi2KIY6vJoM6rbLVeRxKDbKll0rwr ghlnxVuftdNK2nretgGEMdWOAR8GEXFdryifU4Ab3TJod/GXwZOWWG+FqqJpil7Xe4g6 raRY2Me+ItJXn20Pam9MnZuF8jmCU3cqa/AKNJ1OihNlSK4QiVlgx8Cb1YLib3jDCxE0 I2M/fZbzzLkGaN6yhTdLOzBtIyu21A1d1F3+DL0yWsAxCNYdUOre8U98iyBYDi+GXJfa oXow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=bRiokslzPT0BkPSJbxjY6M0t3ZuG4CGVX1SAwQavzzM=; b=AaCWtZQXDBmTJugGL9Fki53H17zpU2rlh/9JLoIveP5JfCThLtBdv4GiBtMIbEqyVd kUjPTv01ke3/hOvsRNkobYO5G0V7O2rH9y5EXViyp0H7qwIZHXODLi4X0gJ3EsvUR23X algTV+FVQecsN/zY/ui/1NJv6TRw3K78tF6sYR1Dr9Ytt3WwGKtc1v4DOyZidhfVTLCz 9gq19y5lCaeGlpErm2S9Mg/KPhzXQXfIY4YtN8XDamX8TTKkKGwu1Z/pdSkLgtqKpzvZ W09V1YolMrvYuc79l2F7qOvtVAOM4re9DCWwYsNFIxFydSuGfaz7PJJ1WHe8iWGtEce2 AAYQ== X-Gm-Message-State: AD7BkJJKD9YbQxbtsinW3A5KRWS2bSgvEQGjUG0NMDuDQB2S8zr5C0FViGWs3e1FhWSNOA== X-Received: by 10.98.64.79 with SMTP id n76mr35384956pfa.149.1459918556112; Tue, 05 Apr 2016 21:55:56 -0700 (PDT) Received: from [192.168.20.7] (c-24-16-212-205.hsd1.wa.comcast.net. [24.16.212.205]) by smtp.gmail.com with ESMTPSA id y27sm1206712pfi.11.2016.04.05.21.55.54 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 05 Apr 2016 21:55:55 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: svn commit: r297609 - in head/sys: dev/isci/scil net From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201604060450.u364oSQu089743@repo.freebsd.org> Date: Tue, 5 Apr 2016 21:55:53 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: <3BD273AD-4CC8-470E-9FAE-A0A06F89FFB2@gmail.com> References: <201604060450.u364oSQu089743@repo.freebsd.org> To: Ravi Pokala X-Mailer: Apple Mail (2.2104) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 04:55:59 -0000 > On Apr 5, 2016, at 21:50, Ravi Pokala wrote: > > Author: rpokala > Date: Wed Apr 6 04:50:28 2016 > New Revision: 297609 > URL: https://svnweb.freebsd.org/changeset/base/297609 > > Log: > Storage Controller Interface driver - typo in unimplemented macro in > scic_sds_controller_registers.h > > s/contoller/controller/ > > PR: 207336 > Submitted by: Tony Narlock > > Modified: > head/sys/dev/isci/scil/scic_sds_controller_registers.h > head/sys/net/if_lagg.c > head/sys/net/if_lagg.h It looks like the if_lagg changes are unrelated... From owner-svn-src-all@freebsd.org Wed Apr 6 04:58:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A36CB04296; Wed, 6 Apr 2016 04:58:22 +0000 (UTC) (envelope-from rpokala@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 mx1.freebsd.org (Postfix) with ESMTPS id 1A7B51C8F; Wed, 6 Apr 2016 04:58:22 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u364wLn8092628; Wed, 6 Apr 2016 04:58:21 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u364wLwJ092626; Wed, 6 Apr 2016 04:58:21 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201604060458.u364wLwJ092626@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Wed, 6 Apr 2016 04:58:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297610 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 04:58:22 -0000 Author: rpokala Date: Wed Apr 6 04:58:20 2016 New Revision: 297610 URL: https://svnweb.freebsd.org/changeset/base/297610 Log: Revert accidental submit of WIP as part of r297609 Pointyhat to: rpokala Modified: head/sys/net/if_lagg.c head/sys/net/if_lagg.h Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Wed Apr 6 04:50:28 2016 (r297609) +++ head/sys/net/if_lagg.c Wed Apr 6 04:58:20 2016 (r297610) @@ -101,11 +101,7 @@ static const char laggname[] = "lagg"; static void lagg_lladdr(struct lagg_softc *, uint8_t *); static void lagg_capabilities(struct lagg_softc *); static void lagg_port_lladdr(struct lagg_port *, uint8_t *, lagg_llqtype); -static void lagg_port_ops(void *, int); -static void lagg_llq_action_mtu(struct lagg_softc *, - struct lagg_llq_slist_entry *); -static void lagg_llq_action_lladdr(struct lagg_softc *, - struct lagg_llq_slist_entry *); +static void lagg_port_setlladdr(void *, int); static int lagg_port_create(struct lagg_softc *, struct ifnet *); static int lagg_port_destroy(struct lagg_port *, int); static struct mbuf *lagg_input(struct ifnet *, struct mbuf *); @@ -134,9 +130,6 @@ static int lagg_media_change(struct ifne static void lagg_media_status(struct ifnet *, struct ifmediareq *); static struct lagg_port *lagg_link_active(struct lagg_softc *, struct lagg_port *); -static int lagg_change_mtu(struct ifnet *, struct ifreq *); -static void _lagg_free_llq_entries(struct lagg_llq_slist_entry *); -static void lagg_free_llq_entries(struct lagg_softc *, lagg_llq_idx); /* Simple round robin */ static void lagg_rr_attach(struct lagg_softc *); @@ -172,24 +165,6 @@ static struct mbuf *lagg_lacp_input(stru struct mbuf *); static void lagg_lacp_lladdr(struct lagg_softc *); -/* - * This action handler shall be called from taskqueue handler for each - * submitted operation - */ -typedef void (*lagg_llq_action)(struct lagg_softc *, - struct lagg_llq_slist_entry *); - -/* - * lagg llq action Table: Called at the taskqueue context for each - * submitted operations. - * Contents SHOULD be in sync with lagg_llq_idx index. - * New entries shall be appended. - */ -static const lagg_llq_action llq_action[LAGG_LLQ_MAX] = { - lagg_llq_action_lladdr, /* Maps to LAGG_LLQ_LLADDR index */ - lagg_llq_action_mtu, /* Maps to LAGG_LLQ_MTU index */ -}; - /* lagg protocol table */ static const struct lagg_proto { lagg_proto pr_num; @@ -512,7 +487,7 @@ lagg_clone_create(struct if_clone *ifc, LAGG_LOCK_INIT(sc); SLIST_INIT(&sc->sc_ports); - TASK_INIT(&sc->sc_llq_task, 0, lagg_port_ops, sc); + TASK_INIT(&sc->sc_lladdr_task, 0, lagg_port_setlladdr, sc); /* Initialise pseudo media types */ ifmedia_init(&sc->sc_media, 0, lagg_media_change, @@ -530,10 +505,6 @@ lagg_clone_create(struct if_clone *ifc, ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST; ifp->if_capenable = ifp->if_capabilities = IFCAP_HWSTATS; - mtx_init(&sc->sc_mtu_ctxt.mtu_sync.lock, ifp->if_xname, - "mtu_sync_lock", MTX_DEF); - cv_init(&sc->sc_mtu_ctxt.mtu_sync.cv, "mtu_sync_cv"); - /* * Attach as an ordinary ethernet device, children will be attached * as special device IFT_IEEE8023ADLAG. @@ -582,9 +553,7 @@ lagg_clone_destroy(struct ifnet *ifp) SLIST_REMOVE(&V_lagg_list, sc, lagg_softc, sc_entries); LAGG_LIST_UNLOCK(); - taskqueue_drain(taskqueue_swi, &sc->sc_llq_task); - cv_destroy(&sc->sc_mtu_ctxt.mtu_sync.cv); - mtx_destroy(&sc->sc_mtu_ctxt.mtu_sync.lock); + taskqueue_drain(taskqueue_swi, &sc->sc_lladdr_task); LAGG_LOCK_DESTROY(sc); free(sc, M_DEVBUF); } @@ -676,8 +645,7 @@ lagg_port_lladdr(struct lagg_port *lp, u { struct lagg_softc *sc = lp->lp_softc; struct ifnet *ifp = lp->lp_ifp; - struct lagg_llq_slist_entry *cmn_llq; - struct lagg_lladdr_llq_ctxt *llq_ctxt; + struct lagg_llq *llq; LAGG_WLOCK_ASSERT(sc); @@ -690,213 +658,51 @@ lagg_port_lladdr(struct lagg_port *lp, u return; /* Check to make sure its not already queued to be changed */ - SLIST_FOREACH(cmn_llq, &sc->sc_llq[LAGG_LLQ_LLADDR], - llq_entries) { - llq_ctxt = (struct lagg_lladdr_llq_ctxt *)cmn_llq; - if (llq_ctxt->llq_ifp == ifp) { + SLIST_FOREACH(llq, &sc->sc_llq_head, llq_entries) { + if (llq->llq_ifp == ifp) { /* Update lladdr, it may have changed */ - bcopy(lladdr, llq_ctxt->llq_lladdr, ETHER_ADDR_LEN); + bcopy(lladdr, llq->llq_lladdr, ETHER_ADDR_LEN); return; } } - llq_ctxt = malloc(sizeof(struct lagg_lladdr_llq_ctxt), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (llq_ctxt == NULL) /* XXX what to do */ + llq = malloc(sizeof(struct lagg_llq), M_DEVBUF, M_NOWAIT | M_ZERO); + if (llq == NULL) /* XXX what to do */ return; - llq_ctxt->llq_ifp = ifp; - llq_ctxt->llq_type = llq_type; - bcopy(lladdr, llq_ctxt->llq_lladdr, ETHER_ADDR_LEN); + llq->llq_ifp = ifp; + llq->llq_type = llq_type; + bcopy(lladdr, llq->llq_lladdr, ETHER_ADDR_LEN); /* XXX: We should insert to tail */ - SLIST_INSERT_HEAD(&sc->sc_llq[LAGG_LLQ_LLADDR], - (struct lagg_llq_slist_entry *)llq_ctxt, llq_entries); + SLIST_INSERT_HEAD(&sc->sc_llq_head, llq, llq_entries); - taskqueue_enqueue(taskqueue_swi, &sc->sc_llq_task); + taskqueue_enqueue(taskqueue_swi, &sc->sc_lladdr_task); } /* - * Set the interface MTU, MAC address from a taskqueue to avoid a LOR. + * Set the interface MAC address from a taskqueue to avoid a LOR. * * Set noinline to be dtrace-friendly */ static __noinline void -lagg_port_ops(void *arg, int pending) +lagg_port_setlladdr(void *arg, int pending) { struct lagg_softc *sc = (struct lagg_softc *)arg; - struct lagg_llq_slist_entry *llq_first; - lagg_llq_idx llq_idx; - - for (llq_idx = LAGG_LLQ_MIN; llq_idx < LAGG_LLQ_MAX; llq_idx++) { - LAGG_WLOCK(sc); - llq_first = SLIST_FIRST(&sc->sc_llq[llq_idx]); - SLIST_INIT(&sc->sc_llq[llq_idx]); - LAGG_WUNLOCK(sc); - - if (llq_first != NULL) - llq_action[llq_idx](sc, llq_first); - } -} - -static void -lagg_llq_action_mtu(struct lagg_softc *sc, struct lagg_llq_slist_entry *first) -{ - struct lagg_llq_slist_entry *llq; - int err; - - /* Set the new MTU on the lagg interface */ - LAGG_WLOCK(sc); - sc->sc_ifp->if_mtu = ((struct lagg_mtu_llq_ctxt *)first)->llq_ifr.ifr_mtu; - LAGG_WUNLOCK(sc); - - /* - * Traverse the queue and set the mtu on each ifp. It is safe to do - * unlocked as we have the only reference to it. - */ - err = EIO; /* In case the list is empty. */ - llq = first; - SLIST_FOREACH_FROM(llq, (struct __llqhd *)NULL, llq_entries) { - struct lagg_mtu_llq_ctxt *llq_ctxt; - - llq_ctxt = (struct lagg_mtu_llq_ctxt *)llq; - /* Set the new MTU on the physical interface */ - err = (*llq_ctxt->llq_ioctl)(llq_ctxt->llq_ifp, SIOCSIFMTU, - (caddr_t)&llq_ctxt->llq_ifr); - if (err) { - if_printf(llq_ctxt->llq_ifp, - "Failed to change MTU from %d to %d (err %d)\n", - llq_ctxt->llq_old_mtu, llq_ctxt->llq_ifr.ifr_mtu, err); - break; - } - } - - if (err) { - /* Restore the old MTU on the lagg interface */ - LAGG_WLOCK(sc); - sc->sc_ifp->if_mtu = ((struct lagg_mtu_llq_ctxt *)first)->llq_old_mtu; - LAGG_WUNLOCK(sc); - - /* Restore the old MTU on the physical interface */ - llq = first; - SLIST_FOREACH_FROM(llq, (struct __llqhd *)NULL, llq_entries) { - struct lagg_mtu_llq_ctxt *llq_ctxt; - - llq_ctxt = (struct lagg_mtu_llq_ctxt *)llq; - llq_ctxt->llq_ifr.ifr_mtu = llq_ctxt->llq_old_mtu; - err = (*llq_ctxt->llq_ioctl) - (llq_ctxt->llq_ifp, SIOCSIFMTU, (caddr_t)&llq_ctxt->llq_ifr); - if (err) { - if_printf(llq_ctxt->llq_ifp, - "Failed to restore MTU to %d (err %d)\n", - llq_ctxt->llq_old_mtu, err); - } - } - } - - /* Free the MTU LLQ entries */ - _lagg_free_llq_entries(first); - - mtx_lock(&sc->sc_mtu_ctxt.mtu_sync.lock); - sc->sc_mtu_ctxt.mtu_cmd_ret = err; - /* Signal for command completion */ - cv_signal(&sc->sc_mtu_ctxt.mtu_sync.cv); - mtx_unlock(&sc->sc_mtu_ctxt.mtu_sync.lock); -} - -static void -_lagg_free_llq_entries(struct lagg_llq_slist_entry *llq) -{ - struct lagg_llq_slist_entry *tmp_llq; - - SLIST_FOREACH_FROM_SAFE(llq, (struct __llqhd *)NULL, llq_entries, - tmp_llq) { - free(llq, M_DEVBUF); - } -} - -static void -lagg_free_llq_entries(struct lagg_softc *sc, lagg_llq_idx idx) -{ - struct lagg_llq_slist_entry *llq; - - LAGG_WLOCK_ASSERT(sc); - - llq = SLIST_FIRST(&sc->sc_llq[idx]); - SLIST_INIT(&sc->sc_llq[idx]); - - _lagg_free_llq_entries(llq); -} - -static int -lagg_change_mtu(struct ifnet *ifp, struct ifreq *ifr) -{ - struct lagg_softc *sc; - struct lagg_port *lp; - struct lagg_mtu_llq_ctxt *llq_ctxt; - int ret; - - sc = (struct lagg_softc *)ifp->if_softc; - ret = 0; - - LAGG_WLOCK(sc); - if (SLIST_EMPTY(&sc->sc_ports)) { - LAGG_WUNLOCK(sc); - return (EIO); - } else if (sc->sc_mtu_ctxt.busy) { - LAGG_WUNLOCK(sc); - return (EBUSY); - } else if (ifp->if_mtu == ifr->ifr_mtu) { - LAGG_WUNLOCK(sc); - return (0); - } - sc->sc_mtu_ctxt.busy = TRUE; - - SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { - llq_ctxt = malloc(sizeof(struct lagg_mtu_llq_ctxt), M_DEVBUF, - M_NOWAIT); - if (llq_ctxt == NULL) { - lagg_free_llq_entries(sc, LAGG_LLQ_MTU); - ret = ENOMEM; - goto out; - } - SLIST_INSERT_HEAD(&sc->sc_llq[LAGG_LLQ_MTU], - (struct lagg_llq_slist_entry *)llq_ctxt, llq_entries); - - bcopy(ifr, &llq_ctxt->llq_ifr, sizeof(struct ifreq)); - llq_ctxt->llq_old_mtu = ifp->if_mtu; - llq_ctxt->llq_ifp = lp->lp_ifp; - llq_ctxt->llq_ioctl = lp->lp_ioctl; - } - mtx_lock(&sc->sc_mtu_ctxt.mtu_sync.lock); - taskqueue_enqueue(taskqueue_swi, &sc->sc_llq_task); - LAGG_WUNLOCK(sc); + struct lagg_llq *llq, *head; + struct ifnet *ifp; - /* Wait for the command completion */ - cv_wait(&sc->sc_mtu_ctxt.mtu_sync.cv, &sc->sc_mtu_ctxt.mtu_sync.lock); - ret = sc->sc_mtu_ctxt.mtu_cmd_ret; - mtx_unlock(&sc->sc_mtu_ctxt.mtu_sync.lock); + /* Grab a local reference of the queue and remove it from the softc */ LAGG_WLOCK(sc); - -out: - sc->sc_mtu_ctxt.busy = FALSE; + head = SLIST_FIRST(&sc->sc_llq_head); + SLIST_FIRST(&sc->sc_llq_head) = NULL; LAGG_WUNLOCK(sc); - return (ret); -} - -static void -lagg_llq_action_lladdr(struct lagg_softc *sc, struct lagg_llq_slist_entry *head) -{ - struct lagg_lladdr_llq_ctxt *llq_ctxt; - struct lagg_llq_slist_entry *llq; - struct ifnet *ifp; /* * Traverse the queue and set the lladdr on each ifp. It is safe to do * unlocked as we have the only reference to it. */ for (llq = head; llq != NULL; llq = head) { - llq_ctxt = (struct lagg_lladdr_llq_ctxt *)llq; - ifp = llq_ctxt->llq_ifp; + ifp = llq->llq_ifp; CURVNET_SET(ifp->if_vnet); @@ -905,8 +711,9 @@ lagg_llq_action_lladdr(struct lagg_softc * Note that if_setlladdr() or iflladdr_event handler * may result in arp transmission / lltable updates. */ - if (llq_ctxt->llq_type == LAGG_LLQTYPE_PHYS) - if_setlladdr(ifp, llq_ctxt->llq_lladdr, ETHER_ADDR_LEN); + if (llq->llq_type == LAGG_LLQTYPE_PHYS) + if_setlladdr(ifp, llq->llq_lladdr, + ETHER_ADDR_LEN); else EVENTHANDLER_INVOKE(iflladdr_event, ifp); CURVNET_RESTORE(); @@ -1070,8 +877,7 @@ lagg_port_destroy(struct lagg_port *lp, { struct lagg_softc *sc = lp->lp_softc; struct lagg_port *lp_ptr, *lp0; - struct lagg_llq_slist_entry *cmn_llq; - struct lagg_lladdr_llq_ctxt *llq_ctxt; + struct lagg_llq *llq; struct ifnet *ifp = lp->lp_ifp; uint64_t *pval, vdiff; int i; @@ -1134,12 +940,11 @@ lagg_port_destroy(struct lagg_port *lp, /* Remove any pending lladdr changes from the queue */ if (lp->lp_detaching) { - SLIST_FOREACH(cmn_llq, &sc->sc_llq[LAGG_LLQ_LLADDR], llq_entries) { - llq_ctxt = (struct lagg_lladdr_llq_ctxt *)cmn_llq; - if (llq_ctxt->llq_ifp == ifp) { - SLIST_REMOVE(&sc->sc_llq[LAGG_LLQ_LLADDR], cmn_llq, - lagg_llq_slist_entry, llq_entries); - free(cmn_llq, M_DEVBUF); + SLIST_FOREACH(llq, &sc->sc_llq_head, llq_entries) { + if (llq->llq_ifp == ifp) { + SLIST_REMOVE(&sc->sc_llq_head, llq, lagg_llq, + llq_entries); + free(llq, M_DEVBUF); break; /* Only appears once */ } } @@ -1732,11 +1537,9 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd break; case SIOCSIFCAP: - /* Do not allow the CAPs to be directly changed. */ - error = EINVAL; - break; case SIOCSIFMTU: - error = lagg_change_mtu(ifp, ifr); + /* Do not allow the MTU or caps to be directly changed */ + error = EINVAL; break; default: Modified: head/sys/net/if_lagg.h ============================================================================== --- head/sys/net/if_lagg.h Wed Apr 6 04:50:28 2016 (r297609) +++ head/sys/net/if_lagg.h Wed Apr 6 04:58:20 2016 (r297610) @@ -21,8 +21,6 @@ #ifndef _NET_LAGG_H #define _NET_LAGG_H -#include - /* * Global definitions */ @@ -209,55 +207,18 @@ typedef enum { LAGG_LLQTYPE_VIRT, /* Task related to lagg interface itself */ } lagg_llqtype; -/* Adding new entry here, SHOULD also have relevant entry in llq_action */ -typedef enum { - LAGG_LLQ_MIN = 0, - LAGG_LLQ_LLADDR = LAGG_LLQ_MIN, /* MAC Address index */ - LAGG_LLQ_MTU, /* MTU index */ - LAGG_LLQ_MAX /* This SHOULD be the last entry */ -} lagg_llq_idx; - -/* Common list entry definition for each taskq operation */ -struct lagg_llq_slist_entry { - SLIST_ENTRY(lagg_llq_slist_entry) llq_entries; -}; - -/* Context for lladdr llq operation part of lagg soft context */ -struct lagg_lladdr_llq_ctxt { - struct lagg_llq_slist_entry llq_cmn; /* This SHOULD be the first - member */ +/* List of interfaces to have the MAC address modified */ +struct lagg_llq { struct ifnet *llq_ifp; uint8_t llq_lladdr[ETHER_ADDR_LEN]; lagg_llqtype llq_type; -}; - -/* Context for mtu llq operation part of lagg soft context */ -struct lagg_mtu_llq_ctxt { - struct lagg_llq_slist_entry llq_cmn; /* This SHOULD be the first - member */ - struct ifnet *llq_ifp; - struct ifreq llq_ifr; - uint32_t llq_old_mtu; - int (*llq_ioctl)(struct ifnet *, u_long, caddr_t); + SLIST_ENTRY(lagg_llq) llq_entries; }; struct lagg_counters { uint64_t val[IFCOUNTERS]; }; -/* Conditional variables context for lagg operations */ -struct lagg_signal { - struct mtx lock; - struct cv cv; -}; - -/* Lagg MTU context */ -struct lagg_mtu_ctxt { - struct lagg_signal mtu_sync; /* Synchronize cmd completion */ - int mtu_cmd_ret; - bool busy; -}; - struct lagg_softc { struct ifnet *sc_ifp; /* virtual interface */ struct rmlock sc_mtx; @@ -275,12 +236,9 @@ struct lagg_softc { SLIST_HEAD(__tplhd, lagg_port) sc_ports; /* list of interfaces */ SLIST_ENTRY(lagg_softc) sc_entries; - struct task sc_llq_task; /* SYNC & ASYNC ops - enqueued here */ - struct lagg_mtu_ctxt sc_mtu_ctxt; /* MTU programming */ - /* List of LLQs */ - SLIST_HEAD(__llqhd, lagg_llq_slist_entry) sc_llq[LAGG_LLQ_MAX]; - + struct task sc_lladdr_task; + SLIST_HEAD(__llqhd, lagg_llq) sc_llq_head; /* interfaces to program + the lladdr on */ eventhandler_tag vlan_attach; eventhandler_tag vlan_detach; struct callout sc_callout; From owner-svn-src-all@freebsd.org Wed Apr 6 05:13:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45BE2B046CA; Wed, 6 Apr 2016 05:13:37 +0000 (UTC) (envelope-from wma@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 mx1.freebsd.org (Postfix) with ESMTPS id 211C9152B; Wed, 6 Apr 2016 05:13:37 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u365DaHD098640; Wed, 6 Apr 2016 05:13:36 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u365DaZ3098638; Wed, 6 Apr 2016 05:13:36 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201604060513.u365DaZ3098638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Wed, 6 Apr 2016 05:13:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297611 - in head/sys: arm64/include cddl/dev/dtrace/aarch64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 05:13:37 -0000 Author: wma Date: Wed Apr 6 05:13:36 2016 New Revision: 297611 URL: https://svnweb.freebsd.org/changeset/base/297611 Log: Implement dtrace_getupcstack in ARM64 Allow using DTRACE for performance analysis of userspace applications - the function call stack can be captured. This is almost an exact copy of AMD64 solution. Obtained from: Semihalf Sponsored by: Cavium Reviewed by: emaste, gnn, jhibbits Differential Revision: https://reviews.freebsd.org/D5779 Modified: head/sys/arm64/include/frame.h head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c Modified: head/sys/arm64/include/frame.h ============================================================================== --- head/sys/arm64/include/frame.h Wed Apr 6 04:58:20 2016 (r297610) +++ head/sys/arm64/include/frame.h Wed Apr 6 05:13:36 2016 (r297611) @@ -49,6 +49,11 @@ struct trapframe { uint64_t tf_x[30]; }; +struct arm64_frame { + struct arm64_frame *f_frame; + u_long f_retaddr; +}; + /* * Signal frame, pushedonto the user stack */ Modified: head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c Wed Apr 6 04:58:20 2016 (r297610) +++ head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c Wed Apr 6 05:13:36 2016 (r297611) @@ -57,6 +57,7 @@ */ #define MAX_FUNCTION_SIZE 0x10000 #define MAX_PROLOGUE_SIZE 0x100 +#define MAX_USTACK_DEPTH 2048 uint8_t dtrace_fuword8_nocheck(void *); uint16_t dtrace_fuword16_nocheck(void *); @@ -111,11 +112,127 @@ dtrace_getpcstack(pc_t *pcstack, int pcs } } +static int +dtrace_getustack_common(uint64_t *pcstack, int pcstack_limit, uintptr_t pc, + uintptr_t fp) +{ + volatile uint16_t *flags = + (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags; + int ret = 0; + uintptr_t oldfp; + + ASSERT(pcstack == NULL || pcstack_limit > 0); + + while (pc != 0) { + /* + * We limit the number of times we can go around this + * loop to account for a circular stack. + */ + if (ret++ >= MAX_USTACK_DEPTH) { + *flags |= CPU_DTRACE_BADSTACK; + cpu_core[curcpu].cpuc_dtrace_illval = fp; + break; + } + + if (pcstack != NULL) { + *pcstack++ = (uint64_t)pc; + pcstack_limit--; + if (pcstack_limit <= 0) + break; + } + + if (fp == 0) + break; + + pc = dtrace_fuword64((void *)(fp + + offsetof(struct arm64_frame, f_retaddr))); + fp = dtrace_fuword64((void *)fp); + + if (fp == oldfp) { + *flags |= CPU_DTRACE_BADSTACK; + cpu_core[curcpu].cpuc_dtrace_illval = fp; + break; + } + + /* + * ARM64TODO: + * This workaround might not be necessary. It needs to be + * revised and removed from all architectures if found + * unwanted. Leaving the original x86 comment for reference. + * + * This is totally bogus: if we faulted, we're going to clear + * the fault and break. This is to deal with the apparently + * broken Java stacks on x86. + */ + if (*flags & CPU_DTRACE_FAULT) { + *flags &= ~CPU_DTRACE_FAULT; + break; + } + } + + return (ret); +} + void dtrace_getupcstack(uint64_t *pcstack, int pcstack_limit) { + proc_t *p = curproc; + struct trapframe *tf; + uintptr_t pc, sp, fp; + volatile uint16_t *flags = + (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags; + int n; + + if (*flags & CPU_DTRACE_FAULT) + return; + + if (pcstack_limit <= 0) + return; + + /* + * If there's no user context we still need to zero the stack. + */ + if (p == NULL || (tf = curthread->td_frame) == NULL) + goto zero; + + *pcstack++ = (uint64_t)p->p_pid; + pcstack_limit--; + + if (pcstack_limit <= 0) + return; + + pc = tf->tf_elr; + sp = tf->tf_sp; + fp = tf->tf_x[29]; - printf("IMPLEMENT ME: %s\n", __func__); + if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_ENTRY)) { + /* + * In an entry probe. The frame pointer has not yet been + * pushed (that happens in the function prologue). The + * best approach is to add the current pc as a missing top + * of stack and back the pc up to the caller, which is stored + * at the current stack pointer address since the call + * instruction puts it there right before the branch. + */ + + *pcstack++ = (uint64_t)pc; + pcstack_limit--; + if (pcstack_limit <= 0) + return; + + pc = tf->tf_lr; + } + + n = dtrace_getustack_common(pcstack, pcstack_limit, pc, fp); + ASSERT(n >= 0); + ASSERT(n <= pcstack_limit); + + pcstack += n; + pcstack_limit -= n; + +zero: + while (pcstack_limit-- > 0) + *pcstack++ = 0; } int From owner-svn-src-all@freebsd.org Wed Apr 6 05:53:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A874FB05330; Wed, 6 Apr 2016 05:53:26 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp003.me.com (mr11p00im-asmtp003.me.com [17.110.69.254]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 953221BB9; Wed, 6 Apr 2016 05:53:26 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from [192.168.1.4] (c-50-174-208-73.hsd1.ca.comcast.net [50.174.208.73]) by mr11p00im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.36.0 64bit (built Sep 8 2015)) with ESMTPSA id <0O5700JEE48VPT10@mr11p00im-asmtp003.me.com>; Wed, 06 Apr 2016 04:53:20 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-04-06_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1510270003 definitions=main-1604060072 User-Agent: Microsoft-MacOutlook/0.0.0.160212 Date: Tue, 05 Apr 2016 21:53:18 -0700 Subject: Re: svn commit: r297609 - in head/sys: dev/isci/scil net From: Ravi Pokala Sender: "Pokala, Ravi" To: Ravi Pokala , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: <93D5740F-BE9F-4BA0-934E-9C95FBD4B5E4@panasas.com> Thread-topic: svn commit: r297609 - in head/sys: dev/isci/scil net References: <201604060450.u364oSQu089743@repo.freebsd.org> In-reply-to: <201604060450.u364oSQu089743@repo.freebsd.org> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 05:53:26 -0000 Frack - this was only supposed to be the isci(4) change, not the lagg(4) changes. Reverting momentarily... -Ravi (rpokala@) -----Original Message----- From: on behalf of Ravi Pokala Date: 2016-04-05, Tuesday at 21:50 To: , , Subject: svn commit: r297609 - in head/sys: dev/isci/scil net >Author: rpokala >Date: Wed Apr 6 04:50:28 2016 >New Revision: 297609 >URL: https://svnweb.freebsd.org/changeset/base/297609 > >Log: > Storage Controller Interface driver - typo in unimplemented macro in > scic_sds_controller_registers.h > > s/contoller/controller/ > > PR: 207336 > Submitted by: Tony Narlock > >Modified: > head/sys/dev/isci/scil/scic_sds_controller_registers.h > head/sys/net/if_lagg.c > head/sys/net/if_lagg.h > >Modified: head/sys/dev/isci/scil/scic_sds_controller_registers.h >============================================================================== >--- head/sys/dev/isci/scil/scic_sds_controller_registers.h Wed Apr 6 04:10:22 2016 (r297608) >+++ head/sys/dev/isci/scil/scic_sds_controller_registers.h Wed Apr 6 04:50:28 2016 (r297609) >@@ -586,7 +586,7 @@ extern "C" { > > #define SCU_PTSGRTC_READ(controller) \ > scu_ptsg_register_read( \ >- contoller, \ >+ controller, \ > real_time_clock \ > ) > /*@}*/ > >Modified: head/sys/net/if_lagg.c >============================================================================== >--- head/sys/net/if_lagg.c Wed Apr 6 04:10:22 2016 (r297608) >+++ head/sys/net/if_lagg.c Wed Apr 6 04:50:28 2016 (r297609) >@@ -101,7 +101,11 @@ static const char laggname[] = "lagg"; > static void lagg_lladdr(struct lagg_softc *, uint8_t *); > static void lagg_capabilities(struct lagg_softc *); > static void lagg_port_lladdr(struct lagg_port *, uint8_t *, lagg_llqtype); >-static void lagg_port_setlladdr(void *, int); >+static void lagg_port_ops(void *, int); >+static void lagg_llq_action_mtu(struct lagg_softc *, >+ struct lagg_llq_slist_entry *); >+static void lagg_llq_action_lladdr(struct lagg_softc *, >+ struct lagg_llq_slist_entry *); > static int lagg_port_create(struct lagg_softc *, struct ifnet *); > static int lagg_port_destroy(struct lagg_port *, int); > static struct mbuf *lagg_input(struct ifnet *, struct mbuf *); >@@ -130,6 +134,9 @@ static int lagg_media_change(struct ifne > static void lagg_media_status(struct ifnet *, struct ifmediareq *); > static struct lagg_port *lagg_link_active(struct lagg_softc *, > struct lagg_port *); >+static int lagg_change_mtu(struct ifnet *, struct ifreq *); >+static void _lagg_free_llq_entries(struct lagg_llq_slist_entry *); >+static void lagg_free_llq_entries(struct lagg_softc *, lagg_llq_idx); > > /* Simple round robin */ > static void lagg_rr_attach(struct lagg_softc *); >@@ -165,6 +172,24 @@ static struct mbuf *lagg_lacp_input(stru > struct mbuf *); > static void lagg_lacp_lladdr(struct lagg_softc *); > >+/* >+ * This action handler shall be called from taskqueue handler for each >+ * submitted operation >+ */ >+typedef void (*lagg_llq_action)(struct lagg_softc *, >+ struct lagg_llq_slist_entry *); >+ >+/* >+ * lagg llq action Table: Called at the taskqueue context for each >+ * submitted operations. >+ * Contents SHOULD be in sync with lagg_llq_idx index. >+ * New entries shall be appended. >+ */ >+static const lagg_llq_action llq_action[LAGG_LLQ_MAX] = { >+ lagg_llq_action_lladdr, /* Maps to LAGG_LLQ_LLADDR index */ >+ lagg_llq_action_mtu, /* Maps to LAGG_LLQ_MTU index */ >+}; >+ > /* lagg protocol table */ > static const struct lagg_proto { > lagg_proto pr_num; >@@ -487,7 +512,7 @@ lagg_clone_create(struct if_clone *ifc, > > LAGG_LOCK_INIT(sc); > SLIST_INIT(&sc->sc_ports); >- TASK_INIT(&sc->sc_lladdr_task, 0, lagg_port_setlladdr, sc); >+ TASK_INIT(&sc->sc_llq_task, 0, lagg_port_ops, sc); > > /* Initialise pseudo media types */ > ifmedia_init(&sc->sc_media, 0, lagg_media_change, >@@ -505,6 +530,10 @@ lagg_clone_create(struct if_clone *ifc, > ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST; > ifp->if_capenable = ifp->if_capabilities = IFCAP_HWSTATS; > >+ mtx_init(&sc->sc_mtu_ctxt.mtu_sync.lock, ifp->if_xname, >+ "mtu_sync_lock", MTX_DEF); >+ cv_init(&sc->sc_mtu_ctxt.mtu_sync.cv, "mtu_sync_cv"); >+ > /* > * Attach as an ordinary ethernet device, children will be attached > * as special device IFT_IEEE8023ADLAG. >@@ -553,7 +582,9 @@ lagg_clone_destroy(struct ifnet *ifp) > SLIST_REMOVE(&V_lagg_list, sc, lagg_softc, sc_entries); > LAGG_LIST_UNLOCK(); > >- taskqueue_drain(taskqueue_swi, &sc->sc_lladdr_task); >+ taskqueue_drain(taskqueue_swi, &sc->sc_llq_task); >+ cv_destroy(&sc->sc_mtu_ctxt.mtu_sync.cv); >+ mtx_destroy(&sc->sc_mtu_ctxt.mtu_sync.lock); > LAGG_LOCK_DESTROY(sc); > free(sc, M_DEVBUF); > } >@@ -645,7 +676,8 @@ lagg_port_lladdr(struct lagg_port *lp, u > { > struct lagg_softc *sc = lp->lp_softc; > struct ifnet *ifp = lp->lp_ifp; >- struct lagg_llq *llq; >+ struct lagg_llq_slist_entry *cmn_llq; >+ struct lagg_lladdr_llq_ctxt *llq_ctxt; > > LAGG_WLOCK_ASSERT(sc); > >@@ -658,51 +690,213 @@ lagg_port_lladdr(struct lagg_port *lp, u > return; > > /* Check to make sure its not already queued to be changed */ >- SLIST_FOREACH(llq, &sc->sc_llq_head, llq_entries) { >- if (llq->llq_ifp == ifp) { >+ SLIST_FOREACH(cmn_llq, &sc->sc_llq[LAGG_LLQ_LLADDR], >+ llq_entries) { >+ llq_ctxt = (struct lagg_lladdr_llq_ctxt *)cmn_llq; >+ if (llq_ctxt->llq_ifp == ifp) { > /* Update lladdr, it may have changed */ >- bcopy(lladdr, llq->llq_lladdr, ETHER_ADDR_LEN); >+ bcopy(lladdr, llq_ctxt->llq_lladdr, ETHER_ADDR_LEN); > return; > } > } > >- llq = malloc(sizeof(struct lagg_llq), M_DEVBUF, M_NOWAIT | M_ZERO); >- if (llq == NULL) /* XXX what to do */ >+ llq_ctxt = malloc(sizeof(struct lagg_lladdr_llq_ctxt), M_DEVBUF, >+ M_NOWAIT | M_ZERO); >+ if (llq_ctxt == NULL) /* XXX what to do */ > return; > >- llq->llq_ifp = ifp; >- llq->llq_type = llq_type; >- bcopy(lladdr, llq->llq_lladdr, ETHER_ADDR_LEN); >+ llq_ctxt->llq_ifp = ifp; >+ llq_ctxt->llq_type = llq_type; >+ bcopy(lladdr, llq_ctxt->llq_lladdr, ETHER_ADDR_LEN); > /* XXX: We should insert to tail */ >- SLIST_INSERT_HEAD(&sc->sc_llq_head, llq, llq_entries); >+ SLIST_INSERT_HEAD(&sc->sc_llq[LAGG_LLQ_LLADDR], >+ (struct lagg_llq_slist_entry *)llq_ctxt, llq_entries); > >- taskqueue_enqueue(taskqueue_swi, &sc->sc_lladdr_task); >+ taskqueue_enqueue(taskqueue_swi, &sc->sc_llq_task); > } > > /* >- * Set the interface MAC address from a taskqueue to avoid a LOR. >+ * Set the interface MTU, MAC address from a taskqueue to avoid a LOR. > * > * Set noinline to be dtrace-friendly > */ > static __noinline void >-lagg_port_setlladdr(void *arg, int pending) >+lagg_port_ops(void *arg, int pending) > { > struct lagg_softc *sc = (struct lagg_softc *)arg; >- struct lagg_llq *llq, *head; >- struct ifnet *ifp; >+ struct lagg_llq_slist_entry *llq_first; >+ lagg_llq_idx llq_idx; >+ >+ for (llq_idx = LAGG_LLQ_MIN; llq_idx < LAGG_LLQ_MAX; llq_idx++) { >+ LAGG_WLOCK(sc); >+ llq_first = SLIST_FIRST(&sc->sc_llq[llq_idx]); >+ SLIST_INIT(&sc->sc_llq[llq_idx]); >+ LAGG_WUNLOCK(sc); >+ >+ if (llq_first != NULL) >+ llq_action[llq_idx](sc, llq_first); >+ } >+} >+ >+static void >+lagg_llq_action_mtu(struct lagg_softc *sc, struct lagg_llq_slist_entry *first) >+{ >+ struct lagg_llq_slist_entry *llq; >+ int err; >+ >+ /* Set the new MTU on the lagg interface */ >+ LAGG_WLOCK(sc); >+ sc->sc_ifp->if_mtu = ((struct lagg_mtu_llq_ctxt *)first)->llq_ifr.ifr_mtu; >+ LAGG_WUNLOCK(sc); >+ >+ /* >+ * Traverse the queue and set the mtu on each ifp. It is safe to do >+ * unlocked as we have the only reference to it. >+ */ >+ err = EIO; /* In case the list is empty. */ >+ llq = first; >+ SLIST_FOREACH_FROM(llq, (struct __llqhd *)NULL, llq_entries) { >+ struct lagg_mtu_llq_ctxt *llq_ctxt; >+ >+ llq_ctxt = (struct lagg_mtu_llq_ctxt *)llq; >+ /* Set the new MTU on the physical interface */ >+ err = (*llq_ctxt->llq_ioctl)(llq_ctxt->llq_ifp, SIOCSIFMTU, >+ (caddr_t)&llq_ctxt->llq_ifr); >+ if (err) { >+ if_printf(llq_ctxt->llq_ifp, >+ "Failed to change MTU from %d to %d (err %d)\n", >+ llq_ctxt->llq_old_mtu, llq_ctxt->llq_ifr.ifr_mtu, err); >+ break; >+ } >+ } >+ >+ if (err) { >+ /* Restore the old MTU on the lagg interface */ >+ LAGG_WLOCK(sc); >+ sc->sc_ifp->if_mtu = ((struct lagg_mtu_llq_ctxt *)first)->llq_old_mtu; >+ LAGG_WUNLOCK(sc); >+ >+ /* Restore the old MTU on the physical interface */ >+ llq = first; >+ SLIST_FOREACH_FROM(llq, (struct __llqhd *)NULL, llq_entries) { >+ struct lagg_mtu_llq_ctxt *llq_ctxt; >+ >+ llq_ctxt = (struct lagg_mtu_llq_ctxt *)llq; >+ llq_ctxt->llq_ifr.ifr_mtu = llq_ctxt->llq_old_mtu; >+ err = (*llq_ctxt->llq_ioctl) >+ (llq_ctxt->llq_ifp, SIOCSIFMTU, (caddr_t)&llq_ctxt->llq_ifr); >+ if (err) { >+ if_printf(llq_ctxt->llq_ifp, >+ "Failed to restore MTU to %d (err %d)\n", >+ llq_ctxt->llq_old_mtu, err); >+ } >+ } >+ } >+ >+ /* Free the MTU LLQ entries */ >+ _lagg_free_llq_entries(first); >+ >+ mtx_lock(&sc->sc_mtu_ctxt.mtu_sync.lock); >+ sc->sc_mtu_ctxt.mtu_cmd_ret = err; >+ /* Signal for command completion */ >+ cv_signal(&sc->sc_mtu_ctxt.mtu_sync.cv); >+ mtx_unlock(&sc->sc_mtu_ctxt.mtu_sync.lock); >+} >+ >+static void >+_lagg_free_llq_entries(struct lagg_llq_slist_entry *llq) >+{ >+ struct lagg_llq_slist_entry *tmp_llq; > >- /* Grab a local reference of the queue and remove it from the softc */ >+ SLIST_FOREACH_FROM_SAFE(llq, (struct __llqhd *)NULL, llq_entries, >+ tmp_llq) { >+ free(llq, M_DEVBUF); >+ } >+} >+ >+static void >+lagg_free_llq_entries(struct lagg_softc *sc, lagg_llq_idx idx) >+{ >+ struct lagg_llq_slist_entry *llq; >+ >+ LAGG_WLOCK_ASSERT(sc); >+ >+ llq = SLIST_FIRST(&sc->sc_llq[idx]); >+ SLIST_INIT(&sc->sc_llq[idx]); >+ >+ _lagg_free_llq_entries(llq); >+} >+ >+static int >+lagg_change_mtu(struct ifnet *ifp, struct ifreq *ifr) >+{ >+ struct lagg_softc *sc; >+ struct lagg_port *lp; >+ struct lagg_mtu_llq_ctxt *llq_ctxt; >+ int ret; >+ >+ sc = (struct lagg_softc *)ifp->if_softc; >+ ret = 0; >+ >+ LAGG_WLOCK(sc); >+ if (SLIST_EMPTY(&sc->sc_ports)) { >+ LAGG_WUNLOCK(sc); >+ return (EIO); >+ } else if (sc->sc_mtu_ctxt.busy) { >+ LAGG_WUNLOCK(sc); >+ return (EBUSY); >+ } else if (ifp->if_mtu == ifr->ifr_mtu) { >+ LAGG_WUNLOCK(sc); >+ return (0); >+ } >+ sc->sc_mtu_ctxt.busy = TRUE; >+ >+ SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { >+ llq_ctxt = malloc(sizeof(struct lagg_mtu_llq_ctxt), M_DEVBUF, >+ M_NOWAIT); >+ if (llq_ctxt == NULL) { >+ lagg_free_llq_entries(sc, LAGG_LLQ_MTU); >+ ret = ENOMEM; >+ goto out; >+ } >+ SLIST_INSERT_HEAD(&sc->sc_llq[LAGG_LLQ_MTU], >+ (struct lagg_llq_slist_entry *)llq_ctxt, llq_entries); >+ >+ bcopy(ifr, &llq_ctxt->llq_ifr, sizeof(struct ifreq)); >+ llq_ctxt->llq_old_mtu = ifp->if_mtu; >+ llq_ctxt->llq_ifp = lp->lp_ifp; >+ llq_ctxt->llq_ioctl = lp->lp_ioctl; >+ } >+ mtx_lock(&sc->sc_mtu_ctxt.mtu_sync.lock); >+ taskqueue_enqueue(taskqueue_swi, &sc->sc_llq_task); >+ LAGG_WUNLOCK(sc); >+ >+ /* Wait for the command completion */ >+ cv_wait(&sc->sc_mtu_ctxt.mtu_sync.cv, &sc->sc_mtu_ctxt.mtu_sync.lock); >+ ret = sc->sc_mtu_ctxt.mtu_cmd_ret; >+ mtx_unlock(&sc->sc_mtu_ctxt.mtu_sync.lock); > LAGG_WLOCK(sc); >- head = SLIST_FIRST(&sc->sc_llq_head); >- SLIST_FIRST(&sc->sc_llq_head) = NULL; >+ >+out: >+ sc->sc_mtu_ctxt.busy = FALSE; > LAGG_WUNLOCK(sc); >+ return (ret); >+} >+ >+static void >+lagg_llq_action_lladdr(struct lagg_softc *sc, struct lagg_llq_slist_entry *head) >+{ >+ struct lagg_lladdr_llq_ctxt *llq_ctxt; >+ struct lagg_llq_slist_entry *llq; >+ struct ifnet *ifp; > > /* > * Traverse the queue and set the lladdr on each ifp. It is safe to do > * unlocked as we have the only reference to it. > */ > for (llq = head; llq != NULL; llq = head) { >- ifp = llq->llq_ifp; >+ llq_ctxt = (struct lagg_lladdr_llq_ctxt *)llq; >+ ifp = llq_ctxt->llq_ifp; > > CURVNET_SET(ifp->if_vnet); > >@@ -711,9 +905,8 @@ lagg_port_setlladdr(void *arg, int pendi > * Note that if_setlladdr() or iflladdr_event handler > * may result in arp transmission / lltable updates. > */ >- if (llq->llq_type == LAGG_LLQTYPE_PHYS) >- if_setlladdr(ifp, llq->llq_lladdr, >- ETHER_ADDR_LEN); >+ if (llq_ctxt->llq_type == LAGG_LLQTYPE_PHYS) >+ if_setlladdr(ifp, llq_ctxt->llq_lladdr, ETHER_ADDR_LEN); > else > EVENTHANDLER_INVOKE(iflladdr_event, ifp); > CURVNET_RESTORE(); >@@ -877,7 +1070,8 @@ lagg_port_destroy(struct lagg_port *lp, > { > struct lagg_softc *sc = lp->lp_softc; > struct lagg_port *lp_ptr, *lp0; >- struct lagg_llq *llq; >+ struct lagg_llq_slist_entry *cmn_llq; >+ struct lagg_lladdr_llq_ctxt *llq_ctxt; > struct ifnet *ifp = lp->lp_ifp; > uint64_t *pval, vdiff; > int i; >@@ -940,11 +1134,12 @@ lagg_port_destroy(struct lagg_port *lp, > > /* Remove any pending lladdr changes from the queue */ > if (lp->lp_detaching) { >- SLIST_FOREACH(llq, &sc->sc_llq_head, llq_entries) { >- if (llq->llq_ifp == ifp) { >- SLIST_REMOVE(&sc->sc_llq_head, llq, lagg_llq, >- llq_entries); >- free(llq, M_DEVBUF); >+ SLIST_FOREACH(cmn_llq, &sc->sc_llq[LAGG_LLQ_LLADDR], llq_entries) { >+ llq_ctxt = (struct lagg_lladdr_llq_ctxt *)cmn_llq; >+ if (llq_ctxt->llq_ifp == ifp) { >+ SLIST_REMOVE(&sc->sc_llq[LAGG_LLQ_LLADDR], cmn_llq, >+ lagg_llq_slist_entry, llq_entries); >+ free(cmn_llq, M_DEVBUF); > break; /* Only appears once */ > } > } >@@ -1537,10 +1732,12 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd > break; > > case SIOCSIFCAP: >- case SIOCSIFMTU: >- /* Do not allow the MTU or caps to be directly changed */ >+ /* Do not allow the CAPs to be directly changed. */ > error = EINVAL; > break; >+ case SIOCSIFMTU: >+ error = lagg_change_mtu(ifp, ifr); >+ break; > > default: > error = ether_ioctl(ifp, cmd, data); > >Modified: head/sys/net/if_lagg.h >============================================================================== >--- head/sys/net/if_lagg.h Wed Apr 6 04:10:22 2016 (r297608) >+++ head/sys/net/if_lagg.h Wed Apr 6 04:50:28 2016 (r297609) >@@ -21,6 +21,8 @@ > #ifndef _NET_LAGG_H > #define _NET_LAGG_H > >+#include >+ > /* > * Global definitions > */ >@@ -207,18 +209,55 @@ typedef enum { > LAGG_LLQTYPE_VIRT, /* Task related to lagg interface itself */ > } lagg_llqtype; > >-/* List of interfaces to have the MAC address modified */ >-struct lagg_llq { >+/* Adding new entry here, SHOULD also have relevant entry in llq_action */ >+typedef enum { >+ LAGG_LLQ_MIN = 0, >+ LAGG_LLQ_LLADDR = LAGG_LLQ_MIN, /* MAC Address index */ >+ LAGG_LLQ_MTU, /* MTU index */ >+ LAGG_LLQ_MAX /* This SHOULD be the last entry */ >+} lagg_llq_idx; >+ >+/* Common list entry definition for each taskq operation */ >+struct lagg_llq_slist_entry { >+ SLIST_ENTRY(lagg_llq_slist_entry) llq_entries; >+}; >+ >+/* Context for lladdr llq operation part of lagg soft context */ >+struct lagg_lladdr_llq_ctxt { >+ struct lagg_llq_slist_entry llq_cmn; /* This SHOULD be the first >+ member */ > struct ifnet *llq_ifp; > uint8_t llq_lladdr[ETHER_ADDR_LEN]; > lagg_llqtype llq_type; >- SLIST_ENTRY(lagg_llq) llq_entries; >+}; >+ >+/* Context for mtu llq operation part of lagg soft context */ >+struct lagg_mtu_llq_ctxt { >+ struct lagg_llq_slist_entry llq_cmn; /* This SHOULD be the first >+ member */ >+ struct ifnet *llq_ifp; >+ struct ifreq llq_ifr; >+ uint32_t llq_old_mtu; >+ int (*llq_ioctl)(struct ifnet *, u_long, caddr_t); > }; > > struct lagg_counters { > uint64_t val[IFCOUNTERS]; > }; > >+/* Conditional variables context for lagg operations */ >+struct lagg_signal { >+ struct mtx lock; >+ struct cv cv; >+}; >+ >+/* Lagg MTU context */ >+struct lagg_mtu_ctxt { >+ struct lagg_signal mtu_sync; /* Synchronize cmd completion */ >+ int mtu_cmd_ret; >+ bool busy; >+}; >+ > struct lagg_softc { > struct ifnet *sc_ifp; /* virtual interface */ > struct rmlock sc_mtx; >@@ -236,9 +275,12 @@ struct lagg_softc { > SLIST_HEAD(__tplhd, lagg_port) sc_ports; /* list of interfaces */ > SLIST_ENTRY(lagg_softc) sc_entries; > >- struct task sc_lladdr_task; >- SLIST_HEAD(__llqhd, lagg_llq) sc_llq_head; /* interfaces to program >- the lladdr on */ >+ struct task sc_llq_task; /* SYNC & ASYNC ops >+ enqueued here */ >+ struct lagg_mtu_ctxt sc_mtu_ctxt; /* MTU programming */ >+ /* List of LLQs */ >+ SLIST_HEAD(__llqhd, lagg_llq_slist_entry) sc_llq[LAGG_LLQ_MAX]; >+ > eventhandler_tag vlan_attach; > eventhandler_tag vlan_detach; > struct callout sc_callout; > From owner-svn-src-all@freebsd.org Wed Apr 6 06:05:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8E4FB05653; Wed, 6 Apr 2016 06:05:27 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp004.me.com (mr11p00im-asmtp004.me.com [17.110.69.135]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95BF81FBE; Wed, 6 Apr 2016 06:05:27 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from [192.168.1.4] (c-50-174-208-73.hsd1.ca.comcast.net [50.174.208.73]) by mr11p00im-asmtp004.me.com (Oracle Communications Messaging Server 7.0.5.36.0 64bit (built Sep 8 2015)) with ESMTPSA id <0O570021B4SWFH20@mr11p00im-asmtp004.me.com>; Wed, 06 Apr 2016 05:05:21 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-04-06_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1510270003 definitions=main-1604060075 User-Agent: Microsoft-MacOutlook/0.0.0.160212 Date: Tue, 05 Apr 2016 22:05:19 -0700 Subject: Re: svn commit: r297609 - in head/sys: dev/isci/scil net From: Ravi Pokala Sender: "Pokala, Ravi" To: "Ngie Cooper (yaneurabeya)" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: Thread-topic: svn commit: r297609 - in head/sys: dev/isci/scil net References: <201604060450.u364oSQu089743@repo.freebsd.org> <3BD273AD-4CC8-470E-9FAE-A0A06F89FFB2@gmail.com> In-reply-to: <3BD273AD-4CC8-470E-9FAE-A0A06F89FFB2@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 06:05:27 -0000 Fixed in r297610. I'm too used to Perforce, where you can specify the files to include as part of the commit form. -Ravi -----Original Message----- From: "Ngie Cooper (yaneurabeya)" Date: 2016-04-05, Tuesday at 21:55 To: Ravi Pokala Cc: , , Subject: Re: svn commit: r297609 - in head/sys: dev/isci/scil net > >> On Apr 5, 2016, at 21:50, Ravi Pokala wrote: >> >> Author: rpokala >> Date: Wed Apr 6 04:50:28 2016 >> New Revision: 297609 >> URL: https://svnweb.freebsd.org/changeset/base/297609 >> >> Log: >> Storage Controller Interface driver - typo in unimplemented macro in >> scic_sds_controller_registers.h >> >> s/contoller/controller/ >> >> PR: 207336 >> Submitted by: Tony Narlock >> >> Modified: >> head/sys/dev/isci/scil/scic_sds_controller_registers.h >> head/sys/net/if_lagg.c >> head/sys/net/if_lagg.h > >It looks like the if_lagg changes are unrelated... From owner-svn-src-all@freebsd.org Wed Apr 6 06:37:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB506B05E3E; Wed, 6 Apr 2016 06:37:37 +0000 (UTC) (envelope-from ngie@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 mx1.freebsd.org (Postfix) with ESMTPS id BC85D1CC2; Wed, 6 Apr 2016 06:37:37 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u366bahV022502; Wed, 6 Apr 2016 06:37:36 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u366baDx022501; Wed, 6 Apr 2016 06:37:36 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201604060637.u366baDx022501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 6 Apr 2016 06:37:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297612 - stable/10/tests/sys/geom/class X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 06:37:38 -0000 Author: ngie Date: Wed Apr 6 06:37:36 2016 New Revision: 297612 URL: https://svnweb.freebsd.org/changeset/base/297612 Log: MFC r297183: Use a SKIP testplan instead of bailing out if/when the tester isn't root, or the geom class can't be loaded cleanly [*] This makes sure that scenarios that are easy to hit aren't counted as false positives with kyua test PR: 208101 Modified: stable/10/tests/sys/geom/class/geom_subr.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/tests/sys/geom/class/geom_subr.sh ============================================================================== --- stable/10/tests/sys/geom/class/geom_subr.sh Wed Apr 6 05:13:36 2016 (r297611) +++ stable/10/tests/sys/geom/class/geom_subr.sh Wed Apr 6 06:37:36 2016 (r297612) @@ -35,16 +35,14 @@ geom_test_cleanup() } if [ $(id -u) -ne 0 ]; then - echo 'Tests must be run as root' - echo 'Bail out!' - exit 1 + echo '1..0 # SKIP tests must be run as root' + exit 0 fi # If the geom class isn't already loaded, try loading it. if ! kldstat -q -m g_${class}; then if ! geom ${class} load; then - echo "Could not load module for geom class=${class}" - echo 'Bail out!' - exit 1 + echo "1..0 # SKIP could not load module for geom class=${class}" + exit 0 fi fi From owner-svn-src-all@freebsd.org Wed Apr 6 06:40:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62B53B05F00; Wed, 6 Apr 2016 06:40:07 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (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 09CB91E4A; Wed, 6 Apr 2016 06:40:06 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wm0-x244.google.com with SMTP id o129so819588wmo.3; Tue, 05 Apr 2016 23:40:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=CCCaDQ4YT/LSh9ZP1EVaXeYTUdo2/c+S4inyMinEDic=; b=QGwMKvjl9dutFSNRHhJkaiDcsB0doISPYOoO7B9QsaiQjGCmORmLJRX7IAxd4dL34e PNPXwke8sQOTTrARh+AMcGyqq8HuAwubtEDwA4ZFRxHZJT72mHn8vwfSp93O5YgA23LO DCD9Va1lgvKF8GAqm0FSnqw1Ued/Bl78qVC3J+v8ujWgsmLsGso6YkoiM7pinK88Y/T4 5E3I79g7DxLrdhCRIXyJTTXm6pwuu2HjAeA4uMOY1g9hz+iiApbeYU1sJxBxdArDbuf9 SEONurKsez5ESadlojqmSC7MimzAKfc5kDKWyPtoBJHqQPBj4o2Sn1QTYg0oY/N0IJ5w Q2Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=CCCaDQ4YT/LSh9ZP1EVaXeYTUdo2/c+S4inyMinEDic=; b=Iw+gppbldxhd7+jAa4DlVmDX13LupMA4/y5UjRKIect3LvQlYMhbxy2nnXNlgC8+kO aJaHg6ss51TqifTv0oTbKJ66ITzXKvjsEUgg7ymEp8atHoglb/H/KeKr33wyT4AuTEeI 3HOg9MGLV6bj8vIHG8XqK2nHACQS8ez3uHnqUYhZa5ASET6S7PXcFmJrbpyDEagAmnWO IXIMYTHwtl9PgktuAyYPypiGN8bY8ueJaoyOcxZ2Cg/zZw668TSNgfceGehPJqBV86TW Rk60UmBmvZuUCcSQ4yCY41+dpfTotJ8um2LuzR36AhYxDq2x9ok/Vhnv/FTU2UiUQO7z up3A== X-Gm-Message-State: AD7BkJJV6CdKYiUDnY7I6qUrazhHne+D9wNNJqp9RCcpNyx94nDWJkyEUguofL+tAuqjlA== X-Received: by 10.28.210.73 with SMTP id j70mr21800968wmg.8.1459924805514; Tue, 05 Apr 2016 23:40:05 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id ks5sm1506395wjb.13.2016.04.05.23.40.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Apr 2016 23:40:04 -0700 (PDT) Sender: Baptiste Daroussin Date: Wed, 6 Apr 2016 08:40:02 +0200 From: Baptiste Daroussin To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297597 - in head/sys: amd64/linux amd64/linux32 i386/linux Message-ID: <20160406064002.GJ49864@ivaldir.etoilebsd.net> References: <201604052236.u35ManwQ076790@repo.freebsd.org> <2270129.DEqYKEiVDZ@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="P6YfpwaDcfcOCJkJ" Content-Disposition: inline In-Reply-To: <2270129.DEqYKEiVDZ@ralph.baldwin.cx> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 06:40:07 -0000 --P6YfpwaDcfcOCJkJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 05, 2016 at 06:32:16PM -0700, John Baldwin wrote: > On Tuesday, April 05, 2016 10:36:49 PM Baptiste Daroussin wrote: > > Author: bapt > > Date: Tue Apr 5 22:36:48 2016 > > New Revision: 297597 > > URL: https://svnweb.freebsd.org/changeset/base/297597 > >=20 > > Log: > > Add kern.features flags for linux and linux64 modules > > =20 > > kern.features.linux: 1 meaning linux 32 bits binaries are supported > > kern.features.linux64: 1 meaning linux 64 bits binaries are supported > > =20 > > The goal here is to help 3rd party applications (including ports) to = determine > > if the host do support linux emulation > > =20 > > Reviewed by: dchagin > > MFC after: 1 week > > Relnotes: yes > > Differential Revision: D5830 >=20 > Other parts of the system (e.g. libsysdecode, the various symbols exporte= d by > the modules, etc.) use "linux" to mean supporting Linux binaries of the s= ame > ABI as the host (so x86-64 on amd64 and i386 on i386) and "linux32" to me= an > supporting 32-bit Linux binaries on a 64-bit host. Note that we used to > have linux.ko on Alpha which was a 64-bit ABI, not 32-bit. It is unfortu= nate > that we called linux32.ko linux.ko, but we shouldn't perpetuate that mist= ake > further IMO. For example, I think if we grow Linux/aarch64 ABI support on > FreeBSD/arm64, that should be called 'linux.ko', not 'linux64.ko'. > Similarly, Linux/armv6 on FreeBSD/armv6 would also be 'linux.ko'. >=20 > I would also list the names in the feature description (so Linux/i386, not > Linux 32-bit, since Linux/armv6 is a 32-bit binary, but linux.ko on > FreeBSD/i386 can't run it). >=20 Well I tried to be consistent with the other example we have which is cloud= abi. I considered the x86 case and tried to generalize: linux =3D> my arch (x86) in 32bit linux64 =3D> my arch (x86) in 64bit Let's consider aarch64 which is supposed to also have support for 32bits (o= ne would be happy to run linux armv6 on top of it ,no?) linux =3D> my arm in 32bits linux64 =3D> my arch in 64bits That said, I have no strong feelings about it Bapt --P6YfpwaDcfcOCJkJ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXBK9CAAoJEGOJi9zxtz5arTQQANADUN8mLAMDD/4cgoHyrMK+ e5NAFSbJTaixYkr944YQkVYTWgalCzN3c3J5WdRdWRU+2R3xQAZq8emVPHUSSEN6 mk7eCvjbCCW14ufUEUSx7z+IKeGXBjhYFlI/tRcf2WLtAry31/iTwJ9uvOHcvp/k PRrqmtQPafAj7OdBpz1cay/JnjwlS8q2/V7EHE1H7ty0cgPFUA6M3C2h7oRTGaPA 0vTF/Zwsoa8xUVBdX5MDe75ldBroz6cExB5PXUJAft9Cmhx3u7UnLvdwDIl1EfOc QRPlCm3rhPEsOKTrKFhIPURWtso014U7GDHkUIgq2Inpo3de3Po2ScKWBjMHjG7v No9R98JwGM2AfLPJR9bfsmvI5o8WZCXmlp/iwt7Sjf9sVqz5n6WtW3mivsQQ2qLR WfvAZPRwHhEhsirbUXlfhg6EQ85ORJ7wtIYxKpeUut7XzyAHLN+SH7jvkza81I2Q BFxqYJ9WXB8kjKhzmYndGcXWDLeI6jH0cRMwKAriVAdVuFGeU/tW48ldFcec7uor 9vHbPJDZRUCp4kNgBuLqz1rQM0Jd+1ZJUigmq+OT+BYHzaF8R4MfY0wy+dIrH68j Cc0MyTkMC69WiISF4C4jJI20QiQptjL57SjaYMu7aXu97cWWGScmiu1qu4KFOGg+ TJH4jWdexCYmOkAR3K99 =hksm -----END PGP SIGNATURE----- --P6YfpwaDcfcOCJkJ-- From owner-svn-src-all@freebsd.org Wed Apr 6 11:11:32 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1D8FB05945; Wed, 6 Apr 2016 11:11:32 +0000 (UTC) (envelope-from ed@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 mx1.freebsd.org (Postfix) with ESMTPS id 953FA1444; Wed, 6 Apr 2016 11:11:32 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36BBVlc004634; Wed, 6 Apr 2016 11:11:31 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36BBVgS004628; Wed, 6 Apr 2016 11:11:31 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201604061111.u36BBVgS004628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 6 Apr 2016 11:11:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297613 - in head/sys: amd64/cloudabi64 arm64/cloudabi64 compat/cloudabi64 contrib/cloudabi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 11:11:32 -0000 Author: ed Date: Wed Apr 6 11:11:31 2016 New Revision: 297613 URL: https://svnweb.freebsd.org/changeset/base/297613 Log: Make CloudABI's way of doing TLS more friendly to userspace emulators. We're currently seeing how hard it would be to run CloudABI binaries on operating systems cannot be modified easily (Windows, Mac OS X). The idea is that we want to just run them without any sandboxing. Now that CloudABI executables are PIE, this is already a bit easier, but TLS is still problematic: - CloudABI executables want to write to the %fs, which typically requires extra system calls by the emulator every time it needs to switch between CloudABI's and its own TLS. - If CloudABI executables overwrite the %fs base unconditionally, it also becomes harder for the emulator to store a backup of the old value of %fs. To solve this, let's no longer overwrite %fs, but just %fs:0. As CloudABI's C library does not use a TCB, this space can now be used by an emulator to keep track of its internal state. The executable can now safely overwrite %fs:0, as long as it makes sure that the TCB is copied over to the new TLS area. Ensure that there is an initial TLS area set up when the process starts, only containing a bogus TCB. We don't really care about its contents on FreeBSD. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D5836 Modified: head/sys/amd64/cloudabi64/cloudabi64_sysvec.c head/sys/arm64/cloudabi64/cloudabi64_sysvec.c head/sys/compat/cloudabi64/cloudabi64_module.c head/sys/compat/cloudabi64/cloudabi64_thread.c head/sys/compat/cloudabi64/cloudabi64_util.h head/sys/contrib/cloudabi/cloudabi64_types.h Modified: head/sys/amd64/cloudabi64/cloudabi64_sysvec.c ============================================================================== --- head/sys/amd64/cloudabi64/cloudabi64_sysvec.c Wed Apr 6 06:37:36 2016 (r297612) +++ head/sys/amd64/cloudabi64/cloudabi64_sysvec.c Wed Apr 6 11:11:31 2016 (r297613) @@ -27,6 +27,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -47,6 +48,45 @@ extern const char *cloudabi64_syscallnam extern struct sysent cloudabi64_sysent[]; static int +cloudabi64_fixup_tcb(register_t **stack_base, struct image_params *imgp) +{ + int error; + register_t tcbptr; + + /* Place auxiliary vector and TCB on the stack. */ + error = cloudabi64_fixup(stack_base, imgp); + if (error != 0) + return (error); + + /* + * On x86-64, the TCB is referred to by %fs:0. Take some space + * from the top of the stack to store a single element array, + * containing a pointer to the TCB. %fs base will point to this. + */ + tcbptr = (register_t)*stack_base; + return (copyout(&tcbptr, --*stack_base, sizeof(tcbptr))); +} + +static void +cloudabi64_proc_setregs(struct thread *td, struct image_params *imgp, + unsigned long stack) +{ + struct trapframe *regs; + + exec_setregs(td, imgp, stack); + + /* + * The stack now contains a pointer to the TCB, the TCB itself, + * and the auxiliary vector. Let %rdx point to the auxiliary + * vector, and set %fs base to the address of the TCB. + */ + regs = td->td_frame; + regs->tf_rdi = stack + sizeof(register_t) + + roundup(sizeof(cloudabi64_tcb_t), sizeof(register_t)); + (void)cpu_set_user_tls(td, (void *)stack); +} + +static int cloudabi64_fetch_syscall_args(struct thread *td, struct syscall_args *sa) { struct trapframe *frame = td->td_frame; @@ -109,16 +149,29 @@ cloudabi64_schedtail(struct thread *td) frame->tf_rdx = td->td_tid; } -void +int cloudabi64_thread_setregs(struct thread *td, - const cloudabi64_threadattr_t *attr) + const cloudabi64_threadattr_t *attr, uint64_t tcb) { struct trapframe *frame; stack_t stack; + uint64_t tcbptr; + int error; + + /* + * On x86-64, the TCB is referred to by %fs:0. Take some space + * from the top of the stack to store a single element array, + * containing a pointer to the TCB. %fs base will point to this. + */ + tcbptr = rounddown(attr->stack + attr->stack_size - sizeof(tcbptr), + _Alignof(tcbptr)); + error = copyout(&tcb, (void *)tcbptr, sizeof(tcb)); + if (error != 0) + return (error); /* Perform standard register initialization. */ stack.ss_sp = (void *)attr->stack; - stack.ss_size = attr->stack_size; + stack.ss_size = tcbptr - attr->stack; cpu_set_upcall_kse(td, (void *)attr->entry_point, NULL, &stack); /* @@ -129,12 +182,14 @@ cloudabi64_thread_setregs(struct thread frame = td->td_frame; frame->tf_rdi = td->td_tid; frame->tf_rsi = attr->argument; + + return (cpu_set_user_tls(td, (void *)tcbptr)); } static struct sysentvec cloudabi64_elf_sysvec = { .sv_size = CLOUDABI64_SYS_MAXSYSCALL, .sv_table = cloudabi64_sysent, - .sv_fixup = cloudabi64_fixup, + .sv_fixup = cloudabi64_fixup_tcb, .sv_name = "CloudABI ELF64", .sv_coredump = elf64_coredump, .sv_pagesize = PAGE_SIZE, @@ -143,6 +198,7 @@ static struct sysentvec cloudabi64_elf_s .sv_usrstack = USRSTACK, .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, .sv_copyout_strings = cloudabi64_copyout_strings, + .sv_setregs = cloudabi64_proc_setregs, .sv_flags = SV_ABI_CLOUDABI | SV_CAPSICUM | SV_LP64, .sv_set_syscall_retval = cloudabi64_set_syscall_retval, .sv_fetch_syscall_args = cloudabi64_fetch_syscall_args, Modified: head/sys/arm64/cloudabi64/cloudabi64_sysvec.c ============================================================================== --- head/sys/arm64/cloudabi64/cloudabi64_sysvec.c Wed Apr 6 06:37:36 2016 (r297612) +++ head/sys/arm64/cloudabi64/cloudabi64_sysvec.c Wed Apr 6 11:11:31 2016 (r297613) @@ -27,6 +27,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -46,6 +47,25 @@ __FBSDID("$FreeBSD$"); extern const char *cloudabi64_syscallnames[]; extern struct sysent cloudabi64_sysent[]; +static void +cloudabi64_proc_setregs(struct thread *td, struct image_params *imgp, + unsigned long stack) +{ + struct trapframe *regs; + + exec_setregs(td, imgp, stack); + + /* + * The stack now contains a pointer to the TCB and the auxiliary + * vector. Let x0 point to the auxiliary vector, and set + * tpidr_el0 to the TCB. + */ + regs = td->td_frame; + regs->tf_x[0] = td->td_retval[0] = + stack + roundup(sizeof(cloudabi64_tcb_t), sizeof(register_t)); + (void)cpu_set_user_tls(td, (void *)stack); +} + static int cloudabi64_fetch_syscall_args(struct thread *td, struct syscall_args *sa) { @@ -110,9 +130,9 @@ cloudabi64_schedtail(struct thread *td) } } -void +int cloudabi64_thread_setregs(struct thread *td, - const cloudabi64_threadattr_t *attr) + const cloudabi64_threadattr_t *attr, uint64_t tcb) { struct trapframe *frame; stack_t stack; @@ -130,6 +150,9 @@ cloudabi64_thread_setregs(struct thread frame = td->td_frame; frame->tf_x[0] = td->td_tid; frame->tf_x[1] = attr->argument; + + /* Set up TLS. */ + return (cpu_set_user_tls(td, (void *)tcb)); } static struct sysentvec cloudabi64_elf_sysvec = { @@ -144,6 +167,7 @@ static struct sysentvec cloudabi64_elf_s .sv_usrstack = USRSTACK, .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, .sv_copyout_strings = cloudabi64_copyout_strings, + .sv_setregs = cloudabi64_proc_setregs, .sv_flags = SV_ABI_CLOUDABI | SV_CAPSICUM | SV_LP64, .sv_set_syscall_retval = cloudabi64_set_syscall_retval, .sv_fetch_syscall_args = cloudabi64_fetch_syscall_args, Modified: head/sys/compat/cloudabi64/cloudabi64_module.c ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_module.c Wed Apr 6 06:37:36 2016 (r297612) +++ head/sys/compat/cloudabi64/cloudabi64_module.c Wed Apr 6 11:11:31 2016 (r297613) @@ -112,7 +112,13 @@ cloudabi64_fixup(register_t **stack_base { .a_type = CLOUDABI_AT_NULL }, }; *stack_base -= howmany(sizeof(auxv), sizeof(register_t)); - return (copyout(auxv, *stack_base, sizeof(auxv))); + error = copyout(auxv, *stack_base, sizeof(auxv)); + if (error != 0) + return (error); + + /* Reserve space for storing the TCB. */ + *stack_base -= howmany(sizeof(cloudabi64_tcb_t), sizeof(register_t)); + return (0); } static int Modified: head/sys/compat/cloudabi64/cloudabi64_thread.c ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_thread.c Wed Apr 6 06:37:36 2016 (r297612) +++ head/sys/compat/cloudabi64/cloudabi64_thread.c Wed Apr 6 11:11:31 2016 (r297613) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); struct thread_create_args { cloudabi64_threadattr_t attr; + uint64_t tcb; lwpid_t tid; }; @@ -49,8 +50,7 @@ initialize_thread(struct thread *td, voi args->tid = td->td_tid; /* Set up initial register contents. */ - cloudabi64_thread_setregs(td, &args->attr); - return (0); + return (cloudabi64_thread_setregs(td, &args->attr, args->tcb)); } int @@ -63,6 +63,12 @@ cloudabi64_sys_thread_create(struct thre error = copyin(uap->attr, &args.attr, sizeof(args.attr)); if (error != 0) return (error); + + /* Remove some space on the top of the stack for the TCB. */ + args.tcb = rounddown(args.attr.stack + args.attr.stack_size - + sizeof(cloudabi64_tcb_t), _Alignof(cloudabi64_tcb_t)); + args.attr.stack_size = args.tcb - args.attr.stack; + error = thread_create(td, NULL, initialize_thread, &args); if (error != 0) return (error); Modified: head/sys/compat/cloudabi64/cloudabi64_util.h ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_util.h Wed Apr 6 06:37:36 2016 (r297612) +++ head/sys/compat/cloudabi64/cloudabi64_util.h Wed Apr 6 11:11:31 2016 (r297613) @@ -42,7 +42,7 @@ extern Elf64_Brandinfo cloudabi64_brand; register_t *cloudabi64_copyout_strings(struct image_params *); int cloudabi64_fixup(register_t **, struct image_params *); -void cloudabi64_thread_setregs(struct thread *, - const cloudabi64_threadattr_t *); +int cloudabi64_thread_setregs(struct thread *, + const cloudabi64_threadattr_t *, uint64_t); #endif Modified: head/sys/contrib/cloudabi/cloudabi64_types.h ============================================================================== --- head/sys/contrib/cloudabi/cloudabi64_types.h Wed Apr 6 06:37:36 2016 (r297612) +++ head/sys/contrib/cloudabi/cloudabi64_types.h Wed Apr 6 11:11:31 2016 (r297613) @@ -192,6 +192,13 @@ _Static_assert(offsetof(cloudabi64_subsc _Static_assert(sizeof(cloudabi64_subscription_t) == 56, "Incorrect layout"); _Static_assert(_Alignof(cloudabi64_subscription_t) == 8, "Incorrect layout"); +typedef struct { + _Alignas(8) uint64_t parent; +} cloudabi64_tcb_t; +_Static_assert(offsetof(cloudabi64_tcb_t, parent) == 0, "Incorrect layout"); +_Static_assert(sizeof(cloudabi64_tcb_t) == 8, "Incorrect layout"); +_Static_assert(_Alignof(cloudabi64_tcb_t) == 8, "Incorrect layout"); + typedef void cloudabi64_threadentry_t(cloudabi_tid_t tid, uint64_t aux); typedef struct { From owner-svn-src-all@freebsd.org Wed Apr 6 11:18:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FA56B05B7A for ; Wed, 6 Apr 2016 11:18:14 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yw0-x22c.google.com (mail-yw0-x22c.google.com [IPv6:2607:f8b0:4002:c05::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 18EC718B9 for ; Wed, 6 Apr 2016 11:18:14 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yw0-x22c.google.com with SMTP id i84so45436712ywc.2 for ; Wed, 06 Apr 2016 04:18:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=ta3TmT6AonHlkWohl1XUBkcw65EE/6H+Ub71VXXFP6A=; b=QAycDgYUQGvpSPFoPtoQ+ttb74P2uiil26cNygffxii3+gi8oqrGO7mA306tuebAVB yGAlqzAF7hn7DI9WUiMtyG1/BCCMmnwhfG/GDFRncB/I7XPwev5XwuwlOdn9nEuReRIU kvGmowD6ojxQs2/Kxkr4drsd+94L/V2kUAN00qqMqW1Q9EoLDoUJkJuJk5xIh7pWYqka 7H1U45NYQb29YgA25FrzGpLG2jRuHD/pZCPv+CUq/GAU7+F0mK84eULLD5rFj88859R2 WKzwqPKjITZAmOdidPpXSFk5KDOp/iXxaY2jTRmIeGZLDnayYek8rQYbWbrJd8UrWYAD KBzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=ta3TmT6AonHlkWohl1XUBkcw65EE/6H+Ub71VXXFP6A=; b=e8ow+bFgWU7jdm/jEM6y5SYoXj5B2iQZRYrua1yge9whNCfCf8Kdt0Hg8niHP9Nb1A u0z8X6LjaApacULjtHff81QVwUj4SsVKKxw/5gOLMBEUFwma+ZCJf52Z9GXmjBPCpcLK ytoEPqo28uk+FR71FtAZ8GaCgvUm8HxP/suVDV27BauB7MPYmI6yQh5gmORj1V2Jf1zc cu/NsqLD4yGX9oLbIY55smugDelQm34oe86ji5NlkfmwsKVcQ018jwKK8nLVP4w31Pu7 L9PW3xuHSYgmODpfMy4dYMwlH87jhJysv/SO0P/ERVCOksLd5vN00jqhnNtkpkcy0UqX qzZQ== X-Gm-Message-State: AD7BkJJVGEMXQRv6+zlwJrZaSYMFyzr7VWV619rDoKaR4H3dTj3ydOnGDrMDa4QUKJRVdAzI8ljYeeI5feTnpA== MIME-Version: 1.0 X-Received: by 10.37.36.215 with SMTP id k206mr2787602ybk.183.1459941493210; Wed, 06 Apr 2016 04:18:13 -0700 (PDT) Received: by 10.129.148.6 with HTTP; Wed, 6 Apr 2016 04:18:13 -0700 (PDT) In-Reply-To: <201604060055.u360teox018860@repo.freebsd.org> References: <201604060055.u360teox018860@repo.freebsd.org> Date: Wed, 6 Apr 2016 13:18:13 +0200 Message-ID: Subject: Re: svn commit: r297602 - in head: sys/sys usr.bin/sed From: Ed Schouten To: "Pedro F. Giffuni" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 11:18:14 -0000 2016-04-06 2:55 GMT+02:00 Pedro F. Giffuni : > Fix sed functions 'i' and 'a' from discarding leading white space. Thank you! -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-all@freebsd.org Wed Apr 6 12:48:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0C92B03F7A; Wed, 6 Apr 2016 12:48:46 +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 mx1.freebsd.org (Postfix) with ESMTPS id A027211D2; Wed, 6 Apr 2016 12:48:46 +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 u36Cmj9k034299; Wed, 6 Apr 2016 12:48:45 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36CmjRT034298; Wed, 6 Apr 2016 12:48:45 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201604061248.u36CmjRT034298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus Date: Wed, 6 Apr 2016 12:48:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297614 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 12:48:46 -0000 Author: skra Date: Wed Apr 6 12:48:45 2016 New Revision: 297614 URL: https://svnweb.freebsd.org/changeset/base/297614 Log: Fix PIC lookup by device and xref. There was not taken into account the situation that someone has a pointer to device but not its xref. This situation is regular now, after r297539. Modified: head/sys/kern/subr_intr.c Modified: head/sys/kern/subr_intr.c ============================================================================== --- head/sys/kern/subr_intr.c Wed Apr 6 11:11:31 2016 (r297613) +++ head/sys/kern/subr_intr.c Wed Apr 6 12:48:45 2016 (r297614) @@ -766,11 +766,19 @@ pic_lookup_locked(device_t dev, intptr_t mtx_assert(&pic_list_lock, MA_OWNED); + if (dev == NULL && xref == 0) + return (NULL); + + /* Note that pic->pic_dev is never NULL on registered PIC. */ SLIST_FOREACH(pic, &pic_list, pic_next) { - if (pic->pic_xref != xref) - continue; - if (pic->pic_xref != 0 || pic->pic_dev == dev) - return (pic); + if (dev == NULL) { + if (xref == pic->pic_xref) + return (pic); + } else if (xref == 0 || pic->pic_xref == 0) { + if (dev == pic->pic_dev) + return (pic); + } else if (xref == pic->pic_xref && dev == pic->pic_dev) + return (pic); } return (NULL); } @@ -840,14 +848,14 @@ intr_pic_register(device_t dev, intptr_t { struct intr_pic *pic; + if (dev == NULL) + return (EINVAL); pic = pic_create(dev, xref); if (pic == NULL) return (ENOMEM); - if (pic->pic_dev != dev) - return (EINVAL); /* XXX it could be many things. */ - debugf("PIC %p registered for %s \n", pic, - device_get_nameunit(dev), xref); + debugf("PIC %p registered for %s \n", pic, + device_get_nameunit(dev), dev, xref); return (0); } From owner-svn-src-all@freebsd.org Wed Apr 6 14:08:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AEC9B05B30; Wed, 6 Apr 2016 14:08:12 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id C10521711; Wed, 6 Apr 2016 14:08:11 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36E8Ahw058692; Wed, 6 Apr 2016 14:08:10 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36E8Aks058687; Wed, 6 Apr 2016 14:08:10 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201604061408.u36E8Aks058687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 6 Apr 2016 14:08:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297615 - in head/sys/arm64: arm64 include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 14:08:12 -0000 Author: andrew Date: Wed Apr 6 14:08:10 2016 New Revision: 297615 URL: https://svnweb.freebsd.org/changeset/base/297615 Log: Allow vmparam.h to be included from assembly files on arm64. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/copyinout.S head/sys/arm64/arm64/genassym.c head/sys/arm64/arm64/locore.S head/sys/arm64/arm64/support.S head/sys/arm64/include/vmparam.h Modified: head/sys/arm64/arm64/copyinout.S ============================================================================== --- head/sys/arm64/arm64/copyinout.S Wed Apr 6 12:48:45 2016 (r297614) +++ head/sys/arm64/arm64/copyinout.S Wed Apr 6 14:08:10 2016 (r297615) @@ -33,6 +33,8 @@ __FBSDID("$FreeBSD$"); #include +#include + #include "assym.s" /* Modified: head/sys/arm64/arm64/genassym.c ============================================================================== --- head/sys/arm64/arm64/genassym.c Wed Apr 6 12:48:45 2016 (r297614) +++ head/sys/arm64/arm64/genassym.c Wed Apr 6 14:08:10 2016 (r297615) @@ -37,9 +37,6 @@ __FBSDID("$FreeBSD$"); #include #include -ASSYM(KERNBASE, KERNBASE); -ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS); - ASSYM(TDF_ASTPENDING, TDF_ASTPENDING); ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); Modified: head/sys/arm64/arm64/locore.S ============================================================================== --- head/sys/arm64/arm64/locore.S Wed Apr 6 12:48:45 2016 (r297614) +++ head/sys/arm64/arm64/locore.S Wed Apr 6 14:08:10 2016 (r297615) @@ -34,6 +34,7 @@ #include #include #include +#include #define VIRT_BITS 48 Modified: head/sys/arm64/arm64/support.S ============================================================================== --- head/sys/arm64/arm64/support.S Wed Apr 6 12:48:45 2016 (r297614) +++ head/sys/arm64/arm64/support.S Wed Apr 6 14:08:10 2016 (r297615) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "assym.s" Modified: head/sys/arm64/include/vmparam.h ============================================================================== --- head/sys/arm64/include/vmparam.h Wed Apr 6 12:48:45 2016 (r297614) +++ head/sys/arm64/include/vmparam.h Wed Apr 6 14:08:10 2016 (r297615) @@ -160,7 +160,6 @@ #define DMAP_MIN_ADDRESS (0xffffffc000000000UL) #define DMAP_MAX_ADDRESS (0xffffffdfffffffffUL) -extern vm_paddr_t dmap_phys_base; #define DMAP_MIN_PHYSADDR (dmap_phys_base) #define DMAP_MAX_PHYSADDR (dmap_phys_base + (DMAP_MAX_ADDRESS - DMAP_MIN_ADDRESS)) @@ -229,10 +228,15 @@ extern vm_paddr_t dmap_phys_base; #define UMA_MD_SMALL_ALLOC +#ifndef LOCORE + +extern vm_paddr_t dmap_phys_base; extern u_int tsb_kernel_ldd_phys; extern vm_offset_t vm_max_kernel_address; extern vm_offset_t init_pt_va; +#endif + #define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ #endif /* !_MACHINE_VMPARAM_H_ */ From owner-svn-src-all@freebsd.org Wed Apr 6 14:12:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2675EB05BF6; Wed, 6 Apr 2016 14:12:02 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id D890F1B05; Wed, 6 Apr 2016 14:12:01 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36EC1dO060834; Wed, 6 Apr 2016 14:12:01 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36EC0dO060833; Wed, 6 Apr 2016 14:12:00 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201604061412.u36EC0dO060833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 6 Apr 2016 14:12:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297616 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 14:12:02 -0000 Author: andrew Date: Wed Apr 6 14:12:00 2016 New Revision: 297616 URL: https://svnweb.freebsd.org/changeset/base/297616 Log: Cleanup the early pagetable creation code in preperation for increasing the size of the arm64 DMAP region. Approved by: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/locore.S Modified: head/sys/arm64/arm64/locore.S ============================================================================== --- head/sys/arm64/arm64/locore.S Wed Apr 6 14:08:10 2016 (r297615) +++ head/sys/arm64/arm64/locore.S Wed Apr 6 14:12:00 2016 (r297616) @@ -378,6 +378,7 @@ create_pagetables: /* Link the l0 -> l1 table */ mov x9, x6 mov x6, x24 + mov x10, #1 bl link_l0_pagetable /* @@ -408,6 +409,7 @@ create_pagetables: /* Link the l0 -> l1 table */ mov x9, x6 mov x6, x27 + mov x10, #1 bl link_l0_pagetable /* Restore the Link register */ @@ -423,6 +425,7 @@ create_pagetables: * x6 = L0 table * x8 = Virtual Address * x9 = L1 PA (trashed) + * x10 = Entry count * x11, x12 and x13 are trashed */ link_l0_pagetable: @@ -437,11 +440,16 @@ link_l0_pagetable: mov x12, #L0_TABLE /* Only use the output address bits */ - lsr x9, x9, #12 - orr x12, x12, x9, lsl #12 + lsr x9, x9, #PAGE_SHIFT +1: orr x13, x12, x9, lsl #PAGE_SHIFT /* Store the entry */ - str x12, [x6, x11, lsl #3] + str x13, [x6, x11, lsl #3] + + sub x10, x10, #1 + add x11, x11, #1 + add x9, x9, #1 + cbnz x10, 1b ret @@ -468,11 +476,11 @@ link_l1_pagetable: mov x12, #L1_TABLE /* Only use the output address bits */ - lsr x9, x9, #12 - orr x12, x12, x9, lsl #12 + lsr x9, x9, #PAGE_SHIFT + orr x13, x12, x9, lsl #PAGE_SHIFT /* Store the entry */ - str x12, [x6, x11, lsl #3] + str x13, [x6, x11, lsl #3] ret @@ -482,7 +490,7 @@ link_l1_pagetable: * x7 = Type (0 = Device, 1 = Normal) * x8 = VA start * x9 = PA start (trashed) - * x10 = Entry count (TODO) + * x10 = Entry count * x11, x12 and x13 are trashed */ build_l1_block_pagetable: @@ -505,20 +513,17 @@ build_l1_block_pagetable: lsr x9, x9, #L1_SHIFT /* Set the physical address for this virtual address */ -1: orr x12, x12, x9, lsl #L1_SHIFT +1: orr x13, x12, x9, lsl #L1_SHIFT /* Store the entry */ - str x12, [x6, x11, lsl #3] - - /* Clear the address bits */ - and x12, x12, #ATTR_MASK_L + str x13, [x6, x11, lsl #3] sub x10, x10, #1 add x11, x11, #1 add x9, x9, #1 cbnz x10, 1b -2: ret + ret /* * Builds count 2 MiB page table entry @@ -526,7 +531,7 @@ build_l1_block_pagetable: * x7 = Type (0 = Device, 1 = Normal) * x8 = VA start * x9 = PA start (trashed) - * x10 = Entry count (TODO) + * x10 = Entry count * x11, x12 and x13 are trashed */ build_l2_block_pagetable: @@ -549,20 +554,17 @@ build_l2_block_pagetable: lsr x9, x9, #L2_SHIFT /* Set the physical address for this virtual address */ -1: orr x12, x12, x9, lsl #L2_SHIFT +1: orr x13, x12, x9, lsl #L2_SHIFT /* Store the entry */ - str x12, [x6, x11, lsl #3] - - /* Clear the address bits */ - and x12, x12, #ATTR_MASK_L + str x13, [x6, x11, lsl #3] sub x10, x10, #1 add x11, x11, #1 add x9, x9, #1 cbnz x10, 1b -2: ret + ret start_mmu: dsb sy From owner-svn-src-all@freebsd.org Wed Apr 6 14:16:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D320B05E57; Wed, 6 Apr 2016 14:16:39 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id F1C1F1DB5; Wed, 6 Apr 2016 14:16:38 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36EGcb9061667; Wed, 6 Apr 2016 14:16:38 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36EGcQh061666; Wed, 6 Apr 2016 14:16:38 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201604061416.u36EGcQh061666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 6 Apr 2016 14:16:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297617 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 14:16:39 -0000 Author: andrew Date: Wed Apr 6 14:16:37 2016 New Revision: 297617 URL: https://svnweb.freebsd.org/changeset/base/297617 Log: Use PHYS_IN_DMAP to check if a physical address is within the DMAP region. Approved by: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Wed Apr 6 14:12:00 2016 (r297616) +++ head/sys/arm64/arm64/pmap.c Wed Apr 6 14:16:37 2016 (r297617) @@ -3534,7 +3534,7 @@ pmap_map_io_transient(vm_page_t page[], needs_mapping = FALSE; for (i = 0; i < count; i++) { paddr = VM_PAGE_TO_PHYS(page[i]); - if (__predict_false(paddr >= DMAP_MAX_PHYSADDR)) { + if (__predict_false(!PHYS_IN_DMAP(paddr))) { error = vmem_alloc(kernel_arena, PAGE_SIZE, M_BESTFIT | M_WAITOK, &vaddr[i]); KASSERT(error == 0, ("vmem_alloc failed: %d", error)); @@ -3552,7 +3552,7 @@ pmap_map_io_transient(vm_page_t page[], sched_pin(); for (i = 0; i < count; i++) { paddr = VM_PAGE_TO_PHYS(page[i]); - if (paddr >= DMAP_MAX_PHYSADDR) { + if (!PHYS_IN_DMAP(paddr)) { panic( "pmap_map_io_transient: TODO: Map out of DMAP data"); } @@ -3572,7 +3572,7 @@ pmap_unmap_io_transient(vm_page_t page[] sched_unpin(); for (i = 0; i < count; i++) { paddr = VM_PAGE_TO_PHYS(page[i]); - if (paddr >= DMAP_MAX_PHYSADDR) { + if (!PHYS_IN_DMAP(paddr)) { panic("ARM64TODO: pmap_unmap_io_transient: Unmap data"); } } From owner-svn-src-all@freebsd.org Wed Apr 6 15:28:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E9D3ADF4EA; Wed, 6 Apr 2016 15:28:28 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id 0701011EB; Wed, 6 Apr 2016 15:28:27 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36FSR6d083446; Wed, 6 Apr 2016 15:28:27 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36FSRDr083445; Wed, 6 Apr 2016 15:28:27 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604061528.u36FSRDr083445@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 6 Apr 2016 15:28:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297618 - head/sbin/fsck_msdosfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 15:28:28 -0000 Author: pfg Date: Wed Apr 6 15:28:26 2016 New Revision: 297618 URL: https://svnweb.freebsd.org/changeset/base/297618 Log: fsck_msdosfs(8): Optimimize memsets Obtained from: NetBSD (bin/50908) MFC after: 2 weeks Modified: head/sbin/fsck_msdosfs/dir.c Modified: head/sbin/fsck_msdosfs/dir.c ============================================================================== --- head/sbin/fsck_msdosfs/dir.c Wed Apr 6 14:16:37 2016 (r297617) +++ head/sbin/fsck_msdosfs/dir.c Wed Apr 6 15:28:26 2016 (r297618) @@ -925,6 +925,7 @@ int reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head) { struct dosDirEntry d; + int len; u_char *p; if (!ask(1, "Reconnect")) @@ -976,14 +977,15 @@ reconnect(int dosfs, struct bootblock *b boot->NumFiles++; /* Ensure uniqueness of entry here! XXX */ memset(&d, 0, sizeof d); - (void)snprintf(d.name, sizeof(d.name), "%u", head); + /* worst case -1 = 4294967295, 10 digits */ + len = snprintf(d.name, sizeof(d.name), "%u", head); d.flags = 0; d.head = head; d.size = fat[head].length * boot->ClusterSize; - memset(p, 0, 32); - memset(p, ' ', 11); - memcpy(p, d.name, strlen(d.name)); + memcpy(p, d.name, len); + memset(p + len, ' ', 11 - len); + memset(p + 11, 0, 32 - 11); p[26] = (u_char)d.head; p[27] = (u_char)(d.head >> 8); if (boot->ClustMask == CLUST32_MASK) { From owner-svn-src-all@freebsd.org Wed Apr 6 16:09:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01498B066A8; Wed, 6 Apr 2016 16:09:12 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id D02901C23; Wed, 6 Apr 2016 16:09:11 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36G9Bws096359; Wed, 6 Apr 2016 16:09:11 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36G9AWd096354; Wed, 6 Apr 2016 16:09:10 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201604061609.u36G9AWd096354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 6 Apr 2016 16:09:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297619 - in head/lib/libc: aarch64/gen aarch64/sys arm/aeabi gen include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 16:09:12 -0000 Author: andrew Date: Wed Apr 6 16:09:10 2016 New Revision: 297619 URL: https://svnweb.freebsd.org/changeset/base/297619 Log: Disable support for compat syscalls on arm64. These symbols were never shipped since arm64 exists only on 11+. Submitted by: brooks Reviewed by: emaste, imp Modified: head/lib/libc/aarch64/gen/Makefile.inc head/lib/libc/aarch64/sys/Makefile.inc head/lib/libc/arm/aeabi/aeabi_vfp.h head/lib/libc/gen/semctl.c head/lib/libc/include/compat.h Modified: head/lib/libc/aarch64/gen/Makefile.inc ============================================================================== --- head/lib/libc/aarch64/gen/Makefile.inc Wed Apr 6 15:28:26 2016 (r297618) +++ head/lib/libc/aarch64/gen/Makefile.inc Wed Apr 6 16:09:10 2016 (r297619) @@ -1,5 +1,7 @@ # $FreeBSD$ +CFLAGS+= -DNO_COMPAT7 + SRCS+= _ctx_start.S \ fabs.S \ flt_rounds.c \ Modified: head/lib/libc/aarch64/sys/Makefile.inc ============================================================================== --- head/lib/libc/aarch64/sys/Makefile.inc Wed Apr 6 15:28:26 2016 (r297618) +++ head/lib/libc/aarch64/sys/Makefile.inc Wed Apr 6 16:09:10 2016 (r297619) @@ -1,5 +1,7 @@ # $FreeBSD$ +MIASM:= ${MIASM:Nfreebsd[467]_*} + SRCS+= __vdso_gettc.c #MDASM= ptrace.S Modified: head/lib/libc/arm/aeabi/aeabi_vfp.h ============================================================================== --- head/lib/libc/arm/aeabi/aeabi_vfp.h Wed Apr 6 15:28:26 2016 (r297618) +++ head/lib/libc/arm/aeabi/aeabi_vfp.h Wed Apr 6 16:09:10 2016 (r297619) @@ -42,7 +42,9 @@ #define AEABI_ENTRY(x) ENTRY(__aeabi_ ## x ## _vfp) #define AEABI_END(x) END(__aeabi_ ## x ## _vfp) #else -#define AEABI_ENTRY(x) ENTRY(__aeabi_ ## x) +#define AEABI_ENTRY(x) \ + .set __fbsd_ ## x, __aeabi_ ## x; \ + ENTRY(__aeabi_ ## x) #define AEABI_END(x) END(__aeabi_ ## x) #endif Modified: head/lib/libc/gen/semctl.c ============================================================================== --- head/lib/libc/gen/semctl.c Wed Apr 6 15:28:26 2016 (r297618) +++ head/lib/libc/gen/semctl.c Wed Apr 6 16:09:10 2016 (r297619) @@ -29,7 +29,9 @@ #include __FBSDID("$FreeBSD$"); +#ifndef NO_COMPAT7 #define _WANT_SEMUN_OLD +#endif #include #include @@ -38,8 +40,10 @@ __FBSDID("$FreeBSD$"); #include int __semctl(int semid, int semnum, int cmd, union semun *arg); +#ifndef NO_COMPAT7 int freebsd7___semctl(int semid, int semnum, int cmd, union semun_old *arg); int freebsd7_semctl(int semid, int semnum, int cmd, ...); +#endif int semctl(int semid, int semnum, int cmd, ...) @@ -61,6 +65,7 @@ semctl(int semid, int semnum, int cmd, . return (__semctl(semid, semnum, cmd, semun_ptr)); } +#ifndef NO_COMPAT7 int freebsd7_semctl(int semid, int semnum, int cmd, ...) { @@ -82,3 +87,4 @@ freebsd7_semctl(int semid, int semnum, i } __sym_compat(semctl, freebsd7_semctl, FBSD_1.0); +#endif Modified: head/lib/libc/include/compat.h ============================================================================== --- head/lib/libc/include/compat.h Wed Apr 6 15:28:26 2016 (r297618) +++ head/lib/libc/include/compat.h Wed Apr 6 16:09:10 2016 (r297619) @@ -38,9 +38,11 @@ #define __sym_compat(sym,impl,verid) \ .symver impl, sym@verid +#ifndef NO_COMPAT7 __sym_compat(__semctl, freebsd7___semctl, FBSD_1.0); __sym_compat(msgctl, freebsd7_msgctl, FBSD_1.0); __sym_compat(shmctl, freebsd7_shmctl, FBSD_1.0); +#endif #undef __sym_compat From owner-svn-src-all@freebsd.org Wed Apr 6 16:10:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AD2FB0678A; Wed, 6 Apr 2016 16:10:47 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from kif.fubar.geek.nz (kif.fubar.geek.nz [178.62.119.249]) by mx1.freebsd.org (Postfix) with ESMTP id CFD381F20; Wed, 6 Apr 2016 16:10:46 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from zapp (global-5-144.nat-2.net.cam.ac.uk [131.111.5.144]) by kif.fubar.geek.nz (Postfix) with ESMTPSA id 97685D7A17; Wed, 6 Apr 2016 16:10:40 +0000 (UTC) Date: Wed, 6 Apr 2016 17:10:37 +0100 From: Andrew Turner Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297619 - in head/lib/libc: aarch64/gen aarch64/sys arm/aeabi gen include Message-ID: <20160406171037.36a60194@zapp> In-Reply-To: <201604061609.u36G9AWd096354@repo.freebsd.org> References: <201604061609.u36G9AWd096354@repo.freebsd.org> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 16:10:47 -0000 On Wed, 6 Apr 2016 16:09:10 +0000 (UTC) Andrew Turner wrote: > Author: andrew > Date: Wed Apr 6 16:09:10 2016 > New Revision: 297619 > URL: https://svnweb.freebsd.org/changeset/base/297619 > > Log: > Disable support for compat syscalls on arm64. These symbols were > never shipped since arm64 exists only on 11+. > > Submitted by: brooks > Reviewed by: emaste, imp Differential Revision: https://reviews.freebsd.org/D5601 Andrew From owner-svn-src-all@freebsd.org Wed Apr 6 16:50:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7274CB0631A; Wed, 6 Apr 2016 16:50:19 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id 44CE212CD; Wed, 6 Apr 2016 16:50:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36GoIIW008354; Wed, 6 Apr 2016 16:50:18 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36GoI6N008353; Wed, 6 Apr 2016 16:50:18 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201604061650.u36GoI6N008353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 6 Apr 2016 16:50:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297620 - head/lib/libc/arm/aeabi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 16:50:19 -0000 Author: andrew Date: Wed Apr 6 16:50:18 2016 New Revision: 297620 URL: https://svnweb.freebsd.org/changeset/base/297620 Log: Revert a change that sneeked with 297619 Modified: head/lib/libc/arm/aeabi/aeabi_vfp.h Modified: head/lib/libc/arm/aeabi/aeabi_vfp.h ============================================================================== --- head/lib/libc/arm/aeabi/aeabi_vfp.h Wed Apr 6 16:09:10 2016 (r297619) +++ head/lib/libc/arm/aeabi/aeabi_vfp.h Wed Apr 6 16:50:18 2016 (r297620) @@ -42,9 +42,7 @@ #define AEABI_ENTRY(x) ENTRY(__aeabi_ ## x ## _vfp) #define AEABI_END(x) END(__aeabi_ ## x ## _vfp) #else -#define AEABI_ENTRY(x) \ - .set __fbsd_ ## x, __aeabi_ ## x; \ - ENTRY(__aeabi_ ## x) +#define AEABI_ENTRY(x) ENTRY(__aeabi_ ## x) #define AEABI_END(x) END(__aeabi_ ## x) #endif From owner-svn-src-all@freebsd.org Wed Apr 6 17:56:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28CA1B0673D; Wed, 6 Apr 2016 17:56:42 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0054914EB; Wed, 6 Apr 2016 17:56:42 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 1EB35B987; Wed, 6 Apr 2016 13:56:41 -0400 (EDT) From: John Baldwin To: Baptiste Daroussin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297597 - in head/sys: amd64/linux amd64/linux32 i386/linux Date: Wed, 06 Apr 2016 07:59:05 -0700 Message-ID: <1589418.nsqxoJzOlo@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <20160406064002.GJ49864@ivaldir.etoilebsd.net> References: <201604052236.u35ManwQ076790@repo.freebsd.org> <2270129.DEqYKEiVDZ@ralph.baldwin.cx> <20160406064002.GJ49864@ivaldir.etoilebsd.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 06 Apr 2016 13:56:41 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 17:56:42 -0000 On Wednesday, April 06, 2016 08:40:02 AM Baptiste Daroussin wrote: > On Tue, Apr 05, 2016 at 06:32:16PM -0700, John Baldwin wrote: > > On Tuesday, April 05, 2016 10:36:49 PM Baptiste Daroussin wrote: > > > Author: bapt > > > Date: Tue Apr 5 22:36:48 2016 > > > New Revision: 297597 > > > URL: https://svnweb.freebsd.org/changeset/base/297597 > > > > > > Log: > > > Add kern.features flags for linux and linux64 modules > > > > > > kern.features.linux: 1 meaning linux 32 bits binaries are supported > > > kern.features.linux64: 1 meaning linux 64 bits binaries are supported > > > > > > The goal here is to help 3rd party applications (including ports) to determine > > > if the host do support linux emulation > > > > > > Reviewed by: dchagin > > > MFC after: 1 week > > > Relnotes: yes > > > Differential Revision: D5830 > > > > Other parts of the system (e.g. libsysdecode, the various symbols exported by > > the modules, etc.) use "linux" to mean supporting Linux binaries of the same > > ABI as the host (so x86-64 on amd64 and i386 on i386) and "linux32" to mean > > supporting 32-bit Linux binaries on a 64-bit host. Note that we used to > > have linux.ko on Alpha which was a 64-bit ABI, not 32-bit. It is unfortunate > > that we called linux32.ko linux.ko, but we shouldn't perpetuate that mistake > > further IMO. For example, I think if we grow Linux/aarch64 ABI support on > > FreeBSD/arm64, that should be called 'linux.ko', not 'linux64.ko'. > > Similarly, Linux/armv6 on FreeBSD/armv6 would also be 'linux.ko'. > > > > I would also list the names in the feature description (so Linux/i386, not > > Linux 32-bit, since Linux/armv6 is a 32-bit binary, but linux.ko on > > FreeBSD/i386 can't run it). > > > Well I tried to be consistent with the other example we have which is cloudabi. > > I considered the x86 case and tried to generalize: > > linux => my arch (x86) in 32bit > linux64 => my arch (x86) in 64bit > > Let's consider aarch64 which is supposed to also have support for 32bits (one > would be happy to run linux armv6 on top of it ,no?) > > linux => my arm in 32bits > linux64 => my arch in 64bits > > That said, I have no strong feelings about it Note that we don't call FreeBSD/amd64 binaries 'freebsd64', we call them 'freebsd' and use 'freebsd32' for FreeBSD/i386 binaries. If we had gone the route of /usr/lib64 for amd64 binaries leaving /usr/lib for i386, then I think your naming would be more consistent, but that's not what we do. As I said above, I would expect Linux/armv6 binaries on aarch64 to be a 'linux32', not 'linux'. Using 'linux.ko' instead of 'linux32.ko' on amd64 was just a mistake of expedience. The files are all named 'linux32'. The global symbols have recently all been named 'linux32', and the DTrace systrace kernel module was recently renamed from 'systrace_linux.ko' to 'systrace_linux32.ko'. (systrace_linux.ko holds the x86-64 system call names). If we could rename 'linux.ko' to 'linux32.ko' on amd64 without suffering a huge POLA violation I would push for that as well. In the future we might very well have platforms that are primarily 64-bit and may not implement 32-bit at all (FreeBSD/riscv is 64-bit only right now, and if we grow Linux ABI support for that I suspect it will be 64-bit only as well). Those should have 'linux.ko' to be the 'native' ABI IMO, not a linux64.ko without a linux.ko. -- John Baldwin From owner-svn-src-all@freebsd.org Wed Apr 6 19:34:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E337EB04D2C; Wed, 6 Apr 2016 19:34:45 +0000 (UTC) (envelope-from imp@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 mx1.freebsd.org (Postfix) with ESMTPS id BFC5D1C8E; Wed, 6 Apr 2016 19:34:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36JYiG4059831; Wed, 6 Apr 2016 19:34:44 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36JYinF059830; Wed, 6 Apr 2016 19:34:44 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201604061934.u36JYinF059830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 6 Apr 2016 19:34:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297621 - head/tools/tools/nanobsd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 19:34:46 -0000 Author: imp Date: Wed Apr 6 19:34:44 2016 New Revision: 297621 URL: https://svnweb.freebsd.org/changeset/base/297621 Log: Update cust_pkgng with a simpler, more robust version. We don't need to loop for pkg, which simplifies things. Modified: head/tools/tools/nanobsd/defaults.sh (contents, props changed) Modified: head/tools/tools/nanobsd/defaults.sh ============================================================================== --- head/tools/tools/nanobsd/defaults.sh Wed Apr 6 16:50:18 2016 (r297620) +++ head/tools/tools/nanobsd/defaults.sh Wed Apr 6 19:34:44 2016 (r297621) @@ -916,6 +916,17 @@ cust_install_files ( ) ( cust_pkgng ( ) ( + local PKG_CONF="${NANO_WORLDDIR}/usr/local/etc/pkg.conf" + local PKGCMD="env ASSUME_ALWAYS_YES=YES PKG_DBDIR=${NANO_PKG_META_BASE}/pkg SIGNATURE_TYPE=none /usr/sbin/pkg" + + # Ensure pkg.conf points pkg to where the package meta data lives. + touch ${PKG_CONF} + if grep -Eiq '^PKG_DBDIR:.*' ${PKG_CONF}; then + sed -i -e "\|^PKG_DBDIR:.*|Is||PKG_DBDIR: "\"${NANO_PKG_META_BASE}/pkg\""|" ${PKG_CONF} + else + echo "PKG_DBDIR: \"${NANO_PKG_META_BASE}/pkg\"" >> ${PKG_CONF} + fi + # If the package directory doesn't exist, we're done. if [ ! -d ${NANO_PACKAGE_DIR} ]; then echo "DONE 0 packages" @@ -930,52 +941,28 @@ cust_pkgng ( ) ( echo "FAILED: need a pkg/ package for bootstrapping" exit 2 fi + NANO_PACKAGE_LIST="${_NANO_PKG_PACKAGE} ${NANO_PACKAGE_LIST}" - # Copy packages into chroot - mkdir -p ${NANO_WORLDDIR}/Pkg - ( - cd "${NANO_PACKAGE_DIR}" - find ${NANO_PACKAGE_LIST} -print | - cpio -Ldumpv ${NANO_WORLDDIR}/Pkg - ) - - #Bootstrap pkg - CR env ASSUME_ALWAYS_YES=YES SIGNATURE_TYPE=none /usr/sbin/pkg add /Pkg/${_NANO_PKG_PACKAGE} - CR pkg -N >/dev/null 2>&1 - if [ "$?" -ne "0" ]; then - echo "FAILED: pkg bootstrapping faied" - exit 2 - fi - rm -f ${NANO_WORLDDIR}/Pkg/pkg-* + # Mount packages into chroot + mkdir -p ${NANO_WORLDDIR}/_.p + mount -t nullfs -o noatime -o ro ${NANO_PACKAGE_DIR} ${NANO_WORLDDIR}/_.p + + trap "umount ${NANO_WORLDDIR}/_.p ; rm -rf ${NANO_WORLDDIR}/_.p" 1 2 15 - # Count & report how many we have to install - todo=`ls ${NANO_WORLDDIR}/Pkg | /usr/bin/wc -l` - todo=$(expr $todo + 1) # add one for pkg since it is installed already + # Install packages + todo="$(echo "${NANO_PACKAGE_LIST}" | awk '{ print NF }')" echo "=== TODO: $todo" - ls ${NANO_WORLDDIR}/Pkg + echo "${NANO_PACKAGE_LIST}" echo "===" - while true - do - # Record how many we have now - have=$(CR env ASSUME_ALWAYS_YES=YES /usr/sbin/pkg info | /usr/bin/wc -l) - - # Attempt to install more packages - CR0 'ls 'Pkg/*txz' | xargs env ASSUME_ALWAYS_YES=YES /usr/sbin/pkg add' - - # See what that got us - now=$(CR env ASSUME_ALWAYS_YES=YES /usr/sbin/pkg info | /usr/bin/wc -l) - echo "=== NOW $now" - CR env ASSUME_ALWAYS_YES=YES /usr/sbin/pkg info - echo "===" - if [ $now -eq $todo ] ; then - echo "DONE $now packages" - break - elif [ $now -eq $have ] ; then - echo "FAILED: Nothing happened on this pass" - exit 2 - fi + for _PKG in ${NANO_PACKAGE_LIST}; do + CR "${PKGCMD} add /_.p/${_PKG}" done - rm -rf ${NANO_WORLDDIR}/Pkg + + CR0 "${PKGCMD} info" + + trap - 1 2 15 EXIT + umount ${NANO_WORLDDIR}/_.p + rm -rf ${NANO_WORLDDIR}/_.p ) ####################################################################### From owner-svn-src-all@freebsd.org Wed Apr 6 21:04:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DE58B06AF7; Wed, 6 Apr 2016 21:04:41 +0000 (UTC) (envelope-from davidcs@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 mx1.freebsd.org (Postfix) with ESMTPS id C34E31B8D; Wed, 6 Apr 2016 21:04:40 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36L4dpq087280; Wed, 6 Apr 2016 21:04:39 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36L4dEV087277; Wed, 6 Apr 2016 21:04:39 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201604062104.u36L4dEV087277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 6 Apr 2016 21:04:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297622 - stable/10/sys/dev/bxe X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 21:04:41 -0000 Author: davidcs Date: Wed Apr 6 21:04:39 2016 New Revision: 297622 URL: https://svnweb.freebsd.org/changeset/base/297622 Log: MFC r297155 Modifications to achieve a common source base from FreeBSD7.x thru 10.x Modified: stable/10/sys/dev/bxe/bxe.c stable/10/sys/dev/bxe/bxe.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/bxe/bxe.c ============================================================================== --- stable/10/sys/dev/bxe/bxe.c Wed Apr 6 19:34:44 2016 (r297621) +++ stable/10/sys/dev/bxe/bxe.c Wed Apr 6 21:04:39 2016 (r297622) @@ -3074,7 +3074,7 @@ bxe_tpa_stop(struct bxe_softc * #if __FreeBSD_version >= 800000 /* specify what RSS queue was used for this flow */ m->m_pkthdr.flowid = fp->index; - M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE); + BXE_SET_FLOWID(m); #endif ifp->if_ipackets++; @@ -3363,7 +3363,7 @@ bxe_rxeof(struct bxe_softc *sc, #if __FreeBSD_version >= 800000 /* specify what RSS queue was used for this flow */ m->m_pkthdr.flowid = fp->index; - M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE); + BXE_SET_FLOWID(m); #endif next_rx: @@ -4835,6 +4835,8 @@ bxe_dump_mbuf(struct bxe_softc *sc, } while (m) { + +#if __FreeBSD_version >= 1000000 BLOGD(sc, DBG_MBUF, "%02d: mbuf=%p m_len=%d m_flags=0x%b m_data=%p\n", i, m, m->m_len, m->m_flags, M_FLAG_BITS, m->m_data); @@ -4845,6 +4847,26 @@ bxe_dump_mbuf(struct bxe_softc *sc, i, m->m_pkthdr.len, m->m_flags, M_FLAG_BITS, (int)m->m_pkthdr.csum_flags, CSUM_BITS); } +#else + BLOGD(sc, DBG_MBUF, + "%02d: mbuf=%p m_len=%d m_flags=0x%b m_data=%p\n", + i, m, m->m_len, m->m_flags, + "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY", m->m_data); + + if (m->m_flags & M_PKTHDR) { + BLOGD(sc, DBG_MBUF, + "%02d: - m_pkthdr: tot_len=%d flags=0x%b csum_flags=%b\n", + i, m->m_pkthdr.len, m->m_flags, + "\20\12M_BCAST\13M_MCAST\14M_FRAG" + "\15M_FIRSTFRAG\16M_LASTFRAG\21M_VLANTAG" + "\22M_PROMISC\23M_NOFREE", + (int)m->m_pkthdr.csum_flags, + "\20\1CSUM_IP\2CSUM_TCP\3CSUM_UDP\4CSUM_IP_FRAGS" + "\5CSUM_FRAGMENT\6CSUM_TSO\11CSUM_IP_CHECKED" + "\12CSUM_IP_VALID\13CSUM_DATA_VALID" + "\14CSUM_PSEUDO_HDR"); + } +#endif /* #if __FreeBSD_version >= 1000000 */ if (m->m_flags & M_EXT) { switch (m->m_ext.ext_type) { @@ -5228,7 +5250,9 @@ bxe_tx_encap(struct bxe_fastpath *fp, st sc = fp->sc; +#if __FreeBSD_version >= 800000 M_ASSERTPKTHDR(*m_head); +#endif /* #if __FreeBSD_version >= 800000 */ m0 = *m_head; rc = defragged = nbds = ovlan = vlan_off = total_pkt_size = 0; @@ -5843,7 +5867,8 @@ bxe_tx_mq_start(struct ifnet *ifp, fp_index = 0; /* default is the first queue */ /* check if flowid is set */ - if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) + + if (BXE_VALID_FLOWID(m)) fp_index = (m->m_pkthdr.flowid % sc->num_queues); fp = &sc->fp[fp_index]; @@ -15709,18 +15734,11 @@ bxe_add_sysctls(struct bxe_softc *sc) CTLFLAG_RD, BXE_DRIVER_VERSION, 0, "version"); - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version", - CTLFLAG_RD, sc->devinfo.bc_ver_str, 0, - "bootcode version"); - snprintf(sc->fw_ver_str, sizeof(sc->fw_ver_str), "%d.%d.%d.%d", BCM_5710_FW_MAJOR_VERSION, BCM_5710_FW_MINOR_VERSION, BCM_5710_FW_REVISION_VERSION, BCM_5710_FW_ENGINEERING_VERSION); - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version", - CTLFLAG_RD, sc->fw_ver_str, 0, - "firmware version"); snprintf(sc->mf_mode_str, sizeof(sc->mf_mode_str), "%s", ((sc->devinfo.mf_info.mf_mode == SINGLE_FUNCTION) ? "Single" : @@ -15728,32 +15746,58 @@ bxe_add_sysctls(struct bxe_softc *sc) (sc->devinfo.mf_info.mf_mode == MULTI_FUNCTION_SI) ? "MF-SI" : (sc->devinfo.mf_info.mf_mode == MULTI_FUNCTION_AFEX) ? "MF-AFEX" : "Unknown")); - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode", - CTLFLAG_RD, sc->mf_mode_str, 0, - "multifunction mode"); - SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "mf_vnics", CTLFLAG_RD, &sc->devinfo.mf_info.vnics_per_port, 0, "multifunction vnics per port"); - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr", - CTLFLAG_RD, sc->mac_addr_str, 0, - "mac address"); - snprintf(sc->pci_link_str, sizeof(sc->pci_link_str), "%s x%d", ((sc->devinfo.pcie_link_speed == 1) ? "2.5GT/s" : (sc->devinfo.pcie_link_speed == 2) ? "5.0GT/s" : (sc->devinfo.pcie_link_speed == 4) ? "8.0GT/s" : "???GT/s"), sc->devinfo.pcie_link_width); + + sc->debug = bxe_debug; + +#if __FreeBSD_version >= 900000 + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version", + CTLFLAG_RD, sc->devinfo.bc_ver_str, 0, + "bootcode version"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version", + CTLFLAG_RD, sc->fw_ver_str, 0, + "firmware version"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode", + CTLFLAG_RD, sc->mf_mode_str, 0, + "multifunction mode"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr", + CTLFLAG_RD, sc->mac_addr_str, 0, + "mac address"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "pci_link", CTLFLAG_RD, sc->pci_link_str, 0, "pci link status"); - - sc->debug = bxe_debug; SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "debug", CTLFLAG_RW, &sc->debug, "debug logging mode"); +#else + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version", + CTLFLAG_RD, &sc->devinfo.bc_ver_str, 0, + "bootcode version"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version", + CTLFLAG_RD, &sc->fw_ver_str, 0, + "firmware version"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode", + CTLFLAG_RD, &sc->mf_mode_str, 0, + "multifunction mode"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr", + CTLFLAG_RD, &sc->mac_addr_str, 0, + "mac address"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "pci_link", + CTLFLAG_RD, &sc->pci_link_str, 0, + "pci link status"); + SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "debug", + CTLFLAG_RW, &sc->debug, 0, + "debug logging mode"); +#endif /* #if __FreeBSD_version >= 900000 */ SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "trigger_grcdump", CTLTYPE_UINT | CTLFLAG_RW, sc, 0, Modified: stable/10/sys/dev/bxe/bxe.h ============================================================================== --- stable/10/sys/dev/bxe/bxe.h Wed Apr 6 19:34:44 2016 (r297621) +++ stable/10/sys/dev/bxe/bxe.h Wed Apr 6 21:04:39 2016 (r297622) @@ -2271,6 +2271,17 @@ void bxe_dump_mem(struct bxe_softc *sc, void bxe_dump_mbuf_data(struct bxe_softc *sc, char *pTag, struct mbuf *m, uint8_t contents); + +#if __FreeBSD_version >= 800000 +#if __FreeBSD_version >= 1000000 +#define BXE_SET_FLOWID(m) M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE) +#define BXE_VALID_FLOWID(m) (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) +#else +#define BXE_VALID_FLOWID(m) ((m->m_flags & M_FLOWID) != 0) +#define BXE_SET_FLOWID(m) m->m_flags |= M_FLOWID +#endif +#endif /* #if __FreeBSD_version >= 800000 */ + /***********/ /* INLINES */ /***********/ From owner-svn-src-all@freebsd.org Wed Apr 6 21:19:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37AC8B06F95; Wed, 6 Apr 2016 21:19:29 +0000 (UTC) (envelope-from davidcs@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 mx1.freebsd.org (Postfix) with ESMTPS id EE3CB127B; Wed, 6 Apr 2016 21:19:28 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36LJShm090389; Wed, 6 Apr 2016 21:19:28 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36LJSZ8090387; Wed, 6 Apr 2016 21:19:28 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201604062119.u36LJSZ8090387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 6 Apr 2016 21:19:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r297623 - stable/9/sys/dev/bxe X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 21:19:29 -0000 Author: davidcs Date: Wed Apr 6 21:19:27 2016 New Revision: 297623 URL: https://svnweb.freebsd.org/changeset/base/297623 Log: MFC r297155 Modifications to achieve a common source base from FreeBSD7.x thru 10.x Modified: stable/9/sys/dev/bxe/bxe.c stable/9/sys/dev/bxe/bxe.h Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/bxe/bxe.c ============================================================================== --- stable/9/sys/dev/bxe/bxe.c Wed Apr 6 21:04:39 2016 (r297622) +++ stable/9/sys/dev/bxe/bxe.c Wed Apr 6 21:19:27 2016 (r297623) @@ -3074,7 +3074,7 @@ bxe_tpa_stop(struct bxe_softc * #if __FreeBSD_version >= 800000 /* specify what RSS queue was used for this flow */ m->m_pkthdr.flowid = fp->index; - m->m_flags |= M_FLOWID; + BXE_SET_FLOWID(m); #endif ifp->if_ipackets++; @@ -3363,7 +3363,7 @@ bxe_rxeof(struct bxe_softc *sc, #if __FreeBSD_version >= 800000 /* specify what RSS queue was used for this flow */ m->m_pkthdr.flowid = fp->index; - m->m_flags |= M_FLOWID; + BXE_SET_FLOWID(m); #endif next_rx: @@ -4835,6 +4835,27 @@ bxe_dump_mbuf(struct bxe_softc *sc, } while (m) { + +#if __FreeBSD_version >= 1000000 + BLOGD(sc, DBG_MBUF, + "%02d: mbuf=%p m_len=%d m_flags=0x%b m_data=%p\n", + i, m, m->m_len, m->m_flags, + "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY", m->m_data); + + if (m->m_flags & M_PKTHDR) { + BLOGD(sc, DBG_MBUF, + "%02d: - m_pkthdr: tot_len=%d flags=0x%b csum_flags=%b\n", + i, m->m_pkthdr.len, m->m_flags, + "\20\12M_BCAST\13M_MCAST\14M_FRAG" + "\15M_FIRSTFRAG\16M_LASTFRAG\21M_VLANTAG" + "\22M_PROMISC\23M_NOFREE", + (int)m->m_pkthdr.csum_flags, + "\20\1CSUM_IP\2CSUM_TCP\3CSUM_UDP\4CSUM_IP_FRAGS" + "\5CSUM_FRAGMENT\6CSUM_TSO\11CSUM_IP_CHECKED" + "\12CSUM_IP_VALID\13CSUM_DATA_VALID" + "\14CSUM_PSEUDO_HDR"); + } +#else BLOGD(sc, DBG_MBUF, "%02d: mbuf=%p m_len=%d m_flags=0x%b m_data=%p\n", i, m, m->m_len, m->m_flags, @@ -4853,6 +4874,7 @@ bxe_dump_mbuf(struct bxe_softc *sc, "\12CSUM_IP_VALID\13CSUM_DATA_VALID" "\14CSUM_PSEUDO_HDR"); } +#endif /* #if __FreeBSD_version >= 1000000 */ if (m->m_flags & M_EXT) { switch (m->m_ext.ext_type) { @@ -5236,7 +5258,9 @@ bxe_tx_encap(struct bxe_fastpath *fp, st sc = fp->sc; +#if __FreeBSD_version >= 800000 M_ASSERTPKTHDR(*m_head); +#endif /* #if __FreeBSD_version >= 800000 */ m0 = *m_head; rc = defragged = nbds = ovlan = vlan_off = total_pkt_size = 0; @@ -5850,10 +5874,10 @@ bxe_tx_mq_start(struct ifnet *ifp, fp_index = 0; /* default is the first queue */ - /* change the queue if using flow ID */ - if ((m->m_flags & M_FLOWID) != 0) { + /* check if flowid is set */ + + if (BXE_VALID_FLOWID(m)) fp_index = (m->m_pkthdr.flowid % sc->num_queues); - } fp = &sc->fp[fp_index]; @@ -15718,18 +15742,11 @@ bxe_add_sysctls(struct bxe_softc *sc) CTLFLAG_RD, BXE_DRIVER_VERSION, 0, "version"); - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version", - CTLFLAG_RD, sc->devinfo.bc_ver_str, 0, - "bootcode version"); - snprintf(sc->fw_ver_str, sizeof(sc->fw_ver_str), "%d.%d.%d.%d", BCM_5710_FW_MAJOR_VERSION, BCM_5710_FW_MINOR_VERSION, BCM_5710_FW_REVISION_VERSION, BCM_5710_FW_ENGINEERING_VERSION); - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version", - CTLFLAG_RD, sc->fw_ver_str, 0, - "firmware version"); snprintf(sc->mf_mode_str, sizeof(sc->mf_mode_str), "%s", ((sc->devinfo.mf_info.mf_mode == SINGLE_FUNCTION) ? "Single" : @@ -15737,32 +15754,58 @@ bxe_add_sysctls(struct bxe_softc *sc) (sc->devinfo.mf_info.mf_mode == MULTI_FUNCTION_SI) ? "MF-SI" : (sc->devinfo.mf_info.mf_mode == MULTI_FUNCTION_AFEX) ? "MF-AFEX" : "Unknown")); - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode", - CTLFLAG_RD, sc->mf_mode_str, 0, - "multifunction mode"); - SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "mf_vnics", CTLFLAG_RD, &sc->devinfo.mf_info.vnics_per_port, 0, "multifunction vnics per port"); - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr", - CTLFLAG_RD, sc->mac_addr_str, 0, - "mac address"); - snprintf(sc->pci_link_str, sizeof(sc->pci_link_str), "%s x%d", ((sc->devinfo.pcie_link_speed == 1) ? "2.5GT/s" : (sc->devinfo.pcie_link_speed == 2) ? "5.0GT/s" : (sc->devinfo.pcie_link_speed == 4) ? "8.0GT/s" : "???GT/s"), sc->devinfo.pcie_link_width); + + sc->debug = bxe_debug; + +#if __FreeBSD_version >= 900000 + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version", + CTLFLAG_RD, sc->devinfo.bc_ver_str, 0, + "bootcode version"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version", + CTLFLAG_RD, sc->fw_ver_str, 0, + "firmware version"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode", + CTLFLAG_RD, sc->mf_mode_str, 0, + "multifunction mode"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr", + CTLFLAG_RD, sc->mac_addr_str, 0, + "mac address"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "pci_link", CTLFLAG_RD, sc->pci_link_str, 0, "pci link status"); - - sc->debug = bxe_debug; SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "debug", CTLFLAG_RW, &sc->debug, "debug logging mode"); +#else + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version", + CTLFLAG_RD, &sc->devinfo.bc_ver_str, 0, + "bootcode version"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version", + CTLFLAG_RD, &sc->fw_ver_str, 0, + "firmware version"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode", + CTLFLAG_RD, &sc->mf_mode_str, 0, + "multifunction mode"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr", + CTLFLAG_RD, &sc->mac_addr_str, 0, + "mac address"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "pci_link", + CTLFLAG_RD, &sc->pci_link_str, 0, + "pci link status"); + SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "debug", + CTLFLAG_RW, &sc->debug, 0, + "debug logging mode"); +#endif /* #if __FreeBSD_version >= 900000 */ SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "trigger_grcdump", CTLTYPE_UINT | CTLFLAG_RW, sc, 0, Modified: stable/9/sys/dev/bxe/bxe.h ============================================================================== --- stable/9/sys/dev/bxe/bxe.h Wed Apr 6 21:04:39 2016 (r297622) +++ stable/9/sys/dev/bxe/bxe.h Wed Apr 6 21:19:27 2016 (r297623) @@ -2271,6 +2271,17 @@ void bxe_dump_mem(struct bxe_softc *sc, void bxe_dump_mbuf_data(struct bxe_softc *sc, char *pTag, struct mbuf *m, uint8_t contents); + +#if __FreeBSD_version >= 800000 +#if __FreeBSD_version >= 1000000 +#define BXE_SET_FLOWID(m) M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE) +#define BXE_VALID_FLOWID(m) (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) +#else +#define BXE_VALID_FLOWID(m) ((m->m_flags & M_FLOWID) != 0) +#define BXE_SET_FLOWID(m) m->m_flags |= M_FLOWID +#endif +#endif /* #if __FreeBSD_version >= 800000 */ + /***********/ /* INLINES */ /***********/ From owner-svn-src-all@freebsd.org Wed Apr 6 21:43:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99267B06826; Wed, 6 Apr 2016 21:43:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8313C1100; Wed, 6 Apr 2016 21:43:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id u36Lhbk7007674 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 6 Apr 2016 14:43:37 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id u36LhbZL007673; Wed, 6 Apr 2016 14:43:37 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 6 Apr 2016 14:43:37 -0700 From: Gleb Smirnoff To: Andriy Voskoboinyk Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297592 - head/sys/net80211 Message-ID: <20160406214337.GD1080@FreeBSD.org> References: <201604052129.u35LTBpR055481@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201604052129.u35LTBpR055481@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 21:43:38 -0000 On Tue, Apr 05, 2016 at 09:29:11PM +0000, Andriy Voskoboinyk wrote: A> Author: avos A> Date: Tue Apr 5 21:29:11 2016 A> New Revision: 297592 A> URL: https://svnweb.freebsd.org/changeset/base/297592 A> A> Log: A> net80211: copy MAC address into iv_myaddr[] instead of aliasing it. A> A> Since IF_LLADDR() returns a non-constant pointer to the MAC address A> preserve a copy of it in iv_myaddr. A> A> PR: 208505 This is actually a bug of ifnet layer, not of ieee80211. So this fix is a workaround. You are welcome to try to improve the situation with ifnet :) Meanwhile, can you please put a comment into 'struct ieee80211vap' declaration: /* * XXX: we copy the address, since address returned by IF_LLADDR() isn't * constant. See PR 208505. */ A> Modified: A> head/sys/net80211/ieee80211.c A> head/sys/net80211/ieee80211_var.h A> A> Modified: head/sys/net80211/ieee80211.c A> ============================================================================== A> --- head/sys/net80211/ieee80211.c Tue Apr 5 21:12:03 2016 (r297591) A> +++ head/sys/net80211/ieee80211.c Tue Apr 5 21:29:11 2016 (r297592) A> @@ -483,7 +483,7 @@ ieee80211_vap_setup(struct ieee80211com A> vap->iv_htextcaps = ic->ic_htextcaps; A> vap->iv_opmode = opmode; A> vap->iv_caps |= ieee80211_opcap[opmode]; A> - vap->iv_myaddr = ic->ic_macaddr; A> + IEEE80211_ADDR_COPY(vap->iv_myaddr, ic->ic_macaddr); A> switch (opmode) { A> case IEEE80211_M_WDS: A> /* A> @@ -603,7 +603,7 @@ ieee80211_vap_attach(struct ieee80211vap A> ifp->if_baudrate = IF_Mbps(maxrate); A> A> ether_ifattach(ifp, macaddr); A> - vap->iv_myaddr = IF_LLADDR(ifp); A> + IEEE80211_ADDR_COPY(vap->iv_myaddr, IF_LLADDR(ifp)); A> /* hook output method setup by ether_ifattach */ A> vap->iv_output = ifp->if_output; A> ifp->if_output = ieee80211_output; A> A> Modified: head/sys/net80211/ieee80211_var.h A> ============================================================================== A> --- head/sys/net80211/ieee80211_var.h Tue Apr 5 21:12:03 2016 (r297591) A> +++ head/sys/net80211/ieee80211_var.h Tue Apr 5 21:29:11 2016 (r297592) A> @@ -362,7 +362,8 @@ struct ieee80211vap { A> A> TAILQ_ENTRY(ieee80211vap) iv_next; /* list of vap instances */ A> struct ieee80211com *iv_ic; /* back ptr to common state */ A> - const uint8_t *iv_myaddr; /* MAC address: ifp or ic */ A> + /* MAC address: ifp or ic */ A> + uint8_t iv_myaddr[IEEE80211_ADDR_LEN]; A> uint32_t iv_debug; /* debug msg flags */ A> struct ieee80211_stats iv_stats; /* statistics */ A> A> _______________________________________________ A> svn-src-all@freebsd.org mailing list A> https://lists.freebsd.org/mailman/listinfo/svn-src-all A> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" -- Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Wed Apr 6 21:45:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 419FDB068A8; Wed, 6 Apr 2016 21:45:33 +0000 (UTC) (envelope-from davidcs@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 mx1.freebsd.org (Postfix) with ESMTPS id 03F141296; Wed, 6 Apr 2016 21:45:32 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36LjW4v099637; Wed, 6 Apr 2016 21:45:32 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36LjWBL099635; Wed, 6 Apr 2016 21:45:32 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201604062145.u36LjWBL099635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 6 Apr 2016 21:45:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r297624 - stable/8/sys/dev/bxe X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 21:45:33 -0000 Author: davidcs Date: Wed Apr 6 21:45:31 2016 New Revision: 297624 URL: https://svnweb.freebsd.org/changeset/base/297624 Log: MFC r297155 Modifications to achieve a common source base from FreeBSD7.x thru 10.x Modified: stable/8/sys/dev/bxe/bxe.c stable/8/sys/dev/bxe/bxe.h Directory Properties: stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) Modified: stable/8/sys/dev/bxe/bxe.c ============================================================================== --- stable/8/sys/dev/bxe/bxe.c Wed Apr 6 21:19:27 2016 (r297623) +++ stable/8/sys/dev/bxe/bxe.c Wed Apr 6 21:45:31 2016 (r297624) @@ -3074,7 +3074,7 @@ bxe_tpa_stop(struct bxe_softc * #if __FreeBSD_version >= 800000 /* specify what RSS queue was used for this flow */ m->m_pkthdr.flowid = fp->index; - m->m_flags |= M_FLOWID; + BXE_SET_FLOWID(m); #endif ifp->if_ipackets++; @@ -3363,7 +3363,7 @@ bxe_rxeof(struct bxe_softc *sc, #if __FreeBSD_version >= 800000 /* specify what RSS queue was used for this flow */ m->m_pkthdr.flowid = fp->index; - m->m_flags |= M_FLOWID; + BXE_SET_FLOWID(m); #endif next_rx: @@ -4835,6 +4835,19 @@ bxe_dump_mbuf(struct bxe_softc *sc, } while (m) { + +#if __FreeBSD_version >= 1000000 + BLOGD(sc, DBG_MBUF, + "%02d: mbuf=%p m_len=%d m_flags=0x%b m_data=%p\n", + i, m, m->m_len, m->m_flags, M_FLAG_BITS, m->m_data); + + if (m->m_flags & M_PKTHDR) { + BLOGD(sc, DBG_MBUF, + "%02d: - m_pkthdr: tot_len=%d flags=0x%b csum_flags=%b\n", + i, m->m_pkthdr.len, m->m_flags, M_FLAG_BITS, + (int)m->m_pkthdr.csum_flags, CSUM_BITS); + } +#else BLOGD(sc, DBG_MBUF, "%02d: mbuf=%p m_len=%d m_flags=0x%b m_data=%p\n", i, m, m->m_len, m->m_flags, @@ -4853,6 +4866,7 @@ bxe_dump_mbuf(struct bxe_softc *sc, "\12CSUM_IP_VALID\13CSUM_DATA_VALID" "\14CSUM_PSEUDO_HDR"); } +#endif /* #if __FreeBSD_version >= 1000000 */ if (m->m_flags & M_EXT) { switch (m->m_ext.ext_type) { @@ -5236,7 +5250,9 @@ bxe_tx_encap(struct bxe_fastpath *fp, st sc = fp->sc; +#if __FreeBSD_version >= 800000 M_ASSERTPKTHDR(*m_head); +#endif /* #if __FreeBSD_version >= 800000 */ m0 = *m_head; rc = defragged = nbds = ovlan = vlan_off = total_pkt_size = 0; @@ -5850,10 +5866,10 @@ bxe_tx_mq_start(struct ifnet *ifp, fp_index = 0; /* default is the first queue */ - /* change the queue if using flow ID */ - if ((m->m_flags & M_FLOWID) != 0) { + /* check if flowid is set */ + + if (BXE_VALID_FLOWID(m)) fp_index = (m->m_pkthdr.flowid % sc->num_queues); - } fp = &sc->fp[fp_index]; @@ -15718,18 +15734,11 @@ bxe_add_sysctls(struct bxe_softc *sc) CTLFLAG_RD, BXE_DRIVER_VERSION, 0, "version"); - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version", - CTLFLAG_RD, &sc->devinfo.bc_ver_str, 0, - "bootcode version"); - snprintf(sc->fw_ver_str, sizeof(sc->fw_ver_str), "%d.%d.%d.%d", BCM_5710_FW_MAJOR_VERSION, BCM_5710_FW_MINOR_VERSION, BCM_5710_FW_REVISION_VERSION, BCM_5710_FW_ENGINEERING_VERSION); - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version", - CTLFLAG_RD, &sc->fw_ver_str, 0, - "firmware version"); snprintf(sc->mf_mode_str, sizeof(sc->mf_mode_str), "%s", ((sc->devinfo.mf_info.mf_mode == SINGLE_FUNCTION) ? "Single" : @@ -15737,32 +15746,58 @@ bxe_add_sysctls(struct bxe_softc *sc) (sc->devinfo.mf_info.mf_mode == MULTI_FUNCTION_SI) ? "MF-SI" : (sc->devinfo.mf_info.mf_mode == MULTI_FUNCTION_AFEX) ? "MF-AFEX" : "Unknown")); - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode", - CTLFLAG_RD, &sc->mf_mode_str, 0, - "multifunction mode"); - SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "mf_vnics", CTLFLAG_RD, &sc->devinfo.mf_info.vnics_per_port, 0, "multifunction vnics per port"); - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr", - CTLFLAG_RD, &sc->mac_addr_str, 0, - "mac address"); - snprintf(sc->pci_link_str, sizeof(sc->pci_link_str), "%s x%d", ((sc->devinfo.pcie_link_speed == 1) ? "2.5GT/s" : (sc->devinfo.pcie_link_speed == 2) ? "5.0GT/s" : (sc->devinfo.pcie_link_speed == 4) ? "8.0GT/s" : "???GT/s"), sc->devinfo.pcie_link_width); + + sc->debug = bxe_debug; + +#if __FreeBSD_version >= 900000 + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version", + CTLFLAG_RD, sc->devinfo.bc_ver_str, 0, + "bootcode version"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version", + CTLFLAG_RD, sc->fw_ver_str, 0, + "firmware version"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode", + CTLFLAG_RD, sc->mf_mode_str, 0, + "multifunction mode"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr", + CTLFLAG_RD, sc->mac_addr_str, 0, + "mac address"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "pci_link", + CTLFLAG_RD, &sc->pci_link_str, 0, + "pci link status"); + SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "debug", + CTLFLAG_RW, &sc->debug, 0, + "debug logging mode"); +#else + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version", + CTLFLAG_RD, &sc->devinfo.bc_ver_str, 0, + "bootcode version"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version", + CTLFLAG_RD, &sc->fw_ver_str, 0, + "firmware version"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode", + CTLFLAG_RD, &sc->mf_mode_str, 0, + "multifunction mode"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr", + CTLFLAG_RD, &sc->mac_addr_str, 0, + "mac address"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "pci_link", CTLFLAG_RD, &sc->pci_link_str, 0, "pci link status"); - - sc->debug = bxe_debug; SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "debug", CTLFLAG_RW, &sc->debug, 0, "debug logging mode"); +#endif /* #if __FreeBSD_version >= 900000 */ SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "trigger_grcdump", CTLTYPE_UINT | CTLFLAG_RW, sc, 0, Modified: stable/8/sys/dev/bxe/bxe.h ============================================================================== --- stable/8/sys/dev/bxe/bxe.h Wed Apr 6 21:19:27 2016 (r297623) +++ stable/8/sys/dev/bxe/bxe.h Wed Apr 6 21:45:31 2016 (r297624) @@ -2271,6 +2271,17 @@ void bxe_dump_mem(struct bxe_softc *sc, void bxe_dump_mbuf_data(struct bxe_softc *sc, char *pTag, struct mbuf *m, uint8_t contents); + +#if __FreeBSD_version >= 800000 +#if __FreeBSD_version >= 1000000 +#define BXE_SET_FLOWID(m) M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE) +#define BXE_VALID_FLOWID(m) (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) +#else +#define BXE_VALID_FLOWID(m) ((m->m_flags & M_FLOWID) != 0) +#define BXE_SET_FLOWID(m) m->m_flags |= M_FLOWID +#endif +#endif /* #if __FreeBSD_version >= 800000 */ + /***********/ /* INLINES */ /***********/ From owner-svn-src-all@freebsd.org Wed Apr 6 21:59:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A79DB06D9E; Wed, 6 Apr 2016 21:59:53 +0000 (UTC) (envelope-from davidcs@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 mx1.freebsd.org (Postfix) with ESMTPS id 59F0D18DF; Wed, 6 Apr 2016 21:59:53 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36LxqJm003133; Wed, 6 Apr 2016 21:59:52 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36LxqPj003131; Wed, 6 Apr 2016 21:59:52 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201604062159.u36LxqPj003131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 6 Apr 2016 21:59:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r297625 - stable/7/sys/dev/bxe X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 21:59:53 -0000 Author: davidcs Date: Wed Apr 6 21:59:52 2016 New Revision: 297625 URL: https://svnweb.freebsd.org/changeset/base/297625 Log: MFC r297155 Modifications to achieve a common source base from FreeBSD7.x thru 10.x Modified: stable/7/sys/dev/bxe/bxe.c stable/7/sys/dev/bxe/bxe.h Directory Properties: stable/7/ (props changed) stable/7/sys/ (props changed) Modified: stable/7/sys/dev/bxe/bxe.c ============================================================================== --- stable/7/sys/dev/bxe/bxe.c Wed Apr 6 21:45:31 2016 (r297624) +++ stable/7/sys/dev/bxe/bxe.c Wed Apr 6 21:59:52 2016 (r297625) @@ -3074,7 +3074,7 @@ bxe_tpa_stop(struct bxe_softc * #if __FreeBSD_version >= 800000 /* specify what RSS queue was used for this flow */ m->m_pkthdr.flowid = fp->index; - m->m_flags |= M_FLOWID; + BXE_SET_FLOWID(m); #endif ifp->if_ipackets++; @@ -3363,7 +3363,7 @@ bxe_rxeof(struct bxe_softc *sc, #if __FreeBSD_version >= 800000 /* specify what RSS queue was used for this flow */ m->m_pkthdr.flowid = fp->index; - m->m_flags |= M_FLOWID; + BXE_SET_FLOWID(m); #endif next_rx: @@ -4835,6 +4835,19 @@ bxe_dump_mbuf(struct bxe_softc *sc, } while (m) { + +#if __FreeBSD_version >= 1000000 + BLOGD(sc, DBG_MBUF, + "%02d: mbuf=%p m_len=%d m_flags=0x%b m_data=%p\n", + i, m, m->m_len, m->m_flags, M_FLAG_BITS, m->m_data); + + if (m->m_flags & M_PKTHDR) { + BLOGD(sc, DBG_MBUF, + "%02d: - m_pkthdr: tot_len=%d flags=0x%b csum_flags=%b\n", + i, m->m_pkthdr.len, m->m_flags, M_FLAG_BITS, + (int)m->m_pkthdr.csum_flags, CSUM_BITS); + } +#else BLOGD(sc, DBG_MBUF, "%02d: mbuf=%p m_len=%d m_flags=0x%b m_data=%p\n", i, m, m->m_len, m->m_flags, @@ -4853,6 +4866,7 @@ bxe_dump_mbuf(struct bxe_softc *sc, "\12CSUM_IP_VALID\13CSUM_DATA_VALID" "\14CSUM_PSEUDO_HDR"); } +#endif /* #if __FreeBSD_version >= 1000000 */ if (m->m_flags & M_EXT) { switch (m->m_ext.ext_type) { @@ -5236,9 +5250,9 @@ bxe_tx_encap(struct bxe_fastpath *fp, st sc = fp->sc; - /* XXX compile error with _.amd64.LINT with m_hdr? +#if __FreeBSD_version >= 800000 M_ASSERTPKTHDR(*m_head); - */ +#endif /* #if __FreeBSD_version >= 800000 */ m0 = *m_head; rc = defragged = nbds = ovlan = vlan_off = total_pkt_size = 0; @@ -5757,7 +5771,7 @@ bxe_tx_mq_start_locked(struct bxe_softc if (!sc->link_vars.link_up || (ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) { - rc = drbr_enqueue_drv(ifp, tx_br, m); + rc = drbr_enqueue(ifp, tx_br, m); goto bxe_tx_mq_start_locked_exit; } @@ -5852,10 +5866,10 @@ bxe_tx_mq_start(struct ifnet *ifp, fp_index = 0; /* default is the first queue */ - /* change the queue if using flow ID */ - if ((m->m_flags & M_FLOWID) != 0) { + /* check if flowid is set */ + + if (BXE_VALID_FLOWID(m)) fp_index = (m->m_pkthdr.flowid % sc->num_queues); - } fp = &sc->fp[fp_index]; @@ -5863,7 +5877,7 @@ bxe_tx_mq_start(struct ifnet *ifp, rc = bxe_tx_mq_start_locked(sc, ifp, fp, m); BXE_FP_TX_UNLOCK(fp); } else - rc = drbr_enqueue_drv(ifp, fp->tx_br, m); + rc = drbr_enqueue(ifp, fp->tx_br, m); return (rc); } @@ -15720,18 +15734,11 @@ bxe_add_sysctls(struct bxe_softc *sc) CTLFLAG_RD, BXE_DRIVER_VERSION, 0, "version"); - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version", - CTLFLAG_RD, &sc->devinfo.bc_ver_str, 0, - "bootcode version"); - snprintf(sc->fw_ver_str, sizeof(sc->fw_ver_str), "%d.%d.%d.%d", BCM_5710_FW_MAJOR_VERSION, BCM_5710_FW_MINOR_VERSION, BCM_5710_FW_REVISION_VERSION, BCM_5710_FW_ENGINEERING_VERSION); - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version", - CTLFLAG_RD, &sc->fw_ver_str, 0, - "firmware version"); snprintf(sc->mf_mode_str, sizeof(sc->mf_mode_str), "%s", ((sc->devinfo.mf_info.mf_mode == SINGLE_FUNCTION) ? "Single" : @@ -15739,32 +15746,58 @@ bxe_add_sysctls(struct bxe_softc *sc) (sc->devinfo.mf_info.mf_mode == MULTI_FUNCTION_SI) ? "MF-SI" : (sc->devinfo.mf_info.mf_mode == MULTI_FUNCTION_AFEX) ? "MF-AFEX" : "Unknown")); - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode", - CTLFLAG_RD, &sc->mf_mode_str, 0, - "multifunction mode"); - SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "mf_vnics", CTLFLAG_RD, &sc->devinfo.mf_info.vnics_per_port, 0, "multifunction vnics per port"); - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr", - CTLFLAG_RD, &sc->mac_addr_str, 0, - "mac address"); - snprintf(sc->pci_link_str, sizeof(sc->pci_link_str), "%s x%d", ((sc->devinfo.pcie_link_speed == 1) ? "2.5GT/s" : (sc->devinfo.pcie_link_speed == 2) ? "5.0GT/s" : (sc->devinfo.pcie_link_speed == 4) ? "8.0GT/s" : "???GT/s"), sc->devinfo.pcie_link_width); + + sc->debug = bxe_debug; + +#if __FreeBSD_version >= 900000 + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version", + CTLFLAG_RD, sc->devinfo.bc_ver_str, 0, + "bootcode version"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version", + CTLFLAG_RD, sc->fw_ver_str, 0, + "firmware version"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode", + CTLFLAG_RD, sc->mf_mode_str, 0, + "multifunction mode"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr", + CTLFLAG_RD, sc->mac_addr_str, 0, + "mac address"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "pci_link", + CTLFLAG_RD, &sc->pci_link_str, 0, + "pci link status"); + SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "debug", + CTLFLAG_RW, &sc->debug, 0, + "debug logging mode"); +#else + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version", + CTLFLAG_RD, &sc->devinfo.bc_ver_str, 0, + "bootcode version"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version", + CTLFLAG_RD, &sc->fw_ver_str, 0, + "firmware version"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode", + CTLFLAG_RD, &sc->mf_mode_str, 0, + "multifunction mode"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr", + CTLFLAG_RD, &sc->mac_addr_str, 0, + "mac address"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "pci_link", CTLFLAG_RD, &sc->pci_link_str, 0, "pci link status"); - - sc->debug = bxe_debug; SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "debug", CTLFLAG_RW, &sc->debug, 0, "debug logging mode"); +#endif /* #if __FreeBSD_version >= 900000 */ SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "trigger_grcdump", CTLTYPE_UINT | CTLFLAG_RW, sc, 0, Modified: stable/7/sys/dev/bxe/bxe.h ============================================================================== --- stable/7/sys/dev/bxe/bxe.h Wed Apr 6 21:45:31 2016 (r297624) +++ stable/7/sys/dev/bxe/bxe.h Wed Apr 6 21:59:52 2016 (r297625) @@ -2271,6 +2271,17 @@ void bxe_dump_mem(struct bxe_softc *sc, void bxe_dump_mbuf_data(struct bxe_softc *sc, char *pTag, struct mbuf *m, uint8_t contents); + +#if __FreeBSD_version >= 800000 +#if __FreeBSD_version >= 1000000 +#define BXE_SET_FLOWID(m) M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE) +#define BXE_VALID_FLOWID(m) (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) +#else +#define BXE_VALID_FLOWID(m) ((m->m_flags & M_FLOWID) != 0) +#define BXE_SET_FLOWID(m) m->m_flags |= M_FLOWID +#endif +#endif /* #if __FreeBSD_version >= 800000 */ + /***********/ /* INLINES */ /***********/ From owner-svn-src-all@freebsd.org Wed Apr 6 22:38:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FA31B07613; Wed, 6 Apr 2016 22:38:51 +0000 (UTC) (envelope-from bdrewery@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 mx1.freebsd.org (Postfix) with ESMTPS id 25CFF1679; Wed, 6 Apr 2016 22:38:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36McoLH015121; Wed, 6 Apr 2016 22:38:50 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36McovK015120; Wed, 6 Apr 2016 22:38:50 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201604062238.u36McovK015120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 6 Apr 2016 22:38:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297626 - head/lib/libc/db/hash X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 22:38:51 -0000 Author: bdrewery Date: Wed Apr 6 22:38:50 2016 New Revision: 297626 URL: https://svnweb.freebsd.org/changeset/base/297626 Log: Follow-up r295924: Only sync hash-based db files open for writing when closing. This fixes a major performance regression when reading db files such as the pw database during a 'pkg install'. MFC after: 1 week Tested by: bapt Reviewed by: bapt Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D5868 Modified: head/lib/libc/db/hash/hash.c Modified: head/lib/libc/db/hash/hash.c ============================================================================== --- head/lib/libc/db/hash/hash.c Wed Apr 6 21:59:52 2016 (r297625) +++ head/lib/libc/db/hash/hash.c Wed Apr 6 22:38:50 2016 (r297626) @@ -423,7 +423,8 @@ hdestroy(HTAB *hashp) free(hashp->tmp_buf); if (hashp->fp != -1) { - (void)_fsync(hashp->fp); + if (hashp->save_file) + (void)_fsync(hashp->fp); (void)_close(hashp->fp); } From owner-svn-src-all@freebsd.org Wed Apr 6 22:42:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0ACE6B0779B; Wed, 6 Apr 2016 22:42:34 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (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 959EA1B12; Wed, 6 Apr 2016 22:42:33 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wm0-x242.google.com with SMTP id n3so16930412wmn.1; Wed, 06 Apr 2016 15:42:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=2mQHr9N6UkGJdU/onzzPVesurVB3flRBuQ+iw2kLl64=; b=lSo/BKIVT4TirXuF2EaJs46YoDi7k1LPpuyG09waGdE+GIW6jfNovJ7WM4asBWmi7Q OFDIeMZ3WQr1lAf9K5qe/R6CRVTiG23Di7fA1U/b/YEdaVvgnqxBvWjJr187QFvf4Zx8 qr2ftadtGO/uNyjismrN+B4dM35fzWXhnh73ttrXUrMOEzvrL/cAga70lSCR5IYISkur qFUEY/M30cSwsD9RzMJKSdT88cb+JDI5UJuM/xWvzcdSynw11480v2OAAHDmkllHAe8g BlGkA2OqXAu7IaYd8dsLFD2x27hpqvr+ZkRqc5NLRKG/AW4LTctBPmJUMHum27IaQuow 6Kww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=2mQHr9N6UkGJdU/onzzPVesurVB3flRBuQ+iw2kLl64=; b=GiSD/2HD3c/Dq2vjVM7lBDyOC9IeQBH7gNryOv3dyEB4Aed68g4ocYnaKQCcNvXZaW HwP+PEXgEE8/eqDH8oI/sH0r5UsPFXmxTaaMpQYyiubC4KuA6K19Qrk3qTVpgkr8xypI gPNcikV74M4HtNyIjLb9FVNEkR5QAXx+M76D8a1MU9zkoApLE22IUiXvQQMbtrsW10Yr rb0LGheE327BVD6gE7Guq0v5YjFe2AkaJ72M4dc23soLK9HWWKmikVice/IqjfLkv4X+ nE0/IuC75iHddo0O8ptK4Hz8ULnT+dQ8uZK+qicRwxYAaf+JAvTMZhdYlOVgwantVJgu lQBA== X-Gm-Message-State: AD7BkJKLxygQ4teCb91HeVjvg9/GpqJMeHMVjsqvwuia7cpuW2kC3Uj16bYNddxsPGOjpQ== X-Received: by 10.28.194.67 with SMTP id s64mr17273136wmf.44.1459982552270; Wed, 06 Apr 2016 15:42:32 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id j18sm27213314wmd.2.2016.04.06.15.42.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Apr 2016 15:42:31 -0700 (PDT) Sender: Baptiste Daroussin Date: Thu, 7 Apr 2016 00:42:29 +0200 From: Baptiste Daroussin To: Bryan Drewery Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297626 - head/lib/libc/db/hash Message-ID: <20160406224229.GM49864@ivaldir.etoilebsd.net> References: <201604062238.u36McovK015120@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="aiCxlS1GuupXjEh3" Content-Disposition: inline In-Reply-To: <201604062238.u36McovK015120@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 22:42:34 -0000 --aiCxlS1GuupXjEh3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 06, 2016 at 10:38:50PM +0000, Bryan Drewery wrote: > Author: bdrewery > Date: Wed Apr 6 22:38:50 2016 > New Revision: 297626 > URL: https://svnweb.freebsd.org/changeset/base/297626 >=20 > Log: > Follow-up r295924: Only sync hash-based db files open for writing when = closing. > =20 > This fixes a major performance regression when reading db files such as > the pw database during a 'pkg install'. > =20 FYI that causes pkg installation to be 10 times slower than before! Best regards, Bapt --aiCxlS1GuupXjEh3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXBZDVAAoJEGOJi9zxtz5acusP/iYo8j/Qrbp8rqExSE7xet9s kh6sfZ7eh976iirGxGlMB7PV0dvrrW/lS0BdQhqMMUCDGZw+2n0Zsk+SldLWDd/6 dT2OdTPGJo63ZjhxyPrqPcy7rPl7m1amkst8JcsoDpK0LBgnD1RqhmfL3HQZur92 A/CAmmxLQ+dtKqEVqVdy0gArTjOSAt2A6jWPc48JtaGoCh8+TT6804I65fBJc4YB uPWrFwJbmB9VP52xwFOF5ElVi/Pghq1o9JiN3tWlIEhn1JeblY7qdl1VvSlCaiOD KeOFyuH3FkTdZ5SZHfhzvaiYg9S5bvhUFEmDqxBfkSKO8/5z5PerpqSp7ePelLkG SSF8FyKUiHT6F+zRO3lBllVqF68shyFShkiXKkl+e7oo0R3pw+WqoVahTGzSpMlr dqe72DhotoBcnAHF926iFrvuIrTVssiuTFgWN150AQHXJ6WzOFPe9aJ1nLcYYwGi dRixmHle520hfDa/A3fK9zx63IfbW1npUC6jzA7e/1gFin/0Xo+pgSyNUXLTdBG3 R9jSJ3x0B3hUo1FOnexHu9DMhxo61AQk+DbN4WYkzK4jH8mLeZ2wG5oyAroeeVth imjOPSWXodyjMbVHsFBr5YHVPw3gZK1GBfDZDPrd8wV7YztVpktQHCeBeMhxpk6p VSc6rhCP1LkaVQiYHxHW =AP+O -----END PGP SIGNATURE----- --aiCxlS1GuupXjEh3-- From owner-svn-src-all@freebsd.org Wed Apr 6 22:48:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFBCAB078A5; Wed, 6 Apr 2016 22:48:30 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pa0-x242.google.com (mail-pa0-x242.google.com [IPv6:2607:f8b0:400e:c03::242]) (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 C18221D2D; Wed, 6 Apr 2016 22:48:30 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pa0-x242.google.com with SMTP id q6so5262384pav.0; Wed, 06 Apr 2016 15:48:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=u2CezOTPBEvafe75sEuAvyitykQeEssUQTY6kYQb/Z4=; b=J/xmdmhjt6URlL1Nf7AI7zUaGgdgYLQNfg9uu0r8p4UTGy0LyZfHVu+5U6IaoJQR/x UD2XPkbzWETbBx9gQhA6CG0nfee+UU2ULoy+rCH2T0mUIEStyLXi76Rd0vzgO8AivGmm k5IeWs2CDPh4y2JF2r6yW+v+CRmSFSoKCpgfh5QABsWvx4Bz70vd+KgjBivjPNSKiWdf WLBels+RYWbm7lJkEdo3f0PfzMg0Nsnyzek80W+GPw7oLhJX3R2Z6nw8kj9D4V8rlG8f FRFnLnVsf93w+oujHfVSesjmYoT7hjX3AiIkyJE1xEaoMRAYDUDMFa/fjvkrurWDjCHA OQSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=u2CezOTPBEvafe75sEuAvyitykQeEssUQTY6kYQb/Z4=; b=hztyTPsSeIMjxI8uG7rGyltspZO50e823JAR76xlgGiKf6qHF61syZrvDGb9ZHk9ux OrZskNvyATpfDNqshXMWJM2p3im5dilqD6bW8Ly2QnSD4X5Af34W+Fgj+orXuF8hM+a2 oO+/hJ7dNriV1KieZwf5tHcbUakW7f9hLkQoDmQvYv02azn+f7HY80HUFJ2MFa84l2XN P9EhdlSUwDq/ooNDhi4STlaaumtgJdCrA1ajTlcQ1OdwbJ3/UqRxLkJO8/E9+TErqXTN vGc6qvOVnSVEXOEvOxUZRQtrJqZCJI5M6NNVMlUYT2vJjD+0XVpx9Q+dAnJscIsKEWbH h3Jw== X-Gm-Message-State: AD7BkJLTu006pecYRe+THlefmUWlrimV/2eKVAjxY+zbWfNgnzFmr2wjI8ptswx3dFapWA== X-Received: by 10.66.220.101 with SMTP id pv5mr74427121pac.139.1459982902820; Wed, 06 Apr 2016 15:48:22 -0700 (PDT) Received: from [192.168.100.71] ([199.231.240.59]) by smtp.gmail.com with ESMTPSA id g28sm7230908pfd.25.2016.04.06.15.48.21 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 06 Apr 2016 15:48:21 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: svn commit: r297626 - head/lib/libc/db/hash From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <20160406224229.GM49864@ivaldir.etoilebsd.net> Date: Wed, 6 Apr 2016 15:48:20 -0700 Cc: Bryan Drewery , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201604062238.u36McovK015120@repo.freebsd.org> <20160406224229.GM49864@ivaldir.etoilebsd.net> To: Baptiste Daroussin X-Mailer: Apple Mail (2.2104) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 22:48:31 -0000 > On Apr 6, 2016, at 15:42, Baptiste Daroussin wrote: >=20 > On Wed, Apr 06, 2016 at 10:38:50PM +0000, Bryan Drewery wrote: >> Author: bdrewery >> Date: Wed Apr 6 22:38:50 2016 >> New Revision: 297626 >> URL: https://svnweb.freebsd.org/changeset/base/297626 >>=20 >> Log: >> Follow-up r295924: Only sync hash-based db files open for writing = when closing. >>=20 >> This fixes a major performance regression when reading db files such = as >> the pw database during a 'pkg install'. >>=20 > FYI that causes pkg installation to be 10 times slower than before! Does the before or after case cause it to be 10x slower?= From owner-svn-src-all@freebsd.org Wed Apr 6 22:52:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9518CB07B45; Wed, 6 Apr 2016 22:52:02 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (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 2A0581113; Wed, 6 Apr 2016 22:52:02 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wm0-x242.google.com with SMTP id o129so7467127wmo.3; Wed, 06 Apr 2016 15:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=E4YN1JiJvpn6Z/io9nz+sdhYE7y/yDQDOksx6cKLtws=; b=bK4AsoM8NkD3h6qjH2x2A9icOaRydw7xjjUy3fgLXBJ6uQLUa0HzXXmY0pvadlXXuv b+XK5C5Vii9XAAVdmzzdhWKwOhWO+FPaCQcjFyMoT/9PC6lfPSArGF+w0Py8m+lfQeT/ kQ/mMC8UHiS+vz5PMM/2xVdPpLEgwlNhKJBzbW9Ee9zFYyYIOiwcpKzLW5eYFac534p0 MT5sV0yMnG04VAfJzb/w6eGXA09N92Rudu5c89TzzdmJ2afNgKbjxjK3FQXrTOdqUja4 rXoltWmT7eQ7qVx+qVQ/7/csqaGHAVHa1EA3sjWiYsMqKLzueoTSBAkdTYyAWHrLpX2V 0Itg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=E4YN1JiJvpn6Z/io9nz+sdhYE7y/yDQDOksx6cKLtws=; b=m4ciTTcMeaCR48QIivCz9BZjFUckulW6L+SImSgOjrEDp6X730PsCImRYYgZuu1AOf YPSyfsInrUgHEKylHzImNzpNtuy0XHU6KrlwanQ9n/jY6IP8edQNqtsPfngik1pRW98+ JeRydpkbAQcyA9ZDFBleCV/cSZgQdOTOCrt/uD9VCRpEn8Tfh64ECiP59Mp4/NpKX0t8 SVYM/DmcmRAEHSAw6Uh+soIyBbjdgpOTIPtPVjDMivChugGwFcvtq8L8OCZIv2BqiKaM 5qm9uEx5Vpxj8XH/tNvT8yRNV9WsrEeUbgadV7EAhRhPxhQahD8v6dt5gg1hdRlw0u3w JkdA== X-Gm-Message-State: AD7BkJLVbW+gCgaKrlw4dNsG7JR+E0qB4hOB99UVLbJLlzEb7gLFg9FMLqSQr6Jfs0wfbw== X-Received: by 10.194.61.19 with SMTP id l19mr18629973wjr.4.1459983120860; Wed, 06 Apr 2016 15:52:00 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id d131sm1085507wmd.12.2016.04.06.15.51.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Apr 2016 15:52:00 -0700 (PDT) Sender: Baptiste Daroussin Date: Thu, 7 Apr 2016 00:51:58 +0200 From: Baptiste Daroussin To: "Ngie Cooper (yaneurabeya)" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bryan Drewery Subject: Re: svn commit: r297626 - head/lib/libc/db/hash Message-ID: <20160406225158.GO49864@ivaldir.etoilebsd.net> References: <201604062238.u36McovK015120@repo.freebsd.org> <20160406224229.GM49864@ivaldir.etoilebsd.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6zipuvUKAEymKn2g" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 22:52:02 -0000 --6zipuvUKAEymKn2g Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 06, 2016 at 03:48:20PM -0700, Ngie Cooper (yaneurabeya) wrote: >=20 > > On Apr 6, 2016, at 15:42, Baptiste Daroussin wrote: > >=20 > > On Wed, Apr 06, 2016 at 10:38:50PM +0000, Bryan Drewery wrote: > >> Author: bdrewery > >> Date: Wed Apr 6 22:38:50 2016 > >> New Revision: 297626 > >> URL: https://svnweb.freebsd.org/changeset/base/297626 > >>=20 > >> Log: > >> Follow-up r295924: Only sync hash-based db files open for writing whe= n closing. > >>=20 > >> This fixes a major performance regression when reading db files such = as > >> the pw database during a 'pkg install'. > >>=20 > > FYI that causes pkg installation to be 10 times slower than before! >=20 > Does the before or after case cause it to be 10x slower? before it was 10x slower with that fix it works perfectly fine again :) I see now my mail wasn't clear at all Bapt --6zipuvUKAEymKn2g Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXBZMOAAoJEGOJi9zxtz5atEEQANqjwjmaNaPRcMo9PsiIXTBL yw1QfOu18cRJ2FHitobqnzcXBCSxQ+Vd89Cg2aRGQogEWn6NtY8MB23BaXurWIYF yXuSC6BAYOjovdZHytzViBt5k1wwiUh9AsUrspyjMrhHIaHyePa/BIq+zcZFVKaU tn53eAuNxN9IaJK4j+sNRiRO9pjsa1JNjOJn3v3O66b//Z69emtfxAkgJjl2vsBR 3GZredcIb0dGwup3/BcqyutIw5kgBCoYQq6nAoJi686EjI7w6vQtvXzPNfO0a8jl Hxetl+zWE9HgVq3pDs6GAqH9tajlcuDj1oXAyuIO8vr6bTBAUOLsNdG8rGtHzmyO iYp3sKj/olt99IpQtP/3Cz0Ta7vnPE5D6N3LroC9RpKg3lLhPNIScBkicp9HhOuQ GTLcFnCnhli2/4WMF1fBur78+sjI7xx9Etdf7YuqT+ieCT+6aWatkdh5ZNvyg1PW obOlXAXLjhQs+6G7HxvOyXSxug6PgW8Yz7fDmlI6cycEFoqYjDHiAS87g6AYk0Cq AZ2er7qXgkHkKXGUYZkpgmFqOLIzovPiDkDPAV75ojAwCETLkWzsuxcKYklsIpLM ahb5JvkAhpzUX+S7HtY/0su5jAajmPWMZRcQ0H6bnPaotvX7xBW/OebRT2giopDd mc4BszEtd8jOVBhc3TpD =kg4o -----END PGP SIGNATURE----- --6zipuvUKAEymKn2g-- From owner-svn-src-all@freebsd.org Wed Apr 6 23:11:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DB1FB07F5B; Wed, 6 Apr 2016 23:11:06 +0000 (UTC) (envelope-from jmcneill@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 mx1.freebsd.org (Postfix) with ESMTPS id 9F60818DA; Wed, 6 Apr 2016 23:11:05 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36NB42n024282; Wed, 6 Apr 2016 23:11:04 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36NB43A024272; Wed, 6 Apr 2016 23:11:04 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201604062311.u36NB43A024272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Wed, 6 Apr 2016 23:11:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297627 - in head/sys: arm/allwinner arm/allwinner/a20 arm/allwinner/a31 arm/allwinner/clk arm/conf boot/fdt/dts/arm dev/dwc dev/iicbus/twsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 23:11:06 -0000 Author: jmcneill Date: Wed Apr 6 23:11:03 2016 New Revision: 297627 URL: https://svnweb.freebsd.org/changeset/base/297627 Log: Convert Allwinner port to extres clk/hwreset/regulator APIs. Reviewed by: andrew, gonzo, Emmanuel Vadot Approved by: gonzo (mentor) Differential Revision: https://reviews.freebsd.org/D5752 Added: head/sys/arm/allwinner/aw_ccu.c (contents, props changed) head/sys/arm/allwinner/aw_reset.c (contents, props changed) head/sys/arm/allwinner/clk/ head/sys/arm/allwinner/clk/aw_ahbclk.c (contents, props changed) head/sys/arm/allwinner/clk/aw_apbclk.c (contents, props changed) head/sys/arm/allwinner/clk/aw_axiclk.c (contents, props changed) head/sys/arm/allwinner/clk/aw_codecclk.c (contents, props changed) head/sys/arm/allwinner/clk/aw_cpuclk.c (contents, props changed) head/sys/arm/allwinner/clk/aw_debeclk.c (contents, props changed) head/sys/arm/allwinner/clk/aw_gate.c (contents, props changed) head/sys/arm/allwinner/clk/aw_gmacclk.c (contents, props changed) head/sys/arm/allwinner/clk/aw_hdmiclk.c (contents, props changed) head/sys/arm/allwinner/clk/aw_lcdclk.c (contents, props changed) head/sys/arm/allwinner/clk/aw_mmcclk.c (contents, props changed) head/sys/arm/allwinner/clk/aw_modclk.c (contents, props changed) head/sys/arm/allwinner/clk/aw_oscclk.c (contents, props changed) head/sys/arm/allwinner/clk/aw_pll.c (contents, props changed) head/sys/arm/allwinner/clk/aw_usbclk.c (contents, props changed) Deleted: head/sys/arm/allwinner/a10_clk.c head/sys/arm/allwinner/a10_clk.h head/sys/arm/allwinner/a31/a31_clk.c head/sys/arm/allwinner/a31/a31_clk.h head/sys/boot/fdt/dts/arm/sun4i-a10.dtsi head/sys/boot/fdt/dts/arm/sun7i-a20.dtsi Modified: head/sys/arm/allwinner/a10_ahci.c head/sys/arm/allwinner/a10_codec.c head/sys/arm/allwinner/a10_dmac.c head/sys/arm/allwinner/a10_ehci.c head/sys/arm/allwinner/a10_fb.c head/sys/arm/allwinner/a10_hdmi.c head/sys/arm/allwinner/a10_mmc.c head/sys/arm/allwinner/a20/a20_if_dwc.c head/sys/arm/allwinner/aw_usbphy.c head/sys/arm/allwinner/files.allwinner head/sys/arm/allwinner/if_emac.c head/sys/arm/conf/A10 head/sys/arm/conf/A20 head/sys/boot/fdt/dts/arm/bananapi.dts head/sys/boot/fdt/dts/arm/cubieboard.dts head/sys/boot/fdt/dts/arm/cubieboard2.dts head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts head/sys/boot/fdt/dts/arm/olinuxino-lime.dts head/sys/boot/fdt/dts/arm/sun7i-a20-hdmi.dtsi head/sys/dev/dwc/if_dwc.c head/sys/dev/iicbus/twsi/a10_twsi.c Modified: head/sys/arm/allwinner/a10_ahci.c ============================================================================== --- head/sys/arm/allwinner/a10_ahci.c Wed Apr 6 22:38:50 2016 (r297626) +++ head/sys/arm/allwinner/a10_ahci.c Wed Apr 6 23:11:03 2016 (r297627) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include /* * Allwinner a1x/a2x/a8x SATA attachment. This is just the AHCI register @@ -117,6 +117,8 @@ __FBSDID("$FreeBSD$"); #define AHCI_P0PHYCR 0x0078 #define AHCI_P0PHYSR 0x007C +#define PLL_FREQ 100000000 + static void inline ahci_set(struct resource *m, bus_size_t off, uint32_t set) { @@ -295,8 +297,11 @@ ahci_a10_attach(device_t dev) { int error; struct ahci_controller *ctlr; + clk_t clk_pll, clk_gate; ctlr = device_get_softc(dev); + clk_pll = clk_gate = NULL; + ctlr->quirks = AHCI_Q_NOPMP; ctlr->vendorid = 0; ctlr->deviceid = 0; @@ -307,15 +312,36 @@ ahci_a10_attach(device_t dev) &ctlr->r_rid, RF_ACTIVE))) return (ENXIO); - /* Turn on the PLL for SATA */ - a10_clk_ahci_activate(); - + /* Enable clocks */ + error = clk_get_by_ofw_index(dev, 0, &clk_pll); + if (error != 0) { + device_printf(dev, "Cannot get PLL clock\n"); + goto fail; + } + error = clk_get_by_ofw_index(dev, 1, &clk_gate); + if (error != 0) { + device_printf(dev, "Cannot get gate clock\n"); + goto fail; + } + error = clk_set_freq(clk_pll, PLL_FREQ, CLK_SET_ROUND_DOWN); + if (error != 0) { + device_printf(dev, "Cannot set PLL frequency\n"); + goto fail; + } + error = clk_enable(clk_pll); + if (error != 0) { + device_printf(dev, "Cannot enable PLL\n"); + goto fail; + } + error = clk_enable(clk_gate); + if (error != 0) { + device_printf(dev, "Cannot enable clk gate\n"); + goto fail; + } + /* Reset controller */ - if ((error = ahci_a10_ctlr_reset(dev)) != 0) { - bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, - ctlr->r_mem); - return (error); - }; + if ((error = ahci_a10_ctlr_reset(dev)) != 0) + goto fail; /* * No MSI registers on this platform. @@ -330,6 +356,14 @@ ahci_a10_attach(device_t dev) * Note: ahci_attach will release ctlr->r_mem on errors automatically */ return (ahci_attach(dev)); + +fail: + if (clk_gate != NULL) + clk_release(clk_gate); + if (clk_pll != NULL) + clk_release(clk_pll); + bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem); + return (error); } static int Modified: head/sys/arm/allwinner/a10_codec.c ============================================================================== --- head/sys/arm/allwinner/a10_codec.c Wed Apr 6 22:38:50 2016 (r297626) +++ head/sys/arm/allwinner/a10_codec.c Wed Apr 6 23:11:03 2016 (r297627) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "sunxi_dma_if.h" #include "mixer_if.h" @@ -738,6 +738,7 @@ a10codec_attach(device_t dev) { struct a10codec_info *sc; char status[SND_STATUSLEN]; + clk_t clk_apb, clk_codec; uint32_t val; int error; @@ -778,6 +779,24 @@ a10codec_attach(device_t dev) goto fail; } + /* Get clocks */ + error = clk_get_by_ofw_name(dev, "apb", &clk_apb); + if (error != 0) { + device_printf(dev, "cannot find apb clock\n"); + goto fail; + } + error = clk_get_by_ofw_name(dev, "codec", &clk_codec); + if (error != 0) { + device_printf(dev, "cannot find codec clock\n"); + goto fail; + } + + /* Gating APB clock for codec */ + error = clk_enable(clk_apb); + if (error != 0) { + device_printf(dev, "cannot enable apb clock\n"); + goto fail; + } /* Activate audio codec clock. According to the A10 and A20 user * manuals, Audio_pll can be either 24.576MHz or 22.5792MHz. Most * audio sampling rates require an 24.576MHz input clock with the @@ -787,7 +806,17 @@ a10codec_attach(device_t dev) * 24.576MHz clock source and don't advertise native support for * the three sampling rates that require a 22.5792MHz input. */ - a10_clk_codec_activate(24576000); + error = clk_set_freq(clk_codec, 24576000, CLK_SET_ROUND_DOWN); + if (error != 0) { + device_printf(dev, "cannot set codec clock frequency\n"); + goto fail; + } + /* Enable audio codec clock */ + error = clk_enable(clk_codec); + if (error != 0) { + device_printf(dev, "cannot enable codec clock\n"); + goto fail; + } /* Enable DAC */ val = CODEC_READ(sc, AC_DAC_DPC); Modified: head/sys/arm/allwinner/a10_dmac.c ============================================================================== --- head/sys/arm/allwinner/a10_dmac.c Wed Apr 6 22:38:50 2016 (r297626) +++ head/sys/arm/allwinner/a10_dmac.c Wed Apr 6 23:11:03 2016 (r297627) @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "sunxi_dma_if.h" @@ -111,6 +111,7 @@ a10dmac_attach(device_t dev) { struct a10dmac_softc *sc; unsigned int index; + clk_t clk; int error; sc = device_get_softc(dev); @@ -123,7 +124,16 @@ a10dmac_attach(device_t dev) mtx_init(&sc->sc_mtx, "a10 dmac", NULL, MTX_SPIN); /* Activate DMA controller clock */ - a10_clk_dmac_activate(); + error = clk_get_by_ofw_index(dev, 0, &clk); + if (error != 0) { + device_printf(dev, "cannot get clock\n"); + return (error); + } + error = clk_enable(clk); + if (error != 0) { + device_printf(dev, "cannot enable clock\n"); + return (error); + } /* Disable all interrupts and clear pending status */ DMA_WRITE(sc, AWIN_DMA_IRQ_EN_REG, 0); Modified: head/sys/arm/allwinner/a10_ehci.c ============================================================================== --- head/sys/arm/allwinner/a10_ehci.c Wed Apr 6 22:38:50 2016 (r297626) +++ head/sys/arm/allwinner/a10_ehci.c Wed Apr 6 23:11:03 2016 (r297627) @@ -59,8 +59,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include +#include #define EHCI_HC_DEVSTR "Allwinner Integrated USB 2.0 controller" @@ -90,25 +90,22 @@ static device_detach_t a10_ehci_detach; bs_r_1_proto(reversed); bs_w_1_proto(reversed); +struct aw_ehci_softc { + ehci_softc_t sc; + clk_t clk; + hwreset_t rst; +}; + struct aw_ehci_conf { - int (*clk_activate)(void); - int (*clk_deactivate)(void); bool sdram_init; }; static const struct aw_ehci_conf a10_ehci_conf = { -#if defined(SOC_ALLWINNER_A10) || defined(SOC_ALLWINNER_A20) - .clk_activate = a10_clk_ehci_activate, - .clk_deactivate = a10_clk_ehci_deactivate, -#endif .sdram_init = true, }; static const struct aw_ehci_conf a31_ehci_conf = { -#if defined(SOC_ALLWINNER_A31) || defined(SOC_ALLWINNER_A31S) - .clk_activate = a31_clk_ehci_activate, - .clk_deactivate = a31_clk_ehci_deactivate, -#endif + .sdram_init = false, }; static struct ofw_compat_data compat_data[] = { @@ -136,7 +133,8 @@ a10_ehci_probe(device_t self) static int a10_ehci_attach(device_t self) { - ehci_softc_t *sc = device_get_softc(self); + struct aw_ehci_softc *aw_sc = device_get_softc(self); + ehci_softc_t *sc = &aw_sc->sc; const struct aw_ehci_conf *conf; bus_space_handle_t bsh; int err; @@ -144,10 +142,6 @@ a10_ehci_attach(device_t self) uint32_t reg_value = 0; conf = USB_CONF(self); - if (conf->clk_activate == NULL) { - device_printf(self, "clock not supported\n"); - return (ENXIO); - } /* initialise some bus fields */ sc->sc_bus.parent = self; @@ -208,9 +202,24 @@ a10_ehci_attach(device_t self) sc->sc_flags |= EHCI_SCFLG_DONTRESET; + /* De-assert reset */ + if (hwreset_get_by_ofw_idx(self, 0, &aw_sc->rst) == 0) { + err = hwreset_deassert(aw_sc->rst); + if (err != 0) { + device_printf(self, "Could not de-assert reset\n"); + goto error; + } + } + /* Enable clock for USB */ - if (conf->clk_activate() != 0) { - device_printf(self, "Could not activate clock\n"); + err = clk_get_by_ofw_index(self, 0, &aw_sc->clk); + if (err != 0) { + device_printf(self, "Could not get clock\n"); + goto error; + } + err = clk_enable(aw_sc->clk); + if (err != 0) { + device_printf(self, "Could not enable clock\n"); goto error; } @@ -240,6 +249,8 @@ a10_ehci_attach(device_t self) return (0); error: + if (aw_sc->clk) + clk_release(aw_sc->clk); a10_ehci_detach(self); return (ENXIO); } @@ -247,7 +258,8 @@ error: static int a10_ehci_detach(device_t self) { - ehci_softc_t *sc = device_get_softc(self); + struct aw_ehci_softc *aw_sc = device_get_softc(self); + ehci_softc_t *sc = &aw_sc->sc; const struct aw_ehci_conf *conf; device_t bdev; int err; @@ -305,7 +317,14 @@ a10_ehci_detach(device_t self) A10_WRITE_4(sc, SW_USB_PMU_IRQ_ENABLE, reg_value); /* Disable clock for USB */ - conf->clk_deactivate(); + clk_disable(aw_sc->clk); + clk_release(aw_sc->clk); + + /* Assert reset */ + if (aw_sc->rst != NULL) { + hwreset_assert(aw_sc->rst); + hwreset_release(aw_sc->rst); + } return (0); } Modified: head/sys/arm/allwinner/a10_fb.c ============================================================================== --- head/sys/arm/allwinner/a10_fb.c Wed Apr 6 22:38:50 2016 (r297626) +++ head/sys/arm/allwinner/a10_fb.c Wed Apr 6 23:11:03 2016 (r297627) @@ -54,7 +54,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include +#include #include "fb_if.h" #include "hdmi_if.h" @@ -66,6 +67,7 @@ __FBSDID("$FreeBSD$"); #define FB_ALIGN 0x1000 #define HDMI_ENABLE_DELAY 20000 +#define DEBE_FREQ 300000000 #define DOT_CLOCK_TO_HZ(c) ((c) * 1000) @@ -193,18 +195,68 @@ a10fb_freefb(struct a10fb_softc *sc) kmem_free(kernel_arena, sc->vaddr, sc->fbsize); } -static void +static int a10fb_setup_debe(struct a10fb_softc *sc, const struct videomode *mode) { int width, height, interlace, reg; + clk_t clk_ahb, clk_dram, clk_debe; + hwreset_t rst; uint32_t val; + int error; interlace = !!(mode->flags & VID_INTERLACE); width = mode->hdisplay; height = mode->vdisplay << interlace; - /* Enable DEBE clocks */ - a10_clk_debe_activate(); + /* Leave reset */ + error = hwreset_get_by_ofw_name(sc->dev, "de_be", &rst); + if (error != 0) { + device_printf(sc->dev, "cannot find reset 'de_be'\n"); + return (error); + } + error = hwreset_deassert(rst); + if (error != 0) { + device_printf(sc->dev, "couldn't de-assert reset 'de_be'\n"); + return (error); + } + /* Gating AHB clock for BE */ + error = clk_get_by_ofw_name(sc->dev, "ahb_de_be", &clk_ahb); + if (error != 0) { + device_printf(sc->dev, "cannot find clk 'ahb_de_be'\n"); + return (error); + } + error = clk_enable(clk_ahb); + if (error != 0) { + device_printf(sc->dev, "cannot enable clk 'ahb_de_be'\n"); + return (error); + } + /* Enable DRAM clock to BE */ + error = clk_get_by_ofw_name(sc->dev, "dram_de_be", &clk_dram); + if (error != 0) { + device_printf(sc->dev, "cannot find clk 'dram_de_be'\n"); + return (error); + } + error = clk_enable(clk_dram); + if (error != 0) { + device_printf(sc->dev, "cannot enable clk 'dram_de_be'\n"); + return (error); + } + /* Set BE clock to 300MHz and enable */ + error = clk_get_by_ofw_name(sc->dev, "de_be", &clk_debe); + if (error != 0) { + device_printf(sc->dev, "cannot find clk 'de_be'\n"); + return (error); + } + error = clk_set_freq(clk_debe, DEBE_FREQ, CLK_SET_ROUND_DOWN); + if (error != 0) { + device_printf(sc->dev, "cannot set 'de_be' frequency\n"); + return (error); + } + error = clk_enable(clk_debe); + if (error != 0) { + device_printf(sc->dev, "cannot enable clk 'de_be'\n"); + return (error); + } /* Initialize all registers to 0 */ for (reg = DEBE_REG_START; reg < DEBE_REG_END; reg += DEBE_REG_WIDTH) @@ -247,14 +299,55 @@ a10fb_setup_debe(struct a10fb_softc *sc, val = DEBE_READ(sc, DEBE_MODCTL); val |= MODCTL_START_CTL; DEBE_WRITE(sc, DEBE_MODCTL, val); + + return (0); } -static void +static int +a10fb_setup_pll(struct a10fb_softc *sc, uint64_t freq) +{ + clk_t clk_sclk1, clk_sclk2; + int error; + + error = clk_get_by_ofw_name(sc->dev, "lcd_ch1_sclk1", &clk_sclk1); + if (error != 0) { + device_printf(sc->dev, "cannot find clk 'lcd_ch1_sclk1'\n"); + return (error); + } + error = clk_get_by_ofw_name(sc->dev, "lcd_ch1_sclk2", &clk_sclk2); + if (error != 0) { + device_printf(sc->dev, "cannot find clk 'lcd_ch1_sclk2'\n"); + return (error); + } + + error = clk_set_freq(clk_sclk2, freq, 0); + if (error != 0) { + device_printf(sc->dev, "cannot set lcd ch1 frequency\n"); + return (error); + } + error = clk_enable(clk_sclk2); + if (error != 0) { + device_printf(sc->dev, "cannot enable lcd ch1 sclk2\n"); + return (error); + } + error = clk_enable(clk_sclk1); + if (error != 0) { + device_printf(sc->dev, "cannot enable lcd ch1 sclk1\n"); + return (error); + } + + return (0); +} + +static int a10fb_setup_tcon(struct a10fb_softc *sc, const struct videomode *mode) { u_int interlace, hspw, hbp, vspw, vbp, vbl, width, height, start_delay; u_int vtotal, framerate, clk; + clk_t clk_ahb; + hwreset_t rst; uint32_t val; + int error; interlace = !!(mode->flags & VID_INTERLACE); width = mode->hdisplay; @@ -266,8 +359,28 @@ a10fb_setup_tcon(struct a10fb_softc *sc, vbl = VBLANK_LEN(mode->vtotal, mode->vdisplay, interlace); start_delay = START_DELAY(vbl); - /* Enable LCD clocks */ - a10_clk_lcd_activate(); + /* Leave reset */ + error = hwreset_get_by_ofw_name(sc->dev, "lcd", &rst); + if (error != 0) { + device_printf(sc->dev, "cannot find reset 'lcd'\n"); + return (error); + } + error = hwreset_deassert(rst); + if (error != 0) { + device_printf(sc->dev, "couldn't de-assert reset 'lcd'\n"); + return (error); + } + /* Gating AHB clock for LCD */ + error = clk_get_by_ofw_name(sc->dev, "ahb_lcd", &clk_ahb); + if (error != 0) { + device_printf(sc->dev, "cannot find clk 'ahb_lcd'\n"); + return (error); + } + error = clk_enable(clk_ahb); + if (error != 0) { + device_printf(sc->dev, "cannot enable clk 'ahb_lcd'\n"); + return (error); + } /* Disable TCON and TCON1 */ TCON_WRITE(sc, TCON_GCTL, 0); @@ -322,7 +435,7 @@ a10fb_setup_tcon(struct a10fb_softc *sc, TCON_WRITE(sc, TCON1_CTL, val); /* Setup PLL */ - a10_clk_tcon_activate(DOT_CLOCK_TO_HZ(mode->dot_clock)); + return (a10fb_setup_pll(sc, DOT_CLOCK_TO_HZ(mode->dot_clock))); } static void @@ -378,10 +491,14 @@ a10fb_configure(struct a10fb_softc *sc, } /* Setup display backend */ - a10fb_setup_debe(sc, mode); + error = a10fb_setup_debe(sc, mode); + if (error != 0) + return (error); /* Setup display timing controller */ - a10fb_setup_tcon(sc, mode); + error = a10fb_setup_tcon(sc, mode); + if (error != 0) + return (error); /* Attach framebuffer device */ sc->info.fb_name = device_get_nameunit(sc->dev); Modified: head/sys/arm/allwinner/a10_hdmi.c ============================================================================== --- head/sys/arm/allwinner/a10_hdmi.c Wed Apr 6 22:38:50 2016 (r297626) +++ head/sys/arm/allwinner/a10_hdmi.c Wed Apr 6 23:11:03 2016 (r297627) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "hdmi_if.h" @@ -204,6 +204,7 @@ __FBSDID("$FreeBSD$"); #define HDMI_VSDB_MINLEN 5 #define HDMI_OUI "\x03\x0c\x00" #define HDMI_OUI_LEN 3 +#define HDMI_DEFAULT_FREQ 297000000 struct a10hdmi_softc { struct resource *res; @@ -214,6 +215,10 @@ struct a10hdmi_softc { int has_hdmi; int has_audio; + + clk_t clk_ahb; + clk_t clk_hdmi; + clk_t clk_lcd; }; static struct resource_spec a10hdmi_spec[] = { @@ -287,7 +292,33 @@ a10hdmi_attach(device_t dev) return (ENXIO); } - a10_clk_hdmi_activate(); + /* Setup clocks */ + error = clk_get_by_ofw_name(dev, "ahb", &sc->clk_ahb); + if (error != 0) { + device_printf(dev, "cannot find ahb clock\n"); + return (error); + } + error = clk_get_by_ofw_name(dev, "hdmi", &sc->clk_hdmi); + if (error != 0) { + device_printf(dev, "cannot find hdmi clock\n"); + return (error); + } + error = clk_get_by_ofw_name(dev, "lcd", &sc->clk_lcd); + if (error != 0) { + device_printf(dev, "cannot find lcd clock\n"); + } + /* Enable HDMI clock */ + error = clk_enable(sc->clk_hdmi); + if (error != 0) { + device_printf(dev, "cannot enable hdmi clock\n"); + return (error); + } + /* Gating AHB clock for HDMI */ + error = clk_enable(sc->clk_ahb); + if (error != 0) { + device_printf(dev, "cannot enable ahb gate\n"); + return (error); + } a10hdmi_init(sc); @@ -527,6 +558,38 @@ a10hdmi_set_audiomode(device_t dev, cons } static int +a10hdmi_get_tcon_config(struct a10hdmi_softc *sc, int *div, int *dbl) +{ + uint64_t lcd_fin, lcd_fout; + clk_t clk_lcd_parent; + const char *pname; + int error; + + error = clk_get_parent(sc->clk_lcd, &clk_lcd_parent); + if (error != 0) + return (error); + + /* Get the LCD CH1 special clock 2 divider */ + error = clk_get_freq(sc->clk_lcd, &lcd_fout); + if (error != 0) + return (error); + error = clk_get_freq(clk_lcd_parent, &lcd_fin); + if (error != 0) + return (error); + *div = lcd_fin / lcd_fout; + + /* Detect LCD CH1 special clock using a 1X or 2X source */ + /* XXX */ + pname = clk_get_name(clk_lcd_parent); + if (strcmp(pname, "pll3-1x") == 0 || strcmp(pname, "pll7-1x") == 0) + *dbl = 0; + else + *dbl = 1; + + return (0); +} + +static int a10hdmi_set_videomode(device_t dev, const struct videomode *mode) { struct a10hdmi_softc *sc; @@ -543,9 +606,11 @@ a10hdmi_set_videomode(device_t dev, cons vspw = mode->vsync_end - mode->vsync_start; vbp = mode->vtotal - mode->vsync_start; - error = a10_clk_tcon_get_config(&clk_div, &clk_dbl); - if (error != 0) + error = a10hdmi_get_tcon_config(sc, &clk_div, &clk_dbl); + if (error != 0) { + device_printf(dev, "couldn't get tcon config: %d\n", error); return (error); + } /* Clear interrupt status */ HDMI_WRITE(sc, HDMI_INT_STATUS, HDMI_READ(sc, HDMI_INT_STATUS)); Modified: head/sys/arm/allwinner/a10_mmc.c ============================================================================== --- head/sys/arm/allwinner/a10_mmc.c Wed Apr 6 22:38:50 2016 (r297626) +++ head/sys/arm/allwinner/a10_mmc.c Wed Apr 6 23:11:03 2016 (r297627) @@ -49,9 +49,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include -#include +#include +#include #define A10_MMC_MEMRES 0 #define A10_MMC_IRQRES 1 @@ -60,6 +60,8 @@ __FBSDID("$FreeBSD$"); #define A10_MMC_DMA_MAX_SIZE 0x2000 #define A10_MMC_DMA_FTRGLEVEL 0x20070008 +#define CARD_ID_FREQUENCY 400000 + static int a10_mmc_pio_mode = 0; TUNABLE_INT("hw.a10.mmc.pio_mode", &a10_mmc_pio_mode); @@ -74,6 +76,9 @@ struct a10_mmc_softc { bus_space_handle_t a10_bsh; bus_space_tag_t a10_bst; device_t a10_dev; + clk_t a10_clk_ahb; + clk_t a10_clk_mmc; + hwreset_t a10_rst_ahb; int a10_bus_busy; int a10_id; int a10_resid; @@ -147,7 +152,7 @@ a10_mmc_attach(device_t dev) struct a10_mmc_softc *sc; struct sysctl_ctx_list *ctx; struct sysctl_oid_list *tree; - int clk; + int error; sc = device_get_softc(dev); sc->a10_dev = dev; @@ -170,6 +175,9 @@ a10_mmc_attach(device_t dev) device_printf(dev, "cannot setup interrupt handler\n"); return (ENXIO); } + mtx_init(&sc->a10_mtx, device_get_nameunit(sc->a10_dev), "a10_mmc", + MTX_DEF); + callout_init_mtx(&sc->a10_timeoutc, &sc->a10_mtx, 0); /* * Later chips use a different FIFO offset. Unfortunately the FDT @@ -186,30 +194,41 @@ a10_mmc_attach(device_t dev) break; } + /* De-assert reset */ + if (hwreset_get_by_ofw_name(dev, "ahb", &sc->a10_rst_ahb) == 0) { + error = hwreset_deassert(sc->a10_rst_ahb); + if (error != 0) { + device_printf(dev, "cannot de-assert reset\n"); + return (error); + } + } + /* Activate the module clock. */ - switch (allwinner_soc_type()) { -#if defined(SOC_ALLWINNER_A10) || defined(SOC_ALLWINNER_A20) - case ALLWINNERSOC_A10: - case ALLWINNERSOC_A10S: - case ALLWINNERSOC_A20: - clk = a10_clk_mmc_activate(sc->a10_id); - break; -#endif -#if defined(SOC_ALLWINNER_A31) || defined(SOC_ALLWINNER_A31S) - case ALLWINNERSOC_A31: - case ALLWINNERSOC_A31S: - clk = a31_clk_mmc_activate(sc->a10_id); - break; -#endif - default: - clk = -1; + error = clk_get_by_ofw_name(dev, "ahb", &sc->a10_clk_ahb); + if (error != 0) { + device_printf(dev, "cannot get ahb clock\n"); + goto fail; } - if (clk != 0) { - bus_teardown_intr(dev, sc->a10_res[A10_MMC_IRQRES], - sc->a10_intrhand); - bus_release_resources(dev, a10_mmc_res_spec, sc->a10_res); - device_printf(dev, "cannot activate mmc clock\n"); - return (ENXIO); + error = clk_enable(sc->a10_clk_ahb); + if (error != 0) { + device_printf(dev, "cannot enable ahb clock\n"); + goto fail; + } + error = clk_get_by_ofw_name(dev, "mmc", &sc->a10_clk_mmc); + if (error != 0) { + device_printf(dev, "cannot get mmc clock\n"); + goto fail; + } + error = clk_set_freq(sc->a10_clk_mmc, CARD_ID_FREQUENCY, + CLK_SET_ROUND_DOWN); + if (error != 0) { + device_printf(dev, "cannot init mmc clock\n"); + goto fail; + } + error = clk_enable(sc->a10_clk_mmc); + if (error != 0) { + device_printf(dev, "cannot enable mmc clock\n"); + goto fail; } sc->a10_timeout = 10; @@ -217,9 +236,6 @@ a10_mmc_attach(device_t dev) tree = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "req_timeout", CTLFLAG_RW, &sc->a10_timeout, 0, "Request timeout in seconds"); - mtx_init(&sc->a10_mtx, device_get_nameunit(sc->a10_dev), "a10_mmc", - MTX_DEF); - callout_init_mtx(&sc->a10_timeoutc, &sc->a10_mtx, 0); /* Reset controller. */ if (a10_mmc_reset(sc) != 0) { @@ -826,25 +842,14 @@ a10_mmc_update_ios(device_t bus, device_ return (error); /* Set the MMC clock. */ - switch (allwinner_soc_type()) { -#if defined(SOC_ALLWINNER_A10) || defined(SOC_ALLWINNER_A20) - case ALLWINNERSOC_A10: - case ALLWINNERSOC_A10S: - case ALLWINNERSOC_A20: - error = a10_clk_mmc_cfg(sc->a10_id, ios->clock); - break; -#endif -#if defined(SOC_ALLWINNER_A31) || defined(SOC_ALLWINNER_A31S) - case ALLWINNERSOC_A31: - case ALLWINNERSOC_A31S: - error = a31_clk_mmc_cfg(sc->a10_id, ios->clock); - break; -#endif - default: - error = ENXIO; - } - if (error != 0) + error = clk_set_freq(sc->a10_clk_mmc, ios->clock, + CLK_SET_ROUND_DOWN); + if (error != 0) { + device_printf(sc->a10_dev, + "failed to set frequency to %u Hz: %d\n", + ios->clock, error); return (error); + } /* Enable clock. */ clkcr |= A10_MMC_CARD_CLK_ON; Modified: head/sys/arm/allwinner/a20/a20_if_dwc.c ============================================================================== --- head/sys/arm/allwinner/a20/a20_if_dwc.c Wed Apr 6 22:38:50 2016 (r297626) +++ head/sys/arm/allwinner/a20/a20_if_dwc.c Wed Apr 6 23:11:03 2016 (r297627) @@ -41,8 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include #include "if_dwc_if.h" @@ -62,29 +61,39 @@ a20_if_dwc_probe(device_t dev) static int a20_if_dwc_init(device_t dev) { - int clk; - - /* Activate GMAC clock and set the pin mux to rgmii. */ - switch (allwinner_soc_type()) { -#if defined(SOC_ALLWINNER_A10) || defined(SOC_ALLWINNER_A20) - case ALLWINNERSOC_A10: - case ALLWINNERSOC_A10S: - case ALLWINNERSOC_A20: - clk = a10_clk_gmac_activate(ofw_bus_get_node(dev)); - break; -#endif -#if defined(SOC_ALLWINNER_A31) || defined(SOC_ALLWINNER_A31S) - case ALLWINNERSOC_A31: - case ALLWINNERSOC_A31S: - clk = a31_clk_gmac_activate(ofw_bus_get_node(dev)); - break; -#endif - default: - clk = -1; - } - if (clk != 0) { - device_printf(dev, "could not activate gmac module\n"); - return (ENXIO); + const char *tx_parent_name; + char *phy_type; + clk_t clk_tx, clk_tx_parent; + phandle_t node; + int error; + + node = ofw_bus_get_node(dev); + + /* Configure PHY for MII or RGMII mode */ + if (OF_getprop_alloc(node, "phy-mode", 1, (void **)&phy_type)) { + error = clk_get_by_ofw_name(dev, "allwinner_gmac_tx", &clk_tx); + if (error != 0) { + device_printf(dev, "could not get tx clk\n"); + return (error); + } + + if (strcmp(phy_type, "rgmii") == 0) + tx_parent_name = "gmac_int_tx"; + else + tx_parent_name = "mii_phy_tx"; + + error = clk_get_by_name(dev, tx_parent_name, &clk_tx_parent); + if (error != 0) { + device_printf(dev, "could not get clock '%s'\n", + tx_parent_name); + return (error); + } + + error = clk_set_parent_by_clk(clk_tx, clk_tx_parent); + if (error != 0) { + device_printf(dev, "could not set tx clk parent\n"); + return (error); + } } return (0); Added: head/sys/arm/allwinner/aw_ccu.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/aw_ccu.c Wed Apr 6 23:11:03 2016 (r297627) @@ -0,0 +1,224 @@ +/*- + * Copyright (c) 2016 Jared McNeill + * 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 ``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. + * + * $FreeBSD$ + */ + +/* + * Allwinner oscillator clock + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#include "clkdev_if.h" + +#define CCU_BASE 0x01c20000 +#define CCU_SIZE 0x400 + +struct aw_ccu_softc { + struct simplebus_softc sc; + bus_space_tag_t bst; + bus_space_handle_t bsh; + struct mtx mtx; +}; + +static struct ofw_compat_data compat_data[] = { + { "allwinner,sun4i-a10", 1 }, + { "allwinner,sun7i-a20", 1 }, + { "allwinner,sun6i-a31", 1 }, + { "allwinner,sun6i-a31s", 1 }, + { NULL, 0 } +}; + +static int +aw_ccu_check_addr(bus_addr_t addr) +{ + if (addr < CCU_BASE || addr >= (CCU_BASE + CCU_SIZE)) + return (EINVAL); + return (0); +} + +static int +aw_ccu_write_4(device_t dev, bus_addr_t addr, uint32_t val) +{ + struct aw_ccu_softc *sc; + + if (aw_ccu_check_addr(addr) != 0) + return (EINVAL); + + sc = device_get_softc(dev); + mtx_assert(&sc->mtx, MA_OWNED); + bus_space_write_4(sc->bst, sc->bsh, addr - CCU_BASE, val); + + return (0); +} + +static int +aw_ccu_read_4(device_t dev, bus_addr_t addr, uint32_t *val) +{ + struct aw_ccu_softc *sc; + + if (aw_ccu_check_addr(addr) != 0) + return (EINVAL); + + sc = device_get_softc(dev); + mtx_assert(&sc->mtx, MA_OWNED); + *val = bus_space_read_4(sc->bst, sc->bsh, addr - CCU_BASE); + + return (0); +} + +static int +aw_ccu_modify_4(device_t dev, bus_addr_t addr, uint32_t clr, uint32_t set) +{ + struct aw_ccu_softc *sc; + uint32_t val; + + if (aw_ccu_check_addr(addr) != 0) + return (EINVAL); + + sc = device_get_softc(dev); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Apr 6 23:17:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A305B0309E; Wed, 6 Apr 2016 23:17:06 +0000 (UTC) (envelope-from glebius@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 mx1.freebsd.org (Postfix) with ESMTPS id 2735B1C52; Wed, 6 Apr 2016 23:17:06 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36NH5cP027118; Wed, 6 Apr 2016 23:17:05 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36NH5cK027117; Wed, 6 Apr 2016 23:17:05 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201604062317.u36NH5cK027117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 6 Apr 2016 23:17:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297628 - head/tools/tools/nanobsd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 23:17:06 -0000 Author: glebius Date: Wed Apr 6 23:17:05 2016 New Revision: 297628 URL: https://svnweb.freebsd.org/changeset/base/297628 Log: Add optional configuration knob NANO_CUST_FILES_MTREE. If set, it will require an entry in custom mtree definition for every custom installed file. Obtained from: Netflix Modified: head/tools/tools/nanobsd/defaults.sh Modified: head/tools/tools/nanobsd/defaults.sh ============================================================================== --- head/tools/tools/nanobsd/defaults.sh Wed Apr 6 23:11:03 2016 (r297627) +++ head/tools/tools/nanobsd/defaults.sh Wed Apr 6 23:17:05 2016 (r297628) @@ -52,6 +52,11 @@ NANO_PACKAGE_LIST="*" # where package metadata gets placed NANO_PKG_META_BASE=/var/db +# Path to mtree file to apply to anything copied by cust_install_files(). +# If you specify this, the mtree file *must* have an entry for every file and +# directory located in Files. +#NANO_CUST_FILES_MTREE="" + # Object tree directory # default is subdir of /usr/obj #NANO_OBJ="" @@ -909,6 +914,10 @@ cust_allow_ssh_root ( ) ( cust_install_files ( ) ( cd "${NANO_TOOLS}/Files" find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)' | cpio -Ldumpv ${NANO_WORLDDIR} + + if [ -f ${NANO_CUST_FILES_MTREE} ]; then + CR "mtree -eiU -p /" <${NANO_CUST_FILES_MTREE} + fi ) ####################################################################### From owner-svn-src-all@freebsd.org Wed Apr 6 23:21:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E52E6B032D5; Wed, 6 Apr 2016 23:21:45 +0000 (UTC) (envelope-from allanjude@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 mx1.freebsd.org (Postfix) with ESMTPS id C0C161F96; Wed, 6 Apr 2016 23:21:45 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u36NLijZ029450; Wed, 6 Apr 2016 23:21:44 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u36NLisl029446; Wed, 6 Apr 2016 23:21:44 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201604062321.u36NLisl029446@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Wed, 6 Apr 2016 23:21:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297629 - in head/sys/boot: geli i386/libi386 i386/zfsboot X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 23:21:46 -0000 Author: allanjude Date: Wed Apr 6 23:21:44 2016 New Revision: 297629 URL: https://svnweb.freebsd.org/changeset/base/297629 Log: Fix GELIBoot support for GELI sector size is > 512 Add support for 4k sector GELI encrypted partitions to the bootloader This is the default created by the installer Because the IV is different for each sector, and the XTS tweak carries forward you can not decrypt a partial sector if the starting offset is not 0 Make boot2 and the loader read in 4k aligned chunks Reviewed by: ed, oshogbo Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D5820 Modified: head/sys/boot/geli/geliboot.c head/sys/boot/geli/geliboot.h head/sys/boot/i386/libi386/biosdisk.c head/sys/boot/i386/zfsboot/zfsboot.c Modified: head/sys/boot/geli/geliboot.c ============================================================================== --- head/sys/boot/geli/geliboot.c Wed Apr 6 23:17:05 2016 (r297628) +++ head/sys/boot/geli/geliboot.c Wed Apr 6 23:21:44 2016 (r297629) @@ -73,30 +73,34 @@ geli_taste(int read_func(void *vdev, voi size_t bytes), struct dsk *dskp, daddr_t lastsector) { struct g_eli_metadata md; - u_char buf[DEV_BSIZE]; + u_char buf[DEV_GELIBOOT_BSIZE]; int error; + off_t alignsector; - error = read_func(NULL, dskp, (off_t) lastsector * DEV_BSIZE, &buf, - (size_t) DEV_BSIZE); + alignsector = (lastsector * DEV_BSIZE) & + ~(off_t)(DEV_GELIBOOT_BSIZE - 1); + error = read_func(NULL, dskp, alignsector, &buf, DEV_GELIBOOT_BSIZE); if (error != 0) { return (error); } - error = eli_metadata_decode(buf, &md); + /* Extract the last DEV_BSIZE bytes from the block. */ + error = eli_metadata_decode(buf + (DEV_GELIBOOT_BSIZE - DEV_BSIZE), + &md); if (error != 0) { return (error); } if ((md.md_flags & G_ELI_FLAG_ONETIME)) { - /* Swap device, skip it */ + /* Swap device, skip it. */ return (1); } if (!(md.md_flags & G_ELI_FLAG_BOOT)) { - /* Disk is not GELI boot device, skip it */ + /* Disk is not GELI boot device, skip it. */ return (1); } if (md.md_iterations < 0) { - /* XXX TODO: Support loading key files */ - /* Disk does not have a passphrase, skip it */ + /* XXX TODO: Support loading key files. */ + /* Disk does not have a passphrase, skip it. */ return (1); } geli_e = malloc(sizeof(struct geli_entry)); @@ -143,7 +147,7 @@ geli_attach(struct dsk *dskp, const char * Prepare Derived-Key from the user passphrase. */ if (geli_e->md.md_iterations < 0) { - /* XXX TODO: Support loading key files */ + /* XXX TODO: Support loading key files. */ return (1); } else if (geli_e->md.md_iterations == 0) { g_eli_crypto_hmac_update(&ctx, geli_e->md.md_salt, @@ -151,8 +155,8 @@ geli_attach(struct dsk *dskp, const char g_eli_crypto_hmac_update(&ctx, passphrase, strlen(passphrase)); } else if (geli_e->md.md_iterations > 0) { - printf("Calculating GELI Decryption Key disk%dp%d @ %lu " - "iterations...\n", dskp->unit, + printf("Calculating GELI Decryption Key disk%dp%d @ %lu" + " iterations...\n", dskp->unit, (dskp->slice > 0 ? dskp->slice : dskp->part), geli_e->md.md_iterations); u_char dkey[G_ELI_USERKEYLEN]; @@ -193,7 +197,7 @@ geli_attach(struct dsk *dskp, const char } bzero(&mkey, sizeof(mkey)); - /* Initialize the per-sector IV */ + /* Initialize the per-sector IV. */ switch (geli_e->sc.sc_ealgo) { case CRYPTO_AES_XTS: break; @@ -207,7 +211,7 @@ geli_attach(struct dsk *dskp, const char return (0); } - /* Disk not found */ + /* Disk not found. */ return (2); } @@ -229,35 +233,49 @@ geli_read(struct dsk *dskp, off_t offset u_char iv[G_ELI_IVKEYLEN]; u_char *pbuf; int error; - off_t os; + off_t dstoff; uint64_t keyno; - size_t n, nb; + size_t n, nsec, secsize; struct g_eli_key gkey; + pbuf = buf; SLIST_FOREACH_SAFE(geli_e, &geli_head, entries, geli_e_tmp) { if (geli_same_device(geli_e, dskp) != 0) { continue; } - nb = bytes / DEV_BSIZE; - for (n = 0; n < nb; n++) { - os = offset + (n * DEV_BSIZE); - pbuf = buf + (n * DEV_BSIZE); + secsize = geli_e->sc.sc_sectorsize; + nsec = bytes / secsize; + if (nsec == 0) { + /* + * A read of less than the GELI sector size has been + * requested. The caller provided destination buffer may + * not be big enough to boost the read to a full sector, + * so just attempt to decrypt the truncated sector. + */ + secsize = bytes; + nsec = 1; + } + + for (n = 0, dstoff = offset; n < nsec; n++, dstoff += secsize) { - g_eli_crypto_ivgen(&geli_e->sc, os, iv, G_ELI_IVKEYLEN); + g_eli_crypto_ivgen(&geli_e->sc, dstoff, iv, + G_ELI_IVKEYLEN); - /* Get the key that corresponds to this offset */ - keyno = (os >> G_ELI_KEY_SHIFT) / DEV_BSIZE; + /* Get the key that corresponds to this offset. */ + keyno = (dstoff >> G_ELI_KEY_SHIFT) / secsize; g_eli_key_fill(&geli_e->sc, &gkey, keyno); error = geliboot_crypt(geli_e->sc.sc_ealgo, 0, pbuf, - DEV_BSIZE, gkey.gek_key, geli_e->sc.sc_ekeylen, iv); + secsize, gkey.gek_key, + geli_e->sc.sc_ekeylen, iv); if (error != 0) { bzero(&gkey, sizeof(gkey)); printf("Failed to decrypt in geli_read()!"); return (error); } + pbuf += secsize; } bzero(&gkey, sizeof(gkey)); return (0); Modified: head/sys/boot/geli/geliboot.h ============================================================================== --- head/sys/boot/geli/geliboot.h Wed Apr 6 23:17:05 2016 (r297628) +++ head/sys/boot/geli/geliboot.h Wed Apr 6 23:21:44 2016 (r297629) @@ -55,6 +55,9 @@ #ifndef DEV_BSIZE #define DEV_BSIZE 512 #endif +#ifndef DEV_GELIBOOT_BSIZE +#define DEV_GELIBOOT_BSIZE 4096 +#endif #ifndef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) Modified: head/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- head/sys/boot/i386/libi386/biosdisk.c Wed Apr 6 23:17:05 2016 (r297628) +++ head/sys/boot/i386/libi386/biosdisk.c Wed Apr 6 23:21:44 2016 (r297629) @@ -706,15 +706,38 @@ bd_read(struct disk_devdesc *dev, daddr_ { #ifdef LOADER_GELI_SUPPORT struct dsk dskp; - off_t p_off; - int err, n; + off_t p_off, diff; + daddr_t alignlba; + int err, n, alignblks; + char *tmpbuf; /* if we already know there is no GELI, skip the rest */ if (geli_status[dev->d_unit][dev->d_slice] != ISGELI_YES) return (bd_io(dev, dblk, blks, dest, 0)); if (geli_status[dev->d_unit][dev->d_slice] == ISGELI_YES) { - err = bd_io(dev, dblk, blks, dest, 0); + /* + * Align reads to DEV_GELIBOOT_BSIZE bytes because partial + * sectors cannot be decrypted. Round the requested LBA down to + * nearest multiple of DEV_GELIBOOT_BSIZE bytes. + */ + alignlba = dblk & + ~(daddr_t)((DEV_GELIBOOT_BSIZE / BIOSDISK_SECSIZE) - 1); + /* + * Round number of blocks to read up to nearest multiple of + * DEV_GELIBOOT_BSIZE + */ + alignblks = blks + (dblk - alignlba) + + ((DEV_GELIBOOT_BSIZE / BIOSDISK_SECSIZE) - 1) & + ~(int)((DEV_GELIBOOT_BSIZE / BIOSDISK_SECSIZE) - 1); + diff = (dblk - alignlba) * BIOSDISK_SECSIZE; + /* + * Use a temporary buffer here because the buffer provided by + * the caller may be too small. + */ + tmpbuf = alloca(alignblks * BIOSDISK_SECSIZE); + + err = bd_io(dev, alignlba, alignblks, tmpbuf, 0); if (err) return (err); @@ -726,13 +749,14 @@ bd_read(struct disk_devdesc *dev, daddr_ dskp.start = dev->d_offset; /* GELI needs the offset relative to the partition start */ - p_off = dblk - dskp.start; + p_off = alignlba - dskp.start; - err = geli_read(&dskp, p_off * BIOSDISK_SECSIZE, dest, - blks * BIOSDISK_SECSIZE); + err = geli_read(&dskp, p_off * BIOSDISK_SECSIZE, tmpbuf, + alignblks * BIOSDISK_SECSIZE); if (err) return (err); + bcopy(tmpbuf + diff, dest, blks * BIOSDISK_SECSIZE); return (0); } #endif /* LOADER_GELI_SUPPORT */ Modified: head/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- head/sys/boot/i386/zfsboot/zfsboot.c Wed Apr 6 23:17:05 2016 (r297628) +++ head/sys/boot/i386/zfsboot/zfsboot.c Wed Apr 6 23:21:44 2016 (r297629) @@ -46,18 +46,20 @@ __FBSDID("$FreeBSD$"); #include "libzfs.h" -#define ARGS 0x900 -#define NOPT 14 -#define NDEV 3 - -#define BIOS_NUMDRIVES 0x475 -#define DRV_HARD 0x80 -#define DRV_MASK 0x7f - -#define TYPE_AD 0 -#define TYPE_DA 1 -#define TYPE_MAXHARD TYPE_DA -#define TYPE_FD 2 +#define ARGS 0x900 +#define NOPT 14 +#define NDEV 3 + +#define BIOS_NUMDRIVES 0x475 +#define DRV_HARD 0x80 +#define DRV_MASK 0x7f + +#define TYPE_AD 0 +#define TYPE_DA 1 +#define TYPE_MAXHARD TYPE_DA +#define TYPE_FD 2 + +#define DEV_GELIBOOT_BSIZE 4096 extern uint32_t _end; @@ -104,13 +106,13 @@ static struct bios_smap smap; /* * The minimum amount of memory to reserve in bios_extmem for the heap. */ -#define HEAP_MIN (3 * 1024 * 1024) +#define HEAP_MIN (3 * 1024 * 1024) static char *heap_next; static char *heap_end; /* Buffers that must not span a 64k boundary. */ -#define READ_BUF_SIZE 8192 +#define READ_BUF_SIZE 8192 struct dmadat { char rdbuf[READ_BUF_SIZE]; /* for reading large things */ char secbuf[READ_BUF_SIZE]; /* for MBR/disklabel */ @@ -198,8 +200,9 @@ static int vdev_read(vdev_t *vdev, void *priv, off_t off, void *buf, size_t bytes) { char *p; - daddr_t lba; - unsigned int nb; + daddr_t lba, alignlba; + off_t alignoff, diff; + unsigned int nb, alignnb; struct dsk *dsk = (struct dsk *) priv; if ((off & (DEV_BSIZE - 1)) || (bytes & (DEV_BSIZE - 1))) @@ -208,24 +211,52 @@ vdev_read(vdev_t *vdev, void *priv, off_ p = buf; lba = off / DEV_BSIZE; lba += dsk->start; + /* Align reads to 4k else 4k sector GELIs will not decrypt. */ + alignoff = off & ~ (off_t)(DEV_GELIBOOT_BSIZE - 1); + /* Round LBA down to nearest multiple of DEV_GELIBOOT_BSIZE bytes. */ + alignlba = alignoff / DEV_BSIZE; + /* + * The read must be aligned to DEV_GELIBOOT_BSIZE bytes relative to the + * start of the GELI partition, not the start of the actual disk. + */ + alignlba += dsk->start; + diff = (lba - alignlba) * DEV_BSIZE; + while (bytes > 0) { nb = bytes / DEV_BSIZE; if (nb > READ_BUF_SIZE / DEV_BSIZE) nb = READ_BUF_SIZE / DEV_BSIZE; - if (drvread(dsk, dmadat->rdbuf, lba, nb)) + /* + * Ensure that the read size plus the leading offset does not + * exceed the size of the read buffer. + */ + if (nb * DEV_BSIZE + diff > READ_BUF_SIZE) + nb -= diff / DEV_BSIZE; + /* + * Round the number of blocks to read up to the nearest multiple + * of DEV_GELIBOOT_BSIZE. + */ + alignnb = nb + (diff / DEV_BSIZE) + + (DEV_GELIBOOT_BSIZE / DEV_BSIZE - 1) & ~ + (unsigned int)(DEV_GELIBOOT_BSIZE / DEV_BSIZE - 1); + + if (drvread(dsk, dmadat->rdbuf, alignlba, alignnb)) return -1; #ifdef LOADER_GELI_SUPPORT /* decrypt */ if (is_geli(dsk) == 0) { - if (geli_read(dsk, ((lba - dsk->start) * DEV_BSIZE), - dmadat->rdbuf, nb * DEV_BSIZE)) - return (-1); + if (geli_read(dsk, ((alignlba - dsk->start) * + DEV_BSIZE), dmadat->rdbuf, alignnb * DEV_BSIZE)) + return (-1); } #endif - memcpy(p, dmadat->rdbuf, nb * DEV_BSIZE); + memcpy(p, dmadat->rdbuf + diff, nb * DEV_BSIZE); p += nb * DEV_BSIZE; lba += nb; + alignlba += alignnb; bytes -= nb * DEV_BSIZE; + /* Don't need the leading offset after the first block. */ + diff = 0; } return 0; From owner-svn-src-all@freebsd.org Wed Apr 6 23:28:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CA5EB033D5 for ; Wed, 6 Apr 2016 23:28:45 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (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 EBCC111E3 for ; Wed, 6 Apr 2016 23:28:44 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-wm0-x22d.google.com with SMTP id n3so82476841wmn.0 for ; Wed, 06 Apr 2016 16:28:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=Q5ALUOxeGtHw9laQAtnQL4hHBK2t+tV5ugMXeATd2Zg=; b=MdDgLy6yV/oh094xxEBkYJs5Xcvg4mmxuRPbpdtxGqEU1Rb9H9dk4i807K7AmeNGBr CQdXXthRy/QuceGljtw6vvqjw0u1Dr2GjDdVPzMfOEHLVcsp8Q7rPt9hC3WNI438G2Xc +X/7LlBxl6oRTeh8mh/EwMRY8OcKNTEvr0eBBA3AWGIMEuNwXAQulD9dg1ZvQnx+eDm6 SibhSRcH9VvlU8MvlRjtGLoYzIpl6V+CzqMB2wj3lG89hKK2LKuotrAFzIJbUI3mAyIQ cQVg0xTxCStIONa7LxCpbKJyYip1OTTozhN8zkgijgXa7EuO4LkxiLH3lEFvCrP1w6Gk Vheg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=Q5ALUOxeGtHw9laQAtnQL4hHBK2t+tV5ugMXeATd2Zg=; b=DAoM1t/l+Y3KiXf/M9fFE1KMi0AJHK7XHnIiRzXCvTd9KAE05bpcoomac4DFuhGseh TxCVghdWcm92BttduJ3devkgdsNe4FWl4GL3MN2UkICOxRoQuMyT4m/ypHBud/+6Ta9+ nE3PUj/cwi+/qoy6dLEUsHpy8+6KBuwmdEQ4/fxH5iobxKiwDuC2tk9A7VPEfErAyaP5 yHJgoryWJhDxxk/AlW0ipTrP8WBBc3an5LSe+2ro3RjwB03OluYUaVmG5XZb0/T+rEp3 0rHHUeqJVxMra6nksCKuzJeGAhTU2SfBtS3GXomkZZS1DvjwGm4iwPHarM86bfUa4adD m0QQ== X-Gm-Message-State: AD7BkJIeFoKdZmzlSfwsA7NFhaoc3ASTGSgg+gFLIo4sYT8NabUy5qlHg6rZXOyCm1tgXQ3uYP2z+rAvM9pd0s+C MIME-Version: 1.0 X-Received: by 10.28.3.138 with SMTP id 132mr426772wmd.20.1459985323552; Wed, 06 Apr 2016 16:28:43 -0700 (PDT) Received: by 10.194.243.98 with HTTP; Wed, 6 Apr 2016 16:28:43 -0700 (PDT) In-Reply-To: <201604062321.u36NLisl029446@repo.freebsd.org> References: <201604062321.u36NLisl029446@repo.freebsd.org> Date: Thu, 7 Apr 2016 01:28:43 +0200 Message-ID: Subject: Re: svn commit: r297629 - in head/sys/boot: geli i386/libi386 i386/zfsboot From: Oliver Pinter To: Allan Jude Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2016 23:28:45 -0000 On Thursday, April 7, 2016, Allan Jude wrote: > Author: allanjude > Date: Wed Apr 6 23:21:44 2016 > New Revision: 297629 > URL: https://svnweb.freebsd.org/changeset/base/297629 > > Log: > Fix GELIBoot support for GELI sector size is > 512 > > Add support for 4k sector GELI encrypted partitions to the bootloader > This is the default created by the installer > > Because the IV is different for each sector, and the XTS tweak carries > forward you can not decrypt a partial sector if the starting offset is not 0 > > Make boot2 and the loader read in 4k aligned chunks > > Reviewed by: ed, oshogbo > Sponsored by: ScaleEngine Inc. > Differential Revision: https://reviews.freebsd.org/D5820 > > Modified: > head/sys/boot/geli/geliboot.c > head/sys/boot/geli/geliboot.h > head/sys/boot/i386/libi386/biosdisk.c > head/sys/boot/i386/zfsboot/zfsboot.c Hi Allan! Are you plan to MFC this commit to 10-stable? > > Modified: head/sys/boot/geli/geliboot.c > > ============================================================================== > - > > ... > __________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org > " > From owner-svn-src-all@freebsd.org Thu Apr 7 00:37:48 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55940B01DAB; Thu, 7 Apr 2016 00:37:48 +0000 (UTC) (envelope-from jhibbits@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 mx1.freebsd.org (Postfix) with ESMTPS id F3B831C3E; Thu, 7 Apr 2016 00:37:47 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u370bl7C050827; Thu, 7 Apr 2016 00:37:47 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u370blhd050825; Thu, 7 Apr 2016 00:37:47 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201604070037.u370blhd050825@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 7 Apr 2016 00:37:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297630 - stable/10/sys/powerpc/powerpc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 00:37:48 -0000 Author: jhibbits Date: Thu Apr 7 00:37:46 2016 New Revision: 297630 URL: https://svnweb.freebsd.org/changeset/base/297630 Log: MFC r295186 Align signal stack pointer to 16 bytes. The stack must be aligned to 16 bytes at all times. Clang 3.8 is especially adamant about this, and causes strange behavior and segmentation faults if it is not the case. PR: kern/206810 Modified: stable/10/sys/powerpc/powerpc/exec_machdep.c stable/10/sys/powerpc/powerpc/sigcode32.S Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/powerpc/powerpc/exec_machdep.c ============================================================================== --- stable/10/sys/powerpc/powerpc/exec_machdep.c Wed Apr 6 23:21:44 2016 (r297629) +++ stable/10/sys/powerpc/powerpc/exec_machdep.c Thu Apr 7 00:37:46 2016 (r297630) @@ -224,10 +224,10 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, */ if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && SIGISMEMBER(psp->ps_sigonstack, sig)) { - usfp = (void *)(td->td_sigstk.ss_sp + - td->td_sigstk.ss_size - rndfsize); + usfp = (void *)(((uintptr_t)td->td_sigstk.ss_sp + + td->td_sigstk.ss_size - rndfsize) & ~0xFul); } else { - usfp = (void *)(tf->fixreg[1] - rndfsize); + usfp = (void *)((tf->fixreg[1] - rndfsize) & ~0xFul); } /* Modified: stable/10/sys/powerpc/powerpc/sigcode32.S ============================================================================== --- stable/10/sys/powerpc/powerpc/sigcode32.S Wed Apr 6 23:21:44 2016 (r297629) +++ stable/10/sys/powerpc/powerpc/sigcode32.S Thu Apr 7 00:37:46 2016 (r297630) @@ -45,9 +45,9 @@ */ .globl CNAME(sigcode32),CNAME(szsigcode32) CNAME(sigcode32): - addi 1,1,-20 /* reserved space for callee */ + addi 1,1,-32 /* reserved space for callee */ blrl - addi 3,1,20+SF_UC /* restore sp, and get &frame->sf_uc */ + addi 3,1,32+SF_UC /* restore sp, and get &frame->sf_uc */ li 0,SYS_sigreturn sc /* sigreturn(scp) */ li 0,SYS_exit From owner-svn-src-all@freebsd.org Thu Apr 7 01:18:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BFDDB06A2E; Thu, 7 Apr 2016 01:18:42 +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 mx1.freebsd.org (Postfix) with ESMTPS id 6E3E91D01; Thu, 7 Apr 2016 01:18:42 +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 u371IfZB062894; Thu, 7 Apr 2016 01:18:41 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u371Ifmg062893; Thu, 7 Apr 2016 01:18:41 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201604070118.u371Ifmg062893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 7 Apr 2016 01:18:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r297631 - svnadmin/conf X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 01:18:42 -0000 Author: gonzo Date: Thu Apr 7 01:18:41 2016 New Revision: 297631 URL: https://svnweb.freebsd.org/changeset/base/297631 Log: Release Jared McNeill (jmcneill) from mentorship Approved by: adrian (co-mentor) Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Thu Apr 7 00:37:46 2016 (r297630) +++ svnadmin/conf/mentors Thu Apr 7 01:18:41 2016 (r297631) @@ -19,7 +19,6 @@ cherry gibbs eri gnn Co-mentor: thompsa jceel trasz jkh rwatson -jmcneill gonzo Co-mentor: adrian jonathan rwatson jwd rmacklem kadesai ken Co-mentor: scottl, ambrisko From owner-svn-src-all@freebsd.org Thu Apr 7 01:42:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B97EB06086; Thu, 7 Apr 2016 01:42:11 +0000 (UTC) (envelope-from cy@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 mx1.freebsd.org (Postfix) with ESMTPS id DA7CF171C; Thu, 7 Apr 2016 01:42:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u371gANH072348; Thu, 7 Apr 2016 01:42:10 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u371g9KE072344; Thu, 7 Apr 2016 01:42:09 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201604070142.u371g9KE072344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 7 Apr 2016 01:42:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297632 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 01:42:11 -0000 Author: cy Date: Thu Apr 7 01:42:09 2016 New Revision: 297632 URL: https://svnweb.freebsd.org/changeset/base/297632 Log: Add DTrace probes for packets flagged as bad by ipfilter. All probes for bad packets are named ipf_fi_bad_*. An example of its use might be: dtrace -n 'sdt:::ipf_fi_bad_* { stack(); }' Reviewed by: Darren Reed Modified: head/sys/contrib/ipfilter/netinet/fil.c head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c head/sys/contrib/ipfilter/netinet/ip_frag.c head/sys/contrib/ipfilter/netinet/ip_state.c Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Thu Apr 7 01:18:41 2016 (r297631) +++ head/sys/contrib/ipfilter/netinet/fil.c Thu Apr 7 01:42:09 2016 (r297632) @@ -629,6 +629,7 @@ ipf_pr_ipv6hdr(fin) ipf_main_softc_t *softc = fin->fin_main_soft; fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_ipv6_frag_1, fr_info_t *, fin, int, go); LBUMPD(ipf_stats[fin->fin_out], fr_v6_badfrag); LBUMP(ipf_stats[fin->fin_out].fr_v6_bad); } @@ -687,6 +688,7 @@ ipf_pr_ipv6exthdr(fin, multiple, proto) if (shift > fin->fin_dlen) { /* Nasty extension header length? */ fin->fin_flx |= FI_BAD; + DT3(ipf_fi_bad_pr_ipv6exthdr_len, fr_info_t *, fin, u_short, shift, u_short, fin->fin_dlen); LBUMPD(ipf_stats[fin->fin_out], fr_v6_ext_hlen); return NULL; } @@ -708,9 +710,10 @@ ipf_pr_ipv6exthdr(fin, multiple, proto) * Most IPv6 extension headers are only allowed once. */ if ((multiple == 0) && - ((fin->fin_optmsk & ip6exthdr[i].ol_bit) != 0)) + ((fin->fin_optmsk & ip6exthdr[i].ol_bit) != 0)) { fin->fin_flx |= FI_BAD; - else + DT2(ipf_fi_bad_ipv6exthdr_once, fr_info_t *, fin, u_int, (fin->fin_optmsk & ip6exthdr[i].ol_bit)); + } else fin->fin_optmsk |= ip6exthdr[i].ol_bit; break; } @@ -790,6 +793,7 @@ ipf_pr_routing6(fin) ipf_main_softc_t *softc = fin->fin_main_soft; fin->fin_flx |= FI_BAD; + DT1(ipf_fi_bad_routing6, fr_info_t *, fin); LBUMPD(ipf_stats[fin->fin_out], fr_v6_rh_bad); return IPPROTO_NONE; } @@ -852,8 +856,10 @@ ipf_pr_fragment6(fin) * Any fragment that isn't the last fragment must have its * length as a multiple of 8. */ - if ((fin->fin_plen & 7) != 0) + if ((fin->fin_plen & 7) != 0) { fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_frag_not_8, fr_info_t *, fin, u_int, (fin->fin_plen & 7)); + } } fin->fin_fraghdr = frag; @@ -865,8 +871,10 @@ ipf_pr_fragment6(fin) /* * Jumbograms aren't handled, so the max. length is 64k */ - if ((fin->fin_off << 3) + fin->fin_dlen > 65535) + if ((fin->fin_off << 3) + fin->fin_dlen > 65535) { fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_jumbogram, fr_info_t *, fin, u_int, ((fin->fin_off << 3) + fin->fin_dlen)); + } /* * We don't know where the transport layer header (or whatever is next @@ -970,8 +978,10 @@ ipf_pr_icmp6(fin) icmp6 = fin->fin_dp; ip6 = (ip6_t *)((char *)icmp6 + ICMPERR_ICMPHLEN); if (IP6_NEQ(&fin->fin_fi.fi_dst, - (i6addr_t *)&ip6->ip6_src)) + (i6addr_t *)&ip6->ip6_src)) { fin->fin_flx |= FI_BAD; + DT1(ipf_fi_bad_icmp6, fr_info_t *, fin); + } break; default : break; @@ -1283,8 +1293,10 @@ ipf_pr_icmp(fin) case ICMP_UNREACH : #ifdef icmp_nextmtu if (icmp->icmp_code == ICMP_UNREACH_NEEDFRAG) { - if (icmp->icmp_nextmtu < softc->ipf_icmpminfragmtu) + if (icmp->icmp_nextmtu < softc->ipf_icmpminfragmtu) { fin->fin_flx |= FI_BAD; + DT3(ipf_fi_bad_icmp_nextmtu, fr_info_t *, fin, u_int, icmp->icmp_nextmtu, u_int, softc->ipf_icmpminfragmtu); + } } #endif case ICMP_SOURCEQUENCH : @@ -1303,16 +1315,20 @@ ipf_pr_icmp(fin) * fragment. */ oip = (ip_t *)((char *)fin->fin_dp + ICMPERR_ICMPHLEN); - if ((ntohs(oip->ip_off) & IP_OFFMASK) != 0) + if ((ntohs(oip->ip_off) & IP_OFFMASK) != 0) { fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_icmp_err, fr_info_t, fin, u_int, (ntohs(oip->ip_off) & IP_OFFMASK)); + } /* * If the destination of this packet doesn't match the * source of the original packet then this packet is * not correct. */ - if (oip->ip_src.s_addr != fin->fin_daddr) + if (oip->ip_src.s_addr != fin->fin_daddr) { fin->fin_flx |= FI_BAD; + DT1(ipf_fi_bad_src_ne_dst, fr_info_t *, fin); + } break; default : break; @@ -1372,6 +1388,7 @@ ipf_pr_tcpcommon(fin) if (tlen < sizeof(tcphdr_t)) { LBUMPD(ipf_stats[fin->fin_out], fr_tcp_small); fin->fin_flx |= FI_BAD; + DT3(ipf_fi_bad_tlen, fr_info_t, fin, u_int, tlen, u_int, sizeof(tcphdr_t)); return 1; } @@ -1385,6 +1402,7 @@ ipf_pr_tcpcommon(fin) */ if ((flags & TH_URG) != 0 && (tcp->th_urp == 0)) { fin->fin_flx |= FI_BAD; + DT3(ipf_fi_bad_th_urg, fr_info_t*, fin, u_int, (flags & TH_URG), u_int, tcp->th_urp); #if 0 } else if ((flags & TH_URG) == 0 && (tcp->th_urp != 0)) { /* @@ -1392,11 +1410,13 @@ ipf_pr_tcpcommon(fin) * traffic with bogus values in the urgent pointer field. */ fin->fin_flx |= FI_BAD; + DT3(ipf_fi_bad_th_urg0, fr_info_t *, fin, u_int, (flags & TH_URG), u_int, tcp->th_urp); #endif } else if (((flags & (TH_SYN|TH_FIN)) != 0) && ((flags & (TH_RST|TH_ACK)) == TH_RST)) { /* TH_FIN|TH_RST|TH_ACK seems to appear "naturally" */ fin->fin_flx |= FI_BAD; + DT1(ipf_fi_bad_th_fin_rst_ack, fr_info_t, fin); #if 1 } else if (((flags & TH_SYN) != 0) && ((flags & (TH_URG|TH_PUSH)) != 0)) { @@ -1405,6 +1425,7 @@ ipf_pr_tcpcommon(fin) * possible(?) with T/TCP...but who uses T/TCP? */ fin->fin_flx |= FI_BAD; + DT1(ipf_fi_bad_th_syn_urg_psh, fr_info_t *, fin); #endif } else if (!(flags & TH_ACK)) { /* @@ -1423,10 +1444,13 @@ ipf_pr_tcpcommon(fin) * achieved. */ /*fin->fin_flx |= FI_BAD*/; + /*DT1(ipf_fi_bad_th_syn_ack, fr_info_t *, fin);*/ } else if (!(flags & (TH_RST|TH_SYN))) { fin->fin_flx |= FI_BAD; + DT1(ipf_fi_bad_th_rst_syn, fr_info_t *, fin); } else if ((flags & (TH_URG|TH_PUSH|TH_FIN)) != 0) { fin->fin_flx |= FI_BAD; + DT1(ipf_fi_bad_th_urg_push_fin, fr_info_t *, fin); } } if (fin->fin_flx & FI_BAD) { @@ -1757,6 +1781,7 @@ ipf_pr_ipv4hdr(fin) * must be an even multiple of 8. */ fi->fi_flx |= FI_BAD; + DT1(ipf_fi_bad_fragbody_gt_65535, fr_info_t *, fin); } } } @@ -1840,6 +1865,7 @@ ipf_pr_ipv4hdr(fin) case IPOPT_SECURITY : if (optmsk & op->ol_bit) { fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_ipopt_security, fr_info_t *, fin, u_short, (optmsk & op->ol_bit)); } else { doi = ipf_checkripso(s); secmsk = doi >> 16; @@ -1851,6 +1877,7 @@ ipf_pr_ipv4hdr(fin) if (optmsk & op->ol_bit) { fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_ipopt_cipso, fr_info_t *, fin, u_short, (optmsk & op->ol_bit)); } else { doi = ipf_checkcipso(fin, s, ol); @@ -1949,6 +1976,7 @@ ipf_checkcipso(fin, s, ol) if (ol < 6 || ol > 40) { LBUMPD(ipf_stats[fin->fin_out], fr_v4_cipso_bad); fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_checkcipso_ol, fr_info_t *, fin, u_int, ol); return 0; } @@ -1966,6 +1994,7 @@ ipf_checkcipso(fin, s, ol) if (tlen > len || tlen < 4 || tlen > 34) { LBUMPD(ipf_stats[fin->fin_out], fr_v4_cipso_tlen); fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_checkcipso_tlen, fr_info_t *, fin, u_int, tlen); return 0; } @@ -1976,10 +2005,12 @@ ipf_checkcipso(fin, s, ol) */ if (tag == 0) { fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_checkcipso_tag, fr_info_t *, fin, u_int, tag); continue; } else if (tag == 1) { if (*(t + 2) != 0) { fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_checkcipso_tag1_t2, fr_info_t *, fin, u_int, (*t + 2)); continue; } sensitivity = *(t + 3); @@ -1988,6 +2019,7 @@ ipf_checkcipso(fin, s, ol) } else if (tag == 4) { if (*(t + 2) != 0) { fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_checkcipso_tag4_t2, fr_info_t *, fin, u_int, (*t + 2)); continue; } sensitivity = *(t + 3); @@ -1996,6 +2028,7 @@ ipf_checkcipso(fin, s, ol) } else if (tag == 5) { if (*(t + 2) != 0) { fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_checkcipso_tag5_t2, fr_info_t *, fin, u_int, (*t + 2)); continue; } sensitivity = *(t + 3); @@ -2006,6 +2039,7 @@ ipf_checkcipso(fin, s, ol) ; } else { fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_checkcipso_tag127, fr_info_t *, fin, u_int, tag); continue; } Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Apr 7 01:18:41 2016 (r297631) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Apr 7 01:42:09 2016 (r297632) @@ -1091,6 +1091,7 @@ ipf_checkv4sum(fin) CSUM_IP_CHECKED) { fin->fin_cksum = FI_CK_BAD; fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_checkv4sum_csum_ip_checked, fr_info_t *, fin, u_int, m->m_pkthdr.csum_flags & (CSUM_IP_CHECKED|CSUM_IP_VALID)); return -1; } if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) { @@ -1120,6 +1121,7 @@ ipf_checkv4sum(fin) if (sum != 0) { fin->fin_cksum = FI_CK_BAD; fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_checkv4sum_sum, fr_info_t *, fin, u_int, sum); } else { fin->fin_cksum = FI_CK_SUMOK; return 0; @@ -1143,12 +1145,14 @@ skipauto: if (manual != 0) { if (ipf_checkl4sum(fin) == -1) { fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_checkv4sum_manual, fr_info_t *, fin, u_int, manual); return -1; } } #else if (ipf_checkl4sum(fin) == -1) { fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_checkv4sum_checkl4sum, fr_info_t *, fin, u_int, -1); return -1; } #endif @@ -1162,16 +1166,20 @@ ipf_checkv6sum(fin) fr_info_t *fin; { if ((fin->fin_flx & FI_NOCKSUM) != 0) + DT(ipf_checkv6sum_fi_nocksum); return 0; if ((fin->fin_flx & FI_SHORT) != 0) + DT(ipf_checkv6sum_fi_short); return 1; if (fin->fin_cksum != FI_CK_NEEDED) + DT(ipf_checkv6sum_fi_ck_needed); return (fin->fin_cksum > FI_CK_NEEDED) ? 0 : -1; if (ipf_checkl4sum(fin) == -1) { fin->fin_flx |= FI_BAD; + DT2(ipf_fi_bad_checkv6sum_checkl4sum, fr_info_t *, fin, u_int, -1); return -1; } return 0; Modified: head/sys/contrib/ipfilter/netinet/ip_frag.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_frag.c Thu Apr 7 01:18:41 2016 (r297631) +++ head/sys/contrib/ipfilter/netinet/ip_frag.c Thu Apr 7 01:42:09 2016 (r297632) @@ -719,6 +719,8 @@ ipf_frag_lookup(softc, softf, fin, table FBUMP(ifs_overlap); DT2(ifs_overlap, u_short, off, ipfr_t *, f); + DT3(ipf_fi_bad_ifs_overlap, fr_info_t *, fin, u_short, off, + ipfr_t *, f); fin->fin_flx |= FI_BAD; break; } @@ -901,6 +903,7 @@ ipf_frag_known(fin, passp) if (fin->fin_flx & FI_BAD) { fr = &ipfr_block; fin->fin_reason = FRB_BADFRAG; + DT2(ipf_frb_badfrag, fr_info_t *, fin, uint, fra); } else { fr = fra->ipfr_rule; } Modified: head/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_state.c Thu Apr 7 01:18:41 2016 (r297631) +++ head/sys/contrib/ipfilter/netinet/ip_state.c Thu Apr 7 01:42:09 2016 (r297632) @@ -1611,8 +1611,10 @@ ipf_state_add(softc, fin, stsave, flags) TH_SYN && (TCP_OFF(tcp) > (sizeof(tcphdr_t) >> 2))) { if (ipf_tcpoptions(softs, fin, tcp, - &is->is_tcp.ts_data[0]) == -1) + &is->is_tcp.ts_data[0]) == -1) { fin->fin_flx |= FI_BAD; + DT1(ipf_fi_bad_tcpoptions_th_fin_ack_ecnall, fr_info_t *, fin); + } } if ((fin->fin_out != 0) && (pass & FR_NEWISN) != 0) { @@ -2068,8 +2070,10 @@ ipf_state_tcp(softc, softs, fin, tcp, is is->is_s0[!source] = ntohl(tcp->th_seq) + 1; if ((TCP_OFF(tcp) > (sizeof(tcphdr_t) >> 2))) { if (ipf_tcpoptions(softs, fin, tcp, - fdata) == -1) + fdata) == -1) { fin->fin_flx |= FI_BAD; + DT1(ipf_fi_bad_winscale_syn_ack, fr_info_t *, fin); + } } if ((fin->fin_out != 0) && (is->is_pass & FR_NEWISN)) ipf_checknewisn(fin, is); @@ -2077,8 +2081,10 @@ ipf_state_tcp(softc, softs, fin, tcp, is is->is_s0[source] = ntohl(tcp->th_seq) + 1; if ((TCP_OFF(tcp) > (sizeof(tcphdr_t) >> 2))) { if (ipf_tcpoptions(softs, fin, tcp, - fdata) == -1) + fdata) == -1) { fin->fin_flx |= FI_BAD; + DT1(ipf_fi_bad_winscale_syn, fr_info_t *, fin); + } } if ((fin->fin_out != 0) && (is->is_pass & FR_NEWISN)) From owner-svn-src-all@freebsd.org Thu Apr 7 04:23:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77485B06F41; Thu, 7 Apr 2016 04:23:28 +0000 (UTC) (envelope-from trasz@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 mx1.freebsd.org (Postfix) with ESMTPS id 429381C97; Thu, 7 Apr 2016 04:23:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u374NRXW021132; Thu, 7 Apr 2016 04:23:27 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u374NP0Z021115; Thu, 7 Apr 2016 04:23:25 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201604070423.u374NP0Z021115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 7 Apr 2016 04:23:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297633 - in head: sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/fs/ext2fs sys/kern sys/sys sys/ufs/ffs sys/ufs/ufs sys/vm usr.bin/rctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 04:23:28 -0000 Author: trasz Date: Thu Apr 7 04:23:25 2016 New Revision: 297633 URL: https://svnweb.freebsd.org/changeset/base/297633 Log: Add four new RCTL resources - readbps, readiops, writebps and writeiops, for limiting disk (actually filesystem) IO. Note that in some cases these limits are not quite precise. It's ok, as long as it's within some reasonable bounds. Testing - and review of the code, in particular the VFS and VM parts - is very welcome. MFC after: 1 month Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5080 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/fs/ext2fs/ext2_bmap.c head/sys/kern/kern_physio.c head/sys/kern/kern_racct.c head/sys/kern/kern_rctl.c head/sys/kern/subr_trap.c head/sys/kern/vfs_bio.c head/sys/kern/vfs_cluster.c head/sys/sys/proc.h head/sys/sys/racct.h head/sys/sys/rctl.h head/sys/ufs/ffs/ffs_inode.c head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ufs/ufs_bmap.c head/sys/vm/vm_fault.c head/usr.bin/rctl/rctl.8 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Apr 7 01:42:09 2016 (r297632) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Apr 7 04:23:25 2016 (r297633) @@ -132,6 +132,7 @@ #include #ifdef _KERNEL #include +#include #endif #include #include @@ -4503,6 +4504,14 @@ top: demand, prefetch, !HDR_ISTYPE_METADATA(hdr), data, metadata, misses); #ifdef _KERNEL +#ifdef RACCT + if (racct_enable) { + PROC_LOCK(curproc); + racct_add_force(curproc, RACCT_READBPS, size); + racct_add_force(curproc, RACCT_READIOPS, 1); + PROC_UNLOCK(curproc); + } +#endif /* RACCT */ curthread->td_ru.ru_inblock++; #endif Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Apr 7 01:42:09 2016 (r297632) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Apr 7 04:23:25 2016 (r297633) @@ -47,6 +47,7 @@ #include #include #ifdef _KERNEL +#include #include #include #endif @@ -427,6 +428,15 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, } dbp = kmem_zalloc(sizeof (dmu_buf_t *) * nblks, KM_SLEEP); +#if defined(_KERNEL) && defined(RACCT) + if (racct_enable && !read) { + PROC_LOCK(curproc); + racct_add_force(curproc, RACCT_WRITEBPS, length); + racct_add_force(curproc, RACCT_WRITEIOPS, nblks); + PROC_UNLOCK(curproc); + } +#endif + zio = zio_root(dn->dn_objset->os_spa, NULL, NULL, ZIO_FLAG_CANFAIL); blkid = dbuf_whichblock(dn, 0, offset); for (i = 0; i < nblks; i++) { @@ -1422,7 +1432,15 @@ dmu_assign_arcbuf(dmu_buf_t *handle, uin DBUF_GET_BUFC_TYPE(db) == ARC_BUFC_DATA) { #ifdef _KERNEL curthread->td_ru.ru_oublock++; -#endif +#ifdef RACCT + if (racct_enable) { + PROC_LOCK(curproc); + racct_add_force(curproc, RACCT_WRITEBPS, blksz); + racct_add_force(curproc, RACCT_WRITEIOPS, 1); + PROC_UNLOCK(curproc); + } +#endif /* RACCT */ +#endif /* _KERNEL */ dbuf_assign_arcbuf(db, buf, tx); dbuf_rele(db, FTAG); } else { Modified: head/sys/fs/ext2fs/ext2_bmap.c ============================================================================== --- head/sys/fs/ext2fs/ext2_bmap.c Thu Apr 7 01:42:09 2016 (r297632) +++ head/sys/fs/ext2fs/ext2_bmap.c Thu Apr 7 04:23:25 2016 (r297633) @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -247,6 +248,13 @@ ext2_bmaparray(struct vnode *vp, daddr_t vfs_busy_pages(bp, 0); bp->b_iooffset = dbtob(bp->b_blkno); bstrategy(bp); +#ifdef RACCT + if (racct_enable) { + PROC_LOCK(curproc); + racct_add_buf(curproc, bp, 0); + PROC_UNLOCK(curproc); + } +#endif curthread->td_ru.ru_inblock++; error = bufwait(bp); if (error) { Modified: head/sys/kern/kern_physio.c ============================================================================== --- head/sys/kern/kern_physio.c Thu Apr 7 01:42:09 2016 (r297632) +++ head/sys/kern/kern_physio.c Thu Apr 7 04:23:25 2016 (r297633) @@ -27,6 +27,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -109,6 +110,22 @@ physio(struct cdev *dev, struct uio *uio prot |= VM_PROT_WRITE; /* Less backwards than it looks */ error = 0; for (i = 0; i < uio->uio_iovcnt; i++) { +#ifdef RACCT + if (racct_enable) { + PROC_LOCK(curproc); + if (uio->uio_rw == UIO_READ) { + racct_add_force(curproc, RACCT_READBPS, + uio->uio_iov[i].iov_len); + racct_add_force(curproc, RACCT_READIOPS, 1); + } else { + racct_add_force(curproc, RACCT_WRITEBPS, + uio->uio_iov[i].iov_len); + racct_add_force(curproc, RACCT_WRITEIOPS, 1); + } + PROC_UNLOCK(curproc); + } +#endif /* RACCT */ + while (uio->uio_iov[i].iov_len) { g_reset_bio(bp); if (uio->uio_rw == UIO_READ) { Modified: head/sys/kern/kern_racct.c ============================================================================== --- head/sys/kern/kern_racct.c Thu Apr 7 01:42:09 2016 (r297632) +++ head/sys/kern/kern_racct.c Thu Apr 7 04:23:25 2016 (r297633) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include "opt_sched.h" #include +#include #include #include #include @@ -177,7 +178,15 @@ int racct_types[] = { [RACCT_WALLCLOCK] = RACCT_IN_MILLIONS, [RACCT_PCTCPU] = - RACCT_DECAYING | RACCT_DENIABLE | RACCT_IN_MILLIONS }; + RACCT_DECAYING | RACCT_DENIABLE | RACCT_IN_MILLIONS, + [RACCT_READBPS] = + RACCT_DECAYING, + [RACCT_WRITEBPS] = + RACCT_DECAYING, + [RACCT_READIOPS] = + RACCT_DECAYING, + [RACCT_WRITEIOPS] = + RACCT_DECAYING }; static const fixpt_t RACCT_DECAY_FACTOR = 0.3 * FSCALE; @@ -634,6 +643,28 @@ racct_add_cred(struct ucred *cred, int r RACCT_UNLOCK(); } +/* + * Account for disk IO resource consumption. Checks for limits, + * but never fails, due to disk limits being undeniable. + */ +void +racct_add_buf(struct proc *p, const struct buf *bp, int is_write) +{ + + ASSERT_RACCT_ENABLED(); + PROC_LOCK_ASSERT(p, MA_OWNED); + + RACCT_LOCK(); + if (is_write) { + racct_add_locked(curproc, RACCT_WRITEBPS, bp->b_bcount, 1); + racct_add_locked(curproc, RACCT_WRITEIOPS, 1, 1); + } else { + racct_add_locked(curproc, RACCT_READBPS, bp->b_bcount, 1); + racct_add_locked(curproc, RACCT_READIOPS, 1, 1); + } + RACCT_UNLOCK(); +} + static int racct_set_locked(struct proc *p, int resource, uint64_t amount, int force) { @@ -655,7 +686,7 @@ racct_set_locked(struct proc *p, int res * The diffs may be negative. */ diff_proc = amount - old_amount; - if (RACCT_IS_DECAYING(resource)) { + if (resource == RACCT_PCTCPU) { /* * Resources in per-credential racct containers may decay. * If this is the case, we need to calculate the difference @@ -1043,14 +1074,19 @@ racct_move(struct racct *dest, struct ra RACCT_UNLOCK(); } -static void -racct_proc_throttle(struct proc *p) +/* + * Make the process sleep in userret() for 'timeout' ticks. Setting + * timeout to -1 makes it sleep until woken up by racct_proc_wakeup(). + */ +void +racct_proc_throttle(struct proc *p, int timeout) { struct thread *td; #ifdef SMP int cpuid; #endif + KASSERT(timeout != 0, ("timeout %d", timeout)); ASSERT_RACCT_ENABLED(); PROC_LOCK_ASSERT(p, MA_OWNED); @@ -1058,10 +1094,13 @@ racct_proc_throttle(struct proc *p) * Do not block kernel processes. Also do not block processes with * low %cpu utilization to improve interactivity. */ - if (((p->p_flag & (P_SYSTEM | P_KPROC)) != 0) || - (p->p_racct->r_resources[RACCT_PCTCPU] <= pcpu_threshold)) + if ((p->p_flag & (P_SYSTEM | P_KPROC)) != 0) return; - p->p_throttled = 1; + + if (p->p_throttled < 0 || (timeout > 0 && p->p_throttled > timeout)) + return; + + p->p_throttled = timeout; FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); @@ -1102,7 +1141,7 @@ racct_proc_wakeup(struct proc *p) PROC_LOCK_ASSERT(p, MA_OWNED); - if (p->p_throttled) { + if (p->p_throttled != 0) { p->p_throttled = 0; wakeup(p->p_racct); } @@ -1116,6 +1155,13 @@ racct_decay_callback(struct racct *racct ASSERT_RACCT_ENABLED(); RACCT_LOCK_ASSERT(); +#ifdef RCTL + rctl_throttle_decay(racct, RACCT_READBPS); + rctl_throttle_decay(racct, RACCT_WRITEBPS); + rctl_throttle_decay(racct, RACCT_READIOPS); + rctl_throttle_decay(racct, RACCT_WRITEIOPS); +#endif + r_old = racct->r_resources[RACCT_PCTCPU]; /* If there is nothing to decay, just exit. */ @@ -1206,6 +1252,12 @@ racctd(void) pct_estimate = 0; pct = racct_getpcpu(p, pct_estimate); RACCT_LOCK(); +#ifdef RCTL + rctl_throttle_decay(p->p_racct, RACCT_READBPS); + rctl_throttle_decay(p->p_racct, RACCT_WRITEBPS); + rctl_throttle_decay(p->p_racct, RACCT_READIOPS); + rctl_throttle_decay(p->p_racct, RACCT_WRITEIOPS); +#endif racct_set_locked(p, RACCT_PCTCPU, pct, 1); racct_set_locked(p, RACCT_CPU, runtime, 0); racct_set_locked(p, RACCT_WALLCLOCK, @@ -1228,10 +1280,13 @@ racctd(void) continue; } - if (racct_pcpu_available(p) <= 0) - racct_proc_throttle(p); - else if (p->p_throttled) + if (racct_pcpu_available(p) <= 0) { + if (p->p_racct->r_resources[RACCT_PCTCPU] > + pcpu_threshold) + racct_proc_throttle(p, -1); + } else if (p->p_throttled == -1) { racct_proc_wakeup(p); + } PROC_UNLOCK(p); } sx_sunlock(&allproc_lock); Modified: head/sys/kern/kern_rctl.c ============================================================================== --- head/sys/kern/kern_rctl.c Thu Apr 7 01:42:09 2016 (r297632) +++ head/sys/kern/kern_rctl.c Thu Apr 7 04:23:25 2016 (r297633) @@ -77,9 +77,13 @@ FEATURE(rctl, "Resource Limits"); #define RCTL_PCPU_SHIFT (10 * 1000000) -unsigned int rctl_maxbufsize = RCTL_MAX_OUTBUFSIZE; +static unsigned int rctl_maxbufsize = RCTL_MAX_OUTBUFSIZE; static int rctl_log_rate_limit = 10; static int rctl_devctl_rate_limit = 10; +static unsigned int rctl_throttle_min = 0; +static unsigned int rctl_throttle_max = 0; +static unsigned int rctl_throttle_pct = 0; +static unsigned int rctl_throttle_pct2 = 0; SYSCTL_NODE(_kern_racct, OID_AUTO, rctl, CTLFLAG_RW, 0, "Resource Limits"); SYSCTL_UINT(_kern_racct_rctl, OID_AUTO, maxbufsize, CTLFLAG_RWTUN, @@ -88,6 +92,16 @@ SYSCTL_UINT(_kern_racct_rctl, OID_AUTO, &rctl_log_rate_limit, 0, "Maximum number of log messages per second"); SYSCTL_UINT(_kern_racct_rctl, OID_AUTO, devctl_rate_limit, CTLFLAG_RW, &rctl_devctl_rate_limit, 0, "Maximum number of devctl messages per second"); +SYSCTL_UINT(_kern_racct_rctl, OID_AUTO, throttle_min, CTLFLAG_RDTUN, + &rctl_throttle_min, 0, "Shortest throttling duration, in hz"); +SYSCTL_UINT(_kern_racct_rctl, OID_AUTO, throttle_max, CTLFLAG_RDTUN, + &rctl_throttle_max, 0, "Longest throttling duration, in hz"); +SYSCTL_UINT(_kern_racct_rctl, OID_AUTO, throttle_pct, CTLFLAG_RDTUN, + &rctl_throttle_pct, 0, + "Throttling penalty for process consumption, in percent"); +SYSCTL_UINT(_kern_racct_rctl, OID_AUTO, throttle_pct2, CTLFLAG_RDTUN, + &rctl_throttle_pct2, 0, + "Throttling penalty for container consumption, in percent"); /* * 'rctl_rule_link' connects a rule with every racct it's related to. @@ -134,6 +148,10 @@ static struct dict resourcenames[] = { { "shmsize", RACCT_SHMSIZE }, { "wallclock", RACCT_WALLCLOCK }, { "pcpu", RACCT_PCTCPU }, + { "readbps", RACCT_READBPS }, + { "writebps", RACCT_WRITEBPS }, + { "readiops", RACCT_READIOPS }, + { "writeiops", RACCT_WRITEIOPS }, { NULL, -1 }}; static struct dict actionnames[] = { @@ -171,6 +189,7 @@ static struct dict actionnames[] = { { "deny", RCTL_ACTION_DENY }, { "log", RCTL_ACTION_LOG }, { "devctl", RCTL_ACTION_DEVCTL }, + { "throttle", RCTL_ACTION_THROTTLE }, { NULL, -1 }}; static void rctl_init(void); @@ -274,23 +293,53 @@ rctl_available_resource(const struct pro } /* - * Return non-zero if allocating 'amount' by proc 'p' would exceed - * resource limit specified by 'rule'. + * Called every second for proc, uidinfo, loginclass, and jail containers. + * If the limit isn't exceeded, it decreases the usage amount to zero. + * Otherwise, it decreases it by the value of the limit. This way + * resource consumption exceeding the limit "carries over" to the next + * period. */ -static int -rctl_would_exceed(const struct proc *p, const struct rctl_rule *rule, - int64_t amount) +void +rctl_throttle_decay(struct racct *racct, int resource) { - int64_t available; + struct rctl_rule *rule; + struct rctl_rule_link *link; + int64_t minavailable; ASSERT_RACCT_ENABLED(); - RCTL_LOCK_ASSERT(); - available = rctl_available_resource(p, rule); - if (available >= amount) - return (0); + minavailable = INT64_MAX; - return (1); + RCTL_RLOCK(); + + LIST_FOREACH(link, &racct->r_rule_links, rrl_next) { + rule = link->rrl_rule; + + if (rule->rr_resource != resource) + continue; + if (rule->rr_action != RCTL_ACTION_THROTTLE) + continue; + + if (rule->rr_amount < minavailable) + minavailable = rule->rr_amount; + } + + RCTL_RUNLOCK(); + + if (racct->r_resources[resource] < minavailable) { + racct->r_resources[resource] = 0; + } else { + /* + * Cap utilization counter at ten times the limit. Otherwise, + * if we changed the rule lowering the allowed amount, it could + * take unreasonably long time for the accumulated resource + * usage to drop. + */ + if (racct->r_resources[resource] > minavailable * 10) + racct->r_resources[resource] = minavailable * 10; + + racct->r_resources[resource] -= minavailable; + } } /* @@ -340,6 +389,38 @@ rctl_pcpu_available(const struct proc *p return (minavailable); } +static uint64_t +xadd(uint64_t a, uint64_t b) +{ + uint64_t c; + + c = a + b; + + /* + * Detect overflow. + */ + if (c < a || c < b) + return (UINT64_MAX); + + return (c); +} + +static uint64_t +xmul(uint64_t a, uint64_t b) +{ + uint64_t c; + + if (a == 0 || b == 0) + return (0); + + c = a * b; + + if (c < a || c < b) + return (UINT64_MAX); + + return (c); +} + /* * Check whether the proc 'p' can allocate 'amount' of 'resource' in addition * to what it keeps allocated now. Returns non-zero if the allocation should @@ -353,9 +434,12 @@ rctl_enforce(struct proc *p, int resourc struct rctl_rule *rule; struct rctl_rule_link *link; struct sbuf sb; + int64_t available; + uint64_t sleep_ms, sleep_ratio; int should_deny = 0; char *buf; + ASSERT_RACCT_ENABLED(); RCTL_RLOCK(); @@ -368,7 +452,9 @@ rctl_enforce(struct proc *p, int resourc rule = link->rrl_rule; if (rule->rr_resource != resource) continue; - if (!rctl_would_exceed(p, rule, amount)) { + + available = rctl_available_resource(p, rule); + if (available >= (int64_t)amount) { link->rrl_exceeded = 0; continue; } @@ -421,7 +507,7 @@ rctl_enforce(struct proc *p, int resourc if (p->p_state != PRS_NORMAL) continue; - + if (!ppsratecheck(&devctl_lasttime, &devctl_curtime, rctl_devctl_rate_limit)) continue; @@ -444,6 +530,69 @@ rctl_enforce(struct proc *p, int resourc free(buf, M_RCTL); link->rrl_exceeded = 1; continue; + case RCTL_ACTION_THROTTLE: + if (p->p_state != PRS_NORMAL) + continue; + + /* + * Make the process sleep for a fraction of second + * proportional to the ratio of process' resource + * utilization compared to the limit. The point is + * to penalize resource hogs: processes that consume + * more of the available resources sleep for longer. + * + * We're trying to defer division until the very end, + * to minimize the rounding effects. The following + * calculation could have been written in a clearer + * way like this: + * + * sleep_ms = hz * p->p_racct->r_resources[resource] / + * rule->rr_amount; + * sleep_ms *= rctl_throttle_pct / 100; + * if (sleep_ms < rctl_throttle_min) + * sleep_ms = rctl_throttle_min; + * + */ + sleep_ms = xmul(hz, p->p_racct->r_resources[resource]); + sleep_ms = xmul(sleep_ms, rctl_throttle_pct) / 100; + if (sleep_ms < rctl_throttle_min * rule->rr_amount) + sleep_ms = rctl_throttle_min * rule->rr_amount; + + /* + * Multiply that by the ratio of the resource + * consumption for the container compared to the limit, + * squared. In other words, a process in a container + * that is two times over the limit will be throttled + * four times as much for hitting the same rule. The + * point is to penalize processes more if the container + * itself (eg certain UID or jail) is above the limit. + */ + if (available < 0) + sleep_ratio = -available / rule->rr_amount; + else + sleep_ratio = 0; + sleep_ratio = xmul(sleep_ratio, sleep_ratio); + sleep_ratio = xmul(sleep_ratio, rctl_throttle_pct2) / 100; + sleep_ms = xadd(sleep_ms, xmul(sleep_ms, sleep_ratio)); + + /* + * Finally the division. + */ + sleep_ms /= rule->rr_amount; + + if (sleep_ms > rctl_throttle_max) + sleep_ms = rctl_throttle_max; +#if 0 + printf("%s: pid %d (%s), %jd of %jd, will sleep for %ld ms (ratio %ld, available %ld)\n", + __func__, p->p_pid, p->p_comm, + p->p_racct->r_resources[resource], + rule->rr_amount, sleep_ms, sleep_ratio, available); +#endif + + KASSERT(sleep_ms >= rctl_throttle_min, ("%s: %ju < %d\n", + __func__, (uintmax_t)sleep_ms, rctl_throttle_min)); + racct_proc_throttle(p, sleep_ms); + continue; default: if (link->rrl_exceeded != 0) continue; @@ -1073,20 +1222,32 @@ rctl_rule_add(struct rctl_rule *rule) KASSERT(rctl_rule_fully_specified(rule), ("rule not fully specified")); /* - * Some rules just don't make sense. Note that the one below - * cannot be rewritten using RACCT_IS_DENIABLE(); the RACCT_PCTCPU, - * for example, is not deniable in the racct sense, but the - * limit is enforced in a different way, so "deny" rules for %CPU - * do make sense. + * Some rules just don't make sense, like "deny" rule for an undeniable + * resource. The exception are the RSS and %CPU resources - they are + * not deniable in the racct sense, but the limit is enforced in + * a different way. */ if (rule->rr_action == RCTL_ACTION_DENY && - (rule->rr_resource == RACCT_CPU || - rule->rr_resource == RACCT_WALLCLOCK)) + !RACCT_IS_DENIABLE(rule->rr_resource) && + rule->rr_resource != RACCT_RSS && + rule->rr_resource != RACCT_PCTCPU) { return (EOPNOTSUPP); + } + + if (rule->rr_action == RCTL_ACTION_THROTTLE && + !RACCT_IS_DECAYING(rule->rr_resource)) { + return (EOPNOTSUPP); + } + + if (rule->rr_action == RCTL_ACTION_THROTTLE && + rule->rr_resource == RACCT_PCTCPU) { + return (EOPNOTSUPP); + } if (rule->rr_per == RCTL_SUBJECT_TYPE_PROCESS && - RACCT_IS_SLOPPY(rule->rr_resource)) + RACCT_IS_SLOPPY(rule->rr_resource)) { return (EOPNOTSUPP); + } /* * Make sure there are no duplicated rules. Also, for the "deny" @@ -1960,6 +2121,15 @@ rctl_init(void) UMA_ALIGN_PTR, UMA_ZONE_NOFREE); rctl_rule_zone = uma_zcreate("rctl_rule", sizeof(struct rctl_rule), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + + if (rctl_throttle_min <= 0) + rctl_throttle_min = 1; + if (rctl_throttle_max <= 0) + rctl_throttle_max = 2 * hz; + if (rctl_throttle_pct <= 0) + rctl_throttle_pct = 100; + if (rctl_throttle_pct2 <= 0) + rctl_throttle_pct2 = 100; } #else /* !RCTL */ Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Thu Apr 7 01:42:09 2016 (r297632) +++ head/sys/kern/subr_trap.c Thu Apr 7 04:23:25 2016 (r297633) @@ -172,10 +172,14 @@ userret(struct thread *td, struct trapfr (td->td_vnet_lpush != NULL) ? td->td_vnet_lpush : "N/A")); #endif #ifdef RACCT - if (racct_enable && p->p_throttled == 1) { + if (racct_enable && p->p_throttled != 0) { PROC_LOCK(p); - while (p->p_throttled == 1) - msleep(p->p_racct, &p->p_mtx, 0, "racct", 0); + while (p->p_throttled != 0) { + msleep(p->p_racct, &p->p_mtx, 0, "racct", + p->p_throttled < 0 ? 0 : p->p_throttled); + if (p->p_throttled > 0) + p->p_throttled = 0; + } PROC_UNLOCK(p); } #endif Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Thu Apr 7 01:42:09 2016 (r297632) +++ head/sys/kern/vfs_bio.c Thu Apr 7 04:23:25 2016 (r297633) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1784,8 +1785,16 @@ breada(struct vnode * vp, daddr_t * rabl rabp = getblk(vp, *rablkno, *rabsize, 0, 0, 0); if ((rabp->b_flags & B_CACHE) == 0) { - if (!TD_IS_IDLETHREAD(curthread)) + if (!TD_IS_IDLETHREAD(curthread)) { +#ifdef RACCT + if (racct_enable) { + PROC_LOCK(curproc); + racct_add_buf(curproc, rabp, 0); + PROC_UNLOCK(curproc); + } +#endif /* RACCT */ curthread->td_ru.ru_inblock++; + } rabp->b_flags |= B_ASYNC; rabp->b_flags &= ~B_INVAL; rabp->b_ioflags &= ~BIO_ERROR; @@ -1829,8 +1838,16 @@ breadn_flags(struct vnode *vp, daddr_t b /* if not found in cache, do some I/O */ if ((bp->b_flags & B_CACHE) == 0) { - if (!TD_IS_IDLETHREAD(curthread)) + if (!TD_IS_IDLETHREAD(curthread)) { +#ifdef RACCT + if (racct_enable) { + PROC_LOCK(curproc); + racct_add_buf(curproc, bp, 0); + PROC_UNLOCK(curproc); + } +#endif /* RACCT */ curthread->td_ru.ru_inblock++; + } bp->b_iocmd = BIO_READ; bp->b_flags &= ~B_INVAL; bp->b_ioflags &= ~BIO_ERROR; @@ -1926,8 +1943,16 @@ bufwrite(struct buf *bp) bp->b_runningbufspace = bp->b_bufsize; space = atomic_fetchadd_long(&runningbufspace, bp->b_runningbufspace); - if (!TD_IS_IDLETHREAD(curthread)) + if (!TD_IS_IDLETHREAD(curthread)) { +#ifdef RACCT + if (racct_enable) { + PROC_LOCK(curproc); + racct_add_buf(curproc, bp, 1); + PROC_UNLOCK(curproc); + } +#endif /* RACCT */ curthread->td_ru.ru_oublock++; + } if (oldflags & B_ASYNC) BUF_KERNPROC(bp); bp->b_iooffset = dbtob(bp->b_blkno); Modified: head/sys/kern/vfs_cluster.c ============================================================================== --- head/sys/kern/vfs_cluster.c Thu Apr 7 01:42:09 2016 (r297632) +++ head/sys/kern/vfs_cluster.c Thu Apr 7 04:23:25 2016 (r297633) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -241,6 +242,13 @@ cluster_read(struct vnode *vp, u_quad_t BUF_KERNPROC(bp); bp->b_iooffset = dbtob(bp->b_blkno); bstrategy(bp); +#ifdef RACCT + if (racct_enable) { + PROC_LOCK(curproc); + racct_add_buf(curproc, bp, 0); + PROC_UNLOCK(curproc); + } +#endif /* RACCT */ curthread->td_ru.ru_inblock++; } @@ -294,6 +302,13 @@ cluster_read(struct vnode *vp, u_quad_t BUF_KERNPROC(rbp); rbp->b_iooffset = dbtob(rbp->b_blkno); bstrategy(rbp); +#ifdef RACCT + if (racct_enable) { + PROC_LOCK(curproc); + racct_add_buf(curproc, rbp, 0); + PROC_UNLOCK(curproc); + } +#endif /* RACCT */ curthread->td_ru.ru_inblock++; } Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Thu Apr 7 01:42:09 2016 (r297632) +++ head/sys/sys/proc.h Thu Apr 7 04:23:25 2016 (r297633) @@ -623,7 +623,7 @@ struct proc { after fork. */ uint64_t p_prev_runtime; /* (c) Resource usage accounting. */ struct racct *p_racct; /* (b) Resource accounting. */ - u_char p_throttled; /* (c) Flag for racct pcpu throttling */ + int p_throttled; /* (c) Flag for racct pcpu throttling */ struct vm_domain_policy p_vm_dom_policy; /* (c) process default VM domain, or -1 */ /* * An orphan is the child that has beed re-parented to the Modified: head/sys/sys/racct.h ============================================================================== --- head/sys/sys/racct.h Thu Apr 7 01:42:09 2016 (r297632) +++ head/sys/sys/racct.h Thu Apr 7 04:23:25 2016 (r297633) @@ -42,6 +42,7 @@ #include #include +struct buf; struct proc; struct rctl_rule_link; struct ucred; @@ -71,7 +72,11 @@ struct ucred; #define RACCT_SHMSIZE 18 #define RACCT_WALLCLOCK 19 #define RACCT_PCTCPU 20 -#define RACCT_MAX RACCT_PCTCPU +#define RACCT_READBPS 21 +#define RACCT_WRITEBPS 22 +#define RACCT_READIOPS 23 +#define RACCT_WRITEIOPS 24 +#define RACCT_MAX RACCT_WRITEIOPS /* * Resource properties. @@ -153,6 +158,7 @@ SYSCTL_DECL(_kern_racct); int racct_add(struct proc *p, int resource, uint64_t amount); void racct_add_cred(struct ucred *cred, int resource, uint64_t amount); void racct_add_force(struct proc *p, int resource, uint64_t amount); +void racct_add_buf(struct proc *p, const struct buf *bufp, int is_write); int racct_set(struct proc *p, int resource, uint64_t amount); void racct_set_force(struct proc *p, int resource, uint64_t amount); void racct_sub(struct proc *p, int resource, uint64_t amount); @@ -170,6 +176,7 @@ void racct_proc_exit(struct proc *p); void racct_proc_ucred_changed(struct proc *p, struct ucred *oldcred, struct ucred *newcred); void racct_move(struct racct *dest, struct racct *src); +void racct_proc_throttle(struct proc *p, int timeout); #else Modified: head/sys/sys/rctl.h ============================================================================== --- head/sys/sys/rctl.h Thu Apr 7 01:42:09 2016 (r297632) +++ head/sys/sys/rctl.h Thu Apr 7 04:23:25 2016 (r297633) @@ -129,7 +129,8 @@ struct rctl_rule { #define RCTL_ACTION_DENY (RCTL_ACTION_SIGNAL_MAX + 1) #define RCTL_ACTION_LOG (RCTL_ACTION_SIGNAL_MAX + 2) #define RCTL_ACTION_DEVCTL (RCTL_ACTION_SIGNAL_MAX + 3) -#define RCTL_ACTION_MAX RCTL_ACTION_DEVCTL +#define RCTL_ACTION_THROTTLE (RCTL_ACTION_SIGNAL_MAX + 4) +#define RCTL_ACTION_MAX RCTL_ACTION_THROTTLE #define RCTL_AMOUNT_UNDEFINED -1 @@ -140,6 +141,7 @@ void rctl_rule_release(struct rctl_rule int rctl_rule_add(struct rctl_rule *rule); int rctl_rule_remove(struct rctl_rule *filter); int rctl_enforce(struct proc *p, int resource, uint64_t amount); +void rctl_throttle_decay(struct racct *racct, int resource); int64_t rctl_pcpu_available(const struct proc *p); uint64_t rctl_get_limit(struct proc *p, int resource); uint64_t rctl_get_available(struct proc *p, int resource); Modified: head/sys/ufs/ffs/ffs_inode.c ============================================================================== --- head/sys/ufs/ffs/ffs_inode.c Thu Apr 7 01:42:09 2016 (r297632) +++ head/sys/ufs/ffs/ffs_inode.c Thu Apr 7 04:23:25 2016 (r297633) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -659,6 +660,13 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, lev vp = ITOV(ip); bp = getblk(vp, lbn, (int)fs->fs_bsize, 0, 0, 0); if ((bp->b_flags & B_CACHE) == 0) { +#ifdef RACCT + if (racct_enable) { + PROC_LOCK(curproc); + racct_add_buf(curproc, bp, 0); + PROC_UNLOCK(curproc); + } +#endif /* RACCT */ curthread->td_ru.ru_inblock++; /* pay for read */ bp->b_iocmd = BIO_READ; bp->b_flags &= ~B_INVAL; Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Thu Apr 7 01:42:09 2016 (r297632) +++ head/sys/ufs/ffs/ffs_softdep.c Thu Apr 7 04:23:25 2016 (r297633) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -6229,6 +6230,13 @@ setup_trunc_indir(freeblks, ip, lbn, las vfs_busy_pages(bp, 0); bp->b_iooffset = dbtob(bp->b_blkno); bstrategy(bp); +#ifdef RACCT + if (racct_enable) { + PROC_LOCK(curproc); + racct_add_buf(curproc, bp, 0); + PROC_UNLOCK(curproc); + } +#endif /* RACCT */ curthread->td_ru.ru_inblock++; error = bufwait(bp); if (error) { Modified: head/sys/ufs/ufs/ufs_bmap.c ============================================================================== --- head/sys/ufs/ufs/ufs_bmap.c Thu Apr 7 01:42:09 2016 (r297632) +++ head/sys/ufs/ufs/ufs_bmap.c Thu Apr 7 04:23:25 2016 (r297633) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -223,6 +224,13 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, ru vfs_busy_pages(bp, 0); bp->b_iooffset = dbtob(bp->b_blkno); bstrategy(bp); +#ifdef RACCT + if (racct_enable) { + PROC_LOCK(curproc); + racct_add_buf(curproc, bp, 0); + PROC_UNLOCK(curproc); + } +#endif /* RACCT */ curthread->td_ru.ru_inblock++; error = bufwait(bp); if (error) { Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Thu Apr 7 01:42:09 2016 (r297632) +++ head/sys/vm/vm_fault.c Thu Apr 7 04:23:25 2016 (r297633) @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -994,6 +995,21 @@ vnode_locked: if (hardfault) { PCPU_INC(cnt.v_io_faults); curthread->td_ru.ru_majflt++; +#ifdef RACCT + if (racct_enable && fs.object->type == OBJT_VNODE) { + PROC_LOCK(curproc); + if ((fault_type & (VM_PROT_COPY | VM_PROT_WRITE)) != 0) { + racct_add_force(curproc, RACCT_WRITEBPS, + PAGE_SIZE + behind * PAGE_SIZE); + racct_add_force(curproc, RACCT_WRITEIOPS, 1); + } else { + racct_add_force(curproc, RACCT_READBPS, + PAGE_SIZE + ahead * PAGE_SIZE); + racct_add_force(curproc, RACCT_READIOPS, 1); + } + PROC_UNLOCK(curproc); + } +#endif } else curthread->td_ru.ru_minflt++; Modified: head/usr.bin/rctl/rctl.8 ============================================================================== --- head/usr.bin/rctl/rctl.8 Thu Apr 7 01:42:09 2016 (r297632) +++ head/usr.bin/rctl/rctl.8 Thu Apr 7 04:23:25 2016 (r297633) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 29, 2015 +.Dd January 30, 2016 .Dt RCTL 8 .Os .Sh NAME @@ -204,14 +204,22 @@ resource would be .It Sy shmsize Ta "SysV shared memory size, in bytes" .It Sy wallclock Ta "wallclock time, in seconds" .It Sy pcpu Ta "%CPU, in percents of a single CPU core" +.It Sy readbps Ta "filesystem reads, in bytes per second" +.It Sy writebps Ta "filesystem writes, in bytes per second" +.It Sy readiops Ta "filesystem reads, in operations per second" +.It Sy writeiops Ta "filesystem writes, in operations per second" .El .Sh ACTIONS .Bl -column -offset 3n "pseudoterminals" .It Em action .It Sy deny Ta deny the allocation; not supported for -.Sy cputime +.Sy cputime , +.Sy wallclock , +.Sy readbps , +.Sy writebps , +.Sy readiops , and -.Sy wallclock +.Sy writeiops .It Sy log Ta "log a warning to the console" .It Sy devctl Ta "send notification to" .Xr devd 8 @@ -228,6 +236,12 @@ send a signal to the offending process. See .Xr signal 3 for a list of supported signals +.It Sy throttle Ta "slow down process execution"; only supported for +.Sy readbps , +.Sy writebps , +.Sy readiops , +and +.Sy writeiops . .El .Pp Not all actions are supported for all resources. @@ -287,3 +301,22 @@ under sponsorship from the FreeBSD Found Limiting .Sy memoryuse may kill the machine due to thrashing. +.Pp +The +.Sy readiops +and +.Sy writeiops +counters are only approximations. +Like +.Sy readbps +and +.Sy writebps , +they are calculated in the filesystem layer, where it is difficult +or even impossible to observe actual disk device operations. +.Pp +The +.Sy writebps +and +.Sy writeiops +resources generally account for writes to the filesystem cache, +not to actual devices. From owner-svn-src-all@freebsd.org Thu Apr 7 05:31:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71A5DB07FF8; Thu, 7 Apr 2016 05:31:23 +0000 (UTC) (envelope-from sephe@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 mx1.freebsd.org (Postfix) with ESMTPS id 421CC1364; Thu, 7 Apr 2016 05:31:23 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u375VMGd041114; Thu, 7 Apr 2016 05:31:22 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u375VMS9041113; Thu, 7 Apr 2016 05:31:22 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201604070531.u375VMS9041113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 7 Apr 2016 05:31:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297634 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 05:31:23 -0000 Author: sephe Date: Thu Apr 7 05:31:22 2016 New Revision: 297634 URL: https://svnweb.freebsd.org/changeset/base/297634 Log: hyperv: Use mb() instead of atomic_thread_fence_seq_cst() Since atomic_thread_fence_seq_cst() will become compiler fence on UP kernel. Reviewed by: kib, Dexuan Cui MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5852 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Apr 7 04:23:25 2016 (r297633) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Apr 7 05:31:22 2016 (r297634) @@ -117,8 +117,12 @@ handled: * message_pending and EOMing. Otherwise, the EOMing will * not deliver any more messages * since there is no empty slot + * + * NOTE: + * mb() is used here, since atomic_thread_fence_seq_cst() + * will become compler fence on UP kernel. */ - atomic_thread_fence_seq_cst(); + mb(); if (msg->header.message_flags.u.message_pending) { /* @@ -190,8 +194,12 @@ hv_vmbus_isr(struct trapframe *frame) * message_pending and EOMing. Otherwise, the EOMing will * not deliver any more messages * since there is no empty slot + * + * NOTE: + * mb() is used here, since atomic_thread_fence_seq_cst() + * will become compler fence on UP kernel. */ - atomic_thread_fence_seq_cst(); + mb(); if (msg->header.message_flags.u.message_pending) { /* From owner-svn-src-all@freebsd.org Thu Apr 7 05:45:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC09CB0651F; Thu, 7 Apr 2016 05:45:50 +0000 (UTC) (envelope-from sephe@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 mx1.freebsd.org (Postfix) with ESMTPS id 9D5281B92; Thu, 7 Apr 2016 05:45:50 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u375jn18044823; Thu, 7 Apr 2016 05:45:49 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u375jnke044820; Thu, 7 Apr 2016 05:45:49 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201604070545.u375jnke044820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 7 Apr 2016 05:45:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297635 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 05:45:51 -0000 Author: sephe Date: Thu Apr 7 05:45:49 2016 New Revision: 297635 URL: https://svnweb.freebsd.org/changeset/base/297635 Log: hyperv/vmbus: Use default mtx for channel message queue First of all sema_post() can't be called w/ spinlock, and the channel message queue processing is not on hot code path, i.e. spinlock is not necessary. Submitted by: Jun Su Reviewed by: sephe, Dexuan Cui MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5812 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_connection.c Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Thu Apr 7 05:31:22 2016 (r297634) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Thu Apr 7 05:45:49 2016 (r297635) @@ -270,12 +270,12 @@ hv_vmbus_channel_open( if (user_data_len) memcpy(open_msg->user_data, user_data, user_data_len); - mtx_lock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); TAILQ_INSERT_TAIL( &hv_vmbus_g_connection.channel_msg_anchor, open_info, msg_list_entry); - mtx_unlock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); ret = hv_vmbus_post_message( open_msg, sizeof(hv_vmbus_channel_open_channel)); @@ -302,12 +302,12 @@ hv_vmbus_channel_open( } cleanup: - mtx_lock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); TAILQ_REMOVE( &hv_vmbus_g_connection.channel_msg_anchor, open_info, msg_list_entry); - mtx_unlock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); sema_destroy(&open_info->wait_sema); free(open_info, M_DEVBUF); @@ -496,13 +496,13 @@ hv_vmbus_channel_establish_gpadl( gpadl_msg->child_rel_id = channel->offer_msg.child_rel_id; gpadl_msg->gpadl = next_gpadl_handle; - mtx_lock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); TAILQ_INSERT_TAIL( &hv_vmbus_g_connection.channel_msg_anchor, msg_info, msg_list_entry); - mtx_unlock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); ret = hv_vmbus_post_message( gpadl_msg, @@ -541,10 +541,10 @@ hv_vmbus_channel_establish_gpadl( cleanup: - mtx_lock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); TAILQ_REMOVE(&hv_vmbus_g_connection.channel_msg_anchor, msg_info, msg_list_entry); - mtx_unlock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); sema_destroy(&msg_info->wait_sema); free(msg_info, M_DEVBUF); @@ -583,10 +583,10 @@ hv_vmbus_channel_teardown_gpdal( msg->child_rel_id = channel->offer_msg.child_rel_id; msg->gpadl = gpadl_handle; - mtx_lock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); TAILQ_INSERT_TAIL(&hv_vmbus_g_connection.channel_msg_anchor, info, msg_list_entry); - mtx_unlock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); ret = hv_vmbus_post_message(msg, sizeof(hv_vmbus_channel_gpadl_teardown)); @@ -599,10 +599,10 @@ cleanup: /* * Received a torndown response */ - mtx_lock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); TAILQ_REMOVE(&hv_vmbus_g_connection.channel_msg_anchor, info, msg_list_entry); - mtx_unlock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); sema_destroy(&info->wait_sema); free(info, M_DEVBUF); Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Apr 7 05:31:22 2016 (r297634) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Apr 7 05:45:49 2016 (r297635) @@ -492,7 +492,7 @@ vmbus_channel_on_open_result(hv_vmbus_ch /* * Find the open msg, copy the result and signal/unblock the wait event */ - mtx_lock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); TAILQ_FOREACH(msg_info, &hv_vmbus_g_connection.channel_msg_anchor, msg_list_entry) { @@ -510,7 +510,7 @@ vmbus_channel_on_open_result(hv_vmbus_ch } } } - mtx_unlock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); } @@ -534,7 +534,7 @@ vmbus_channel_on_gpadl_created(hv_vmbus_ /* Find the establish msg, copy the result and signal/unblock * the wait event */ - mtx_lock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); TAILQ_FOREACH(msg_info, &hv_vmbus_g_connection.channel_msg_anchor, msg_list_entry) { request_header = (hv_vmbus_channel_msg_header*) msg_info->msg; @@ -553,7 +553,7 @@ vmbus_channel_on_gpadl_created(hv_vmbus_ } } } - mtx_unlock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); } /** @@ -578,7 +578,7 @@ vmbus_channel_on_gpadl_torndown(hv_vmbus * wait event. */ - mtx_lock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); TAILQ_FOREACH(msg_info, &hv_vmbus_g_connection.channel_msg_anchor, msg_list_entry) { @@ -598,7 +598,7 @@ vmbus_channel_on_gpadl_torndown(hv_vmbus } } } - mtx_unlock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); } /** @@ -618,7 +618,7 @@ vmbus_channel_on_version_response(hv_vmb versionResponse = (hv_vmbus_channel_version_response*)hdr; - mtx_lock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); TAILQ_FOREACH(msg_info, &hv_vmbus_g_connection.channel_msg_anchor, msg_list_entry) { requestHeader = (hv_vmbus_channel_msg_header*) msg_info->msg; @@ -632,7 +632,7 @@ vmbus_channel_on_version_response(hv_vmb sema_post(&msg_info->wait_sema); } } - mtx_unlock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); } Modified: head/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c Thu Apr 7 05:31:22 2016 (r297634) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Thu Apr 7 05:45:49 2016 (r297635) @@ -96,26 +96,26 @@ hv_vmbus_negotiate_version(hv_vmbus_chan * Add to list before we send the request since we may receive the * response before returning from this routine */ - mtx_lock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); TAILQ_INSERT_TAIL( &hv_vmbus_g_connection.channel_msg_anchor, msg_info, msg_list_entry); - mtx_unlock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); ret = hv_vmbus_post_message( msg, sizeof(hv_vmbus_channel_initiate_contact)); if (ret != 0) { - mtx_lock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); TAILQ_REMOVE( &hv_vmbus_g_connection.channel_msg_anchor, msg_info, msg_list_entry); - mtx_unlock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); return (ret); } @@ -124,12 +124,12 @@ hv_vmbus_negotiate_version(hv_vmbus_chan */ ret = sema_timedwait(&msg_info->wait_sema, 5 * hz); /* KYS 5 seconds */ - mtx_lock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); TAILQ_REMOVE( &hv_vmbus_g_connection.channel_msg_anchor, msg_info, msg_list_entry); - mtx_unlock_spin(&hv_vmbus_g_connection.channel_msg_lock); + mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); /** * Check if successful @@ -166,7 +166,7 @@ hv_vmbus_connect(void) { TAILQ_INIT(&hv_vmbus_g_connection.channel_msg_anchor); mtx_init(&hv_vmbus_g_connection.channel_msg_lock, "vmbus channel msg", - NULL, MTX_SPIN); + NULL, MTX_DEF); TAILQ_INIT(&hv_vmbus_g_connection.channel_anchor); mtx_init(&hv_vmbus_g_connection.channel_lock, "vmbus channel", From owner-svn-src-all@freebsd.org Thu Apr 7 05:56:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C3CBB06B1E; Thu, 7 Apr 2016 05:56:23 +0000 (UTC) (envelope-from sephe@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 mx1.freebsd.org (Postfix) with ESMTPS id 4E81F1FD7; Thu, 7 Apr 2016 05:56:23 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u375uMBk047886; Thu, 7 Apr 2016 05:56:22 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u375uM5i047885; Thu, 7 Apr 2016 05:56:22 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201604070556.u375uM5i047885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 7 Apr 2016 05:56:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297636 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 05:56:23 -0000 Author: sephe Date: Thu Apr 7 05:56:22 2016 New Revision: 297636 URL: https://svnweb.freebsd.org/changeset/base/297636 Log: hyperv: Typo in r297634 Noticed by: hiren MFC after: 1 week Sponsored by: Microsoft OSTC Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Apr 7 05:45:49 2016 (r297635) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Apr 7 05:56:22 2016 (r297636) @@ -120,7 +120,7 @@ handled: * * NOTE: * mb() is used here, since atomic_thread_fence_seq_cst() - * will become compler fence on UP kernel. + * will become compiler fence on UP kernel. */ mb(); @@ -197,7 +197,7 @@ hv_vmbus_isr(struct trapframe *frame) * * NOTE: * mb() is used here, since atomic_thread_fence_seq_cst() - * will become compler fence on UP kernel. + * will become compiler fence on UP kernel. */ mb(); From owner-svn-src-all@freebsd.org Thu Apr 7 06:21:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4965B071A0; Thu, 7 Apr 2016 06:21:34 +0000 (UTC) (envelope-from ngie@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 mx1.freebsd.org (Postfix) with ESMTPS id 8489B19AB; Thu, 7 Apr 2016 06:21:34 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u376LXrv053908; Thu, 7 Apr 2016 06:21:33 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u376LXrZ053907; Thu, 7 Apr 2016 06:21:33 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201604070621.u376LXrZ053907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 7 Apr 2016 06:21:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297637 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 06:21:34 -0000 Author: ngie Date: Thu Apr 7 06:21:33 2016 New Revision: 297637 URL: https://svnweb.freebsd.org/changeset/base/297637 Log: Disable the NetBSD-specific EFAULT requirements test in gettimeofday_err FreeBSD doesn't specifically list this as a supported error, and in some configurations/versions of FreeBSD, this test will segfault as the memory address might be evaluated in userspace, instead of in kernel space like in NetBSD. MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_gettimeofday.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_gettimeofday.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_gettimeofday.c Thu Apr 7 05:56:22 2016 (r297636) +++ head/contrib/netbsd-tests/lib/libc/sys/t_gettimeofday.c Thu Apr 7 06:21:33 2016 (r297637) @@ -46,9 +46,11 @@ ATF_TC_HEAD(gettimeofday_err, tc) ATF_TC_BODY(gettimeofday_err, tc) { +#ifdef __NetBSD__ errno = 0; ATF_REQUIRE_ERRNO(EFAULT, gettimeofday((void *)-1, NULL) != 0); +#endif } ATF_TC(gettimeofday_mono); From owner-svn-src-all@freebsd.org Thu Apr 7 06:36:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9177B0754D; Thu, 7 Apr 2016 06:36:04 +0000 (UTC) (envelope-from sephe@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 mx1.freebsd.org (Postfix) with ESMTPS id 717491F1C; Thu, 7 Apr 2016 06:36:04 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u376a3tF059696; Thu, 7 Apr 2016 06:36:03 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u376a3JA059695; Thu, 7 Apr 2016 06:36:03 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201604070636.u376a3JA059695@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 7 Apr 2016 06:36:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297638 - head/sys/x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 06:36:04 -0000 Author: sephe Date: Thu Apr 7 06:36:03 2016 New Revision: 297638 URL: https://svnweb.freebsd.org/changeset/base/297638 Log: x86: Allow interrupt vector allocation/free even on UP It is needed by the hypervisor FreeBSD guest to allocate/free private interrupt vectors. Reviewed by: kib, jhb, Dexuan Cui Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5849 Modified: head/sys/x86/x86/local_apic.c Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Thu Apr 7 06:21:33 2016 (r297637) +++ head/sys/x86/x86/local_apic.c Thu Apr 7 06:36:03 2016 (r297638) @@ -321,9 +321,9 @@ static int native_lapic_set_lvt_trigger static void native_lapic_ipi_raw(register_t icrlo, u_int dest); static void native_lapic_ipi_vectored(u_int vector, int dest); static int native_lapic_ipi_wait(int delay); +#endif /* SMP */ static int native_lapic_ipi_alloc(inthand_t *ipifunc); static void native_lapic_ipi_free(int vector); -#endif /* SMP */ struct apic_ops apic_ops = { .create = native_lapic_create, @@ -350,9 +350,9 @@ struct apic_ops apic_ops = { .ipi_raw = native_lapic_ipi_raw, .ipi_vectored = native_lapic_ipi_vectored, .ipi_wait = native_lapic_ipi_wait, +#endif .ipi_alloc = native_lapic_ipi_alloc, .ipi_free = native_lapic_ipi_free, -#endif .set_lvt_mask = native_lapic_set_lvt_mask, .set_lvt_mode = native_lapic_set_lvt_mode, .set_lvt_polarity = native_lapic_set_lvt_polarity, @@ -1904,6 +1904,8 @@ native_lapic_ipi_vectored(u_int vector, #endif /* DETECT_DEADLOCK */ } +#endif /* SMP */ + /* * Since the IDT is shared by all CPUs the IPI slot update needs to be globally * visible. @@ -1958,5 +1960,3 @@ native_lapic_ipi_free(int vector) setidt(vector, &IDTVEC(rsvd), SDT_APICT, SEL_KPL, GSEL_APIC); mtx_unlock_spin(&icu_lock); } - -#endif /* SMP */ From owner-svn-src-all@freebsd.org Thu Apr 7 07:00:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 489AAB06008; Thu, 7 Apr 2016 07:00:01 +0000 (UTC) (envelope-from sephe@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 mx1.freebsd.org (Postfix) with ESMTPS id 1ABB01BD3; Thu, 7 Apr 2016 07:00:01 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37700GZ065894; Thu, 7 Apr 2016 07:00:00 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37700UT065893; Thu, 7 Apr 2016 07:00:00 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201604070700.u37700UT065893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 7 Apr 2016 07:00:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297639 - head/sys/x86/xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:00:01 -0000 Author: sephe Date: Thu Apr 7 07:00:00 2016 New Revision: 297639 URL: https://svnweb.freebsd.org/changeset/base/297639 Log: xen: Set ipi_{alloc,free} even for UP This keeps XEN apic_ops aligned w/ x86's. Suggested by: kib, jhb Reviewed by: jhb, royger Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5871 Modified: head/sys/x86/xen/xen_apic.c Modified: head/sys/x86/xen/xen_apic.c ============================================================================== --- head/sys/x86/xen/xen_apic.c Thu Apr 7 06:36:03 2016 (r297638) +++ head/sys/x86/xen/xen_apic.c Thu Apr 7 07:00:00 2016 (r297639) @@ -296,6 +296,7 @@ xen_pv_lapic_ipi_wait(int delay) XEN_APIC_UNSUPPORTED; return (0); } +#endif /* SMP */ static int xen_pv_lapic_ipi_alloc(inthand_t *ipifunc) @@ -311,7 +312,6 @@ xen_pv_lapic_ipi_free(int vector) XEN_APIC_UNSUPPORTED; } -#endif /* SMP */ static int xen_pv_lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked) @@ -372,9 +372,9 @@ struct apic_ops xen_apic_ops = { .ipi_raw = xen_pv_lapic_ipi_raw, .ipi_vectored = xen_pv_lapic_ipi_vectored, .ipi_wait = xen_pv_lapic_ipi_wait, +#endif .ipi_alloc = xen_pv_lapic_ipi_alloc, .ipi_free = xen_pv_lapic_ipi_free, -#endif .set_lvt_mask = xen_pv_lapic_set_lvt_mask, .set_lvt_mode = xen_pv_lapic_set_lvt_mode, .set_lvt_polarity = xen_pv_lapic_set_lvt_polarity, From owner-svn-src-all@freebsd.org Thu Apr 7 07:12:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A43DBB064C6; Thu, 7 Apr 2016 07:12:15 +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 mx1.freebsd.org (Postfix) with ESMTPS id 5B1B41377; Thu, 7 Apr 2016 07:12:15 +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 u377CEc0069654; Thu, 7 Apr 2016 07:12:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377CECH069653; Thu, 7 Apr 2016 07:12:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070712.u377CECH069653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:12:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297640 - stable/10/sbin/ifconfig X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:12:15 -0000 Author: hselasky Date: Thu Apr 7 07:12:14 2016 New Revision: 297640 URL: https://svnweb.freebsd.org/changeset/base/297640 Log: MFC r296902: Improve detection of extended QSFP diagnostics. The standards in the QSFP diagnostics area are not clear when the additional measurements are present or not. Use a valid temperature reading as an indicator for the presence of voltage and TX/RX power measurements. Sponsored by: Mellanox Technologies Tested by: Netflix Differential Revision: https://reviews.freebsd.org/D5391 Reviewed by: gallatin Modified: stable/10/sbin/ifconfig/sfp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/ifconfig/sfp.c ============================================================================== --- stable/10/sbin/ifconfig/sfp.c Thu Apr 7 07:00:00 2016 (r297639) +++ stable/10/sbin/ifconfig/sfp.c Thu Apr 7 07:12:14 2016 (r297640) @@ -625,14 +625,17 @@ get_sfp_voltage(struct i2c_info *ii, cha convert_sff_voltage(buf, size, xbuf); } -static void +static int get_qsfp_temp(struct i2c_info *ii, char *buf, size_t size) { uint8_t xbuf[2]; memset(xbuf, 0, sizeof(xbuf)); read_i2c(ii, SFF_8436_BASE, SFF_8436_TEMP, 2, xbuf); + if ((xbuf[0] == 0xFF && xbuf[1] == 0xFF) || (xbuf[0] == 0 && xbuf[1] == 0)) + return (-1); convert_sff_temp(buf, size, xbuf); + return (0); } static void @@ -779,22 +782,9 @@ static void print_qsfp_status(struct i2c_info *ii, int verbose) { char buf[80], buf2[40], buf3[40]; - uint8_t diag_type; uint32_t bitrate; int i; - /* Read diagnostic monitoring type */ - read_i2c(ii, SFF_8436_BASE, SFF_8436_DIAG_TYPE, 1, (caddr_t)&diag_type); - if (ii->error != 0) - return; - - /* - * Read monitoring data it is supplied. - * XXX: It is not exactly clear from standard - * how one can specify lack of measurements (passive cables case). - */ - if (diag_type != 0) - ii->do_diag = 1; ii->qsfp = 1; /* Transceiver type */ @@ -817,9 +807,13 @@ print_qsfp_status(struct i2c_info *ii, i printf("\tnominal bitrate: %u Mbps\n", bitrate); } - /* Request current measurements if they are provided: */ - if (ii->do_diag != 0) { - get_qsfp_temp(ii, buf, sizeof(buf)); + /* + * The standards in this area are not clear when the + * additional measurements are present or not. Use a valid + * temperature reading as an indicator for the presence of + * voltage and TX/RX power measurements. + */ + if (get_qsfp_temp(ii, buf, sizeof(buf)) == 0) { get_qsfp_voltage(ii, buf2, sizeof(buf2)); printf("\tmodule temperature: %s voltage: %s\n", buf, buf2); for (i = 1; i <= 4; i++) { From owner-svn-src-all@freebsd.org Thu Apr 7 07:12:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20759B065EC; Thu, 7 Apr 2016 07:12:59 +0000 (UTC) (envelope-from sephe@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 mx1.freebsd.org (Postfix) with ESMTPS id F12E815B8; Thu, 7 Apr 2016 07:12:58 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u377Cwlf071686; Thu, 7 Apr 2016 07:12:58 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377CwAk071684; Thu, 7 Apr 2016 07:12:58 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201604070712.u377CwAk071684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 7 Apr 2016 07:12:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297641 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:12:59 -0000 Author: sephe Date: Thu Apr 7 07:12:57 2016 New Revision: 297641 URL: https://svnweb.freebsd.org/changeset/base/297641 Log: hyperv: Use lapic_{alloc,free}_ipi to allocate private interrupt vector Suggested by: jhb Reviewed by: Dexuan Cui , Jun Su Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5850 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Apr 7 07:12:14 2016 (r297640) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Apr 7 07:12:57 2016 (r297641) @@ -391,80 +391,9 @@ vmbus_probe(device_t dev) { } #ifdef HYPERV -extern inthand_t IDTVEC(rsvd), IDTVEC(hv_vmbus_callback); - -/** - * @brief Find a free IDT slot and setup the interrupt handler. - */ -static int -vmbus_vector_alloc(void) -{ - int vector; - uintptr_t func; - struct gate_descriptor *ip; - - /* - * Search backwards form the highest IDT vector available for use - * as vmbus channel callback vector. We install 'hv_vmbus_callback' - * handler at that vector and use it to interrupt vcpus. - */ - vector = APIC_SPURIOUS_INT; - while (--vector >= APIC_IPI_INTS) { - ip = &idt[vector]; - func = ((long)ip->gd_hioffset << 16 | ip->gd_looffset); - if (func == (uintptr_t)&IDTVEC(rsvd)) { -#ifdef __i386__ - setidt(vector , IDTVEC(hv_vmbus_callback), SDT_SYS386IGT, - SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); -#else - setidt(vector , IDTVEC(hv_vmbus_callback), SDT_SYSIGT, - SEL_KPL, 0); +extern inthand_t IDTVEC(hv_vmbus_callback); #endif - return (vector); - } - } - return (0); -} - -/** - * @brief Restore the IDT slot to rsvd. - */ -static void -vmbus_vector_free(int vector) -{ - uintptr_t func; - struct gate_descriptor *ip; - - if (vector == 0) - return; - - KASSERT(vector >= APIC_IPI_INTS && vector < APIC_SPURIOUS_INT, - ("invalid vector %d", vector)); - - ip = &idt[vector]; - func = ((long)ip->gd_hioffset << 16 | ip->gd_looffset); - KASSERT(func == (uintptr_t)&IDTVEC(hv_vmbus_callback), - ("invalid vector %d", vector)); - - setidt(vector, IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0); -} - -#else /* HYPERV */ - -static int -vmbus_vector_alloc(void) -{ - return(0); -} - -static void -vmbus_vector_free(int vector) -{ -} - -#endif /* HYPERV */ - /** * @brief Main vmbus driver initialization routine. * @@ -497,12 +426,15 @@ vmbus_bus_init(void) return (ret); } +#ifdef HYPERV /* * Find a free IDT slot for vmbus callback. */ - hv_vmbus_g_context.hv_cb_vector = vmbus_vector_alloc(); - - if (hv_vmbus_g_context.hv_cb_vector == 0) { + hv_vmbus_g_context.hv_cb_vector = lapic_ipi_alloc(IDTVEC(hv_vmbus_callback)); +#else + hv_vmbus_g_context.hv_cb_vector = -1; +#endif + if (hv_vmbus_g_context.hv_cb_vector < 0) { if(bootverbose) printf("Error VMBUS: Cannot find free IDT slot for " "vmbus callback!\n"); @@ -595,7 +527,7 @@ vmbus_bus_init(void) } } - vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector); + lapic_ipi_free(hv_vmbus_g_context.hv_cb_vector); cleanup: hv_vmbus_cleanup(); @@ -663,7 +595,7 @@ vmbus_bus_exit(void) } } - vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector); + lapic_ipi_free(hv_vmbus_g_context.hv_cb_vector); return; } Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Apr 7 07:12:14 2016 (r297640) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Apr 7 07:12:57 2016 (r297641) @@ -208,10 +208,10 @@ typedef struct { struct taskqueue *hv_msg_tq[MAXCPU]; struct task hv_msg_task[MAXCPU]; /* - * Host use this vector to intrrupt guest for vmbus channel + * Host use this vector to interrupt guest for vmbus channel * event and msg. */ - unsigned int hv_cb_vector; + int hv_cb_vector; } hv_vmbus_context; /* From owner-svn-src-all@freebsd.org Thu Apr 7 07:15:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21188B066E1; Thu, 7 Apr 2016 07:15:55 +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 mx1.freebsd.org (Postfix) with ESMTPS id E5F3E17E9; Thu, 7 Apr 2016 07:15:54 +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 u377FsJo071835; Thu, 7 Apr 2016 07:15:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377FsFf071834; Thu, 7 Apr 2016 07:15:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070715.u377FsFf071834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:15:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r297642 - stable/9/sys/dev/usb/quirk X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:15:55 -0000 Author: hselasky Date: Thu Apr 7 07:15:53 2016 New Revision: 297642 URL: https://svnweb.freebsd.org/changeset/base/297642 Log: MFC r296342: Allow for overlapping quirk device ranges. Prior to this patch only the first device entry matching the USB vendor, product and revision would be searched for quirks. After this patch all device entries will be searched for quirks. Modified: stable/9/sys/dev/usb/quirk/usb_quirk.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- stable/9/sys/dev/usb/quirk/usb_quirk.c Thu Apr 7 07:12:57 2016 (r297641) +++ stable/9/sys/dev/usb/quirk/usb_quirk.c Thu Apr 7 07:15:53 2016 (r297642) @@ -682,8 +682,6 @@ usb_test_quirk_by_info(const struct usbd return (1); } } - /* no quirk found */ - break; } mtx_unlock(&usb_quirk_mtx); done: From owner-svn-src-all@freebsd.org Thu Apr 7 07:17:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96B1FB067D3; Thu, 7 Apr 2016 07:17: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 mx1.freebsd.org (Postfix) with ESMTPS id 5FE4119CC; Thu, 7 Apr 2016 07:17:24 +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 u377HNVu071944; Thu, 7 Apr 2016 07:17:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377HNHH071943; Thu, 7 Apr 2016 07:17:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070717.u377HNHH071943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:17:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297643 - stable/10/sys/dev/usb/quirk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:17:24 -0000 Author: hselasky Date: Thu Apr 7 07:17:23 2016 New Revision: 297643 URL: https://svnweb.freebsd.org/changeset/base/297643 Log: MFC r296342: Allow for overlapping quirk device ranges. Prior to this patch only the first device entry matching the USB vendor, product and revision would be searched for quirks. After this patch all device entries will be searched for quirks. Modified: stable/10/sys/dev/usb/quirk/usb_quirk.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- stable/10/sys/dev/usb/quirk/usb_quirk.c Thu Apr 7 07:15:53 2016 (r297642) +++ stable/10/sys/dev/usb/quirk/usb_quirk.c Thu Apr 7 07:17:23 2016 (r297643) @@ -682,8 +682,6 @@ usb_test_quirk_by_info(const struct usbd return (1); } } - /* no quirk found */ - break; } mtx_unlock(&usb_quirk_mtx); done: From owner-svn-src-all@freebsd.org Thu Apr 7 07:19:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4C83B068F0; Thu, 7 Apr 2016 07:19:31 +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 mx1.freebsd.org (Postfix) with ESMTPS id B500C1C6B; Thu, 7 Apr 2016 07:19:31 +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 u377JUXh072213; Thu, 7 Apr 2016 07:19:30 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377JUw6072212; Thu, 7 Apr 2016 07:19:30 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070719.u377JUw6072212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:19:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r297644 - stable/8/sys/dev/usb/quirk X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:19:32 -0000 Author: hselasky Date: Thu Apr 7 07:19:30 2016 New Revision: 297644 URL: https://svnweb.freebsd.org/changeset/base/297644 Log: MFC r296342: Allow for overlapping quirk device ranges. Prior to this patch only the first device entry matching the USB vendor, product and revision would be searched for quirks. After this patch all device entries will be searched for quirks. Modified: stable/8/sys/dev/usb/quirk/usb_quirk.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) Modified: stable/8/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- stable/8/sys/dev/usb/quirk/usb_quirk.c Thu Apr 7 07:17:23 2016 (r297643) +++ stable/8/sys/dev/usb/quirk/usb_quirk.c Thu Apr 7 07:19:30 2016 (r297644) @@ -613,8 +613,6 @@ usb_test_quirk_by_info(const struct usbd return (1); } } - /* no quirk found */ - break; } mtx_unlock(&usb_quirk_mtx); done: From owner-svn-src-all@freebsd.org Thu Apr 7 07:21:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4ADB8B069B6; Thu, 7 Apr 2016 07:21:28 +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 mx1.freebsd.org (Postfix) with ESMTPS id 1672F1F14; Thu, 7 Apr 2016 07:21:28 +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 u377LRdo074964; Thu, 7 Apr 2016 07:21:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377LRG3074963; Thu, 7 Apr 2016 07:21:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070721.u377LRG3074963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:21:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297645 - stable/10/sys/amd64/include X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:21:28 -0000 Author: hselasky Date: Thu Apr 7 07:21:27 2016 New Revision: 297645 URL: https://svnweb.freebsd.org/changeset/base/297645 Log: MFC r294526: Add missing atomic wrapper macro. Reviewed by: alfred @ Sponsored by: Mellanox Technologies Modified: stable/10/sys/amd64/include/atomic.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/include/atomic.h ============================================================================== --- stable/10/sys/amd64/include/atomic.h Thu Apr 7 07:19:30 2016 (r297644) +++ stable/10/sys/amd64/include/atomic.h Thu Apr 7 07:21:27 2016 (r297645) @@ -483,6 +483,7 @@ u_long atomic_swap_long(volatile u_long #define atomic_cmpset_rel_64 atomic_cmpset_rel_long #define atomic_swap_64 atomic_swap_long #define atomic_readandclear_64 atomic_readandclear_long +#define atomic_fetchadd_64 atomic_fetchadd_long #define atomic_testandset_64 atomic_testandset_long /* Operations on pointers. */ From owner-svn-src-all@freebsd.org Thu Apr 7 07:22:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F86AB06B9D; Thu, 7 Apr 2016 07:22:23 +0000 (UTC) (envelope-from sgalabov@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 mx1.freebsd.org (Postfix) with ESMTPS id 5E9441160; Thu, 7 Apr 2016 07:22:23 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u377MMYN075090; Thu, 7 Apr 2016 07:22:22 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377MMBe075088; Thu, 7 Apr 2016 07:22:22 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201604070722.u377MMBe075088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Thu, 7 Apr 2016 07:22:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297646 - head/sys/dev/rt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:22:23 -0000 Author: sgalabov Date: Thu Apr 7 07:22:22 2016 New Revision: 297646 URL: https://svnweb.freebsd.org/changeset/base/297646 Log: This revision adds support to if_rt for more SoCs. The SoCs I've tried the driver with include the following: RT3050, RT5350, RT3662, RT3883, MT7620, MT7621, MT7688. On boards, based on the above SoCs traffic is passing through correctly and the boards survive a flood ping with very little or no drops (drops may be caused elsewhere in my test setup, however). One issue still remains and needs to be fixed in the future: if_rt does not survive an ifconfig rt0 down/ifconfig rt0 up cycle. This issue existed before this commit as well, however. Reviewed by: ray Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5864 Modified: head/sys/dev/rt/if_rt.c head/sys/dev/rt/if_rtvar.h Modified: head/sys/dev/rt/if_rt.c ============================================================================== --- head/sys/dev/rt/if_rt.c Thu Apr 7 07:21:27 2016 (r297645) +++ head/sys/dev/rt/if_rt.c Thu Apr 7 07:22:22 2016 (r297646) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015, Stanislav Galabov + * Copyright (c) 2015-2016, Stanislav Galabov * Copyright (c) 2014, Aleksandr A. Mityaev * Copyright (c) 2011, Aleksandr Rybalko * based on hard work @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -69,8 +70,10 @@ __FBSDID("$FreeBSD$"); #include #include +#if 0 #include #include +#endif #ifdef IF_RT_PHY_SUPPORT #include "miibus_if.h" @@ -89,19 +92,20 @@ __FBSDID("$FreeBSD$"); #define RT_TX_WATCHDOG_TIMEOUT 5 #define RT_CHIPID_RT3050 0x3050 -#define RT_CHIPID_RT3052 0x3052 #define RT_CHIPID_RT5350 0x5350 -#define RT_CHIPID_RT6855 0x6855 #define RT_CHIPID_MT7620 0x7620 +#define RT_CHIPID_MT7621 0x7621 #ifdef FDT /* more specific and new models should go first */ static const struct ofw_compat_data rt_compat_data[] = { - { "ralink,rt6855-eth", (uintptr_t)RT_CHIPID_RT6855 }, - { "ralink,rt5350-eth", (uintptr_t)RT_CHIPID_RT5350 }, - { "ralink,rt3052-eth", (uintptr_t)RT_CHIPID_RT3052 }, - { "ralink,rt305x-eth", (uintptr_t)RT_CHIPID_RT3050 }, - { NULL, (uintptr_t)NULL } + { "ralink,rt3050-eth", RT_CHIPID_RT3050 }, + { "ralink,rt3352-eth", RT_CHIPID_RT3050 }, + { "ralink,rt3883-eth", RT_CHIPID_RT3050 }, + { "ralink,rt5350-eth", RT_CHIPID_RT5350 }, + { "ralink,mt7620a-eth", RT_CHIPID_MT7620 }, + { "ralink,mt7621-eth", RT_CHIPID_MT7621 }, + { NULL, 0 } }; #endif @@ -182,21 +186,23 @@ rt_probe(device_t dev) const struct ofw_compat_data * cd; cd = ofw_bus_search_compatible(dev, rt_compat_data); - if (cd->ocd_data == (uintptr_t)NULL) + if (cd->ocd_data == 0) return (ENXIO); sc->rt_chipid = (unsigned int)(cd->ocd_data); #else #if defined(MT7620) sc->rt_chipid = RT_CHIPID_MT7620; +#elif defined(MT7621) + sc->rt_chipid = RT_CHIPID_MT7621; #elif defined(RT5350) sc->rt_chipid = RT_CHIPID_RT5350; #else sc->rt_chipid = RT_CHIPID_RT3050; #endif #endif - snprintf(buf, sizeof(buf), "Ralink RT%x onChip Ethernet driver", - sc->rt_chipid); + snprintf(buf, sizeof(buf), "Ralink %cT%x onChip Ethernet driver", + sc->rt_chipid >= 0x7600 ? 'M' : 'R', sc->rt_chipid); device_set_desc_copy(dev, buf); return (BUS_PROBE_GENERIC); } @@ -373,12 +379,26 @@ rt_attach(device_t dev) /* Reset hardware */ reset_freng(sc); + + + if (sc->rt_chipid == RT_CHIPID_MT7620) { + sc->csum_fail_ip = MT7620_RXD_SRC_IP_CSUM_FAIL; + sc->csum_fail_l4 = MT7620_RXD_SRC_L4_CSUM_FAIL; + } else if (sc->rt_chipid == RT_CHIPID_MT7621) { + sc->csum_fail_ip = MT7621_RXD_SRC_IP_CSUM_FAIL; + sc->csum_fail_l4 = MT7621_RXD_SRC_L4_CSUM_FAIL; + } else { + sc->csum_fail_ip = RT305X_RXD_SRC_IP_CSUM_FAIL; + sc->csum_fail_l4 = RT305X_RXD_SRC_L4_CSUM_FAIL; + } /* Fill in soc-specific registers map */ switch(sc->rt_chipid) { case RT_CHIPID_MT7620: + case RT_CHIPID_MT7621: case RT_CHIPID_RT5350: - device_printf(dev, "RT%x Ethernet MAC (rev 0x%08x)\n", + device_printf(dev, "%cT%x Ethernet MAC (rev 0x%08x)\n", + sc->rt_chipid >= 0x7600 ? 'M' : 'R', sc->rt_chipid, sc->mac_rev); /* RT5350: No GDMA, PSE, CDMA, PPE */ RT_WRITE(sc, GE_PORT_BASE + 0x0C00, // UDPCS, TCPCS, IPCS=1 @@ -406,10 +426,6 @@ rt_attach(device_t dev) sc->int_rx_done_mask=RT5350_INT_RXQ0_DONE; sc->int_tx_done_mask=RT5350_INT_TXQ0_DONE; break; - case RT_CHIPID_RT6855: - device_printf(dev, "RT6855 Ethernet MAC (rev 0x%08x)\n", - sc->mac_rev); - break; default: device_printf(dev, "RT305XF Ethernet MAC (rev 0x%08x)\n", sc->mac_rev); @@ -533,7 +549,8 @@ rt_attach(device_t dev) /* set up interrupt */ error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, NULL, (sc->rt_chipid == RT_CHIPID_RT5350 || - sc->rt_chipid == RT_CHIPID_MT7620) ? rt_rt5350_intr : rt_intr, + sc->rt_chipid == RT_CHIPID_MT7620 || + sc->rt_chipid == RT_CHIPID_MT7621) ? rt_rt5350_intr : rt_intr, sc, &sc->irqh); if (error != 0) { printf("%s: could not set up interrupt\n", @@ -763,7 +780,7 @@ rt_init_locked(void *priv) //rt305x_sysctl_set(SYSCTL_RSTCTRL, SYSCTL_RSTCTRL_FRENG); /* Fwd to CPU (uni|broad|multi)cast and Unknown */ - if(sc->rt_chipid == RT_CHIPID_RT3050 || sc->rt_chipid == RT_CHIPID_RT3052) + if(sc->rt_chipid == RT_CHIPID_RT3050) RT_WRITE(sc, GDMA1_BASE + GDMA_FWD_CFG, ( GDM_ICS_EN | /* Enable IP Csum */ @@ -831,7 +848,8 @@ rt_init_locked(void *priv) /* write back DDONE, 16byte burst enable RX/TX DMA */ tmp = FE_TX_WB_DDONE | FE_DMA_BT_SIZE16 | FE_RX_DMA_EN | FE_TX_DMA_EN; - if (sc->rt_chipid == RT_CHIPID_MT7620) + if (sc->rt_chipid == RT_CHIPID_MT7620 || + sc->rt_chipid == RT_CHIPID_MT7621) tmp |= (1<<31); RT_WRITE(sc, sc->pdma_glo_cfg, tmp); @@ -843,7 +861,8 @@ rt_init_locked(void *priv) /* enable interrupts */ if (sc->rt_chipid == RT_CHIPID_RT5350 || - sc->rt_chipid == RT_CHIPID_MT7620) + sc->rt_chipid == RT_CHIPID_MT7620 || + sc->rt_chipid == RT_CHIPID_MT7621) tmp = RT5350_INT_TX_COHERENT | RT5350_INT_RX_COHERENT | RT5350_INT_TXQ3_DONE | @@ -945,7 +964,8 @@ rt_stop_locked(void *priv) RT_WRITE(sc, sc->fe_int_enable, 0); if(sc->rt_chipid == RT_CHIPID_RT5350 || - sc->rt_chipid == RT_CHIPID_MT7620) { + sc->rt_chipid == RT_CHIPID_MT7620 || + sc->rt_chipid == RT_CHIPID_MT7621) { } else { /* reset adapter */ RT_WRITE(sc, GE_PORT_BASE + FE_RST_GLO, PSE_RESET); @@ -1055,22 +1075,29 @@ rt_tx_data(struct rt_softc *sc, struct m /* TODO: this needs to be refined as MT7620 for example has * a different word3 layout than RT305x and RT5350 (the last - * one doesn't use word3 at all). + * one doesn't use word3 at all). And so does MT7621... */ - /* Set destination */ - if (sc->rt_chipid != RT_CHIPID_MT7620) - desc->dst = (TXDSCR_DST_PORT_GDMA1); - - if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) - desc->dst |= (TXDSCR_IP_CSUM_GEN|TXDSCR_UDP_CSUM_GEN| - TXDSCR_TCP_CSUM_GEN); - /* Set queue id */ - desc->qn = qid; - /* No PPPoE */ - desc->pppoe = 0; - /* No VLAN */ - desc->vid = 0; + if (sc->rt_chipid != RT_CHIPID_MT7621) { + /* Set destination */ + if (sc->rt_chipid != RT_CHIPID_MT7620) + desc->dst = (TXDSCR_DST_PORT_GDMA1); + + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) + desc->dst |= (TXDSCR_IP_CSUM_GEN | + TXDSCR_UDP_CSUM_GEN | TXDSCR_TCP_CSUM_GEN); + /* Set queue id */ + desc->qn = qid; + /* No PPPoE */ + desc->pppoe = 0; + /* No VLAN */ + desc->vid = 0; + } else { + desc->vid = 0; + desc->pppoe = 0; + desc->qn = 0; + desc->dst = 2; + } desc->sdp0 = htole32(dma_seg[i].ds_addr); desc->sdl0 = htole16(dma_seg[i].ds_len | @@ -1714,7 +1741,8 @@ rt_tx_done_task(void *context, int pendi ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; if(sc->rt_chipid == RT_CHIPID_RT5350 || - sc->rt_chipid == RT_CHIPID_MT7620) + sc->rt_chipid == RT_CHIPID_MT7620 || + sc->rt_chipid == RT_CHIPID_MT7621) intr_mask = ( RT5350_INT_TXQ3_DONE | RT5350_INT_TXQ2_DONE | @@ -1870,15 +1898,13 @@ rt_rx_eof(struct rt_softc *sc, struct rt BUS_DMASYNC_PREREAD); m = data->m; - desc_flags = desc->src; + desc_flags = desc->word3; data->m = mnew; /* Add 2 for proper align of RX IP header */ desc->sdp0 = htole32(segs[0].ds_addr+2); desc->sdl0 = htole32(segs[0].ds_len-2); - desc->src = 0; - desc->ai = 0; - desc->foe = 0; + desc->word3 = 0; RT_DPRINTF(sc, RT_DEBUG_RX, "Rx frame: rxdesc flags=0x%08x\n", desc_flags); @@ -1891,8 +1917,7 @@ rt_rx_eof(struct rt_softc *sc, struct rt /* check for crc errors */ if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) { /*check for valid checksum*/ - if (desc_flags & (RXDSXR_SRC_IP_CSUM_FAIL| - RXDSXR_SRC_L4_CSUM_FAIL)) { + if (desc_flags & (sc->csum_fail_ip|sc->csum_fail_l4)) { RT_DPRINTF(sc, RT_DEBUG_RX, "rxdesc: crc error\n"); @@ -1903,7 +1928,7 @@ rt_rx_eof(struct rt_softc *sc, struct rt goto skip; } } - if ((desc_flags & RXDSXR_SRC_IP_CSUM_FAIL) != 0) { + if ((desc_flags & sc->csum_fail_ip) == 0) { m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; m->m_pkthdr.csum_flags |= CSUM_IP_VALID; m->m_pkthdr.csum_data = 0xffff; @@ -2031,7 +2056,8 @@ rt_watchdog(struct rt_softc *sc) int ntries; #endif if(sc->rt_chipid != RT_CHIPID_RT5350 && - sc->rt_chipid != RT_CHIPID_MT7620) { + sc->rt_chipid != RT_CHIPID_MT7620 && + sc->rt_chipid != RT_CHIPID_MT7621) { tmp = RT_READ(sc, PSE_BASE + CDMA_OQ_STA); RT_DPRINTF(sc, RT_DEBUG_WATCHDOG, Modified: head/sys/dev/rt/if_rtvar.h ============================================================================== --- head/sys/dev/rt/if_rtvar.h Thu Apr 7 07:21:27 2016 (r297645) +++ head/sys/dev/rt/if_rtvar.h Thu Apr 7 07:22:22 2016 (r297646) @@ -115,12 +115,21 @@ struct rt_txdesc } __packed; #define RT_RXDESC_SDL0_DDONE (1 << 15) + +#define RT305X_RXD_SRC_L4_CSUM_FAIL (1 << 28) +#define RT305X_RXD_SRC_IP_CSUM_FAIL (1 << 29) +#define MT7620_RXD_SRC_L4_CSUM_FAIL (1 << 22) +#define MT7620_RXD_SRC_IP_CSUM_FAIL (1 << 25) +#define MT7621_RXD_SRC_L4_CSUM_FAIL (1 << 23) +#define MT7621_RXD_SRC_IP_CSUM_FAIL (1 << 26) + struct rt_rxdesc { uint32_t sdp0; uint16_t sdl1; uint16_t sdl0; uint32_t sdp1; +#if 0 uint16_t foe; #define RXDSXR_FOE_ENTRY_VALID 0x40 #define RXDSXR_FOE_ENTRY_MASK 0x3f @@ -134,6 +143,8 @@ struct rt_rxdesc #define RXDSXR_SRC_L4_CSUM_FAIL 0x10 #define RXDSXR_SRC_AIS 0x08 #define RXDSXR_SRC_PORT_MASK 0x07 +#endif + uint32_t word3; } __packed; struct rt_softc_rx_data @@ -263,6 +274,8 @@ struct rt_softc uint32_t rt_chipid; /* chip specific registers config */ int rx_ring_count; + uint32_t csum_fail_l4; + uint32_t csum_fail_ip; uint32_t int_rx_done_mask; uint32_t int_tx_done_mask; uint32_t delay_int_cfg; From owner-svn-src-all@freebsd.org Thu Apr 7 07:23:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3D67B06C32; Thu, 7 Apr 2016 07:23:22 +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 mx1.freebsd.org (Postfix) with ESMTPS id C0A8C12F7; Thu, 7 Apr 2016 07:23: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 u377NLNS075163; Thu, 7 Apr 2016 07:23:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377NLv4075162; Thu, 7 Apr 2016 07:23:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070723.u377NLv4075162@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:23:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r297647 - stable/9/sys/amd64/include X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:23:23 -0000 Author: hselasky Date: Thu Apr 7 07:23:21 2016 New Revision: 297647 URL: https://svnweb.freebsd.org/changeset/base/297647 Log: MFC r294526: Add missing atomic wrapper macro. Reviewed by: alfred @ Sponsored by: Mellanox Technologies Modified: stable/9/sys/amd64/include/atomic.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/include/atomic.h ============================================================================== --- stable/9/sys/amd64/include/atomic.h Thu Apr 7 07:22:22 2016 (r297646) +++ stable/9/sys/amd64/include/atomic.h Thu Apr 7 07:23:21 2016 (r297647) @@ -524,6 +524,7 @@ u_long atomic_swap_long(volatile u_long #define atomic_cmpset_rel_64 atomic_cmpset_rel_long #define atomic_swap_64 atomic_swap_long #define atomic_readandclear_64 atomic_readandclear_long +#define atomic_fetchadd_64 atomic_fetchadd_long #define atomic_testandset_64 atomic_testandset_long /* Operations on pointers. */ From owner-svn-src-all@freebsd.org Thu Apr 7 07:29:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDC29B06DFD; Thu, 7 Apr 2016 07:29: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 mx1.freebsd.org (Postfix) with ESMTPS id A37E71628; Thu, 7 Apr 2016 07:29: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 u377TvAG076048; Thu, 7 Apr 2016 07:29:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377Tv8B076046; Thu, 7 Apr 2016 07:29:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070729.u377Tv8B076046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:29:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297648 - stable/10/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:29:59 -0000 Author: hselasky Date: Thu Apr 7 07:29:57 2016 New Revision: 297648 URL: https://svnweb.freebsd.org/changeset/base/297648 Log: MFC r296909: Fix witness panic in the ipoib_ioctl() function when unloading the ipoib module. The bpfdetach() function is trying to turn off promiscious mode on the network interface it is attached to while holding a mutex. The fix consists of ignoring any further calls to the ipoib_ioctl() function when the network interface is going to be detached. The ipoib_ioctl() function might sleep. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Thu Apr 7 07:23:21 2016 (r297647) +++ stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Thu Apr 7 07:29:57 2016 (r297648) @@ -319,6 +319,8 @@ struct ipoib_dev_priv { unsigned long flags; + int gone; + struct mutex vlan_mutex; struct rb_root path_tree; Modified: stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Thu Apr 7 07:23:21 2016 (r297647) +++ stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Thu Apr 7 07:29:57 2016 (r297648) @@ -258,6 +258,10 @@ ipoib_ioctl(struct ifnet *ifp, u_long co struct ifreq *ifr = (struct ifreq *) data; int error = 0; + /* check if detaching */ + if (priv == NULL || priv->gone != 0) + return (ENXIO); + switch (command) { case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { @@ -794,6 +798,7 @@ ipoib_detach(struct ipoib_dev_priv *priv dev = priv->dev; if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { + priv->gone = 1; bpfdetach(dev); if_detach(dev); if_free(dev); From owner-svn-src-all@freebsd.org Thu Apr 7 07:31:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9003B06F5F; Thu, 7 Apr 2016 07:31:18 +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 mx1.freebsd.org (Postfix) with ESMTPS id 8B6021955; Thu, 7 Apr 2016 07:31:18 +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 u377VH8G076160; Thu, 7 Apr 2016 07:31:17 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377VHj1076158; Thu, 7 Apr 2016 07:31:17 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070731.u377VHj1076158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:31:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r297649 - stable/9/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:31:19 -0000 Author: hselasky Date: Thu Apr 7 07:31:17 2016 New Revision: 297649 URL: https://svnweb.freebsd.org/changeset/base/297649 Log: MFC r296909: Fix witness panic in the ipoib_ioctl() function when unloading the ipoib module. The bpfdetach() function is trying to turn off promiscious mode on the network interface it is attached to while holding a mutex. The fix consists of ignoring any further calls to the ipoib_ioctl() function when the network interface is going to be detached. The ipoib_ioctl() function might sleep. Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h ============================================================================== --- stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Thu Apr 7 07:29:57 2016 (r297648) +++ stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Thu Apr 7 07:31:17 2016 (r297649) @@ -319,6 +319,8 @@ struct ipoib_dev_priv { unsigned long flags; + int gone; + struct mutex vlan_mutex; struct rb_root path_tree; Modified: stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Thu Apr 7 07:29:57 2016 (r297648) +++ stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Thu Apr 7 07:31:17 2016 (r297649) @@ -258,6 +258,10 @@ ipoib_ioctl(struct ifnet *ifp, u_long co struct ifreq *ifr = (struct ifreq *) data; int error = 0; + /* check if detaching */ + if (priv == NULL || priv->gone != 0) + return (ENXIO); + switch (command) { case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { @@ -794,6 +798,7 @@ ipoib_detach(struct ipoib_dev_priv *priv dev = priv->dev; if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { + priv->gone = 1; bpfdetach(dev); if_detach(dev); if_free(dev); From owner-svn-src-all@freebsd.org Thu Apr 7 07:33:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 927E2B07003; Thu, 7 Apr 2016 07:33:41 +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 mx1.freebsd.org (Postfix) with ESMTPS id 5B6C31BB6; Thu, 7 Apr 2016 07:33:41 +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 u377XeBI079059; Thu, 7 Apr 2016 07:33:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377Xek4079057; Thu, 7 Apr 2016 07:33:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070733.u377Xek4079057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:33:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r297650 - stable/9/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:33:41 -0000 Author: hselasky Date: Thu Apr 7 07:33:40 2016 New Revision: 297650 URL: https://svnweb.freebsd.org/changeset/base/297650 Log: MFC r296910: Use hardware computed Toeplitz hash for incoming flowids Use the Toeplitz hash value as source for the flowid. This makes the hash value more suitable for so-called hash bucket algorithms which are used in the FreeBSD's TCP/IP stack when RSS is enabled. Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/drivers/net/mlx4/en_rx.c stable/9/sys/ofed/drivers/net/mlx4/en_tx.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/drivers/net/mlx4/en_rx.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_rx.c Thu Apr 7 07:31:17 2016 (r297649) +++ stable/9/sys/ofed/drivers/net/mlx4/en_rx.c Thu Apr 7 07:33:40 2016 (r297650) @@ -616,7 +616,8 @@ int mlx4_en_process_rx_cq(struct net_dev goto next; } - mb->m_pkthdr.flowid = cq->ring; + /* forward Toeplitz compatible hash value */ + mb->m_pkthdr.flowid = be32_to_cpu(cqe->immed_rss_invalid); mb->m_flags |= M_FLOWID; mb->m_pkthdr.rcvif = dev; if (be32_to_cpu(cqe->vlan_my_qpn) & Modified: stable/9/sys/ofed/drivers/net/mlx4/en_tx.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_tx.c Thu Apr 7 07:31:17 2016 (r297649) +++ stable/9/sys/ofed/drivers/net/mlx4/en_tx.c Thu Apr 7 07:33:40 2016 (r297650) @@ -1061,7 +1061,7 @@ mlx4_en_transmit(struct ifnet *dev, stru /* Compute which queue to use */ if (m->m_flags & M_FLOWID) { - i = m->m_pkthdr.flowid % priv->tx_ring_num; + i = (m->m_pkthdr.flowid % 128) % priv->tx_ring_num; } else { i = mlx4_en_select_queue(dev, m); From owner-svn-src-all@freebsd.org Thu Apr 7 07:35:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08BDDB0708C; Thu, 7 Apr 2016 07:35: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 mx1.freebsd.org (Postfix) with ESMTPS id C96D51D15; Thu, 7 Apr 2016 07:35: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 u377Z29O079165; Thu, 7 Apr 2016 07:35:02 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377Z2Eb079163; Thu, 7 Apr 2016 07:35:02 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070735.u377Z2Eb079163@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:35:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297651 - stable/10/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:35:04 -0000 Author: hselasky Date: Thu Apr 7 07:35:02 2016 New Revision: 297651 URL: https://svnweb.freebsd.org/changeset/base/297651 Log: MFC r296910: Use hardware computed Toeplitz hash for incoming flowids Use the Toeplitz hash value as source for the flowid. This makes the hash value more suitable for so-called hash bucket algorithms which are used in the FreeBSD's TCP/IP stack when RSS is enabled. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/en_rx.c stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/en_rx.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_rx.c Thu Apr 7 07:33:40 2016 (r297650) +++ stable/10/sys/ofed/drivers/net/mlx4/en_rx.c Thu Apr 7 07:35:02 2016 (r297651) @@ -616,7 +616,8 @@ int mlx4_en_process_rx_cq(struct net_dev goto next; } - mb->m_pkthdr.flowid = cq->ring; + /* forward Toeplitz compatible hash value */ + mb->m_pkthdr.flowid = be32_to_cpu(cqe->immed_rss_invalid); M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE); mb->m_pkthdr.rcvif = dev; if (be32_to_cpu(cqe->vlan_my_qpn) & Modified: stable/10/sys/ofed/drivers/net/mlx4/en_tx.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Thu Apr 7 07:33:40 2016 (r297650) +++ stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Thu Apr 7 07:35:02 2016 (r297651) @@ -1057,7 +1057,7 @@ mlx4_en_transmit(struct ifnet *dev, stru /* Compute which queue to use */ if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) { - i = m->m_pkthdr.flowid % priv->tx_ring_num; + i = (m->m_pkthdr.flowid % 128) % priv->tx_ring_num; } else { i = mlx4_en_select_queue(dev, m); From owner-svn-src-all@freebsd.org Thu Apr 7 07:36:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A64FB0713D; Thu, 7 Apr 2016 07:36:55 +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 mx1.freebsd.org (Postfix) with ESMTPS id 6BEA81E8A; Thu, 7 Apr 2016 07:36:55 +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 u377as4K079279; Thu, 7 Apr 2016 07:36:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377as8p079278; Thu, 7 Apr 2016 07:36:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070736.u377as8p079278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:36:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297652 - stable/10/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:36:55 -0000 Author: hselasky Date: Thu Apr 7 07:36:54 2016 New Revision: 297652 URL: https://svnweb.freebsd.org/changeset/base/297652 Log: MFC r296987: Add missing curly brackets in for loop. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/en_port.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/en_port.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_port.c Thu Apr 7 07:35:02 2016 (r297651) +++ stable/10/sys/ofed/drivers/net/mlx4/en_port.c Thu Apr 7 07:36:54 2016 (r297652) @@ -60,10 +60,11 @@ int mlx4_SET_VLAN_FLTR(struct mlx4_dev * memset(filter, 0, sizeof(*filter)); for (i = VLAN_FLTR_SIZE - 1; i >= 0; i--) { entry = 0; - for (j = 0; j < 32; j++) + for (j = 0; j < 32; j++) { if (test_bit(index, priv->active_vlans)) entry |= 1 << j; - index++; + index++; + } filter->entry[i] = cpu_to_be32(entry); } err = mlx4_cmd(dev, mailbox->dma, priv->port, 0, MLX4_CMD_SET_VLAN_FLTR, From owner-svn-src-all@freebsd.org Thu Apr 7 07:38:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB164B071B8; Thu, 7 Apr 2016 07:38:19 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9BD021FEA; Thu, 7 Apr 2016 07:38:19 +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 u377cIN4079383; Thu, 7 Apr 2016 07:38:18 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377cIYu079382; Thu, 7 Apr 2016 07:38:18 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070738.u377cIYu079382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:38:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r297653 - stable/9/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:38:19 -0000 Author: hselasky Date: Thu Apr 7 07:38:18 2016 New Revision: 297653 URL: https://svnweb.freebsd.org/changeset/base/297653 Log: MFC r296987: Add missing curly brackets in for loop. Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/drivers/net/mlx4/en_port.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/drivers/net/mlx4/en_port.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_port.c Thu Apr 7 07:36:54 2016 (r297652) +++ stable/9/sys/ofed/drivers/net/mlx4/en_port.c Thu Apr 7 07:38:18 2016 (r297653) @@ -60,10 +60,11 @@ int mlx4_SET_VLAN_FLTR(struct mlx4_dev * memset(filter, 0, sizeof(*filter)); for (i = VLAN_FLTR_SIZE - 1; i >= 0; i--) { entry = 0; - for (j = 0; j < 32; j++) + for (j = 0; j < 32; j++) { if (test_bit(index, priv->active_vlans)) entry |= 1 << j; - index++; + index++; + } filter->entry[i] = cpu_to_be32(entry); } err = mlx4_cmd(dev, mailbox->dma, priv->port, 0, MLX4_CMD_SET_VLAN_FLTR, From owner-svn-src-all@freebsd.org Thu Apr 7 07:39:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E556B07274; Thu, 7 Apr 2016 07:39:56 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4FC6F1180; Thu, 7 Apr 2016 07:39:56 +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 u377dtpB079484; Thu, 7 Apr 2016 07:39:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377dtow079483; Thu, 7 Apr 2016 07:39:55 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070739.u377dtow079483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:39:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r297654 - stable/9/sys/contrib/rdma/krping X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:39:56 -0000 Author: hselasky Date: Thu Apr 7 07:39:55 2016 New Revision: 297654 URL: https://svnweb.freebsd.org/changeset/base/297654 Log: MFC r296934: Fix crash in krping when run as a client due to NULL pointer access. Initialize pointer in question which is used only when fast registers mode is selected. Sponsored by: Mellanox Technologies Modified: stable/9/sys/contrib/rdma/krping/krping.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/contrib/rdma/krping/krping.c ============================================================================== --- stable/9/sys/contrib/rdma/krping/krping.c Thu Apr 7 07:38:18 2016 (r297653) +++ stable/9/sys/contrib/rdma/krping/krping.c Thu Apr 7 07:39:55 2016 (r297654) @@ -259,6 +259,7 @@ static int krping_cma_event_handler(stru case RDMA_CM_EVENT_ROUTE_RESOLVED: cb->state = ROUTE_RESOLVED; + cb->child_cm_id = cma_id; wake_up_interruptible(&cb->sem); break; From owner-svn-src-all@freebsd.org Thu Apr 7 07:41:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2516CB072DF; Thu, 7 Apr 2016 07:41: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 mx1.freebsd.org (Postfix) with ESMTPS id EAFF9134F; Thu, 7 Apr 2016 07:41:07 +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 u377f7ER079599; Thu, 7 Apr 2016 07:41:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377f7FO079598; Thu, 7 Apr 2016 07:41:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070741.u377f7FO079598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:41:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297655 - stable/10/sys/contrib/rdma/krping X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:41:08 -0000 Author: hselasky Date: Thu Apr 7 07:41:06 2016 New Revision: 297655 URL: https://svnweb.freebsd.org/changeset/base/297655 Log: MFC r296934: Fix crash in krping when run as a client due to NULL pointer access. Initialize pointer in question which is used only when fast registers mode is selected. Sponsored by: Mellanox Technologies Modified: stable/10/sys/contrib/rdma/krping/krping.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/contrib/rdma/krping/krping.c ============================================================================== --- stable/10/sys/contrib/rdma/krping/krping.c Thu Apr 7 07:39:55 2016 (r297654) +++ stable/10/sys/contrib/rdma/krping/krping.c Thu Apr 7 07:41:06 2016 (r297655) @@ -259,6 +259,7 @@ static int krping_cma_event_handler(stru case RDMA_CM_EVENT_ROUTE_RESOLVED: cb->state = ROUTE_RESOLVED; + cb->child_cm_id = cma_id; wake_up_interruptible(&cb->sem); break; From owner-svn-src-all@freebsd.org Thu Apr 7 07:44:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8A60B07482; Thu, 7 Apr 2016 07:44:02 +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 mx1.freebsd.org (Postfix) with ESMTPS id B90BF1734; Thu, 7 Apr 2016 07:44:02 +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 u377i1E4082339; Thu, 7 Apr 2016 07:44:01 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377i14f082338; Thu, 7 Apr 2016 07:44:01 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070744.u377i14f082338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:44:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297656 - stable/10/sys/ofed/include/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:44:03 -0000 Author: hselasky Date: Thu Apr 7 07:44:01 2016 New Revision: 297656 URL: https://svnweb.freebsd.org/changeset/base/297656 Log: MFC r297444: Fix bugs in currently unused bit searching loop. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/include/linux/bitops.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/include/linux/bitops.h ============================================================================== --- stable/10/sys/ofed/include/linux/bitops.h Thu Apr 7 07:41:06 2016 (r297655) +++ stable/10/sys/ofed/include/linux/bitops.h Thu Apr 7 07:44:01 2016 (r297656) @@ -138,11 +138,11 @@ find_last_bit(unsigned long *addr, unsig if (mask) return (bit + __flsl(mask)); } - while (--pos) { + while (pos--) { addr--; bit -= BITS_PER_LONG; if (*addr) - return (bit + __flsl(mask)); + return (bit + __flsl(*addr)); } return (size); } From owner-svn-src-all@freebsd.org Thu Apr 7 07:45:32 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95A47B07545; Thu, 7 Apr 2016 07:45: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 mx1.freebsd.org (Postfix) with ESMTPS id 63D5618FC; Thu, 7 Apr 2016 07:45: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 u377jVXN082444; Thu, 7 Apr 2016 07:45:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377jVBE082443; Thu, 7 Apr 2016 07:45:31 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070745.u377jVBE082443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:45:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r297657 - stable/9/sys/ofed/include/linux X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:45:32 -0000 Author: hselasky Date: Thu Apr 7 07:45:31 2016 New Revision: 297657 URL: https://svnweb.freebsd.org/changeset/base/297657 Log: MFC r297444: Fix bugs in currently unused bit searching loop. Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/include/linux/bitops.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/include/linux/bitops.h ============================================================================== --- stable/9/sys/ofed/include/linux/bitops.h Thu Apr 7 07:44:01 2016 (r297656) +++ stable/9/sys/ofed/include/linux/bitops.h Thu Apr 7 07:45:31 2016 (r297657) @@ -138,11 +138,11 @@ find_last_bit(unsigned long *addr, unsig if (mask) return (bit + __flsl(mask)); } - while (--pos) { + while (pos--) { addr--; bit -= BITS_PER_LONG; if (*addr) - return (bit + __flsl(mask)); + return (bit + __flsl(*addr)); } return (size); } From owner-svn-src-all@freebsd.org Thu Apr 7 07:52:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8592FB077CC; Thu, 7 Apr 2016 07:52:10 +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 mx1.freebsd.org (Postfix) with ESMTPS id 60AA31CDB; Thu, 7 Apr 2016 07:52:10 +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 u377q9w8082726; Thu, 7 Apr 2016 07:52:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377q9vg082724; Thu, 7 Apr 2016 07:52:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070752.u377q9vg082724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:52:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297658 - stable/10/sys/ofed/include/asm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:52:10 -0000 Author: hselasky Date: Thu Apr 7 07:52:09 2016 New Revision: 297658 URL: https://svnweb.freebsd.org/changeset/base/297658 Log: MFC r294520: LinuxKPI atomic fixes: - Fix implementation of atomic_add_unless(). The atomic_cmpset_int() function returns a boolean and not the previous value of the atomic variable. - The atomic counters should be signed according to Linux. - Some minor cosmetics and styling while at it. Reviewed by: alfred @ Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/include/asm/atomic-long.h stable/10/sys/ofed/include/asm/atomic.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/include/asm/atomic-long.h ============================================================================== --- stable/10/sys/ofed/include/asm/atomic-long.h Thu Apr 7 07:45:31 2016 (r297657) +++ stable/10/sys/ofed/include/asm/atomic-long.h Thu Apr 7 07:52:09 2016 (r297658) @@ -35,7 +35,7 @@ #include typedef struct { - volatile u_long counter; + volatile long counter; } atomic_long_t; #define atomic_long_add(i, v) atomic_long_add_return((i), (v)) Modified: stable/10/sys/ofed/include/asm/atomic.h ============================================================================== --- stable/10/sys/ofed/include/asm/atomic.h Thu Apr 7 07:45:31 2016 (r297657) +++ stable/10/sys/ofed/include/asm/atomic.h Thu Apr 7 07:52:09 2016 (r297658) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,9 +35,13 @@ #include typedef struct { - volatile u_int counter; + volatile int counter; } atomic_t; +/*------------------------------------------------------------------------* + * 32-bit atomic operations + *------------------------------------------------------------------------*/ + #define atomic_add(i, v) atomic_add_return((i), (v)) #define atomic_sub(i, v) atomic_sub_return((i), (v)) #define atomic_inc_return(v) atomic_add_return(1, (v)) @@ -45,7 +49,8 @@ typedef struct { #define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0) #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) #define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) -#define atomic_dec_return(v) atomic_sub_return(1, (v)) +#define atomic_dec_return(v) atomic_sub_return(1, (v)) +#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) static inline int atomic_add_return(int i, atomic_t *v) @@ -83,24 +88,19 @@ atomic_dec(atomic_t *v) return atomic_fetchadd_int(&v->counter, -1) - 1; } -static inline int atomic_add_unless(atomic_t *v, int a, int u) +static inline int +atomic_add_unless(atomic_t *v, int a, int u) { - int c, old; - c = atomic_read(v); - for (;;) { - if (unlikely(c == (u))) - break; - old = atomic_cmpset_int(&v->counter, c, c + (a)); - if (likely(old == c)) - break; - c = old; - } - return c != (u); -} - -#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) - - + int c; + for (;;) { + c = atomic_read(v); + if (unlikely(c == u)) + break; + if (likely(atomic_cmpset_int(&v->counter, c, c + a))) + break; + } + return (c != u); +} -#endif /* _ASM_ATOMIC_H_ */ +#endif /* _ASM_ATOMIC_H_ */ From owner-svn-src-all@freebsd.org Thu Apr 7 07:53:57 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A13D2B07888; Thu, 7 Apr 2016 07:53:57 +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 mx1.freebsd.org (Postfix) with ESMTPS id 7938D1E78; Thu, 7 Apr 2016 07:53:57 +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 u377rui7085414; Thu, 7 Apr 2016 07:53:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u377ruw6085412; Thu, 7 Apr 2016 07:53:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604070753.u377ruw6085412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Apr 2016 07:53:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r297659 - stable/9/sys/ofed/include/asm X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 07:53:57 -0000 Author: hselasky Date: Thu Apr 7 07:53:56 2016 New Revision: 297659 URL: https://svnweb.freebsd.org/changeset/base/297659 Log: MFC r294520: LinuxKPI atomic fixes: - Fix implementation of atomic_add_unless(). The atomic_cmpset_int() function returns a boolean and not the previous value of the atomic variable. - The atomic counters should be signed according to Linux. - Some minor cosmetics and styling while at it. Reviewed by: alfred @ Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/include/asm/atomic-long.h stable/9/sys/ofed/include/asm/atomic.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/include/asm/atomic-long.h ============================================================================== --- stable/9/sys/ofed/include/asm/atomic-long.h Thu Apr 7 07:52:09 2016 (r297658) +++ stable/9/sys/ofed/include/asm/atomic-long.h Thu Apr 7 07:53:56 2016 (r297659) @@ -35,7 +35,7 @@ #include typedef struct { - volatile u_long counter; + volatile long counter; } atomic_long_t; #define atomic_long_add(i, v) atomic_long_add_return((i), (v)) Modified: stable/9/sys/ofed/include/asm/atomic.h ============================================================================== --- stable/9/sys/ofed/include/asm/atomic.h Thu Apr 7 07:52:09 2016 (r297658) +++ stable/9/sys/ofed/include/asm/atomic.h Thu Apr 7 07:53:56 2016 (r297659) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,9 +35,13 @@ #include typedef struct { - volatile u_int counter; + volatile int counter; } atomic_t; +/*------------------------------------------------------------------------* + * 32-bit atomic operations + *------------------------------------------------------------------------*/ + #define atomic_add(i, v) atomic_add_return((i), (v)) #define atomic_sub(i, v) atomic_sub_return((i), (v)) #define atomic_inc_return(v) atomic_add_return(1, (v)) @@ -45,7 +49,8 @@ typedef struct { #define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0) #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) #define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) -#define atomic_dec_return(v) atomic_sub_return(1, (v)) +#define atomic_dec_return(v) atomic_sub_return(1, (v)) +#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) static inline int atomic_add_return(int i, atomic_t *v) @@ -83,24 +88,19 @@ atomic_dec(atomic_t *v) return atomic_fetchadd_int(&v->counter, -1) - 1; } -static inline int atomic_add_unless(atomic_t *v, int a, int u) +static inline int +atomic_add_unless(atomic_t *v, int a, int u) { - int c, old; - c = atomic_read(v); - for (;;) { - if (unlikely(c == (u))) - break; - old = atomic_cmpset_int(&v->counter, c, c + (a)); - if (likely(old == c)) - break; - c = old; - } - return c != (u); -} - -#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) - - + int c; + for (;;) { + c = atomic_read(v); + if (unlikely(c == u)) + break; + if (likely(atomic_cmpset_int(&v->counter, c, c + a))) + break; + } + return (c != u); +} -#endif /* _ASM_ATOMIC_H_ */ +#endif /* _ASM_ATOMIC_H_ */ From owner-svn-src-all@freebsd.org Thu Apr 7 08:31:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D6A6B065ED; Thu, 7 Apr 2016 08:31:53 +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 mx1.freebsd.org (Postfix) with ESMTPS id 089C71ECB; Thu, 7 Apr 2016 08:31:52 +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 u378Vq6V097442; Thu, 7 Apr 2016 08:31:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u378VqRm097439; Thu, 7 Apr 2016 08:31:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604070831.u378VqRm097439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 7 Apr 2016 08:31:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297660 - stable/10/sys/dev/ichwd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 08:31:53 -0000 Author: mav Date: Thu Apr 7 08:31:52 2016 New Revision: 297660 URL: https://svnweb.freebsd.org/changeset/base/297660 Log: MFC r286890 (by fabient): Add ichwd TCO version 3 support (Bay Trail / Rangeley...) Modified: stable/10/sys/dev/ichwd/ichwd.c stable/10/sys/dev/ichwd/ichwd.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ichwd/ichwd.c ============================================================================== --- stable/10/sys/dev/ichwd/ichwd.c Thu Apr 7 07:53:56 2016 (r297659) +++ stable/10/sys/dev/ichwd/ichwd.c Thu Apr 7 08:31:52 2016 (r297660) @@ -53,6 +53,7 @@ * (document no. 252516-001) sections 9.10 and 9.11. * * ICH6/7/8 support by Takeharu KATO + * SoC PMC support by Denir Li */ #include @@ -74,161 +75,216 @@ __FBSDID("$FreeBSD$"); #include static struct ichwd_device ichwd_devices[] = { - { DEVICEID_82801AA, "Intel 82801AA watchdog timer", 1 }, - { DEVICEID_82801AB, "Intel 82801AB watchdog timer", 1 }, - { DEVICEID_82801BA, "Intel 82801BA watchdog timer", 2 }, - { DEVICEID_82801BAM, "Intel 82801BAM watchdog timer", 2 }, - { DEVICEID_82801CA, "Intel 82801CA watchdog timer", 3 }, - { DEVICEID_82801CAM, "Intel 82801CAM watchdog timer", 3 }, - { DEVICEID_82801DB, "Intel 82801DB watchdog timer", 4 }, - { DEVICEID_82801DBM, "Intel 82801DBM watchdog timer", 4 }, - { DEVICEID_82801E, "Intel 82801E watchdog timer", 5 }, - { DEVICEID_82801EB, "Intel 82801EB watchdog timer", 5 }, - { DEVICEID_82801EBR, "Intel 82801EB/ER watchdog timer", 5 }, - { DEVICEID_6300ESB, "Intel 6300ESB watchdog timer", 5 }, - { DEVICEID_82801FBR, "Intel 82801FB/FR watchdog timer", 6 }, - { DEVICEID_ICH6M, "Intel ICH6M watchdog timer", 6 }, - { DEVICEID_ICH6W, "Intel ICH6W watchdog timer", 6 }, - { DEVICEID_ICH7, "Intel ICH7 watchdog timer", 7 }, - { DEVICEID_ICH7DH, "Intel ICH7DH watchdog timer", 7 }, - { DEVICEID_ICH7M, "Intel ICH7M watchdog timer", 7 }, - { DEVICEID_ICH7MDH, "Intel ICH7MDH watchdog timer", 7 }, - { DEVICEID_NM10, "Intel NM10 watchdog timer", 7 }, - { DEVICEID_ICH8, "Intel ICH8 watchdog timer", 8 }, - { DEVICEID_ICH8DH, "Intel ICH8DH watchdog timer", 8 }, - { DEVICEID_ICH8DO, "Intel ICH8DO watchdog timer", 8 }, - { DEVICEID_ICH8M, "Intel ICH8M watchdog timer", 8 }, - { DEVICEID_ICH8ME, "Intel ICH8M-E watchdog timer", 8 }, - { DEVICEID_63XXESB, "Intel 63XXESB watchdog timer", 8 }, - { DEVICEID_ICH9, "Intel ICH9 watchdog timer", 9 }, - { DEVICEID_ICH9DH, "Intel ICH9DH watchdog timer", 9 }, - { DEVICEID_ICH9DO, "Intel ICH9DO watchdog timer", 9 }, - { DEVICEID_ICH9M, "Intel ICH9M watchdog timer", 9 }, - { DEVICEID_ICH9ME, "Intel ICH9M-E watchdog timer", 9 }, - { DEVICEID_ICH9R, "Intel ICH9R watchdog timer", 9 }, - { DEVICEID_ICH10, "Intel ICH10 watchdog timer", 10 }, - { DEVICEID_ICH10D, "Intel ICH10D watchdog timer", 10 }, - { DEVICEID_ICH10DO, "Intel ICH10DO watchdog timer", 10 }, - { DEVICEID_ICH10R, "Intel ICH10R watchdog timer", 10 }, - { DEVICEID_PCH, "Intel PCH watchdog timer", 10 }, - { DEVICEID_PCHM, "Intel PCH watchdog timer", 10 }, - { DEVICEID_P55, "Intel P55 watchdog timer", 10 }, - { DEVICEID_PM55, "Intel PM55 watchdog timer", 10 }, - { DEVICEID_H55, "Intel H55 watchdog timer", 10 }, - { DEVICEID_QM57, "Intel QM57 watchdog timer", 10 }, - { DEVICEID_H57, "Intel H57 watchdog timer", 10 }, - { DEVICEID_HM55, "Intel HM55 watchdog timer", 10 }, - { DEVICEID_Q57, "Intel Q57 watchdog timer", 10 }, - { DEVICEID_HM57, "Intel HM57 watchdog timer", 10 }, - { DEVICEID_PCHMSFF, "Intel PCHMSFF watchdog timer", 10 }, - { DEVICEID_QS57, "Intel QS57 watchdog timer", 10 }, - { DEVICEID_3400, "Intel 3400 watchdog timer", 10 }, - { DEVICEID_3420, "Intel 3420 watchdog timer", 10 }, - { DEVICEID_3450, "Intel 3450 watchdog timer", 10 }, - { DEVICEID_CPT0, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT1, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT2, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT3, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT4, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT5, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT6, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT7, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT8, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT9, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT10, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT11, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT12, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT13, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT14, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT15, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT16, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT17, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT18, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT19, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT20, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT21, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT22, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT23, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT23, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT25, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT26, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT27, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT28, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT29, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT30, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_CPT31, "Intel Cougar Point watchdog timer", 10 }, - { DEVICEID_PATSBURG_LPC1, "Intel Patsburg watchdog timer", 10 }, - { DEVICEID_PATSBURG_LPC2, "Intel Patsburg watchdog timer", 10 }, - { DEVICEID_PPT0, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT1, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT2, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT3, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT4, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT5, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT6, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT7, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT8, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT9, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT10, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT11, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT12, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT13, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT14, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT15, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT16, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT17, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT18, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT19, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT20, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT21, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT22, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT23, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT24, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT25, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT26, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT27, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT28, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT29, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT30, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_PPT31, "Intel Panther Point watchdog timer", 10 }, - { DEVICEID_LPT0, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT1, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT2, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT3, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT4, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT5, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT6, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT7, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT8, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT9, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT10, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT11, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT12, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT13, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT14, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT15, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT16, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT17, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT18, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT19, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT20, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT21, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT22, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT23, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT24, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT25, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT26, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT27, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT28, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT29, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT30, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_LPT31, "Intel Lynx Point watchdog timer", 10 }, - { DEVICEID_WCPT2, "Intel Wildcat Point watchdog timer", 10 }, - { DEVICEID_WCPT4, "Intel Wildcat Point watchdog timer", 10 }, - { DEVICEID_WCPT6, "Intel Wildcat Point watchdog timer", 10 }, - { DEVICEID_DH89XXCC_LPC, "Intel DH89xxCC watchdog timer", 10 }, - { DEVICEID_COLETOCRK_LPC, "Intel Coleto Creek watchdog timer", 10 }, - { 0, NULL, 0 }, + { DEVICEID_82801AA, "Intel 82801AA watchdog timer", 1, 1 }, + { DEVICEID_82801AB, "Intel 82801AB watchdog timer", 1, 1 }, + { DEVICEID_82801BA, "Intel 82801BA watchdog timer", 2, 1 }, + { DEVICEID_82801BAM, "Intel 82801BAM watchdog timer", 2, 1 }, + { DEVICEID_82801CA, "Intel 82801CA watchdog timer", 3, 1 }, + { DEVICEID_82801CAM, "Intel 82801CAM watchdog timer", 3, 1 }, + { DEVICEID_82801DB, "Intel 82801DB watchdog timer", 4, 1 }, + { DEVICEID_82801DBM, "Intel 82801DBM watchdog timer", 4, 1 }, + { DEVICEID_82801E, "Intel 82801E watchdog timer", 5, 1 }, + { DEVICEID_82801EB, "Intel 82801EB watchdog timer", 5, 1 }, + { DEVICEID_82801EBR, "Intel 82801EB/ER watchdog timer", 5, 1 }, + { DEVICEID_6300ESB, "Intel 6300ESB watchdog timer", 5, 1 }, + { DEVICEID_82801FBR, "Intel 82801FB/FR watchdog timer", 6, 2 }, + { DEVICEID_ICH6M, "Intel ICH6M watchdog timer", 6, 2 }, + { DEVICEID_ICH6W, "Intel ICH6W watchdog timer", 6, 2 }, + { DEVICEID_ICH7, "Intel ICH7 watchdog timer", 7, 2 }, + { DEVICEID_ICH7DH, "Intel ICH7DH watchdog timer", 7, 2 }, + { DEVICEID_ICH7M, "Intel ICH7M watchdog timer", 7, 2 }, + { DEVICEID_ICH7MDH, "Intel ICH7MDH watchdog timer", 7, 2 }, + { DEVICEID_NM10, "Intel NM10 watchdog timer", 7, 2 }, + { DEVICEID_ICH8, "Intel ICH8 watchdog timer", 8, 2 }, + { DEVICEID_ICH8DH, "Intel ICH8DH watchdog timer", 8, 2 }, + { DEVICEID_ICH8DO, "Intel ICH8DO watchdog timer", 8, 2 }, + { DEVICEID_ICH8M, "Intel ICH8M watchdog timer", 8, 2 }, + { DEVICEID_ICH8ME, "Intel ICH8M-E watchdog timer", 8, 2 }, + { DEVICEID_63XXESB, "Intel 63XXESB watchdog timer", 8, 2 }, + { DEVICEID_ICH9, "Intel ICH9 watchdog timer", 9, 2 }, + { DEVICEID_ICH9DH, "Intel ICH9DH watchdog timer", 9, 2 }, + { DEVICEID_ICH9DO, "Intel ICH9DO watchdog timer", 9, 2 }, + { DEVICEID_ICH9M, "Intel ICH9M watchdog timer", 9, 2 }, + { DEVICEID_ICH9ME, "Intel ICH9M-E watchdog timer", 9, 2 }, + { DEVICEID_ICH9R, "Intel ICH9R watchdog timer", 9, 2 }, + { DEVICEID_ICH10, "Intel ICH10 watchdog timer", 10, 2 }, + { DEVICEID_ICH10D, "Intel ICH10D watchdog timer", 10, 2 }, + { DEVICEID_ICH10DO, "Intel ICH10DO watchdog timer", 10, 2 }, + { DEVICEID_ICH10R, "Intel ICH10R watchdog timer", 10, 2 }, + { DEVICEID_PCH, "Intel PCH watchdog timer", 10, 2 }, + { DEVICEID_PCHM, "Intel PCH watchdog timer", 10, 2 }, + { DEVICEID_P55, "Intel P55 watchdog timer", 10, 2 }, + { DEVICEID_PM55, "Intel PM55 watchdog timer", 10, 2 }, + { DEVICEID_H55, "Intel H55 watchdog timer", 10, 2 }, + { DEVICEID_QM57, "Intel QM57 watchdog timer", 10, 2 }, + { DEVICEID_H57, "Intel H57 watchdog timer", 10, 2 }, + { DEVICEID_HM55, "Intel HM55 watchdog timer", 10, 2 }, + { DEVICEID_Q57, "Intel Q57 watchdog timer", 10, 2 }, + { DEVICEID_HM57, "Intel HM57 watchdog timer", 10, 2 }, + { DEVICEID_PCHMSFF, "Intel PCHMSFF watchdog timer", 10, 2 }, + { DEVICEID_QS57, "Intel QS57 watchdog timer", 10, 2 }, + { DEVICEID_3400, "Intel 3400 watchdog timer", 10, 2 }, + { DEVICEID_3420, "Intel 3420 watchdog timer", 10, 2 }, + { DEVICEID_3450, "Intel 3450 watchdog timer", 10, 2 }, + { DEVICEID_CPT0, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT1, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT2, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT3, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT4, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT5, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT6, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT7, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT8, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT9, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT10, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT11, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT12, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT13, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT14, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT15, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT16, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT17, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT18, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT19, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT20, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT21, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT22, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT23, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT24, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT25, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT26, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT27, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT28, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT29, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT30, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_CPT31, "Intel Cougar Point watchdog timer", 10, 2 }, + { DEVICEID_PATSBURG_LPC1, "Intel Patsburg watchdog timer", 10, 2 }, + { DEVICEID_PATSBURG_LPC2, "Intel Patsburg watchdog timer", 10, 2 }, + { DEVICEID_PPT0, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT1, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT2, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT3, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT4, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT5, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT6, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT7, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT8, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT9, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT10, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT11, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT12, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT13, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT14, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT15, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT16, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT17, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT18, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT19, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT20, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT21, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT22, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT23, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT24, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT25, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT26, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT27, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT28, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT29, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT30, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_PPT31, "Intel Panther Point watchdog timer", 10, 2 }, + { DEVICEID_LPT0, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT1, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT2, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT3, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT4, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT5, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT6, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT7, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT8, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT9, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT10, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT11, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT12, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT13, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT14, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT15, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT16, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT17, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT18, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT19, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT20, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT21, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT22, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT23, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT24, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT25, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT26, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT27, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT28, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT29, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT30, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_LPT31, "Intel Lynx Point watchdog timer", 10, 2 }, + { DEVICEID_WCPT1, "Intel Wildcat Point watchdog timer", 10, 2 }, + { DEVICEID_WCPT2, "Intel Wildcat Point watchdog timer", 10, 2 }, + { DEVICEID_WCPT3, "Intel Wildcat Point watchdog timer", 10, 2 }, + { DEVICEID_WCPT4, "Intel Wildcat Point watchdog timer", 10, 2 }, + { DEVICEID_WCPT6, "Intel Wildcat Point watchdog timer", 10, 2 }, + { DEVICEID_WBG0, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG1, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG2, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG3, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG4, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG5, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG6, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG7, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG8, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG9, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG10, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG11, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG12, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG13, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG14, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG15, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG16, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG17, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG18, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG19, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG20, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG21, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG22, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG23, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG24, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG25, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG26, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG27, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG28, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG29, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG30, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_WBG31, "Intel Wellsburg watchdog timer", 10, 2 }, + { DEVICEID_LPT_LP0, "Intel Lynx Point-LP watchdog timer", 10, 2 }, + { DEVICEID_LPT_LP1, "Intel Lynx Point-LP watchdog timer", 10, 2 }, + { DEVICEID_LPT_LP2, "Intel Lynx Point-LP watchdog timer", 10, 2 }, + { DEVICEID_LPT_LP3, "Intel Lynx Point-LP watchdog timer", 10, 2 }, + { DEVICEID_LPT_LP4, "Intel Lynx Point-LP watchdog timer", 10, 2 }, + { DEVICEID_LPT_LP5, "Intel Lynx Point-LP watchdog timer", 10, 2 }, + { DEVICEID_LPT_LP6, "Intel Lynx Point-LP watchdog timer", 10, 2 }, + { DEVICEID_LPT_LP7, "Intel Lynx Point-LP watchdog timer", 10, 2 }, + { DEVICEID_WCPT_LP1, "Intel Wildcat Point-LP watchdog timer", 10, 2 }, + { DEVICEID_WCPT_LP2, "Intel Wildcat Point-LP watchdog timer", 10, 2 }, + { DEVICEID_WCPT_LP3, "Intel Wildcat Point-LP watchdog timer", 10, 2 }, + { DEVICEID_WCPT_LP5, "Intel Wildcat Point-LP watchdog timer", 10, 2 }, + { DEVICEID_WCPT_LP6, "Intel Wildcat Point-LP watchdog timer", 10, 2 }, + { DEVICEID_WCPT_LP7, "Intel Wildcat Point-LP watchdog timer", 10, 2 }, + { DEVICEID_WCPT_LP9, "Intel Wildcat Point-LP watchdog timer", 10, 2 }, + { DEVICEID_DH89XXCC_LPC, "Intel DH89xxCC watchdog timer", 10, 2 }, + { DEVICEID_COLETOCRK_LPC, "Intel Coleto Creek watchdog timer", 10, 2 }, + { DEVICEID_AVN0, "Intel Avoton/Rangeley SoC watchdog timer",10, 3 }, + { DEVICEID_AVN1, "Intel Avoton/Rangeley SoC watchdog timer",10, 3 }, + { DEVICEID_AVN2, "Intel Avoton/Rangeley SoC watchdog timer",10, 3 }, + { DEVICEID_AVN3, "Intel Avoton/Rangeley SoC watchdog timer",10, 3 }, + { DEVICEID_BAYTRAIL, "Intel Bay Trail SoC watchdog timer", 10, 3 }, + { DEVICEID_BRASWELL, "Intel Braswell SoC watchdog timer", 10, 3 }, + { 0, NULL, 0, 0 }, }; static devclass_t ichwd_devclass; @@ -243,6 +299,9 @@ static devclass_t ichwd_devclass; bus_read_4((sc)->smi_res, (off)) #define ichwd_read_gcs_4(sc, off) \ bus_read_4((sc)->gcs_res, (off)) +/* NB: TCO version 3 devices use the gcs_res resource for the PMC register. */ +#define ichwd_read_pmc_4(sc, off) \ + bus_read_4((sc)->gcs_res, (off)) #define ichwd_write_tco_1(sc, off, val) \ bus_write_1((sc)->tco_res, (off), (val)) @@ -254,6 +313,9 @@ static devclass_t ichwd_devclass; bus_write_4((sc)->smi_res, (off), (val)) #define ichwd_write_gcs_4(sc, off, val) \ bus_write_4((sc)->gcs_res, (off), (val)) +/* NB: TCO version 3 devices use the gcs_res resource for the PMC register. */ +#define ichwd_write_pmc_4(sc, off, val) \ + bus_write_4((sc)->gcs_res, (off), (val)) #define ichwd_verbose_printf(dev, ...) \ do { \ @@ -352,7 +414,7 @@ ichwd_tmr_disable(struct ichwd_softc *sc static __inline void ichwd_tmr_reload(struct ichwd_softc *sc) { - if (sc->ich_version <= 5) + if (sc->tco_version == 1) ichwd_write_tco_1(sc, TCO_RLD, 1); else ichwd_write_tco_2(sc, TCO_RLD, 1); @@ -369,7 +431,7 @@ ichwd_tmr_set(struct ichwd_softc *sc, un if (timeout < TCO_RLD_TMR_MIN) timeout = TCO_RLD_TMR_MIN; - if (sc->ich_version <= 5) { + if (sc->tco_version == 1) { uint8_t tmr_val8 = ichwd_read_tco_1(sc, TCO_TMR1); tmr_val8 &= (~TCO_RLD1_TMR_MAX & 0xff); @@ -399,20 +461,36 @@ ichwd_clear_noreboot(struct ichwd_softc int rc = 0; /* try to clear the NO_REBOOT bit */ - if (sc->ich_version <= 5) { + switch (sc->tco_version) { + case 1: status = pci_read_config(sc->ich, ICH_GEN_STA, 1); status &= ~ICH_GEN_STA_NO_REBOOT; pci_write_config(sc->ich, ICH_GEN_STA, status, 1); status = pci_read_config(sc->ich, ICH_GEN_STA, 1); if (status & ICH_GEN_STA_NO_REBOOT) rc = EIO; - } else { + break; + case 2: status = ichwd_read_gcs_4(sc, 0); status &= ~ICH_GCS_NO_REBOOT; ichwd_write_gcs_4(sc, 0, status); status = ichwd_read_gcs_4(sc, 0); if (status & ICH_GCS_NO_REBOOT) rc = EIO; + break; + case 3: + status = ichwd_read_pmc_4(sc, 0); + status &= ~ICH_PMC_NO_REBOOT; + ichwd_write_pmc_4(sc, 0, status); + status = ichwd_read_pmc_4(sc, 0); + if (status & ICH_PMC_NO_REBOOT) + rc = EIO; + break; + default: + ichwd_verbose_printf(sc->device, + "Unknown TCO Version: %d, can't set NO_REBOOT.\n", + sc->tco_version); + break; } if (rc) @@ -463,7 +541,7 @@ ichwd_find_ich_lpc_bridge(struct ichwd_d return (NULL); ichwd_verbose_printf(ich, "found ICH%d or equivalent chipset: %s\n", - id->version, id->desc); + id->ich_version, id->desc); if (id_p) *id_p = id; @@ -481,7 +559,7 @@ ichwd_identify(driver_t *driver, device_ struct ichwd_device *id_p; device_t ich = NULL; device_t dev; - uint32_t rcba; + uint32_t base_address; int rc; ich = ichwd_find_ich_lpc_bridge(&id_p); @@ -497,14 +575,36 @@ ichwd_identify(driver_t *driver, device_ device_set_desc_copy(dev, id_p->desc); - if (id_p->version >= 6) { + switch (id_p->tco_version) { + case 1: + break; + case 2: /* get RCBA (root complex base address) */ - rcba = pci_read_config(ich, ICH_RCBA, 4); + base_address = pci_read_config(ich, ICH_RCBA, 4); + rc = bus_set_resource(ich, SYS_RES_MEMORY, 0, + (base_address & 0xffffc000) + ICH_GCS_OFFSET, + ICH_GCS_SIZE); + if (rc) + ichwd_verbose_printf(dev, + "Can not set TCO v%d memory resource for RCBA\n", + id_p->tco_version); + break; + case 3: + /* get PBASE (Power Management Controller base address) */ + base_address = pci_read_config(ich, ICH_PBASE, 4); rc = bus_set_resource(ich, SYS_RES_MEMORY, 0, - (rcba & 0xffffc000) + ICH_GCS_OFFSET, ICH_GCS_SIZE); + (base_address & 0xfffffe00) + ICH_PMC_OFFSET, + ICH_PMC_SIZE); if (rc) ichwd_verbose_printf(dev, - "Can not set memory resource for RCBA\n"); + "Can not set TCO v%d memory resource for PBASE\n", + id_p->tco_version); + break; + default: + ichwd_verbose_printf(dev, + "Can not set unknown TCO v%d memory resource for unknown base address\n", + id_p->tco_version); + break; } } @@ -535,7 +635,8 @@ ichwd_attach(device_t dev) goto fail; } sc->ich = ich; - sc->ich_version = id_p->version; + sc->ich_version = id_p->ich_version; + sc->tco_version = id_p->tco_version; /* get ACPI base address */ pmbase = pci_read_config(ich, ICH_PMBASE, 2) & ICH_PMBASE_MASK; @@ -564,7 +665,7 @@ ichwd_attach(device_t dev) } sc->gcs_rid = 0; - if (sc->ich_version >= 6) { + if (sc->tco_version >= 2) { sc->gcs_res = bus_alloc_resource_any(ich, SYS_RES_MEMORY, &sc->gcs_rid, RF_ACTIVE|RF_SHAREABLE); if (sc->gcs_res == NULL) { @@ -577,7 +678,7 @@ ichwd_attach(device_t dev) goto fail; ichwd_verbose_printf(dev, "%s (ICH%d or equivalent)\n", - device_get_desc(dev), sc->ich_version); + id_p->desc, sc->ich_version); /* * Determine if we are coming up after a watchdog-induced reset. Some @@ -648,7 +749,8 @@ ichwd_detach(device_t dev) /* deallocate memory resource */ ich = ichwd_find_ich_lpc_bridge(NULL); if (sc->gcs_res && ich) - bus_release_resource(ich, SYS_RES_MEMORY, sc->gcs_rid, sc->gcs_res); + bus_release_resource(ich, SYS_RES_MEMORY, sc->gcs_rid, + sc->gcs_res); return (0); } Modified: stable/10/sys/dev/ichwd/ichwd.h ============================================================================== --- stable/10/sys/dev/ichwd/ichwd.h Thu Apr 7 07:53:56 2016 (r297659) +++ stable/10/sys/dev/ichwd/ichwd.h Thu Apr 7 08:31:52 2016 (r297660) @@ -34,13 +34,15 @@ struct ichwd_device { uint16_t device; char *desc; - unsigned int version; + unsigned int ich_version; + unsigned int tco_version; }; struct ichwd_softc { device_t device; device_t ich; int ich_version; + int tco_version; int active; unsigned int timeout; @@ -59,6 +61,7 @@ struct ichwd_softc { }; #define VENDORID_INTEL 0x8086 +#define DEVICEID_BAYTRAIL 0x0f1c #define DEVICEID_CPT0 0x1c40 #define DEVICEID_CPT1 0x1c41 #define DEVICEID_CPT2 0x1c42 @@ -125,6 +128,11 @@ struct ichwd_softc { #define DEVICEID_PPT29 0x1e5d #define DEVICEID_PPT30 0x1e5e #define DEVICEID_PPT31 0x1e5f +#define DEVICEID_AVN0 0x1f38 +#define DEVICEID_AVN1 0x1f39 +#define DEVICEID_AVN2 0x1f3a +#define DEVICEID_AVN3 0x1f3b +#define DEVICEID_BRASWELL 0x229c #define DEVICEID_DH89XXCC_LPC 0x2310 #define DEVICEID_COLETOCRK_LPC 0x2390 #define DEVICEID_82801AA 0x2410 @@ -210,9 +218,58 @@ struct ichwd_softc { #define DEVICEID_LPT29 0x8c5d #define DEVICEID_LPT30 0x8c5e #define DEVICEID_LPT31 0x8c5f +#define DEVICEID_WCPT1 0x8cc1 #define DEVICEID_WCPT2 0x8cc2 +#define DEVICEID_WCPT3 0x8cc3 #define DEVICEID_WCPT4 0x8cc4 #define DEVICEID_WCPT6 0x8cc6 +#define DEVICEID_WBG0 0x8d40 +#define DEVICEID_WBG1 0x8d41 +#define DEVICEID_WBG2 0x8d42 +#define DEVICEID_WBG3 0x8d43 +#define DEVICEID_WBG4 0x8d44 +#define DEVICEID_WBG5 0x8d45 +#define DEVICEID_WBG6 0x8d46 +#define DEVICEID_WBG7 0x8d47 +#define DEVICEID_WBG8 0x8d48 +#define DEVICEID_WBG9 0x8d49 +#define DEVICEID_WBG10 0x8d4a +#define DEVICEID_WBG11 0x8d4b +#define DEVICEID_WBG12 0x8d4c +#define DEVICEID_WBG13 0x8d4d +#define DEVICEID_WBG14 0x8d4e +#define DEVICEID_WBG15 0x8d4f +#define DEVICEID_WBG16 0x8d50 +#define DEVICEID_WBG17 0x8d51 +#define DEVICEID_WBG18 0x8d52 +#define DEVICEID_WBG19 0x8d53 +#define DEVICEID_WBG20 0x8d54 +#define DEVICEID_WBG21 0x8d55 +#define DEVICEID_WBG22 0x8d56 +#define DEVICEID_WBG23 0x8d57 +#define DEVICEID_WBG24 0x8d58 +#define DEVICEID_WBG25 0x8d59 +#define DEVICEID_WBG26 0x8d5a +#define DEVICEID_WBG27 0x8d5b +#define DEVICEID_WBG28 0x8d5c +#define DEVICEID_WBG29 0x8d5d +#define DEVICEID_WBG30 0x8d5e +#define DEVICEID_WBG31 0x8d5f +#define DEVICEID_LPT_LP0 0x9c40 +#define DEVICEID_LPT_LP1 0x9c41 +#define DEVICEID_LPT_LP2 0x9c42 +#define DEVICEID_LPT_LP3 0x9c43 +#define DEVICEID_LPT_LP4 0x9c44 +#define DEVICEID_LPT_LP5 0x9c45 +#define DEVICEID_LPT_LP6 0x9c46 +#define DEVICEID_LPT_LP7 0x9c47 +#define DEVICEID_WCPT_LP1 0x9cc1 +#define DEVICEID_WCPT_LP2 0x9cc2 +#define DEVICEID_WCPT_LP3 0x9cc3 +#define DEVICEID_WCPT_LP5 0x9cc5 +#define DEVICEID_WCPT_LP6 0x9cc6 +#define DEVICEID_WCPT_LP7 0x9cc7 +#define DEVICEID_WCPT_LP9 0x9cc9 /* ICH LPC Interface Bridge Registers (ICH5 and older) */ #define ICH_GEN_STA 0xd4 @@ -226,6 +283,12 @@ struct ichwd_softc { #define ICH_GCS_SIZE 0x4 #define ICH_GCS_NO_REBOOT 0x20 +/* SoC Power Management Configuration Registers */ +#define ICH_PBASE 0x44 +#define ICH_PMC_OFFSET 0x08 +#define ICH_PMC_SIZE 0x4 +#define ICH_PMC_NO_REBOOT 0x10 + /* register names and locations (relative to PMBASE) */ #define SMI_BASE 0x30 /* base address for SMI registers */ #define SMI_LEN 0x08 From owner-svn-src-all@freebsd.org Thu Apr 7 08:32:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54A8EB06679; Thu, 7 Apr 2016 08:32:38 +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 mx1.freebsd.org (Postfix) with ESMTPS id 21B9810A9; Thu, 7 Apr 2016 08:32:38 +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 u378Wbfw097520; Thu, 7 Apr 2016 08:32:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u378WbJA097519; Thu, 7 Apr 2016 08:32:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604070832.u378WbJA097519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 7 Apr 2016 08:32:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297661 - stable/10/sys/dev/ichwd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 08:32:38 -0000 Author: mav Date: Thu Apr 7 08:32:37 2016 New Revision: 297661 URL: https://svnweb.freebsd.org/changeset/base/297661 Log: MFC r297255: Unify ichwd(4) attachment messages in dmesg. Modified: stable/10/sys/dev/ichwd/ichwd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ichwd/ichwd.c ============================================================================== --- stable/10/sys/dev/ichwd/ichwd.c Thu Apr 7 08:31:52 2016 (r297660) +++ stable/10/sys/dev/ichwd/ichwd.c Thu Apr 7 08:32:37 2016 (r297661) @@ -540,9 +540,6 @@ ichwd_find_ich_lpc_bridge(struct ichwd_d if (ich == NULL) return (NULL); - ichwd_verbose_printf(ich, "found ICH%d or equivalent chipset: %s\n", - id->ich_version, id->desc); - if (id_p) *id_p = id; @@ -573,8 +570,6 @@ ichwd_identify(driver_t *driver, device_ if (dev == NULL) return; - device_set_desc_copy(dev, id_p->desc); - switch (id_p->tco_version) { case 1: break; @@ -611,10 +606,16 @@ ichwd_identify(driver_t *driver, device_ static int ichwd_probe(device_t dev) { + struct ichwd_device *id_p; /* Do not claim some ISA PnP device by accident. */ if (isa_get_logicalid(dev) != 0) return (ENXIO); + + if (ichwd_find_ich_lpc_bridge(&id_p) == NULL) + return (ENXIO); + + device_set_desc_copy(dev, id_p->desc); return (0); } @@ -677,9 +678,6 @@ ichwd_attach(device_t dev) if (ichwd_clear_noreboot(sc) != 0) goto fail; - ichwd_verbose_printf(dev, "%s (ICH%d or equivalent)\n", - id_p->desc, sc->ich_version); - /* * Determine if we are coming up after a watchdog-induced reset. Some * BIOSes may clear this bit at bootup, preventing us from reporting From owner-svn-src-all@freebsd.org Thu Apr 7 09:10:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2AA11B076D6; Thu, 7 Apr 2016 09:10:36 +0000 (UTC) (envelope-from rrs@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 mx1.freebsd.org (Postfix) with ESMTPS id BA25C1FE2; Thu, 7 Apr 2016 09:10:35 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u379AZZR007126; Thu, 7 Apr 2016 09:10:35 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u379AYhh007120; Thu, 7 Apr 2016 09:10:34 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201604070910.u379AYhh007120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Thu, 7 Apr 2016 09:10:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297662 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 09:10:36 -0000 Author: rrs Date: Thu Apr 7 09:10:34 2016 New Revision: 297662 URL: https://svnweb.freebsd.org/changeset/base/297662 Log: This is work done by Michael Tuexen and myself at the IETF. This adds the new I-Data (Interleaved Data) message. This allows a user to be able to have complete freedom from Head Of Line blocking that was previously there due to the in-ability to send multiple large messages without the TSN's being in sequence. The code as been tested with Michaels various packet drill scripts as well as inter-networking between the IETF's location in Argentina and Germany. Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_dtrace_define.h head/sys/netinet/sctp_header.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_indata.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_os_bsd.h head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_pcb.h head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctp_uio.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctp_var.h head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h Modified: head/sys/netinet/sctp.h ============================================================================== --- head/sys/netinet/sctp.h Thu Apr 7 08:32:37 2016 (r297661) +++ head/sys/netinet/sctp.h Thu Apr 7 09:10:34 2016 (r297662) @@ -196,6 +196,9 @@ struct sctp_paramhdr { #define SCTP_SS_VALUE 0x00001204 #define SCTP_CC_OPTION 0x00001205 /* Options for CC * modules */ +/* For I-DATA */ +#define SCTP_INTERLEAVING_SUPPORTED 0x00001206 + /* read only */ #define SCTP_GET_SNDBUF_USE 0x00001101 #define SCTP_GET_STAT_LOG 0x00001103 @@ -452,6 +455,7 @@ struct sctp_error_auth_invalid_hmac { /* EY nr_sack chunk id*/ #define SCTP_NR_SELECTIVE_ACK 0x10 /************0x40 series ***********/ +#define SCTP_IDATA 0x40 /************0x80 series ***********/ /* RFC5061 */ #define SCTP_ASCONF_ACK 0x80 @@ -467,7 +471,7 @@ struct sctp_error_auth_invalid_hmac { #define SCTP_FORWARD_CUM_TSN 0xc0 /* RFC5061 */ #define SCTP_ASCONF 0xc1 - +#define SCTP_IFORWARD_CUM_TSN 0xc2 /* ABORT and SHUTDOWN COMPLETE FLAG */ #define SCTP_HAD_NO_TCB 0x01 Modified: head/sys/netinet/sctp_constants.h ============================================================================== --- head/sys/netinet/sctp_constants.h Thu Apr 7 08:32:37 2016 (r297661) +++ head/sys/netinet/sctp_constants.h Thu Apr 7 09:10:34 2016 (r297662) @@ -386,8 +386,8 @@ __FBSDID("$FreeBSD$"); /* align to 32-bit sizes */ #define SCTP_SIZE32(x) ((((x) + 3) >> 2) << 2) -#define IS_SCTP_CONTROL(a) ((a)->chunk_type != SCTP_DATA) -#define IS_SCTP_DATA(a) ((a)->chunk_type == SCTP_DATA) +#define IS_SCTP_CONTROL(a) (((a)->chunk_type != SCTP_DATA) && ((a)->chunk_type != SCTP_IDATA)) +#define IS_SCTP_DATA(a) (((a)->chunk_type == SCTP_DATA) || ((a)->chunk_type == SCTP_IDATA)) /* SCTP parameter types */ @@ -886,12 +886,19 @@ __FBSDID("$FreeBSD$"); /* modular comparison */ /* See RFC 1982 for details. */ -#define SCTP_SSN_GT(a, b) (((a < b) && ((uint16_t)(b - a) > (1U<<15))) || \ - ((a > b) && ((uint16_t)(a - b) < (1U<<15)))) -#define SCTP_SSN_GE(a, b) (SCTP_SSN_GT(a, b) || (a == b)) -#define SCTP_TSN_GT(a, b) (((a < b) && ((uint32_t)(b - a) > (1U<<31))) || \ - ((a > b) && ((uint32_t)(a - b) < (1U<<31)))) -#define SCTP_TSN_GE(a, b) (SCTP_TSN_GT(a, b) || (a == b)) +#define SCTP_UINT16_GT(a, b) (((a < b) && ((uint16_t)(b - a) > (1U<<15))) || \ + ((a > b) && ((uint16_t)(a - b) < (1U<<15)))) +#define SCTP_UINT16_GE(a, b) (SCTP_UINT16_GT(a, b) || (a == b)) +#define SCTP_UINT32_GT(a, b) (((a < b) && ((uint32_t)(b - a) > (1U<<31))) || \ + ((a > b) && ((uint32_t)(a - b) < (1U<<31)))) +#define SCTP_UINT32_GE(a, b) (SCTP_UINT32_GT(a, b) || (a == b)) + +#define SCTP_SSN_GT(a, b) SCTP_UINT16_GT(a, b) +#define SCTP_SSN_GE(a, b) SCTP_UINT16_GE(a, b) +#define SCTP_TSN_GT(a, b) SCTP_UINT32_GT(a, b) +#define SCTP_TSN_GE(a, b) SCTP_UINT32_GE(a, b) +#define SCTP_MSGID_GT(o, a, b) ((o == 1) ? SCTP_UINT16_GT((uint16_t)a, (uint16_t)b) : SCTP_UINT32_GT(a, b)) +#define SCTP_MSGID_GE(o, a, b) ((o == 1) ? SCTP_UINT16_GE((uint16_t)a, (uint16_t)b) : SCTP_UINT32_GE(a, b)) /* Mapping array manipulation routines */ #define SCTP_IS_TSN_PRESENT(arry, gap) ((arry[(gap >> 3)] >> (gap & 0x07)) & 0x01) Modified: head/sys/netinet/sctp_dtrace_define.h ============================================================================== --- head/sys/netinet/sctp_dtrace_define.h Thu Apr 7 08:32:37 2016 (r297661) +++ head/sys/netinet/sctp_dtrace_define.h Thu Apr 7 09:10:34 2016 (r297662) @@ -45,131 +45,131 @@ SDT_PROVIDER_DEFINE(sctp); /********************************************************/ /* Initial */ SDT_PROBE_DEFINE5(sctp, cwnd, net, init, - "uint32_t", /* The Vtag for this end */ - "uint32_t", /* - * The port number of the local side << 16 | port number - * of remote in network byte order. - */ - "uintptr_t", /* The pointer to the struct sctp_nets * changing */ - "int", /* The old value of the cwnd */ - "int"); /* The new value of the cwnd */ + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "uintptr_t", /* The pointer to the struct sctp_nets * + * changing */ + "int", /* The old value of the cwnd */ + "int"); /* The new value of the cwnd */ /* ACK-INCREASE */ SDT_PROBE_DEFINE5(sctp, cwnd, net, ack, - "uint32_t", /* The Vtag for this end */ - "uint32_t", /* - * The port number of the local side << 16 | port number - * of remote in network byte order. - */ - "uintptr_t", /* The pointer to the struct sctp_nets * changing */ - "int", /* The old value of the cwnd */ - "int"); /* The new value of the cwnd */ + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "uintptr_t", /* The pointer to the struct sctp_nets * + * changing */ + "int", /* The old value of the cwnd */ + "int"); /* The new value of the cwnd */ /* ACK-INCREASE */ SDT_PROBE_DEFINE5(sctp, cwnd, net, rttvar, - "uint64_t", /* The Vtag << 32 | localport << 16 | remoteport */ - "uint64_t", /* obw | nbw */ - "uint64_t", /* bwrtt | newrtt */ - "uint64_t", /* flight */ - "uint64_t"); /* (cwnd << 32) | point << 16 | retval(0/1) */ + "uint64_t", /* The Vtag << 32 | localport << 16 | + * remoteport */ + "uint64_t", /* obw | nbw */ + "uint64_t", /* bwrtt | newrtt */ + "uint64_t", /* flight */ + "uint64_t"); /* (cwnd << 32) | point << 16 | retval(0/1) */ SDT_PROBE_DEFINE5(sctp, cwnd, net, rttstep, - "uint64_t", /* The Vtag << 32 | localport << 16 | remoteport */ - "uint64_t", /* obw | nbw */ - "uint64_t", /* bwrtt | newrtt */ - "uint64_t", /* flight */ - "uint64_t"); /* (cwnd << 32) | point << 16 | retval(0/1) */ + "uint64_t", /* The Vtag << 32 | localport << 16 | + * remoteport */ + "uint64_t", /* obw | nbw */ + "uint64_t", /* bwrtt | newrtt */ + "uint64_t", /* flight */ + "uint64_t"); /* (cwnd << 32) | point << 16 | retval(0/1) */ /* FastRetransmit-DECREASE */ SDT_PROBE_DEFINE5(sctp, cwnd, net, fr, - "uint32_t", /* The Vtag for this end */ - "uint32_t", /* - * The port number of the local side << 16 | port number - * of remote in network byte order. - */ - "uintptr_t", /* The pointer to the struct sctp_nets * changing */ - "int", /* The old value of the cwnd */ - "int"); /* The new value of the cwnd */ + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "uintptr_t", /* The pointer to the struct sctp_nets * + * changing */ + "int", /* The old value of the cwnd */ + "int"); /* The new value of the cwnd */ /* TimeOut-DECREASE */ SDT_PROBE_DEFINE5(sctp, cwnd, net, to, - "uint32_t", /* The Vtag for this end */ - "uint32_t", /* - * The port number of the local side << 16 | port number - * of remote in network byte order. - */ - "uintptr_t", /* The pointer to the struct sctp_nets * changing */ - "int", /* The old value of the cwnd */ - "int"); /* The new value of the cwnd */ + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "uintptr_t", /* The pointer to the struct sctp_nets * + * changing */ + "int", /* The old value of the cwnd */ + "int"); /* The new value of the cwnd */ /* BurstLimit-DECREASE */ SDT_PROBE_DEFINE5(sctp, cwnd, net, bl, - "uint32_t", /* The Vtag for this end */ - "uint32_t", /* - * The port number of the local side << 16 | port number - * of remote in network byte order. - */ - "uintptr_t", /* The pointer to the struct sctp_nets * changing */ - "int", /* The old value of the cwnd */ - "int"); /* The new value of the cwnd */ + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "uintptr_t", /* The pointer to the struct sctp_nets * + * changing */ + "int", /* The old value of the cwnd */ + "int"); /* The new value of the cwnd */ /* ECN-DECREASE */ SDT_PROBE_DEFINE5(sctp, cwnd, net, ecn, - "uint32_t", /* The Vtag for this end */ - "uint32_t", /* - * The port number of the local side << 16 | port number - * of remote in network byte order. - */ - "uintptr_t", /* The pointer to the struct sctp_nets * changing */ - "int", /* The old value of the cwnd */ - "int"); /* The new value of the cwnd */ + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "uintptr_t", /* The pointer to the struct sctp_nets * + * changing */ + "int", /* The old value of the cwnd */ + "int"); /* The new value of the cwnd */ /* PacketDrop-DECREASE */ SDT_PROBE_DEFINE5(sctp, cwnd, net, pd, - "uint32_t", /* The Vtag for this end */ - "uint32_t", /* - * The port number of the local side << 16 | port number - * of remote in network byte order. - */ - "uintptr_t", /* The pointer to the struct sctp_nets * changing */ - "int", /* The old value of the cwnd */ - "int"); /* The new value of the cwnd */ + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "uintptr_t", /* The pointer to the struct sctp_nets * + * changing */ + "int", /* The old value of the cwnd */ + "int"); /* The new value of the cwnd */ /********************************************************/ /* Rwnd probe - tracks changes in the receiver window for an assoc */ /********************************************************/ SDT_PROBE_DEFINE4(sctp, rwnd, assoc, val, - "uint32_t", /* The Vtag for this end */ - "uint32_t", /* - * The port number of the local side << 16 | port number - * of remote in network byte order. - */ - "int", /* The up/down amount */ - "int"); /* The new value of the cwnd */ + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "int", /* The up/down amount */ + "int"); /* The new value of the cwnd */ /********************************************************/ /* flight probe - tracks changes in the flight size on a net or assoc */ /********************************************************/ SDT_PROBE_DEFINE5(sctp, flightsize, net, val, - "uint32_t", /* The Vtag for this end */ - "uint32_t", /* - * The port number of the local side << 16 | port number - * of remote in network byte order. - */ - "uintptr_t", /* The pointer to the struct sctp_nets * changing */ - "int", /* The up/down amount */ - "int"); /* The new value of the cwnd */ + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "uintptr_t", /* The pointer to the struct sctp_nets * + * changing */ + "int", /* The up/down amount */ + "int"); /* The new value of the cwnd */ /********************************************************/ /* The total flight version */ /********************************************************/ SDT_PROBE_DEFINE4(sctp, flightsize, assoc, val, - "uint32_t", /* The Vtag for this end */ - "uint32_t", /* - * The port number of the local side << 16 | port number - * of remote in network byte order. - */ - "int", /* The up/down amount */ - "int"); /* The new value of the cwnd */ + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "int", /* The up/down amount */ + "int"); /* The new value of the cwnd */ #endif Modified: head/sys/netinet/sctp_header.h ============================================================================== --- head/sys/netinet/sctp_header.h Thu Apr 7 08:32:37 2016 (r297661) +++ head/sys/netinet/sctp_header.h Thu Apr 7 09:10:34 2016 (r297662) @@ -152,6 +152,23 @@ struct sctp_data_chunk { struct sctp_data dp; } SCTP_PACKED; +struct sctp_idata { + uint32_t tsn; + uint16_t stream_id; + uint16_t reserved; /* Where does the SSN go? */ + uint32_t msg_id; + union { + uint32_t protocol_id; + uint32_t fsn; /* Fragment Sequence Number */ + }; + /* user data follows */ +} SCTP_PACKED; + +struct sctp_idata_chunk { + struct sctp_chunkhdr ch; + struct sctp_idata dp; +} SCTP_PACKED; + /* * Structures for the control chunks */ @@ -378,6 +395,12 @@ struct sctp_strseq { uint16_t sequence; } SCTP_PACKED; +struct sctp_strseq_mid { + uint16_t stream; + uint16_t reserved; + uint32_t msg_id; +}; + struct sctp_forward_tsn_msg { struct sctphdr sh; struct sctp_forward_tsn_chunk msg; Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Thu Apr 7 08:32:37 2016 (r297661) +++ head/sys/netinet/sctp_indata.c Thu Apr 7 09:10:34 2016 (r297662) @@ -34,18 +34,22 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include -#include #include +#include #include #include -#include -#include #include +#include #include - - +#include +#include +#include +#include +#include +#include /* * NOTES: On the outbound side of things I need to check the sack timer to * see if I should generate a sack into the chunk queue (if I have data to @@ -55,6 +59,13 @@ __FBSDID("$FreeBSD$"); * This will cause sctp_service_queues() to get called on the top entry in * the list. */ +static void +sctp_add_chk_to_control(struct sctp_queued_to_read *control, + struct sctp_stream_in *strm, + struct sctp_tcb *stcb, + struct sctp_association *asoc, + struct sctp_tmit_chunk *chk); + void sctp_set_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc) @@ -74,9 +85,9 @@ sctp_calc_rwnd(struct sctp_tcb *stcb, st * sctp_soreceive then we will fix this so that ONLY this * associations data is taken into account. */ - if (stcb->sctp_socket == NULL) + if (stcb->sctp_socket == NULL) { return (calc); - + } if (stcb->asoc.sb_cc == 0 && asoc->size_on_reasm_queue == 0 && asoc->size_on_all_streams == 0) { @@ -86,7 +97,6 @@ sctp_calc_rwnd(struct sctp_tcb *stcb, st } /* get actual space */ calc = (uint32_t) sctp_sbspace(&stcb->asoc, &stcb->sctp_socket->so_rcv); - /* * take out what has NOT been put on socket queue and we yet hold * for putting up. @@ -95,7 +105,6 @@ sctp_calc_rwnd(struct sctp_tcb *stcb, st asoc->cnt_on_reasm_queue * MSIZE)); calc = sctp_sbspace_sub(calc, (uint32_t) (asoc->size_on_all_streams + asoc->cnt_on_all_streams * MSIZE)); - if (calc == 0) { /* out of space */ return (calc); @@ -122,7 +131,7 @@ sctp_build_readq_entry(struct sctp_tcb * struct sctp_nets *net, uint32_t tsn, uint32_t ppid, uint32_t context, uint16_t stream_no, - uint16_t stream_seq, uint8_t flags, + uint32_t stream_seq, uint8_t flags, struct mbuf *dm) { struct sctp_queued_to_read *read_queue_e = NULL; @@ -131,73 +140,26 @@ sctp_build_readq_entry(struct sctp_tcb * if (read_queue_e == NULL) { goto failed_build; } + memset(read_queue_e, 0, sizeof(struct sctp_queued_to_read)); read_queue_e->sinfo_stream = stream_no; read_queue_e->sinfo_ssn = stream_seq; read_queue_e->sinfo_flags = (flags << 8); read_queue_e->sinfo_ppid = ppid; read_queue_e->sinfo_context = context; - read_queue_e->sinfo_timetolive = 0; read_queue_e->sinfo_tsn = tsn; read_queue_e->sinfo_cumtsn = tsn; read_queue_e->sinfo_assoc_id = sctp_get_associd(stcb); + read_queue_e->top_fsn = read_queue_e->fsn_included = 0xffffffff; + TAILQ_INIT(&read_queue_e->reasm); read_queue_e->whoFrom = net; - read_queue_e->length = 0; atomic_add_int(&net->ref_count, 1); read_queue_e->data = dm; - read_queue_e->spec_flags = 0; - read_queue_e->tail_mbuf = NULL; - read_queue_e->aux_data = NULL; - read_queue_e->stcb = stcb; - read_queue_e->port_from = stcb->rport; - read_queue_e->do_not_ref_stcb = 0; - read_queue_e->end_added = 0; - read_queue_e->some_taken = 0; - read_queue_e->pdapi_aborted = 0; -failed_build: - return (read_queue_e); -} - - -/* - * Build out our readq entry based on the incoming packet. - */ -static struct sctp_queued_to_read * -sctp_build_readq_entry_chk(struct sctp_tcb *stcb, - struct sctp_tmit_chunk *chk) -{ - struct sctp_queued_to_read *read_queue_e = NULL; - - sctp_alloc_a_readq(stcb, read_queue_e); - if (read_queue_e == NULL) { - goto failed_build; - } - read_queue_e->sinfo_stream = chk->rec.data.stream_number; - read_queue_e->sinfo_ssn = chk->rec.data.stream_seq; - read_queue_e->sinfo_flags = (chk->rec.data.rcv_flags << 8); - read_queue_e->sinfo_ppid = chk->rec.data.payloadtype; - read_queue_e->sinfo_context = stcb->asoc.context; - read_queue_e->sinfo_timetolive = 0; - read_queue_e->sinfo_tsn = chk->rec.data.TSN_seq; - read_queue_e->sinfo_cumtsn = chk->rec.data.TSN_seq; - read_queue_e->sinfo_assoc_id = sctp_get_associd(stcb); - read_queue_e->whoFrom = chk->whoTo; - read_queue_e->aux_data = NULL; - read_queue_e->length = 0; - atomic_add_int(&chk->whoTo->ref_count, 1); - read_queue_e->data = chk->data; - read_queue_e->tail_mbuf = NULL; read_queue_e->stcb = stcb; read_queue_e->port_from = stcb->rport; - read_queue_e->spec_flags = 0; - read_queue_e->do_not_ref_stcb = 0; - read_queue_e->end_added = 0; - read_queue_e->some_taken = 0; - read_queue_e->pdapi_aborted = 0; failed_build: return (read_queue_e); } - struct mbuf * sctp_build_ctl_nchunk(struct sctp_inpcb *inp, struct sctp_sndrcvinfo *sinfo) { @@ -317,6 +279,7 @@ sctp_mark_non_revokable(struct sctp_asso { uint32_t gap, i, cumackp1; int fnd = 0; + int in_r = 0, in_nr = 0; if (SCTP_BASE_SYSCTL(sctp_do_drain) == 0) { return; @@ -330,15 +293,20 @@ sctp_mark_non_revokable(struct sctp_asso return; } SCTP_CALC_TSN_TO_GAP(gap, tsn, asoc->mapping_array_base_tsn); - if (!SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap)) { + in_r = SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap); + in_nr = SCTP_IS_TSN_PRESENT(asoc->nr_mapping_array, gap); + if ((in_r == 0) && (in_nr == 0)) { +#ifdef INVARIANTS + panic("Things are really messed up now"); +#else SCTP_PRINTF("gap:%x tsn:%x\n", gap, tsn); sctp_print_mapping_array(asoc); -#ifdef INVARIANTS - panic("Things are really messed up now!!"); #endif } - SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap); - SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap); + if (in_nr == 0) + SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap); + if (in_r) + SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap); if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) { asoc->highest_tsn_inside_nr_map = tsn; } @@ -358,191 +326,157 @@ sctp_mark_non_revokable(struct sctp_asso } } - -/* - * We are delivering currently from the reassembly queue. We must continue to - * deliver until we either: 1) run out of space. 2) run out of sequential - * TSN's 3) hit the SCTP_DATA_LAST_FRAG flag. - */ -static void -sctp_service_reassembly(struct sctp_tcb *stcb, struct sctp_association *asoc) +static int +sctp_place_control_in_stream(struct sctp_stream_in *strm, + struct sctp_association *asoc, + struct sctp_queued_to_read *control) { - struct sctp_tmit_chunk *chk, *nchk; - uint16_t nxt_todel; - uint16_t stream_no; - int end = 0; - int cntDel; - struct sctp_queued_to_read *control, *ctl, *nctl; - - if (stcb == NULL) - return; + struct sctp_queued_to_read *at; + struct sctp_readhead *q; + uint8_t bits, unordered; - cntDel = stream_no = 0; - if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) || - (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) || - (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) { - /* socket above is long gone or going.. */ -abandon: - asoc->fragmented_delivery_inprogress = 0; - TAILQ_FOREACH_SAFE(chk, &asoc->reasmqueue, sctp_next, nchk) { - TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next); - asoc->size_on_reasm_queue -= chk->send_size; - sctp_ucount_decr(asoc->cnt_on_reasm_queue); - /* - * Lose the data pointer, since its in the socket - * buffer - */ - if (chk->data) { - sctp_m_freem(chk->data); - chk->data = NULL; + bits = (control->sinfo_flags >> 8); + unordered = bits & SCTP_DATA_UNORDERED; + if (unordered) { + q = &strm->uno_inqueue; + if (asoc->idata_supported == 0) { + if (!TAILQ_EMPTY(q)) { + /* + * Only one stream can be here in old style + * -- abort + */ + return (-1); } - /* Now free the address and data */ - sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); - /* sa_ignore FREED_MEMORY */ + TAILQ_INSERT_TAIL(q, control, next_instrm); + control->on_strm_q = SCTP_ON_UNORDERED; + return (0); } - return; + } else { + q = &strm->inqueue; } - SCTP_TCB_LOCK_ASSERT(stcb); - TAILQ_FOREACH_SAFE(chk, &asoc->reasmqueue, sctp_next, nchk) { - if (chk->rec.data.TSN_seq != (asoc->tsn_last_delivered + 1)) { - /* Can't deliver more :< */ - return; - } - stream_no = chk->rec.data.stream_number; - nxt_todel = asoc->strmin[stream_no].last_sequence_delivered + 1; - if (nxt_todel != chk->rec.data.stream_seq && - (chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) == 0) { - /* - * Not the next sequence to deliver in its stream OR - * unordered - */ - return; - } - if (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) { - - control = sctp_build_readq_entry_chk(stcb, chk); - if (control == NULL) { - /* out of memory? */ - return; - } - /* save it off for our future deliveries */ - stcb->asoc.control_pdapi = control; - if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) - end = 1; - else - end = 0; - sctp_mark_non_revokable(asoc, chk->rec.data.TSN_seq); - sctp_add_to_readq(stcb->sctp_ep, - stcb, control, &stcb->sctp_socket->so_rcv, end, - SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); - cntDel++; + if ((bits & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { + control->end_added = control->last_frag_seen = control->first_frag_seen = 1; + } + if (TAILQ_EMPTY(q)) { + /* Empty queue */ + TAILQ_INSERT_HEAD(q, control, next_instrm); + if (unordered) { + control->on_strm_q = SCTP_ON_UNORDERED; } else { - if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) - end = 1; - else - end = 0; - sctp_mark_non_revokable(asoc, chk->rec.data.TSN_seq); - if (sctp_append_to_readq(stcb->sctp_ep, stcb, - stcb->asoc.control_pdapi, - chk->data, end, chk->rec.data.TSN_seq, - &stcb->sctp_socket->so_rcv)) { + control->on_strm_q = SCTP_ON_ORDERED; + } + return (0); + } else { + TAILQ_FOREACH(at, q, next_instrm) { + if (SCTP_TSN_GT(at->msg_id, control->msg_id)) { /* - * something is very wrong, either - * control_pdapi is NULL, or the tail_mbuf - * is corrupt, or there is a EOM already on - * the mbuf chain. + * one in queue is bigger than the new one, + * insert before this one */ - if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { - goto abandon; + TAILQ_INSERT_BEFORE(at, control, next_instrm); + if (unordered) { + control->on_strm_q = SCTP_ON_UNORDERED; } else { -#ifdef INVARIANTS - if ((stcb->asoc.control_pdapi == NULL) || (stcb->asoc.control_pdapi->tail_mbuf == NULL)) { - panic("This should not happen control_pdapi NULL?"); + control->on_strm_q = SCTP_ON_ORDERED; + } + break; + } else if (at->msg_id == control->msg_id) { + /* + * Gak, He sent me a duplicate msg id + * number?? return -1 to abort. + */ + return (-1); + } else { + if (TAILQ_NEXT(at, next_instrm) == NULL) { + /* + * We are at the end, insert it + * after this one + */ + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { + sctp_log_strm_del(control, at, + SCTP_STR_LOG_FROM_INSERT_TL); } - /* if we did not panic, it was a EOM */ - panic("Bad chunking ??"); -#else - if ((stcb->asoc.control_pdapi == NULL) || (stcb->asoc.control_pdapi->tail_mbuf == NULL)) { - SCTP_PRINTF("This should not happen control_pdapi NULL?\n"); + TAILQ_INSERT_AFTER(q, + at, control, next_instrm); + if (unordered) { + control->on_strm_q = SCTP_ON_UNORDERED; + } else { + control->on_strm_q = SCTP_ON_ORDERED; } - SCTP_PRINTF("Bad chunking ??\n"); - SCTP_PRINTF("Dumping re-assembly queue this will probably hose the association\n"); - -#endif - goto abandon; + break; } } - cntDel++; - } - /* pull it we did it */ - TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next); - if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) { - asoc->fragmented_delivery_inprogress = 0; - if ((chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) == 0) { - asoc->strmin[stream_no].last_sequence_delivered++; - } - if ((chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) == 0) { - SCTP_STAT_INCR_COUNTER64(sctps_reasmusrmsgs); - } - } else if (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) { - /* - * turn the flag back on since we just delivered - * yet another one. - */ - asoc->fragmented_delivery_inprogress = 1; } - asoc->tsn_of_pdapi_last_delivered = chk->rec.data.TSN_seq; - asoc->last_flags_delivered = chk->rec.data.rcv_flags; - asoc->last_strm_seq_delivered = chk->rec.data.stream_seq; - asoc->last_strm_no_delivered = chk->rec.data.stream_number; + } + return (0); +} - asoc->tsn_last_delivered = chk->rec.data.TSN_seq; - asoc->size_on_reasm_queue -= chk->send_size; - sctp_ucount_decr(asoc->cnt_on_reasm_queue); - /* free up the chk */ - chk->data = NULL; - sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); +static void +sctp_abort_in_reasm(struct sctp_tcb *stcb, + struct sctp_stream_in *strm, + struct sctp_queued_to_read *control, + struct sctp_tmit_chunk *chk, + int *abort_flag, int opspot) +{ + char msg[SCTP_DIAG_INFO_LEN]; + struct mbuf *oper; - if (asoc->fragmented_delivery_inprogress == 0) { - /* - * Now lets see if we can deliver the next one on - * the stream - */ - struct sctp_stream_in *strm; + if (stcb->asoc.idata_supported) { + snprintf(msg, sizeof(msg), + "Reass %x,CF:%x,TSN=%8.8x,SID=%4.4x,FSN=%8.8x,MID:%8.8x", + opspot, + control->fsn_included, + chk->rec.data.TSN_seq, + chk->rec.data.stream_number, + chk->rec.data.fsn_num, chk->rec.data.stream_seq); + } else { + snprintf(msg, sizeof(msg), + "Reass %x, CI:%x,TSN=%8.8x,SID=%4.4x,FSN=%4.4x, SSN:%4.4x", + opspot, + control->fsn_included, + chk->rec.data.TSN_seq, + chk->rec.data.stream_number, + chk->rec.data.fsn_num, + (uint16_t) chk->rec.data.stream_seq); + } + oper = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); + sctp_m_freem(chk->data); + chk->data = NULL; + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_1; + sctp_abort_an_association(stcb->sctp_ep, stcb, oper, SCTP_SO_NOT_LOCKED); + *abort_flag = 1; +} - strm = &asoc->strmin[stream_no]; - nxt_todel = strm->last_sequence_delivered + 1; - TAILQ_FOREACH_SAFE(ctl, &strm->inqueue, next, nctl) { - /* Deliver more if we can. */ - if (nxt_todel == ctl->sinfo_ssn) { - TAILQ_REMOVE(&strm->inqueue, ctl, next); - asoc->size_on_all_streams -= ctl->length; - sctp_ucount_decr(asoc->cnt_on_all_streams); - strm->last_sequence_delivered++; - sctp_mark_non_revokable(asoc, ctl->sinfo_tsn); - sctp_add_to_readq(stcb->sctp_ep, stcb, - ctl, - &stcb->sctp_socket->so_rcv, 1, - SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); - } else { - break; - } - nxt_todel = strm->last_sequence_delivered + 1; - } - break; - } +static void +clean_up_control(struct sctp_tcb *stcb, struct sctp_queued_to_read *control) +{ + /* + * The control could not be placed and must be cleaned. + */ + struct sctp_tmit_chunk *chk, *nchk; + + TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, nchk) { + TAILQ_REMOVE(&control->reasm, chk, sctp_next); + if (chk->data) + sctp_m_freem(chk->data); + chk->data = NULL; + sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); } + sctp_free_a_readq(stcb, control); } /* * Queue the chunk either right into the socket buffer if it is the next one * to go OR put it in the correct place in the delivery queue. If we do - * append to the so_buf, keep doing so until we are out of order. One big - * question still remains, what to do when the socket buffer is FULL?? + * append to the so_buf, keep doing so until we are out of order as + * long as the control's entered are non-fragmented. */ static void -sctp_queue_data_to_stream(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_queued_to_read *control, int *abort_flag) +sctp_queue_data_to_stream(struct sctp_tcb *stcb, + struct sctp_stream_in *strm, + struct sctp_association *asoc, + struct sctp_queued_to_read *control, int *abort_flag, int *need_reasm) { /* * FIX-ME maybe? What happens when the ssn wraps? If we are getting @@ -562,27 +496,16 @@ sctp_queue_data_to_stream(struct sctp_tc * SSN alone. Maybe a hybred approach is the answer * */ - struct sctp_stream_in *strm; struct sctp_queued_to_read *at; int queue_needed; - uint16_t nxt_todel; + uint32_t nxt_todel; struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - queue_needed = 1; - asoc->size_on_all_streams += control->length; - sctp_ucount_incr(asoc->cnt_on_all_streams); - strm = &asoc->strmin[control->sinfo_stream]; - nxt_todel = strm->last_sequence_delivered + 1; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { sctp_log_strm_del(control, NULL, SCTP_STR_LOG_FROM_INTO_STRD); } - SCTPDBG(SCTP_DEBUG_INDATA1, - "queue to stream called for sid:%u ssn:%u tsn:%u lastdel:%u nxt:%u\n", - (uint32_t) control->sinfo_stream, (uint32_t) control->sinfo_ssn, - (uint32_t) control->sinfo_tsn, - (uint32_t) strm->last_sequence_delivered, (uint32_t) nxt_todel); - if (SCTP_SSN_GE(strm->last_sequence_delivered, control->sinfo_ssn)) { + if (SCTP_MSGID_GT((!asoc->idata_supported), strm->last_sequence_delivered, control->sinfo_ssn)) { /* The incoming sseq is behind where we last delivered? */ SCTPDBG(SCTP_DEBUG_INDATA1, "Duplicate S-SEQ:%d delivered:%d from peer, Abort association\n", control->sinfo_ssn, strm->last_sequence_delivered); @@ -591,32 +514,39 @@ protocol_error: * throw it in the stream so it gets cleaned up in * association destruction */ - TAILQ_INSERT_HEAD(&strm->inqueue, control, next); + TAILQ_INSERT_HEAD(&strm->inqueue, control, next_instrm); snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", strm->last_sequence_delivered, control->sinfo_tsn, control->sinfo_stream, control->sinfo_ssn); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_1; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_2; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return; } + if ((SCTP_TSN_GE(asoc->cumulative_tsn, control->sinfo_tsn)) && (asoc->idata_supported == 0)) { + goto protocol_error; + } + queue_needed = 1; + asoc->size_on_all_streams += control->length; + sctp_ucount_incr(asoc->cnt_on_all_streams); + nxt_todel = strm->last_sequence_delivered + 1; + if (nxt_todel == control->sinfo_ssn) { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; + struct socket *so; - so = SCTP_INP_SO(stcb->sctp_ep); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { - SCTP_SOCKET_UNLOCK(so, 1); - return; - } + so = SCTP_INP_SO(stcb->sctp_ep); + atomic_add_int(&stcb->asoc.refcnt, 1); + SCTP_TCB_UNLOCK(stcb); + SCTP_SOCKET_LOCK(so, 1); + SCTP_TCB_LOCK(stcb); + atomic_subtract_int(&stcb->asoc.refcnt, 1); + if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { + SCTP_SOCKET_UNLOCK(so, 1); + return; + } #endif - if (nxt_todel == control->sinfo_ssn) { /* can be delivered right away? */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { sctp_log_strm_del(control, NULL, SCTP_STR_LOG_FROM_IMMED_DEL); @@ -626,19 +556,25 @@ protocol_error: asoc->size_on_all_streams -= control->length; sctp_ucount_decr(asoc->cnt_on_all_streams); strm->last_sequence_delivered++; - sctp_mark_non_revokable(asoc, control->sinfo_tsn); sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, 1, - SCTP_READ_LOCK_NOT_HELD, SCTP_SO_LOCKED); - TAILQ_FOREACH_SAFE(control, &strm->inqueue, next, at) { + SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); + TAILQ_FOREACH_SAFE(control, &strm->inqueue, next_instrm, at) { /* all delivered */ nxt_todel = strm->last_sequence_delivered + 1; - if (nxt_todel == control->sinfo_ssn) { - TAILQ_REMOVE(&strm->inqueue, control, next); + if ((nxt_todel == control->sinfo_ssn) && + (((control->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG)) { asoc->size_on_all_streams -= control->length; sctp_ucount_decr(asoc->cnt_on_all_streams); + if (control->on_strm_q == SCTP_ON_ORDERED) { + TAILQ_REMOVE(&strm->inqueue, control, next_instrm); + } else { + panic("Huh control:%p is on_strm_q:%d", + control, control->on_strm_q); + } + control->on_strm_q = 0; strm->last_sequence_delivered++; /* * We ignore the return of deliver_data here @@ -655,655 +591,1000 @@ protocol_error: control, &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, - SCTP_SO_LOCKED); + SCTP_SO_NOT_LOCKED); continue; + } else if (nxt_todel == control->sinfo_ssn) { + *need_reasm = 1; } break; } +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + SCTP_SOCKET_UNLOCK(so, 1); +#endif } if (queue_needed) { /* * Ok, we did not deliver this guy, find the correct place * to put it on the queue. */ - if (SCTP_TSN_GE(asoc->cumulative_tsn, control->sinfo_tsn)) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif - goto protocol_error; - } - if (TAILQ_EMPTY(&strm->inqueue)) { - /* Empty queue */ - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { - sctp_log_strm_del(control, NULL, SCTP_STR_LOG_FROM_INSERT_HD); - } - TAILQ_INSERT_HEAD(&strm->inqueue, control, next); - } else { - TAILQ_FOREACH(at, &strm->inqueue, next) { - if (SCTP_SSN_GT(at->sinfo_ssn, control->sinfo_ssn)) { - /* - * one in queue is bigger than the - * new one, insert before this one - */ - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { - sctp_log_strm_del(control, at, - SCTP_STR_LOG_FROM_INSERT_MD); - } - TAILQ_INSERT_BEFORE(at, control, next); - break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Apr 7 09:34:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90894B07E14; Thu, 7 Apr 2016 09:34:43 +0000 (UTC) (envelope-from rrs@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 mx1.freebsd.org (Postfix) with ESMTPS id 6881B1B98; Thu, 7 Apr 2016 09:34:43 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u379YgkX015937; Thu, 7 Apr 2016 09:34:42 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u379YgZH015930; Thu, 7 Apr 2016 09:34:42 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201604070934.u379YgZH015930@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Thu, 7 Apr 2016 09:34:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297663 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 09:34:43 -0000 Author: rrs Date: Thu Apr 7 09:34:41 2016 New Revision: 297663 URL: https://svnweb.freebsd.org/changeset/base/297663 Log: A couple of minor changes that I missed that Michael had done, most noted in these is the change to non-strict ordering for incoming data (this will make pkt-drill test 14 fail but its expected). Modified: head/sys/netinet/sctp_indata.h head/sys/netinet/sctp_os_bsd.h head/sys/netinet/sctp_output.c head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctp_var.h head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_indata.h ============================================================================== --- head/sys/netinet/sctp_indata.h Thu Apr 7 09:10:34 2016 (r297662) +++ head/sys/netinet/sctp_indata.h Thu Apr 7 09:34:41 2016 (r297663) @@ -53,7 +53,7 @@ sctp_build_readq_entry(struct sctp_tcb * memset(_ctl, 0, sizeof(struct sctp_queued_to_read)); \ (_ctl)->sinfo_stream = stream_no; \ (_ctl)->sinfo_ssn = stream_seq; \ - TAILQ_INIT(&_ctl->reasm); \ + TAILQ_INIT(&_ctl->reasm); \ (_ctl)->top_fsn = tfsn; \ (_ctl)->msg_id = msgid; \ (_ctl)->sinfo_flags = (flags << 8); \ Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Thu Apr 7 09:10:34 2016 (r297662) +++ head/sys/netinet/sctp_os_bsd.h Thu Apr 7 09:34:41 2016 (r297663) @@ -480,9 +480,9 @@ sctp_get_mbuf_for_msg(unsigned int space #define SCTP_SAVE_ATOMIC_DECREMENT(addr, val) \ { \ int32_t oldval; \ - oldval = atomic_fetchadd_int(addr, -val); \ + oldval = atomic_fetchadd_int(addr, -val); \ if (oldval < val) { \ - panic("Counter goes negative addr:%p val:%d oldval:%d", addr, val, oldval); \ + panic("Counter goes negative"); \ } \ } #else Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Thu Apr 7 09:10:34 2016 (r297662) +++ head/sys/netinet/sctp_output.c Thu Apr 7 09:34:41 2016 (r297663) @@ -10499,6 +10499,7 @@ sctp_fill_in_rest: strseq++; } else { strseq_m->stream = ntohs(at->rec.data.stream_number); + strseq_m->reserved = ntohs(0); strseq_m->msg_id = ntohl(at->rec.data.stream_seq); strseq_m++; } Modified: head/sys/netinet/sctp_sysctl.h ============================================================================== --- head/sys/netinet/sctp_sysctl.h Thu Apr 7 09:10:34 2016 (r297662) +++ head/sys/netinet/sctp_sysctl.h Thu Apr 7 09:34:41 2016 (r297663) @@ -432,7 +432,7 @@ struct sctp_sysctl { #define SCTPCTL_STRICT_DATA_ORDER_DESC "Enforce strict data ordering, abort if control inside data" #define SCTPCTL_STRICT_DATA_ORDER_MIN 0 #define SCTPCTL_STRICT_DATA_ORDER_MAX 1 -#define SCTPCTL_STRICT_DATA_ORDER_DEFAULT 1 +#define SCTPCTL_STRICT_DATA_ORDER_DEFAULT 0 /* min_residual: min residual in a data fragment leftover */ #define SCTPCTL_MIN_RESIDUAL_DESC "Minimum residual data chunk in second part of split" Modified: head/sys/netinet/sctp_var.h ============================================================================== --- head/sys/netinet/sctp_var.h Thu Apr 7 09:10:34 2016 (r297662) +++ head/sys/netinet/sctp_var.h Thu Apr 7 09:34:41 2016 (r297663) @@ -99,8 +99,8 @@ extern struct pr_usrreqs sctp_usrreqs; */ #ifdef INVARIANTS #define sctp_free_a_readq(_stcb, _readq) { \ - if ((_readq)->on_strm_q) \ - panic("On strm q stcb:%p readq:%p", (_stcb), (_readq)); \ + if ((_readq)->on_strm_q) \ + panic("On strm q stcb:%p readq:%p", (_stcb), (_readq)); \ SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_readq), (_readq)); \ SCTP_DECR_READQ_COUNT(); \ } @@ -204,7 +204,7 @@ extern struct pr_usrreqs sctp_usrreqs; } #define sctp_sbfree(ctl, stcb, sb, m) { \ - SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \ + SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \ SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_mbcnt, MSIZE); \ if (((ctl)->do_not_ref_stcb == 0) && stcb) {\ SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \ Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Thu Apr 7 09:10:34 2016 (r297662) +++ head/sys/netinet/sctputil.c Thu Apr 7 09:34:41 2016 (r297663) @@ -6100,7 +6100,7 @@ wait_some_more: * corrupt? */ #ifdef INVARIANTS - panic("Impossible data==NULL length !=0 control:%p stcb:%p length:%d", control, stcb, control->length); + panic("Impossible data==NULL length !=0"); #endif out_flags |= MSG_EOR; out_flags |= MSG_TRUNC; From owner-svn-src-all@freebsd.org Thu Apr 7 10:36:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62A43B079AF; Thu, 7 Apr 2016 10:36:51 +0000 (UTC) (envelope-from zbb@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 mx1.freebsd.org (Postfix) with ESMTPS id 33F7F16E8; Thu, 7 Apr 2016 10:36:51 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37Aaoho033971; Thu, 7 Apr 2016 10:36:50 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37Aaoud033970; Thu, 7 Apr 2016 10:36:50 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201604071036.u37Aaoud033970@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Thu, 7 Apr 2016 10:36:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297664 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 10:36:51 -0000 Author: zbb Date: Thu Apr 7 10:36:50 2016 New Revision: 297664 URL: https://svnweb.freebsd.org/changeset/base/297664 Log: Fix interrupts delivery on ThunderX for VF IDs beyond 8 SR-IOV devices usually use Alternative Routing ID (ARI). In that case slot/device is always assumed to be 0 and function/identifier is extended to 8 bits. Fix interrupts delivery to VF IDs beyond 8 by using a correct DevID if ARI is enabled. Reviewed by: jhb, wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5855 Modified: head/sys/arm64/arm64/gic_v3_its.c Modified: head/sys/arm64/arm64/gic_v3_its.c ============================================================================== --- head/sys/arm64/arm64/gic_v3_its.c Thu Apr 7 09:34:41 2016 (r297663) +++ head/sys/arm64/arm64/gic_v3_its.c Thu Apr 7 10:36:50 2016 (r297664) @@ -1579,9 +1579,7 @@ its_get_devid_thunder(device_t pci_dev) uint32_t bus; bus = pci_get_bus(pci_dev); - - bsf = PCI_RID(pci_get_bus(pci_dev), pci_get_slot(pci_dev), - pci_get_function(pci_dev)); + bsf = pci_get_rid(pci_dev); /* Check if accessing internal PCIe (low bus numbers) */ if (bus < GIC_V3_ITS_QUIRK_THUNDERX_PEM_BUS_OFFSET) { From owner-svn-src-all@freebsd.org Thu Apr 7 10:48:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8F3DB07C55; Thu, 7 Apr 2016 10:48:27 +0000 (UTC) (envelope-from sgalabov@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 mx1.freebsd.org (Postfix) with ESMTPS id AA1D91BFE; Thu, 7 Apr 2016 10:48:27 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37AmQXt036989; Thu, 7 Apr 2016 10:48:26 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37AmQ7M036987; Thu, 7 Apr 2016 10:48:26 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201604071048.u37AmQ7M036987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Thu, 7 Apr 2016 10:48:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297665 - head/sys/mips/mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 10:48:27 -0000 Author: sgalabov Date: Thu Apr 7 10:48:26 2016 New Revision: 297665 URL: https://svnweb.freebsd.org/changeset/base/297665 Log: Bring MIPS INTRNG support back up again, in line with D5370 Reviewed by: kan Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5838 Modified: head/sys/mips/mips/mips_pic.c head/sys/mips/mips/nexus.c Modified: head/sys/mips/mips/mips_pic.c ============================================================================== --- head/sys/mips/mips/mips_pic.c Thu Apr 7 10:36:50 2016 (r297664) +++ head/sys/mips/mips/mips_pic.c Thu Apr 7 10:48:26 2016 (r297665) @@ -71,15 +71,24 @@ __FBSDID("$FreeBSD$"); static int mips_pic_intr(void *); +struct mips_pic_irqsrc { + struct intr_irqsrc isrc; + struct resource *res; + u_int irq; +}; + struct mips_pic_softc { - device_t pic_dev; - struct intr_irqsrc * pic_irqs[NREAL_IRQS]; - struct mtx mutex; - uint32_t nirqs; + device_t pic_dev; + struct mips_pic_irqsrc pic_irqs[NREAL_IRQS]; + struct rman pic_irq_rman; + struct mtx mutex; + uint32_t nirqs; }; static struct mips_pic_softc *pic_sc; +#define PIC_INTR_ISRC(sc, irq) (&(sc)->pic_irqs[(irq)].isrc) + #ifdef FDT static struct ofw_compat_data compat_data[] = { {"mti,cpu-interrupt-controller", true}, @@ -143,6 +152,39 @@ pic_xref(device_t dev) } static int +mips_pic_register_isrcs(struct mips_pic_softc *sc) +{ + int error; + uint32_t irq, i; + struct intr_irqsrc *isrc; + const char *name; + + name = device_get_nameunit(sc->pic_dev); + for (irq = 0; irq < sc->nirqs; irq++) { + sc->pic_irqs[irq].irq = irq; + sc->pic_irqs[irq].res = rman_reserve_resource(&sc->pic_irq_rman, + irq, irq, 1, RF_ACTIVE, sc->pic_dev); + if (sc->pic_irqs[irq].res == NULL) { + device_printf(sc->pic_dev, + "%s failed to alloc resource for irq %d", + __func__, irq); + return (ENOMEM); + } + isrc = PIC_INTR_ISRC(sc, irq); + error = intr_isrc_register(isrc, sc->pic_dev, 0, "%s", name); + if (error != 0) { + for (i = 0; i < irq; i++) { + intr_isrc_deregister(PIC_INTR_ISRC(sc, i)); + } + device_printf(sc->pic_dev, "%s failed", __func__); + return (error); + } + } + + return (0); +} + +static int mips_pic_attach(device_t dev) { struct mips_pic_softc *sc; @@ -162,6 +204,21 @@ mips_pic_attach(device_t dev) /* Set the number of interrupts */ sc->nirqs = nitems(sc->pic_irqs); + /* Init the IRQ rman */ + sc->pic_irq_rman.rm_type = RMAN_ARRAY; + sc->pic_irq_rman.rm_descr = "MIPS PIC IRQs"; + if (rman_init(&sc->pic_irq_rman) != 0 || + rman_manage_region(&sc->pic_irq_rman, 0, sc->nirqs - 1) != 0) { + device_printf(dev, "failed to setup IRQ rman\n"); + goto cleanup; + } + + /* Register the interrupts */ + if (mips_pic_register_isrcs(sc) != 0) { + device_printf(dev, "could not register PIC ISRCs\n"); + goto cleanup; + } + /* * Now, when everything is initialized, it's right time to * register interrupt controller to interrupt framefork. @@ -174,7 +231,7 @@ mips_pic_attach(device_t dev) /* Claim our root controller role */ if (intr_pic_claim_root(dev, xref, mips_pic_intr, sc, 0) != 0) { device_printf(dev, "could not set PIC as a root\n"); - intr_pic_unregister(dev, xref); + intr_pic_deregister(dev, xref); goto cleanup; } @@ -189,7 +246,6 @@ mips_pic_intr(void *arg) { struct mips_pic_softc *sc = arg; register_t cause, status; - struct intr_irqsrc *isrc; int i, intr; cause = mips_rd_cause(); @@ -205,15 +261,13 @@ mips_pic_intr(void *arg) i--; /* Get a 0-offset interrupt. */ intr &= ~(1 << i); - isrc = sc->pic_irqs[i]; - if (isrc == NULL) { + if (intr_isrc_dispatch(PIC_INTR_ISRC(sc, i), + curthread->td_intr_frame) != 0) { device_printf(sc->pic_dev, "Stray interrupt %u detected\n", i); pic_irq_mask(sc, i); continue; } - - intr_irq_dispatch(isrc, curthread->td_intr_frame); } KASSERT(i == 0, ("all interrupts handled")); @@ -228,178 +282,56 @@ mips_pic_intr(void *arg) return (FILTER_HANDLED); } -static int -pic_attach_isrc(struct mips_pic_softc *sc, struct intr_irqsrc *isrc, u_int irq) -{ - - /* - * 1. The link between ISRC and controller must be set atomically. - * 2. Just do things only once in rare case when consumers - * of shared interrupt came here at the same moment. - */ - mtx_lock_spin(&sc->mutex); - if (sc->pic_irqs[irq] != NULL) { - mtx_unlock_spin(&sc->mutex); - return (sc->pic_irqs[irq] == isrc ? 0 : EEXIST); - } - sc->pic_irqs[irq] = isrc; - isrc->isrc_data = irq; - mtx_unlock_spin(&sc->mutex); - - if (irq < NSOFT_IRQS) - intr_irq_set_name(isrc, "sint%u", irq); - else if (irq < NREAL_IRQS) - intr_irq_set_name(isrc, "int%u", irq - NSOFT_IRQS); - else - panic("Invalid irq %u", irq); - return (0); -} - -static int -pic_detach_isrc(struct mips_pic_softc *sc, struct intr_irqsrc *isrc, u_int irq) +static void +mips_pic_disable_intr(device_t dev, struct intr_irqsrc *isrc) { + u_int irq; - mtx_lock_spin(&sc->mutex); - if (sc->pic_irqs[irq] != isrc) { - mtx_unlock_spin(&sc->mutex); - return (sc->pic_irqs[irq] == NULL ? 0 : EINVAL); - } - sc->pic_irqs[irq] = NULL; - isrc->isrc_data = 0; - mtx_unlock_spin(&sc->mutex); - - intr_irq_set_name(isrc, "%s", ""); - return (0); + irq = ((struct mips_pic_irqsrc *)isrc)->irq; + pic_irq_mask(device_get_softc(dev), irq); } -static int -pic_irq_from_nspc(struct mips_pic_softc *sc, u_int type, u_int num, u_int *irqp) +static void +mips_pic_enable_intr(device_t dev, struct intr_irqsrc *isrc) { + u_int irq; - switch (type) { - case INTR_IRQ_NSPC_PLAIN: - *irqp = num; - return (*irqp < sc->nirqs ? 0 : EINVAL); - - case INTR_IRQ_NSPC_SWI: - *irqp = num; - return (num < NSOFT_IRQS ? 0 : EINVAL); - - case INTR_IRQ_NSPC_IRQ: - *irqp = num + NSOFT_IRQS; - return (num < NHARD_IRQS ? 0 : EINVAL); - - default: - return (EINVAL); - } + irq = ((struct mips_pic_irqsrc *)isrc)->irq; + pic_irq_unmask(device_get_softc(dev), irq); } static int -pic_map_nspc(struct mips_pic_softc *sc, struct intr_irqsrc *isrc, u_int *irqp) +mips_pic_map_intr(device_t dev, struct intr_map_data *data, + struct intr_irqsrc **isrcp) { - int error; - - error = pic_irq_from_nspc(sc, isrc->isrc_nspc_type, isrc->isrc_nspc_num, - irqp); - if (error != 0) - return (error); - return (pic_attach_isrc(sc, isrc, *irqp)); -} - #ifdef FDT -static int -pic_map_fdt(struct mips_pic_softc *sc, struct intr_irqsrc *isrc, u_int *irqp) -{ - u_int irq; - int error; + struct mips_pic_softc *sc; - irq = isrc->isrc_cells[0]; + sc = device_get_softc(dev); - if (irq >= sc->nirqs) + if (data == NULL || data->type != INTR_MAP_DATA_FDT || + data->fdt.ncells != 1 || data->fdt.cells[0] >= sc->nirqs) return (EINVAL); - error = pic_attach_isrc(sc, isrc, irq); - if (error != 0) - return (error); - - isrc->isrc_nspc_type = INTR_IRQ_NSPC_PLAIN; - isrc->isrc_nspc_num = irq; - isrc->isrc_trig = INTR_TRIGGER_CONFORM; - isrc->isrc_pol = INTR_POLARITY_CONFORM; - - *irqp = irq; + *isrcp = PIC_INTR_ISRC(sc, data->fdt.cells[0]); return (0); -} -#endif - -static int -mips_pic_register(device_t dev, struct intr_irqsrc *isrc, boolean_t *is_percpu) -{ - struct mips_pic_softc *sc = device_get_softc(dev); - u_int irq; - int error; - - if (isrc->isrc_type == INTR_ISRCT_NAMESPACE) - error = pic_map_nspc(sc, isrc, &irq); -#ifdef FDT - else if (isrc->isrc_type == INTR_ISRCT_FDT) - error = pic_map_fdt(sc, isrc, &irq); +#else + return (EINVAL); #endif - else - return (EINVAL); - - if (error == 0) - *is_percpu = TRUE; - return (error); -} - -static void -mips_pic_enable_intr(device_t dev, struct intr_irqsrc *isrc) -{ - - if (isrc->isrc_trig == INTR_TRIGGER_CONFORM) - isrc->isrc_trig = INTR_TRIGGER_LEVEL; -} - -static void -mips_pic_enable_source(device_t dev, struct intr_irqsrc *isrc) -{ - struct mips_pic_softc *sc = device_get_softc(dev); - u_int irq = isrc->isrc_data; - - pic_irq_unmask(sc, irq); -} - -static void -mips_pic_disable_source(device_t dev, struct intr_irqsrc *isrc) -{ - struct mips_pic_softc *sc = device_get_softc(dev); - u_int irq = isrc->isrc_data; - - pic_irq_mask(sc, irq); -} - -static int -mips_pic_unregister(device_t dev, struct intr_irqsrc *isrc) -{ - struct mips_pic_softc *sc = device_get_softc(dev); - u_int irq = isrc->isrc_data; - - return (pic_detach_isrc(sc, isrc, irq)); } static void mips_pic_pre_ithread(device_t dev, struct intr_irqsrc *isrc) { - mips_pic_disable_source(dev, isrc); + mips_pic_disable_intr(dev, isrc); } static void mips_pic_post_ithread(device_t dev, struct intr_irqsrc *isrc) { - mips_pic_enable_source(dev, isrc); + mips_pic_enable_intr(dev, isrc); } static void @@ -407,19 +339,6 @@ mips_pic_post_filter(device_t dev, struc { } -#ifdef SMP -static int -mips_pic_bind(device_t dev, struct intr_irqsrc *isrc) -{ - return (EOPNOTSUPP); -} - -static void -mips_pic_ipi_send(device_t dev, struct intr_irqsrc *isrc, cpuset_t cpus) -{ -} -#endif - static device_method_t mips_pic_methods[] = { /* Device interface */ #ifndef FDT @@ -427,20 +346,15 @@ static device_method_t mips_pic_methods[ #endif DEVMETHOD(device_probe, mips_pic_probe), DEVMETHOD(device_attach, mips_pic_attach), + /* Interrupt controller interface */ - DEVMETHOD(pic_disable_source, mips_pic_disable_source), + DEVMETHOD(pic_disable_intr, mips_pic_disable_intr), DEVMETHOD(pic_enable_intr, mips_pic_enable_intr), - DEVMETHOD(pic_enable_source, mips_pic_enable_source), - DEVMETHOD(pic_post_filter, mips_pic_post_filter), - DEVMETHOD(pic_post_ithread, mips_pic_post_ithread), + DEVMETHOD(pic_map_intr, mips_pic_map_intr), DEVMETHOD(pic_pre_ithread, mips_pic_pre_ithread), - DEVMETHOD(pic_register, mips_pic_register), - DEVMETHOD(pic_unregister, mips_pic_unregister), -#ifdef SMP - DEVMETHOD(pic_bind, mips_pic_bind), - DEVMETHOD(pic_init_secondary, mips_pic_init_secondary), - DEVMETHOD(pic_ipi_send, mips_pic_ipi_send), -#endif + DEVMETHOD(pic_post_ithread, mips_pic_post_ithread), + DEVMETHOD(pic_post_filter, mips_pic_post_filter), + { 0, 0 } }; @@ -469,7 +383,6 @@ void cpu_establish_hardintr(const char *name, driver_filter_t *filt, void (*handler)(void*), void *arg, int irq, int flags, void **cookiep) { - u_int vec; int res; /* @@ -479,17 +392,11 @@ cpu_establish_hardintr(const char *name, panic("%s called for unknown hard intr %d", __func__, irq); KASSERT(pic_sc != NULL, ("%s: no pic", __func__)); - vec = intr_namespace_map_irq(pic_sc->pic_dev, INTR_IRQ_NSPC_IRQ, irq); - KASSERT(vec != NIRQ, ("Unable to map hard IRQ %d\n", irq)); - res = intr_irq_add_handler(pic_sc->pic_dev, filt, handler, arg, vec, - flags, cookiep); + irq += NSOFT_IRQS; + res = intr_setup_irq(pic_sc->pic_dev, pic_sc->pic_irqs[irq].res, filt, + handler, arg, flags, cookiep); if (res != 0) panic("Unable to add hard IRQ %d handler", irq); - - (void)pic_irq_from_nspc(pic_sc, INTR_IRQ_NSPC_IRQ, irq, &vec); - KASSERT(pic_sc->pic_irqs[vec] != NULL, - ("Hard IRQ %d not registered\n", irq)); - intr_irq_set_name(pic_sc->pic_irqs[vec], "%s", name); } void @@ -497,23 +404,15 @@ cpu_establish_softintr(const char *name, void (*handler)(void*), void *arg, int irq, int flags, void **cookiep) { - u_int vec; int res; if (irq < 0 || irq > NSOFT_IRQS) panic("%s called for unknown soft intr %d", __func__, irq); KASSERT(pic_sc != NULL, ("%s: no pic", __func__)); - vec = intr_namespace_map_irq(pic_sc->pic_dev, INTR_IRQ_NSPC_SWI, irq); - KASSERT(vec <= NIRQ, ("Unable to map soft IRQ %d\n", irq)); - intr_irq_add_handler(pic_sc->pic_dev, filt, handler, arg, vec, - flags, cookiep); + res = intr_setup_irq(pic_sc->pic_dev, pic_sc->pic_irqs[irq].res, filt, + handler, arg, flags, cookiep); if (res != 0) panic("Unable to add soft IRQ %d handler", irq); - - (void)pic_irq_from_nspc(pic_sc, INTR_IRQ_NSPC_SWI, irq, &vec); - KASSERT(pic_sc->pic_irqs[vec] != NULL, - ("Soft IRQ %d not registered\n", irq)); - intr_irq_set_name(pic_sc->pic_irqs[vec], "%s", name); } Modified: head/sys/mips/mips/nexus.c ============================================================================== --- head/sys/mips/mips/nexus.c Thu Apr 7 10:36:50 2016 (r297664) +++ head/sys/mips/mips/nexus.c Thu Apr 7 10:48:26 2016 (r297665) @@ -457,14 +457,11 @@ static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { - int irq; #ifdef MIPS_INTRNG - for (irq = rman_get_start(res); irq <= rman_get_end(res); irq++) { - intr_irq_add_handler(child, filt, intr, arg, irq, flags, - cookiep); - } + return (intr_setup_irq(child, res, filt, intr, arg, flags, cookiep)); #else + int irq; register_t s; s = intr_disable(); @@ -477,8 +474,9 @@ nexus_setup_intr(device_t dev, device_t cpu_establish_hardintr(device_get_nameunit(child), filt, intr, arg, irq, flags, cookiep); intr_restore(s); -#endif + return (0); +#endif } static int @@ -486,7 +484,7 @@ nexus_teardown_intr(device_t dev, device { #ifdef MIPS_INTRNG - return (intr_irq_remove_handler(child, rman_get_start(r), ih)); + return (intr_teardown_irq(child, r, ih)); #else printf("Unimplemented %s at %s:%d\n", __func__, __FILE__, __LINE__); return (0); @@ -499,7 +497,8 @@ nexus_config_intr(device_t dev, int irq, enum intr_polarity pol) { - return (intr_irq_config(irq, trig, pol)); + device_printf(dev, "bus_config_intr is obsolete and not supported!\n"); + return (EOPNOTSUPP); } static int @@ -507,7 +506,7 @@ nexus_describe_intr(device_t dev, device void *cookie, const char *descr) { - return (intr_irq_describe(rman_get_start(irq), cookie, descr)); + return (intr_describe_irq(child, irq, cookie, descr)); } #ifdef SMP @@ -515,7 +514,7 @@ static int nexus_bind_intr(device_t dev, device_t child, struct resource *irq, int cpu) { - return (intr_irq_bind(rman_get_start(irq), cpu)); + return (intr_bind_irq(child, irq, cpu)); } #endif From owner-svn-src-all@freebsd.org Thu Apr 7 11:02:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FDBCB06098; Thu, 7 Apr 2016 11:02:51 +0000 (UTC) (envelope-from sgalabov@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 mx1.freebsd.org (Postfix) with ESMTPS id AF1CD1340; Thu, 7 Apr 2016 11:02:50 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37B2nlx042785; Thu, 7 Apr 2016 11:02:49 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37B2nIe042779; Thu, 7 Apr 2016 11:02:49 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201604071102.u37B2nIe042779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Thu, 7 Apr 2016 11:02:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297666 - head/sys/mips/mediatek X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 11:02:51 -0000 Author: sgalabov Date: Thu Apr 7 11:02:49 2016 New Revision: 297666 URL: https://svnweb.freebsd.org/changeset/base/297666 Log: This revision adds the following parts: - machine dependent low level init code - SoC clocks detection and some utility functions - Common interface to read/write/modify SoC system control registers, used by some of the other drivers and utility functions - simple FDT resets support, based on the fdt_clock implementation already in the tree. For the moment resets and clocks are managed using these implementations. I am planning to port those to the new extres framework in the future, but currently I simply don't have time to do this part too. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5826 Added: head/sys/mips/mediatek/ head/sys/mips/mediatek/fdt_reset.c (contents, props changed) head/sys/mips/mediatek/fdt_reset.h (contents, props changed) head/sys/mips/mediatek/fdt_reset_if.m (contents, props changed) head/sys/mips/mediatek/mtk_machdep.c (contents, props changed) head/sys/mips/mediatek/mtk_soc.c (contents, props changed) head/sys/mips/mediatek/mtk_soc.h (contents, props changed) head/sys/mips/mediatek/mtk_sysctl.c (contents, props changed) head/sys/mips/mediatek/mtk_sysctl.h (contents, props changed) Added: head/sys/mips/mediatek/fdt_reset.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/fdt_reset.c Thu Apr 7 11:02:49 2016 (r297666) @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 2016 Stanislav Galabov + * Copyright (c) 2014 Ian Lepore + * 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. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "fdt_reset_if.h" +#include + +/* + * Loop through all the tuples in the resets= property for a device, asserting + * or deasserting each reset. + * + * Be liberal about errors for now: warn about a failure to (de)assert but keep + * trying with any other resets in the list. Return ENXIO if any errors were + * found, and let the caller decide whether the problem is fatal. + */ +static int +assert_deassert_all(device_t consumer, boolean_t assert) +{ + phandle_t rnode; + device_t resetdev; + int resetnum, err, i, ncells; + uint32_t *resets; + boolean_t anyerrors; + + rnode = ofw_bus_get_node(consumer); + ncells = OF_getencprop_alloc(rnode, "resets", sizeof(*resets), + (void **)&resets); + if (!assert && ncells < 2) { + device_printf(consumer, "Warning: No resets specified in fdt " + "data; device may not function."); + return (ENXIO); + } + anyerrors = false; + for (i = 0; i < ncells; i += 2) { + resetdev = OF_device_from_xref(resets[i]); + resetnum = resets[i + 1]; + if (resetdev == NULL) { + if (!assert) + device_printf(consumer, "Warning: can not find " + "driver for reset number %u; device may " + "not function\n", resetnum); + anyerrors = true; + continue; + } + if (assert) + err = FDT_RESET_ASSERT(resetdev, resetnum); + else + err = FDT_RESET_DEASSERT(resetdev, resetnum); + if (err != 0) { + if (!assert) + device_printf(consumer, "Warning: failed to " + "deassert reset number %u; device may not " + "function\n", resetnum); + anyerrors = true; + } + } + free(resets, M_OFWPROP); + return (anyerrors ? ENXIO : 0); +} + +int +fdt_reset_assert_all(device_t consumer) +{ + + return (assert_deassert_all(consumer, true)); +} + +int +fdt_reset_deassert_all(device_t consumer) +{ + + return (assert_deassert_all(consumer, false)); +} + +void +fdt_reset_register_provider(device_t provider) +{ + + OF_device_register_xref( + OF_xref_from_node(ofw_bus_get_node(provider)), provider); +} + +void +fdt_reset_unregister_provider(device_t provider) +{ + + OF_device_register_xref(OF_xref_from_device(provider), NULL); +} + Added: head/sys/mips/mediatek/fdt_reset.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/fdt_reset.h Thu Apr 7 11:02:49 2016 (r297666) @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2016 Stanislav Galabov + * Copyright (c) 2014 Ian Lepore + * 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 ``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. + * + * $FreeBSD$ + */ + +#ifndef DEV_FDT_RESET_H +#define DEV_FDT_RESET_H + +#include "fdt_reset_if.h" + +/* + * Look up "resets" property in consumer's fdt data and assert or deassert all + * configured resets. + */ +int fdt_reset_assert_all(device_t consumer); +int fdt_reset_deassert_all(device_t consumer); + +/* + * [Un]register the given device instance as a driver that implements the + * fdt_clock interface. + */ +void fdt_reset_register_provider(device_t provider); +void fdt_reset_unregister_provider(device_t provider); + +#endif /* DEV_FDT_RESET_H */ + Added: head/sys/mips/mediatek/fdt_reset_if.m ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/fdt_reset_if.m Thu Apr 7 11:02:49 2016 (r297666) @@ -0,0 +1,58 @@ +#- +# Copyright (c) 2016 Stanislav Galabov +# Copyright (c) 2014 Ian Lepore +# 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. +# +# $FreeBSD$ +# + +#include + +# +# This is the interface that fdt_reset drivers provide to other drivers. +# In this context, reset refers to a reset signal provided to some other +# hardware component within the system. They are most often found within +# embedded processors that have on-chip IO controllers. +# + +INTERFACE fdt_reset; + +# +# Enable/assert/apply the specified reset. +# Returns 0 on success or a standard errno value. +# +METHOD int assert { + device_t provider; + int index; +}; + +# +# Disable/de-assert/remove the specified reset. +# Returns 0 on success or a standard errno value. +# +METHOD int deassert { + device_t provider; + int index; +}; + Added: head/sys/mips/mediatek/mtk_machdep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_machdep.c Thu Apr 7 11:02:49 2016 (r297666) @@ -0,0 +1,286 @@ +/*- + * Copyright (C) 2015-2016 by Stanislav Galabov. All rights reserved. + * Copyright (C) 2010-2011 by Aleksandr Rybalko. All rights reserved. + * Copyright (C) 2007 by Oleksandr Tymoshenko. 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 ``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 HIS RELATIVES 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 MIND, 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 "opt_ddb.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "opt_platform.h" +#include "opt_rt305x.h" + +#include +#include + +extern int *edata; +extern int *end; +static char boot1_env[0x1000]; + +void +platform_cpu_init() +{ + /* Nothing special */ +} + +static void +mips_init(void) +{ + struct mem_region mr[FDT_MEM_REGIONS]; + uint64_t val; + int i, j, mr_cnt; + char *memsize; + + printf("entry: mips_init()\n"); + + bootverbose = 1; + + for (i = 0; i < 10; i++) + phys_avail[i] = 0; + + dump_avail[0] = phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end); + + /* + * The most low memory MT7621 can have. Currently MT7621 is the chip + * that supports the most memory, so that seems reasonable. + */ + realmem = btoc(448 * 1024 * 1024); + + if (fdt_get_mem_regions(mr, &mr_cnt, &val) == 0) { + physmem = btoc(val); + + printf("RAM size: %ldMB (from FDT)\n", + ctob(physmem) / (1024 * 1024)); + + KASSERT((phys_avail[0] >= mr[0].mr_start) && \ + (phys_avail[0] < (mr[0].mr_start + mr[0].mr_size)), + ("First region is not within FDT memory range")); + + /* Limit size of the first region */ + phys_avail[1] = (mr[0].mr_start + + MIN(mr[0].mr_size, ctob(realmem))); + dump_avail[1] = phys_avail[1]; + + /* Add the rest of the regions */ + for (i = 1, j = 2; i < mr_cnt; i++, j+=2) { + phys_avail[j] = mr[i].mr_start; + phys_avail[j+1] = (mr[i].mr_start + mr[i].mr_size); + dump_avail[j] = phys_avail[j]; + dump_avail[j+1] = phys_avail[j+1]; + } + } else { + if ((memsize = kern_getenv("memsize")) != NULL) { + physmem = btoc(strtol(memsize, NULL, 0) << 20); + printf("RAM size: %ldMB (from memsize)\n", + ctob(physmem) / (1024 * 1024)); + } else { /* All else failed, assume 32MB */ + physmem = btoc(32 * 1024 * 1024); + printf("RAM size: %ldMB (assumed)\n", + ctob(physmem) / (1024 * 1024)); + } + + if (ctob(physmem) < (448 * 1024 * 1024)) { + /* + * Anything up to 448MB is assumed to be directly + * mappable as low memory... + */ + dump_avail[1] = phys_avail[1] = ctob(physmem); + } else if (mtk_soc_get_socid() == MTK_SOC_MT7621) { + /* + * On MT7621 the low memory is limited to 448MB, the + * rest is high memory, mapped at 0x20000000 + */ + phys_avail[1] = 448 * 1024 * 1024; + phys_avail[2] = 0x20000000; + phys_avail[3] = phys_avail[2] + ctob(physmem) - + phys_avail[1]; + dump_avail[1] = phys_avail[1] - phys_avail[0]; + dump_avail[2] = phys_avail[2]; + dump_avail[3] = phys_avail[3] - phys_avail[2]; + } else { + /* + * We have > 448MB RAM and we're not MT7621? Currently + * there is no such chip, so we'll just limit the RAM to + * 32MB and let the user know... + */ + printf("Unknown chip, assuming 32MB RAM\n"); + physmem = btoc(32 * 1024 * 1024); + dump_avail[1] = phys_avail[1] = ctob(physmem); + } + } + + if (physmem < realmem) + realmem = physmem; + + init_param1(); + init_param2(physmem); + mips_cpu_init(); + pmap_bootstrap(); + mips_proc0_init(); + mutex_init(); + kdb_init(); +#ifdef KDB + if (boothowto & RB_KDB) + kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger"); +#endif +} + +void +platform_reset(void) +{ + + mtk_soc_reset(); +} + +void +platform_start(__register_t a0 __unused, __register_t a1 __unused, + __register_t a2 __unused, __register_t a3 __unused) +{ + vm_offset_t kernend; + int argc = a0, i;//, res; + uint32_t timer_clk; + char **argv = (char **)MIPS_PHYS_TO_KSEG0(a1); + char **envp = (char **)MIPS_PHYS_TO_KSEG0(a2); + void *dtbp; + + /* clear the BSS and SBSS segments */ + kernend = (vm_offset_t)&end; + memset(&edata, 0, kernend - (vm_offset_t)(&edata)); + + mips_postboot_fixup(); + + /* Initialize pcpu stuff */ + mips_pcpu0_init(); + + dtbp = &fdt_static_dtb; + if (OF_install(OFW_FDT, 0) == FALSE) + while (1); + if (OF_init((void *)dtbp) != 0) + while (1); + + mtk_soc_try_early_detect(); + if ((timer_clk = mtk_soc_get_timerclk()) == 0) + timer_clk = 1000000000; /* no such speed yet */ + + mips_timer_early_init(timer_clk); + + /* initialize console so that we have printf */ + boothowto |= (RB_SERIAL | RB_MULTIPLE); /* Use multiple consoles */ + boothowto |= (RB_VERBOSE); + cninit(); + + init_static_kenv(boot1_env, sizeof(boot1_env)); + + printf("FDT DTB at: 0x%08x\n", (uint32_t)dtbp); + + printf("CPU clock: %4dMHz\n", mtk_soc_get_cpuclk()/(1000*1000)); + printf("Timer clock: %4dMHz\n", timer_clk/(1000*1000)); + printf("UART clock: %4dMHz\n\n", mtk_soc_get_uartclk()/(1000*1000)); + + printf("U-Boot args (from %d args):\n", argc - 1); + + if (argc == 1) + printf("\tNone\n"); + + for (i = 1; i < argc; i++) { + char *n = "argv ", *arg; + + if (i > 99) + break; + + if (argv[i]) + { + arg = (char *)(intptr_t)MIPS_PHYS_TO_KSEG0(argv[i]); + printf("\targv[%d] = %s\n", i, arg); + sprintf(n, "argv%d", i); + kern_setenv(n, arg); + } + } + + printf("Environment:\n"); + + for (i = 0; envp[i] && MIPS_IS_VALID_PTR(envp[i]); i++) { + char *n, *arg; + + arg = (char *)(intptr_t)MIPS_PHYS_TO_KSEG0(envp[i]); + if (! MIPS_IS_VALID_PTR(arg)) + continue; + printf("\t%s\n", arg); + n = strsep(&arg, "="); + if (arg == NULL) + kern_setenv(n, "1"); + else + kern_setenv(n, arg); + } + + + mips_init(); + mips_timer_init_params(timer_clk, 0); +} Added: head/sys/mips/mediatek/mtk_soc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_soc.c Thu Apr 7 11:02:49 2016 (r297666) @@ -0,0 +1,438 @@ +/*- + * Copyright (c) 2016 Stanislav Galabov. + * 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 +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +static uint32_t mtk_soc_socid = MTK_SOC_UNKNOWN; +static uint32_t mtk_soc_uartclk = 0; +static uint32_t mtk_soc_cpuclk = MTK_CPU_CLK_880MHZ; +static uint32_t mtk_soc_timerclk = MTK_CPU_CLK_880MHZ / 2; + +static const struct ofw_compat_data compat_data[] = { + { "ralink,rt3050-soc", MTK_SOC_RT3050 }, + { "ralink,rt3052-soc", MTK_SOC_RT3052 }, + { "ralink,rt3350-soc", MTK_SOC_RT3350 }, + { "ralink,rt3352-soc", MTK_SOC_RT3352 }, + { "ralink,rt3662-soc", MTK_SOC_RT3662 }, + { "ralink,rt3883-soc", MTK_SOC_RT3883 }, + { "ralink,rt5350-soc", MTK_SOC_RT5350 }, + { "ralink,mtk7620a-soc", MTK_SOC_MT7620A }, + { "ralink,mtk7620n-soc", MTK_SOC_MT7620N }, + { "mediatek,mtk7621-soc", MTK_SOC_MT7621 }, + { "ralink,mtk7621-soc", MTK_SOC_MT7621 }, + { "ralink,mtk7628an-soc", MTK_SOC_MT7628 }, + { "mediatek,mt7628an-soc", MTK_SOC_MT7628 }, + { "ralink,mtk7688-soc", MTK_SOC_MT7688 }, + + /* Sentinel */ + { NULL, MTK_SOC_UNKNOWN }, +}; + +static uint32_t +mtk_detect_cpuclk_rt305x(bus_space_tag_t bst, bus_space_handle_t bsh) +{ + uint32_t clk; + + clk = bus_space_read_4(bst, bsh, SYSCTL_SYSCFG); + clk >>= RT305X_CPU_CLKSEL_OFF; + clk &= RT305X_CPU_CLKSEL_MSK; + + return ((clk == 0) ? MTK_CPU_CLK_320MHZ : MTK_CPU_CLK_384MHZ); +} + +static uint32_t +mtk_detect_cpuclk_rt3352(bus_space_tag_t bst, bus_space_handle_t bsh) +{ + uint32_t val; + + val = bus_space_read_4(bst, bsh, SYSCTL_SYSCFG); + val >>= RT3352_CPU_CLKSEL_OFF; + val &= RT3352_CPU_CLKSEL_MSK; + + if (val) + return (MTK_CPU_CLK_400MHZ); + + return (MTK_CPU_CLK_384MHZ); +} + +static uint32_t +mtk_detect_cpuclk_rt3883(bus_space_tag_t bst, bus_space_handle_t bsh) +{ + uint32_t val; + + val = bus_space_read_4(bst, bsh, SYSCTL_SYSCFG); + val >>= RT3883_CPU_CLKSEL_OFF; + val &= RT3883_CPU_CLKSEL_MSK; + + switch (val) { + case 0: + return (MTK_CPU_CLK_250MHZ); + case 1: + return (MTK_CPU_CLK_384MHZ); + case 2: + return (MTK_CPU_CLK_480MHZ); + case 3: + return (MTK_CPU_CLK_500MHZ); + } + + /* Never reached */ + return (0); +} + +static uint32_t +mtk_detect_cpuclk_rt5350(bus_space_tag_t bst, bus_space_handle_t bsh) +{ + uint32_t val1, val2; + + val1 = val2 = bus_space_read_4(bst, bsh, SYSCTL_SYSCFG); + + val1 >>= RT5350_CPU_CLKSEL_OFF1; + val2 >>= RT5350_CPU_CLKSEL_OFF2; + val1 &= RT5350_CPU_CLKSEL_MSK; + val2 &= RT5350_CPU_CLKSEL_MSK; + val1 |= (val2 << 1); + + switch (val1) { + case 0: + return (MTK_CPU_CLK_360MHZ); + case 1: + /* Reserved value, but we return UNKNOWN */ + return (MTK_CPU_CLK_UNKNOWN); + case 2: + return (MTK_CPU_CLK_320MHZ); + case 3: + return (MTK_CPU_CLK_300MHZ); + } + + /* Never reached */ + return (0); +} + +static uint32_t +mtk_detect_cpuclk_mt7620(bus_space_tag_t bst, bus_space_handle_t bsh) +{ + uint32_t val, mul, div, res; + + val = bus_space_read_4(bst, bsh, SYSCTL_MT7620_CPLL_CFG1); + if (val & MT7620_CPU_CLK_AUX0) + return (MTK_CPU_CLK_480MHZ); + + val = bus_space_read_4(bst, bsh, SYSCTL_MT7620_CPLL_CFG0); + if (!(val & MT7620_CPLL_SW_CFG)) + return (MTK_CPU_CLK_600MHZ); + + mul = MT7620_PLL_MULT_RATIO_BASE + ((val >> MT7620_PLL_MULT_RATIO_OFF) & + MT7620_PLL_MULT_RATIO_MSK); + div = (val >> MT7620_PLL_DIV_RATIO_OFF) & MT7620_PLL_DIV_RATIO_MSK; + + if (div != MT7620_PLL_DIV_RATIO_MSK) + div += MT7620_PLL_DIV_RATIO_BASE; + else + div = MT7620_PLL_DIV_RATIO_MAX; + + res = (MT7620_XTAL_40 * mul) / div; + + return (MTK_MHZ(res)); +} + +static uint32_t +mtk_detect_cpuclk_mt7621(bus_space_tag_t bst, bus_space_handle_t bsh) +{ + uint32_t val, div, res; + + val = bus_space_read_4(bst, bsh, SYSCTL_CLKCFG0); + if (val & MT7621_USES_MEMDIV) { + div = bus_space_read_4(bst, bsh, MTK_MT7621_CLKDIV_REG); + div >>= MT7621_MEMDIV_OFF; + div &= MT7621_MEMDIV_MSK; + div += MT7621_MEMDIV_BASE; + + val = bus_space_read_4(bst, bsh, SYSCTL_SYSCFG); + val >>= MT7621_CLKSEL_OFF; + val &= MT7621_CLKSEL_MSK; + + if (val >= MT7621_CLKSEL_25MHZ_VAL) + res = div * MT7621_CLKSEL_25MHZ; + else if (val >= MT7621_CLKSEL_20MHZ_VAL) + res = div * MT7621_CLKSEL_20MHZ; + else + res = div * 0; /* XXX: not sure about this */ + } else { + val = bus_space_read_4(bst, bsh, SYSCTL_CUR_CLK_STS); + div = (val >> MT7621_CLK_STS_DIV_OFF) & MT7621_CLK_STS_MSK; + val &= MT7621_CLK_STS_MSK; + + res = (MT7621_CLK_STS_BASE * val) / div; + } + + return (MTK_MHZ(res)); +} + +static uint32_t +mtk_detect_cpuclk_mt7628(bus_space_tag_t bst, bus_space_handle_t bsh) +{ + uint32_t val; + + val = bus_space_read_4(bst, bsh, SYSCTL_SYSCFG); + val >>= MT7628_CPU_CLKSEL_OFF; + val &= MT7628_CPU_CLKSEL_MSK; + + if (val) + return (MTK_CPU_CLK_580MHZ); + + return (MTK_CPU_CLK_575MHZ); +} + +void +mtk_soc_try_early_detect(void) +{ + bus_space_tag_t bst; + bus_space_handle_t bsh; + uint32_t base; + phandle_t node; + int i; + + if ((node = OF_finddevice("/")) == -1) + return; + + for (i = 0; compat_data[i].ocd_str != NULL; i++) { + if (fdt_is_compatible(node, compat_data[i].ocd_str)) { + mtk_soc_socid = compat_data[i].ocd_data; + break; + } + } + + if (mtk_soc_socid == MTK_SOC_UNKNOWN) { + /* We don't know the SoC, so we don't know how to get clocks */ + return; + } + + bst = fdtbus_bs_tag; + if (mtk_soc_socid == MTK_SOC_MT7621) + base = MTK_MT7621_BASE; + else + base = MTK_DEFAULT_BASE; + + if (bus_space_map(bst, MTK_DEFAULT_BASE, MTK_DEFAULT_SIZE, 0, &bsh)) + return; + + /* First, figure out the CPU clock */ + switch (mtk_soc_socid) { + case MTK_SOC_RT3050: /* fallthrough */ + case MTK_SOC_RT3052: + mtk_soc_cpuclk = mtk_detect_cpuclk_rt305x(bst, bsh); + break; + case MTK_SOC_RT3350: + mtk_soc_cpuclk = MTK_CPU_CLK_320MHZ; + break; + case MTK_SOC_RT3352: + mtk_soc_cpuclk = mtk_detect_cpuclk_rt3352(bst, bsh); + break; + case MTK_SOC_RT3662: /* fallthrough */ + case MTK_SOC_RT3883: + mtk_soc_cpuclk = mtk_detect_cpuclk_rt3883(bst, bsh); + break; + case MTK_SOC_RT5350: + mtk_soc_cpuclk = mtk_detect_cpuclk_rt5350(bst, bsh); + break; + case MTK_SOC_MT7620A: /* fallthrough */ + case MTK_SOC_MT7620N: + mtk_soc_cpuclk = mtk_detect_cpuclk_mt7620(bst, bsh); + break; + case MTK_SOC_MT7621: + mtk_soc_cpuclk = mtk_detect_cpuclk_mt7621(bst, bsh); + break; + case MTK_SOC_MT7628: /* fallthrough */ + case MTK_SOC_MT7688: + mtk_soc_cpuclk = mtk_detect_cpuclk_mt7628(bst, bsh); + break; + default: + /* We don't know the SoC, so we can't find the CPU clock */ + break; + } + + /* Now figure out the timer clock */ + if (mtk_soc_socid == MTK_SOC_MT7621) { +#ifdef notyet + /* + * We use the GIC timer for timing source and its clock freq is + * the same as the CPU's clock freq + */ + mtk_soc_timerclk = mtk_soc_cpuclk; +#else + /* + * When GIC timer and MIPS timer are ready to co-exist and + * GIC timer is actually implemented, we need to switch to it. + * Until then we use a fake GIC timer, which is actually a + * normal MIPS ticker, so the timer clock is half the CPU clock + */ + mtk_soc_timerclk = mtk_soc_cpuclk / 2; +#endif + } else { + /* + * We use the MIPS ticker for the rest for now, so + * the CPU clock is divided by 2 + */ + mtk_soc_timerclk = mtk_soc_cpuclk / 2; + } + + switch (mtk_soc_socid) { + case MTK_SOC_RT3350: /* fallthrough */ + case MTK_SOC_RT3050: /* fallthrough */ + case MTK_SOC_RT3052: + /* UART clock is CPU clock / 3 */ + mtk_soc_uartclk = mtk_soc_cpuclk / MTK_UARTDIV_3; + break; + case MTK_SOC_RT3352: /* fallthrough */ + case MTK_SOC_RT3662: /* fallthrough */ + case MTK_SOC_RT3883: /* fallthrough */ + case MTK_SOC_RT5350: /* fallthrough */ + case MTK_SOC_MT7620A: /* fallthrough */ + case MTK_SOC_MT7620N: /* fallthrough */ + case MTK_SOC_MT7628: /* fallthrough */ + case MTK_SOC_MT7688: + /* UART clock is always 40MHz */ + mtk_soc_uartclk = MTK_UART_CLK_40MHZ; + break; + case MTK_SOC_MT7621: + /* UART clock is always 50MHz */ + mtk_soc_uartclk = MTK_UART_CLK_50MHZ; + break; + default: + /* We don't know the SoC, so we don't know the UART clock */ + break; + } + + bus_space_unmap(bst, bsh, MTK_DEFAULT_SIZE); +} + +uint32_t +mtk_soc_get_uartclk(void) +{ + + return mtk_soc_uartclk; +} + +uint32_t +mtk_soc_get_cpuclk(void) +{ + + return mtk_soc_cpuclk; +} + +uint32_t +mtk_soc_get_timerclk(void) +{ + + return mtk_soc_timerclk; +} + +uint32_t +mtk_soc_get_socid(void) +{ + + return mtk_soc_socid; +} + +/* + * The following are generic reset and clock functions + */ + +/* Default reset time is 100ms */ +#define DEFAULT_RESET_TIME 100000 + +int +mtk_soc_reset_device(device_t dev) +{ + int res; + + res = fdt_reset_assert_all(dev); + if (res == 0) { + DELAY(DEFAULT_RESET_TIME); + res = fdt_reset_deassert_all(dev); + if (res == 0) + DELAY(DEFAULT_RESET_TIME); + } + + return (res); +} + +int +mtk_soc_stop_clock(device_t dev) +{ + + return (fdt_clock_disable_all(dev)); +} + +int +mtk_soc_start_clock(device_t dev) +{ + + return (fdt_clock_enable_all(dev)); +} + +int +mtk_soc_assert_reset(device_t dev) +{ + + return (fdt_reset_assert_all(dev)); +} + +int +mtk_soc_deassert_reset(device_t dev) +{ + + return (fdt_reset_deassert_all(dev)); +} + +void +mtk_soc_reset(void) +{ + + mtk_sysctl_clr_set(SYSCTL_RSTCTRL, 0, 1); + mtk_sysctl_clr_set(SYSCTL_RSTCTRL, 1, 0); +} Added: head/sys/mips/mediatek/mtk_soc.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_soc.h Thu Apr 7 11:02:49 2016 (r297666) @@ -0,0 +1,130 @@ +/*- + * Copyright (c) 2016 Stanislav Galabov. + * 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 unmodified, 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. + * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Apr 7 11:08:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3782B065D9; Thu, 7 Apr 2016 11:08:51 +0000 (UTC) (envelope-from sgalabov@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 mx1.freebsd.org (Postfix) with ESMTPS id BDFF91A32; Thu, 7 Apr 2016 11:08:51 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37B8oHX043012; Thu, 7 Apr 2016 11:08:50 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37B8oLq043008; Thu, 7 Apr 2016 11:08:50 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201604071108.u37B8oLq043008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Thu, 7 Apr 2016 11:08:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297667 - head/sys/mips/mediatek X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 11:08:52 -0000 Author: sgalabov Date: Thu Apr 7 11:08:50 2016 New Revision: 297667 URL: https://svnweb.freebsd.org/changeset/base/297667 Log: Initial import of Ralink/Mediatek MIPS SoC support #2 This revision adds the following to the Mediatek/Ralink support: - initial support for "clocks" FDT property, currently based on fdt_clock - initial support for "resets" FDT property, currently based on the fdt_reset interface from D5826 - initial support for "pinctrl,bits" functionality via FDT. May be extended in the future to cover a better and fuller pinctrl implementation Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5827 Added: head/sys/mips/mediatek/mtk_clock.c (contents, props changed) head/sys/mips/mediatek/mtk_pinctrl.c (contents, props changed) head/sys/mips/mediatek/mtk_reset.c (contents, props changed) Added: head/sys/mips/mediatek/mtk_clock.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_clock.c Thu Apr 7 11:08:50 2016 (r297667) @@ -0,0 +1,156 @@ +/*- + * Copyright (c) 2016 Stanislav Galabov + * 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, + * without modification, immediately at the beginning of the file. + * 2. 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 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 +#include +#include + +#include + +#include "fdt_clock_if.h" + +static const struct ofw_compat_data compat_data[] = { + { "ralink,rt2880-clock", 1 }, + + /* Sentinel */ + { NULL, 0 } +}; + +static int +mtk_clock_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "MTK Clock Controller"); + + return (0); +} + +static int +mtk_clock_attach(device_t dev) +{ + + if (device_get_unit(dev) != 0) { + device_printf(dev, "Only one clock control allowed\n"); + return (ENXIO); + } + + fdt_clock_register_provider(dev); + + return (0); +} + +#define CLOCK_ENABLE 1 +#define CLOCK_DISABLE 0 + +static int +mtk_clock_set(device_t dev, int index, int value) +{ + uint32_t mask; + + /* Clock config register holds 32 clock gating bits */ + if (index < 0 || index > 31) + return (EINVAL); + + mask = (1u << index); + + if (value == CLOCK_ENABLE) + mtk_sysctl_clr_set(SYSCTL_CLKCFG1, 0, mask); + else + mtk_sysctl_clr_set(SYSCTL_CLKCFG1, mask, 0); + + return (0); +} + +static int +mtk_clock_enable(device_t dev, int index) +{ + + return mtk_clock_set(dev, index, CLOCK_ENABLE); +} + +static int +mtk_clock_disable(device_t dev, int index) +{ + + return mtk_clock_set(dev, index, CLOCK_DISABLE); +} + +static int +mtk_clock_get_info(device_t dev, int index, struct fdt_clock_info *info) +{ + uint32_t mask; + + if (index < 0 || index > 31 || info == NULL) + return (EINVAL); + + if (mtk_sysctl_get(SYSCTL_CLKCFG1) & mask) + info->flags = FDT_CIFLAG_RUNNING; + else + info->flags = 0; + + return (0); +} + +static device_method_t mtk_clock_methods[] = { + DEVMETHOD(device_probe, mtk_clock_probe), + DEVMETHOD(device_attach, mtk_clock_attach), + + /* fdt_clock interface */ + DEVMETHOD(fdt_clock_enable, mtk_clock_enable), + DEVMETHOD(fdt_clock_disable, mtk_clock_disable), + DEVMETHOD(fdt_clock_get_info, mtk_clock_get_info), + + DEVMETHOD_END +}; + +static driver_t mtk_clock_driver = { + "clkctrl", + mtk_clock_methods, + 0, +}; +static devclass_t mtk_clock_devclass; + +EARLY_DRIVER_MODULE(mtk_clock, simplebus, mtk_clock_driver, mtk_clock_devclass, + 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_EARLY); + +MODULE_DEPEND(mtk_clock, mtk_sysctl, 1, 1, 1); Added: head/sys/mips/mediatek/mtk_pinctrl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_pinctrl.c Thu Apr 7 11:08:50 2016 (r297667) @@ -0,0 +1,114 @@ +/*- + * Copyright (c) 2016 Stanislav Galabov + * 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, + * without modification, immediately at the beginning of the file. + * 2. 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 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 +#include + +#include +#include + +#include "fdt_pinctrl_if.h" + +static const struct ofw_compat_data compat_data[] = { + { "ralink,rt2880-pinctrl", 1 }, + + /* Sentinel */ + { NULL, 0 } +}; + +static int +mtk_pinctrl_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "MTK Pin Controller"); + + return (0); +} + +static int +mtk_pinctrl_attach(device_t dev) +{ + + if (device_get_unit(dev) != 0) { + device_printf(dev, "Only one pin control allowed\n"); + return (ENXIO); + } + + fdt_pinctrl_register(dev, "pinctrl-single,bits"); + fdt_pinctrl_configure_tree(dev); + + if (bootverbose) + device_printf(dev, "GPIO mode: 0x%08x\n", + mtk_sysctl_get(SYSCTL_GPIOMODE)); + + return (0); +} + +static int +mtk_pinctrl_configure(device_t dev, phandle_t cfgxref) +{ + + return (EINVAL); +} + +static device_method_t mtk_pinctrl_methods[] = { + DEVMETHOD(device_probe, mtk_pinctrl_probe), + DEVMETHOD(device_attach, mtk_pinctrl_attach), + + /* fdt_pinctrl interface */ + DEVMETHOD(fdt_pinctrl_configure, mtk_pinctrl_configure), + + DEVMETHOD_END +}; + +static driver_t mtk_pinctrl_driver = { + "pinctrl", + mtk_pinctrl_methods, + 0, +}; +static devclass_t mtk_pinctrl_devclass; + +EARLY_DRIVER_MODULE(mtk_pinctrl, simplebus, mtk_pinctrl_driver, + mtk_pinctrl_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_EARLY); + +MODULE_DEPEND(mtk_pinctrl, mtk_sysctl, 1, 1, 1); Added: head/sys/mips/mediatek/mtk_reset.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_reset.c Thu Apr 7 11:08:50 2016 (r297667) @@ -0,0 +1,139 @@ +/*- + * Copyright (c) 2016 Stanislav Galabov + * 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, + * without modification, immediately at the beginning of the file. + * 2. 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 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 +#include + +#include +#include + +#include "fdt_reset_if.h" + +static const struct ofw_compat_data compat_data[] = { + { "ralink,rt2880-reset", 1 }, + + /* Sentinel */ + { NULL, 0 } +}; + +static int +mtk_reset_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "MTK Reset Controller"); + + return (0); +} + +static int +mtk_reset_attach(device_t dev) +{ + + if (device_get_unit(dev) != 0) { + device_printf(dev, "Only one reset control allowed\n"); + return (ENXIO); + } + + fdt_reset_register_provider(dev); + + return (0); +} + +#define RESET_ASSERT 1 +#define RESET_DEASSERT 0 + +static int +mtk_reset_set(device_t dev, int index, int value) +{ + uint32_t mask; + + /* index 0 is SoC reset, indices 1 - 31 are valid peripheral resets */ + if (index < 1 || index > 31) + return (EINVAL); + + mask = (1u << index); + + if (value == RESET_ASSERT) + mtk_sysctl_clr_set(SYSCTL_RSTCTRL, 0, mask); + else + mtk_sysctl_clr_set(SYSCTL_RSTCTRL, mask, 0); + + return (0); +} + +static int +mtk_reset_assert(device_t dev, int index) +{ + + return mtk_reset_set(dev, index, RESET_ASSERT); +} + +static int +mtk_reset_deassert(device_t dev, int index) +{ + + return mtk_reset_set(dev, index, RESET_DEASSERT); +} + +static device_method_t mtk_reset_methods[] = { + DEVMETHOD(device_probe, mtk_reset_probe), + DEVMETHOD(device_attach, mtk_reset_attach), + + /* fdt_reset interface */ + DEVMETHOD(fdt_reset_assert, mtk_reset_assert), + DEVMETHOD(fdt_reset_deassert, mtk_reset_deassert), + + DEVMETHOD_END +}; + +static driver_t mtk_reset_driver = { + "rstctrl", + mtk_reset_methods, + 0, +}; +static devclass_t mtk_reset_devclass; + +EARLY_DRIVER_MODULE(mtk_reset, simplebus, mtk_reset_driver, mtk_reset_devclass, + 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_EARLY); + +MODULE_DEPEND(mtk_reset, mtk_sysctl, 1, 1, 1); From owner-svn-src-all@freebsd.org Thu Apr 7 11:12:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E54EBB0682E; Thu, 7 Apr 2016 11:12:38 +0000 (UTC) (envelope-from sgalabov@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 mx1.freebsd.org (Postfix) with ESMTPS id B4B7D1E0E; Thu, 7 Apr 2016 11:12:38 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37BCc1O045777; Thu, 7 Apr 2016 11:12:38 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37BCbU7045774; Thu, 7 Apr 2016 11:12:37 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201604071112.u37BCbU7045774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Thu, 7 Apr 2016 11:12:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297668 - head/sys/mips/mediatek X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 11:12:39 -0000 Author: sgalabov Date: Thu Apr 7 11:12:37 2016 New Revision: 297668 URL: https://svnweb.freebsd.org/changeset/base/297668 Log: Initial import of Ralink/Mediatek MIPS SoC support #3 Interrupt controllers found in various Mediatek/Ralink SoCs. mtk_intr_v1 and mtk_intr_v2 are basically the same at the moment, with just different register mappings. However, v1 interrupt controller has a subset of the functionality of the v2 interrupt controller, so in the future the v2 interrupt controller driver may be enhanced, if needed, with things like level/edge interrupts and soft interrupts. So, for the moment I suggest we keep them as 2 separate files. mtk_intr_gic provides very basic (similar to v1 and v2) support for MIPS GIC controllers, which currently maps all interrupts to a single core and sets them to type level, active high. In the future this may be developed into a generic GIC controller to support any new MIPS SoCs that include it. The GIC is a standard MTI interrupt controller in their multi-core line-up (e.g., 1004K, 1074K, etc.), rather than a SoC-specific controller. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5839 Added: head/sys/mips/mediatek/mtk_intr_gic.c (contents, props changed) head/sys/mips/mediatek/mtk_intr_v1.c (contents, props changed) head/sys/mips/mediatek/mtk_intr_v2.c (contents, props changed) Added: head/sys/mips/mediatek/mtk_intr_gic.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_intr_gic.c Thu Apr 7 11:12:37 2016 (r297668) @@ -0,0 +1,377 @@ +/*- + * Copyright (c) 2016 Stanislav Galabov + * Copyright (c) 2015 Alexander Kabaev + * 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, + * without modification, immediately at the beginning of the file. + * 2. 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 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 "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "pic_if.h" + +#define MTK_NIRQS 64 /* We'll only use 64 for now */ + +#define MTK_INTPOL 0x0100 +#define MTK_INTTRIG 0x0180 +#define MTK_INTDIS 0x0300 +#define MTK_INTENA 0x0380 +#define MTK_INTMASK 0x0400 +#define MTK_INTSTAT 0x0480 +#define MTK_MAPPIN(_i) (0x0500 + (4 * (_i))) +#define MTK_MAPVPE(_i, _v) (0x2000 + (32 * (_i)) + (((_v) / 32) * 4)) + +#define MTK_INTPOL_POS 1 +#define MTK_INTPOL_NEG 0 +#define MTK_INTTRIG_EDGE 1 +#define MTK_INTTRIG_LEVEL 0 +#define MTK_PIN_BITS(_i) ((1 << 31) | (_i)) +#define MTK_VPE_BITS(_v) (1 << ((_v) % 32)) + +static int mtk_gic_intr(void *); + +struct mtk_gic_irqsrc { + struct intr_irqsrc isrc; + u_int irq; +}; + +struct mtk_gic_softc { + device_t gic_dev; + void * gic_intrhand; + struct resource * gic_res[2]; + struct mtk_gic_irqsrc gic_irqs[MTK_NIRQS]; + struct mtx mutex; + uint32_t nirqs; +}; + +#define GIC_INTR_ISRC(sc, irq) (&(sc)->gic_irqs[(irq)].isrc) + +static struct resource_spec mtk_gic_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, /* Registers */ + { SYS_RES_IRQ, 0, RF_ACTIVE }, /* Parent interrupt 1 */ + { -1, 0 } +}; + +static struct ofw_compat_data compat_data[] = { + { "mti,gic", 1 }, + { NULL, 0 } +}; + +#if 0 +#define READ4(_sc, _reg) \ + bus_space_read_4((_sc)->bst, (_sc)->bsh, _reg) +#define WRITE4(_sc, _reg, _val) \ + bus_space_write_4((_sc)->bst, (_sc)->bsh, _reg, _val) +#else +#define READ4(_sc, _reg) bus_read_4((_sc)->gic_res[0], (_reg)) +#define WRITE4(_sc, _reg, _val) bus_write_4((_sc)->gic_res[0], (_reg), (_val)) +#endif + +static int +mtk_gic_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "MTK Interrupt Controller (GIC)"); + return (BUS_PROBE_DEFAULT); +} + +static inline void +gic_irq_unmask(struct mtk_gic_softc *sc, u_int irq) +{ + + WRITE4(sc, MTK_INTENA, (1u << (irq))); +} + +static inline void +gic_irq_mask(struct mtk_gic_softc *sc, u_int irq) +{ + + WRITE4(sc, MTK_INTDIS, (1u << (irq))); +} + +static inline intptr_t +gic_xref(device_t dev) +{ + + return (OF_xref_from_node(ofw_bus_get_node(dev))); +} + +static int +mtk_gic_register_isrcs(struct mtk_gic_softc *sc) +{ + int error; + uint32_t irq; + struct intr_irqsrc *isrc; + const char *name; + + name = device_get_nameunit(sc->gic_dev); + for (irq = 0; irq < sc->nirqs; irq++) { + sc->gic_irqs[irq].irq = irq; + isrc = GIC_INTR_ISRC(sc, irq); + error = intr_isrc_register(isrc, sc->gic_dev, 0, "%s", name); + if (error != 0) { + /* XXX call intr_isrc_deregister */ + device_printf(sc->gic_dev, "%s failed", __func__); + return (error); + } + } + + return (0); +} + +static int +mtk_gic_attach(device_t dev) +{ + struct mtk_gic_softc *sc; + intptr_t xref = gic_xref(dev); + int i; + + sc = device_get_softc(dev); + + if (bus_alloc_resources(dev, mtk_gic_spec, sc->gic_res)) { + device_printf(dev, "could not allocate resources\n"); + return (ENXIO); + } + + sc->gic_dev = dev; + + /* Initialize mutex */ + mtx_init(&sc->mutex, "PIC lock", "", MTX_SPIN); + + /* Set the number of interrupts */ + sc->nirqs = nitems(sc->gic_irqs); + + /* Mask all interrupts */ + WRITE4(sc, MTK_INTDIS, 0xFFFFFFFF); + + /* All interrupts are of type level */ + WRITE4(sc, MTK_INTTRIG, 0x00000000); + + /* All interrupts are of positive polarity */ + WRITE4(sc, MTK_INTPOL, 0xFFFFFFFF); + + /* + * Route all interrupts to pin 0 on VPE 0; + */ + for (i = 0; i < 32; i++) { + WRITE4(sc, MTK_MAPPIN(i), MTK_PIN_BITS(0)); + WRITE4(sc, MTK_MAPVPE(i, 0), MTK_VPE_BITS(0)); + } + + /* Register the interrupts */ + if (mtk_gic_register_isrcs(sc) != 0) { + device_printf(dev, "could not register GIC ISRCs\n"); + goto cleanup; + } + + /* + * Now, when everything is initialized, it's right time to + * register interrupt controller to interrupt framefork. + */ + if (intr_pic_register(dev, xref) != 0) { + device_printf(dev, "could not register PIC\n"); + goto cleanup; + } + + if (bus_setup_intr(dev, sc->gic_res[1], INTR_TYPE_CLK, + mtk_gic_intr, NULL, sc, &sc->gic_intrhand)) { + device_printf(dev, "could not setup irq handler\n"); + intr_pic_deregister(dev, xref); + goto cleanup; + } + return (0); + +cleanup: + bus_release_resources(dev, mtk_gic_spec, sc->gic_res); + return(ENXIO); +} + +static int +mtk_gic_intr(void *arg) +{ + struct mtk_gic_softc *sc = arg; + struct thread *td; + uint32_t i, intr; + + td = curthread; + /* Workaround: do not inflate intr nesting level */ + td->td_intr_nesting_level--; + + intr = READ4(sc, MTK_INTSTAT) & READ4(sc, MTK_INTMASK); + while ((i = fls(intr)) != 0) { + i--; + intr &= ~(1u << i); + + if (intr_isrc_dispatch(GIC_INTR_ISRC(sc, i), + curthread->td_intr_frame) != 0) { + device_printf(sc->gic_dev, + "Stray interrupt %u detected\n", i); + gic_irq_mask(sc, i); + continue; + } + } + + KASSERT(i == 0, ("all interrupts handled")); + + td->td_intr_nesting_level++; + + return (FILTER_HANDLED); +} + +static int +mtk_gic_map_intr(device_t dev, struct intr_map_data *data, + struct intr_irqsrc **isrcp) +{ +#ifdef FDT + struct mtk_gic_softc *sc; + + sc = device_get_softc(dev); + + if (data == NULL || data->type != INTR_MAP_DATA_FDT || + data->fdt.ncells != 1 || data->fdt.cells[0] >= sc->nirqs) + return (EINVAL); + + *isrcp = GIC_INTR_ISRC(sc, data->fdt.cells[0]); + return (0); +#else + return (EINVAL); +#endif +} + +static void +mtk_gic_enable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + u_int irq; + + irq = ((struct mtk_gic_irqsrc *)isrc)->irq; + gic_irq_unmask(device_get_softc(dev), irq); +} + +static void +mtk_gic_disable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + u_int irq; + + irq = ((struct mtk_gic_irqsrc *)isrc)->irq; + gic_irq_mask(device_get_softc(dev), irq); +} + +static void +mtk_gic_pre_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + + mtk_gic_disable_intr(dev, isrc); +} + +static void +mtk_gic_post_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + + mtk_gic_enable_intr(dev, isrc); +} + +static void +mtk_gic_post_filter(device_t dev, struct intr_irqsrc *isrc) +{ +} + +#ifdef SMP +static int +mtk_gic_bind(device_t dev, struct intr_irqsrc *isrc) +{ + return (EOPNOTSUPP); +} + +static void +mtk_gic_init_secondary(device_t dev) +{ +} + +static void +mtk_gic_ipi_send(device_t dev, struct intr_irqsrc *isrc, cpuset_t cpus) +{ +} +#endif + +static device_method_t mtk_gic_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, mtk_gic_probe), + DEVMETHOD(device_attach, mtk_gic_attach), + /* Interrupt controller interface */ + DEVMETHOD(pic_disable_intr, mtk_gic_disable_intr), + DEVMETHOD(pic_enable_intr, mtk_gic_enable_intr), + DEVMETHOD(pic_map_intr, mtk_gic_map_intr), + DEVMETHOD(pic_post_filter, mtk_gic_post_filter), + DEVMETHOD(pic_post_ithread, mtk_gic_post_ithread), + DEVMETHOD(pic_pre_ithread, mtk_gic_pre_ithread), +#ifdef SMP + DEVMETHOD(pic_bind, mtk_gic_bind), + DEVMETHOD(pic_init_secondary, mtk_gic_init_secondary), + DEVMETHOD(pic_ipi_send, mtk_gic_ipi_send), +#endif + { 0, 0 } +}; + +static driver_t mtk_gic_driver = { + "intc", + mtk_gic_methods, + sizeof(struct mtk_gic_softc), +}; + +static devclass_t mtk_gic_devclass; + +EARLY_DRIVER_MODULE(intc_gic, simplebus, mtk_gic_driver, mtk_gic_devclass, 0, 0, + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Added: head/sys/mips/mediatek/mtk_intr_v1.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_intr_v1.c Thu Apr 7 11:12:37 2016 (r297668) @@ -0,0 +1,353 @@ +/*- + * Copyright (c) 2015 Stanislav Galabov + * Copyright (c) 2015 Alexander Kabaev + * 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, + * without modification, immediately at the beginning of the file. + * 2. 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 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 "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "pic_if.h" + +#define MTK_NIRQS 32 + +#define MTK_IRQ0STAT 0x0000 +#define MTK_IRQ1STAT 0x0004 +#define MTK_INTTYPE 0x0020 +#define MTK_INTRAW 0x0030 +#define MTK_INTENA 0x0034 +#define MTK_INTDIS 0x0038 + +static int mtk_pic_intr(void *); + +struct mtk_pic_irqsrc { + struct intr_irqsrc isrc; + u_int irq; +}; + +struct mtk_pic_softc { + device_t pic_dev; + void * pic_intrhand; + struct resource * pic_res[2]; + struct mtk_pic_irqsrc pic_irqs[MTK_NIRQS]; + struct mtx mutex; + uint32_t nirqs; +}; + +#define PIC_INTR_ISRC(sc, irq) (&(sc)->pic_irqs[(irq)].isrc) + +static struct resource_spec mtk_pic_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, /* Registers */ + { SYS_RES_IRQ, 0, RF_ACTIVE }, /* Parent interrupt 1 */ +// { SYS_RES_IRQ, 1, RF_ACTIVE }, /* Parent interrupt 2 */ + { -1, 0 } +}; + +static struct ofw_compat_data compat_data[] = { + { "ralink,rt2880-intc", 1 }, + { "ralink,rt3050-intc", 1 }, + { "ralink,rt3352-intc", 1 }, + { "ralink,rt3883-intc", 1 }, + { "ralink,rt5350-intc", 1 }, + { "ralink,mt7620a-intc", 1 }, + { NULL, 0 } +}; + +#define READ4(_sc, _reg) bus_read_4((_sc)->pic_res[0], _reg) +#define WRITE4(_sc, _reg, _val) bus_write_4((_sc)->pic_res[0], _reg, _val) + +static int +mtk_pic_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "MTK Interrupt Controller (v2)"); + return (BUS_PROBE_DEFAULT); +} + +static inline void +pic_irq_unmask(struct mtk_pic_softc *sc, u_int irq) +{ + + WRITE4(sc, MTK_INTENA, (1u << (irq))); +} + +static inline void +pic_irq_mask(struct mtk_pic_softc *sc, u_int irq) +{ + + WRITE4(sc, MTK_INTDIS, (1u << (irq))); +} + +static inline intptr_t +pic_xref(device_t dev) +{ + return (OF_xref_from_node(ofw_bus_get_node(dev))); +} + +static int +mtk_pic_register_isrcs(struct mtk_pic_softc *sc) +{ + int error; + uint32_t irq; + struct intr_irqsrc *isrc; + const char *name; + + name = device_get_nameunit(sc->pic_dev); + for (irq = 0; irq < sc->nirqs; irq++) { + sc->pic_irqs[irq].irq = irq; + isrc = PIC_INTR_ISRC(sc, irq); + error = intr_isrc_register(isrc, sc->pic_dev, 0, "%s", name); + if (error != 0) { + /* XXX call intr_isrc_deregister */ + device_printf(sc->pic_dev, "%s failed", __func__); + return (error); + } + } + + return (0); +} + +static int +mtk_pic_attach(device_t dev) +{ + struct mtk_pic_softc *sc; + intptr_t xref = pic_xref(dev); + + sc = device_get_softc(dev); + + if (bus_alloc_resources(dev, mtk_pic_spec, sc->pic_res)) { + device_printf(dev, "could not allocate resources\n"); + return (ENXIO); + } + + sc->pic_dev = dev; + + /* Initialize mutex */ + mtx_init(&sc->mutex, "PIC lock", "", MTX_SPIN); + + /* Set the number of interrupts */ + sc->nirqs = nitems(sc->pic_irqs); + + /* Mask all interrupts */ + WRITE4(sc, MTK_INTDIS, 0x7FFFFFFF); + + /* But enable interrupt generation/masking */ + WRITE4(sc, MTK_INTENA, 0x80000000); + + /* Set all interrupts to type 0 */ + WRITE4(sc, MTK_INTTYPE, 0x00000000); + + /* Register the interrupts */ + if (mtk_pic_register_isrcs(sc) != 0) { + device_printf(dev, "could not register PIC ISRCs\n"); + goto cleanup; + } + + /* + * Now, when everything is initialized, it's right time to + * register interrupt controller to interrupt framefork. + */ + if (intr_pic_register(dev, xref) != 0) { + device_printf(dev, "could not register PIC\n"); + goto cleanup; + } + + if (bus_setup_intr(dev, sc->pic_res[1], INTR_TYPE_CLK, + mtk_pic_intr, NULL, sc, &sc->pic_intrhand)) { + device_printf(dev, "could not setup irq handler\n"); + intr_pic_deregister(dev, xref); + goto cleanup; + } + return (0); + +cleanup: + bus_release_resources(dev, mtk_pic_spec, sc->pic_res); + return(ENXIO); +} + +static int +mtk_pic_intr(void *arg) +{ + struct mtk_pic_softc *sc = arg; + struct thread *td; + uint32_t i, intr; + + td = curthread; + /* Workaround: do not inflate intr nesting level */ + td->td_intr_nesting_level--; + +#ifdef _notyet_ + intr = READ4(sc, MTK_IRQ1STAT); + while ((i = fls(intr)) != 0) { + i--; + intr &= ~(1u << i); + + if (intr_isrc_dispatch(PIC_INTR_ISRC(sc, i), + curthread->td_intr_frame) != 0) { + device_printf(sc->pic_dev, + "Stray interrupt %u detected\n", i); + pic_irq_mask(sc, i); + continue; + } + } + + KASSERT(i == 0, ("all interrupts handled")); +#endif + + intr = READ4(sc, MTK_IRQ0STAT); + + while ((i = fls(intr)) != 0) { + i--; + intr &= ~(1u << i); + + if (intr_isrc_dispatch(PIC_INTR_ISRC(sc, i), + curthread->td_intr_frame) != 0) { + device_printf(sc->pic_dev, + "Stray interrupt %u detected\n", i); + pic_irq_mask(sc, i); + continue; + } + } + + KASSERT(i == 0, ("all interrupts handled")); + + td->td_intr_nesting_level++; + + return (FILTER_HANDLED); +} + +static int +mtk_pic_map_intr(device_t dev, struct intr_map_data *data, + struct intr_irqsrc **isrcp) +{ +#ifdef FDT + struct mtk_pic_softc *sc; + + sc = device_get_softc(dev); + + if (data == NULL || data->type != INTR_MAP_DATA_FDT || + data->fdt.ncells != 1 || data->fdt.cells[0] >= sc->nirqs) + return (EINVAL); + + *isrcp = PIC_INTR_ISRC(sc, data->fdt.cells[0]); + return (0); +#else + return (EINVAL); +#endif +} + +static void +mtk_pic_enable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + u_int irq; + + irq = ((struct mtk_pic_irqsrc *)isrc)->irq; + pic_irq_unmask(device_get_softc(dev), irq); +} + +static void +mtk_pic_disable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + u_int irq; + + irq = ((struct mtk_pic_irqsrc *)isrc)->irq; + pic_irq_mask(device_get_softc(dev), irq); +} + +static void +mtk_pic_pre_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + + mtk_pic_disable_intr(dev, isrc); +} + +static void +mtk_pic_post_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + + mtk_pic_enable_intr(dev, isrc); +} + +static void +mtk_pic_post_filter(device_t dev, struct intr_irqsrc *isrc) +{ +} + +static device_method_t mtk_pic_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, mtk_pic_probe), + DEVMETHOD(device_attach, mtk_pic_attach), + /* Interrupt controller interface */ + DEVMETHOD(pic_disable_intr, mtk_pic_disable_intr), + DEVMETHOD(pic_enable_intr, mtk_pic_enable_intr), + DEVMETHOD(pic_map_intr, mtk_pic_map_intr), + DEVMETHOD(pic_post_filter, mtk_pic_post_filter), + DEVMETHOD(pic_post_ithread, mtk_pic_post_ithread), + DEVMETHOD(pic_pre_ithread, mtk_pic_pre_ithread), + { 0, 0 } +}; + +static driver_t mtk_pic_driver = { + "intc", + mtk_pic_methods, + sizeof(struct mtk_pic_softc), +}; + +static devclass_t mtk_pic_devclass; + +EARLY_DRIVER_MODULE(intc_v1, simplebus, mtk_pic_driver, mtk_pic_devclass, 0, 0, + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Added: head/sys/mips/mediatek/mtk_intr_v2.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_intr_v2.c Thu Apr 7 11:12:37 2016 (r297668) @@ -0,0 +1,348 @@ +/*- + * Copyright (c) 2015 Stanislav Galabov + * Copyright (c) 2015 Alexander Kabaev + * 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, + * without modification, immediately at the beginning of the file. + * 2. 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 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 "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "pic_if.h" + +#define MTK_NIRQS 32 + +#define MTK_IRQ0STAT 0x009c +#define MTK_IRQ1STAT 0x00a0 +#define MTK_INTTYPE 0x0000 +#define MTK_INTRAW 0x00a4 +#define MTK_INTENA 0x0080 +#define MTK_INTDIS 0x0078 + +static int mtk_pic_intr(void *); + +struct mtk_pic_irqsrc { + struct intr_irqsrc isrc; + u_int irq; +}; + +struct mtk_pic_softc { + device_t pic_dev; + void * pic_intrhand; + struct resource * pic_res[2]; + struct mtk_pic_irqsrc pic_irqs[MTK_NIRQS]; + struct mtx mutex; + uint32_t nirqs; +}; + +#define PIC_INTR_ISRC(sc, irq) (&(sc)->pic_irqs[(irq)].isrc) + +static struct resource_spec mtk_pic_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, /* Registers */ + { SYS_RES_IRQ, 0, RF_ACTIVE }, /* Parent interrupt 1 */ +// { SYS_RES_IRQ, 1, RF_ACTIVE }, /* Parent interrupt 2 */ + { -1, 0 } +}; + +static struct ofw_compat_data compat_data[] = { + { "ralink,mt7628an-intc", 1 }, + { NULL, 0 } +}; + +#define READ4(_sc, _reg) bus_read_4((_sc)->pic_res[0], _reg) +#define WRITE4(_sc, _reg, _val) bus_write_4((_sc)->pic_res[0], _reg, _val) + +static int +mtk_pic_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "MTK Interrupt Controller (v2)"); + return (BUS_PROBE_DEFAULT); +} + +static inline void +pic_irq_unmask(struct mtk_pic_softc *sc, u_int irq) +{ + + WRITE4(sc, MTK_INTENA, (1u << (irq))); +} + +static inline void +pic_irq_mask(struct mtk_pic_softc *sc, u_int irq) +{ + + WRITE4(sc, MTK_INTDIS, (1u << (irq))); +} + +static inline intptr_t +pic_xref(device_t dev) +{ + return (OF_xref_from_node(ofw_bus_get_node(dev))); +} + +static int +mtk_pic_register_isrcs(struct mtk_pic_softc *sc) +{ + int error; + uint32_t irq; + struct intr_irqsrc *isrc; + const char *name; + + name = device_get_nameunit(sc->pic_dev); + for (irq = 0; irq < sc->nirqs; irq++) { + sc->pic_irqs[irq].irq = irq; + isrc = PIC_INTR_ISRC(sc, irq); + error = intr_isrc_register(isrc, sc->pic_dev, 0, "%s", name); + if (error != 0) { + /* XXX call intr_isrc_deregister */ + device_printf(sc->pic_dev, "%s failed", __func__); + return (error); + } + } + + return (0); +} + +static int +mtk_pic_attach(device_t dev) +{ + struct mtk_pic_softc *sc; + intptr_t xref = pic_xref(dev); + + sc = device_get_softc(dev); + + if (bus_alloc_resources(dev, mtk_pic_spec, sc->pic_res)) { + device_printf(dev, "could not allocate resources\n"); + return (ENXIO); + } + + sc->pic_dev = dev; + + /* Initialize mutex */ + mtx_init(&sc->mutex, "PIC lock", "", MTX_SPIN); + + /* Set the number of interrupts */ + sc->nirqs = nitems(sc->pic_irqs); + + /* Mask all interrupts */ + WRITE4(sc, MTK_INTDIS, 0xFFFFFFFF); + + /* But enable interrupt generation/masking */ + WRITE4(sc, MTK_INTENA, 0x00000000); + + /* Set all interrupts to type 0 */ + WRITE4(sc, MTK_INTTYPE, 0xFFFFFFFF); + + /* Register the interrupts */ + if (mtk_pic_register_isrcs(sc) != 0) { + device_printf(dev, "could not register PIC ISRCs\n"); + goto cleanup; + } + + /* + * Now, when everything is initialized, it's right time to + * register interrupt controller to interrupt framefork. + */ + if (intr_pic_register(dev, xref) != 0) { + device_printf(dev, "could not register PIC\n"); + goto cleanup; + } + + if (bus_setup_intr(dev, sc->pic_res[1], INTR_TYPE_CLK, + mtk_pic_intr, NULL, sc, &sc->pic_intrhand)) { + device_printf(dev, "could not setup irq handler\n"); + intr_pic_deregister(dev, xref); + goto cleanup; + } + return (0); + +cleanup: + bus_release_resources(dev, mtk_pic_spec, sc->pic_res); + return(ENXIO); +} + +static int +mtk_pic_intr(void *arg) +{ + struct mtk_pic_softc *sc = arg; + struct thread *td; + uint32_t i, intr; + + td = curthread; + /* Workaround: do not inflate intr nesting level */ + td->td_intr_nesting_level--; + +#ifdef _notyet_ + intr = READ4(sc, MTK_IRQ1STAT); + while ((i = fls(intr)) != 0) { + i--; + intr &= ~(1u << i); + + if (intr_isrc_dispatch(PIC_INTR_ISRC(sc, i), + curthread->td_intr_frame) != 0) { + device_printf(sc->pic_dev, + "Stray interrupt %u detected\n", i); + pic_irq_mask(sc, i); + continue; + } + } + + KASSERT(i == 0, ("all interrupts handled")); +#endif + + intr = READ4(sc, MTK_IRQ0STAT); + + while ((i = fls(intr)) != 0) { + i--; + intr &= ~(1u << i); + + if (intr_isrc_dispatch(PIC_INTR_ISRC(sc, i), + curthread->td_intr_frame) != 0) { + device_printf(sc->pic_dev, + "Stray interrupt %u detected\n", i); + pic_irq_mask(sc, i); + continue; + } + } + + KASSERT(i == 0, ("all interrupts handled")); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Apr 7 11:16:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5852B0699B; Thu, 7 Apr 2016 11:16:33 +0000 (UTC) (envelope-from sgalabov@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 mx1.freebsd.org (Postfix) with ESMTPS id 79A841FE6; Thu, 7 Apr 2016 11:16:33 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37BGW1e045949; Thu, 7 Apr 2016 11:16:32 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37BGWVb045946; Thu, 7 Apr 2016 11:16:32 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201604071116.u37BGWVb045946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Thu, 7 Apr 2016 11:16:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297669 - head/sys/mips/mediatek X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 11:16:33 -0000 Author: sgalabov Date: Thu Apr 7 11:16:32 2016 New Revision: 297669 URL: https://svnweb.freebsd.org/changeset/base/297669 Log: Initial import of Ralink/Mediatek MIPS SoC support #4 UART drivers. - uart_dev_mtk.[ch] are the old-style Mediatek/Ralink-specific UART driver as also found in sys/mips/rt305x/uart_dev_rt305x.c, with minor improvements and FDT attachment enabled for the appropriate SoCs. - uart_dev_mtk_ns8250.c is the new-style ns16550a-compatible UART driver found in newer Mediatek SoCs. It uses the uart_dev_ns8250.c driver indirectly and is basically just a wrapper around it and only overrides its probe method. The reason I am not using the uart_dev_ns8250.c driver directly is because I have some code that does UART clock detection before initializing the UART, so that we don't need to hard-code the UART clock frequency in the dts files for each board. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5840 Added: head/sys/mips/mediatek/uart_dev_mtk.c (contents, props changed) head/sys/mips/mediatek/uart_dev_mtk.h (contents, props changed) head/sys/mips/mediatek/uart_dev_mtk_ns8250.c (contents, props changed) Added: head/sys/mips/mediatek/uart_dev_mtk.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/uart_dev_mtk.c Thu Apr 7 11:16:32 2016 (r297669) @@ -0,0 +1,552 @@ +/* $NetBSD: uart.c,v 1.2 2007/03/23 20:05:47 dogcow Exp $ */ + +/*- + * Copyright (c) 2013, Alexander A. Mityaev + * Copyright (c) 2010 Aleksandr Rybalko. + * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. + * Copyright (c) 2007 Oleksandr Tymoshenko. + * 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 ``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 + * 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 "opt_ddb.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include "uart_if.h" + +/* Set some reference clock value. Real value will be taken from FDT */ +#define DEFAULT_RCLK (120 * 1000 * 1000) + +/* + * Low-level UART interface. + */ +static int mtk_uart_probe(struct uart_bas *bas); +static void mtk_uart_init(struct uart_bas *bas, int, int, int, int); +static void mtk_uart_term(struct uart_bas *bas); +static void mtk_uart_putc(struct uart_bas *bas, int); +static int mtk_uart_rxready(struct uart_bas *bas); +static int mtk_uart_getc(struct uart_bas *bas, struct mtx *); + +static struct uart_ops uart_mtk_ops = { + .probe = mtk_uart_probe, + .init = mtk_uart_init, + .term = mtk_uart_term, + .putc = mtk_uart_putc, + .rxready = mtk_uart_rxready, + .getc = mtk_uart_getc, +}; + +static int uart_output = 1; +TUNABLE_INT("kern.uart_output", &uart_output); +SYSCTL_INT(_kern, OID_AUTO, uart_output, CTLFLAG_RW, + &uart_output, 0, "UART output enabled."); + +static int +mtk_uart_probe(struct uart_bas *bas) +{ + return (0); +} + +static void +mtk_uart_init(struct uart_bas *bas, int baudrate, int databits, + int stopbits, int parity) +{ + /* CLKDIV = 384000000/ 3/ 16/ br */ + /* for 384MHz CLKDIV = 8000000 / baudrate; */ + switch (databits) { + case 5: + databits = UART_LCR_5B; + break; + case 6: + databits = UART_LCR_6B; + break; + case 7: + databits = UART_LCR_7B; + break; + case 8: + databits = UART_LCR_8B; + break; + default: + /* Unsupported */ + return; + } + switch (parity) { + case UART_PARITY_EVEN: parity = (UART_LCR_PEN|UART_LCR_EVEN); break; + case UART_PARITY_ODD: parity = (UART_LCR_PEN); break; + case UART_PARITY_NONE: parity = 0; break; + /* Unsupported */ + default: return; + } + + if (bas->rclk && baudrate) { + uart_setreg(bas, UART_CDDL_REG, bas->rclk/16/baudrate); + uart_barrier(bas); + } + + uart_setreg(bas, UART_LCR_REG, databits | + (stopbits==1?0:UART_LCR_STB_15) | + parity); + uart_barrier(bas); +} + +static void +mtk_uart_term(struct uart_bas *bas) +{ + uart_setreg(bas, UART_MCR_REG, 0); + uart_barrier(bas); +} + +static void +mtk_uart_putc(struct uart_bas *bas, int c) +{ + char chr; + if (!uart_output) return; + chr = c; + while (!(uart_getreg(bas, UART_LSR_REG) & UART_LSR_THRE)); + uart_setreg(bas, UART_TX_REG, c); + uart_barrier(bas); + while (!(uart_getreg(bas, UART_LSR_REG) & UART_LSR_THRE)); +} + +static int +mtk_uart_rxready(struct uart_bas *bas) +{ + if (uart_getreg(bas, UART_LSR_REG) & UART_LSR_DR) + return (1); + return (0); +} + +static int +mtk_uart_getc(struct uart_bas *bas, struct mtx *hwmtx) +{ + int c; + + uart_lock(hwmtx); + + while (!(uart_getreg(bas, UART_LSR_REG) & UART_LSR_DR)) { + uart_unlock(hwmtx); + DELAY(10); + uart_lock(hwmtx); + } + + c = uart_getreg(bas, UART_RX_REG); + + uart_unlock(hwmtx); + + return (c); +} + +/* + * High-level UART interface. + */ +struct uart_mtk_softc { + struct uart_softc base; + uint8_t ier_mask; + uint8_t ier; +}; + +static int mtk_uart_bus_attach(struct uart_softc *); +static int mtk_uart_bus_detach(struct uart_softc *); +static int mtk_uart_bus_flush(struct uart_softc *, int); +static int mtk_uart_bus_getsig(struct uart_softc *); +static int mtk_uart_bus_ioctl(struct uart_softc *, int, intptr_t); +static int mtk_uart_bus_ipend(struct uart_softc *); +static int mtk_uart_bus_param(struct uart_softc *, int, int, int, int); +static int mtk_uart_bus_probe(struct uart_softc *); +static int mtk_uart_bus_receive(struct uart_softc *); +static int mtk_uart_bus_setsig(struct uart_softc *, int); +static int mtk_uart_bus_transmit(struct uart_softc *); +static void mtk_uart_bus_grab(struct uart_softc *); +static void mtk_uart_bus_ungrab(struct uart_softc *); + +static kobj_method_t uart_mtk_methods[] = { + KOBJMETHOD(uart_attach, mtk_uart_bus_attach), + KOBJMETHOD(uart_detach, mtk_uart_bus_detach), + KOBJMETHOD(uart_flush, mtk_uart_bus_flush), + KOBJMETHOD(uart_getsig, mtk_uart_bus_getsig), + KOBJMETHOD(uart_ioctl, mtk_uart_bus_ioctl), + KOBJMETHOD(uart_ipend, mtk_uart_bus_ipend), + KOBJMETHOD(uart_param, mtk_uart_bus_param), + KOBJMETHOD(uart_probe, mtk_uart_bus_probe), + KOBJMETHOD(uart_receive, mtk_uart_bus_receive), + KOBJMETHOD(uart_setsig, mtk_uart_bus_setsig), + KOBJMETHOD(uart_transmit, mtk_uart_bus_transmit), + KOBJMETHOD(uart_grab, mtk_uart_bus_grab), + KOBJMETHOD(uart_ungrab, mtk_uart_bus_ungrab), + { 0, 0 } +}; + +struct uart_class uart_mtk_class = { + "uart_mtk", + uart_mtk_methods, + sizeof(struct uart_mtk_softc), + .uc_ops = &uart_mtk_ops, + .uc_range = 1, /* use hinted range */ + .uc_rclk = 0 +}; + +static struct ofw_compat_data compat_data[] = { + { "ralink,rt2880-uart", (uintptr_t)&uart_mtk_class }, + { "ralink,rt3050-uart", (uintptr_t)&uart_mtk_class }, + { "ralink,rt3352-uart", (uintptr_t)&uart_mtk_class }, + { "ralink,rt3883-uart", (uintptr_t)&uart_mtk_class }, + { "ralink,rt5350-uart", (uintptr_t)&uart_mtk_class }, + { "ralink,mt7620a-uart", (uintptr_t)&uart_mtk_class }, + { NULL, (uintptr_t)NULL }, +}; +UART_FDT_CLASS_AND_DEVICE(compat_data); + + +#define SIGCHG(c, i, s, d) \ + if (c) { \ + i |= (i & s) ? s : s | d; \ + } else { \ + i = (i & s) ? (i & ~s) | d : i; \ + } + +/* + * Disable TX interrupt. uart should be locked + */ +static __inline void +mtk_uart_disable_txintr(struct uart_softc *sc) +{ + struct uart_bas *bas = &sc->sc_bas; + uint8_t cr; + + cr = uart_getreg(bas, UART_IER_REG); + cr &= ~UART_IER_ETBEI; + uart_setreg(bas, UART_IER_REG, cr); + uart_barrier(bas); +} + +/* + * Enable TX interrupt. uart should be locked + */ +static __inline void +mtk_uart_enable_txintr(struct uart_softc *sc) +{ + struct uart_bas *bas = &sc->sc_bas; + uint8_t cr; + + cr = uart_getreg(bas, UART_IER_REG); + cr |= UART_IER_ETBEI; + uart_setreg(bas, UART_IER_REG, cr); + uart_barrier(bas); +} + +static int +mtk_uart_bus_attach(struct uart_softc *sc) +{ + struct uart_bas *bas; + struct uart_devinfo *di; + struct uart_mtk_softc *usc = (struct uart_mtk_softc *)sc; + + bas = &sc->sc_bas; + + if (!bas->rclk) { + bas->rclk = mtk_soc_get_uartclk(); + } + + if (sc->sc_sysdev != NULL) { + di = sc->sc_sysdev; + mtk_uart_init(bas, di->baudrate, di->databits, di->stopbits, + di->parity); + } else { + mtk_uart_init(bas, 57600, 8, 1, 0); + } + + sc->sc_rxfifosz = 16; + sc->sc_txfifosz = 16; + + (void)mtk_uart_bus_getsig(sc); + + /* Enable FIFO */ + uart_setreg(bas, UART_FCR_REG, + uart_getreg(bas, UART_FCR_REG) | + UART_FCR_FIFOEN | UART_FCR_TXTGR_1 | UART_FCR_RXTGR_1); + uart_barrier(bas); + /* Enable interrupts */ + usc->ier_mask = 0xf0; + uart_setreg(bas, UART_IER_REG, + UART_IER_EDSSI | UART_IER_ELSI | UART_IER_ERBFI); + uart_barrier(bas); + + return (0); +} + +static int +mtk_uart_bus_detach(struct uart_softc *sc) +{ + return (0); +} + +static int +mtk_uart_bus_flush(struct uart_softc *sc, int what) +{ + struct uart_bas *bas = &sc->sc_bas; + uint32_t fcr = uart_getreg(bas, UART_FCR_REG); + + if (what & UART_FLUSH_TRANSMITTER) { + uart_setreg(bas, UART_FCR_REG, fcr|UART_FCR_TXRST); + uart_barrier(bas); + } + if (what & UART_FLUSH_RECEIVER) { + uart_setreg(bas, UART_FCR_REG, fcr|UART_FCR_RXRST); + uart_barrier(bas); + } + uart_setreg(bas, UART_FCR_REG, fcr); + uart_barrier(bas); + return (0); +} + +static int +mtk_uart_bus_getsig(struct uart_softc *sc) +{ + uint32_t new, old, sig; + uint8_t bes; + + return(0); + do { + old = sc->sc_hwsig; + sig = old; + uart_lock(sc->sc_hwmtx); + bes = uart_getreg(&sc->sc_bas, UART_MSR_REG); + uart_unlock(sc->sc_hwmtx); + /* XXX: chip can show delta */ + SIGCHG(bes & UART_MSR_CTS, sig, SER_CTS, SER_DCTS); + SIGCHG(bes & UART_MSR_DCD, sig, SER_DCD, SER_DDCD); + SIGCHG(bes & UART_MSR_DSR, sig, SER_DSR, SER_DDSR); + new = sig & ~SER_MASK_DELTA; + } while (!atomic_cmpset_32(&sc->sc_hwsig, old, new)); + + return (sig); +} + +static int +mtk_uart_bus_ioctl(struct uart_softc *sc, int request, intptr_t data) +{ + struct uart_bas *bas; + int baudrate, divisor, error; + + bas = &sc->sc_bas; + error = 0; + uart_lock(sc->sc_hwmtx); + switch (request) { + case UART_IOCTL_BREAK: + /* TODO: Send BREAK */ + break; + case UART_IOCTL_BAUD: + divisor = uart_getreg(bas, UART_CDDL_REG); + baudrate = bas->rclk / (divisor * 16); + *(int*)data = baudrate; + break; + default: + error = EINVAL; + break; + } + uart_unlock(sc->sc_hwmtx); + return (error); +} + +static int +mtk_uart_bus_ipend(struct uart_softc *sc) +{ + struct uart_bas *bas; + int ipend; + uint8_t iir, lsr, msr; + +// breakpoint(); + + bas = &sc->sc_bas; + ipend = 0; + + uart_lock(sc->sc_hwmtx); + iir = uart_getreg(&sc->sc_bas, UART_IIR_REG); + lsr = uart_getreg(&sc->sc_bas, UART_LSR_REG); + uart_setreg(&sc->sc_bas, UART_LSR_REG, lsr); + msr = uart_getreg(&sc->sc_bas, UART_MSR_REG); + uart_setreg(&sc->sc_bas, UART_MSR_REG, msr); + if (iir & UART_IIR_INTP) { + uart_unlock(sc->sc_hwmtx); + return (0); + } + switch ((iir >> 1) & 0x07) { + case UART_IIR_ID_THRE: + ipend |= SER_INT_TXIDLE; + break; + case UART_IIR_ID_DR2: + mtk_uart_bus_flush(sc, UART_FLUSH_RECEIVER); + /* passthrough */ + case UART_IIR_ID_DR: + ipend |= SER_INT_RXREADY; + break; + case UART_IIR_ID_MST: + case UART_IIR_ID_LINESTATUS: + ipend |= SER_INT_SIGCHG; + if (lsr & UART_LSR_BI) + ipend |= SER_INT_BREAK; + if (lsr & UART_LSR_OE) + ipend |= SER_INT_OVERRUN; + break; + default: + /* XXX: maybe return error here */ + break; + } + + uart_unlock(sc->sc_hwmtx); + + return (ipend); +} + +static int +mtk_uart_bus_param(struct uart_softc *sc, int baudrate, int databits, + int stopbits, int parity) +{ + uart_lock(sc->sc_hwmtx); + mtk_uart_init(&sc->sc_bas, baudrate, databits, stopbits, parity); + uart_unlock(sc->sc_hwmtx); + return (0); +} + +static int +mtk_uart_bus_probe(struct uart_softc *sc) +{ + int error; + + error = mtk_uart_probe(&sc->sc_bas); + if (error) + return (error); + + device_set_desc(sc->sc_dev, "MTK UART Controller"); + + return (0); +} + +static int +mtk_uart_bus_receive(struct uart_softc *sc) +{ + struct uart_bas *bas; + int xc; + uint8_t lsr; + + bas = &sc->sc_bas; + uart_lock(sc->sc_hwmtx); + lsr = uart_getreg(bas, UART_LSR_REG); + while ((lsr & UART_LSR_DR)) { + if (uart_rx_full(sc)) { + sc->sc_rxbuf[sc->sc_rxput] = UART_STAT_OVERRUN; + break; + } + xc = 0; + xc = uart_getreg(bas, UART_RX_REG); + if (lsr & UART_LSR_FE) + xc |= UART_STAT_FRAMERR; + if (lsr & UART_LSR_PE) + xc |= UART_STAT_PARERR; + if (lsr & UART_LSR_OE) + xc |= UART_STAT_OVERRUN; + uart_barrier(bas); + uart_rx_put(sc, xc); + lsr = uart_getreg(bas, UART_LSR_REG); + } + + uart_unlock(sc->sc_hwmtx); + return (0); +} + +static int +mtk_uart_bus_setsig(struct uart_softc *sc, int sig) +{ + /* TODO: implement (?) */ + return (sig); +} + +static int +mtk_uart_bus_transmit(struct uart_softc *sc) +{ + struct uart_bas *bas = &sc->sc_bas; + int i; + + if (!uart_output) return (0); + + bas = &sc->sc_bas; + uart_lock(sc->sc_hwmtx); + while ((uart_getreg(bas, UART_LSR_REG) & UART_LSR_THRE) == 0); + mtk_uart_enable_txintr(sc); + for (i = 0; i < sc->sc_txdatasz; i++) { + uart_setreg(bas, UART_TX_REG, sc->sc_txbuf[i]); + uart_barrier(bas); + } + sc->sc_txbusy = 1; + uart_unlock(sc->sc_hwmtx); + return (0); +} + +void +mtk_uart_bus_grab(struct uart_softc *sc) +{ + struct uart_bas *bas = &sc->sc_bas; + struct uart_mtk_softc *usc = (struct uart_mtk_softc *)sc; + + uart_lock(sc->sc_hwmtx); + usc->ier = uart_getreg(bas, UART_IER_REG); + uart_setreg(bas, UART_IER_REG, usc->ier & usc->ier_mask); + uart_barrier(bas); + uart_unlock(sc->sc_hwmtx); +} + +void +mtk_uart_bus_ungrab(struct uart_softc *sc) +{ + struct uart_mtk_softc *usc = (struct uart_mtk_softc *)sc; + struct uart_bas *bas = &sc->sc_bas; + + uart_lock(sc->sc_hwmtx); + uart_setreg(bas, UART_IER_REG, usc->ier); + uart_barrier(bas); + uart_unlock(sc->sc_hwmtx); +} Added: head/sys/mips/mediatek/uart_dev_mtk.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/uart_dev_mtk.h Thu Apr 7 11:16:32 2016 (r297669) @@ -0,0 +1,126 @@ +/*- + * Copyright (c) 2010 Aleksandr Rybalko. + * 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. The names of the authors may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 + * 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 _MTKUART_H +#define _MTKUART_H + +#undef uart_getreg +#undef uart_setreg +#define uart_getreg(bas, reg) \ + bus_space_read_4((bas)->bst, (bas)->bsh, reg) +#define uart_setreg(bas, reg, value) \ + bus_space_write_4((bas)->bst, (bas)->bsh, reg, value) + +/* UART registers */ +#define UART_RX_REG 0x00 +#define UART_TX_REG 0x04 + +#define UART_IER_REG 0x08 +#define UART_IER_EDSSI (1<<3) /* Only full UART */ +#define UART_IER_ELSI (1<<2) +#define UART_IER_ETBEI (1<<1) +#define UART_IER_ERBFI (1<<0) + +#define UART_IIR_REG 0x0c +#define UART_IIR_RXFIFO (1<<7) +#define UART_IIR_TXFIFO (1<<6) +#define UART_IIR_ID_MST 0 +#define UART_IIR_ID_THRE 1 +#define UART_IIR_ID_DR 2 +#define UART_IIR_ID_LINESTATUS 3 +#define UART_IIR_ID_DR2 6 +#define UART_IIR_ID_SHIFT 1 +#define UART_IIR_ID_MASK 0x0000000e +#define UART_IIR_INTP (1<<0) + +#define UART_FCR_REG 0x10 +#define UART_FCR_RXTGR_1 (0<<6) +#define UART_FCR_RXTGR_4 (1<<6) +#define UART_FCR_RXTGR_8 (2<<6) +#define UART_FCR_RXTGR_12 (3<<6) +#define UART_FCR_TXTGR_1 (0<<4) +#define UART_FCR_TXTGR_4 (1<<4) +#define UART_FCR_TXTGR_8 (2<<4) +#define UART_FCR_TXTGR_12 (3<<4) +#define UART_FCR_DMA (1<<3) +#define UART_FCR_TXRST (1<<2) +#define UART_FCR_RXRST (1<<1) +#define UART_FCR_FIFOEN (1<<0) + +#define UART_LCR_REG 0x14 +#define UART_LCR_DLAB (1<<7) +#define UART_LCR_BRK (1<<6) +#define UART_LCR_FPAR (1<<5) +#define UART_LCR_EVEN (1<<4) +#define UART_LCR_PEN (1<<3) +#define UART_LCR_STB_15 (1<<2) +#define UART_LCR_5B 0 +#define UART_LCR_6B 1 +#define UART_LCR_7B 2 +#define UART_LCR_8B 3 + +#define UART_MCR_REG 0x18 +#define UART_MCR_LOOP (1<<4) +#define UART_MCR_OUT2_L (1<<3) /* Only full UART */ +#define UART_MCR_OUT1_L (1<<2) /* Only full UART */ +#define UART_MCR_RTS_L (1<<1) /* Only full UART */ +#define UART_MCR_DTR_L (1<<0) /* Only full UART */ + +#define UART_LSR_REG 0x1c +#define UART_LSR_ERINF (1<<7) +#define UART_LSR_TEMT (1<<6) +#define UART_LSR_THRE (1<<5) +#define UART_LSR_BI (1<<4) +#define UART_LSR_FE (1<<3) +#define UART_LSR_PE (1<<2) +#define UART_LSR_OE (1<<1) +#define UART_LSR_DR (1<<0) + +#define UART_MSR_REG 0x20 /* Only full UART */ +#define UART_MSR_DCD (1<<7) /* Only full UART */ +#define UART_MSR_RI (1<<6) /* Only full UART */ +#define UART_MSR_DSR (1<<5) /* Only full UART */ +#define UART_MSR_CTS (1<<4) /* Only full UART */ +#define UART_MSR_DDCD (1<<3) /* Only full UART */ +#define UART_MSR_TERI (1<<2) /* Only full UART */ +#define UART_MSR_DDSR (1<<1) /* Only full UART */ +#define UART_MSR_DCTS (1<<0) /* Only full UART */ + +#define UART_CDDL_REG 0x28 +#define UART_CDDLL_REG 0x2c +#define UART_CDDLH_REG 0x30 + +#define UART_IFCTL_REG 0x34 +#define UART_IFCTL_IFCTL (1<<0) + +int uart_cnattach(void); +#endif /* _MTKUART_H */ Added: head/sys/mips/mediatek/uart_dev_mtk_ns8250.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/uart_dev_mtk_ns8250.c Thu Apr 7 11:16:32 2016 (r297669) @@ -0,0 +1,113 @@ +/*- + * Copyright (c) 2013 Ian Lepore + * 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 ``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 "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "uart_if.h" + +/* + * High-level UART interface. + */ +static struct uart_class uart_mtk_ns8250_class; +static int mtk_ns8250_bus_probe(struct uart_softc *); + +static kobj_method_t mtk_ns8250_methods[] = { + KOBJMETHOD(uart_probe, mtk_ns8250_bus_probe), + + KOBJMETHOD(uart_attach, ns8250_bus_attach), + KOBJMETHOD(uart_detach, ns8250_bus_detach), + KOBJMETHOD(uart_flush, ns8250_bus_flush), + KOBJMETHOD(uart_getsig, ns8250_bus_getsig), + KOBJMETHOD(uart_ioctl, ns8250_bus_ioctl), + KOBJMETHOD(uart_ipend, ns8250_bus_ipend), + KOBJMETHOD(uart_param, ns8250_bus_param), + KOBJMETHOD(uart_receive, ns8250_bus_receive), + KOBJMETHOD(uart_setsig, ns8250_bus_setsig), + KOBJMETHOD(uart_transmit, ns8250_bus_transmit), + KOBJMETHOD_END +}; + +static struct uart_class uart_mtk_ns8250_class = { + "mtk8250", + mtk_ns8250_methods, + sizeof(struct ns8250_softc), + .uc_ops = &uart_ns8250_ops, + .uc_range = 1, /* use hinted range */ + .uc_rclk = 0, + .uc_rshift = 2 +}; + +static struct ofw_compat_data compat_data[] = { + { "mtk,ns16550a", (uintptr_t)&uart_mtk_ns8250_class }, + { "ns16550a", (uintptr_t)&uart_mtk_ns8250_class }, + { NULL, (uintptr_t)NULL }, +}; +UART_FDT_CLASS_AND_DEVICE(compat_data); + +static int +mtk_ns8250_bus_probe(struct uart_softc *sc) +{ + int status; + + if (!ofw_bus_status_okay(sc->sc_dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(sc->sc_dev, compat_data)->ocd_data == + (uintptr_t)NULL) + return (ENXIO); + + sc->sc_bas.rclk = mtk_soc_get_uartclk(); + + status = ns8250_bus_probe(sc); + if (status == 0) + device_set_desc(sc->sc_dev, "MTK UART Controller (ns16550a)"); + + return (status); +} From owner-svn-src-all@freebsd.org Thu Apr 7 11:20:05 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6285BB06A95; Thu, 7 Apr 2016 11:20:05 +0000 (UTC) (envelope-from sgalabov@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 mx1.freebsd.org (Postfix) with ESMTPS id 26CA211CB; Thu, 7 Apr 2016 11:20:05 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37BK4Id046120; Thu, 7 Apr 2016 11:20:04 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37BK37c046115; Thu, 7 Apr 2016 11:20:03 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201604071120.u37BK37c046115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Thu, 7 Apr 2016 11:20:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297670 - head/sys/mips/mediatek X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 11:20:05 -0000 Author: sgalabov Date: Thu Apr 7 11:20:03 2016 New Revision: 297670 URL: https://svnweb.freebsd.org/changeset/base/297670 Log: Initial import of Ralink/Mediatek MIPS SoC support #5 USB support This revision adds USB (EHCI/OHCI/OTG, depending on SoC type) support for various Ralink/Mediatek SoCs. Currently USB is not supported on MT7621, this will be a future addition. A USB PHY driver is also included, so that we can properly initialize the USB PHY (e.g., clocks, resets, registers where needed), before attempting to initialize EHCI/OHCI/OTG functionality. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5841 Added: head/sys/mips/mediatek/mtk_dotg.c (contents, props changed) head/sys/mips/mediatek/mtk_ehci.c (contents, props changed) head/sys/mips/mediatek/mtk_ohci.c (contents, props changed) head/sys/mips/mediatek/mtk_usb_phy.c (contents, props changed) head/sys/mips/mediatek/mtk_usb_phy.h (contents, props changed) Added: head/sys/mips/mediatek/mtk_dotg.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_dotg.c Thu Apr 7 11:20:03 2016 (r297670) @@ -0,0 +1,220 @@ +#include +__FBSDID("$FreeBSD$"); + +/*- + * Copyright (c) 2015-2016 Stanislav Galabov. All rights reserved. + * Copyright (c) 2010,2011 Aleksandr Rybalko. All rights reserved. + * Copyright (c) 2007-2008 Hans Petter Selasky. 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + +#define MEM_RID 0 + +static device_probe_t dotg_fdt_probe; +static device_attach_t dotg_fdt_attach; +static device_detach_t dotg_fdt_detach; + +static int +dotg_fdt_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "ralink,rt3050-otg")) + return (ENXIO); + + device_set_desc(dev, "MTK DWC-OTG USB Controller"); + return (0); +} + +static int +dotg_fdt_attach(device_t dev) +{ + struct dwc_otg_softc *sc = device_get_softc(dev); + int err, rid; + + /* setup controller interface softc */ + + /* initialise some bus fields */ + sc->sc_mode = DWC_MODE_HOST; + sc->sc_bus.parent = dev; + sc->sc_bus.devices = sc->sc_devices; + sc->sc_bus.devices_max = DWC_OTG_MAX_DEVICES; + sc->sc_bus.dma_bits = 32; + + /* get all DMA memory */ + if (usb_bus_mem_alloc_all(&sc->sc_bus, + USB_GET_DMA_TAG(dev), NULL)) { + printf("No mem\n"); + return (ENOMEM); + } + rid = 0; + sc->sc_io_res = + bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (!(sc->sc_io_res)) { + printf("Can`t alloc MEM\n"); + goto error; + } + sc->sc_io_tag = rman_get_bustag(sc->sc_io_res); + sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res); + sc->sc_io_size = rman_get_size(sc->sc_io_res); + + rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &rid, RF_ACTIVE); + if (!(sc->sc_irq_res)) { + printf("Can`t alloc IRQ\n"); + goto error; + } + + sc->sc_bus.bdev = device_add_child(dev, "usbus", -1); + if (!(sc->sc_bus.bdev)) { + printf("Can`t add usbus\n"); + goto error; + } + device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus); + + err = bus_setup_intr(dev, sc->sc_irq_res, + INTR_TYPE_TTY | INTR_MPSAFE, dwc_otg_filter_interrupt, + dwc_otg_interrupt, sc, &sc->sc_intr_hdl); + if (err) { + sc->sc_intr_hdl = NULL; + printf("Can`t set IRQ handle\n"); + goto error; + } + + err = dwc_otg_init(sc); + if (err) printf("dotg_init fail\n"); + if (!err) { + err = device_probe_and_attach(sc->sc_bus.bdev); + if (err) printf("device_probe_and_attach fail %d\n", err); + } + if (err) { + goto error; + } + return (0); + +error: + dotg_fdt_detach(dev); + return (ENXIO); +} + +static int +dotg_fdt_detach(device_t dev) +{ + struct dwc_otg_softc *sc = device_get_softc(dev); + device_t bdev; + int err; + + if (sc->sc_bus.bdev) { + bdev = sc->sc_bus.bdev; + device_detach(bdev); + device_delete_child(dev, bdev); + } + /* during module unload there are lots of children leftover */ + device_delete_children(dev); + + if (sc->sc_irq_res && sc->sc_intr_hdl) { + /* + * only call dotg_fdt_uninit() after dotg_fdt_init() + */ + dwc_otg_uninit(sc); + + err = bus_teardown_intr(dev, sc->sc_irq_res, + sc->sc_intr_hdl); + sc->sc_intr_hdl = NULL; + } + if (sc->sc_irq_res) { + bus_release_resource(dev, SYS_RES_IRQ, 0, + sc->sc_irq_res); + sc->sc_irq_res = NULL; + } + if (sc->sc_io_res) { + bus_release_resource(dev, SYS_RES_MEMORY, 0, + sc->sc_io_res); + sc->sc_io_res = NULL; + } + usb_bus_mem_free_all(&sc->sc_bus, NULL); + + return (0); +} + +static device_method_t dotg_fdt_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, dotg_fdt_probe), + DEVMETHOD(device_attach, dotg_fdt_attach), + DEVMETHOD(device_detach, dotg_fdt_detach), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + + DEVMETHOD_END +}; + +static driver_t dotg_fdt_driver = { + .name = "dwcotg", + .methods = dotg_fdt_methods, + .size = sizeof(struct dwc_otg_softc), +}; + +static devclass_t dotg_fdt_devclass; + +DRIVER_MODULE(dotg, simplebus, dotg_fdt_driver, dotg_fdt_devclass, 0, 0); Added: head/sys/mips/mediatek/mtk_ehci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_ehci.c Thu Apr 7 11:20:03 2016 (r297670) @@ -0,0 +1,223 @@ +#include +__FBSDID("$FreeBSD$"); + +/*- + * Copyright (c) 2015 Stanislav Galabov. All rights reserved. + * Copyright (c) 2010,2011 Aleksandr Rybalko. All rights reserved. + * Copyright (c) 2007-2008 Hans Petter Selasky. 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + +#define EHCI_HC_DEVSTR "MTK USB 2.0 Controller" + +static device_probe_t ehci_fdt_probe; +static device_attach_t ehci_fdt_attach; +static device_detach_t ehci_fdt_detach; + +static int +ehci_fdt_probe(device_t self) +{ + + if (!ofw_bus_status_okay(self)) + return (ENXIO); + + if (!ofw_bus_is_compatible(self, "ralink,rt3xxx-ehci")) + return (ENXIO); + + device_set_desc(self, EHCI_HC_DEVSTR); + + return (BUS_PROBE_DEFAULT); +} + +static int +ehci_fdt_attach(device_t self) +{ + ehci_softc_t *sc = device_get_softc(self); + int err; + int rid; + + /* initialise some bus fields */ + sc->sc_bus.parent = self; + sc->sc_bus.devices = sc->sc_devices; + sc->sc_bus.devices_max = EHCI_MAX_DEVICES; + sc->sc_bus.dma_bits = 32; + + /* get all DMA memory */ + if (usb_bus_mem_alloc_all(&sc->sc_bus, + USB_GET_DMA_TAG(self), &ehci_iterate_hw_softc)) { + printf("No mem\n"); + return (ENOMEM); + } + + rid = 0; + sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->sc_io_res) { + device_printf(self, "Could not map memory\n"); + goto error; + } + sc->sc_io_tag = rman_get_bustag(sc->sc_io_res); + sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res); + sc->sc_io_size = rman_get_size(sc->sc_io_res); + + rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + if (sc->sc_irq_res == NULL) { + device_printf(self, "Could not allocate irq\n"); + goto error; + } + + sc->sc_bus.bdev = device_add_child(self, "usbus", -1); + if (!(sc->sc_bus.bdev)) { + device_printf(self, "Could not add USB device\n"); + goto error; + } + device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus); + device_set_desc(sc->sc_bus.bdev, EHCI_HC_DEVSTR); + + sprintf(sc->sc_vendor, "MediaTek"); + + err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + NULL, (driver_intr_t *)ehci_interrupt, sc, &sc->sc_intr_hdl); + if (err) { + device_printf(self, "Could not setup irq, %d\n", err); + sc->sc_intr_hdl = NULL; + goto error; + } + + err = ehci_init(sc); + if (!err) { + err = device_probe_and_attach(sc->sc_bus.bdev); + } + if (err) { + device_printf(self, "USB init failed err=%d\n", err); + goto error; + } + return (0); + +error: + ehci_fdt_detach(self); + return (ENXIO); +} + +static int +ehci_fdt_detach(device_t self) +{ + ehci_softc_t *sc = device_get_softc(self); + device_t bdev; + int err; + + if (sc->sc_bus.bdev) { + bdev = sc->sc_bus.bdev; + device_detach(bdev); + device_delete_child(self, bdev); + } + /* during module unload there are lots of children leftover */ + device_delete_children(self); + + if (sc->sc_irq_res && sc->sc_intr_hdl) { + /* + * only call ehci_detach() after ehci_init() + */ + ehci_detach(sc); + + err = bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl); + if (err) + device_printf(self, "Could not tear down irq, %d\n", + err); + sc->sc_intr_hdl = NULL; + } + if (sc->sc_irq_res) { + bus_release_resource(self, SYS_RES_IRQ, 0, + sc->sc_irq_res); + sc->sc_irq_res = NULL; + } + if (sc->sc_io_res) { + bus_release_resource(self, SYS_RES_MEMORY, 0, + sc->sc_io_res); + sc->sc_io_res = NULL; + } + usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc); + + return (0); +} + +static device_method_t ehci_fdt_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ehci_fdt_probe), + DEVMETHOD(device_attach, ehci_fdt_attach), + DEVMETHOD(device_detach, ehci_fdt_detach), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + + DEVMETHOD_END +}; + +static driver_t ehci_fdt_driver = { + .name = "ehci", + .methods = ehci_fdt_methods, + .size = sizeof(ehci_softc_t), +}; + +static devclass_t ehci_fdt_devclass; + +DRIVER_MODULE(ehci, simplebus, ehci_fdt_driver, ehci_fdt_devclass, 0, 0); Added: head/sys/mips/mediatek/mtk_ohci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_ohci.c Thu Apr 7 11:20:03 2016 (r297670) @@ -0,0 +1,223 @@ +#include +__FBSDID("$FreeBSD$"); + +/*- + * Copyright (c) 2015 Stanislav Galabov. All rights reserved. + * Copyright (c) 2010,2011 Aleksandr Rybalko. All rights reserved. + * Copyright (c) 2007-2008 Hans Petter Selasky. 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + +#define OHCI_HC_DEVSTR "MTK USB Controller" + +static device_probe_t ohci_fdt_probe; +static device_attach_t ohci_fdt_attach; +static device_detach_t ohci_fdt_detach; + +static int +ohci_fdt_probe(device_t self) +{ + + if (!ofw_bus_status_okay(self)) + return (ENXIO); + + if (!ofw_bus_is_compatible(self, "ralink,rt3xxx-ohci")) + return (ENXIO); + + device_set_desc(self, OHCI_HC_DEVSTR); + + return (BUS_PROBE_DEFAULT); +} + +static int +ohci_fdt_attach(device_t self) +{ + ohci_softc_t *sc = device_get_softc(self); + int err; + int rid; + + /* initialise some bus fields */ + sc->sc_bus.parent = self; + sc->sc_bus.devices = sc->sc_devices; + sc->sc_bus.devices_max = OHCI_MAX_DEVICES; + sc->sc_bus.dma_bits = 32; + + /* get all DMA memory */ + if (usb_bus_mem_alloc_all(&sc->sc_bus, + USB_GET_DMA_TAG(self), &ohci_iterate_hw_softc)) { + printf("No mem\n"); + return (ENOMEM); + } + + rid = 0; + sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->sc_io_res) { + device_printf(self, "Could not map memory\n"); + goto error; + } + sc->sc_io_tag = rman_get_bustag(sc->sc_io_res); + sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res); + sc->sc_io_size = rman_get_size(sc->sc_io_res); + + rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + if (sc->sc_irq_res == NULL) { + device_printf(self, "Could not allocate irq\n"); + goto error; + } + + sc->sc_bus.bdev = device_add_child(self, "usbus", -1); + if (!(sc->sc_bus.bdev)) { + device_printf(self, "Could not add USB device\n"); + goto error; + } + device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus); + device_set_desc(sc->sc_bus.bdev, OHCI_HC_DEVSTR); + + sprintf(sc->sc_vendor, "MediaTek"); + + err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + NULL, (driver_intr_t *)ohci_interrupt, sc, &sc->sc_intr_hdl); + if (err) { + device_printf(self, "Could not setup irq, %d\n", err); + sc->sc_intr_hdl = NULL; + goto error; + } + + err = ohci_init(sc); + if (!err) { + err = device_probe_and_attach(sc->sc_bus.bdev); + } + if (err) { + device_printf(self, "USB init failed err=%d\n", err); + goto error; + } + return (0); + +error: + ohci_fdt_detach(self); + return (ENXIO); +} + +static int +ohci_fdt_detach(device_t self) +{ + ohci_softc_t *sc = device_get_softc(self); + device_t bdev; + int err; + + if (sc->sc_bus.bdev) { + bdev = sc->sc_bus.bdev; + device_detach(bdev); + device_delete_child(self, bdev); + } + /* during module unload there are lots of children leftover */ + device_delete_children(self); + + if (sc->sc_irq_res && sc->sc_intr_hdl) { + /* + * only call ohci_detach() after ohci_init() + */ + ohci_detach(sc); + + err = bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl); + if (err) + device_printf(self, "Could not tear down irq, %d\n", + err); + sc->sc_intr_hdl = NULL; + } + if (sc->sc_irq_res) { + bus_release_resource(self, SYS_RES_IRQ, 0, + sc->sc_irq_res); + sc->sc_irq_res = NULL; + } + if (sc->sc_io_res) { + bus_release_resource(self, SYS_RES_MEMORY, 0, + sc->sc_io_res); + sc->sc_io_res = NULL; + } + usb_bus_mem_free_all(&sc->sc_bus, &ohci_iterate_hw_softc); + + return (0); +} + +static device_method_t ohci_fdt_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ohci_fdt_probe), + DEVMETHOD(device_attach, ohci_fdt_attach), + DEVMETHOD(device_detach, ohci_fdt_detach), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + + DEVMETHOD_END +}; + +static driver_t ohci_fdt_driver = { + .name = "ohci", + .methods = ohci_fdt_methods, + .size = sizeof(ohci_softc_t), +}; + +static devclass_t ohci_fdt_devclass; + +DRIVER_MODULE(ohci, simplebus, ohci_fdt_driver, ohci_fdt_devclass, 0, 0); Added: head/sys/mips/mediatek/mtk_usb_phy.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_usb_phy.c Thu Apr 7 11:20:03 2016 (r297670) @@ -0,0 +1,314 @@ +/*- + * Copyright (c) 2016 Stanislav Galabov. + * 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 ``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 +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#define RESET_ASSERT_DELAY 1000 +#define RESET_DEASSERT_DELAY 10000 + +struct mtk_usb_phy_softc { + device_t dev; + struct resource * res; + uint32_t fm_base; + uint32_t u2_base; + uint32_t sr_coef; + uint32_t socid; +}; + +#define USB_PHY_READ(_sc, _off) bus_read_4((_sc)->res, (_off)) +#define USB_PHY_WRITE(_sc, _off, _val) bus_write_4((_sc)->res, (_off), (_val)) +#define USB_PHY_CLR_SET(_sc, _off, _clr, _set) \ + USB_PHY_WRITE(_sc, _off, ((USB_PHY_READ(_sc, _off) & ~(_clr)) | (_set))) + +#define USB_PHY_READ_U2(_sc, _off) \ + USB_PHY_READ((_sc), ((_sc)->u2_base + (_off))) +#define USB_PHY_WRITE_U2(_sc, _off, _val) \ + USB_PHY_WRITE((_sc), ((_sc)->u2_base + (_off)), (_val)) +#define USB_PHY_CLR_SET_U2(_sc, _off, _clr, _set) \ + USB_PHY_WRITE_U2((_sc), (_off), ((USB_PHY_READ_U2((_sc), (_off)) & \ + ~(_clr)) | (_set))) +#define USB_PHY_BARRIER(_sc) bus_barrier((_sc)->res, 0, 0, \ + BUS_SPACE_BARRIER_WRITE | BUS_SPACE_BARRIER_READ) + +#define USB_PHY_READ_FM(_sc, _off) \ + USB_PHY_READ((_sc), ((_sc)->fm_base + (_off))) +#define USB_PHY_WRITE_FM(_sc, _off) \ + USB_PHY_WRITE((_sc), ((_sc)->fm_base + (_off)), (_val)) +#define USB_PHY_CLR_SET_FM(_sc, _off, _clr, _set) \ + USB_PHY_WRITE_U2((_sc), (_off), ((USB_PHY_READ_U2((_sc), (_off)) & \ + ~(_clr)) | (_set))) + +static void mtk_usb_phy_mt7621_init(device_t); +static void mtk_usb_phy_mt7628_init(device_t); + +static struct ofw_compat_data compat_data[] = { + { "ralink,mt7620a-usbphy", MTK_SOC_MT7620A }, + { "ralink,mt7628an-usbphy", MTK_SOC_MT7628 }, + { "ralink,rt3xxx-usbphy", MTK_SOC_RT3352 }, + { NULL, MTK_SOC_UNKNOWN } +}; + +static int +mtk_usb_phy_probe(device_t dev) +{ + struct mtk_usb_phy_softc *sc = device_get_softc(dev); + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + if ((sc->socid = + ofw_bus_search_compatible(dev, compat_data)->ocd_data) == + MTK_SOC_UNKNOWN) + return (ENXIO); + + device_set_desc(dev, "MTK USB PHY"); + + return (0); +} + +static int +mtk_usb_phy_attach(device_t dev) +{ + struct mtk_usb_phy_softc * sc = device_get_softc(dev); + phandle_t node; + uint32_t val; + int rid; + + sc->dev = dev; + + /* Get our FDT node and SoC id */ + node = ofw_bus_get_node(dev); + + /* Now let's see about setting USB to host or device mode */ + /* XXX: is it the same for all SoCs? */ + val = mtk_sysctl_get(SYSCTL_SYSCFG1); + if (OF_hasprop(node, "mtk,usb-device")) + val &= ~SYSCFG1_USB_HOST_MODE; + else + val |= SYSCFG1_USB_HOST_MODE; + mtk_sysctl_set(SYSCTL_SYSCFG1, val); + + /* If we have clocks defined - enable them */ + if (OF_hasprop(node, "clocks")) + fdt_clock_enable_all(dev); + + /* If we have resets defined - perform a reset sequence */ + if (OF_hasprop(node, "resets")) { + fdt_reset_assert_all(dev); + DELAY(RESET_ASSERT_DELAY); + fdt_reset_deassert_all(dev); + DELAY(RESET_DEASSERT_DELAY); + } + + /* Careful, some devices actually require resources */ + if (OF_hasprop(node, "reg")) { + rid = 0; + sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->res == NULL) { + device_printf(dev, "could not map memory\n"); + return (ENXIO); + } + } else { + sc->res = NULL; + } + + /* Some SoCs require specific USB PHY init... handle these */ + switch (sc->socid) { + case MTK_SOC_MT7628: /* Fallthrough */ + case MTK_SOC_MT7688: + if (sc->res == NULL) + return (ENXIO); + sc->fm_base = MT7628_FM_FEG_BASE; + sc->u2_base = MT7628_U2_BASE; + sc->sr_coef = MT7628_SR_COEF; + mtk_usb_phy_mt7628_init(dev); + break; + case MTK_SOC_MT7621: + if (sc->res == NULL) + return (ENXIO); + sc->fm_base = MT7621_FM_FEG_BASE; + sc->u2_base = MT7621_U2_BASE; + sc->sr_coef = MT7621_SR_COEF; + mtk_usb_phy_mt7621_init(dev); + break; + } + + /* We no longer need the resources, release them */ + if (sc->res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->res); + + return (0); +} + +static int +mtk_usb_phy_detach(device_t dev) +{ + struct mtk_usb_phy_softc *sc = device_get_softc(dev); + phandle_t node; + + /* Get our FDT node */ + node = ofw_bus_get_node(dev); + + /* If we have resets defined - assert them */ + if (OF_hasprop(node, "resets")) + fdt_reset_assert_all(dev); + + /* If we have clocks defined - disable them */ + if (OF_hasprop(node, "clocks")) + fdt_clock_disable_all(dev); + + /* Finally, release resources, if any were allocated */ + if (sc->res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->res); + + return (0); +} + +static void +mtk_usb_phy_slew_rate_calibration(struct mtk_usb_phy_softc *sc) +{ + uint32_t val; + int i; + + USB_PHY_CLR_SET_U2(sc, U2_PHY_ACR0, 0, SRCAL_EN); + USB_PHY_BARRIER(sc); + DELAY(1000); + + USB_PHY_CLR_SET_FM(sc, U2_PHY_FMMONR1, 0, FRCK_EN); + USB_PHY_BARRIER(sc); + USB_PHY_CLR_SET_FM(sc, U2_PHY_FMCR0, CYCLECNT, 0x400); + USB_PHY_BARRIER(sc); + USB_PHY_CLR_SET_FM(sc, U2_PHY_FMCR0, 0, FDET_EN); + USB_PHY_BARRIER(sc); + + for (i = 0; i < 1000; i++) { + if ((val = USB_PHY_READ_FM(sc, U2_PHY_FMMONR0)) != 0) { + device_printf(sc->dev, "DONE with FDET\n"); + break; + } + DELAY(10000); + } + device_printf(sc->dev, "After FDET\n"); + + USB_PHY_CLR_SET_FM(sc, U2_PHY_FMCR0, FDET_EN, 0); + USB_PHY_BARRIER(sc); + USB_PHY_CLR_SET_FM(sc, U2_PHY_FMMONR1, FRCK_EN, 0); + USB_PHY_BARRIER(sc); + USB_PHY_CLR_SET_U2(sc, U2_PHY_ACR0, SRCAL_EN, 0); + USB_PHY_BARRIER(sc); + DELAY(1000); + + if (val == 0) { + USB_PHY_CLR_SET_U2(sc, U2_PHY_ACR0, SRCTRL, 0x4 << SRCTRL_OFF); + USB_PHY_BARRIER(sc); + } else { + val = ((((1024 * 25 * sc->sr_coef) / val) + 500) / 1000) & + SRCTRL_MSK; + USB_PHY_CLR_SET_U2(sc, U2_PHY_ACR0, SRCTRL, val << SRCTRL_OFF); + USB_PHY_BARRIER(sc); + } +} + +static void +mtk_usb_phy_mt7621_init(device_t dev) +{ + struct mtk_usb_phy_softc *sc = device_get_softc(dev); + + /* Slew rate calibration only, but for 2 ports */ + mtk_usb_phy_slew_rate_calibration(sc); + + sc->u2_base = MT7621_U2_BASE_P1; + mtk_usb_phy_slew_rate_calibration(sc); +} + +static void +mtk_usb_phy_mt7628_init(device_t dev) +{ + struct mtk_usb_phy_softc *sc = device_get_softc(dev); + + /* XXX: possibly add barriers between the next writes? */ + USB_PHY_WRITE_U2(sc, U2_PHY_DCR0, 0x00ffff02); + USB_PHY_BARRIER(sc); + USB_PHY_WRITE_U2(sc, U2_PHY_DCR0, 0x00555502); + USB_PHY_BARRIER(sc); + USB_PHY_WRITE_U2(sc, U2_PHY_DCR0, 0x00aaaa02); + USB_PHY_BARRIER(sc); + USB_PHY_WRITE_U2(sc, U2_PHY_DCR0, 0x00000402); + USB_PHY_BARRIER(sc); + USB_PHY_WRITE_U2(sc, U2_PHY_AC0, 0x0048086a); + USB_PHY_BARRIER(sc); + USB_PHY_WRITE_U2(sc, U2_PHY_AC1, 0x4400001c); + USB_PHY_BARRIER(sc); + USB_PHY_WRITE_U2(sc, U2_PHY_ACR3, 0xc0200000); + USB_PHY_BARRIER(sc); + USB_PHY_WRITE_U2(sc, U2_PHY_DTM0, 0x02000000); + USB_PHY_BARRIER(sc); + + /* Slew rate calibration */ + //mtk_usb_phy_slew_rate_calibration(sc); +} + +static device_method_t mtk_usb_phy_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, mtk_usb_phy_probe), + DEVMETHOD(device_attach, mtk_usb_phy_attach), + DEVMETHOD(device_detach, mtk_usb_phy_detach), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + + DEVMETHOD_END +}; + +static driver_t mtk_usb_phy_driver = { + .name = "usbphy", + .methods = mtk_usb_phy_methods, + .size = sizeof(struct mtk_usb_phy_softc), +}; + +static devclass_t mtk_usb_phy_devclass; + +DRIVER_MODULE(usbphy, simplebus, mtk_usb_phy_driver, mtk_usb_phy_devclass, 0, + 0); Added: head/sys/mips/mediatek/mtk_usb_phy.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_usb_phy.h Thu Apr 7 11:20:03 2016 (r297670) @@ -0,0 +1,66 @@ +/*- + * Copyright (c) 2016 Stanislav Galabov. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Apr 7 11:21:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8EDBB06CB5; Thu, 7 Apr 2016 11:21:43 +0000 (UTC) (envelope-from sgalabov@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 mx1.freebsd.org (Postfix) with ESMTPS id A594A1456; Thu, 7 Apr 2016 11:21:43 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37BLg9e048792; Thu, 7 Apr 2016 11:21:42 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37BLgci048788; Thu, 7 Apr 2016 11:21:42 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201604071121.u37BLgci048788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Thu, 7 Apr 2016 11:21:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297671 - head/sys/mips/mediatek X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 11:21:44 -0000 Author: sgalabov Date: Thu Apr 7 11:21:42 2016 New Revision: 297671 URL: https://svnweb.freebsd.org/changeset/base/297671 Log: Initial import of Ralink/Mediatek MIPS SoC support #6 SPI drivers for the various Ralink/Mediatek SoCs. There are 2 versions of the SPI controller (so far) present in the supported SoCs, hence v1 and v2 drivers. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5842 Added: head/sys/mips/mediatek/mtk_spi_v1.c (contents, props changed) head/sys/mips/mediatek/mtk_spi_v1.h (contents, props changed) head/sys/mips/mediatek/mtk_spi_v2.c (contents, props changed) head/sys/mips/mediatek/mtk_spi_v2.h (contents, props changed) Added: head/sys/mips/mediatek/mtk_spi_v1.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_spi_v1.c Thu Apr 7 11:21:42 2016 (r297671) @@ -0,0 +1,351 @@ +/*- + * Copyright (c) 2009, Oleksandr Tymoshenko + * Copyright (c) 2011, Aleksandr Rybalko + * Copyright (c) 2013, Alexander A. Mityaev + * 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 unmodified, 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 +#include + +#include +#include +//#include + +#include +#include +#include "spibus_if.h" + +#include "opt_platform.h" + +#include +#include +#include + +#include +#include + +#undef MTK_SPI_DEBUG +#ifdef MTK_SPI_DEBUG +#define dprintf printf +#else +#define dprintf(x, arg...) +#endif + +/* + * register space access macros + */ +#define SPI_WRITE(sc, reg, val) do { \ + bus_write_4(sc->sc_mem_res, (reg), (val)); \ + } while (0) + +#define SPI_READ(sc, reg) bus_read_4(sc->sc_mem_res, (reg)) + +#define SPI_SET_BITS(sc, reg, bits) \ + SPI_WRITE(sc, reg, SPI_READ(sc, (reg)) | (bits)) + +#define SPI_CLEAR_BITS(sc, reg, bits) \ + SPI_WRITE(sc, reg, SPI_READ(sc, (reg)) & ~(bits)) + +struct mtk_spi_softc { + device_t sc_dev; + struct resource *sc_mem_res; +}; + +static int mtk_spi_probe(device_t); +static int mtk_spi_attach(device_t); +static int mtk_spi_detach(device_t); +static int mtk_spi_wait(struct mtk_spi_softc *); +static void mtk_spi_chip_activate(struct mtk_spi_softc *); +static void mtk_spi_chip_deactivate(struct mtk_spi_softc *); +static uint8_t mtk_spi_txrx(struct mtk_spi_softc *, uint8_t *, int); +static int mtk_spi_transfer(device_t, device_t, struct spi_command *); +static phandle_t mtk_spi_get_node(device_t, device_t); + +static struct ofw_compat_data compat_data[] = { + { "ralink,rt2880-spi", 1 }, + { "ralink,rt3050-spi", 1 }, + { "ralink,rt3352-spi", 1 }, + { "ralink,rt3883-spi", 1 }, + { "ralink,rt5350-spi", 1 }, + { "ralink,mt7620a-spi", 1 }, + { NULL, 0 } +}; + +static int +mtk_spi_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return(ENXIO); + + device_set_desc(dev, "MTK SPI Controller (v1)"); + + return (0); +} + +static int +mtk_spi_attach(device_t dev) +{ + struct mtk_spi_softc *sc = device_get_softc(dev); + int rid; + + sc->sc_dev = dev; + rid = 0; + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->sc_mem_res) { + device_printf(dev, "Could not map memory\n"); + return (ENXIO); + } + + if (mtk_spi_wait(sc)) { + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + return (EBUSY); + } + + SPI_WRITE(sc, MTK_SPICFG, MSBFIRST | SPICLKPOL | TX_ON_CLK_FALL | + SPI_CLK_DIV8); /* XXX: make it configurable */ + /* + * W25Q64CV max 104MHz, bus 120-192 MHz, so divide by 2. + * Update: divide by 4, DEV2 to fast for flash. + */ + + device_add_child(dev, "spibus", 0); + return (bus_generic_attach(dev)); +} + +static int +mtk_spi_detach(device_t dev) +{ + struct mtk_spi_softc *sc = device_get_softc(dev); + + SPI_SET_BITS(sc, MTK_SPICTL, HIZSMOSI | CS_HIGH); + + if (sc->sc_mem_res) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + + return (0); +} + +static void +mtk_spi_chip_activate(struct mtk_spi_softc *sc) +{ +// printf("%s\n", __func__); + mtk_spi_wait(sc); + /* + * Put all CSx to low + */ + SPI_CLEAR_BITS(sc, MTK_SPICTL, CS_HIGH | HIZSMOSI); +} + +static void +mtk_spi_chip_deactivate(struct mtk_spi_softc *sc) +{ +// printf("%s\n", __func__); + mtk_spi_wait(sc); + /* + * Put all CSx to high + */ + SPI_SET_BITS(sc, MTK_SPICTL, CS_HIGH | HIZSMOSI); +} + +static int +mtk_spi_wait(struct mtk_spi_softc *sc) +{ + int i = 1000; + + while (i--) { + if (!SPI_READ(sc, MTK_SPIBUSY)) + break; + } + if (i == 0) { + printf("busy\n"); + return (1); + } + + return (0); +} + +static uint8_t +mtk_spi_txrx(struct mtk_spi_softc *sc, uint8_t *data, int write) +{ + + if (mtk_spi_wait(sc)) + return (EBUSY); + + if (write == MTK_SPI_WRITE) { + SPI_WRITE(sc, MTK_SPIDATA, *data); + SPI_SET_BITS(sc, MTK_SPICTL, START_WRITE); + //printf("%s(W:%d)\n", __func__, *data); + } else {/* MTK_SPI_READ */ + SPI_SET_BITS(sc, MTK_SPICTL, START_READ); + if (mtk_spi_wait(sc)) + return (EBUSY); + + *data = SPI_READ(sc, MTK_SPIDATA) & 0xff; + //printf("%s(R:%d)\n", __func__, *data); + } + return (0); +} + +static int +mtk_spi_transfer(device_t dev, device_t child, struct spi_command *cmd) +{ + struct mtk_spi_softc *sc; + uint8_t *buf, byte, *tx_buf; + struct spibus_ivar *devi = SPIBUS_IVAR(child); + int i, sz, error = 0, write = 0; + + sc = device_get_softc(dev); + + if (devi->cs != 0) + /* Only 1 CS */ + return (ENXIO); + + /* There is always a command to transfer. */ + tx_buf = (uint8_t *)(cmd->tx_cmd); + + /* Perform some fixup because MTK dont support duplex SPI */ + switch(tx_buf[0]) { + case CMD_READ_IDENT: + cmd->tx_cmd_sz = 1; + cmd->rx_cmd_sz = 3; + break; + case CMD_ENTER_4B_MODE: + case CMD_EXIT_4B_MODE: + case CMD_WRITE_ENABLE: + case CMD_WRITE_DISABLE: + cmd->tx_cmd_sz = 1; + cmd->rx_cmd_sz = 0; + break; + case CMD_READ_STATUS: + cmd->tx_cmd_sz = 1; + cmd->rx_cmd_sz = 1; + break; + case CMD_READ: + case CMD_FAST_READ: + cmd->rx_cmd_sz = cmd->tx_data_sz = 0; + break; + case CMD_SECTOR_ERASE: + cmd->rx_cmd_sz = 0; + break; + case CMD_PAGE_PROGRAM: + cmd->rx_cmd_sz = cmd->rx_data_sz = 0; + break; + } + + mtk_spi_chip_activate(sc); + + if (cmd->tx_cmd_sz + cmd->rx_cmd_sz) { + buf = (uint8_t *)(cmd->rx_cmd); + tx_buf = (uint8_t *)(cmd->tx_cmd); + sz = cmd->tx_cmd_sz + cmd->rx_cmd_sz; + + for (i = 0; i < sz; i++) { + if(i < cmd->tx_cmd_sz) { + byte = tx_buf[i]; + error = mtk_spi_txrx(sc, &byte, + MTK_SPI_WRITE); + if (error) + goto mtk_spi_transfer_fail; + continue; + } + error = mtk_spi_txrx(sc, &byte, + MTK_SPI_READ); + if (error) + goto mtk_spi_transfer_fail; + buf[i] = byte; + } + } + + /* + * Transfer/Receive data + */ + + if (cmd->tx_data_sz + cmd->rx_data_sz) { + write = (cmd->tx_data_sz > 0)?1:0; + buf = (uint8_t *)(write ? cmd->tx_data : cmd->rx_data); + sz = write ? cmd->tx_data_sz : cmd->rx_data_sz; + + for (i = 0; i < sz; i++) { + byte = buf[i]; + error = mtk_spi_txrx(sc, &byte, + write ? MTK_SPI_WRITE : MTK_SPI_READ); + if (error) + goto mtk_spi_transfer_fail; + buf[i] = byte; + } + } +mtk_spi_transfer_fail: + mtk_spi_chip_deactivate(sc); + + return (error); +} + +static phandle_t +mtk_spi_get_node(device_t bus, device_t dev) +{ + + /* We only have one child, the SPI bus, which needs our own node. */ + return (ofw_bus_get_node(bus)); +} + +static device_method_t mtk_spi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, mtk_spi_probe), + DEVMETHOD(device_attach, mtk_spi_attach), + DEVMETHOD(device_detach, mtk_spi_detach), + + DEVMETHOD(spibus_transfer, mtk_spi_transfer), + + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_node, mtk_spi_get_node), + + DEVMETHOD_END +}; + +static driver_t mtk_spi_driver = { + .name = "spi", + .methods = mtk_spi_methods, + .size = sizeof(struct mtk_spi_softc), +}; + +static devclass_t mtk_spi_devclass; + +DRIVER_MODULE(mtk_spi_v1, simplebus, mtk_spi_driver, mtk_spi_devclass, 0, 0); Added: head/sys/mips/mediatek/mtk_spi_v1.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_spi_v1.h Thu Apr 7 11:21:42 2016 (r297671) @@ -0,0 +1,71 @@ +/*- + * Copyright (c) 2009, Oleksandr Tymoshenko + * Copyright (c) 2011, Aleksandr Rybalko + * Copyright (c) 2013, Alexander A. Mityaev + * Copyright (c) 2016, Stanislav Galabov + * 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 unmodified, 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. + * + * $FreeBSD$ + */ + +#ifndef _MTK_SPIVAR_H_ +#define _MTK_SPIVAR_H_ + +/* SPI controller interface */ + +#define MTK_SPISTAT 0x00 +/* SPIBUSY is alias for SPIBUSY, because SPISTAT have only BUSY bit*/ +#define MTK_SPIBUSY MTK_SPISTAT + +#define MTK_SPICFG 0x10 +#define MSBFIRST (1<<8) +#define SPICLKPOL (1<<6) +#define CAPT_ON_CLK_FALL (1<<5) +#define TX_ON_CLK_FALL (1<<4) +#define HIZSPI (1<<3) /* Set SPI pins to Tri-state */ +#define SPI_CLK_SHIFT 0 /* SPI clock divide control */ +#define SPI_CLK_MASK 0x00000007 +#define SPI_CLK_DIV2 0 +#define SPI_CLK_DIV4 1 +#define SPI_CLK_DIV8 2 +#define SPI_CLK_DIV16 3 +#define SPI_CLK_DIV32 4 +#define SPI_CLK_DIV64 5 +#define SPI_CLK_DIV128 6 +#define SPI_CLK_DISABLED 7 + +#define MTK_SPICTL 0x14 +#define HIZSMOSI (1<<3) +#define START_WRITE (1<<2) +#define START_READ (1<<1) +#define CS_HIGH (1<<0) + +#define MTK_SPIDATA 0x20 +#define SPIDATA_MASK 0x000000ff + +#define MTK_SPI_WRITE 1 +#define MTK_SPI_READ 0 + +#endif /* _MTK_SPIVAR_H_ */ Added: head/sys/mips/mediatek/mtk_spi_v2.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_spi_v2.c Thu Apr 7 11:21:42 2016 (r297671) @@ -0,0 +1,357 @@ +/*- + * Copyright (c) 2009, Oleksandr Tymoshenko + * Copyright (c) 2011, Aleksandr Rybalko + * Copyright (c) 2013, Alexander A. Mityaev + * Copyright (c) 2016, Stanislav Galabov + * 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 unmodified, 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 +#include + +#include +#include +//#include + +#include +#include +#include "spibus_if.h" + +#include "opt_platform.h" + +#include +#include +#include + +#include +#include + +#undef MTK_SPI_DEBUG +#ifdef MTK_SPI_DEBUG +#define dprintf printf +#else +#define dprintf(x, arg...) +#endif + +/* + * register space access macros + */ +#define SPI_WRITE(sc, reg, val) do { \ + bus_write_4(sc->sc_mem_res, (reg), (val)); \ + } while (0) + +#define SPI_READ(sc, reg) bus_read_4(sc->sc_mem_res, (reg)) + +#define SPI_SET_BITS(sc, reg, bits) \ + SPI_WRITE(sc, reg, SPI_READ(sc, (reg)) | (bits)) + +#define SPI_CLEAR_BITS(sc, reg, bits) \ + SPI_WRITE(sc, reg, SPI_READ(sc, (reg)) & ~(bits)) + +struct mtk_spi_softc { + device_t sc_dev; + struct resource *sc_mem_res; +}; + +static int mtk_spi_probe(device_t); +static int mtk_spi_attach(device_t); +static int mtk_spi_detach(device_t); +static int mtk_spi_wait(struct mtk_spi_softc *); +static void mtk_spi_chip_activate(struct mtk_spi_softc *); +static void mtk_spi_chip_deactivate(struct mtk_spi_softc *); +static uint8_t mtk_spi_txrx(struct mtk_spi_softc *, uint8_t *, int); +static int mtk_spi_transfer(device_t, device_t, struct spi_command *); +static phandle_t mtk_spi_get_node(device_t, device_t); + +static struct ofw_compat_data compat_data[] = { + { "ralink,mt7621-spi", 1 }, + { "ralink,mtk7628an-spi", 1 }, + { NULL, 0 } +}; + +static int +mtk_spi_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return(ENXIO); + + device_set_desc(dev, "MTK SPI Controller (v2)"); + + return (0); +} + +static int +mtk_spi_attach(device_t dev) +{ + struct mtk_spi_softc *sc = device_get_softc(dev); + uint32_t val; + int rid; + + sc->sc_dev = dev; + rid = 0; + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->sc_mem_res) { + device_printf(dev, "Could not map memory\n"); + return (ENXIO); + } + + if (mtk_spi_wait(sc)) { + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + return (EBUSY); + } + + val = SPI_READ(sc, MTK_SPIMASTER); + val &= ~(0xfff << 16); + val |= 13 << 16; + val |= 7 << 29; + val |= 1 << 2; + SPI_WRITE(sc, MTK_SPIMASTER, val); + /* + * W25Q64CV max 104MHz, bus 120-192 MHz, so divide by 2. + * Update: divide by 4, DEV2 to fast for flash. + */ + + device_add_child(dev, "spibus", 0); + return (bus_generic_attach(dev)); +} + +static int +mtk_spi_detach(device_t dev) +{ + struct mtk_spi_softc *sc = device_get_softc(dev); + + //SPI_SET_BITS(sc, MTK_SPICTL, HIZSMOSI | CS_HIGH); + + if (sc->sc_mem_res) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + + return (0); +} + +static void +mtk_spi_chip_activate(struct mtk_spi_softc *sc) +{ +// printf("%s\n", __func__); + mtk_spi_wait(sc); + /* + * Put all CSx to low + */ + SPI_SET_BITS(sc, MTK_SPIPOLAR, 1); +} + +static void +mtk_spi_chip_deactivate(struct mtk_spi_softc *sc) +{ +// printf("%s\n", __func__); + mtk_spi_wait(sc); + /* + * Put all CSx to high + */ + SPI_CLEAR_BITS(sc, MTK_SPIPOLAR, 1); +} + +static int +mtk_spi_wait(struct mtk_spi_softc *sc) +{ + int i = 1000; + + while (i--) { + if (!(SPI_READ(sc, MTK_SPITRANS) & SPIBUSY)) + break; + } + if (i == 0) { + //printf("busy\n"); + return (1); + } + + return (0); +} + +static uint8_t +mtk_spi_txrx(struct mtk_spi_softc *sc, uint8_t *data, int write) +{ + + if (mtk_spi_wait(sc)) + return (0xff); + + if (write == MTK_SPI_WRITE) { + SPI_WRITE(sc, MTK_SPIOPCODE, (*data)); + SPI_WRITE(sc, MTK_SPIMOREBUF, (8<<24)); + } else { + SPI_WRITE(sc, MTK_SPIMOREBUF, (8<<12)); + } + + SPI_SET_BITS(sc, MTK_SPITRANS, SPISTART); + + if (mtk_spi_wait(sc)) + return (0xff); + + if (write == MTK_SPI_READ) { + *data = SPI_READ(sc, MTK_SPIDATA) & 0xff; + } + + return (0); +} + +static int +mtk_spi_transfer(device_t dev, device_t child, struct spi_command *cmd) +{ + struct mtk_spi_softc *sc; + uint8_t *buf, byte, *tx_buf; + struct spibus_ivar *devi = SPIBUS_IVAR(child); + int i, sz, error, write = 0; + + sc = device_get_softc(dev); + + if (devi->cs != 0) + /* Only 1 CS */ + return (ENXIO); + + /* There is always a command to transfer. */ + tx_buf = (uint8_t *)(cmd->tx_cmd); + + /* Perform some fixup because MTK dont support duplex SPI */ + switch(tx_buf[0]) { + case CMD_READ_IDENT: + cmd->tx_cmd_sz = 1; + cmd->rx_cmd_sz = 3; + break; + case CMD_ENTER_4B_MODE: + case CMD_EXIT_4B_MODE: + case CMD_WRITE_ENABLE: + case CMD_WRITE_DISABLE: + cmd->tx_cmd_sz = 1; + cmd->rx_cmd_sz = 0; + break; + case CMD_READ_STATUS: + cmd->tx_cmd_sz = 1; + cmd->rx_cmd_sz = 1; + break; + case CMD_READ: + case CMD_FAST_READ: + cmd->rx_cmd_sz = cmd->tx_data_sz = 0; + break; + case CMD_SECTOR_ERASE: + cmd->rx_cmd_sz = 0; + break; + case CMD_PAGE_PROGRAM: + cmd->rx_cmd_sz = cmd->rx_data_sz = 0; + break; + } + + mtk_spi_chip_activate(sc); + + if (cmd->tx_cmd_sz + cmd->rx_cmd_sz) { + buf = (uint8_t *)(cmd->rx_cmd); + tx_buf = (uint8_t *)(cmd->tx_cmd); + sz = cmd->tx_cmd_sz + cmd->rx_cmd_sz; + + for (i = 0; i < sz; i++) { + if(i < cmd->tx_cmd_sz) { + byte = tx_buf[i]; + error = mtk_spi_txrx(sc, &byte, + MTK_SPI_WRITE); + if (error) + goto mtk_spi_transfer_fail; + continue; + } + error = mtk_spi_txrx(sc, &byte, + MTK_SPI_READ); + if (error) + goto mtk_spi_transfer_fail; + buf[i] = byte; + } + } + + /* + * Transfer/Receive data + */ + + if (cmd->tx_data_sz + cmd->rx_data_sz) { + write = (cmd->tx_data_sz > 0)?1:0; + buf = (uint8_t *)(write ? cmd->tx_data : cmd->rx_data); + sz = write ? cmd->tx_data_sz : cmd->rx_data_sz; + + for (i = 0; i < sz; i++) { + byte = buf[i]; + error = mtk_spi_txrx(sc, &byte, + write ? MTK_SPI_WRITE : MTK_SPI_READ); + if (error) + goto mtk_spi_transfer_fail; + buf[i] = byte; + } + } +mtk_spi_transfer_fail: + mtk_spi_chip_deactivate(sc); + + return (0); +} + +static phandle_t +mtk_spi_get_node(device_t bus, device_t dev) +{ + + /* We only have one child, the SPI bus, which needs our own node. */ + return (ofw_bus_get_node(bus)); +} + +static device_method_t mtk_spi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, mtk_spi_probe), + DEVMETHOD(device_attach, mtk_spi_attach), + DEVMETHOD(device_detach, mtk_spi_detach), + + DEVMETHOD(spibus_transfer, mtk_spi_transfer), + + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_node, mtk_spi_get_node), + + DEVMETHOD_END +}; + +static driver_t mtk_spi_driver = { + .name = "spi", + .methods = mtk_spi_methods, + .size = sizeof(struct mtk_spi_softc), +}; + +static devclass_t mtk_spi_devclass; + +DRIVER_MODULE(mtk_spi_v2, simplebus, mtk_spi_driver, mtk_spi_devclass, 0, 0); Added: head/sys/mips/mediatek/mtk_spi_v2.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_spi_v2.h Thu Apr 7 11:21:42 2016 (r297671) @@ -0,0 +1,55 @@ +/*- + * Copyright (c) 2009, Oleksandr Tymoshenko + * Copyright (c) 2011, Aleksandr Rybalko + * Copyright (c) 2013, Alexander A. Mityaev + * Copyright (c) 2016, Stanislav Galabov + * 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 unmodified, 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. + * + * $FreeBSD$ + */ + +#ifndef _MTK_SPI_NEWVAR_H_ +#define _MTK_SPI_NEWVAR_H_ + +/* SPI controller interface */ + +#define MTK_SPITRANS 0x00 +#define SPIBUSY (1<<16) +#define SPISTART (1<<8) + +#define MTK_SPIMASTER 0x28 + +#define MTK_SPIMOREBUF 0x2C + +#define MTK_SPIOPCODE 0x04 +#define MTK_SPIDATA 0x08 +#define SPIDATA_MASK 0x000000ff + +#define MTK_SPI_WRITE 1 +#define MTK_SPI_READ 0 + +#define MTK_SPIPOLAR 0x38 + +#endif /* _MTK_SPI_NEWVAR_H_ */ From owner-svn-src-all@freebsd.org Thu Apr 7 12:54:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A01CB06172; Thu, 7 Apr 2016 12:54:45 +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 mx1.freebsd.org (Postfix) with ESMTPS id 5AB2C1FC2; Thu, 7 Apr 2016 12:54:45 +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 u37Csika076214; Thu, 7 Apr 2016 12:54:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37Csi9k076213; Thu, 7 Apr 2016 12:54:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604071254.u37Csi9k076213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 7 Apr 2016 12:54:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297672 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 12:54:45 -0000 Author: mav Date: Thu Apr 7 12:54:44 2016 New Revision: 297672 URL: https://svnweb.freebsd.org/changeset/base/297672 Log: Alike to r293708 relax pool check in vdev_geom_open_by_path(). This made impossible spare disk open by known path, which kind of worked only because the same fix was applied to vdev_geom_attach_by_guids() in r293708. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Apr 7 11:21:42 2016 (r297671) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Apr 7 12:54:44 2016 (r297672) @@ -679,7 +679,15 @@ vdev_geom_open_by_path(vdev_t *vd, int c g_topology_unlock(); vdev_geom_read_guids(cp, &pguid, &vguid); g_topology_lock(); - if (pguid != spa_guid(vd->vdev_spa) || + /* + * Check that the label's vdev guid matches the + * desired guid. If the label has a pool guid, + * check that it matches too. (Inactive spares + * and L2ARCs do not have any pool guid in the + * label.) + */ + if ((pguid != 0 && + pguid != spa_guid(vd->vdev_spa)) || vguid != vd->vdev_guid) { vdev_geom_close_locked(vd); cp = NULL; From owner-svn-src-all@freebsd.org Thu Apr 7 14:14:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0C08B07AB8; Thu, 7 Apr 2016 14:14:17 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (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 7473E1390; Thu, 7 Apr 2016 14:14:17 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1aoA3G-0001Ws-6Y; Thu, 07 Apr 2016 16:32:50 +0300 Date: Thu, 7 Apr 2016 16:32:50 +0300 From: Slawa Olhovchenkov To: Edward Tomasz Napierala Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297633 - in head: sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/fs/ext2fs sys/kern sys/sys sys/ufs/ffs sys/ufs/ufs sys/vm usr.bin/rctl Message-ID: <20160407133250.GA5298@zxy.spb.ru> References: <201604070423.u374NP0Z021115@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201604070423.u374NP0Z021115@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 14:14:17 -0000 On Thu, Apr 07, 2016 at 04:23:25AM +0000, Edward Tomasz Napierala wrote: > Author: trasz > Date: Thu Apr 7 04:23:25 2016 > New Revision: 297633 > URL: https://svnweb.freebsd.org/changeset/base/297633 > > Log: > Add four new RCTL resources - readbps, readiops, writebps and writeiops, > for limiting disk (actually filesystem) IO. > > Note that in some cases these limits are not quite precise. It's ok, > as long as it's within some reasonable bounds. > > Testing - and review of the code, in particular the VFS and VM parts - is > very welcome. How you calculate iops for sequential IOs? As distinc IOPS or merged? I.e. readin 1 sector from offset 100 and immediately reading 1 sectro from offset 101 accounting as 2IOPS or as 1IOPS? > MFC after: 1 month From owner-svn-src-all@freebsd.org Thu Apr 7 14:25:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46DA7B07D7C; Thu, 7 Apr 2016 14:25:16 +0000 (UTC) (envelope-from mp@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 mx1.freebsd.org (Postfix) with ESMTPS id 18C191935; Thu, 7 Apr 2016 14:25:16 +0000 (UTC) (envelope-from mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37EPFe9003457; Thu, 7 Apr 2016 14:25:15 GMT (envelope-from mp@FreeBSD.org) Received: (from mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37EPFKp003456; Thu, 7 Apr 2016 14:25:15 GMT (envelope-from mp@FreeBSD.org) Message-Id: <201604071425.u37EPFKp003456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mp set sender to mp@FreeBSD.org using -f From: Mark Peek Date: Thu, 7 Apr 2016 14:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297673 - head/bin/csh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 14:25:16 -0000 Author: mp Date: Thu Apr 7 14:25:15 2016 New Revision: 297673 URL: https://svnweb.freebsd.org/changeset/base/297673 Log: Revert r296416 by removing SAVESIGVEC and switching to fork instead. This fixes usage with system libraries which maintain their own signal state. PR: 208132 Obtained from: kib MFC after: 3 days Modified: head/bin/csh/config_p.h Modified: head/bin/csh/config_p.h ============================================================================== --- head/bin/csh/config_p.h Thu Apr 7 12:54:44 2016 (r297672) +++ head/bin/csh/config_p.h Thu Apr 7 14:25:15 2016 (r297673) @@ -34,7 +34,8 @@ * Note that some machines eg. rs6000 have a vfork, but not * with the berkeley semantics, so we cannot use it there either. */ -#define VFORK +/* #define VFORK */ +#define vfork fork /* * BSDJOBS You have BSD-style job control (both process groups and @@ -80,7 +81,6 @@ /****************** local defines *********************/ #if defined(__FreeBSD__) -#define SAVESIGVEC #define NLS_BUGS #define BSD_STYLE_COLORLS /* Use LC_MESSAGES locale category to open the message catalog */ From owner-svn-src-all@freebsd.org Thu Apr 7 15:00:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14963B069D8; Thu, 7 Apr 2016 15:00:27 +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 mx1.freebsd.org (Postfix) with ESMTPS id C67671EC2; Thu, 7 Apr 2016 15:00:26 +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 u37F0Pue013322; Thu, 7 Apr 2016 15:00:25 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37F0PhS013318; Thu, 7 Apr 2016 15:00:25 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201604071500.u37F0PhS013318@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus Date: Thu, 7 Apr 2016 15:00:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297674 - in head/sys: arm/arm arm/broadcom/bcm2835 kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 15:00:27 -0000 Author: skra Date: Thu Apr 7 15:00:25 2016 New Revision: 297674 URL: https://svnweb.freebsd.org/changeset/base/297674 Log: Implement intr_isrc_init_on_cpu() and use it to replace very same code implemented in every interrupt controller driver running SMP. This function returns true, if provided ISRC should be enabled on given cpu. Modified: head/sys/arm/arm/gic.c head/sys/arm/broadcom/bcm2835/bcm2836.c head/sys/kern/subr_intr.c head/sys/sys/intr.h Modified: head/sys/arm/arm/gic.c ============================================================================== --- head/sys/arm/arm/gic.c Thu Apr 7 14:25:15 2016 (r297673) +++ head/sys/arm/arm/gic.c Thu Apr 7 15:00:25 2016 (r297674) @@ -256,11 +256,11 @@ static void arm_gic_init_secondary(device_t dev) { struct arm_gic_softc *sc = device_get_softc(dev); - struct intr_irqsrc *isrc; - u_int irq; + u_int irq, cpu; /* Set the mask so we can find this CPU to send it IPIs */ - arm_gic_map[PCPU_GET(cpuid)] = gic_cpu_mask(sc); + cpu = PCPU_GET(cpuid); + arm_gic_map[cpu] = gic_cpu_mask(sc); for (irq = 0; irq < sc->nirqs; irq += 4) gic_d_write_4(sc, GICD_IPRIORITYR(irq >> 2), 0); @@ -280,27 +280,14 @@ arm_gic_init_secondary(device_t dev) gic_d_write_4(sc, GICD_CTLR, 0x01); /* Unmask attached SGI interrupts. */ - for (irq = GIC_FIRST_SGI; irq <= GIC_LAST_SGI; irq++) { - isrc = GIC_INTR_ISRC(sc, irq); - if (isrc != NULL && isrc->isrc_handlers != 0) { - CPU_SET(PCPU_GET(cpuid), &isrc->isrc_cpu); + for (irq = GIC_FIRST_SGI; irq <= GIC_LAST_SGI; irq++) + if (intr_isrc_init_on_cpu(GIC_INTR_ISRC(sc, irq), cpu)) gic_irq_unmask(sc, irq); - } - } /* Unmask attached PPI interrupts. */ - for (irq = GIC_FIRST_PPI; irq <= GIC_LAST_PPI; irq++) { - isrc = GIC_INTR_ISRC(sc, irq); - if (isrc == NULL || isrc->isrc_handlers == 0) - continue; - if (isrc->isrc_flags & INTR_ISRCF_BOUND) { - if (CPU_ISSET(PCPU_GET(cpuid), &isrc->isrc_cpu)) - gic_irq_unmask(sc, irq); - } else { - CPU_SET(PCPU_GET(cpuid), &isrc->isrc_cpu); + for (irq = GIC_FIRST_PPI; irq <= GIC_LAST_PPI; irq++) + if (intr_isrc_init_on_cpu(GIC_INTR_ISRC(sc, irq), cpu)) gic_irq_unmask(sc, irq); - } - } } #else static void Modified: head/sys/arm/broadcom/bcm2835/bcm2836.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2836.c Thu Apr 7 14:25:15 2016 (r297673) +++ head/sys/arm/broadcom/bcm2835/bcm2836.c Thu Apr 7 15:00:25 2016 (r297674) @@ -525,40 +525,21 @@ bcm_lintc_setup_intr(device_t dev, struc } #ifdef SMP -static bool -bcm_lint_init_on_ap(struct bcm_lintc_softc *sc, struct bcm_lintc_irqsrc *bli, - u_int cpu) -{ - struct intr_irqsrc *isrc; - - isrc = &bli->bli_isrc; - - KASSERT(isrc->isrc_flags & INTR_ISRCF_PPI, - ("%s: irq %d is not PPI", __func__, bli->bli_irq)); - - if (isrc->isrc_handlers == 0) - return (false); - if (isrc->isrc_flags & INTR_ISRCF_BOUND) - return (CPU_ISSET(cpu, &isrc->isrc_cpu)); - - CPU_SET(cpu, &isrc->isrc_cpu); - return (true); -} - static void bcm_lintc_init_rwreg_on_ap(struct bcm_lintc_softc *sc, u_int cpu, u_int irq, uint32_t reg, uint32_t mask) { - if (bcm_lint_init_on_ap(sc, &sc->bls_isrcs[irq], cpu)) + if (intr_isrc_init_on_cpu(&sc->bls_isrcs[irq].bli_isrc, cpu)) bcm_lintc_rwreg_set(sc, reg, mask); } static void bcm_lintc_init_pmu_on_ap(struct bcm_lintc_softc *sc, u_int cpu) { + struct intr_irqsrc *isrc = &sc->bls_isrcs[BCM_LINTC_PMU_IRQ].bli_isrc; - if (bcm_lint_init_on_ap(sc, &sc->bls_isrcs[BCM_LINTC_PMU_IRQ], cpu)) { + if (intr_isrc_init_on_cpu(isrc, cpu)) { /* Write-set register. */ bcm_lintc_write_4(sc, BCM_LINTC_PMU_ROUTING_SET_REG, BCM_LINTC_PIRR_IRQ_EN_CORE(cpu)); Modified: head/sys/kern/subr_intr.c ============================================================================== --- head/sys/kern/subr_intr.c Thu Apr 7 14:25:15 2016 (r297673) +++ head/sys/kern/subr_intr.c Thu Apr 7 15:00:25 2016 (r297674) @@ -467,6 +467,32 @@ intr_isrc_deregister(struct intr_irqsrc return (error); } +#ifdef SMP +/* + * A support function for a PIC to decide if provided ISRC should be inited + * on given cpu. The logic of INTR_ISRCF_BOUND flag and isrc_cpu member of + * struct intr_irqsrc is the following: + * + * If INTR_ISRCF_BOUND is set, the ISRC should be inited only on cpus + * set in isrc_cpu. If not, the ISRC should be inited on every cpu and + * isrc_cpu is kept consistent with it. Thus isrc_cpu is always correct. + */ +bool +intr_isrc_init_on_cpu(struct intr_irqsrc *isrc, u_int cpu) +{ + + if (isrc->isrc_handlers == 0) + return (false); + if ((isrc->isrc_flags & (INTR_ISRCF_PPI | INTR_ISRCF_IPI)) == 0) + return (false); + if (isrc->isrc_flags & INTR_ISRCF_BOUND) + return (CPU_ISSET(cpu, &isrc->isrc_cpu)); + + CPU_SET(cpu, &isrc->isrc_cpu); + return (true); +} +#endif + static struct intr_dev_data * intr_ddata_alloc(u_int extsize) { Modified: head/sys/sys/intr.h ============================================================================== --- head/sys/sys/intr.h Thu Apr 7 14:25:15 2016 (r297673) +++ head/sys/sys/intr.h Thu Apr 7 15:00:25 2016 (r297674) @@ -98,6 +98,10 @@ int intr_isrc_deregister(struct intr_irq int intr_isrc_register(struct intr_irqsrc *, device_t, u_int, const char *, ...) __printflike(4, 5); +#ifdef SMP +bool intr_isrc_init_on_cpu(struct intr_irqsrc *isrc, u_int cpu); +#endif + int intr_isrc_dispatch(struct intr_irqsrc *, struct trapframe *); u_int intr_irq_next_cpu(u_int current_cpu, cpuset_t *cpumask); From owner-svn-src-all@freebsd.org Thu Apr 7 15:11:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D0B1B06E91; Thu, 7 Apr 2016 15:11:25 +0000 (UTC) (envelope-from sgalabov@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 mx1.freebsd.org (Postfix) with ESMTPS id 4D2D71546; Thu, 7 Apr 2016 15:11:25 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37FBOLp016958; Thu, 7 Apr 2016 15:11:24 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37FBOhs016956; Thu, 7 Apr 2016 15:11:24 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201604071511.u37FBOhs016956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Thu, 7 Apr 2016 15:11:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297675 - head/sys/mips/mediatek X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 15:11:25 -0000 Author: sgalabov Date: Thu Apr 7 15:11:24 2016 New Revision: 297675 URL: https://svnweb.freebsd.org/changeset/base/297675 Log: Initial import of Ralink/Mediatek MIPS SoC support #7 GPIO controller drivers import. As with other Ralink/Mediatek work, there are 2 versions of the GPIO controller driver, depending on the type of SoC. This revision introduces initial support for these. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5877 Added: head/sys/mips/mediatek/mtk_gpio_v1.c (contents, props changed) head/sys/mips/mediatek/mtk_gpio_v2.c (contents, props changed) Added: head/sys/mips/mediatek/mtk_gpio_v1.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_gpio_v1.c Thu Apr 7 15:11:24 2016 (r297675) @@ -0,0 +1,646 @@ +/*- + * Copyright 2016 Stanislav Galabov + * 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 "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include +#include +#include + +#include + +#include "gpio_if.h" +#include "pic_if.h" + +#define MTK_GPIO_PINS 32 + +struct mtk_gpio_pin_irqsrc { + struct intr_irqsrc isrc; + u_int irq; +}; + +struct mtk_gpio_pin { + uint32_t pin_caps; + uint32_t pin_flags; + enum intr_trigger intr_trigger; + enum intr_polarity intr_polarity; + char pin_name[GPIOMAXNAME]; + struct mtk_gpio_pin_irqsrc pin_irqsrc; +}; + +struct mtk_gpio_softc { + device_t dev; + device_t busdev; + struct resource *res[2]; + struct mtx mtx; + struct mtk_gpio_pin pins[MTK_GPIO_PINS]; + void *intrhand; + + uint32_t num_pins; + uint8_t do_remap; +}; + +#define PIC_INTR_ISRC(sc, irq) (&(sc)->pins[(irq)].pin_irqsrc.isrc) + +static struct resource_spec mtk_gpio_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE | RF_SHAREABLE }, + { -1, 0 } +}; + +static int mtk_gpio_probe(device_t dev); +static int mtk_gpio_attach(device_t dev); +static int mtk_gpio_detach(device_t dev); +static int mtk_gpio_intr(void *arg); + +#define MTK_GPIO_LOCK(sc) mtx_lock_spin(&(sc)->mtx) +#define MTK_GPIO_UNLOCK(sc) mtx_unlock_spin(&(sc)->mtx) +#define MTK_GPIO_LOCK_INIT(sc) \ + mtx_init(&(sc)->mtx, device_get_nameunit((sc)->dev), \ + "mtk_gpio", MTX_SPIN) +#define MTK_GPIO_LOCK_DESTROY(sc) mtx_destroy(&(sc)->mtx) + +#define MTK_WRITE_4(sc, reg, val) bus_write_4((sc)->res[0], (reg), (val)) +#define MTK_READ_4(sc, reg) bus_read_4((sc)->res[0], (reg)) + +/* Register definitions */ +#define GPIO_PIOINT(_sc) 0x0000 +#define GPIO_PIOEDGE(_sc) 0x0004 +#define GPIO_PIORENA(_sc) 0x0008 +#define GPIO_PIOFENA(_sc) 0x000C +#define GPIO_PIODATA(_sc) ((_sc)->do_remap ? 0x0020 : 0x0010) +#define GPIO_PIODIR(_sc) ((_sc)->do_remap ? 0x0024 : 0x0014) +#define GPIO_PIOPOL(_sc) ((_sc)->do_remap ? 0x0028 : 0x0018) +#define GPIO_PIOSET(_sc) ((_sc)->do_remap ? 0x002C : 0x001C) +#define GPIO_PIORESET(_sc) ((_sc)->do_remap ? 0x0030 : 0x0020) +#define GPIO_PIOTOG(_sc) ((_sc)->do_remap ? 0x0034 : 0x0024) + +static struct ofw_compat_data compat_data[] = { + { "ralink,rt2880-gpio", 1 }, + { "ralink,rt3050-gpio", 1 }, + { "ralink,rt3352-gpio", 1 }, + { "ralink,rt3883-gpio", 1 }, + { "ralink,rt5350-gpio", 1 }, + { "ralink,mt7620a-gpio", 1 }, + { NULL, 0 } +}; + +static int +mtk_gpio_probe(device_t dev) +{ + phandle_t node; + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + node = ofw_bus_get_node(dev); + if (!OF_hasprop(node, "gpio-controller")) + return (ENXIO); + + device_set_desc(dev, "MTK GPIO Controller (v1)"); + + return (BUS_PROBE_DEFAULT); +} + +static int +mtk_pic_register_isrcs(struct mtk_gpio_softc *sc) +{ + int error; + uint32_t irq; + struct intr_irqsrc *isrc; + const char *name; + + name = device_get_nameunit(sc->dev); + for (irq = 0; irq < sc->num_pins; irq++) { + sc->pins[irq].pin_irqsrc.irq = irq; + isrc = PIC_INTR_ISRC(sc, irq); + error = intr_isrc_register(isrc, sc->dev, 0, "%s", name); + if (error != 0) { + /* XXX call intr_isrc_deregister */ + device_printf(sc->dev, "%s failed", __func__); + return (error); + } + } + + return (0); +} + +static int +mtk_gpio_pin_set_direction(struct mtk_gpio_softc *sc, uint32_t pin, + uint32_t dir) +{ + uint32_t regval, mask = (1u << pin); + + if (!(sc->pins[pin].pin_caps & dir)) + return (EINVAL); + + regval = MTK_READ_4(sc, GPIO_PIODIR(sc)); + if (dir == GPIO_PIN_INPUT) + regval &= ~mask; + else + regval |= mask; + MTK_WRITE_4(sc, GPIO_PIODIR(sc), regval); + + sc->pins[pin].pin_flags &= ~(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT); + sc->pins[pin].pin_flags |= dir; + + return (0); +} + +static int +mtk_gpio_pin_set_invert(struct mtk_gpio_softc *sc, uint32_t pin, uint32_t val) +{ + uint32_t regval, mask = (1u << pin); + + regval = MTK_READ_4(sc, GPIO_PIOPOL(sc)); + if (val) + regval |= mask; + else + regval &= ~mask; + MTK_WRITE_4(sc, GPIO_PIOPOL(sc), regval); + sc->pins[pin].pin_flags &= ~(GPIO_PIN_INVIN | GPIO_PIN_INVOUT); + sc->pins[pin].pin_flags |= val; + + return (0); +} + +static void +mtk_gpio_pin_probe(struct mtk_gpio_softc *sc, uint32_t pin) +{ + uint32_t mask = (1u << pin); + uint32_t val; + + /* Clear cached gpio config */ + sc->pins[pin].pin_flags = 0; + + val = MTK_READ_4(sc, GPIO_PIORENA(sc)) | + MTK_READ_4(sc, GPIO_PIOFENA(sc)); + if (val & mask) { + /* Pin is in interrupt mode */ + sc->pins[pin].intr_trigger = INTR_TRIGGER_EDGE; + val = MTK_READ_4(sc, GPIO_PIORENA(sc)); + if (val & mask) + sc->pins[pin].intr_polarity = INTR_POLARITY_HIGH; + else + sc->pins[pin].intr_polarity = INTR_POLARITY_LOW; + } + + val = MTK_READ_4(sc, GPIO_PIODIR(sc)); + if (val & mask) + sc->pins[pin].pin_flags |= GPIO_PIN_OUTPUT; + else + sc->pins[pin].pin_flags |= GPIO_PIN_INPUT; + + val = MTK_READ_4(sc, GPIO_PIOPOL(sc)); + if (val & mask) { + if (sc->pins[pin].pin_flags & GPIO_PIN_INPUT) { + sc->pins[pin].pin_flags |= GPIO_PIN_INVIN; + } else { + sc->pins[pin].pin_flags |= GPIO_PIN_INVOUT; + } + } +} + +static int +mtk_gpio_attach(device_t dev) +{ + struct mtk_gpio_softc *sc; + phandle_t node; + uint32_t i, num_pins; + + sc = device_get_softc(dev); + sc->dev = dev; + + if (bus_alloc_resources(dev, mtk_gpio_spec, sc->res)) { + device_printf(dev, "could not allocate resources for device\n"); + return (ENXIO); + } + + MTK_GPIO_LOCK_INIT(sc); + + node = ofw_bus_get_node(dev); + + if (OF_hasprop(node, "clocks")) + mtk_soc_start_clock(dev); + if (OF_hasprop(node, "resets")) + mtk_soc_reset_device(dev); + + if (OF_hasprop(node, "mtk,register-gap")) { + device_printf(dev, "\n"); + sc->do_remap = 1; + } else { + device_printf(dev, "\n"); + sc->do_remap = 0; + } + + if (OF_hasprop(node, "mtk,num-pins") && (OF_getencprop(node, + "mtk,num-pins", &num_pins, sizeof(num_pins)) >= 0)) + sc->num_pins = num_pins; + else + sc->num_pins = MTK_GPIO_PINS; + + for (i = 0; i < num_pins; i++) { + sc->pins[i].pin_caps |= GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | + GPIO_PIN_INVIN | GPIO_PIN_INVOUT; + sc->pins[i].intr_polarity = INTR_POLARITY_HIGH; + sc->pins[i].intr_trigger = INTR_TRIGGER_EDGE; + + snprintf(sc->pins[i].pin_name, GPIOMAXNAME - 1, "gpio%c%d", + device_get_unit(dev) + 'a', i); + sc->pins[i].pin_name[GPIOMAXNAME - 1] = '\0'; + + mtk_gpio_pin_probe(sc, i); + } + + if (mtk_pic_register_isrcs(sc) != 0) { + device_printf(dev, "could not register PIC ISRCs\n"); + goto fail; + } + + if (intr_pic_register(dev, OF_xref_from_node(node)) != 0) { + device_printf(dev, "could not register PIC\n"); + goto fail; + } + + if (bus_setup_intr(dev, sc->res[1], INTR_TYPE_MISC | INTR_MPSAFE, + mtk_gpio_intr, NULL, sc, &sc->intrhand) != 0) + goto fail_pic; + + sc->busdev = gpiobus_attach_bus(dev); + if (sc->busdev == NULL) + goto fail_pic; + + return (0); +fail_pic: + intr_pic_deregister(dev, OF_xref_from_node(node)); +fail: + if(sc->intrhand != NULL) + bus_teardown_intr(dev, sc->res[1], sc->intrhand); + bus_release_resources(dev, mtk_gpio_spec, sc->res); + MTK_GPIO_LOCK_DESTROY(sc); + return (ENXIO); +} + +static int +mtk_gpio_detach(device_t dev) +{ + struct mtk_gpio_softc *sc = device_get_softc(dev); + phandle_t node; + + node = ofw_bus_get_node(dev); + intr_pic_deregister(dev, OF_xref_from_node(node)); + if (sc->intrhand != NULL) + bus_teardown_intr(dev, sc->res[1], sc->intrhand); + bus_release_resources(dev, mtk_gpio_spec, sc->res); + MTK_GPIO_LOCK_DESTROY(sc); + return (0); +} + +static device_t +mtk_gpio_get_bus(device_t dev) +{ + struct mtk_gpio_softc *sc = device_get_softc(dev); + + return (sc->busdev); +} + +static int +mtk_gpio_pin_max(device_t dev, int *maxpin) +{ + struct mtk_gpio_softc *sc = device_get_softc(dev); + + *maxpin = sc->num_pins - 1; + + return (0); +} + +static int +mtk_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) +{ + struct mtk_gpio_softc *sc = device_get_softc(dev); + + if (pin >= sc->num_pins) + return (EINVAL); + + MTK_GPIO_LOCK(sc); + *caps = sc->pins[pin].pin_caps; + MTK_GPIO_UNLOCK(sc); + + return (0); +} + +static int +mtk_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags) +{ + struct mtk_gpio_softc *sc = device_get_softc(dev); + + if (pin >= sc->num_pins) + return (EINVAL); + + MTK_GPIO_LOCK(sc); + *flags = sc->pins[pin].pin_flags; + MTK_GPIO_UNLOCK(sc); + + return (0); +} + +static int +mtk_gpio_pin_getname(device_t dev, uint32_t pin, char *name) +{ + struct mtk_gpio_softc *sc = device_get_softc(dev); + + if (pin >= sc->num_pins) + return (EINVAL); + + strncpy(name, sc->pins[pin].pin_name, GPIOMAXNAME - 1); + name[GPIOMAXNAME - 1] = '\0'; + + return (0); +} + +static int +mtk_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) +{ + struct mtk_gpio_softc *sc; + int retval; + + sc = device_get_softc(dev); + + if (pin >= sc->num_pins) + return (EINVAL); + + MTK_GPIO_LOCK(sc); + retval = mtk_gpio_pin_set_direction(sc, pin, + flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)); + if (retval == 0) + retval = mtk_gpio_pin_set_invert(sc, pin, + flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)); + MTK_GPIO_UNLOCK(sc); + + return (retval); +} + +static int +mtk_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) +{ + struct mtk_gpio_softc *sc = device_get_softc(dev); + + if (pin >= sc->num_pins || !(sc->pins[pin].pin_flags & GPIO_PIN_OUTPUT)) + return (EINVAL); + + MTK_GPIO_LOCK(sc); + if (value) + MTK_WRITE_4(sc, GPIO_PIOSET(sc), (1u << pin)); + else + MTK_WRITE_4(sc, GPIO_PIORESET(sc), (1u << pin)); + MTK_GPIO_UNLOCK(sc); + + return (0); +} + +static int +mtk_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val) +{ + struct mtk_gpio_softc *sc; + uint32_t data; + + sc = device_get_softc(dev); + + if (pin >= sc->num_pins || !(sc->pins[pin].pin_flags & GPIO_PIN_INPUT)) + return (EINVAL); + + MTK_GPIO_LOCK(sc); + data = MTK_READ_4(sc, GPIO_PIODATA(sc)); + MTK_GPIO_UNLOCK(sc); + *val = (data & (1u << pin)) ? 1 : 0; + + return (0); +} + +static int +mtk_gpio_pin_toggle(device_t dev, uint32_t pin) +{ + struct mtk_gpio_softc *sc = device_get_softc(dev); + + if (pin >= sc->num_pins || !(sc->pins[pin].pin_flags & GPIO_PIN_OUTPUT)) + return (EINVAL); + + MTK_GPIO_LOCK(sc); + MTK_WRITE_4(sc, GPIO_PIOTOG(sc), (1u << pin)); + MTK_GPIO_UNLOCK(sc); + + return (0); +} + +static int +mtk_gpio_pic_map_intr(device_t dev, struct intr_map_data *data, + struct intr_irqsrc **isrcp) +{ + struct mtk_gpio_softc *sc; + + sc = device_get_softc(dev); + + if (data == NULL || data->type != INTR_MAP_DATA_FDT || + data->fdt.ncells != 1 || data->fdt.cells[0] >= sc->num_pins) + return (EINVAL); + + *isrcp = PIC_INTR_ISRC(sc, data->fdt.cells[0]); + return (0); +} + +static void +mtk_gpio_pic_enable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct mtk_gpio_softc *sc; + struct mtk_gpio_pin_irqsrc *pisrc; + uint32_t pin, mask, val; + + sc = device_get_softc(dev); + + pisrc = (struct mtk_gpio_pin_irqsrc *)isrc; + pin = pisrc->irq; + mask = 1u << pin; + + MTK_GPIO_LOCK(sc); + + if (sc->pins[pin].intr_polarity == INTR_POLARITY_LOW) { + val = MTK_READ_4(sc, GPIO_PIORENA(sc)) & ~mask; + MTK_WRITE_4(sc, GPIO_PIORENA(sc), val); + val = MTK_READ_4(sc, GPIO_PIOFENA(sc)) | mask; + MTK_WRITE_4(sc, GPIO_PIOFENA(sc), val); + } else { + val = MTK_READ_4(sc, GPIO_PIOFENA(sc)) & ~mask; + MTK_WRITE_4(sc, GPIO_PIOFENA(sc), val); + val = MTK_READ_4(sc, GPIO_PIORENA(sc)) | mask; + MTK_WRITE_4(sc, GPIO_PIORENA(sc), val); + } + + MTK_GPIO_UNLOCK(sc); +} + +static void +mtk_gpio_pic_disable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct mtk_gpio_softc *sc; + struct mtk_gpio_pin_irqsrc *pisrc; + uint32_t pin, mask, val; + + sc = device_get_softc(dev); + + pisrc = (struct mtk_gpio_pin_irqsrc *)isrc; + pin = pisrc->irq; + mask = 1u << pin; + + MTK_GPIO_LOCK(sc); + + val = MTK_READ_4(sc, GPIO_PIORENA(sc)) & ~mask; + MTK_WRITE_4(sc, GPIO_PIORENA(sc), val); + val = MTK_READ_4(sc, GPIO_PIOFENA(sc)) & ~mask; + MTK_WRITE_4(sc, GPIO_PIOFENA(sc), val); + + MTK_GPIO_UNLOCK(sc); +} + +static void +mtk_gpio_pic_pre_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + + mtk_gpio_pic_disable_intr(dev, isrc); +} + +static void +mtk_gpio_pic_post_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + + mtk_gpio_pic_enable_intr(dev, isrc); +} + +static void +mtk_gpio_pic_post_filter(device_t dev, struct intr_irqsrc *isrc) +{ + struct mtk_gpio_softc *sc; + struct mtk_gpio_pin_irqsrc *pisrc; + + pisrc = (struct mtk_gpio_pin_irqsrc *)isrc; + sc = device_get_softc(dev); + MTK_WRITE_4(sc, GPIO_PIOINT(sc), 1u << pisrc->irq); +} + +static int +mtk_gpio_intr(void *arg) +{ + struct mtk_gpio_softc *sc; + uint32_t i, interrupts; + + sc = arg; + interrupts = MTK_READ_4(sc, GPIO_PIOINT(sc)); + + for (i = 0; interrupts != 0; i++, interrupts >>= 1) { + if ((interrupts & 0x1) == 0) + continue; + if (intr_isrc_dispatch(PIC_INTR_ISRC(sc, i), + curthread->td_intr_frame) != 0) { + device_printf(sc->dev, "spurious interrupt %d\n", i); + } + } + + return (FILTER_HANDLED); +} + +static phandle_t +mtk_gpio_get_node(device_t bus, device_t dev) +{ + + /* We only have one child, the GPIO bus, which needs our own node. */ + return (ofw_bus_get_node(bus)); +} + +static device_method_t mtk_gpio_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, mtk_gpio_probe), + DEVMETHOD(device_attach, mtk_gpio_attach), + DEVMETHOD(device_detach, mtk_gpio_detach), + + /* GPIO protocol */ + DEVMETHOD(gpio_get_bus, mtk_gpio_get_bus), + DEVMETHOD(gpio_pin_max, mtk_gpio_pin_max), + DEVMETHOD(gpio_pin_getname, mtk_gpio_pin_getname), + DEVMETHOD(gpio_pin_getflags, mtk_gpio_pin_getflags), + DEVMETHOD(gpio_pin_getcaps, mtk_gpio_pin_getcaps), + DEVMETHOD(gpio_pin_setflags, mtk_gpio_pin_setflags), + DEVMETHOD(gpio_pin_get, mtk_gpio_pin_get), + DEVMETHOD(gpio_pin_set, mtk_gpio_pin_set), + DEVMETHOD(gpio_pin_toggle, mtk_gpio_pin_toggle), + + /* Interrupt controller interface */ + DEVMETHOD(pic_disable_intr, mtk_gpio_pic_disable_intr), + DEVMETHOD(pic_enable_intr, mtk_gpio_pic_enable_intr), + DEVMETHOD(pic_map_intr, mtk_gpio_pic_map_intr), + DEVMETHOD(pic_post_filter, mtk_gpio_pic_post_filter), + DEVMETHOD(pic_post_ithread, mtk_gpio_pic_post_ithread), + DEVMETHOD(pic_pre_ithread, mtk_gpio_pic_pre_ithread), + + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_node, mtk_gpio_get_node), + + DEVMETHOD_END +}; + +static driver_t mtk_gpio_driver = { + "gpio", + mtk_gpio_methods, + sizeof(struct mtk_gpio_softc), +}; + +static devclass_t mtk_gpio_devclass; + +EARLY_DRIVER_MODULE(mtk_gpio_v1, simplebus, mtk_gpio_driver, + mtk_gpio_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); Added: head/sys/mips/mediatek/mtk_gpio_v2.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_gpio_v2.c Thu Apr 7 15:11:24 2016 (r297675) @@ -0,0 +1,646 @@ +/*- + * Copyright 2016 Stanislav Galabov + * 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 "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include +#include +#include + +#include + +#include "gpio_if.h" +#include "pic_if.h" + +#define MTK_GPIO_PINS 32 + +struct mtk_gpio_pin_irqsrc { + struct intr_irqsrc isrc; + u_int irq; +}; + +struct mtk_gpio_pin { + uint32_t pin_caps; + uint32_t pin_flags; + enum intr_trigger intr_trigger; + enum intr_polarity intr_polarity; + char pin_name[GPIOMAXNAME]; + struct mtk_gpio_pin_irqsrc pin_irqsrc; +}; + +struct mtk_gpio_softc { + device_t dev; + device_t busdev; + struct resource *res[2]; + struct mtx mtx; + struct mtk_gpio_pin pins[MTK_GPIO_PINS]; + void *intrhand; + + uint32_t num_pins; + uint32_t bank_id; +}; + +#define PIC_INTR_ISRC(sc, irq) (&(sc)->pins[(irq)].pin_irqsrc.isrc) + +static struct resource_spec mtk_gpio_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE | RF_SHAREABLE }, + { SYS_RES_IRQ, 0, RF_ACTIVE | RF_SHAREABLE }, + { -1, 0 } +}; + +static int mtk_gpio_probe(device_t dev); +static int mtk_gpio_attach(device_t dev); +static int mtk_gpio_detach(device_t dev); +static int mtk_gpio_intr(void *arg); + +#define MTK_GPIO_LOCK(sc) mtx_lock_spin(&(sc)->mtx) +#define MTK_GPIO_UNLOCK(sc) mtx_unlock_spin(&(sc)->mtx) +#define MTK_GPIO_LOCK_INIT(sc) \ + mtx_init(&(sc)->mtx, device_get_nameunit((sc)->dev), \ + "mtk_gpio", MTX_SPIN) +#define MTK_GPIO_LOCK_DESTROY(sc) mtx_destroy(&(sc)->mtx) + +#define MTK_WRITE_4(sc, reg, val) bus_write_4((sc)->res[0], (reg), (val)) +#define MTK_READ_4(sc, reg) bus_read_4((sc)->res[0], (reg)) + +/* Register definitions */ +#define GPIO_REG(_sc, _reg) ((_reg) + (_sc)->bank_id * 0x4) +#define GPIO_PIOINT(_sc) GPIO_REG((_sc), 0x0090) +#define GPIO_PIOEDGE(_sc) GPIO_REG((_sc), 0x00A0) +#define GPIO_PIORENA(_sc) GPIO_REG((_sc), 0x0050) +#define GPIO_PIOFENA(_sc) GPIO_REG((_sc), 0x0060) +#define GPIO_PIODATA(_sc) GPIO_REG((_sc), 0x0020) +#define GPIO_PIODIR(_sc) GPIO_REG((_sc), 0x0000) +#define GPIO_PIOPOL(_sc) GPIO_REG((_sc), 0x0010) +#define GPIO_PIOSET(_sc) GPIO_REG((_sc), 0x0030) +#define GPIO_PIORESET(_sc) GPIO_REG((_sc), 0x0040) + +static struct ofw_compat_data compat_data[] = { + { "mtk,mt7621-gpio", 1 }, + { "mtk,mt7628-gpio", 1 }, + { NULL, 0 } +}; + +static int +mtk_gpio_probe(device_t dev) +{ + phandle_t node; + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + node = ofw_bus_get_node(dev); + if (!OF_hasprop(node, "gpio-controller")) + return (ENXIO); + + device_set_desc(dev, "MTK GPIO Controller (v2)"); + + return (BUS_PROBE_DEFAULT); +} + +static int +mtk_pic_register_isrcs(struct mtk_gpio_softc *sc) +{ + int error; + uint32_t irq; + struct intr_irqsrc *isrc; + const char *name; + + name = device_get_nameunit(sc->dev); + for (irq = 0; irq < sc->num_pins; irq++) { + sc->pins[irq].pin_irqsrc.irq = irq; + isrc = PIC_INTR_ISRC(sc, irq); + error = intr_isrc_register(isrc, sc->dev, 0, "%s", name); + if (error != 0) { + /* XXX call intr_isrc_deregister */ + device_printf(sc->dev, "%s failed", __func__); + return (error); + } + } + + return (0); +} + +static int +mtk_gpio_pin_set_direction(struct mtk_gpio_softc *sc, uint32_t pin, + uint32_t dir) +{ + uint32_t regval, mask = (1u << pin); + + if (!(sc->pins[pin].pin_caps & dir)) + return (EINVAL); + + regval = MTK_READ_4(sc, GPIO_PIODIR(sc)); + if (dir == GPIO_PIN_INPUT) + regval &= ~mask; + else + regval |= mask; + MTK_WRITE_4(sc, GPIO_PIODIR(sc), regval); + + sc->pins[pin].pin_flags &= ~(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT); + sc->pins[pin].pin_flags |= dir; + + return (0); +} + +static int +mtk_gpio_pin_set_invert(struct mtk_gpio_softc *sc, uint32_t pin, uint32_t val) +{ + uint32_t regval, mask = (1u << pin); + + regval = MTK_READ_4(sc, GPIO_PIOPOL(sc)); + if (val) + regval |= mask; + else + regval &= ~mask; + MTK_WRITE_4(sc, GPIO_PIOPOL(sc), regval); + sc->pins[pin].pin_flags &= ~(GPIO_PIN_INVIN | GPIO_PIN_INVOUT); + sc->pins[pin].pin_flags |= val; + + return (0); +} + +static void +mtk_gpio_pin_probe(struct mtk_gpio_softc *sc, uint32_t pin) +{ + uint32_t mask = (1u << pin); + uint32_t val; + + /* Clear cached gpio config */ + sc->pins[pin].pin_flags = 0; + + val = MTK_READ_4(sc, GPIO_PIORENA(sc)) | + MTK_READ_4(sc, GPIO_PIOFENA(sc)); + if (val & mask) { + /* Pin is in interrupt mode */ + sc->pins[pin].intr_trigger = INTR_TRIGGER_EDGE; + val = MTK_READ_4(sc, GPIO_PIORENA(sc)); + if (val & mask) + sc->pins[pin].intr_polarity = INTR_POLARITY_HIGH; + else + sc->pins[pin].intr_polarity = INTR_POLARITY_LOW; + } + + val = MTK_READ_4(sc, GPIO_PIODIR(sc)); + if (val & mask) + sc->pins[pin].pin_flags |= GPIO_PIN_OUTPUT; + else + sc->pins[pin].pin_flags |= GPIO_PIN_INPUT; + + val = MTK_READ_4(sc, GPIO_PIOPOL(sc)); + if (val & mask) { + if (sc->pins[pin].pin_flags & GPIO_PIN_INPUT) { + sc->pins[pin].pin_flags |= GPIO_PIN_INVIN; + } else { + sc->pins[pin].pin_flags |= GPIO_PIN_INVOUT; + } + } +} + +static int +mtk_gpio_attach(device_t dev) +{ + struct mtk_gpio_softc *sc; + phandle_t node; + uint32_t i, num_pins, bank_id; + + sc = device_get_softc(dev); + sc->dev = dev; + + if (bus_alloc_resources(dev, mtk_gpio_spec, sc->res)) { + device_printf(dev, "could not allocate resources for device\n"); + return (ENXIO); + } + + MTK_GPIO_LOCK_INIT(sc); + + node = ofw_bus_get_node(dev); + + if (OF_hasprop(node, "clocks")) + mtk_soc_start_clock(dev); + if (OF_hasprop(node, "resets")) + mtk_soc_reset_device(dev); + + if (OF_hasprop(node, "mtk,bank-id") && (OF_getencprop(node, + "mtk,bank-id", &bank_id, sizeof(bank_id)) >= 0)) + sc->bank_id = bank_id; + else + sc->bank_id = device_get_unit(dev); + + if (OF_hasprop(node, "mtk,num-pins") && (OF_getencprop(node, + "mtk,num-pins", &num_pins, sizeof(num_pins)) >= 0)) + sc->num_pins = num_pins; + else + sc->num_pins = MTK_GPIO_PINS; + + for (i = 0; i < num_pins; i++) { + sc->pins[i].pin_caps |= GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | + GPIO_PIN_INVIN | GPIO_PIN_INVOUT; + sc->pins[i].intr_polarity = INTR_POLARITY_HIGH; + sc->pins[i].intr_trigger = INTR_TRIGGER_EDGE; + + snprintf(sc->pins[i].pin_name, GPIOMAXNAME - 1, "gpio%c%d", + device_get_unit(dev) + 'a', i); + sc->pins[i].pin_name[GPIOMAXNAME - 1] = '\0'; + + mtk_gpio_pin_probe(sc, i); + } + + if (mtk_pic_register_isrcs(sc) != 0) { + device_printf(dev, "could not register PIC ISRCs\n"); + goto fail; + } + + if (intr_pic_register(dev, OF_xref_from_node(node)) != 0) { + device_printf(dev, "could not register PIC\n"); + goto fail; + } + + if (bus_setup_intr(dev, sc->res[1], INTR_TYPE_MISC | INTR_MPSAFE, + mtk_gpio_intr, NULL, sc, &sc->intrhand) != 0) + goto fail_pic; + + sc->busdev = gpiobus_attach_bus(dev); + if (sc->busdev == NULL) + goto fail_pic; + + return (0); +fail_pic: + intr_pic_deregister(dev, OF_xref_from_node(node)); +fail: + if(sc->intrhand != NULL) + bus_teardown_intr(dev, sc->res[1], sc->intrhand); + bus_release_resources(dev, mtk_gpio_spec, sc->res); + MTK_GPIO_LOCK_DESTROY(sc); + return (ENXIO); +} + +static int +mtk_gpio_detach(device_t dev) +{ + struct mtk_gpio_softc *sc = device_get_softc(dev); + phandle_t node; + + node = ofw_bus_get_node(dev); + intr_pic_deregister(dev, OF_xref_from_node(node)); + if (sc->intrhand != NULL) + bus_teardown_intr(dev, sc->res[1], sc->intrhand); + bus_release_resources(dev, mtk_gpio_spec, sc->res); + MTK_GPIO_LOCK_DESTROY(sc); + return (0); +} + +static device_t +mtk_gpio_get_bus(device_t dev) +{ + struct mtk_gpio_softc *sc = device_get_softc(dev); + + return (sc->busdev); +} + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Apr 7 15:16:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07090B06F82; Thu, 7 Apr 2016 15:16:35 +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 mx1.freebsd.org (Postfix) with ESMTPS id C89341846; Thu, 7 Apr 2016 15:16:34 +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 u37FGXWV019132; Thu, 7 Apr 2016 15:16:33 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37FGXRv019131; Thu, 7 Apr 2016 15:16:33 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201604071516.u37FGXRv019131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus Date: Thu, 7 Apr 2016 15:16:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297676 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 15:16:35 -0000 Author: skra Date: Thu Apr 7 15:16:33 2016 New Revision: 297676 URL: https://svnweb.freebsd.org/changeset/base/297676 Log: Fix intr_irq_shuffle(). After r297539, ISRCs doing IPI may be also registered into global interrupt table. Thus, they must be filtered out like per-cpu interrupts. Fortunately, it does not influence anything on interrupt controllers which already use INTRNG. Modified: head/sys/kern/subr_intr.c Modified: head/sys/kern/subr_intr.c ============================================================================== --- head/sys/kern/subr_intr.c Thu Apr 7 15:11:24 2016 (r297675) +++ head/sys/kern/subr_intr.c Thu Apr 7 15:16:33 2016 (r297676) @@ -1190,7 +1190,7 @@ intr_irq_shuffle(void *arg __unused) for (i = 0; i < NIRQ; i++) { isrc = irq_sources[i]; if (isrc == NULL || isrc->isrc_handlers == 0 || - isrc->isrc_flags & INTR_ISRCF_PPI) + isrc->isrc_flags & (INTR_ISRCF_PPI | INTR_ISRCF_IPI)) continue; if (isrc->isrc_event != NULL && From owner-svn-src-all@freebsd.org Thu Apr 7 15:26:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29A1EB07334; Thu, 7 Apr 2016 15:26:14 +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 mx1.freebsd.org (Postfix) with ESMTPS id EDDFE1ED1; Thu, 7 Apr 2016 15:26:13 +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 u37FQDNp022288; Thu, 7 Apr 2016 15:26:13 GMT (envelope-from skra@FreeBSD.org) Received: (from skra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37FQDck022287; Thu, 7 Apr 2016 15:26:13 GMT (envelope-from skra@FreeBSD.org) Message-Id: <201604071526.u37FQDck022287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: skra set sender to skra@FreeBSD.org using -f From: Svatopluk Kraus Date: Thu, 7 Apr 2016 15:26:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297677 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 15:26:14 -0000 Author: skra Date: Thu Apr 7 15:26:12 2016 New Revision: 297677 URL: https://svnweb.freebsd.org/changeset/base/297677 Log: Properly initialize isrc_cpu field of ISRC which is setup for an IPI. Modified: head/sys/arm/arm/gic.c Modified: head/sys/arm/arm/gic.c ============================================================================== --- head/sys/arm/arm/gic.c Thu Apr 7 15:16:33 2016 (r297676) +++ head/sys/arm/arm/gic.c Thu Apr 7 15:26:12 2016 (r297677) @@ -1003,13 +1003,18 @@ arm_gic_ipi_send(device_t dev, struct in static int arm_gic_ipi_setup(device_t dev, u_int ipi, struct intr_irqsrc **isrcp) { + struct intr_irqsrc *isrc; struct arm_gic_softc *sc = device_get_softc(dev); if (sgi_first_unused > GIC_LAST_SGI) return (ENOSPC); - *isrcp = GIC_INTR_ISRC(sc, sgi_first_unused); + isrc = GIC_INTR_ISRC(sc, sgi_first_unused); sgi_to_ipi[sgi_first_unused++] = ipi; + + CPU_SET(PCPU_GET(cpuid), &isrc->isrc_cpu); + + *isrcp = isrc; return (0); } #endif From owner-svn-src-all@freebsd.org Thu Apr 7 16:12:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 339BFB07278; Thu, 7 Apr 2016 16:12:40 +0000 (UTC) (envelope-from gahr@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 mx1.freebsd.org (Postfix) with ESMTPS id E8F0516E6; Thu, 7 Apr 2016 16:12:39 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37GCdl4037315; Thu, 7 Apr 2016 16:12:39 GMT (envelope-from gahr@FreeBSD.org) Received: (from gahr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37GCdn1037313; Thu, 7 Apr 2016 16:12:39 GMT (envelope-from gahr@FreeBSD.org) Message-Id: <201604071612.u37GCdn1037313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gahr set sender to gahr@FreeBSD.org using -f From: Pietro Cerutti Date: Thu, 7 Apr 2016 16:12:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297678 - head/usr.bin/uuencode X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 16:12:40 -0000 Author: gahr (ports committer) Date: Thu Apr 7 16:12:38 2016 New Revision: 297678 URL: https://svnweb.freebsd.org/changeset/base/297678 Log: Enhance uuencode with a -r option to produce raw output. This matches with uudecode's -r option to decode raw data without initial and final framing lines. $ echo Test | uuencode -mr - | uudecode -mr Test Approved by: cognet MFC after: 1 week Modified: head/usr.bin/uuencode/uuencode.1 head/usr.bin/uuencode/uuencode.c Modified: head/usr.bin/uuencode/uuencode.1 ============================================================================== --- head/usr.bin/uuencode/uuencode.1 Thu Apr 7 15:26:12 2016 (r297677) +++ head/usr.bin/uuencode/uuencode.1 Thu Apr 7 16:12:38 2016 (r297678) @@ -40,6 +40,7 @@ .Sh SYNOPSIS .Nm .Op Fl m +.Op Fl r .Op Fl o Ar output_file .Op Ar file .Ar name @@ -50,6 +51,7 @@ .Op Fl i .Fl o Ar output_file .Nm b64encode +.Op Fl r .Op Fl o Ar output_file .Op Ar file .Ar name @@ -123,6 +125,8 @@ The following options are available for Use the Base64 method of encoding, rather than the traditional .Nm algorithm. +.It Fl r +Produce raw output by excluding the initial and final framing lines. .It Fl o Ar output_file Output to .Ar output_file Modified: head/usr.bin/uuencode/uuencode.c ============================================================================== --- head/usr.bin/uuencode/uuencode.c Thu Apr 7 15:26:12 2016 (r297677) +++ head/usr.bin/uuencode/uuencode.c Thu Apr 7 16:12:38 2016 (r297678) @@ -66,6 +66,7 @@ static void usage(void); static FILE *output; static int mode; +static char raw = 0; static char **av; int @@ -82,7 +83,7 @@ main(int argc, char *argv[]) if (strcmp(basename(argv[0]), "b64encode") == 0) base64 = 1; - while ((ch = getopt(argc, argv, "mo:")) != -1) { + while ((ch = getopt(argc, argv, "mo:r")) != -1) { switch (ch) { case 'm': base64 = 1; @@ -90,6 +91,9 @@ main(int argc, char *argv[]) case 'o': outfile = optarg; break; + case 'r': + raw = 1; + break; case '?': default: usage(); @@ -152,7 +156,8 @@ base64_encode(void) sequence = 0; - fprintf(output, "begin-base64 %o %s\n", mode, *av); + if (!raw) + fprintf(output, "begin-base64 %o %s\n", mode, *av); while ((n = fread(buf, 1, sizeof(buf), stdin))) { ++sequence; rv = b64_ntop(buf, n, buf2, (sizeof(buf2) / sizeof(buf2[0]))); @@ -162,7 +167,8 @@ base64_encode(void) } if (sequence % GROUPS) fprintf(output, "\n"); - fprintf(output, "====\n"); + if (!raw) + fprintf(output, "====\n"); } /* @@ -175,7 +181,8 @@ encode(void) register char *p; char buf[80]; - (void)fprintf(output, "begin %o %s\n", mode, *av); + if (!raw) + (void)fprintf(output, "begin %o %s\n", mode, *av); while ((n = fread(buf, 1, 45, stdin))) { ch = ENC(n); if (fputc(ch, output) == EOF) @@ -209,7 +216,8 @@ encode(void) } if (ferror(stdin)) errx(1, "read error"); - (void)fprintf(output, "%c\nend\n", ENC('\0')); + if (!raw) + (void)fprintf(output, "%c\nend\n", ENC('\0')); } static void From owner-svn-src-all@freebsd.org Thu Apr 7 17:15:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 459B6B0855E; Thu, 7 Apr 2016 17:15:18 +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 mx1.freebsd.org (Postfix) with ESMTPS id 06F941602; Thu, 7 Apr 2016 17:15:17 +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 u37HFHfU055315; Thu, 7 Apr 2016 17:15:17 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37HFGXu055312; Thu, 7 Apr 2016 17:15:16 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201604071715.u37HFGXu055312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 7 Apr 2016 17:15:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297679 - in head/sys/dev: acpica xen/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 17:15:18 -0000 Author: jhb Date: Thu Apr 7 17:15:16 2016 New Revision: 297679 URL: https://svnweb.freebsd.org/changeset/base/297679 Log: Associate device_t objects with ACPI handles via PCI_CHILD_ADDED(). Previously, the ACPI PCI bus driver did a single pass over the devices in the namespace that were a child of a given PCI bus to associate the PCI bus-enumerated device_t devices with the corresponding ACPI handles. However, this meant that handles were only established at runtime for devices found during the initial PCI bus scan. PCI_IOV adds devices that show up after the initial PCI bus scan, and coming changes to add a bus rescan can also add devices after the initial scan. This change adds a pci_child_added() callback to the ACPI PCI bus that walks the namespace to find the ACPI handle for each device that is added. Using a callback means that the handle is correctly set for any device no matter how it is added (initial scan, IOV, or a bus rescan). Added: head/sys/dev/acpica/acpi_pcivar.h (contents, props changed) Modified: head/sys/dev/acpica/acpi_pci.c head/sys/dev/xen/pci/xen_acpi_pci.c Modified: head/sys/dev/acpica/acpi_pci.c ============================================================================== --- head/sys/dev/acpica/acpi_pci.c Thu Apr 7 16:12:38 2016 (r297678) +++ head/sys/dev/acpica/acpi_pci.c Thu Apr 7 17:15:16 2016 (r297679) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -104,6 +105,7 @@ static device_method_t acpi_pci_methods[ DEVMETHOD(bus_get_domain, acpi_get_domain), /* PCI interface */ + DEVMETHOD(pci_child_added, acpi_pci_child_added), DEVMETHOD(pci_set_powerstate, acpi_pci_set_powerstate_method), #ifdef PCI_IOV DEVMETHOD(pci_create_iov_child, acpi_pci_create_iov_child), @@ -271,31 +273,35 @@ acpi_pci_save_handle(ACPI_HANDLE handle, void **status) { struct acpi_pci_devinfo *dinfo; - device_t *devlist; - int devcount, i, func, slot; + device_t child; + int func, slot; UINT32 address; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + child = context; if (ACPI_FAILURE(acpi_GetInteger(handle, "_ADR", &address))) return_ACPI_STATUS (AE_OK); slot = ACPI_ADR_PCI_SLOT(address); func = ACPI_ADR_PCI_FUNC(address); - if (device_get_children((device_t)context, &devlist, &devcount) != 0) - return_ACPI_STATUS (AE_OK); - for (i = 0; i < devcount; i++) { - dinfo = device_get_ivars(devlist[i]); - if (dinfo->ap_dinfo.cfg.func == func && - dinfo->ap_dinfo.cfg.slot == slot) { - dinfo->ap_handle = handle; - acpi_pci_update_device(handle, devlist[i]); - break; - } + dinfo = device_get_ivars(child); + if (dinfo->ap_dinfo.cfg.func == func && + dinfo->ap_dinfo.cfg.slot == slot) { + dinfo->ap_handle = handle; + acpi_pci_update_device(handle, child); + return_ACPI_STATUS (AE_CTRL_TERMINATE); } - free(devlist, M_TEMP); return_ACPI_STATUS (AE_OK); } +void +acpi_pci_child_added(device_t dev, device_t child) +{ + + AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1, + acpi_pci_save_handle, NULL, child, NULL); +} + static int acpi_pci_probe(device_t dev) { @@ -325,18 +331,18 @@ acpi_pci_attach(device_t dev) busno = pcib_get_bus(dev); /* - * First, PCI devices are added as in the normal PCI bus driver. - * Afterwards, the ACPI namespace under the bridge driver is - * walked to save ACPI handles to all the devices that appear in - * the ACPI namespace as immediate descendants of the bridge. + * PCI devices are added via the bus scan in the normal PCI + * bus driver. As each device is added, the + * acpi_pci_child_added() callback walks the ACPI namespace + * under the bridge driver to save ACPI handles to all the + * devices that appear in the ACPI namespace as immediate + * descendants of the bridge. * * XXX: Sometimes PCI devices show up in the ACPI namespace that * pci_add_children() doesn't find. We currently just ignore * these devices. */ pci_add_children(dev, domain, busno, sizeof(struct acpi_pci_devinfo)); - AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1, - acpi_pci_save_handle, NULL, dev, NULL); return (bus_generic_attach(dev)); } @@ -371,17 +377,9 @@ static device_t acpi_pci_create_iov_child(device_t bus, device_t pf, uint16_t rid, uint16_t vid, uint16_t did) { - struct acpi_pci_devinfo *dinfo; - device_t vf; - vf = pci_add_iov_child(bus, pf, sizeof(struct acpi_pci_devinfo), rid, - vid, did); - if (vf == NULL) - return (NULL); - - dinfo = device_get_ivars(vf); - dinfo->ap_handle = NULL; - return (vf); + return (pci_add_iov_child(bus, pf, sizeof(struct acpi_pci_devinfo), rid, + vid, did)); } #endif Added: head/sys/dev/acpica/acpi_pcivar.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/acpica/acpi_pcivar.h Thu Apr 7 17:15:16 2016 (r297679) @@ -0,0 +1,38 @@ +/*- + * Copyright (c) 2016 John Baldwin + * 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. + * + * $FreeBSD$ + */ + +#ifndef _ACPI_PCIVAR_H_ +#define _ACPI_PCIVAR_H_ + +#ifdef _KERNEL + +void acpi_pci_child_added(device_t dev, device_t child); + +#endif + +#endif /* !_ACPI_PCIVAR_H_ */ Modified: head/sys/dev/xen/pci/xen_acpi_pci.c ============================================================================== --- head/sys/dev/xen/pci/xen_acpi_pci.c Thu Apr 7 16:12:38 2016 (r297678) +++ head/sys/dev/xen/pci/xen_acpi_pci.c Thu Apr 7 17:15:16 2016 (r297679) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -65,6 +66,14 @@ xen_acpi_pci_probe(device_t dev) return (BUS_PROBE_SPECIFIC); } +static void +xen_acpi_pci_child_added(device_t dev, device_t child) +{ + + acpi_pci_child_added(dev, child); + xen_pci_child_added_method(dev, child); +} + static device_method_t xen_acpi_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, xen_acpi_pci_probe), @@ -72,7 +81,7 @@ static device_method_t xen_acpi_pci_meth /* PCI interface overwrites */ DEVMETHOD(pci_enable_msi, xen_pci_enable_msi_method), DEVMETHOD(pci_disable_msi, xen_pci_disable_msi_method), - DEVMETHOD(pci_child_added, xen_pci_child_added_method), + DEVMETHOD(pci_child_added, xen_acpi_pci_child_added), DEVMETHOD_END }; From owner-svn-src-all@freebsd.org Thu Apr 7 17:45:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1622DB08F9B; Thu, 7 Apr 2016 17:45:03 +0000 (UTC) (envelope-from ian@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 mx1.freebsd.org (Postfix) with ESMTPS id E6EC0194A; Thu, 7 Apr 2016 17:45:02 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37Hj2tw064657; Thu, 7 Apr 2016 17:45:02 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37Hj2YJ064656; Thu, 7 Apr 2016 17:45:02 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201604071745.u37Hj2YJ064656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 7 Apr 2016 17:45:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297680 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 17:45:03 -0000 Author: ian Date: Thu Apr 7 17:45:01 2016 New Revision: 297680 URL: https://svnweb.freebsd.org/changeset/base/297680 Log: Comestic changes; when INTRNG support was added, some functions became oddly separated from related functionality. This just moves some blocks of code around so that setup_intr and teardown_intr are near each other again, and likewise for enable/disable_intr. No functional changes. Modified: head/sys/arm/freescale/imx/imx_gpio.c Modified: head/sys/arm/freescale/imx/imx_gpio.c ============================================================================== --- head/sys/arm/freescale/imx/imx_gpio.c Thu Apr 7 17:15:16 2016 (r297679) +++ head/sys/arm/freescale/imx/imx_gpio.c Thu Apr 7 17:45:01 2016 (r297680) @@ -157,45 +157,6 @@ static int imx51_gpio_pin_toggle(device_ #ifdef ARM_INTRNG static int -gpio_pic_teardown_intr(device_t dev, struct intr_irqsrc *isrc, - struct resource *res, struct intr_map_data *data) -{ - struct imx51_gpio_softc *sc; - struct gpio_irqsrc *gi; - - sc = device_get_softc(dev); - if (isrc->isrc_handlers == 0) { - gi = (struct gpio_irqsrc *)isrc; - gi->gi_pol = INTR_POLARITY_CONFORM; - gi->gi_trig = INTR_TRIGGER_CONFORM; - - // XXX Not sure this is necessary - mtx_lock_spin(&sc->sc_mtx); - CLEAR4(sc, IMX_GPIO_IMR_REG, (1U << gi->gi_irq)); - WRITE4(sc, IMX_GPIO_ISR_REG, (1U << gi->gi_irq)); - mtx_unlock_spin(&sc->sc_mtx); - } - return (0); -} - -/* - * this is mask_intr - */ -static void -gpio_pic_disable_intr(device_t dev, struct intr_irqsrc *isrc) -{ - struct imx51_gpio_softc *sc; - u_int irq; - - sc = device_get_softc(dev); - irq = ((struct gpio_irqsrc *)isrc)->gi_irq; - - mtx_lock_spin(&sc->sc_mtx); - CLEAR4(sc, IMX_GPIO_IMR_REG, (1U << irq)); - mtx_unlock_spin(&sc->sc_mtx); -} - -static int gpio_pic_map_fdt(device_t dev, u_int ncells, pcell_t *cells, u_int *irqp, enum intr_polarity *polp, enum intr_trigger *trigp) { @@ -279,6 +240,28 @@ gpio_pic_map_intr(device_t dev, struct i } static int +gpio_pic_teardown_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ + struct imx51_gpio_softc *sc; + struct gpio_irqsrc *gi; + + sc = device_get_softc(dev); + if (isrc->isrc_handlers == 0) { + gi = (struct gpio_irqsrc *)isrc; + gi->gi_pol = INTR_POLARITY_CONFORM; + gi->gi_trig = INTR_TRIGGER_CONFORM; + + // XXX Not sure this is necessary + mtx_lock_spin(&sc->sc_mtx); + CLEAR4(sc, IMX_GPIO_IMR_REG, (1U << gi->gi_irq)); + WRITE4(sc, IMX_GPIO_ISR_REG, (1U << gi->gi_irq)); + mtx_unlock_spin(&sc->sc_mtx); + } + return (0); +} + +static int gpio_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc, struct resource *res, struct intr_map_data *data) { @@ -345,6 +328,23 @@ gpio_pic_setup_intr(device_t dev, struct } /* + * this is mask_intr + */ +static void +gpio_pic_disable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct imx51_gpio_softc *sc; + u_int irq; + + sc = device_get_softc(dev); + irq = ((struct gpio_irqsrc *)isrc)->gi_irq; + + mtx_lock_spin(&sc->sc_mtx); + CLEAR4(sc, IMX_GPIO_IMR_REG, (1U << irq)); + mtx_unlock_spin(&sc->sc_mtx); +} + +/* * this is unmask_intr */ static void @@ -417,7 +417,7 @@ gpio_pic_filter(void *arg) } /* - * register our isrcs into intrng to make it known about them. + * Initialize our isrcs and register them with intrng. */ static int gpio_pic_register_isrcs(struct imx51_gpio_softc *sc) From owner-svn-src-all@freebsd.org Thu Apr 7 18:03:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D342B06591; Thu, 7 Apr 2016 18:03:43 +0000 (UTC) (envelope-from sbruno@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 mx1.freebsd.org (Postfix) with ESMTPS id 4C5D2137F; Thu, 7 Apr 2016 18:03:43 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37I3gsk070701; Thu, 7 Apr 2016 18:03:42 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37I3gXv070699; Thu, 7 Apr 2016 18:03:42 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201604071803.u37I3gXv070699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 7 Apr 2016 18:03:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297681 - in stable/10/sys/cam: ata scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 18:03:43 -0000 Author: sbruno Date: Thu Apr 7 18:03:42 2016 New Revision: 297681 URL: https://svnweb.freebsd.org/changeset/base/297681 Log: MFC r297237 Add 4k enabled cam quirks for Samsung SM863 Series SSDs Modified: stable/10/sys/cam/ata/ata_da.c stable/10/sys/cam/scsi/scsi_da.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ata/ata_da.c ============================================================================== --- stable/10/sys/cam/ata/ata_da.c Thu Apr 7 17:45:01 2016 (r297680) +++ stable/10/sys/cam/ata/ata_da.c Thu Apr 7 18:03:42 2016 (r297681) @@ -485,6 +485,14 @@ static struct ada_quirk_entry ada_quirk_ }, { /* + * Samsung SM863 Series SSDs + * 4k optimised + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG MZ7KM*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* * SuperTalent TeraDrive CT SSDs * 4k optimised & trim only works in 4k requests + 4k aligned */ Modified: stable/10/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_da.c Thu Apr 7 17:45:01 2016 (r297680) +++ stable/10/sys/cam/scsi/scsi_da.c Thu Apr 7 18:03:42 2016 (r297681) @@ -1157,6 +1157,14 @@ static struct da_quirk_entry da_quirk_ta }, { /* + * Samsung SM863 Series SSDs + * 4k optimised + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG MZ7KM*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* * SuperTalent TeraDrive CT SSDs * 4k optimised & trim only works in 4k requests + 4k aligned */ From owner-svn-src-all@freebsd.org Thu Apr 7 18:19:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33577B06B85; Thu, 7 Apr 2016 18:19:11 +0000 (UTC) (envelope-from ian@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 mx1.freebsd.org (Postfix) with ESMTPS id DFD861CDB; Thu, 7 Apr 2016 18:19:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37IJARs074197; Thu, 7 Apr 2016 18:19:10 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37IJ96H074194; Thu, 7 Apr 2016 18:19:09 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201604071819.u37IJ96H074194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 7 Apr 2016 18:19:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297682 - in head/sys: arm/arm mips/mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 18:19:11 -0000 Author: ian Date: Thu Apr 7 18:19:09 2016 New Revision: 297682 URL: https://svnweb.freebsd.org/changeset/base/297682 Log: Fix a copyright glitch before it gets copy-pasted again. I think this must have started as collateral damage in a global search-replace, then it got copied around when I cloned a file to begin creating a new file. Modified: head/sys/arm/arm/locore.S head/sys/arm/arm/physmem.c head/sys/mips/mips/ofw_machdep.c Modified: head/sys/arm/arm/locore.S ============================================================================== --- head/sys/arm/arm/locore.S Thu Apr 7 18:03:42 2016 (r297681) +++ head/sys/arm/arm/locore.S Thu Apr 7 18:19:09 2016 (r297682) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Ian Lepore - * All rights excluded. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/arm/physmem.c ============================================================================== --- head/sys/arm/arm/physmem.c Thu Apr 7 18:03:42 2016 (r297681) +++ head/sys/arm/arm/physmem.c Thu Apr 7 18:19:09 2016 (r297682) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Ian Lepore - * All rights excluded. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/mips/mips/ofw_machdep.c ============================================================================== --- head/sys/mips/mips/ofw_machdep.c Thu Apr 7 18:03:42 2016 (r297681) +++ head/sys/mips/mips/ofw_machdep.c Thu Apr 7 18:19:09 2016 (r297682) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2015 Ian Lepore - * All rights excluded. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-svn-src-all@freebsd.org Thu Apr 7 19:13:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13166B08269; Thu, 7 Apr 2016 19:13:58 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D4CC51FCA; Thu, 7 Apr 2016 19:13:57 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [10.0.2.164] (94-224-12-229.access.telenet.be [94.224.12.229]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 2FCB17D10; Thu, 7 Apr 2016 21:13:55 +0200 (CEST) Subject: Re: svn commit: r296986 - head/sys/netinet6 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: text/plain; charset=utf-8 From: Kristof Provost X-Checked-By-Nsa: Probably In-Reply-To: <201603171110.u2HBAiFR075164@repo.freebsd.org> Date: Thu, 7 Apr 2016 21:13:55 +0200 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <87DA8A8F-3CD6-46A6-B4ED-BC31ADDADABC@FreeBSD.org> References: <201603171110.u2HBAiFR075164@repo.freebsd.org> To: "Andrey V. Elsukov" X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 19:13:58 -0000 > On 17 Mar 2016, at 12:10, Andrey V. Elsukov wrote: >=20 > Author: ae > Date: Thu Mar 17 11:10:44 2016 > New Revision: 296986 > URL: https://svnweb.freebsd.org/changeset/base/296986 >=20 > Log: > Reduce the number of local variables. Remove redundant check that inp > pointer isn't NULL, it is safe, because we are handling IPV6_PKTINFO > socket option in this block of code. Also, use in6ifa_withaddr() = instead > of ifa_withaddr(). ... > in6_selectsrc(uint32_t fibnum, struct so > * the interface must be specified; otherwise, = ifa_ifwithaddr() > * will fail matching the address. > */ > - bzero(&srcsock, sizeof(srcsock)); > - srcsock.sin6_family =3D AF_INET6; > - srcsock.sin6_len =3D sizeof(srcsock); > - srcsock.sin6_addr =3D pi->ipi6_addr; > + tmp =3D pi->ipi6_addr; > if (ifp) { > - error =3D in6_setscope(&srcsock.sin6_addr, ifp, = NULL); > + error =3D in6_setscope(&tmp, ifp, &odstzone); > if (error) > return (error); > } > if (cred !=3D NULL && (error =3D prison_local_ip6(cred, > - &srcsock.sin6_addr, (inp !=3D NULL && > - (inp->inp_flags & IN6P_IPV6_V6ONLY) !=3D 0))) !=3D = 0) > + &tmp, (inp->inp_flags & IN6P_IPV6_V6ONLY) !=3D 0)) = !=3D 0) > return (error); >=20 > /* > @@ -262,19 +255,18 @@ in6_selectsrc(uint32_t fibnum, struct so > * ancillary data. > */ > if ((inp->inp_flags & INP_BINDANY) =3D=3D 0) { > - ia6 =3D (struct in6_ifaddr *)ifa_ifwithaddr( > - (struct sockaddr *)&srcsock); > - if (ia6 =3D=3D NULL || (ia6->ia6_flags & = (IN6_IFF_ANYCAST | > + ia =3D in6ifa_ifwithaddr(&tmp, odstzone); I believe this breaks radvd. It tries to send out RAs with a link-local = source address. These fail with 'ERR#49 'Can't assign requested address=E2=80=99=E2=80=99.= Note that =E2=80=98tmp=E2=80=99 has had the zoneid embedded into it = already (in6_setscope() above), so the address comparison in = in6ifa_ifwithaddr() fails to match. That leads to the EADDRNOTAVAIL error. I don=E2=80=99t think this is the specific commit that broke things (at = least, I don=E2=80=99t see how it worked before), but I=E2=80=99m hoping you=E2=80=99ll have a better idea of what went = wrong. Regards, Kristof= From owner-svn-src-all@freebsd.org Thu Apr 7 19:17:48 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85B26B0834E; Thu, 7 Apr 2016 19:17:48 +0000 (UTC) (envelope-from ian@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 mx1.freebsd.org (Postfix) with ESMTPS id 5D2121179; Thu, 7 Apr 2016 19:17:48 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37JHlb2092611; Thu, 7 Apr 2016 19:17:47 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37JHlLV092610; Thu, 7 Apr 2016 19:17:47 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201604071917.u37JHlLV092610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 7 Apr 2016 19:17:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297683 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 19:17:48 -0000 Author: ian Date: Thu Apr 7 19:17:47 2016 New Revision: 297683 URL: https://svnweb.freebsd.org/changeset/base/297683 Log: Code cleanup: stop searching for a pin in the array and just use the pin number directly as an index. We create the array ourselves and nothing can change the order of items in it, it's a simple 1:1 mapping. Modified: head/sys/arm/freescale/imx/imx_gpio.c Modified: head/sys/arm/freescale/imx/imx_gpio.c ============================================================================== --- head/sys/arm/freescale/imx/imx_gpio.c Thu Apr 7 18:19:09 2016 (r297682) +++ head/sys/arm/freescale/imx/imx_gpio.c Thu Apr 7 19:17:47 2016 (r297683) @@ -497,19 +497,14 @@ static int imx51_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) { struct imx51_gpio_softc *sc; - int i; sc = device_get_softc(dev); - for (i = 0; i < sc->gpio_npins; i++) { - if (sc->gpio_pins[i].gp_pin == pin) - break; - } - if (i >= sc->gpio_npins) + if (pin >= sc->gpio_npins) return (EINVAL); mtx_lock_spin(&sc->sc_mtx); - *caps = sc->gpio_pins[i].gp_caps; + *caps = sc->gpio_pins[pin].gp_caps; mtx_unlock_spin(&sc->sc_mtx); return (0); @@ -519,19 +514,14 @@ static int imx51_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags) { struct imx51_gpio_softc *sc; - int i; sc = device_get_softc(dev); - for (i = 0; i < sc->gpio_npins; i++) { - if (sc->gpio_pins[i].gp_pin == pin) - break; - } - if (i >= sc->gpio_npins) + if (pin >= sc->gpio_npins) return (EINVAL); mtx_lock_spin(&sc->sc_mtx); - *flags = sc->gpio_pins[i].gp_flags; + *flags = sc->gpio_pins[pin].gp_flags; mtx_unlock_spin(&sc->sc_mtx); return (0); @@ -541,19 +531,13 @@ static int imx51_gpio_pin_getname(device_t dev, uint32_t pin, char *name) { struct imx51_gpio_softc *sc; - int i; sc = device_get_softc(dev); - for (i = 0; i < sc->gpio_npins; i++) { - if (sc->gpio_pins[i].gp_pin == pin) - break; - } - - if (i >= sc->gpio_npins) + if (pin >= sc->gpio_npins) return (EINVAL); mtx_lock_spin(&sc->sc_mtx); - memcpy(name, sc->gpio_pins[i].gp_name, GPIOMAXNAME); + memcpy(name, sc->gpio_pins[pin].gp_name, GPIOMAXNAME); mtx_unlock_spin(&sc->sc_mtx); return (0); @@ -563,18 +547,13 @@ static int imx51_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) { struct imx51_gpio_softc *sc; - int i; sc = device_get_softc(dev); - for (i = 0; i < sc->gpio_npins; i++) { - if (sc->gpio_pins[i].gp_pin == pin) - break; - } - if (i >= sc->gpio_npins) + if (pin >= sc->gpio_npins) return (EINVAL); - imx51_gpio_pin_configure(sc, &sc->gpio_pins[i], flags); + imx51_gpio_pin_configure(sc, &sc->gpio_pins[pin], flags); return (0); } @@ -583,22 +562,17 @@ static int imx51_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) { struct imx51_gpio_softc *sc; - int i; sc = device_get_softc(dev); - for (i = 0; i < sc->gpio_npins; i++) { - if (sc->gpio_pins[i].gp_pin == pin) - break; - } - if (i >= sc->gpio_npins) + if (pin >= sc->gpio_npins) return (EINVAL); mtx_lock_spin(&sc->sc_mtx); if (value) - SET4(sc, IMX_GPIO_DR_REG, (1U << i)); + SET4(sc, IMX_GPIO_DR_REG, (1U << pin)); else - CLEAR4(sc, IMX_GPIO_DR_REG, (1U << i)); + CLEAR4(sc, IMX_GPIO_DR_REG, (1U << pin)); mtx_unlock_spin(&sc->sc_mtx); return (0); @@ -608,19 +582,14 @@ static int imx51_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val) { struct imx51_gpio_softc *sc; - int i; sc = device_get_softc(dev); - for (i = 0; i < sc->gpio_npins; i++) { - if (sc->gpio_pins[i].gp_pin == pin) - break; - } - if (i >= sc->gpio_npins) + if (pin >= sc->gpio_npins) return (EINVAL); mtx_lock_spin(&sc->sc_mtx); - *val = (READ4(sc, IMX_GPIO_DR_REG) >> i) & 1; + *val = (READ4(sc, IMX_GPIO_DR_REG) >> pin) & 1; mtx_unlock_spin(&sc->sc_mtx); return (0); @@ -630,20 +599,15 @@ static int imx51_gpio_pin_toggle(device_t dev, uint32_t pin) { struct imx51_gpio_softc *sc; - int i; sc = device_get_softc(dev); - for (i = 0; i < sc->gpio_npins; i++) { - if (sc->gpio_pins[i].gp_pin == pin) - break; - } - if (i >= sc->gpio_npins) + if (pin >= sc->gpio_npins) return (EINVAL); mtx_lock_spin(&sc->sc_mtx); WRITE4(sc, IMX_GPIO_DR_REG, - (READ4(sc, IMX_GPIO_DR_REG) ^ (1U << i))); + (READ4(sc, IMX_GPIO_DR_REG) ^ (1U << pin))); mtx_unlock_spin(&sc->sc_mtx); return (0); From owner-svn-src-all@freebsd.org Thu Apr 7 19:51:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DA16B08C04; Thu, 7 Apr 2016 19:51:28 +0000 (UTC) (envelope-from ian@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 mx1.freebsd.org (Postfix) with ESMTPS id 28071106A; Thu, 7 Apr 2016 19:51:28 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37JpRgi004866; Thu, 7 Apr 2016 19:51:27 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37JpRhG004863; Thu, 7 Apr 2016 19:51:27 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201604071951.u37JpRhG004863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 7 Apr 2016 19:51:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297684 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 19:51:28 -0000 Author: ian Date: Thu Apr 7 19:51:27 2016 New Revision: 297684 URL: https://svnweb.freebsd.org/changeset/base/297684 Log: Remove unecessary locking, mostly from places where a read is done of a value that can't ever be in an inconsistant intermediate state even when some other thread is in the middle of writing the value/register. Locking of the hardware remains in the few places that do r-m-w operations. Locking of metadata access is restricted to places using memcpy or sprintf to modify the metadata. Modified: head/sys/arm/freescale/imx/imx_gpio.c Modified: head/sys/arm/freescale/imx/imx_gpio.c ============================================================================== --- head/sys/arm/freescale/imx/imx_gpio.c Thu Apr 7 19:17:47 2016 (r297683) +++ head/sys/arm/freescale/imx/imx_gpio.c Thu Apr 7 19:51:27 2016 (r297684) @@ -451,22 +451,27 @@ static void imx51_gpio_pin_configure(struct imx51_gpio_softc *sc, struct gpio_pin *pin, unsigned int flags) { + u_int newflags; mtx_lock_spin(&sc->sc_mtx); /* - * Manage input/output + * Manage input/output; other flags not supported yet. + * + * Note that changes to pin->gp_flags must be acccumulated in newflags + * and stored with a single writeback to gp_flags at the end, to enable + * unlocked reads of that value elsewhere. */ - if (flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) { - pin->gp_flags &= ~(GPIO_PIN_INPUT|GPIO_PIN_OUTPUT); + if (flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { + newflags = pin->gp_flags & ~(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT); if (flags & GPIO_PIN_OUTPUT) { - pin->gp_flags |= GPIO_PIN_OUTPUT; + newflags |= GPIO_PIN_OUTPUT; SET4(sc, IMX_GPIO_OE_REG, (1U << pin->gp_pin)); - } - else { - pin->gp_flags |= GPIO_PIN_INPUT; + } else { + newflags |= GPIO_PIN_INPUT; CLEAR4(sc, IMX_GPIO_OE_REG, (1U << pin->gp_pin)); } + pin->gp_flags = newflags; } mtx_unlock_spin(&sc->sc_mtx); @@ -503,9 +508,7 @@ imx51_gpio_pin_getcaps(device_t dev, uin if (pin >= sc->gpio_npins) return (EINVAL); - mtx_lock_spin(&sc->sc_mtx); *caps = sc->gpio_pins[pin].gp_caps; - mtx_unlock_spin(&sc->sc_mtx); return (0); } @@ -520,9 +523,7 @@ imx51_gpio_pin_getflags(device_t dev, ui if (pin >= sc->gpio_npins) return (EINVAL); - mtx_lock_spin(&sc->sc_mtx); *flags = sc->gpio_pins[pin].gp_flags; - mtx_unlock_spin(&sc->sc_mtx); return (0); } @@ -588,9 +589,7 @@ imx51_gpio_pin_get(device_t dev, uint32_ if (pin >= sc->gpio_npins) return (EINVAL); - mtx_lock_spin(&sc->sc_mtx); *val = (READ4(sc, IMX_GPIO_DR_REG) >> pin) & 1; - mtx_unlock_spin(&sc->sc_mtx); return (0); } From owner-svn-src-all@freebsd.org Thu Apr 7 20:12:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBBEAB061B6; Thu, 7 Apr 2016 20:12:46 +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 mx1.freebsd.org (Postfix) with ESMTPS id A75921CC0; Thu, 7 Apr 2016 20:12:46 +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 u37KCjbo011364; Thu, 7 Apr 2016 20:12:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37KCjCa011359; Thu, 7 Apr 2016 20:12:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201604072012.u37KCjCa011359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 7 Apr 2016 20:12:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297685 - in head/sys: conf dev/kbdmux modules/kbdmux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 20:12:46 -0000 Author: emaste Date: Thu Apr 7 20:12:45 2016 New Revision: 297685 URL: https://svnweb.freebsd.org/changeset/base/297685 Log: Add option to specify built-in keymap for kbdmux PR: 153459 Submitted by: swell.k@gmail.com Modified: head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/dev/kbdmux/kbdmux.c head/sys/modules/kbdmux/Makefile Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Thu Apr 7 19:51:27 2016 (r297684) +++ head/sys/conf/NOTES Thu Apr 7 20:12:45 2016 (r297685) @@ -1409,6 +1409,10 @@ options MSGBUF_SIZE=40960 options KBD_DISABLE_KEYMAP_LOAD # refuse to load a keymap options KBD_INSTALL_CDEV # install a CDEV entry in /dev +device kbdmux # keyboard multiplexer +options KBDMUX_DFLT_KEYMAP # specify the built-in keymap +makeoptions KBDMUX_DFLT_KEYMAP=it.iso + options FB_DEBUG # Frame buffer debugging device splash # Splash screen and screen saver support Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Apr 7 19:51:27 2016 (r297684) +++ head/sys/conf/files Thu Apr 7 20:12:45 2016 (r297685) @@ -47,6 +47,10 @@ pccarddevs.h standard \ compile-with "${AWK} -f $S/tools/pccarddevs2h.awk $S/dev/pccard/pccarddevs" \ no-obj no-implicit-rule before-depend \ clean "pccarddevs.h" +kbdmuxmap.h optional kbdmux_dflt_keymap \ + compile-with "kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${KBDMUX_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > kbdmuxmap.h" \ + no-obj no-implicit-rule before-depend \ + clean "kbdmuxmap.h" teken_state.h optional sc | vt \ dependency "$S/teken/gensequences $S/teken/sequences" \ compile-with "${AWK} -f $S/teken/gensequences $S/teken/sequences > teken_state.h" \ Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Thu Apr 7 19:51:27 2016 (r297684) +++ head/sys/conf/options Thu Apr 7 20:12:45 2016 (r297685) @@ -801,6 +801,8 @@ KBD_MAXWAIT opt_kbd.h KBD_RESETDELAY opt_kbd.h KBDIO_DEBUG opt_kbd.h +KBDMUX_DFLT_KEYMAP opt_kbdmux.h + # options for the Atheros driver ATH_DEBUG opt_ath.h ATH_TXBUF opt_ath.h Modified: head/sys/dev/kbdmux/kbdmux.c ============================================================================== --- head/sys/dev/kbdmux/kbdmux.c Thu Apr 7 19:51:27 2016 (r297684) +++ head/sys/dev/kbdmux/kbdmux.c Thu Apr 7 20:12:45 2016 (r297685) @@ -33,6 +33,7 @@ #include "opt_compat.h" #include "opt_kbd.h" +#include "opt_kbdmux.h" #include #include @@ -54,6 +55,13 @@ #include #include #include + +/* the initial key map, accent map and fkey strings */ +#ifdef KBDMUX_DFLT_KEYMAP +#define KBD_DFLT_KEYMAP +#include "kbdmuxmap.h" +#endif + #include #define KEYBOARD_NAME "kbdmux" Modified: head/sys/modules/kbdmux/Makefile ============================================================================== --- head/sys/modules/kbdmux/Makefile Thu Apr 7 19:51:27 2016 (r297684) +++ head/sys/modules/kbdmux/Makefile Thu Apr 7 20:12:45 2016 (r297685) @@ -4,7 +4,7 @@ .PATH: ${.CURDIR}/../../dev/kbdmux KMOD= kbdmux -SRCS= kbdmux.c opt_compat.h opt_kbd.h bus_if.h device_if.h +SRCS= kbdmux.c opt_compat.h opt_kbd.h opt_kbdmux.h bus_if.h device_if.h .if !defined(KERNBUILDDIR) opt_compat.h: From owner-svn-src-all@freebsd.org Thu Apr 7 20:22:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FFB8B06567; Thu, 7 Apr 2016 20:22:27 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-lb0-x232.google.com (mail-lb0-x232.google.com [IPv6:2a00:1450:4010:c04::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 E84341319; Thu, 7 Apr 2016 20:22:26 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-lb0-x232.google.com with SMTP id u8so57110318lbk.0; Thu, 07 Apr 2016 13:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=Hj6Gpr9kwjrTNkGcoNEQ28gvrNEPNsMU5R1p/SJppTM=; b=xeRnGIojS3jk8DzT7hGrTQdHne6FHSWAzqUDv8GJrR0w32mndwZgtzn8eRFxGsOqne C+Vobq6Ta+fatkaYJUhfV5NZ7vE7bHcESQjsD4L38g61C/1F916PM8htbxwdZuEIsD4V 2YYNr8Y67Nw1MFjxkIAyHxYXM19juTD4A3788bVEaeLq9kUyh7y0X3Tj80zen4RvtSD5 rtJEIzamYvyYLjqSlc2DMnA9ecDxEIt1R7k9v78bSohqteZCvk6kiCGCyMbuTWcIdT4g Mx1jbWOImDm4Kk3uICnN55myyCLg40ICrzavMvdjXPthB/o6ky+J04Ek1/x+0mtwUNgK Rq8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=Hj6Gpr9kwjrTNkGcoNEQ28gvrNEPNsMU5R1p/SJppTM=; b=dikw2Sykw4pn9gSwig0zWrMuC+s6dj+tGGdU9tNw8lesYX/d7X8hR4iv13IHwtj6Q1 eDe6P8NQl2Fu/N4wd2vdVjNQ4oynoVtO+Ptl0rK+nepN9XFY8T9Scd985L4FTL+RVgtP PEPqRensF6Km/IKBOKmczk63LBZMaE9HHpCtnGbzdsVi7G6hGyRKun4qogD67JrkDHWk OQgYXctYiKI62I1v38kegbomlZSrsRFz5lkksbFCs7Q6RXNOPFihBCjpSHfmLoQUM58I yrf76etkSyq60OD9fB4OjqVoa7xH4Z+FeWQqB9xm4dUmXbqCGWHe8ubEjX3GJG+CWwZP vsNA== X-Gm-Message-State: AD7BkJKohdDD97uSYwwKl9XHQw5bSO1sqHukMGX1fXW0lqoyw2M/U3qvOf4+fM2H2kEZvlyjuhq9uX4WMuBCgQ== MIME-Version: 1.0 X-Received: by 10.112.146.201 with SMTP id te9mr2130974lbb.9.1460060545051; Thu, 07 Apr 2016 13:22:25 -0700 (PDT) Received: by 10.112.236.33 with HTTP; Thu, 7 Apr 2016 13:22:24 -0700 (PDT) In-Reply-To: <201604072012.u37KCjCa011359@repo.freebsd.org> References: <201604072012.u37KCjCa011359@repo.freebsd.org> Date: Thu, 7 Apr 2016 13:22:24 -0700 Message-ID: Subject: Re: svn commit: r297685 - in head/sys: conf dev/kbdmux modules/kbdmux From: Ngie Cooper To: Ed Maste Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 20:22:27 -0000 On Thu, Apr 7, 2016 at 1:12 PM, Ed Maste wrote: > Author: emaste > Date: Thu Apr 7 20:12:45 2016 > New Revision: 297685 > URL: https://svnweb.freebsd.org/changeset/base/297685 > > Log: > Add option to specify built-in keymap for kbdmux > > PR: 153459 > Submitted by: swell.k@gmail.com This doesn't seem to work in the sys/modules/kbdmux case (kbdmuxmap.h isn't generated via sys/modules/kbdmux/Makefile) -- should it be generated there as well? Thanks! -Ngie From owner-svn-src-all@freebsd.org Thu Apr 7 20:26:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1858FB066CC; Thu, 7 Apr 2016 20:26:29 +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 mx1.freebsd.org (Postfix) with ESMTPS id DA19E16E3; Thu, 7 Apr 2016 20:26:28 +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 u37KQSaH015059; Thu, 7 Apr 2016 20:26:28 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37KQSM4015058; Thu, 7 Apr 2016 20:26:28 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201604072026.u37KQSM4015058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 7 Apr 2016 20:26:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297686 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 20:26:29 -0000 Author: emaste Date: Thu Apr 7 20:26:27 2016 New Revision: 297686 URL: https://svnweb.freebsd.org/changeset/base/297686 Log: Rename SHT_AMD64_UNWIND to SHT_X86_64_UNWIND per ABI doc From http://www.x86-64.org/documentation_folder/abi-0.99.pdf Modified: head/sys/sys/elf_common.h Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Thu Apr 7 20:12:45 2016 (r297685) +++ head/sys/sys/elf_common.h Thu Apr 7 20:26:27 2016 (r297686) @@ -415,7 +415,8 @@ typedef struct { #define SHT_HISUNW 0x6fffffff #define SHT_HIOS 0x6fffffff /* Last of OS specific semantics */ #define SHT_LOPROC 0x70000000 /* reserved range for processor */ -#define SHT_AMD64_UNWIND 0x70000001 /* unwind information */ +#define SHT_X86_64_UNWIND 0x70000001 /* unwind information */ +#define SHT_AMD64_UNWIND SHT_X86_64_UNWIND #define SHT_ARM_EXIDX 0x70000001 /* Exception index table. */ #define SHT_ARM_PREEMPTMAP 0x70000002 /* BPABI DLL dynamic linking From owner-svn-src-all@freebsd.org Thu Apr 7 20:30:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BD9BB068FD; Thu, 7 Apr 2016 20:30:47 +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 mx1.freebsd.org (Postfix) with ESMTPS id 2D9901A8D; Thu, 7 Apr 2016 20:30:47 +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 u37KUkfi015378; Thu, 7 Apr 2016 20:30:46 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37KUklA015377; Thu, 7 Apr 2016 20:30:46 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201604072030.u37KUklA015377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 7 Apr 2016 20:30:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297687 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 20:30:47 -0000 Author: emaste Date: Thu Apr 7 20:30:46 2016 New Revision: 297687 URL: https://svnweb.freebsd.org/changeset/base/297687 Log: newvers.sh: rationalize licence condition numbering Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Thu Apr 7 20:26:27 2016 (r297686) +++ head/sys/conf/newvers.sh Thu Apr 7 20:30:46 2016 (r297687) @@ -11,7 +11,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. -# 4. Neither the name of the University nor the names of its contributors +# 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. # From owner-svn-src-all@freebsd.org Thu Apr 7 20:38:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61D51B06D7E for ; Thu, 7 Apr 2016 20:38:01 +0000 (UTC) (envelope-from jbeich@vfemail.net) Received: from vfemail.net (onethreetwo.vfemail.net [199.16.11.132]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 20D7C102C for ; Thu, 7 Apr 2016 20:38:00 +0000 (UTC) (envelope-from jbeich@vfemail.net) Received: (qmail 39225 invoked by uid 89); 7 Apr 2016 20:37:59 -0000 Received: from localhost (HELO freequeue.vfemail.net) (127.0.0.1) by localhost with (DHE-RSA-AES256-SHA encrypted) SMTP; 7 Apr 2016 20:37:59 -0000 Received: (qmail 39210 invoked by uid 89); 7 Apr 2016 20:37:42 -0000 Received: by simscan 1.3.1 ppid: 39201, pid: 39205, t: 0.0042s scanners:none Received: from unknown (HELO smtp102-2.vfemail.net) (172.16.100.62) by FreeQueue with SMTP; 7 Apr 2016 20:37:42 -0000 Received: (qmail 16613 invoked by uid 89); 7 Apr 2016 20:37:42 -0000 Received: by simscan 1.4.0 ppid: 16601, pid: 16607, t: 0.5986s scanners:none Received: from unknown (HELO nil) (amJlaWNoQHZmZW1haWwubmV0@172.16.100.27) by mail.vfemail.net with ESMTPA; 7 Apr 2016 20:37:41 -0000 From: Jan Beich To: Ngie Cooper Cc: Ed Maste , "svn-src-head\@freebsd.org" , "svn-src-all\@freebsd.org" , "src-committers\@freebsd.org" Subject: Re: svn commit: r297685 - in head/sys: conf dev/kbdmux modules/kbdmux References: <201604072012.u37KCjCa011359@repo.freebsd.org> Date: Thu, 07 Apr 2016 22:37:33 +0200 In-Reply-To: (Ngie Cooper's message of "Thu, 7 Apr 2016 13:22:24 -0700") Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 20:38:01 -0000 --=-=-= Content-Type: text/plain Ngie Cooper writes: > On Thu, Apr 7, 2016 at 1:12 PM, Ed Maste wrote: > >> Author: emaste >> Date: Thu Apr 7 20:12:45 2016 >> New Revision: 297685 >> URL: https://svnweb.freebsd.org/changeset/base/297685 >> >> Log: >> Add option to specify built-in keymap for kbdmux >> >> PR: 153459 >> Submitted by: swell.k@gmail.com > > This doesn't seem to work in the sys/modules/kbdmux case (kbdmuxmap.h > isn't generated via sys/modules/kbdmux/Makefile) -- should it be > generated there as well? Probably not. KBDMUX_DFLT_KEYMAP can only be defined via kernel config(5). This is similar to sys/modules/usb/ukbd + opt_ukbd.h. So, build modules as part of |make buildkernel|. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQF8BAEBCgBmBQJXBsUNXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXREQjQ0MzY3NEM3RDIzNTc4NkUxNDkyQ0VF NEM3Nzg4MzQ3OURCRERCAAoJEOTHeINHnb3brbcH/RUlHJ/ELqppD4tvuSaxvwAE 5TyH6xiK1FIm7Xpq77tO6c4cyRJ2uD50DIBrSMTkxpH9bhR3YSpI4E3obFBRTptz IGEvPHWzz7M8kXgD7VMJo0SvaU096abnokwbpEMb+oXcWh5gOQz1fGZYO+Kmy0Tq 2VM5FrAtbj8FXl2WOdng/83dWUgXnIHNTGleHAg56P76sE71ckowdy8UO6smHy+l Pn5BLdY8JGHRCg3UJnR3W/UunQsX09IiJlxiIUdnnBuSKC8kag4H2RCMGL3Vkago GUNE0toq8AwR2u8nd8NcrbcXZURpxsvA8KeUSRjqRaGzoyuSPhQZxP0ZLz+VE74= =fa9P -----END PGP SIGNATURE----- --=-=-=-- From owner-svn-src-all@freebsd.org Thu Apr 7 21:33:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5854DB07F47; Thu, 7 Apr 2016 21:33:15 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id 2A2F81821; Thu, 7 Apr 2016 21:33:15 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37LXEw0035658; Thu, 7 Apr 2016 21:33:14 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37LXETl035657; Thu, 7 Apr 2016 21:33:14 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604072133.u37LXETl035657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 7 Apr 2016 21:33:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297688 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 21:33:15 -0000 Author: pfg Date: Thu Apr 7 21:33:14 2016 New Revision: 297688 URL: https://svnweb.freebsd.org/changeset/base/297688 Log: chdone(): Prevent returning uninitialized scalar value. Improve over the solution in r297527: Instead of attempting to initialize all the possible cases, just move the check nearer to the case where it makes sense. CID: 1006486 Reviewed by: ken MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_ch.c Modified: head/sys/cam/scsi/scsi_ch.c ============================================================================== --- head/sys/cam/scsi/scsi_ch.c Thu Apr 7 20:30:46 2016 (r297687) +++ head/sys/cam/scsi/scsi_ch.c Thu Apr 7 21:33:14 2016 (r297688) @@ -648,10 +648,14 @@ chdone(struct cam_periph *periph, union softc->sc_counts[CHET_IE], PLURAL(softc->sc_counts[CHET_IE])); #undef PLURAL + if (announce_buf[0] != '\0') { + xpt_announce_periph(periph, announce_buf); + xpt_announce_quirks(periph, softc->quirks, + CH_Q_BIT_STRING); + } } else { int error; - announce_buf[0] = '\0'; error = cherror(done_ccb, CAM_RETRY_SELTO, SF_RETRY_UA | SF_NO_PRINT); /* @@ -715,14 +719,8 @@ chdone(struct cam_periph *periph, union cam_periph_invalidate(periph); - announce_buf[0] = '\0'; } } - if (announce_buf[0] != '\0') { - xpt_announce_periph(periph, announce_buf); - xpt_announce_quirks(periph, softc->quirks, - CH_Q_BIT_STRING); - } softc->state = CH_STATE_NORMAL; free(mode_header, M_SCSICH); /* From owner-svn-src-all@freebsd.org Fri Apr 8 00:01:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97B14B08A73; Fri, 8 Apr 2016 00:01:20 +0000 (UTC) (envelope-from jmcneill@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 mx1.freebsd.org (Postfix) with ESMTPS id 6A0B31A8E; Fri, 8 Apr 2016 00:01:20 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3801Jdr079112; Fri, 8 Apr 2016 00:01:19 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3801JtX079111; Fri, 8 Apr 2016 00:01:19 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201604080001.u3801JtX079111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Fri, 8 Apr 2016 00:01:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297689 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 00:01:20 -0000 Author: jmcneill Date: Fri Apr 8 00:01:19 2016 New Revision: 297689 URL: https://svnweb.freebsd.org/changeset/base/297689 Log: Match on compatible string "allwinner,sun4i-a10-sram-controller" instead of "allwinner,sun4i-sramc", to match upstream DTS. Modified: head/sys/arm/allwinner/a10_sramc.c Modified: head/sys/arm/allwinner/a10_sramc.c ============================================================================== --- head/sys/arm/allwinner/a10_sramc.c Thu Apr 7 21:33:14 2016 (r297688) +++ head/sys/arm/allwinner/a10_sramc.c Fri Apr 8 00:01:19 2016 (r297689) @@ -71,7 +71,7 @@ static int a10_sramc_probe(device_t dev) { - if (ofw_bus_is_compatible(dev, "allwinner,sun4i-sramc")) { + if (ofw_bus_is_compatible(dev, "allwinner,sun4i-a10-sram-controller")) { device_set_desc(dev, "Allwinner sramc module"); return (BUS_PROBE_DEFAULT); } From owner-svn-src-all@freebsd.org Fri Apr 8 00:24:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3A7DB07362; Fri, 8 Apr 2016 00:24:22 +0000 (UTC) (envelope-from sobomax@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 mx1.freebsd.org (Postfix) with ESMTPS id 81363165E; Fri, 8 Apr 2016 00:24:22 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u380OL5o087517; Fri, 8 Apr 2016 00:24:21 GMT (envelope-from sobomax@FreeBSD.org) Received: (from sobomax@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u380OL4Q087516; Fri, 8 Apr 2016 00:24:21 GMT (envelope-from sobomax@FreeBSD.org) Message-Id: <201604080024.u380OL4Q087516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sobomax set sender to sobomax@FreeBSD.org using -f From: Maxim Sobolev Date: Fri, 8 Apr 2016 00:24:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297690 - head/sys/boot/forth X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 00:24:22 -0000 Author: sobomax Date: Fri Apr 8 00:24:21 2016 New Revision: 297690 URL: https://svnweb.freebsd.org/changeset/base/297690 Log: Document vfs.root.mountfrom. Reviewed by: imp, wblock Differential Revision: https://reviews.freebsd.org/D5332 Modified: head/sys/boot/forth/loader.conf.5 Modified: head/sys/boot/forth/loader.conf.5 ============================================================================== --- head/sys/boot/forth/loader.conf.5 Fri Apr 8 00:01:19 2016 (r297689) +++ head/sys/boot/forth/loader.conf.5 Fri Apr 8 00:24:21 2016 (r297690) @@ -112,6 +112,31 @@ The name must be a subdirectory of that contains a kernel. .It Ar kernel_options Flags to be passed to the kernel. +.It Ar vfs.root.mountfrom +Specify the root partition to mount. +For example: +.Pp +.Dl vfs.root.mountfrom="ufs:/dev/da0s1a" +.Pp +.Xr loader 8 +automatically calculates the value of this tunable from +.Pa /etc/fstab +from the partition the kernel was loaded from. +The calculated value might be calculated incorrectly when +.Pa /etc/fstab +is not available during +.Xr loader 8 +startup (as during diskless booting from NFS), or if a different +device is desired by the user. +The preferred value can be set in +.Pa /loader.conf . +.Pp +The value can also be overridden from the +.Xr loader 8 +command line. +This is useful for system recovery when +.Pa /etc/fstab +is damaged, lost, or read from the wrong partition. .It Ar password Protect boot menu with a password without interrupting .Ic autoboot From owner-svn-src-all@freebsd.org Fri Apr 8 01:25:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED353B082AB; Fri, 8 Apr 2016 01:25:26 +0000 (UTC) (envelope-from allanjude@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 mx1.freebsd.org (Postfix) with ESMTPS id AFAB51EA4; Fri, 8 Apr 2016 01:25:26 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u381PPnP005930; Fri, 8 Apr 2016 01:25:25 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u381PPsx005925; Fri, 8 Apr 2016 01:25:25 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201604080125.u381PPsx005925@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Fri, 8 Apr 2016 01:25:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297691 - in head: sbin/geom/class/eli sys/geom/eli X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 01:25:27 -0000 Author: allanjude Date: Fri Apr 8 01:25:25 2016 New Revision: 297691 URL: https://svnweb.freebsd.org/changeset/base/297691 Log: Create the GELIBOOT GEOM_ELI flag This flag indicates that the user wishes to use the GELIBOOT feature to boot from a fully encrypted root file system. Currently, GELIBOOT does not support key files, and in the future when it does, they will be loaded differently. Due to the design of GELI, and the desire for secrecy, the GELI metadata does not know if key files are used or not, it just adds the key material (if any) to the HMAC before the optional passphrase, so there is no way to tell if a GELI partition requires key files or not. Since the GELIBOOT code in boot2 and the loader does not support keys, they will now only attempt to attach if this flag is set. This will stop GELIBOOT from prompting for passwords to GELIs that it cannot decrypt, disrupting the boot process PR: 208251 Reviewed by: ed, oshogbo, wblock Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D5867 Modified: head/sbin/geom/class/eli/geli.8 head/sbin/geom/class/eli/geom_eli.c head/sys/geom/eli/g_eli.c head/sys/geom/eli/g_eli.h head/sys/geom/eli/g_eli_ctl.c Modified: head/sbin/geom/class/eli/geli.8 ============================================================================== --- head/sbin/geom/class/eli/geli.8 Fri Apr 8 00:24:21 2016 (r297690) +++ head/sbin/geom/class/eli/geli.8 Fri Apr 8 01:25:25 2016 (r297691) @@ -51,7 +51,7 @@ utility: .Pp .Nm .Cm init -.Op Fl bPTv +.Op Fl bgPTv .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 bBtT +.Op Fl bBgGtT .Ar prov ... .Nm .Cm setkey @@ -293,6 +293,11 @@ The default and recommended algorithm is .Nm AES-XTS . .Nm NULL is unencrypted. +.It Fl g +Enable booting from this encrypted root filesystem. +The boot loader prompts for the passphrase and loads +.Xr loader 8 +from the encrypted partition. .It Fl i Ar iterations Number of iterations to use with PKCS#5v2 when processing User Key passphrase component. @@ -485,6 +490,13 @@ For more information, see the descriptio subcommand. .It Fl B Remove the BOOT flag from the given providers. +.It Fl g +Enable booting from this encrypted root filesystem. +The boot loader prompts for the passphrase and loads +.Xr loader 8 +from the encrypted partition. +.It Fl G +Deactivate booting from this encrypted root partition. .It Fl t Enable TRIM/UNMAP passthru. For more information, see the description of the Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Fri Apr 8 00:24:21 2016 (r297690) +++ head/sbin/geom/class/eli/geom_eli.c Fri Apr 8 01:25:25 2016 (r297691) @@ -82,13 +82,13 @@ static int eli_backup_create(struct gctl /* * Available commands: * - * init [-bhPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-V version] prov + * init [-bgPTv] [-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 ... * stop - alias for 'detach' * onetime [-d] [-a aalgo] [-e ealgo] [-l keylen] prov - * configure [-bB] prov ... + * configure [-bBgGtT] prov ... * setkey [-pPv] [-n keyno] [-j passfile] [-J newpassfile] [-k keyfile] [-K newkeyfile] prov * delkey [-afv] [-n keyno] prov * suspend [-v] -a | prov ... @@ -108,6 +108,7 @@ struct g_command class_commands[] = { { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "backupfile", "", G_TYPE_STRING }, { 'e', "ealgo", "", G_TYPE_STRING }, + { 'g', "geliboot", NULL, G_TYPE_BOOL }, { 'i', "iterations", "-1", G_TYPE_NUMBER }, { 'J', "newpassfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, { 'K', "newkeyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, @@ -118,7 +119,7 @@ struct g_command class_commands[] = { { 'V', "mdversion", "-1", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - "[-bPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov" + "[-bgPTv] [-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, { @@ -126,6 +127,7 @@ struct g_command class_commands[] = { { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "backupfile", "", G_TYPE_STRING }, { 'e', "ealgo", "", G_TYPE_STRING }, + { 'g', "geliboot", NULL, G_TYPE_BOOL }, { 'i', "iterations", "-1", G_TYPE_NUMBER }, { 'J', "newpassfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, { 'K', "newkeyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, @@ -180,11 +182,13 @@ struct g_command class_commands[] = { { { 'b', "boot", NULL, G_TYPE_BOOL }, { 'B', "noboot", 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 }, - "[-bBtT] prov ..." + "[-bBgGtT] prov ..." }, { "setkey", G_FLAG_VERBOSE, eli_main, { @@ -702,6 +706,8 @@ eli_init(struct gctl_req *req) md.md_flags = 0; if (gctl_get_int(req, "boot")) 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, "notrim")) md.md_flags |= G_ELI_FLAG_NODELETE; md.md_ealgo = CRYPTO_ALGORITHM_MIN - 1; @@ -906,7 +912,7 @@ eli_attach(struct gctl_req *req) static void eli_configure_detached(struct gctl_req *req, const char *prov, int boot, - int trim) + int geliboot, int trim) { struct g_eli_metadata md; bool changed = 0; @@ -928,6 +934,20 @@ eli_configure_detached(struct gctl_req * changed = 1; } + if (geliboot == 1 && (md.md_flags & G_ELI_FLAG_GELIBOOT)) { + if (verbose) + printf("GELIBOOT flag already configured for %s.\n", prov); + } else if (geliboot == 0 && !(md.md_flags & G_ELI_FLAG_GELIBOOT)) { + if (verbose) + printf("GELIBOOT flag not configured for %s.\n", prov); + } else if (geliboot >= 0) { + if (geliboot) + md.md_flags |= G_ELI_FLAG_GELIBOOT; + else + md.md_flags &= ~G_ELI_FLAG_GELIBOOT; + changed = 1; + } + if (trim == 0 && (md.md_flags & G_ELI_FLAG_NODELETE)) { if (verbose) printf("TRIM disable flag already configured for %s.\n", prov); @@ -951,8 +971,8 @@ static void eli_configure(struct gctl_req *req) { const char *prov; - bool boot, noboot, trim, notrim; - int doboot, dotrim; + bool boot, noboot, geliboot, nogeliboot, trim, notrim; + int doboot, dogeliboot, dotrim; int i, nargs; nargs = gctl_get_int(req, "nargs"); @@ -963,6 +983,8 @@ eli_configure(struct gctl_req *req) boot = gctl_get_int(req, "boot"); noboot = gctl_get_int(req, "noboot"); + geliboot = gctl_get_int(req, "geliboot"); + nogeliboot = gctl_get_int(req, "nogeliboot"); trim = gctl_get_int(req, "trim"); notrim = gctl_get_int(req, "notrim"); @@ -976,6 +998,16 @@ eli_configure(struct gctl_req *req) else if (noboot) doboot = 0; + dogeliboot = -1; + if (geliboot && nogeliboot) { + gctl_error(req, "Options -g and -G are mutually exclusive."); + return; + } + if (geliboot) + dogeliboot = 1; + else if (nogeliboot) + dogeliboot = 0; + dotrim = -1; if (trim && notrim) { gctl_error(req, "Options -t and -T are mutually exclusive."); @@ -986,7 +1018,7 @@ eli_configure(struct gctl_req *req) else if (notrim) dotrim = 0; - if (doboot == -1 && dotrim == -1) { + if (doboot == -1 && dogeliboot == -1 && dotrim == -1) { gctl_error(req, "No option given."); return; } @@ -997,7 +1029,7 @@ eli_configure(struct gctl_req *req) 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, dotrim); + eli_configure_detached(req, prov, doboot, dogeliboot, dotrim); } } Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Fri Apr 8 00:24:21 2016 (r297690) +++ head/sys/geom/eli/g_eli.c Fri Apr 8 01:25:25 2016 (r297691) @@ -1181,6 +1181,7 @@ g_eli_dumpconf(struct sbuf *sb, const ch ADD_FLAG(G_ELI_FLAG_DESTROY, "DESTROY"); ADD_FLAG(G_ELI_FLAG_RO, "READ-ONLY"); ADD_FLAG(G_ELI_FLAG_NODELETE, "NODELETE"); + ADD_FLAG(G_ELI_FLAG_GELIBOOT, "GELIBOOT"); #undef ADD_FLAG } sbuf_printf(sb, "\n"); Modified: head/sys/geom/eli/g_eli.h ============================================================================== --- head/sys/geom/eli/g_eli.h Fri Apr 8 00:24:21 2016 (r297690) +++ head/sys/geom/eli/g_eli.h Fri Apr 8 01:25:25 2016 (r297691) @@ -97,6 +97,8 @@ #define G_ELI_FLAG_RO 0x00000020 /* Don't pass through BIO_DELETE requests. */ #define G_ELI_FLAG_NODELETE 0x00000040 +/* This GELI supports GELIBoot */ +#define G_ELI_FLAG_GELIBOOT 0x00000080 /* RUNTIME FLAGS. */ /* Provider was open for writing. */ #define G_ELI_FLAG_WOPEN 0x00010000 Modified: head/sys/geom/eli/g_eli_ctl.c ============================================================================== --- head/sys/geom/eli/g_eli_ctl.c Fri Apr 8 00:24:21 2016 (r297690) +++ head/sys/geom/eli/g_eli_ctl.c Fri Apr 8 01:25:25 2016 (r297691) @@ -376,7 +376,7 @@ g_eli_ctl_configure(struct gctl_req *req char param[16]; const char *prov; u_char *sector; - int *nargs, *boot, *noboot, *trim, *notrim; + int *nargs, *boot, *noboot, *trim, *notrim, *geliboot, *nogeliboot; int zero, error, changed; u_int i; @@ -421,6 +421,19 @@ g_eli_ctl_configure(struct gctl_req *req if (*trim || *notrim) changed = 1; + geliboot = gctl_get_paraml(req, "geliboot", sizeof(*geliboot)); + if (geliboot == NULL) + geliboot = &zero; + nogeliboot = gctl_get_paraml(req, "nogeliboot", sizeof(*nogeliboot)); + if (nogeliboot == NULL) + nogeliboot = &zero; + if (*geliboot && *nogeliboot) { + gctl_error(req, "Options -g and -G are mutually exclusive."); + return; + } + if (*geliboot || *nogeliboot) + changed = 1; + if (!changed) { gctl_error(req, "No option given."); return; @@ -469,6 +482,16 @@ g_eli_ctl_configure(struct gctl_req *req continue; } + if (*geliboot && (sc->sc_flags & G_ELI_FLAG_GELIBOOT)) { + G_ELI_DEBUG(1, "GELIBOOT flag already configured for %s.", + prov); + continue; + } else if (*nogeliboot && !(sc->sc_flags & G_ELI_FLAG_GELIBOOT)) { + G_ELI_DEBUG(1, "GELIBOOT flag not configured for %s.", + prov); + continue; + } + if (!(sc->sc_flags & G_ELI_FLAG_ONETIME)) { /* * ONETIME providers don't write metadata to @@ -504,6 +527,14 @@ g_eli_ctl_configure(struct gctl_req *req sc->sc_flags &= ~G_ELI_FLAG_NODELETE; } + if (*geliboot) { + md.md_flags |= G_ELI_FLAG_GELIBOOT; + sc->sc_flags |= G_ELI_FLAG_GELIBOOT; + } else if (*nogeliboot) { + md.md_flags &= ~G_ELI_FLAG_GELIBOOT; + sc->sc_flags &= ~G_ELI_FLAG_GELIBOOT; + } + if (sc->sc_flags & G_ELI_FLAG_ONETIME) { /* There's no metadata on disk so we are done here. */ continue; From owner-svn-src-all@freebsd.org Fri Apr 8 01:27:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA74FB08394; Fri, 8 Apr 2016 01:27:41 +0000 (UTC) (envelope-from allanjude@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 mx1.freebsd.org (Postfix) with ESMTPS id 777CC117B; Fri, 8 Apr 2016 01:27:41 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u381ReLb006175; Fri, 8 Apr 2016 01:27:40 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u381ReT4006174; Fri, 8 Apr 2016 01:27:40 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201604080127.u381ReT4006174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Fri, 8 Apr 2016 01:27:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297692 - head/sys/boot/geli X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 01:27:41 -0000 Author: allanjude Date: Fri Apr 8 01:27:40 2016 New Revision: 297692 URL: https://svnweb.freebsd.org/changeset/base/297692 Log: GELIBoot should only prompt for the GELI passphrase if the provider has the G_ELI_FLAG_GELIBOOT set PR: 208251 Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D5870 Modified: head/sys/boot/geli/geliboot.c Modified: head/sys/boot/geli/geliboot.c ============================================================================== --- head/sys/boot/geli/geliboot.c Fri Apr 8 01:25:25 2016 (r297691) +++ head/sys/boot/geli/geliboot.c Fri Apr 8 01:27:40 2016 (r297692) @@ -90,12 +90,12 @@ geli_taste(int read_func(void *vdev, voi return (error); } - if ((md.md_flags & G_ELI_FLAG_ONETIME)) { - /* Swap device, skip it. */ + if (!(md.md_flags & G_ELI_FLAG_GELIBOOT)) { + /* The GELIBOOT feature is not activated */ return (1); } - if (!(md.md_flags & G_ELI_FLAG_BOOT)) { - /* Disk is not GELI boot device, skip it. */ + if ((md.md_flags & G_ELI_FLAG_ONETIME)) { + /* Swap device, skip it. */ return (1); } if (md.md_iterations < 0) { From owner-svn-src-all@freebsd.org Fri Apr 8 03:26:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E557B082E4; Fri, 8 Apr 2016 03:26:22 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id 0EE971EA7; Fri, 8 Apr 2016 03:26:21 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u383QLhW042616; Fri, 8 Apr 2016 03:26:21 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u383QL2b042615; Fri, 8 Apr 2016 03:26:21 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604080326.u383QL2b042615@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 8 Apr 2016 03:26:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297694 - head/sys/security/audit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 03:26:22 -0000 Author: pfg Date: Fri Apr 8 03:26:21 2016 New Revision: 297694 URL: https://svnweb.freebsd.org/changeset/base/297694 Log: audit(8): leave unsigned comparison for last. aq64_minfree is unsigned so comparing to find out if it is less than zero is a nonsense. Move the comparison to the last position as we don't want to spend time if any of the others triggers first. hile it would be tempting to just remove it, it may be important to keep it for portability with platforms where may be signed(?) or in case we may want to change it in the future. Modified: head/sys/security/audit/audit_syscalls.c Modified: head/sys/security/audit/audit_syscalls.c ============================================================================== --- head/sys/security/audit/audit_syscalls.c Fri Apr 8 01:57:40 2016 (r297693) +++ head/sys/security/audit/audit_syscalls.c Fri Apr 8 03:26:21 2016 (r297694) @@ -303,8 +303,8 @@ sys_auditon(struct thread *td, struct au (udata.au_qctrl64.aq64_lowater >= udata.au_qctrl.aq_hiwater) || (udata.au_qctrl64.aq64_bufsz > AQ_MAXBUFSZ) || - (udata.au_qctrl64.aq64_minfree < 0) || - (udata.au_qctrl64.aq64_minfree > 100)) + (udata.au_qctrl64.aq64_minfree > 100) || + (udata.au_qctrl64.aq64_minfree < 0)) return (EINVAL); audit_qctrl.aq_hiwater = (int)udata.au_qctrl64.aq64_hiwater; From owner-svn-src-all@freebsd.org Fri Apr 8 03:38:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80C7FB08662; Fri, 8 Apr 2016 03:38:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 14277182C; Fri, 8 Apr 2016 03:38:11 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c110-21-41-193.carlnfd1.nsw.optusnet.com.au (c110-21-41-193.carlnfd1.nsw.optusnet.com.au [110.21.41.193]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 4DB88780BAB; Fri, 8 Apr 2016 13:38:03 +1000 (AEST) Date: Fri, 8 Apr 2016 13:38:01 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Maxim Sobolev cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297690 - head/sys/boot/forth In-Reply-To: <201604080024.u380OL4Q087516@repo.freebsd.org> Message-ID: <20160408121934.H1779@besplex.bde.org> References: <201604080024.u380OL4Q087516@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=KvuwojiN c=1 sm=1 tr=0 a=73JWPhLeruqQCjN69UNZtQ==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=9sqBlyX0pr8N2FYJr5AA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 03:38:12 -0000 On Fri, 8 Apr 2016, Maxim Sobolev wrote: > Log: > Document vfs.root.mountfrom. > > Reviewed by: imp, wblock The format of this variable is still undocumented, except in the source code. > Modified: head/sys/boot/forth/loader.conf.5 > ============================================================================== > --- head/sys/boot/forth/loader.conf.5 Fri Apr 8 00:01:19 2016 (r297689) > +++ head/sys/boot/forth/loader.conf.5 Fri Apr 8 00:24:21 2016 (r297690) This variable is (partly) documented in a different wrong file than the source file. It isn't a loader option. It is a kernel tunable. No other kernel tunables are documented in loader.conf.5. Some of them are documented in loader.8 (not really the right place --- loader is just 1 way of setting them, and isn't a way of reading or interpreting them). loader.8 also documents most loader options as BUILTIN ENVIRONMENT VARIABLES. It does this much better than loader.conf.5. It documents 30 such options and only has a couple of ordering errors in the list, whie loader.conf.5 documents 15 such options in random order. About half of the 15 are in both, and their descriptions give quite different details in a quite different style (too much double quoting in loader.conf.5). loader.8 documents only 16 tunables, with more ordering errors that for options. > @@ -112,6 +112,31 @@ The name must be a subdirectory of > that contains a kernel. > .It Ar kernel_options > Flags to be passed to the kernel. > +.It Ar vfs.root.mountfrom > +Specify the root partition to mount. > +For example: > +.Pp > +.Dl vfs.root.mountfrom="ufs:/dev/da0s1a" The source code gives the details needed to actually use this variable without guessing from a single example. It gives both an informal and formal description: X /* X * The root filesystem is detailed in the kernel environment variable X * vfs.root.mountfrom, which is expected to be in the general format X * X * :[][ :[] ...] X * vfsname := the name of a VFS known to the kernel and capable X * of being mounted as root X * path := disk device name or other data used by the filesystem X * to locate its physical store X * X * If the environment variable vfs.root.mountfrom is a space separated list, X * each list element is tried in turn and the root filesystem will be mounted X * from the first one that suceeds. X * X * The environment variable vfs.root.mountfrom.options is a comma delimited X * set of string mount options. These mount options must be parseable X * by nmount() in the kernel. X */ I thought that these careful descriptions were broken using sbufs which accidentally (?) changed the separator from space to newline. However, I can' find any trace of this in my config files -- they now just use a space. I might have just been confused by old kernels not supporting lists. I mainly use this feaature to work around the renaming of ad to ada and loss of the compatibility support for this. My lists look like "ufs:ad4s3a ufs:ada0s3a ufs:ad0s2a". Old kernels don't support lists, but they also don't support ada; they use the first entry and this works although the documentation says it shouldn't (the comment says that the format is :[] and doesn't mention field separators or trailing garbage). FreeBSD-11 doesn't supprt ad, but it supports lists; so it uses the second entry. This works on 2 systems with similar disk numbering. The third entry is for another system with different disk numbering an no ad4. This almost never works -- with old kernels, the list doesn't work, and with new kernels the list works and ada0 exists and ada0s3a exists, but it is not the right boot partition. This works with intermediate kernels with lists but no ada0, so that the third entry is used. Bruce From owner-svn-src-all@freebsd.org Fri Apr 8 04:29:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2E14B06075; Fri, 8 Apr 2016 04:29:06 +0000 (UTC) (envelope-from kevlo@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 mx1.freebsd.org (Postfix) with ESMTPS id A60CA1D30; Fri, 8 Apr 2016 04:29:06 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u384T5Gd061505; Fri, 8 Apr 2016 04:29:05 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u384T5UA061504; Fri, 8 Apr 2016 04:29:05 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201604080429.u384T5UA061504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Fri, 8 Apr 2016 04:29:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297695 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 04:29:07 -0000 Author: kevlo Date: Fri Apr 8 04:29:05 2016 New Revision: 297695 URL: https://svnweb.freebsd.org/changeset/base/297695 Log: Fix comment. Modified: head/sys/fs/ext2fs/ext2_vfsops.c Modified: head/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vfsops.c Fri Apr 8 03:26:21 2016 (r297694) +++ head/sys/fs/ext2fs/ext2_vfsops.c Fri Apr 8 04:29:05 2016 (r297695) @@ -308,8 +308,8 @@ ext2_check_sb_compat(struct ext2fs *es, } /* - * This computes the fields of the ext2_sb_info structure from the - * data in the ext2_super_block structure read in. + * This computes the fields of the m_ext2fs structure from the + * data in the ext2fs structure read in. */ static int compute_sb_data(struct vnode *devvp, struct ext2fs *es, @@ -600,7 +600,7 @@ ext2_mountfs(struct vnode *devvp, struct /* * I don't know whether this is the right strategy. Note that - * we dynamically allocate both an ext2_sb_info and an ext2_super_block + * we dynamically allocate both an m_ext2fs and an ext2fs * while Linux keeps the super block in a locked buffer. */ ump->um_e2fs = malloc(sizeof(struct m_ext2fs), From owner-svn-src-all@freebsd.org Fri Apr 8 05:44:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 424BAB07726 for ; Fri, 8 Apr 2016 05:44:59 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: from mail-oi0-x22c.google.com (mail-oi0-x22c.google.com [IPv6:2607:f8b0:4003: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 0AC401934 for ; Fri, 8 Apr 2016 05:44:59 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: by mail-oi0-x22c.google.com with SMTP id s79so125544190oie.1 for ; Thu, 07 Apr 2016 22:44:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sippysoft-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=smBFZtwosPP2IlQYO8YX0nZ4/Rpufz/nhm48tPETzDU=; b=mNl33zup0Y8+qeHj10KFjEpeQm9iqK/4ofbYWr/WTitUG2NHQYa1nle3glqY3Gg4eW aCJDnGPH+W3ilwazh3patMF13J7gS1y3CyX959VSD90DEk4eCmNpM//YUpAHFHA7DgmZ eDtwXaQFv7aurvnmGkJjicrkz/W9RkvxGAl48zid191Zx94NBh3vMO/9R3h4t4DGsm9Y +KytX2gVFQsUXoh8OiTnL6fSKehivMqxxH2DybPVo4QhsSYdY2R8OEGW+Z5FWoClg4JX MjQ0h6jA4jMhD3+L6VTDeIYtXRff5FaPJCUt+fjgosfcyCx+S1vCQCW2EZozLHcYWACm kx6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=smBFZtwosPP2IlQYO8YX0nZ4/Rpufz/nhm48tPETzDU=; b=BnDPZtwdlYRFFHg1Q9FWS8m1Biv2ppweGS+GCy4ttEarWkEPvVYZ7oFJraOVjTSXy9 HVjr2D3W2mGjKr6iIQaorkqPncv5j/b4A8+yd2CSETGRNimbuXgq4belyhcbEqwLl08B KTv9s3tGPk2Bk5OIKTIkUq3IUQxgzK9T51/S2hY0KbPko9WzXgRg4KIAcY+C3ElHKJCi j8r/iNjGI62FwSeqmGP2AnvdBfrWyfPInToV6kvn0H84umXazr+Ii6pUfOid4G52uFHg kYxI2KzGZdUuD0OLzJNS4SlHAZiL+ygwtcC2OJ17uANKiCxGbptBL0rMsVEfQyUZqwG0 11Qw== X-Gm-Message-State: AD7BkJIuKAA4MbURhuCqq4Zrzntny3Zk17uLtB0jkkgmpSsdGU5Wwm9tegIUxIYbgUMu7NeB5Jg9u5a+y/TUJs0s MIME-Version: 1.0 X-Received: by 10.157.15.136 with SMTP id d8mr3591200otd.20.1460094298221; Thu, 07 Apr 2016 22:44:58 -0700 (PDT) Sender: sobomax@sippysoft.com Received: by 10.157.15.5 with HTTP; Thu, 7 Apr 2016 22:44:58 -0700 (PDT) In-Reply-To: <20160408121934.H1779@besplex.bde.org> References: <201604080024.u380OL4Q087516@repo.freebsd.org> <20160408121934.H1779@besplex.bde.org> Date: Thu, 7 Apr 2016 22:44:58 -0700 X-Google-Sender-Auth: YzH64lgHp5eLfcs_0oAP1zsN1TI Message-ID: Subject: Re: svn commit: r297690 - head/sys/boot/forth From: Maxim Sobolev To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 05:44:59 -0000 Hi Bruce, thanks for the input! I will see if I can move that piece into loader.8 and extend it a bit from the source "documentation". -Max On Thu, Apr 7, 2016 at 8:38 PM, Bruce Evans wrote: > On Fri, 8 Apr 2016, Maxim Sobolev wrote: > > Log: >> Document vfs.root.mountfrom. >> >> Reviewed by: imp, wblock >> > > The format of this variable is still undocumented, except in the source > code. > > Modified: head/sys/boot/forth/loader.conf.5 >> >> ============================================================================== >> --- head/sys/boot/forth/loader.conf.5 Fri Apr 8 00:01:19 2016 >> (r297689) >> +++ head/sys/boot/forth/loader.conf.5 Fri Apr 8 00:24:21 2016 >> (r297690) >> > > This variable is (partly) documented in a different wrong file than the > source file. It isn't a loader option. It is a kernel tunable. No > other kernel tunables are documented in loader.conf.5. Some of them are > documented in loader.8 (not really the right place --- loader is just 1 > way of setting them, and isn't a way of reading or interpreting them). > loader.8 also documents most loader options as BUILTIN ENVIRONMENT > VARIABLES. It does this much better than loader.conf.5. It documents > 30 such options and only has a couple of ordering errors in the list, > whie loader.conf.5 documents 15 such options in random order. About > half of the 15 are in both, and their descriptions give quite different > details in a quite different style (too much double quoting in > loader.conf.5). loader.8 documents only 16 tunables, with more ordering > errors that for options. > > @@ -112,6 +112,31 @@ The name must be a subdirectory of >> that contains a kernel. >> .It Ar kernel_options >> Flags to be passed to the kernel. >> +.It Ar vfs.root.mountfrom >> +Specify the root partition to mount. >> +For example: >> +.Pp >> +.Dl vfs.root.mountfrom="ufs:/dev/da0s1a" >> > > The source code gives the details needed to actually use this variable > without guessing from a single example. It gives both an informal and > formal description: > > X /* > X * The root filesystem is detailed in the kernel environment variable > X * vfs.root.mountfrom, which is expected to be in the general format > X * > X * :[][ :[] ...] > X * vfsname := the name of a VFS known to the kernel and capable > X * of being mounted as root > X * path := disk device name or other data used by the filesystem > X * to locate its physical store > X * > X * If the environment variable vfs.root.mountfrom is a space separated > list, > X * each list element is tried in turn and the root filesystem will be > mounted > X * from the first one that suceeds. > X * > X * The environment variable vfs.root.mountfrom.options is a comma > delimited > X * set of string mount options. These mount options must be parseable > X * by nmount() in the kernel. > X */ > > I thought that these careful descriptions were broken using sbufs which > accidentally (?) changed the separator from space to newline. However, > I can' find any trace of this in my config files -- they now just use > a space. I might have just been confused by old kernels not supporting > lists. > > I mainly use this feaature to work around the renaming of ad to ada and > loss of the compatibility support for this. My lists look like > "ufs:ad4s3a ufs:ada0s3a ufs:ad0s2a". Old kernels don't support lists, > but they also don't support ada; they use the first entry and this works > although the documentation says it shouldn't (the comment says that > the format is :[] and doesn't mention field separators or > trailing garbage). FreeBSD-11 doesn't supprt ad, but it supports lists; > so it uses the second entry. This works on 2 systems with similar disk > numbering. The third entry is for another system with different disk > numbering an no ad4. This almost never works -- with old kernels, the > list doesn't work, and with new kernels the list works and ada0 exists > and ada0s3a exists, but it is not the right boot partition. This works > with intermediate kernels with lists but no ada0, so that the third > entry is used. > > Bruce > > From owner-svn-src-all@freebsd.org Fri Apr 8 06:51:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B306DB08E48; Fri, 8 Apr 2016 06:51:50 +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 mx1.freebsd.org (Postfix) with ESMTPS id 80901159A; Fri, 8 Apr 2016 06:51:50 +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 u386pnqW006118; Fri, 8 Apr 2016 06:51:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u386pn5v006116; Fri, 8 Apr 2016 06:51:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604080651.u386pn5v006116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 8 Apr 2016 06:51:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297696 - in head/sys/dev/usb: . quirk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 06:51:50 -0000 Author: hselasky Date: Fri Apr 8 06:51:49 2016 New Revision: 297696 URL: https://svnweb.freebsd.org/changeset/base/297696 Log: Add new USB quirk. Submitted by: AJ PR: 208623 MFC after: 1 week Modified: head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.c Fri Apr 8 04:29:05 2016 (r297695) +++ head/sys/dev/usb/quirk/usb_quirk.c Fri Apr 8 06:51:49 2016 (r297696) @@ -529,6 +529,9 @@ static struct usb_quirk_entry usb_quirks /* DYMO LabelManager Pnp */ USB_QUIRK(DYMO, LABELMANAGERPNP, 0x0000, 0xffff, UQ_MSC_DYMO_EJECT), + + /* Holtek USB gaming keyboard */ + USB_QUIRK(HOLTEK, F85, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), }; #undef USB_QUIRK_VP #undef USB_QUIRK Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Fri Apr 8 04:29:05 2016 (r297695) +++ head/sys/dev/usb/usbdevs Fri Apr 8 06:51:49 2016 (r297696) @@ -2268,6 +2268,9 @@ product HIDGLOBAL CM6020 0x1784 Omnikey product HITACHI DVDCAM_DZ_MV100A 0x0004 DVD-CAM DZ-MV100A Camcorder product HITACHI DVDCAM_USB 0x001e DVDCAM USB HS Interface +/* Holtek products */ +product HOLTEK F85 0xa030 Holtek USB gaming keyboard + /* HP products */ product HP 895C 0x0004 DeskJet 895C product HP 4100C 0x0101 Scanjet 4100C From owner-svn-src-all@freebsd.org Fri Apr 8 07:57:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3870B08315; Fri, 8 Apr 2016 07:57:58 +0000 (UTC) (envelope-from pieter@degoeje.nl) Received: from degoeje.nl (degoeje.nl [81.169.238.128]) by mx1.freebsd.org (Postfix) with ESMTP id A9F8C1FE2; Fri, 8 Apr 2016 07:57:57 +0000 (UTC) (envelope-from pieter@degoeje.nl) Received: from [192.168.1.250] (unknown [188.203.228.182]) by degoeje.nl (Postfix) with ESMTPSA id 80C2315C0686; Fri, 8 Apr 2016 09:51:03 +0200 (CEST) Subject: Re: svn commit: r297633 - in head: sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/fs/ext2fs sys/kern sys/sys sys/ufs/ffs sys/ufs/ufs sys/vm usr.bin/rctl To: Edward Tomasz Napierala , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201604070423.u374NP0Z021115@repo.freebsd.org> From: Pieter de Goeje Message-ID: <570762E4.6080706@degoeje.nl> Date: Fri, 8 Apr 2016 09:51:00 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <201604070423.u374NP0Z021115@repo.freebsd.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.0 required=3.5 tests=ALL_TRUSTED autolearn=ham autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on degoeje.nl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 07:57:59 -0000 Op 2016-04-07 om 06:23 schreef Edward Tomasz Napierala: > +static uint64_t > +xmul(uint64_t a, uint64_t b) > +{ > + uint64_t c; > + > + if (a == 0 || b == 0) > + return (0); > + > + c = a * b; > + > + if (c < a || c < b) > + return (UINT64_MAX); If the intent is to check for overflow, then this check is insufficient. It fails for example if a = 2^32+1 and b = 2^32. This works for all cases, assuming a != 0: if(UINT64_MAX / a > b) return (UINT64_MAX); If the extra division is too expensive, GCC and clang provide __builtin_mul_overflow(). -- Pieter de Goeje From owner-svn-src-all@freebsd.org Fri Apr 8 09:20:48 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1ABCEB0859D; Fri, 8 Apr 2016 09:20:48 +0000 (UTC) (envelope-from sephe@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 mx1.freebsd.org (Postfix) with ESMTPS id D8E7B1B12; Fri, 8 Apr 2016 09:20:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u389Kl46048703; Fri, 8 Apr 2016 09:20:47 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u389KliR048702; Fri, 8 Apr 2016 09:20:47 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201604080920.u389KliR048702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 8 Apr 2016 09:20:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297699 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 09:20:48 -0000 Author: sephe Date: Fri Apr 8 09:20:46 2016 New Revision: 297699 URL: https://svnweb.freebsd.org/changeset/base/297699 Log: hyperv: Revert r297481 Use vm_guest == VM_GUEST_HV is not enough to determine whether FreeBSD is running on Hyper-V or not. What a mess. Reported by: smokehydration tutanota com Sponsored by: Microsoft OSTC Modified: head/sys/dev/hyperv/vmbus/hv_hv.c Modified: head/sys/dev/hyperv/vmbus/hv_hv.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_hv.c Fri Apr 8 08:43:25 2016 (r297698) +++ head/sys/dev/hyperv/vmbus/hv_hv.c Fri Apr 8 09:20:46 2016 (r297699) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -208,6 +207,8 @@ hv_vmbus_init(void) hv_vmbus_g_context.hypercall_page = virt_addr; + tc_init(&hv_timecounter); /* register virtual timecount */ + hv_et_init(); return (0); @@ -436,14 +437,3 @@ void hv_vmbus_synic_cleanup(void *arg) wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); } -static void -hv_tc_init(void) -{ - if (vm_guest != VM_GUEST_HV) - return; - - /* register virtual timecounter */ - tc_init(&hv_timecounter); -} - -SYSINIT(hv_tc_init, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, hv_tc_init, NULL); From owner-svn-src-all@freebsd.org Fri Apr 8 09:42:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3BD0B08C16; Fri, 8 Apr 2016 09:42:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F2C717E9; Fri, 8 Apr 2016 09:42:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u389gmvB074255 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 8 Apr 2016 12:42:48 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u389gmvB074255 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u389gmvS074254; Fri, 8 Apr 2016 12:42:48 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 8 Apr 2016 12:42:48 +0300 From: Konstantin Belousov To: Sepherosa Ziehau Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297699 - head/sys/dev/hyperv/vmbus Message-ID: <20160408094248.GM1741@kib.kiev.ua> References: <201604080920.u389KliR048702@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201604080920.u389KliR048702@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 09:42:55 -0000 On Fri, Apr 08, 2016 at 09:20:47AM +0000, Sepherosa Ziehau wrote: > Author: sephe > Date: Fri Apr 8 09:20:46 2016 > New Revision: 297699 > URL: https://svnweb.freebsd.org/changeset/base/297699 > > Log: > hyperv: Revert r297481 > > Use vm_guest == VM_GUEST_HV is not enough to determine whether FreeBSD > is running on Hyper-V or not. What a mess. Can you explain why ? VM_GUEST_HV is only set in inentify_hypervisor() when the vendor string explicitely contained 'Microsoft Hv'. How can this be mis-interpreted to be a Xen id ? From owner-svn-src-all@freebsd.org Fri Apr 8 09:49:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77EF1B08D21; Fri, 8 Apr 2016 09:49:14 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::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 F29941A17; Fri, 8 Apr 2016 09:49:13 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-lf0-x241.google.com with SMTP id t203so6454499lfd.0; Fri, 08 Apr 2016 02:49:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-transfer-encoding; bh=Rs77qDe0GjJYo0CReZan0JkJyjT7TyA2uD94KO52tZY=; b=YgzvC462mY3UVY7HV6F7x6py1/Mg77sVtetOPwjcWSEUSyKezneI0vS6zGweCNx9Jq 4gb8ek9waZjiVYiD+IpKU1qy09iRU+y1nFTF6C2tKcgvbA5TC7BIShGMDPA2rgsmQoUL M0HAIByaGjU5hHY1Ni7i+kahbCXc10eMkW7QueP7WErr4LguxrkXNKCcL5ARO57UWxkw mlg1GaQsM9GxbkmoM6Ppjr6fiE/FSYWWqkKzxXrYrx5Yis7XygVYkpTsBUlb5rejfOae SamUD5M1MQ2K/nPprTOnlSQPLQbp/8WSdIh1CevY/S6rhXrYjQVDwGNLzV7LRb/9vzIQ wnyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-transfer-encoding; bh=Rs77qDe0GjJYo0CReZan0JkJyjT7TyA2uD94KO52tZY=; b=ke3Pp3Wz+GQOxGglpHTjFm2GYBrwbftWytiWyj6ZRIYBx9oKERz4vbJ0C5WCxnPvxg gg1fE7y8OKKvNGo32qj2IEVuboiL8Gdc02LnEec5of3ZAA95Xucrn8+WF8YA9Cg/3JDa e67++L1aJi3NcPAepRnDAQJy1rCWKDgzJ3E4tmbS6l5d/9fRQxBlE4YyD79gCptKzQv2 KPhaTLlepxxEgu8sxa1YlqIfO5QgtnShBSkjnhtzVzCfNACh609G6NOPdrqwBDJdwv1v yPdopov8Ln4o+SHLNclFCKyp+QrjpvgsSAze+u5MvGXWW6pv8c6HMAqbJr+wR+8nRwJN VocQ== X-Gm-Message-State: AD7BkJJUh4xz/9TgWP4myRg7VNg3dFUQ2FYdY21NSdbL8IMBkEZIDPiPk2HJyS/xm4iT4A== X-Received: by 10.25.168.67 with SMTP id r64mr2720874lfe.104.1460108952244; Fri, 08 Apr 2016 02:49:12 -0700 (PDT) Received: from mavbook.mavhome.dp.ua (mavhome.mavhome.dp.ua. [213.227.240.37]) by smtp.googlemail.com with ESMTPSA id vs3sm1903104lbb.4.2016.04.08.02.49.10 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 08 Apr 2016 02:49:11 -0700 (PDT) Message-ID: <57077E95.1030505@gmail.com> Date: Fri, 08 Apr 2016 12:49:09 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Konstantin Belousov , Sepherosa Ziehau CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297699 - head/sys/dev/hyperv/vmbus References: <201604080920.u389KliR048702@repo.freebsd.org> <20160408094248.GM1741@kib.kiev.ua> In-Reply-To: <20160408094248.GM1741@kib.kiev.ua> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 09:49:14 -0000 On 08.04.16 12:42, Konstantin Belousov wrote: > On Fri, Apr 08, 2016 at 09:20:47AM +0000, Sepherosa Ziehau wrote: >> Author: sephe >> Date: Fri Apr 8 09:20:46 2016 >> New Revision: 297699 >> URL: https://svnweb.freebsd.org/changeset/base/297699 >> >> Log: >> hyperv: Revert r297481 >> >> Use vm_guest == VM_GUEST_HV is not enough to determine whether FreeBSD >> is running on Hyper-V or not. What a mess. > > Can you explain why ? > > VM_GUEST_HV is only set in inentify_hypervisor() when the vendor string > explicitely contained 'Microsoft Hv'. How can this be mis-interpreted > to be a Xen id ? Xen has some odd "Hyper-V compatibility mode", that is identified as Hyper-V, but not very compatible in practice. -- Alexander Motin From owner-svn-src-all@freebsd.org Fri Apr 8 09:59:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A160B0704D; Fri, 8 Apr 2016 09:59:42 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 4A86A1E71; Fri, 8 Apr 2016 09:59:41 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c110-21-41-193.carlnfd1.nsw.optusnet.com.au (c110-21-41-193.carlnfd1.nsw.optusnet.com.au [110.21.41.193]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 838701041717; Fri, 8 Apr 2016 19:26:58 +1000 (AEST) Date: Fri, 8 Apr 2016 19:26:57 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Maxim Sobolev cc: Bruce Evans , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r297690 - head/sys/boot/forth In-Reply-To: Message-ID: <20160408173524.V827@besplex.bde.org> References: <201604080024.u380OL4Q087516@repo.freebsd.org> <20160408121934.H1779@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=c+ZWOkJl c=1 sm=1 tr=0 a=73JWPhLeruqQCjN69UNZtQ==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=uBi6BwCJpX-U97XzUNkA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 09:59:42 -0000 On Thu, 7 Apr 2016, Maxim Sobolev wrote: > Hi Bruce, thanks for the input! I will see if I can move that piece into > loader.8 and extend it a bit from the source "documentation". Thanks. I checked what happens for space and newline as field separators. They both to work in -current. The newline form is less backwards compatible and has other problems, so it should never be used. Quoting for the spaces and newlines is painful, and also unclearly documented. I noticed these problems: - in the static env source file, IIRC spaces don't work despite the strings being quoted, so I use hex escapes. Octal escapes might work. I doubt that the format is documented. It is either not just C string format, or there is a problem with outer quotes being removed. - in the default loader.conf and device.hints, everything is quoted with literal double quotes, even though most of the strings don't have whitespace. I don't know if this is needed. Quoting has a lot of documentation in loader.8 - the 'show' command in at least old versions of loader strips quotes, even in strings with whitespace. Setting setting foo=123 and foo="123" both give 123. Hex escapes are documented to work in the parser, but don't work from the command line (\x20 becomes x20), so so my use of them in kernel.env wouldn't work in loader. Octal escapes are docmented to work in the parser, and work from the command line. - when I got the octal escape sequence for newline wrong in loader, it did no OPOST processing like it does for newline, so it displayed a strange glyph (whatever is in the BIOS font). Kernel error messages did the same. For syscons, boot messages use the BIOS font. I think vt would not display anything for control characters. - when mountroot tries a device that doesn't exist, it prints the confusing errno 19. 19 is ENODEV. ENODEV means ENOENT for the device. Documentation of this was broken by nmount in mount.2. It still refers to the ufs_args struct which is not used by nmount and is no longer documented (except via this broken pointer) in mount.2. - quoting is needed for strings with spaces or escape sequences: setting either foo=1 2 3 or foo=1\0402\0403 are syntax errors. - loader.8, when viewed using man, has a few instances of excessive quoting too. I not see that this a markup error. Double quotes for string literals are rendered on a text terminal as 2 single quote characters each. The string literals should be marked up as literals, especially the quotes in them, so that the quotes are rendered literally. - loader.conf.5 barely documents quoting. It just says that settings have the form variable="value". The double quotes are correctly rendered for this but are misrendered in all examples. Bruce From owner-svn-src-all@freebsd.org Fri Apr 8 10:00:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02853B070BB; Fri, 8 Apr 2016 10:00:09 +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 mx1.freebsd.org (Postfix) with ESMTPS id C647E1FE2; Fri, 8 Apr 2016 10:00:08 +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 u38A07mq061113; Fri, 8 Apr 2016 10:00:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38A076r061112; Fri, 8 Apr 2016 10:00:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604081000.u38A076r061112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 8 Apr 2016 10:00:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297700 - stable/10/sys/dev/mpr X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 10:00:09 -0000 Author: mav Date: Fri Apr 8 10:00:07 2016 New Revision: 297700 URL: https://svnweb.freebsd.org/changeset/base/297700 Log: MFC r266615: Increase taskqueue thread priority from idle to PRIBIO. Idle priority is not even time-share, so if system is busy in any way, those events may never be executed. Since in some cases system waits for events processed by that thread, that may cause deadlocks. Modified: stable/10/sys/dev/mpr/mpr_sas.c Modified: stable/10/sys/dev/mpr/mpr_sas.c ============================================================================== --- stable/10/sys/dev/mpr/mpr_sas.c Fri Apr 8 09:20:46 2016 (r297699) +++ stable/10/sys/dev/mpr/mpr_sas.c Fri Apr 8 10:00:07 2016 (r297700) @@ -769,9 +769,7 @@ mpr_attach_sas(struct mpr_softc *sc) TASK_INIT(&sassc->ev_task, 0, mprsas_firmware_event_work, sc); sassc->ev_tq = taskqueue_create("mpr_taskq", M_NOWAIT | M_ZERO, taskqueue_thread_enqueue, &sassc->ev_tq); - - /* Run the task queue with lowest priority */ - taskqueue_start_threads(&sassc->ev_tq, 1, 255, "%s taskq", + taskqueue_start_threads(&sassc->ev_tq, 1, PRIBIO, "%s taskq", device_get_nameunit(sc->mpr_dev)); mpr_lock(sc); From owner-svn-src-all@freebsd.org Fri Apr 8 10:21:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0590B0796E; Fri, 8 Apr 2016 10:21:44 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9F7DB1ADE; Fri, 8 Apr 2016 10:21:44 +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 u38ALhRd068965; Fri, 8 Apr 2016 10:21:43 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38ALhrq068960; Fri, 8 Apr 2016 10:21:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201604081021.u38ALhrq068960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 8 Apr 2016 10:21:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297701 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 10:21:45 -0000 Author: kib Date: Fri Apr 8 10:21:43 2016 New Revision: 297701 URL: https://svnweb.freebsd.org/changeset/base/297701 Log: Assert that the lock objects put into the off-page, fit into the page. Sponsored by: The FreeBSD Foundation Modified: head/lib/libthr/thread/thr_barrier.c head/lib/libthr/thread/thr_cond.c head/lib/libthr/thread/thr_mutex.c head/lib/libthr/thread/thr_pspinlock.c head/lib/libthr/thread/thr_rwlock.c Modified: head/lib/libthr/thread/thr_barrier.c ============================================================================== --- head/lib/libthr/thread/thr_barrier.c Fri Apr 8 10:00:07 2016 (r297700) +++ head/lib/libthr/thread/thr_barrier.c Fri Apr 8 10:21:43 2016 (r297701) @@ -34,6 +34,9 @@ #include "thr_private.h" +_Static_assert(sizeof(struct pthread_barrier) <= PAGE_SIZE, + "pthread_barrier is too large for off-page"); + __weak_reference(_pthread_barrier_init, pthread_barrier_init); __weak_reference(_pthread_barrier_wait, pthread_barrier_wait); __weak_reference(_pthread_barrier_destroy, pthread_barrier_destroy); Modified: head/lib/libthr/thread/thr_cond.c ============================================================================== --- head/lib/libthr/thread/thr_cond.c Fri Apr 8 10:00:07 2016 (r297700) +++ head/lib/libthr/thread/thr_cond.c Fri Apr 8 10:21:43 2016 (r297701) @@ -40,6 +40,9 @@ #include "thr_private.h" +_Static_assert(sizeof(struct pthread_cond) <= PAGE_SIZE, + "pthread_cond too large"); + /* * Prototypes */ Modified: head/lib/libthr/thread/thr_mutex.c ============================================================================== --- head/lib/libthr/thread/thr_mutex.c Fri Apr 8 10:00:07 2016 (r297700) +++ head/lib/libthr/thread/thr_mutex.c Fri Apr 8 10:21:43 2016 (r297701) @@ -51,6 +51,9 @@ #include "thr_private.h" +_Static_assert(sizeof(struct pthread_mutex) <= PAGE_SIZE, + "pthread_mutex is too large for off-page"); + /* * For adaptive mutexes, how many times to spin doing trylock2 * before entering the kernel to block Modified: head/lib/libthr/thread/thr_pspinlock.c ============================================================================== --- head/lib/libthr/thread/thr_pspinlock.c Fri Apr 8 10:00:07 2016 (r297700) +++ head/lib/libthr/thread/thr_pspinlock.c Fri Apr 8 10:21:43 2016 (r297701) @@ -38,6 +38,9 @@ #include "thr_private.h" +_Static_assert(sizeof(struct pthread_spinlock) <= PAGE_SIZE, + "pthread_spinlock is too large for off-page"); + #define SPIN_COUNT 100000 __weak_reference(_pthread_spin_init, pthread_spin_init); Modified: head/lib/libthr/thread/thr_rwlock.c ============================================================================== --- head/lib/libthr/thread/thr_rwlock.c Fri Apr 8 10:00:07 2016 (r297700) +++ head/lib/libthr/thread/thr_rwlock.c Fri Apr 8 10:21:43 2016 (r297701) @@ -35,6 +35,9 @@ #include "un-namespace.h" #include "thr_private.h" +_Static_assert(sizeof(struct pthread_rwlock) <= PAGE_SIZE, + "pthread_rwlock is too large for off-page"); + __weak_reference(_pthread_rwlock_destroy, pthread_rwlock_destroy); __weak_reference(_pthread_rwlock_init, pthread_rwlock_init); __weak_reference(_pthread_rwlock_rdlock, pthread_rwlock_rdlock); From owner-svn-src-all@freebsd.org Fri Apr 8 10:23:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0565B07B86; Fri, 8 Apr 2016 10:23:49 +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 mx1.freebsd.org (Postfix) with ESMTPS id 7F34A1D1B; Fri, 8 Apr 2016 10:23:49 +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 u38ANmY1069812; Fri, 8 Apr 2016 10:23:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38ANmmA069810; Fri, 8 Apr 2016 10:23:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201604081023.u38ANmmA069810@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 8 Apr 2016 10:23:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297702 - in head/sys: boot/common kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 10:23:49 -0000 Author: kib Date: Fri Apr 8 10:23:48 2016 New Revision: 297702 URL: https://svnweb.freebsd.org/changeset/base/297702 Log: Use the ABI-prescribed name for SHT_X86_64_UNWIND in the loader and kernel linker, after the r297686. Sponsored by: The FreeBSD Foundation Modified: head/sys/boot/common/load_elf_obj.c head/sys/kern/link_elf_obj.c Modified: head/sys/boot/common/load_elf_obj.c ============================================================================== --- head/sys/boot/common/load_elf_obj.c Fri Apr 8 10:21:43 2016 (r297701) +++ head/sys/boot/common/load_elf_obj.c Fri Apr 8 10:23:48 2016 (r297702) @@ -222,7 +222,7 @@ __elfN(obj_loadimage)(struct preloaded_f case SHT_PROGBITS: case SHT_NOBITS: #if defined(__i386__) || defined(__amd64__) - case SHT_AMD64_UNWIND: + case SHT_X86_64_UNWIND: #endif lastaddr = roundup(lastaddr, shdr[i].sh_addralign); shdr[i].sh_addr = (Elf_Addr)lastaddr; Modified: head/sys/kern/link_elf_obj.c ============================================================================== --- head/sys/kern/link_elf_obj.c Fri Apr 8 10:21:43 2016 (r297701) +++ head/sys/kern/link_elf_obj.c Fri Apr 8 10:23:48 2016 (r297702) @@ -258,7 +258,7 @@ link_elf_link_preload(linker_class_t cls case SHT_PROGBITS: case SHT_NOBITS: #ifdef __amd64__ - case SHT_AMD64_UNWIND: + case SHT_X86_64_UNWIND: #endif ef->nprogtab++; break; @@ -331,13 +331,13 @@ link_elf_link_preload(linker_class_t cls case SHT_PROGBITS: case SHT_NOBITS: #ifdef __amd64__ - case SHT_AMD64_UNWIND: + case SHT_X86_64_UNWIND: #endif ef->progtab[pb].addr = (void *)shdr[i].sh_addr; if (shdr[i].sh_type == SHT_PROGBITS) ef->progtab[pb].name = "<>"; #ifdef __amd64__ - else if (shdr[i].sh_type == SHT_AMD64_UNWIND) + else if (shdr[i].sh_type == SHT_X86_64_UNWIND) ef->progtab[pb].name = "<>"; #endif else @@ -597,7 +597,7 @@ link_elf_load_file(linker_class_t cls, c case SHT_PROGBITS: case SHT_NOBITS: #ifdef __amd64__ - case SHT_AMD64_UNWIND: + case SHT_X86_64_UNWIND: #endif ef->nprogtab++; break; @@ -712,7 +712,7 @@ link_elf_load_file(linker_class_t cls, c case SHT_PROGBITS: case SHT_NOBITS: #ifdef __amd64__ - case SHT_AMD64_UNWIND: + case SHT_X86_64_UNWIND: #endif alignmask = shdr[i].sh_addralign - 1; mapsize += alignmask; @@ -782,7 +782,7 @@ link_elf_load_file(linker_class_t cls, c case SHT_PROGBITS: case SHT_NOBITS: #ifdef __amd64__ - case SHT_AMD64_UNWIND: + case SHT_X86_64_UNWIND: #endif alignmask = shdr[i].sh_addralign - 1; mapbase += alignmask; @@ -797,7 +797,7 @@ link_elf_load_file(linker_class_t cls, c } else if (shdr[i].sh_type == SHT_PROGBITS) ef->progtab[pb].name = "<>"; #ifdef __amd64__ - else if (shdr[i].sh_type == SHT_AMD64_UNWIND) + else if (shdr[i].sh_type == SHT_X86_64_UNWIND) ef->progtab[pb].name = "<>"; #endif else @@ -823,7 +823,7 @@ link_elf_load_file(linker_class_t cls, c ef->progtab[pb].sec = i; if (shdr[i].sh_type == SHT_PROGBITS #ifdef __amd64__ - || shdr[i].sh_type == SHT_AMD64_UNWIND + || shdr[i].sh_type == SHT_X86_64_UNWIND #endif ) { error = vn_rdwr(UIO_READ, nd.ni_vp, From owner-svn-src-all@freebsd.org Fri Apr 8 10:48:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A57BB0839C; Fri, 8 Apr 2016 10:48:33 +0000 (UTC) (envelope-from howard0su@gmail.com) Received: from mail-io0-x22f.google.com (mail-io0-x22f.google.com [IPv6:2607:f8b0:4001:c06::22f]) (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 F2A2616E9; Fri, 8 Apr 2016 10:48:32 +0000 (UTC) (envelope-from howard0su@gmail.com) Received: by mail-io0-x22f.google.com with SMTP id 2so127177132ioy.1; Fri, 08 Apr 2016 03:48:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=O1maRLVCz5yteMmd5nL7hyZrNhQOohuI3n2FldGN1ko=; b=gfAF+gM0QXG8bSXVgPtjVDcwcNF3aewv8bz7w8XCEhzMLtXi0370r097FUfRBIReJt uDBcKkdS9jss/A2GQSW5ThD0H+Uaubl0m7X1+/x8MsbgPF6GjXzlsrBgqvXZ06lpPhC+ 6EWCUzMBP2BgOF3h8klGbIJ+JLI3F2zNjzxf3XyzpsEHitM7IKvQvYDpRQCuJcYefz87 EkSuVvLwlnn+TrESOsydHZWc2Rso7mLZpz/Sud27WBIi3UlGtv5ATWdOu5Cr/v5akGz1 eu7S3EvYVx/d7n0PGD97ePt/V0cOG6HvE7FuruSbX+VQx5adFcQMvsvSRw9KoIxUDNU1 nnEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=O1maRLVCz5yteMmd5nL7hyZrNhQOohuI3n2FldGN1ko=; b=Usbs8HUtxHIKoXzSc7jNdGlz8ivZTv/VlNk2svmmBF64Fv+8VvmMIbb3fsBe6EX6rl uWfiZEG7GIMX/jWUjGkGnCdSKCA/4bczjqVBkfXI1X2dJ9Sh0NqhO4euMvI4LP+EjfeP eCu2oDApI6qG6hU0eUhbIGeaft9H+VLZOYkU1WgqS6CJ2+yExYOjgMmKL2aODEHusxRW S0d8e4TtVUo8okHcLEPT7n2oLzDNuERPBY57D5/69DKoVL8gXktzZAmLhgc4ZZDVP7t8 pWsP71KrxdFDWd+o7szqruReFU2Wc6Tg38FRNCndtdxRI200d8Pn7ZB/DJajeNMLQGRI lUBA== X-Gm-Message-State: AD7BkJL271Xgw1F5ts+fYyLXeUL32wtXMObETmAuWKxZRB7MifOiOy306UOxFe6LVdHU0JiLCbfG+Db6/Lbmkw== X-Received: by 10.107.7.23 with SMTP id 23mr7999805ioh.64.1460112512241; Fri, 08 Apr 2016 03:48:32 -0700 (PDT) MIME-Version: 1.0 References: <201604080920.u389KliR048702@repo.freebsd.org> <20160408094248.GM1741@kib.kiev.ua> <57077E95.1030505@gmail.com> In-Reply-To: <57077E95.1030505@gmail.com> From: Howard Su Date: Fri, 08 Apr 2016 10:48:22 +0000 Message-ID: Subject: Re: svn commit: r297699 - head/sys/dev/hyperv/vmbus To: Alexander Motin , Konstantin Belousov , Sepherosa Ziehau Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 10:48:33 -0000 On Fri, Apr 8, 2016 at 5:49 PM Alexander Motin wrote: > On 08.04.16 12:42, Konstantin Belousov wrote: > > On Fri, Apr 08, 2016 at 09:20:47AM +0000, Sepherosa Ziehau wrote: > >> Author: sephe > >> Date: Fri Apr 8 09:20:46 2016 > >> New Revision: 297699 > >> URL: https://svnweb.freebsd.org/changeset/base/297699 > >> > >> Log: > >> hyperv: Revert r297481 > >> > >> Use vm_guest == VM_GUEST_HV is not enough to determine whether FreeBSD > >> is running on Hyper-V or not. What a mess. > > > > Can you explain why ? > > > > VM_GUEST_HV is only set in inentify_hypervisor() when the vendor string > > explicitely contained 'Microsoft Hv'. How can this be mis-interpreted > > to be a Xen id ? > > Xen has some odd "Hyper-V compatibility mode", that is identified as > Hyper-V, but not very compatible in practice. > Per hyper-V document, it needs more checks about if one feature is available on certain hypervisor. As far as I know, KVM, QEMU (after 1.1), VirtualBox all have the simliar Windows hypervisor emulation mode to make Windows Runs faster. So we need handle this more strictly following the spec. There is already a patch under testing now, which may reach the tree soon. > > -- > Alexander Motin > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-all@freebsd.org Fri Apr 8 10:55:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E50C2B0863D; Fri, 8 Apr 2016 10:55:00 +0000 (UTC) (envelope-from jmcneill@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 mx1.freebsd.org (Postfix) with ESMTPS id 9D1851BA8; Fri, 8 Apr 2016 10:55:00 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38Asxx2078621; Fri, 8 Apr 2016 10:54:59 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38Asx1N078619; Fri, 8 Apr 2016 10:54:59 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201604081054.u38Asx1N078619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Fri, 8 Apr 2016 10:54:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297703 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 10:55:01 -0000 Author: jmcneill Date: Fri Apr 8 10:54:59 2016 New Revision: 297703 URL: https://svnweb.freebsd.org/changeset/base/297703 Log: Add function for mapping SRAM-D area to USB0 (OTG) controller. Use a lower pass number to ensure that this driver is loaded before EMAC or OTG, regardless of the order of nodes in the DT. Modified: head/sys/arm/allwinner/a10_sramc.c head/sys/arm/allwinner/a10_sramc.h Modified: head/sys/arm/allwinner/a10_sramc.c ============================================================================== --- head/sys/arm/allwinner/a10_sramc.c Fri Apr 8 10:23:48 2016 (r297702) +++ head/sys/arm/allwinner/a10_sramc.c Fri Apr 8 10:54:59 2016 (r297703) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include "a10_sramc.h" #define SRAM_CTL1_CFG 0x04 +#define CTL1_CFG_SRAMD_MAP_USB0 (1 << 0) struct a10_sramc_softc { struct resource *res; @@ -113,7 +114,8 @@ static driver_t a10_sramc_driver = { static devclass_t a10_sramc_devclass; -DRIVER_MODULE(a10_sramc, simplebus, a10_sramc_driver, a10_sramc_devclass, 0, 0); +EARLY_DRIVER_MODULE(a10_sramc, simplebus, a10_sramc_driver, a10_sramc_devclass, + 0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_EARLY); int a10_map_to_emac(void) @@ -131,3 +133,20 @@ a10_map_to_emac(void) return (0); } + +int +a10_map_to_otg(void) +{ + struct a10_sramc_softc *sc = a10_sramc_sc; + uint32_t reg_value; + + if (sc == NULL) + return (ENXIO); + + /* Map SRAM to OTG */ + reg_value = sramc_read_4(sc, SRAM_CTL1_CFG); + reg_value |= CTL1_CFG_SRAMD_MAP_USB0; + sramc_write_4(sc, SRAM_CTL1_CFG, reg_value); + + return (0); +} Modified: head/sys/arm/allwinner/a10_sramc.h ============================================================================== --- head/sys/arm/allwinner/a10_sramc.h Fri Apr 8 10:23:48 2016 (r297702) +++ head/sys/arm/allwinner/a10_sramc.h Fri Apr 8 10:54:59 2016 (r297703) @@ -30,5 +30,6 @@ #define _A10_SRAMC_H_ int a10_map_to_emac(void); +int a10_map_to_otg(void); #endif From owner-svn-src-all@freebsd.org Fri Apr 8 10:59:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D979BB086E4; Fri, 8 Apr 2016 10:59:07 +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 mx1.freebsd.org (Postfix) with ESMTPS id AAC6F1D9A; Fri, 8 Apr 2016 10:59:07 +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 u38Ax6Ef078821; Fri, 8 Apr 2016 10:59:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38Ax6ER078818; Fri, 8 Apr 2016 10:59:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201604081059.u38Ax6ER078818@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 8 Apr 2016 10:59:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297704 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 10:59:08 -0000 Author: kib Date: Fri Apr 8 10:59:06 2016 New Revision: 297704 URL: https://svnweb.freebsd.org/changeset/base/297704 Log: Use ANSI C function definitions, fix spelling in a comment. Sponsored by: The FreeBSD Foundation Modified: head/lib/libthr/thread/thr_main_np.c head/lib/libthr/thread/thr_multi_np.c head/lib/libthr/thread/thr_single_np.c Modified: head/lib/libthr/thread/thr_main_np.c ============================================================================== --- head/lib/libthr/thread/thr_main_np.c Fri Apr 8 10:54:59 2016 (r297703) +++ head/lib/libthr/thread/thr_main_np.c Fri Apr 8 10:59:06 2016 (r297704) @@ -37,10 +37,10 @@ __weak_reference(_pthread_main_np, pthread_main_np); /* - * Provide the equivelant to Solaris thr_main() function + * Provide the equivalent to Solaris thr_main() function. */ int -_pthread_main_np() +_pthread_main_np(void) { if (!_thr_initial) Modified: head/lib/libthr/thread/thr_multi_np.c ============================================================================== --- head/lib/libthr/thread/thr_multi_np.c Fri Apr 8 10:54:59 2016 (r297703) +++ head/lib/libthr/thread/thr_multi_np.c Fri Apr 8 10:59:06 2016 (r297704) @@ -37,7 +37,7 @@ __weak_reference(_pthread_multi_np, pthread_multi_np); int -_pthread_multi_np() +_pthread_multi_np(void) { /* Return to multi-threaded scheduling mode: */ Modified: head/lib/libthr/thread/thr_single_np.c ============================================================================== --- head/lib/libthr/thread/thr_single_np.c Fri Apr 8 10:54:59 2016 (r297703) +++ head/lib/libthr/thread/thr_single_np.c Fri Apr 8 10:59:06 2016 (r297704) @@ -36,7 +36,8 @@ __weak_reference(_pthread_single_np, pthread_single_np); -int _pthread_single_np() +int +_pthread_single_np(void) { /* Enter single-threaded (non-POSIX) scheduling mode: */ From owner-svn-src-all@freebsd.org Fri Apr 8 11:13:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF057B08D7E; Fri, 8 Apr 2016 11:13:25 +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 mx1.freebsd.org (Postfix) with ESMTPS id 815F8197D; Fri, 8 Apr 2016 11:13:25 +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 u38BDOWt084865; Fri, 8 Apr 2016 11:13:24 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38BDObQ084864; Fri, 8 Apr 2016 11:13:24 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201604081113.u38BDObQ084864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 8 Apr 2016 11:13:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297705 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 11:13:25 -0000 Author: ae Date: Fri Apr 8 11:13:24 2016 New Revision: 297705 URL: https://svnweb.freebsd.org/changeset/base/297705 Log: Fix regression introduced in r296986. Currently we don't keep zoneid in in6_ifaddr structure, because there is still some code, that doesn't properly initialize sin6_scope_id, but some functions use sa_equal() for addresses comparison. sa_equal() compares full sockaddr_in6 structures and such comparison will fail. For now use zero zoneid in in6ifa_ifwithaddr(). It is safe, because used address is in embedded form. In future we will use zoneid, so mark it with XXX comment. Reported by: kp Tested by: kp Modified: head/sys/netinet6/in6_src.c Modified: head/sys/netinet6/in6_src.c ============================================================================== --- head/sys/netinet6/in6_src.c Fri Apr 8 10:59:06 2016 (r297704) +++ head/sys/netinet6/in6_src.c Fri Apr 8 11:13:24 2016 (r297705) @@ -255,7 +255,7 @@ in6_selectsrc(uint32_t fibnum, struct so * ancillary data. */ if ((inp->inp_flags & INP_BINDANY) == 0) { - ia = in6ifa_ifwithaddr(&tmp, odstzone); + ia = in6ifa_ifwithaddr(&tmp, 0 /* XXX */); if (ia == NULL || (ia->ia6_flags & (IN6_IFF_ANYCAST | IN6_IFF_NOTREADY))) { if (ia != NULL) From owner-svn-src-all@freebsd.org Fri Apr 8 11:15:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E75D2B08E47; Fri, 8 Apr 2016 11:15:32 +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 mx1.freebsd.org (Postfix) with ESMTPS id 854011B0F; Fri, 8 Apr 2016 11:15:32 +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 u38BFVwp085028; Fri, 8 Apr 2016 11:15:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38BFQDQ084975; Fri, 8 Apr 2016 11:15:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201604081115.u38BFQDQ084975@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 8 Apr 2016 11:15:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297706 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 11:15:33 -0000 Author: kib Date: Fri Apr 8 11:15:26 2016 New Revision: 297706 URL: https://svnweb.freebsd.org/changeset/base/297706 Log: Use __FBSDID() for .c files from lib/libthr/thread. Sponsored by: The FreeBSD Foundation Modified: head/lib/libthr/thread/thr_affinity.c head/lib/libthr/thread/thr_attr.c head/lib/libthr/thread/thr_autoinit.c head/lib/libthr/thread/thr_barrier.c head/lib/libthr/thread/thr_barrierattr.c head/lib/libthr/thread/thr_cancel.c head/lib/libthr/thread/thr_clean.c head/lib/libthr/thread/thr_concurrency.c head/lib/libthr/thread/thr_cond.c head/lib/libthr/thread/thr_condattr.c head/lib/libthr/thread/thr_create.c head/lib/libthr/thread/thr_detach.c head/lib/libthr/thread/thr_equal.c head/lib/libthr/thread/thr_event.c head/lib/libthr/thread/thr_exit.c head/lib/libthr/thread/thr_fork.c head/lib/libthr/thread/thr_getcpuclockid.c head/lib/libthr/thread/thr_getprio.c head/lib/libthr/thread/thr_getschedparam.c head/lib/libthr/thread/thr_getthreadid_np.c head/lib/libthr/thread/thr_info.c head/lib/libthr/thread/thr_init.c head/lib/libthr/thread/thr_join.c head/lib/libthr/thread/thr_kern.c head/lib/libthr/thread/thr_kill.c head/lib/libthr/thread/thr_list.c head/lib/libthr/thread/thr_main_np.c head/lib/libthr/thread/thr_multi_np.c head/lib/libthr/thread/thr_mutex.c head/lib/libthr/thread/thr_mutexattr.c head/lib/libthr/thread/thr_once.c head/lib/libthr/thread/thr_printf.c head/lib/libthr/thread/thr_pspinlock.c head/lib/libthr/thread/thr_resume_np.c head/lib/libthr/thread/thr_rtld.c head/lib/libthr/thread/thr_rwlock.c head/lib/libthr/thread/thr_rwlockattr.c head/lib/libthr/thread/thr_self.c head/lib/libthr/thread/thr_sem.c head/lib/libthr/thread/thr_setprio.c head/lib/libthr/thread/thr_setschedparam.c head/lib/libthr/thread/thr_sig.c head/lib/libthr/thread/thr_single_np.c head/lib/libthr/thread/thr_sleepq.c head/lib/libthr/thread/thr_spec.c head/lib/libthr/thread/thr_spinlock.c head/lib/libthr/thread/thr_stack.c head/lib/libthr/thread/thr_suspend_np.c head/lib/libthr/thread/thr_switch_np.c head/lib/libthr/thread/thr_symbols.c head/lib/libthr/thread/thr_umtx.c head/lib/libthr/thread/thr_yield.c Modified: head/lib/libthr/thread/thr_affinity.c ============================================================================== --- head/lib/libthr/thread/thr_affinity.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_affinity.c Fri Apr 8 11:15:26 2016 (r297706) @@ -22,11 +22,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_attr.c ============================================================================== --- head/lib/libthr/thread/thr_attr.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_attr.c Fri Apr 8 11:15:26 2016 (r297706) @@ -89,10 +89,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_autoinit.c ============================================================================== --- head/lib/libthr/thread/thr_autoinit.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_autoinit.c Fri Apr 8 11:15:26 2016 (r297706) @@ -29,10 +29,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include #include "thr_private.h" Modified: head/lib/libthr/thread/thr_barrier.c ============================================================================== --- head/lib/libthr/thread/thr_barrier.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_barrier.c Fri Apr 8 11:15:26 2016 (r297706) @@ -22,10 +22,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_barrierattr.c ============================================================================== --- head/lib/libthr/thread/thr_barrierattr.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_barrierattr.c Fri Apr 8 11:15:26 2016 (r297706) @@ -24,10 +24,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_cancel.c ============================================================================== --- head/lib/libthr/thread/thr_cancel.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_cancel.c Fri Apr 8 11:15:26 2016 (r297706) @@ -22,11 +22,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include "un-namespace.h" Modified: head/lib/libthr/thread/thr_clean.c ============================================================================== --- head/lib/libthr/thread/thr_clean.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_clean.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,10 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_concurrency.c ============================================================================== --- head/lib/libthr/thread/thr_concurrency.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_concurrency.c Fri Apr 8 11:15:26 2016 (r297706) @@ -28,10 +28,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_cond.c ============================================================================== --- head/lib/libthr/thread/thr_cond.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_cond.c Fri Apr 8 11:15:26 2016 (r297706) @@ -26,10 +26,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_condattr.c ============================================================================== --- head/lib/libthr/thread/thr_condattr.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_condattr.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,10 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_create.c ============================================================================== --- head/lib/libthr/thread/thr_create.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_create.c Fri Apr 8 11:15:26 2016 (r297706) @@ -23,10 +23,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_detach.c ============================================================================== --- head/lib/libthr/thread/thr_detach.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_detach.c Fri Apr 8 11:15:26 2016 (r297706) @@ -23,11 +23,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_equal.c ============================================================================== --- head/lib/libthr/thread/thr_equal.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_equal.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,9 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include "un-namespace.h" Modified: head/lib/libthr/thread/thr_event.c ============================================================================== --- head/lib/libthr/thread/thr_event.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_event.c Fri Apr 8 11:15:26 2016 (r297706) @@ -22,10 +22,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "thr_private.h" void Modified: head/lib/libthr/thread/thr_exit.c ============================================================================== --- head/lib/libthr/thread/thr_exit.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_exit.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,10 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #ifdef _PTHREAD_FORCED_UNWIND Modified: head/lib/libthr/thread/thr_fork.c ============================================================================== --- head/lib/libthr/thread/thr_fork.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_fork.c Fri Apr 8 11:15:26 2016 (r297706) @@ -23,8 +23,6 @@ * 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$ */ /* @@ -57,6 +55,9 @@ * */ +#include +__FBSDID("$FreeBSD$"); + #include #include "namespace.h" #include Modified: head/lib/libthr/thread/thr_getcpuclockid.c ============================================================================== --- head/lib/libthr/thread/thr_getcpuclockid.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_getcpuclockid.c Fri Apr 8 11:15:26 2016 (r297706) @@ -22,10 +22,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_getprio.c ============================================================================== --- head/lib/libthr/thread/thr_getprio.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_getprio.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,9 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_getschedparam.c ============================================================================== --- head/lib/libthr/thread/thr_getschedparam.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_getschedparam.c Fri Apr 8 11:15:26 2016 (r297706) @@ -28,10 +28,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_getthreadid_np.c ============================================================================== --- head/lib/libthr/thread/thr_getthreadid_np.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_getthreadid_np.c Fri Apr 8 11:15:26 2016 (r297706) @@ -21,10 +21,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_info.c ============================================================================== --- head/lib/libthr/thread/thr_info.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_info.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,10 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_init.c ============================================================================== --- head/lib/libthr/thread/thr_init.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_init.c Fri Apr 8 11:15:26 2016 (r297706) @@ -29,10 +29,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_join.c ============================================================================== --- head/lib/libthr/thread/thr_join.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_join.c Fri Apr 8 11:15:26 2016 (r297706) @@ -22,11 +22,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_kern.c ============================================================================== --- head/lib/libthr/thread/thr_kern.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_kern.c Fri Apr 8 11:15:26 2016 (r297706) @@ -23,10 +23,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include #include #include Modified: head/lib/libthr/thread/thr_kill.c ============================================================================== --- head/lib/libthr/thread/thr_kill.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_kill.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,10 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_list.c ============================================================================== --- head/lib/libthr/thread/thr_list.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_list.c Fri Apr 8 11:15:26 2016 (r297706) @@ -23,10 +23,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include #include Modified: head/lib/libthr/thread/thr_main_np.c ============================================================================== --- head/lib/libthr/thread/thr_main_np.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_main_np.c Fri Apr 8 11:15:26 2016 (r297706) @@ -23,10 +23,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_multi_np.c ============================================================================== --- head/lib/libthr/thread/thr_multi_np.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_multi_np.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,10 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_mutex.c ============================================================================== --- head/lib/libthr/thread/thr_mutex.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_mutex.c Fri Apr 8 11:15:26 2016 (r297706) @@ -34,10 +34,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include #include "namespace.h" #include Modified: head/lib/libthr/thread/thr_mutexattr.c ============================================================================== --- head/lib/libthr/thread/thr_mutexattr.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_mutexattr.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,8 +25,6 @@ * 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$ */ /* @@ -59,6 +57,9 @@ * */ +#include +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_once.c ============================================================================== --- head/lib/libthr/thread/thr_once.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_once.c Fri Apr 8 11:15:26 2016 (r297706) @@ -22,11 +22,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include "un-namespace.h" Modified: head/lib/libthr/thread/thr_printf.c ============================================================================== --- head/lib/libthr/thread/thr_printf.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_printf.c Fri Apr 8 11:15:26 2016 (r297706) @@ -22,10 +22,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include #include #include Modified: head/lib/libthr/thread/thr_pspinlock.c ============================================================================== --- head/lib/libthr/thread/thr_pspinlock.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_pspinlock.c Fri Apr 8 11:15:26 2016 (r297706) @@ -26,10 +26,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_resume_np.c ============================================================================== --- head/lib/libthr/thread/thr_resume_np.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_resume_np.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,10 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_rtld.c ============================================================================== --- head/lib/libthr/thread/thr_rtld.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_rtld.c Fri Apr 8 11:15:26 2016 (r297706) @@ -22,11 +22,11 @@ * 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 +__FBSDID("$FreeBSD$"); + /* * A lockless rwlock for rtld. */ Modified: head/lib/libthr/thread/thr_rwlock.c ============================================================================== --- head/lib/libthr/thread/thr_rwlock.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_rwlock.c Fri Apr 8 11:15:26 2016 (r297706) @@ -22,10 +22,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include #include #include Modified: head/lib/libthr/thread/thr_rwlockattr.c ============================================================================== --- head/lib/libthr/thread/thr_rwlockattr.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_rwlockattr.c Fri Apr 8 11:15:26 2016 (r297706) @@ -22,10 +22,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_self.c ============================================================================== --- head/lib/libthr/thread/thr_self.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_self.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,10 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include "un-namespace.h" Modified: head/lib/libthr/thread/thr_sem.c ============================================================================== --- head/lib/libthr/thread/thr_sem.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_sem.c Fri Apr 8 11:15:26 2016 (r297706) @@ -26,10 +26,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_setprio.c ============================================================================== --- head/lib/libthr/thread/thr_setprio.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_setprio.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,10 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include "un-namespace.h" Modified: head/lib/libthr/thread/thr_setschedparam.c ============================================================================== --- head/lib/libthr/thread/thr_setschedparam.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_setschedparam.c Fri Apr 8 11:15:26 2016 (r297706) @@ -28,10 +28,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_sig.c Fri Apr 8 11:15:26 2016 (r297706) @@ -22,10 +22,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_single_np.c ============================================================================== --- head/lib/libthr/thread/thr_single_np.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_single_np.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,10 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_sleepq.c ============================================================================== --- head/lib/libthr/thread/thr_sleepq.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_sleepq.c Fri Apr 8 11:15:26 2016 (r297706) @@ -22,10 +22,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include #include "thr_private.h" Modified: head/lib/libthr/thread/thr_spec.c ============================================================================== --- head/lib/libthr/thread/thr_spec.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_spec.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,10 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_spinlock.c ============================================================================== --- head/lib/libthr/thread/thr_spinlock.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_spinlock.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,11 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include #include #include Modified: head/lib/libthr/thread/thr_stack.c ============================================================================== --- head/lib/libthr/thread/thr_stack.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_stack.c Fri Apr 8 11:15:26 2016 (r297706) @@ -23,10 +23,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include #include #include Modified: head/lib/libthr/thread/thr_suspend_np.c ============================================================================== --- head/lib/libthr/thread/thr_suspend_np.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_suspend_np.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,10 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_switch_np.c ============================================================================== --- head/lib/libthr/thread/thr_switch_np.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_switch_np.c Fri Apr 8 11:15:26 2016 (r297706) @@ -28,10 +28,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include Modified: head/lib/libthr/thread/thr_symbols.c ============================================================================== --- head/lib/libthr/thread/thr_symbols.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_symbols.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,10 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include #include #include Modified: head/lib/libthr/thread/thr_umtx.c ============================================================================== --- head/lib/libthr/thread/thr_umtx.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_umtx.c Fri Apr 8 11:15:26 2016 (r297706) @@ -22,11 +22,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "thr_private.h" #include "thr_umtx.h" Modified: head/lib/libthr/thread/thr_yield.c ============================================================================== --- head/lib/libthr/thread/thr_yield.c Fri Apr 8 11:13:24 2016 (r297705) +++ head/lib/libthr/thread/thr_yield.c Fri Apr 8 11:15:26 2016 (r297706) @@ -25,10 +25,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "namespace.h" #include #include From owner-svn-src-all@freebsd.org Fri Apr 8 11:20:57 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AACD7B08062; Fri, 8 Apr 2016 11:20:57 +0000 (UTC) (envelope-from wma@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 mx1.freebsd.org (Postfix) with ESMTPS id 7A8E31E41; Fri, 8 Apr 2016 11:20:57 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38BKupo085363; Fri, 8 Apr 2016 11:20:56 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38BKuD1085362; Fri, 8 Apr 2016 11:20:56 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201604081120.u38BKuD1085362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Fri, 8 Apr 2016 11:20:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297707 - head/sys/dev/vnic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 11:20:57 -0000 Author: wma Date: Fri Apr 8 11:20:56 2016 New Revision: 297707 URL: https://svnweb.freebsd.org/changeset/base/297707 Log: Speedup BGX link polling on ARM64 The previous values caused the callout thread stall for 100ms each 2s if no link is present. Dtrace analysis showed that it has significant impact on overall interrupt performance. Decrease these values by a factor of 100. Obtained from: Semihalf Sponsored by: Cavium Reviewed by: zbb Differential Revision: https://reviews.freebsd.org/D5854 Modified: head/sys/dev/vnic/thunder_bgx.c Modified: head/sys/dev/vnic/thunder_bgx.c ============================================================================== --- head/sys/dev/vnic/thunder_bgx.c Fri Apr 8 11:15:26 2016 (r297706) +++ head/sys/dev/vnic/thunder_bgx.c Fri Apr 8 11:20:56 2016 (r297707) @@ -240,7 +240,7 @@ static int bgx_poll_reg(struct bgx *bgx, uint8_t lmac, uint64_t reg, uint64_t mask, boolean_t zero) { - int timeout = 100; + int timeout = 10; uint64_t reg_val; while (timeout) { @@ -250,7 +250,7 @@ bgx_poll_reg(struct bgx *bgx, uint8_t lm if (!zero && (reg_val & mask)) return (0); - DELAY(1000); + DELAY(100); timeout--; } return (ETIMEDOUT); From owner-svn-src-all@freebsd.org Fri Apr 8 11:43:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A5B0B087CB; Fri, 8 Apr 2016 11:43:24 +0000 (UTC) (envelope-from fanf@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 mx1.freebsd.org (Postfix) with ESMTPS id B5B7619ED; Fri, 8 Apr 2016 11:43:23 +0000 (UTC) (envelope-from fanf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38BhMoh094084; Fri, 8 Apr 2016 11:43:22 GMT (envelope-from fanf@FreeBSD.org) Received: (from fanf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38BhMah094083; Fri, 8 Apr 2016 11:43:22 GMT (envelope-from fanf@FreeBSD.org) Message-Id: <201604081143.u38BhMah094083@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fanf set sender to fanf@FreeBSD.org using -f From: Tony Finch Date: Fri, 8 Apr 2016 11:43:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297708 - head/usr.bin/whois X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 11:43:24 -0000 Author: fanf Date: Fri Apr 8 11:43:22 2016 New Revision: 297708 URL: https://svnweb.freebsd.org/changeset/base/297708 Log: Handle whois referrals between RIRs This is rather ugly, because the RIPE and APNIC whois servers do not provide referrals for address blocks that they do not manage. However ARIN is usually the right place or knows the right place so we try there. The particular instance which clued me in to this bug is U.Mich. 141.211.0.0/16 for which the referral chain should be IANA -> RIPE -> ARIN. RIPE's RDAP does provide useful redirects (for example try `curl -I http://rdap.db.ripe.net/ip/141.211.0.0) so maybe their whois server can be improved. AfriNIC's whois server gives more direct referrals, but they are designed to be human-readable. Ugly, but we can manage. The issue of referrals between RIRs is likely to become more important in the future whith the increasing number of cross-region IP address block transfers increases. Modified: head/usr.bin/whois/whois.c Modified: head/usr.bin/whois/whois.c ============================================================================== --- head/usr.bin/whois/whois.c Fri Apr 8 11:20:56 2016 (r297707) +++ head/usr.bin/whois/whois.c Fri Apr 8 11:43:22 2016 (r297708) @@ -114,9 +114,16 @@ static struct { WHOIS_REFERRAL("Whois Server:"), WHOIS_REFERRAL("Registrar WHOIS Server:"), /* corporatedomains.com */ WHOIS_REFERRAL("ReferralServer: whois://"), /* ARIN */ + WHOIS_REFERRAL("descr: region. Please query"), /* AfriNIC */ { NULL, 0 } }; +static const char *actually_arin[] = { + "netname: ERX-NETBLOCK\n", /* APNIC */ + "netname: NON-RIPE-NCC-MANAGED-ADDRESS-BLOCK\n", + NULL +}; + static const char *port = DEFAULT_PORT; static const char *choose_server(char *); @@ -469,6 +476,12 @@ done: (int)(p - host), host); break; } + for (i = 0; actually_arin[i] != NULL; i++) { + if (strncmp(buf, actually_arin[i], len) == 0) { + s_asprintf(&nhost, "%s", ANICHOST); + break; + } + } } /* Verisign etc. */ if (!(flags & WHOIS_SPAM_ME) && From owner-svn-src-all@freebsd.org Fri Apr 8 11:58:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95BF1B08AA2; Fri, 8 Apr 2016 11:58:25 +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 mx1.freebsd.org (Postfix) with ESMTPS id 66F621ECF; Fri, 8 Apr 2016 11:58:25 +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 u38BwOjv097376; Fri, 8 Apr 2016 11:58:24 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38BwO50097375; Fri, 8 Apr 2016 11:58:24 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201604081158.u38BwO50097375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 8 Apr 2016 11:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297709 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 11:58:25 -0000 Author: avg Date: Fri Apr 8 11:58:24 2016 New Revision: 297709 URL: https://svnweb.freebsd.org/changeset/base/297709 Log: zio write issue threads should have lower (numerically greater) priority This is because they might do data compression which is quite CPU expensive. The original code is correct for illumos, because there a higher priority corresponds to a greater number. MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Apr 8 11:43:22 2016 (r297708) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Apr 8 11:58:24 2016 (r297709) @@ -929,7 +929,7 @@ spa_taskqs_init(spa_t *spa, zio_type_t t * than the other taskqs. */ if (t == ZIO_TYPE_WRITE && q == ZIO_TASKQ_ISSUE) - pri--; + pri++; tq = taskq_create_proc(name, value, pri, 50, INT_MAX, spa->spa_proc, flags); From owner-svn-src-all@freebsd.org Fri Apr 8 11:59:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68414B08B1B; Fri, 8 Apr 2016 11:59:12 +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 mx1.freebsd.org (Postfix) with ESMTPS id 390A6105D; Fri, 8 Apr 2016 11:59:12 +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 u38BxBef097445; Fri, 8 Apr 2016 11:59:11 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38BxBkO097444; Fri, 8 Apr 2016 11:59:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201604081159.u38BxBkO097444@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 8 Apr 2016 11:59:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297710 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 11:59:12 -0000 Author: avg Date: Fri Apr 8 11:59:11 2016 New Revision: 297710 URL: https://svnweb.freebsd.org/changeset/base/297710 Log: topo_set_pu_id: turn a check into an assertion The new id must not be present in any cpu set in any topology element. MFC after: 30 days Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Fri Apr 8 11:58:24 2016 (r297709) +++ head/sys/kern/subr_smp.c Fri Apr 8 11:59:11 2016 (r297710) @@ -1029,8 +1029,8 @@ topo_set_pu_id(struct topo_node *node, c node->subtype = 1; while ((node = node->parent) != NULL) { - if (CPU_ISSET(id, &node->cpuset)) - break; + KASSERT(!CPU_ISSET(id, &node->cpuset), + ("logical ID %u is already set in node %p", id, node)); CPU_SET(id, &node->cpuset); node->cpu_count++; } From owner-svn-src-all@freebsd.org Fri Apr 8 13:43:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A68C9B085B5; Fri, 8 Apr 2016 13:43:40 +0000 (UTC) (envelope-from sbruno@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 mx1.freebsd.org (Postfix) with ESMTPS id 76B001158; Fri, 8 Apr 2016 13:43:40 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38DhdR1032646; Fri, 8 Apr 2016 13:43:39 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38DhdC2032644; Fri, 8 Apr 2016 13:43:39 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201604081343.u38DhdC2032644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Fri, 8 Apr 2016 13:43:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297711 - in stable/10/sys/cam: ata scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 13:43:40 -0000 Author: sbruno Date: Fri Apr 8 13:43:39 2016 New Revision: 297711 URL: https://svnweb.freebsd.org/changeset/base/297711 Log: Revert svn 297681 as it has been deprecated by svn 297575. Submitted by: Tomoaki AOKI Modified: stable/10/sys/cam/ata/ata_da.c stable/10/sys/cam/scsi/scsi_da.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ata/ata_da.c ============================================================================== --- stable/10/sys/cam/ata/ata_da.c Fri Apr 8 11:59:11 2016 (r297710) +++ stable/10/sys/cam/ata/ata_da.c Fri Apr 8 13:43:39 2016 (r297711) @@ -485,14 +485,6 @@ static struct ada_quirk_entry ada_quirk_ }, { /* - * Samsung SM863 Series SSDs - * 4k optimised - */ - { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG MZ7KM*", "*" }, - /*quirks*/ADA_Q_4K - }, - { - /* * SuperTalent TeraDrive CT SSDs * 4k optimised & trim only works in 4k requests + 4k aligned */ Modified: stable/10/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_da.c Fri Apr 8 11:59:11 2016 (r297710) +++ stable/10/sys/cam/scsi/scsi_da.c Fri Apr 8 13:43:39 2016 (r297711) @@ -1157,14 +1157,6 @@ static struct da_quirk_entry da_quirk_ta }, { /* - * Samsung SM863 Series SSDs - * 4k optimised - */ - { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG MZ7KM*", "*" }, - /*quirks*/DA_Q_4K - }, - { - /* * SuperTalent TeraDrive CT SSDs * 4k optimised & trim only works in 4k requests + 4k aligned */ From owner-svn-src-all@freebsd.org Fri Apr 8 15:05:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C2BCB0800F; Fri, 8 Apr 2016 15:05:07 +0000 (UTC) (envelope-from allanjude@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 mx1.freebsd.org (Postfix) with ESMTPS id 4D2F21543; Fri, 8 Apr 2016 15:05:07 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38F56mm056216; Fri, 8 Apr 2016 15:05:06 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38F567f056215; Fri, 8 Apr 2016 15:05:06 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201604081505.u38F567f056215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Fri, 8 Apr 2016 15:05:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297712 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 15:05:07 -0000 Author: allanjude Date: Fri Apr 8 15:05:06 2016 New Revision: 297712 URL: https://svnweb.freebsd.org/changeset/base/297712 Log: Do not add swap to fstab when swapsize is 0 If a user requested encrypted swap, but 0 sized, it would still be added to fstab PR: 208630 Submitted by: Ganael LAPLANCHE MFC after: 2 weeks Sponsored by: ScaleEngine Inc. Modified: head/usr.sbin/bsdinstall/scripts/zfsboot Modified: head/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- head/usr.sbin/bsdinstall/scripts/zfsboot Fri Apr 8 13:43:39 2016 (r297711) +++ head/usr.sbin/bsdinstall/scripts/zfsboot Fri Apr 8 15:05:06 2016 (r297712) @@ -964,6 +964,8 @@ zfs_create_diskpart() f_expand_number "$ZFSBOOT_SWAP_SIZE" swapsize if [ "$isswapmirror" ]; then # This is not the first disk in the mirror, do nothing + elif [ ${swapsize:-0} -eq 0 ]; then + # If swap is 0 sized, don't add it to fstab elif [ "$ZFSBOOT_SWAP_ENCRYPTION" -a "$ZFSBOOT_SWAP_MIRROR" ]; then f_eval_catch $funcname printf "$PRINTF_FSTAB" \ /dev/mirror/swap.eli none swap sw 0 0 \ @@ -981,8 +983,6 @@ zfs_create_diskpart() /dev/$disk${swappart}.eli none swap sw 0 0 \ $BSDINSTALL_TMPETC/fstab || return $FAILURE - elif [ ${swapsize:-0} -eq 0 ]; then - # If swap is 0 sized, don't add it to fstab else f_eval_catch $funcname printf "$PRINTF_FSTAB" \ /dev/$disk$swappart none swap sw 0 0 \ From owner-svn-src-all@freebsd.org Fri Apr 8 15:08:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38D8CB0815D; Fri, 8 Apr 2016 15:08:23 +0000 (UTC) (envelope-from allanjude@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 mx1.freebsd.org (Postfix) with ESMTPS id 097BE182A; Fri, 8 Apr 2016 15:08:22 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38F8MAx056368; Fri, 8 Apr 2016 15:08:22 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38F8MgJ056367; Fri, 8 Apr 2016 15:08:22 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201604081508.u38F8MgJ056367@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Fri, 8 Apr 2016 15:08:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297713 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 15:08:23 -0000 Author: allanjude Date: Fri Apr 8 15:08:22 2016 New Revision: 297713 URL: https://svnweb.freebsd.org/changeset/base/297713 Log: bsdinstall/zfsboot should create /tmp and /var/tmp if they do not exist PR: 208629 PR: 208568 Submitted by: Galael LAPLANCHE MFC after: 2 weeks Modified: head/usr.sbin/bsdinstall/scripts/zfsboot Modified: head/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- head/usr.sbin/bsdinstall/scripts/zfsboot Fri Apr 8 15:05:06 2016 (r297712) +++ head/usr.sbin/bsdinstall/scripts/zfsboot Fri Apr 8 15:08:22 2016 (r297713) @@ -1256,6 +1256,8 @@ zfs_create_boot() f_dprintf "$funcname: Modifying directory permissions..." local dir for dir in /tmp /var/tmp; do + f_eval_catch $funcname mkdir "$MKDIR_P" \ + $BSDINSTALL_CHROOT$dir || return $FAILURE f_eval_catch $funcname chmod "$CHMOD_MODE" 1777 \ $BSDINSTALL_CHROOT$dir || return $FAILURE done From owner-svn-src-all@freebsd.org Fri Apr 8 15:13:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3532B083D9; Fri, 8 Apr 2016 15:13:39 +0000 (UTC) (envelope-from sgalabov@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 mx1.freebsd.org (Postfix) with ESMTPS id 741451D41; Fri, 8 Apr 2016 15:13:39 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38FDcve059210; Fri, 8 Apr 2016 15:13:38 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38FDcTf059209; Fri, 8 Apr 2016 15:13:38 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201604081513.u38FDcTf059209@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Fri, 8 Apr 2016 15:13:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297714 - head/sys/mips/mediatek X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 15:13:39 -0000 Author: sgalabov Date: Fri Apr 8 15:13:38 2016 New Revision: 297714 URL: https://svnweb.freebsd.org/changeset/base/297714 Log: Fix wrong memory mapping In mtk_soc.c memory is mapped incorrectly for MT7621. This revision fixes this. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5882 Modified: head/sys/mips/mediatek/mtk_soc.c Modified: head/sys/mips/mediatek/mtk_soc.c ============================================================================== --- head/sys/mips/mediatek/mtk_soc.c Fri Apr 8 15:08:22 2016 (r297713) +++ head/sys/mips/mediatek/mtk_soc.c Fri Apr 8 15:13:38 2016 (r297714) @@ -257,7 +257,7 @@ mtk_soc_try_early_detect(void) else base = MTK_DEFAULT_BASE; - if (bus_space_map(bst, MTK_DEFAULT_BASE, MTK_DEFAULT_SIZE, 0, &bsh)) + if (bus_space_map(bst, base, MTK_DEFAULT_SIZE, 0, &bsh)) return; /* First, figure out the CPU clock */ From owner-svn-src-all@freebsd.org Fri Apr 8 15:21:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00D8FB08700; Fri, 8 Apr 2016 15:21:00 +0000 (UTC) (envelope-from sgalabov@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 mx1.freebsd.org (Postfix) with ESMTPS id AA03C12C7; Fri, 8 Apr 2016 15:20:59 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38FKwBN059611; Fri, 8 Apr 2016 15:20:58 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38FKw5i059610; Fri, 8 Apr 2016 15:20:58 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201604081520.u38FKw5i059610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Fri, 8 Apr 2016 15:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297715 - head/sys/mips/mediatek X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 15:21:00 -0000 Author: sgalabov Date: Fri Apr 8 15:20:58 2016 New Revision: 297715 URL: https://svnweb.freebsd.org/changeset/base/297715 Log: Disable USB PHY slew rate calibration for Mediatek SoCs for now USB on both MT7621 and MT7688 seems to work much better without doing slew rate calibration. These are the only two SoCs, apart from MT7628, which actually make use of the slew rate calibration routines implemented in the mtk_usb_phy driver. Since MT7628 is actually a superset of MT7688 things should be the same for it as well. We do not remove the code, we simply define it out. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5884 Modified: head/sys/mips/mediatek/mtk_usb_phy.c Modified: head/sys/mips/mediatek/mtk_usb_phy.c ============================================================================== --- head/sys/mips/mediatek/mtk_usb_phy.c Fri Apr 8 15:13:38 2016 (r297714) +++ head/sys/mips/mediatek/mtk_usb_phy.c Fri Apr 8 15:20:58 2016 (r297715) @@ -206,6 +206,11 @@ mtk_usb_phy_detach(device_t dev) return (0); } +/* + * Things currently seem to work a lot better without slew rate calibration + * both on MT7621 and MT7688, so we leave it out for now. + */ +#ifdef notyet static void mtk_usb_phy_slew_rate_calibration(struct mtk_usb_phy_softc *sc) { @@ -250,10 +255,12 @@ mtk_usb_phy_slew_rate_calibration(struct USB_PHY_BARRIER(sc); } } +#endif static void mtk_usb_phy_mt7621_init(device_t dev) { +#ifdef notyet struct mtk_usb_phy_softc *sc = device_get_softc(dev); /* Slew rate calibration only, but for 2 ports */ @@ -261,6 +268,7 @@ mtk_usb_phy_mt7621_init(device_t dev) sc->u2_base = MT7621_U2_BASE_P1; mtk_usb_phy_slew_rate_calibration(sc); +#endif } static void @@ -286,8 +294,10 @@ mtk_usb_phy_mt7628_init(device_t dev) USB_PHY_WRITE_U2(sc, U2_PHY_DTM0, 0x02000000); USB_PHY_BARRIER(sc); +#ifdef notyet /* Slew rate calibration */ - //mtk_usb_phy_slew_rate_calibration(sc); + mtk_usb_phy_slew_rate_calibration(sc); +#endif } static device_method_t mtk_usb_phy_methods[] = { From owner-svn-src-all@freebsd.org Fri Apr 8 15:22:32 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38E4FB0881F; Fri, 8 Apr 2016 15:22:32 +0000 (UTC) (envelope-from sgalabov@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 mx1.freebsd.org (Postfix) with ESMTPS id 10BCA15BD; Fri, 8 Apr 2016 15:22:31 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38FMVRJ062483; Fri, 8 Apr 2016 15:22:31 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38FMVqK062482; Fri, 8 Apr 2016 15:22:31 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201604081522.u38FMVqK062482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Fri, 8 Apr 2016 15:22:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297716 - head/sys/mips/mediatek X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 15:22:32 -0000 Author: sgalabov Date: Fri Apr 8 15:22:30 2016 New Revision: 297716 URL: https://svnweb.freebsd.org/changeset/base/297716 Log: Introduce XHCI support for MT7621 SoC Tested on a MT7621 board, similar to the WiTi board. More testing will be required to confirm everything is fine, but things look good so far. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5885 Added: head/sys/mips/mediatek/mtk_xhci.c (contents, props changed) Added: head/sys/mips/mediatek/mtk_xhci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_xhci.c Fri Apr 8 15:22:30 2016 (r297716) @@ -0,0 +1,298 @@ +#include +__FBSDID("$FreeBSD$"); + +/*- + * Copyright (c) 2015 Stanislav Galabov. All rights reserved. + * Copyright (c) 2010,2011 Aleksandr Rybalko. All rights reserved. + * Copyright (c) 2007-2008 Hans Petter Selasky. 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + +#define XHCI_HC_DEVSTR "MTK USB 3.0 controller" + +static device_probe_t mtk_xhci_fdt_probe; +static device_attach_t mtk_xhci_fdt_attach; +static device_detach_t mtk_xhci_fdt_detach; + +static void mtk_xhci_fdt_init(device_t dev); + +static int +mtk_xhci_fdt_probe(device_t self) +{ + + if (!ofw_bus_status_okay(self)) + return (ENXIO); + + if (!ofw_bus_is_compatible(self, "mtk,usb-xhci")) + return (ENXIO); + + device_set_desc(self, XHCI_HC_DEVSTR); + + return (BUS_PROBE_DEFAULT); +} + +static int +mtk_xhci_fdt_attach(device_t self) +{ + struct xhci_softc *sc = device_get_softc(self); + int err; + int rid; + + /* initialise some bus fields */ + sc->sc_bus.parent = self; + sc->sc_bus.devices = sc->sc_devices; + sc->sc_bus.devices_max = XHCI_MAX_DEVICES; + sc->sc_bus.dma_bits = 32; + + rid = 0; + sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->sc_io_res) { + device_printf(self, "Could not map memory\n"); + goto error; + } + sc->sc_io_tag = rman_get_bustag(sc->sc_io_res); + sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res); + sc->sc_io_size = rman_get_size(sc->sc_io_res); + + mtk_xhci_fdt_init(self); + + rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + if (sc->sc_irq_res == NULL) { + device_printf(self, "Could not allocate irq\n"); + goto error; + } + + sc->sc_bus.bdev = device_add_child(self, "usbus", -1); + if (!(sc->sc_bus.bdev)) { + device_printf(self, "Could not add USB device\n"); + goto error; + } + device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus); + device_set_desc(sc->sc_bus.bdev, XHCI_HC_DEVSTR); + + sprintf(sc->sc_vendor, "Mediatek"); + + err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + NULL, (driver_intr_t *)xhci_interrupt, sc, &sc->sc_intr_hdl); + if (err) { + device_printf(self, "Could not setup irq, %d\n", err); + sc->sc_intr_hdl = NULL; + goto error; + } + + err = xhci_init(sc, self, 1); + if (err == 0) + err = xhci_halt_controller(sc); + if (err == 0) + err = xhci_start_controller(sc); + if (err == 0) + err = device_probe_and_attach(sc->sc_bus.bdev); + if (err) { + device_printf(self, "USB init failed err=%d\n", err); + goto error; + } + return (0); + +error: + mtk_xhci_fdt_detach(self); + return (ENXIO); +} + +static int +mtk_xhci_fdt_detach(device_t self) +{ + struct xhci_softc *sc = device_get_softc(self); + device_t bdev; + int err; + + if (sc->sc_bus.bdev) { + bdev = sc->sc_bus.bdev; + device_detach(bdev); + device_delete_child(self, bdev); + } + /* during module unload there are lots of children leftover */ + device_delete_children(self); + + if (sc->sc_irq_res && sc->sc_intr_hdl) { + /* + * only call xhci_detach() after xhci_init() + */ + xhci_uninit(sc); + + err = bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl); + if (err) + device_printf(self, "Could not tear down irq, %d\n", + err); + sc->sc_intr_hdl = NULL; + } + if (sc->sc_irq_res) { + bus_release_resource(self, SYS_RES_IRQ, 0, + sc->sc_irq_res); + sc->sc_irq_res = NULL; + } + if (sc->sc_io_res) { + bus_release_resource(self, SYS_RES_MEMORY, 0, + sc->sc_io_res); + sc->sc_io_res = NULL; + } + + return (0); +} + +static device_method_t mtk_xhci_fdt_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, mtk_xhci_fdt_probe), + DEVMETHOD(device_attach, mtk_xhci_fdt_attach), + DEVMETHOD(device_detach, mtk_xhci_fdt_detach), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + + DEVMETHOD_END +}; + +static driver_t mtk_xhci_fdt_driver = { + .name = "xhci", + .methods = mtk_xhci_fdt_methods, + .size = sizeof(struct xhci_softc), +}; + +static devclass_t mtk_xhci_fdt_devclass; + +DRIVER_MODULE(xhci, simplebus, mtk_xhci_fdt_driver, mtk_xhci_fdt_devclass, 0, + 0); + +#define USB_HDMA_CFG 0x950 +#define USB_HDMA_CFG_MT7621_VAL 0x10E0E0C + +#define U3_LTSSM_TIMING_PARAM3 0x2514 +#define U3_LTSSM_TIMING_VAL 0x3E8012C + +#define SYNC_HS_EOF 0x938 +#define SYNC_HS_EOF_VAL 0x201F3 + +#define USB_IP_SPAR0 0x107C8 +#define USB_IP_SPAR0_VAL 1 + +#define U2_PHY_BASE_P0 0x10800 +#define U2_PHY_BASE_P1 0x11000 +#define U2_PHYD_CR1 0x64 +#define U2_PHYD_CR1_MASK (3<<18) +#define U2_PHYD_CR1_VAL (1<<18) + +#define USB_IP_PW_CTRL 0x10700 +#define USB_IP_PW_CTRL_1 0x10704 +#define USB_IP_CAP 0x10724 +#define USB_U3_CTRL(p) (0x10730 + ((p) * 0x08)) +#define USB_U2_CTRL(p) (0x10750 + ((p) * 0x08)) + +#define USB_IP_SW_RST (1 << 0) +#define USB_IP_PDN (1 << 0) + +#define USB_PORT_DIS (1 << 0) +#define USB_PORT_PDN (1 << 1) + +#define U3_PORT_NUM(p) (p & 0xFF) +#define U2_PORT_NUM(p) ((p>>8) & 0xFF) + +#define RD4(_sc, _reg) bus_read_4((_sc)->sc_io_res, (_reg)) +#define WR4(_sc, _reg, _val) bus_write_4((_sc)->sc_io_res, (_reg), (_val)) +#define CLRSET4(_sc, _reg, _clr, _set) \ + WR4((_sc), (_reg), (RD4((_sc), (_reg)) & ~(_clr)) | (_set)) + +static void +mtk_xhci_fdt_init(device_t dev) +{ + struct xhci_softc *sc; + uint32_t temp, u3_ports, u2_ports, i; + + sc = device_get_softc(dev); + + temp = RD4(sc, USB_IP_CAP); + u3_ports = U3_PORT_NUM(temp); + u2_ports = U2_PORT_NUM(temp); + + device_printf(dev, "%d USB3 ports, %d USB2 ports\n", + u3_ports, u2_ports); + + CLRSET4(sc, USB_IP_PW_CTRL, 0, USB_IP_SW_RST); + CLRSET4(sc, USB_IP_PW_CTRL, USB_IP_SW_RST, 0); + CLRSET4(sc, USB_IP_PW_CTRL_1, USB_IP_PDN, 0); + + for (i = 0; i < u3_ports; i++) + CLRSET4(sc, USB_U3_CTRL(i), USB_PORT_PDN | USB_PORT_DIS, 0); + + for (i = 0; i < u2_ports; i++) + CLRSET4(sc, USB_U2_CTRL(i), USB_PORT_PDN | USB_PORT_DIS, 0); + + DELAY(100000); + + WR4(sc, USB_HDMA_CFG, USB_HDMA_CFG_MT7621_VAL); + WR4(sc, U3_LTSSM_TIMING_PARAM3, U3_LTSSM_TIMING_VAL); + WR4(sc, SYNC_HS_EOF, SYNC_HS_EOF_VAL); + WR4(sc, USB_IP_SPAR0, USB_IP_SPAR0_VAL); + CLRSET4(sc, U2_PHY_BASE_P0 + U2_PHYD_CR1, U2_PHYD_CR1_MASK, + U2_PHYD_CR1_VAL); + CLRSET4(sc, U2_PHY_BASE_P1 + U2_PHYD_CR1, U2_PHYD_CR1_MASK, + U2_PHYD_CR1_VAL); +} From owner-svn-src-all@freebsd.org Fri Apr 8 15:26:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFB73B0893F; Fri, 8 Apr 2016 15:26:50 +0000 (UTC) (envelope-from sgalabov@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 mx1.freebsd.org (Postfix) with ESMTPS id 98AEF189D; Fri, 8 Apr 2016 15:26:50 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38FQntM062654; Fri, 8 Apr 2016 15:26:49 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38FQnvC062652; Fri, 8 Apr 2016 15:26:49 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201604081526.u38FQnvC062652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Fri, 8 Apr 2016 15:26:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297717 - head/sys/mips/mediatek X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 15:26:50 -0000 Author: sgalabov Date: Fri Apr 8 15:26:49 2016 New Revision: 297717 URL: https://svnweb.freebsd.org/changeset/base/297717 Log: Introduce Mediatek/Ralink PCIe support This revision introduces PCIe support for the relevant Mediatek/Ralink SoCs. Currently the PCIe support is not converted to INTRNG, this may be a task for the future. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5886 Added: head/sys/mips/mediatek/mtk_pcie.c (contents, props changed) head/sys/mips/mediatek/mtk_pcie.h (contents, props changed) Added: head/sys/mips/mediatek/mtk_pcie.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/mtk_pcie.c Fri Apr 8 15:26:49 2016 (r297717) @@ -0,0 +1,1489 @@ +/*- + * Copyright (c) 2016 Stanislav Galabov. + * + * 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. + * + * The pci allocator parts are based on code from sys/dev/arm/mv/: + * + * Copyright (c) 2008 MARVELL INTERNATIONAL LTD. + * Copyright (c) 2010 The FreeBSD Foundation + * Copyright (c) 2010-2012 Semihalf + * All rights reserved. + * + * Developed by Semihalf. + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "pcib_if.h" +#include "pic_if.h" + +/* + * Note: We only support PCIe at the moment. + * Most SoCs in the Ralink/Mediatek family that we target actually don't + * support PCI anyway, with the notable exceptions being RT3662/RT3883, which + * support both PCI and PCIe. If there exists a board based on one of them + * which is of interest in the future it shouldn't be too hard to enable PCI + * support for it. + */ + +/* Chip specific function declarations */ +static int mtk_pcie_phy_init(device_t); +static int mtk_pcie_phy_start(device_t); +static int mtk_pcie_phy_stop(device_t); +static int mtk_pcie_phy_mt7621_init(device_t); +static int mtk_pcie_phy_mt7628_init(device_t); +static int mtk_pcie_phy_mt7620_init(device_t); +static int mtk_pcie_phy_rt3883_init(device_t); +static void mtk_pcie_phy_setup_slots(device_t); + +/* Generic declarations */ +struct mtx mtk_pci_mtx; +MTX_SYSINIT(mtk_pci_mtx, &mtk_pci_mtx, "MTK PCIe mutex", MTX_SPIN); + +static int mtk_pcib_init(device_t, int, int); +static int mtk_pci_intr(void *); + +static struct mtk_pci_softc *mt_sc = NULL; + +struct mtk_pci_range { + u_long base; + u_long len; +}; + +#define FDT_RANGES_CELLS (3 * 2) + +static void +mtk_pci_range_dump(struct mtk_pci_range *range) +{ +#ifdef DEBUG + printf("\n"); + printf(" base = 0x%08lx\n", range->base); + printf(" len = 0x%08lx\n", range->len); +#endif +} + +static int +mtk_pci_ranges_decode(phandle_t node, struct mtk_pci_range *io_space, + struct mtk_pci_range *mem_space) +{ + struct mtk_pci_range *pci_space; + pcell_t ranges[FDT_RANGES_CELLS]; + pcell_t *rangesptr; + pcell_t cell0, cell1, cell2; + int tuples, i, rv, len; + + /* + * Retrieve 'ranges' property. + */ + if (!OF_hasprop(node, "ranges")) { + printf("%s: %d\n", __FUNCTION__, 1); + return (EINVAL); + } + + len = OF_getproplen(node, "ranges"); + if (len > sizeof(ranges)) { + printf("%s: %d\n", __FUNCTION__, 2); + return (ENOMEM); + } + + if (OF_getprop(node, "ranges", ranges, sizeof(ranges)) <= 0) { + printf("%s: %d\n", __FUNCTION__, 3); + return (EINVAL); + } + + tuples = len / (sizeof(pcell_t) * 3); + + /* + * Initialize the ranges so that we don't have to worry about + * having them all defined in the FDT. In particular, it is + * perfectly fine not to want I/O space on PCI busses. + */ + bzero(io_space, sizeof(*io_space)); + bzero(mem_space, sizeof(*mem_space)); + + rangesptr = &ranges[0]; + for (i = 0; i < tuples; i++) { + cell0 = fdt_data_get((void *)rangesptr, 1); + rangesptr++; + cell1 = fdt_data_get((void *)rangesptr, 1); + rangesptr++; + cell2 = fdt_data_get((void *)rangesptr, 1); + rangesptr++; + + if (cell0 == 2) { + pci_space = mem_space; + } else if (cell0 == 1) { + pci_space = io_space; + } else { + rv = ERANGE; + printf("%s: %d\n", __FUNCTION__, 4); + goto out; + } + + pci_space->base = cell1; + pci_space->len = cell2; + } + + rv = 0; +out: + return (rv); +} + +static int +mtk_pci_ranges(phandle_t node, struct mtk_pci_range *io_space, + struct mtk_pci_range *mem_space) +{ + int err; + + if ((err = mtk_pci_ranges_decode(node, io_space, mem_space)) != 0) { + return (err); + } + + mtk_pci_range_dump(io_space); + mtk_pci_range_dump(mem_space); + + return (0); +} + +static struct ofw_compat_data compat_data[] = { + { "ralink,rt3662-pcie", MTK_SOC_RT3883 }, + { "ralink,rt3883-pcie", MTK_SOC_RT3883 }, + { "ralink,mt7620a-pcie", MTK_SOC_MT7620A }, + { "ralink,mt7621-pcie", MTK_SOC_MT7621 }, + { "ralink,mt7628-pcie", MTK_SOC_MT7628 }, + { "ralink,mt7688-pcie", MTK_SOC_MT7628 }, + { NULL, MTK_SOC_UNKNOWN } +}; + +static int +mtk_pci_probe(device_t dev) +{ + struct mtk_pci_softc *sc = device_get_softc(dev); + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + sc->socid = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + if (sc->socid == MTK_SOC_UNKNOWN) + return (ENXIO); + + device_set_desc(dev, "MTK PCIe Controller"); + + return (0); +} + +static int +mtk_pci_attach(device_t dev) +{ + struct mtk_pci_softc *sc = device_get_softc(dev); + struct mtk_pci_range io_space, mem_space; + phandle_t node; + intptr_t xref; + int i, rid; + + sc->sc_dev = dev; + mt_sc = sc; + sc->addr_mask = 0xffffffff; + + /* Request our memory */ + rid = 0; + sc->pci_res[0] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->pci_res[0] == NULL) { + device_printf(dev, "could not allocate memory resource\n"); + return (ENXIO); + } + + /* See how many interrupts we need */ + if (sc->socid == MTK_SOC_MT7621) + sc->sc_num_irq = 3; + else { + sc->sc_num_irq = 1; + sc->pci_res[2] = sc->pci_res[3] = NULL; + sc->pci_intrhand[1] = sc->pci_intrhand[2] = NULL; + } + + /* Request our interrupts */ + for (i = 1; i <= sc->sc_num_irq ; i++) { + rid = i - 1; + sc->pci_res[i] = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (sc->pci_res[i] == NULL) { + device_printf(dev, "could not allocate interrupt " + "resource %d\n", rid); + goto cleanup_res; + } + } + + /* Parse our PCI 'ranges' property */ + node = ofw_bus_get_node(dev); + xref = OF_xref_from_node(node); + if (mtk_pci_ranges(node, &io_space, &mem_space)) { + device_printf(dev, "could not retrieve 'ranges' data\n"); + goto cleanup_res; + } + + /* Memory, I/O and IRQ resource limits */ + sc->sc_io_base = io_space.base; + sc->sc_io_size = io_space.len; + sc->sc_mem_base = mem_space.base; + sc->sc_mem_size = mem_space.len; + sc->sc_irq_start = MTK_PCIE0_IRQ; + sc->sc_irq_end = MTK_PCIE2_IRQ; + + /* Init resource managers for memory, I/O and IRQ */ + sc->sc_mem_rman.rm_type = RMAN_ARRAY; + sc->sc_mem_rman.rm_descr = "mtk pcie memory window"; + if (rman_init(&sc->sc_mem_rman) != 0 || + rman_manage_region(&sc->sc_mem_rman, sc->sc_mem_base, + sc->sc_mem_base + sc->sc_mem_size - 1) != 0) { + device_printf(dev, "failed to setup memory rman\n"); + goto cleanup_res; + } + + sc->sc_io_rman.rm_type = RMAN_ARRAY; + sc->sc_io_rman.rm_descr = "mtk pcie io window"; + if (rman_init(&sc->sc_io_rman) != 0 || + rman_manage_region(&sc->sc_io_rman, sc->sc_io_base, + sc->sc_io_base + sc->sc_io_size - 1) != 0) { + device_printf(dev, "failed to setup io rman\n"); + goto cleanup_res; + } + + sc->sc_irq_rman.rm_type = RMAN_ARRAY; + sc->sc_irq_rman.rm_descr = "mtk pcie irqs"; + if (rman_init(&sc->sc_irq_rman) != 0 || + rman_manage_region(&sc->sc_irq_rman, sc->sc_irq_start, + sc->sc_irq_end) != 0) { + device_printf(dev, "failed to setup irq rman\n"); + goto cleanup_res; + } + + /* Do SoC-specific PCIe initialization */ + if (mtk_pcie_phy_init(dev)) { + device_printf(dev, "pcie phy init failed\n"); + goto cleanup_rman; + } + + /* Register ourselves as an interrupt controller */ + if (intr_pic_register(dev, xref) != 0) { + device_printf(dev, "could not register PIC\n"); + goto cleanup_rman; + } + + /* Set up our interrupt handler */ + for (i = 1; i <= sc->sc_num_irq; i++) { + sc->pci_intrhand[i - 1] = NULL; + if (bus_setup_intr(dev, sc->pci_res[i], INTR_TYPE_MISC, + mtk_pci_intr, NULL, sc, &sc->pci_intrhand[i - 1])) { + device_printf(dev, "could not setup intr handler %d\n", + i); + goto cleanup; + } + } + + /* Do generic PCIe initialization and resource allocation */ + mtk_pcib_init(dev, 0, PCI_SLOTMAX); + + /* Attach our PCI child so bus enumeration can start */ + if (device_add_child(dev, "pci", -1) == NULL) { + device_printf(dev, "could not attach pci bus\n"); + goto cleanup; + } + + /* And finally, attach ourselves to the bus */ + if (bus_generic_attach(dev)) { + device_printf(dev, "could not attach to bus\n"); + goto cleanup; + } + + return (0); + +cleanup: +#ifdef notyet + intr_pic_unregister(dev, xref); +#endif + for (i = 1; i <= sc->sc_num_irq; i++) { + if (sc->pci_intrhand[i - 1] != NULL) + bus_teardown_intr(dev, sc->pci_res[i], + sc->pci_intrhand[i - 1]); + } +cleanup_rman: + mtk_pcie_phy_stop(dev); + rman_fini(&sc->sc_irq_rman); + rman_fini(&sc->sc_io_rman); + rman_fini(&sc->sc_mem_rman); +cleanup_res: + mt_sc = NULL; + if (sc->pci_res[0] != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->pci_res[0]); + if (sc->pci_res[1] != NULL) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->pci_res[1]); + if (sc->pci_res[2] != NULL) + bus_release_resource(dev, SYS_RES_IRQ, 1, sc->pci_res[2]); + if (sc->pci_res[3] != NULL) + bus_release_resource(dev, SYS_RES_IRQ, 2, sc->pci_res[3]); + return (ENXIO); +} + +static int +mtk_pci_read_ivar(device_t dev, device_t child, int which, + uintptr_t *result) +{ + struct mtk_pci_softc *sc = device_get_softc(dev); + + switch (which) { + case PCIB_IVAR_DOMAIN: + *result = device_get_unit(dev); + return (0); + case PCIB_IVAR_BUS: + *result = sc->sc_busno; + return (0); + } + + return (ENOENT); +} + +static int +mtk_pci_write_ivar(device_t dev, device_t child, int which, + uintptr_t result) +{ + struct mtk_pci_softc *sc = device_get_softc(dev); + + switch (which) { + case PCIB_IVAR_BUS: + sc->sc_busno = result; + return (0); + } + + return (ENOENT); +} + +static struct resource * +mtk_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) +{ + struct mtk_pci_softc *sc = device_get_softc(bus); + struct resource *rv; + struct rman *rm; + + switch (type) { + case SYS_RES_IRQ: + rm = &sc->sc_irq_rman; + break; + case SYS_RES_IOPORT: + rm = &sc->sc_io_rman; + break; + case SYS_RES_MEMORY: + rm = &sc->sc_mem_rman; + break; + default: + return (NULL); + } + + rv = rman_reserve_resource(rm, start, end, count, flags, child); + + if (rv == NULL) + return (NULL); + + rman_set_rid(rv, *rid); + + if ((flags & RF_ACTIVE) && type != SYS_RES_IRQ) { + if (bus_activate_resource(child, type, *rid, rv)) { + rman_release_resource(rv); + return (NULL); + } + } + + return (rv); +} + +static inline int +mtk_idx_to_irq(int idx) +{ + + return ((idx == 0) ? MTK_PCIE0_IRQ : + (idx == 1) ? MTK_PCIE1_IRQ : + (idx == 2) ? MTK_PCIE2_IRQ : -1); +} + +static inline int +mtk_irq_to_idx(int irq) +{ + + return ((irq == MTK_PCIE0_IRQ) ? 0 : + (irq == MTK_PCIE1_IRQ) ? 1 : + (irq == MTK_PCIE2_IRQ) ? 2 : -1); +} + +static void +mtk_pci_mask_irq(void *source) +{ + MT_WRITE32(mt_sc, MTK_PCI_PCIENA, + MT_READ32(mt_sc, MTK_PCI_PCIENA) & ~(1<<((int)source))); +} + +static void +mtk_pci_unmask_irq(void *source) +{ + + MT_WRITE32(mt_sc, MTK_PCI_PCIENA, + MT_READ32(mt_sc, MTK_PCI_PCIENA) | (1<<((int)source))); +} + +static int +mtk_pci_setup_intr(device_t bus, device_t child, struct resource *ires, + int flags, driver_filter_t *filt, driver_intr_t *handler, + void *arg, void **cookiep) +{ + struct mtk_pci_softc *sc = device_get_softc(bus); + struct intr_event *event; + int irq, error, irqidx; + + irq = rman_get_start(ires); + + if (irq < sc->sc_irq_start || irq > sc->sc_irq_end) + return (EINVAL); + + irqidx = irq - sc->sc_irq_start; + + event = sc->sc_eventstab[irqidx]; + if (event == NULL) { + error = intr_event_create(&event, (void *)irq, 0, irq, + mtk_pci_mask_irq, mtk_pci_unmask_irq, NULL, NULL, + "pci intr%d:", irq); + + if (error == 0) { + sc->sc_eventstab[irqidx] = event; + } + else { + return (error); + } + } + + intr_event_add_handler(event, device_get_nameunit(child), filt, + handler, arg, intr_priority(flags), flags, cookiep); + + mtk_pci_unmask_irq((void*)irq); + + return (0); +} + +static int +mtk_pci_teardown_intr(device_t dev, device_t child, struct resource *ires, + void *cookie) +{ + struct mtk_pci_softc *sc = device_get_softc(dev); + int irq, result, irqidx; + + irq = rman_get_start(ires); + if (irq < sc->sc_irq_start || irq > sc->sc_irq_end) + return (EINVAL); + + irqidx = irq - sc->sc_irq_start; + if (sc->sc_eventstab[irqidx] == NULL) + panic("Trying to teardown unoccupied IRQ"); + + mtk_pci_mask_irq((void*)irq); + + result = intr_event_remove_handler(cookie); + if (!result) + sc->sc_eventstab[irqidx] = NULL; + + + return (result); +} + +static inline uint32_t +mtk_pci_make_addr(int bus, int slot, int func, int reg) +{ + uint32_t addr; + + addr = ((((reg & 0xf00) >> 8) << 24) | (bus << 16) | (slot << 11) | + (func << 8) | (reg & 0xfc) | (1 << 31)); + + return (addr); +} + +static int +mtk_pci_maxslots(device_t dev) +{ + + return (PCI_SLOTMAX); +} + +static inline int +mtk_pci_slot_has_link(device_t dev, int slot) +{ + struct mtk_pci_softc *sc = device_get_softc(dev); + + return !!(sc->pcie_link_status & (1<addr_mask; + MT_WRITE32(sc, MTK_PCI_CFGADDR, addr); + switch (bytes % 4) { + case 0: + data = MT_READ32(sc, MTK_PCI_CFGDATA); + break; + case 1: + data = MT_READ8(sc, MTK_PCI_CFGDATA + (reg & 0x3)); + break; + case 2: + data = MT_READ16(sc, MTK_PCI_CFGDATA + (reg & 0x3)); + break; + default: + panic("%s(): Wrong number of bytes (%d) requested!\n", + __FUNCTION__, bytes % 4); + } + mtx_unlock_spin(&mtk_pci_mtx); + + return (data); +} + +static void +mtk_pci_write_config(device_t dev, u_int bus, u_int slot, u_int func, + u_int reg, uint32_t val, int bytes) +{ + struct mtk_pci_softc *sc = device_get_softc(dev); + uint32_t addr = 0, data = val; + + /* Do not write if slot has no link */ + if (bus == 0 && mtk_pci_slot_has_link(dev, slot) == 0) + return; + + mtx_lock_spin(&mtk_pci_mtx); + addr = mtk_pci_make_addr(bus, slot, func, (reg & ~3)) & sc->addr_mask; + MT_WRITE32(sc, MTK_PCI_CFGADDR, addr); + switch (bytes % 4) { + case 0: + MT_WRITE32(sc, MTK_PCI_CFGDATA, data); + break; + case 1: + MT_WRITE8(sc, MTK_PCI_CFGDATA + (reg & 0x3), data); + break; + case 2: + MT_WRITE16(sc, MTK_PCI_CFGDATA + (reg & 0x3), data); + break; + default: + panic("%s(): Wrong number of bytes (%d) requested!\n", + __FUNCTION__, bytes % 4); + } + mtx_unlock_spin(&mtk_pci_mtx); +} + +#if 0 +/* We take care of interrupt routing in the allocator code below */ +static int +mtk_pci_route_interrupt(device_t pcib, device_t device, int pin) +{ + //struct mtk_pci_softc *sc = device_get_softc(pcib); + int bus, sl, dev; + + if (1) return PCI_INVALID_IRQ; + + bus = pci_get_bus(device); + sl = pci_get_slot(device); + dev = pci_get_device(device); + + printf("%s: for %d:%d:%d, int = %d\n", __FUNCTION__, bus, sl, dev, pin); + + if (bus != 0) + panic("Unexpected bus number %d\n", bus); + + /* PCIe only */ + switch (sl) { + case 0: return MTK_PCIE0_IRQ; + case 1: return MTK_PCIE0_IRQ + 1; + case 2: return MTK_PCIE0_IRQ + 2; + default: return (-1); + } + + return (-1); +} +#endif + +static device_method_t mtk_pci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, mtk_pci_probe), + DEVMETHOD(device_attach, mtk_pci_attach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* Bus interface */ + DEVMETHOD(bus_read_ivar, mtk_pci_read_ivar), + DEVMETHOD(bus_write_ivar, mtk_pci_write_ivar), + DEVMETHOD(bus_alloc_resource, mtk_pci_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, mtk_pci_setup_intr), + DEVMETHOD(bus_teardown_intr, mtk_pci_teardown_intr), + + /* pcib interface */ + DEVMETHOD(pcib_maxslots, mtk_pci_maxslots), + DEVMETHOD(pcib_read_config, mtk_pci_read_config), + DEVMETHOD(pcib_write_config, mtk_pci_write_config), +#if 0 + DEVMETHOD(pcib_route_interrupt, mtk_pci_route_interrupt), +#endif + + DEVMETHOD_END +}; + +static driver_t mtk_pci_driver = { + "pcib", + mtk_pci_methods, + sizeof(struct mtk_pci_softc), +}; + +static devclass_t mtk_pci_devclass; + +DRIVER_MODULE(mtk_pci, simplebus, mtk_pci_driver, mtk_pci_devclass, 0, 0); + +/* Resource allocation code */ +static inline uint32_t +pcib_bit_get(uint32_t *map, uint32_t bit) +{ + uint32_t n = bit / BITS_PER_UINT32; + + bit = bit % BITS_PER_UINT32; + return (map[n] & (1 << bit)); +} + +static inline void +pcib_bit_set(uint32_t *map, uint32_t bit) +{ + uint32_t n = bit / BITS_PER_UINT32; + + bit = bit % BITS_PER_UINT32; + map[n] |= (1 << bit); +} + +static inline uint32_t +pcib_map_check(uint32_t *map, uint32_t start, uint32_t bits) +{ + uint32_t i; + + for (i = start; i < start + bits; i++) + if (pcib_bit_get(map, i)) + return (0); + + return (1); +} + +static inline void +pcib_map_set(uint32_t *map, uint32_t start, uint32_t bits) +{ + uint32_t i; + + for (i = start; i < start + bits; i++) + pcib_bit_set(map, i); +} + +static bus_addr_t +pcib_alloc(device_t dev, uint32_t smask) +{ + struct mtk_pci_softc *sc = device_get_softc(dev); + uint32_t bits, bits_limit, i, *map, min_alloc, size; + bus_addr_t addr = 0; + bus_addr_t base; + + if (smask & 1) { + base = sc->sc_io_base; + min_alloc = PCI_MIN_IO_ALLOC; + bits_limit = sc->sc_io_size / min_alloc; + map = sc->sc_io_map; + smask &= ~0x3; + } else { + base = sc->sc_mem_base; + min_alloc = PCI_MIN_MEM_ALLOC; + bits_limit = sc->sc_mem_size / min_alloc; + map = sc->sc_mem_map; + smask &= ~0xF; + } + + size = ~smask + 1; + bits = size / min_alloc; + + for (i = 0; i + bits <= bits_limit; i+= bits) + if (pcib_map_check(map, i, bits)) { + pcib_map_set(map, i, bits); + addr = base + (i * min_alloc); + return (addr); + } + + return (addr); +} + +static int +mtk_pcib_init_bar(device_t dev, int bus, int slot, int func, int barno) +{ + uint32_t addr, bar; + int reg, width; + + reg = PCIR_BAR(barno); + + mtk_pci_write_config(dev, bus, slot, func, reg, ~0, 4); + bar = mtk_pci_read_config(dev, bus, slot, func, reg, 4); + if (bar == 0) + return (1); + + /* Calculate BAR size: 64 or 32 bit (in 32-bit units) */ + width = ((bar & 7) == 4) ? 2 : 1; + + addr = pcib_alloc(dev, bar); + if (!addr) + return (-1); + + if (bootverbose) + printf("PCI %u:%u:%u: reg %x: smask=%08x: addr=%08x\n", + bus, slot, func, reg, bar, addr); + + mtk_pci_write_config(dev, bus, slot, func, reg, addr, 4); + if (width == 2) + mtk_pci_write_config(dev, bus, slot, func, reg + 4, 0, 4); + + return (width); +} + +static int +mtk_pcib_init_all_bars(device_t dev, int bus, int slot, int func, + int hdrtype) +{ + int maxbar, bar, i; + + maxbar = (hdrtype & PCIM_HDRTYPE) ? 0 : 6; + bar = 0; + + while (bar < maxbar) { + i = mtk_pcib_init_bar(dev, bus, slot, func, bar); + bar += i; + if (i < 0) { + device_printf(dev, "PCI IO/Memory space exhausted\n"); + return (ENOMEM); + } + } + + return (0); +} + +static void +mtk_pcib_init_bridge(device_t dev, int bus, int slot, int func) +{ + struct mtk_pci_softc *sc = device_get_softc(dev); + bus_addr_t io_base, mem_base; + uint32_t io_limit, mem_limit; + int secbus; + + if (bus == 0 && !mtk_pci_slot_has_link(dev, slot)) { + sc->sc_cur_secbus++; + device_printf(dev, "Skip bus %d due to no link\n", + sc->sc_cur_secbus); + return; + } + + io_base = sc->sc_io_base; + io_limit = io_base + sc->sc_io_size - 1; + mem_base = sc->sc_mem_base; + mem_limit = mem_base + sc->sc_mem_size - 1; + + mtk_pci_write_config(dev, bus, slot, func, PCIR_IOBASEL_1, + io_base >> 8, 1); + mtk_pci_write_config(dev, bus, slot, func, PCIR_IOBASEH_1, + io_base >> 16, 2); + mtk_pci_write_config(dev, bus, slot, func, PCIR_IOLIMITL_1, + io_limit >> 8, 1); + mtk_pci_write_config(dev, bus, slot, func, PCIR_IOLIMITH_1, + io_limit >> 16, 2); + + mtk_pci_write_config(dev, bus, slot, func, PCIR_MEMBASE_1, + mem_base >> 16, 2); + mtk_pci_write_config(dev, bus, slot, func, PCIR_MEMLIMIT_1, + mem_limit >> 16, 2); + + mtk_pci_write_config(dev, bus, slot, func, PCIR_PMBASEL_1, + 0x10, 2); + mtk_pci_write_config(dev, bus, slot, func, PCIR_PMBASEH_1, + 0x0, 4); + mtk_pci_write_config(dev, bus, slot, func, PCIR_PMLIMITL_1, + 0xF, 2); + mtk_pci_write_config(dev, bus, slot, func, PCIR_PMLIMITH_1, + 0x0, 4); + + mtk_pci_write_config(dev, bus, slot, func, PCIR_INTLINE, 0xff, 1); + + secbus = mtk_pci_read_config(dev, bus, slot, func, PCIR_SECBUS_1, 1); + + if (secbus == 0) { + sc->sc_cur_secbus++; + mtk_pci_write_config(dev, bus, slot, func, PCIR_SECBUS_1, + sc->sc_cur_secbus, 1); + mtk_pci_write_config(dev, bus, slot, func, PCIR_SUBBUS_1, + sc->sc_cur_secbus, 1); + secbus = sc->sc_cur_secbus; + } + + mtk_pcib_init(dev, secbus, PCI_SLOTMAX); +} + +static uint8_t +mtk_pci_get_int(device_t dev, int bus, int slot) +{ + + if (slot != 0) + return (PCI_INVALID_IRQ); + + switch (bus) { + case 1: + return (MTK_PCIE0_IRQ); + case 2: + return (MTK_PCIE1_IRQ); + case 3: + return (MTK_PCIE2_IRQ); + default: + device_printf(dev, "Bus %d out of range\n", slot); + return (PCI_INVALID_IRQ); + } + + /* Unreachable */ + return (PCI_INVALID_IRQ); +} + +static int +mtk_pcib_init(device_t dev, int bus, int maxslot) +{ + int slot, func, maxfunc, error; + uint8_t hdrtype, command, class, subclass; + + for (slot = 0; slot <= maxslot; slot++) { + maxfunc = 0; + for (func = 0; func <= maxfunc; func++) { + hdrtype = mtk_pci_read_config(dev, bus, slot, func, + PCIR_HDRTYPE, 1); + + if ((hdrtype & PCIM_HDRTYPE) > PCI_MAXHDRTYPE) + continue; + + if (func == 0 && (hdrtype & PCIM_MFDEV)) + maxfunc = PCI_FUNCMAX; + + command = mtk_pci_read_config(dev, bus, slot, func, + PCIR_COMMAND, 1); + command &= ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN); + mtk_pci_write_config(dev, bus, slot, func, + PCIR_COMMAND, command, 1); + + error = mtk_pcib_init_all_bars(dev, bus, slot, func, + hdrtype); + + if (error) + return (error); + + command |= PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN | + PCIM_CMD_PORTEN; + mtk_pci_write_config(dev, bus, slot, func, + PCIR_COMMAND, command, 1); + + mtk_pci_write_config(dev, bus, slot, func, + PCIR_CACHELNSZ, 16, 1); + + class = mtk_pci_read_config(dev, bus, slot, func, + PCIR_CLASS, 1); + subclass = mtk_pci_read_config(dev, bus, slot, func, + PCIR_SUBCLASS, 1); + + if (class != PCIC_BRIDGE || + subclass != PCIS_BRIDGE_PCI) { + uint8_t val; + + val = mtk_pci_get_int(dev, bus, slot); + + mtk_pci_write_config(dev, bus, slot, func, + PCIR_INTLINE, val, 1); /* XXX */ + continue; + } + + mtk_pcib_init_bridge(dev, bus, slot, func); + } + } + + return (0); +} + +/* Our interrupt handler */ +static int +mtk_pci_intr(void *arg) +{ + struct mtk_pci_softc *sc = arg; + struct intr_event *event; + uint32_t reg, irq, irqidx; + + reg = MT_READ32(sc, MTK_PCI_PCIINT); + + for (irq = sc->sc_irq_start; irq <= sc->sc_irq_end; irq++) { + if (reg & (1u< Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 570D3B089C7; Fri, 8 Apr 2016 15:28:14 +0000 (UTC) (envelope-from sgalabov@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 mx1.freebsd.org (Postfix) with ESMTPS id 183771A55; Fri, 8 Apr 2016 15:28:14 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38FSD35062751; Fri, 8 Apr 2016 15:28:13 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38FSDRM062749; Fri, 8 Apr 2016 15:28:13 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201604081528.u38FSDRM062749@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Fri, 8 Apr 2016 15:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297718 - head/sys/mips/mediatek X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 15:28:14 -0000 Author: sgalabov Date: Fri Apr 8 15:28:12 2016 New Revision: 297718 URL: https://svnweb.freebsd.org/changeset/base/297718 Log: Introduce better locking for mtk_gpio_v[12] drivers Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5887 Modified: head/sys/mips/mediatek/mtk_gpio_v1.c head/sys/mips/mediatek/mtk_gpio_v2.c Modified: head/sys/mips/mediatek/mtk_gpio_v1.c ============================================================================== --- head/sys/mips/mediatek/mtk_gpio_v1.c Fri Apr 8 15:26:49 2016 (r297717) +++ head/sys/mips/mediatek/mtk_gpio_v1.c Fri Apr 8 15:28:12 2016 (r297718) @@ -431,19 +431,29 @@ mtk_gpio_pin_setflags(device_t dev, uint static int mtk_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) { - struct mtk_gpio_softc *sc = device_get_softc(dev); + struct mtk_gpio_softc *sc; + int ret; + + sc = device_get_softc(dev); + ret = 0; - if (pin >= sc->num_pins || !(sc->pins[pin].pin_flags & GPIO_PIN_OUTPUT)) + if (pin >= sc->num_pins) return (EINVAL); MTK_GPIO_LOCK(sc); + if(!(sc->pins[pin].pin_flags & GPIO_PIN_OUTPUT)) { + ret = EINVAL; + goto out; + } + if (value) MTK_WRITE_4(sc, GPIO_PIOSET(sc), (1u << pin)); else MTK_WRITE_4(sc, GPIO_PIORESET(sc), (1u << pin)); - MTK_GPIO_UNLOCK(sc); - return (0); +out: + MTK_GPIO_UNLOCK(sc); + return (ret); } static int @@ -451,33 +461,50 @@ mtk_gpio_pin_get(device_t dev, uint32_t { struct mtk_gpio_softc *sc; uint32_t data; + int ret; sc = device_get_softc(dev); + ret = 0; - if (pin >= sc->num_pins || !(sc->pins[pin].pin_flags & GPIO_PIN_INPUT)) + if (pin >= sc->num_pins) return (EINVAL); MTK_GPIO_LOCK(sc); + if(!(sc->pins[pin].pin_flags & GPIO_PIN_INPUT)) { + ret = EINVAL; + goto out; + } data = MTK_READ_4(sc, GPIO_PIODATA(sc)); - MTK_GPIO_UNLOCK(sc); *val = (data & (1u << pin)) ? 1 : 0; - return (0); +out: + MTK_GPIO_UNLOCK(sc); + return (ret); } static int mtk_gpio_pin_toggle(device_t dev, uint32_t pin) { - struct mtk_gpio_softc *sc = device_get_softc(dev); + struct mtk_gpio_softc *sc; + int ret; - if (pin >= sc->num_pins || !(sc->pins[pin].pin_flags & GPIO_PIN_OUTPUT)) + if (pin >= sc->num_pins) return (EINVAL); + sc = device_get_softc(dev); + ret = 0; + MTK_GPIO_LOCK(sc); + if (!(sc->pins[pin].pin_flags & GPIO_PIN_OUTPUT)) { + ret = EINVAL; + goto out; + } MTK_WRITE_4(sc, GPIO_PIOTOG(sc), (1u << pin)); + +out: MTK_GPIO_UNLOCK(sc); - return (0); + return (ret); } static int @@ -571,7 +598,9 @@ mtk_gpio_pic_post_filter(device_t dev, s pisrc = (struct mtk_gpio_pin_irqsrc *)isrc; sc = device_get_softc(dev); + MTK_GPIO_LOCK(sc); MTK_WRITE_4(sc, GPIO_PIOINT(sc), 1u << pisrc->irq); + MTK_GPIO_UNLOCK(sc); } static int Modified: head/sys/mips/mediatek/mtk_gpio_v2.c ============================================================================== --- head/sys/mips/mediatek/mtk_gpio_v2.c Fri Apr 8 15:26:49 2016 (r297717) +++ head/sys/mips/mediatek/mtk_gpio_v2.c Fri Apr 8 15:28:12 2016 (r297718) @@ -425,19 +425,29 @@ mtk_gpio_pin_setflags(device_t dev, uint static int mtk_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) { - struct mtk_gpio_softc *sc = device_get_softc(dev); + struct mtk_gpio_softc *sc; + int ret; - if (pin >= sc->num_pins || !(sc->pins[pin].pin_flags & GPIO_PIN_OUTPUT)) + if (pin >= sc->num_pins) return (EINVAL); + sc = device_get_softc(dev); + ret = 0; + MTK_GPIO_LOCK(sc); + if (!(sc->pins[pin].pin_flags & GPIO_PIN_OUTPUT)) { + ret = EINVAL; + goto out; + } if (value) MTK_WRITE_4(sc, GPIO_PIOSET(sc), (1u << pin)); else MTK_WRITE_4(sc, GPIO_PIORESET(sc), (1u << pin)); + +out: MTK_GPIO_UNLOCK(sc); - return (0); + return (ret); } static int @@ -445,39 +455,56 @@ mtk_gpio_pin_get(device_t dev, uint32_t { struct mtk_gpio_softc *sc; uint32_t data; + int ret; - sc = device_get_softc(dev); - - if (pin >= sc->num_pins || !(sc->pins[pin].pin_flags & GPIO_PIN_INPUT)) + if (pin >= sc->num_pins) return (EINVAL); + sc = device_get_softc(dev); + ret = 0; + MTK_GPIO_LOCK(sc); + if (!(sc->pins[pin].pin_flags & GPIO_PIN_INPUT)) { + ret = EINVAL; + goto out; + } data = MTK_READ_4(sc, GPIO_PIODATA(sc)); - MTK_GPIO_UNLOCK(sc); *val = (data & (1u << pin)) ? 1 : 0; - return (0); +out: + MTK_GPIO_UNLOCK(sc); + return (ret); } static int mtk_gpio_pin_toggle(device_t dev, uint32_t pin) { - struct mtk_gpio_softc *sc = device_get_softc(dev); + struct mtk_gpio_softc *sc; uint32_t val; + int ret; - if (pin >= sc->num_pins || !(sc->pins[pin].pin_flags & GPIO_PIN_OUTPUT)) + if (pin >= sc->num_pins) return (EINVAL); + sc = device_get_softc(dev); + ret = 0; + MTK_GPIO_LOCK(sc); + if(!(sc->pins[pin].pin_flags & GPIO_PIN_OUTPUT)) { + ret = EINVAL; + goto out; + } val = MTK_READ_4(sc, GPIO_PIODATA(sc)); val &= (1u << pin); if (val) MTK_WRITE_4(sc, GPIO_PIORESET(sc), (1u << pin)); else MTK_WRITE_4(sc, GPIO_PIOSET(sc), (1u << pin)); + +out: MTK_GPIO_UNLOCK(sc); - return (0); + return (ret); } static int @@ -571,7 +598,9 @@ mtk_gpio_pic_post_filter(device_t dev, s pisrc = (struct mtk_gpio_pin_irqsrc *)isrc; sc = device_get_softc(dev); + MTK_GPIO_LOCK(sc); MTK_WRITE_4(sc, GPIO_PIOINT(sc), 1u << pisrc->irq); + MTK_GPIO_UNLOCK(sc); } static int From owner-svn-src-all@freebsd.org Fri Apr 8 15:38:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 451FCB08E9F; Fri, 8 Apr 2016 15:38:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 26ED81020; Fri, 8 Apr 2016 15:38:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id CB236B946; Fri, 8 Apr 2016 11:38:57 -0400 (EDT) From: John Baldwin To: Sepherosa Ziehau Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297699 - head/sys/dev/hyperv/vmbus Date: Fri, 08 Apr 2016 07:50:26 -0700 Message-ID: <2723235.iE8LVQdaEH@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201604080920.u389KliR048702@repo.freebsd.org> References: <201604080920.u389KliR048702@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 08 Apr 2016 11:38:57 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 15:38:59 -0000 On Friday, April 08, 2016 09:20:47 AM Sepherosa Ziehau wrote: > Author: sephe > Date: Fri Apr 8 09:20:46 2016 > New Revision: 297699 > URL: https://svnweb.freebsd.org/changeset/base/297699 > > Log: > hyperv: Revert r297481 > > Use vm_guest == VM_GUEST_HV is not enough to determine whether FreeBSD > is running on Hyper-V or not. What a mess. > > Reported by: smokehydration tutanota com > Sponsored by: Microsoft OSTC Ewww, does this mean Hyper-V doesn't always report itself via the VM CPUID leafs? (Or is it not setting the HV cpuid feature bit?) -- John Baldwin From owner-svn-src-all@freebsd.org Fri Apr 8 15:43:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50667B080C6; Fri, 8 Apr 2016 15:43:50 +0000 (UTC) (envelope-from jilles@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 mx1.freebsd.org (Postfix) with ESMTPS id 1F53A142A; Fri, 8 Apr 2016 15:43:50 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38Fhn3t068568; Fri, 8 Apr 2016 15:43:49 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38FhnAE068567; Fri, 8 Apr 2016 15:43:49 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201604081543.u38FhnAE068567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Fri, 8 Apr 2016 15:43:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297719 - stable/10/lib/libc/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 15:43:50 -0000 Author: jilles Date: Fri Apr 8 15:43:49 2016 New Revision: 297719 URL: https://svnweb.freebsd.org/changeset/base/297719 Log: MFC r295384: semget(2): Add missing [EINVAL] conditions. PR: 206927 Modified: stable/10/lib/libc/sys/semget.2 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/semget.2 ============================================================================== --- stable/10/lib/libc/sys/semget.2 Fri Apr 8 15:28:12 2016 (r297718) +++ stable/10/lib/libc/sys/semget.2 Fri Apr 8 15:43:49 2016 (r297719) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 12, 1995 +.Dd February 7, 2016 .Dt SEMGET 2 .Os .Sh NAME @@ -132,6 +132,17 @@ already exists. .It Bq Er EINVAL The number of semaphores requested exceeds the system imposed maximum per set. +.It Bq Er EINVAL +A semaphore set corresponding to +.Fa key +already exists and contains fewer semaphores than +.Fa nsems . +.It Bq Er EINVAL +A semaphore set corresponding to +.Fa key +does not exist and +.Fa nsems +is 0 or negative. .It Bq Er ENOSPC Insufficiently many semaphores are available. .It Bq Er ENOSPC From owner-svn-src-all@freebsd.org Fri Apr 8 15:48:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B099B081B5; Fri, 8 Apr 2016 15:48:12 +0000 (UTC) (envelope-from sgalabov@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 mx1.freebsd.org (Postfix) with ESMTPS id E93F31642; Fri, 8 Apr 2016 15:48:11 +0000 (UTC) (envelope-from sgalabov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38FmBBa068873; Fri, 8 Apr 2016 15:48:11 GMT (envelope-from sgalabov@FreeBSD.org) Received: (from sgalabov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38FmBRM068872; Fri, 8 Apr 2016 15:48:11 GMT (envelope-from sgalabov@FreeBSD.org) Message-Id: <201604081548.u38FmBRM068872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sgalabov set sender to sgalabov@FreeBSD.org using -f From: Stanislav Galabov Date: Fri, 8 Apr 2016 15:48:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297720 - head/sys/mips/mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 15:48:12 -0000 Author: sgalabov Date: Fri Apr 8 15:48:10 2016 New Revision: 297720 URL: https://svnweb.freebsd.org/changeset/base/297720 Log: Fix MIPS INTRNG omissions, add soft/hard interrupts with different names Reviewed by: kan Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D5888 Modified: head/sys/mips/mips/mips_pic.c Modified: head/sys/mips/mips/mips_pic.c ============================================================================== --- head/sys/mips/mips/mips_pic.c Fri Apr 8 15:43:49 2016 (r297719) +++ head/sys/mips/mips/mips_pic.c Fri Apr 8 15:48:10 2016 (r297720) @@ -134,13 +134,6 @@ pic_irq_mask(struct mips_pic_softc *sc, mips_wr_status(mips_rd_status() & ~((1 << irq) << 8)); } -#ifdef SMP -static void -mips_pic_init_secondary(device_t dev) -{ -} -#endif /* SMP */ - static inline intptr_t pic_xref(device_t dev) { @@ -155,23 +148,30 @@ static int mips_pic_register_isrcs(struct mips_pic_softc *sc) { int error; - uint32_t irq, i; + uint32_t irq, i, tmpirq; struct intr_irqsrc *isrc; - const char *name; + char *name; - name = device_get_nameunit(sc->pic_dev); for (irq = 0; irq < sc->nirqs; irq++) { sc->pic_irqs[irq].irq = irq; sc->pic_irqs[irq].res = rman_reserve_resource(&sc->pic_irq_rman, irq, irq, 1, RF_ACTIVE, sc->pic_dev); if (sc->pic_irqs[irq].res == NULL) { device_printf(sc->pic_dev, - "%s failed to alloc resource for irq %d", + "%s failed to alloc resource for irq %u", __func__, irq); return (ENOMEM); } isrc = PIC_INTR_ISRC(sc, irq); - error = intr_isrc_register(isrc, sc->pic_dev, 0, "%s", name); + if (irq < NSOFT_IRQS) { + name = "sint"; + tmpirq = irq; + } else { + name = "int"; + tmpirq = irq - NSOFT_IRQS; + } + error = intr_isrc_register(isrc, sc->pic_dev, 0, "%s%u", + name, tmpirq); if (error != 0) { for (i = 0; i < irq; i++) { intr_isrc_deregister(PIC_INTR_ISRC(sc, i)); From owner-svn-src-all@freebsd.org Fri Apr 8 16:14:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6432CB08949; Fri, 8 Apr 2016 16:14:19 +0000 (UTC) (envelope-from zbb@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 mx1.freebsd.org (Postfix) with ESMTPS id 31FA2139E; Fri, 8 Apr 2016 16:14:19 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38GEIlb077942; Fri, 8 Apr 2016 16:14:18 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38GEIms077941; Fri, 8 Apr 2016 16:14:18 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201604081614.u38GEIms077941@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Fri, 8 Apr 2016 16:14:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297721 - head/sys/dev/vnic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 16:14:19 -0000 Author: zbb Date: Fri Apr 8 16:14:18 2016 New Revision: 297721 URL: https://svnweb.freebsd.org/changeset/base/297721 Log: Fix sending TSO packets larger than single DMA segment on VNIC Due to the bug in the number of 'GATHER' subdescriptors for TSO packets, VNIC was not able to transmit more than one DMA segment with TSO enabled. Obtained from: Semihalf Sponsored by: Cavium Modified: head/sys/dev/vnic/nicvf_queues.c Modified: head/sys/dev/vnic/nicvf_queues.c ============================================================================== --- head/sys/dev/vnic/nicvf_queues.c Fri Apr 8 15:48:10 2016 (r297720) +++ head/sys/dev/vnic/nicvf_queues.c Fri Apr 8 16:14:18 2016 (r297721) @@ -1904,7 +1904,6 @@ static int nicvf_tx_mbuf_locked(struct snd_queue *sq, struct mbuf **mbufp) { bus_dma_segment_t segs[256]; - struct nicvf *nic; struct snd_buff *snd_buff; size_t seg; int nsegs, qentry; @@ -1928,12 +1927,7 @@ nicvf_tx_mbuf_locked(struct snd_queue *s } /* Set how many subdescriptors is required */ - nic = sq->nic; - if ((*mbufp)->m_pkthdr.tso_segsz != 0 && nic->hw_tso) - subdesc_cnt = MIN_SQ_DESC_PER_PKT_XMIT; - else - subdesc_cnt = MIN_SQ_DESC_PER_PKT_XMIT + nsegs - 1; - + subdesc_cnt = MIN_SQ_DESC_PER_PKT_XMIT + nsegs - 1; if (subdesc_cnt > sq->free_cnt) { /* ARM64TODO: Add mbuf defragmentation if we lack descriptors */ bus_dmamap_unload(sq->snd_buff_dmat, snd_buff->dmap); From owner-svn-src-all@freebsd.org Fri Apr 8 16:16:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89C1AB08A3F; Fri, 8 Apr 2016 16:16:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B8ED16A8; Fri, 8 Apr 2016 16:16:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 6AF0AB946; Fri, 8 Apr 2016 12:16:22 -0400 (EDT) From: John Baldwin To: Stanislav Galabov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297717 - head/sys/mips/mediatek Date: Fri, 08 Apr 2016 09:11:15 -0700 Message-ID: <2014592.cEATiW0yl7@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201604081526.u38FQnvC062652@repo.freebsd.org> References: <201604081526.u38FQnvC062652@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 08 Apr 2016 12:16:22 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 16:16:23 -0000 On Friday, April 08, 2016 03:26:49 PM Stanislav Galabov wrote: > Author: sgalabov > Date: Fri Apr 8 15:26:49 2016 > New Revision: 297717 > URL: https://svnweb.freebsd.org/changeset/base/297717 > > Log: > Introduce Mediatek/Ralink PCIe support > > This revision introduces PCIe support for the relevant Mediatek/Ralink > SoCs. > Currently the PCIe support is not converted to INTRNG, this may be a > task for the future. > > Approved by: adrian (mentor) > Sponsored by: Smartcom - Bulgaria AD > Differential Revision: https://reviews.freebsd.org/D5886 I would _really_ like to get away from having N different Foo-PCI bridge drivers that all do an initial walk of the PCI hierarchy configuring BARs and PCI-PCI bridge I/O windows. With NEW_PCIB, the PCI-PCI bridge driver is capable of figuring out windows on its own, and the PCI bus is also capable of allocating resource for BARs. Leveraging that means removing N copies of this approach and having one place to manage BARs, etc. Can you please try removing all of your I/O window and BAR setup and seeing if the PCI bus works ok? If not, we should fix it so that it does, but fixing the PCI bus means we only have to fix one place, not N. (And yes, I want to axe the code from the various arm places that do this as well and want to avoid adding even more copies of it.) -- John Baldwin From owner-svn-src-all@freebsd.org Fri Apr 8 16:31:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5A20B092BC; Fri, 8 Apr 2016 16:31:50 +0000 (UTC) (envelope-from sgalabov@gmail.com) Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (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 4886C146A; Fri, 8 Apr 2016 16:31:50 +0000 (UTC) (envelope-from sgalabov@gmail.com) Received: by mail-wm0-x243.google.com with SMTP id y144so5563428wmd.0; Fri, 08 Apr 2016 09:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=JmVbKyqa59/y6kCH17DK0N2CsCRr/EnUALd1uzrTvRg=; b=Spp7asnzW5ksoVs1SlPmjQ/qOHC2yyrmYxn752DMyy8nsDyXhFQxwIk/HcmJ8rfbTV YG+keOgOAjZZCDLJx5ia13bH5+OPp0PYFM5RM1uMXgGaNllVkSB1FsjDN2K4Ja8wm5Fo LkGF5q6l1RiZxZ7vXPQLvMv6GDsXYBMgfiPnr0XyMEURxf5TlzIubcFbGevfHQpZ82ns kUUiDHitrHGtFVs/Z5jOmdc/LmmNEc5m+77dRjESKRdiPypQuE57V/NXZenFs9iKZyYN wCgflkzJ8l1tfVD+hk0hbZvXs/CCFT/19jM4j3L67yf2QmXO+hy4MIjEalYxJaWEI61N ILXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=JmVbKyqa59/y6kCH17DK0N2CsCRr/EnUALd1uzrTvRg=; b=Agtd0kRw+plaFaxGODgs6/lL/i0Dx44hWZe7CzQRwnmNJ89hmOSr7uwspUeUUvvudm IX7123sI4iWgmmCLW32tyC2y2kSbYrD9isW8n82XUBWnDTcG8lrlfjbiK3gZlLXR6vs8 +ubgMAJsLZoD7WGIlHnZ/oRNTmtgGxO0iVQN3EQ8t2y6f87c9W4IS6ggNSr7n9J2DOqM QoB/Em/ITAjx5mFjsHnjmj3FTtE22VCOq7R2y7Xwm3TA/IYGonBgVCvnnKQ3EIV3xNJM /qy1NlEbmVnJqoTINLxB0DIh/boBZwO7tLdSHFX/qTTHtQp4paKmPb41+L6MoESN5wd+ GjKg== X-Gm-Message-State: AOPr4FVy4NI5+szcjnP+5bdSDKyu7ZkPWKPoVUyj6YIMpIKkKBLClNTjJ5K/dhiFwAIzFw== X-Received: by 10.194.60.134 with SMTP id h6mr1474465wjr.115.1460133108006; Fri, 08 Apr 2016 09:31:48 -0700 (PDT) Received: from [10.189.188.175] (85-118-68-185.mtel.net. [85.118.68.185]) by smtp.gmail.com with ESMTPSA id i5sm14144587wja.23.2016.04.08.09.31.46 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 08 Apr 2016 09:31:47 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r297717 - head/sys/mips/mediatek From: Stanislav Galabov X-Mailer: iPhone Mail (12B440) In-Reply-To: <2014592.cEATiW0yl7@ralph.baldwin.cx> Date: Fri, 8 Apr 2016 19:31:45 +0300 Cc: Stanislav Galabov , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <0F1CDE8A-543D-4F3E-A595-95A107B271B9@gmail.com> References: <201604081526.u38FQnvC062652@repo.freebsd.org> <2014592.cEATiW0yl7@ralph.baldwin.cx> To: John Baldwin X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 16:31:50 -0000 > On Apr 8, 2016, at 19:11, John Baldwin wrote: >=20 >> On Friday, April 08, 2016 03:26:49 PM Stanislav Galabov wrote: >> Author: sgalabov >> Date: Fri Apr 8 15:26:49 2016 >> New Revision: 297717 >> URL: https://svnweb.freebsd.org/changeset/base/297717 >>=20 >> Log: >> Introduce Mediatek/Ralink PCIe support >>=20 >> This revision introduces PCIe support for the relevant Mediatek/Ralink >> SoCs. >> Currently the PCIe support is not converted to INTRNG, this may be a >> task for the future. >>=20 >> Approved by: adrian (mentor) >> Sponsored by: Smartcom - Bulgaria AD >> Differential Revision: https://reviews.freebsd.org/D5886 >=20 > I would _really_ like to get away from having N different Foo-PCI bridge > drivers that all do an initial walk of the PCI hierarchy configuring > BARs and PCI-PCI bridge I/O windows. With NEW_PCIB, the PCI-PCI bridge > driver is capable of figuring out windows on its own, and the PCI bus is > also capable of allocating resource for BARs. Leveraging that means > removing N copies of this approach and having one place to manage BARs, et= c. > Can you please try removing all of your I/O window and BAR setup and seein= g > if the PCI bus works ok? If not, we should fix it so that it does, but > fixing the PCI bus means we only have to fix one place, not N. >=20 > (And yes, I want to axe the code from the various arm places that do this > as well and want to avoid adding even more copies of it.) >=20 > --=20 > John Baldwin No problem, I will try to look into this next week. Best wishes, Stanislav= From owner-svn-src-all@freebsd.org Fri Apr 8 18:15:32 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E90DB080CD; Fri, 8 Apr 2016 18:15:32 +0000 (UTC) (envelope-from trasz@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 mx1.freebsd.org (Postfix) with ESMTPS id 3DC4B164F; Fri, 8 Apr 2016 18:15:32 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38IFVle017468; Fri, 8 Apr 2016 18:15:31 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38IFVqL017467; Fri, 8 Apr 2016 18:15:31 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201604081815.u38IFVqL017467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 8 Apr 2016 18:15:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297722 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 18:15:32 -0000 Author: trasz Date: Fri Apr 8 18:15:31 2016 New Revision: 297722 URL: https://svnweb.freebsd.org/changeset/base/297722 Log: Make it possible to tweak RCTL throttling sysctls at runtime. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_rctl.c Modified: head/sys/kern/kern_rctl.c ============================================================================== --- head/sys/kern/kern_rctl.c Fri Apr 8 16:14:18 2016 (r297721) +++ head/sys/kern/kern_rctl.c Fri Apr 8 18:15:31 2016 (r297722) @@ -80,28 +80,43 @@ FEATURE(rctl, "Resource Limits"); static unsigned int rctl_maxbufsize = RCTL_MAX_OUTBUFSIZE; static int rctl_log_rate_limit = 10; static int rctl_devctl_rate_limit = 10; -static unsigned int rctl_throttle_min = 0; -static unsigned int rctl_throttle_max = 0; -static unsigned int rctl_throttle_pct = 0; -static unsigned int rctl_throttle_pct2 = 0; + +/* + * Values below are initialized in rctl_init(). + */ +static int rctl_throttle_min = -1; +static int rctl_throttle_max = -1; +static int rctl_throttle_pct = -1; +static int rctl_throttle_pct2 = -1; + +static int rctl_throttle_min_sysctl(SYSCTL_HANDLER_ARGS); +static int rctl_throttle_max_sysctl(SYSCTL_HANDLER_ARGS); +static int rctl_throttle_pct_sysctl(SYSCTL_HANDLER_ARGS); +static int rctl_throttle_pct2_sysctl(SYSCTL_HANDLER_ARGS); SYSCTL_NODE(_kern_racct, OID_AUTO, rctl, CTLFLAG_RW, 0, "Resource Limits"); SYSCTL_UINT(_kern_racct_rctl, OID_AUTO, maxbufsize, CTLFLAG_RWTUN, &rctl_maxbufsize, 0, "Maximum output buffer size"); SYSCTL_UINT(_kern_racct_rctl, OID_AUTO, log_rate_limit, CTLFLAG_RW, &rctl_log_rate_limit, 0, "Maximum number of log messages per second"); -SYSCTL_UINT(_kern_racct_rctl, OID_AUTO, devctl_rate_limit, CTLFLAG_RW, +SYSCTL_UINT(_kern_racct_rctl, OID_AUTO, devctl_rate_limit, CTLFLAG_RWTUN, &rctl_devctl_rate_limit, 0, "Maximum number of devctl messages per second"); -SYSCTL_UINT(_kern_racct_rctl, OID_AUTO, throttle_min, CTLFLAG_RDTUN, - &rctl_throttle_min, 0, "Shortest throttling duration, in hz"); -SYSCTL_UINT(_kern_racct_rctl, OID_AUTO, throttle_max, CTLFLAG_RDTUN, - &rctl_throttle_max, 0, "Longest throttling duration, in hz"); -SYSCTL_UINT(_kern_racct_rctl, OID_AUTO, throttle_pct, CTLFLAG_RDTUN, - &rctl_throttle_pct, 0, +SYSCTL_PROC(_kern_racct_rctl, OID_AUTO, throttle_min, + CTLTYPE_UINT | CTLFLAG_RWTUN, 0, 0, &rctl_throttle_min_sysctl, "IU", + "Shortest throttling duration, in hz"); +TUNABLE_INT("kern.racct.rctl.throttle_min", &rctl_throttle_min); +SYSCTL_PROC(_kern_racct_rctl, OID_AUTO, throttle_max, + CTLTYPE_UINT | CTLFLAG_RWTUN, 0, 0, &rctl_throttle_max_sysctl, "IU", + "Longest throttling duration, in hz"); +TUNABLE_INT("kern.racct.rctl.throttle_max", &rctl_throttle_max); +SYSCTL_PROC(_kern_racct_rctl, OID_AUTO, throttle_pct, + CTLTYPE_UINT | CTLFLAG_RWTUN, 0, 0, &rctl_throttle_pct_sysctl, "IU", "Throttling penalty for process consumption, in percent"); -SYSCTL_UINT(_kern_racct_rctl, OID_AUTO, throttle_pct2, CTLFLAG_RDTUN, - &rctl_throttle_pct2, 0, +TUNABLE_INT("kern.racct.rctl.throttle_pct", &rctl_throttle_pct); +SYSCTL_PROC(_kern_racct_rctl, OID_AUTO, throttle_pct2, + CTLTYPE_UINT | CTLFLAG_RWTUN, 0, 0, &rctl_throttle_pct2_sysctl, "IU", "Throttling penalty for container consumption, in percent"); +TUNABLE_INT("kern.racct.rctl.throttle_pct2", &rctl_throttle_pct2); /* * 'rctl_rule_link' connects a rule with every racct it's related to. @@ -212,6 +227,78 @@ static void rctl_rule_to_sbuf(struct sbu static MALLOC_DEFINE(M_RCTL, "rctl", "Resource Limits"); +static int rctl_throttle_min_sysctl(SYSCTL_HANDLER_ARGS) +{ + int val = rctl_throttle_min; + int error; + + error = sysctl_handle_int(oidp, &val, 0, req); + if (error || !req->newptr) + return (error); + if (val < 1 || val > rctl_throttle_max) + return (EINVAL); + + RCTL_WLOCK(); + rctl_throttle_min = val; + RCTL_WUNLOCK(); + + return (0); +} + +static int rctl_throttle_max_sysctl(SYSCTL_HANDLER_ARGS) +{ + int val = rctl_throttle_max; + int error; + + error = sysctl_handle_int(oidp, &val, 0, req); + if (error || !req->newptr) + return (error); + if (val < rctl_throttle_min) + return (EINVAL); + + RCTL_WLOCK(); + rctl_throttle_max = val; + RCTL_WUNLOCK(); + + return (0); +} + +static int rctl_throttle_pct_sysctl(SYSCTL_HANDLER_ARGS) +{ + int val = rctl_throttle_pct; + int error; + + error = sysctl_handle_int(oidp, &val, 0, req); + if (error || !req->newptr) + return (error); + if (val < 0) + return (EINVAL); + + RCTL_WLOCK(); + rctl_throttle_pct = val; + RCTL_WUNLOCK(); + + return (0); +} + +static int rctl_throttle_pct2_sysctl(SYSCTL_HANDLER_ARGS) +{ + int val = rctl_throttle_pct2; + int error; + + error = sysctl_handle_int(oidp, &val, 0, req); + if (error || !req->newptr) + return (error); + if (val < 0) + return (EINVAL); + + RCTL_WLOCK(); + rctl_throttle_pct2 = val; + RCTL_WUNLOCK(); + + return (0); +} + static const char * rctl_subject_type_name(int subject) { @@ -2122,13 +2209,19 @@ rctl_init(void) rctl_rule_zone = uma_zcreate("rctl_rule", sizeof(struct rctl_rule), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - if (rctl_throttle_min <= 0) + /* + * Set default values, making sure not to overwrite the ones + * fetched from tunables. Most of those could be set at the + * declaration, except for the rctl_throttle_max - we cannot + * set it there due to hz not being compile time constant. + */ + if (rctl_throttle_min < 1) rctl_throttle_min = 1; - if (rctl_throttle_max <= 0) + if (rctl_throttle_max < rctl_throttle_min) rctl_throttle_max = 2 * hz; - if (rctl_throttle_pct <= 0) + if (rctl_throttle_pct < 0) rctl_throttle_pct = 100; - if (rctl_throttle_pct2 <= 0) + if (rctl_throttle_pct2 < 0) rctl_throttle_pct2 = 100; } From owner-svn-src-all@freebsd.org Fri Apr 8 20:43:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D382AB09ECD; Fri, 8 Apr 2016 20:43:51 +0000 (UTC) (envelope-from asomers@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 mx1.freebsd.org (Postfix) with ESMTPS id 8BC7D1168; Fri, 8 Apr 2016 20:43:51 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38KhoBc062604; Fri, 8 Apr 2016 20:43:50 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38Khori062603; Fri, 8 Apr 2016 20:43:50 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201604082043.u38Khori062603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 8 Apr 2016 20:43:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297723 - stable/10/sbin/devd/tests X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 20:43:51 -0000 Author: asomers Date: Fri Apr 8 20:43:50 2016 New Revision: 297723 URL: https://svnweb.freebsd.org/changeset/base/297723 Log: MFC 270231 Misc fixes suggested by Coverity. sbin/devd/tests/client_test.c * In the event that popen fails, don't dereference its return value. * Fix array overwrite in the stream and seqpacket tests. * Close sockets at the end of successful ATF tests. Modified: stable/10/sbin/devd/tests/client_test.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/devd/tests/client_test.c ============================================================================== --- stable/10/sbin/devd/tests/client_test.c Fri Apr 8 18:15:31 2016 (r297722) +++ stable/10/sbin/devd/tests/client_test.c Fri Apr 8 20:43:50 2016 (r297723) @@ -58,6 +58,7 @@ create_two_events(void) snprintf(destroy_cmd, nitems(destroy_cmd), "mdconfig -d -u %s", mdname); destroy_stdout = popen(destroy_cmd, "r"); + ATF_REQUIRE(destroy_stdout != NULL); /* We expect no output */ ATF_REQUIRE_EQ(0, pclose(destroy_stdout)); } @@ -105,7 +106,8 @@ ATF_TC_BODY(seqpacket, tc) ssize_t len; char event[1024]; - len = recv(s, event, sizeof(event), MSG_WAITALL); + /* Read 1 less than sizeof(event) to allow space for NULL */ + len = recv(s, event, sizeof(event) - 1, MSG_WAITALL); ATF_REQUIRE(len != -1); /* NULL terminate the result */ event[len] = '\0'; @@ -118,6 +120,8 @@ ATF_TC_BODY(seqpacket, tc) if (cmp == 0) got_destroy_event = true; } + + close(s); } /* @@ -160,7 +164,8 @@ ATF_TC_BODY(stream, tc) ssize_t newlen; char *create_pos, *destroy_pos; - newlen = read(s, &event[len], sizeof(event) - len); + /* Read 1 less than sizeof(event) to allow space for NULL */ + newlen = read(s, &event[len], sizeof(event) - len - 1); ATF_REQUIRE(newlen != -1); len += newlen; /* NULL terminate the result */ @@ -174,8 +179,9 @@ ATF_TC_BODY(stream, tc) destroy_pos = strstr(event, destroy_pat); if (destroy_pos != NULL) got_destroy_event = true; - } + + close(s); } /* From owner-svn-src-all@freebsd.org Fri Apr 8 21:42:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 367D7B08243; Fri, 8 Apr 2016 21:42:37 +0000 (UTC) (envelope-from asomers@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 mx1.freebsd.org (Postfix) with ESMTPS id 03DD71E56; Fri, 8 Apr 2016 21:42:36 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38LgaRL080519; Fri, 8 Apr 2016 21:42:36 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38Lgadc080518; Fri, 8 Apr 2016 21:42:36 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201604082142.u38Lgadc080518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 8 Apr 2016 21:42:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297724 - stable/10/usr.sbin/syslogd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 21:42:37 -0000 Author: asomers Date: Fri Apr 8 21:42:35 2016 New Revision: 297724 URL: https://svnweb.freebsd.org/changeset/base/297724 Log: MFC r294924 syslogd: Enable repeated line compression for lines of any length. Enable repeated line compression for lines of any length, instead of only short lines. AFAICT repeated line compression was limited to short lines as a RAM optimization, which made sense when karels added it in 1988, but no longer. The penalty is a paltry 904B of RAM per file logged. Modified: stable/10/usr.sbin/syslogd/syslogd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/syslogd/syslogd.c ============================================================================== --- stable/10/usr.sbin/syslogd/syslogd.c Fri Apr 8 20:43:50 2016 (r297723) +++ stable/10/usr.sbin/syslogd/syslogd.c Fri Apr 8 21:42:35 2016 (r297724) @@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$"); */ #define MAXLINE 1024 /* maximum line length */ -#define MAXSVLINE 120 /* maximum saved line length */ +#define MAXSVLINE MAXLINE /* maximum saved line length */ #define DEFUPRI (LOG_USER|LOG_NOTICE) #define DEFSPRI (LOG_KERN|LOG_CRIT) #define TIMERINTVL 30 /* interval for checking flush, mark */ From owner-svn-src-all@freebsd.org Fri Apr 8 23:07:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1AFFB0980C; Fri, 8 Apr 2016 23:07:17 +0000 (UTC) (envelope-from jmcneill@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 mx1.freebsd.org (Postfix) with ESMTPS id BEEDD106D; Fri, 8 Apr 2016 23:07:17 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38N7GAl005080; Fri, 8 Apr 2016 23:07:16 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38N7GAg005079; Fri, 8 Apr 2016 23:07:16 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201604082307.u38N7GAg005079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Fri, 8 Apr 2016 23:07:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297725 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 23:07:18 -0000 Author: jmcneill Date: Fri Apr 8 23:07:16 2016 New Revision: 297725 URL: https://svnweb.freebsd.org/changeset/base/297725 Log: Attach hwreset resources at the same time as clock resources. Modified: head/sys/arm/allwinner/aw_reset.c Modified: head/sys/arm/allwinner/aw_reset.c ============================================================================== --- head/sys/arm/allwinner/aw_reset.c Fri Apr 8 21:42:35 2016 (r297724) +++ head/sys/arm/allwinner/aw_reset.c Fri Apr 8 23:07:16 2016 (r297725) @@ -159,5 +159,6 @@ static driver_t aw_reset_driver = { static devclass_t aw_reset_devclass; -DRIVER_MODULE(aw_reset, simplebus, aw_reset_driver, aw_reset_devclass, 0, 0); +EARLY_DRIVER_MODULE(aw_reset, simplebus, aw_reset_driver, aw_reset_devclass, + 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); MODULE_VERSION(aw_reset, 1); From owner-svn-src-all@freebsd.org Fri Apr 8 23:11:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2733DB098A9; Fri, 8 Apr 2016 23:11:02 +0000 (UTC) (envelope-from jmcneill@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 mx1.freebsd.org (Postfix) with ESMTPS id DC8CA125C; Fri, 8 Apr 2016 23:11:01 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u38NB1uR005889; Fri, 8 Apr 2016 23:11:01 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u38NB19I005888; Fri, 8 Apr 2016 23:11:01 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201604082311.u38NB19I005888@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Fri, 8 Apr 2016 23:11:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297726 - head/sys/arm/allwinner/a31 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2016 23:11:02 -0000 Author: jmcneill Date: Fri Apr 8 23:11:00 2016 New Revision: 297726 URL: https://svnweb.freebsd.org/changeset/base/297726 Log: Fix incorrect pin definitions for Allwinner A31. Modified: head/sys/arm/allwinner/a31/a31_padconf.c Modified: head/sys/arm/allwinner/a31/a31_padconf.c ============================================================================== --- head/sys/arm/allwinner/a31/a31_padconf.c Fri Apr 8 23:07:16 2016 (r297725) +++ head/sys/arm/allwinner/a31/a31_padconf.c Fri Apr 8 23:11:00 2016 (r297726) @@ -51,19 +51,19 @@ const static struct allwinner_pins a31_p {"PA12", 0, 12, {"gpio_in", "gpio_out", "gmac", "lcd1", "mmc3", "mmc2", NULL, NULL}}, {"PA13", 0, 13, {"gpio_in", "gpio_out", "gmac", "lcd1", "mmc3", "mmc2", NULL, NULL}}, {"PA14", 0, 14, {"gpio_in", "gpio_out", "gmac", "lcd1", "mmc3", "mmc2", NULL, NULL}}, - {"PA15", 0, 15, {"gpio_in", "gpio_out", "gmac", "lcd1", "dmic", NULL, NULL, NULL}}, + {"PA15", 0, 15, {"gpio_in", "gpio_out", "gmac", "lcd1", "clk_out_a", NULL, NULL, NULL}}, {"PA16", 0, 16, {"gpio_in", "gpio_out", "gmac", "lcd1", "dmic", NULL, NULL, NULL}}, - {"PA17", 0, 17, {"gpio_in", "gpio_out", "gmac", "lcd1", "clk_out_b", NULL, NULL, NULL}}, - {"PA18", 0, 17, {"gpio_in", "gpio_out", "gmac", "lcd1", "pwm3", NULL, NULL, NULL}}, - {"PA19", 0, 17, {"gpio_in", "gpio_out", "gmac", "lcd1", "pwm3", NULL, NULL, NULL}}, - {"PA20", 0, 17, {"gpio_in", "gpio_out", "gmac", "lcd1", "spi3", NULL, NULL, NULL}}, - {"PA21", 0, 17, {"gpio_in", "gpio_out", "gmac", "lcd1", "spi3", NULL, NULL, NULL}}, - {"PA22", 0, 17, {"gpio_in", "gpio_out", "gmac", "lcd1", "spi3", NULL, NULL, NULL}}, - {"PA23", 0, 17, {"gpio_in", "gpio_out", "gmac", "lcd1", "spi3", NULL, NULL, NULL}}, - {"PA24", 0, 17, {"gpio_in", "gpio_out", "gmac", "lcd1", "spi3", NULL, NULL, NULL}}, - {"PA25", 0, 17, {"gpio_in", "gpio_out", "gmac", "lcd1", "spi3", NULL, NULL, NULL}}, - {"PA26", 0, 17, {"gpio_in", "gpio_out", "gmac", "lcd1", "clk_out_c", NULL, NULL, NULL}}, - {"PA27", 0, 17, {"gpio_in", "gpio_out", "gmac", "lcd1", NULL, NULL, NULL, NULL}}, + {"PA17", 0, 17, {"gpio_in", "gpio_out", "gmac", "lcd1", "dmic", NULL, NULL, NULL}}, + {"PA18", 0, 18, {"gpio_in", "gpio_out", "gmac", "lcd1", "clk_out_b", NULL, NULL, NULL}}, + {"PA19", 0, 19, {"gpio_in", "gpio_out", "gmac", "lcd1", "pwm3", NULL, NULL, NULL}}, + {"PA20", 0, 20, {"gpio_in", "gpio_out", "gmac", "lcd1", "pwm3", NULL, NULL, NULL}}, + {"PA21", 0, 21, {"gpio_in", "gpio_out", "gmac", "lcd1", "spi3", NULL, NULL, NULL}}, + {"PA22", 0, 22, {"gpio_in", "gpio_out", "gmac", "lcd1", "spi3", NULL, NULL, NULL}}, + {"PA23", 0, 23, {"gpio_in", "gpio_out", "gmac", "lcd1", "spi3", NULL, NULL, NULL}}, + {"PA24", 0, 24, {"gpio_in", "gpio_out", "gmac", "lcd1", "spi3", NULL, NULL, NULL}}, + {"PA25", 0, 25, {"gpio_in", "gpio_out", "gmac", "lcd1", "spi3", NULL, NULL, NULL}}, + {"PA26", 0, 26, {"gpio_in", "gpio_out", "gmac", "lcd1", "clk_out_c", NULL, NULL, NULL}}, + {"PA27", 0, 27, {"gpio_in", "gpio_out", "gmac", "lcd1", NULL, NULL, NULL, NULL}}, {"PB0", 1, 0, {"gpio_in", "gpio_out", "i2s0", "uart3", "csi", NULL, NULL, NULL}}, {"PB1", 1, 1, {"gpio_in", "gpio_out", "i2s0", NULL, NULL, NULL, NULL, NULL}}, @@ -144,11 +144,11 @@ const static struct allwinner_pins a31_p {"PE9", 4, 9, {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}}, {"PE10", 4, 10, {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}}, {"PE11", 4, 11, {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}}, - {"PE12", 4, 11, {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}}, - {"PE13", 4, 11, {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}}, - {"PE14", 4, 11, {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}}, - {"PE15", 4, 11, {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}}, - {"PE16", 4, 11, {"gpio_in", "gpio_out", "csi", NULL, NULL, NULL, NULL, NULL}}, + {"PE12", 4, 12, {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}}, + {"PE13", 4, 13, {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}}, + {"PE14", 4, 14, {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}}, + {"PE15", 4, 15, {"gpio_in", "gpio_out", "csi", "ts", NULL, NULL, NULL, NULL}}, + {"PE16", 4, 16, {"gpio_in", "gpio_out", "csi", NULL, NULL, NULL, NULL, NULL}}, {"PF0", 5, 0, {"gpio_in", "gpio_out", "mmc0", NULL, "jtag", NULL, NULL, NULL}}, {"PF1", 5, 1, {"gpio_in", "gpio_out", "mmc0", NULL, "jtag", NULL, NULL, NULL}}, @@ -205,9 +205,9 @@ const static struct allwinner_pins a31_p {"PH25", 7, 25, {"gpio_in", "gpio_out", NULL, NULL, NULL, NULL, NULL, NULL}}, {"PH26", 7, 26, {"gpio_in", "gpio_out", NULL, NULL, NULL, NULL, NULL, NULL}}, {"PH27", 7, 27, {"gpio_in", "gpio_out", NULL, NULL, NULL, NULL, NULL, NULL}}, - {"PH28", 7, 27, {"gpio_in", "gpio_out", NULL, NULL, NULL, NULL, NULL, NULL}}, - {"PH29", 7, 27, {"gpio_in", "gpio_out", "nand1", NULL, NULL, NULL, NULL, NULL}}, - {"PH30", 7, 27, {"gpio_in", "gpio_out", "nand1", NULL, NULL, NULL, NULL, NULL}}, + {"PH28", 7, 28, {"gpio_in", "gpio_out", NULL, NULL, NULL, NULL, NULL, NULL}}, + {"PH29", 7, 29, {"gpio_in", "gpio_out", "nand1", NULL, NULL, NULL, NULL, NULL}}, + {"PH30", 7, 30, {"gpio_in", "gpio_out", "nand1", NULL, NULL, NULL, NULL, NULL}}, }; const struct allwinner_padconf a31_padconf = { From owner-svn-src-all@freebsd.org Sat Apr 9 00:54:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FA5EB07412; Sat, 9 Apr 2016 00:54:03 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id 2D8401592; Sat, 9 Apr 2016 00:54:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u390s21X037782; Sat, 9 Apr 2016 00:54:02 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u390s2CO037781; Sat, 9 Apr 2016 00:54:02 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604090054.u390s2CO037781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 9 Apr 2016 00:54:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297727 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 00:54:03 -0000 Author: adrian Date: Sat Apr 9 00:54:02 2016 New Revision: 297727 URL: https://svnweb.freebsd.org/changeset/base/297727 Log: [net80211] revert part of r282405 in order to restore IBSS behaviour. This prevents nodes being created for peers on BSSes that are not our own. (Ie, same channel, IBSS, but different BSS.) The "IBSS merge" thing was fixed by me enabling "see all beacons" in the ath(4) driver a few months ago. Trouble is, we now need the filtering again. Tested: * ath(4), IBSS, on a very busy IBSS channel with lots (> 15) IBSS networks. PR: kern/208643 Sponsored by: Eva Automation, Inc. Modified: head/sys/net80211/ieee80211_adhoc.c Modified: head/sys/net80211/ieee80211_adhoc.c ============================================================================== --- head/sys/net80211/ieee80211_adhoc.c Fri Apr 8 23:11:00 2016 (r297726) +++ head/sys/net80211/ieee80211_adhoc.c Sat Apr 9 00:54:02 2016 (r297727) @@ -371,10 +371,7 @@ adhoc_input(struct ieee80211_node *ni, s /* * Validate the bssid. */ - if (!(type == IEEE80211_FC0_TYPE_MGT && - (subtype == IEEE80211_FC0_SUBTYPE_BEACON || - subtype == IEEE80211_FC0_SUBTYPE_PROBE_RESP)) && - !IEEE80211_ADDR_EQ(bssid, vap->iv_bss->ni_bssid) && + if (!IEEE80211_ADDR_EQ(bssid, vap->iv_bss->ni_bssid) && !IEEE80211_ADDR_EQ(bssid, ifp->if_broadcastaddr)) { /* not interested in */ IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT, From owner-svn-src-all@freebsd.org Sat Apr 9 00:55:57 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B03EB074DF; Sat, 9 Apr 2016 00:55:57 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id 0E4EB172E; Sat, 9 Apr 2016 00:55:56 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u390tukf037913; Sat, 9 Apr 2016 00:55:56 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u390tuBl037911; Sat, 9 Apr 2016 00:55:56 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604090055.u390tuBl037911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 9 Apr 2016 00:55:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297728 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 00:55:57 -0000 Author: adrian Date: Sat Apr 9 00:55:55 2016 New Revision: 297728 URL: https://svnweb.freebsd.org/changeset/base/297728 Log: [net8021] Pull out the ibss check code into a public function. The ath(4) driver now sees beacons and management frames for different BSSIDs in IBSS mode, which is a problem when you're in a very busy IBSS environment. So, expose this function so drivers can use it to check if the current RX node is actually for a BSS we need to pay attention to or not. PR: kern/208644 Sponsored by: Eva Automation. Inc. Modified: head/sys/net80211/ieee80211_node.c head/sys/net80211/ieee80211_node.h Modified: head/sys/net80211/ieee80211_node.c ============================================================================== --- head/sys/net80211/ieee80211_node.c Sat Apr 9 00:54:02 2016 (r297727) +++ head/sys/net80211/ieee80211_node.c Sat Apr 9 00:55:55 2016 (r297728) @@ -556,6 +556,33 @@ check_bss_debug(struct ieee80211vap *vap } #endif /* IEEE80211_DEBUG */ + +int +ieee80211_ibss_merge_check(struct ieee80211_node *ni) +{ + struct ieee80211vap *vap = ni->ni_vap; + + if (ni == vap->iv_bss || + IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) { + /* unchanged, nothing to do */ + return 0; + } + + if (!check_bss(vap, ni)) { + /* capabilities mismatch */ + IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC, + "%s: merge failed, capabilities mismatch\n", __func__); +#ifdef IEEE80211_DEBUG + if (ieee80211_msg_assoc(vap)) + check_bss_debug(vap, ni); +#endif + vap->iv_stats.is_ibss_capmismatch++; + return 0; + } + + return 1; +} + /* * Handle 802.11 ad hoc network merge. The * convention, set by the Wireless Ethernet Compatibility Alliance @@ -576,22 +603,9 @@ ieee80211_ibss_merge(struct ieee80211_no struct ieee80211com *ic = ni->ni_ic; #endif - if (ni == vap->iv_bss || - IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) { - /* unchanged, nothing to do */ + if (! ieee80211_ibss_merge_check(ni)) return 0; - } - if (!check_bss(vap, ni)) { - /* capabilities mismatch */ - IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC, - "%s: merge failed, capabilities mismatch\n", __func__); -#ifdef IEEE80211_DEBUG - if (ieee80211_msg_assoc(vap)) - check_bss_debug(vap, ni); -#endif - vap->iv_stats.is_ibss_capmismatch++; - return 0; - } + IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC, "%s: new bssid %s: %s preamble, %s slot time%s\n", __func__, ether_sprintf(ni->ni_bssid), Modified: head/sys/net80211/ieee80211_node.h ============================================================================== --- head/sys/net80211/ieee80211_node.h Sat Apr 9 00:54:02 2016 (r297727) +++ head/sys/net80211/ieee80211_node.h Sat Apr 9 00:55:55 2016 (r297728) @@ -330,6 +330,7 @@ void ieee80211_setupcurchan(struct ieee8 struct ieee80211_channel *); void ieee80211_setcurchan(struct ieee80211com *, struct ieee80211_channel *); void ieee80211_update_chw(struct ieee80211com *); +int ieee80211_ibss_merge_check(struct ieee80211_node *); int ieee80211_ibss_merge(struct ieee80211_node *); struct ieee80211_scan_entry; int ieee80211_sta_join(struct ieee80211vap *, struct ieee80211_channel *, From owner-svn-src-all@freebsd.org Sat Apr 9 00:58:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 944C6B07668; Sat, 9 Apr 2016 00:58:39 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id 6E42B19BD; Sat, 9 Apr 2016 00:58:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u390wchn038054; Sat, 9 Apr 2016 00:58:38 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u390wcZZ038053; Sat, 9 Apr 2016 00:58:38 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604090058.u390wcZZ038053@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 9 Apr 2016 00:58:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297729 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 00:58:39 -0000 Author: adrian Date: Sat Apr 9 00:58:38 2016 New Revision: 297729 URL: https://svnweb.freebsd.org/changeset/base/297729 Log: [ath] Only process beacon frames for the IBSS/BSSID if appropriate. * Don't use arbitrary frames for the average RX RSSI - only frames from the current BSSID * Don't log / do the syncbeacon logic for another BSSID and definitely don't do the syncbeacon call if we miss beacons outside of STA mode. * Don't do the IBSS merge bits if the current node plainly won't ever match our current BSS (ie, the IBSS doesn't have to match, but all the same bits that we check in ieee80211_ibss_merge() have to match.) Tested: * ath(4), AR9380, IBSS mode, surrounded by a lot of IBSS 11ac networks. Sponsored by: Eva Automation, Inc. Modified: head/sys/dev/ath/if_ath_rx.c Modified: head/sys/dev/ath/if_ath_rx.c ============================================================================== --- head/sys/dev/ath/if_ath_rx.c Sat Apr 9 00:55:55 2016 (r297728) +++ head/sys/dev/ath/if_ath_rx.c Sat Apr 9 00:58:38 2016 (r297729) @@ -361,85 +361,102 @@ ath_recv_mgmt(struct ieee80211_node *ni, ATH_VAP(vap)->av_recv_mgmt(ni, m, subtype, rxs, rssi, nf); switch (subtype) { case IEEE80211_FC0_SUBTYPE_BEACON: - /* update rssi statistics for use by the hal */ - /* XXX unlocked check against vap->iv_bss? */ - ATH_RSSI_LPF(sc->sc_halstats.ns_avgbrssi, rssi); - tsf_beacon = ((uint64_t) LE_READ_4(ni->ni_tstamp.data + 4)) << 32; - tsf_beacon |= LE_READ_4(ni->ni_tstamp.data); + /* + * Only do the following processing if it's for + * the current BSS. + * + * In scan and IBSS mode we receive all beacons, + * which means we need to filter out stuff + * that isn't for us or we'll end up constantly + * trying to sync / merge to BSSes that aren't + * actually us. + */ + if (IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) { + /* update rssi statistics for use by the hal */ + /* XXX unlocked check against vap->iv_bss? */ + ATH_RSSI_LPF(sc->sc_halstats.ns_avgbrssi, rssi); - nexttbtt = ath_hal_getnexttbtt(sc->sc_ah); - /* - * Let's calculate the delta and remainder, so we can see - * if the beacon timer from the AP is varying by more than - * a few TU. (Which would be a huge, huge problem.) - */ - tsf_delta = (long long) tsf_beacon - (long long) tsf_beacon_old; + tsf_beacon = ((uint64_t) LE_READ_4(ni->ni_tstamp.data + 4)) << 32; + tsf_beacon |= LE_READ_4(ni->ni_tstamp.data); - tsf_delta_bmiss = tsf_delta / tsf_intval; + nexttbtt = ath_hal_getnexttbtt(sc->sc_ah); - /* - * If our delta is greater than half the beacon interval, - * let's round the bmiss value up to the next beacon - * interval. Ie, we're running really, really early - * on the next beacon. - */ - if (tsf_delta % tsf_intval > (tsf_intval / 2)) - tsf_delta_bmiss ++; + /* + * Let's calculate the delta and remainder, so we can see + * if the beacon timer from the AP is varying by more than + * a few TU. (Which would be a huge, huge problem.) + */ + tsf_delta = (long long) tsf_beacon - (long long) tsf_beacon_old; - tsf_beacon_target = tsf_beacon_old + - (((unsigned long long) tsf_delta_bmiss) * (long long) tsf_intval); + tsf_delta_bmiss = tsf_delta / tsf_intval; - /* - * The remainder using '%' is between 0 .. intval-1. - * If we're actually running too fast, then the remainder - * will be some large number just under intval-1. - * So we need to look at whether we're running - * before or after the target beacon interval - * and if we are, modify how we do the remainder - * calculation. - */ - if (tsf_beacon < tsf_beacon_target) { - tsf_remainder = - -(tsf_intval - ((tsf_beacon - tsf_beacon_old) % tsf_intval)); - } else { - tsf_remainder = (tsf_beacon - tsf_beacon_old) % tsf_intval; - } + /* + * If our delta is greater than half the beacon interval, + * let's round the bmiss value up to the next beacon + * interval. Ie, we're running really, really early + * on the next beacon. + */ + if (tsf_delta % tsf_intval > (tsf_intval / 2)) + tsf_delta_bmiss ++; - DPRINTF(sc, ATH_DEBUG_BEACON, "%s: old_tsf=%llu, new_tsf=%llu, target_tsf=%llu, delta=%lld, bmiss=%d, remainder=%d\n", - __func__, - (unsigned long long) tsf_beacon_old, - (unsigned long long) tsf_beacon, - (unsigned long long) tsf_beacon_target, - (long long) tsf_delta, - tsf_delta_bmiss, - tsf_remainder); + tsf_beacon_target = tsf_beacon_old + + (((unsigned long long) tsf_delta_bmiss) * (long long) tsf_intval); - DPRINTF(sc, ATH_DEBUG_BEACON, "%s: tsf=%llu, nexttbtt=%llu, delta=%d\n", - __func__, - (unsigned long long) tsf_beacon, - (unsigned long long) nexttbtt, - (int32_t) tsf_beacon - (int32_t) nexttbtt + tsf_intval); - - if (sc->sc_syncbeacon && - ni == vap->iv_bss && - (vap->iv_state == IEEE80211_S_RUN || vap->iv_state == IEEE80211_S_SLEEP)) { - DPRINTF(sc, ATH_DEBUG_BEACON, - "%s: syncbeacon=1; syncing\n", - __func__); /* - * Resync beacon timers using the tsf of the beacon - * frame we just received. + * The remainder using '%' is between 0 .. intval-1. + * If we're actually running too fast, then the remainder + * will be some large number just under intval-1. + * So we need to look at whether we're running + * before or after the target beacon interval + * and if we are, modify how we do the remainder + * calculation. */ - ath_beacon_config(sc, vap); - sc->sc_syncbeacon = 0; + if (tsf_beacon < tsf_beacon_target) { + tsf_remainder = + -(tsf_intval - ((tsf_beacon - tsf_beacon_old) % tsf_intval)); + } else { + tsf_remainder = (tsf_beacon - tsf_beacon_old) % tsf_intval; + } + + DPRINTF(sc, ATH_DEBUG_BEACON, "%s: old_tsf=%llu, new_tsf=%llu, target_tsf=%llu, delta=%lld, bmiss=%d, remainder=%d\n", + __func__, + (unsigned long long) tsf_beacon_old, + (unsigned long long) tsf_beacon, + (unsigned long long) tsf_beacon_target, + (long long) tsf_delta, + tsf_delta_bmiss, + tsf_remainder); + + DPRINTF(sc, ATH_DEBUG_BEACON, "%s: tsf=%llu, nexttbtt=%llu, delta=%d\n", + __func__, + (unsigned long long) tsf_beacon, + (unsigned long long) nexttbtt, + (int32_t) tsf_beacon - (int32_t) nexttbtt + tsf_intval); + + /* We only do syncbeacon on STA VAPs; not on IBSS */ + if (vap->iv_opmode == IEEE80211_M_STA && + sc->sc_syncbeacon && + ni == vap->iv_bss && + (vap->iv_state == IEEE80211_S_RUN || vap->iv_state == IEEE80211_S_SLEEP)) { + DPRINTF(sc, ATH_DEBUG_BEACON, + "%s: syncbeacon=1; syncing\n", + __func__); + /* + * Resync beacon timers using the tsf of the beacon + * frame we just received. + */ + ath_beacon_config(sc, vap); + sc->sc_syncbeacon = 0; + } } /* fall thru... */ case IEEE80211_FC0_SUBTYPE_PROBE_RESP: if (vap->iv_opmode == IEEE80211_M_IBSS && - vap->iv_state == IEEE80211_S_RUN) { + vap->iv_state == IEEE80211_S_RUN && + ieee80211_ibss_merge_check(ni)) { uint32_t rstamp = sc->sc_lastrs->rs_tstamp; uint64_t tsf = ath_extend_tsf(sc, rstamp, ath_hal_gettsf64(sc->sc_ah)); From owner-svn-src-all@freebsd.org Sat Apr 9 01:02:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21AC6B0783E; Sat, 9 Apr 2016 01:02:19 +0000 (UTC) (envelope-from jhibbits@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 mx1.freebsd.org (Postfix) with ESMTPS id E7C501D26; Sat, 9 Apr 2016 01:02:18 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3912IVV040815; Sat, 9 Apr 2016 01:02:18 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3912I2s040814; Sat, 9 Apr 2016 01:02:18 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201604090102.u3912I2s040814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 9 Apr 2016 01:02:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297730 - head/sys/dev/hwpmc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 01:02:19 -0000 Author: jhibbits Date: Sat Apr 9 01:02:17 2016 New Revision: 297730 URL: https://svnweb.freebsd.org/changeset/base/297730 Log: Fix a masking bug for e500 PMC. No idea how this slipped through my regression testing. pe_code is the event to count, pe_cpu is the CPU family mask. Modified: head/sys/dev/hwpmc/hwpmc_e500.c Modified: head/sys/dev/hwpmc/hwpmc_e500.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_e500.c Sat Apr 9 00:58:38 2016 (r297729) +++ head/sys/dev/hwpmc/hwpmc_e500.c Sat Apr 9 01:02:17 2016 (r297730) @@ -507,6 +507,7 @@ e500_allocate_pmc(int cpu, int ri, struc pe = a->pm_ev; config = PMLCax_FCS | PMLCax_FCU | PMLCax_FCM1 | PMLCax_FCM1; + if (pe < PMC_EV_E500_FIRST || pe > PMC_EV_E500_LAST) return (EINVAL); @@ -517,14 +518,14 @@ e500_allocate_pmc(int cpu, int ri, struc vers = mfpvr() >> 16; switch (vers) { case FSL_E500v1: - pe_cpu_mask = ev->pe_code & PMC_PPC_E500V1; + pe_cpu_mask = ev->pe_cpu & PMC_PPC_E500V1; break; case FSL_E500v2: - pe_cpu_mask = ev->pe_code & PMC_PPC_E500V2; + pe_cpu_mask = ev->pe_cpu & PMC_PPC_E500V2; break; case FSL_E500mc: case FSL_E5500: - pe_cpu_mask = ev->pe_code & PMC_PPC_E500MC; + pe_cpu_mask = ev->pe_cpu & PMC_PPC_E500MC; break; } if (pe_cpu_mask == 0) From owner-svn-src-all@freebsd.org Sat Apr 9 04:57:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 383CFB0936B; Sat, 9 Apr 2016 04:57:26 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id 0985D12CC; Sat, 9 Apr 2016 04:57:25 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u394vPUL010288; Sat, 9 Apr 2016 04:57:25 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u394vPw7010287; Sat, 9 Apr 2016 04:57:25 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604090457.u394vPw7010287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 9 Apr 2016 04:57:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297731 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 04:57:26 -0000 Author: adrian Date: Sat Apr 9 04:57:25 2016 New Revision: 297731 URL: https://svnweb.freebsd.org/changeset/base/297731 Log: [net80211] print out the channel type (eg a, b, g, n) when creating an IBSS network. Modified: head/sys/net80211/ieee80211_node.c Modified: head/sys/net80211/ieee80211_node.c ============================================================================== --- head/sys/net80211/ieee80211_node.c Sat Apr 9 01:02:17 2016 (r297730) +++ head/sys/net80211/ieee80211_node.c Sat Apr 9 04:57:25 2016 (r297731) @@ -330,9 +330,10 @@ ieee80211_create_ibss(struct ieee80211va struct ieee80211_node *ni; IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, - "%s: creating %s on channel %u\n", __func__, + "%s: creating %s on channel %u%c\n", __func__, ieee80211_opmode_name[vap->iv_opmode], - ieee80211_chan2ieee(ic, chan)); + ieee80211_chan2ieee(ic, chan), + ieee80211_channel_type_char(chan)); ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr); if (ni == NULL) { From owner-svn-src-all@freebsd.org Sat Apr 9 09:24:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0700B08E59; Sat, 9 Apr 2016 09:24:06 +0000 (UTC) (envelope-from bz@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 mx1.freebsd.org (Postfix) with ESMTPS id 731E614AB; Sat, 9 Apr 2016 09:24:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u399O539092581; Sat, 9 Apr 2016 09:24:05 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u399O5rG092580; Sat, 9 Apr 2016 09:24:05 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201604090924.u399O5rG092580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 9 Apr 2016 09:24:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297732 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 09:24:06 -0000 Author: bz Date: Sat Apr 9 09:24:05 2016 New Revision: 297732 URL: https://svnweb.freebsd.org/changeset/base/297732 Log: Make the KASSERT message in hash destroy more informative. While the pointer might not be too helpful, the malloc type might at least give a good hint about which hashtbl we are talking. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Reviewed by: gnn, emaste Differential Revision: https://reviews.freebsd.org/D5802 Modified: head/sys/kern/subr_hash.c Modified: head/sys/kern/subr_hash.c ============================================================================== --- head/sys/kern/subr_hash.c Sat Apr 9 04:57:25 2016 (r297731) +++ head/sys/kern/subr_hash.c Sat Apr 9 09:24:05 2016 (r297732) @@ -93,7 +93,8 @@ hashdestroy(void *vhashtbl, struct mallo hashtbl = vhashtbl; for (hp = hashtbl; hp <= &hashtbl[hashmask]; hp++) - KASSERT(LIST_EMPTY(hp), ("%s: hash not empty", __func__)); + KASSERT(LIST_EMPTY(hp), ("%s: hashtbl %p not empty " + "(malloc type %s)", __func__, hashtbl, type->ks_shortdesc)); free(hashtbl, type); } From owner-svn-src-all@freebsd.org Sat Apr 9 09:31:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26082B09074; Sat, 9 Apr 2016 09:31:30 +0000 (UTC) (envelope-from bz@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 mx1.freebsd.org (Postfix) with ESMTPS id E135C176C; Sat, 9 Apr 2016 09:31:29 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u399VTVa093486; Sat, 9 Apr 2016 09:31:29 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u399VTbw093485; Sat, 9 Apr 2016 09:31:29 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201604090931.u399VTbw093485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 9 Apr 2016 09:31:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297733 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 09:31:30 -0000 Author: bz Date: Sat Apr 9 09:31:28 2016 New Revision: 297733 URL: https://svnweb.freebsd.org/changeset/base/297733 Log: Try to unbreak the build: the 'vap' variable is only used if ieee80211 debugging compile is on. Modified: head/sys/net80211/ieee80211_node.c Modified: head/sys/net80211/ieee80211_node.c ============================================================================== --- head/sys/net80211/ieee80211_node.c Sat Apr 9 09:24:05 2016 (r297732) +++ head/sys/net80211/ieee80211_node.c Sat Apr 9 09:31:28 2016 (r297733) @@ -599,8 +599,8 @@ ieee80211_ibss_merge_check(struct ieee80 int ieee80211_ibss_merge(struct ieee80211_node *ni) { - struct ieee80211vap *vap = ni->ni_vap; #ifdef IEEE80211_DEBUG + struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ni->ni_ic; #endif From owner-svn-src-all@freebsd.org Sat Apr 9 10:39:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8983B09641; Sat, 9 Apr 2016 10:39:55 +0000 (UTC) (envelope-from bz@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 mx1.freebsd.org (Postfix) with ESMTPS id 9C89A1489; Sat, 9 Apr 2016 10:39:55 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39AdsC8014156; Sat, 9 Apr 2016 10:39:54 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39AdsEt014155; Sat, 9 Apr 2016 10:39:54 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201604091039.u39AdsEt014155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 9 Apr 2016 10:39:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297734 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 10:39:56 -0000 Author: bz Date: Sat Apr 9 10:39:54 2016 New Revision: 297734 URL: https://svnweb.freebsd.org/changeset/base/297734 Log: Mfp: r296346 No reason identified to keep UMA_ZONE_NOFREE here. Reviewed by: gnn MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5736 Modified: head/sys/netinet/ip_divert.c Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Sat Apr 9 09:31:28 2016 (r297733) +++ head/sys/netinet/ip_divert.c Sat Apr 9 10:39:54 2016 (r297734) @@ -158,8 +158,7 @@ div_init(void) * place for hashbase == NULL. */ in_pcbinfo_init(&V_divcbinfo, "div", &V_divcb, 1, 1, "divcb", - div_inpcb_init, div_inpcb_fini, UMA_ZONE_NOFREE, - IPI_HASHFIELDS_NONE); + div_inpcb_init, div_inpcb_fini, 0, IPI_HASHFIELDS_NONE); } static void From owner-svn-src-all@freebsd.org Sat Apr 9 10:44:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31675B097C4; Sat, 9 Apr 2016 10:44:59 +0000 (UTC) (envelope-from bz@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 mx1.freebsd.org (Postfix) with ESMTPS id E58531937; Sat, 9 Apr 2016 10:44:58 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39Aiw2R017072; Sat, 9 Apr 2016 10:44:58 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39Aiw84017071; Sat, 9 Apr 2016 10:44:58 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201604091044.u39Aiw84017071@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 9 Apr 2016 10:44:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297735 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 10:44:59 -0000 Author: bz Date: Sat Apr 9 10:44:57 2016 New Revision: 297735 URL: https://svnweb.freebsd.org/changeset/base/297735 Log: Mfp: r296345 No need to keep type stability on raw sockets zone. We've also been running with a KASSERT since r222488 to make sure the ipi_count is 0 on destroy. PR: 164763 Reviewed by: gnn MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5735 Modified: head/sys/netinet/raw_ip.c Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Sat Apr 9 10:39:54 2016 (r297734) +++ head/sys/netinet/raw_ip.c Sat Apr 9 10:44:57 2016 (r297735) @@ -209,8 +209,7 @@ rip_init(void) { in_pcbinfo_init(&V_ripcbinfo, "rip", &V_ripcb, INP_PCBHASH_RAW_SIZE, - 1, "ripcb", rip_inpcb_init, NULL, UMA_ZONE_NOFREE, - IPI_HASHFIELDS_NONE); + 1, "ripcb", rip_inpcb_init, NULL, 0, IPI_HASHFIELDS_NONE); EVENTHANDLER_REGISTER(maxsockets_change, rip_zone_change, NULL, EVENTHANDLER_PRI_ANY); } From owner-svn-src-all@freebsd.org Sat Apr 9 10:51:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0E1BB099FE; Sat, 9 Apr 2016 10:51:08 +0000 (UTC) (envelope-from bz@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 mx1.freebsd.org (Postfix) with ESMTPS id 6EB471BB5; Sat, 9 Apr 2016 10:51:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39Ap7db018088; Sat, 9 Apr 2016 10:51:07 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39Ap7ni018087; Sat, 9 Apr 2016 10:51:07 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201604091051.u39Ap7ni018087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 9 Apr 2016 10:51:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297736 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 10:51:08 -0000 Author: bz Date: Sat Apr 9 10:51:07 2016 New Revision: 297736 URL: https://svnweb.freebsd.org/changeset/base/297736 Log: Mfp: r296309 While there is no dependency interaction, stopping the timer before freeing the rest of the resources seems more natural and avoids it being scheduled an extra time when it is no longer needed. Reviewed by: gnn, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5733 Modified: head/sys/netinet/tcp_syncache.c Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Sat Apr 9 10:44:57 2016 (r297735) +++ head/sys/netinet/tcp_syncache.c Sat Apr 9 10:51:07 2016 (r297736) @@ -281,6 +281,12 @@ syncache_destroy(void) struct syncache *sc, *nsc; int i; + /* + * Stop the re-seed timer before freeing resources. No need to + * possibly schedule it another time. + */ + callout_drain(&V_tcp_syncache.secret.reseed); + /* Cleanup hash buckets: stop timers, free entries, destroy locks. */ for (i = 0; i < V_tcp_syncache.hashsize; i++) { @@ -304,8 +310,6 @@ syncache_destroy(void) /* Free the allocated global resources. */ uma_zdestroy(V_tcp_syncache.zone); free(V_tcp_syncache.hashbase, M_SYNCACHE); - - callout_drain(&V_tcp_syncache.secret.reseed); } #endif From owner-svn-src-all@freebsd.org Sat Apr 9 10:53:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D288AB09A8F; Sat, 9 Apr 2016 10:53:22 +0000 (UTC) (envelope-from phk@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 mx1.freebsd.org (Postfix) with ESMTPS id 9FDFB1F00; Sat, 9 Apr 2016 10:53:22 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39ArL9Q020363; Sat, 9 Apr 2016 10:53:21 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39ArLUd020362; Sat, 9 Apr 2016 10:53:21 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201604091053.u39ArLUd020362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Sat, 9 Apr 2016 10:53:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297737 - head/tools/tools/nanobsd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 10:53:22 -0000 Author: phk Date: Sat Apr 9 10:53:21 2016 New Revision: 297737 URL: https://svnweb.freebsd.org/changeset/base/297737 Log: Create /usr/local/etc before filling things into it. Only run mtree if the NANO_CUST_FILES_MTREE is nonempty Also umount the packages on non-signal failure Modified: head/tools/tools/nanobsd/defaults.sh Modified: head/tools/tools/nanobsd/defaults.sh ============================================================================== --- head/tools/tools/nanobsd/defaults.sh Sat Apr 9 10:51:07 2016 (r297736) +++ head/tools/tools/nanobsd/defaults.sh Sat Apr 9 10:53:21 2016 (r297737) @@ -915,7 +915,7 @@ cust_install_files ( ) ( cd "${NANO_TOOLS}/Files" find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)' | cpio -Ldumpv ${NANO_WORLDDIR} - if [ -f ${NANO_CUST_FILES_MTREE} ]; then + if [ -n "${NANO_CUST_FILES_MTREE}" -a -f ${NANO_CUST_FILES_MTREE} ]; then CR "mtree -eiU -p /" <${NANO_CUST_FILES_MTREE} fi ) @@ -925,6 +925,7 @@ cust_install_files ( ) ( cust_pkgng ( ) ( + mkdir -p ${NANO_WORLDDIR}/usr/local/etc local PKG_CONF="${NANO_WORLDDIR}/usr/local/etc/pkg.conf" local PKGCMD="env ASSUME_ALWAYS_YES=YES PKG_DBDIR=${NANO_PKG_META_BASE}/pkg SIGNATURE_TYPE=none /usr/sbin/pkg" @@ -956,7 +957,7 @@ cust_pkgng ( ) ( mkdir -p ${NANO_WORLDDIR}/_.p mount -t nullfs -o noatime -o ro ${NANO_PACKAGE_DIR} ${NANO_WORLDDIR}/_.p - trap "umount ${NANO_WORLDDIR}/_.p ; rm -rf ${NANO_WORLDDIR}/_.p" 1 2 15 + trap "umount ${NANO_WORLDDIR}/_.p ; rm -rf ${NANO_WORLDDIR}/_.p" 1 2 15 EXIT # Install packages todo="$(echo "${NANO_PACKAGE_LIST}" | awk '{ print NF }')" From owner-svn-src-all@freebsd.org Sat Apr 9 10:58:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7AEAB09C75; Sat, 9 Apr 2016 10:58:09 +0000 (UTC) (envelope-from bz@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 mx1.freebsd.org (Postfix) with ESMTPS id 8F4EF1213; Sat, 9 Apr 2016 10:58:09 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39Aw8w5020689; Sat, 9 Apr 2016 10:58:08 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39Aw8wt020687; Sat, 9 Apr 2016 10:58:08 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201604091058.u39Aw8wt020687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 9 Apr 2016 10:58:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297738 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 10:58:09 -0000 Author: bz Date: Sat Apr 9 10:58:08 2016 New Revision: 297738 URL: https://svnweb.freebsd.org/changeset/base/297738 Log: Mfp: r296259 We attach the "counter" to the tcpcbs. Thus don't free the TCP Fastopen zone before the tcpcbs are gone, as otherwise the zone won't be empty. With that it should be safe to destroy the "tfo" zone without leaking the memory. PR: 164763 Reviewed by: gnn MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5731 Modified: head/sys/netinet/tcp_fastopen.c head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_fastopen.c ============================================================================== --- head/sys/netinet/tcp_fastopen.c Sat Apr 9 10:53:21 2016 (r297737) +++ head/sys/netinet/tcp_fastopen.c Sat Apr 9 10:58:08 2016 (r297738) @@ -204,7 +204,7 @@ void tcp_fastopen_init(void) { V_counter_zone = uma_zcreate("tfo", sizeof(unsigned int), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); rm_init(&V_tcp_fastopen_keylock, "tfo_keylock"); callout_init_rm(&V_tcp_fastopen_autokey_ctx.c, &V_tcp_fastopen_keylock, 0); Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Sat Apr 9 10:53:21 2016 (r297737) +++ head/sys/netinet/tcp_subr.c Sat Apr 9 10:58:08 2016 (r297738) @@ -738,9 +738,6 @@ tcp_destroy(void) { int error; -#ifdef TCP_RFC7413 - tcp_fastopen_destroy(); -#endif tcp_hc_destroy(); syncache_destroy(); tcp_tw_destroy(); @@ -748,6 +745,14 @@ tcp_destroy(void) uma_zdestroy(V_sack_hole_zone); uma_zdestroy(V_tcpcb_zone); +#ifdef TCP_RFC7413 + /* + * Cannot free the zone until all tcpcbs are released as we attach + * the allocations to them. + */ + tcp_fastopen_destroy(); +#endif + error = hhook_head_deregister(V_tcp_hhh[HHOOK_TCP_EST_IN]); if (error != 0) { printf("%s: WARNING: unable to deregister helper hook " From owner-svn-src-all@freebsd.org Sat Apr 9 11:03:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A20AB09FF0 for ; Sat, 9 Apr 2016 11:03:41 +0000 (UTC) (envelope-from oliver.pinter@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 9D73B199A for ; Sat, 9 Apr 2016 11:03:40 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-wm0-x232.google.com with SMTP id 191so40186074wmq.0 for ; Sat, 09 Apr 2016 04:03:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=/o9U9/5tfIVbfHXmv7ZOqPJGyl0bbnyxO42CI7R8lz0=; b=sblLwQVqe+iCkqDvJPCTXfDUAg76SVK3d0kxjOrp7gHeINKIkpTE+oppCKUNXWeNTk 45+lFJoosP3fcf7yid4PWDpawaYkrlXizC4QqxFjKq5bBbrHuZ3HfDuc8BnDSybTJbD+ ZLjcLe8ADtG8sy4hgTJ6ieB7VqI47pOUDR0jL3ZXRu8oaEq8NzkRAyHiEfaD2+Asm0Ls 5hR1TIbRRl10pNgHzNINp6I0jMTAngtDBKiCB1Tg2xDpwq4GRzmqbW/rsS8JZDjXyym3 8DePaJe9yBtyPAYAm192J3FFkfchQHt8d5p9TsXwof2B3BXKf76WSNJEye0xi9UgKxUf pdQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=/o9U9/5tfIVbfHXmv7ZOqPJGyl0bbnyxO42CI7R8lz0=; b=JXblmSRAVuq3JNINx+Rq4bfmU6wDmDmw5nzbNpe4HkMkxR63eFRjkocunDN85bPaZe pLuZiWRtYswrfL+HMSmTGVvV6t7wfOqqU8ulGX9jPuxqiutWfxhRuoYaFPUm4O9Lg5E7 /n9e4V+yd96eAHG2JXsSqAphve71NkvQSSc8o3KG6gofD4/sGNiRTuka5rddPM/MfiFb /izPTqONfLbmTsGqStZ89JE2bqshub5/6ih3xr0N63JPtTJQjB3ndvC/h8BMi19ujLay XteP8PhF6yqv18j0IZ7qUlZ+0ayeGEDjJeUTn70GqmCYyp8AYzyeS5/dlQHKVTvhk4+J cp8A== X-Gm-Message-State: AD7BkJJ6sz0QoiH934apwOJuHzwfD38SlGXNs4SIhmhUT6CBPw/bT40EosXVbsofWAG1EA5+gqcyPS+ZjPyRiGCg MIME-Version: 1.0 X-Received: by 10.28.101.213 with SMTP id z204mr8960005wmb.22.1460199818848; Sat, 09 Apr 2016 04:03:38 -0700 (PDT) Received: by 10.194.243.98 with HTTP; Sat, 9 Apr 2016 04:03:38 -0700 (PDT) In-Reply-To: <201604072012.u37KCjCa011359@repo.freebsd.org> References: <201604072012.u37KCjCa011359@repo.freebsd.org> Date: Sat, 9 Apr 2016 13:03:38 +0200 Message-ID: Subject: Re: svn commit: r297685 - in head/sys: conf dev/kbdmux modules/kbdmux From: Oliver Pinter To: Ed Maste Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 11:03:41 -0000 Hi Ed! On Thu, Apr 7, 2016 at 10:12 PM, Ed Maste wrote: > Author: emaste > Date: Thu Apr 7 20:12:45 2016 > New Revision: 297685 > URL: https://svnweb.freebsd.org/changeset/base/297685 > > Log: > Add option to specify built-in keymap for kbdmux > > PR: 153459 > Submitted by: swell.k@gmail.com > > Modified: > head/sys/conf/NOTES > head/sys/conf/files > head/sys/conf/options > head/sys/dev/kbdmux/kbdmux.c > head/sys/modules/kbdmux/Makefile > > Modified: head/sys/conf/NOTES > It would be nice to MFC this change to 10-STABLE. From owner-svn-src-all@freebsd.org Sat Apr 9 11:23:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74BC0B07674; Sat, 9 Apr 2016 11:23:47 +0000 (UTC) (envelope-from jmcneill@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 mx1.freebsd.org (Postfix) with ESMTPS id 43187124D; Sat, 9 Apr 2016 11:23:47 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39BNkA9029422; Sat, 9 Apr 2016 11:23:46 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39BNknO029421; Sat, 9 Apr 2016 11:23:46 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201604091123.u39BNknO029421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sat, 9 Apr 2016 11:23:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297739 - head/sys/arm/allwinner/a20 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 11:23:47 -0000 Author: jmcneill Date: Sat Apr 9 11:23:46 2016 New Revision: 297739 URL: https://svnweb.freebsd.org/changeset/base/297739 Log: Enable PHY regulator when the optional "phy-supply" property is present. Submitted by: Emmanuel Vadot Modified: head/sys/arm/allwinner/a20/a20_if_dwc.c Modified: head/sys/arm/allwinner/a20/a20_if_dwc.c ============================================================================== --- head/sys/arm/allwinner/a20/a20_if_dwc.c Sat Apr 9 10:58:08 2016 (r297738) +++ head/sys/arm/allwinner/a20/a20_if_dwc.c Sat Apr 9 11:23:46 2016 (r297739) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "if_dwc_if.h" @@ -64,6 +65,7 @@ a20_if_dwc_init(device_t dev) const char *tx_parent_name; char *phy_type; clk_t clk_tx, clk_tx_parent; + regulator_t reg; phandle_t node; int error; @@ -96,6 +98,15 @@ a20_if_dwc_init(device_t dev) } } + /* Enable PHY regulator if applicable */ + if (regulator_get_by_ofw_property(dev, "phy-supply", ®) == 0) { + error = regulator_enable(reg); + if (error != 0) { + device_printf(dev, "could not enable PHY regulator\n"); + return (error); + } + } + return (0); } From owner-svn-src-all@freebsd.org Sat Apr 9 11:27:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 028DFB0777C; Sat, 9 Apr 2016 11:27:49 +0000 (UTC) (envelope-from bz@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 mx1.freebsd.org (Postfix) with ESMTPS id C83E314A0; Sat, 9 Apr 2016 11:27:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39BRmkb029591; Sat, 9 Apr 2016 11:27:48 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39BRm9U029590; Sat, 9 Apr 2016 11:27:48 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201604091127.u39BRm9U029590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 9 Apr 2016 11:27:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297740 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 11:27:49 -0000 Author: bz Date: Sat Apr 9 11:27:47 2016 New Revision: 297740 URL: https://svnweb.freebsd.org/changeset/base/297740 Log: Mfp: r296260 The tcp_inpcb (pcbinfo) zone should be safe to destroy. PR: 164763 Reviewed by: gnn MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5732 Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Sat Apr 9 11:23:46 2016 (r297739) +++ head/sys/netinet/tcp_subr.c Sat Apr 9 11:27:47 2016 (r297740) @@ -654,8 +654,7 @@ tcp_init(void) hashsize); } in_pcbinfo_init(&V_tcbinfo, "tcp", &V_tcb, hashsize, hashsize, - "tcp_inpcb", tcp_inpcb_init, NULL, UMA_ZONE_NOFREE, - IPI_HASHFIELDS_4TUPLE); + "tcp_inpcb", tcp_inpcb_init, NULL, 0, IPI_HASHFIELDS_4TUPLE); /* * These have to be type stable for the benefit of the timers. From owner-svn-src-all@freebsd.org Sat Apr 9 11:54:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FD6BB07FD6; Sat, 9 Apr 2016 11:54:10 +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 mx1.freebsd.org (Postfix) with ESMTPS id 2F4E11155; Sat, 9 Apr 2016 11:54:10 +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 u39Bs9Ig038433; Sat, 9 Apr 2016 11:54:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39Bs9pH038432; Sat, 9 Apr 2016 11:54:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604091154.u39Bs9pH038432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 9 Apr 2016 11:54:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297741 - head/sys/dev/isp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 11:54:10 -0000 Author: mav Date: Sat Apr 9 11:54:09 2016 New Revision: 297741 URL: https://svnweb.freebsd.org/changeset/base/297741 Log: Reduce code duplication when executing Passthrough IOCB. MFC after: 2 weeks Modified: head/sys/dev/isp/isp.c Modified: head/sys/dev/isp/isp.c ============================================================================== --- head/sys/dev/isp/isp.c Sat Apr 9 11:27:47 2016 (r297740) +++ head/sys/dev/isp/isp.c Sat Apr 9 11:54:09 2016 (r297741) @@ -3494,26 +3494,17 @@ isp_gid_ft_sns(ispsoftc_t *isp, int chan } static int -isp_gid_ft_ct_passthru(ispsoftc_t *isp, int chan) +isp_ct_passthru(ispsoftc_t *isp, int chan, uint32_t cmd_bcnt, uint32_t rsp_bcnt) { mbreg_t mbs; fcparam *fcp = FCPARAM(isp, chan); union { isp_ct_pt_t plocal; - ct_hdr_t clocal; uint8_t q[QENTRY_LEN]; } un; isp_ct_pt_t *pt; - ct_hdr_t *ct; - uint32_t *rp; uint8_t *scp = fcp->isp_scratch; - isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GID_FT via CT", chan); - if (FC_SCRATCH_ACQUIRE(isp, chan)) { - isp_prt(isp, ISP_LOGERR, sacq); - return (-1); - } - /* * Build a Passthrough IOCB in memory. */ @@ -3527,39 +3518,21 @@ isp_gid_ft_ct_passthru(ispsoftc_t *isp, pt->ctp_vpidx = ISP_GET_VPIDX(isp, chan); pt->ctp_time = 10; pt->ctp_rsp_cnt = 1; - pt->ctp_rsp_bcnt = GIDLEN; - pt->ctp_cmd_bcnt = sizeof (*ct) + sizeof (uint32_t); + pt->ctp_rsp_bcnt = rsp_bcnt; + pt->ctp_cmd_bcnt = cmd_bcnt; pt->ctp_dataseg[0].ds_base = DMA_LO32(fcp->isp_scdma+XTXOFF); pt->ctp_dataseg[0].ds_basehi = DMA_HI32(fcp->isp_scdma+XTXOFF); - pt->ctp_dataseg[0].ds_count = sizeof (*ct) + sizeof (uint32_t); + pt->ctp_dataseg[0].ds_count = cmd_bcnt; pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma); pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma); - pt->ctp_dataseg[1].ds_count = GIDLEN; - if (isp->isp_dblev & ISP_LOGDEBUG1) { - isp_print_bytes(isp, "ct IOCB", QENTRY_LEN, pt); - } - isp_put_ct_pt(isp, pt, (isp_ct_pt_t *) &scp[CTXOFF]); + pt->ctp_dataseg[1].ds_count = rsp_bcnt; + isp_put_ct_pt(isp, pt, (isp_ct_pt_t *)&scp[CTXOFF]); + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "CT IOCB request", QENTRY_LEN, &scp[CTXOFF]); /* - * Build the CT header and command in memory. - * - * Note that the CT header has to end up as Big Endian format in memory. + * Execute the Passthrough IOCB. */ - ct = &un.clocal; - ISP_MEMZERO(ct, sizeof (*ct)); - ct->ct_revision = CT_REVISION; - ct->ct_fcs_type = CT_FC_TYPE_FC; - ct->ct_fcs_subtype = CT_FC_SUBTYPE_NS; - ct->ct_cmd_resp = SNS_GID_FT; - ct->ct_bcnt_resid = (GIDLEN - 16) >> 2; - - isp_put_ct_hdr(isp, ct, (ct_hdr_t *) &scp[XTXOFF]); - rp = (uint32_t *) &scp[XTXOFF+sizeof (*ct)]; - ISP_IOZPUT_32(isp, FC4_SCSI, rp); - if (isp->isp_dblev & ISP_LOGDEBUG1) { - isp_print_bytes(isp, "CT HDR + payload after put", - sizeof (*ct) + sizeof (uint32_t), &scp[XTXOFF]); - } ISP_MEMZERO(&scp[ZTXOFF], QENTRY_LEN); MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, MBCMD_DEFAULT_TIMEOUT + pt->ctp_time * 1000000); @@ -3574,18 +3547,58 @@ isp_gid_ft_ct_passthru(ispsoftc_t *isp, return (-1); } MEMORYBARRIER(isp, SYNC_SFORCPU, 0, ISP_FC_SCRLEN, chan); + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "CT IOCB response", QENTRY_LEN, &scp[ZTXOFF]); pt = &un.plocal; isp_get_ct_pt(isp, (isp_ct_pt_t *) &scp[ZTXOFF], pt); - if (isp->isp_dblev & ISP_LOGDEBUG1) { - isp_print_bytes(isp, "IOCB response", QENTRY_LEN, pt); - } - if (pt->ctp_status && pt->ctp_status != RQCS_DATA_UNDERRUN) { isp_prt(isp, ISP_LOGWARN, "Chan %d GID_FT CT Passthrough returned 0x%x", chan, pt->ctp_status); return (-1); } + + return (0); +} + +static int +isp_gid_ft_ct_passthru(ispsoftc_t *isp, int chan) +{ + fcparam *fcp = FCPARAM(isp, chan); + ct_hdr_t ct; + uint32_t *rp; + uint8_t *scp = fcp->isp_scratch; + + isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GID_FT via CT", chan); + if (FC_SCRATCH_ACQUIRE(isp, chan)) { + isp_prt(isp, ISP_LOGERR, sacq); + return (-1); + } + + /* + * Build the CT header and command in memory. + * + * Note that the CT header has to end up as Big Endian format in memory. + */ + ISP_MEMZERO(&ct, sizeof (ct)); + ct.ct_revision = CT_REVISION; + ct.ct_fcs_type = CT_FC_TYPE_FC; + ct.ct_fcs_subtype = CT_FC_SUBTYPE_NS; + ct.ct_cmd_resp = SNS_GID_FT; + ct.ct_bcnt_resid = (GIDLEN - 16) >> 2; + isp_put_ct_hdr(isp, &ct, (ct_hdr_t *) &scp[XTXOFF]); + rp = (uint32_t *) &scp[XTXOFF + sizeof(ct)]; + ISP_IOZPUT_32(isp, FC4_SCSI, rp); + if (isp->isp_dblev & ISP_LOGDEBUG1) { + isp_print_bytes(isp, "CT request", + sizeof(ct) + sizeof(uint32_t), &scp[XTXOFF]); + } + + if (isp_ct_passthru(isp, chan, sizeof(ct) + sizeof(uint32_t), GIDLEN)) { + FC_SCRATCH_RELEASE(isp, chan); + return (-1); + } + if (isp->isp_dblev & ISP_LOGDEBUG1) isp_print_bytes(isp, "CT response", GIDLEN, scp); isp_get_gid_ft_response(isp, (sns_gid_ft_rsp_t *)scp, @@ -3957,16 +3970,9 @@ isp_register_fc4_type(ispsoftc_t *isp, i static int isp_register_fc4_type_24xx(ispsoftc_t *isp, int chan) { - mbreg_t mbs; fcparam *fcp = FCPARAM(isp, chan); - union { - isp_ct_pt_t plocal; - rft_id_t clocal; - uint8_t q[QENTRY_LEN]; - } un; - isp_ct_pt_t *pt; ct_hdr_t *ct; - rft_id_t *rp; + rft_id_t rp; uint8_t *scp = fcp->isp_scratch; if (FC_SCRATCH_ACQUIRE(isp, chan)) { @@ -3975,110 +3981,50 @@ isp_register_fc4_type_24xx(ispsoftc_t *i } /* - * Build a Passthrough IOCB in memory. - */ - ISP_MEMZERO(un.q, QENTRY_LEN); - pt = &un.plocal; - pt->ctp_header.rqs_entry_count = 1; - pt->ctp_header.rqs_entry_type = RQSTYPE_CT_PASSTHRU; - pt->ctp_handle = 0xffffffff; - pt->ctp_nphdl = fcp->isp_sns_hdl; - pt->ctp_cmd_cnt = 1; - pt->ctp_vpidx = ISP_GET_VPIDX(isp, chan); - pt->ctp_time = 4; - pt->ctp_rsp_cnt = 1; - pt->ctp_rsp_bcnt = sizeof (ct_hdr_t); - pt->ctp_cmd_bcnt = sizeof (rft_id_t); - pt->ctp_dataseg[0].ds_base = DMA_LO32(fcp->isp_scdma+XTXOFF); - pt->ctp_dataseg[0].ds_basehi = DMA_HI32(fcp->isp_scdma+XTXOFF); - pt->ctp_dataseg[0].ds_count = sizeof (rft_id_t); - pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma); - pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma); - pt->ctp_dataseg[1].ds_count = sizeof (ct_hdr_t); - isp_put_ct_pt(isp, pt, (isp_ct_pt_t *) &scp[CTXOFF]); - if (isp->isp_dblev & ISP_LOGDEBUG1) { - isp_print_bytes(isp, "IOCB CT Request", QENTRY_LEN, pt); - } - - /* * Build the CT header and command in memory. * * Note that the CT header has to end up as Big Endian format in memory. */ - ISP_MEMZERO(&un.clocal, sizeof (un.clocal)); - ct = &un.clocal.rftid_hdr; + ISP_MEMZERO(&rp, sizeof(rp)); + ct = &rp.rftid_hdr; ct->ct_revision = CT_REVISION; ct->ct_fcs_type = CT_FC_TYPE_FC; ct->ct_fcs_subtype = CT_FC_SUBTYPE_NS; ct->ct_cmd_resp = SNS_RFT_ID; ct->ct_bcnt_resid = (sizeof (rft_id_t) - sizeof (ct_hdr_t)) >> 2; - rp = &un.clocal; - rp->rftid_portid[0] = fcp->isp_portid >> 16; - rp->rftid_portid[1] = fcp->isp_portid >> 8; - rp->rftid_portid[2] = fcp->isp_portid; - rp->rftid_fc4types[FC4_SCSI >> 5] = 1 << (FC4_SCSI & 0x1f); - isp_put_rft_id(isp, rp, (rft_id_t *) &scp[XTXOFF]); - if (isp->isp_dblev & ISP_LOGDEBUG1) { - isp_print_bytes(isp, "CT Header", QENTRY_LEN, &scp[XTXOFF]); - } - - ISP_MEMZERO(&scp[ZTXOFF], sizeof (ct_hdr_t)); + rp.rftid_portid[0] = fcp->isp_portid >> 16; + rp.rftid_portid[1] = fcp->isp_portid >> 8; + rp.rftid_portid[2] = fcp->isp_portid; + rp.rftid_fc4types[FC4_SCSI >> 5] = 1 << (FC4_SCSI & 0x1f); + isp_put_rft_id(isp, &rp, (rft_id_t *)&scp[XTXOFF]); + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "CT request", sizeof(rft_id_t), &scp[XTXOFF]); - MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, - MBCMD_DEFAULT_TIMEOUT + pt->ctp_time * 1000000); - mbs.param[1] = QENTRY_LEN; - mbs.param[2] = DMA_WD1(fcp->isp_scdma + CTXOFF); - mbs.param[3] = DMA_WD0(fcp->isp_scdma + CTXOFF); - mbs.param[6] = DMA_WD3(fcp->isp_scdma + CTXOFF); - mbs.param[7] = DMA_WD2(fcp->isp_scdma + CTXOFF); - MEMORYBARRIER(isp, SYNC_SFORDEV, XTXOFF, 2 * QENTRY_LEN, chan); - isp_mboxcmd(isp, &mbs); - if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + if (isp_ct_passthru(isp, chan, sizeof(rft_id_t), sizeof(ct_hdr_t))) { FC_SCRATCH_RELEASE(isp, chan); return (-1); } - MEMORYBARRIER(isp, SYNC_SFORCPU, ZTXOFF, QENTRY_LEN, chan); - pt = &un.plocal; - isp_get_ct_pt(isp, (isp_ct_pt_t *) &scp[ZTXOFF], pt); - if (isp->isp_dblev & ISP_LOGDEBUG1) { - isp_print_bytes(isp, "IOCB response", QENTRY_LEN, pt); - } - if (pt->ctp_status) { - FC_SCRATCH_RELEASE(isp, chan); - isp_prt(isp, ISP_LOGWARN, - "Chan %d Register FC4 Type CT Passthrough returned 0x%x", - chan, pt->ctp_status); - return (1); - } isp_get_ct_hdr(isp, (ct_hdr_t *) scp, ct); FC_SCRATCH_RELEASE(isp, chan); - if (ct->ct_cmd_resp == LS_RJT) { isp_prt(isp, ISP_LOG_SANCFG|ISP_LOG_WARN1, "Chan %d Register FC4 Type rejected", chan); return (-1); } else if (ct->ct_cmd_resp == LS_ACC) { isp_prt(isp, ISP_LOG_SANCFG, "Chan %d Register FC4 Type accepted", chan); - return (0); } else { isp_prt(isp, ISP_LOGWARN, "Chan %d Register FC4 Type: 0x%x", chan, ct->ct_cmd_resp); return (-1); } + return (0); } static int isp_register_fc4_features_24xx(ispsoftc_t *isp, int chan) { - mbreg_t mbs; fcparam *fcp = FCPARAM(isp, chan); - union { - isp_ct_pt_t plocal; - rff_id_t clocal; - uint8_t q[QENTRY_LEN]; - } un; - isp_ct_pt_t *pt; ct_hdr_t *ct; - rff_id_t *rp; + rff_id_t rp; uint8_t *scp = fcp->isp_scratch; if (FC_SCRATCH_ACQUIRE(isp, chan)) { @@ -4087,90 +4033,37 @@ isp_register_fc4_features_24xx(ispsoftc_ } /* - * Build a Passthrough IOCB in memory. - */ - ISP_MEMZERO(un.q, QENTRY_LEN); - pt = &un.plocal; - pt->ctp_header.rqs_entry_count = 1; - pt->ctp_header.rqs_entry_type = RQSTYPE_CT_PASSTHRU; - pt->ctp_handle = 0xffffffff; - pt->ctp_nphdl = fcp->isp_sns_hdl; - pt->ctp_cmd_cnt = 1; - pt->ctp_vpidx = ISP_GET_VPIDX(isp, chan); - pt->ctp_time = 4; - pt->ctp_rsp_cnt = 1; - pt->ctp_rsp_bcnt = sizeof (ct_hdr_t); - pt->ctp_cmd_bcnt = sizeof (rff_id_t); - pt->ctp_dataseg[0].ds_base = DMA_LO32(fcp->isp_scdma+XTXOFF); - pt->ctp_dataseg[0].ds_basehi = DMA_HI32(fcp->isp_scdma+XTXOFF); - pt->ctp_dataseg[0].ds_count = sizeof (rff_id_t); - pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma); - pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma); - pt->ctp_dataseg[1].ds_count = sizeof (ct_hdr_t); - isp_put_ct_pt(isp, pt, (isp_ct_pt_t *) &scp[CTXOFF]); - if (isp->isp_dblev & ISP_LOGDEBUG1) { - isp_print_bytes(isp, "IOCB CT Request", QENTRY_LEN, pt); - } - - /* * Build the CT header and command in memory. * * Note that the CT header has to end up as Big Endian format in memory. */ - ISP_MEMZERO(&un.clocal, sizeof (un.clocal)); - ct = &un.clocal.rffid_hdr; + ISP_MEMZERO(&rp, sizeof(rp)); + ct = &rp.rffid_hdr; ct->ct_revision = CT_REVISION; ct->ct_fcs_type = CT_FC_TYPE_FC; ct->ct_fcs_subtype = CT_FC_SUBTYPE_NS; ct->ct_cmd_resp = SNS_RFF_ID; ct->ct_bcnt_resid = (sizeof (rff_id_t) - sizeof (ct_hdr_t)) >> 2; - rp = &un.clocal; - rp->rffid_portid[0] = fcp->isp_portid >> 16; - rp->rffid_portid[1] = fcp->isp_portid >> 8; - rp->rffid_portid[2] = fcp->isp_portid; - rp->rffid_fc4features = 0; + rp.rffid_portid[0] = fcp->isp_portid >> 16; + rp.rffid_portid[1] = fcp->isp_portid >> 8; + rp.rffid_portid[2] = fcp->isp_portid; + rp.rffid_fc4features = 0; if (fcp->role & ISP_ROLE_TARGET) - rp->rffid_fc4features |= 1; + rp.rffid_fc4features |= 1; if (fcp->role & ISP_ROLE_INITIATOR) - rp->rffid_fc4features |= 2; - rp->rffid_fc4type = FC4_SCSI; - isp_put_rff_id(isp, rp, (rff_id_t *) &scp[XTXOFF]); - if (isp->isp_dblev & ISP_LOGDEBUG1) { - isp_print_bytes(isp, "CT Header", QENTRY_LEN, &scp[XTXOFF]); - } - - ISP_MEMZERO(&scp[ZTXOFF], sizeof (ct_hdr_t)); + rp.rffid_fc4features |= 2; + rp.rffid_fc4type = FC4_SCSI; + isp_put_rff_id(isp, &rp, (rff_id_t *)&scp[XTXOFF]); + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "CT request", sizeof(rft_id_t), &scp[XTXOFF]); - MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, - MBCMD_DEFAULT_TIMEOUT + pt->ctp_time * 1000000); - mbs.param[1] = QENTRY_LEN; - mbs.param[2] = DMA_WD1(fcp->isp_scdma + CTXOFF); - mbs.param[3] = DMA_WD0(fcp->isp_scdma + CTXOFF); - mbs.param[6] = DMA_WD3(fcp->isp_scdma + CTXOFF); - mbs.param[7] = DMA_WD2(fcp->isp_scdma + CTXOFF); - MEMORYBARRIER(isp, SYNC_SFORDEV, XTXOFF, 2 * QENTRY_LEN, chan); - isp_mboxcmd(isp, &mbs); - if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + if (isp_ct_passthru(isp, chan, sizeof(rft_id_t), sizeof(ct_hdr_t))) { FC_SCRATCH_RELEASE(isp, chan); return (-1); } - MEMORYBARRIER(isp, SYNC_SFORCPU, ZTXOFF, QENTRY_LEN, chan); - pt = &un.plocal; - isp_get_ct_pt(isp, (isp_ct_pt_t *) &scp[ZTXOFF], pt); - if (isp->isp_dblev & ISP_LOGDEBUG1) { - isp_print_bytes(isp, "IOCB response", QENTRY_LEN, pt); - } - if (pt->ctp_status) { - FC_SCRATCH_RELEASE(isp, chan); - isp_prt(isp, ISP_LOGWARN, - "Chan %d Register FC4 Features CT Passthrough returned 0x%x", - chan, pt->ctp_status); - return (1); - } isp_get_ct_hdr(isp, (ct_hdr_t *) scp, ct); FC_SCRATCH_RELEASE(isp, chan); - if (ct->ct_cmd_resp == LS_RJT) { isp_prt(isp, ISP_LOG_SANCFG|ISP_LOG_WARN1, "Chan %d Register FC4 Features rejected", chan); @@ -4178,12 +4071,12 @@ isp_register_fc4_features_24xx(ispsoftc_ } else if (ct->ct_cmd_resp == LS_ACC) { isp_prt(isp, ISP_LOG_SANCFG, "Chan %d Register FC4 Features accepted", chan); - return (0); } else { isp_prt(isp, ISP_LOGWARN, "Chan %d Register FC4 Features: 0x%x", chan, ct->ct_cmd_resp); return (-1); } + return (0); } static uint16_t From owner-svn-src-all@freebsd.org Sat Apr 9 12:05:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F796B08CCE; Sat, 9 Apr 2016 12:05:25 +0000 (UTC) (envelope-from bz@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 mx1.freebsd.org (Postfix) with ESMTPS id EBE721AA5; Sat, 9 Apr 2016 12:05:24 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39C5Oc6041430; Sat, 9 Apr 2016 12:05:24 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39C5Oks041429; Sat, 9 Apr 2016 12:05:24 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201604091205.u39C5Oks041429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 9 Apr 2016 12:05:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297742 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 12:05:25 -0000 Author: bz Date: Sat Apr 9 12:05:23 2016 New Revision: 297742 URL: https://svnweb.freebsd.org/changeset/base/297742 Log: Mfp: r296310,r296343 It looks like as with the safety belt of DELAY() fastened (*) we can completely tear down and free all memory for TCP (after r281599). (*) in theory a few ticks should be good enough to make sure the timers are all really gone. Could we use a better matric here and check a tcbcb count as an optimization? PR: 164763 Reviewed by: gnn, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5734 Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Sat Apr 9 11:54:09 2016 (r297741) +++ head/sys/netinet/tcp_subr.c Sat Apr 9 12:05:23 2016 (r297742) @@ -660,7 +660,7 @@ tcp_init(void) * These have to be type stable for the benefit of the timers. */ V_tcpcb_zone = uma_zcreate("tcpcb", sizeof(struct tcpcb_mem), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); uma_zone_set_max(V_tcpcb_zone, maxsockets); uma_zone_set_warning(V_tcpcb_zone, "kern.ipc.maxsockets limit reached"); @@ -670,7 +670,7 @@ tcp_init(void) TUNABLE_INT_FETCH("net.inet.tcp.sack.enable", &V_tcp_do_sack); V_sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); /* Skip initialization of globals for non-default instances. */ if (!IS_DEFAULT_VNET(curvnet)) @@ -737,10 +737,21 @@ tcp_destroy(void) { int error; + /* + * All our processes are gone, all our sockets should be cleaned + * up, which means, we should be past the tcp_discardcb() calls. + * Sleep to let all tcpcb timers really disappear and then cleanup. + * Timewait will cleanup its queue and will be ready to go. + * XXX-BZ In theory a few ticks should be good enough to make sure + * the timers are all really gone. We should see if we could use a + * better metric here and, e.g., check a tcbcb count as an optimization? + */ + DELAY(1000000 / hz); tcp_hc_destroy(); syncache_destroy(); tcp_tw_destroy(); in_pcbinfo_destroy(&V_tcbinfo); + /* tcp_discardcb() clears the sack_holes up. */ uma_zdestroy(V_sack_hole_zone); uma_zdestroy(V_tcpcb_zone); From owner-svn-src-all@freebsd.org Sat Apr 9 13:15:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72419B099A0; Sat, 9 Apr 2016 13:15:35 +0000 (UTC) (envelope-from cem@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 mx1.freebsd.org (Postfix) with ESMTPS id 4DB031CC9; Sat, 9 Apr 2016 13:15:35 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39DFYnN066674; Sat, 9 Apr 2016 13:15:34 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39DFYqa066670; Sat, 9 Apr 2016 13:15:34 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201604091315.u39DFYqa066670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Sat, 9 Apr 2016 13:15:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297746 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 13:15:35 -0000 Author: cem Date: Sat Apr 9 13:15:34 2016 New Revision: 297746 URL: https://svnweb.freebsd.org/changeset/base/297746 Log: ioat(4): ioat_get_dmaengine(): Add M_WAITOK mode Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/ioat/ioat.c head/sys/dev/ioat/ioat.h head/sys/dev/ioat/ioat_internal.h head/sys/dev/ioat/ioat_test.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Sat Apr 9 13:01:40 2016 (r297745) +++ head/sys/dev/ioat/ioat.c Sat Apr 9 13:15:34 2016 (r297746) @@ -314,6 +314,9 @@ ioat_detach(device_t device) mtx_lock(IOAT_REFLK); ioat->quiescing = TRUE; + ioat->destroying = TRUE; + wakeup(&ioat->quiescing); + ioat_channel[ioat->chan_idx] = NULL; ioat_drain_locked(ioat); @@ -739,18 +742,40 @@ ioat_reset_hw_task(void *ctx, int pendin * User API functions */ bus_dmaengine_t -ioat_get_dmaengine(uint32_t index) +ioat_get_dmaengine(uint32_t index, int flags) { - struct ioat_softc *sc; + struct ioat_softc *ioat; + + KASSERT((flags & ~(M_NOWAIT | M_WAITOK)) == 0, + ("invalid flags: 0x%08x", flags)); + KASSERT((flags & (M_NOWAIT | M_WAITOK)) != (M_NOWAIT | M_WAITOK), + ("invalid wait | nowait")); if (index >= ioat_channel_index) return (NULL); - sc = ioat_channel[index]; - if (sc == NULL || sc->quiescing) + ioat = ioat_channel[index]; + if (ioat == NULL || ioat->destroying) return (NULL); - return (&ioat_get(sc, IOAT_DMAENGINE_REF)->dmaengine); + if (ioat->quiescing) { + if ((flags & M_NOWAIT) != 0) + return (NULL); + + mtx_lock(IOAT_REFLK); + while (ioat->quiescing && !ioat->destroying) + msleep(&ioat->quiescing, IOAT_REFLK, 0, "getdma", 0); + mtx_unlock(IOAT_REFLK); + + if (ioat->destroying) + return (NULL); + } + + /* + * There's a race here between the quiescing check and HW reset or + * module destroy. + */ + return (&ioat_get(ioat, IOAT_DMAENGINE_REF)->dmaengine); } void @@ -1571,6 +1596,7 @@ ioat_reset_hw(struct ioat_softc *ioat) out: mtx_lock(IOAT_REFLK); ioat->quiescing = FALSE; + wakeup(&ioat->quiescing); mtx_unlock(IOAT_REFLK); if (error == 0) Modified: head/sys/dev/ioat/ioat.h ============================================================================== --- head/sys/dev/ioat/ioat.h Sat Apr 9 13:01:40 2016 (r297745) +++ head/sys/dev/ioat/ioat.h Sat Apr 9 13:15:34 2016 (r297746) @@ -68,8 +68,10 @@ typedef void (*bus_dmaengine_callback_t) /* * Called first to acquire a reference to the DMA channel + * + * Flags may be M_WAITOK or M_NOWAIT. */ -bus_dmaengine_t ioat_get_dmaengine(uint32_t channel_index); +bus_dmaengine_t ioat_get_dmaengine(uint32_t channel_index, int flags); /* Release the DMA channel */ void ioat_put_dmaengine(bus_dmaengine_t dmaengine); Modified: head/sys/dev/ioat/ioat_internal.h ============================================================================== --- head/sys/dev/ioat/ioat_internal.h Sat Apr 9 13:01:40 2016 (r297745) +++ head/sys/dev/ioat/ioat_internal.h Sat Apr 9 13:15:34 2016 (r297746) @@ -410,6 +410,7 @@ struct ioat_softc { struct task reset_task; boolean_t quiescing; + boolean_t destroying; boolean_t is_resize_pending; boolean_t is_completion_pending; boolean_t is_reset_pending; Modified: head/sys/dev/ioat/ioat_test.c ============================================================================== --- head/sys/dev/ioat/ioat_test.c Sat Apr 9 13:01:40 2016 (r297745) +++ head/sys/dev/ioat/ioat_test.c Sat Apr 9 13:15:34 2016 (r297746) @@ -388,7 +388,7 @@ ioat_dma_test(void *arg) return; } - dmaengine = ioat_get_dmaengine(test->channel_index); + dmaengine = ioat_get_dmaengine(test->channel_index, M_NOWAIT); if (dmaengine == NULL) { ioat_test_log(0, "Couldn't acquire dmaengine\n"); test->status[IOAT_TEST_NO_DMA_ENGINE]++; From owner-svn-src-all@freebsd.org Sat Apr 9 13:32:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B303AB09E97; Sat, 9 Apr 2016 13:32:43 +0000 (UTC) (envelope-from jilles@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 mx1.freebsd.org (Postfix) with ESMTPS id 62E1615A5; Sat, 9 Apr 2016 13:32:43 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39DWgJB072542; Sat, 9 Apr 2016 13:32:42 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39DWglh072540; Sat, 9 Apr 2016 13:32:42 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201604091332.u39DWglh072540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 9 Apr 2016 13:32:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297747 - in stable/10: sys/kern tools/regression/sysvsem X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 13:32:43 -0000 Author: jilles Date: Sat Apr 9 13:32:42 2016 New Revision: 297747 URL: https://svnweb.freebsd.org/changeset/base/297747 Log: MFC r295385: semget(): Check for [EEXIST] error first. Although POSIX literally permits failing with [EINVAL] if IPC_CREAT and IPC_EXCL were both passed, the semaphore set already exists and has fewer semaphores than nsems, this does not allow an application to retry safely: if the [EINVAL] is actually because of the semmsl limit, an infinite loop would result. PR: 206927 Modified: stable/10/sys/kern/sysv_sem.c stable/10/tools/regression/sysvsem/semtest.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/sysv_sem.c ============================================================================== --- stable/10/sys/kern/sysv_sem.c Sat Apr 9 13:15:34 2016 (r297746) +++ stable/10/sys/kern/sysv_sem.c Sat Apr 9 13:32:42 2016 (r297747) @@ -877,6 +877,11 @@ sys_semget(struct thread *td, struct sem } if (semid < seminfo.semmni) { DPRINTF(("found public key\n")); + if ((semflg & IPC_CREAT) && (semflg & IPC_EXCL)) { + DPRINTF(("not exclusive\n")); + error = EEXIST; + goto done2; + } if ((error = ipcperm(td, &sema[semid].u.sem_perm, semflg & 0700))) { goto done2; @@ -886,11 +891,6 @@ sys_semget(struct thread *td, struct sem error = EINVAL; goto done2; } - if ((semflg & IPC_CREAT) && (semflg & IPC_EXCL)) { - DPRINTF(("not exclusive\n")); - error = EEXIST; - goto done2; - } #ifdef MAC error = mac_sysvsem_check_semget(cred, &sema[semid]); if (error != 0) Modified: stable/10/tools/regression/sysvsem/semtest.c ============================================================================== --- stable/10/tools/regression/sysvsem/semtest.c Sat Apr 9 13:15:34 2016 (r297746) +++ stable/10/tools/regression/sysvsem/semtest.c Sat Apr 9 13:32:42 2016 (r297747) @@ -152,6 +152,15 @@ main(int argc, char *argv[]) print_semid_ds(&s_ds, 0600); + errno = 0; + if (semget(semkey, 1, IPC_CREAT | IPC_EXCL | 0600) != -1 || + errno != EEXIST) + err(1, "semget IPC_EXCL 1 did not fail with [EEXIST]"); + errno = 0; + if (semget(semkey, 2, IPC_CREAT | IPC_EXCL | 0600) != -1 || + errno != EEXIST) + err(1, "semget IPC_EXCL 2 did not fail with [EEXIST]"); + for (child_count = 0; child_count < 5; child_count++) { switch ((child_pid = fork())) { case -1: From owner-svn-src-all@freebsd.org Sat Apr 9 13:58:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53DECB09578; Sat, 9 Apr 2016 13:58:06 +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 mx1.freebsd.org (Postfix) with ESMTPS id 23BF41FDB; Sat, 9 Apr 2016 13:58:06 +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 u39Dw5vI079059; Sat, 9 Apr 2016 13:58:05 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39Dw4SW079049; Sat, 9 Apr 2016 13:58:04 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201604091358.u39Dw4SW079049@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 9 Apr 2016 13:58:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297748 - in head/sys: conf dev/acpica kern vm x86/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 13:58:06 -0000 Author: jhb Date: Sat Apr 9 13:58:04 2016 New Revision: 297748 URL: https://svnweb.freebsd.org/changeset/base/297748 Log: Add more fine-grained kernel options for NUMA support. VM_NUMA_ALLOC is used to enable use of domain-aware memory allocation in the virtual memory system. DEVICE_NUMA is used to enable affinity reporting for devices such as bus_get_domain(). MAXMEMDOM must still be set to a value greater than for any NUMA support to be effective. Note that 'cpuset -gd' always works if MAXMEMDOM is enabled and the system supports NUMA. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D5782 Modified: head/sys/conf/NOTES head/sys/conf/options head/sys/dev/acpica/acpi.c head/sys/dev/acpica/acpivar.h head/sys/kern/kern_cpuset.c head/sys/vm/vm_domain.c head/sys/vm/vm_pageout.c head/sys/vm/vm_phys.c head/sys/vm/vm_phys.h head/sys/x86/acpica/srat.c Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sat Apr 9 13:32:42 2016 (r297747) +++ head/sys/conf/NOTES Sat Apr 9 13:58:04 2016 (r297748) @@ -229,7 +229,15 @@ options MAXCPU=32 # MAXMEMDOM defines the maximum number of memory domains that can boot in the # system. A default value should already be defined by every architecture. -options MAXMEMDOM=1 +options MAXMEMDOM=2 + +# VM_NUMA_ALLOC enables use of memory domain-aware allocation in the VM +# system. +options VM_NUMA_ALLOC + +# DEVICE_NUMA enables reporting of domain affinity of I/O devices via +# bus_get_domain(), etc. +options DEVICE_NUMA # ADAPTIVE_MUTEXES changes the behavior of blocking mutexes to spin # if the thread that currently owns the mutex is executing on another Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sat Apr 9 13:32:42 2016 (r297747) +++ head/sys/conf/options Sat Apr 9 13:58:04 2016 (r297748) @@ -90,6 +90,7 @@ COMPAT_LINUXKPI opt_compat.h COMPILING_LINT opt_global.h CY_PCI_FASTINTR DEADLKRES opt_watchdog.h +DEVICE_NUMA EXT_RESOURCES opt_global.h DIRECTIO FILEMON opt_dontuse.h @@ -603,6 +604,7 @@ VM_KMEM_SIZE opt_vm.h VM_KMEM_SIZE_SCALE opt_vm.h VM_KMEM_SIZE_MAX opt_vm.h VM_NRESERVLEVEL opt_vm.h +VM_NUMA_ALLOC opt_vm.h VM_LEVEL_0_ORDER opt_vm.h NO_SWAPPING opt_vm.h MALLOC_MAKE_FAILURES opt_vm.h Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Sat Apr 9 13:32:42 2016 (r297747) +++ head/sys/dev/acpica/acpi.c Sat Apr 9 13:58:04 2016 (r297748) @@ -31,6 +31,8 @@ __FBSDID("$FreeBSD$"); #include "opt_acpi.h" +#include "opt_device_numa.h" + #include #include #include @@ -1083,7 +1085,7 @@ acpi_hint_device_unit(device_t acdev, de int acpi_parse_pxm(device_t dev, int *domain) { -#if MAXMEMDOM > 1 +#ifdef DEVICE_NUMA ACPI_HANDLE h; int d, pxm; Modified: head/sys/dev/acpica/acpivar.h ============================================================================== --- head/sys/dev/acpica/acpivar.h Sat Apr 9 13:32:42 2016 (r297747) +++ head/sys/dev/acpica/acpivar.h Sat Apr 9 13:58:04 2016 (r297748) @@ -502,9 +502,7 @@ SYSCTL_DECL(_debug_acpi); * * Returns the VM domain ID if found, or -1 if not found / invalid. */ -#if MAXMEMDOM > 1 extern int acpi_map_pxm_to_vm_domainid(int pxm); -#endif extern int acpi_get_domain(device_t dev, device_t child, int *domain); extern int acpi_parse_pxm(device_t dev, int *domain); Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Sat Apr 9 13:32:42 2016 (r297747) +++ head/sys/kern/kern_cpuset.c Sat Apr 9 13:58:04 2016 (r297748) @@ -831,7 +831,7 @@ struct cpuset * cpuset_thread0(void) { struct cpuset *set; - int error; + int error, i; cpuset_zone = uma_zcreate("cpuset", sizeof(struct cpuset), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); @@ -863,9 +863,15 @@ cpuset_thread0(void) */ cpuset_unr = new_unrhdr(2, INT_MAX, NULL); - /* MD Code is responsible for initializing sets if vm_ndomains > 1. */ - if (vm_ndomains == 1) - CPU_COPY(&all_cpus, &cpuset_domain[0]); + /* + * If MD code has not initialized per-domain cpusets, place all + * CPUs in domain 0. + */ + for (i = 0; i < MAXMEMDOM; i++) + if (!CPU_EMPTY(&cpuset_domain[i])) + goto domains_set; + CPU_COPY(&all_cpus, &cpuset_domain[0]); +domains_set: return (set); } @@ -1118,7 +1124,7 @@ sys_cpuset_getaffinity(struct thread *td error = intr_getaffinity(uap->id, mask); break; case CPU_WHICH_DOMAIN: - if (uap->id < 0 || uap->id >= vm_ndomains) + if (uap->id < 0 || uap->id >= MAXMEMDOM) error = ESRCH; else CPU_COPY(&cpuset_domain[uap->id], mask); Modified: head/sys/vm/vm_domain.c ============================================================================== --- head/sys/vm/vm_domain.c Sat Apr 9 13:32:42 2016 (r297747) +++ head/sys/vm/vm_domain.c Sat Apr 9 13:58:04 2016 (r297748) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if MAXMEMDOM > 1 +#ifdef VM_NUMA_ALLOC #include #endif #include @@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$"); static __inline int vm_domain_rr_selectdomain(int skip_domain) { -#if MAXMEMDOM > 1 +#ifdef VM_NUMA_ALLOC struct thread *td; td = curthread; @@ -188,8 +188,13 @@ vm_domain_policy_validate(const struct v return (-1); case VM_POLICY_FIXED_DOMAIN: case VM_POLICY_FIXED_DOMAIN_ROUND_ROBIN: +#ifdef VM_NUMA_ALLOC if (vp->p.domain >= 0 && vp->p.domain < vm_ndomains) return (0); +#else + if (vp->p.domain == 0) + return (0); +#endif return (-1); default: return (-1); @@ -221,6 +226,7 @@ vm_domain_iterator_set(struct vm_domain_ vm_domain_policy_type_t vt, int domain) { +#ifdef VM_NUMA_ALLOC switch (vt) { case VM_POLICY_FIXED_DOMAIN: vi->policy = VM_POLICY_FIXED_DOMAIN; @@ -249,6 +255,10 @@ vm_domain_iterator_set(struct vm_domain_ vi->n = vm_ndomains; break; } +#else + vi->domain = 0; + vi->n = 1; +#endif return (0); } @@ -259,6 +269,8 @@ static inline void _vm_domain_iterator_set_policy(struct vm_domain_iterator *vi, const struct vm_domain_policy *vt) { + +#ifdef VM_NUMA_ALLOC /* * Initialise the iterator. * @@ -300,6 +312,10 @@ _vm_domain_iterator_set_policy(struct vm vi->n = vm_ndomains; break; } +#else + vi->domain = 0; + vi->n = 1; +#endif } void @@ -334,6 +350,7 @@ vm_domain_iterator_run(struct vm_domain_ if (vi->n <= 0) return (-1); +#ifdef VM_NUMA_ALLOC switch (vi->policy) { case VM_POLICY_FIXED_DOMAIN: case VM_POLICY_FIRST_TOUCH: @@ -358,6 +375,10 @@ vm_domain_iterator_run(struct vm_domain_ vi->n--; break; } +#else + *domain = 0; + vi->n--; +#endif return (0); } Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sat Apr 9 13:32:42 2016 (r297747) +++ head/sys/vm/vm_pageout.c Sat Apr 9 13:58:04 2016 (r297748) @@ -1656,12 +1656,12 @@ static void vm_pageout(void) { int error; -#if MAXMEMDOM > 1 +#ifdef VM_NUMA_ALLOC int i; #endif swap_pager_swap_init(); -#if MAXMEMDOM > 1 +#ifdef VM_NUMA_ALLOC for (i = 1; i < vm_ndomains; i++) { error = kthread_add(vm_pageout_worker, (void *)(uintptr_t)i, curproc, NULL, 0, 0, "dom%d", i); Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Sat Apr 9 13:32:42 2016 (r297747) +++ head/sys/vm/vm_phys.c Sat Apr 9 13:58:04 2016 (r297748) @@ -48,9 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if MAXMEMDOM > 1 #include -#endif #include #include #include @@ -73,8 +71,10 @@ __FBSDID("$FreeBSD$"); _Static_assert(sizeof(long) * NBBY >= VM_PHYSSEG_MAX, "Too many physsegs."); +#ifdef VM_NUMA_ALLOC struct mem_affinity *mem_affinity; int *mem_locality; +#endif int vm_ndomains = 1; @@ -144,7 +144,7 @@ static int sysctl_vm_phys_segs(SYSCTL_HA SYSCTL_OID(_vm, OID_AUTO, phys_segs, CTLTYPE_STRING | CTLFLAG_RD, NULL, 0, sysctl_vm_phys_segs, "A", "Phys Seg Info"); -#if MAXMEMDOM > 1 +#ifdef VM_NUMA_ALLOC static int sysctl_vm_phys_locality(SYSCTL_HANDLER_ARGS); SYSCTL_OID(_vm, OID_AUTO, phys_locality, CTLTYPE_STRING | CTLFLAG_RD, NULL, 0, sysctl_vm_phys_locality, "A", "Phys Locality Info"); @@ -159,7 +159,7 @@ SYSCTL_INT(_vm, OID_AUTO, ndomains, CTLF static struct mtx vm_default_policy_mtx; MTX_SYSINIT(vm_default_policy, &vm_default_policy_mtx, "default policy mutex", MTX_DEF); -#if MAXMEMDOM > 1 +#ifdef VM_NUMA_ALLOC static struct vm_domain_policy vm_default_policy = VM_DOMAIN_POLICY_STATIC_INITIALISER(VM_POLICY_FIRST_TOUCH_ROUND_ROBIN, 0); #else @@ -277,7 +277,7 @@ vm_phys_fictitious_cmp(struct vm_phys_fi static __inline int vm_rr_selectdomain(void) { -#if MAXMEMDOM > 1 +#ifdef VM_NUMA_ALLOC struct thread *td; td = curthread; @@ -303,13 +303,13 @@ vm_rr_selectdomain(void) static void vm_policy_iterator_init(struct vm_domain_iterator *vi) { -#if MAXMEMDOM > 1 +#ifdef VM_NUMA_ALLOC struct vm_domain_policy lcl; #endif vm_domain_iterator_init(vi); -#if MAXMEMDOM > 1 +#ifdef VM_NUMA_ALLOC /* Copy out the thread policy */ vm_domain_policy_localcopy(&lcl, &curthread->td_vm_dom_policy); if (lcl.p.policy != VM_POLICY_NONE) { @@ -433,7 +433,7 @@ int vm_phys_mem_affinity(int f, int t) { -#if MAXMEMDOM > 1 +#ifdef VM_NUMA_ALLOC if (mem_locality == NULL) return (-1); if (f >= vm_ndomains || t >= vm_ndomains) @@ -444,7 +444,7 @@ vm_phys_mem_affinity(int f, int t) #endif } -#if MAXMEMDOM > 1 +#ifdef VM_NUMA_ALLOC /* * Outputs the VM locality table. */ @@ -520,6 +520,7 @@ _vm_phys_create_seg(vm_paddr_t start, vm static void vm_phys_create_seg(vm_paddr_t start, vm_paddr_t end) { +#ifdef VM_NUMA_ALLOC int i; if (mem_affinity == NULL) { @@ -544,6 +545,9 @@ vm_phys_create_seg(vm_paddr_t start, vm_ mem_affinity[i].domain); start = mem_affinity[i].end; } +#else + _vm_phys_create_seg(start, end, 0); +#endif } /* Modified: head/sys/vm/vm_phys.h ============================================================================== --- head/sys/vm/vm_phys.h Sat Apr 9 13:32:42 2016 (r297747) +++ head/sys/vm/vm_phys.h Sat Apr 9 13:58:04 2016 (r297748) @@ -99,7 +99,7 @@ int vm_phys_mem_affinity(int f, int t); static inline struct vm_domain * vm_phys_domain(vm_page_t m) { -#if MAXMEMDOM > 1 +#ifdef VM_NUMA_ALLOC int domn, segind; /* XXXKIB try to assert that the page is managed */ Modified: head/sys/x86/acpica/srat.c ============================================================================== --- head/sys/x86/acpica/srat.c Sat Apr 9 13:32:42 2016 (r297747) +++ head/sys/x86/acpica/srat.c Sat Apr 9 13:58:04 2016 (r297748) @@ -28,6 +28,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_vm.h" + #include #include #include @@ -62,7 +64,8 @@ int num_mem; static ACPI_TABLE_SRAT *srat; static vm_paddr_t srat_physaddr; -static int vm_domains[VM_PHYSSEG_MAX]; +static int domain_pxm[MAXMEMDOM]; +static int ndomain; static ACPI_TABLE_SLIT *slit; static vm_paddr_t slit_physaddr; @@ -145,8 +148,10 @@ parse_slit(void) acpi_unmap_table(slit); slit = NULL; +#ifdef VM_NUMA_ALLOC /* Tell the VM about it! */ mem_locality = vm_locality_table; +#endif return (0); } @@ -340,48 +345,46 @@ renumber_domains(void) int i, j, slot; /* Enumerate all the domains. */ - vm_ndomains = 0; + ndomain = 0; for (i = 0; i < num_mem; i++) { /* See if this domain is already known. */ - for (j = 0; j < vm_ndomains; j++) { - if (vm_domains[j] >= mem_info[i].domain) + for (j = 0; j < ndomain; j++) { + if (domain_pxm[j] >= mem_info[i].domain) break; } - if (j < vm_ndomains && vm_domains[j] == mem_info[i].domain) + if (j < ndomain && domain_pxm[j] == mem_info[i].domain) continue; /* Insert the new domain at slot 'j'. */ slot = j; - for (j = vm_ndomains; j > slot; j--) - vm_domains[j] = vm_domains[j - 1]; - vm_domains[slot] = mem_info[i].domain; - vm_ndomains++; - if (vm_ndomains > MAXMEMDOM) { - vm_ndomains = 1; + for (j = ndomain; j > slot; j--) + domain_pxm[j] = domain_pxm[j - 1]; + domain_pxm[slot] = mem_info[i].domain; + ndomain++; + if (ndomain > MAXMEMDOM) { + ndomain = 1; printf("SRAT: Too many memory domains\n"); return (EFBIG); } } - /* Renumber each domain to its index in the sorted 'domains' list. */ - for (i = 0; i < vm_ndomains; i++) { + /* Renumber each domain to its index in the sorted 'domain_pxm' list. */ + for (i = 0; i < ndomain; i++) { /* * If the domain is already the right value, no need * to renumber. */ - if (vm_domains[i] == i) + if (domain_pxm[i] == i) continue; /* Walk the cpu[] and mem_info[] arrays to renumber. */ for (j = 0; j < num_mem; j++) - if (mem_info[j].domain == vm_domains[i]) + if (mem_info[j].domain == domain_pxm[i]) mem_info[j].domain = i; for (j = 0; j <= MAX_APIC_ID; j++) - if (cpus[j].enabled && cpus[j].domain == vm_domains[i]) + if (cpus[j].enabled && cpus[j].domain == domain_pxm[i]) cpus[j].domain = i; } - KASSERT(vm_ndomains > 0, - ("renumber_domains: invalid final vm_ndomains setup")); return (0); } @@ -416,8 +419,11 @@ parse_srat(void) return (-1); } +#ifdef VM_NUMA_ALLOC /* Point vm_phys at our memory affinity table. */ + vm_ndomains = ndomain; mem_affinity = mem_info; +#endif return (0); } @@ -495,12 +501,21 @@ acpi_map_pxm_to_vm_domainid(int pxm) { int i; - for (i = 0; i < vm_ndomains; i++) { - if (vm_domains[i] == pxm) + for (i = 0; i < ndomain; i++) { + if (domain_pxm[i] == pxm) return (i); } return (-1); } +#else /* MAXMEMDOM == 1 */ + +int +acpi_map_pxm_to_vm_domainid(int pxm) +{ + + return (-1); +} + #endif /* MAXMEMDOM > 1 */ From owner-svn-src-all@freebsd.org Sat Apr 9 14:04:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FA5CB0985C; Sat, 9 Apr 2016 14:04:03 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi0-f54.google.com (mail-oi0-f54.google.com [209.85.218.54]) (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 E556414C9; Sat, 9 Apr 2016 14:04:02 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-oi0-f54.google.com with SMTP id p188so164525388oih.2; Sat, 09 Apr 2016 07:04:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :date:message-id:subject:from:to:cc; bh=OyWu5DrtZDpMcruh9VbHx9I5MxuXTngaCjQCuaIu4hQ=; b=T0S7cDwcCXms4BWAfDsHPAkUrR5dkT3guta+YijZ+XXzWJ7BEEfHhMgqsgZ/ltRcho 23d/MzAHg0VN3CRZ2BPZUw+Br3rHkgh6SXKn+iJlTj8Am7h3Qg1ZMoQ3AiITjtuVhKfT 6iMmkIY6KNZkI478Hy0mfhF6axurNO4/HAFBra+6Wesik3WdBaWJbbjSHN/S0kPKAjlz SXzO/h+P4z5AqwsUWRGgjCpu6YQDYG4Gf/0kOFb6544W8b/ldlAQCvRrgq79D4RiYM6e nWYxflS4qZO4GVnm1QFEclifNArkX/YOzX4posaiByR43EcILhuAgfUJ640C0RehHPci bxbg== X-Gm-Message-State: AD7BkJJDC6pvTGCSP3nw32xGb7Dz8BNrMIkdQqJOHvGlagCzBvisTPU5Q1S31I+Dc088QQ== X-Received: by 10.157.47.207 with SMTP id b15mr6749081otd.118.1460210635792; Sat, 09 Apr 2016 07:03:55 -0700 (PDT) Received: from mail-oi0-f48.google.com (mail-oi0-f48.google.com. [209.85.218.48]) by smtp.gmail.com with ESMTPSA id u2sm5556813obz.24.2016.04.09.07.03.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Apr 2016 07:03:55 -0700 (PDT) Received: by mail-oi0-f48.google.com with SMTP id p188so164525146oih.2; Sat, 09 Apr 2016 07:03:55 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.202.225.9 with SMTP id y9mr6253070oig.13.1460210635065; Sat, 09 Apr 2016 07:03:55 -0700 (PDT) Reply-To: cem@FreeBSD.org Received: by 10.157.22.215 with HTTP; Sat, 9 Apr 2016 07:03:55 -0700 (PDT) In-Reply-To: <201604091358.u39Dw4SW079049@repo.freebsd.org> References: <201604091358.u39Dw4SW079049@repo.freebsd.org> Date: Sat, 9 Apr 2016 07:03:55 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r297748 - in head/sys: conf dev/acpica kern vm x86/acpica From: Conrad Meyer To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 14:04:03 -0000 On Sat, Apr 9, 2016 at 6:58 AM, John Baldwin wrote: > Author: jhb > Date: Sat Apr 9 13:58:04 2016 > New Revision: 297748 > URL: https://svnweb.freebsd.org/changeset/base/297748 > > Log: > Add more fine-grained kernel options for NUMA support. > ... > > MAXMEMDOM must still be set to a value greater than for any NUMA support a value greater than one :) > to be effective. Note that 'cpuset -gd' always works if MAXMEMDOM is > enabled and the system supports NUMA. Best, Conrad From owner-svn-src-all@freebsd.org Sat Apr 9 14:09:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 107A5B09970; Sat, 9 Apr 2016 14:09:16 +0000 (UTC) (envelope-from jilles@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 mx1.freebsd.org (Postfix) with ESMTPS id C731F176F; Sat, 9 Apr 2016 14:09:15 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39E9FTI082374; Sat, 9 Apr 2016 14:09:15 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39E9EJP082370; Sat, 9 Apr 2016 14:09:14 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201604091409.u39E9EJP082370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 9 Apr 2016 14:09:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297749 - stable/10/bin/sh X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 14:09:16 -0000 Author: jilles Date: Sat Apr 9 14:09:14 2016 New Revision: 297749 URL: https://svnweb.freebsd.org/changeset/base/297749 Log: MFC r278818: sh: Add stsavestr(), like savestr() but allocates using stalloc(). Modified: stable/10/bin/sh/cd.c stable/10/bin/sh/expand.c stable/10/bin/sh/memalloc.c stable/10/bin/sh/memalloc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/sh/cd.c ============================================================================== --- stable/10/bin/sh/cd.c Sat Apr 9 13:58:04 2016 (r297748) +++ stable/10/bin/sh/cd.c Sat Apr 9 14:09:14 2016 (r297749) @@ -182,7 +182,6 @@ cdlogical(char *dest) struct stat statb; int first; int badstat; - size_t len; /* * Check each component of the path. If we find a symlink or @@ -190,9 +189,7 @@ cdlogical(char *dest) * next time we get the value of the current directory. */ badstat = 0; - len = strlen(dest); - cdcomppath = stalloc(len + 1); - memcpy(cdcomppath, dest, len + 1); + cdcomppath = stsavestr(dest); STARTSTACKSTR(p); if (*dest == '/') { STPUTC('/', p); @@ -277,7 +274,6 @@ findcwd(char *dir) { char *new; char *p; - size_t len; /* * If our argument is NULL, we don't know the current directory @@ -286,9 +282,7 @@ findcwd(char *dir) */ if (dir == NULL || curdir == NULL) return getpwd2(); - len = strlen(dir); - cdcomppath = stalloc(len + 1); - memcpy(cdcomppath, dir, len + 1); + cdcomppath = stsavestr(dir); STARTSTACKSTR(new); if (*dir != '/') { STPUTS(curdir, new); Modified: stable/10/bin/sh/expand.c ============================================================================== --- stable/10/bin/sh/expand.c Sat Apr 9 13:58:04 2016 (r297748) +++ stable/10/bin/sh/expand.c Sat Apr 9 14:09:14 2016 (r297749) @@ -1281,11 +1281,8 @@ addfname(char *name) { char *p; struct strlist *sp; - size_t len; - len = strlen(name); - p = stalloc(len + 1); - memcpy(p, name, len + 1); + p = stsavestr(name); sp = (struct strlist *)stalloc(sizeof *sp); sp->text = p; *exparg.lastp = sp; Modified: stable/10/bin/sh/memalloc.c ============================================================================== --- stable/10/bin/sh/memalloc.c Sat Apr 9 13:58:04 2016 (r297748) +++ stable/10/bin/sh/memalloc.c Sat Apr 9 14:09:14 2016 (r297749) @@ -180,6 +180,18 @@ stunalloc(pointer p) } +char * +stsavestr(const char *s) +{ + char *p; + size_t len; + + len = strlen(s); + p = stalloc(len + 1); + memcpy(p, s, len + 1); + return p; +} + void setstackmark(struct stackmark *mark) Modified: stable/10/bin/sh/memalloc.h ============================================================================== --- stable/10/bin/sh/memalloc.h Sat Apr 9 13:58:04 2016 (r297748) +++ stable/10/bin/sh/memalloc.h Sat Apr 9 14:09:14 2016 (r297749) @@ -52,6 +52,7 @@ void ckfree(pointer); char *savestr(const char *); pointer stalloc(int); void stunalloc(pointer); +char *stsavestr(const char *); void setstackmark(struct stackmark *); void popstackmark(struct stackmark *); char *growstackstr(void); From owner-svn-src-all@freebsd.org Sat Apr 9 14:24:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F9D2B09E47; Sat, 9 Apr 2016 14:24:19 +0000 (UTC) (envelope-from jilles@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 mx1.freebsd.org (Postfix) with ESMTPS id CB34711C0; Sat, 9 Apr 2016 14:24:18 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39EOITn088323; Sat, 9 Apr 2016 14:24:18 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39EOHeU088320; Sat, 9 Apr 2016 14:24:17 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201604091424.u39EOHeU088320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 9 Apr 2016 14:24:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297750 - in stable/10/bin/sh: . tests/builtins X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 14:24:19 -0000 Author: jilles Date: Sat Apr 9 14:24:17 2016 New Revision: 297750 URL: https://svnweb.freebsd.org/changeset/base/297750 Log: MFC r297360: sh: Fix use-after-free if a trap replaces itself. The mergeinfo for this commit was accidentally added to the previous commit. Added: stable/10/bin/sh/tests/builtins/trap17.0 - copied unchanged from r297360, head/bin/sh/tests/builtins/trap17.0 Modified: stable/10/bin/sh/tests/builtins/Makefile stable/10/bin/sh/trap.c Modified: stable/10/bin/sh/tests/builtins/Makefile ============================================================================== --- stable/10/bin/sh/tests/builtins/Makefile Sat Apr 9 14:09:14 2016 (r297749) +++ stable/10/bin/sh/tests/builtins/Makefile Sat Apr 9 14:24:17 2016 (r297750) @@ -127,6 +127,7 @@ FILES+= trap11.0 FILES+= trap12.0 FILES+= trap13.0 FILES+= trap14.0 +FILES+= trap17.0 FILES+= trap2.0 FILES+= trap3.0 FILES+= trap4.0 Copied: stable/10/bin/sh/tests/builtins/trap17.0 (from r297360, head/bin/sh/tests/builtins/trap17.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/bin/sh/tests/builtins/trap17.0 Sat Apr 9 14:24:17 2016 (r297750, copy of r297360, head/bin/sh/tests/builtins/trap17.0) @@ -0,0 +1,10 @@ +# $FreeBSD$ +# This use-after-free bug probably needs non-default settings to show up. + +v1=nothing v2=nothing +trap 'trap "echo bad" USR1 +v1=trap_received +v2=trap_invoked +:' USR1 +kill -USR1 "$$" +[ "$v1.$v2" = trap_received.trap_invoked ] Modified: stable/10/bin/sh/trap.c ============================================================================== --- stable/10/bin/sh/trap.c Sat Apr 9 14:09:14 2016 (r297749) +++ stable/10/bin/sh/trap.c Sat Apr 9 14:24:17 2016 (r297750) @@ -403,6 +403,7 @@ onsig(int signo) void dotrap(void) { + struct stackmark smark; int i; int savestatus, prev_evalskip, prev_skipcount; @@ -436,7 +437,9 @@ dotrap(void) last_trapsig = i; savestatus = exitstatus; - evalstring(trap[i], 0); + setstackmark(&smark); + evalstring(stsavestr(trap[i]), 0); + popstackmark(&smark); /* * If such a command was not From owner-svn-src-all@freebsd.org Sat Apr 9 14:50:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3046EB0855E; Sat, 9 Apr 2016 14:50:49 +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 mx1.freebsd.org (Postfix) with ESMTPS id E24C31DF1; Sat, 9 Apr 2016 14:50:48 +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 u39EomkI094626; Sat, 9 Apr 2016 14:50:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39Eol6W094620; Sat, 9 Apr 2016 14:50:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604091450.u39Eol6W094620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 9 Apr 2016 14:50:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297751 - head/sys/dev/isp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 14:50:49 -0000 Author: mav Date: Sat Apr 9 14:50:47 2016 New Revision: 297751 URL: https://svnweb.freebsd.org/changeset/base/297751 Log: Register symbolic port/node names in FC name server. This is cosmetics that simplifies identification of new ports on FC switch. It would be good to use target name from CTL here instead of hostname, but it is not passed here through CAM now. MFC after: 2 weeks Modified: head/sys/dev/isp/isp.c head/sys/dev/isp/isp_freebsd.h head/sys/dev/isp/isp_library.c head/sys/dev/isp/isp_library.h head/sys/dev/isp/isp_stds.h head/sys/dev/isp/ispmbox.h Modified: head/sys/dev/isp/isp.c ============================================================================== --- head/sys/dev/isp/isp.c Sat Apr 9 14:24:17 2016 (r297750) +++ head/sys/dev/isp/isp.c Sat Apr 9 14:50:47 2016 (r297751) @@ -126,6 +126,8 @@ static int isp_send_change_request(ispso static int isp_register_fc4_type(ispsoftc_t *, int); static int isp_register_fc4_type_24xx(ispsoftc_t *, int); static int isp_register_fc4_features_24xx(ispsoftc_t *, int); +static int isp_register_port_name_24xx(ispsoftc_t *, int); +static int isp_register_node_name_24xx(ispsoftc_t *, int); static uint16_t isp_next_handle(ispsoftc_t *, uint16_t *); static int isp_fw_state(ispsoftc_t *, int); static void isp_mboxcmd_qnw(ispsoftc_t *, mbreg_t *, int); @@ -3073,6 +3075,8 @@ isp_fclink_test(ispsoftc_t *isp, int cha r = isp_register_fc4_type_24xx(isp, chan); if (r == 0) isp_register_fc4_features_24xx(isp, chan); + isp_register_port_name_24xx(isp, chan); + isp_register_node_name_24xx(isp, chan); } else { fcp->isp_sns_hdl = SNS_ID; r = isp_register_fc4_type(isp, chan); @@ -3577,8 +3581,6 @@ isp_gid_ft_ct_passthru(ispsoftc_t *isp, /* * Build the CT header and command in memory. - * - * Note that the CT header has to end up as Big Endian format in memory. */ ISP_MEMZERO(&ct, sizeof (ct)); ct.ct_revision = CT_REVISION; @@ -3982,8 +3984,6 @@ isp_register_fc4_type_24xx(ispsoftc_t *i /* * Build the CT header and command in memory. - * - * Note that the CT header has to end up as Big Endian format in memory. */ ISP_MEMZERO(&rp, sizeof(rp)); ct = &rp.rftid_hdr; @@ -4034,8 +4034,6 @@ isp_register_fc4_features_24xx(ispsoftc_ /* * Build the CT header and command in memory. - * - * Note that the CT header has to end up as Big Endian format in memory. */ ISP_MEMZERO(&rp, sizeof(rp)); ct = &rp.rffid_hdr; @@ -4079,6 +4077,130 @@ isp_register_fc4_features_24xx(ispsoftc_ return (0); } +static int +isp_register_port_name_24xx(ispsoftc_t *isp, int chan) +{ + fcparam *fcp = FCPARAM(isp, chan); + ct_hdr_t *ct; + rspn_id_t rp; + uint8_t *scp = fcp->isp_scratch; + int len; + + if (FC_SCRATCH_ACQUIRE(isp, chan)) { + isp_prt(isp, ISP_LOGERR, sacq); + return (-1); + } + + /* + * Build the CT header and command in memory. + */ + ISP_MEMZERO(&rp, sizeof(rp)); + ct = &rp.rspnid_hdr; + ct->ct_revision = CT_REVISION; + ct->ct_fcs_type = CT_FC_TYPE_FC; + ct->ct_fcs_subtype = CT_FC_SUBTYPE_NS; + ct->ct_cmd_resp = SNS_RSPN_ID; + rp.rspnid_portid[0] = fcp->isp_portid >> 16; + rp.rspnid_portid[1] = fcp->isp_portid >> 8; + rp.rspnid_portid[2] = fcp->isp_portid; + rp.rspnid_length = 0; + len = offsetof(rspn_id_t, rspnid_name); + mtx_lock(&prison0.pr_mtx); + rp.rspnid_length += sprintf(&scp[XTXOFF + len + rp.rspnid_length], + "%s", prison0.pr_hostname[0] ? prison0.pr_hostname : "FreeBSD"); + mtx_unlock(&prison0.pr_mtx); + rp.rspnid_length += sprintf(&scp[XTXOFF + len + rp.rspnid_length], + ":%s", device_get_nameunit(isp->isp_dev)); + if (chan != 0) { + rp.rspnid_length += sprintf(&scp[XTXOFF + len + + rp.rspnid_length], "/%d", chan); + } + len += rp.rspnid_length; + ct->ct_bcnt_resid = (len - sizeof(ct_hdr_t)) >> 2; + isp_put_rspn_id(isp, &rp, (rspn_id_t *)&scp[XTXOFF]); + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "CT request", len, &scp[XTXOFF]); + + if (isp_ct_passthru(isp, chan, len, sizeof(ct_hdr_t))) { + FC_SCRATCH_RELEASE(isp, chan); + return (-1); + } + + isp_get_ct_hdr(isp, (ct_hdr_t *) scp, ct); + FC_SCRATCH_RELEASE(isp, chan); + if (ct->ct_cmd_resp == LS_RJT) { + isp_prt(isp, ISP_LOG_SANCFG|ISP_LOG_WARN1, + "Chan %d Register Symbolic Port Name rejected", chan); + return (-1); + } else if (ct->ct_cmd_resp == LS_ACC) { + isp_prt(isp, ISP_LOG_SANCFG, + "Chan %d Register Symbolic Port Name accepted", chan); + } else { + isp_prt(isp, ISP_LOGWARN, + "Chan %d Register Symbolic Port Name: 0x%x", chan, ct->ct_cmd_resp); + return (-1); + } + return (0); +} + +static int +isp_register_node_name_24xx(ispsoftc_t *isp, int chan) +{ + fcparam *fcp = FCPARAM(isp, chan); + ct_hdr_t *ct; + rsnn_nn_t rp; + uint8_t *scp = fcp->isp_scratch; + int len; + + if (FC_SCRATCH_ACQUIRE(isp, chan)) { + isp_prt(isp, ISP_LOGERR, sacq); + return (-1); + } + + /* + * Build the CT header and command in memory. + */ + ISP_MEMZERO(&rp, sizeof(rp)); + ct = &rp.rsnnnn_hdr; + ct->ct_revision = CT_REVISION; + ct->ct_fcs_type = CT_FC_TYPE_FC; + ct->ct_fcs_subtype = CT_FC_SUBTYPE_NS; + ct->ct_cmd_resp = SNS_RSNN_NN; + MAKE_NODE_NAME_FROM_WWN(rp.rsnnnn_nodename, fcp->isp_wwnn); + rp.rsnnnn_length = 0; + len = offsetof(rsnn_nn_t, rsnnnn_name); + mtx_lock(&prison0.pr_mtx); + rp.rsnnnn_length += sprintf(&scp[XTXOFF + len + rp.rsnnnn_length], + "%s", prison0.pr_hostname[0] ? prison0.pr_hostname : "FreeBSD"); + mtx_unlock(&prison0.pr_mtx); + len += rp.rsnnnn_length; + ct->ct_bcnt_resid = (len - sizeof(ct_hdr_t)) >> 2; + isp_put_rsnn_nn(isp, &rp, (rsnn_nn_t *)&scp[XTXOFF]); + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "CT request", len, &scp[XTXOFF]); + + if (isp_ct_passthru(isp, chan, len, sizeof(ct_hdr_t))) { + FC_SCRATCH_RELEASE(isp, chan); + return (-1); + } + + isp_get_ct_hdr(isp, (ct_hdr_t *) scp, ct); + FC_SCRATCH_RELEASE(isp, chan); + if (ct->ct_cmd_resp == LS_RJT) { + isp_prt(isp, ISP_LOG_SANCFG|ISP_LOG_WARN1, + "Chan %d Register Symbolic Node Name rejected", chan); + return (-1); + } else if (ct->ct_cmd_resp == LS_ACC) { + isp_prt(isp, ISP_LOG_SANCFG, + "Chan %d Register Symbolic Node Name accepted", chan); + } else { + isp_prt(isp, ISP_LOGWARN, + "Chan %d Register Symbolic Node Name: 0x%x", chan, ct->ct_cmd_resp); + return (-1); + } + return (0); +} + static uint16_t isp_next_handle(ispsoftc_t *isp, uint16_t *ohp) { Modified: head/sys/dev/isp/isp_freebsd.h ============================================================================== --- head/sys/dev/isp/isp_freebsd.h Sat Apr 9 14:24:17 2016 (r297750) +++ head/sys/dev/isp/isp_freebsd.h Sat Apr 9 14:50:47 2016 (r297751) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include Modified: head/sys/dev/isp/isp_library.c ============================================================================== --- head/sys/dev/isp/isp_library.c Sat Apr 9 14:24:17 2016 (r297750) +++ head/sys/dev/isp/isp_library.c Sat Apr 9 14:50:47 2016 (r297751) @@ -1988,6 +1988,17 @@ isp_put_rft_id(ispsoftc_t *isp, rft_id_t } void +isp_put_rspn_id(ispsoftc_t *isp, rspn_id_t *src, rspn_id_t *dst) +{ +/* int i;*/ + isp_put_ct_hdr(isp, &src->rspnid_hdr, &dst->rspnid_hdr); + ISP_IOZPUT_8(isp, src->rspnid_reserved, &dst->rspnid_reserved); + ISP_IOZPUT_8(isp, src->rspnid_length, &dst->rspnid_length); +/* for (i = 0; i < src->rspnid_length; i++) + ISP_IOZPUT_8(isp, src->rspnid_name[i], &dst->rspnid_name[i]);*/ +} + +void isp_put_rff_id(ispsoftc_t *isp, rff_id_t *src, rff_id_t *dst) { int i; @@ -2002,6 +2013,18 @@ isp_put_rff_id(ispsoftc_t *isp, rff_id_t } void +isp_put_rsnn_nn(ispsoftc_t *isp, rsnn_nn_t *src, rsnn_nn_t *dst) +{ + int i; + isp_put_ct_hdr(isp, &src->rsnnnn_hdr, &dst->rsnnnn_hdr); + for (i = 0; i < 8; i++) + ISP_IOZPUT_8(isp, src->rsnnnn_nodename[i], &dst->rsnnnn_nodename[i]); + ISP_IOZPUT_8(isp, src->rsnnnn_length, &dst->rsnnnn_length); +/* for (i = 0; i < src->rsnnnn_length; i++) + ISP_IOZPUT_8(isp, src->rsnnnn_name[i], &dst->rsnnnn_name[i]);*/ +} + +void isp_get_ct_hdr(ispsoftc_t *isp, ct_hdr_t *src, ct_hdr_t *dst) { ISP_IOZGET_8(isp, &src->ct_revision, dst->ct_revision); Modified: head/sys/dev/isp/isp_library.h ============================================================================== --- head/sys/dev/isp/isp_library.h Sat Apr 9 14:24:17 2016 (r297750) +++ head/sys/dev/isp/isp_library.h Sat Apr 9 14:50:47 2016 (r297751) @@ -144,7 +144,9 @@ void isp_get_fc_hdr(ispsoftc_t *, fc_hdr void isp_put_fc_hdr(ispsoftc_t *, fc_hdr_t *, fc_hdr_t *); void isp_get_fcp_cmnd_iu(ispsoftc_t *, fcp_cmnd_iu_t *, fcp_cmnd_iu_t *); void isp_put_rft_id(ispsoftc_t *, rft_id_t *, rft_id_t *); +void isp_put_rspn_id(ispsoftc_t *, rspn_id_t *, rspn_id_t *); void isp_put_rff_id(ispsoftc_t *, rff_id_t *, rff_id_t *); +void isp_put_rsnn_nn(ispsoftc_t *, rsnn_nn_t *, rsnn_nn_t *); void isp_get_ct_hdr(ispsoftc_t *isp, ct_hdr_t *, ct_hdr_t *); void isp_put_ct_hdr(ispsoftc_t *isp, ct_hdr_t *, ct_hdr_t *); void isp_put_fcp_rsp_iu(ispsoftc_t *isp, fcp_rsp_iu_t *, fcp_rsp_iu_t *); Modified: head/sys/dev/isp/isp_stds.h ============================================================================== --- head/sys/dev/isp/isp_stds.h Sat Apr 9 14:24:17 2016 (r297750) +++ head/sys/dev/isp/isp_stds.h Sat Apr 9 14:50:47 2016 (r297751) @@ -139,6 +139,19 @@ typedef struct { } rft_id_t; /* + * RSPN_ID Requet CT_IU + * + * Source: INCITS 463-2010 Generic Services 6 Section 5.2.5.32 + */ +typedef struct { + ct_hdr_t rspnid_hdr; + uint8_t rspnid_reserved; + uint8_t rspnid_portid[3]; + uint8_t rspnid_length; + uint8_t rspnid_name[0]; +} rspn_id_t; + +/* * RFF_ID Requet CT_IU * * Source: INCITS 463-2010 Generic Services 6 Section 5.2.5.34 @@ -153,6 +166,18 @@ typedef struct { } rff_id_t; /* + * RSNN_NN Requet CT_IU + * + * Source: INCITS 463-2010 Generic Services 6 Section 5.2.5.35 + */ +typedef struct { + ct_hdr_t rsnnnn_hdr; + uint8_t rsnnnn_nodename[8]; + uint8_t rsnnnn_length; + uint8_t rsnnnn_name[0]; +} rsnn_nn_t; + +/* * FCP Response IU and bits of interest * Source: NCITS T10, Project 1828D, Revision 02b (aka FCP4r02b) */ Modified: head/sys/dev/isp/ispmbox.h ============================================================================== --- head/sys/dev/isp/ispmbox.h Sat Apr 9 14:24:17 2016 (r297750) +++ head/sys/dev/isp/ispmbox.h Sat Apr 9 14:50:47 2016 (r297751) @@ -1548,7 +1548,9 @@ typedef struct { #define SNS_GFF_ID 0x11F #define SNS_GID_FT 0x171 #define SNS_RFT_ID 0x217 +#define SNS_RSPN_ID 0x218 #define SNS_RFF_ID 0x21F +#define SNS_RSNN_NN 0x239 typedef struct { uint16_t snscb_rblen; /* response buffer length (words) */ uint16_t snscb_reserved0; From owner-svn-src-all@freebsd.org Sat Apr 9 14:56:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2DACB08758; Sat, 9 Apr 2016 14:56:06 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ig0-x235.google.com (mail-ig0-x235.google.com [IPv6:2607:f8b0:4001:c05::235]) (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 91C9F117E; Sat, 9 Apr 2016 14:56:06 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-ig0-x235.google.com with SMTP id gy3so32514655igb.0; Sat, 09 Apr 2016 07:56:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=1kSXgVAFc//DbCOQw9drXrHuuVbvtIQGL5r/CFeMyec=; b=KTdLZLQoN1ksmhj7YmEfoChJsVNi+AXECqmvUFzPADwKRz6YoKqkZSVOv3LjSvMdUm U2BJ+hz0mA73BnAVY861Q466lt7ExWy8VuifnTNawlFeOj591Zfy8892gOsGAEeUB6na ZIad+klt4+5sKGoygeRvndylA3+mlxi4lSE6OSW5ZABXT6HefjUVhJllwyiit8N4+e4Q Ghh5gzxft9IyVbCjsfo5hDSeONwI4Jt9HgE1MalxjJRRwaUE5U1J8t2YaNVKX1Tke/kH x7paR/EizFkYL3X/kdI2/QbPdfAWstoa2FsJl2zf6LCQb6dvBt5KxVivxL0qjo9ltXev +gaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=1kSXgVAFc//DbCOQw9drXrHuuVbvtIQGL5r/CFeMyec=; b=NTLuyHnfohVXyyX2Z+KCA6v+FUzXN4n0aFn9QOyB7vvDHnmgEe044dThnG6WJgeylq KWIDyNfSPSSVMB47zREK8nYnvPLAIkiteaBLlOJlLe0cZBNSjUqL5ZmSo/sEqDj07G29 AJVl1oOA4kB3XJC13IEsbMNNJNJAIKUi/P6CctBa5FSmqRrtwn3I4/zK11a0tinEjiOk //iZ1omqXQV9dgsbmWsUyZnD1WCOXfGx9hk7ruzxtWc7eEzjHUUY0iA2Yq0nORfaAevE vH8ZKJ9fcdKfd4nnbPjw8v+uWAg0gByfNghr2MkUPlPQHrf1YgOZ6N2JYFAiYJd3sRCq Ntgg== X-Gm-Message-State: AD7BkJJrKxVUPJ4fETdHbv7bPeCTemeS37ZrrpZ2x4oaYqL7+peq6KmShRl+6ZR0pcK8P3HiFRqGzu9sZfXykA== MIME-Version: 1.0 X-Received: by 10.50.131.199 with SMTP id oo7mr9108237igb.22.1460213765998; Sat, 09 Apr 2016 07:56:05 -0700 (PDT) Received: by 10.36.14.19 with HTTP; Sat, 9 Apr 2016 07:56:05 -0700 (PDT) In-Reply-To: <201604090931.u399VTbw093485@repo.freebsd.org> References: <201604090931.u399VTbw093485@repo.freebsd.org> Date: Sat, 9 Apr 2016 07:56:05 -0700 Message-ID: Subject: Re: svn commit: r297733 - head/sys/net80211 From: Adrian Chadd To: "Bjoern A. Zeeb" Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 14:56:06 -0000 thanks! Sorry, I'm in the middle of trying to figure out why IBSS isn't working anymore for me and I missed this :( -a On 9 April 2016 at 02:31, Bjoern A. Zeeb wrote: > Author: bz > Date: Sat Apr 9 09:31:28 2016 > New Revision: 297733 > URL: https://svnweb.freebsd.org/changeset/base/297733 > > Log: > Try to unbreak the build: the 'vap' variable is only used if ieee80211 > debugging compile is on. > > Modified: > head/sys/net80211/ieee80211_node.c > > Modified: head/sys/net80211/ieee80211_node.c > ============================================================================== > --- head/sys/net80211/ieee80211_node.c Sat Apr 9 09:24:05 2016 (r297732) > +++ head/sys/net80211/ieee80211_node.c Sat Apr 9 09:31:28 2016 (r297733) > @@ -599,8 +599,8 @@ ieee80211_ibss_merge_check(struct ieee80 > int > ieee80211_ibss_merge(struct ieee80211_node *ni) > { > - struct ieee80211vap *vap = ni->ni_vap; > #ifdef IEEE80211_DEBUG > + struct ieee80211vap *vap = ni->ni_vap; > struct ieee80211com *ic = ni->ni_ic; > #endif > > From owner-svn-src-all@freebsd.org Sat Apr 9 15:27:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B6BAB08FE1; Sat, 9 Apr 2016 15:27:36 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 18EE51DED; Sat, 9 Apr 2016 15:27:36 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id ECED8B97E; Sat, 9 Apr 2016 11:27:34 -0400 (EDT) From: John Baldwin To: "Bjoern A. Zeeb" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297742 - head/sys/netinet Date: Sat, 09 Apr 2016 06:53:37 -0700 Message-ID: <5630207.6cr5Ycyqbh@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201604091205.u39C5Oks041429@repo.freebsd.org> References: <201604091205.u39C5Oks041429@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Sat, 09 Apr 2016 11:27:35 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 15:27:36 -0000 On Saturday, April 09, 2016 12:05:24 PM Bjoern A. Zeeb wrote: > Author: bz > Date: Sat Apr 9 12:05:23 2016 > New Revision: 297742 > URL: https://svnweb.freebsd.org/changeset/base/297742 > > Log: > Mfp: r296310,r296343 > > It looks like as with the safety belt of DELAY() fastened (*) we can > completely tear down and free all memory for TCP (after r281599). > > (*) in theory a few ticks should be good enough to make sure the timers > are all really gone. Could we use a better matric here and check a > tcbcb count as an optimization? In theory, no amount of DELAY() is ever enough to close a theoretical race window. In practice you might get lucky, but you might also panic and trash user data. In the rest of the tree, we tend to prefer marking items as NOFREE instead of this approach putting a priority on stability and reliability over memory efficiency. For all of the zones that you removed NOFREE from, do you know why that was added in the first place (e.g. which stale pointers to pcbs could be referenced after free)? Did you verify that those conditions have been fixed? -- John Baldwin From owner-svn-src-all@freebsd.org Sat Apr 9 15:27:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6DA1B08FC4; Sat, 9 Apr 2016 15:27:34 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9801E1DB4; Sat, 9 Apr 2016 15:27:34 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 88442B962; Sat, 9 Apr 2016 11:27:33 -0400 (EDT) From: John Baldwin To: cem@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297748 - in head/sys: conf dev/acpica kern vm x86/acpica Date: Sat, 09 Apr 2016 08:20:55 -0700 Message-ID: <2273890.RhbvShR3vN@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: References: <201604091358.u39Dw4SW079049@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Sat, 09 Apr 2016 11:27:33 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 15:27:34 -0000 On Saturday, April 09, 2016 07:03:55 AM Conrad Meyer wrote: > On Sat, Apr 9, 2016 at 6:58 AM, John Baldwin wrote: > > Author: jhb > > Date: Sat Apr 9 13:58:04 2016 > > New Revision: 297748 > > URL: https://svnweb.freebsd.org/changeset/base/297748 > > > > Log: > > Add more fine-grained kernel options for NUMA support. > > ... > > > > MAXMEMDOM must still be set to a value greater than for any NUMA support > > a value greater than one :) Oops, yes. :) -- John Baldwin From owner-svn-src-all@freebsd.org Sat Apr 9 16:06:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA5E6B09BAA; Sat, 9 Apr 2016 16:06:14 +0000 (UTC) (envelope-from jilles@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 mx1.freebsd.org (Postfix) with ESMTPS id A19E510F8; Sat, 9 Apr 2016 16:06:14 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39G6DHl018685; Sat, 9 Apr 2016 16:06:13 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39G6DJg018682; Sat, 9 Apr 2016 16:06:13 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201604091606.u39G6DJg018682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 9 Apr 2016 16:06:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297752 - head/bin/sh/tests/builtins X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 16:06:15 -0000 Author: jilles Date: Sat Apr 9 16:06:13 2016 New Revision: 297752 URL: https://svnweb.freebsd.org/changeset/base/297752 Log: sh: Fix some unquoted variables in tests. The builtins/getopts1.0 test failed if a single-character file existed in the current directory. Modified: head/bin/sh/tests/builtins/getopts1.0 head/bin/sh/tests/builtins/getopts2.0 head/bin/sh/tests/builtins/getopts9.0 Modified: head/bin/sh/tests/builtins/getopts1.0 ============================================================================== --- head/bin/sh/tests/builtins/getopts1.0 Sat Apr 9 14:50:47 2016 (r297751) +++ head/bin/sh/tests/builtins/getopts1.0 Sat Apr 9 16:06:13 2016 (r297752) @@ -3,7 +3,7 @@ printf -- '-1-\n' set -- -abc getopts "ab:" OPTION -echo ${OPTION} +printf '%s\n' "${OPTION}" # In this case 'getopts' should realize that we have not provided the # required argument for "-b". @@ -14,12 +14,12 @@ echo ${OPTION} printf -- '-2-\n' set -- -ab getopts "ab:" OPTION -echo ${OPTION} +printf '%s\n' "${OPTION}" getopts "ab:" OPTION 3>&2 2>&1 >&3 3>&- -echo ${OPTION} +printf '%s\n' "${OPTION}" # The 'shift' is aimed at causing an error. printf -- '-3-\n' shift 1 getopts "ab:" OPTION -echo ${OPTION} +printf '%s\n' "${OPTION}" Modified: head/bin/sh/tests/builtins/getopts2.0 ============================================================================== --- head/bin/sh/tests/builtins/getopts2.0 Sat Apr 9 14:50:47 2016 (r297751) +++ head/bin/sh/tests/builtins/getopts2.0 Sat Apr 9 16:06:13 2016 (r297752) @@ -3,4 +3,4 @@ set - -ax getopts ax option set -C getopts ax option -echo $option +printf '%s\n' "$option" Modified: head/bin/sh/tests/builtins/getopts9.0 ============================================================================== --- head/bin/sh/tests/builtins/getopts9.0 Sat Apr 9 14:50:47 2016 (r297751) +++ head/bin/sh/tests/builtins/getopts9.0 Sat Apr 9 16:06:13 2016 (r297752) @@ -2,8 +2,8 @@ args='-ab' getopts ab opt $args -echo $?:$opt:$OPTARG +printf '%s\n' "$?:$opt:$OPTARG" for dummy in dummy1 dummy2; do getopts ab opt $args - echo $?:$opt:$OPTARG + printf '%s\n' "$?:$opt:$OPTARG" done From owner-svn-src-all@freebsd.org Sat Apr 9 16:35:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2A84B092A2; Sat, 9 Apr 2016 16:35:52 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-ig0-x242.google.com (mail-ig0-x242.google.com [IPv6:2607:f8b0:4001:c05::242]) (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 AF4711D21; Sat, 9 Apr 2016 16:35:52 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-ig0-x242.google.com with SMTP id kb1so6206492igb.3; Sat, 09 Apr 2016 09:35:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=aDjxBiaiWlretLg8s78Z/vLbD/9gN8UK5hVENd4i0fY=; b=sa1GY9QKnBFPauO3VGujx12IvlHoil2uPLnrPrqaIE9XFpbx5DReV9fmOEYrD9kh2f uyPnVZ7n7UXjZ7L+u0AIkEQy6STSDP+LN45p4DheQfZjC3ZqNhcvuEIb3snsoSvCEsSK 4oA1y0nD5UL0bsSv3c9XgLG2wEvKb5DFwZDdB0EEe+Xdk4nHVTUYLocHzwA99wGuswyu 3z2Np8zF/t2NRAUvMs1QpPWCyyX/XQXoFCuiARsxzpOXDw02kh3TSLHJ8PYkdgOfi2+A 6PgSsaZiQ1QdWZkkB/jzA+NlDY5KxcOh5RHoz3HKqaBKB5KgkeeqfeNRYGFJAQSsYYNU agOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=aDjxBiaiWlretLg8s78Z/vLbD/9gN8UK5hVENd4i0fY=; b=U3rQw0mj+cffGbbd05D9uoyeBQP8YLr3SG/PvAKSNYUEzF/MH1mC4aPt2X/uQ9vUFZ kTl0BNy+QjgQPhAqYdZWLxEWQA5pHh5ycoVlneLADlgiR7Io22GOMTT4c7/JZamx3ng2 xDWgeNZ8sJiifI/ATXrV/XA40rNABvJ6aafTAqRvIBzI0MurjmFArwFO/1dZJwXoqjBE uB3/LyJygpvG52RLqkZxauQQahYVzvz7YZWDa4SJK7PAERkukG/FjgU/06EzB8y7TjlN RyyJjoNPGYxYR9tasGav9udOkBn1wSKboWtC6jJtSQyQjQMsqb6UW7Xos4upl+4ERkNV sP4w== X-Gm-Message-State: AD7BkJJiNUMD2mmZRgj7pM9a1pMKWnx0qkL0JUsM5Fn0nyHrmTxRzRkGIv1CPH/FwFJAWmIPNZX0L92tnpuLJg== X-Received: by 10.50.132.102 with SMTP id ot6mr9012127igb.97.1460219752042; Sat, 09 Apr 2016 09:35:52 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.39.66 with HTTP; Sat, 9 Apr 2016 09:35:32 -0700 (PDT) In-Reply-To: References: <201604072012.u37KCjCa011359@repo.freebsd.org> From: Ed Maste Date: Sat, 9 Apr 2016 16:35:32 +0000 X-Google-Sender-Auth: ftu5RzJKAobKK04YkCZmdI1kJ6o Message-ID: Subject: Re: svn commit: r297685 - in head/sys: conf dev/kbdmux modules/kbdmux To: Oliver Pinter Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 16:35:53 -0000 On 9 April 2016 at 11:03, Oliver Pinter wrote: > Hi Ed! > > On Thu, Apr 7, 2016 at 10:12 PM, Ed Maste wrote: >> Author: emaste >> Date: Thu Apr 7 20:12:45 2016 >> New Revision: 297685 >> URL: https://svnweb.freebsd.org/changeset/base/297685 >> >> Log: >> Add option to specify built-in keymap for kbdmux >> >> PR: 153459 >> Submitted by: swell.k@gmail.com >> [...] > > It would be nice to MFC this change to 10-STABLE. Yes, I plan to merge all of the compiled-in keymap changes to stable/10 in a little while. From owner-svn-src-all@freebsd.org Sat Apr 9 17:37:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C525B0A43E; Sat, 9 Apr 2016 17:37:37 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id 6B7AE1991; Sat, 9 Apr 2016 17:37:37 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39Hbaqs046657; Sat, 9 Apr 2016 17:37:36 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39HbaQi046655; Sat, 9 Apr 2016 17:37:36 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604091737.u39HbaQi046655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 9 Apr 2016 17:37:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297753 - head/sys/dev/ixl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 17:37:37 -0000 Author: pfg Date: Sat Apr 9 17:37:36 2016 New Revision: 297753 URL: https://svnweb.freebsd.org/changeset/base/297753 Log: ixl(4): replace 0 with NULL for pointers. Found by devel/coccinelle. Differential Revision: https://reviews.freebsd.org/D5894 Reviewed by: erj Modified: head/sys/dev/ixl/if_ixl.c head/sys/dev/ixl/if_ixlv.c Modified: head/sys/dev/ixl/if_ixl.c ============================================================================== --- head/sys/dev/ixl/if_ixl.c Sat Apr 9 16:06:13 2016 (r297752) +++ head/sys/dev/ixl/if_ixl.c Sat Apr 9 17:37:36 2016 (r297753) @@ -3380,7 +3380,7 @@ ixl_add_sysctls_eth_stats(struct sysctl_ }; struct ixl_sysctl_info *entry = ctls; - while (entry->stat != 0) + while (entry->stat != NULL) { SYSCTL_ADD_UQUAD(ctx, child, OID_AUTO, entry->name, CTLFLAG_RD, entry->stat, @@ -3439,7 +3439,7 @@ ixl_add_sysctls_mac_stats(struct sysctl_ }; struct ixl_sysctl_info *entry = ctls; - while (entry->stat != 0) + while (entry->stat != NULL) { SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, entry->name, CTLFLAG_RD, entry->stat, Modified: head/sys/dev/ixl/if_ixlv.c ============================================================================== --- head/sys/dev/ixl/if_ixlv.c Sat Apr 9 16:06:13 2016 (r297752) +++ head/sys/dev/ixl/if_ixlv.c Sat Apr 9 17:37:36 2016 (r297753) @@ -2832,7 +2832,7 @@ ixlv_add_sysctls(struct ixlv_sc *sc) {0,0,0} }; struct ixl_sysctl_info *entry = ctls; - while (entry->stat != 0) + while (entry->stat != NULL) { SYSCTL_ADD_QUAD(ctx, child, OID_AUTO, entry->name, CTLFLAG_RD, entry->stat, From owner-svn-src-all@freebsd.org Sat Apr 9 18:08:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58C1AB0AB68; Sat, 9 Apr 2016 18:08:22 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id 26464186E; Sat, 9 Apr 2016 18:08:22 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39I8LMK056457; Sat, 9 Apr 2016 18:08:21 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39I8Lmr056456; Sat, 9 Apr 2016 18:08:21 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604091808.u39I8Lmr056456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 9 Apr 2016 18:08:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297754 - head/lib/libfetch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 18:08:22 -0000 Author: pfg Date: Sat Apr 9 18:08:21 2016 New Revision: 297754 URL: https://svnweb.freebsd.org/changeset/base/297754 Log: libfetch: replace 0 with NULL for pointers. Found with devel/coccinelle. Reviewed by: des Modified: head/lib/libfetch/ftp.c Modified: head/lib/libfetch/ftp.c ============================================================================== --- head/lib/libfetch/ftp.c Sat Apr 9 17:37:36 2016 (r297753) +++ head/lib/libfetch/ftp.c Sat Apr 9 18:08:21 2016 (r297754) @@ -929,7 +929,7 @@ ftp_authenticate(conn_t *conn, struct ur if (*pwd == '\0') pwd = getenv("FTP_PASSWORD"); if (pwd == NULL || *pwd == '\0') { - if ((logname = getlogin()) == 0) + if ((logname = getlogin()) == NULL) logname = FTP_ANONYMOUS_USER; if ((len = snprintf(pbuf, MAXLOGNAME + 1, "%s@", logname)) < 0) len = 0; From owner-svn-src-all@freebsd.org Sat Apr 9 18:09:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C3A2B0ABBD; Sat, 9 Apr 2016 18:09:11 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id 325491A24; Sat, 9 Apr 2016 18:09:11 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39I9A2K056529; Sat, 9 Apr 2016 18:09:10 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39I9Alu056527; Sat, 9 Apr 2016 18:09:10 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604091809.u39I9Alu056527@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 9 Apr 2016 18:09:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297755 - in head/lib/libpam/modules: pam_krb5 pam_login_access X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 18:09:11 -0000 Author: pfg Date: Sat Apr 9 18:09:10 2016 New Revision: 297755 URL: https://svnweb.freebsd.org/changeset/base/297755 Log: libpam: replace 0 with NULL for pointers. Found with devel/coccinelle. Reviewed by: des Modified: head/lib/libpam/modules/pam_krb5/pam_krb5.c head/lib/libpam/modules/pam_login_access/login_access.c Modified: head/lib/libpam/modules/pam_krb5/pam_krb5.c ============================================================================== --- head/lib/libpam/modules/pam_krb5/pam_krb5.c Sat Apr 9 18:08:21 2016 (r297754) +++ head/lib/libpam/modules/pam_krb5/pam_krb5.c Sat Apr 9 18:09:10 2016 (r297755) @@ -860,7 +860,7 @@ verify_krb_v5_tgt(krb5_context context, services[0] = "host"; services[1] = pam_service; services[2] = NULL; - keyblock = 0; + keyblock = NULL; retval = -1; for (service = &services[0]; *service != NULL; service++) { retval = krb5_sname_to_principal(context, NULL, *service, Modified: head/lib/libpam/modules/pam_login_access/login_access.c ============================================================================== --- head/lib/libpam/modules/pam_login_access/login_access.c Sat Apr 9 18:08:21 2016 (r297754) +++ head/lib/libpam/modules/pam_login_access/login_access.c Sat Apr 9 18:09:10 2016 (r297755) @@ -124,7 +124,7 @@ list_match(char *list, const char *item, * the match is affected by any exceptions. */ - for (tok = strtok(list, sep); tok != 0; tok = strtok((char *) 0, sep)) { + for (tok = strtok(list, sep); tok != NULL; tok = strtok((char *) 0, sep)) { if (strcasecmp(tok, "EXCEPT") == 0) /* EXCEPT: give up */ break; if ((match = (*match_fn)(tok, item)) != 0) /* YES */ @@ -135,7 +135,7 @@ list_match(char *list, const char *item, if (match != NO) { while ((tok = strtok((char *) 0, sep)) && strcasecmp(tok, "EXCEPT")) /* VOID */ ; - if (tok == 0 || list_match((char *) 0, item, match_fn) == NO) + if (tok == NULL || list_match((char *) 0, item, match_fn) == NO) return (match); } return (NO); From owner-svn-src-all@freebsd.org Sat Apr 9 18:31:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AD7CB08067; Sat, 9 Apr 2016 18:31:39 +0000 (UTC) (envelope-from bz@freebsd.org) Received: from mx1.sbone.de (bird.sbone.de [46.4.1.90]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 083C41323; Sat, 9 Apr 2016 18:31:38 +0000 (UTC) (envelope-from bz@freebsd.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 2E5D825D385E; Sat, 9 Apr 2016 18:31:28 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 441CDD1F7F9; Sat, 9 Apr 2016 18:31:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id EmOwDeg6WbTm; Sat, 9 Apr 2016 18:31:25 +0000 (UTC) Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 882BEC7BF64; Sat, 9 Apr 2016 18:31:25 +0000 (UTC) Date: Sat, 9 Apr 2016 18:31:24 +0000 (UTC) From: "Bjoern A. Zeeb" To: John Baldwin cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297742 - head/sys/netinet In-Reply-To: <5630207.6cr5Ycyqbh@ralph.baldwin.cx> Message-ID: References: <201604091205.u39C5Oks041429@repo.freebsd.org> <5630207.6cr5Ycyqbh@ralph.baldwin.cx> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 18:31:39 -0000 On Sat, 9 Apr 2016, John Baldwin wrote: > On Saturday, April 09, 2016 12:05:24 PM Bjoern A. Zeeb wrote: >> Author: bz >> Date: Sat Apr 9 12:05:23 2016 >> New Revision: 297742 >> URL: https://svnweb.freebsd.org/changeset/base/297742 >> >> Log: >> Mfp: r296310,r296343 >> >> It looks like as with the safety belt of DELAY() fastened (*) we can >> completely tear down and free all memory for TCP (after r281599). >> >> (*) in theory a few ticks should be good enough to make sure the timers >> are all really gone. Could we use a better matric here and check a >> tcbcb count as an optimization? > > In theory, no amount of DELAY() is ever enough to close a theoretical race > window. In practice you might get lucky, but you might also panic and Yes I do understand. Thus saying a better metric should do the right thing. I am aware of the consequences of removing type stability. Should there be reports I'll make sure that DELAY becomes something more proper sooner than later. > trash user data. In the rest of the tree, we tend to prefer marking items > as NOFREE instead of this approach putting a priority on stability and > reliability over memory efficiency. > > For all of the zones that you removed NOFREE from, do you know why that was > added in the first place (e.g. which stale pointers to pcbs could be > referenced after free)? Did you verify that those conditions have been > fixed? I did check. I did check a few years ago (and I think you had reviewed that; maybe it was trouble). And the TCP bits here were the last ones that were problematic back then. With the changes from r281599 this should no longer be a problem. As for the others, a few years ago Andre already removed the NOFREE and we unconditionally made him back the change out, which was a mistake as otherwise some of these zones would have been "clean" for years. Others have had KASSERTs ensuring that on VNET stack they were actually empty. From owner-svn-src-all@freebsd.org Sat Apr 9 18:39:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3D8BB08324; Sat, 9 Apr 2016 18:39:58 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9126F195D; Sat, 9 Apr 2016 18:39:58 +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 u39Idv7w065719; Sat, 9 Apr 2016 18:39:57 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39Idvee065718; Sat, 9 Apr 2016 18:39:57 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604091839.u39Idvee065718@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 9 Apr 2016 18:39:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297756 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 18:39:58 -0000 Author: mav Date: Sat Apr 9 18:39:57 2016 New Revision: 297756 URL: https://svnweb.freebsd.org/changeset/base/297756 Log: Add couple new constants from SPC5r08. Modified: head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Sat Apr 9 18:09:10 2016 (r297755) +++ head/sys/cam/scsi/scsi_all.h Sat Apr 9 18:39:57 2016 (r297756) @@ -2291,6 +2291,8 @@ struct scsi_vpd_id_descriptor #define SVPD_ID_TYPE_LUNGRP 0x06 #define SVPD_ID_TYPE_MD5_LUN_ID 0x07 #define SVPD_ID_TYPE_SCSI_NAME 0x08 +#define SVPD_ID_TYPE_PROTO 0x09 +#define SVPD_ID_TYPE_UUID 0x0a #define SVPD_ID_TYPE_MASK 0x0f u_int8_t reserved; u_int8_t length; From owner-svn-src-all@freebsd.org Sat Apr 9 18:52:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4435AB08751; Sat, 9 Apr 2016 18:52:11 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id 11D541119; Sat, 9 Apr 2016 18:52:10 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39IqApb069587; Sat, 9 Apr 2016 18:52:10 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39IqAem069585; Sat, 9 Apr 2016 18:52:10 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604091852.u39IqAem069585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 9 Apr 2016 18:52:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297757 - head/lib/libedit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 18:52:11 -0000 Author: pfg Date: Sat Apr 9 18:52:09 2016 New Revision: 297757 URL: https://svnweb.freebsd.org/changeset/base/297757 Log: libedit: replace 0 with NULL for pointers. Found with devel/coccinelle. Reviewed by: Christos Zoulas Modified: head/lib/libedit/filecomplete.c head/lib/libedit/vi.c Modified: head/lib/libedit/filecomplete.c ============================================================================== --- head/lib/libedit/filecomplete.c Sat Apr 9 18:39:57 2016 (r297756) +++ head/lib/libedit/filecomplete.c Sat Apr 9 18:52:09 2016 (r297757) @@ -471,7 +471,7 @@ fn_complete(EditLine *el, /* these can be used by function called in completion_matches() */ /* or (*attempted_completion_function)() */ - if (point != 0) + if (point != NULL) *point = (int)(li->cursor - li->buffer); if (end != NULL) *end = (int)(li->lastchar - li->buffer); @@ -483,7 +483,7 @@ fn_complete(EditLine *el, &el->el_scratch), cur_off - (int)len, cur_off); } else - matches = 0; + matches = NULL; if (!attempted_completion_function || (over != NULL && !*over && !matches)) matches = completion_matches( Modified: head/lib/libedit/vi.c ============================================================================== --- head/lib/libedit/vi.c Sat Apr 9 18:39:57 2016 (r297756) +++ head/lib/libedit/vi.c Sat Apr 9 18:52:09 2016 (r297757) @@ -1088,7 +1088,7 @@ vi_history_word(EditLine *el, Int c __at if (wp == NULL) return CC_ERROR; - wep = wsp = 0; + wep = wsp = NULL; do { while (Isspace(*wp)) wp++; @@ -1101,7 +1101,7 @@ vi_history_word(EditLine *el, Int c __at } while ((!el->el_state.doingarg || --el->el_state.argument > 0) && *wp != 0); - if (wsp == 0 || (el->el_state.doingarg && el->el_state.argument != 0)) + if (wsp == NULL || (el->el_state.doingarg && el->el_state.argument != 0)) return CC_ERROR; cv_undo(el); From owner-svn-src-all@freebsd.org Sat Apr 9 19:09:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A1CFB08CD8; Sat, 9 Apr 2016 19:09:08 +0000 (UTC) (envelope-from ian@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 mx1.freebsd.org (Postfix) with ESMTPS id EFE121679; Sat, 9 Apr 2016 19:09:07 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39J97CO074739; Sat, 9 Apr 2016 19:09:07 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39J97NG074738; Sat, 9 Apr 2016 19:09:07 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201604091909.u39J97NG074738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 9 Apr 2016 19:09:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297758 - head/sys/boot/arm/uboot X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 19:09:08 -0000 Author: ian Date: Sat Apr 9 19:09:06 2016 New Revision: 297758 URL: https://svnweb.freebsd.org/changeset/base/297758 Log: Align the start of the text segment to an 8-byte boundary. This fixes alignment aborts in ubldr.bin for RPi that started happening with clang 3.8 (earlier clang apparently didn't generate strd instructions that trigger the alignment fault). The abort happened in ubldr.bin and not ubldr (elf version) because the elf headers are 0xf4 bytes long, and stripping them off left everything 4-byte aligned. While here, also stop aligning the data segment to a page boundary, align it to 8 bytes instead (aligning to a page just needlessly makes the file bigger); pointed out by andrew@. Modified: head/sys/boot/arm/uboot/ldscript.arm Modified: head/sys/boot/arm/uboot/ldscript.arm ============================================================================== --- head/sys/boot/arm/uboot/ldscript.arm Sat Apr 9 18:52:09 2016 (r297757) +++ head/sys/boot/arm/uboot/ldscript.arm Sat Apr 9 19:09:06 2016 (r297758) @@ -6,6 +6,7 @@ SECTIONS { /* Read-only sections, merged into text segment: */ . = UBLDR_LOADADDR + SIZEOF_HEADERS; + . = ALIGN(8); .text : { *(.text) @@ -47,8 +48,8 @@ SECTIONS .rodata1 : { *(.rodata1) } .sdata2 : { *(.sdata2) } .sbss2 : { *(.sbss2) } - /* Adjust the address for the data segment to the next page up. */ - . = ((. + 0x1000) & ~(0x1000 - 1)); + /* Adjust the address for the data segment to the doubleword boundary. */ + . = ALIGN(8); .data : { *(.data) From owner-svn-src-all@freebsd.org Sat Apr 9 19:29:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84DB3B09360; Sat, 9 Apr 2016 19:29:40 +0000 (UTC) (envelope-from jilles@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 mx1.freebsd.org (Postfix) with ESMTPS id 47FDA115B; Sat, 9 Apr 2016 19:29:40 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39JTdeO080920; Sat, 9 Apr 2016 19:29:39 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39JTdav080919; Sat, 9 Apr 2016 19:29:39 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201604091929.u39JTdav080919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 9 Apr 2016 19:29:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297759 - stable/10/lib/libc/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 19:29:40 -0000 Author: jilles Date: Sat Apr 9 19:29:39 2016 New Revision: 297759 URL: https://svnweb.freebsd.org/changeset/base/297759 Log: MFC r287753: setuid(2): Suggest O_CLOEXEC instead of fcntl(F_SETFD). Modified: stable/10/lib/libc/sys/setuid.2 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/setuid.2 ============================================================================== --- stable/10/lib/libc/sys/setuid.2 Sat Apr 9 19:09:06 2016 (r297758) +++ stable/10/lib/libc/sys/setuid.2 Sat Apr 9 19:29:39 2016 (r297759) @@ -28,7 +28,7 @@ .\" @(#)setuid.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd September 13, 2015 .Dt SETUID 2 .Os .Sh NAME @@ -178,15 +178,10 @@ pseudocode(void) int fd; /* ... */ - fd = open("/path/to/sensitive/data", O_RDWR); + fd = open("/path/to/sensitive/data", O_RDWR | O_CLOEXEC); if (fd == -1) err(1, "open"); - /* - * Set close-on-exec flag; see fcntl(2) for more information. - */ - if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) - err(1, "fcntl(F_SETFD)"); /* ... */ execve(path, argv, environ); } From owner-svn-src-all@freebsd.org Sat Apr 9 19:49:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE4A6B09934; Sat, 9 Apr 2016 19:49:41 +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 mx1.freebsd.org (Postfix) with ESMTPS id 8DD2C1A03; Sat, 9 Apr 2016 19:49:41 +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 u39Jneeu086848; Sat, 9 Apr 2016 19:49:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39JneJn086847; Sat, 9 Apr 2016 19:49:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604091949.u39JneJn086847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 9 Apr 2016 19:49:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r297760 - vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zdb vendor/illumos/dist/cmd/zpool vendor/illumos/dist/lib/libzfs/common X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 19:49:41 -0000 Author: mav Date: Sat Apr 9 19:49:40 2016 New Revision: 297760 URL: https://svnweb.freebsd.org/changeset/base/297760 Log: 6418 zpool should have a label clearing command Reviewed by: Yuri Pankov Reviewed by: Matthew Ahrens Reviewed by: George Wilson Author: Will Andrews Closes #83 Closes #32 Modified: vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/cmd/zpool/zpool_vdev.c vendor/illumos/dist/lib/libzfs/common/libzfs.h vendor/illumos/dist/lib/libzfs/common/libzfs_import.c vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Modified: vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Sat Apr 9 19:29:39 2016 (r297759) +++ vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Sat Apr 9 19:49:40 2016 (r297760) @@ -767,6 +767,10 @@ typedef struct ddt_histogram { #define ZVOL_DRIVER "zvol" #define ZFS_DRIVER "zfs" #define ZFS_DEV "/dev/zfs" +#define ZFS_DISK_ROOT "/dev/dsk" +#define ZFS_DISK_ROOTD ZFS_DISK_ROOT "/" +#define ZFS_RDISK_ROOT "/dev/rdsk" +#define ZFS_RDISK_ROOTD ZFS_RDISK_ROOT "/" /* general zvol path */ #define ZVOL_DIR "/dev/zvol" From owner-svn-src-all@freebsd.org Sat Apr 9 19:49:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62062B09938; Sat, 9 Apr 2016 19:49:42 +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 mx1.freebsd.org (Postfix) with ESMTPS id 2D3691A04; Sat, 9 Apr 2016 19:49:42 +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 u39Jnfln086860; Sat, 9 Apr 2016 19:49:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39Jnek0086854; Sat, 9 Apr 2016 19:49:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604091949.u39Jnek0086854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 9 Apr 2016 19:49:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r297760 - vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zdb vendor/illumos/dist/cmd/zpool vendor/illumos/dist/lib/libzfs/common X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 19:49:42 -0000 Author: mav Date: Sat Apr 9 19:49:40 2016 New Revision: 297760 URL: https://svnweb.freebsd.org/changeset/base/297760 Log: 6418 zpool should have a label clearing command Reviewed by: Yuri Pankov Reviewed by: Matthew Ahrens Reviewed by: George Wilson Author: Will Andrews Closes #83 Closes #32 Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/cmd/zpool/zpool_vdev.c vendor/illumos/dist/lib/libzfs/common/libzfs.h vendor/illumos/dist/lib/libzfs/common/libzfs_import.c vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Modified: vendor/illumos/dist/cmd/zdb/zdb.c ============================================================================== --- vendor/illumos/dist/cmd/zdb/zdb.c Sat Apr 9 19:29:39 2016 (r297759) +++ vendor/illumos/dist/cmd/zdb/zdb.c Sat Apr 9 19:49:40 2016 (r297760) @@ -2131,10 +2131,11 @@ dump_label(const char *dev) uint64_t psize, ashift; int len = strlen(dev) + 1; - if (strncmp(dev, "/dev/dsk/", 9) == 0) { + if (strncmp(dev, ZFS_DISK_ROOTD, strlen(ZFS_DISK_ROOTD)) == 0) { len++; path = malloc(len); - (void) snprintf(path, len, "%s%s", "/dev/rdsk/", dev + 9); + (void) snprintf(path, len, "%s%s", ZFS_RDISK_ROOTD, + dev + strlen(ZFS_DISK_ROOTD)); } else { path = strdup(dev); } Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c ============================================================================== --- vendor/illumos/dist/cmd/zpool/zpool_main.c Sat Apr 9 19:29:39 2016 (r297759) +++ vendor/illumos/dist/cmd/zpool/zpool_main.c Sat Apr 9 19:49:40 2016 (r297760) @@ -21,11 +21,11 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2012 by Frederik Wessels. All rights reserved. * Copyright (c) 2013 by Prasad Joshi (sTec). All rights reserved. * Copyright 2016 Igor Kozhukhov . + * Copyright 2016 Nexenta Systems, Inc. */ #include @@ -62,6 +62,7 @@ static int zpool_do_destroy(int, char ** static int zpool_do_add(int, char **); static int zpool_do_remove(int, char **); +static int zpool_do_labelclear(int, char **); static int zpool_do_list(int, char **); static int zpool_do_iostat(int, char **); @@ -121,6 +122,7 @@ typedef enum { HELP_HISTORY, HELP_IMPORT, HELP_IOSTAT, + HELP_LABELCLEAR, HELP_LIST, HELP_OFFLINE, HELP_ONLINE, @@ -159,6 +161,8 @@ static zpool_command_t command_table[] = { "add", zpool_do_add, HELP_ADD }, { "remove", zpool_do_remove, HELP_REMOVE }, { NULL }, + { "labelclear", zpool_do_labelclear, HELP_LABELCLEAR }, + { NULL }, { "list", zpool_do_list, HELP_LIST }, { "iostat", zpool_do_iostat, HELP_IOSTAT }, { "status", zpool_do_status, HELP_STATUS }, @@ -228,6 +232,8 @@ get_usage(zpool_help_t idx) case HELP_IOSTAT: return (gettext("\tiostat [-v] [-T d|u] [pool] ... [interval " "[count]]\n")); + case HELP_LABELCLEAR: + return (gettext("\tlabelclear [-f] \n")); case HELP_LIST: return (gettext("\tlist [-Hp] [-o property[,...]] " "[-T d|u] [pool] ... [interval [count]]\n")); @@ -618,6 +624,149 @@ zpool_do_remove(int argc, char **argv) } /* + * zpool labelclear [-f] + * + * -f Force clearing the label for the vdevs which are members of + * the exported or foreign pools. + * + * Verifies that the vdev is not active and zeros out the label information + * on the device. + */ +int +zpool_do_labelclear(int argc, char **argv) +{ + char vdev[MAXPATHLEN]; + char *name = NULL; + struct stat st; + int c, fd, ret = 0; + nvlist_t *config; + pool_state_t state; + boolean_t inuse = B_FALSE; + boolean_t force = B_FALSE; + + /* check options */ + while ((c = getopt(argc, argv, "f")) != -1) { + switch (c) { + case 'f': + force = B_TRUE; + break; + default: + (void) fprintf(stderr, gettext("invalid option '%c'\n"), + optopt); + usage(B_FALSE); + } + } + + argc -= optind; + argv += optind; + + /* get vdev name */ + if (argc < 1) { + (void) fprintf(stderr, gettext("missing vdev name\n")); + usage(B_FALSE); + } + if (argc > 1) { + (void) fprintf(stderr, gettext("too many arguments\n")); + usage(B_FALSE); + } + + /* + * Check if we were given absolute path and use it as is. + * Otherwise if the provided vdev name doesn't point to a file, + * try prepending dsk path and appending s0. + */ + (void) strlcpy(vdev, argv[0], sizeof (vdev)); + if (vdev[0] != '/' && stat(vdev, &st) != 0) { + char *s; + + (void) snprintf(vdev, sizeof (vdev), "%s/%s", + ZFS_DISK_ROOT, argv[0]); + if ((s = strrchr(argv[0], 's')) == NULL || + !isdigit(*(s + 1))) + (void) strlcat(vdev, "s0", sizeof (vdev)); + if (stat(vdev, &st) != 0) { + (void) fprintf(stderr, gettext( + "failed to find device %s, try specifying absolute " + "path instead\n"), argv[0]); + return (1); + } + } + + if ((fd = open(vdev, O_RDWR)) < 0) { + (void) fprintf(stderr, gettext("failed to open %s: %s\n"), + vdev, strerror(errno)); + return (1); + } + + if (zpool_read_label(fd, &config) != 0 || config == NULL) { + (void) fprintf(stderr, + gettext("failed to read label from %s\n"), vdev); + return (1); + } + nvlist_free(config); + + ret = zpool_in_use(g_zfs, fd, &state, &name, &inuse); + if (ret != 0) { + (void) fprintf(stderr, + gettext("failed to check state for %s\n"), vdev); + return (1); + } + + if (!inuse) + goto wipe_label; + + switch (state) { + default: + case POOL_STATE_ACTIVE: + case POOL_STATE_SPARE: + case POOL_STATE_L2CACHE: + (void) fprintf(stderr, gettext( + "%s is a member (%s) of pool \"%s\"\n"), + vdev, zpool_pool_state_to_name(state), name); + ret = 1; + goto errout; + + case POOL_STATE_EXPORTED: + if (force) + break; + (void) fprintf(stderr, gettext( + "use '-f' to override the following error:\n" + "%s is a member of exported pool \"%s\"\n"), + vdev, name); + ret = 1; + goto errout; + + case POOL_STATE_POTENTIALLY_ACTIVE: + if (force) + break; + (void) fprintf(stderr, gettext( + "use '-f' to override the following error:\n" + "%s is a member of potentially active pool \"%s\"\n"), + vdev, name); + ret = 1; + goto errout; + + case POOL_STATE_DESTROYED: + /* inuse should never be set for a destroyed pool */ + assert(0); + break; + } + +wipe_label: + ret = zpool_clear_label(fd); + if (ret != 0) { + (void) fprintf(stderr, + gettext("failed to clear label for %s\n"), vdev); + } + +errout: + free(name); + (void) close(fd); + + return (ret); +} + +/* * zpool create [-fnd] [-o property=value] ... * [-O file-system-property=value] ... * [-R root] [-m mountpoint] ... @@ -1179,7 +1328,7 @@ print_status_config(zpool_handle_t *zhp, char *vname; uint64_t notpresent; spare_cbdata_t cb; - char *state; + const char *state; if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, &child, &children) != 0) @@ -1945,7 +2094,7 @@ zpool_do_import(int argc, char **argv) if (searchdirs == NULL) { searchdirs = safe_malloc(sizeof (char *)); - searchdirs[0] = "/dev/dsk"; + searchdirs[0] = ZFS_DISK_ROOT; nsearch = 1; } Modified: vendor/illumos/dist/cmd/zpool/zpool_vdev.c ============================================================================== --- vendor/illumos/dist/cmd/zpool/zpool_vdev.c Sat Apr 9 19:29:39 2016 (r297759) +++ vendor/illumos/dist/cmd/zpool/zpool_vdev.c Sat Apr 9 19:49:40 2016 (r297760) @@ -79,8 +79,6 @@ #include "zpool_util.h" -#define DISK_ROOT "/dev/dsk" -#define RDISK_ROOT "/dev/rdsk" #define BACKUP_SLICE "s2" /* @@ -367,7 +365,7 @@ is_whole_disk(const char *arg) char path[MAXPATHLEN]; (void) snprintf(path, sizeof (path), "%s%s%s", - RDISK_ROOT, strrchr(arg, '/'), BACKUP_SLICE); + ZFS_RDISK_ROOT, strrchr(arg, '/'), BACKUP_SLICE); if ((fd = open(path, O_RDWR | O_NDELAY)) < 0) return (B_FALSE); if (efi_alloc_and_init(fd, EFI_NUMPAR, &label) != 0) { @@ -423,7 +421,7 @@ make_leaf_vdev(const char *arg, uint64_t * /dev/dsk/. As part of this check, see if we've been given a * an entire disk (minus the slice number). */ - (void) snprintf(path, sizeof (path), "%s/%s", DISK_ROOT, + (void) snprintf(path, sizeof (path), "%s/%s", ZFS_DISK_ROOT, arg); wholedisk = is_whole_disk(path); if (!wholedisk && (stat64(path, &statbuf) != 0)) { @@ -437,7 +435,7 @@ make_leaf_vdev(const char *arg, uint64_t if (errno == ENOENT) { (void) fprintf(stderr, gettext("cannot open '%s': no such " - "device in %s\n"), arg, DISK_ROOT); + "device in %s\n"), arg, ZFS_DISK_ROOT); (void) fprintf(stderr, gettext("must be a full path or " "shorthand device name\n")); Modified: vendor/illumos/dist/lib/libzfs/common/libzfs.h ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs.h Sat Apr 9 19:29:39 2016 (r297759) +++ vendor/illumos/dist/lib/libzfs/common/libzfs.h Sat Apr 9 19:49:40 2016 (r297760) @@ -210,7 +210,8 @@ extern zpool_handle_t *zpool_open_canfai extern void zpool_close(zpool_handle_t *); extern const char *zpool_get_name(zpool_handle_t *); extern int zpool_get_state(zpool_handle_t *); -extern char *zpool_state_to_name(vdev_state_t, vdev_aux_t); +extern const char *zpool_state_to_name(vdev_state_t, vdev_aux_t); +extern const char *zpool_pool_state_to_name(pool_state_t); extern void zpool_free_handles(libzfs_handle_t *); /* @@ -261,7 +262,7 @@ extern nvlist_t *zpool_find_vdev(zpool_h boolean_t *, boolean_t *); extern nvlist_t *zpool_find_vdev_by_physpath(zpool_handle_t *, const char *, boolean_t *, boolean_t *, boolean_t *); -extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, char *); +extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, const char *); /* * Functions to manage pool properties Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_import.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_import.c Sat Apr 9 19:29:39 2016 (r297759) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_import.c Sat Apr 9 19:49:40 2016 (r297760) @@ -20,10 +20,10 @@ */ /* - * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright 2015 RackTop Systems. + * Copyright 2016 Nexenta Systems, Inc. */ /* @@ -1084,9 +1084,7 @@ zpool_open_func(void *arg) } /* - * Given a file descriptor, clear (zero) the label information. This function - * is currently only used in the appliance stack as part of the ZFS sysevent - * module. + * Given a file descriptor, clear (zero) the label information. */ int zpool_clear_label(int fd) @@ -1131,7 +1129,7 @@ zpool_find_import_impl(libzfs_handle_t * char *end, **dir = iarg->path; size_t pathleft; nvlist_t *ret = NULL; - static char *default_dir = "/dev/dsk"; + static char *default_dir = ZFS_DISK_ROOT; pool_list_t pools = { 0 }; pool_entry_t *pe, *penext; vdev_entry_t *ve, *venext; @@ -1153,7 +1151,7 @@ zpool_find_import_impl(libzfs_handle_t * */ for (i = 0; i < dirs; i++) { tpool_t *t; - char *rdsk; + char rdsk[MAXPATHLEN]; int dfd; boolean_t config_failed = B_FALSE; DIR *dirp; @@ -1174,10 +1172,10 @@ zpool_find_import_impl(libzfs_handle_t * * reading the labels skips a bunch of slow operations during * close(2) processing, so we replace /dev/dsk with /dev/rdsk. */ - if (strcmp(path, "/dev/dsk/") == 0) - rdsk = "/dev/rdsk/"; + if (strcmp(path, ZFS_DISK_ROOTD) == 0) + (void) strlcpy(rdsk, ZFS_RDISK_ROOTD, sizeof (rdsk)); else - rdsk = path; + (void) strlcpy(rdsk, path, sizeof (rdsk)); if ((dfd = open64(rdsk, O_RDONLY)) < 0 || (dirp = fdopendir(dfd)) == NULL) { Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Sat Apr 9 19:29:39 2016 (r297759) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Sat Apr 9 19:49:40 2016 (r297760) @@ -20,10 +20,10 @@ */ /* - * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright 2016 Nexenta Systems, Inc. */ #include @@ -49,8 +49,6 @@ static int read_efi_label(nvlist_t *config, diskaddr_t *sb); -#define DISK_ROOT "/dev/dsk" -#define RDISK_ROOT "/dev/rdsk" #define BACKUP_SLICE "s2" typedef struct prop_flags { @@ -179,7 +177,7 @@ zpool_get_prop_int(zpool_handle_t *zhp, /* * Map VDEV STATE to printed strings. */ -char * +const char * zpool_state_to_name(vdev_state_t state, vdev_aux_t aux) { switch (state) { @@ -207,6 +205,34 @@ zpool_state_to_name(vdev_state_t state, } /* + * Map POOL STATE to printed strings. + */ +const char * +zpool_pool_state_to_name(pool_state_t state) +{ + switch (state) { + case POOL_STATE_ACTIVE: + return (gettext("ACTIVE")); + case POOL_STATE_EXPORTED: + return (gettext("EXPORTED")); + case POOL_STATE_DESTROYED: + return (gettext("DESTROYED")); + case POOL_STATE_SPARE: + return (gettext("SPARE")); + case POOL_STATE_L2CACHE: + return (gettext("L2CACHE")); + case POOL_STATE_UNINITIALIZED: + return (gettext("UNINITIALIZED")); + case POOL_STATE_UNAVAIL: + return (gettext("UNAVAIL")); + case POOL_STATE_POTENTIALLY_ACTIVE: + return (gettext("POTENTIALLY_ACTIVE")); + } + + return (gettext("UNKNOWN")); +} + +/* * Get a zpool property value for 'prop' and return the value in * a pre-allocated buffer. */ @@ -2127,7 +2153,8 @@ zpool_find_vdev(zpool_handle_t *zhp, con } else if (zpool_vdev_is_interior(path)) { verify(nvlist_add_string(search, ZPOOL_CONFIG_TYPE, path) == 0); } else if (path[0] != '/') { - (void) snprintf(buf, sizeof (buf), "%s%s", "/dev/dsk/", path); + (void) snprintf(buf, sizeof (buf), "%s/%s", ZFS_DISK_ROOT, + path); verify(nvlist_add_string(search, ZPOOL_CONFIG_PATH, buf) == 0); } else { verify(nvlist_add_string(search, ZPOOL_CONFIG_PATH, path) == 0); @@ -2309,7 +2336,7 @@ zpool_relabel_disk(libzfs_handle_t *hdl, "efi_use_whole_disk")) == NULL) return (-1); - (void) snprintf(path, sizeof (path), "%s/%s", RDISK_ROOT, name); + (void) snprintf(path, sizeof (path), "%s/%s", ZFS_RDISK_ROOT, name); if ((fd = open(path, O_RDWR | O_NDELAY)) < 0) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "cannot " @@ -2384,7 +2411,7 @@ zpool_vdev_online(zpool_handle_t *zhp, c } if (wholedisk) { - pathname += strlen(DISK_ROOT) + 1; + pathname += strlen(ZFS_DISK_ROOT) + 1; (void) zpool_relabel_disk(hdl, pathname); } } @@ -3350,8 +3377,8 @@ zpool_vdev_name(libzfs_handle_t *hdl, zp devid_str_free(newdevid); } - if (strncmp(path, "/dev/dsk/", 9) == 0) - path += 9; + if (strncmp(path, ZFS_DISK_ROOTD, strlen(ZFS_DISK_ROOTD)) == 0) + path += strlen(ZFS_DISK_ROOTD); if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK, &value) == 0 && value) { @@ -3773,7 +3800,7 @@ read_efi_label(nvlist_t *config, diskadd if (nvlist_lookup_string(config, ZPOOL_CONFIG_PATH, &path) != 0) return (err); - (void) snprintf(diskname, sizeof (diskname), "%s%s", RDISK_ROOT, + (void) snprintf(diskname, sizeof (diskname), "%s%s", ZFS_RDISK_ROOT, strrchr(path, '/')); if ((fd = open(diskname, O_RDONLY|O_NDELAY)) >= 0) { struct dk_gpt *vtoc; @@ -3826,7 +3853,7 @@ find_start_block(nvlist_t *config) * stripped of any leading /dev path. */ int -zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, char *name) +zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name) { char path[MAXPATHLEN]; struct dk_gpt *vtoc; @@ -3856,7 +3883,7 @@ zpool_label_disk(libzfs_handle_t *hdl, z start_block = NEW_START_BLOCK; } - (void) snprintf(path, sizeof (path), "%s/%s%s", RDISK_ROOT, name, + (void) snprintf(path, sizeof (path), "%s/%s%s", ZFS_RDISK_ROOT, name, BACKUP_SLICE); if ((fd = open(path, O_RDWR | O_NDELAY)) < 0) { From owner-svn-src-all@freebsd.org Sat Apr 9 20:05:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15AD8B09D5E; Sat, 9 Apr 2016 20:05:41 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id CDDFE1316; Sat, 9 Apr 2016 20:05:40 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39K5eBN092931; Sat, 9 Apr 2016 20:05:40 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39K5dBr092929; Sat, 9 Apr 2016 20:05:39 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604092005.u39K5dBr092929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 9 Apr 2016 20:05:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297761 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 20:05:41 -0000 Author: pfg Date: Sat Apr 9 20:05:39 2016 New Revision: 297761 URL: https://svnweb.freebsd.org/changeset/base/297761 Log: sh(1): replace 0 with NULL for pointers. Found with devel/coccinelle. Reviewed by: jilles Modified: head/bin/sh/miscbltin.c head/bin/sh/parser.c Modified: head/bin/sh/miscbltin.c ============================================================================== --- head/bin/sh/miscbltin.c Sat Apr 9 19:49:40 2016 (r297760) +++ head/bin/sh/miscbltin.c Sat Apr 9 20:05:39 2016 (r297761) @@ -341,7 +341,7 @@ umaskcmd(int argc __unused, char **argv } else { void *set; INTOFF; - if ((set = setmode (ap)) == 0) + if ((set = setmode (ap)) == NULL) error("Illegal number: %s", ap); mask = getmode (set, ~mask & 0777); Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Sat Apr 9 19:49:40 2016 (r297760) +++ head/bin/sh/parser.c Sat Apr 9 20:05:39 2016 (r297761) @@ -628,7 +628,7 @@ simplecmd(union node **rpp, union node * /* If we don't have any redirections already, then we must reset */ /* rpp to be the address of the local redir variable. */ - if (redir == 0) + if (redir == NULL) rpp = &redir; args = NULL; From owner-svn-src-all@freebsd.org Sat Apr 9 20:18:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0008B091A2; Sat, 9 Apr 2016 20:18:35 +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 mx1.freebsd.org (Postfix) with ESMTPS id B71A61ABC; Sat, 9 Apr 2016 20:18:35 +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 u39KIYhm096160; Sat, 9 Apr 2016 20:18:34 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39KIYf3096159; Sat, 9 Apr 2016 20:18:34 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201604092018.u39KIYf3096159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 9 Apr 2016 20:18:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297762 - head/sys/dev/ichiic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 20:18:36 -0000 Author: jhb Date: Sat Apr 9 20:18:34 2016 New Revision: 297762 URL: https://svnweb.freebsd.org/changeset/base/297762 Log: Use DELAY() instead of sleeping during boot-time attach. Tested by: Wolfgang Zenker Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sat Apr 9 20:05:39 2016 (r297761) +++ head/sys/dev/ichiic/ig4_iic.c Sat Apr 9 20:18:34 2016 (r297762) @@ -117,7 +117,10 @@ set_controller(ig4iic_softc_t *sc, uint3 error = 0; break; } - mtx_sleep(sc, &sc->io_lock, 0, "i2cslv", 1); + if (cold) + DELAY(1000); + else + mtx_sleep(sc, &sc->io_lock, 0, "i2cslv", 1); } return (error); } From owner-svn-src-all@freebsd.org Sat Apr 9 20:30:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D9E2B09479; Sat, 9 Apr 2016 20:30:52 +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 mx1.freebsd.org (Postfix) with ESMTPS id 2834F102D; Sat, 9 Apr 2016 20:30:52 +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 u39KUpIL099238; Sat, 9 Apr 2016 20:30:51 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39KUocn099232; Sat, 9 Apr 2016 20:30:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201604092030.u39KUocn099232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 9 Apr 2016 20:30:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297763 - in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/sys/fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 20:30:52 -0000 Author: mav Date: Sat Apr 9 20:30:50 2016 New Revision: 297763 URL: https://svnweb.freebsd.org/changeset/base/297763 Log: MFV r297760: 6418 zpool should have a label clearing command Reviewed by: Yuri Pankov Reviewed by: Matthew Ahrens Reviewed by: George Wilson Author: Will Andrews Closes #83 Closes #32 openzfs/openzfs@9663688425131744221ea99f9e66b9ed964492ae FreeBSD already had `zpool labelclear` functionality, so this is mostly just a diff reduction. MFC after: 1 month Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sat Apr 9 20:18:34 2016 (r297762) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sat Apr 9 20:30:50 2016 (r297763) @@ -2156,10 +2156,11 @@ dump_label(const char *dev) uint64_t psize, ashift; int len = strlen(dev) + 1; - if (strncmp(dev, "/dev/dsk/", 9) == 0) { + if (strncmp(dev, ZFS_DISK_ROOTD, strlen(ZFS_DISK_ROOTD)) == 0) { len++; path = malloc(len); - (void) snprintf(path, len, "%s%s", "/dev/rdsk/", dev + 9); + (void) snprintf(path, len, "%s%s", ZFS_RDISK_ROOTD, + dev + strlen(ZFS_DISK_ROOTD)); } else { path = strdup(dev); } Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sat Apr 9 20:18:34 2016 (r297762) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sat Apr 9 20:30:50 2016 (r297763) @@ -21,12 +21,12 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2012 by Frederik Wessels. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. * Copyright (c) 2013 by Prasad Joshi (sTec). All rights reserved. * Copyright 2016 Igor Kozhukhov . + * Copyright 2016 Nexenta Systems, Inc. */ #include @@ -626,7 +626,10 @@ zpool_do_remove(int argc, char **argv) } /* - * zpool labelclear + * zpool labelclear [-f] + * + * -f Force clearing the label for the vdevs which are members of + * the exported or foreign pools. * * Verifies that the vdev is not active and zeros out the label information * on the device. @@ -634,8 +637,11 @@ zpool_do_remove(int argc, char **argv) int zpool_do_labelclear(int argc, char **argv) { - char *vdev, *name; - int c, fd = -1, ret = 0; + char vdev[MAXPATHLEN]; + char *name = NULL; + struct stat st; + int c, fd, ret = 0; + nvlist_t *config; pool_state_t state; boolean_t inuse = B_FALSE; boolean_t force = B_FALSE; @@ -658,88 +664,110 @@ zpool_do_labelclear(int argc, char **arg /* get vdev name */ if (argc < 1) { - (void) fprintf(stderr, gettext("missing vdev device name\n")); + (void) fprintf(stderr, gettext("missing vdev name\n")); usage(B_FALSE); } + if (argc > 1) { + (void) fprintf(stderr, gettext("too many arguments\n")); + usage(B_FALSE); + } + + /* + * Check if we were given absolute path and use it as is. + * Otherwise if the provided vdev name doesn't point to a file, + * try prepending dsk path and appending s0. + */ + (void) strlcpy(vdev, argv[0], sizeof (vdev)); + if (vdev[0] != '/' && stat(vdev, &st) != 0) { + char *s; + + (void) snprintf(vdev, sizeof (vdev), "%s/%s", +#ifdef illumos + ZFS_DISK_ROOT, argv[0]); + if ((s = strrchr(argv[0], 's')) == NULL || + !isdigit(*(s + 1))) + (void) strlcat(vdev, "s0", sizeof (vdev)); +#else + "/dev", argv[0]); +#endif + if (stat(vdev, &st) != 0) { + (void) fprintf(stderr, gettext( + "failed to find device %s, try specifying absolute " + "path instead\n"), argv[0]); + return (1); + } + } - vdev = argv[0]; if ((fd = open(vdev, O_RDWR)) < 0) { - (void) fprintf(stderr, gettext("Unable to open %s\n"), vdev); - return (B_FALSE); + (void) fprintf(stderr, gettext("failed to open %s: %s\n"), + vdev, strerror(errno)); + return (1); } - name = NULL; - if (zpool_in_use(g_zfs, fd, &state, &name, &inuse) != 0) { - if (force) - goto wipe_label; - + if (zpool_read_label(fd, &config) != 0 || config == NULL) { (void) fprintf(stderr, - gettext("Unable to determine pool state for %s\n" - "Use -f to force the clearing any label data\n"), vdev); - + gettext("failed to read label from %s\n"), vdev); return (1); } + nvlist_free(config); - if (inuse) { - switch (state) { - default: - case POOL_STATE_ACTIVE: - case POOL_STATE_SPARE: - case POOL_STATE_L2CACHE: - (void) fprintf(stderr, -gettext("labelclear operation failed.\n" - "\tVdev %s is a member (%s), of pool \"%s\".\n" - "\tTo remove label information from this device, export or destroy\n" - "\tthe pool, or remove %s from the configuration of this pool\n" - "\tand retry the labelclear operation\n"), - vdev, zpool_pool_state_to_name(state), name, vdev); - ret = 1; - goto errout; - - case POOL_STATE_EXPORTED: - if (force) - break; + ret = zpool_in_use(g_zfs, fd, &state, &name, &inuse); + if (ret != 0) { + (void) fprintf(stderr, + gettext("failed to check state for %s\n"), vdev); + return (1); + } - (void) fprintf(stderr, -gettext("labelclear operation failed.\n" - "\tVdev %s is a member of the exported pool \"%s\".\n" - "\tUse \"zpool labelclear -f %s\" to force the removal of label\n" - "\tinformation.\n"), - vdev, name, vdev); - ret = 1; - goto errout; + if (!inuse) + goto wipe_label; - case POOL_STATE_POTENTIALLY_ACTIVE: - if (force) - break; + switch (state) { + default: + case POOL_STATE_ACTIVE: + case POOL_STATE_SPARE: + case POOL_STATE_L2CACHE: + (void) fprintf(stderr, gettext( + "%s is a member (%s) of pool \"%s\"\n"), + vdev, zpool_pool_state_to_name(state), name); + ret = 1; + goto errout; - (void) fprintf(stderr, -gettext("labelclear operation failed.\n" - "\tVdev %s is a member of the pool \"%s\".\n" - "\tThis pool is unknown to this system, but may be active on\n" - "\tanother system. Use \'zpool labelclear -f %s\' to force the\n" - "\tremoval of label information.\n"), - vdev, name, vdev); - ret = 1; - goto errout; + case POOL_STATE_EXPORTED: + if (force) + break; + (void) fprintf(stderr, gettext( + "use '-f' to override the following error:\n" + "%s is a member of exported pool \"%s\"\n"), + vdev, name); + ret = 1; + goto errout; - case POOL_STATE_DESTROYED: - /* inuse should never be set for a destoryed pool... */ + case POOL_STATE_POTENTIALLY_ACTIVE: + if (force) break; - } + (void) fprintf(stderr, gettext( + "use '-f' to override the following error:\n" + "%s is a member of potentially active pool \"%s\"\n"), + vdev, name); + ret = 1; + goto errout; + + case POOL_STATE_DESTROYED: + /* inuse should never be set for a destroyed pool */ + assert(0); + break; } wipe_label: - if (zpool_clear_label(fd) != 0) { + ret = zpool_clear_label(fd); + if (ret != 0) { (void) fprintf(stderr, - gettext("Label clear failed on vdev %s\n"), vdev); - ret = 1; + gettext("failed to clear label for %s\n"), vdev); } errout: - close(fd); - if (name != NULL) - free(name); + free(name); + (void) close(fd); return (ret); } Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Sat Apr 9 20:18:34 2016 (r297762) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Sat Apr 9 20:30:50 2016 (r297763) @@ -79,8 +79,6 @@ #include "zpool_util.h" -#define DISK_ROOT "/dev/dsk" -#define RDISK_ROOT "/dev/rdsk" #define BACKUP_SLICE "s2" /* @@ -384,7 +382,7 @@ is_whole_disk(const char *arg) char path[MAXPATHLEN]; (void) snprintf(path, sizeof (path), "%s%s%s", - RDISK_ROOT, strrchr(arg, '/'), BACKUP_SLICE); + ZFS_RDISK_ROOT, strrchr(arg, '/'), BACKUP_SLICE); if ((fd = open(path, O_RDWR | O_NDELAY)) < 0) return (B_FALSE); if (efi_alloc_and_init(fd, EFI_NUMPAR, &label) != 0) { Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Sat Apr 9 20:18:34 2016 (r297762) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Sat Apr 9 20:30:50 2016 (r297763) @@ -20,10 +20,10 @@ */ /* - * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright 2015 RackTop Systems. + * Copyright 2016 Nexenta Systems, Inc. */ /* @@ -1099,9 +1099,7 @@ zpool_open_func(void *arg) } /* - * Given a file descriptor, clear (zero) the label information. This function - * is used in the appliance stack as part of the ZFS sysevent module and - * to implement the "zpool labelclear" command. + * Given a file descriptor, clear (zero) the label information. */ int zpool_clear_label(int fd) @@ -1168,7 +1166,7 @@ zpool_find_import_impl(libzfs_handle_t * */ for (i = 0; i < dirs; i++) { tpool_t *t; - char *rdsk; + char rdsk[MAXPATHLEN]; int dfd; boolean_t config_failed = B_FALSE; DIR *dirp; @@ -1184,15 +1182,17 @@ zpool_find_import_impl(libzfs_handle_t * *end = 0; pathleft = &path[sizeof (path)] - end; +#ifdef illumos /* * Using raw devices instead of block devices when we're * reading the labels skips a bunch of slow operations during * close(2) processing, so we replace /dev/dsk with /dev/rdsk. */ - if (strcmp(path, "/dev/dsk/") == 0) - rdsk = "/dev/"; + if (strcmp(path, ZFS_DISK_ROOTD) == 0) + (void) strlcpy(rdsk, ZFS_RDISK_ROOTD, sizeof (rdsk)); else - rdsk = path; +#endif + (void) strlcpy(rdsk, path, sizeof (rdsk)); if ((dfd = open64(rdsk, O_RDONLY)) < 0 || (dirp = fdopendir(dfd)) == NULL) { Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sat Apr 9 20:18:34 2016 (r297762) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sat Apr 9 20:30:50 2016 (r297763) @@ -20,10 +20,10 @@ */ /* - * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2015 by Delphix. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright 2016 Nexenta Systems, Inc. */ #include @@ -49,8 +49,6 @@ static int read_efi_label(nvlist_t *config, diskaddr_t *sb); -#define DISK_ROOT "/dev/dsk" -#define RDISK_ROOT "/dev/rdsk" #define BACKUP_SLICE "s2" typedef struct prop_flags { @@ -2345,7 +2343,7 @@ zpool_relabel_disk(libzfs_handle_t *hdl, "efi_use_whole_disk")) == NULL) return (-1); - (void) snprintf(path, sizeof (path), "%s/%s", RDISK_ROOT, name); + (void) snprintf(path, sizeof (path), "%s/%s", ZFS_RDISK_ROOT, name); if ((fd = open(path, O_RDWR | O_NDELAY)) < 0) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "cannot " @@ -2421,7 +2419,7 @@ zpool_vdev_online(zpool_handle_t *zhp, c } if (wholedisk) { - pathname += strlen(DISK_ROOT) + 1; + pathname += strlen(ZFS_DISK_ROOT) + 1; (void) zpool_relabel_disk(hdl, pathname); } } @@ -3411,8 +3409,8 @@ zpool_vdev_name(libzfs_handle_t *hdl, zp } #ifdef illumos - if (strncmp(path, "/dev/dsk/", 9) == 0) - path += 9; + if (strncmp(path, ZFS_DISK_ROOTD, strlen(ZFS_DISK_ROOTD)) == 0) + path += strlen(ZFS_DISK_ROOTD); if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK, &value) == 0 && value) { @@ -3846,7 +3844,7 @@ read_efi_label(nvlist_t *config, diskadd if (nvlist_lookup_string(config, ZPOOL_CONFIG_PATH, &path) != 0) return (err); - (void) snprintf(diskname, sizeof (diskname), "%s%s", RDISK_ROOT, + (void) snprintf(diskname, sizeof (diskname), "%s%s", ZFS_RDISK_ROOT, strrchr(path, '/')); if ((fd = open(diskname, O_RDONLY|O_NDELAY)) >= 0) { struct dk_gpt *vtoc; @@ -3931,7 +3929,7 @@ zpool_label_disk(libzfs_handle_t *hdl, z start_block = NEW_START_BLOCK; } - (void) snprintf(path, sizeof (path), "%s/%s%s", RDISK_ROOT, name, + (void) snprintf(path, sizeof (path), "%s/%s%s", ZFS_RDISK_ROOT, name, BACKUP_SLICE); if ((fd = open(path, O_RDWR | O_NDELAY)) < 0) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sat Apr 9 20:18:34 2016 (r297762) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sat Apr 9 20:30:50 2016 (r297763) @@ -785,6 +785,10 @@ typedef struct ddt_histogram { #define ZFS_DRIVER "zfs" #define ZFS_DEV_NAME "zfs" #define ZFS_DEV "/dev/" ZFS_DEV_NAME +#define ZFS_DISK_ROOT "/dev/dsk" +#define ZFS_DISK_ROOTD ZFS_DISK_ROOT "/" +#define ZFS_RDISK_ROOT "/dev/rdsk" +#define ZFS_RDISK_ROOTD ZFS_RDISK_ROOT "/" /* general zvol path */ #define ZVOL_DIR "/dev/zvol" From owner-svn-src-all@freebsd.org Sat Apr 9 20:36:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F33F8B09680; Sat, 9 Apr 2016 20:36:08 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id CA55B1396; Sat, 9 Apr 2016 20:36:08 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39Ka7ir002362; Sat, 9 Apr 2016 20:36:07 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39Ka7xL002357; Sat, 9 Apr 2016 20:36:07 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604092036.u39Ka7xL002357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 9 Apr 2016 20:36:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297764 - in head: lib/libusb lib/libusbhid sys/dev/usb sys/dev/usb/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 20:36:09 -0000 Author: pfg Date: Sat Apr 9 20:36:07 2016 New Revision: 297764 URL: https://svnweb.freebsd.org/changeset/base/297764 Log: USB: replace 0 with NULL for pointers. Found with devel/coccinelle. Reviewed by: hselasky Modified: head/lib/libusb/libusb20.c head/lib/libusbhid/descr.c head/lib/libusbhid/usage.c head/sys/dev/usb/net/if_urndis.c head/sys/dev/usb/usb_transfer.c Modified: head/lib/libusb/libusb20.c ============================================================================== --- head/lib/libusb/libusb20.c Sat Apr 9 20:30:50 2016 (r297763) +++ head/lib/libusb/libusb20.c Sat Apr 9 20:36:07 2016 (r297764) @@ -139,8 +139,8 @@ libusb20_tr_close(struct libusb20_transf free(xfer->ppBuffer); } /* reset variable fields in case the transfer is opened again */ - xfer->priv_sc0 = 0; - xfer->priv_sc1 = 0; + xfer->priv_sc0 = NULL; + xfer->priv_sc1 = NULL; xfer->is_opened = 0; xfer->is_pending = 0; xfer->is_cancel = 0; Modified: head/lib/libusbhid/descr.c ============================================================================== --- head/lib/libusbhid/descr.c Sat Apr 9 20:30:50 2016 (r297763) +++ head/lib/libusbhid/descr.c Sat Apr 9 20:36:07 2016 (r297764) @@ -159,7 +159,7 @@ hid_use_report_desc(unsigned char *data, report_desc_t r; r = malloc(sizeof(*r) + size); - if (r == 0) { + if (r == NULL) { errno = ENOMEM; return (NULL); } Modified: head/lib/libusbhid/usage.c ============================================================================== --- head/lib/libusbhid/usage.c Sat Apr 9 20:30:50 2016 (r297763) +++ head/lib/libusbhid/usage.c Sat Apr 9 20:36:07 2016 (r297764) @@ -77,9 +77,9 @@ hid_init(const char *hidname) char line[100], name[100], *p, *n; int no; int lineno; - struct usage_page *curpage = 0; + struct usage_page *curpage = NULL; - if (hidname == 0) + if (hidname == NULL) hidname = _PATH_HIDTABLE; f = fopen(hidname, "r"); @@ -124,7 +124,7 @@ hid_init(const char *hidname) curpage->pagesize++; } else { if (npages >= npagesmax) { - if (pages == 0) { + if (pages == NULL) { npagesmax = 5; pages = malloc(npagesmax * sizeof (struct usage_page)); Modified: head/sys/dev/usb/net/if_urndis.c ============================================================================== --- head/sys/dev/usb/net/if_urndis.c Sat Apr 9 20:30:50 2016 (r297763) +++ head/sys/dev/usb/net/if_urndis.c Sat Apr 9 20:36:07 2016 (r297764) @@ -235,7 +235,7 @@ urndis_attach(device_t dev) cmd = usbd_find_descriptor(uaa->device, NULL, uaa->info.bIfaceIndex, UDESC_CS_INTERFACE, 0xFF, UDESCSUB_CDC_CM, 0xFF); - if (cmd != 0) { + if (cmd != NULL) { DPRINTF("Call Mode Descriptor found, dataif=%d\n", cmd->bDataInterface); iface_index[0] = cmd->bDataInterface; } Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Sat Apr 9 20:30:50 2016 (r297763) +++ head/sys/dev/usb/usb_transfer.c Sat Apr 9 20:36:07 2016 (r297764) @@ -925,7 +925,7 @@ usbd_transfer_setup(struct usb_device *u DPRINTFN(6, "setup array has zero length!\n"); return (USB_ERR_INVAL); } - if (ifaces == 0) { + if (ifaces == NULL) { DPRINTFN(6, "ifaces array is NULL!\n"); return (USB_ERR_INVAL); } From owner-svn-src-all@freebsd.org Sat Apr 9 20:57:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0FFDB09B87; Sat, 9 Apr 2016 20:57:01 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C1E521BEC; Sat, 9 Apr 2016 20:57:01 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7D9C0B918; Sat, 9 Apr 2016 16:57:00 -0400 (EDT) From: John Baldwin To: "Bjoern A. Zeeb" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r297742 - head/sys/netinet Date: Sat, 09 Apr 2016 13:22:19 -0700 Message-ID: <3095089.J0o1iEDduN@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: References: <201604091205.u39C5Oks041429@repo.freebsd.org> <5630207.6cr5Ycyqbh@ralph.baldwin.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Sat, 09 Apr 2016 16:57:00 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 20:57:02 -0000 On Saturday, April 09, 2016 06:31:24 PM Bjoern A. Zeeb wrote: > On Sat, 9 Apr 2016, John Baldwin wrote: > > trash user data. In the rest of the tree, we tend to prefer marking items > > as NOFREE instead of this approach putting a priority on stability and > > reliability over memory efficiency. > > > > For all of the zones that you removed NOFREE from, do you know why that was > > added in the first place (e.g. which stale pointers to pcbs could be > > referenced after free)? Did you verify that those conditions have been > > fixed? > > I did check. I did check a few years ago (and I think you had > reviewed that; maybe it was trouble). And the TCP bits here were > the last ones that were problematic back then. With the changes from > r281599 this should no longer be a problem. > > As for the others, a few years ago Andre already removed the NOFREE > and we unconditionally made him back the change out, which was a > mistake as otherwise some of these zones would have been "clean" for > years. Others have had KASSERTs ensuring that on VNET stack they were > actually empty. Ok. I believe one of the old ones fixed long ago were the pcb sysctls. I couldn't recall any other cases that required NOFREE. The network stack is often fairly loose with references especially those that add per-packet overhead (at least historically, the ifnet reference in m_pkthdr is one of the "big" remaining issues IIRC), so I sort of assume it still needs NOFREE as a general rule. -- John Baldwin From owner-svn-src-all@freebsd.org Sat Apr 9 21:04:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9DF8B09DAE; Sat, 9 Apr 2016 21:04:52 +0000 (UTC) (envelope-from jilles@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 mx1.freebsd.org (Postfix) with ESMTPS id 7613510E0; Sat, 9 Apr 2016 21:04:52 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39L4pcr011489; Sat, 9 Apr 2016 21:04:51 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39L4p33011488; Sat, 9 Apr 2016 21:04:51 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201604092104.u39L4p33011488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 9 Apr 2016 21:04:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297765 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 21:04:52 -0000 Author: jilles Date: Sat Apr 9 21:04:51 2016 New Revision: 297765 URL: https://svnweb.freebsd.org/changeset/base/297765 Log: MFC r281086: utimensat: Correct Capsicum required capability rights. Modified: stable/10/sys/kern/vfs_syscalls.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_syscalls.c ============================================================================== --- stable/10/sys/kern/vfs_syscalls.c Sat Apr 9 20:36:07 2016 (r297764) +++ stable/10/sys/kern/vfs_syscalls.c Sat Apr 9 21:04:51 2016 (r297765) @@ -3405,6 +3405,7 @@ kern_utimensat(struct thread *td, int fd { struct nameidata nd; struct timespec ts[2]; + cap_rights_t rights; int error, flags; if (flag & ~AT_SYMLINK_NOFOLLOW) @@ -3412,8 +3413,9 @@ kern_utimensat(struct thread *td, int fd if ((error = getutimens(tptr, tptrseg, ts, &flags)) != 0) return (error); - NDINIT_AT(&nd, LOOKUP, ((flag & AT_SYMLINK_NOFOLLOW) ? NOFOLLOW : - FOLLOW) | AUDITVNODE1, pathseg, path, fd, td); + NDINIT_ATRIGHTS(&nd, LOOKUP, ((flag & AT_SYMLINK_NOFOLLOW) ? NOFOLLOW : + FOLLOW) | AUDITVNODE1, pathseg, path, fd, + cap_rights_init(&rights, CAP_FUTIMES), td); if ((error = namei(&nd)) != 0) return (error); /* From owner-svn-src-all@freebsd.org Sat Apr 9 21:49:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63A3EB0A797; Sat, 9 Apr 2016 21:49:58 +0000 (UTC) (envelope-from jilles@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 mx1.freebsd.org (Postfix) with ESMTPS id 214A01184; Sat, 9 Apr 2016 21:49:58 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39LnvAW023755; Sat, 9 Apr 2016 21:49:57 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39LnvRZ023754; Sat, 9 Apr 2016 21:49:57 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201604092149.u39LnvRZ023754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 9 Apr 2016 21:49:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297766 - stable/10/bin/test X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 21:49:58 -0000 Author: jilles Date: Sat Apr 9 21:49:57 2016 New Revision: 297766 URL: https://svnweb.freebsd.org/changeset/base/297766 Log: MFC r258799: test: Simplify the code by unifying op_num and op_type. The global variable t_wp_op is no longer needed. Modified: stable/10/bin/test/test.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/test/test.c ============================================================================== --- stable/10/bin/test/test.c Sat Apr 9 21:04:51 2016 (r297765) +++ stable/10/bin/test/test.c Sat Apr 9 21:49:57 2016 (r297766) @@ -67,9 +67,18 @@ error(const char *msg, ...) operand ::= */ +enum token_types { + UNOP = 0x100, + BINOP = 0x200, + BUNOP = 0x300, + BBINOP = 0x400, + PAREN = 0x500 +}; + enum token { EOI, - FILRD, + OPERAND, + FILRD = UNOP + 1, FILWR, FILEX, FILEXIST, @@ -85,13 +94,13 @@ enum token { FILSUID, FILSGID, FILSTCK, - FILNT, - FILOT, - FILEQ, - FILUID, - FILGID, STREZ, STRNZ, + FILUID, + FILGID, + FILNT = BINOP + 1, + FILOT, + FILEQ, STREQ, STRNE, STRLT, @@ -102,70 +111,62 @@ enum token { INTGT, INTLE, INTLT, - UNOT, - BAND, + UNOT = BUNOP + 1, + BAND = BBINOP + 1, BOR, - LPAREN, - RPAREN, - OPERAND + LPAREN = PAREN + 1, + RPAREN }; -enum token_types { - UNOP, - BINOP, - BUNOP, - BBINOP, - PAREN -}; +#define TOKEN_TYPE(token) ((token) & 0xff00) static struct t_op { char op_text[4]; - short op_num, op_type; + short op_num; } const ops [] = { - {"-r", FILRD, UNOP}, - {"-w", FILWR, UNOP}, - {"-x", FILEX, UNOP}, - {"-e", FILEXIST,UNOP}, - {"-f", FILREG, UNOP}, - {"-d", FILDIR, UNOP}, - {"-c", FILCDEV,UNOP}, - {"-b", FILBDEV,UNOP}, - {"-p", FILFIFO,UNOP}, - {"-u", FILSUID,UNOP}, - {"-g", FILSGID,UNOP}, - {"-k", FILSTCK,UNOP}, - {"-s", FILGZ, UNOP}, - {"-t", FILTT, UNOP}, - {"-z", STREZ, UNOP}, - {"-n", STRNZ, UNOP}, - {"-h", FILSYM, UNOP}, /* for backwards compat */ - {"-O", FILUID, UNOP}, - {"-G", FILGID, UNOP}, - {"-L", FILSYM, UNOP}, - {"-S", FILSOCK,UNOP}, - {"=", STREQ, BINOP}, - {"==", STREQ, BINOP}, - {"!=", STRNE, BINOP}, - {"<", STRLT, BINOP}, - {">", STRGT, BINOP}, - {"-eq", INTEQ, BINOP}, - {"-ne", INTNE, BINOP}, - {"-ge", INTGE, BINOP}, - {"-gt", INTGT, BINOP}, - {"-le", INTLE, BINOP}, - {"-lt", INTLT, BINOP}, - {"-nt", FILNT, BINOP}, - {"-ot", FILOT, BINOP}, - {"-ef", FILEQ, BINOP}, - {"!", UNOT, BUNOP}, - {"-a", BAND, BBINOP}, - {"-o", BOR, BBINOP}, - {"(", LPAREN, PAREN}, - {")", RPAREN, PAREN}, - {"", 0, 0} + {"-r", FILRD}, + {"-w", FILWR}, + {"-x", FILEX}, + {"-e", FILEXIST}, + {"-f", FILREG}, + {"-d", FILDIR}, + {"-c", FILCDEV}, + {"-b", FILBDEV}, + {"-p", FILFIFO}, + {"-u", FILSUID}, + {"-g", FILSGID}, + {"-k", FILSTCK}, + {"-s", FILGZ}, + {"-t", FILTT}, + {"-z", STREZ}, + {"-n", STRNZ}, + {"-h", FILSYM}, /* for backwards compat */ + {"-O", FILUID}, + {"-G", FILGID}, + {"-L", FILSYM}, + {"-S", FILSOCK}, + {"=", STREQ}, + {"==", STREQ}, + {"!=", STRNE}, + {"<", STRLT}, + {">", STRGT}, + {"-eq", INTEQ}, + {"-ne", INTNE}, + {"-ge", INTGE}, + {"-gt", INTGT}, + {"-le", INTLE}, + {"-lt", INTLT}, + {"-nt", FILNT}, + {"-ot", FILOT}, + {"-ef", FILEQ}, + {"!", UNOT}, + {"-a", BAND}, + {"-o", BOR}, + {"(", LPAREN}, + {")", RPAREN}, + {"", 0} }; -static struct t_op const *t_wp_op; static int nargc; static char **t_wp; static int parenlevel; @@ -295,10 +296,10 @@ primary(enum token n) parenlevel--; return res; } - if (t_wp_op && t_wp_op->op_type == UNOP) { + if (TOKEN_TYPE(n) == UNOP) { /* unary expression */ if (--nargc == 0) - syntax(t_wp_op->op_text, "argument expected"); + syntax(NULL, "argument expected"); /* impossible */ switch (n) { case STREZ: return strlen(*++t_wp) == 0; @@ -311,10 +312,8 @@ primary(enum token n) } } - if (t_lex(nargc > 0 ? t_wp[1] : NULL), t_wp_op && t_wp_op->op_type == - BINOP) { + if (TOKEN_TYPE(t_lex(nargc > 0 ? t_wp[1] : NULL)) == BINOP) return binop(); - } return strlen(*t_wp) > 0; } @@ -322,17 +321,17 @@ primary(enum token n) static int binop(void) { - const char *opnd1, *opnd2; - struct t_op const *op; + const char *opnd1, *op, *opnd2; + enum token n; opnd1 = *t_wp; - (void) t_lex(nargc > 0 ? (--nargc, *++t_wp) : NULL); - op = t_wp_op; + op = nargc > 0 ? t_wp[1] : NULL; + n = t_lex(nargc > 0 ? (--nargc, *++t_wp) : NULL); if ((opnd2 = nargc > 0 ? (--nargc, *++t_wp) : NULL) == NULL) - syntax(op->op_text, "argument expected"); + syntax(op, "argument expected"); - switch (op->op_num) { + switch (n) { case STREQ: return strcmp(opnd1, opnd2) == 0; case STRNE: @@ -424,22 +423,20 @@ t_lex(char *s) struct t_op const *op = ops; if (s == 0) { - t_wp_op = NULL; return EOI; } while (*op->op_text) { if (strcmp(s, op->op_text) == 0) { - if (((op->op_type == UNOP || op->op_type == BUNOP) + if (((TOKEN_TYPE(op->op_num) == UNOP || + TOKEN_TYPE(op->op_num) == BUNOP) && isunopoperand()) || (op->op_num == LPAREN && islparenoperand()) || (op->op_num == RPAREN && isrparenoperand())) break; - t_wp_op = op; return op->op_num; } op++; } - t_wp_op = NULL; return OPERAND; } @@ -458,7 +455,7 @@ isunopoperand(void) t = *(t_wp + 2); while (*op->op_text) { if (strcmp(s, op->op_text) == 0) - return op->op_type == BINOP && + return TOKEN_TYPE(op->op_num) == BINOP && (parenlevel == 0 || t[0] != ')' || t[1] != '\0'); op++; } @@ -480,7 +477,7 @@ islparenoperand(void) return 0; while (*op->op_text) { if (strcmp(s, op->op_text) == 0) - return op->op_type == BINOP; + return TOKEN_TYPE(op->op_num) == BINOP; op++; } return 0; From owner-svn-src-all@freebsd.org Sat Apr 9 21:56:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 376DFB0A92F; Sat, 9 Apr 2016 21:56:00 +0000 (UTC) (envelope-from jilles@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 mx1.freebsd.org (Postfix) with ESMTPS id 067BC1591; Sat, 9 Apr 2016 21:55:59 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39LtxjP026593; Sat, 9 Apr 2016 21:55:59 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39LtxIr026592; Sat, 9 Apr 2016 21:55:59 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201604092155.u39LtxIr026592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 9 Apr 2016 21:55:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297767 - stable/10/bin/test X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 21:56:00 -0000 Author: jilles Date: Sat Apr 9 21:55:58 2016 New Revision: 297767 URL: https://svnweb.freebsd.org/changeset/base/297767 Log: MFC r259017: test: Avoid looking up again the type of a known binary operator. Modified: stable/10/bin/test/test.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/test/test.c ============================================================================== --- stable/10/bin/test/test.c Sat Apr 9 21:49:57 2016 (r297766) +++ stable/10/bin/test/test.c Sat Apr 9 21:55:58 2016 (r297767) @@ -172,7 +172,7 @@ static char **t_wp; static int parenlevel; static int aexpr(enum token); -static int binop(void); +static int binop(enum token); static int equalf(const char *, const char *); static int filstat(char *, enum token); static int getn(const char *); @@ -312,21 +312,20 @@ primary(enum token n) } } - if (TOKEN_TYPE(t_lex(nargc > 0 ? t_wp[1] : NULL)) == BINOP) - return binop(); + nn = t_lex(nargc > 0 ? t_wp[1] : NULL); + if (TOKEN_TYPE(nn) == BINOP) + return binop(nn); return strlen(*t_wp) > 0; } static int -binop(void) +binop(enum token n) { const char *opnd1, *op, *opnd2; - enum token n; opnd1 = *t_wp; - op = nargc > 0 ? t_wp[1] : NULL; - n = t_lex(nargc > 0 ? (--nargc, *++t_wp) : NULL); + op = nargc > 0 ? (--nargc, *++t_wp) : NULL; if ((opnd2 = nargc > 0 ? (--nargc, *++t_wp) : NULL) == NULL) syntax(op, "argument expected"); From owner-svn-src-all@freebsd.org Sat Apr 9 21:57:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08955B0A9A5; Sat, 9 Apr 2016 21:57:36 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id C984916E9; Sat, 9 Apr 2016 21:57:35 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39LvYpT026693; Sat, 9 Apr 2016 21:57:34 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39LvYYl026692; Sat, 9 Apr 2016 21:57:34 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604092157.u39LvYYl026692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 9 Apr 2016 21:57:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297768 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 21:57:36 -0000 Author: adrian Date: Sat Apr 9 21:57:34 2016 New Revision: 297768 URL: https://svnweb.freebsd.org/changeset/base/297768 Log: [net80211] add back in the ff/superg node init call that I accidentally deleted. It's mostly a no-op right now, so it shouldn't have changed behaviour. Modified: head/sys/net80211/ieee80211_sta.c Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Sat Apr 9 21:55:58 2016 (r297767) +++ head/sys/net80211/ieee80211_sta.c Sat Apr 9 21:57:34 2016 (r297768) @@ -1706,6 +1706,14 @@ sta_recv_mgmt(struct ieee80211_node *ni, } /* + * Always initialise FF/superg state; we can use this + * for doing A-MSDU encapsulation as well. + */ +#ifdef IEEE80211_SUPPORT_SUPERG + ieee80211_ff_node_init(ni); +#endif + + /* * Configure state now that we are associated. * * XXX may need different/additional driver callbacks? From owner-svn-src-all@freebsd.org Sat Apr 9 22:01:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61ED3B0AA5B; Sat, 9 Apr 2016 22:01:33 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id 2CBB31A70; Sat, 9 Apr 2016 22:01:33 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u39M1W8M028836; Sat, 9 Apr 2016 22:01:32 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u39M1WNX028835; Sat, 9 Apr 2016 22:01:32 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604092201.u39M1WNX028835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 9 Apr 2016 22:01:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297769 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 22:01:33 -0000 Author: adrian Date: Sat Apr 9 22:01:32 2016 New Revision: 297769 URL: https://svnweb.freebsd.org/changeset/base/297769 Log: [net80211] log the node pointer when calling ht node init/cleanup This makes it easier to track which node is having what done do it during normal use. This is likely the eighth time I've done this since I started doing net80211 development, so I think it's about time I just committed it. Modified: head/sys/net80211/ieee80211_ht.c Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Sat Apr 9 21:57:34 2016 (r297768) +++ head/sys/net80211/ieee80211_ht.c Sat Apr 9 22:01:32 2016 (r297769) @@ -1063,8 +1063,9 @@ ieee80211_ht_node_init(struct ieee80211_ IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N, ni, - "%s: called", - __func__); + "%s: called (%p)", + __func__, + ni); if (ni->ni_flags & IEEE80211_NODE_HT) { /* @@ -1074,8 +1075,8 @@ ieee80211_ht_node_init(struct ieee80211_ */ IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N, ni, - "%s: calling cleanup", - __func__); + "%s: calling cleanup (%p)", + __func__, ni); ieee80211_ht_node_cleanup(ni); } for (tid = 0; tid < WME_NUM_TID; tid++) { @@ -1100,8 +1101,8 @@ ieee80211_ht_node_cleanup(struct ieee802 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N, ni, - "%s: called", - __func__); + "%s: called (%p)", + __func__, ni); KASSERT(ni->ni_flags & IEEE80211_NODE_HT, ("not an HT node"));