From owner-svn-src-projects@FreeBSD.ORG Sun Sep 7 17:42:33 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 78F6F1F6; Sun, 7 Sep 2014 17:42:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 4AC8D173E; Sun, 7 Sep 2014 17:42:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s87HgXmD010735; Sun, 7 Sep 2014 17:42:33 GMT (envelope-from jceel@FreeBSD.org) Received: (from jceel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s87HgWuY010730; Sun, 7 Sep 2014 17:42:32 GMT (envelope-from jceel@FreeBSD.org) Message-Id: <201409071742.s87HgWuY010730@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jceel set sender to jceel@FreeBSD.org using -f From: Jakub Wojciech Klama Date: Sun, 7 Sep 2014 17:42:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271229 - in projects/arm_intrng/sys: arm/broadcom/bcm2835 arm/lpc arm/ti conf X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Sep 2014 17:42:33 -0000 Author: jceel Date: Sun Sep 7 17:42:32 2014 New Revision: 271229 URL: http://svnweb.freebsd.org/changeset/base/271229 Log: Don't add intrng.c twice. Compile arm/arm/intr.c if ARM_INTRNG option is not set. Modified: projects/arm_intrng/sys/arm/broadcom/bcm2835/files.bcm2835 projects/arm_intrng/sys/arm/lpc/files.lpc projects/arm_intrng/sys/arm/ti/files.ti projects/arm_intrng/sys/conf/files.arm Modified: projects/arm_intrng/sys/arm/broadcom/bcm2835/files.bcm2835 ============================================================================== --- projects/arm_intrng/sys/arm/broadcom/bcm2835/files.bcm2835 Sun Sep 7 17:07:19 2014 (r271228) +++ projects/arm_intrng/sys/arm/broadcom/bcm2835/files.bcm2835 Sun Sep 7 17:42:32 2014 (r271229) @@ -21,7 +21,6 @@ arm/arm/cpufunc_asm_arm11.S arm/arm/cpufunc_asm_arm11x6.S standard arm/arm/cpufunc_asm_armv5.S standard arm/arm/cpufunc_asm_armv6.S standard -arm/arm/intrng.c standard kern/kern_clocksource.c standard Modified: projects/arm_intrng/sys/arm/lpc/files.lpc ============================================================================== --- projects/arm_intrng/sys/arm/lpc/files.lpc Sun Sep 7 17:07:19 2014 (r271228) +++ projects/arm_intrng/sys/arm/lpc/files.lpc Sun Sep 7 17:42:32 2014 (r271229) @@ -2,7 +2,6 @@ arm/arm/bus_space_generic.c standard arm/arm/cpufunc_asm_arm9.S standard arm/arm/cpufunc_asm_armv5.S standard -arm/arm/intrng.c standard arm/lpc/lpc_machdep.c standard arm/lpc/lpc_space.c standard arm/lpc/lpc_pwr.c standard Modified: projects/arm_intrng/sys/arm/ti/files.ti ============================================================================== --- projects/arm_intrng/sys/arm/ti/files.ti Sun Sep 7 17:07:19 2014 (r271228) +++ projects/arm_intrng/sys/arm/ti/files.ti Sun Sep 7 17:42:32 2014 (r271229) @@ -9,7 +9,6 @@ arm/arm/cpufunc_asm_armv5.S standard arm/arm/cpufunc_asm_arm10.S standard arm/arm/cpufunc_asm_arm11.S standard arm/arm/cpufunc_asm_armv7.S standard -arm/arm/intrng.c standard arm/ti/ti_common.c standard arm/ti/ti_cpuid.c standard Modified: projects/arm_intrng/sys/conf/files.arm ============================================================================== --- projects/arm_intrng/sys/conf/files.arm Sun Sep 7 17:07:19 2014 (r271228) +++ projects/arm_intrng/sys/conf/files.arm Sun Sep 7 17:42:32 2014 (r271229) @@ -26,6 +26,7 @@ arm/arm/gdb_machdep.c optional gdb arm/arm/identcpu.c standard arm/arm/in_cksum.c optional inet | inet6 arm/arm/in_cksum_arm.S optional inet | inet6 +arm/arm/intr.c optional !arm_intrng arm/arm/intrng.c optional arm_intrng arm/arm/locore.S standard no-obj arm/arm/machdep.c standard From owner-svn-src-projects@FreeBSD.ORG Sun Sep 7 18:30:30 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5D80A9B; Sun, 7 Sep 2014 18:30:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 474F51B31; Sun, 7 Sep 2014 18:30:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s87IUULD031697; Sun, 7 Sep 2014 18:30:30 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s87IUT4f031688; Sun, 7 Sep 2014 18:30:29 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201409071830.s87IUT4f031688@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 7 Sep 2014 18:30:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271231 - in projects/ipfw: sbin/ipfw sys/netinet sys/netpfil/ipfw X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Sep 2014 18:30:30 -0000 Author: melifaro Date: Sun Sep 7 18:30:29 2014 New Revision: 271231 URL: http://svnweb.freebsd.org/changeset/base/271231 Log: Make ipfw_nat module use IP_FW3 codes. Kernel changes: * Split kernel/userland nat structures eliminating IPFW_INTERNAL hack. * Add IP_FW_NAT44_* codes resemblin old ones. * Assume that instances can be named (no kernel support currently). * Use both UH+WLOCK locks for all configuration changes. * Provide full ABI support for old sockopts. Userland changes: * Use IP_FW_NAT44_* codes for nat operations. * Remove undocumented ability to show ranges of nat "log" entries. Modified: projects/ipfw/sbin/ipfw/nat.c projects/ipfw/sys/netinet/ip_fw.h projects/ipfw/sys/netpfil/ipfw/ip_fw_nat.c Modified: projects/ipfw/sbin/ipfw/nat.c ============================================================================== --- projects/ipfw/sbin/ipfw/nat.c Sun Sep 7 18:05:37 2014 (r271230) +++ projects/ipfw/sbin/ipfw/nat.c Sun Sep 7 18:30:29 2014 (r271231) @@ -30,14 +30,13 @@ #include #include +#include #include #include #include #include #include -#define IPFW_INTERNAL /* Access to protected structures in ip_fw.h. */ - #include #include #include /* def. of struct route */ @@ -46,6 +45,14 @@ #include #include +typedef int (nat_cb_t)(struct nat44_cfg_nat *cfg, void *arg); +static void nat_show_cfg(struct nat44_cfg_nat *n, void *arg); +static void nat_show_log(struct nat44_cfg_nat *n, void *arg); +static int nat_show_data(struct nat44_cfg_nat *cfg, void *arg); +static int natname_cmp(const void *a, const void *b); +static int nat_foreach(nat_cb_t *f, void *arg, int sort); +static int nat_get_cmd(char *name, uint16_t cmd, ipfw_obj_header **ooh); + static struct _s_x nat_params[] = { { "ip", TOK_IP }, { "if", TOK_IF }, @@ -71,7 +78,7 @@ static struct _s_x nat_params[] = { * n->if_name copy of interface name "ifn" */ static void -set_addr_dynamic(const char *ifn, struct cfg_nat *n) +set_addr_dynamic(const char *ifn, struct nat44_cfg_nat *n) { size_t needed; int mib[6]; @@ -288,15 +295,15 @@ StrToAddrAndPortRange (const char* str, * and SetupProtoRedirect() from natd.c. * * Every setup_* function fills at least one redirect entry - * (struct cfg_redir) and zero or more server pool entry (struct cfg_spool) - * in buf. + * (struct nat44_cfg_redir) and zero or more server pool entry + * (struct nat44_cfg_spool) in buf. * * The format of data in buf is: * - * cfg_nat cfg_redir cfg_spool ...... cfg_spool + * nat44_cfg_nat nat44_cfg_redir nat44_cfg_spool ...... nat44_cfg_spool * * ------------------------------------- ------------ - * | | .....X ... | | | | ..... + * | | .....X ..... | | | | ..... * ------------------------------------- ...... ------------ * ^ * spool_cnt n=0 ...... n=(X-1) @@ -314,7 +321,7 @@ StrToAddrAndPortRange (const char* str, static int estimate_redir_addr(int *ac, char ***av) { - size_t space = sizeof(struct cfg_redir); + size_t space = sizeof(struct nat44_cfg_redir); char *sep = **av; u_int c = 0; @@ -327,7 +334,7 @@ estimate_redir_addr(int *ac, char ***av) if (c > 0) c++; - space += c * sizeof(struct cfg_spool); + space += c * sizeof(struct nat44_cfg_spool); return (space); } @@ -335,31 +342,31 @@ estimate_redir_addr(int *ac, char ***av) static int setup_redir_addr(char *buf, int *ac, char ***av) { - struct cfg_redir *r; + struct nat44_cfg_redir *r; char *sep; size_t space; - r = (struct cfg_redir *)buf; + r = (struct nat44_cfg_redir *)buf; r->mode = REDIR_ADDR; - /* Skip cfg_redir at beginning of buf. */ - buf = &buf[sizeof(struct cfg_redir)]; - space = sizeof(struct cfg_redir); + /* Skip nat44_cfg_redir at beginning of buf. */ + buf = &buf[sizeof(struct nat44_cfg_redir)]; + space = sizeof(struct nat44_cfg_redir); /* Extract local address. */ if (strchr(**av, ',') != NULL) { - struct cfg_spool *spool; + struct nat44_cfg_spool *spool; /* Setup LSNAT server pool. */ r->laddr.s_addr = INADDR_NONE; sep = strtok(**av, ","); while (sep != NULL) { - spool = (struct cfg_spool *)buf; - space += sizeof(struct cfg_spool); + spool = (struct nat44_cfg_spool *)buf; + space += sizeof(struct nat44_cfg_spool); StrToAddr(sep, &spool->addr); spool->port = ~0; r->spool_cnt++; - /* Point to the next possible cfg_spool. */ - buf = &buf[sizeof(struct cfg_spool)]; + /* Point to the next possible nat44_cfg_spool. */ + buf = &buf[sizeof(struct nat44_cfg_spool)]; sep = strtok(NULL, ","); } } else @@ -376,7 +383,7 @@ setup_redir_addr(char *buf, int *ac, cha static int estimate_redir_port(int *ac, char ***av) { - size_t space = sizeof(struct cfg_redir); + size_t space = sizeof(struct nat44_cfg_redir); char *sep = **av; u_int c = 0; @@ -389,7 +396,7 @@ estimate_redir_port(int *ac, char ***av) if (c > 0) c++; - space += c * sizeof(struct cfg_spool); + space += c * sizeof(struct nat44_cfg_spool); return (space); } @@ -397,7 +404,7 @@ estimate_redir_port(int *ac, char ***av) static int setup_redir_port(char *buf, int *ac, char ***av) { - struct cfg_redir *r; + struct nat44_cfg_redir *r; char *sep, *protoName, *lsnat = NULL; size_t space; u_short numLocalPorts; @@ -405,11 +412,11 @@ setup_redir_port(char *buf, int *ac, cha numLocalPorts = 0; - r = (struct cfg_redir *)buf; + r = (struct nat44_cfg_redir *)buf; r->mode = REDIR_PORT; - /* Skip cfg_redir at beginning of buf. */ - buf = &buf[sizeof(struct cfg_redir)]; - space = sizeof(struct cfg_redir); + /* Skip nat44_cfg_redir at beginning of buf. */ + buf = &buf[sizeof(struct nat44_cfg_redir)]; + space = sizeof(struct nat44_cfg_redir); /* * Extract protocol. @@ -516,12 +523,12 @@ setup_redir_port(char *buf, int *ac, cha /* Setup LSNAT server pool. */ if (lsnat != NULL) { - struct cfg_spool *spool; + struct nat44_cfg_spool *spool; sep = strtok(lsnat, ","); while (sep != NULL) { - spool = (struct cfg_spool *)buf; - space += sizeof(struct cfg_spool); + spool = (struct nat44_cfg_spool *)buf; + space += sizeof(struct nat44_cfg_spool); /* * The sctp nat does not allow the port numbers to * be mapped to new port numbers. Therefore, no ports @@ -549,8 +556,8 @@ setup_redir_port(char *buf, int *ac, cha spool->port = GETLOPORT(portRange); } r->spool_cnt++; - /* Point to the next possible cfg_spool. */ - buf = &buf[sizeof(struct cfg_spool)]; + /* Point to the next possible nat44_cfg_spool. */ + buf = &buf[sizeof(struct nat44_cfg_spool)]; sep = strtok(NULL, ","); } } @@ -561,15 +568,15 @@ setup_redir_port(char *buf, int *ac, cha static int setup_redir_proto(char *buf, int *ac, char ***av) { - struct cfg_redir *r; + struct nat44_cfg_redir *r; struct protoent *protoent; size_t space; - r = (struct cfg_redir *)buf; + r = (struct nat44_cfg_redir *)buf; r->mode = REDIR_PROTO; - /* Skip cfg_redir at beginning of buf. */ - buf = &buf[sizeof(struct cfg_redir)]; - space = sizeof(struct cfg_redir); + /* Skip nat44_cfg_redir at beginning of buf. */ + buf = &buf[sizeof(struct nat44_cfg_redir)]; + space = sizeof(struct nat44_cfg_redir); /* * Extract protocol. @@ -616,18 +623,28 @@ setup_redir_proto(char *buf, int *ac, ch } static void -print_nat_config(unsigned char *buf) +nat_show_log(struct nat44_cfg_nat *n, void *arg) +{ + char *buf; + + buf = (char *)(n + 1); + if (buf[0] != '\0') + printf("nat %s: %s\n", n->name, buf); +} + +static void +nat_show_cfg(struct nat44_cfg_nat *n, void *arg) { - struct cfg_nat *n; int i, cnt, flag, off; - struct cfg_redir *t; - struct cfg_spool *s; + struct nat44_cfg_redir *t; + struct nat44_cfg_spool *s; + caddr_t buf; struct protoent *p; - n = (struct cfg_nat *)buf; + buf = (caddr_t)n; flag = 1; - off = sizeof(*n); - printf("ipfw nat %u config", n->id); + off = sizeof(*n); + printf("ipfw nat %s config", n->name); if (strlen(n->if_name) != 0) printf(" if %s", n->if_name); else if (n->ip.s_addr != 0) @@ -661,8 +678,8 @@ print_nat_config(unsigned char *buf) } /* Print all the redirect's data configuration. */ for (cnt = 0; cnt < n->redir_cnt; cnt++) { - t = (struct cfg_redir *)&buf[off]; - off += SOF_REDIR; + t = (struct nat44_cfg_redir *)&buf[off]; + off += sizeof(struct nat44_cfg_redir); switch (t->mode) { case REDIR_ADDR: printf(" redirect_addr"); @@ -670,13 +687,13 @@ print_nat_config(unsigned char *buf) printf(" %s", inet_ntoa(t->laddr)); else for (i = 0; i < t->spool_cnt; i++) { - s = (struct cfg_spool *)&buf[off]; + s = (struct nat44_cfg_spool *)&buf[off]; if (i) printf(","); else printf(" "); printf("%s", inet_ntoa(s->addr)); - off += SOF_SPOOL; + off += sizeof(struct nat44_cfg_spool); } printf(" %s", inet_ntoa(t->paddr)); break; @@ -690,12 +707,12 @@ print_nat_config(unsigned char *buf) t->pport_cnt - 1); } else for (i=0; i < t->spool_cnt; i++) { - s = (struct cfg_spool *)&buf[off]; + s = (struct nat44_cfg_spool *)&buf[off]; if (i) printf(","); printf("%s:%u", inet_ntoa(s->addr), s->port); - off += SOF_SPOOL; + off += sizeof(struct nat44_cfg_spool); } printf(" "); @@ -736,7 +753,8 @@ print_nat_config(unsigned char *buf) void ipfw_config_nat(int ac, char **av) { - struct cfg_nat *n; /* Nat instance configuration. */ + ipfw_obj_header *oh; + struct nat44_cfg_nat *n; /* Nat instance configuration. */ int i, off, tok, ac1; char *id, *buf, **av1, *end; size_t len; @@ -755,7 +773,7 @@ ipfw_config_nat(int ac, char **av) if (ac == 0) errx(EX_DATAERR, "missing option"); - len = sizeof(struct cfg_nat); + len = sizeof(*oh) + sizeof(*n); ac1 = ac; av1 = av; while (ac1 > 0) { @@ -804,7 +822,7 @@ ipfw_config_nat(int ac, char **av) if (ac1 < 2) errx(EX_DATAERR, "redirect_proto: " "not enough arguments"); - len += sizeof(struct cfg_redir); + len += sizeof(struct nat44_cfg_redir); av1 += 2; ac1 -= 2; /* Skip optional remoteIP/port */ @@ -825,11 +843,14 @@ ipfw_config_nat(int ac, char **av) if ((buf = malloc(len)) == NULL) errx(EX_OSERR, "malloc failed"); - /* Offset in buf: save space for n at the beginning. */ - off = sizeof(*n); + /* Offset in buf: save space for header at the beginning. */ + off = sizeof(*oh) + sizeof(*n); memset(buf, 0, len); - n = (struct cfg_nat *)buf; - n->id = i; + oh = (ipfw_obj_header *)buf; + n = (struct nat44_cfg_nat *)(oh + 1); + oh->ntlv.head.length = sizeof(oh->ntlv); + snprintf(oh->ntlv.name, sizeof(oh->ntlv.name), "%d", i); + snprintf(n->name, sizeof(n->name), "%d", i); while (ac > 0) { tok = match_token(nat_params, *av); @@ -900,9 +921,9 @@ ipfw_config_nat(int ac, char **av) } } - i = do_cmd(IP_FW_NAT_CFG, buf, off); - if (i) - err(1, "setsockopt(%s)", "IP_FW_NAT_CFG"); + i = do_set3(IP_FW_NAT44_XCONFIG, &oh->opheader, len); + if (i != 0) + err(1, "setsockopt(%s)", "IP_FW_NAT44_XCONFIG"); if (!co.do_quiet) { /* After every modification, we show the resultant rule. */ @@ -912,23 +933,147 @@ ipfw_config_nat(int ac, char **av) } } +struct nat_list_arg { + uint16_t cmd; + int is_all; +}; + +static int +nat_show_data(struct nat44_cfg_nat *cfg, void *arg) +{ + struct nat_list_arg *nla; + ipfw_obj_header *oh; + + nla = (struct nat_list_arg *)arg; + + switch (nla->cmd) { + case IP_FW_NAT44_XGETCONFIG: + if (nat_get_cmd(cfg->name, nla->cmd, &oh) != 0) { + warnx("Error getting nat instance %s info", cfg->name); + break; + } + nat_show_cfg((struct nat44_cfg_nat *)(oh + 1), NULL); + free(oh); + break; + case IP_FW_NAT44_XGETLOG: + if (nat_get_cmd(cfg->name, nla->cmd, &oh) == 0) { + nat_show_log((struct nat44_cfg_nat *)(oh + 1), NULL); + free(oh); + break; + } + /* Handle error */ + if (nla->is_all != 0 && errno == ENOENT) + break; + warn("Error getting nat instance %s info", cfg->name); + break; + } + + return (0); +} + +/* + * Compare nat names. + * Honor number comparison. + */ +static int +natname_cmp(const void *a, const void *b) +{ + struct nat44_cfg_nat *ia, *ib; + + ia = (struct nat44_cfg_nat *)a; + ib = (struct nat44_cfg_nat *)b; + + return (stringnum_cmp(ia->name, ib->name)); +} + +/* + * Retrieves nat list from kernel, + * optionally sorts it and calls requested function for each table. + * Returns 0 on success. + */ +static int +nat_foreach(nat_cb_t *f, void *arg, int sort) +{ + ipfw_obj_lheader *olh; + struct nat44_cfg_nat *cfg; + size_t sz; + int i, error; + + /* Start with reasonable default */ + sz = sizeof(*olh) + 16 * sizeof(struct nat44_cfg_nat); + + for (;;) { + if ((olh = calloc(1, sz)) == NULL) + return (ENOMEM); + + olh->size = sz; + if (do_get3(IP_FW_NAT44_LIST_NAT, &olh->opheader, &sz) != 0) { + free(olh); + if (errno == ENOMEM) { + sz = olh->size; + continue; + } + return (errno); + } + + if (sort != 0) + qsort(olh + 1, olh->count, olh->objsize, natname_cmp); + + cfg = (struct nat44_cfg_nat*)(olh + 1); + for (i = 0; i < olh->count; i++) { + error = f(cfg, arg); /* Ignore errors for now */ + cfg = (struct nat44_cfg_nat *)((caddr_t)cfg + + olh->objsize); + } + + free(olh); + break; + } + + return (0); +} + +static int +nat_get_cmd(char *name, uint16_t cmd, ipfw_obj_header **ooh) +{ + ipfw_obj_header *oh; + struct nat44_cfg_nat *cfg; + size_t sz; + + /* Start with reasonable default */ + sz = sizeof(*oh) + sizeof(*cfg) + 128; + + for (;;) { + if ((oh = calloc(1, sz)) == NULL) + return (ENOMEM); + cfg = (struct nat44_cfg_nat *)(oh + 1); + oh->ntlv.head.length = sizeof(oh->ntlv); + strlcpy(oh->ntlv.name, name, sizeof(oh->ntlv.name)); + strlcpy(cfg->name, name, sizeof(cfg->name)); + + if (do_get3(cmd, &oh->opheader, &sz) != 0) { + sz = cfg->size; + free(oh); + if (errno == ENOMEM) + continue; + return (errno); + } + + *ooh = oh; + break; + } + + return (0); +} void ipfw_show_nat(int ac, char **av) { - struct cfg_nat *n; - struct cfg_redir *e; - int cmd, i, nbytes, do_cfg, do_rule, frule, lrule, nalloc, size; - int nat_cnt, redir_cnt, r; - uint8_t *data, *p; - char *endptr; - - do_rule = 0; - nalloc = 1024; - size = 0; - data = NULL; - frule = 0; - lrule = IPFW_DEFAULT_RULE; /* max ipfw rule number */ + ipfw_obj_header *oh; + char *name; + int cmd; + struct nat_list_arg nla; + ac--; av++; @@ -936,55 +1081,35 @@ ipfw_show_nat(int ac, char **av) return; /* Parse parameters. */ - for (cmd = IP_FW_NAT_GET_LOG, do_cfg = 0; ac != 0; ac--, av++) { + cmd = 0; /* XXX: Change to IP_FW_NAT44_XGETLOG @ MFC */ + name = NULL; + for ( ; ac != 0; ac--, av++) { if (!strncmp(av[0], "config", strlen(av[0]))) { - cmd = IP_FW_NAT_GET_CONFIG, do_cfg = 1; + cmd = IP_FW_NAT44_XGETCONFIG; continue; } - /* Convert command line rule #. */ - frule = lrule = strtoul(av[0], &endptr, 10); - if (*endptr == '-') - lrule = strtoul(endptr+1, &endptr, 10); - if (lrule == 0) - err(EX_USAGE, "invalid rule number: %s", av[0]); - do_rule = 1; - } - - nbytes = nalloc; - while (nbytes >= nalloc) { - nalloc = nalloc * 2; - nbytes = nalloc; - data = safe_realloc(data, nbytes); - if (do_cmd(cmd, data, (uintptr_t)&nbytes) < 0) - err(EX_OSERR, "getsockopt(IP_FW_GET_%s)", - (cmd == IP_FW_NAT_GET_LOG) ? "LOG" : "CONFIG"); - } - if (nbytes == 0) - exit(0); - if (do_cfg) { - nat_cnt = *((int *)data); - for (i = sizeof(nat_cnt); nat_cnt; nat_cnt--) { - n = (struct cfg_nat *)&data[i]; - if (frule <= n->id && lrule >= n->id) - print_nat_config(&data[i]); - i += sizeof(struct cfg_nat); - for (redir_cnt = 0; redir_cnt < n->redir_cnt; redir_cnt++) { - e = (struct cfg_redir *)&data[i]; - i += sizeof(struct cfg_redir) + e->spool_cnt * - sizeof(struct cfg_spool); - } + if (strcmp(av[0], "log") == 0) { + cmd = IP_FW_NAT44_XGETLOG; + continue; } + if (name != NULL) + err(EX_USAGE,"only one instance name may be specified"); + name = av[0]; + } + + if (cmd == 0) + errx(EX_USAGE, "Please specify action. Available: config,log"); + + if (name == NULL) { + memset(&nla, 0, sizeof(nla)); + nla.cmd = cmd; + nla.is_all = 1; + nat_foreach(nat_show_data, &nla, 1); } else { - for (i = 0; 1; i += LIBALIAS_BUF_SIZE + sizeof(int)) { - p = &data[i]; - if (p == data + nbytes) - break; - bcopy(p, &r, sizeof(int)); - if (do_rule) { - if (!(frule <= r && lrule >= r)) - continue; - } - printf("nat %u: %s\n", r, p+sizeof(int)); - } + if (nat_get_cmd(name, cmd, &oh) != 0) + err(EX_OSERR, "Error getting nat %s instance info", name); + nat_show_cfg((struct nat44_cfg_nat *)(oh + 1), NULL); + free(oh); } } + Modified: projects/ipfw/sys/netinet/ip_fw.h ============================================================================== --- projects/ipfw/sys/netinet/ip_fw.h Sun Sep 7 18:05:37 2014 (r271230) +++ projects/ipfw/sys/netinet/ip_fw.h Sun Sep 7 18:30:29 2014 (r271231) @@ -98,6 +98,12 @@ typedef struct _ip_fw3_opheader { #define IP_FW_TABLE_XSWAP 109 /* swap two tables */ #define IP_FW_TABLE_VLIST 110 /* dump table value hash */ +#define IP_FW_NAT44_XCONFIG 111 /* Create/modify NAT44 instance */ +#define IP_FW_NAT44_DESTROY 112 /* Destroys NAT44 instance */ +#define IP_FW_NAT44_XGETCONFIG 113 /* Get NAT44 instance config */ +#define IP_FW_NAT44_LIST_NAT 114 /* List all NAT44 instances */ +#define IP_FW_NAT44_XGETLOG 115 /* Get log from NAT44 instance */ + /* * The kernel representation of ipfw rules is made of a list of * 'instructions' (for all practical purposes equivalent to BPF @@ -402,6 +408,8 @@ typedef struct _ipfw_insn_log { u_int32_t log_left; /* how many left to log */ } ipfw_insn_log; +/* Legacy NAT structures, compat only */ +#ifndef _KERNEL /* * Data structures required by both ipfw(8) and ipfw(4) but not part of the * management API are protected by IPFW_INTERNAL. @@ -463,6 +471,44 @@ struct cfg_nat { #define SOF_REDIR sizeof(struct cfg_redir) #define SOF_SPOOL sizeof(struct cfg_spool) +#endif /* ifndef _KERNEL */ + + +struct nat44_cfg_spool { + struct in_addr addr; + uint16_t port; + uint16_t spare; +}; +#define NAT44_REDIR_ADDR 0x01 +#define NAT44_REDIR_PORT 0x02 +#define NAT44_REDIR_PROTO 0x04 + +/* Nat redirect configuration. */ +struct nat44_cfg_redir { + struct in_addr laddr; /* local ip address */ + struct in_addr paddr; /* public ip address */ + struct in_addr raddr; /* remote ip address */ + uint16_t lport; /* local port */ + uint16_t pport; /* public port */ + uint16_t rport; /* remote port */ + uint16_t pport_cnt; /* number of public ports */ + uint16_t rport_cnt; /* number of remote ports */ + uint16_t mode; /* type of redirect mode */ + uint16_t spool_cnt; /* num of entry in spool chain */ + uint16_t spare; + uint32_t proto; /* protocol: tcp/udp */ +}; + +/* Nat configuration data struct. */ +struct nat44_cfg_nat { + char name[64]; /* nat name */ + char if_name[64]; /* interface name */ + uint32_t size; /* structure size incl. redirs */ + struct in_addr ip; /* nat IPv4 address */ + uint32_t mode; /* aliasing mode */ + uint32_t redir_cnt; /* number of entry in spool chain */ +}; + /* Nat command. */ typedef struct _ipfw_insn_nat { ipfw_insn o; Modified: projects/ipfw/sys/netpfil/ipfw/ip_fw_nat.c ============================================================================== --- projects/ipfw/sys/netpfil/ipfw/ip_fw_nat.c Sun Sep 7 18:05:37 2014 (r271230) +++ projects/ipfw/sys/netpfil/ipfw/ip_fw_nat.c Sun Sep 7 18:30:29 2014 (r271231) @@ -37,8 +37,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define IPFW_INTERNAL /* Access to protected data structures in ip_fw.h. */ - #include #include @@ -55,6 +53,45 @@ __FBSDID("$FreeBSD$"); #include /* XXX for in_cksum */ +struct cfg_spool { + LIST_ENTRY(cfg_spool) _next; /* chain of spool instances */ + struct in_addr addr; + uint16_t port; +}; + +/* Nat redirect configuration. */ +struct cfg_redir { + LIST_ENTRY(cfg_redir) _next; /* chain of redir instances */ + uint16_t mode; /* type of redirect mode */ + uint16_t proto; /* protocol: tcp/udp */ + struct in_addr laddr; /* local ip address */ + struct in_addr paddr; /* public ip address */ + struct in_addr raddr; /* remote ip address */ + uint16_t lport; /* local port */ + uint16_t pport; /* public port */ + uint16_t rport; /* remote port */ + uint16_t pport_cnt; /* number of public ports */ + uint16_t rport_cnt; /* number of remote ports */ + struct alias_link **alink; + u_int16_t spool_cnt; /* num of entry in spool chain */ + /* chain of spool instances */ + LIST_HEAD(spool_chain, cfg_spool) spool_chain; +}; + +/* Nat configuration data struct. */ +struct cfg_nat { + /* chain of nat instances */ + LIST_ENTRY(cfg_nat) _next; + int id; /* nat id */ + struct in_addr ip; /* nat ip address */ + struct libalias *lib; /* libalias instance */ + int mode; /* aliasing mode */ + int redir_cnt; /* number of entry in spool chain */ + /* chain of redir instances */ + LIST_HEAD(redir_chain, cfg_redir) redir_chain; + char if_name[IF_NAMESIZE]; /* interface name */ +}; + static eventhandler_tag ifaddr_event_tag; static void @@ -117,11 +154,11 @@ del_redir_spool_cfg(struct cfg_nat *n, s LIST_FOREACH_SAFE(r, head, _next, tmp_r) { num = 1; /* Number of alias_link to delete. */ switch (r->mode) { - case REDIR_PORT: + case NAT44_REDIR_PORT: num = r->pport_cnt; /* FALLTHROUGH */ - case REDIR_ADDR: - case REDIR_PROTO: + case NAT44_REDIR_ADDR: + case NAT44_REDIR_PROTO: /* Delete all libalias redirect entry. */ for (i = 0; i < num; i++) LibAliasRedirectDelete(n->lib, r->alink[i]); @@ -142,27 +179,41 @@ del_redir_spool_cfg(struct cfg_nat *n, s } } -static void +static int add_redir_spool_cfg(char *buf, struct cfg_nat *ptr) { - struct cfg_redir *r, *ser_r; - struct cfg_spool *s, *ser_s; + struct cfg_redir *r; + struct cfg_spool *s; + struct nat44_cfg_redir *ser_r; + struct nat44_cfg_spool *ser_s; + int cnt, off, i; for (cnt = 0, off = 0; cnt < ptr->redir_cnt; cnt++) { - ser_r = (struct cfg_redir *)&buf[off]; - r = malloc(SOF_REDIR, M_IPFW, M_WAITOK | M_ZERO); - memcpy(r, ser_r, SOF_REDIR); + ser_r = (struct nat44_cfg_redir *)&buf[off]; + r = malloc(sizeof(*r), M_IPFW, M_WAITOK | M_ZERO); + r->mode = ser_r->mode; + r->laddr = ser_r->laddr; + r->paddr = ser_r->paddr; + r->raddr = ser_r->raddr; + r->lport = ser_r->lport; + r->pport = ser_r->pport; + r->rport = ser_r->rport; + r->pport_cnt = ser_r->pport_cnt; + r->rport_cnt = ser_r->rport_cnt; + r->proto = ser_r->proto; + r->spool_cnt = ser_r->spool_cnt; + //memcpy(r, ser_r, SOF_REDIR); LIST_INIT(&r->spool_chain); - off += SOF_REDIR; + off += sizeof(struct nat44_cfg_redir); r->alink = malloc(sizeof(struct alias_link *) * r->pport_cnt, M_IPFW, M_WAITOK | M_ZERO); switch (r->mode) { - case REDIR_ADDR: + case NAT44_REDIR_ADDR: r->alink[0] = LibAliasRedirectAddr(ptr->lib, r->laddr, r->paddr); break; - case REDIR_PORT: + case NAT44_REDIR_PORT: for (i = 0 ; i < r->pport_cnt; i++) { /* If remotePort is all ports, set it to 0. */ u_short remotePortCopy = r->rport + i; @@ -178,7 +229,7 @@ add_redir_spool_cfg(char *buf, struct cf } } break; - case REDIR_PROTO: + case NAT44_REDIR_PROTO: r->alink[0] = LibAliasRedirectProto(ptr->lib ,r->laddr, r->raddr, r->paddr, r->proto); break; @@ -186,23 +237,27 @@ add_redir_spool_cfg(char *buf, struct cf printf("unknown redirect mode: %u\n", r->mode); break; } - /* XXX perhaps return an error instead of panic ? */ - if (r->alink[0] == NULL) - panic("LibAliasRedirect* returned NULL"); + if (r->alink[0] == NULL) { + printf("LibAliasRedirect* returned NULL\n"); + return (EINVAL); + } /* LSNAT handling. */ for (i = 0; i < r->spool_cnt; i++) { - ser_s = (struct cfg_spool *)&buf[off]; - s = malloc(SOF_REDIR, M_IPFW, M_WAITOK | M_ZERO); - memcpy(s, ser_s, SOF_SPOOL); + ser_s = (struct nat44_cfg_spool *)&buf[off]; + s = malloc(sizeof(*s), M_IPFW, M_WAITOK | M_ZERO); + s->addr = ser_s->addr; + s->port = ser_s->port; LibAliasAddServer(ptr->lib, r->alink[0], s->addr, htons(s->port)); - off += SOF_SPOOL; + off += sizeof(struct nat44_cfg_spool); /* Hook spool entry. */ LIST_INSERT_HEAD(&r->spool_chain, s, _next); } /* And finally hook this redir entry. */ LIST_INSERT_HEAD(&ptr->redir_chain, r, _next); } + + return (0); } /* @@ -392,60 +447,68 @@ lookup_nat(struct nat_list *l, int nat_i return res; } -static int -ipfw_nat_cfg(struct sockopt *sopt) +static struct cfg_nat * +lookup_nat_name(struct nat_list *l, char *name) { - struct cfg_nat *cfg, *ptr; - char *buf; - struct ip_fw_chain *chain = &V_layer3_chain; - size_t len; - int gencnt, error = 0; + struct cfg_nat *res; + int id; + char *errptr; - len = sopt->sopt_valsize; - buf = malloc(len, M_TEMP, M_WAITOK | M_ZERO); - if ((error = sooptcopyin(sopt, buf, len, sizeof(struct cfg_nat))) != 0) - goto out; + id = strtol(name, &errptr, 10); + if (id == 0 || *errptr != '\0') + return (NULL); - cfg = (struct cfg_nat *)buf; - if (cfg->id < 0) { - error = EINVAL; - goto out; + LIST_FOREACH(res, l, _next) { + if (res->id == id) + break; } + return (res); +} + +/* IP_FW3 configuration routines */ + +static void +nat44_config(struct ip_fw_chain *chain, struct nat44_cfg_nat *ucfg) +{ + struct cfg_nat *ptr, *tcfg; + int gencnt; /* * Find/create nat rule. */ - IPFW_WLOCK(chain); + IPFW_UH_WLOCK(chain); gencnt = chain->gencnt; - ptr = lookup_nat(&chain->nat, cfg->id); + ptr = lookup_nat_name(&chain->nat, ucfg->name); if (ptr == NULL) { - IPFW_WUNLOCK(chain); + IPFW_UH_WUNLOCK(chain); /* New rule: allocate and init new instance. */ ptr = malloc(sizeof(struct cfg_nat), M_IPFW, M_WAITOK | M_ZERO); ptr->lib = LibAliasInit(NULL); LIST_INIT(&ptr->redir_chain); } else { /* Entry already present: temporarily unhook it. */ + IPFW_WLOCK(chain); LIST_REMOVE(ptr, _next); - flush_nat_ptrs(chain, cfg->id); + flush_nat_ptrs(chain, ptr->id); IPFW_WUNLOCK(chain); + IPFW_UH_WUNLOCK(chain); } /* - * Basic nat configuration. + * Basic nat (re)configuration. */ - ptr->id = cfg->id; + ptr->id = strtol(ucfg->name, NULL, 10); /* * XXX - what if this rule doesn't nat any ip and just * redirect? * do we set aliasaddress to 0.0.0.0? */ - ptr->ip = cfg->ip; - ptr->redir_cnt = cfg->redir_cnt; - ptr->mode = cfg->mode; - LibAliasSetMode(ptr->lib, cfg->mode, ~0); + ptr->ip = ucfg->ip; + ptr->redir_cnt = ucfg->redir_cnt; + ptr->mode = ucfg->mode; + strlcpy(ptr->if_name, ucfg->if_name, sizeof(ptr->if_name)); + LibAliasSetMode(ptr->lib, ptr->mode, ~0); LibAliasSetAddress(ptr->lib, ptr->ip); - memcpy(ptr->if_name, cfg->if_name, IF_NAMESIZE); /* * Redir and LSNAT configuration. @@ -453,16 +516,455 @@ ipfw_nat_cfg(struct sockopt *sopt) /* Delete old cfgs. */ del_redir_spool_cfg(ptr, &ptr->redir_chain); /* Add new entries. */ - add_redir_spool_cfg(&buf[(sizeof(struct cfg_nat))], ptr); + add_redir_spool_cfg((char *)(ucfg + 1), ptr); + IPFW_UH_WLOCK(chain); - IPFW_WLOCK(chain); /* Extra check to avoid race with another ipfw_nat_cfg() */ - if (gencnt != chain->gencnt && - ((cfg = lookup_nat(&chain->nat, ptr->id)) != NULL)) - LIST_REMOVE(cfg, _next); + tcfg = NULL; + if (gencnt != chain->gencnt) + tcfg = lookup_nat_name(&chain->nat, ucfg->name); + IPFW_WLOCK(chain); + if (tcfg != NULL) + LIST_REMOVE(tcfg, _next); LIST_INSERT_HEAD(&chain->nat, ptr, _next); + IPFW_WUNLOCK(chain); chain->gencnt++; + + IPFW_UH_WUNLOCK(chain); + + if (tcfg != NULL) + free(tcfg, M_IPFW); +} + +/* + * Creates/configure nat44 instance + * Data layout (v0)(current): + * Request: [ ipfw_obj_header nat44_cfg_nat .. ] + * + * Returns 0 on success + */ +static int +nat44_cfg(struct ip_fw_chain *chain, ip_fw3_opheader *op3, + struct sockopt_data *sd) +{ + ipfw_obj_header *oh; + struct nat44_cfg_nat *ucfg; + int id; + size_t read; + char *errptr; + + /* Check minimum header size */ + if (sd->valsize < (sizeof(*oh) + sizeof(*ucfg))) + return (EINVAL); + + oh = (ipfw_obj_header *)sd->kbuf; + + /* Basic length checks for TLVs */ + if (oh->ntlv.head.length != sizeof(oh->ntlv)) + return (EINVAL); + + ucfg = (struct nat44_cfg_nat *)(oh + 1); + + /* Check if name is properly terminated and looks like number */ + if (strnlen(ucfg->name, sizeof(ucfg->name)) == sizeof(ucfg->name)) + return (EINVAL); + id = strtol(ucfg->name, &errptr, 10); + if (id == 0 || *errptr != '\0') + return (EINVAL); + + read = sizeof(*oh) + sizeof(*ucfg); + /* Check number of redirs */ + if (sd->valsize < read + ucfg->redir_cnt*sizeof(struct nat44_cfg_redir)) + return (EINVAL); + + nat44_config(chain, ucfg); + return (0); +} + +/* + * Destroys given nat instances. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Mon Sep 8 00:16:35 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A47477F9; Mon, 8 Sep 2014 00:16:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 846571F02; Mon, 8 Sep 2014 00:16:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s880GZ0q098791; Mon, 8 Sep 2014 00:16:35 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s880GYAl098788; Mon, 8 Sep 2014 00:16:34 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201409080016.s880GYAl098788@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Mon, 8 Sep 2014 00:16:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271242 - in projects/vxlan: sbin/ifconfig share/man/man4 X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Sep 2014 00:16:35 -0000 Author: bryanv Date: Mon Sep 8 00:16:34 2014 New Revision: 271242 URL: http://svnweb.freebsd.org/changeset/base/271242 Log: Add initial man pages for vxlan Added: projects/vxlan/share/man/man4/vxlan.4 (contents, props changed) Modified: projects/vxlan/sbin/ifconfig/ifconfig.8 projects/vxlan/share/man/man4/Makefile Modified: projects/vxlan/sbin/ifconfig/ifconfig.8 ============================================================================== --- projects/vxlan/sbin/ifconfig/ifconfig.8 Sun Sep 7 22:56:57 2014 (r271241) +++ projects/vxlan/sbin/ifconfig/ifconfig.8 Mon Sep 8 00:16:34 2014 (r271242) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd June 5, 2014 +.Dd September 7, 2014 .Dt IFCONFIG 8 .Os .Sh NAME @@ -2491,6 +2491,76 @@ argument is useless and hence deprecated .El .Pp The following parameters are used to configure +.Xr vxlan 4 +interfaces. +.Bl -tag -width indent +.It Cm vni Ar identifier +This value is a 16-bit VXLAN Network Identifier (VNI) that identifies the +virtual network segment membership of the interface. +.It Cm local Ar address +The source address used in the encapsulating IPv4/IPv6 header. +The address should already be assigned to an existing interface. +When the interface is configured in unicast mode, the listening socket +is bound to this address. +.It Cm remote Ar address +The interface can be configured in a unicast, or point-to-point, mode +to create a tunnel between two hosts. +This is the IP address of the remote end of the tunnel. +.It Cm group Ar address +The interface can be configured in a multicast mode +to create a virtual network of hosts. +This is the IP multicast group address the interface will join. +.It Cm localport Ar port +The port number the interface will listen on. +The default port number is 4789. +.It Cm remoteport Ar port +The destination port number used in the encapsulating IPv4/IPv6 header. +The remote host should be listening on this port. +The default port number is 4789. +Note some other implementations, such as Linux, +do not default to the IANA assigned port, +but instead listen on port 8472. +.It Cm portrange Ar low high +The range of source ports used in the encapsulating IPv4/IPv6 header. +The port selected within the range is based on a hash of the inner frame. +A range is useful to provide entropy within the outer IP header +for more effective load balancing. +The default range is between the +.Xr sysctl 8 +variables +.Va net.inet.ip.portrange.first +and +.Va net.inet.ip.portrange.last +.It Cm timeout Ar timeout +The maximum time, in seconds, before an entry in the forwarding table +is pruned. +The default is 1200 seconds (20 minutes). +.It Cm maxaddr Ar max +The maximum number of entries in the forwarding table. +The default is 2000. +.It Cm vxlandev Ar dev +When the interface is configured in multicast mode, the +.Ar Cm dev +interface is used to transmit IP multicast packets. +.It Cm ttl Ar ttl +The TTL used in the encapsulating IPv4/IPv6 header. +The default is 64. +.It Cm learn +The source IP address and inner source Ethernet MAC address of +received packets are used to dynamically populate the forwarding table. +When in multicast mode, an entry in the forwarding table allows the +interface to send the frame directly to the remote host instead of +broadcasting the frame to the multicast group. +This is the default. +.It Fl learn +The forwarding table is not populated by recevied packets. +.It Cm flush +Delete all dynamically-learned addresses from the forwarding table. +.It Cm flushall +Delete all addresses, including static addresses, from the forwarding table. +.El +.Pp +The following parameters are used to configure .Xr carp 4 protocol on an interface: .Bl -tag -width indent @@ -2695,6 +2765,7 @@ tried to alter an interface's configurat .Xr pfsync 4 , .Xr polling 4 , .Xr vlan 4 , +.Xr vxlan 4 , .Xr devd.conf 5 , .\" .Xr eon 5 , .Xr devd 8 , Modified: projects/vxlan/share/man/man4/Makefile ============================================================================== --- projects/vxlan/share/man/man4/Makefile Sun Sep 7 22:56:57 2014 (r271241) +++ projects/vxlan/share/man/man4/Makefile Mon Sep 8 00:16:34 2014 (r271242) @@ -563,6 +563,7 @@ MAN= aac.4 \ ${_virtio_scsi.4} \ vkbd.4 \ vlan.4 \ + vxlan.4 \ ${_vmx.4} \ vpo.4 \ vr.4 \ Added: projects/vxlan/share/man/man4/vxlan.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/vxlan/share/man/man4/vxlan.4 Mon Sep 8 00:16:34 2014 (r271242) @@ -0,0 +1,203 @@ +.\" Copyright (c) 2014 Bryan Venteicher +.\" 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$ +.\" +.Dd September 7, 2014 +.Dt VXLAN 4 +.Os +.Sh NAME +.Nm vxlan +.Nd "Virtual eXtensible LAN interface" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device vxlan" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_vxlan_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver creates a virtual tunnel endpoint in a +.Nm +segment. +A +.Nm +segment is a virtual Layer 2 (Ethernet) network that is overlaid +in a Layer 3 (IP/UDP) network. +.Nm +is analogous to +.Xr vlan 4 +but is designed to be better suited for large, multiple tenant +data center environments. +.Pp +Each +.Nm +interface is created at runtime using interface cloning. +This is most easily done with the +.Xr ifconfig 8 +.Cm create +command or using the +.Va cloned_interfaces +variable in +.Xr rc.conf 5 . +The interface may be removed with the +.Xr ifconfig 8 +.Cm destroy +command. +.Pp +The +.Nm +driver creates a pseudo Ethernet network interface +that supports the usual network +.Xr ioctl 2 Ns s +and is thus can be used with +.Xr ifconfig 8 . +like any other Ethernet interface. +The +.Nm +interface encapsulates the Ethernet frame +by prepending IP/UDP and +.Nm +headers. +Thus, the encapsulated (inner) frame is able to transmitted +over a routed, Layer 3 network to the remote host. +.Pp +The +.Nm +interface may be configured in either unicast or multicast mode. +When in unicast mode, +the interface creates a tunnel to a single remote host, +and all traffic is transmitted to that host. +When in multicast mode, +the interface joins an IP multicast group, +and receives packets sent to the group address, +and transmits packets to either the multicast group address, +or directly the remote host if there is an appropriate +forwarding table entry. +.Pp +When the +.Nm +interface is brought up, a +.Xr UDP 4 +.Xr socket 9 +is created based on the configuration, +such as the local address for unicast mode or +the group address for multicast mode, +and the listening (local) port number. +Since multiple +.Nm +interfaces may be created that either +use the same local address +or join the same group address, +and use the same port, +the driver may share a socket among multiple interfaces. +However, each interface within a socket must belong to +a unique +.Nm +segment. +The analogous +.Xr vlan 4 +configuration would be a physical interface configured as +the parent device for multiple VLAN interfaces, each with +a unique VLAN tag. +Each +.Nm +segment is identified by a 24-bit value in the +.Nm +header called the +.Dq VXLAN Network Identifier , +or VNI. +.Pp +When configured with the +.Xr ifconfig 8 +.Cm learn +parameter, the interface dynamically creates forwarding table entries +from received packets. +An entry in the forwarding table maps the inner source MAC address +to the outer remote IP address. +During transmit, the interface attempts to lookup an entry for +the encapsulated destination MAC address. +If an entry is found, the IP address in the entry is used to directly +transmit the encapsulated frame to the destination. +Otherwise, when configured in multicast mode, +the interface must flood the frame to all hosts in the group. +The maximum number of entries in the table is configurable with the +.Xr ifconfig 8 +.Cm maxaddr +command. +Stale entries in the table periodically pruned. +The timeout is configurable with the +.Xr ifconfig 8 +.Cm timeout +command. +The table may be viewed with the +.Xr sysctl 8 +.Cm net.link.vlxan.N.ftable.dump +command. +.Sh MTU +Since the +.Nm +interface encapsulates the Ethernet frame with an IP, UDP, and +.Nm +header, the resulting frame may be larger than the MTU of the +physical network. +The +.Nm +specification recommends the physical network MTU be configured +to use jumbo frames to accommodate the encapsulated frame size. +Alternatively, the +.Xr ifconfig 8 +.Cm mtu +command may be used to reduce the MTU size on the +.Nm +interface to allow the encapsulated frame to fit in the +physical network current MTU. +.Sh SEE ALSO +.Xr ifconfig 8 , +.Xr inet 4 , +.Xr inet 6 , +.Xr sysctl 8 , +.Xr vlan 8 +.Rs +.%A "M. Mahalingam" +.%A "et al" +.%T "Virtual eXtensible Local Area Network (VXLAN): A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks" +.%D August 2014 +.%O "RFC 7348" +.Re +.Sh AUTHOR +.An -nosplit +The +.Nm +driver was written by +.An Bryan Venteicher Aq bryanv@freebsd.org . From owner-svn-src-projects@FreeBSD.ORG Tue Sep 9 23:39:44 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 610848C1; Tue, 9 Sep 2014 23:39:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 4C640A37; Tue, 9 Sep 2014 23:39:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s89Ndi5S062747; Tue, 9 Sep 2014 23:39:44 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s89Ndiqm062746; Tue, 9 Sep 2014 23:39:44 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201409092339.s89Ndiqm062746@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Tue, 9 Sep 2014 23:39:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271340 - projects/bhyve_svm/sys/amd64/vmm/amd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Sep 2014 23:39:44 -0000 Author: neel Date: Tue Sep 9 23:39:43 2014 New Revision: 271340 URL: http://svnweb.freebsd.org/changeset/base/271340 Log: Remove gratuitous forward declarations. Remove tabs on empty lines. Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Tue Sep 9 23:31:30 2014 (r271339) +++ projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Tue Sep 9 23:39:43 2014 (r271340) @@ -89,11 +89,6 @@ MALLOC_DEFINE(M_SVM_VLAPIC, "svm-vlapic" /* Per-CPU context area. */ extern struct pcpu __pcpu[]; -static bool svm_vmexit(struct svm_softc *svm_sc, int vcpu, - struct vm_exit *vmexit); -static int svm_msr_rw_ok(uint8_t *btmap, uint64_t msr); -static int svm_msr_rd_ok(uint8_t *btmap, uint64_t msr); -static int svm_msr_index(uint64_t msr, int *index, int *bit); static int svm_getdesc(void *arg, int vcpu, int type, struct seg_desc *desc); static uint32_t svm_feature; /* AMD SVM features. */ @@ -124,7 +119,7 @@ static int cpu_svm_enable_disable(boolean_t enable) { uint64_t efer_msr; - + efer_msr = rdmsr(MSR_EFER); if (enable) @@ -205,10 +200,10 @@ svm_cpuid_features(void) printf("Missing Nested paging or RVI SVM support in processor.\n"); return (EIO); } - + if (svm_feature & AMD_CPUID_SVM_NRIP_SAVE) return (0); - + return (EIO); } @@ -230,7 +225,7 @@ svm_enable(void *arg __unused) hsave_pa = vtophys(hsave[curcpu]); wrmsr(MSR_VM_HSAVE_PA, hsave_pa); - + if (rdmsr(MSR_VM_HSAVE_PA) != hsave_pa) { panic("VM_HSAVE_PA is wrong on CPU%d\n", curcpu); } @@ -271,7 +266,7 @@ svm_init(int ipinum) err = is_svm_enabled(); if (err) return (err); - + for (cpu = 0; cpu < MAXCPU; cpu++) { /* * Initialize the host ASIDs to their "highest" valid values. @@ -284,7 +279,7 @@ svm_init(int ipinum) } svm_npt_init(ipinum); - + /* Start SVM on all CPUs */ smp_rendezvous(NULL, svm_enable, NULL, NULL); @@ -296,6 +291,7 @@ svm_restore(void) { svm_enable(NULL); } + /* * Get index and bit position for a MSR in MSR permission * bitmap. Two bits are used for each MSR, lower bit is @@ -315,7 +311,7 @@ svm_msr_index(uint64_t msr, int *index, /* AMD 7th and 8th generation compatible MSRs */ #define MSR_AMD7TH_START 0xC0010000UL #define MSR_AMD7TH_END 0xC0011FFFUL - + *index = -1; *bit = (msr % 4) * 2; base = 0; @@ -324,14 +320,14 @@ svm_msr_index(uint64_t msr, int *index, *index = msr / 4; return (0); } - + base += (MSR_PENTIUM_END - MSR_PENTIUM_START + 1); if (msr >= MSR_AMD6TH_START && msr <= MSR_AMD6TH_END) { off = (msr - MSR_AMD6TH_START); *index = (off + base) / 4; return (0); } - + base += (MSR_AMD6TH_END - MSR_AMD6TH_START + 1); if (msr >= MSR_AMD7TH_START && msr <= MSR_AMD7TH_END) { off = (msr - MSR_AMD7TH_START); @@ -355,7 +351,7 @@ svm_msr_perm(uint8_t *perm_bitmap, uint6 ERR("MSR 0x%lx is not writeable by guest.\n", msr); return (err); } - + if (index < 0 || index > (SVM_MSR_BITMAP_SIZE)) { ERR("MSR 0x%lx index out of range(%d).\n", msr, index); return (EINVAL); @@ -372,7 +368,7 @@ svm_msr_perm(uint8_t *perm_bitmap, uint6 perm_bitmap[index] &= ~(2UL << bit); CTR2(KTR_VMM, "Guest has control:0x%x on SVM:MSR(0x%lx).\n", (perm_bitmap[index] >> bit) & 0x3, msr); - + return (0); } From owner-svn-src-projects@FreeBSD.ORG Wed Sep 10 01:10:53 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9FA87FA0; Wed, 10 Sep 2014 01:10:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 8AAEC300; Wed, 10 Sep 2014 01:10:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8A1ArbM006484; Wed, 10 Sep 2014 01:10:53 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8A1Are1006483; Wed, 10 Sep 2014 01:10:53 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201409100110.s8A1Are1006483@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Wed, 10 Sep 2014 01:10:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271342 - projects/bhyve_svm/sys/amd64/vmm/amd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Sep 2014 01:10:53 -0000 Author: neel Date: Wed Sep 10 01:10:53 2014 New Revision: 271342 URL: http://svnweb.freebsd.org/changeset/base/271342 Log: Allow guest read access to MSR_EFER without hypervisor intervention. Dirty the VMCB_CACHE_CR state cache when MSR_EFER is modified. Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Wed Sep 10 00:19:33 2014 (r271341) +++ projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Wed Sep 10 01:10:53 2014 (r271342) @@ -385,8 +385,12 @@ svm_msr_rd_ok(uint8_t *perm_bitmap, uint } static __inline void -vcpu_set_dirty(struct svm_vcpu *vcpustate, uint32_t dirtybits) +vcpu_set_dirty(struct svm_softc *sc, int vcpu, uint32_t dirtybits) { + struct svm_vcpu *vcpustate; + + vcpustate = svm_get_vcpu(sc, vcpu); + vcpustate->dirty |= dirtybits; } @@ -434,6 +438,7 @@ svm_vminit(struct vm *vm, pmap_t pmap) svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_PAT); svm_msr_rd_ok(svm_sc->msr_bitmap, MSR_TSC); + svm_msr_rd_ok(svm_sc->msr_bitmap, MSR_EFER); /* Intercept access to all I/O ports. */ memset(svm_sc->iopm_bitmap, 0xFF, sizeof(svm_sc->iopm_bitmap)); @@ -682,25 +687,23 @@ svm_handle_inst_emul(struct vmcb *vmcb, } /* - * Special handling of EFER MSR. - * SVM guest must have SVM EFER bit set, prohibit guest from cleareing SVM - * enable bit in EFER. + * Intercept access to MSR_EFER to prevent the guest from clearing the + * SVM enable bit. */ static void -svm_efer(struct svm_softc *svm_sc, int vcpu, boolean_t write) +svm_write_efer(struct svm_softc *sc, int vcpu, uint32_t edx, uint32_t eax) { - struct svm_regctx *swctx; struct vmcb_state *state; - - state = svm_get_vmcb_state(svm_sc, vcpu); - swctx = svm_get_guest_regctx(svm_sc, vcpu); + uint64_t oldval; - if (write) { - state->efer = ((swctx->e.g.sctx_rdx & (uint32_t)~0) << 32) | - ((uint32_t)state->rax) | EFER_SVM; - } else { - state->rax = (uint32_t)state->efer; - swctx->e.g.sctx_rdx = (uint32_t)(state->efer >> 32); + state = svm_get_vmcb_state(sc, vcpu); + + oldval = state->efer; + state->efer = (uint64_t)edx << 32 | eax | EFER_SVM; + if (state->efer != oldval) { + VCPU_CTR2(sc->vm, vcpu, "Guest EFER changed from %#lx to %#lx", + oldval, state->efer); + vcpu_set_dirty(sc, vcpu, VMCB_CACHE_CR); } } @@ -775,8 +778,10 @@ svm_vmexit(struct svm_softc *svm_sc, int edx = ctx->e.g.sctx_rdx; if (ecx == MSR_EFER) { - VCPU_CTR0(svm_sc->vm, vcpu,"VMEXIT EFER\n"); - svm_efer(svm_sc, vcpu, info1); + KASSERT(info1 != 0, ("rdmsr(MSR_EFER) is not " + "emulated: info1(%#lx) info2(%#lx)", + info1, info2)); + svm_write_efer(svm_sc, vcpu, edx, eax); break; } @@ -1186,7 +1191,7 @@ check_asid(struct svm_softc *sc, int vcp vcpustate->asid.num = asid[thiscpu].num; ctrl->asid = vcpustate->asid.num; - vcpu_set_dirty(vcpustate, VMCB_CACHE_ASID); + vcpu_set_dirty(sc, vcpuid, VMCB_CACHE_ASID); /* * If this cpu supports "flush-by-asid" then the TLB * was not flushed after the generation bump. The TLB @@ -1253,7 +1258,7 @@ svm_vmrun(void *arg, int vcpu, register_ /* * Invalidate the VMCB state cache by marking all fields dirty. */ - vcpu_set_dirty(vcpustate, 0xffffffff); + vcpu_set_dirty(svm_sc, vcpu, 0xffffffff); /* * XXX From owner-svn-src-projects@FreeBSD.ORG Wed Sep 10 01:37:33 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 18B444AA; Wed, 10 Sep 2014 01:37:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 EBF4F7E8; Wed, 10 Sep 2014 01:37:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8A1bWfn020087; Wed, 10 Sep 2014 01:37:32 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8A1bWbi020084; Wed, 10 Sep 2014 01:37:32 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201409100137.s8A1bWbi020084@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Wed, 10 Sep 2014 01:37:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271343 - projects/bhyve_svm/sys/amd64/vmm/amd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Sep 2014 01:37:33 -0000 Author: neel Date: Wed Sep 10 01:37:32 2014 New Revision: 271343 URL: http://svnweb.freebsd.org/changeset/base/271343 Log: Make the KTR tracepoints uniform and ensure that every VM-exit is logged. Discussed with: Anish Gupta (akgupt3@gmail.com) Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c projects/bhyve_svm/sys/amd64/vmm/amd/svm_softc.h projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Wed Sep 10 01:10:53 2014 (r271342) +++ projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Wed Sep 10 01:37:32 2014 (r271343) @@ -730,6 +730,42 @@ svm_save_intinfo(struct svm_softc *svm_s vm_exit_intinfo(svm_sc->vm, vcpu, intinfo); } +#ifdef KTR +static const char * +exit_reason_to_str(uint64_t reason) +{ + static char reasonbuf[32]; + + switch (reason) { + case VMCB_EXIT_INVALID: + return ("invalvmcb"); + case VMCB_EXIT_SHUTDOWN: + return ("shutdown"); + case VMCB_EXIT_NPF: + return ("nptfault"); + case VMCB_EXIT_PAUSE: + return ("pause"); + case VMCB_EXIT_HLT: + return ("hlt"); + case VMCB_EXIT_CPUID: + return ("cpuid"); + case VMCB_EXIT_IO: + return ("inout"); + case VMCB_EXIT_MC: + return ("mchk"); + case VMCB_EXIT_INTR: + return ("extintr"); + case VMCB_EXIT_VINTR: + return ("vintr"); + case VMCB_EXIT_MSR: + return ("msr"); + default: + snprintf(reasonbuf, sizeof(reasonbuf), "%#lx", reason); + return (reasonbuf); + } +} +#endif /* KTR */ + /* * Determine the cause of virtual cpu exit and handle VMEXIT. * Return: false - Break vcpu execution loop and handle vmexit @@ -760,6 +796,8 @@ svm_vmexit(struct svm_softc *svm_sc, int vmexit->exitcode = VM_EXITCODE_VMX; vmexit->u.vmx.status = 0; + vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_COUNT, 1); + KASSERT((ctrl->eventinj & VMCB_EVENTINJ_VALID) == 0, ("%s: event " "injection valid bit is set %#lx", __func__, ctrl->eventinj)); @@ -776,7 +814,7 @@ svm_vmexit(struct svm_softc *svm_sc, int eax = state->rax; ecx = ctx->sctx_rcx; edx = ctx->e.g.sctx_rdx; - + if (ecx == MSR_EFER) { KASSERT(info1 != 0, ("rdmsr(MSR_EFER) is not " "emulated: info1(%#lx) info2(%#lx)", @@ -836,8 +874,6 @@ svm_vmexit(struct svm_softc *svm_sc, int * interrupt, local APIC will inject event in guest. */ update_rip = false; - VCPU_CTR1(svm_sc->vm, vcpu, "SVM:VMEXIT ExtInt" - " RIP:0x%lx.\n", state->rip); vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_EXTINT, 1); break; @@ -853,29 +889,16 @@ svm_vmexit(struct svm_softc *svm_sc, int (uint32_t *)&ctx->sctx_rbx, (uint32_t *)&ctx->sctx_rcx, (uint32_t *)&ctx->e.g.sctx_rdx); - VCPU_CTR0(svm_sc->vm, vcpu, "SVM:VMEXIT CPUID\n"); break; case VMCB_EXIT_HLT: vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_HLT, 1); - if (ctrl->v_irq) { - /* Interrupt is pending, can't halt guest. */ - vmm_stat_incr(svm_sc->vm, vcpu, - VMEXIT_HLT_IGNORED, 1); - VCPU_CTR0(svm_sc->vm, vcpu, - "VMEXIT halt ignored."); - } else { - VCPU_CTR0(svm_sc->vm, vcpu, - "VMEXIT halted CPU."); - vmexit->exitcode = VM_EXITCODE_HLT; - vmexit->u.hlt.rflags = state->rflags; - loop = false; - - } + vmexit->exitcode = VM_EXITCODE_HLT; + vmexit->u.hlt.rflags = state->rflags; + loop = false; break; case VMCB_EXIT_PAUSE: - VCPU_CTR0(svm_sc->vm, vcpu, "SVM:VMEXIT pause"); vmexit->exitcode = VM_EXITCODE_PAUSE; vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_PAUSE, 1); @@ -893,36 +916,33 @@ svm_vmexit(struct svm_softc *svm_sc, int break; } - /* EXITINFO2 has the physical fault address (GPA). */ + /* EXITINFO2 has the physical fault address (GPA). */ if(vm_mem_allocated(svm_sc->vm, info2)) { - VCPU_CTR3(svm_sc->vm, vcpu, "SVM:NPF-paging," - "RIP:0x%lx INFO1:0x%lx INFO2:0x%lx .\n", - state->rip, info1, info2); vmexit->exitcode = VM_EXITCODE_PAGING; vmexit->u.paging.gpa = info2; vmexit->u.paging.fault_type = svm_npf_paging(info1); vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_NESTED_FAULT, 1); + VCPU_CTR3(svm_sc->vm, vcpu, "nested page fault " + "on gpa %#lx/%#lx at rip %#lx", + info2, info1, state->rip); } else if (svm_npf_emul_fault(info1)) { - VCPU_CTR3(svm_sc->vm, vcpu, "SVM:NPF inst_emul," - "RIP:0x%lx INFO1:0x%lx INFO2:0x%lx .\n", - state->rip, info1, info2); svm_handle_inst_emul(svm_get_vmcb(svm_sc, vcpu), info2, vmexit); - vmm_stat_incr(svm_sc->vm, vcpu, - VMEXIT_INST_EMUL, 1); + vmm_stat_incr(svm_sc->vm, vcpu, + VMEXIT_INST_EMUL, 1); + VCPU_CTR3(svm_sc->vm, vcpu, "inst_emul fault " + "for gpa %#lx/%#lx at rip %#lx", + info2, info1, state->rip); } - break; case VMCB_EXIT_SHUTDOWN: - VCPU_CTR0(svm_sc->vm, vcpu, "SVM:VMEXIT shutdown."); loop = false; break; case VMCB_EXIT_INVALID: - VCPU_CTR0(svm_sc->vm, vcpu, "SVM:VMEXIT INVALID."); loop = false; break; @@ -940,6 +960,10 @@ svm_vmexit(struct svm_softc *svm_sc, int break; } + VCPU_CTR4(svm_sc->vm, vcpu, "%s %s vmexit at %#lx nrip %#lx", + loop ? "handled" : "unhandled", exit_reason_to_str(code), + state->rip, update_rip ? ctrl->nrip : state->rip); + vmexit->rip = state->rip; if (update_rip) { if (ctrl->nrip == 0) { @@ -1274,10 +1298,6 @@ svm_vmrun(void *arg, int vcpu, register_ vmm_stat_incr(vm, vcpu, VCPU_MIGRATIONS, 1); } - VCPU_CTR3(vm, vcpu, "SVM:Enter vmrun RIP:0x%lx" - " inst len=%d/%d\n", - rip, vmexit->inst_length, - vmexit->u.inst_emul.vie.num_valid); /* Update Guest RIP */ state->rip = rip; @@ -1301,23 +1321,14 @@ svm_vmrun(void *arg, int vcpu, register_ if (vcpu_rendezvous_pending(rend_cookie)) { enable_gintr(); - vmexit->exitcode = VM_EXITCODE_RENDEZVOUS; - vmm_stat_incr(vm, vcpu, VMEXIT_RENDEZVOUS, 1); - VCPU_CTR1(vm, vcpu, - "SVM: VCPU rendezvous, RIP:0x%lx\n", - state->rip); - vmexit->rip = state->rip; + vm_exit_rendezvous(vm, vcpu, state->rip); break; } /* We are asked to give the cpu by scheduler. */ if (curthread->td_flags & (TDF_ASTPENDING | TDF_NEEDRESCHED)) { enable_gintr(); - vmexit->exitcode = VM_EXITCODE_BOGUS; - vmm_stat_incr(vm, vcpu, VMEXIT_ASTPENDING, 1); - VCPU_CTR1(vm, vcpu, - "SVM: ASTPENDING, RIP:0x%lx\n", state->rip); - vmexit->rip = state->rip; + vm_exit_astpending(vm, vcpu, state->rip); break; } @@ -1334,8 +1345,10 @@ svm_vmrun(void *arg, int vcpu, register_ ctrl->vmcb_clean = VMCB_CACHE_DEFAULT & ~vcpustate->dirty; vcpustate->dirty = 0; + VCPU_CTR1(vm, vcpu, "vmcb clean %#x", ctrl->vmcb_clean); /* Launch Virtual Machine. */ + VCPU_CTR1(vm, vcpu, "Resume execution at %#lx", state->rip); svm_launch(vmcb_pa, gctx, hctx); CPU_CLR_ATOMIC(thiscpu, &pmap->pm_active); @@ -1366,10 +1379,8 @@ svm_vmrun(void *arg, int vcpu, register_ /* Handle #VMEXIT and if required return to user space. */ loop = svm_vmexit(svm_sc, vcpu, vmexit); - vcpustate->loop++; - vmm_stat_incr(vm, vcpu, VMEXIT_COUNT, 1); } while (loop); - + return (0); } Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm_softc.h ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/svm_softc.h Wed Sep 10 01:10:53 2014 (r271342) +++ projects/bhyve_svm/sys/amd64/vmm/amd/svm_softc.h Wed Sep 10 01:37:32 2014 (r271343) @@ -44,7 +44,6 @@ struct svm_vcpu { struct vmcb vmcb; /* hardware saved vcpu context */ struct svm_regctx swctx; /* software saved vcpu context */ uint64_t vmcb_pa; /* VMCB physical address */ - uint64_t loop; /* loop count for vcpu */ int lastcpu; /* host cpu that the vcpu last ran on */ uint32_t dirty; /* state cache bits that must be cleared */ long eptgen; /* pmap->pm_eptgen when the vcpu last ran */ Modified: projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Wed Sep 10 01:10:53 2014 (r271342) +++ projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Wed Sep 10 01:37:32 2014 (r271343) @@ -117,6 +117,7 @@ /* VMCB exit code, APM vol2 Appendix C */ #define VMCB_EXIT_MC 0x52 #define VMCB_EXIT_INTR 0x60 +#define VMCB_EXIT_VINTR 0x64 #define VMCB_EXIT_PUSHF 0x70 #define VMCB_EXIT_POPF 0x71 #define VMCB_EXIT_CPUID 0x72 From owner-svn-src-projects@FreeBSD.ORG Wed Sep 10 01:46:23 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 10D826E4; Wed, 10 Sep 2014 01:46:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 F03DE8B0; Wed, 10 Sep 2014 01:46:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8A1kMXF024544; Wed, 10 Sep 2014 01:46:22 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8A1kMbZ024542; Wed, 10 Sep 2014 01:46:22 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201409100146.s8A1kMbZ024542@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Wed, 10 Sep 2014 01:46:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271344 - projects/bhyve_svm/sys/amd64/vmm/amd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Sep 2014 01:46:23 -0000 Author: neel Date: Wed Sep 10 01:46:22 2014 New Revision: 271344 URL: http://svnweb.freebsd.org/changeset/base/271344 Log: Remove a bogus check that flagged an error if the guest %rip was zero. An AP begins execution with %rip set to 0 after a startup IPI. Discussed with: Anish Gupta (akgupt3@gmail.com) Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Wed Sep 10 01:37:32 2014 (r271343) +++ projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Wed Sep 10 01:46:22 2014 (r271344) @@ -979,11 +979,6 @@ svm_vmexit(struct svm_softc *svm_sc, int state->rip = vmexit->rip; } - if (state->rip == 0) { - VCPU_CTR0(svm_sc->vm, vcpu, "SVM_ERR:RIP is NULL\n"); - vmexit->exitcode = VM_EXITCODE_VMX; - } - return (loop); } From owner-svn-src-projects@FreeBSD.ORG Wed Sep 10 02:20:33 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA417D8F; Wed, 10 Sep 2014 02:20:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 8A058B3E; Wed, 10 Sep 2014 02:20:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8A2KXN9039375; Wed, 10 Sep 2014 02:20:33 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8A2KW6T039372; Wed, 10 Sep 2014 02:20:33 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201409100220.s8A2KW6T039372@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Wed, 10 Sep 2014 02:20:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271345 - projects/bhyve_svm/sys/amd64/vmm/amd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Sep 2014 02:20:33 -0000 Author: neel Date: Wed Sep 10 02:20:32 2014 New Revision: 271345 URL: http://svnweb.freebsd.org/changeset/base/271345 Log: Move the event injection function into svm.c and add KTR logging for every event injection. This in in preparation for changes to SVM guest interrupt injection. Discussed with: Anish Gupta (akgupt3@gmail.com) Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Wed Sep 10 01:46:22 2014 (r271344) +++ projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Wed Sep 10 02:20:32 2014 (r271345) @@ -707,6 +707,67 @@ svm_write_efer(struct svm_softc *sc, int } } +#ifdef KTR +static const char * +intrtype_to_str(int intr_type) +{ + switch (intr_type) { + case VMCB_EVENTINJ_TYPE_INTR: + return ("hwintr"); + case VMCB_EVENTINJ_TYPE_NMI: + return ("nmi"); + case VMCB_EVENTINJ_TYPE_INTn: + return ("swintr"); + case VMCB_EVENTINJ_TYPE_EXCEPTION: + return ("exception"); + default: + panic("%s: unknown intr_type %d", __func__, intr_type); + } +} +#endif + +/* + * Inject an event to vcpu as described in section 15.20, "Event injection". + */ +static void +svm_eventinject(struct svm_softc *sc, int vcpu, int intr_type, int vector, + uint32_t error, bool ec_valid) +{ + struct vmcb_ctrl *ctrl; + + ctrl = svm_get_vmcb_ctrl(sc, vcpu); + + KASSERT((ctrl->eventinj & VMCB_EVENTINJ_VALID) == 0, + ("%s: event already pending %#lx", __func__, ctrl->eventinj)); + + KASSERT(vector >=0 && vector <= 255, ("%s: invalid vector %d", + __func__, vector)); + + switch (intr_type) { + case VMCB_EVENTINJ_TYPE_INTR: + case VMCB_EVENTINJ_TYPE_NMI: + case VMCB_EVENTINJ_TYPE_INTn: + break; + case VMCB_EVENTINJ_TYPE_EXCEPTION: + if (vector >= 0 && vector <= 31 && vector != 2) + break; + /* FALLTHROUGH */ + default: + panic("%s: invalid intr_type/vector: %d/%d", __func__, + intr_type, vector); + } + ctrl->eventinj = vector | (intr_type << 8) | VMCB_EVENTINJ_VALID; + if (ec_valid) { + ctrl->eventinj |= VMCB_EVENTINJ_EC_VALID; + ctrl->eventinj |= (uint64_t)error << 32; + VCPU_CTR3(sc->vm, vcpu, "Injecting %s at vector %d errcode %#x", + intrtype_to_str(intr_type), vector, error); + } else { + VCPU_CTR2(sc->vm, vcpu, "Injecting %s at vector %d", + intrtype_to_str(intr_type), vector); + } +} + static void svm_save_intinfo(struct svm_softc *svm_sc, int vcpu) { @@ -998,7 +1059,8 @@ svm_inject_nmi(struct svm_softc *svm_sc, return (0); /* Inject NMI, vector number is not used.*/ - vmcb_eventinject(ctrl, VMCB_EVENTINJ_TYPE_NMI, IDT_NMI, 0, false); + svm_eventinject(svm_sc, vcpu, VMCB_EVENTINJ_TYPE_NMI, IDT_NMI, 0, + false); /* Acknowledge the request is accepted.*/ vm_nmi_clear(svm_sc->vm, vcpu); @@ -1011,18 +1073,15 @@ svm_inject_nmi(struct svm_softc *svm_sc, static void svm_inj_intinfo(struct svm_softc *svm_sc, int vcpu) { - struct vmcb_ctrl *ctrl; uint64_t intinfo; - ctrl = svm_get_vmcb_ctrl(svm_sc, vcpu); - if (!vm_entry_intinfo(svm_sc->vm, vcpu, &intinfo)) return; KASSERT(VMCB_EXITINTINFO_VALID(intinfo), ("%s: entry intinfo is not " "valid: %#lx", __func__, intinfo)); - vmcb_eventinject(ctrl, VMCB_EXITINTINFO_TYPE(intinfo), + svm_eventinject(svm_sc, vcpu, VMCB_EXITINTINFO_TYPE(intinfo), VMCB_EXITINTINFO_VECTOR(intinfo), VMCB_EXITINTINFO_EC(intinfo), VMCB_EXITINTINFO_EC_VALID(intinfo)); @@ -1089,7 +1148,8 @@ svm_inj_interrupts(struct svm_softc *svm return; } - vmcb_eventinject(ctrl, VMCB_EVENTINJ_TYPE_INTR, vector, 0, false); + svm_eventinject(svm_sc, vcpu, VMCB_EVENTINJ_TYPE_INTR, vector, 0, + false); if (!extint_pending) { /* Update the Local APIC ISR */ Modified: projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c Wed Sep 10 01:46:22 2014 (r271344) +++ projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c Wed Sep 10 02:20:32 2014 (r271345) @@ -352,36 +352,3 @@ vmcb_seg(struct vmcb *vmcb, int type) return (seg); } - -/* - * Inject an event to vcpu as described in section 15.20, "Event injection". - */ -void -vmcb_eventinject(struct vmcb_ctrl *ctrl, int intr_type, int vector, - uint32_t error, bool ec_valid) -{ - KASSERT((ctrl->eventinj & VMCB_EVENTINJ_VALID) == 0, - ("%s: event already pending %#lx", __func__, ctrl->eventinj)); - - KASSERT(vector >=0 && vector <= 255, ("%s: invalid vector %d", - __func__, vector)); - - switch (intr_type) { - case VMCB_EVENTINJ_TYPE_INTR: - case VMCB_EVENTINJ_TYPE_NMI: - case VMCB_EVENTINJ_TYPE_INTn: - break; - case VMCB_EVENTINJ_TYPE_EXCEPTION: - if (vector >= 0 && vector <= 31 && vector != 2) - break; - /* FALLTHROUGH */ - default: - panic("%s: invalid intr_type/vector: %d/%d", __func__, - intr_type, vector); - } - ctrl->eventinj = vector | (intr_type << 8) | VMCB_EVENTINJ_VALID; - if (ec_valid) { - ctrl->eventinj |= VMCB_EVENTINJ_EC_VALID; - ctrl->eventinj |= (uint64_t)error << 32; - } -} Modified: projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Wed Sep 10 01:46:22 2014 (r271344) +++ projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Wed Sep 10 02:20:32 2014 (r271345) @@ -282,7 +282,5 @@ void svm_init_vmcb(struct vmcb *vmcb, ui int vmcb_read(struct vmcb *vmcb, int ident, uint64_t *retval); int vmcb_write(struct vmcb *vmcb, int ident, uint64_t val); struct vmcb_segment *vmcb_seg(struct vmcb *vmcb, int type); -void vmcb_eventinject(struct vmcb_ctrl *ctrl, int type, int vector, - uint32_t error, bool ec_valid); #endif /* _VMCB_H_ */ From owner-svn-src-projects@FreeBSD.ORG Wed Sep 10 02:35:20 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1C7D533A; Wed, 10 Sep 2014 02:35:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 078CCDC4; Wed, 10 Sep 2014 02:35:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8A2ZJ1Z047673; Wed, 10 Sep 2014 02:35:19 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8A2ZJNK047670; Wed, 10 Sep 2014 02:35:19 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201409100235.s8A2ZJNK047670@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Wed, 10 Sep 2014 02:35:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271346 - projects/bhyve_svm/sys/amd64/vmm/amd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Sep 2014 02:35:20 -0000 Author: neel Date: Wed Sep 10 02:35:19 2014 New Revision: 271346 URL: http://svnweb.freebsd.org/changeset/base/271346 Log: Move the VMCB initialization into svm.c in preparation for changes to the interrupt injection logic. Discussed with: Anish Gupta (akgupt3@gmail.com) Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Wed Sep 10 02:20:32 2014 (r271345) +++ projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Wed Sep 10 02:35:19 2014 (r271346) @@ -394,6 +394,84 @@ vcpu_set_dirty(struct svm_softc *sc, int vcpustate->dirty |= dirtybits; } +static void +vmcb_init(struct svm_softc *sc, int vcpu, uint64_t iopm_base_pa, + uint64_t msrpm_base_pa, uint64_t np_pml4) +{ + struct vmcb_ctrl *ctrl; + struct vmcb_state *state; + uint16_t cr_shadow; + + ctrl = svm_get_vmcb_ctrl(sc, vcpu); + state = svm_get_vmcb_state(sc, vcpu); + + ctrl->iopm_base_pa = iopm_base_pa; + ctrl->msrpm_base_pa = msrpm_base_pa; + + /* Enable nested paging */ + ctrl->np_enable = 1; + ctrl->n_cr3 = np_pml4; + + /* + * Intercept accesses to the control registers that are not shadowed + * in the VMCB - i.e. all except cr0, cr2, cr3, cr4 and cr8. + */ + cr_shadow = BIT(0) | BIT(2) | BIT(3) | BIT(4) | BIT(8); + ctrl->cr_write = ctrl->cr_read = ~cr_shadow; + + /* Intercept Machine Check exceptions. */ + ctrl->exception = BIT(IDT_MC); + + /* Intercept various events (for e.g. I/O, MSR and CPUID accesses) */ + ctrl->ctrl1 = VMCB_INTCPT_IO | + VMCB_INTCPT_MSR | + VMCB_INTCPT_HLT | + VMCB_INTCPT_CPUID | + VMCB_INTCPT_INTR | + VMCB_INTCPT_VINTR | + VMCB_INTCPT_INIT | + VMCB_INTCPT_NMI | + VMCB_INTCPT_SMI | + VMCB_INTCPT_FERR_FREEZE | + VMCB_INTCPT_SHUTDOWN; + + /* + * From section "Canonicalization and Consistency Checks" in APMv2 + * the VMRUN intercept bit must be set to pass the consistency check. + */ + ctrl->ctrl2 = VMCB_INTCPT_VMRUN; + + /* + * The ASID will be set to a non-zero value just before VMRUN. + */ + ctrl->asid = 0; + + /* + * Section 15.21.1, Interrupt Masking in EFLAGS + * Section 15.21.2, Virtualizing APIC.TPR + * + * This must be set for %rflag and %cr8 isolation of guest and host. + */ + ctrl->v_intr_masking = 1; + + /* Enable Last Branch Record aka LBR for debugging */ + ctrl->lbr_virt_en = 1; + state->dbgctl = BIT(0); + + /* EFER_SVM must always be set when the guest is executing */ + state->efer = EFER_SVM; + + /* Set up the PAT to power-on state */ + state->g_pat = PAT_VALUE(0, PAT_WRITE_BACK) | + PAT_VALUE(1, PAT_WRITE_THROUGH) | + PAT_VALUE(2, PAT_UNCACHED) | + PAT_VALUE(3, PAT_UNCACHEABLE) | + PAT_VALUE(4, PAT_WRITE_BACK) | + PAT_VALUE(5, PAT_WRITE_THROUGH) | + PAT_VALUE(6, PAT_UNCACHED) | + PAT_VALUE(7, PAT_UNCACHEABLE); +} + /* * Initialise a virtual machine. */ @@ -452,7 +530,7 @@ svm_vminit(struct vm *vm, pmap_t pmap) vcpu = svm_get_vcpu(svm_sc, i); vcpu->lastcpu = NOCPU; vcpu->vmcb_pa = vtophys(&vcpu->vmcb); - svm_init_vmcb(&vcpu->vmcb, iopm_pa, msrpm_pa, pml4_pa); + vmcb_init(svm_sc, i, iopm_pa, msrpm_pa, pml4_pa); } return (svm_sc); } Modified: projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c Wed Sep 10 02:20:32 2014 (r271345) +++ projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c Wed Sep 10 02:35:19 2014 (r271346) @@ -49,87 +49,6 @@ __FBSDID("$FreeBSD$"); */ /* - * Initialize SVM h/w context i.e. the VMCB control and saved state areas. - */ -void -svm_init_vmcb(struct vmcb *vmcb, uint64_t iopm_base_pa, uint64_t msrpm_base_pa, - uint64_t np_pml4) -{ - struct vmcb_ctrl *ctrl; - struct vmcb_state *state; - uint16_t cr_shadow; - - ctrl = &vmcb->ctrl; - state = &vmcb->state; - - ctrl->iopm_base_pa = iopm_base_pa; - ctrl->msrpm_base_pa = msrpm_base_pa; - - /* Enable nested paging */ - ctrl->np_enable = 1; - ctrl->n_cr3 = np_pml4; - - /* - * Intercept accesses to the control registers that are not shadowed - * in the VMCB - i.e. all except cr0, cr2, cr3, cr4 and cr8. - */ - cr_shadow = BIT(0) | BIT(2) | BIT(3) | BIT(4) | BIT(8); - ctrl->cr_write = ctrl->cr_read = ~cr_shadow; - - /* Intercept Machine Check exceptions. */ - ctrl->exception = BIT(IDT_MC); - - /* Intercept various events (for e.g. I/O, MSR and CPUID accesses) */ - ctrl->ctrl1 = VMCB_INTCPT_IO | - VMCB_INTCPT_MSR | - VMCB_INTCPT_HLT | - VMCB_INTCPT_CPUID | - VMCB_INTCPT_INTR | - VMCB_INTCPT_VINTR | - VMCB_INTCPT_INIT | - VMCB_INTCPT_NMI | - VMCB_INTCPT_SMI | - VMCB_INTCPT_FERR_FREEZE | - VMCB_INTCPT_SHUTDOWN; - - /* - * From section "Canonicalization and Consistency Checks" in APMv2 - * the VMRUN intercept bit must be set to pass the consistency check. - */ - ctrl->ctrl2 = VMCB_INTCPT_VMRUN; - - /* - * The ASID will be set to a non-zero value just before VMRUN. - */ - ctrl->asid = 0; - - /* - * Section 15.21.1, Interrupt Masking in EFLAGS - * Section 15.21.2, Virtualizing APIC.TPR - * - * This must be set for %rflag and %cr8 isolation of guest and host. - */ - ctrl->v_intr_masking = 1; - - /* Enable Last Branch Record aka LBR for debugging */ - ctrl->lbr_virt_en = 1; - state->dbgctl = BIT(0); - - /* EFER_SVM must always be set when the guest is executing */ - state->efer = EFER_SVM; - - /* Set up the PAT to power-on state */ - state->g_pat = PAT_VALUE(0, PAT_WRITE_BACK) | - PAT_VALUE(1, PAT_WRITE_THROUGH) | - PAT_VALUE(2, PAT_UNCACHED) | - PAT_VALUE(3, PAT_UNCACHEABLE) | - PAT_VALUE(4, PAT_WRITE_BACK) | - PAT_VALUE(5, PAT_WRITE_THROUGH) | - PAT_VALUE(6, PAT_UNCACHED) | - PAT_VALUE(7, PAT_UNCACHEABLE); -} - -/* * Read from segment selector, control and general purpose register of VMCB. */ int Modified: projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Wed Sep 10 02:20:32 2014 (r271345) +++ projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Wed Sep 10 02:35:19 2014 (r271346) @@ -277,8 +277,6 @@ struct vmcb { CTASSERT(sizeof(struct vmcb) == PAGE_SIZE); CTASSERT(offsetof(struct vmcb, state) == 0x400); -void svm_init_vmcb(struct vmcb *vmcb, uint64_t iopm_base_pa, - uint64_t msrpm_base_pa, uint64_t np_pml4); int vmcb_read(struct vmcb *vmcb, int ident, uint64_t *retval); int vmcb_write(struct vmcb *vmcb, int ident, uint64_t val); struct vmcb_segment *vmcb_seg(struct vmcb *vmcb, int type); From owner-svn-src-projects@FreeBSD.ORG Wed Sep 10 03:13:41 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A561674; Wed, 10 Sep 2014 03:13:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 8EA578B9; Wed, 10 Sep 2014 03:13:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8A3Dftn066862; Wed, 10 Sep 2014 03:13:41 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8A3Dfc1066860; Wed, 10 Sep 2014 03:13:41 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201409100313.s8A3Dfc1066860@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Wed, 10 Sep 2014 03:13:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271348 - projects/bhyve_svm/sys/amd64/vmm/amd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Sep 2014 03:13:41 -0000 Author: neel Date: Wed Sep 10 03:13:40 2014 New Revision: 271348 URL: http://svnweb.freebsd.org/changeset/base/271348 Log: Allow intercepts and irq fields to be cached by the VMCB. Provide APIs svm_enable_intercept()/svm_disable_intercept() to add/delete VMCB intercepts. These APIs ensure that the VMCB state cache is invalidated when intercepts are modified. Each intercept is identified as a (index,bitmask) tuple. For e.g., the VINTR intercept is identified as (VMCB_CTRL1_INTCPT,VMCB_INTCPT_VINTR). The first 20 bytes in control area that are used to enable intercepts are represented as 'uint32_t intercept[5]' in 'struct vmcb_ctrl'. Modify svm_setcap() and svm_getcap() to use the new APIs. Discussed with: Anish Gupta (akgupt3@gmail.com) Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Wed Sep 10 02:44:02 2014 (r271347) +++ projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Wed Sep 10 03:13:40 2014 (r271348) @@ -80,8 +80,11 @@ __FBSDID("$FreeBSD$"); #define AMD_CPUID_SVM_PAUSE_INC BIT(10) /* Pause intercept filter. */ #define AMD_CPUID_SVM_PAUSE_FTH BIT(12) /* Pause filter threshold */ -#define VMCB_CACHE_DEFAULT \ - (VMCB_CACHE_ASID | VMCB_CACHE_IOPM | VMCB_CACHE_NP) +#define VMCB_CACHE_DEFAULT (VMCB_CACHE_ASID | \ + VMCB_CACHE_IOPM | \ + VMCB_CACHE_I | \ + VMCB_CACHE_TPR | \ + VMCB_CACHE_NP) MALLOC_DEFINE(M_SVM, "svm", "svm"); MALLOC_DEFINE(M_SVM_VLAPIC, "svm-vlapic", "svm-vlapic"); @@ -394,13 +397,61 @@ vcpu_set_dirty(struct svm_softc *sc, int vcpustate->dirty |= dirtybits; } +static __inline int +svm_get_intercept(struct svm_softc *sc, int vcpu, int idx, uint32_t bitmask) +{ + struct vmcb_ctrl *ctrl; + + KASSERT(idx >=0 && idx < 5, ("invalid intercept index %d", idx)); + + ctrl = svm_get_vmcb_ctrl(sc, vcpu); + return (ctrl->intercept[idx] & bitmask ? 1 : 0); +} + +static __inline void +svm_set_intercept(struct svm_softc *sc, int vcpu, int idx, uint32_t bitmask, + int enabled) +{ + struct vmcb_ctrl *ctrl; + uint32_t oldval; + + KASSERT(idx >=0 && idx < 5, ("invalid intercept index %d", idx)); + + ctrl = svm_get_vmcb_ctrl(sc, vcpu); + oldval = ctrl->intercept[idx]; + + if (enabled) + ctrl->intercept[idx] |= bitmask; + else + ctrl->intercept[idx] &= ~bitmask; + + if (ctrl->intercept[idx] != oldval) { + vcpu_set_dirty(sc, vcpu, VMCB_CACHE_I); + VCPU_CTR3(sc->vm, vcpu, "intercept[%d] modified " + "from %#x to %#x", idx, oldval, ctrl->intercept[idx]); + } +} + +static __inline void +svm_disable_intercept(struct svm_softc *sc, int vcpu, int off, uint32_t bitmask) +{ + svm_set_intercept(sc, vcpu, off, bitmask, 0); +} + +static __inline void +svm_enable_intercept(struct svm_softc *sc, int vcpu, int off, uint32_t bitmask) +{ + svm_set_intercept(sc, vcpu, off, bitmask, 1); +} + static void vmcb_init(struct svm_softc *sc, int vcpu, uint64_t iopm_base_pa, uint64_t msrpm_base_pa, uint64_t np_pml4) { struct vmcb_ctrl *ctrl; struct vmcb_state *state; - uint16_t cr_shadow; + uint32_t mask; + int n; ctrl = svm_get_vmcb_ctrl(sc, vcpu); state = svm_get_vmcb_state(sc, vcpu); @@ -416,30 +467,35 @@ vmcb_init(struct svm_softc *sc, int vcpu * Intercept accesses to the control registers that are not shadowed * in the VMCB - i.e. all except cr0, cr2, cr3, cr4 and cr8. */ - cr_shadow = BIT(0) | BIT(2) | BIT(3) | BIT(4) | BIT(8); - ctrl->cr_write = ctrl->cr_read = ~cr_shadow; + for (n = 0; n < 16; n++) { + mask = (BIT(n) << 16) | BIT(n); + if (n == 0 || n == 2 || n == 3 || n == 4 || n == 8) + svm_disable_intercept(sc, vcpu, VMCB_CR_INTCPT, mask); + else + svm_enable_intercept(sc, vcpu, VMCB_CR_INTCPT, mask); + } /* Intercept Machine Check exceptions. */ - ctrl->exception = BIT(IDT_MC); + svm_enable_intercept(sc, vcpu, VMCB_EXC_INTCPT, BIT(IDT_MC)); /* Intercept various events (for e.g. I/O, MSR and CPUID accesses) */ - ctrl->ctrl1 = VMCB_INTCPT_IO | - VMCB_INTCPT_MSR | - VMCB_INTCPT_HLT | - VMCB_INTCPT_CPUID | - VMCB_INTCPT_INTR | - VMCB_INTCPT_VINTR | - VMCB_INTCPT_INIT | - VMCB_INTCPT_NMI | - VMCB_INTCPT_SMI | - VMCB_INTCPT_FERR_FREEZE | - VMCB_INTCPT_SHUTDOWN; + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_IO); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_MSR); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_HLT); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_CPUID); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_INTR); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_INIT); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_NMI); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_SMI); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_SHUTDOWN); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, + VMCB_INTCPT_FERR_FREEZE); /* * From section "Canonicalization and Consistency Checks" in APMv2 * the VMRUN intercept bit must be set to pass the consistency check. */ - ctrl->ctrl2 = VMCB_INTCPT_VMRUN; + svm_enable_intercept(sc, vcpu, VMCB_CTRL2_INTCPT, VMCB_INTCPT_VMRUN); /* * The ASID will be set to a non-zero value just before VMRUN. @@ -670,7 +726,7 @@ svm_handle_io(struct svm_softc *svm_sc, struct svm_regctx *regs; struct vm_inout_str *vis; uint64_t info1; - + state = svm_get_vmcb_state(svm_sc, vcpu); ctrl = svm_get_vmcb_ctrl(svm_sc, vcpu); regs = svm_get_guest_regctx(svm_sc, vcpu); @@ -1725,99 +1781,58 @@ svm_getdesc(void *arg, int vcpu, int typ static int svm_setcap(void *arg, int vcpu, int type, int val) { - struct svm_softc *svm_sc; - struct vmcb_ctrl *ctrl; - int ret = ENOENT; - - svm_sc = arg; - KASSERT(vcpu < svm_sc->vcpu_cnt, ("Guest doesn't have VCPU%d", vcpu)); - - ctrl = svm_get_vmcb_ctrl(svm_sc, vcpu); + struct svm_softc *sc; + int error; + sc = arg; + error = 0; switch (type) { - case VM_CAP_HALT_EXIT: - if (val) - ctrl->ctrl1 |= VMCB_INTCPT_HLT; - else - ctrl->ctrl1 &= ~VMCB_INTCPT_HLT; - ret = 0; - VCPU_CTR1(svm_sc->vm, vcpu, "SVM:Set_gap:Halt exit %s.\n", - val ? "enabled": "disabled"); - break; - - case VM_CAP_PAUSE_EXIT: - if (val) - ctrl->ctrl1 |= VMCB_INTCPT_PAUSE; - else - ctrl->ctrl1 &= ~VMCB_INTCPT_PAUSE; - ret = 0; - VCPU_CTR1(svm_sc->vm, vcpu, "SVM:Set_gap:Pause exit %s.\n", - val ? "enabled": "disabled"); - break; - - case VM_CAP_MTRAP_EXIT: - if (val) - ctrl->exception |= BIT(IDT_MC); - else - ctrl->exception &= ~BIT(IDT_MC); - ret = 0; - VCPU_CTR1(svm_sc->vm, vcpu, "SVM:Set_gap:MC exit %s.\n", - val ? "enabled": "disabled"); - break; - - case VM_CAP_UNRESTRICTED_GUEST: - /* SVM doesn't need special capability for SMP.*/ - VCPU_CTR0(svm_sc->vm, vcpu, "SVM:Set_gap:Unrestricted " - "always enabled.\n"); - ret = 0; - break; - - default: - break; - } - - return (ret); + case VM_CAP_HALT_EXIT: + svm_set_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, + VMCB_INTCPT_HLT, val); + break; + case VM_CAP_PAUSE_EXIT: + svm_set_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, + VMCB_INTCPT_PAUSE, val); + break; + case VM_CAP_UNRESTRICTED_GUEST: + /* Unrestricted guest execution cannot be disabled in SVM */ + if (val == 0) + error = EINVAL; + break; + default: + error = ENOENT; + break; + } + return (error); } static int svm_getcap(void *arg, int vcpu, int type, int *retval) { - struct svm_softc *svm_sc; - struct vmcb_ctrl *ctrl; - - svm_sc = arg; - KASSERT(vcpu < svm_sc->vcpu_cnt, ("Guest doesn't have VCPU%d", vcpu)); + struct svm_softc *sc; + int error; - ctrl = svm_get_vmcb_ctrl(svm_sc, vcpu); + sc = arg; + error = 0; switch (type) { - case VM_CAP_HALT_EXIT: - *retval = (ctrl->ctrl1 & VMCB_INTCPT_HLT) ? 1 : 0; - VCPU_CTR1(svm_sc->vm, vcpu, "SVM:get_cap:Halt exit %s.\n", - *retval ? "enabled": "disabled"); + case VM_CAP_HALT_EXIT: + *retval = svm_get_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, + VMCB_INTCPT_HLT); break; - - case VM_CAP_PAUSE_EXIT: - *retval = (ctrl->ctrl1 & VMCB_INTCPT_PAUSE) ? 1 : 0; - VCPU_CTR1(svm_sc->vm, vcpu, "SVM:get_cap:Pause exit %s.\n", - *retval ? "enabled": "disabled"); + case VM_CAP_PAUSE_EXIT: + *retval = svm_get_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, + VMCB_INTCPT_PAUSE); break; - - case VM_CAP_MTRAP_EXIT: - *retval = (ctrl->exception & BIT(IDT_MC)) ? 1 : 0; - VCPU_CTR1(svm_sc->vm, vcpu, "SVM:get_cap:MC exit %s.\n", - *retval ? "enabled": "disabled"); - break; - case VM_CAP_UNRESTRICTED_GUEST: - VCPU_CTR0(svm_sc->vm, vcpu, "SVM:get_cap:Unrestricted.\n"); - *retval = 1; + *retval = 1; /* unrestricted guest is always enabled */ break; - default: + default: + error = ENOENT; break; } - - return (0); + return (error); } static struct vlapic * Modified: projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Wed Sep 10 02:44:02 2014 (r271347) +++ projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Wed Sep 10 03:13:40 2014 (r271348) @@ -34,7 +34,14 @@ * Layout of VMCB: AMD64 Programmer's Manual Vol2, Appendix B */ -/* VMCB Control offset 0xC */ +/* vmcb_ctrl->intercept[] array indices */ +#define VMCB_CR_INTCPT 0 +#define VMCB_DR_INTCPT 1 +#define VMCB_EXC_INTCPT 2 +#define VMCB_CTRL1_INTCPT 3 +#define VMCB_CTRL2_INTCPT 4 + +/* intercept[VMCB_CTRL1_INTCPT] fields */ #define VMCB_INTCPT_INTR BIT(0) #define VMCB_INTCPT_NMI BIT(1) #define VMCB_INTCPT_SMI BIT(2) @@ -68,7 +75,7 @@ #define VMCB_INTCPT_FERR_FREEZE BIT(30) #define VMCB_INTCPT_SHUTDOWN BIT(31) -/* VMCB Control offset 0x10 */ +/* intercept[VMCB_CTRL2_INTCPT] fields */ #define VMCB_INTCPT_VMRUN BIT(0) #define VMCB_INTCPT_VMMCALL BIT(1) #define VMCB_INTCPT_VMLOAD BIT(2) @@ -91,18 +98,18 @@ #define VMCB_TLB_FLUSH_GUEST_NONGLOBAL 7 /* Flush guest non-PG entries */ /* VMCB state caching */ -#define VMCB_CACHE_NONE 0 /* No caching */ -#define VMCB_CACHE_I BIT(0) /* Cache vectors, TSC offset */ -#define VMCB_CACHE_IOPM BIT(1) /* I/O and MSR permission */ -#define VMCB_CACHE_ASID BIT(2) /* ASID */ -#define VMCB_CACHE_TPR BIT(3) /* V_TPR to V_INTR_VECTOR */ -#define VMCB_CACHE_NP BIT(4) /* Nested Paging */ -#define VMCB_CACHE_CR BIT(5) /* CR0, CR3, CR4 & EFER */ -#define VMCB_CACHE_DR BIT(6) /* Debug registers */ -#define VMCB_CACHE_DT BIT(7) /* GDT/IDT */ -#define VMCB_CACHE_SEG BIT(8) /* User segments, CPL */ -#define VMCB_CACHE_CR2 BIT(9) /* page fault address */ -#define VMCB_CACHE_LBR BIT(10) /* Last branch */ +#define VMCB_CACHE_NONE 0 /* No caching */ +#define VMCB_CACHE_I BIT(0) /* Intercept, TSC off, Pause filter */ +#define VMCB_CACHE_IOPM BIT(1) /* I/O and MSR permission */ +#define VMCB_CACHE_ASID BIT(2) /* ASID */ +#define VMCB_CACHE_TPR BIT(3) /* V_TPR to V_INTR_VECTOR */ +#define VMCB_CACHE_NP BIT(4) /* Nested Paging */ +#define VMCB_CACHE_CR BIT(5) /* CR0, CR3, CR4 & EFER */ +#define VMCB_CACHE_DR BIT(6) /* Debug registers */ +#define VMCB_CACHE_DT BIT(7) /* GDT/IDT */ +#define VMCB_CACHE_SEG BIT(8) /* User segments, CPL */ +#define VMCB_CACHE_CR2 BIT(9) /* page fault address */ +#define VMCB_CACHE_LBR BIT(10) /* Last branch */ /* VMCB control event injection */ #define VMCB_EVENTINJ_EC_VALID BIT(11) /* Error Code valid */ @@ -175,13 +182,7 @@ CTASSERT(sizeof(struct vmcb_segment) == /* VMCB control area - padded up to 1024 bytes */ struct vmcb_ctrl { - uint16_t cr_read; /* Offset 0, CR0-15 read/write */ - uint16_t cr_write; - uint16_t dr_read; /* Offset 4, DR0-DR15 */ - uint16_t dr_write; - uint32_t exception; /* Offset 8, bit mask for exceptions. */ - uint32_t ctrl1; /* Offset 0xC, intercept events1 */ - uint32_t ctrl2; /* Offset 0x10, intercept event2 */ + uint32_t intercept[5]; /* all intercepts */ uint8_t pad1[0x28]; /* Offsets 0x14-0x3B are reserved. */ uint16_t pause_filthresh; /* Offset 0x3C, PAUSE filter threshold */ uint16_t pause_filcnt; /* Offset 0x3E, PAUSE filter count */ From owner-svn-src-projects@FreeBSD.ORG Wed Sep 10 11:27:53 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 11361DB8; Wed, 10 Sep 2014 11:27:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 F05701D7; Wed, 10 Sep 2014 11:27:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8ABRqYY096406; Wed, 10 Sep 2014 11:27:52 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8ABRqZO096405; Wed, 10 Sep 2014 11:27:52 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201409101127.s8ABRqZO096405@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 10 Sep 2014 11:27:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271383 - projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Sep 2014 11:27:53 -0000 Author: glebius Date: Wed Sep 10 11:27:52 2014 New Revision: 271383 URL: http://svnweb.freebsd.org/changeset/base/271383 Log: Revert r270963. The plan is that support for asynchronous paging is opt-in, not opt-out. Modified: projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Sep 10 11:27:33 2014 (r271382) +++ projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Sep 10 11:27:52 2014 (r271383) @@ -5837,26 +5837,6 @@ zfs_freebsd_getpages(ap) } static int -zfs_freebsd_getpages_async(ap) - struct vop_getpages_async_args /* { - struct vnode *a_vp; - vm_page_t *a_m; - int a_count; - int a_reqpage; - vm_ooffset_t a_offset; - void (*)(void *) a_vop_getpages_iodone; - void *a_arg; - } */ *ap; -{ - int error; - - error = zfs_getpages(ap->a_vp, ap->a_m, ap->a_count, ap->a_reqpage); - vm_page_xunbusy(ap->a_m[ap->a_reqpage]); - ap->a_vop_getpages_iodone(ap->a_arg); - return (error); -} - -static int zfs_putpages(struct vnode *vp, vm_page_t *ma, size_t len, int flags, int *rtvals) { @@ -7166,7 +7146,6 @@ struct vop_vector zfs_vnodeops = { .vop_setacl = zfs_freebsd_setacl, .vop_aclcheck = zfs_freebsd_aclcheck, .vop_getpages = zfs_freebsd_getpages, - .vop_getpages_async = zfs_freebsd_getpages_async, .vop_putpages = zfs_freebsd_putpages, }; From owner-svn-src-projects@FreeBSD.ORG Wed Sep 10 11:33:43 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7BC18F0B; Wed, 10 Sep 2014 11:33:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 4EA742A9; Wed, 10 Sep 2014 11:33:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8ABXhwM000647; Wed, 10 Sep 2014 11:33:43 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8ABXgPI000645; Wed, 10 Sep 2014 11:33:42 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201409101133.s8ABXgPI000645@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 10 Sep 2014 11:33:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271384 - in projects/sendfile/sys: kern ufs/ufs X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Sep 2014 11:33:43 -0000 Author: glebius Date: Wed Sep 10 11:33:42 2014 New Revision: 271384 URL: http://svnweb.freebsd.org/changeset/base/271384 Log: - Make default implementation of VOP_GETPAGES_ASYNC() a wrapper around VOP_GETPAGES(). This emulates asynchronous operation on all filesystems, that use their own vop_getpages(), namely: nfs, smbfs, fuse, zfs. - Opt-in UFS to use true asynchronous vop_stdgetpages_async(). Note: other filesystems, that use default pager, need also to opt-in after some testing. Sponsored by: Netflix Sponsored by: Nginx, Inc. Modified: projects/sendfile/sys/kern/vfs_default.c projects/sendfile/sys/ufs/ufs/ufs_vnops.c Modified: projects/sendfile/sys/kern/vfs_default.c ============================================================================== --- projects/sendfile/sys/kern/vfs_default.c Wed Sep 10 11:27:52 2014 (r271383) +++ projects/sendfile/sys/kern/vfs_default.c Wed Sep 10 11:33:42 2014 (r271384) @@ -83,6 +83,7 @@ static int vop_stdset_text(struct vop_se static int vop_stdunset_text(struct vop_unset_text_args *ap); static int vop_stdget_writecount(struct vop_get_writecount_args *ap); static int vop_stdadd_writecount(struct vop_add_writecount_args *ap); +static int vop_stdgetpages_async_emulate(struct vop_getpages_async_args *ap); /* * This vnode table stores what we want to do if the filesystem doesn't @@ -111,7 +112,7 @@ struct vop_vector default_vnodeops = { .vop_close = VOP_NULL, .vop_fsync = VOP_NULL, .vop_getpages = vop_stdgetpages, - .vop_getpages_async = vop_stdgetpages_async, + .vop_getpages_async = vop_stdgetpages_async_emulate, .vop_getwritemount = vop_stdgetwritemount, .vop_inactive = VOP_NULL, .vop_ioctl = VOP_ENOTTY, @@ -739,6 +740,18 @@ vop_stdgetpages_async(struct vop_getpage ap->a_count, ap->a_reqpage, ap->a_vop_getpages_iodone, ap->a_arg); } +static int +vop_stdgetpages_async_emulate(struct vop_getpages_async_args *ap) +{ + int error; + + error = VOP_GETPAGES(ap->a_vp, ap->a_m, ap->a_count, ap->a_reqpage, + ap->a_offset); + vm_page_xunbusy(ap->a_m[ap->a_reqpage]); + ap->a_vop_getpages_iodone(ap->a_arg); + return (error); +} + int vop_stdkqfilter(struct vop_kqfilter_args *ap) { Modified: projects/sendfile/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- projects/sendfile/sys/ufs/ufs/ufs_vnops.c Wed Sep 10 11:27:52 2014 (r271383) +++ projects/sendfile/sys/ufs/ufs/ufs_vnops.c Wed Sep 10 11:33:42 2014 (r271384) @@ -2745,6 +2745,7 @@ struct vop_vector ufs_vnodeops = { .vop_close = ufs_close, .vop_create = ufs_create, .vop_getattr = ufs_getattr, + .vop_getpages_async = vop_stdgetpages_async, .vop_inactive = ufs_inactive, .vop_ioctl = ufs_ioctl, .vop_link = ufs_link, From owner-svn-src-projects@FreeBSD.ORG Wed Sep 10 12:55:39 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B15C271B; Wed, 10 Sep 2014 12:55:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 96E91E58; Wed, 10 Sep 2014 12:55:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8ACtdnv040760; Wed, 10 Sep 2014 12:55:39 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8ACtZfr040719; Wed, 10 Sep 2014 12:55:35 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201409101255.s8ACtZfr040719@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 10 Sep 2014 12:55:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271388 - in projects/sendfile: bin/sh cddl/contrib/opensolaris/cmd/zpool contrib/libc-vis contrib/llvm/lib/Target/ARM contrib/llvm/patches contrib/llvm/tools/clang/lib/CodeGen contrib/... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Sep 2014 12:55:39 -0000 Author: glebius Date: Wed Sep 10 12:55:34 2014 New Revision: 271388 URL: http://svnweb.freebsd.org/changeset/base/271388 Log: Merge head r258543 through r271387. Added: projects/sendfile/contrib/llvm/patches/patch-r271024-llvm-r216989-fix-movm-armv6.diff - copied unchanged from r271387, head/contrib/llvm/patches/patch-r271024-llvm-r216989-fix-movm-armv6.diff projects/sendfile/contrib/llvm/patches/patch-r271282-clang-r200797-r200798-r200805-debug-info-crash.diff - copied unchanged from r271387, head/contrib/llvm/patches/patch-r271282-clang-r200797-r200798-r200805-debug-info-crash.diff projects/sendfile/lib/libc/arm/Symbol_vfp.map - copied unchanged from r271387, head/lib/libc/arm/Symbol_vfp.map projects/sendfile/share/man/man4/uled.4 - copied unchanged from r271387, head/share/man/man4/uled.4 projects/sendfile/sys/arm/altera/ - copied from r271387, head/sys/arm/altera/ projects/sendfile/sys/arm/conf/IMX53 - copied unchanged from r271387, head/sys/arm/conf/IMX53 projects/sendfile/sys/arm/conf/SOCKIT - copied unchanged from r271387, head/sys/arm/conf/SOCKIT projects/sendfile/sys/arm/freescale/imx/imx6_iomux.c - copied unchanged from r271387, head/sys/arm/freescale/imx/imx6_iomux.c projects/sendfile/sys/arm/freescale/imx/imx6_iomuxreg.h - copied unchanged from r271387, head/sys/arm/freescale/imx/imx6_iomuxreg.h projects/sendfile/sys/arm/freescale/imx/imx_iomuxvar.h - copied unchanged from r271387, head/sys/arm/freescale/imx/imx_iomuxvar.h projects/sendfile/sys/boot/fdt/dts/arm/socfpga-sockit.dts - copied unchanged from r271387, head/sys/boot/fdt/dts/arm/socfpga-sockit.dts projects/sendfile/sys/boot/fdt/dts/arm/socfpga.dtsi - copied unchanged from r271387, head/sys/boot/fdt/dts/arm/socfpga.dtsi projects/sendfile/sys/dev/ahci/ahci_pci.c - copied unchanged from r271387, head/sys/dev/ahci/ahci_pci.c projects/sendfile/sys/dev/fdt/fdt_clock.c - copied unchanged from r271387, head/sys/dev/fdt/fdt_clock.c projects/sendfile/sys/dev/fdt/fdt_clock.h - copied unchanged from r271387, head/sys/dev/fdt/fdt_clock.h projects/sendfile/sys/dev/fdt/fdt_clock_if.m - copied unchanged from r271387, head/sys/dev/fdt/fdt_clock_if.m projects/sendfile/sys/dev/smc/if_smc_fdt.c - copied unchanged from r271387, head/sys/dev/smc/if_smc_fdt.c projects/sendfile/sys/dev/usb/misc/uled.c - copied unchanged from r271387, head/sys/dev/usb/misc/uled.c projects/sendfile/sys/dev/usb/uled_ioctl.h - copied unchanged from r271387, head/sys/dev/usb/uled_ioctl.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clk/ti-dra7-atl.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clk/ti-dra7-atl.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/at91.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/at91.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/bcm21664.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/bcm21664.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/bcm281xx.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/bcm281xx.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/berlin2.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/berlin2.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/berlin2q.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/berlin2q.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/clps711x-clock.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/clps711x-clock.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/exynos-audss-clk.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/exynos-audss-clk.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/exynos3250.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/exynos3250.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/exynos5260-clk.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/exynos5260-clk.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/exynos5410.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/exynos5410.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/hip04-clock.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/hip04-clock.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/hix5hd2-clock.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/hix5hd2-clock.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/imx1-clock.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/imx1-clock.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/imx21-clock.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/imx21-clock.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/imx27-clock.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/imx27-clock.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/imx6qdl-clock.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/imx6qdl-clock.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/imx6sx-clock.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/imx6sx-clock.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/lsi,axm5516-clks.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/lsi,axm5516-clks.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/qcom,gcc-apq8084.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/qcom,gcc-apq8084.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/qcom,gcc-ipq806x.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/qcom,gcc-ipq806x.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/qcom,mmcc-apq8084.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/qcom,mmcc-apq8084.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/r7s72100-clock.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/r7s72100-clock.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/r8a7779-clock.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/r8a7779-clock.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/rk3066a-cru.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/rk3066a-cru.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/rk3188-cru-common.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/rk3188-cru-common.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/rk3188-cru.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/rk3188-cru.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/rk3288-cru.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/rk3288-cru.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/s3c2410.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/s3c2410.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/s3c2412.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/s3c2412.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/s3c2443.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/s3c2443.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/s5pv210-audss.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/s5pv210-audss.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/s5pv210.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/s5pv210.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/stih415-clks.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/stih415-clks.h projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/stih416-clks.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/clock/stih416-clks.h projects/sendfile/sys/gnu/dts/include/dt-bindings/dma/nbpfaxi.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/dma/nbpfaxi.h projects/sendfile/sys/gnu/dts/include/dt-bindings/mfd/palmas.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/mfd/palmas.h projects/sendfile/sys/gnu/dts/include/dt-bindings/phy/ - copied from r271387, head/sys/gnu/dts/include/dt-bindings/phy/ projects/sendfile/sys/gnu/dts/include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h projects/sendfile/sys/gnu/dts/include/dt-bindings/reset-controller/ - copied from r271387, head/sys/gnu/dts/include/dt-bindings/reset-controller/ projects/sendfile/sys/gnu/dts/include/dt-bindings/reset/altr,rst-mgr.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/reset/altr,rst-mgr.h projects/sendfile/sys/gnu/dts/include/dt-bindings/reset/qcom,gcc-apq8084.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/reset/qcom,gcc-apq8084.h projects/sendfile/sys/gnu/dts/include/dt-bindings/reset/qcom,gcc-ipq806x.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/reset/qcom,gcc-ipq806x.h projects/sendfile/sys/gnu/dts/include/dt-bindings/reset/qcom,mmcc-apq8084.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/reset/qcom,mmcc-apq8084.h projects/sendfile/sys/gnu/dts/include/dt-bindings/soc/ - copied from r271387, head/sys/gnu/dts/include/dt-bindings/soc/ projects/sendfile/sys/gnu/dts/include/dt-bindings/sound/tlv320aic31xx-micbias.h - copied unchanged from r271387, head/sys/gnu/dts/include/dt-bindings/sound/tlv320aic31xx-micbias.h projects/sendfile/sys/gnu/dts/include/dt-bindings/spmi/ - copied from r271387, head/sys/gnu/dts/include/dt-bindings/spmi/ projects/sendfile/sys/libkern/memmem.c - copied unchanged from r271387, head/sys/libkern/memmem.c projects/sendfile/sys/modules/usb/uled/ - copied from r271387, head/sys/modules/usb/uled/ projects/sendfile/sys/x86/x86/identcpu.c - copied unchanged from r271387, head/sys/x86/x86/identcpu.c projects/sendfile/tools/tools/tscdrift/ - copied from r271387, head/tools/tools/tscdrift/ Replaced: - copied from r271387, head/sys/gnu/dts/arm/ Directory Properties: projects/sendfile/sys/gnu/dts/arm/ (props changed) Deleted: projects/sendfile/sys/amd64/amd64/identcpu.c projects/sendfile/sys/arm/freescale/imx/imx51_iomuxvar.h projects/sendfile/sys/arm/versatile/if_smc_fdt.c projects/sendfile/sys/i386/i386/identcpu.c Modified: projects/sendfile/bin/sh/jobs.c projects/sendfile/bin/sh/sh.1 projects/sendfile/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 projects/sendfile/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c projects/sendfile/contrib/libc-vis/vis.c projects/sendfile/contrib/llvm/lib/Target/ARM/ARMInstrInfo.td projects/sendfile/contrib/llvm/patches/patch-r270147-llvm-r197824-r213427-r213960.diff projects/sendfile/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp projects/sendfile/contrib/smbfs/lib/smb/ctx.c projects/sendfile/contrib/smbfs/mount_smbfs/mount_smbfs.c projects/sendfile/crypto/heimdal/tools/krb5-config.in projects/sendfile/etc/mtree/BSD.root.dist projects/sendfile/etc/periodic/daily/110.clean-tmps projects/sendfile/etc/rc.d/jail projects/sendfile/etc/rc.d/syscons projects/sendfile/include/pthread.h projects/sendfile/include/stdlib.h projects/sendfile/lib/libc/arm/Makefile.inc projects/sendfile/lib/libc/arm/gen/__aeabi_read_tp.S projects/sendfile/lib/libc/arm/gen/_ctx_start.S projects/sendfile/lib/libc/arm/gen/_setjmp.S projects/sendfile/lib/libc/arm/gen/alloca.S projects/sendfile/lib/libc/arm/gen/divsi3.S projects/sendfile/lib/libc/arm/gen/setjmp.S projects/sendfile/lib/libc/arm/gen/sigsetjmp.S projects/sendfile/lib/libc/arm/string/ffs.S projects/sendfile/lib/libc/arm/string/memcmp.S projects/sendfile/lib/libc/arm/string/memcpy_arm.S projects/sendfile/lib/libc/arm/string/memcpy_xscale.S projects/sendfile/lib/libc/arm/string/memmove.S projects/sendfile/lib/libc/arm/string/memset.S projects/sendfile/lib/libc/arm/string/strcmp.S projects/sendfile/lib/libc/arm/string/strlen.S projects/sendfile/lib/libc/arm/string/strncmp.S projects/sendfile/lib/libc/arm/sys/Ovfork.S projects/sendfile/lib/libc/arm/sys/brk.S projects/sendfile/lib/libc/arm/sys/cerror.S projects/sendfile/lib/libc/arm/sys/pipe.S projects/sendfile/lib/libc/arm/sys/ptrace.S projects/sendfile/lib/libc/arm/sys/sbrk.S projects/sendfile/lib/libc/gen/rewinddir.c projects/sendfile/lib/libc/locale/lmonetary.c projects/sendfile/lib/libc/stdlib/Symbol.map projects/sendfile/lib/libc/sys/kqueue.2 projects/sendfile/lib/libcuse/cuse_lib.c projects/sendfile/lib/libgeom/geom_getxml.c projects/sendfile/lib/libnv/Makefile projects/sendfile/lib/libnv/nvlist.c projects/sendfile/lib/libpam/modules/pam_login_access/pam_login_access.c projects/sendfile/lib/libstdthreads/threads.h projects/sendfile/lib/libthr/thread/thr_cond.c projects/sendfile/lib/msun/src/e_lgamma_r.c projects/sendfile/lib/msun/src/e_lgammaf_r.c projects/sendfile/release/doc/en_US.ISO8859-1/share/xml/release.xsl projects/sendfile/release/doc/share/mk/doc.relnotes.mk projects/sendfile/release/doc/share/xml/release.ent projects/sendfile/release/doc/share/xml/release.xsl projects/sendfile/sbin/conscontrol/conscontrol.8 projects/sendfile/sbin/hastd/primary.c projects/sendfile/sbin/hastd/synch.h projects/sendfile/sbin/ifconfig/af_inet6.c projects/sendfile/sbin/ifconfig/ifconfig.8 projects/sendfile/sbin/ifconfig/sfp.c projects/sendfile/share/man/man4/Makefile projects/sendfile/share/man/man4/filemon.4 projects/sendfile/share/man/man4/ip.4 projects/sendfile/share/man/man5/autofs.5 projects/sendfile/share/man/man7/hier.7 projects/sendfile/share/man/man9/sysctl.9 projects/sendfile/share/mk/bsd.dep.mk projects/sendfile/share/mk/bsd.prog.mk projects/sendfile/share/mk/bsd.sys.mk projects/sendfile/share/zoneinfo/Makefile projects/sendfile/sys/amd64/amd64/cpu_switch.S projects/sendfile/sys/amd64/amd64/fpu.c projects/sendfile/sys/amd64/amd64/genassym.c projects/sendfile/sys/amd64/amd64/machdep.c projects/sendfile/sys/amd64/amd64/mp_machdep.c projects/sendfile/sys/amd64/amd64/pmap.c projects/sendfile/sys/amd64/conf/GENERIC projects/sendfile/sys/amd64/include/fpu.h projects/sendfile/sys/amd64/include/md_var.h projects/sendfile/sys/amd64/include/pcb.h projects/sendfile/sys/arm/arm/generic_timer.c projects/sendfile/sys/arm/arm/gic.c projects/sendfile/sys/arm/arm/locore.S projects/sendfile/sys/arm/arm/nexus.c projects/sendfile/sys/arm/at91/at91_pinctrl.c projects/sendfile/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c projects/sendfile/sys/arm/conf/BEAGLEBONE projects/sendfile/sys/arm/conf/CNS11XXNAS projects/sendfile/sys/arm/conf/CUBIEBOARD projects/sendfile/sys/arm/conf/CUBIEBOARD2 projects/sendfile/sys/arm/conf/DB-78XXX projects/sendfile/sys/arm/conf/DB-88F5XXX projects/sendfile/sys/arm/conf/DB-88F6XXX projects/sendfile/sys/arm/conf/DIGI-CCWMX53 projects/sendfile/sys/arm/conf/DOCKSTAR projects/sendfile/sys/arm/conf/DREAMPLUG-1001 projects/sendfile/sys/arm/conf/EA3250 projects/sendfile/sys/arm/conf/EB9200 projects/sendfile/sys/arm/conf/EFIKA_MX projects/sendfile/sys/arm/conf/EXYNOS5.common projects/sendfile/sys/arm/conf/HL200 projects/sendfile/sys/arm/conf/HL201 projects/sendfile/sys/arm/conf/IMX53-QSB projects/sendfile/sys/arm/conf/IMX6 projects/sendfile/sys/arm/conf/KB920X projects/sendfile/sys/arm/conf/NSLU projects/sendfile/sys/arm/conf/PANDABOARD projects/sendfile/sys/arm/conf/QILA9G20 projects/sendfile/sys/arm/conf/RK3188 projects/sendfile/sys/arm/conf/SAM9G20EK projects/sendfile/sys/arm/conf/SAM9X25EK projects/sendfile/sys/arm/conf/SN9G45 projects/sendfile/sys/arm/conf/VYBRID projects/sendfile/sys/arm/conf/ZEDBOARD projects/sendfile/sys/arm/freescale/fsl_ocotp.c projects/sendfile/sys/arm/freescale/imx/files.imx51 projects/sendfile/sys/arm/freescale/imx/files.imx53 projects/sendfile/sys/arm/freescale/imx/files.imx6 projects/sendfile/sys/arm/freescale/imx/imx51_ccm.c projects/sendfile/sys/arm/freescale/imx/imx51_iomux.c projects/sendfile/sys/arm/freescale/imx/imx6_anatop.c projects/sendfile/sys/arm/freescale/imx/imx6_ccm.c projects/sendfile/sys/arm/freescale/imx/imx_ccmvar.h projects/sendfile/sys/arm/freescale/imx/imx_sdhci.c projects/sendfile/sys/arm/freescale/vybrid/vf_sai.c projects/sendfile/sys/arm/include/asm.h projects/sendfile/sys/arm/include/atomic.h projects/sendfile/sys/arm/include/intr.h projects/sendfile/sys/arm/mv/gpio.c projects/sendfile/sys/arm/rockchip/rk30xx_gpio.c projects/sendfile/sys/arm/ti/ti_sdhci.c projects/sendfile/sys/arm/versatile/files.versatile projects/sendfile/sys/arm/xilinx/files.zynq7 projects/sendfile/sys/boot/arm/uboot/help.uboot projects/sendfile/sys/boot/common/module.c projects/sendfile/sys/boot/fdt/dts/arm/cubieboard2.dts projects/sendfile/sys/boot/fdt/dts/arm/imx6.dtsi projects/sendfile/sys/boot/fdt/dts/arm/sun4i-a10.dtsi projects/sendfile/sys/boot/fdt/dts/arm/sun7i-a20.dtsi projects/sendfile/sys/boot/fdt/dts/arm/wandboard-dual.dts projects/sendfile/sys/boot/fdt/dts/arm/wandboard-quad.dts projects/sendfile/sys/boot/fdt/dts/arm/wandboard-solo.dts projects/sendfile/sys/boot/uboot/common/main.c projects/sendfile/sys/cam/ctl/ctl.c projects/sendfile/sys/cam/ctl/ctl.h projects/sendfile/sys/cam/ctl/ctl_backend_block.c projects/sendfile/sys/cam/ctl/ctl_frontend.c projects/sendfile/sys/cam/ctl/ctl_io.h projects/sendfile/sys/cam/ctl/ctl_private.h projects/sendfile/sys/cam/scsi/scsi_all.h projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c projects/sendfile/sys/conf/NOTES projects/sendfile/sys/conf/files projects/sendfile/sys/conf/files.amd64 projects/sendfile/sys/conf/files.i386 projects/sendfile/sys/conf/files.pc98 projects/sendfile/sys/dev/acpica/acpi.c projects/sendfile/sys/dev/ahci/ahci.c projects/sendfile/sys/dev/ahci/ahci.h projects/sendfile/sys/dev/ahci/ahciem.c projects/sendfile/sys/dev/bce/if_bce.c projects/sendfile/sys/dev/cadence/if_cgem.c projects/sendfile/sys/dev/cadence/if_cgem_hw.h projects/sendfile/sys/dev/ce/if_ce.c projects/sendfile/sys/dev/cp/if_cp.c projects/sendfile/sys/dev/ctau/if_ct.c projects/sendfile/sys/dev/cx/if_cx.c projects/sendfile/sys/dev/cxgbe/t4_netmap.c projects/sendfile/sys/dev/drm/drm_sysctl.c projects/sendfile/sys/dev/fdt/fdt_common.c projects/sendfile/sys/dev/fdt/simplebus.c projects/sendfile/sys/dev/gpio/ofw_gpiobus.c projects/sendfile/sys/dev/iwn/if_iwn.c projects/sendfile/sys/dev/iwn/if_iwnreg.h projects/sendfile/sys/dev/ixgbe/ixgbe.c projects/sendfile/sys/dev/ixgbe/ixv.c projects/sendfile/sys/dev/mii/e1000phy.c projects/sendfile/sys/dev/mrsas/mrsas.h projects/sendfile/sys/dev/mrsas/mrsas_cam.c projects/sendfile/sys/dev/nmdm/nmdm.c projects/sendfile/sys/dev/ofw/ofw_bus_subr.c projects/sendfile/sys/dev/ofw/ofw_console.c projects/sendfile/sys/dev/ofw/ofw_fdt.c projects/sendfile/sys/dev/ofw/ofwbus.c projects/sendfile/sys/dev/ofw/openfirm.c projects/sendfile/sys/dev/ofw/openfirm.h projects/sendfile/sys/dev/sdhci/sdhci.c projects/sendfile/sys/dev/sdhci/sdhci.h projects/sendfile/sys/dev/sdhci/sdhci_fdt.c projects/sendfile/sys/dev/sdhci/sdhci_if.m projects/sendfile/sys/dev/sdhci/sdhci_pci.c projects/sendfile/sys/dev/sound/usb/uaudio.c projects/sendfile/sys/dev/tsec/if_tsec_fdt.c projects/sendfile/sys/dev/usb/controller/ehci_pci.c projects/sendfile/sys/dev/usb/net/if_aue.c projects/sendfile/sys/dev/usb/quirk/usb_quirk.c projects/sendfile/sys/dev/usb/usbdevs projects/sendfile/sys/dev/usb/wlan/if_urtwn.c projects/sendfile/sys/dev/vt/hw/vga/vt_vga.c projects/sendfile/sys/dev/vt/vt.h projects/sendfile/sys/dev/vt/vt_buf.c projects/sendfile/sys/dev/vt/vt_core.c projects/sendfile/sys/dev/xen/blkfront/blkfront.c projects/sendfile/sys/fs/fuse/fuse_vnops.c projects/sendfile/sys/fs/nfs/nfsm_subs.h projects/sendfile/sys/fs/smbfs/smbfs_io.c projects/sendfile/sys/gdb/gdb_int.h projects/sendfile/sys/gdb/gdb_main.c projects/sendfile/sys/gdb/gdb_packet.c projects/sendfile/sys/geom/eli/g_eli_crypto.c projects/sendfile/sys/geom/eli/g_eli_integrity.c projects/sendfile/sys/geom/eli/g_eli_privacy.c projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/exynos4.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/exynos5250.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/exynos5420.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/exynos5440.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/hi3620-clock.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/imx6sl-clock.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/qcom,gcc-msm8960.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/qcom,gcc-msm8974.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/qcom,mmcc-msm8960.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/r8a7790-clock.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/r8a7791-clock.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/tegra114-car.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/tegra124-car.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/vf610-clock.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/mfd/as3722.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/pinctrl/am43xx.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/pinctrl/dra.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/pinctrl/omap.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/reset/qcom,gcc-msm8960.h (contents, props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/reset/qcom,mmcc-msm8960.h (contents, props changed) projects/sendfile/sys/i386/conf/GENERIC projects/sendfile/sys/i386/i386/initcpu.c projects/sendfile/sys/i386/i386/machdep.c projects/sendfile/sys/i386/i386/mp_machdep.c projects/sendfile/sys/i386/i386/trap.c projects/sendfile/sys/i386/include/md_var.h projects/sendfile/sys/i386/include/pcb.h projects/sendfile/sys/kern/imgact_binmisc.c projects/sendfile/sys/kern/imgact_shell.c projects/sendfile/sys/kern/kern_descrip.c projects/sendfile/sys/kern/kern_exit.c projects/sendfile/sys/kern/kern_jail.c projects/sendfile/sys/kern/kern_proc.c projects/sendfile/sys/kern/kern_synch.c projects/sendfile/sys/kern/kern_thread.c projects/sendfile/sys/kern/sysv_shm.c projects/sendfile/sys/kern/uipc_mbuf.c projects/sendfile/sys/kern/uipc_socket.c projects/sendfile/sys/kern/vfs_bio.c projects/sendfile/sys/kern/vfs_default.c projects/sendfile/sys/kern/vnode_if.src projects/sendfile/sys/mips/beri/beri_simplebus.c projects/sendfile/sys/mips/conf/WZR-300HP projects/sendfile/sys/mips/conf/WZR-300HP.hints projects/sendfile/sys/mips/include/sf_buf.h projects/sendfile/sys/mips/include/vmparam.h projects/sendfile/sys/modules/ahci/Makefile projects/sendfile/sys/modules/if_gif/Makefile projects/sendfile/sys/modules/usb/Makefile projects/sendfile/sys/net/if_vlan.c projects/sendfile/sys/net/netisr.h projects/sendfile/sys/netinet/in.h projects/sendfile/sys/netinet/in_pcb.c projects/sendfile/sys/netinet/in_pcb.h projects/sendfile/sys/netinet/in_pcbgroup.c projects/sendfile/sys/netinet/in_rss.c projects/sendfile/sys/netinet/in_rss.h projects/sendfile/sys/netinet/in_var.h projects/sendfile/sys/netinet/ip_fastfwd.c projects/sendfile/sys/netinet/ip_input.c projects/sendfile/sys/netinet/ip_output.c projects/sendfile/sys/netinet/ip_var.h projects/sendfile/sys/netinet/raw_ip.c projects/sendfile/sys/netinet/sctp_asconf.c projects/sendfile/sys/netinet/sctp_constants.h projects/sendfile/sys/netinet/sctp_input.c projects/sendfile/sys/netinet/sctp_os_bsd.h projects/sendfile/sys/netinet/sctp_output.c projects/sendfile/sys/netinet/sctp_pcb.c projects/sendfile/sys/netinet/sctp_sysctl.c projects/sendfile/sys/netinet/sctp_sysctl.h projects/sendfile/sys/netinet/sctp_usrreq.c projects/sendfile/sys/netinet/sctputil.c projects/sendfile/sys/netinet/tcp_input.c projects/sendfile/sys/netinet/tcp_reass.c projects/sendfile/sys/netinet/tcp_subr.c projects/sendfile/sys/netinet/tcp_syncache.c projects/sendfile/sys/netinet/udp_usrreq.c projects/sendfile/sys/netinet6/in6_pcb.c projects/sendfile/sys/netinet6/in6_src.c projects/sendfile/sys/netinet6/in6_var.h projects/sendfile/sys/netinet6/ip6_output.c projects/sendfile/sys/netinet6/sctp6_usrreq.c projects/sendfile/sys/netinet6/udp6_usrreq.c projects/sendfile/sys/netpfil/pf/pf.c projects/sendfile/sys/pc98/pc98/machdep.c projects/sendfile/sys/powerpc/ofw/ofw_pcibus.c projects/sendfile/sys/powerpc/powermac/macio.c projects/sendfile/sys/sparc64/pci/psycho.c projects/sendfile/sys/sys/cdefs.h projects/sendfile/sys/sys/imgact.h projects/sendfile/sys/sys/libkern.h projects/sendfile/sys/sys/mbuf.h projects/sendfile/sys/sys/param.h projects/sendfile/sys/sys/proc.h projects/sendfile/sys/sys/sdt.h projects/sendfile/sys/vm/vm_map.c projects/sendfile/sys/vm/vm_map.h projects/sendfile/sys/vm/vm_reserv.c projects/sendfile/sys/vm/vnode_pager.c projects/sendfile/sys/x86/acpica/acpi_wakeup.c projects/sendfile/sys/x86/include/fpu.h projects/sendfile/sys/x86/include/specialreg.h projects/sendfile/sys/x86/x86/tsc.c projects/sendfile/tools/make_libdeps.sh projects/sendfile/tools/regression/lib/msun/test-cexp.c projects/sendfile/tools/regression/lib/msun/test-conj.c projects/sendfile/tools/regression/lib/msun/test-csqrt.c projects/sendfile/tools/regression/lib/msun/test-invctrig.c projects/sendfile/tools/tools/vt/keymaps/KBDFILES.map projects/sendfile/tools/tools/vt/keymaps/convert-keymap.pl projects/sendfile/usr.bin/netstat/inet6.c projects/sendfile/usr.sbin/auditdistd/Makefile projects/sendfile/usr.sbin/autofs/token.l projects/sendfile/usr.sbin/bhyve/pci_virtio_block.c projects/sendfile/usr.sbin/bhyve/pci_virtio_net.c projects/sendfile/usr.sbin/bhyve/pci_virtio_rnd.c projects/sendfile/usr.sbin/bhyve/virtio.c projects/sendfile/usr.sbin/bhyve/virtio.h projects/sendfile/usr.sbin/bsdconfig/share/dialog.subr projects/sendfile/usr.sbin/ctld/ctl.conf.5 projects/sendfile/usr.sbin/ctld/ctld.c projects/sendfile/usr.sbin/ctld/login.c projects/sendfile/usr.sbin/iscsid/login.c projects/sendfile/usr.sbin/smbmsg/smbmsg.8 projects/sendfile/usr.sbin/traceroute/Makefile projects/sendfile/usr.sbin/unbound/local-setup/local-unbound-setup.sh projects/sendfile/usr.sbin/vidcontrol/vidcontrol.1 Directory Properties: projects/sendfile/ (props changed) projects/sendfile/cddl/ (props changed) projects/sendfile/cddl/contrib/opensolaris/ (props changed) projects/sendfile/contrib/libc-vis/ (props changed) projects/sendfile/contrib/llvm/ (props changed) projects/sendfile/contrib/llvm/tools/clang/ (props changed) projects/sendfile/crypto/heimdal/ (props changed) projects/sendfile/etc/ (props changed) projects/sendfile/include/ (props changed) projects/sendfile/lib/libc/ (props changed) projects/sendfile/sbin/ (props changed) projects/sendfile/share/ (props changed) projects/sendfile/share/man/man4/ (props changed) projects/sendfile/share/zoneinfo/ (props changed) projects/sendfile/sys/ (props changed) projects/sendfile/sys/boot/ (props changed) projects/sendfile/sys/cddl/contrib/opensolaris/ (props changed) projects/sendfile/sys/conf/ (props changed) projects/sendfile/sys/gnu/dts/ (props changed) projects/sendfile/sys/gnu/dts/include/ (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/ (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clk/ (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clk/at91.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clk/exynos-audss-clk.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/ (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/efm32-cmu.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/imx5-clock.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/mpc512x-clock.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/qcom,gcc-msm8660.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/qcom,mmcc-msm8974.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/samsung,s3c64xx-clock.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/tegra20-car.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/clock/tegra30-car.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/dma/ (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/dma/at91.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/gpio/ (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/gpio/gpio.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/gpio/tegra-gpio.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/input/ (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/input/input.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/interrupt-controller/ (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/interrupt-controller/arm-gic.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/interrupt-controller/irq.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/mfd/ (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/mfd/dbx500-prcmu.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/pinctrl/ (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/pinctrl/am33xx.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/pinctrl/at91.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/pinctrl/nomadik.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/pinctrl/pinctrl-tegra.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/pinctrl/rockchip.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/pwm/ (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/pwm/pwm.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/reset/ (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/reset/qcom,gcc-msm8660.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/reset/qcom,gcc-msm8974.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/reset/qcom,mmcc-msm8974.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/sound/ (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/sound/fsl-imx-audmux.h (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/thermal/ (props changed) projects/sendfile/sys/gnu/dts/include/dt-bindings/thermal/thermal.h (props changed) projects/sendfile/usr.sbin/bhyve/ (props changed) Modified: projects/sendfile/bin/sh/jobs.c ============================================================================== --- projects/sendfile/bin/sh/jobs.c Wed Sep 10 12:36:41 2014 (r271387) +++ projects/sendfile/bin/sh/jobs.c Wed Sep 10 12:55:34 2014 (r271388) @@ -118,6 +118,24 @@ static void showjob(struct job *, int); static int jobctl; #if JOBS +static void +jobctl_notty(void) +{ + if (ttyfd >= 0) { + close(ttyfd); + ttyfd = -1; + } + if (!iflag) { + setsignal(SIGTSTP); + setsignal(SIGTTOU); + setsignal(SIGTTIN); + jobctl = 1; + return; + } + out2fmt_flush("sh: can't access tty; job control turned off\n"); + mflag = 0; +} + void setjobctl(int on) { @@ -133,8 +151,10 @@ setjobctl(int on) while (i <= 2 && !isatty(i)) i++; if (i > 2 || - (ttyfd = fcntl(i, F_DUPFD_CLOEXEC, 10)) < 0) - goto out; + (ttyfd = fcntl(i, F_DUPFD_CLOEXEC, 10)) < 0) { + jobctl_notty(); + return; + } } if (ttyfd < 10) { /* @@ -142,9 +162,8 @@ setjobctl(int on) * the user's redirections. */ if ((i = fcntl(ttyfd, F_DUPFD_CLOEXEC, 10)) < 0) { - close(ttyfd); - ttyfd = -1; - goto out; + jobctl_notty(); + return; } close(ttyfd); ttyfd = i; @@ -152,11 +171,15 @@ setjobctl(int on) do { /* while we are in the background */ initialpgrp = tcgetpgrp(ttyfd); if (initialpgrp < 0) { -out: out2fmt_flush("sh: can't access tty; job control turned off\n"); - mflag = 0; + jobctl_notty(); return; } if (initialpgrp != getpgrp()) { + if (!iflag) { + initialpgrp = -1; + jobctl_notty(); + return; + } kill(0, SIGTTIN); continue; } @@ -168,9 +191,11 @@ out: out2fmt_flush("sh: can't access tcsetpgrp(ttyfd, rootpid); } else { /* turning job control off */ setpgid(0, initialpgrp); - tcsetpgrp(ttyfd, initialpgrp); - close(ttyfd); - ttyfd = -1; + if (ttyfd >= 0) { + tcsetpgrp(ttyfd, initialpgrp); + close(ttyfd); + ttyfd = -1; + } setsignal(SIGTSTP); setsignal(SIGTTOU); setsignal(SIGTTIN); @@ -195,7 +220,8 @@ fgcmd(int argc __unused, char **argv __u printjobcmd(jp); flushout(&output); pgrp = jp->ps[0].pid; - tcsetpgrp(ttyfd, pgrp); + if (ttyfd >= 0) + tcsetpgrp(ttyfd, pgrp); restartjob(jp); jp->foreground = 1; INTOFF; @@ -847,7 +873,8 @@ forkshell(struct job *jp, union node *n, pgrp = getpid(); else pgrp = jp->ps[0].pid; - if (setpgid(0, pgrp) == 0 && mode == FORK_FG) { + if (setpgid(0, pgrp) == 0 && mode == FORK_FG && + ttyfd >= 0) { /*** this causes superfluous TIOCSPGRPS ***/ if (tcsetpgrp(ttyfd, pgrp) < 0) error("tcsetpgrp failed, errno=%d", errno); @@ -1007,7 +1034,7 @@ waitforjob(struct job *jp, int *origstat dotrap(); #if JOBS if (jp->jobctl) { - if (tcsetpgrp(ttyfd, rootpid) < 0) + if (ttyfd >= 0 && tcsetpgrp(ttyfd, rootpid) < 0) error("tcsetpgrp failed, errno=%d\n", errno); } if (jp->state == JOBSTOPPED) Modified: projects/sendfile/bin/sh/sh.1 ============================================================================== --- projects/sendfile/bin/sh/sh.1 Wed Sep 10 12:36:41 2014 (r271387) +++ projects/sendfile/bin/sh/sh.1 Wed Sep 10 12:55:34 2014 (r271388) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd January 26, 2014 +.Dd September 4, 2014 .Dt SH 1 .Os .Sh NAME @@ -259,6 +259,12 @@ from input when in interactive mode. Force the shell to behave interactively. .It Fl m Li monitor Turn on job control (set automatically when interactive). +A new process group is created for each pipeline (called a job). +It is possible to suspend jobs or to have them run in the foreground or +in the background. +In a non-interactive shell, +this option can be set even if no terminal is available +and is useful to place processes in separate process groups. .It Fl n Li noexec If not interactive, read commands but do not execute them. Modified: projects/sendfile/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 ============================================================================== --- projects/sendfile/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Wed Sep 10 12:36:41 2014 (r271387) +++ projects/sendfile/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Wed Sep 10 12:55:34 2014 (r271388) @@ -414,7 +414,7 @@ or smaller can take advantage of this fe When this feature is enabled, the contents of highly-compressible blocks are stored in the block "pointer" itself .Po a misnomer in this case, as it contains -the compresseed data, rather than a pointer to its location on disk +the compressed data, rather than a pointer to its location on disk .Pc . Thus the space of the block Modified: projects/sendfile/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c ============================================================================== --- projects/sendfile/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Wed Sep 10 12:36:41 2014 (r271387) +++ projects/sendfile/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c Wed Sep 10 12:55:34 2014 (r271388) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ /* @@ -1068,8 +1069,8 @@ is_spare(nvlist_t *config, const char *p * Go through and find any devices that are in use. We rely on libdiskmgt for * the majority of this task. */ -static int -check_in_use(nvlist_t *config, nvlist_t *nv, boolean_t force, +static boolean_t +is_device_in_use(nvlist_t *config, nvlist_t *nv, boolean_t force, boolean_t replacing, boolean_t isspare) { nvlist_t **child; @@ -1078,6 +1079,7 @@ check_in_use(nvlist_t *config, nvlist_t int ret; char buf[MAXPATHLEN]; uint64_t wholedisk; + boolean_t anyinuse = B_FALSE; verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &type) == 0); @@ -1102,38 +1104,37 @@ check_in_use(nvlist_t *config, nvlist_t (void) strlcpy(buf, path, sizeof (buf)); if (is_spare(config, buf)) - return (0); + return (B_FALSE); } if (strcmp(type, VDEV_TYPE_DISK) == 0) ret = check_device(path, force, isspare); - - if (strcmp(type, VDEV_TYPE_FILE) == 0) + else if (strcmp(type, VDEV_TYPE_FILE) == 0) ret = check_file(path, force, isspare); - return (ret); + return (ret != 0); } for (c = 0; c < children; c++) - if ((ret = check_in_use(config, child[c], force, - replacing, B_FALSE)) != 0) - return (ret); + if (is_device_in_use(config, child[c], force, replacing, + B_FALSE)) + anyinuse = B_TRUE; if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_SPARES, &child, &children) == 0) for (c = 0; c < children; c++) - if ((ret = check_in_use(config, child[c], force, - replacing, B_TRUE)) != 0) - return (ret); + if (is_device_in_use(config, child[c], force, replacing, + B_TRUE)) + anyinuse = B_TRUE; if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE, &child, &children) == 0) for (c = 0; c < children; c++) - if ((ret = check_in_use(config, child[c], force, - replacing, B_FALSE)) != 0) - return (ret); + if (is_device_in_use(config, child[c], force, replacing, + B_FALSE)) + anyinuse = B_TRUE; - return (0); + return (anyinuse); } static const char * @@ -1487,7 +1488,7 @@ make_root_vdev(zpool_handle_t *zhp, int * uses (such as a dedicated dump device) that even '-f' cannot * override. */ - if (check_in_use(poolconfig, newroot, force, replacing, B_FALSE) != 0) { + if (is_device_in_use(poolconfig, newroot, force, replacing, B_FALSE)) { nvlist_free(newroot); return (NULL); } Modified: projects/sendfile/contrib/libc-vis/vis.c ============================================================================== --- projects/sendfile/contrib/libc-vis/vis.c Wed Sep 10 12:36:41 2014 (r271387) +++ projects/sendfile/contrib/libc-vis/vis.c Wed Sep 10 12:55:34 2014 (r271388) @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.60 2013/02/21 16:21:20 joerg Exp $ */ +/* $NetBSD: vis.c,v 1.62 2014/09/08 17:35:01 christos Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -57,7 +57,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.60 2013/02/21 16:21:20 joerg Exp $"); +__RCSID("$NetBSD: vis.c,v 1.62 2014/09/08 17:35:01 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -357,7 +357,7 @@ istrsenvisx(char *mbdst, size_t *dlen, c ssize_t mbslength, maxolen; _DIAGASSERT(mbdst != NULL); - _DIAGASSERT(mbsrc != NULL); + _DIAGASSERT(mbsrc != NULL || mblength == 0); _DIAGASSERT(mbextra != NULL); /* @@ -375,8 +375,6 @@ istrsenvisx(char *mbdst, size_t *dlen, c /* Allocate space for the wide char strings */ psrc = pdst = extra = NULL; - if (!mblength) - mblength = strlen(mbsrc); if ((psrc = calloc(mblength + 1, sizeof(*psrc))) == NULL) return -1; if ((pdst = calloc((4 * mblength) + 1, sizeof(*pdst))) == NULL) @@ -528,6 +526,15 @@ out: free(psrc); return error; } + +static int +istrsenvisxl(char *mbdst, size_t *dlen, const char *mbsrc, + int flags, const char *mbextra, int *cerr_ptr) +{ + return istrsenvisx(mbdst, dlen, mbsrc, + mbsrc != NULL ? strlen(mbsrc) : 0, flags, mbextra, cerr_ptr); +} + #endif #if !HAVE_SVIS @@ -571,13 +578,13 @@ snvis(char *mbdst, size_t dlen, int c, i int strsvis(char *mbdst, const char *mbsrc, int flags, const char *mbextra) { - return istrsenvisx(mbdst, NULL, mbsrc, 0, flags, mbextra, NULL); + return istrsenvisxl(mbdst, NULL, mbsrc, flags, mbextra, NULL); } int strsnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags, const char *mbextra) { - return istrsenvisx(mbdst, &dlen, mbsrc, 0, flags, mbextra, NULL); + return istrsenvisxl(mbdst, &dlen, mbsrc, flags, mbextra, NULL); } int @@ -646,13 +653,13 @@ nvis(char *mbdst, size_t dlen, int c, in int strvis(char *mbdst, const char *mbsrc, int flags) { - return istrsenvisx(mbdst, NULL, mbsrc, 0, flags, "", NULL); + return istrsenvisxl(mbdst, NULL, mbsrc, flags, "", NULL); } int strnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags) { - return istrsenvisx(mbdst, &dlen, mbsrc, 0, flags, "", NULL); + return istrsenvisxl(mbdst, &dlen, mbsrc, flags, "", NULL); } /* Modified: projects/sendfile/contrib/llvm/lib/Target/ARM/ARMInstrInfo.td ============================================================================== --- projects/sendfile/contrib/llvm/lib/Target/ARM/ARMInstrInfo.td Wed Sep 10 12:36:41 2014 (r271387) +++ projects/sendfile/contrib/llvm/lib/Target/ARM/ARMInstrInfo.td Wed Sep 10 12:55:34 2014 (r271388) @@ -3248,7 +3248,8 @@ def : ARMPat<(ARMaddc GPR:$src, imm0_655 def : ARMPat<(ARMadde GPR:$src, so_imm_not:$imm, CPSR), (SBCri GPR:$src, so_imm_not:$imm)>; def : ARMPat<(ARMadde GPR:$src, imm0_65535_neg:$imm, CPSR), - (SBCrr GPR:$src, (MOVi16 (imm_not_XFORM imm:$imm)))>; + (SBCrr GPR:$src, (MOVi16 (imm_not_XFORM imm:$imm)))>, + Requires<[IsARM, HasV6T2]>; // Note: These are implemented in C++ code, because they have to generate // ADD/SUBrs instructions, which use a complex pattern that a xform function Modified: projects/sendfile/contrib/llvm/patches/patch-r270147-llvm-r197824-r213427-r213960.diff ============================================================================== --- projects/sendfile/contrib/llvm/patches/patch-r270147-llvm-r197824-r213427-r213960.diff Wed Sep 10 12:36:41 2014 (r271387) +++ projects/sendfile/contrib/llvm/patches/patch-r270147-llvm-r197824-r213427-r213960.diff Wed Sep 10 12:55:34 2014 (r271388) @@ -1,7 +1,7 @@ -Index: contrib/llvm/include/llvm/Support/ELF.h +Index: include/llvm/Support/ELF.h =================================================================== ---- contrib/llvm/include/llvm/Support/ELF.h (revision 270019) -+++ contrib/llvm/include/llvm/Support/ELF.h (working copy) +--- include/llvm/Support/ELF.h (revision 270019) ++++ include/llvm/Support/ELF.h (working copy) @@ -437,6 +437,7 @@ R_PPC_GOT16_LO = 15, R_PPC_GOT16_HI = 16, @@ -10,10 +10,10 @@ Index: contrib/llvm/include/llvm/Support R_PPC_REL32 = 26, R_PPC_TLS = 67, R_PPC_DTPMOD32 = 68, -Index: contrib/llvm/lib/Object/ELF.cpp +Index: lib/Object/ELF.cpp =================================================================== ---- contrib/llvm/lib/Object/ELF.cpp (revision 270019) -+++ contrib/llvm/lib/Object/ELF.cpp (working copy) +--- lib/Object/ELF.cpp (revision 270019) ++++ lib/Object/ELF.cpp (working copy) @@ -507,6 +507,7 @@ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT16_LO); LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_GOT16_HI); @@ -22,10 +22,10 @@ Index: contrib/llvm/lib/Object/ELF.cpp LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_REL32); LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_TLS); LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_PPC_DTPMOD32); -Index: contrib/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp +Index: lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp =================================================================== ---- contrib/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp (revision 270019) -+++ contrib/llvm/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp (working copy) +--- lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp (revision 270019) ++++ lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp (working copy) @@ -18,6 +18,7 @@ #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" @@ -52,10 +52,10 @@ Index: contrib/llvm/lib/Target/PowerPC/I } -Index: contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp +Index: lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp =================================================================== ---- contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp (revision 270019) -+++ contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp (working copy) +--- lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp (revision 270019) ++++ lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp (working copy) @@ -64,7 +64,15 @@ llvm_unreachable("Unimplemented"); case PPC::fixup_ppc_br24: @@ -123,10 +123,10 @@ Index: contrib/llvm/lib/Target/PowerPC/M break; } break; -Index: contrib/llvm/lib/Target/PowerPC/PPC.h +Index: lib/Target/PowerPC/PPC.h =================================================================== ---- contrib/llvm/lib/Target/PowerPC/PPC.h (revision 270019) -+++ contrib/llvm/lib/Target/PowerPC/PPC.h (working copy) +--- lib/Target/PowerPC/PPC.h (revision 270019) ++++ lib/Target/PowerPC/PPC.h (working copy) @@ -53,10 +53,11 @@ // PPC Specific MachineOperand flags. MO_NO_FLAG, @@ -143,10 +143,10 @@ Index: contrib/llvm/lib/Target/PowerPC/P /// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to /// the function's picbase, e.g. lo16(symbol-picbase). -Index: contrib/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +Index: lib/Target/PowerPC/PPCAsmPrinter.cpp =================================================================== ---- contrib/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp (revision 270019) -+++ contrib/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp (working copy) +--- lib/Target/PowerPC/PPCAsmPrinter.cpp (revision 270019) ++++ lib/Target/PowerPC/PPCAsmPrinter.cpp (working copy) @@ -19,6 +19,7 @@ #define DEBUG_TYPE "asmprinter" #include "PPC.h" @@ -578,10 +578,10 @@ Index: contrib/llvm/lib/Target/PowerPC/P } } -Index: contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp +Index: lib/Target/PowerPC/PPCFrameLowering.cpp =================================================================== ---- contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp (revision 270019) -+++ contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp (working copy) +--- lib/Target/PowerPC/PPCFrameLowering.cpp (revision 270019) ++++ lib/Target/PowerPC/PPCFrameLowering.cpp (working copy) @@ -299,7 +299,7 @@ const PPCRegisterInfo *RegInfo = static_cast(MF.getTarget().getRegisterInfo()); @@ -664,10 +664,10 @@ Index: contrib/llvm/lib/Target/PowerPC/P // Allocate the frame index for the base pointer save area. BPSI = MFI->CreateFixedObject(isPPC64? 8 : 4, BPOffset, true); // Save the result. -Index: contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.h +Index: lib/Target/PowerPC/PPCFrameLowering.h =================================================================== ---- contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.h (revision 270019) -+++ contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.h (working copy) +--- lib/Target/PowerPC/PPCFrameLowering.h (revision 270019) ++++ lib/Target/PowerPC/PPCFrameLowering.h (working copy) @@ -96,12 +96,14 @@ /// getBasePointerSaveOffset - Return the previous frame offset to save the @@ -685,10 +685,10 @@ Index: contrib/llvm/lib/Target/PowerPC/P } /// getLinkageSize - Return the size of the PowerPC ABI linkage area. -Index: contrib/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp +Index: lib/Target/PowerPC/PPCISelDAGToDAG.cpp =================================================================== ---- contrib/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp (revision 270019) -+++ contrib/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp (working copy) +--- lib/Target/PowerPC/PPCISelDAGToDAG.cpp (revision 270019) ++++ lib/Target/PowerPC/PPCISelDAGToDAG.cpp (working copy) @@ -15,6 +15,7 @@ #define DEBUG_TYPE "ppc-codegen" #include "PPC.h" @@ -748,10 +748,10 @@ Index: contrib/llvm/lib/Target/PowerPC/P case PPCISD::VADD_SPLAT: { // This expands into one of three sequences, depending on whether // the first operand is odd or even, positive or negative. -Index: contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +Index: lib/Target/PowerPC/PPCISelLowering.cpp =================================================================== ---- contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp (revision 270019) -+++ contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp (working copy) +--- lib/Target/PowerPC/PPCISelLowering.cpp (revision 270019) ++++ lib/Target/PowerPC/PPCISelLowering.cpp (working copy) @@ -670,6 +670,7 @@ case PPCISD::ADDIS_TOC_HA: return "PPCISD::ADDIS_TOC_HA"; case PPCISD::LD_TOC_L: return "PPCISD::LD_TOC_L"; @@ -972,10 +972,10 @@ Index: contrib/llvm/lib/Target/PowerPC/P MachineInstrBuilder MIB; -Index: contrib/llvm/lib/Target/PowerPC/PPCISelLowering.h +Index: lib/Target/PowerPC/PPCISelLowering.h =================================================================== ---- contrib/llvm/lib/Target/PowerPC/PPCISelLowering.h (revision 270019) -+++ contrib/llvm/lib/Target/PowerPC/PPCISelLowering.h (working copy) +--- lib/Target/PowerPC/PPCISelLowering.h (revision 270019) ++++ lib/Target/PowerPC/PPCISelLowering.h (working copy) @@ -177,6 +177,12 @@ CR6SET, CR6UNSET, @@ -989,10 +989,10 @@ Index: contrib/llvm/lib/Target/PowerPC/P /// G8RC = ADDIS_GOT_TPREL_HA %X2, Symbol - Used by the initial-exec /// TLS model, produces an ADDIS8 instruction that adds the GOT /// base to sym\@got\@tprel\@ha. -Index: contrib/llvm/lib/Target/PowerPC/PPCInstr64Bit.td +Index: lib/Target/PowerPC/PPCInstr64Bit.td =================================================================== ---- contrib/llvm/lib/Target/PowerPC/PPCInstr64Bit.td (revision 270019) -+++ contrib/llvm/lib/Target/PowerPC/PPCInstr64Bit.td (working copy) +--- lib/Target/PowerPC/PPCInstr64Bit.td (revision 270019) ++++ lib/Target/PowerPC/PPCInstr64Bit.td (working copy) @@ -36,10 +36,6 @@ def tocentry : Operand { let MIOperandInfo = (ops i64imm:$imm); @@ -1004,10 +1004,10 @@ Index: contrib/llvm/lib/Target/PowerPC/P def tlsreg : Operand { let EncoderMethod = "getTLSRegEncoding"; let ParserMatchClass = PPCTLSRegOperand; -Index: contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.td +Index: lib/Target/PowerPC/PPCInstrInfo.td =================================================================== ---- contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.td (revision 270019) -+++ contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.td (working copy) +--- lib/Target/PowerPC/PPCInstrInfo.td (revision 270019) ++++ lib/Target/PowerPC/PPCInstrInfo.td (working copy) @@ -57,6 +57,9 @@ SDTCisPtrTy<0>, SDTCisVT<1, i32> ]>; @@ -1130,10 +1130,10 @@ Index: contrib/llvm/lib/Target/PowerPC/P // Standard shifts. These are represented separately from the real shifts above // so that we can distinguish between shifts that allow 5-bit and 6-bit shift // amounts. -Index: contrib/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp +Index: lib/Target/PowerPC/PPCMCInstLower.cpp =================================================================== ---- contrib/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp (revision 270019) -+++ contrib/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp (working copy) +--- lib/Target/PowerPC/PPCMCInstLower.cpp (revision 270019) ++++ lib/Target/PowerPC/PPCMCInstLower.cpp (working copy) @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// @@ -1188,10 +1188,10 @@ Index: contrib/llvm/lib/Target/PowerPC/P const MCExpr *Expr = MCSymbolRefExpr::Create(Symbol, RefKind, Ctx); if (!MO.isJTI() && MO.getOffset()) -Index: contrib/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp +Index: lib/Target/PowerPC/PPCMachineFunctionInfo.cpp =================================================================== ---- contrib/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp (revision 270019) -+++ contrib/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp (working copy) +--- lib/Target/PowerPC/PPCMachineFunctionInfo.cpp (revision 270019) ++++ lib/Target/PowerPC/PPCMachineFunctionInfo.cpp (working copy) @@ -8,8 +8,16 @@ //===----------------------------------------------------------------------===// @@ -1209,10 +1209,10 @@ Index: contrib/llvm/lib/Target/PowerPC/P + return MF.getContext().GetOrCreateSymbol(Twine(MAI->getPrivateGlobalPrefix())+ + Twine(MF.getFunctionNumber())+"$poff"); +} -Index: contrib/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.h +Index: lib/Target/PowerPC/PPCMachineFunctionInfo.h =================================================================== ---- contrib/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.h (revision 270019) -+++ contrib/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.h (working copy) +--- lib/Target/PowerPC/PPCMachineFunctionInfo.h (revision 270019) ++++ lib/Target/PowerPC/PPCMachineFunctionInfo.h (working copy) @@ -92,6 +92,12 @@ /// 64-bit SVR4 ABI. SmallVector MustSaveCRs; @@ -1249,10 +1249,10 @@ Index: contrib/llvm/lib/Target/PowerPC/P }; } // end of namespace llvm -Index: contrib/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp +Index: lib/Target/PowerPC/PPCRegisterInfo.cpp =================================================================== ---- contrib/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp (revision 270019) -+++ contrib/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp (working copy) +--- lib/Target/PowerPC/PPCRegisterInfo.cpp (revision 270019) ++++ lib/Target/PowerPC/PPCRegisterInfo.cpp (working copy) @@ -199,7 +199,16 @@ if (PPCFI->needsFP(MF)) Reserved.set(PPC::R31); @@ -1287,10 +1287,10 @@ Index: contrib/llvm/lib/Target/PowerPC/P } bool PPCRegisterInfo::hasBasePointer(const MachineFunction &MF) const { -Index: contrib/llvm/lib/Target/PowerPC/PPCSubtarget.h +Index: lib/Target/PowerPC/PPCSubtarget.h =================================================================== ---- contrib/llvm/lib/Target/PowerPC/PPCSubtarget.h (revision 270019) -+++ contrib/llvm/lib/Target/PowerPC/PPCSubtarget.h (working copy) +--- lib/Target/PowerPC/PPCSubtarget.h (revision 270019) ++++ lib/Target/PowerPC/PPCSubtarget.h (working copy) @@ -189,6 +189,9 @@ /// isBGQ - True if this is a BG/Q platform. bool isBGQ() const { return TargetTriple.getVendor() == Triple::BGQ; } Copied: projects/sendfile/contrib/llvm/patches/patch-r271024-llvm-r216989-fix-movm-armv6.diff (from r271387, head/contrib/llvm/patches/patch-r271024-llvm-r216989-fix-movm-armv6.diff) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/sendfile/contrib/llvm/patches/patch-r271024-llvm-r216989-fix-movm-armv6.diff Wed Sep 10 12:55:34 2014 (r271388, copy of r271387, head/contrib/llvm/patches/patch-r271024-llvm-r216989-fix-movm-armv6.diff) @@ -0,0 +1,14 @@ +Index: lib/Target/ARM/ARMInstrInfo.td +=================================================================== +--- lib/Target/ARM/ARMInstrInfo.td (revision 271024) ++++ lib/Target/ARM/ARMInstrInfo.td (revision 271026) +@@ -3248,7 +3248,8 @@ + def : ARMPat<(ARMadde GPR:$src, so_imm_not:$imm, CPSR), + (SBCri GPR:$src, so_imm_not:$imm)>; + def : ARMPat<(ARMadde GPR:$src, imm0_65535_neg:$imm, CPSR), +- (SBCrr GPR:$src, (MOVi16 (imm_not_XFORM imm:$imm)))>; ++ (SBCrr GPR:$src, (MOVi16 (imm_not_XFORM imm:$imm)))>, ++ Requires<[IsARM, HasV6T2]>; + + // Note: These are implemented in C++ code, because they have to generate + // ADD/SUBrs instructions, which use a complex pattern that a xform function Copied: projects/sendfile/contrib/llvm/patches/patch-r271282-clang-r200797-r200798-r200805-debug-info-crash.diff (from r271387, head/contrib/llvm/patches/patch-r271282-clang-r200797-r200798-r200805-debug-info-crash.diff) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/sendfile/contrib/llvm/patches/patch-r271282-clang-r200797-r200798-r200805-debug-info-crash.diff Wed Sep 10 12:55:34 2014 (r271388, copy of r271387, head/contrib/llvm/patches/patch-r271282-clang-r200797-r200798-r200805-debug-info-crash.diff) @@ -0,0 +1,51 @@ +diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp +index 59ba47c..dddc7e7 100644 +--- a/lib/CodeGen/CGDebugInfo.cpp ++++ b/lib/CodeGen/CGDebugInfo.cpp +@@ -2251,9 +2251,10 @@ llvm::DICompositeType CGDebugInfo::CreateLimitedType(const RecordType *Ty) { + if (T && (!T.isForwardDecl() || !RD->getDefinition())) + return T; + +- // If this is just a forward declaration, construct an appropriately +- // marked node and just return it. +- if (!RD->getDefinition()) ++ // If this is just a forward or incomplete declaration, construct an ++ // appropriately marked node and just return it. ++ const RecordDecl *D = RD->getDefinition(); ++ if (!D || !D->isCompleteDefinition()) + return getOrCreateRecordFwdDecl(Ty, RDContext); + + uint64_t Size = CGM.getContext().getTypeSize(Ty); +diff --git a/test/CodeGenCXX/debug-info-template-fwd.cpp b/test/CodeGenCXX/debug-info-template-fwd.cpp +new file mode 100644 +index 0000000..b2b7073 +--- /dev/null ++++ b/test/CodeGenCXX/debug-info-template-fwd.cpp +@@ -0,0 +1,27 @@ ++// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -g -emit-llvm -o - | FileCheck %s ++// This test is for a crash when emitting debug info for not-yet-completed ++// types. ++// Test that we don't actually emit a forward decl for the offending class: ++// CHECK: [ DW_TAG_structure_type ] [Derived] {{.*}} [def] ++// rdar://problem/15931354 ++template class Derived; ++ ++template class Base { ++ static Derived *create(); ++}; ++ ++template struct Derived : Base { ++}; ++ ++Base *f; ++ ++// During the instantiation of Derived, Base becomes required to be ++// complete - since the declaration has already been emitted (due to 'f', ++// above), we immediately try to build debug info for Base which then ++// requires the (incomplete definition) of Derived which is problematic. ++// ++// (if 'f' is not present, the point at which Base becomes required to be ++// complete during the instantiation of Derived is a no-op because ++// Base was never emitted so we ignore it and carry on until we ++// wire up the base class of Derived in the debug info later on) ++Derived d; Modified: projects/sendfile/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp ============================================================================== --- projects/sendfile/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp Wed Sep 10 12:36:41 2014 (r271387) +++ projects/sendfile/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp Wed Sep 10 12:55:34 2014 (r271388) @@ -2235,9 +2235,10 @@ llvm::DICompositeType CGDebugInfo::Creat if (T && (!T.isForwardDecl() || !RD->getDefinition())) return T; - // If this is just a forward declaration, construct an appropriately - // marked node and just return it. - if (!RD->getDefinition()) + // If this is just a forward or incomplete declaration, construct an + // appropriately marked node and just return it. + const RecordDecl *D = RD->getDefinition(); + if (!D || !D->isCompleteDefinition()) return getOrCreateRecordFwdDecl(Ty, RDContext); uint64_t Size = CGM.getContext().getTypeSize(Ty); Modified: projects/sendfile/contrib/smbfs/lib/smb/ctx.c ============================================================================== --- projects/sendfile/contrib/smbfs/lib/smb/ctx.c Wed Sep 10 12:36:41 2014 (r271387) +++ projects/sendfile/contrib/smbfs/lib/smb/ctx.c Wed Sep 10 12:55:34 2014 (r271388) @@ -191,10 +191,6 @@ smb_ctx_parseunc(struct smb_ctx *ctx, co smb_error("no user name required", 0); return EINVAL; } - if (*p1 == 0) { - smb_error("empty user name", 0); - return EINVAL; - } error = smb_ctx_setuser(ctx, tmp); if (error) return error; @@ -521,11 +517,6 @@ smb_ctx_resolve(struct smb_ctx *ctx) smb_error("no server name specified", 0); return EINVAL; } - if (ssn->ioc_user[0] == 0) { - smb_error("no user name specified for server %s", - 0, ssn->ioc_srvname); - return EINVAL; - } if (ctx->ct_minlevel >= SMBL_SHARE && sh->ioc_share[0] == 0) { smb_error("no share name specified for %s@%s", 0, ssn->ioc_user, ssn->ioc_srvname); Modified: projects/sendfile/contrib/smbfs/mount_smbfs/mount_smbfs.c ============================================================================== --- projects/sendfile/contrib/smbfs/mount_smbfs/mount_smbfs.c Wed Sep 10 12:36:41 2014 (r271387) +++ projects/sendfile/contrib/smbfs/mount_smbfs/mount_smbfs.c Wed Sep 10 12:55:34 2014 (r271388) @@ -81,7 +81,7 @@ main(int argc, char *argv[]) #else struct xvfsconf vfc; #endif - char *next; + char *next, *p, *val; int opt, error, mntflags, caseopt, fd; uid_t uid; gid_t gid; @@ -194,6 +194,13 @@ main(int argc, char *argv[]) }; case 'o': getmntopts(optarg, mopts, &mntflags, 0); + p = strchr(optarg, '='); + val = NULL; + if (p != NULL) { + *p = '\0'; + val = p + 1; + } + build_iovec(&iov, &iovlen, optarg, val, (size_t)-1); break; case 'c': switch (optarg[0]) { Modified: projects/sendfile/crypto/heimdal/tools/krb5-config.in ============================================================================== --- projects/sendfile/crypto/heimdal/tools/krb5-config.in Wed Sep 10 12:36:41 2014 (r271387) +++ projects/sendfile/crypto/heimdal/tools/krb5-config.in Wed Sep 10 12:55:34 2014 (r271388) @@ -123,7 +123,7 @@ if test "$do_libs" = "yes"; then lib_flags="-L${libdir}" case $library in gssapi) - lib_flags="$lib_flags -lgssapi -lheimntlm" + lib_flags="$lib_flags -lgssapi -lgssapi_krb5 -lheimntlm" ;; kadm-client) lib_flags="$lib_flags -lkadm5clnt" Modified: projects/sendfile/etc/mtree/BSD.root.dist ============================================================================== --- projects/sendfile/etc/mtree/BSD.root.dist Wed Sep 10 12:36:41 2014 (r271387) +++ projects/sendfile/etc/mtree/BSD.root.dist Wed Sep 10 12:55:34 2014 (r271388) @@ -10,6 +10,8 @@ boot defaults .. + dtb + .. firmware .. kernel Modified: projects/sendfile/etc/periodic/daily/110.clean-tmps ============================================================================== --- projects/sendfile/etc/periodic/daily/110.clean-tmps Wed Sep 10 12:36:41 2014 (r271387) +++ projects/sendfile/etc/periodic/daily/110.clean-tmps Wed Sep 10 12:55:34 2014 (r271388) @@ -45,8 +45,8 @@ case "$daily_clean_tmps_enable" in rc=$(for dir in $daily_clean_tmps_dirs do [ ."${dir#/}" != ."$dir" -a -d $dir ] && cd $dir && { - find -d . -type f $args -delete $print - find -d . ! -name . -type d $dargs -delete $print + find -x -d . -type f $args -delete $print + find -x -d . ! -name . -type d $dargs -delete $print } | sed "s,^\\., $dir," done | tee /dev/stderr | wc -l) [ -z "$print" ] && rc=0 Modified: projects/sendfile/etc/rc.d/jail ============================================================================== --- projects/sendfile/etc/rc.d/jail Wed Sep 10 12:36:41 2014 (r271387) +++ projects/sendfile/etc/rc.d/jail Wed Sep 10 12:55:34 2014 (r271388) @@ -207,6 +207,10 @@ parse_options() extract_var $_j consolelog exec.consolelog - \ /var/log/jail_${_j}_console.log + if [ -r $_fstab ]; then + echo " mount.fstab = \"$_fstab\";" + fi + eval : \${jail_${_j}_devfs_enable:=${jail_devfs_enable:-NO}} if checkyesno jail_${_j}_devfs_enable; then echo " mount.devfs;" @@ -222,11 +226,7 @@ parse_options() ;; *) warn "devfs_ruleset must be an integer." ;; esac - if [ -r $_fstab ]; then - echo " mount.fstab = \"$_fstab\";" - fi fi - eval : \${jail_${_j}_fdescfs_enable:=${jail_fdescfs_enable:-NO}} if checkyesno jail_${_j}_fdescfs_enable; then echo " mount.fdescfs;" @@ -319,10 +319,8 @@ jail_extract_address() _mask=${_mask:-/32} elif [ "${_type}" = "inet6" ]; then - # In case _maske is not set for IPv6, use /128. + # In case _mask is not set for IPv6, use /128. _mask=${_mask:-/128} - warn "$_type $_addr: an IPv6 address should always be " \ - "specified with a prefix length. /128 is used." fi } Modified: projects/sendfile/etc/rc.d/syscons ============================================================================== --- projects/sendfile/etc/rc.d/syscons Wed Sep 10 12:36:41 2014 (r271387) +++ projects/sendfile/etc/rc.d/syscons Wed Sep 10 12:55:34 2014 (r271388) @@ -45,16 +45,122 @@ stop_cmd=":" kbddev=/dev/ttyv0 viddev=/dev/ttyv0 -_sc_config="syscons" +_sc_config= +_sc_console= _sc_initdone= +_sc_keymap_msg= sc_init() { if [ -z "${_sc_initdone}" ]; then + if [ -z "${_sc_console}" ]; then + if [ x`sysctl -n kern.vty` = x"vt" ]; then + _sc_console="vt" + else + _sc_console="syscons" + fi + _sc_config="${_sc_console}" + fi echo -n "Configuring ${_sc_config}:" _sc_initdone=yes fi } +# syscons to vt migration helper +lookup_keymap_for_vt() +{ + keymap=`basename $1 .kbd` + case $keymap in +hy.armscii-8) echo am;; +be.iso.acc) echo be.acc;; +be.iso) echo be;; +bg.bds.ctrlcaps) echo bg.bds;; +bg.phonetic.ctrlcaps) echo bg.phonetic;; +br275.iso.acc) echo br;; +br275.*) echo br.noacc;; +by.*) echo by;; +fr_CA.iso.acc) echo ca-fr;; +swissgerman.macbook.acc) echo ch.macbook.acc;; +swissgerman.iso.acc) echo ch.acc;; +swissgerman.*) echo ch;; +swissfrench.iso.acc) echo ch-fr.acc;; +swissfrench.*) echo ch-fr;; +ce.iso2) echo centraleuropean.qwerty;; +colemak.iso15.acc) echo colemak.acc;; +cs.*|cz.*) echo cz;; +german.iso.acc) echo de.acc;; +german.*) echo de;; +danish.iso.acc) echo dk.acc;; +danish.iso.macbook) echo dk.macbook;; +danish.*) echo dk;; +estonian.*) echo ee;; +spanish.dvorak) echo es.dvorak;; +spanish.iso*.acc) echo es.acc;; +spanish.iso) echo es;; +finnish.*) echo fi;; +fr.macbook.acc) echo fr.macbook;; +fr.iso.acc) echo fr.acc;; +fr.iso) echo fr;; +el.iso07) echo gr;; +gr.us101.acc) echo gr.101.acc;; +hr.iso) echo hr;; +hu.iso2.101keys) echo hu.101;; +hu.iso2.102keys) echo hu.102;; +iw.iso8) echo il;; +icelandic.iso.acc) echo is.acc;; +icelandic.iso) echo is;; +it.iso) echo it;; +jp.106x) echo jp.capsctrl;; +jp.106) echo jp;; +#?? jp.pc98.iso) echo jp.pc98;; +kk.pt154.io) echo kz.io;; +kk.pt154.kst) echo kz.kst;; +latinamerican.iso.acc) echo latinamerican.acc;; +lt.iso4) echo lt;; +norwegian.iso) echo no;; +norwegian.dvorak) echo no.dvorak;; +dutch.iso.acc) echo nl;; +eee_nordic) echo nordic.asus-eee;; +pl_PL.dvorak) echo pl.dvorak;; +pl_PL.ISO8859-2) echo pl;; +pt.iso.acc) echo pt.acc;; +pt.iso) echo pt;; +ru.koi8-r.shift) echo ru.shift;; +ru.koi8-r.win) echo ru.win;; +ru.*) echo ru;; +swedish.*) echo se;; +si.iso) echo si;; +sk.iso2) echo sk;; +tr.iso9.q) echo tr;; +ua.koi8-u.shift.alt) echo ua.shift.alt;; +ua.*) echo ua;; +uk.*-ctrl) echo uk.capsctrl;; +uk.dvorak) echo uk.dvorak;; +uk.*) echo uk;; +us.iso.acc) echo us.acc;; +us.pc-ctrl) echo us.ctrl;; +us.iso) echo us;; + esac +} + +kbdcontrol_load_keymap() +{ + errmsg=`kbdcontrol < ${kbddev} -l ${keymap} 2>&1` + if [ -n "${errmsg}" -a "${_sc_console}" = "vt" ]; then + _sc_keymap_msg="${errmsg}" + keymap_vt=`lookup_keymap_for_vt ${keymap}` + if [ -n "${keymap_vt}" ]; then + errmsg=`kbdcontrol < ${kbddev} -l ${keymap_vt} 2>&1` + if [ -z "${errmsg}" ]; then + _sc_keymap_msg="New keymap: In /etc/rc.conf replace 'keymap=${keymap}' by 'keymap=${keymap_vt}'" + fi + else + _sc_keymap_msg="No replacement found for keymap '${keymap}'. +You may try to convert your keymap file using 'convert-keymap.pl', which is +part of the system sources and located in /usr/src/tools/tools/vt/keymaps/" + fi + fi +} + # helper syscons_configure_keyboard() { @@ -65,7 +171,7 @@ syscons_configure_keyboard() ;; *) sc_init - echo -n ' keymap'; kbdcontrol < ${kbddev} -l ${keymap} + echo -n ' keymap'; kbdcontrol_load_keymap ;; esac @@ -139,10 +245,9 @@ syscons_setkeyboard() # if [ -n "${_sc_initdone}" ]; then echo '.' - _sc_config="syscons" + _sc_config="${_sc_console}" _sc_initdone= fi - } syscons_precmd() @@ -256,6 +361,12 @@ syscons_start() fi [ -n "${_sc_initdone}" ] && echo '.' + if [ -n "${_sc_keymap_msg}" ]; then + echo + echo "WARNING:" + echo "${_sc_keymap_msg}." + echo + fi } load_rc_config $name Modified: projects/sendfile/include/pthread.h ============================================================================== --- projects/sendfile/include/pthread.h Wed Sep 10 12:36:41 2014 (r271387) +++ projects/sendfile/include/pthread.h Wed Sep 10 12:55:34 2014 (r271388) @@ -193,8 +193,10 @@ int pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *); int pthread_cond_signal(pthread_cond_t *); int pthread_cond_timedwait(pthread_cond_t *, - pthread_mutex_t *, const struct timespec *); -int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *); + pthread_mutex_t *__mutex, const struct timespec *) + __requires_exclusive(*__mutex); +int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *__mutex) + __requires_exclusive(*__mutex); int pthread_create(pthread_t *, const pthread_attr_t *, void *(*) (void *), void *); int pthread_detach(pthread_t); @@ -213,27 +215,42 @@ int pthread_mutexattr_getpshared(const int pthread_mutexattr_gettype(pthread_mutexattr_t *, int *); int pthread_mutexattr_settype(pthread_mutexattr_t *, int); int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int); -int pthread_mutex_destroy(pthread_mutex_t *); -int pthread_mutex_init(pthread_mutex_t *, - const pthread_mutexattr_t *); -int pthread_mutex_lock(pthread_mutex_t *); -int pthread_mutex_trylock(pthread_mutex_t *); -int pthread_mutex_timedlock(pthread_mutex_t *, - const struct timespec *); -int pthread_mutex_unlock(pthread_mutex_t *); +int pthread_mutex_destroy(pthread_mutex_t *__mutex) + __requires_unlocked(*__mutex); +int pthread_mutex_init(pthread_mutex_t *__mutex, + const pthread_mutexattr_t *) + __requires_unlocked(*__mutex); +int pthread_mutex_lock(pthread_mutex_t *__mutex) + __locks_exclusive(*__mutex); +int pthread_mutex_trylock(pthread_mutex_t *__mutex) + __trylocks_exclusive(0, *__mutex); +int pthread_mutex_timedlock(pthread_mutex_t *__mutex, + const struct timespec *) + __trylocks_exclusive(0, *__mutex); +int pthread_mutex_unlock(pthread_mutex_t *__mutex) + __unlocks(*__mutex); int pthread_once(pthread_once_t *, void (*) (void)); -int pthread_rwlock_destroy(pthread_rwlock_t *); -int pthread_rwlock_init(pthread_rwlock_t *, - const pthread_rwlockattr_t *); -int pthread_rwlock_rdlock(pthread_rwlock_t *); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Thu Sep 11 02:37:03 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 715EDAAA; Thu, 11 Sep 2014 02:37:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 50A80D77; Thu, 11 Sep 2014 02:37:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8B2b3qi026587; Thu, 11 Sep 2014 02:37:03 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8B2b31W026586; Thu, 11 Sep 2014 02:37:03 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201409110237.s8B2b31W026586@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Thu, 11 Sep 2014 02:37:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271415 - projects/bhyve_svm/sys/amd64/vmm/amd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Sep 2014 02:37:03 -0000 Author: neel Date: Thu Sep 11 02:37:02 2014 New Revision: 271415 URL: http://svnweb.freebsd.org/changeset/base/271415 Log: Repurpose the V_IRQ interrupt injection to implement VMX-style interrupt window exiting. This simply involves setting V_IRQ and enabling the VINTR intercept. This instructs the CPU to trap back into the hypervisor as soon as an interrupt can be injected into the guest. The pending interrupt is then injected via the traditional event injection mechanism. Rework vcpu interrupt injection so that Linux guests now idle with host cpu utilization close to 0%. Reviewed by: Anish Gupta (earlier version) Discussed with: grehan Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Thu Sep 11 01:53:55 2014 (r271414) +++ projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Thu Sep 11 02:37:02 2014 (r271415) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -112,8 +113,9 @@ static uint8_t hsave[MAXCPU][PAGE_SIZE] */ static struct svm_regctx host_ctx[MAXCPU]; -static VMM_STAT_AMD(VCPU_EXITINTINFO, "Valid VMCB EXITINTINFO"); -static VMM_STAT_AMD(VCPU_INTINFO_INJECTED, "VMM pending exception injected"); +static VMM_STAT_AMD(VCPU_EXITINTINFO, "VM exits during event delivery"); +static VMM_STAT_AMD(VCPU_INTINFO_INJECTED, "Events pending at VM entry"); +static VMM_STAT_AMD(VMEXIT_VINTR, "VM exits due to interrupt window"); /* * Common function to enable or disabled SVM for a CPU. @@ -925,6 +927,60 @@ svm_save_intinfo(struct svm_softc *svm_s vm_exit_intinfo(svm_sc->vm, vcpu, intinfo); } +static __inline void +enable_intr_window_exiting(struct svm_softc *sc, int vcpu) +{ + struct vmcb_ctrl *ctrl; + + ctrl = svm_get_vmcb_ctrl(sc, vcpu); + + if (ctrl->v_irq == 0) { + VCPU_CTR0(sc->vm, vcpu, "Enable intr window exiting"); + ctrl->v_irq = 1; + ctrl->v_ign_tpr = 1; + vcpu_set_dirty(sc, vcpu, VMCB_CACHE_TPR); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, + VMCB_INTCPT_VINTR); + } +} + +static __inline void +disable_intr_window_exiting(struct svm_softc *sc, int vcpu) +{ + struct vmcb_ctrl *ctrl; + + ctrl = svm_get_vmcb_ctrl(sc, vcpu); + + if (ctrl->v_irq) { + VCPU_CTR0(sc->vm, vcpu, "Disable intr window exiting"); + ctrl->v_irq = 0; + vcpu_set_dirty(sc, vcpu, VMCB_CACHE_TPR); + svm_disable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, + VMCB_INTCPT_VINTR); + } +} + +static int +nmi_blocked(struct svm_softc *sc, int vcpu) +{ + /* XXX need to track NMI blocking */ + return (0); +} + +static void +enable_nmi_blocking(struct svm_softc *sc, int vcpu) +{ + /* XXX enable iret intercept */ +} + +#ifdef notyet +static void +clear_nmi_blocking(struct svm_softc *sc, int vcpu) +{ + /* XXX disable iret intercept */ +} +#endif + #ifdef KTR static const char * exit_reason_to_str(uint64_t reason) @@ -999,6 +1055,10 @@ svm_vmexit(struct svm_softc *svm_sc, int svm_save_intinfo(svm_sc, vcpu); switch (code) { + case VMCB_EXIT_VINTR: + update_rip = false; + vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_VINTR, 1); + break; case VMCB_EXIT_MC: /* Machine Check. */ vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_MTRAP, 1); vmexit->exitcode = VM_EXITCODE_MTRAP; @@ -1177,33 +1237,6 @@ svm_vmexit(struct svm_softc *svm_sc, int return (loop); } -/* - * Inject NMI to virtual cpu. - */ -static int -svm_inject_nmi(struct svm_softc *svm_sc, int vcpu) -{ - struct vmcb_ctrl *ctrl; - - KASSERT(vcpu < svm_sc->vcpu_cnt, ("Guest doesn't have VCPU%d", vcpu)); - - ctrl = svm_get_vmcb_ctrl(svm_sc, vcpu); - /* Can't inject another NMI if last one is pending.*/ - if (!vm_nmi_pending(svm_sc->vm, vcpu)) - return (0); - - /* Inject NMI, vector number is not used.*/ - svm_eventinject(svm_sc, vcpu, VMCB_EVENTINJ_TYPE_NMI, IDT_NMI, 0, - false); - - /* Acknowledge the request is accepted.*/ - vm_nmi_clear(svm_sc->vm, vcpu); - - VCPU_CTR0(svm_sc->vm, vcpu, "SVM:Injected NMI.\n"); - - return (1); -} - static void svm_inj_intinfo(struct svm_softc *svm_sc, int vcpu) { @@ -1227,77 +1260,150 @@ svm_inj_intinfo(struct svm_softc *svm_sc * Inject event to virtual cpu. */ static void -svm_inj_interrupts(struct svm_softc *svm_sc, int vcpu, struct vlapic *vlapic) +svm_inj_interrupts(struct svm_softc *sc, int vcpu, struct vlapic *vlapic) { struct vmcb_ctrl *ctrl; struct vmcb_state *state; int extint_pending; - int vector; - - KASSERT(vcpu < svm_sc->vcpu_cnt, ("Guest doesn't have VCPU%d", vcpu)); + int vector, need_intr_window; - state = svm_get_vmcb_state(svm_sc, vcpu); - ctrl = svm_get_vmcb_ctrl(svm_sc, vcpu); + state = svm_get_vmcb_state(sc, vcpu); + ctrl = svm_get_vmcb_ctrl(sc, vcpu); - svm_inj_intinfo(svm_sc, vcpu); + need_intr_window = 0; - /* Can't inject multiple events at once. */ - if (ctrl->eventinj & VMCB_EVENTINJ_VALID) { - VCPU_CTR1(svm_sc->vm, vcpu, - "SVM:Last event(0x%lx) is pending.\n", ctrl->eventinj); - return ; - } + /* + * Inject pending events or exceptions for this vcpu. + * + * An event might be pending because the previous #VMEXIT happened + * during event delivery (i.e. ctrl->exitintinfo). + * + * An event might also be pending because an exception was injected + * by the hypervisor (e.g. #PF during instruction emulation). + */ + svm_inj_intinfo(sc, vcpu); - /* Wait for guest to come out of interrupt shadow. */ - if (ctrl->intr_shadow) { - VCPU_CTR0(svm_sc->vm, vcpu, "SVM:Guest in interrupt shadow.\n"); - return; - } + /* NMI event has priority over interrupts. */ + if (vm_nmi_pending(sc->vm, vcpu)) { + if (nmi_blocked(sc, vcpu)) { + /* + * Can't inject another NMI if the guest has not + * yet executed an "iret" after the last NMI. + */ + VCPU_CTR0(sc->vm, vcpu, "Cannot inject NMI due " + "to NMI-blocking"); + } else if (ctrl->eventinj & VMCB_EVENTINJ_VALID) { + /* + * If there is already an exception/interrupt pending + * then defer the NMI until after that. + */ + VCPU_CTR1(sc->vm, vcpu, "Cannot inject NMI due to " + "eventinj %#lx", ctrl->eventinj); - /* NMI event has priority over interrupts.*/ - if (svm_inject_nmi(svm_sc, vcpu)) { - return; + /* + * Use self-IPI to trigger a VM-exit as soon as + * possible after the event injection is completed. + * + * This works only if the external interrupt exiting + * is at a lower priority than the event injection. + * + * Although not explicitly specified in APMv2 the + * relative priorities were verified empirically. + */ + ipi_cpu(curcpu, IPI_AST); /* XXX vmm_ipinum? */ + } else { + vm_nmi_clear(sc->vm, vcpu); + + /* Inject NMI, vector number is not used */ + svm_eventinject(sc, vcpu, VMCB_EVENTINJ_TYPE_NMI, + IDT_NMI, 0, false); + + /* virtual NMI blocking is now in effect */ + enable_nmi_blocking(sc, vcpu); + + VCPU_CTR0(sc->vm, vcpu, "Injecting vNMI"); + } } - extint_pending = vm_extint_pending(svm_sc->vm, vcpu); + extint_pending = vm_extint_pending(sc->vm, vcpu); if (!extint_pending) { /* Ask the local apic for a vector to inject */ - if (!vlapic_pending_intr(vlapic, &vector)) - return; + if (!vlapic_pending_intr(vlapic, &vector)) { + goto done; /* nothing to inject */ + } + KASSERT(vector >= 16 && vector <= 255, + ("invalid vector %d from local APIC", vector)); } else { /* Ask the legacy pic for a vector to inject */ - vatpic_pending_intr(svm_sc->vm, &vector); + vatpic_pending_intr(sc->vm, &vector); + KASSERT(vector >= 0 && vector <= 255, + ("invalid vector %d from local APIC", vector)); } - if (vector < 32 || vector > 255) { - VCPU_CTR1(svm_sc->vm, vcpu, "SVM_ERR:Event injection" - "invalid vector=%d.\n", vector); - ERR("SVM_ERR:Event injection invalid vector=%d.\n", vector); - return; + /* + * If the guest has disabled interrupts or is in an interrupt shadow + * then we cannot inject the pending interrupt. + */ + if ((state->rflags & PSL_I) == 0) { + VCPU_CTR2(sc->vm, vcpu, "Cannot inject vector %d due to " + "rflags %#lx", vector, state->rflags); + need_intr_window = 1; + goto done; } - if ((state->rflags & PSL_I) == 0) { - VCPU_CTR0(svm_sc->vm, vcpu, "SVM:Interrupt is disabled\n"); - return; + if (ctrl->intr_shadow) { + VCPU_CTR1(sc->vm, vcpu, "Cannot inject vector %d due to " + "interrupt shadow", vector); + need_intr_window = 1; + goto done; } - svm_eventinject(svm_sc, vcpu, VMCB_EVENTINJ_TYPE_INTR, vector, 0, - false); + if (ctrl->eventinj & VMCB_EVENTINJ_VALID) { + VCPU_CTR2(sc->vm, vcpu, "Cannot inject vector %d due to " + "eventinj %#lx", vector, ctrl->eventinj); + need_intr_window = 1; + goto done; + } + + svm_eventinject(sc, vcpu, VMCB_EVENTINJ_TYPE_INTR, vector, 0, false); if (!extint_pending) { /* Update the Local APIC ISR */ vlapic_intr_accepted(vlapic, vector); } else { - vm_extint_clear(svm_sc->vm, vcpu); - vatpic_intr_accepted(svm_sc->vm, vector); - - /* - * XXX need to recheck exting_pending ala VT-x + vm_extint_clear(sc->vm, vcpu); + vatpic_intr_accepted(sc->vm, vector); + /* + * Force a VM-exit as soon as the vcpu is ready to accept + * another interrupt. This is done because the PIC might + * have another vector that it wants to inject. Also, if + * the vlapic has a pending interrupt that was preempted + * by the ExtInt then it allows us to inject the APIC + * vector as soon as possible. */ + need_intr_window = 1; } - - VCPU_CTR1(svm_sc->vm, vcpu, "SVM:event injected,vector=%d.\n", vector); +done: + if (need_intr_window) { + /* + * We use V_IRQ in conjunction with the VINTR intercept to + * trap into the hypervisor as soon as a virtual interrupt + * can be delivered. + * + * Since injected events are not subject to intercept checks + * we need to ensure that the V_IRQ is not actually going to + * be delivered on VM entry. The KASSERT below enforces this. + */ + KASSERT((ctrl->eventinj & VMCB_EVENTINJ_VALID) != 0 || + (state->rflags & PSL_I) == 0 || ctrl->intr_shadow, + ("Bogus intr_window_exiting: eventinj (%#lx), " + "intr_shadow (%u), rflags (%#lx)", + ctrl->eventinj, ctrl->intr_shadow, state->rflags)); + enable_intr_window_exiting(sc, vcpu); + } else { + disable_intr_window_exiting(sc, vcpu); + } } static __inline void From owner-svn-src-projects@FreeBSD.ORG Thu Sep 11 06:17:57 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9037EEBF; Thu, 11 Sep 2014 06:17:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 791DC302; Thu, 11 Sep 2014 06:17:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8B6HvUb028515; Thu, 11 Sep 2014 06:17:57 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8B6HvNn028514; Thu, 11 Sep 2014 06:17:57 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201409110617.s8B6HvNn028514@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Thu, 11 Sep 2014 06:17:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271419 - projects/bhyve_svm/sys/amd64/vmm/amd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Sep 2014 06:17:57 -0000 Author: neel Date: Thu Sep 11 06:17:56 2014 New Revision: 271419 URL: http://svnweb.freebsd.org/changeset/base/271419 Log: style(9): indent the switch, don't indent the case, indent case body one tab. Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Thu Sep 11 05:48:39 2014 (r271418) +++ projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Thu Sep 11 06:17:56 2014 (r271419) @@ -1055,164 +1055,144 @@ svm_vmexit(struct svm_softc *svm_sc, int svm_save_intinfo(svm_sc, vcpu); switch (code) { - case VMCB_EXIT_VINTR: - update_rip = false; - vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_VINTR, 1); - break; - case VMCB_EXIT_MC: /* Machine Check. */ - vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_MTRAP, 1); - vmexit->exitcode = VM_EXITCODE_MTRAP; - loop = false; + case VMCB_EXIT_VINTR: + update_rip = false; + vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_VINTR, 1); + break; + case VMCB_EXIT_MC: /* Machine Check. */ + vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_MTRAP, 1); + vmexit->exitcode = VM_EXITCODE_MTRAP; + loop = false; + break; + case VMCB_EXIT_MSR: /* MSR access. */ + eax = state->rax; + ecx = ctx->sctx_rcx; + edx = ctx->e.g.sctx_rdx; + + if (ecx == MSR_EFER) { + KASSERT(info1 != 0, ("rdmsr(MSR_EFER) is not " + "emulated: info1(%#lx) info2(%#lx)", + info1, info2)); + svm_write_efer(svm_sc, vcpu, edx, eax); break; + } - case VMCB_EXIT_MSR: /* MSR access. */ - eax = state->rax; - ecx = ctx->sctx_rcx; - edx = ctx->e.g.sctx_rdx; - - if (ecx == MSR_EFER) { - KASSERT(info1 != 0, ("rdmsr(MSR_EFER) is not " - "emulated: info1(%#lx) info2(%#lx)", - info1, info2)); - svm_write_efer(svm_sc, vcpu, edx, eax); - break; - } - - retu = false; - if (info1) { - /* VM exited because of write MSR */ - vmm_stat_incr(svm_sc->vm, vcpu, - VMEXIT_WRMSR, 1); - vmexit->exitcode = VM_EXITCODE_WRMSR; - vmexit->u.msr.code = ecx; - val = (uint64_t)edx << 32 | eax; - if (emulate_wrmsr(svm_sc->vm, vcpu, ecx, val, - &retu)) { - vmexit->u.msr.wval = val; - loop = false; - } else - loop = retu ? false : true; - - VCPU_CTR3(svm_sc->vm, vcpu, - "VMEXIT WRMSR(%s handling) 0x%lx @0x%x", - loop ? "kernel" : "user", val, ecx); - } else { - vmm_stat_incr(svm_sc->vm, vcpu, - VMEXIT_RDMSR, 1); - vmexit->exitcode = VM_EXITCODE_RDMSR; - vmexit->u.msr.code = ecx; - if (emulate_rdmsr(svm_sc->vm, vcpu, ecx, - &retu)) { - loop = false; - } else - loop = retu ? false : true; - VCPU_CTR3(svm_sc->vm, vcpu, "SVM:VMEXIT RDMSR" - " MSB=0x%08x, LSB=%08x @0x%x", - ctx->e.g.sctx_rdx, state->rax, ecx); - } + retu = false; + if (info1) { + /* VM exited because of write MSR */ + vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_WRMSR, 1); + vmexit->exitcode = VM_EXITCODE_WRMSR; + vmexit->u.msr.code = ecx; + val = (uint64_t)edx << 32 | eax; + if (emulate_wrmsr(svm_sc->vm, vcpu, ecx, val, &retu)) { + vmexit->u.msr.wval = val; + loop = false; + } else + loop = retu ? false : true; + VCPU_CTR3(svm_sc->vm, vcpu, + "VMEXIT WRMSR(%s handling) 0x%lx @0x%x", + loop ? "kernel" : "user", val, ecx); + } else { + vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_RDMSR, 1); + vmexit->exitcode = VM_EXITCODE_RDMSR; + vmexit->u.msr.code = ecx; + if (emulate_rdmsr(svm_sc->vm, vcpu, ecx, &retu)) + loop = false; + else + loop = retu ? false : true; + VCPU_CTR3(svm_sc->vm, vcpu, "SVM:VMEXIT RDMSR" + " MSB=0x%08x, LSB=%08x @0x%x", + ctx->e.g.sctx_rdx, state->rax, ecx); + } #define MSR_AMDK8_IPM 0xc0010055 - /* - * We can't hide AMD C1E idle capability since its - * based on CPU generation, for now ignore access to - * this MSR by vcpus - * XXX: special handling of AMD C1E - Ignore. - */ - if (ecx == MSR_AMDK8_IPM) - loop = true; - break; - - case VMCB_EXIT_INTR: - /* - * Exit on External Interrupt. - * Give host interrupt handler to run and if its guest - * interrupt, local APIC will inject event in guest. - */ - update_rip = false; - vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_EXTINT, 1); - break; - - case VMCB_EXIT_IO: - loop = svm_handle_io(svm_sc, vcpu, vmexit); - vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_INOUT, 1); - break; - - case VMCB_EXIT_CPUID: - vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_CPUID, 1); - (void)x86_emulate_cpuid(svm_sc->vm, vcpu, - (uint32_t *)&state->rax, - (uint32_t *)&ctx->sctx_rbx, - (uint32_t *)&ctx->sctx_rcx, - (uint32_t *)&ctx->e.g.sctx_rdx); - break; - - case VMCB_EXIT_HLT: - vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_HLT, 1); - vmexit->exitcode = VM_EXITCODE_HLT; - vmexit->u.hlt.rflags = state->rflags; - loop = false; - break; - - case VMCB_EXIT_PAUSE: - vmexit->exitcode = VM_EXITCODE_PAUSE; - vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_PAUSE, 1); - - break; - - case VMCB_EXIT_NPF: - loop = false; - update_rip = false; - - if (info1 & VMCB_NPF_INFO1_RSV) { - VCPU_CTR2(svm_sc->vm, vcpu, "SVM_ERR:NPT" - " reserved bit is set," - "INFO1:0x%lx INFO2:0x%lx .\n", - info1, info2); - break; - } - - /* EXITINFO2 has the physical fault address (GPA). */ - if(vm_mem_allocated(svm_sc->vm, info2)) { - vmexit->exitcode = VM_EXITCODE_PAGING; - vmexit->u.paging.gpa = info2; - vmexit->u.paging.fault_type = - svm_npf_paging(info1); - vmm_stat_incr(svm_sc->vm, vcpu, - VMEXIT_NESTED_FAULT, 1); - VCPU_CTR3(svm_sc->vm, vcpu, "nested page fault " - "on gpa %#lx/%#lx at rip %#lx", - info2, info1, state->rip); - } else if (svm_npf_emul_fault(info1)) { - svm_handle_inst_emul(svm_get_vmcb(svm_sc, vcpu), - info2, vmexit); - vmm_stat_incr(svm_sc->vm, vcpu, - VMEXIT_INST_EMUL, 1); - VCPU_CTR3(svm_sc->vm, vcpu, "inst_emul fault " - "for gpa %#lx/%#lx at rip %#lx", - info2, info1, state->rip); - } - break; - - case VMCB_EXIT_SHUTDOWN: - loop = false; - break; - - case VMCB_EXIT_INVALID: - loop = false; + /* + * We can't hide AMD C1E idle capability since its + * based on CPU generation, for now ignore access to + * this MSR by vcpus + * XXX: special handling of AMD C1E - Ignore. + */ + if (ecx == MSR_AMDK8_IPM) + loop = true; + break; + case VMCB_EXIT_INTR: + /* + * Exit on External Interrupt. + * Give host interrupt handler to run and if its guest + * interrupt, local APIC will inject event in guest. + */ + update_rip = false; + vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_EXTINT, 1); + break; + case VMCB_EXIT_IO: + loop = svm_handle_io(svm_sc, vcpu, vmexit); + vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_INOUT, 1); + break; + case VMCB_EXIT_CPUID: + vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_CPUID, 1); + loop = x86_emulate_cpuid(svm_sc->vm, vcpu, + (uint32_t *)&state->rax, + (uint32_t *)&ctx->sctx_rbx, + (uint32_t *)&ctx->sctx_rcx, + (uint32_t *)&ctx->e.g.sctx_rdx); + break; + case VMCB_EXIT_HLT: + vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_HLT, 1); + vmexit->exitcode = VM_EXITCODE_HLT; + vmexit->u.hlt.rflags = state->rflags; + loop = false; + break; + case VMCB_EXIT_PAUSE: + vmexit->exitcode = VM_EXITCODE_PAUSE; + vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_PAUSE, 1); + loop = false; + break; + case VMCB_EXIT_NPF: + loop = false; + update_rip = false; + if (info1 & VMCB_NPF_INFO1_RSV) { + VCPU_CTR2(svm_sc->vm, vcpu, "nested page fault with " + "reserved bits set: info1(%#lx) info2(%#lx)", + info1, info2); break; + } - default: - /* Return to user space. */ - loop = false; - update_rip = false; - VCPU_CTR3(svm_sc->vm, vcpu, "VMEXIT=0x%lx" - " EXITINFO1: 0x%lx EXITINFO2:0x%lx\n", - ctrl->exitcode, info1, info2); - VCPU_CTR3(svm_sc->vm, vcpu, "SVM:RIP: 0x%lx nRIP:0x%lx" - " Inst decoder len:%d\n", state->rip, - ctrl->nrip, ctrl->inst_decode_size); - vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_UNKNOWN, 1); - break; + /* EXITINFO2 has the physical fault address (GPA). */ + if(vm_mem_allocated(svm_sc->vm, info2)) { + vmexit->exitcode = VM_EXITCODE_PAGING; + vmexit->u.paging.gpa = info2; + vmexit->u.paging.fault_type = svm_npf_paging(info1); + vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_NESTED_FAULT, 1); + VCPU_CTR3(svm_sc->vm, vcpu, "nested page fault " + "on gpa %#lx/%#lx at rip %#lx", + info2, info1, state->rip); + } else if (svm_npf_emul_fault(info1)) { + svm_handle_inst_emul(svm_get_vmcb(svm_sc, vcpu), + info2, vmexit); + vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_INST_EMUL, 1); + VCPU_CTR3(svm_sc->vm, vcpu, "inst_emul fault " + "for gpa %#lx/%#lx at rip %#lx", + info2, info1, state->rip); + } + break; + case VMCB_EXIT_SHUTDOWN: + loop = false; + break; + case VMCB_EXIT_INVALID: + loop = false; + break; + default: + /* Return to user space. */ + loop = false; + update_rip = false; + VCPU_CTR3(svm_sc->vm, vcpu, "VMEXIT=0x%lx" + " EXITINFO1: 0x%lx EXITINFO2:0x%lx\n", + ctrl->exitcode, info1, info2); + VCPU_CTR3(svm_sc->vm, vcpu, "SVM:RIP: 0x%lx nRIP:0x%lx" + " Inst decoder len:%d\n", state->rip, + ctrl->nrip, ctrl->inst_decode_size); + vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_UNKNOWN, 1); + break; } VCPU_CTR4(svm_sc->vm, vcpu, "%s %s vmexit at %#lx nrip %#lx", From owner-svn-src-projects@FreeBSD.ORG Sat Sep 13 15:48:24 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CBB6BDAF; Sat, 13 Sep 2014 15:48:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 B6CD17CF; Sat, 13 Sep 2014 15:48:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8DFmOQh090038; Sat, 13 Sep 2014 15:48:24 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8DFmOkA090037; Sat, 13 Sep 2014 15:48:24 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201409131548.s8DFmOkA090037@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 13 Sep 2014 15:48:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271519 - projects/arm_intrng/sys/arm/arm X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Sep 2014 15:48:25 -0000 Author: ian Date: Sat Sep 13 15:48:24 2014 New Revision: 271519 URL: http://svnweb.freebsd.org/changeset/base/271519 Log: Add arm_irq_memory_barrier() from intr.c, since this file replaces intr.c. Modified: projects/arm_intrng/sys/arm/arm/intrng.c Modified: projects/arm_intrng/sys/arm/arm/intrng.c ============================================================================== --- projects/arm_intrng/sys/arm/arm/intrng.c Sat Sep 13 15:34:12 2014 (r271518) +++ projects/arm_intrng/sys/arm/arm/intrng.c Sat Sep 13 15:48:24 2014 (r271519) @@ -442,3 +442,66 @@ dosoftints(void) { } +/* + * arm_irq_memory_barrier() + * + * Ensure all writes to device memory have reached devices before proceeding. + * + * This is intended to be called from the post-filter and post-thread routines + * of an interrupt controller implementation. A peripheral device driver should + * use bus_space_barrier() if it needs to ensure a write has reached the + * hardware for some reason other than clearing interrupt conditions. + * + * The need for this function arises from the ARM weak memory ordering model. + * Writes to locations mapped with the Device attribute bypass any caches, but + * are buffered. Multiple writes to the same device will be observed by that + * device in the order issued by the cpu. Writes to different devices may + * appear at those devices in a different order than issued by the cpu. That + * is, if the cpu writes to device A then device B, the write to device B could + * complete before the write to device A. + * + * Consider a typical device interrupt handler which services the interrupt and + * writes to a device status-acknowledge register to clear the interrupt before + * returning. That write is posted to the L2 controller which "immediately" + * places it in a store buffer and automatically drains that buffer. This can + * be less immediate than you'd think... There may be no free slots in the store + * buffers, so an existing buffer has to be drained first to make room. The + * target bus may be busy with other traffic (such as DMA for various devices), + * delaying the drain of the store buffer for some indeterminate time. While + * all this delay is happening, execution proceeds on the CPU, unwinding its way + * out of the interrupt call stack to the point where the interrupt driver code + * is ready to EOI and unmask the interrupt. The interrupt controller may be + * accessed via a faster bus than the hardware whose handler just ran; the write + * to unmask and EOI the interrupt may complete quickly while the device write + * to ack and clear the interrupt source is still lingering in a store buffer + * waiting for access to a slower bus. With the interrupt unmasked at the + * interrupt controller but still active at the device, as soon as interrupts + * are enabled on the core the device re-interrupts immediately: now you've got + * a spurious interrupt on your hands. + * + * The right way to fix this problem is for every device driver to use the + * proper bus_space_barrier() calls in its interrupt handler. For ARM a single + * barrier call at the end of the handler would work. This would have to be + * done to every driver in the system, not just arm-specific drivers. + * + * Another potential fix is to map all device memory as Strongly-Ordered rather + * than Device memory, which takes the store buffers out of the picture. This + * has a pretty big impact on overall system performance, because each strongly + * ordered memory access causes all L2 store buffers to be drained. + * + * A compromise solution is to have the interrupt controller implementation call + * this function to establish a barrier between writes to the interrupt-source + * device and writes to the interrupt controller device. + * + * This takes the interrupt number as an argument, and currently doesn't use it. + * The plan is that maybe some day there is a way to flag certain interrupts as + * "memory barrier safe" and we can avoid this overhead with them. + */ +void +arm_irq_memory_barrier(uintptr_t irq) +{ + + dsb(); + cpu_l2cache_drain_writebuf(); +} + From owner-svn-src-projects@FreeBSD.ORG Sat Sep 13 15:49:51 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E170CE9D; Sat, 13 Sep 2014 15:49:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 CD7587D8; Sat, 13 Sep 2014 15:49:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8DFnpDu090244; Sat, 13 Sep 2014 15:49:51 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8DFnpcW090243; Sat, 13 Sep 2014 15:49:51 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201409131549.s8DFnpcW090243@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 13 Sep 2014 15:49:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271520 - projects/arm_intrng/sys/arm/arm X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Sep 2014 15:49:52 -0000 Author: ian Date: Sat Sep 13 15:49:51 2014 New Revision: 271520 URL: http://svnweb.freebsd.org/changeset/base/271520 Log: Allow the interrupt resource to be NULL for the root interrupt controller. Modified: projects/arm_intrng/sys/arm/arm/nexus.c Modified: projects/arm_intrng/sys/arm/arm/nexus.c ============================================================================== --- projects/arm_intrng/sys/arm/arm/nexus.c Sat Sep 13 15:48:24 2014 (r271519) +++ projects/arm_intrng/sys/arm/arm/nexus.c Sat Sep 13 15:49:51 2014 (r271520) @@ -279,6 +279,25 @@ nexus_setup_intr(device_t dev, device_t { int irq; + /* + * FDT data for a root interrupt controller may have set up interrupt + * resource data indicating nexus as the parent and irq 0, or it may + * have nothing. We handle the latter by allowing a NULL res pointer + * when the INTR_CONTROLLER flag is set. + */ + if (res == NULL) { +#if defined(ARM_INTRNG) + if (flags & INTR_CONTROLLER) { + arm_setup_irqhandler(child, + filt, intr, arg, 0, flags, cookiep); + return (0); + } +#endif + device_printf(child, "NULL resource pointer " + "in nexus_setup_intr\n"); + return (EDOOFUS); + } + if ((rman_get_flags(res) & RF_SHAREABLE) == 0) flags |= INTR_EXCL; From owner-svn-src-projects@FreeBSD.ORG Sat Sep 13 15:50:59 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1A035F95; Sat, 13 Sep 2014 15:50:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 05BC67E5; Sat, 13 Sep 2014 15:50:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8DFowV8090486; Sat, 13 Sep 2014 15:50:58 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8DFowHI090485; Sat, 13 Sep 2014 15:50:58 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201409131550.s8DFowHI090485@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 13 Sep 2014 15:50:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271521 - projects/arm_intrng/sys/arm/arm X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Sep 2014 15:50:59 -0000 Author: ian Date: Sat Sep 13 15:50:58 2014 New Revision: 271521 URL: http://svnweb.freebsd.org/changeset/base/271521 Log: Minor changes to work with intrng, mostly involved with using values in the softc struct instead of global/static values. Modified: projects/arm_intrng/sys/arm/arm/gic.c Modified: projects/arm_intrng/sys/arm/arm/gic.c ============================================================================== --- projects/arm_intrng/sys/arm/arm/gic.c Sat Sep 13 15:49:51 2014 (r271520) +++ projects/arm_intrng/sys/arm/arm/gic.c Sat Sep 13 15:50:58 2014 (r271521) @@ -111,7 +111,7 @@ struct arm_gic_softc { 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 */ - { SYS_RES_IRQ, 0, RF_ACTIVE }, /* Parent interrupt */ + { SYS_RES_IRQ, 0, RF_ACTIVE | RF_OPTIONAL }, /* Parent interrupt */ { -1, 0 } }; @@ -140,6 +140,7 @@ static void arm_gic_ipi_clear(device_t, static int arm_gic_probe(device_t dev) { + if (!ofw_bus_status_okay(dev)) return (ENXIO); @@ -153,34 +154,43 @@ static void arm_gic_init_secondary(device_t dev) { struct arm_gic_softc *sc = device_get_softc(dev); - - for (int i = 0; i < sc->nirqs; i += 4) + int i; + + for (i = 0; i < sc->nirqs; i += 4) gic_d_write_4(sc, GICD_IPRIORITYR(i >> 2), 0); /* Set all the interrupts to be in Group 0 (secure) */ - for (i = 0; i < nirqs; i += 32) { - gic_d_write_4(GICD_IGROUPR(i >> 5), 0); + for (i = 0; i < sc->nirqs; i += 32) { + gic_d_write_4(sc, GICD_IGROUPR(i >> 5), 0); } /* Enable CPU interface */ gic_c_write_4(sc, GICC_CTLR, 1); + /* Set priority mask register. */ + gic_c_write_4(sc, GICC_PMR, 0xff); + /* Enable interrupt distribution */ gic_d_write_4(sc, GICD_CTLR, 0x01); /* Activate IRQ 29, ie private timer IRQ*/ /* Activate IRQ 29-30, ie private timer (secure & non-secure) IRQs */ - gic_d_write_4(GICD_ISENABLER(29 >> 5), (1UL << (29 & 0x1F))); - gic_d_write_4(GICD_ISENABLER(30 >> 5), (1UL << (30 & 0x1F))); + gic_d_write_4(sc, GICD_ISENABLER(29 >> 5), (1UL << (29 & 0x1F))); + gic_d_write_4(sc, GICD_ISENABLER(30 >> 5), (1UL << (30 & 0x1F))); } static int arm_gic_attach(device_t dev) { - struct arm_gic_softc *sc = device_get_softc(dev); + struct arm_gic_softc *sc; int i; uint32_t icciidr; + if (arm_gic_sc) + return (ENXIO); + + sc = device_get_softc(dev); + if (bus_alloc_resources(dev, arm_gic_spec, sc->gic_res)) { device_printf(dev, "could not allocate resources\n"); return (ENXIO); @@ -232,8 +242,8 @@ arm_gic_attach(device_t dev) } for (i = 0; i < sc->nirqs; i += 4) { - gic_d_write_4(GICD_IPRIORITYR(i >> 2), 0); - gic_d_write_4(GICD_ITARGETSR(i >> 2), 1 << 0 | 1 << 8 | 1 << 16 | 1 << 24); + gic_d_write_4(sc, GICD_IPRIORITYR(i >> 2), 0); + gic_d_write_4(sc, GICD_ITARGETSR(i >> 2), 1 << 0 | 1 << 8 | 1 << 16 | 1 << 24); } /* Set all the interrupts to be in Group 0 (secure) */ @@ -267,13 +277,13 @@ arm_gic_intr(void *arg) * have this information later. */ - if ((active_irq & 0x3ff) < 1) + if ((active_irq & 0x3ff) <= GIC_LAST_IPI) gic_c_write_4(sc, GICC_EOIR, active_irq); active_irq &= 0x3FF; if (active_irq == 0x3FF) { if (last_irq == -1) - printf("Spurious interrupt detected [0x%08x]\n", active_irq); + printf("Spurious interrupt detected\n"); return (FILTER_HANDLED); } @@ -354,7 +364,7 @@ arm_gic_mask(device_t dev, int irq) struct arm_gic_softc *sc = device_get_softc(dev); gic_d_write_4(sc, GICD_ICENABLER(irq >> 5), (1UL << (irq & 0x1F))); - gic_c_write_4(GICC_EOIR, nb); + gic_c_write_4(sc, GICC_EOIR, irq); } static void @@ -362,8 +372,8 @@ arm_gic_unmask(device_t dev, int irq) { struct arm_gic_softc *sc = device_get_softc(dev); - if (nb > GIC_LAST_IPI) - arm_irq_memory_barrier(nb); + if (irq > GIC_LAST_IPI) + arm_irq_memory_barrier(irq); gic_d_write_4(sc, GICD_ISENABLER(irq >> 5), (1UL << (irq & 0x1F))); } @@ -429,5 +439,8 @@ static driver_t arm_gic_driver = { static devclass_t arm_gic_devclass; -DRIVER_MODULE(gic, simplebus, arm_gic_driver, arm_gic_devclass, 0, 0); +EARLY_DRIVER_MODULE(gic, simplebus, arm_gic_driver, arm_gic_devclass, 0, 0, + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); +EARLY_DRIVER_MODULE(gic, ofwbus, arm_gic_driver, arm_gic_devclass, 0, 0, + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); From owner-svn-src-projects@FreeBSD.ORG Sat Sep 13 16:00:35 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9E0A530F; Sat, 13 Sep 2014 16:00:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 89B08937; Sat, 13 Sep 2014 16:00:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8DG0ZZ0096936; Sat, 13 Sep 2014 16:00:35 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8DG0ZST096935; Sat, 13 Sep 2014 16:00:35 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201409131600.s8DG0ZST096935@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 13 Sep 2014 16:00:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271522 - projects/arm_intrng/sys/arm/freescale/imx X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Sep 2014 16:00:35 -0000 Author: ian Date: Sat Sep 13 16:00:35 2014 New Revision: 271522 URL: http://svnweb.freebsd.org/changeset/base/271522 Log: Folow name change, gic_init_secondary -> arm_init_secondary_ic. Modified: projects/arm_intrng/sys/arm/freescale/imx/imx6_mp.c Modified: projects/arm_intrng/sys/arm/freescale/imx/imx6_mp.c ============================================================================== --- projects/arm_intrng/sys/arm/freescale/imx/imx6_mp.c Sat Sep 13 15:50:58 2014 (r271521) +++ projects/arm_intrng/sys/arm/freescale/imx/imx6_mp.c Sat Sep 13 16:00:35 2014 (r271522) @@ -66,7 +66,7 @@ void platform_mp_init_secondary(void) { - gic_init_secondary(); + arm_init_secondary_ic(); } void From owner-svn-src-projects@FreeBSD.ORG Sat Sep 13 22:16:42 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E1C08235; Sat, 13 Sep 2014 22:16:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 CC37FFD5; Sat, 13 Sep 2014 22:16:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8DMGfk4085051; Sat, 13 Sep 2014 22:16:41 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8DMGe2Y085045; Sat, 13 Sep 2014 22:16:40 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201409132216.s8DMGe2Y085045@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Sat, 13 Sep 2014 22:16:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271554 - in projects/bhyve_svm/sys/amd64: include vmm vmm/amd vmm/intel X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Sep 2014 22:16:42 -0000 Author: neel Date: Sat Sep 13 22:16:40 2014 New Revision: 271554 URL: http://svnweb.freebsd.org/changeset/base/271554 Log: AMD processors that have the SVM decode assist capability will store the instruction bytes in the VMCB on a nested page fault. This is useful because it saves having to walk the guest page tables to fetch the instruction. vie_init() now takes two additional parameters 'inst_bytes' and 'inst_len' that map directly to 'vie->inst[]' and 'vie->num_valid'. The instruction emulation handler skips calling 'vmm_fetch_instruction()' if 'vie->num_valid' is non-zero. The use of this capability can be turned off by setting the sysctl/tunable 'hw.vmm.svm.disable_npf_assist' to '1'. Reviewed by: Anish Gupta (akgupt3@gmail.com) Discussed with: grehan Modified: projects/bhyve_svm/sys/amd64/include/vmm_instruction_emul.h projects/bhyve_svm/sys/amd64/vmm/amd/svm.c projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h projects/bhyve_svm/sys/amd64/vmm/intel/vmx.c projects/bhyve_svm/sys/amd64/vmm/vmm.c projects/bhyve_svm/sys/amd64/vmm/vmm_instruction_emul.c Modified: projects/bhyve_svm/sys/amd64/include/vmm_instruction_emul.h ============================================================================== --- projects/bhyve_svm/sys/amd64/include/vmm_instruction_emul.h Sat Sep 13 22:14:19 2014 (r271553) +++ projects/bhyve_svm/sys/amd64/include/vmm_instruction_emul.h Sat Sep 13 22:16:40 2014 (r271554) @@ -93,7 +93,7 @@ int vmm_fetch_instruction(struct vm *vm, int vmm_gla2gpa(struct vm *vm, int vcpuid, struct vm_guest_paging *paging, uint64_t gla, int prot, uint64_t *gpa); -void vie_init(struct vie *vie); +void vie_init(struct vie *vie, const char *inst_bytes, int inst_length); /* * Decode the instruction fetched into 'vie' so it can be emulated. Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Sat Sep 13 22:14:19 2014 (r271553) +++ projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Sat Sep 13 22:16:40 2014 (r271554) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -67,6 +68,9 @@ __FBSDID("$FreeBSD$"); #include "svm_softc.h" #include "npt.h" +SYSCTL_DECL(_hw_vmm); +SYSCTL_NODE(_hw_vmm, OID_AUTO, svm, CTLFLAG_RW, NULL, NULL); + /* * SVM CPUID function 0x8000_000A, edx bit decoding. */ @@ -96,9 +100,17 @@ extern struct pcpu __pcpu[]; static int svm_getdesc(void *arg, int vcpu, int type, struct seg_desc *desc); static uint32_t svm_feature; /* AMD SVM features. */ +SYSCTL_UINT(_hw_vmm_svm, OID_AUTO, features, CTLFLAG_RD, &svm_feature, 0, + "SVM features advertised by CPUID.8000000AH:EDX"); + +static int disable_npf_assist; +SYSCTL_INT(_hw_vmm_svm, OID_AUTO, disable_npf_assist, CTLFLAG_RWTUN, + &disable_npf_assist, 0, NULL); /* Maximum ASIDs supported by the processor */ static uint32_t nasid; +SYSCTL_UINT(_hw_vmm_svm, OID_AUTO, num_asids, CTLFLAG_RD, &nasid, 0, + "Number of ASIDs supported by this processor"); /* Current ASID generation for each host cpu */ static struct asid asid[MAXCPU]; @@ -218,6 +230,12 @@ flush_by_asid(void) return (svm_feature & AMD_CPUID_SVM_FLUSH_BY_ASID); } +static __inline int +decode_assist(void) +{ + return (svm_feature & AMD_CPUID_SVM_DECODE_ASSIST); +} + /* * Enable SVM for a CPU. */ @@ -792,19 +810,22 @@ svm_handle_inst_emul(struct vmcb *vmcb, { struct vm_guest_paging *paging; struct vmcb_segment *seg; + struct vmcb_ctrl *ctrl; + char *inst_bytes; + int inst_len; + ctrl = &vmcb->ctrl; paging = &vmexit->u.inst_emul.paging; + vmexit->exitcode = VM_EXITCODE_INST_EMUL; vmexit->u.inst_emul.gpa = gpa; vmexit->u.inst_emul.gla = VIE_INVALID_GLA; svm_paging_info(vmcb, paging); /* - * If DecodeAssist SVM feature doesn't exist, we don't have NPF - * instuction length. RIP will be calculated based on the length - * determined by instruction emulation. + * The inst_length will be determined by decoding the instruction. */ - vmexit->inst_length = VIE_INST_SIZE; + vmexit->inst_length = 0; seg = vmcb_seg(vmcb, VM_REG_GUEST_CS); switch(paging->cpu_mode) { @@ -820,6 +841,18 @@ svm_handle_inst_emul(struct vmcb *vmcb, vmexit->u.inst_emul.cs_d = 0; break; } + + /* + * Copy the instruction bytes into 'vie' if available. + */ + if (decode_assist() && !disable_npf_assist) { + inst_len = ctrl->inst_len; + inst_bytes = ctrl->inst_bytes; + } else { + inst_len = 0; + inst_bytes = NULL; + } + vie_init(&vmexit->u.inst_emul.vie, inst_bytes, inst_len); } /* @@ -1182,7 +1215,7 @@ svm_vmexit(struct svm_softc *svm_sc, int loop = false; break; default: - /* Return to user space. */ + /* Return to user space. */ loop = false; update_rip = false; VCPU_CTR3(svm_sc->vm, vcpu, "VMEXIT=0x%lx" @@ -1190,7 +1223,7 @@ svm_vmexit(struct svm_softc *svm_sc, int ctrl->exitcode, info1, info2); VCPU_CTR3(svm_sc->vm, vcpu, "SVM:RIP: 0x%lx nRIP:0x%lx" " Inst decoder len:%d\n", state->rip, - ctrl->nrip, ctrl->inst_decode_size); + ctrl->nrip, ctrl->inst_len); vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_UNKNOWN, 1); break; } Modified: projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Sat Sep 13 22:14:19 2014 (r271553) +++ projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Sat Sep 13 22:16:40 2014 (r271554) @@ -218,8 +218,8 @@ struct vmcb_ctrl { uint32_t vmcb_clean; /* 0xC0: VMCB clean bits for caching */ uint32_t :32; /* 0xC4: Reserved */ uint64_t nrip; /* 0xC8: Guest next nRIP. */ - uint8_t inst_decode_size; /* 0xD0: Instruction decode */ - uint8_t inst_decode_bytes[15]; + uint8_t inst_len; /* 0xD0: #NPF decode assist */ + uint8_t inst_bytes[15]; uint8_t padd6[0x320]; } __attribute__ ((__packed__)); CTASSERT(sizeof(struct vmcb_ctrl) == 1024); Modified: projects/bhyve_svm/sys/amd64/vmm/intel/vmx.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/intel/vmx.c Sat Sep 13 22:14:19 2014 (r271553) +++ projects/bhyve_svm/sys/amd64/vmm/intel/vmx.c Sat Sep 13 22:16:40 2014 (r271554) @@ -1847,6 +1847,7 @@ vmexit_inst_emul(struct vm_exit *vmexit, vmexit->u.inst_emul.cs_d = 0; break; } + vie_init(&vmexit->u.inst_emul.vie, NULL, 0); } static int Modified: projects/bhyve_svm/sys/amd64/vmm/vmm.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/vmm.c Sat Sep 13 22:14:19 2014 (r271553) +++ projects/bhyve_svm/sys/amd64/vmm/vmm.c Sat Sep 13 22:16:40 2014 (r271554) @@ -1216,7 +1216,7 @@ vm_handle_inst_emul(struct vm *vm, int v mem_region_read_t mread; mem_region_write_t mwrite; enum vm_cpu_mode cpu_mode; - int cs_d, error; + int cs_d, error, length; vcpu = &vm->vcpu[vcpuid]; vme = &vcpu->exitinfo; @@ -1228,11 +1228,21 @@ vm_handle_inst_emul(struct vm *vm, int v paging = &vme->u.inst_emul.paging; cpu_mode = paging->cpu_mode; - vie_init(vie); - /* Fetch, decode and emulate the faulting instruction */ - error = vmm_fetch_instruction(vm, vcpuid, paging, vme->rip, - vme->inst_length, vie); + if (vie->num_valid == 0) { + /* + * If the instruction length is not known then assume a + * maximum size instruction. + */ + length = vme->inst_length ? vme->inst_length : VIE_INST_SIZE; + error = vmm_fetch_instruction(vm, vcpuid, paging, vme->rip, + length, vie); + } else { + /* + * The instruction bytes have already been copied into 'vie' + */ + error = 0; + } if (error == 1) return (0); /* Resume guest to handle page fault */ else if (error == -1) @@ -1243,13 +1253,10 @@ vm_handle_inst_emul(struct vm *vm, int v if (vmm_decode_instruction(vm, vcpuid, gla, cpu_mode, cs_d, vie) != 0) return (EFAULT); - /* - * AMD-V doesn't provide instruction length which is nRIP - RIP - * for some of the exit including Nested Page Fault. Use instruction - * length calculated by software instruction emulation to update - * RIP of vcpu. + /* + * If the instruction length is not specified the update it now. */ - if (vme->inst_length == VIE_INST_SIZE) + if (vme->inst_length == 0) vme->inst_length = vie->num_processed; /* return to userland unless this is an in-kernel emulated device */ Modified: projects/bhyve_svm/sys/amd64/vmm/vmm_instruction_emul.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/vmm_instruction_emul.c Sat Sep 13 22:14:19 2014 (r271553) +++ projects/bhyve_svm/sys/amd64/vmm/vmm_instruction_emul.c Sat Sep 13 22:16:40 2014 (r271554) @@ -1025,13 +1025,20 @@ vie_calculate_gla(enum vm_cpu_mode cpu_m #ifdef _KERNEL void -vie_init(struct vie *vie) +vie_init(struct vie *vie, const char *inst_bytes, int inst_length) { + KASSERT(inst_length >= 0 && inst_length <= VIE_INST_SIZE, + ("%s: invalid instruction length (%d)", __func__, inst_length)); bzero(vie, sizeof(struct vie)); vie->base_register = VM_REG_LAST; vie->index_register = VM_REG_LAST; + + if (inst_length) { + bcopy(inst_bytes, vie->inst, inst_length); + vie->num_valid = inst_length; + } } static int From owner-svn-src-projects@FreeBSD.ORG Sat Sep 13 22:45:04 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C4B44794; Sat, 13 Sep 2014 22:45:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 B0E4427A; Sat, 13 Sep 2014 22:45:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8DMj4iu098753; Sat, 13 Sep 2014 22:45:04 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8DMj4MZ098752; Sat, 13 Sep 2014 22:45:04 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201409132245.s8DMj4MZ098752@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Sat, 13 Sep 2014 22:45:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271557 - projects/bhyve_svm/sys/amd64/vmm/amd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Sep 2014 22:45:04 -0000 Author: neel Date: Sat Sep 13 22:45:04 2014 New Revision: 271557 URL: http://svnweb.freebsd.org/changeset/base/271557 Log: style(9): insert an empty line if the function has no local variables Pointed out by: grehan Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Sat Sep 13 22:44:33 2014 (r271556) +++ projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Sat Sep 13 22:45:04 2014 (r271557) @@ -227,12 +227,14 @@ svm_cpuid_features(void) static __inline int flush_by_asid(void) { + return (svm_feature & AMD_CPUID_SVM_FLUSH_BY_ASID); } static __inline int decode_assist(void) { + return (svm_feature & AMD_CPUID_SVM_DECODE_ASSIST); } From owner-svn-src-projects@FreeBSD.ORG Sat Sep 13 23:48:43 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EEEF9B0; Sat, 13 Sep 2014 23:48:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 C120B96F; Sat, 13 Sep 2014 23:48:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8DNmh7o026937; Sat, 13 Sep 2014 23:48:43 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8DNmh0L026935; Sat, 13 Sep 2014 23:48:43 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201409132348.s8DNmh0L026935@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Sat, 13 Sep 2014 23:48:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271559 - projects/bhyve_svm/sys/amd64/vmm/amd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Sep 2014 23:48:44 -0000 Author: neel Date: Sat Sep 13 23:48:43 2014 New Revision: 271559 URL: http://svnweb.freebsd.org/changeset/base/271559 Log: Bug fixes. - Don't enable the HLT intercept by default. It will be enabled by bhyve(8) if required. Prior to this change HLT exiting was always enabled making the "-H" option to bhyve(8) meaningless. - Recognize a VM exit triggered by a non-maskable interrupt. Prior to this change the exit would be punted to userspace and the virtual machine would terminate. Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Sat Sep 13 23:03:46 2014 (r271558) +++ projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Sat Sep 13 23:48:43 2014 (r271559) @@ -503,7 +503,6 @@ vmcb_init(struct svm_softc *sc, int vcpu /* Intercept various events (for e.g. I/O, MSR and CPUID accesses) */ svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_IO); svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_MSR); - svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_HLT); svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_CPUID); svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_INTR); svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_INIT); @@ -1041,6 +1040,8 @@ exit_reason_to_str(uint64_t reason) return ("mchk"); case VMCB_EXIT_INTR: return ("extintr"); + case VMCB_EXIT_NMI: + return ("nmi"); case VMCB_EXIT_VINTR: return ("vintr"); case VMCB_EXIT_MSR: @@ -1159,6 +1160,9 @@ svm_vmexit(struct svm_softc *svm_sc, int update_rip = false; vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_EXTINT, 1); break; + case VMCB_EXIT_NMI: + update_rip = false; + break; case VMCB_EXIT_IO: loop = svm_handle_io(svm_sc, vcpu, vmexit); vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_INOUT, 1); Modified: projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Sat Sep 13 23:03:46 2014 (r271558) +++ projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Sat Sep 13 23:48:43 2014 (r271559) @@ -124,6 +124,7 @@ /* VMCB exit code, APM vol2 Appendix C */ #define VMCB_EXIT_MC 0x52 #define VMCB_EXIT_INTR 0x60 +#define VMCB_EXIT_NMI 0x61 #define VMCB_EXIT_VINTR 0x64 #define VMCB_EXIT_PUSHF 0x70 #define VMCB_EXIT_POPF 0x71