svn commit: r358729 - head/share/mk
Author: jhibbits Date: Sat Mar 7 03:58:58 2020 New Revision: 358729 URL: https://svnweb.freebsd.org/changeset/base/358729 Log: compat: Allow explicit overriding of COMPAT_ARCH and COMPAT_CPUTYPE Summary: Allow src.conf to override the inferred COMPAT_ARCH and COMPAT_CPUTYPE variables, such that a different CPU target can be specified explicitly for the general target vs the compat target. Reviewed by: imp Differential Revision:https://reviews.freebsd.org/D23992 Modified: head/share/mk/bsd.compat.mk Modified: head/share/mk/bsd.compat.mk == --- head/share/mk/bsd.compat.mk Sat Mar 7 00:55:46 2020(r358728) +++ head/share/mk/bsd.compat.mk Sat Mar 7 03:58:58 2020(r358729) @@ -4,8 +4,8 @@ __<${_this:T}>__: .if defined(_LIBCOMPAT) -COMPAT_ARCH= ${TARGET_ARCH} -COMPAT_CPUTYPE=${TARGET_CPUTYPE} +COMPAT_ARCH?= ${TARGET_ARCH} +COMPAT_CPUTYPE?= ${CPUTYPE_${_LIBCOMPAT}} .if (defined(WANT_COMPILER_TYPE) && ${WANT_COMPILER_TYPE} == gcc) || \ (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) COMPAT_COMPILER_TYPE= gcc ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358728 - in head/sys: sys vm
Author: markj Date: Sat Mar 7 00:55:46 2020 New Revision: 358728 URL: https://svnweb.freebsd.org/changeset/base/358728 Log: Move SMR pointer type definition and access macros to smr_types.h. The intent is to provide a header that can be included by other headers without introducing too much pollution. smr.h depends on various headers and will likely grow over time, but is less likely to be required by system headers. Rename SMR_TYPE_DECLARE() to SMR_POINTER(): - One might use SMR to protect more than just pointers; it could be used for resizeable arrays, for example, so TYPE seems too generic. - It is useful to be able to define anonymous SMR-protected pointer types and the _DECLARE suffix makes that look wrong. Reviewed by: jeff, mjg, rlibby Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D23988 Added: head/sys/sys/smr_types.h (contents, props changed) Modified: head/sys/sys/_smr.h head/sys/sys/smr.h head/sys/vm/vm_radix.c Modified: head/sys/sys/_smr.h == --- head/sys/sys/_smr.h Sat Mar 7 00:29:12 2020(r358727) +++ head/sys/sys/_smr.h Sat Mar 7 00:55:46 2020(r358728) @@ -35,4 +35,16 @@ typedef uint32_t smr_seq_t; typedef int32_tsmr_delta_t; typedef struct smr *smr_t; +#defineSMR_ENTERED(smr) \ +(curthread->td_critnest != 0 && zpcpu_get((smr))->c_seq != SMR_SEQ_INVALID) + +#defineSMR_ASSERT_ENTERED(smr) \ +KASSERT(SMR_ENTERED(smr), ("Not in smr section")) + +#defineSMR_ASSERT_NOT_ENTERED(smr) \ +KASSERT(!SMR_ENTERED(smr), ("In smr section.")); + +#define SMR_ASSERT(ex, fn) \ +KASSERT((ex), (fn ": Assertion " #ex " failed at %s:%d", __FILE__, __LINE__)) + #endif /* __SYS_SMR_H_ */ Modified: head/sys/sys/smr.h == --- head/sys/sys/smr.h Sat Mar 7 00:29:12 2020(r358727) +++ head/sys/sys/smr.h Sat Mar 7 00:55:46 2020(r358728) @@ -35,7 +35,8 @@ /* * Safe memory reclamation. See subr_smr.c for a description of the - * algorithm. + * algorithm, and smr_types.h for macros to define and access SMR-protected + * data structures. * * Readers synchronize with smr_enter()/exit() and writers may either * free directly to a SMR UMA zone or use smr_synchronize or wait. @@ -81,112 +82,6 @@ struct smr { #defineSMR_LAZY0x0001 /* Higher latency write, fast read. */ #defineSMR_DEFERRED0x0002 /* Aggregate updates to wr_seq. */ - -#defineSMR_ENTERED(smr) \ -(curthread->td_critnest != 0 && zpcpu_get((smr))->c_seq != SMR_SEQ_INVALID) - -#defineSMR_ASSERT_ENTERED(smr) \ -KASSERT(SMR_ENTERED(smr), ("Not in smr section")) - -#defineSMR_ASSERT_NOT_ENTERED(smr) \ -KASSERT(!SMR_ENTERED(smr), ("In smr section.")); - -#define SMR_ASSERT(ex, fn) \ -KASSERT((ex), (fn ": Assertion " #ex " failed at %s:%d", __FILE__, __LINE__)) - -/* - * SMR Accessors are meant to provide safe access to SMR protected - * pointers and prevent misuse and accidental access. - * - * Accessors are grouped by type: - * entered - Use while in a read section (between smr_enter/smr_exit()) - * serialized - Use while holding a lock that serializes writers. Updates - * are synchronized with readers via included barriers. - * unserialized- Use after the memory is out of scope and not visible to - * readers. - * - * All acceses include a parameter for an assert to verify the required - * synchronization. For example, a writer might use: - * - * smr_serialized_store(pointer, value, mtx_owned()); - * - * These are only enabled in INVARIANTS kernels. - */ - -/* Type restricting pointer access to force smr accessors. */ -#defineSMR_TYPE_DECLARE(smrtype, type) \ -typedef struct { \ - type__ptr; /* Do not access directly */\ -} smrtype - -/* - * Read from an SMR protected pointer while in a read section. - */ -#definesmr_entered_load(p, smr) ({ \ - SMR_ASSERT(SMR_ENTERED((smr)), "smr_entered_load"); \ - (__typeof((p)->__ptr))atomic_load_acq_ptr((uintptr_t *)&(p)->__ptr); \ -}) - -/* - * Read from an SMR protected pointer while serialized by an - * external mechanism. 'ex' should contain an assert that the - * external mechanism is held. i.e.
svn commit: r358727 - head/sys/cam
Author: imp Date: Sat Mar 7 00:29:12 2020 New Revision: 358727 URL: https://svnweb.freebsd.org/changeset/base/358727 Log: Reword a comment to describe what's actually going on. We can call invalidate several times potentially. We just don't do anything on the second and subsequent calls. Modified: head/sys/cam/cam_periph.c Modified: head/sys/cam/cam_periph.c == --- head/sys/cam/cam_periph.c Fri Mar 6 23:31:09 2020(r358726) +++ head/sys/cam/cam_periph.c Sat Mar 7 00:29:12 2020(r358727) @@ -649,7 +649,7 @@ cam_periph_invalidate(struct cam_periph *periph) cam_periph_assert(periph, MA_OWNED); /* -* We only call this routine the first time a peripheral is +* We only tear down the device the first time a peripheral is * invalidated. */ if ((periph->flags & CAM_PERIPH_INVALID) != 0) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358726 - head/sys/vm
Author: brooks Date: Fri Mar 6 23:31:09 2020 New Revision: 358726 URL: https://svnweb.freebsd.org/changeset/base/358726 Log: Remove an apparently incorrect assertion. Without this change mips64 fails to boot. Discussed with: markj Sponsored by: DARPA Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Fri Mar 6 23:01:49 2020(r358725) +++ head/sys/vm/uma_core.c Fri Mar 6 23:31:09 2020(r358726) @@ -716,9 +716,6 @@ zone_put_bucket(uma_zone_t zone, int domain, uma_bucke goto out; zdom = zone_domain_lock(zone, domain); - KASSERT(!ws || zdom->uzd_nitems < zone->uz_bucket_max, - ("%s: zone %p overflow", __func__, zone)); - /* * Conditionally set the maximum number of items. */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358725 - head/sys/powerpc/powermac
Author: andreast Date: Fri Mar 6 23:01:49 2020 New Revision: 358725 URL: https://svnweb.freebsd.org/changeset/base/358725 Log: Revert Modified: head/sys/powerpc/powermac/fcu.c Modified: head/sys/powerpc/powermac/fcu.c == --- head/sys/powerpc/powermac/fcu.c Fri Mar 6 21:51:28 2020 (r358724) +++ head/sys/powerpc/powermac/fcu.c Fri Mar 6 23:01:49 2020 (r358725) @@ -2,6 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2010 Andreas Tobler + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -151,7 +152,7 @@ fcu_write(device_t dev, uint32_t addr, uint8_t reg, ui for (;;) { - if (iicbus_transfer(dev, msg, nitems(msg)) == 0) + if (iicbus_transfer(dev, msg, 1) == 0) return (0); if (++try > 5) { @@ -175,7 +176,7 @@ fcu_read_1(device_t dev, uint32_t addr, uint8_t reg, u for (;;) { - err = iicbus_transfer(dev, msg, nitems(msg)); + err = iicbus_transfer(dev, msg, 2); if (err != 0) goto retry; @@ -249,8 +250,8 @@ fcu_start(void *xdev) sc = device_get_softc(dev); /* Start the fcu device. */ - fcu_write(sc->sc_dev, sc->sc_addr, 0xe, buf, sizeof(buf)); - fcu_write(sc->sc_dev, sc->sc_addr, 0x2e, buf, sizeof(buf)); + fcu_write(sc->sc_dev, sc->sc_addr, 0xe, buf, 1); + fcu_write(sc->sc_dev, sc->sc_addr, 0x2e, buf, 1); fcu_read_1(sc->sc_dev, sc->sc_addr, 0, buf); fcu_rpm_shift = (buf[0] == 1) ? 2 : 3; @@ -289,7 +290,7 @@ fcu_fan_set_rpm(struct fcu_fan *fan, int rpm) buf[0] = rpm >> (8 - fcu_rpm_shift); buf[1] = rpm << fcu_rpm_shift; - if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, sizeof(buf)) < 0) + if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 2) < 0) return (EIO); return (0); @@ -322,7 +323,7 @@ fcu_fan_get_rpm(struct fcu_fan *fan) return (-1); if ((fail & (1 << fan->id)) != 0) { device_printf(fan->dev, - "RPM Fan failed ID: %d %#x\n", fan->id, fail); + "RPM Fan failed ID: %d\n", fan->id); return (-1); } /* Check if fan is active. */ @@ -355,7 +356,7 @@ fcu_fan_set_pwm(struct fcu_fan *fan, int pwm) { uint8_t reg; struct fcu_softc *sc; - uint8_t buf[1]; + uint8_t buf[2]; sc = device_get_softc(fan->dev); @@ -377,7 +378,7 @@ fcu_fan_set_pwm(struct fcu_fan *fan, int pwm) buf[0] = (pwm * 2550) / 1000; - if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, sizeof(buf)) < 0) + if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 1) < 0) return (EIO); return (0); } @@ -631,9 +632,8 @@ fcu_attach_fans(device_t dev) "Maximum allowed RPM"); /* I use i to pass the fan id. */ SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, - "rpm", CTLTYPE_INT | CTLFLAG_RW | - CTLFLAG_MPSAFE, dev, i, - fcu_fanrpm_sysctl, "I", "Fan RPM"); + "rpm", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, + dev, i, fcu_fanrpm_sysctl, "I", "Fan RPM"); } else { fcu_fan_get_pwm(dev, >sc_fans[i], >sc_fans[i].setpoint, @@ -654,14 +654,13 @@ fcu_attach_fans(device_t dev) * of info I want to display/modify. */ SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, - "pwm", CTLTYPE_INT | CTLFLAG_RW | - CTLFLAG_MPSAFE, dev, - FCU_PWM_SYSCTL_PWM | i, - fcu_fanrpm_sysctl, "I", "Fan PWM in %"); - "rpm", CTLTYPE_INT | CTLFLAG_RD | - CTLFLAG_MPSAFE, dev, - FCU_PWM_SYSCTL_RPM | i, - fcu_fanrpm_sysctl, "I", "Fan RPM"); + "pwm", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, + dev, FCU_PWM_SYSCTL_PWM | i, fcu_fanrpm_sysctl, "I", + "Fan PWM in %"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, + "rpm", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT,
svn commit: r358724 - head/sys/powerpc/powermac
Author: andreast Date: Fri Mar 6 21:51:28 2020 New Revision: 358724 URL: https://svnweb.freebsd.org/changeset/base/358724 Log: Drop 'All rights reserved' Replace hardcoded sizes by nitems and sizeof Replace CTLFLAG_NEEDGIANT with CTLFLAG_MPSAFE, I run this driver since a few years with CTLFLAG_MPSAFE w/o issues. Modified: head/sys/powerpc/powermac/fcu.c Modified: head/sys/powerpc/powermac/fcu.c == --- head/sys/powerpc/powermac/fcu.c Fri Mar 6 21:32:42 2020 (r358723) +++ head/sys/powerpc/powermac/fcu.c Fri Mar 6 21:51:28 2020 (r358724) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2010 Andreas Tobler - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -152,7 +151,7 @@ fcu_write(device_t dev, uint32_t addr, uint8_t reg, ui for (;;) { - if (iicbus_transfer(dev, msg, 1) == 0) + if (iicbus_transfer(dev, msg, nitems(msg)) == 0) return (0); if (++try > 5) { @@ -176,7 +175,7 @@ fcu_read_1(device_t dev, uint32_t addr, uint8_t reg, u for (;;) { - err = iicbus_transfer(dev, msg, 2); + err = iicbus_transfer(dev, msg, nitems(msg)); if (err != 0) goto retry; @@ -250,8 +249,8 @@ fcu_start(void *xdev) sc = device_get_softc(dev); /* Start the fcu device. */ - fcu_write(sc->sc_dev, sc->sc_addr, 0xe, buf, 1); - fcu_write(sc->sc_dev, sc->sc_addr, 0x2e, buf, 1); + fcu_write(sc->sc_dev, sc->sc_addr, 0xe, buf, sizeof(buf)); + fcu_write(sc->sc_dev, sc->sc_addr, 0x2e, buf, sizeof(buf)); fcu_read_1(sc->sc_dev, sc->sc_addr, 0, buf); fcu_rpm_shift = (buf[0] == 1) ? 2 : 3; @@ -290,7 +289,7 @@ fcu_fan_set_rpm(struct fcu_fan *fan, int rpm) buf[0] = rpm >> (8 - fcu_rpm_shift); buf[1] = rpm << fcu_rpm_shift; - if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 2) < 0) + if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, sizeof(buf)) < 0) return (EIO); return (0); @@ -323,7 +322,7 @@ fcu_fan_get_rpm(struct fcu_fan *fan) return (-1); if ((fail & (1 << fan->id)) != 0) { device_printf(fan->dev, - "RPM Fan failed ID: %d\n", fan->id); + "RPM Fan failed ID: %d %#x\n", fan->id, fail); return (-1); } /* Check if fan is active. */ @@ -356,7 +355,7 @@ fcu_fan_set_pwm(struct fcu_fan *fan, int pwm) { uint8_t reg; struct fcu_softc *sc; - uint8_t buf[2]; + uint8_t buf[1]; sc = device_get_softc(fan->dev); @@ -378,7 +377,7 @@ fcu_fan_set_pwm(struct fcu_fan *fan, int pwm) buf[0] = (pwm * 2550) / 1000; - if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 1) < 0) + if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, sizeof(buf)) < 0) return (EIO); return (0); } @@ -632,8 +631,9 @@ fcu_attach_fans(device_t dev) "Maximum allowed RPM"); /* I use i to pass the fan id. */ SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, - "rpm", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - dev, i, fcu_fanrpm_sysctl, "I", "Fan RPM"); + "rpm", CTLTYPE_INT | CTLFLAG_RW | + CTLFLAG_MPSAFE, dev, i, + fcu_fanrpm_sysctl, "I", "Fan RPM"); } else { fcu_fan_get_pwm(dev, >sc_fans[i], >sc_fans[i].setpoint, @@ -654,13 +654,14 @@ fcu_attach_fans(device_t dev) * of info I want to display/modify. */ SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, - "pwm", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - dev, FCU_PWM_SYSCTL_PWM | i, fcu_fanrpm_sysctl, "I", - "Fan PWM in %"); - SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, - "rpm", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, - dev, FCU_PWM_SYSCTL_RPM | i, fcu_fanrpm_sysctl, "I", - "Fan RPM"); + "pwm", CTLTYPE_INT | CTLFLAG_RW | + CTLFLAG_MPSAFE, dev, + FCU_PWM_SYSCTL_PWM | i, +
svn commit: r358723 - head/sys/dev/iicbus
Author: andreast Date: Fri Mar 6 21:32:42 2020 New Revision: 358723 URL: https://svnweb.freebsd.org/changeset/base/358723 Log: Drop 'All rights reserved' Replace hardcoded sizes by nitems and sizeof Replace CTLFLAG_NEEDGIANT with CTLFLAG_MPSAFE, I run this driver since a few years with CTLFLAG_MPSAFE w/o issues. Add a HACK to handle a special case for a sensor location. Modified: head/sys/dev/iicbus/ad7417.c Modified: head/sys/dev/iicbus/ad7417.c == --- head/sys/dev/iicbus/ad7417.cFri Mar 6 21:26:35 2020 (r358722) +++ head/sys/dev/iicbus/ad7417.cFri Mar 6 21:32:42 2020 (r358723) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2010 Andreas Tobler - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -143,7 +142,7 @@ ad7417_write(device_t dev, uint32_t addr, uint8_t reg, for (;;) { - if (iicbus_transfer(dev, msg, 1) == 0) + if (iicbus_transfer(dev, msg, nitems(msg)) == 0) return (0); if (++try > 5) { @@ -167,7 +166,7 @@ ad7417_read_1(device_t dev, uint32_t addr, uint8_t reg for (;;) { - err = iicbus_transfer(dev, msg, 2); + err = iicbus_transfer(dev, msg, nitems(msg)); if (err != 0) goto retry; @@ -195,7 +194,7 @@ ad7417_read_2(device_t dev, uint32_t addr, uint8_t reg for (;;) { - err = iicbus_transfer(dev, msg, 2); + err = iicbus_transfer(dev, msg, nitems(msg)); if (err != 0) goto retry; @@ -230,7 +229,7 @@ ad7417_write_read(device_t dev, uint32_t addr, struct for (;;) { - err = iicbus_transfer(dev, msg, 3); + err = iicbus_transfer(dev, msg, nitems(msg)); if (err != 0) goto retry; @@ -258,18 +257,18 @@ ad7417_init_adc(device_t dev, uint32_t addr) /* Clear Config2 */ buf = 0; - err = ad7417_write(dev, addr, AD7417_CONFIG2, , 1); + err = ad7417_write(dev, addr, AD7417_CONFIG2, , sizeof(buf)); /* Read & cache Config1 */ buf = 0; - err = ad7417_write(dev, addr, AD7417_CONFIG, , 1); + err = ad7417_write(dev, addr, AD7417_CONFIG, , sizeof(buf)); err = ad7417_read_1(dev, addr, AD7417_CONFIG, ); adc741x_config = (uint8_t)buf; /* Disable shutdown mode */ adc741x_config &= 0xfe; buf = adc741x_config; - err = ad7417_write(dev, addr, AD7417_CONFIG, , 1); + err = ad7417_write(dev, addr, AD7417_CONFIG, , sizeof(buf)); if (err < 0) return (-1); @@ -310,7 +309,7 @@ ad7417_probe(device_t dev) static int ad7417_fill_sensor_prop(device_t dev) { - phandle_t child; + phandle_t child, node; struct ad7417_softc *sc; u_int id[10]; char location[96]; @@ -359,13 +358,27 @@ ad7417_fill_sensor_prop(device_t dev) for (j = 0; j < i; j++) sc->sc_sensors[j].therm.zone = id[j]; + /* Some PowerMac's have the real location of the sensors on + child nodes of the hwsensor-location node. Check for and + fix the name if needed. + This is needed to apply the below HACK with the diode. + */ + j = 0; + for (node = OF_child(child); node != 0; node = OF_peer(node)) { + + OF_getprop(node, "location", location, sizeof(location)); + strcpy(sc->sc_sensors[i].therm.name, location); + j++; + } + /* Finish setting up sensor properties */ for (j = 0; j < i; j++) { sc->sc_sensors[j].dev = dev; /* HACK: Apple wired a random diode to the ADC line */ - if (strstr(sc->sc_sensors[j].therm.name, "DIODE TEMP") - != NULL) { + if ((strstr(sc->sc_sensors[j].therm.name, "DIODE TEMP") + != NULL) + || (strstr(sc->sc_sensors[j].therm.name, "AD1") != NULL)) { sc->sc_sensors[j].type = ADC7417_TEMP_SENSOR; sc->sc_sensors[j].therm.read = (int (*)(struct pmac_therm *))(ad7417_diode_read); @@ -444,10 +457,10 @@ ad7417_attach(device_t dev) } /* I use i to pass the sensor id. */ SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, - unit, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, dev, - i, ad7417_sensor_sysctl, - sc->sc_sensors[i].type == ADC7417_TEMP_SENSOR ? "IK" : "I", - desc); + unit,
svn commit: r358722 - head/sys/dev/iicbus
Author: andreast Date: Fri Mar 6 21:26:35 2020 New Revision: 358722 URL: https://svnweb.freebsd.org/changeset/base/358722 Log: Drop 'All rights reserved' Replace hardcoded size by nitems Modified: head/sys/dev/iicbus/ds1775.c Modified: head/sys/dev/iicbus/ds1775.c == --- head/sys/dev/iicbus/ds1775.cFri Mar 6 21:24:09 2020 (r358721) +++ head/sys/dev/iicbus/ds1775.cFri Mar 6 21:26:35 2020 (r358722) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2010 Andreas Tobler - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -104,7 +103,7 @@ ds1775_read_2(device_t dev, uint32_t addr, uint8_t reg for (;;) { - err = iicbus_transfer(dev, msg, 2); + err = iicbus_transfer(dev, msg, nitems(msg)); if (err != 0) goto retry; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r358720 - head/sys/dev/iicbus
On 06.03.20 22:21, Andreas Tobler wrote: Author: andreast Date: Fri Mar 6 21:21:01 2020 New Revision: 358720 URL: https://svnweb.freebsd.org/changeset/base/358720 Log: - Drop 'All rights reserved' - Replace hardcoded size by nitems The CTLFLAG_MPSAFE I forgot to mention since I have it since years in my tree. Sorry. Andreas Modified: head/sys/dev/iicbus/max6690.c Modified: head/sys/dev/iicbus/max6690.c == --- head/sys/dev/iicbus/max6690.c Fri Mar 6 21:15:25 2020 (r358719) +++ head/sys/dev/iicbus/max6690.c Fri Mar 6 21:21:01 2020 (r358720) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2010 Andreas Tobler - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -124,7 +123,7 @@ max6690_read(device_t dev, uint32_t addr, uint8_t reg, for (;;) { - err = iicbus_transfer(dev, msg, 4); + err = iicbus_transfer(dev, msg, nitems(msg)); if (err != 0) goto retry; if (busy[0] & 0x80) @@ -302,8 +301,9 @@ max6690_start(void *xdev) "Sensor Information"); /* I use i to pass the sensor id. */ SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "temp", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, dev, i % 2, - max6690_sensor_sysctl, "IK", sysctl_desc); + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, + dev, i % 2, + max6690_sensor_sysctl, "IK", sysctl_desc); } /* Dump sensor location & ID. */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358721 - head/sys/dev/iicbus
Author: andreast Date: Fri Mar 6 21:24:09 2020 New Revision: 358721 URL: https://svnweb.freebsd.org/changeset/base/358721 Log: Drop 'All rights reserved' Replace hardcoded sizes by nitems and sizeof Modified: head/sys/dev/iicbus/ds1631.c Modified: head/sys/dev/iicbus/ds1631.c == --- head/sys/dev/iicbus/ds1631.cFri Mar 6 21:21:01 2020 (r358720) +++ head/sys/dev/iicbus/ds1631.cFri Mar 6 21:24:09 2020 (r358721) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2012 Andreas Tobler - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -135,7 +134,7 @@ ds1631_write(device_t dev, uint32_t addr, uint8_t reg, for (;;) { - if (iicbus_transfer(dev, msg, 1) == 0) + if (iicbus_transfer(dev, msg, nitems(msg)) == 0) return (0); if (++try > 5) { device_printf(dev, "iicbus write failed\n"); @@ -158,7 +157,7 @@ ds1631_read_1(device_t dev, uint32_t addr, uint8_t reg for (;;) { - err = iicbus_transfer(dev, msg, 2); + err = iicbus_transfer(dev, msg, nitems(msg)); if (err != 0) goto retry; @@ -186,7 +185,7 @@ ds1631_read_2(device_t dev, uint32_t addr, uint8_t reg for (;;) { - err = iicbus_transfer(dev, msg, 2); + err = iicbus_transfer(dev, msg, nitems(msg)); if (err != 0) goto retry; @@ -275,7 +274,7 @@ ds1631_init(device_t dev, uint32_t addr) */ conf = DS1631_CONTROL_10BIT; - err = ds1631_write(dev, addr, DS1631_CONTROL, , 1); + err = ds1631_write(dev, addr, DS1631_CONTROL, , sizeof(conf)); if (err < 0) { device_printf(dev, "ds1631 write config failed: %x\n", err); return (-1); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358720 - head/sys/dev/iicbus
Author: andreast Date: Fri Mar 6 21:21:01 2020 New Revision: 358720 URL: https://svnweb.freebsd.org/changeset/base/358720 Log: - Drop 'All rights reserved' - Replace hardcoded size by nitems Modified: head/sys/dev/iicbus/max6690.c Modified: head/sys/dev/iicbus/max6690.c == --- head/sys/dev/iicbus/max6690.c Fri Mar 6 21:15:25 2020 (r358719) +++ head/sys/dev/iicbus/max6690.c Fri Mar 6 21:21:01 2020 (r358720) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2010 Andreas Tobler - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -124,7 +123,7 @@ max6690_read(device_t dev, uint32_t addr, uint8_t reg, for (;;) { - err = iicbus_transfer(dev, msg, 4); + err = iicbus_transfer(dev, msg, nitems(msg)); if (err != 0) goto retry; if (busy[0] & 0x80) @@ -302,8 +301,9 @@ max6690_start(void *xdev) "Sensor Information"); /* I use i to pass the sensor id. */ SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "temp", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, dev, i % 2, - max6690_sensor_sysctl, "IK", sysctl_desc); + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, + dev, i % 2, + max6690_sensor_sysctl, "IK", sysctl_desc); } /* Dump sensor location & ID. */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358719 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: kib Date: Fri Mar 6 21:15:25 2020 New Revision: 358719 URL: https://svnweb.freebsd.org/changeset/base/358719 Log: zfs dmu_read: loosen the assertion. Since switch to the lockless grab, shared busy for ahead/behind pages allows other threads to validate and map the pages readonly. Reviewed by: avg, jeff, markj Sponsored by: The FreeBSD Foundation Differential revision:https://reviews.freebsd.org/D23986 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Fri Mar 6 20:44:22 2020(r358718) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Fri Mar 6 21:15:25 2020(r358719) @@ -1752,7 +1752,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_ break; } ASSERT(m->dirty == 0); - ASSERT(!pmap_page_is_mapped(m)); + ASSERT(!pmap_page_is_write_mapped(m)); ASSERT(db->db_size > PAGE_SIZE); bufoff = IDX_TO_OFF(m->pindex) % db->db_size; @@ -1867,7 +1867,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_ break; } ASSERT(m->dirty == 0); - ASSERT(!pmap_page_is_mapped(m)); + ASSERT(!pmap_page_is_write_mapped(m)); ASSERT(db->db_size > PAGE_SIZE); bufoff = IDX_TO_OFF(m->pindex) % db->db_size; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358718 - head/sys/powerpc/powerpc
Author: markj Date: Fri Mar 6 20:44:22 2020 New Revision: 358718 URL: https://svnweb.freebsd.org/changeset/base/358718 Log: Remove dead code from the powerpc uma_small_alloc(). 32-bit Book-E doesn't set UMA_MD_SMALL_ALLOC, and 32-bit OEA platforms have a 32-bit vm_paddr_t. Moreover, this code was wrong in that it leaked the page if the check failed. Reviewed by: jhibbits MFC after:1 week Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D23991 Modified: head/sys/powerpc/powerpc/uma_machdep.c Modified: head/sys/powerpc/powerpc/uma_machdep.c == --- head/sys/powerpc/powerpc/uma_machdep.c Fri Mar 6 19:56:12 2020 (r358717) +++ head/sys/powerpc/powerpc/uma_machdep.c Fri Mar 6 20:44:22 2020 (r358718) @@ -66,11 +66,6 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int return (NULL); pa = VM_PAGE_TO_PHYS(m); - - /* On book-e sizeof(void *) < sizeof(vm_paddr_t) */ - if ((vm_offset_t)pa != pa) - return (NULL); - #ifdef __powerpc64__ if ((wait & M_NODUMP) == 0) dump_add_page(pa); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358717 - head/sys/dev/cxgbe/tom
Author: np Date: Fri Mar 6 19:56:12 2020 New Revision: 358717 URL: https://svnweb.freebsd.org/changeset/base/358717 Log: cxgbe/t4_tom: Do not uninitialize a toepcb that has not been initialized. This fixes the following panic: --- trap 0xc, rip = 0x80c00411, rsp = 0xfe0025192840, rbp = 0xfe0025192860 --- vmem_xfree() at vmem_xfree+0xd1/frame 0xfe0025192860 tls_uninit_toep() at tls_uninit_toep+0x78/frame 0xfe0025192880 free_toepcb() at free_toepcb+0x32/frame 0xfe00251928a0 t4_connect() at t4_connect+0x3be/frame 0xfe0025192950 tcp_offload_connect() at tcp_offload_connect+0xa4/frame 0xfe0025192990 tcp_usr_connect() at tcp_usr_connect+0xec/frame 0xfe00251929f0 soconnect() at soconnect+0xae/frame 0xfe0025192a30 kern_connectat() at kern_connectat+0xe2/frame 0xfe0025192a90 sys_connect() at sys_connect+0x75/frame 0xfe0025192ad0 amd64_syscall() at amd64_syscall+0x137/frame 0xfe0025192bf0 fast_syscall_common() at fast_syscall_common+0x101/frame 0xfe0025192bf0 --- syscall (98, FreeBSD ELF64, sys_connect), rip = 0x8008e9d8a, rsp = 0x7fffc0f8, rbp = 0x7fffc130 --- Reviewed by: jhb@ MFC after:3 days Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D23989 Modified: head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_tom.c == --- head/sys/dev/cxgbe/tom/t4_tom.c Fri Mar 6 19:10:00 2020 (r358716) +++ head/sys/dev/cxgbe/tom/t4_tom.c Fri Mar 6 19:56:12 2020 (r358717) @@ -187,6 +187,8 @@ init_toepcb(struct vi_info *vi, struct toepcb *toep) if (ulp_mode(toep) == ULP_MODE_TCPDDP) ddp_init_toep(toep); + toep->flags |= TPF_INITIALIZED; + return (0); } @@ -210,9 +212,11 @@ free_toepcb(struct toepcb *toep) KASSERT(!(toep->flags & TPF_CPL_PENDING), ("%s: CPL pending", __func__)); - if (ulp_mode(toep) == ULP_MODE_TCPDDP) - ddp_uninit_toep(toep); - tls_uninit_toep(toep); + if (toep->flags & TPF_INITIALIZED) { + if (ulp_mode(toep) == ULP_MODE_TCPDDP) + ddp_uninit_toep(toep); + tls_uninit_toep(toep); + } free(toep, M_CXGBE); } Modified: head/sys/dev/cxgbe/tom/t4_tom.h == --- head/sys/dev/cxgbe/tom/t4_tom.h Fri Mar 6 19:10:00 2020 (r358716) +++ head/sys/dev/cxgbe/tom/t4_tom.h Fri Mar 6 19:56:12 2020 (r358717) @@ -73,6 +73,7 @@ enum { TPF_SYNQE_EXPANDED = (1 << 9), /* toepcb ready, tid context updated */ TPF_FORCE_CREDITS = (1 << 10), /* always send credits */ TPF_KTLS = (1 << 11), /* send TLS records from KTLS */ + TPF_INITIALIZED= (1 << 12), /* init_toepcb has been called */ }; enum { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358716 - in head/sys: kern vm
Author: markj Date: Fri Mar 6 19:10:00 2020 New Revision: 358716 URL: https://svnweb.freebsd.org/changeset/base/358716 Log: Use COUNTER_U64_DEFINE_EARLY() in places where it simplifies things. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D23978 Modified: head/sys/kern/subr_smr.c head/sys/kern/vfs_cache.c head/sys/vm/swap_pager.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_reserv.c Modified: head/sys/kern/subr_smr.c == --- head/sys/kern/subr_smr.cFri Mar 6 19:09:01 2020(r358715) +++ head/sys/kern/subr_smr.cFri Mar 6 19:10:00 2020(r358716) @@ -198,15 +198,15 @@ static uma_zone_t smr_zone; static SYSCTL_NODE(_debug, OID_AUTO, smr, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, "SMR Stats"); -static counter_u64_t advance = EARLY_COUNTER; +static COUNTER_U64_DEFINE_EARLY(advance); SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, advance, CTLFLAG_RW, , ""); -static counter_u64_t advance_wait = EARLY_COUNTER; +static COUNTER_U64_DEFINE_EARLY(advance_wait); SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, advance_wait, CTLFLAG_RW, _wait, ""); -static counter_u64_t poll = EARLY_COUNTER; +static COUNTER_U64_DEFINE_EARLY(poll); SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, poll, CTLFLAG_RW, , ""); -static counter_u64_t poll_scan = EARLY_COUNTER; +static COUNTER_U64_DEFINE_EARLY(poll_scan); SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, poll_scan, CTLFLAG_RW, _scan, ""); -static counter_u64_t poll_fail = EARLY_COUNTER; +static COUNTER_U64_DEFINE_EARLY(poll_fail); SYSCTL_COUNTER_U64(_debug_smr, OID_AUTO, poll_fail, CTLFLAG_RW, _fail, ""); /* @@ -631,15 +631,3 @@ smr_init(void) smr_zone = uma_zcreate("SMR CPU", sizeof(struct smr), NULL, NULL, NULL, NULL, (CACHE_LINE_SIZE * 2) - 1, UMA_ZONE_PCPU); } - -static void -smr_init_counters(void *unused) -{ - - advance = counter_u64_alloc(M_WAITOK); - advance_wait = counter_u64_alloc(M_WAITOK); - poll = counter_u64_alloc(M_WAITOK); - poll_scan = counter_u64_alloc(M_WAITOK); - poll_fail = counter_u64_alloc(M_WAITOK); -} -SYSINIT(smr_counters, SI_SUB_CPU, SI_ORDER_ANY, smr_init_counters, NULL); Modified: head/sys/kern/vfs_cache.c == --- head/sys/kern/vfs_cache.c Fri Mar 6 19:09:01 2020(r358715) +++ head/sys/kern/vfs_cache.c Fri Mar 6 19:10:00 2020(r358716) @@ -345,11 +345,12 @@ SYSCTL_INT(_debug_sizeof, OID_AUTO, namecache, CTLFLAG */ static SYSCTL_NODE(_vfs, OID_AUTO, cache, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "Name cache statistics"); -#define STATNODE_ULONG(name, descr)\ +#define STATNODE_ULONG(name, descr)\ SYSCTL_ULONG(_vfs_cache, OID_AUTO, name, CTLFLAG_RD, , 0, descr); -#define STATNODE_COUNTER(name, descr) \ - static counter_u64_t __read_mostly name; \ - SYSCTL_COUNTER_U64(_vfs_cache, OID_AUTO, name, CTLFLAG_RD, , descr); +#define STATNODE_COUNTER(name, descr) \ + static COUNTER_U64_DEFINE_EARLY(name); \ + SYSCTL_COUNTER_U64(_vfs_cache, OID_AUTO, name, CTLFLAG_RD, , \ + descr); STATNODE_ULONG(numneg, "Number of negative cache entries"); STATNODE_ULONG(numcache, "Number of cache entries"); STATNODE_COUNTER(numcachehv, "Number of namecache entries with vnodes held"); @@ -1936,26 +1937,6 @@ nchinit(void *dummy __unused) TAILQ_INIT(_hot.nl_list); mtx_init(_shrink_lock, "ncnegs", NULL, MTX_DEF); - - numcachehv = counter_u64_alloc(M_WAITOK); - numcalls = counter_u64_alloc(M_WAITOK); - dothits = counter_u64_alloc(M_WAITOK); - dotdothits = counter_u64_alloc(M_WAITOK); - numchecks = counter_u64_alloc(M_WAITOK); - nummiss = counter_u64_alloc(M_WAITOK); - nummisszap = counter_u64_alloc(M_WAITOK); - numposzaps = counter_u64_alloc(M_WAITOK); - numposhits = counter_u64_alloc(M_WAITOK); - numnegzaps = counter_u64_alloc(M_WAITOK); - numneghits = counter_u64_alloc(M_WAITOK); - numfullpathcalls = counter_u64_alloc(M_WAITOK); - numfullpathfail1 = counter_u64_alloc(M_WAITOK); - numfullpathfail2 = counter_u64_alloc(M_WAITOK); - numfullpathfail4 = counter_u64_alloc(M_WAITOK); - numfullpathfound = counter_u64_alloc(M_WAITOK); - zap_and_exit_bucket_relock_success = counter_u64_alloc(M_WAITOK); - numneg_evicted = counter_u64_alloc(M_WAITOK); - shrinking_skipped = counter_u64_alloc(M_WAITOK); } SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_SECOND, nchinit, NULL); Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cFri Mar 6 19:09:01 2020(r358715) +++ head/sys/vm/swap_pager.cFri Mar 6
svn commit: r358715 - in head: share/man/man9 sys/kern sys/sys
Author: markj Date: Fri Mar 6 19:09:01 2020 New Revision: 358715 URL: https://svnweb.freebsd.org/changeset/base/358715 Log: Add COUNTER_U64_SYSINIT() and COUNTER_U64_DEFINE_EARLY(). The aim is to reduce the boilerplate needed today to define and initialize global counters. Also add SI_SUB_COUNTER to the sysinit ordering. Reviewed by: kib MFC after:1 week Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D23977 Modified: head/share/man/man9/counter.9 head/sys/kern/subr_counter.c head/sys/kern/subr_pcpu.c head/sys/sys/counter.h head/sys/sys/kernel.h Modified: head/share/man/man9/counter.9 == --- head/share/man/man9/counter.9 Fri Mar 6 18:41:37 2020 (r358714) +++ head/share/man/man9/counter.9 Fri Mar 6 19:09:01 2020 (r358715) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 22, 2017 +.Dd March 6, 2020 .Dt COUNTER 9 .Os .Sh NAME @@ -53,6 +53,8 @@ .Fn counter_u64_zero "counter_u64_t c" .Ft int64_t .Fn counter_ratecheck "struct counter_rate *cr" "int64_t limit" +.Fn COUNTER_U64_SYSINIT "counter_u64_t c" +.Fn COUNTER_U64_DEFINE_EARLY "counter_u64_t c" .In sys/sysctl.h .Fn SYSCTL_COUNTER_U64 parent nbr name access ptr descr .Fn SYSCTL_ADD_COUNTER_U64 ctx parent nbr name access ptr descr @@ -142,6 +144,20 @@ If the limit was reached on previous second, but was j then .Fn counter_ratecheck returns number of events since previous reset. +.It Fn COUNTER_U64_SYSINIT c +Define a +.Xr SYSINIT 9 +initializer for the global counter +.Fa c . +.It Fn COUNTER_U64_DEFINE_EARLY c +Define and initialize a global counter +.Fa c . +It is always safe to increment +.Fa c , +though updates prior to the +.Dv SI_SUB_COUNTER +.Xr SYSINIT 9 +event are lost. .It Fn SYSCTL_COUNTER_U64 parent nbr name access ptr descr Declare a static .Xr sysctl 9 @@ -245,6 +261,7 @@ SYSCTL_COUNTER_U64_ARRAY(_debug, OID_AUTO, counter_arr .Xr malloc 9 , .Xr ratecheck 9 , .Xr sysctl 9 , +.Xr SYSINIT 9 , .Xr uma 9 .Sh HISTORY The Modified: head/sys/kern/subr_counter.c == --- head/sys/kern/subr_counter.cFri Mar 6 18:41:37 2020 (r358714) +++ head/sys/kern/subr_counter.cFri Mar 6 19:09:01 2020 (r358715) @@ -172,3 +172,21 @@ counter_ratecheck(struct counter_rate *cr, int64_t lim return (val); } + +void +counter_u64_sysinit(void *arg) +{ + counter_u64_t *cp; + + cp = arg; + *cp = counter_u64_alloc(M_WAITOK); +} + +void +counter_u64_sysuninit(void *arg) +{ + counter_u64_t *cp; + + cp = arg; + counter_u64_free(*cp); +} Modified: head/sys/kern/subr_pcpu.c == --- head/sys/kern/subr_pcpu.c Fri Mar 6 18:41:37 2020(r358714) +++ head/sys/kern/subr_pcpu.c Fri Mar 6 19:09:01 2020(r358715) @@ -148,7 +148,7 @@ pcpu_zones_startup(void) pcpu_zone_64 = uma_zcreate("64 pcpu", sizeof(uint64_t), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); } -SYSINIT(pcpu_zones, SI_SUB_VM, SI_ORDER_ANY, pcpu_zones_startup, NULL); +SYSINIT(pcpu_zones, SI_SUB_COUNTER, SI_ORDER_FIRST, pcpu_zones_startup, NULL); /* * First-fit extent based allocator for allocating space in the per-cpu Modified: head/sys/sys/counter.h == --- head/sys/sys/counter.h Fri Mar 6 18:41:37 2020(r358714) +++ head/sys/sys/counter.h Fri Mar 6 19:09:01 2020(r358715) @@ -74,5 +74,18 @@ struct counter_rate { int64_tcounter_ratecheck(struct counter_rate *, int64_t); +#defineCOUNTER_U64_SYSINIT(c) \ + SYSINIT(c##_counter_sysinit, SI_SUB_COUNTER,\ + SI_ORDER_ANY, counter_u64_sysinit, ); \ + SYSUNINIT(c##_counter_sysuninit, SI_SUB_COUNTER,\ + SI_ORDER_ANY, counter_u64_sysuninit, ) + +#defineCOUNTER_U64_DEFINE_EARLY(c) \ + counter_u64_t __read_mostly c = EARLY_COUNTER; \ + COUNTER_U64_SYSINIT(c) + +void counter_u64_sysinit(void *); +void counter_u64_sysuninit(void *); + #endif /* _KERNEL */ #endif /* ! __SYS_COUNTER_H__ */ Modified: head/sys/sys/kernel.h == --- head/sys/sys/kernel.h Fri Mar 6 18:41:37 2020(r358714) +++ head/sys/sys/kernel.h Fri Mar 6 19:09:01 2020(r358715) @@ -91,7 +91,8 @@ enum sysinit_sub_id { SI_SUB_DONE = 0x001,/* processed*/ SI_SUB_TUNABLES = 0x070,/* establish tunable values */ SI_SUB_COPYRIGHT= 0x081,/* first use of console*/ - SI_SUB_VM
svn commit: r358714 - in head/sys: conf fs/mntfs kern sys ufs/ffs ufs/ufs
Author: chs Date: Fri Mar 6 18:41:37 2020 New Revision: 358714 URL: https://svnweb.freebsd.org/changeset/base/358714 Log: Add a new "mntfs" pseudo file system which provides private device vnodes for file systems to safely access their disk devices, and adapt FFS to use it. Also add a new BO_NOBUFS flag to allow enforcing that file systems using mntfs vnodes do not accidentally use the original devfs vnode to create buffers. Reviewed by: kib, mckusick Approved by: imp (mentor) Sponsored by: Netflix Differential Revision:https://reviews.freebsd.org/D23787 Added: head/sys/fs/mntfs/ head/sys/fs/mntfs/mntfs_vnops.c (contents, props changed) Modified: head/sys/conf/files head/sys/kern/vfs_subr.c head/sys/sys/bufobj.h head/sys/sys/mount.h head/sys/ufs/ffs/ffs_alloc.c head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ufs/ufsmount.h Modified: head/sys/conf/files == --- head/sys/conf/files Fri Mar 6 17:24:51 2020(r358713) +++ head/sys/conf/files Fri Mar 6 18:41:37 2020(r358714) @@ -3479,6 +3479,7 @@ fs/fuse/fuse_main.c optional fusefs fs/fuse/fuse_node.coptional fusefs fs/fuse/fuse_vfsops.c optional fusefs fs/fuse/fuse_vnops.c optional fusefs +fs/mntfs/mntfs_vnops.c standard fs/msdosfs/msdosfs_conv.c optional msdosfs fs/msdosfs/msdosfs_denode.coptional msdosfs fs/msdosfs/msdosfs_fat.c optional msdosfs Added: head/sys/fs/mntfs/mntfs_vnops.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/fs/mntfs/mntfs_vnops.c Fri Mar 6 18:41:37 2020 (r358714) @@ -0,0 +1,95 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Netflix, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include + +/* + * The "mntfs" VCHR vnodes implemented here provide a safe way for file systems + * to access their disk devices. Using the normal devfs vnode has the problem + * that if the device disappears, the devfs vnode is vgone'd as part of + * removing it from the application-visible namespace, and some file systems + * (notably FFS with softdep) get very unhappy if their dirty buffers are + * invalidated out from under them. By using a separate, private vnode, + * file systems are able to clean up their buffer state in a controlled fashion + * when the underlying device disappears. + */ + +static int +mntfs_reclaim(struct vop_reclaim_args *ap) +{ + struct vnode *vp = ap->a_vp; + + dev_rel(vp->v_rdev); + return (0); +} + +struct vop_vector mntfs_vnodeops = { + .vop_default = _vnodeops, + + .vop_fsync =vop_stdfsync, + .vop_strategy = VOP_PANIC, + .vop_reclaim = mntfs_reclaim, +}; +VFS_VOP_VECTOR_REGISTER(mntfs_vnodeops); + +/* + * Allocate a private VCHR vnode for use by a mounted fs. + * The underlying device will be the same as for the given vnode. + * This mntfs vnode must be freed with mntfs_freevp() rather than just + * releasing the reference. + */ +struct vnode * +mntfs_allocvp(struct mount *mp, struct vnode *ovp) +{ + struct vnode *vp; + struct cdev *dev; + + ASSERT_VOP_ELOCKED(ovp, __func__); + + dev = ovp->v_rdev; + + getnewvnode("mntfs", mp, _vnodeops, ); + vp->v_type = VCHR; + vp->v_data = NULL; + dev_ref(dev); + vp->v_rdev = dev; + + return (vp); +} + +void +mntfs_freevp(struct vnode *vp) +{ + + vgone(vp); + vrele(vp); +} Modified:
svn commit: r358713 - head/contrib/elftoolchain/readelf
Author: emaste Date: Fri Mar 6 17:24:51 2020 New Revision: 358713 URL: https://svnweb.freebsd.org/changeset/base/358713 Log: readelf: print GNU Build-ID Sponsored by: The FreeBSD Foundation Modified: head/contrib/elftoolchain/readelf/readelf.c Modified: head/contrib/elftoolchain/readelf/readelf.c == --- head/contrib/elftoolchain/readelf/readelf.c Fri Mar 6 17:11:29 2020 (r358712) +++ head/contrib/elftoolchain/readelf/readelf.c Fri Mar 6 17:24:51 2020 (r358713) @@ -3742,6 +3742,12 @@ dump_notes_data(struct readelf *re, const char *name, case NT_GNU_PROPERTY_TYPE_0: dump_gnu_property_type_0(re, buf, sz); return; + case NT_GNU_BUILD_ID: + printf(" Build ID: "); + for (i = 0; i < sz; i++) + printf("%02x", (unsigned char)buf[i]); + printf("\n"); + return; } } else if (strcmp(name, "Xen") == 0) { switch (type) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358711 - in head/contrib/llvm-project/clang: include/clang/Basic lib/CodeGen lib/Sema
Author: dim Date: Fri Mar 6 17:02:14 2020 New Revision: 358711 URL: https://svnweb.freebsd.org/changeset/base/358711 Log: Merge commit f75939599 from llvm git (by Erich Keane): Reland r374450 with Richard Smith's comments and test fixed. The behavior from the original patch has changed, since we're no longer allowing LLVM to just ignore the alignment. Instead, we're just assuming the maximum possible alignment. Differential Revision: https://reviews.llvm.org/D68824 llvm-svn: 374562 This fixes 'Assertion failed: (Alignment != 0 && "Invalid Alignment"), function CreateAlignmentAssumption', when building recent versions of v8, which invoke __builtin_assume_aligned() with its alignment argument set to 4GiB or more. Clang will now report a warning, and show the maximum possible alignment instead, e.g.: huge-align.cpp:1:27: warning: requested alignment must be 536870912 bytes or smaller; maximum alignment assumed [-Wbuiltin-assume-aligned-alignment] void *f(void *g) { return __builtin_assume_aligned(g, 4294967296); } ^ ~~ Upstream PR: https://bugs.llvm.org/show_bug.cgi?id=43839 Reported by: cem MFC after:3 days Modified: head/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td head/contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp head/contrib/llvm-project/clang/lib/CodeGen/CGCall.cpp head/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp head/contrib/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp head/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp head/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.h head/contrib/llvm-project/clang/lib/Sema/SemaChecking.cpp Modified: head/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td == --- head/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td Fri Mar 6 16:52:20 2020(r358710) +++ head/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td Fri Mar 6 17:02:14 2020(r358711) @@ -2797,6 +2797,10 @@ def err_alignment_dependent_typedef_name : Error< def err_attribute_aligned_too_great : Error< "requested alignment must be %0 bytes or smaller">; +def warn_assume_aligned_too_great +: Warning<"requested alignment must be %0 bytes or smaller; maximum " + "alignment assumed">, + InGroup>; def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning< "%q0 redeclared without %1 attribute: previous %1 ignored">, InGroup; Modified: head/contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp == --- head/contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp Fri Mar 6 16:52:20 2020(r358710) +++ head/contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp Fri Mar 6 17:02:14 2020(r358711) @@ -2026,11 +2026,13 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDe Value *AlignmentValue = EmitScalarExpr(E->getArg(1)); ConstantInt *AlignmentCI = cast(AlignmentValue); -unsigned Alignment = (unsigned)AlignmentCI->getZExtValue(); +if (AlignmentCI->getValue().ugt(llvm::Value::MaximumAlignment)) + AlignmentCI = ConstantInt::get(AlignmentCI->getType(), + llvm::Value::MaximumAlignment); EmitAlignmentAssumption(PtrValue, Ptr, /*The expr loc is sufficient.*/ SourceLocation(), -Alignment, OffsetValue); +AlignmentCI, OffsetValue); return RValue::get(PtrValue); } case Builtin::BI__assume: Modified: head/contrib/llvm-project/clang/lib/CodeGen/CGCall.cpp == --- head/contrib/llvm-project/clang/lib/CodeGen/CGCall.cpp Fri Mar 6 16:52:20 2020(r358710) +++ head/contrib/llvm-project/clang/lib/CodeGen/CGCall.cpp Fri Mar 6 17:02:14 2020(r358711) @@ -4548,7 +4548,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo llvm::Value *Alignment = EmitScalarExpr(AA->getAlignment()); llvm::ConstantInt *AlignmentCI = cast(Alignment); EmitAlignmentAssumption(Ret.getScalarVal(), RetTy, Loc, AA->getLocation(), - AlignmentCI->getZExtValue(), OffsetValue); + AlignmentCI, OffsetValue); } else if (const auto *AA = TargetDecl->getAttr()) { llvm::Value *AlignmentVal = CallArgs[AA->getParamIndex().getLLVMIndex()] .getRValue(*this) Modified: head/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp == ---
svn commit: r358709 - head/sys/arm64/include
Author: andrew Date: Fri Mar 6 16:00:35 2020 New Revision: 358709 URL: https://svnweb.freebsd.org/changeset/base/358709 Log: Add more are64 special register fields Obtained from:https://github.com/FreeBSD-UPB/freebsd Modified: head/sys/arm64/include/armreg.h Modified: head/sys/arm64/include/armreg.h == --- head/sys/arm64/include/armreg.h Fri Mar 6 15:58:52 2020 (r358708) +++ head/sys/arm64/include/armreg.h Fri Mar 6 16:00:35 2020 (r358709) @@ -66,6 +66,18 @@ #defineUL(x) UINT64_C(x) +/* CNTHCTL_EL2 - Counter-timer Hypervisor Control register */ +#defineCNTHCTL_EVNTI_MASK (0xf << 4) /* Bit to trigger event stream */ +#defineCNTHCTL_EVNTDIR (1 << 3) /* Control transition trigger bit */ +#defineCNTHCTL_EVNTEN (1 << 2) /* Enable event stream */ +#defineCNTHCTL_EL1PCEN (1 << 1) /* Allow EL0/1 physical timer access */ +#defineCNTHCTL_EL1PCTEN(1 << 0) /*Allow EL0/1 physical counter access*/ + +/* CNTP_CTL_EL0 - Counter-timer Physical Timer Control register */ +#defineCNTP_CTL_ENABLE (1 << 0) +#defineCNTP_CTL_IMASK (1 << 1) +#defineCNTP_CTL_ISTATUS(1 << 2) + /* CPACR_EL1 */ #defineCPACR_FPEN_MASK (0x3 << 20) #define CPACR_FPEN_TRAP_ALL1 (0x0 << 20) /* Traps from EL0 and EL1 */ @@ -122,22 +134,53 @@ #defineDCZID_BS_SIZE(reg) (((reg) & DCZID_BS_MASK) >> DCZID_BS_SHIFT) /* ESR_ELx */ -#defineESR_ELx_ISS_MASK0x00ff +#defineESR_ELx_ISS_MASK0x01ff #define ISS_INSN_FnV (0x01 << 10) #define ISS_INSN_EA(0x01 << 9) #define ISS_INSN_S1PTW (0x01 << 7) #define ISS_INSN_IFSC_MASK (0x1f << 0) -#define ISS_DATA_ISV (0x01 << 24) -#define ISS_DATA_SAS_MASK (0x03 << 22) -#define ISS_DATA_SSE (0x01 << 21) -#define ISS_DATA_SRT_MASK (0x1f << 16) + +#define ISS_MSR_DIR_SHIFT 0 +#define ISS_MSR_DIR(0x01 << ISS_MSR_DIR_SHIFT) +#define ISS_MSR_Rt_SHIFT 5 +#define ISS_MSR_Rt_MASK(0x1f << ISS_MSR_Rt_SHIFT) +#define ISS_MSR_Rt(x) (((x) & ISS_MSR_Rt_MASK) >> ISS_MSR_Rt_SHIFT) +#define ISS_MSR_CRm_SHIFT 1 +#define ISS_MSR_CRm_MASK (0xf << ISS_MSR_CRm_SHIFT) +#define ISS_MSR_CRm(x) (((x) & ISS_MSR_CRm_MASK) >> ISS_MSR_CRm_SHIFT) +#define ISS_MSR_CRn_SHIFT 10 +#define ISS_MSR_CRn_MASK (0xf << ISS_MSR_CRn_SHIFT) +#define ISS_MSR_CRn(x) (((x) & ISS_MSR_CRn_MASK) >> ISS_MSR_CRn_SHIFT) +#define ISS_MSR_OP1_SHIFT 14 +#define ISS_MSR_OP1_MASK (0x7 << ISS_MSR_OP1_SHIFT) +#define ISS_MSR_OP1(x) (((x) & ISS_MSR_OP1_MASK) >> ISS_MSR_OP1_SHIFT) +#define ISS_MSR_OP2_SHIFT 17 +#define ISS_MSR_OP2_MASK (0x7 << ISS_MSR_OP2_SHIFT) +#define ISS_MSR_OP2(x) (((x) & ISS_MSR_OP2_MASK) >> ISS_MSR_OP2_SHIFT) +#define ISS_MSR_OP0_SHIFT 20 +#define ISS_MSR_OP0_MASK (0x3 << ISS_MSR_OP0_SHIFT) +#define ISS_MSR_OP0(x) (((x) & ISS_MSR_OP0_MASK) >> ISS_MSR_OP0_SHIFT) +#define ISS_MSR_REG_MASK \ +(ISS_MSR_OP0_MASK | ISS_MSR_OP2_MASK | ISS_MSR_OP1_MASK | \ + ISS_MSR_CRn_MASK | ISS_MSR_CRm_MASK) + + +#define ISS_DATA_ISV_SHIFT 24 +#define ISS_DATA_ISV (0x01 << ISS_DATA_ISV_SHIFT) +#define ISS_DATA_SAS_SHIFT 22 +#define ISS_DATA_SAS_MASK (0x03 << ISS_DATA_SAS_SHIFT) +#define ISS_DATA_SSE_SHIFT 21 +#define ISS_DATA_SSE (0x01 << ISS_DATA_SSE_SHIFT) +#define ISS_DATA_SRT_SHIFT 16 +#define ISS_DATA_SRT_MASK (0x1f << ISS_DATA_SRT_SHIFT) #define ISS_DATA_SF(0x01 << 15) #define ISS_DATA_AR(0x01 << 14) #define ISS_DATA_FnV (0x01 << 10) #define ISS_DATA_EA(0x01 << 9) #define ISS_DATA_CM(0x01 << 8) #define ISS_DATA_S1PTW (0x01 << 7) -#define ISS_DATA_WnR (0x01 << 6) +#define ISS_DATA_WnR_SHIFT 6 +#define ISS_DATA_WnR (0x01 << ISS_DATA_WnR_SHIFT) #define ISS_DATA_DFSC_MASK (0x3f << 0) #define ISS_DATA_DFSC_ASF_L0 (0x00 << 0) #define ISS_DATA_DFSC_ASF_L1 (0x01 << 0) @@ -170,10 +213,12 @@ #defineESR_ELx_EC_MASK (0x3f << 26) #defineESR_ELx_EXCEPTION(esr) (((esr) & ESR_ELx_EC_MASK) >> ESR_ELx_EC_SHIFT) #define EXCP_UNKNOWN 0x00/* Unkwn exception */ +#define EXCP_TRAP_WFI_WFE 0x01/* Trapped WFI or WFE */ #define
svn commit: r358708 - head/contrib/elftoolchain/readelf
Author: emaste Date: Fri Mar 6 15:58:52 2020 New Revision: 358708 URL: https://svnweb.freebsd.org/changeset/base/358708 Log: readelf: decode and print Xen ELF note strings Sponsored by: The FreeBSD Foundation Modified: head/contrib/elftoolchain/readelf/readelf.c Modified: head/contrib/elftoolchain/readelf/readelf.c == --- head/contrib/elftoolchain/readelf/readelf.c Fri Mar 6 15:57:21 2020 (r358707) +++ head/contrib/elftoolchain/readelf/readelf.c Fri Mar 6 15:58:52 2020 (r358708) @@ -3677,6 +3677,33 @@ static struct flag_desc note_feature_ctl_flags[] = { }; static void +dump_note_string(const char *description, const char *s, size_t len) +{ + size_t i; + int printable = 1; + + if (len == 0 || s[--len] != '\0') { + printable = 0; + } else { + for (i = 0; i < len; i++) { + if (!isprint(s[i])) { + printable = 0; + break; + } + } + } + + if (printable) { + printf(" %s: %s\n", description, s); + } else { + printf(" description data:"); + for (i = 0; i < len; i++) + printf(" %02x", (unsigned char)s[i]); + printf("\n"); + } +} + +static void dump_notes_data(struct readelf *re, const char *name, uint32_t type, const char *buf, size_t sz) { @@ -3714,6 +3741,30 @@ dump_notes_data(struct readelf *re, const char *name, switch (type) { case NT_GNU_PROPERTY_TYPE_0: dump_gnu_property_type_0(re, buf, sz); + return; + } + } else if (strcmp(name, "Xen") == 0) { + switch (type) { + case 5: + dump_note_string("Xen version", buf, sz); + return; + case 6: + dump_note_string("Guest OS", buf, sz); + return; + case 7: + dump_note_string("Guest version", buf, sz); + return; + case 8: + dump_note_string("Loader", buf, sz); + return; + case 9: + dump_note_string("PAE mode", buf, sz); + return; + case 10: + dump_note_string("Features", buf, sz); + return; + case 11: + dump_note_string("BSD symtab", buf, sz); return; } } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358706 - head/contrib/elftoolchain/readelf
Author: emaste Date: Fri Mar 6 15:26:15 2020 New Revision: 358706 URL: https://svnweb.freebsd.org/changeset/base/358706 Log: readelf: add XEN_ELFNOTE_PHYS32_ENTRY note See r336469 for details. Sponsored by: The FreeBSD Foundation Modified: head/contrib/elftoolchain/readelf/readelf.c Modified: head/contrib/elftoolchain/readelf/readelf.c == --- head/contrib/elftoolchain/readelf/readelf.c Fri Mar 6 14:56:47 2020 (r358705) +++ head/contrib/elftoolchain/readelf/readelf.c Fri Mar 6 15:26:15 2020 (r358706) @@ -1283,6 +1283,7 @@ note_type_xen(unsigned int nt) case 15: return "XEN_ELFNOTE_INIT_P2M"; case 16: return "XEN_ELFNOTE_MOD_START_PFN"; case 17: return "XEN_ELFNOTE_SUPPORTED_FEATURES"; + case 18: return "XEN_ELFNOTE_PHYS32_ENTRY"; default: return (note_type_unknown(nt)); } } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358703 - head/sys/arm64/include
Author: andrew Date: Fri Mar 6 14:46:50 2020 New Revision: 358703 URL: https://svnweb.freebsd.org/changeset/base/358703 Log: Update the hypervisor registers - Add more registers needed by bhyve [1] - Move EL2 registers from armreg.h to hypervisor.h - Add the register name to hypervisor.h Obtained from:https://github.com/FreeBSD-UPB/freebsd [1] Modified: head/sys/arm64/include/armreg.h head/sys/arm64/include/hypervisor.h Modified: head/sys/arm64/include/armreg.h == --- head/sys/arm64/include/armreg.h Fri Mar 6 14:43:13 2020 (r358702) +++ head/sys/arm64/include/armreg.h Fri Mar 6 14:46:50 2020 (r358703) @@ -66,13 +66,6 @@ #defineUL(x) UINT64_C(x) -/* CNTHCTL_EL2 - Counter-timer Hypervisor Control register */ -#defineCNTHCTL_EVNTI_MASK (0xf << 4) /* Bit to trigger event stream */ -#defineCNTHCTL_EVNTDIR (1 << 3) /* Control transition trigger bit */ -#defineCNTHCTL_EVNTEN (1 << 2) /* Enable event stream */ -#defineCNTHCTL_EL1PCEN (1 << 1) /* Allow EL0/1 physical timer access */ -#defineCNTHCTL_EL1PCTEN(1 << 0) /*Allow EL0/1 physical counter access*/ - /* CPACR_EL1 */ #defineCPACR_FPEN_MASK (0x3 << 20) #define CPACR_FPEN_TRAP_ALL1 (0x0 << 20) /* Traps from EL0 and EL1 */ @@ -219,10 +212,6 @@ /* ICC_SRE_EL1 */ #defineICC_SRE_EL1_SRE (1U << 0) - -/* ICC_SRE_EL2 */ -#defineICC_SRE_EL2_SRE (1U << 0) -#defineICC_SRE_EL2_EN (1U << 3) /* ID_AA64DFR0_EL1 */ #defineID_AA64DFR0_EL1 MRS_REG(3, 0, 0, 5, 0) Modified: head/sys/arm64/include/hypervisor.h == --- head/sys/arm64/include/hypervisor.h Fri Mar 6 14:43:13 2020 (r358702) +++ head/sys/arm64/include/hypervisor.h Fri Mar 6 14:46:50 2020 (r358703) @@ -34,19 +34,21 @@ * e.g. specific to EL2, or controlling the hypervisor. */ -/* - * Architecture feature trap register - */ +/* CNTHCTL_EL2 - Counter-timer Hypervisor Control register */ +#defineCNTHCTL_EVNTI_MASK (0xf << 4) /* Bit to trigger event stream */ +#defineCNTHCTL_EVNTDIR (1 << 3) /* Control transition trigger bit */ +#defineCNTHCTL_EVNTEN (1 << 2) /* Enable event stream */ +#defineCNTHCTL_EL1PCEN (1 << 1) /* Allow EL0/1 physical timer access */ +#defineCNTHCTL_EL1PCTEN(1 << 0) /*Allow EL0/1 physical counter access*/ + +/* CPTR_EL2 - Architecture feature trap register */ #defineCPTR_RES0 0x7fefc800 #defineCPTR_RES1 0x33ff #defineCPTR_TFP0x0400 #defineCPTR_TTA0x0010 #defineCPTR_TCPAC 0x8000 -/* - * Hypervisor Config Register - */ - +/* HCR_EL2 - Hypervisor Config Register */ #defineHCR_VM 0x0001 #defineHCR_SWIO0x0002 #defineHCR_PTW 0x0004 @@ -58,6 +60,9 @@ #defineHCR_VSE 0x0100 #defineHCR_FB 0x0200 #defineHCR_BSU_MASK0x0c00 +#define HCR_BSU_IS 0x0400 +#define HCR_BSU_OS 0x0800 +#define HCR_BSU_FS 0x0c00 #defineHCR_DC 0x1000 #defineHCR_TWI 0x2000 #defineHCR_TWE 0x4000 @@ -69,7 +74,7 @@ #defineHCR_TIDCP 0x0010 #defineHCR_TACR0x0020 #defineHCR_TSW 0x0040 -#defineHCR_TPC 0x0080 +#defineHCR_TPCP0x0080 #defineHCR_TPU 0x0100 #defineHCR_TTLB0x0200 #defineHCR_TVM 0x0400 @@ -92,5 +97,89 @@ #defineHCR_NV1 0x0800 #defineHCR_AT 0x1000 -#endif +/* HPFAR_EL2 - Hypervisor IPA Fault Address Register */ +#defineHPFAR_EL2_FIPA_SHIFT4 +#defineHPFAR_EL2_FIPA_MASK 0xf0 +/* ICC_SRE_EL2 */ +#defineICC_SRE_EL2_SRE (1U << 0) +#defineICC_SRE_EL2_EN (1U << 3) + +/* SCTLR_EL2 - System Control Register */ +#defineSCTLR_EL2_RES1 0x30c50830 +#defineSCTLR_EL2_M_SHIFT 0 +#defineSCTLR_EL2_M (0x1 << SCTLR_EL2_M_SHIFT) +#defineSCTLR_EL2_A_SHIFT 1 +#defineSCTLR_EL2_A (0x1 << SCTLR_EL2_A_SHIFT) +#defineSCTLR_EL2_C_SHIFT 2 +#defineSCTLR_EL2_C (0x1 << SCTLR_EL2_C_SHIFT) +#defineSCTLR_EL2_SA_SHIFT 3 +#defineSCTLR_EL2_SA
svn commit: r358698 - head/sys/dev/ixl
Author: luporl Date: Fri Mar 6 12:37:04 2020 New Revision: 358698 URL: https://svnweb.freebsd.org/changeset/base/358698 Log: ixl: Add missing conversions from/to LE16 This fixes some errors on PPC64, during attach and when trying to assign an IP to an interface. With this change, basic operation of X710 NICs is now possible. This also fixes builds with IXL_DEBUG enabled Reviewed by: erj Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision:https://reviews.freebsd.org/D23975 Modified: head/sys/dev/ixl/if_ixl.c head/sys/dev/ixl/ixl_pf_main.c Modified: head/sys/dev/ixl/if_ixl.c == --- head/sys/dev/ixl/if_ixl.c Fri Mar 6 12:02:42 2020(r358697) +++ head/sys/dev/ixl/if_ixl.c Fri Mar 6 12:37:04 2020(r358698) @@ -398,11 +398,11 @@ ixl_if_attach_pre(if_ctx_t ctx) enum i40e_status_code status; int error = 0; - INIT_DBG_DEV(dev, "begin"); - dev = iflib_get_dev(ctx); pf = iflib_get_softc(ctx); + INIT_DBG_DEV(dev, "begin"); + vsi = >vsi; vsi->back = pf; pf->dev = dev; @@ -588,10 +588,11 @@ ixl_if_attach_post(if_ctx_t ctx) int error = 0; enum i40e_status_code status; - INIT_DBG_DEV(dev, "begin"); - dev = iflib_get_dev(ctx); pf = iflib_get_softc(ctx); + + INIT_DBG_DEV(dev, "begin"); + vsi = >vsi; vsi->ifp = iflib_get_ifp(ctx); hw = >hw; Modified: head/sys/dev/ixl/ixl_pf_main.c == --- head/sys/dev/ixl/ixl_pf_main.c Fri Mar 6 12:02:42 2020 (r358697) +++ head/sys/dev/ixl/ixl_pf_main.c Fri Mar 6 12:37:04 2020 (r358698) @@ -1123,20 +1123,22 @@ ixl_switch_config(struct ixl_pf *pf) if (pf->dbg_mask & IXL_DBG_SWITCH_INFO) { device_printf(dev, "Switch config: header reported: %d in structure, %d total\n", - sw_config->header.num_reported, sw_config->header.num_total); - for (int i = 0; i < sw_config->header.num_reported; i++) { + LE16_TO_CPU(sw_config->header.num_reported), + LE16_TO_CPU(sw_config->header.num_total)); + for (int i = 0; + i < LE16_TO_CPU(sw_config->header.num_reported); i++) { device_printf(dev, "-> %d: type=%d seid=%d uplink=%d downlink=%d\n", i, sw_config->element[i].element_type, - sw_config->element[i].seid, - sw_config->element[i].uplink_seid, - sw_config->element[i].downlink_seid); + LE16_TO_CPU(sw_config->element[i].seid), + LE16_TO_CPU(sw_config->element[i].uplink_seid), + LE16_TO_CPU(sw_config->element[i].downlink_seid)); } } /* Simplified due to a single VSI */ - vsi->uplink_seid = sw_config->element[0].uplink_seid; - vsi->downlink_seid = sw_config->element[0].downlink_seid; - vsi->seid = sw_config->element[0].seid; + vsi->uplink_seid = LE16_TO_CPU(sw_config->element[0].uplink_seid); + vsi->downlink_seid = LE16_TO_CPU(sw_config->element[0].downlink_seid); + vsi->seid = LE16_TO_CPU(sw_config->element[0].seid); return (ret); } @@ -2058,12 +2060,14 @@ ixl_add_hw_filters(struct ixl_vsi *vsi, int flags, int bcopy(f->macaddr, b->mac_addr, ETHER_ADDR_LEN); if (f->vlan == IXL_VLAN_ANY) { b->vlan_tag = 0; - b->flags = I40E_AQC_MACVLAN_ADD_IGNORE_VLAN; + b->flags = CPU_TO_LE16( + I40E_AQC_MACVLAN_ADD_IGNORE_VLAN); } else { - b->vlan_tag = f->vlan; + b->vlan_tag = CPU_TO_LE16(f->vlan); b->flags = 0; } - b->flags |= I40E_AQC_MACVLAN_ADD_PERFECT_MATCH; + b->flags |= CPU_TO_LE16( + I40E_AQC_MACVLAN_ADD_PERFECT_MATCH); f->flags &= ~IXL_FILTER_ADD; j++; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358695 - head/sys/sys
Author: hselasky Date: Fri Mar 6 11:26:16 2020 New Revision: 358695 URL: https://svnweb.freebsd.org/changeset/base/358695 Log: Define more subsystem orders. Intended for use with module_init_order() in the LinuxKPI. MFC after:1 week Sponsored by: Mellanox Technologies Modified: head/sys/sys/kernel.h Modified: head/sys/sys/kernel.h == --- head/sys/sys/kernel.h Fri Mar 6 09:59:07 2020(r358694) +++ head/sys/sys/kernel.h Fri Mar 6 11:26:16 2020(r358695) @@ -183,6 +183,10 @@ enum sysinit_elem_order { SI_ORDER_SECOND = 0x001,/* second*/ SI_ORDER_THIRD = 0x002,/* third*/ SI_ORDER_FOURTH = 0x003,/* fourth*/ + SI_ORDER_FIFTH = 0x004,/* fifth*/ + SI_ORDER_SIXTH = 0x005,/* sixth*/ + SI_ORDER_SEVENTH= 0x006,/* seventh*/ + SI_ORDER_EIGHTH = 0x007,/* eighth*/ SI_ORDER_MIDDLE = 0x100,/* somewhere in the middle */ SI_ORDER_ANY= 0xfff /* last*/ }; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358694 - head/sys/ofed/drivers/infiniband/ulp/ipoib
Author: hselasky Date: Fri Mar 6 09:59:07 2020 New Revision: 358694 URL: https://svnweb.freebsd.org/changeset/base/358694 Log: Fix some whitespace issues in ipoib. MFC after:1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c == --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Fri Mar 6 08:50:18 2020(r358693) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Fri Mar 6 09:59:07 2020(r358694) @@ -1760,12 +1760,12 @@ module_exit(ipoib_cleanup_module); static int ipoib_evhand(module_t mod, int event, void *arg) { - return (0); + return (0); } static moduledata_t ipoib_mod = { - .name = "ipoib", - .evhand = ipoib_evhand, + .name = "ipoib", + .evhand = ipoib_evhand, }; DECLARE_MODULE(ipoib, ipoib_mod, SI_SUB_LAST, SI_ORDER_ANY); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358693 - head/sys/dev/rt
Author: sgalabov Date: Fri Mar 6 08:50:18 2020 New Revision: 358693 URL: https://svnweb.freebsd.org/changeset/base/358693 Log: Add Gigabit Ethernet support for RT3883 and RT2880 Ralink/Mediatek SoCs Submitted by: yamori...@yahoo.co.jp Reported by: yamori...@yahoo.co.jp Reviewed by: sgalabov, ray Obtained from:yamori...@yahoo.co.jp Differential Revision:https://reviews.freebsd.org/D22618 Modified: head/sys/dev/rt/if_rt.c Modified: head/sys/dev/rt/if_rt.c == --- head/sys/dev/rt/if_rt.c Fri Mar 6 07:07:25 2020(r358692) +++ head/sys/dev/rt/if_rt.c Fri Mar 6 08:50:18 2020(r358693) @@ -101,6 +101,7 @@ __FBSDID("$FreeBSD$"); #define RT_CHIPID_RT2880 0x2880 #define RT_CHIPID_RT3050 0x3050 +#define RT_CHIPID_RT3883 0x3883 #define RT_CHIPID_RT5350 0x5350 #define RT_CHIPID_MT7620 0x7620 #define RT_CHIPID_MT7621 0x7621 @@ -111,7 +112,7 @@ static const struct ofw_compat_data rt_compat_data[] = { "ralink,rt2880-eth", RT_CHIPID_RT2880 }, { "ralink,rt3050-eth", RT_CHIPID_RT3050 }, { "ralink,rt3352-eth", RT_CHIPID_RT3050 }, - { "ralink,rt3883-eth", RT_CHIPID_RT3050 }, + { "ralink,rt3883-eth", RT_CHIPID_RT3883 }, { "ralink,rt5350-eth", RT_CHIPID_RT5350 }, { "ralink,mt7620a-eth", RT_CHIPID_MT7620 }, { "mediatek,mt7620-eth",RT_CHIPID_MT7620 }, @@ -355,10 +356,18 @@ rt_attach(device_t dev) struct rt_softc *sc; struct ifnet *ifp; int error, i; +#ifdef FDT + phandle_t node; + char fdtval[32]; +#endif sc = device_get_softc(dev); sc->dev = dev; +#ifdef FDT + node = ofw_bus_get_node(sc->dev); +#endif + mtx_init(>lock, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE); @@ -480,8 +489,16 @@ rt_attach(device_t dev) GDM_DST_PORT_CPU << GDM_OFRC_P_SHIFT /* fwd Other to CPU */ )); - if (sc->rt_chipid == RT_CHIPID_RT2880) - RT_WRITE(sc, MDIO_CFG, MDIO_2880_100T_INIT); +#ifdef FDT + if (sc->rt_chipid == RT_CHIPID_RT2880 || + sc->rt_chipid == RT_CHIPID_RT3883) { + if (OF_getprop(node, "port-mode", fdtval, sizeof(fdtval)) > 0 && + strcmp(fdtval, "gigasw") == 0) + RT_WRITE(sc, MDIO_CFG, MDIO_2880_GIGA_INIT); + else + RT_WRITE(sc, MDIO_CFG, MDIO_2880_100T_INIT); + } +#endif /* allocate Tx and Rx rings */ for (i = 0; i < RT_SOFTC_TX_RING_COUNT; i++) { @@ -2912,7 +2929,7 @@ rtmdio_probe(device_t dev) if (!ofw_bus_is_compatible(dev, "ralink,rt2880-mdio")) return (ENXIO); - device_set_desc(dev, "FV built-in ethernet interface, MDIO controller"); + device_set_desc(dev, "RT built-in ethernet interface, MDIO controller"); return(0); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"