Date: Fri, 2 May 2014 07:04:19 +0000 (UTC) From: Mark Murray <markm@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r265213 - in projects/random_number_generator: . lib/libc/regex share/man/man4 sys/amd64/include sys/amd64/vmm sys/arm/rockchip sys/boot/fdt/dts/arm sys/dev/ath sys/dev/lindev sys/dev/s... Message-ID: <201405020704.s4274JQh094901@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markm Date: Fri May 2 07:04:18 2014 New Revision: 265213 URL: http://svnweb.freebsd.org/changeset/base/265213 Log: MFC - tracking commit. Merging r265195 through r265212. Deleted: projects/random_number_generator/share/man/man4/lindev.4 projects/random_number_generator/sys/dev/lindev/ Modified: projects/random_number_generator/UPDATING projects/random_number_generator/lib/libc/regex/engine.c projects/random_number_generator/lib/libc/regex/regcomp.c projects/random_number_generator/share/man/man4/Makefile projects/random_number_generator/sys/amd64/include/vmm.h (contents, props changed) projects/random_number_generator/sys/amd64/vmm/vmm.c projects/random_number_generator/sys/arm/rockchip/rk30xx_machdep.c projects/random_number_generator/sys/boot/fdt/dts/arm/exynos5250.dtsi projects/random_number_generator/sys/boot/fdt/dts/arm/zedboard.dts projects/random_number_generator/sys/dev/ath/if_ath.c projects/random_number_generator/sys/dev/ath/if_ath_misc.h projects/random_number_generator/sys/dev/ath/if_athvar.h projects/random_number_generator/sys/dev/sdhci/sdhci_fdt.c projects/random_number_generator/sys/fs/fifofs/fifo_vnops.c projects/random_number_generator/sys/geom/uzip/g_uzip.c projects/random_number_generator/sys/kern/subr_clock.c projects/random_number_generator/sys/kern/sys_pipe.c projects/random_number_generator/sys/net/radix.c projects/random_number_generator/sys/sys/pipe.h projects/random_number_generator/usr.sbin/bhyve/bhyve.8 projects/random_number_generator/usr.sbin/bhyve/bhyverun.c projects/random_number_generator/usr.sbin/bhyve/mptbl.c projects/random_number_generator/usr.sbin/bhyve/pci_emul.c projects/random_number_generator/usr.sbin/bhyve/pci_emul.h Directory Properties: projects/random_number_generator/ (props changed) projects/random_number_generator/lib/libc/ (props changed) projects/random_number_generator/share/man/man4/ (props changed) projects/random_number_generator/sys/ (props changed) projects/random_number_generator/sys/amd64/vmm/ (props changed) projects/random_number_generator/sys/boot/ (props changed) projects/random_number_generator/usr.sbin/bhyve/ (props changed) Modified: projects/random_number_generator/UPDATING ============================================================================== --- projects/random_number_generator/UPDATING Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/UPDATING Fri May 2 07:04:18 2014 (r265213) @@ -31,6 +31,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20140430: + The lindev device has been removed since /dev/full has been made a + standard device. __FreeBSD_version has been bumped. + 20140418: The YES_HESIOD knob has been removed. It has been obsolete for a decade. Please move to using WITH_HESIOD instead or your builds Modified: projects/random_number_generator/lib/libc/regex/engine.c ============================================================================== --- projects/random_number_generator/lib/libc/regex/engine.c Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/lib/libc/regex/engine.c Fri May 2 07:04:18 2014 (r265213) @@ -686,19 +686,16 @@ backref(struct match *m, while (m->g->strip[ss] != SOP(O_BACK, i)) ss++; return(backref(m, sp+len, stop, ss+1, stopst, lev, rec)); - break; case OQUEST_: /* to null or not */ dp = backref(m, sp, stop, ss+1, stopst, lev, rec); if (dp != NULL) return(dp); /* not */ return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev, rec)); - break; case OPLUS_: assert(m->lastpos != NULL); assert(lev+1 <= m->g->nplus); m->lastpos[lev+1] = sp; return(backref(m, sp, stop, ss+1, stopst, lev+1, rec)); - break; case O_PLUS: if (sp == m->lastpos[lev]) /* last pass matched null */ return(backref(m, sp, stop, ss+1, stopst, lev-1, rec)); @@ -709,7 +706,6 @@ backref(struct match *m, return(backref(m, sp, stop, ss+1, stopst, lev-1, rec)); else return(dp); - break; case OCH_: /* find the right one, if any */ ssub = ss + 1; esub = ss + OPND(s) - 1; @@ -730,6 +726,7 @@ backref(struct match *m, else assert(OP(m->g->strip[esub]) == O_CH); } + /* NOTREACHED */ break; case OLPAREN: /* must undo assignment if rest fails */ i = OPND(s); @@ -741,7 +738,6 @@ backref(struct match *m, return(dp); m->pmatch[i].rm_so = offsave; return(NULL); - break; case ORPAREN: /* must undo assignment if rest fails */ i = OPND(s); assert(0 < i && i <= m->g->nsub); @@ -752,7 +748,6 @@ backref(struct match *m, return(dp); m->pmatch[i].rm_eo = offsave; return(NULL); - break; default: /* uh oh */ assert(nope); break; Modified: projects/random_number_generator/lib/libc/regex/regcomp.c ============================================================================== --- projects/random_number_generator/lib/libc/regex/regcomp.c Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/lib/libc/regex/regcomp.c Fri May 2 07:04:18 2014 (r265213) @@ -746,7 +746,6 @@ p_b_term(struct parse *p, cset *cs) case '-': SETERROR(REG_ERANGE); return; /* NOTE RETURN */ - break; default: c = '\0'; break; Modified: projects/random_number_generator/share/man/man4/Makefile ============================================================================== --- projects/random_number_generator/share/man/man4/Makefile Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/share/man/man4/Makefile Fri May 2 07:04:18 2014 (r265213) @@ -142,6 +142,7 @@ MAN= aac.4 \ filemon.4 \ firewire.4 \ fpa.4 \ + full.4 \ fwe.4 \ fwip.4 \ fwohci.4 \ @@ -226,7 +227,6 @@ MAN= aac.4 \ le.4 \ led.4 \ lge.4 \ - ${_lindev.4} \ ${_linux.4} \ lmc.4 \ lo.4 \ @@ -790,7 +790,6 @@ _if_vxge.4= if_vxge.4 _if_wpi.4= if_wpi.4 _ipmi.4= ipmi.4 _io.4= io.4 -_lindev.4= lindev.4 _linux.4= linux.4 _ndis.4= ndis.4 _nfe.4= nfe.4 @@ -819,7 +818,6 @@ _wpi.4= wpi.4 _xen.4= xen.4 _xnb.4= xnb.4 -MLINKS+=lindev.4 full.4 .endif .if ${MACHINE_CPUARCH} == "amd64" Modified: projects/random_number_generator/sys/amd64/include/vmm.h ============================================================================== --- projects/random_number_generator/sys/amd64/include/vmm.h Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/sys/amd64/include/vmm.h Fri May 2 07:04:18 2014 (r265213) @@ -33,6 +33,7 @@ enum vm_suspend_how { VM_SUSPEND_NONE, VM_SUSPEND_RESET, VM_SUSPEND_POWEROFF, + VM_SUSPEND_HALT, VM_SUSPEND_LAST }; Modified: projects/random_number_generator/sys/amd64/vmm/vmm.c ============================================================================== --- projects/random_number_generator/sys/amd64/vmm/vmm.c Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/sys/amd64/vmm/vmm.c Fri May 2 07:04:18 2014 (r265213) @@ -142,6 +142,8 @@ struct vm { int suspend; volatile cpuset_t suspended_cpus; + + volatile cpuset_t halted_cpus; }; static int vmm_initialized; @@ -1006,9 +1008,13 @@ vm_handle_hlt(struct vm *vm, int vcpuid, { struct vcpu *vcpu; const char *wmesg; - int t; + int t, vcpu_halted, vm_halted; + + KASSERT(!CPU_ISSET(vcpuid, &vm->halted_cpus), ("vcpu already halted")); vcpu = &vm->vcpu[vcpuid]; + vcpu_halted = 0; + vm_halted = 0; vcpu_lock(vcpu); while (1) { @@ -1032,10 +1038,26 @@ vm_handle_hlt(struct vm *vm, int vcpuid, } } - if (vlapic_enabled(vcpu->vlapic)) - wmesg = "vmidle"; - else + /* + * Some Linux guests implement "halt" by having all vcpus + * execute HLT with interrupts disabled. 'halted_cpus' keeps + * track of the vcpus that have entered this state. When all + * vcpus enter the halted state the virtual machine is halted. + */ + if (intr_disabled) { wmesg = "vmhalt"; + VCPU_CTR0(vm, vcpuid, "Halted"); + if (!vcpu_halted) { + vcpu_halted = 1; + CPU_SET_ATOMIC(vcpuid, &vm->halted_cpus); + } + if (CPU_CMP(&vm->halted_cpus, &vm->active_cpus) == 0) { + vm_halted = 1; + break; + } + } else { + wmesg = "vmidle"; + } t = ticks; vcpu_require_state_locked(vcpu, VCPU_SLEEPING); @@ -1043,8 +1065,15 @@ vm_handle_hlt(struct vm *vm, int vcpuid, vcpu_require_state_locked(vcpu, VCPU_FROZEN); vmm_stat_incr(vm, vcpuid, VCPU_IDLE_TICKS, ticks - t); } + + if (vcpu_halted) + CPU_CLR_ATOMIC(vcpuid, &vm->halted_cpus); + vcpu_unlock(vcpu); + if (vm_halted) + vm_suspend(vm, VM_SUSPEND_HALT); + return (0); } Modified: projects/random_number_generator/sys/arm/rockchip/rk30xx_machdep.c ============================================================================== --- projects/random_number_generator/sys/arm/rockchip/rk30xx_machdep.c Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/sys/arm/rockchip/rk30xx_machdep.c Fri May 2 07:04:18 2014 (r265213) @@ -51,14 +51,11 @@ __FBSDID("$FreeBSD$"); #include <arm/rockchip/rk30xx_wdog.h> -/* Start of address space used for bootstrap map */ -#define DEVMAP_BOOTSTRAP_MAP_START 0xF0000000 - vm_offset_t initarm_lastaddr(void) { - return (DEVMAP_BOOTSTRAP_MAP_START); + return (arm_devmap_lastaddr()); } void @@ -81,27 +78,14 @@ initarm_late_init(void) CPU_CONTROL_DC_ENABLE|CPU_CONTROL_IC_ENABLE); } -#define FDT_DEVMAP_MAX (1 + 2 + 1 + 1) -static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { - { 0, 0, 0, 0, 0, } -}; - /* - * Construct pmap_devmap[] with DT-derived config data. + * Set up static device mappings. */ int initarm_devmap_init(void) { - int i = 0; - - fdt_devmap[i].pd_va = 0xF0000000; - fdt_devmap[i].pd_pa = 0x20000000; - fdt_devmap[i].pd_size = 0x100000; - fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE; - fdt_devmap[i].pd_cache = PTE_DEVICE; - i++; - arm_devmap_register_table(&fdt_devmap[0]); + arm_devmap_add_entry(0x20000000, 0x00100000); return (0); } Modified: projects/random_number_generator/sys/boot/fdt/dts/arm/exynos5250.dtsi ============================================================================== --- projects/random_number_generator/sys/boot/fdt/dts/arm/exynos5250.dtsi Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/sys/boot/fdt/dts/arm/exynos5250.dtsi Fri May 2 07:04:18 2014 (r265213) @@ -126,7 +126,7 @@ reg = <0x12200000 0x1000>; interrupts = <107>; interrupt-parent = <&GIC>; - clock-frequency = <24000000>; /* TODO: verify freq */ + max-frequency = <24000000>; /* TODO: verify freq */ }; sdhci@12210000 { @@ -134,7 +134,7 @@ reg = <0x12210000 0x1000>; interrupts = <108>; interrupt-parent = <&GIC>; - clock-frequency = <24000000>; + max-frequency = <24000000>; }; sdhci@12220000 { @@ -142,7 +142,7 @@ reg = <0x12220000 0x1000>; interrupts = <109>; interrupt-parent = <&GIC>; - clock-frequency = <24000000>; + max-frequency = <24000000>; }; sdhci@12230000 { @@ -150,7 +150,7 @@ reg = <0x12230000 0x1000>; interrupts = <110>; interrupt-parent = <&GIC>; - clock-frequency = <24000000>; + max-frequency = <24000000>; }; serial0: serial@12C00000 { Modified: projects/random_number_generator/sys/boot/fdt/dts/arm/zedboard.dts ============================================================================== --- projects/random_number_generator/sys/boot/fdt/dts/arm/zedboard.dts Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/sys/boot/fdt/dts/arm/zedboard.dts Fri May 2 07:04:18 2014 (r265213) @@ -183,7 +183,7 @@ reg = <0x100000 0x1000>; interrupts = <56>; interrupt-parent = <&GIC>; - clock-frequency = <50000000>; + max-frequency = <50000000>; }; // QSPI Modified: projects/random_number_generator/sys/dev/ath/if_ath.c ============================================================================== --- projects/random_number_generator/sys/dev/ath/if_ath.c Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/sys/dev/ath/if_ath.c Fri May 2 07:04:18 2014 (r265213) @@ -305,6 +305,55 @@ _ath_power_setpower(struct ath_softc *sc power_state != sc->sc_cur_powerstate) { sc->sc_cur_powerstate = power_state; ath_hal_setpower(sc->sc_ah, power_state); + + /* + * If the NIC is force-awake, then set the + * self-gen frame state appropriately. + * + * If the nic is in network sleep or full-sleep, + * we let the above call leave the self-gen + * state as "sleep". + */ + if (sc->sc_cur_powerstate == HAL_PM_AWAKE && + sc->sc_target_selfgen_state != HAL_PM_AWAKE) { + ath_hal_setselfgenpower(sc->sc_ah, + sc->sc_target_selfgen_state); + } + } +} + +/* + * Set the current self-generated frames state. + * + * This is separate from the target power mode. The chip may be + * awake but the desired state is "sleep", so frames sent to the + * destination has PWRMGT=1 in the 802.11 header. The NIC also + * needs to know to set PWRMGT=1 in self-generated frames. + */ +void +_ath_power_set_selfgen(struct ath_softc *sc, int power_state, const char *file, int line) +{ + + ATH_LOCK_ASSERT(sc); + + DPRINTF(sc, ATH_DEBUG_PWRSAVE, "%s: (%s:%d) state=%d, refcnt=%d\n", + __func__, + file, + line, + power_state, + sc->sc_target_selfgen_state); + + sc->sc_target_selfgen_state = power_state; + + /* + * If the NIC is force-awake, then set the power state. + * Network-state and full-sleep will already transition it to + * mark self-gen frames as sleeping - and we can't + * guarantee the NIC is awake to program the self-gen frame + * setting anyway. + */ + if (sc->sc_cur_powerstate == HAL_PM_AWAKE) { + ath_hal_setselfgenpower(sc->sc_ah, power_state); } } @@ -334,6 +383,16 @@ _ath_power_set_power_state(struct ath_so if (power_state != sc->sc_cur_powerstate) { ath_hal_setpower(sc->sc_ah, power_state); sc->sc_cur_powerstate = power_state; + + /* + * Adjust the self-gen powerstate if appropriate. + */ + if (sc->sc_cur_powerstate == HAL_PM_AWAKE && + sc->sc_target_selfgen_state != HAL_PM_AWAKE) { + ath_hal_setselfgenpower(sc->sc_ah, + sc->sc_target_selfgen_state); + } + } } @@ -366,6 +425,16 @@ _ath_power_restore_power_state(struct at sc->sc_cur_powerstate = sc->sc_target_powerstate; ath_hal_setpower(sc->sc_ah, sc->sc_target_powerstate); } + + /* + * Adjust the self-gen powerstate if appropriate. + */ + if (sc->sc_cur_powerstate == HAL_PM_AWAKE && + sc->sc_target_selfgen_state != HAL_PM_AWAKE) { + ath_hal_setselfgenpower(sc->sc_ah, + sc->sc_target_selfgen_state); + } + } #define HAL_MODE_HT20 (HAL_MODE_11NG_HT20 | HAL_MODE_11NA_HT20) @@ -1734,6 +1803,7 @@ ath_resume(struct ath_softc *sc) /* Ensure we set the current power state to on */ ATH_LOCK(sc); + ath_power_setselfgen(sc, HAL_PM_AWAKE); ath_power_set_power_state(sc, HAL_PM_AWAKE); ath_power_setpower(sc, HAL_PM_AWAKE); ATH_UNLOCK(sc); @@ -2252,6 +2322,7 @@ ath_init(void *arg) /* * Force the sleep state awake. */ + ath_power_setselfgen(sc, HAL_PM_AWAKE); ath_power_set_power_state(sc, HAL_PM_AWAKE); ath_power_setpower(sc, HAL_PM_AWAKE); @@ -5656,6 +5727,20 @@ ath_newstate(struct ieee80211vap *vap, e /* Before we touch the hardware - wake it up */ ATH_LOCK(sc); + /* + * If the NIC is in anything other than SLEEP state, + * we need to ensure that self-generated frames are + * set for PWRMGT=0. Otherwise we may end up with + * strange situations. + * + * XXX TODO: is this actually the case? :-) + */ + if (nstate != IEEE80211_S_SLEEP) + ath_power_setselfgen(sc, HAL_PM_AWAKE); + + /* + * Now, wake the thing up. + */ ath_power_set_power_state(sc, HAL_PM_AWAKE); ATH_UNLOCK(sc); @@ -5675,6 +5760,7 @@ ath_newstate(struct ieee80211vap *vap, e /* Ensure we stay awake during scan */ ATH_LOCK(sc); + ath_power_setselfgen(sc, HAL_PM_AWAKE); ath_power_setpower(sc, HAL_PM_AWAKE); ATH_UNLOCK(sc); @@ -5850,6 +5936,7 @@ ath_newstate(struct ieee80211vap *vap, e * Force awake for RUN mode. */ ATH_LOCK(sc); + ath_power_setselfgen(sc, HAL_PM_AWAKE); ath_power_setpower(sc, HAL_PM_AWAKE); ATH_UNLOCK(sc); @@ -5891,20 +5978,23 @@ ath_newstate(struct ieee80211vap *vap, e vap->iv_opmode == IEEE80211_M_STA) { DPRINTF(sc, ATH_DEBUG_BEACON, "%s: syncbeacon=%d\n", __func__, sc->sc_syncbeacon); ATH_LOCK(sc); - if (sc->sc_syncbeacon == 0) { - ath_power_setpower(sc, HAL_PM_NETWORK_SLEEP); - } /* * Always at least set the self-generated - * power bits appropriately. + * frame config to set PWRMGT=1. + */ + ath_power_setselfgen(sc, HAL_PM_NETWORK_SLEEP); + + /* + * If we're not syncing beacons, transition + * to NETWORK_SLEEP. * - * XXX TODO: this should be an ath_power_*() call - * which also tracks whether we're doing self-gen - * frames or not, and allows the hardware to be - * awake _but_ self-gen frames to have PWRMGT=1. + * We stay awake if syncbeacon > 0 in case + * we need to listen for some beacons otherwise + * our beacon timer config may be wrong. */ - ath_hal_setselfgenpower(sc->sc_ah, - HAL_PM_NETWORK_SLEEP); + if (sc->sc_syncbeacon == 0) { + ath_power_setpower(sc, HAL_PM_NETWORK_SLEEP); + } ATH_UNLOCK(sc); } } Modified: projects/random_number_generator/sys/dev/ath/if_ath_misc.h ============================================================================== --- projects/random_number_generator/sys/dev/ath/if_ath_misc.h Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/sys/dev/ath/if_ath_misc.h Fri May 2 07:04:18 2014 (r265213) @@ -131,10 +131,12 @@ extern void ath_tx_dump(struct ath_softc * Power state tracking. */ extern void _ath_power_setpower(struct ath_softc *sc, int power_state, const char *file, int line); +extern void _ath_power_set_selfgen(struct ath_softc *sc, int power_state, const char *file, int line); extern void _ath_power_set_power_state(struct ath_softc *sc, int power_state, const char *file, int line); extern void _ath_power_restore_power_state(struct ath_softc *sc, const char *file, int line); #define ath_power_setpower(sc, ps) _ath_power_setpower(sc, ps, __FILE__, __LINE__) +#define ath_power_setselfgen(sc, ps) _ath_power_set_selfgen(sc, ps, __FILE__, __LINE__) #define ath_power_set_power_state(sc, ps) _ath_power_set_power_state(sc, ps, __FILE__, __LINE__) #define ath_power_restore_power_state(sc) _ath_power_restore_power_state(sc, __FILE__, __LINE__) Modified: projects/random_number_generator/sys/dev/ath/if_athvar.h ============================================================================== --- projects/random_number_generator/sys/dev/ath/if_athvar.h Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/sys/dev/ath/if_athvar.h Fri May 2 07:04:18 2014 (r265213) @@ -867,10 +867,19 @@ struct ath_softc { int status); /* - * powersave state tracking. + * Powersave state tracking. + * + * target/cur powerstate is the chip power state. + * target selfgen state is the self-generated frames + * state. The chip can be awake but transmitted frames + * can have the PWRMGT bit set to 1 so the destination + * thinks the node is asleep. */ HAL_POWER_MODE sc_target_powerstate; + HAL_POWER_MODE sc_target_selfgen_state; + HAL_POWER_MODE sc_cur_powerstate; + int sc_powersave_refcnt; }; Modified: projects/random_number_generator/sys/dev/sdhci/sdhci_fdt.c ============================================================================== --- projects/random_number_generator/sys/dev/sdhci/sdhci_fdt.c Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/sys/dev/sdhci/sdhci_fdt.c Fri May 2 07:04:18 2014 (r265213) @@ -66,6 +66,7 @@ struct sdhci_fdt_softc { device_t dev; /* Controller device */ u_int quirks; /* Chip specific quirks */ u_int caps; /* If we override SDHCI_CAPABILITIES */ + uint32_t max_clk; /* Max possible freq */ struct resource *irq_res; /* IRQ resource */ void *intrhand; /* Interrupt handle */ @@ -156,6 +157,7 @@ sdhci_fdt_probe(device_t dev) sc->quirks = 0; sc->num_slots = 1; + sc->max_clk = 0; if (!ofw_bus_status_okay(dev)) return (ENXIO); @@ -170,11 +172,14 @@ sdhci_fdt_probe(device_t dev) node = ofw_bus_get_node(dev); - /* Allow dts to patch quirks and slots. */ - if ((OF_getprop(node, "quirks", &cid, sizeof(cid))) > 0) - sc->quirks = fdt32_to_cpu(cid); - if ((OF_getprop(node, "num-slots", &cid, sizeof(cid))) > 0) - sc->num_slots = fdt32_to_cpu(cid); + /* Allow dts to patch quirks, slots, and max-frequency. */ + if ((OF_getencprop(node, "quirks", &cid, sizeof(cid))) > 0) + sc->quirks = cid; + if ((OF_getencprop(node, "num-slots", &cid, sizeof(cid))) > 0) + sc->num_slots = cid; + if ((OF_getencprop(node, "max-frequency", &cid, sizeof(cid))) > 0) + sc->max_clk = cid; + return (0); } @@ -214,6 +219,7 @@ sdhci_fdt_attach(device_t dev) slot->quirks = sc->quirks; slot->caps = sc->caps; + slot->max_clk = sc->max_clk; if (sdhci_init_slot(dev, slot, i) != 0) continue; Modified: projects/random_number_generator/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- projects/random_number_generator/sys/fs/fifofs/fifo_vnops.c Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/sys/fs/fifofs/fifo_vnops.c Fri May 2 07:04:18 2014 (r265213) @@ -146,9 +146,7 @@ fifo_open(ap) if (fp == NULL || (ap->a_mode & FEXEC) != 0) return (EINVAL); if ((fip = vp->v_fifoinfo) == NULL) { - error = pipe_named_ctor(&fpipe, td); - if (error != 0) - return (error); + pipe_named_ctor(&fpipe, td); fip = malloc(sizeof(*fip), M_VNODE, M_WAITOK); fip->fi_pipe = fpipe; fpipe->pipe_wgen = fip->fi_readers = fip->fi_writers = 0; Modified: projects/random_number_generator/sys/geom/uzip/g_uzip.c ============================================================================== --- projects/random_number_generator/sys/geom/uzip/g_uzip.c Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/sys/geom/uzip/g_uzip.c Fri May 2 07:04:18 2014 (r265213) @@ -479,6 +479,7 @@ g_uzip_taste(struct g_class *mp, struct } offsets_read += nread; } + free(buf, M_GEOM); DPRINTF(("%s: done reading offsets\n", gp->name)); mtx_init(&sc->last_mtx, "geom_uzip cache", NULL, MTX_DEF); sc->last_blk = -1; Modified: projects/random_number_generator/sys/kern/subr_clock.c ============================================================================== --- projects/random_number_generator/sys/kern/subr_clock.c Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/sys/kern/subr_clock.c Fri May 2 07:04:18 2014 (r265213) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include <sys/kernel.h> #include <sys/bus.h> #include <sys/clock.h> +#include <sys/limits.h> #include <sys/sysctl.h> #include <sys/timetc.h> @@ -147,7 +148,7 @@ clock_ct_to_ts(struct clocktime *ct, str if (ct->mon < 1 || ct->mon > 12 || ct->day < 1 || ct->day > days_in_month(year, ct->mon) || ct->hour > 23 || ct->min > 59 || ct->sec > 59 || - ct->year > 2037) { /* time_t overflow */ + (sizeof(time_t) == 4 && year > 2037)) { /* time_t overflow */ if (ct_debug) printf(" = EINVAL\n"); return (EINVAL); Modified: projects/random_number_generator/sys/kern/sys_pipe.c ============================================================================== --- projects/random_number_generator/sys/kern/sys_pipe.c Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/sys/kern/sys_pipe.c Fri May 2 07:04:18 2014 (r265213) @@ -221,8 +221,8 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, piperesi static void pipeinit(void *dummy __unused); static void pipeclose(struct pipe *cpipe); static void pipe_free_kmem(struct pipe *cpipe); -static int pipe_create(struct pipe *pipe, int backing); -static int pipe_paircreate(struct thread *td, struct pipepair **p_pp); +static void pipe_create(struct pipe *pipe, int backing); +static void pipe_paircreate(struct thread *td, struct pipepair **p_pp); static __inline int pipelock(struct pipe *cpipe, int catch); static __inline void pipeunlock(struct pipe *cpipe); #ifndef PIPE_NODIRECT @@ -331,12 +331,11 @@ pipe_zone_fini(void *mem, int size) mtx_destroy(&pp->pp_mtx); } -static int +static void pipe_paircreate(struct thread *td, struct pipepair **p_pp) { struct pipepair *pp; struct pipe *rpipe, *wpipe; - int error; *p_pp = pp = uma_zalloc(pipe_zone, M_WAITOK); #ifdef MAC @@ -355,30 +354,21 @@ pipe_paircreate(struct thread *td, struc knlist_init_mtx(&wpipe->pipe_sel.si_note, PIPE_MTX(wpipe)); /* Only the forward direction pipe is backed by default */ - if ((error = pipe_create(rpipe, 1)) != 0 || - (error = pipe_create(wpipe, 0)) != 0) { - pipeclose(rpipe); - pipeclose(wpipe); - return (error); - } + pipe_create(rpipe, 1); + pipe_create(wpipe, 0); rpipe->pipe_state |= PIPE_DIRECTOK; wpipe->pipe_state |= PIPE_DIRECTOK; - return (0); } -int +void pipe_named_ctor(struct pipe **ppipe, struct thread *td) { struct pipepair *pp; - int error; - error = pipe_paircreate(td, &pp); - if (error != 0) - return (error); + pipe_paircreate(td, &pp); pp->pp_rpipe.pipe_state |= PIPE_NAMED; *ppipe = &pp->pp_rpipe; - return (0); } void @@ -419,9 +409,7 @@ kern_pipe2(struct thread *td, int fildes int fd, fflags, error; fdp = td->td_proc->p_fd; - error = pipe_paircreate(td, &pp); - if (error != 0) - return (error); + pipe_paircreate(td, &pp); rpipe = &pp->pp_rpipe; wpipe = &pp->pp_wpipe; error = falloc(td, &rf, &fd, flags); @@ -642,24 +630,27 @@ pipeselwakeup(cpipe) * Initialize and allocate VM and memory for pipe. The structure * will start out zero'd from the ctor, so we just manage the kmem. */ -static int +static void pipe_create(pipe, backing) struct pipe *pipe; int backing; { - int error; if (backing) { + /* + * Note that these functions can fail if pipe map is exhausted + * (as a result of too many pipes created), but we ignore the + * error as it is not fatal and could be provoked by + * unprivileged users. The only consequence is worse performance + * with given pipe. + */ if (amountpipekva > maxpipekva / 2) - error = pipespace_new(pipe, SMALL_PIPE_SIZE); + (void)pipespace_new(pipe, SMALL_PIPE_SIZE); else - error = pipespace_new(pipe, PIPE_SIZE); - } else { - /* If we're not backing this pipe, no need to do anything. */ - error = 0; + (void)pipespace_new(pipe, PIPE_SIZE); } + pipe->pipe_ino = -1; - return (error); } /* ARGSUSED */ Modified: projects/random_number_generator/sys/net/radix.c ============================================================================== --- projects/random_number_generator/sys/net/radix.c Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/sys/net/radix.c Fri May 2 07:04:18 2014 (r265213) @@ -971,6 +971,8 @@ rn_walktree_from(struct radix_node_head int stopping = 0; int lastb; + KASSERT(m != NULL, ("%s: mask needs to be specified", __func__)); + /* * rn_search_m is sort-of-open-coded here. We cannot use the * function because we need to keep track of the last node seen. @@ -994,11 +996,11 @@ rn_walktree_from(struct radix_node_head /* * Two cases: either we stepped off the end of our mask, * in which case last == rn, or we reached a leaf, in which - * case we want to start from the last node we looked at. - * Either way, last is the node we want to start from. + * case we want to start from the leaf. */ - rn = last; - lastb = rn->rn_bit; + if (rn->rn_bit >= 0) + rn = last; + lastb = last->rn_bit; /* printf("rn %p, lastb %d\n", rn, lastb);*/ Modified: projects/random_number_generator/sys/sys/pipe.h ============================================================================== --- projects/random_number_generator/sys/sys/pipe.h Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/sys/sys/pipe.h Fri May 2 07:04:18 2014 (r265213) @@ -142,6 +142,6 @@ struct pipepair { #define PIPE_LOCK_ASSERT(pipe, type) mtx_assert(PIPE_MTX(pipe), (type)) void pipe_dtor(struct pipe *dpipe); -int pipe_named_ctor(struct pipe **ppipe, struct thread *td); +void pipe_named_ctor(struct pipe **ppipe, struct thread *td); void pipeselwakeup(struct pipe *cpipe); #endif /* !_SYS_PIPE_H_ */ Modified: projects/random_number_generator/usr.sbin/bhyve/bhyve.8 ============================================================================== --- projects/random_number_generator/usr.sbin/bhyve/bhyve.8 Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/usr.sbin/bhyve/bhyve.8 Fri May 2 07:04:18 2014 (r265213) @@ -236,6 +236,8 @@ This is intended for debug purposes. Ignore accesses to unimplemented Model Specific Registers (MSRs). This is intended for debug purposes. .It Fl x The guest's local APIC is configured in x2APIC mode. +.It Fl Y +Disable MPtable generation. .It Fl h Print help message and exit. .It Ar vmname Modified: projects/random_number_generator/usr.sbin/bhyve/bhyverun.c ============================================================================== --- projects/random_number_generator/usr.sbin/bhyve/bhyverun.c Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/usr.sbin/bhyve/bhyverun.c Fri May 2 07:04:18 2014 (r265213) @@ -145,6 +145,7 @@ usage(int code) " -m: memory size in MB\n" " -w: ignore unimplemented MSRs\n" " -x: local apic is in x2APIC mode\n" + " -Y: disable MPtable generation\n" " -U: uuid\n", progname, (int)strlen(progname), ""); @@ -453,7 +454,6 @@ vmexit_suspend(struct vmctx *ctx, struct enum vm_suspend_how how; how = vmexit->u.suspended.how; - assert(how == VM_SUSPEND_RESET || how == VM_SUSPEND_POWEROFF); fbsdrun_deletecpu(ctx, *pvcpu); @@ -470,10 +470,17 @@ vmexit_suspend(struct vmctx *ctx, struct } pthread_mutex_unlock(&resetcpu_mtx); - if (how == VM_SUSPEND_RESET) + switch (how) { + case VM_SUSPEND_RESET: exit(0); - if (how == VM_SUSPEND_POWEROFF) + case VM_SUSPEND_POWEROFF: exit(1); + case VM_SUSPEND_HALT: + exit(2); + default: + fprintf(stderr, "vmexit_suspend: invalid reason %d\n", how); + exit(100); + } return (0); /* NOTREACHED */ } @@ -610,7 +617,7 @@ int main(int argc, char *argv[]) { int c, error, gdb_port, err, bvmcons; - int max_vcpus; + int max_vcpus, mptgen; struct vmctx *ctx; uint64_t rip; size_t memsize; @@ -620,8 +627,9 @@ main(int argc, char *argv[]) gdb_port = 0; guest_ncpus = 1; memsize = 256 * MB; + mptgen = 1; - while ((c = getopt(argc, argv, "abehwxAHIPWp:g:c:s:m:l:U:")) != -1) { + while ((c = getopt(argc, argv, "abehwxAHIPWYp:g:c:s:m:l:U:")) != -1) { switch (c) { case 'a': x2apic_mode = 0; @@ -687,6 +695,9 @@ main(int argc, char *argv[]) case 'x': x2apic_mode = 1; break; + case 'Y': + mptgen = 0; + break; case 'h': usage(0); default: @@ -746,7 +757,11 @@ main(int argc, char *argv[]) /* * build the guest tables, MP etc. */ - mptable_build(ctx, guest_ncpus); + if (mptgen) { + error = mptable_build(ctx, guest_ncpus); + if (error) + exit(1); + } error = smbios_build(ctx); assert(error == 0); Modified: projects/random_number_generator/usr.sbin/bhyve/mptbl.c ============================================================================== --- projects/random_number_generator/usr.sbin/bhyve/mptbl.c Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/usr.sbin/bhyve/mptbl.c Fri May 2 07:04:18 2014 (r265213) @@ -303,16 +303,31 @@ mptable_build(struct vmctx *ctx, int ncp proc_entry_ptr mpep; mpfps_t mpfp; int_entry_ptr mpie; - int ioints; + int ioints, bus; char *curraddr; char *startaddr; startaddr = paddr_guest2host(ctx, MPTABLE_BASE, MPTABLE_MAX_LENGTH); if (startaddr == NULL) { - printf("mptable requires mapped mem\n"); + fprintf(stderr, "mptable requires mapped mem\n"); return (ENOMEM); } + /* + * There is no way to advertise multiple PCI hierarchies via MPtable + * so require that there is no PCI hierarchy with a non-zero bus + * number. + */ + for (bus = 1; bus <= PCI_BUSMAX; bus++) { + if (pci_bus_configured(bus)) { + fprintf(stderr, "MPtable is incompatible with " + "multiple PCI hierarchies.\r\n"); + fprintf(stderr, "MPtable generation can be disabled " + "by passing the -Y option to bhyve(8).\r\n"); + return (EINVAL); + } + } + curraddr = startaddr; mpfp = (mpfps_t)curraddr; mpt_build_mpfp(mpfp, MPTABLE_BASE); Modified: projects/random_number_generator/usr.sbin/bhyve/pci_emul.c ============================================================================== --- projects/random_number_generator/usr.sbin/bhyve/pci_emul.c Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/usr.sbin/bhyve/pci_emul.c Fri May 2 07:04:18 2014 (r265213) @@ -1261,6 +1261,13 @@ pci_write_dsdt(void) } int +pci_bus_configured(int bus) +{ + assert(bus >= 0 && bus < MAXBUSES); + return (pci_businfo[bus] != NULL); +} + +int pci_msi_enabled(struct pci_devinst *pi) { return (pi->pi_msi.enabled); Modified: projects/random_number_generator/usr.sbin/bhyve/pci_emul.h ============================================================================== --- projects/random_number_generator/usr.sbin/bhyve/pci_emul.h Fri May 2 05:30:49 2014 (r265212) +++ projects/random_number_generator/usr.sbin/bhyve/pci_emul.h Fri May 2 07:04:18 2014 (r265213) @@ -233,6 +233,7 @@ uint64_t pci_emul_msix_tread(struct pci_ int pci_count_lintr(int bus); void pci_walk_lintr(int bus, pci_lintr_cb cb, void *arg); void pci_write_dsdt(void); +int pci_bus_configured(int bus); static __inline void pci_set_cfgdata8(struct pci_devinst *pi, int offset, uint8_t val)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405020704.s4274JQh094901>