diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-11-04 15:49:06 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-11-04 15:49:06 +0000 |
| commit | 2a22df74e9fceaffd62ee437de08383d6cf8cfe0 (patch) | |
| tree | d4887f0719a9a8b98c787012703fa65e21554dc8 /sys/dev | |
| parent | 689486003b2d4637b61b61d5a30bf98fb11ddc16 (diff) | |
| parent | 6d080f8660b370f83eb10a840b6d14b6dd84a1de (diff) | |
Notes
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/acpica/acpi_battery.c | 5 | ||||
| -rw-r--r-- | sys/dev/ahci/ahci.c | 50 | ||||
| -rw-r--r-- | sys/dev/ahci/ahci.h | 2 | ||||
| -rw-r--r-- | sys/dev/ahci/ahci_pci.c | 1 | ||||
| -rw-r--r-- | sys/dev/atkbdc/atkbd.c | 2 | ||||
| -rw-r--r-- | sys/dev/cxgbe/crypto/t4_crypto.c | 116 | ||||
| -rw-r--r-- | sys/dev/cxgbe/iw_cxgbe/cm.c | 47 | ||||
| -rw-r--r-- | sys/dev/cxgbe/iw_cxgbe/qp.c | 16 | ||||
| -rw-r--r-- | sys/dev/cxgbe/t4_main.c | 40 | ||||
| -rw-r--r-- | sys/dev/cxgbe/t4_sge.c | 83 | ||||
| -rw-r--r-- | sys/dev/evdev/cdev.c | 13 | ||||
| -rw-r--r-- | sys/dev/evdev/evdev.c | 44 | ||||
| -rw-r--r-- | sys/dev/evdev/evdev_private.h | 12 | ||||
| -rw-r--r-- | sys/dev/filemon/filemon_wrapper.c | 6 | ||||
| -rw-r--r-- | sys/dev/hwpmc/hwpmc_amd.c | 151 | ||||
| -rw-r--r-- | sys/dev/hwpmc/hwpmc_amd.h | 48 | ||||
| -rw-r--r-- | sys/dev/hwpmc/hwpmc_logging.c | 16 | ||||
| -rw-r--r-- | sys/dev/hwpmc/hwpmc_mod.c | 54 | ||||
| -rw-r--r-- | sys/dev/ixl/iavf_vc.c | 6 | ||||
| -rw-r--r-- | sys/dev/ixl/if_iavf.c | 4 | ||||
| -rw-r--r-- | sys/dev/kbdmux/kbdmux.c | 2 | ||||
| -rw-r--r-- | sys/dev/random/random_harvestq.c | 25 | ||||
| -rw-r--r-- | sys/dev/sound/pci/hda/hdac.c | 2 | ||||
| -rw-r--r-- | sys/dev/usb/controller/ehci_pci.c | 3 | ||||
| -rw-r--r-- | sys/dev/usb/input/ukbd.c | 2 |
25 files changed, 614 insertions, 136 deletions
diff --git a/sys/dev/acpica/acpi_battery.c b/sys/dev/acpica/acpi_battery.c index 3d7d94ab1c2b..a9ed4796c767 100644 --- a/sys/dev/acpica/acpi_battery.c +++ b/sys/dev/acpica/acpi_battery.c @@ -487,6 +487,11 @@ acpi_battery_init(void) "remaining time in minutes"); SYSCTL_ADD_PROC(&acpi_battery_sysctl_ctx, SYSCTL_CHILDREN(acpi_battery_sysctl_tree), + OID_AUTO, "rate", CTLTYPE_INT | CTLFLAG_RD, + &acpi_battery_battinfo.rate, 0, acpi_battery_sysctl, "I", + "present rate in mW"); + SYSCTL_ADD_PROC(&acpi_battery_sysctl_ctx, + SYSCTL_CHILDREN(acpi_battery_sysctl_tree), OID_AUTO, "state", CTLTYPE_INT | CTLFLAG_RD, &acpi_battery_battinfo.state, 0, acpi_battery_sysctl, "I", "current status flags"); diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c index a12d3c1ab392..c6f0293863db 100644 --- a/sys/dev/ahci/ahci.c +++ b/sys/dev/ahci/ahci.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include <sys/malloc.h> #include <sys/lock.h> #include <sys/mutex.h> +#include <sys/sysctl.h> #include <machine/stdarg.h> #include <machine/resource.h> #include <machine/bus.h> @@ -80,6 +81,8 @@ static void ahci_stop(struct ahci_channel *ch); static void ahci_clo(struct ahci_channel *ch); static void ahci_start_fr(struct ahci_channel *ch); static void ahci_stop_fr(struct ahci_channel *ch); +static int ahci_phy_check_events(struct ahci_channel *ch, u_int32_t serr); +static uint32_t ahci_ch_detval(struct ahci_channel *ch, uint32_t val); static int ahci_sata_connect(struct ahci_channel *ch); static int ahci_sata_phy_reset(struct ahci_channel *ch); @@ -100,6 +103,13 @@ static MALLOC_DEFINE(M_AHCI, "AHCI driver", "AHCI driver data buffers"); #define RECOVERY_REQUEST_SENSE 2 #define recovery_slot spriv_field1 +static uint32_t +ahci_ch_detval(struct ahci_channel *ch, uint32_t val) +{ + + return ch->disablephy ? ATA_SC_DET_DISABLE : val; +} + int ahci_ctlr_setup(device_t dev) { @@ -665,11 +675,38 @@ ahci_ch_probe(device_t dev) } static int +ahci_ch_disablephy_proc(SYSCTL_HANDLER_ARGS) +{ + struct ahci_channel *ch; + int error, value; + + ch = arg1; + value = ch->disablephy; + error = sysctl_handle_int(oidp, &value, 0, req); + if (error != 0 || req->newptr == NULL || (value != 0 && value != 1)) + return (error); + + mtx_lock(&ch->mtx); + ch->disablephy = value; + if (value) { + ahci_ch_deinit(ch->dev); + } else { + ahci_ch_init(ch->dev); + ahci_phy_check_events(ch, ATA_SE_PHY_CHANGED | ATA_SE_EXCHANGED); + } + mtx_unlock(&ch->mtx); + + return (0); +} + +static int ahci_ch_attach(device_t dev) { struct ahci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ahci_channel *ch = device_get_softc(dev); struct cam_devq *devq; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree; int rid, error, i, sata_rev = 0; u_int32_t version; @@ -787,6 +824,11 @@ ahci_ch_attach(device_t dev) ahci_ch_pm, ch); } mtx_unlock(&ch->mtx); + ctx = device_get_sysctl_ctx(dev); + tree = device_get_sysctl_tree(dev); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "disable_phy", + CTLFLAG_RW | CTLTYPE_UINT, ch, 0, ahci_ch_disablephy_proc, "IU", + "Disable PHY"); return (0); err3: @@ -2497,7 +2539,7 @@ static int ahci_sata_phy_reset(struct ahci_channel *ch) { int sata_rev; - uint32_t val; + uint32_t val, detval; if (ch->listening) { val = ATA_INL(ch->r_mem, AHCI_P_CMD); @@ -2514,12 +2556,14 @@ ahci_sata_phy_reset(struct ahci_channel *ch) val = ATA_SC_SPD_SPEED_GEN3; else val = 0; + detval = ahci_ch_detval(ch, ATA_SC_DET_RESET); ATA_OUTL(ch->r_mem, AHCI_P_SCTL, - ATA_SC_DET_RESET | val | + detval | val | ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER); DELAY(1000); + detval = ahci_ch_detval(ch, ATA_SC_DET_IDLE); ATA_OUTL(ch->r_mem, AHCI_P_SCTL, - ATA_SC_DET_IDLE | val | ((ch->pm_level > 0) ? 0 : + detval | val | ((ch->pm_level > 0) ? 0 : (ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER))); if (!ahci_sata_connect(ch)) { if (ch->caps & AHCI_CAP_SSS) { diff --git a/sys/dev/ahci/ahci.h b/sys/dev/ahci/ahci.h index 7cd8da838a3f..fc53d346f17f 100644 --- a/sys/dev/ahci/ahci.h +++ b/sys/dev/ahci/ahci.h @@ -461,6 +461,8 @@ struct ahci_channel { struct mtx_padalign mtx; /* state lock */ STAILQ_HEAD(, ccb_hdr) doneq; /* queue of completed CCBs */ int batch; /* doneq is in use */ + + int disablephy; /* keep PHY disabled */ }; struct ahci_enclosure { diff --git a/sys/dev/ahci/ahci_pci.c b/sys/dev/ahci/ahci_pci.c index 2bc2a243837b..135848baa7b6 100644 --- a/sys/dev/ahci/ahci_pci.c +++ b/sys/dev/ahci/ahci_pci.c @@ -350,6 +350,7 @@ static const struct { {0x01861039, 0x00, "SiS 968", 0}, {0xa01c177d, 0x00, "ThunderX", AHCI_Q_ABAR0|AHCI_Q_1MSI}, {0x00311c36, 0x00, "Annapurna", AHCI_Q_FORCE_PI|AHCI_Q_RESTORE_CAP|AHCI_Q_NOMSIX}, + {0x1600144d, 0x00, "Samsung", AHCI_Q_NOMSI}, {0x00000000, 0x00, NULL, 0} }; diff --git a/sys/dev/atkbdc/atkbd.c b/sys/dev/atkbdc/atkbd.c index 57772468a9b1..981828e3eb52 100644 --- a/sys/dev/atkbdc/atkbd.c +++ b/sys/dev/atkbdc/atkbd.c @@ -484,7 +484,7 @@ atkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags) evdev_support_led(evdev, LED_CAPSL); evdev_support_led(evdev, LED_SCROLLL); - if (evdev_register(evdev)) + if (evdev_register_mtx(evdev, &Giant)) evdev_free(evdev); else state->ks_evdev = evdev; diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c index 1b0c46a6ac1b..028430d0663e 100644 --- a/sys/dev/cxgbe/crypto/t4_crypto.c +++ b/sys/dev/cxgbe/crypto/t4_crypto.c @@ -61,6 +61,8 @@ __FBSDID("$FreeBSD$"); * | key context header | * +-------------------------------+ * | AES key | ----- For requests with AES + * +-------------------------------+ + * | Hash state | ----- For hash-only requests * +-------------------------------+ - * | IPAD (16-byte aligned) | \ * +-------------------------------+ +---- For requests with HMAC @@ -72,7 +74,7 @@ __FBSDID("$FreeBSD$"); * +-------------------------------+ +---- Destination buffer for * | PHYS_DSGL entries | / non-hash-only requests * +-------------------------------+ - - * | 16 dummy bytes | ----- Only for hash-only requests + * | 16 dummy bytes | ----- Only for HMAC/hash-only requests * +-------------------------------+ * | IV | ----- If immediate IV * +-------------------------------+ @@ -160,7 +162,7 @@ struct ccr_session_blkcipher { struct ccr_session { bool active; int pending; - enum { HMAC, BLKCIPHER, AUTHENC, GCM } mode; + enum { HASH, HMAC, BLKCIPHER, AUTHENC, GCM } mode; union { struct ccr_session_hmac hmac; struct ccr_session_gmac gmac; @@ -200,6 +202,7 @@ struct ccr_softc { /* Statistics. */ uint64_t stats_blkcipher_encrypt; uint64_t stats_blkcipher_decrypt; + uint64_t stats_hash; uint64_t stats_hmac; uint64_t stats_authenc_encrypt; uint64_t stats_authenc_decrypt; @@ -420,7 +423,7 @@ ccr_populate_wreq(struct ccr_softc *sc, struct chcr_wr *crwr, u_int kctx_len, } static int -ccr_hmac(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) +ccr_hash(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) { struct chcr_wr *crwr; struct wrqe *wr; @@ -428,8 +431,8 @@ ccr_hmac(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) struct cryptodesc *crd; char *dst; u_int hash_size_in_response, kctx_flits, kctx_len, transhdr_len, wr_len; - u_int imm_len, iopad_size; - int error, sgl_nsegs, sgl_len; + u_int hmac_ctrl, imm_len, iopad_size; + int error, sgl_nsegs, sgl_len, use_opad; crd = crp->crp_desc; @@ -439,6 +442,14 @@ ccr_hmac(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) axf = s->hmac.auth_hash; + if (s->mode == HMAC) { + use_opad = 1; + hmac_ctrl = CHCR_SCMD_HMAC_CTRL_NO_TRUNC; + } else { + use_opad = 0; + hmac_ctrl = CHCR_SCMD_HMAC_CTRL_NOP; + } + /* PADs must be 128-bit aligned. */ iopad_size = roundup2(s->hmac.partial_digest_len, 16); @@ -446,7 +457,9 @@ ccr_hmac(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) * The 'key' part of the context includes the aligned IPAD and * OPAD. */ - kctx_len = iopad_size * 2; + kctx_len = iopad_size; + if (use_opad) + kctx_len += iopad_size; hash_size_in_response = axf->hashsize; transhdr_len = HASH_TRANSHDR_SIZE(kctx_len); @@ -503,19 +516,21 @@ ccr_hmac(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) V_SCMD_PROTO_VERSION(CHCR_SCMD_PROTO_VERSION_GENERIC) | V_SCMD_CIPH_MODE(CHCR_SCMD_CIPHER_MODE_NOP) | V_SCMD_AUTH_MODE(s->hmac.auth_mode) | - V_SCMD_HMAC_CTRL(CHCR_SCMD_HMAC_CTRL_NO_TRUNC)); + V_SCMD_HMAC_CTRL(hmac_ctrl)); crwr->sec_cpl.ivgen_hdrlen = htobe32( V_SCMD_LAST_FRAG(0) | V_SCMD_MORE_FRAGS(crd->crd_len == 0 ? 1 : 0) | V_SCMD_MAC_ONLY(1)); memcpy(crwr->key_ctx.key, s->hmac.ipad, s->hmac.partial_digest_len); - memcpy(crwr->key_ctx.key + iopad_size, s->hmac.opad, - s->hmac.partial_digest_len); + if (use_opad) + memcpy(crwr->key_ctx.key + iopad_size, s->hmac.opad, + s->hmac.partial_digest_len); /* XXX: F_KEY_CONTEXT_SALT_PRESENT set, but 'salt' not set. */ kctx_flits = (sizeof(struct _key_ctx) + kctx_len) / 16; crwr->key_ctx.ctx_hdr = htobe32(V_KEY_CONTEXT_CTX_LEN(kctx_flits) | - V_KEY_CONTEXT_OPAD_PRESENT(1) | V_KEY_CONTEXT_SALT_PRESENT(1) | + V_KEY_CONTEXT_OPAD_PRESENT(use_opad) | + V_KEY_CONTEXT_SALT_PRESENT(1) | V_KEY_CONTEXT_CK_SIZE(CHCR_KEYCTX_NO_KEY) | V_KEY_CONTEXT_MK_SIZE(s->hmac.mk_size) | V_KEY_CONTEXT_VALID(1)); @@ -537,7 +552,7 @@ ccr_hmac(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) } static int -ccr_hmac_done(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp, +ccr_hash_done(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp, const struct cpl_fw6_pld *cpl, int error) { struct cryptodesc *crd; @@ -1591,6 +1606,8 @@ ccr_sysctls(struct ccr_softc *sc) NULL, "statistics"); children = SYSCTL_CHILDREN(oid); + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "hash", CTLFLAG_RD, + &sc->stats_hash, 0, "Hash requests submitted"); SYSCTL_ADD_U64(ctx, children, OID_AUTO, "hmac", CTLFLAG_RD, &sc->stats_hmac, 0, "HMAC requests submitted"); SYSCTL_ADD_U64(ctx, children, OID_AUTO, "cipher_encrypt", CTLFLAG_RD, @@ -1666,6 +1683,11 @@ ccr_attach(device_t dev) sc->sg_iv_aad = sglist_build(sc->iv_aad_buf, MAX_AAD_LEN, M_WAITOK); ccr_sysctls(sc); + crypto_register(cid, CRYPTO_SHA1, 0, 0); + crypto_register(cid, CRYPTO_SHA2_224, 0, 0); + crypto_register(cid, CRYPTO_SHA2_256, 0, 0); + crypto_register(cid, CRYPTO_SHA2_384, 0, 0); + crypto_register(cid, CRYPTO_SHA2_512, 0, 0); crypto_register(cid, CRYPTO_SHA1_HMAC, 0, 0); crypto_register(cid, CRYPTO_SHA2_224_HMAC, 0, 0); crypto_register(cid, CRYPTO_SHA2_256_HMAC, 0, 0); @@ -1714,22 +1736,27 @@ ccr_copy_partial_hash(void *dst, int cri_alg, union authctx *auth_ctx) u32 = (uint32_t *)dst; u64 = (uint64_t *)dst; switch (cri_alg) { + case CRYPTO_SHA1: case CRYPTO_SHA1_HMAC: for (i = 0; i < SHA1_HASH_LEN / 4; i++) u32[i] = htobe32(auth_ctx->sha1ctx.h.b32[i]); break; + case CRYPTO_SHA2_224: case CRYPTO_SHA2_224_HMAC: for (i = 0; i < SHA2_256_HASH_LEN / 4; i++) u32[i] = htobe32(auth_ctx->sha224ctx.state[i]); break; + case CRYPTO_SHA2_256: case CRYPTO_SHA2_256_HMAC: for (i = 0; i < SHA2_256_HASH_LEN / 4; i++) u32[i] = htobe32(auth_ctx->sha256ctx.state[i]); break; + case CRYPTO_SHA2_384: case CRYPTO_SHA2_384_HMAC: for (i = 0; i < SHA2_512_HASH_LEN / 8; i++) u64[i] = htobe64(auth_ctx->sha384ctx.state[i]); break; + case CRYPTO_SHA2_512: case CRYPTO_SHA2_512_HMAC: for (i = 0; i < SHA2_512_HASH_LEN / 8; i++) u64[i] = htobe64(auth_ctx->sha512ctx.state[i]); @@ -1738,6 +1765,17 @@ ccr_copy_partial_hash(void *dst, int cri_alg, union authctx *auth_ctx) } static void +ccr_init_hash_digest(struct ccr_session *s, int cri_alg) +{ + union authctx auth_ctx; + struct auth_hash *axf; + + axf = s->hmac.auth_hash; + axf->Init(&auth_ctx); + ccr_copy_partial_hash(s->hmac.ipad, cri_alg, &auth_ctx); +} + +static void ccr_init_hmac_digest(struct ccr_session *s, int cri_alg, char *key, int klen) { @@ -1885,12 +1923,13 @@ ccr_newsession(device_t dev, crypto_session_t cses, struct cryptoini *cri) unsigned int auth_mode, cipher_mode, iv_len, mk_size; unsigned int partial_digest_len; int error; - bool gcm_hash; + bool gcm_hash, hmac; if (cri == NULL) return (EINVAL); gcm_hash = false; + hmac = false; cipher = NULL; hash = NULL; auth_hash = NULL; @@ -1901,6 +1940,11 @@ ccr_newsession(device_t dev, crypto_session_t cses, struct cryptoini *cri) partial_digest_len = 0; for (c = cri; c != NULL; c = c->cri_next) { switch (c->cri_alg) { + case CRYPTO_SHA1: + case CRYPTO_SHA2_224: + case CRYPTO_SHA2_256: + case CRYPTO_SHA2_384: + case CRYPTO_SHA2_512: case CRYPTO_SHA1_HMAC: case CRYPTO_SHA2_224_HMAC: case CRYPTO_SHA2_256_HMAC: @@ -1913,30 +1957,35 @@ ccr_newsession(device_t dev, crypto_session_t cses, struct cryptoini *cri) return (EINVAL); hash = c; switch (c->cri_alg) { + case CRYPTO_SHA1: case CRYPTO_SHA1_HMAC: auth_hash = &auth_hash_hmac_sha1; auth_mode = CHCR_SCMD_AUTH_MODE_SHA1; mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_160; partial_digest_len = SHA1_HASH_LEN; break; + case CRYPTO_SHA2_224: case CRYPTO_SHA2_224_HMAC: auth_hash = &auth_hash_hmac_sha2_224; auth_mode = CHCR_SCMD_AUTH_MODE_SHA224; mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_256; partial_digest_len = SHA2_256_HASH_LEN; break; + case CRYPTO_SHA2_256: case CRYPTO_SHA2_256_HMAC: auth_hash = &auth_hash_hmac_sha2_256; auth_mode = CHCR_SCMD_AUTH_MODE_SHA256; mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_256; partial_digest_len = SHA2_256_HASH_LEN; break; + case CRYPTO_SHA2_384: case CRYPTO_SHA2_384_HMAC: auth_hash = &auth_hash_hmac_sha2_384; auth_mode = CHCR_SCMD_AUTH_MODE_SHA512_384; mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_512; partial_digest_len = SHA2_512_HASH_LEN; break; + case CRYPTO_SHA2_512: case CRYPTO_SHA2_512_HMAC: auth_hash = &auth_hash_hmac_sha2_512; auth_mode = CHCR_SCMD_AUTH_MODE_SHA512_512; @@ -1951,6 +2000,15 @@ ccr_newsession(device_t dev, crypto_session_t cses, struct cryptoini *cri) mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_128; break; } + switch (c->cri_alg) { + case CRYPTO_SHA1_HMAC: + case CRYPTO_SHA2_224_HMAC: + case CRYPTO_SHA2_256_HMAC: + case CRYPTO_SHA2_384_HMAC: + case CRYPTO_SHA2_512_HMAC: + hmac = true; + break; + } break; case CRYPTO_AES_CBC: case CRYPTO_AES_ICM: @@ -1992,8 +2050,12 @@ ccr_newsession(device_t dev, crypto_session_t cses, struct cryptoini *cri) return (EINVAL); if (hash == NULL && cipher == NULL) return (EINVAL); - if (hash != NULL && hash->cri_key == NULL) - return (EINVAL); + if (hash != NULL) { + if ((hmac || gcm_hash) && hash->cri_key == NULL) + return (EINVAL); + if (!(hmac || gcm_hash) && hash->cri_key != NULL) + return (EINVAL); + } sc = device_get_softc(dev); mtx_lock(&sc->lock); @@ -2008,9 +2070,12 @@ ccr_newsession(device_t dev, crypto_session_t cses, struct cryptoini *cri) s->mode = GCM; else if (hash != NULL && cipher != NULL) s->mode = AUTHENC; - else if (hash != NULL) - s->mode = HMAC; - else { + else if (hash != NULL) { + if (hmac) + s->mode = HMAC; + else + s->mode = HASH; + } else { MPASS(cipher != NULL); s->mode = BLKCIPHER; } @@ -2029,8 +2094,11 @@ ccr_newsession(device_t dev, crypto_session_t cses, struct cryptoini *cri) s->hmac.hash_len = auth_hash->hashsize; else s->hmac.hash_len = hash->cri_mlen; - ccr_init_hmac_digest(s, hash->cri_alg, hash->cri_key, - hash->cri_klen); + if (hmac) + ccr_init_hmac_digest(s, hash->cri_alg, hash->cri_key, + hash->cri_klen); + else + ccr_init_hash_digest(s, hash->cri_alg); } if (cipher != NULL) { s->blkcipher.cipher_mode = cipher_mode; @@ -2085,11 +2153,16 @@ ccr_process(device_t dev, struct cryptop *crp, int hint) } switch (s->mode) { + case HASH: + error = ccr_hash(sc, s, crp); + if (error == 0) + sc->stats_hash++; + break; case HMAC: if (crd->crd_flags & CRD_F_KEY_EXPLICIT) ccr_init_hmac_digest(s, crd->crd_alg, crd->crd_key, crd->crd_klen); - error = ccr_hmac(sc, s, crp); + error = ccr_hash(sc, s, crp); if (error == 0) sc->stats_hmac++; break; @@ -2240,8 +2313,9 @@ do_cpl6_fw_pld(struct sge_iq *iq, const struct rss_header *rss, sc->stats_inflight--; switch (s->mode) { + case HASH: case HMAC: - error = ccr_hmac_done(sc, s, crp, cpl, error); + error = ccr_hash_done(sc, s, crp, cpl, error); break; case BLKCIPHER: error = ccr_blkcipher_done(sc, s, crp, cpl, error); diff --git a/sys/dev/cxgbe/iw_cxgbe/cm.c b/sys/dev/cxgbe/iw_cxgbe/cm.c index bf9cf46608f6..515a61d2417d 100644 --- a/sys/dev/cxgbe/iw_cxgbe/cm.c +++ b/sys/dev/cxgbe/iw_cxgbe/cm.c @@ -174,7 +174,6 @@ static void process_newconn(struct c4iw_listen_ep *master_lep, free(__a, M_SONAME); \ } while (0) -#ifdef KTR static char *states[] = { "idle", "listen", @@ -190,7 +189,6 @@ static char *states[] = { "dead", NULL, }; -#endif static void deref_cm_id(struct c4iw_ep_common *epc) { @@ -883,7 +881,9 @@ uninit_iwarp_socket(struct socket *so) static void process_data(struct c4iw_ep *ep) { + int ret = 0; int disconnect = 0; + struct c4iw_qp_attributes attrs = {0}; CTR5(KTR_IW_CXGBE, "%s: so %p, ep %p, state %s, sbused %d", __func__, ep->com.so, ep, states[ep->com.state], sbused(&ep->com.so->so_rcv)); @@ -898,9 +898,16 @@ process_data(struct c4iw_ep *ep) /* Refered in process_newconn() */ c4iw_put_ep(&ep->parent_ep->com); break; + case FPDU_MODE: + MPASS(ep->com.qp != NULL); + attrs.next_state = C4IW_QP_STATE_TERMINATE; + ret = c4iw_modify_qp(ep->com.dev, ep->com.qp, + C4IW_QP_ATTR_NEXT_STATE, &attrs, 1); + if (ret != -EINPROGRESS) + disconnect = 1; + break; default: - if (sbused(&ep->com.so->so_rcv)) - log(LOG_ERR, "%s: Unexpected streaming data. ep %p, " + log(LOG_ERR, "%s: Unexpected streaming data. ep %p, " "state %d, so %p, so_state 0x%x, sbused %u\n", __func__, ep, ep->com.state, ep->com.so, ep->com.so->so_state, sbused(&ep->com.so->so_rcv)); @@ -1180,7 +1187,24 @@ process_socket_event(struct c4iw_ep *ep) } /* rx data */ - process_data(ep); + if (sbused(&ep->com.so->so_rcv)) { + process_data(ep); + return; + } + + /* Socket events for 'MPA Request Received' and 'Close Complete' + * were already processed earlier in their previous events handlers. + * Hence, these socket events are skipped. + * And any other socket events must have handled above. + */ + MPASS((ep->com.state == MPA_REQ_RCVD) || (ep->com.state == MORIBUND)); + + if ((ep->com.state != MPA_REQ_RCVD) && (ep->com.state != MORIBUND)) + log(LOG_ERR, "%s: Unprocessed socket event so %p, " + "so_state 0x%x, so_err %d, sb_state 0x%x, ep %p, ep_state %s\n", + __func__, so, so->so_state, so->so_error, so->so_rcv.sb_state, + ep, states[state]); + } SYSCTL_NODE(_hw, OID_AUTO, iw_cxgbe, CTLFLAG_RD, 0, "iw_cxgbe driver parameters"); @@ -1633,6 +1657,7 @@ send_abort(struct c4iw_ep *ep) * handler(not yet implemented) of iw_cxgbe driver. */ release_ep_resources(ep); + ep->com.state = DEAD; return (0); } @@ -2601,22 +2626,24 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) goto fail; setiwsockopt(ep->com.so); + init_iwarp_socket(ep->com.so, &ep->com); err = -soconnect(ep->com.so, (struct sockaddr *)&ep->com.remote_addr, ep->com.thread); - if (!err) { - init_iwarp_socket(ep->com.so, &ep->com); - goto out; - } else + if (err) goto fail_free_so; + CTR2(KTR_IW_CXGBE, "%s:ccE, ep %p", __func__, ep); + return 0; fail_free_so: + uninit_iwarp_socket(ep->com.so); + ep->com.state = DEAD; sock_release(ep->com.so); fail: deref_cm_id(&ep->com); c4iw_put_ep(&ep->com); ep = NULL; out: - CTR2(KTR_IW_CXGBE, "%s:ccE ret:%d", __func__, err); + CTR2(KTR_IW_CXGBE, "%s:ccE Error %d", __func__, err); return err; } diff --git a/sys/dev/cxgbe/iw_cxgbe/qp.c b/sys/dev/cxgbe/iw_cxgbe/qp.c index f04a442879aa..eb00106da846 100644 --- a/sys/dev/cxgbe/iw_cxgbe/qp.c +++ b/sys/dev/cxgbe/iw_cxgbe/qp.c @@ -1475,6 +1475,22 @@ int c4iw_modify_qp(struct c4iw_dev *rhp, struct c4iw_qp *qhp, if (qhp->attr.state == attrs->next_state) goto out; + /* Return EINPROGRESS if QP is already in transition state. + * Eg: CLOSING->IDLE transition or *->ERROR transition. + * This can happen while connection is switching(due to rdma_fini) + * from iWARP/RDDP to TOE mode and any inflight RDMA RX data will + * reach TOE driver -> TCP stack -> iWARP driver. In this way + * iWARP driver keep receiving inflight RDMA RX data until socket + * is closed or aborted. And if iWARP CM is in FPDU sate, then + * it tries to put QP in TERM state and disconnects endpoint. + * But as QP is already in transition state, this event is ignored. + */ + if ((qhp->attr.state >= C4IW_QP_STATE_ERROR) && + (attrs->next_state == C4IW_QP_STATE_TERMINATE)) { + ret = -EINPROGRESS; + goto out; + } + switch (qhp->attr.state) { case C4IW_QP_STATE_IDLE: switch (attrs->next_state) { diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index d2746367251f..7593f9366f8f 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -92,6 +92,7 @@ __FBSDID("$FreeBSD$"); static int t4_probe(device_t); static int t4_attach(device_t); static int t4_detach(device_t); +static int t4_child_location_str(device_t, device_t, char *, size_t); static int t4_ready(device_t); static int t4_read_port_device(device_t, int, device_t *); static device_method_t t4_methods[] = { @@ -99,6 +100,8 @@ static device_method_t t4_methods[] = { DEVMETHOD(device_attach, t4_attach), DEVMETHOD(device_detach, t4_detach), + DEVMETHOD(bus_child_location_str, t4_child_location_str), + DEVMETHOD(t4_is_main_ready, t4_ready), DEVMETHOD(t4_read_port_device, t4_read_port_device), @@ -158,6 +161,8 @@ static device_method_t t5_methods[] = { DEVMETHOD(device_attach, t4_attach), DEVMETHOD(device_detach, t4_detach), + DEVMETHOD(bus_child_location_str, t4_child_location_str), + DEVMETHOD(t4_is_main_ready, t4_ready), DEVMETHOD(t4_read_port_device, t4_read_port_device), @@ -191,6 +196,8 @@ static device_method_t t6_methods[] = { DEVMETHOD(device_attach, t4_attach), DEVMETHOD(device_detach, t4_detach), + DEVMETHOD(bus_child_location_str, t4_child_location_str), + DEVMETHOD(t4_is_main_ready, t4_ready), DEVMETHOD(t4_read_port_device, t4_read_port_device), @@ -837,6 +844,24 @@ t4_init_devnames(struct adapter *sc) } static int +t4_ifnet_unit(struct adapter *sc, struct port_info *pi) +{ + const char *parent, *name; + long value; + int line, unit; + + line = 0; + parent = device_get_nameunit(sc->dev); + name = sc->names->ifnet_name; + while (resource_find_dev(&line, name, &unit, "at", parent) == 0) { + if (resource_long_value(name, unit, "port", &value) == 0 && + value == pi->port_id) + return (unit); + } + return (-1); +} + +static int t4_attach(device_t dev) { struct adapter *sc; @@ -1037,7 +1062,8 @@ t4_attach(device_t dev) pi->flags |= FIXED_IFMEDIA; PORT_UNLOCK(pi); - pi->dev = device_add_child(dev, sc->names->ifnet_name, -1); + pi->dev = device_add_child(dev, sc->names->ifnet_name, + t4_ifnet_unit(sc, pi)); if (pi->dev == NULL) { device_printf(dev, "failed to add device for port %d.\n", i); @@ -1253,6 +1279,16 @@ done: } static int +t4_child_location_str(device_t bus, device_t dev, char *buf, size_t buflen) +{ + struct port_info *pi; + + pi = device_get_softc(dev); + snprintf(buf, buflen, "port=%d", pi->port_id); + return (0); +} + +static int t4_ready(device_t dev) { struct adapter *sc; @@ -1543,7 +1579,7 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi) if (is_ethoffload(vi->pi->adapter) && vi->nofldtxq != 0) ifp->if_hw_tsomaxsegcount = TX_SGL_SEGS_EO_TSO; #endif - ifp->if_hw_tsomaxsegsize = 0; + ifp->if_hw_tsomaxsegsize = 65536; ether_ifattach(ifp, vi->hw_addr); #ifdef DEV_NETMAP diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index b0fe1da43d95..643eb29ffb9a 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -4725,8 +4725,11 @@ add_to_txpkts(struct mbuf *m, struct txpkts *txp, u_int available) MPASS(txp->wr_type == 0 || txp->wr_type == 1); + if (cannot_use_txpkts(m)) + return (1); + nsegs = mbuf_nsegs(m); - if (needs_tso(m) || (txp->wr_type == 1 && nsegs != 1)) + if (txp->wr_type == 1 && nsegs != 1) return (1); plen = txp->plen + m->m_pkthdr.len; @@ -5079,6 +5082,9 @@ reclaim_tx_descs(struct sge_txq *txq, u_int n) KASSERT(can_reclaim >= ndesc, ("%s: unexpected number of credits: %d, %d", __func__, can_reclaim, ndesc)); + KASSERT(ndesc != 0, + ("%s: descriptor with no credits: cidx %d", + __func__, eq->cidx)); for (m = txsd->m; m != NULL; m = nextpkt) { nextpkt = m->m_nextpkt; @@ -5610,10 +5616,6 @@ write_ethofld_wr(struct cxgbe_snd_tag *cst, struct fw_eth_tx_eo_wr *wr, m0->m_pkthdr.l4hlen > 0, ("%s: ethofld mbuf %p is missing header lengths", __func__, m0)); - if (needs_udp_csum(m0)) { - CXGBE_UNIMPLEMENTED("UDP ethofld"); - } - len16 = mbuf_eo_len16(m0); nsegs = mbuf_eo_nsegs(m0); pktlen = m0->m_pkthdr.len; @@ -5628,37 +5630,52 @@ write_ethofld_wr(struct cxgbe_snd_tag *cst, struct fw_eth_tx_eo_wr *wr, wr->equiq_to_len16 = htobe32(V_FW_WR_LEN16(len16) | V_FW_WR_FLOWID(cst->etid)); wr->r3 = 0; - wr->u.tcpseg.type = FW_ETH_TX_EO_TYPE_TCPSEG; - wr->u.tcpseg.ethlen = m0->m_pkthdr.l2hlen; - wr->u.tcpseg.iplen = htobe16(m0->m_pkthdr.l3hlen); - wr->u.tcpseg.tcplen = m0->m_pkthdr.l4hlen; - wr->u.tcpseg.tsclk_tsoff = mbuf_eo_tsclk_tsoff(m0); - wr->u.tcpseg.r4 = 0; - wr->u.tcpseg.r5 = 0; - wr->u.tcpseg.plen = htobe32(pktlen - immhdrs); + if (needs_udp_csum(m0)) { + wr->u.udpseg.type = FW_ETH_TX_EO_TYPE_UDPSEG; + wr->u.udpseg.ethlen = m0->m_pkthdr.l2hlen; + wr->u.udpseg.iplen = htobe16(m0->m_pkthdr.l3hlen); + wr->u.udpseg.udplen = m0->m_pkthdr.l4hlen; + wr->u.udpseg.rtplen = 0; + wr->u.udpseg.r4 = 0; + wr->u.udpseg.mss = htobe16(pktlen - immhdrs); + wr->u.udpseg.schedpktsize = wr->u.udpseg.mss; + wr->u.udpseg.plen = htobe32(pktlen - immhdrs); + cpl = (void *)(wr + 1); + } else { + MPASS(needs_tcp_csum(m0)); + wr->u.tcpseg.type = FW_ETH_TX_EO_TYPE_TCPSEG; + wr->u.tcpseg.ethlen = m0->m_pkthdr.l2hlen; + wr->u.tcpseg.iplen = htobe16(m0->m_pkthdr.l3hlen); + wr->u.tcpseg.tcplen = m0->m_pkthdr.l4hlen; + wr->u.tcpseg.tsclk_tsoff = mbuf_eo_tsclk_tsoff(m0); + wr->u.tcpseg.r4 = 0; + wr->u.tcpseg.r5 = 0; + wr->u.tcpseg.plen = htobe32(pktlen - immhdrs); - if (needs_tso(m0)) { - struct cpl_tx_pkt_lso_core *lso = (void *)(wr + 1); + if (needs_tso(m0)) { + struct cpl_tx_pkt_lso_core *lso = (void *)(wr + 1); - wr->u.tcpseg.mss = htobe16(m0->m_pkthdr.tso_segsz); + wr->u.tcpseg.mss = htobe16(m0->m_pkthdr.tso_segsz); - ctrl = V_LSO_OPCODE(CPL_TX_PKT_LSO) | F_LSO_FIRST_SLICE | - F_LSO_LAST_SLICE | V_LSO_IPHDR_LEN(m0->m_pkthdr.l3hlen >> 2) - | V_LSO_TCPHDR_LEN(m0->m_pkthdr.l4hlen >> 2); - if (m0->m_pkthdr.l2hlen == sizeof(struct ether_vlan_header)) - ctrl |= V_LSO_ETHHDR_LEN(1); - if (m0->m_pkthdr.l3hlen == sizeof(struct ip6_hdr)) - ctrl |= F_LSO_IPV6; - lso->lso_ctrl = htobe32(ctrl); - lso->ipid_ofst = htobe16(0); - lso->mss = htobe16(m0->m_pkthdr.tso_segsz); - lso->seqno_offset = htobe32(0); - lso->len = htobe32(pktlen); + ctrl = V_LSO_OPCODE(CPL_TX_PKT_LSO) | + F_LSO_FIRST_SLICE | F_LSO_LAST_SLICE | + V_LSO_IPHDR_LEN(m0->m_pkthdr.l3hlen >> 2) | + V_LSO_TCPHDR_LEN(m0->m_pkthdr.l4hlen >> 2); + if (m0->m_pkthdr.l2hlen == sizeof(struct ether_vlan_header)) + ctrl |= V_LSO_ETHHDR_LEN(1); + if (m0->m_pkthdr.l3hlen == sizeof(struct ip6_hdr)) + ctrl |= F_LSO_IPV6; + lso->lso_ctrl = htobe32(ctrl); + lso->ipid_ofst = htobe16(0); + lso->mss = htobe16(m0->m_pkthdr.tso_segsz); + lso->seqno_offset = htobe32(0); + lso->len = htobe32(pktlen); - cpl = (void *)(lso + 1); - } else { - wr->u.tcpseg.mss = htobe16(0xffff); - cpl = (void *)(wr + 1); + cpl = (void *)(lso + 1); + } else { + wr->u.tcpseg.mss = htobe16(0xffff); + cpl = (void *)(wr + 1); + } } /* Checksum offload must be requested for ethofld. */ @@ -5677,7 +5694,7 @@ write_ethofld_wr(struct cxgbe_snd_tag *cst, struct fw_eth_tx_eo_wr *wr, cpl->len = htobe16(pktlen); cpl->ctrl1 = htobe64(ctrl1); - /* Copy Ethernet, IP & TCP hdrs as immediate data */ + /* Copy Ethernet, IP & TCP/UDP hdrs as immediate data */ p = (uintptr_t)(cpl + 1); m_copydata(m0, 0, immhdrs, (void *)p); diff --git a/sys/dev/evdev/cdev.c b/sys/dev/evdev/cdev.c index 433444973779..615a70bafc79 100644 --- a/sys/dev/evdev/cdev.c +++ b/sys/dev/evdev/cdev.c @@ -349,6 +349,19 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, if (client->ec_revoked || evdev == NULL) return (ENODEV); + /* + * Fix evdev state corrupted with discarding of kdb events. + * EVIOCGKEY and EVIOCGLED ioctls can suffer from this. + */ + if (evdev->ev_kdb_active) { + EVDEV_LOCK(evdev); + if (evdev->ev_kdb_active) { + evdev->ev_kdb_active = false; + evdev_restore_after_kdb(evdev); + } + EVDEV_UNLOCK(evdev); + } + /* file I/O ioctl handling */ switch (cmd) { case FIOSETOWN: diff --git a/sys/dev/evdev/evdev.c b/sys/dev/evdev/evdev.c index a119cbbc3ea0..2f5eb11b96b2 100644 --- a/sys/dev/evdev/evdev.c +++ b/sys/dev/evdev/evdev.c @@ -32,9 +32,11 @@ #include <sys/param.h> #include <sys/bitstring.h> #include <sys/conf.h> +#include <sys/kdb.h> #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/module.h> +#include <sys/proc.h> #include <sys/sysctl.h> #include <sys/systm.h> @@ -763,6 +765,30 @@ evdev_send_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, } } +void +evdev_restore_after_kdb(struct evdev_dev *evdev) +{ + int code; + + EVDEV_LOCK_ASSERT(evdev); + + /* Report postponed leds */ + for (code = 0; code < LED_CNT; code++) + if (bit_test(evdev->ev_kdb_led_states, code)) + evdev_send_event(evdev, EV_LED, code, + !bit_test(evdev->ev_led_states, code)); + bit_nclear(evdev->ev_kdb_led_states, 0, LED_MAX); + + /* Release stuck keys (CTRL + ALT + ESC) */ + evdev_stop_repeat(evdev); + for (code = 0; code < KEY_CNT; code++) { + if (bit_test(evdev->ev_key_states, code)) { + evdev_send_event(evdev, EV_KEY, code, KEY_EVENT_UP); + evdev_send_event(evdev, EV_SYN, SYN_REPORT, 1); + } + } +} + int evdev_push_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, int32_t value) @@ -771,8 +797,26 @@ evdev_push_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, if (evdev_check_event(evdev, type, code, value) != 0) return (EINVAL); + /* + * Discard all but LEDs kdb events as unrelated to userspace. + * Aggregate LED updates and postpone reporting until kdb deactivation. + */ + if (kdb_active || SCHEDULER_STOPPED()) { + evdev->ev_kdb_active = true; + if (type == EV_LED) + bit_set(evdev->ev_kdb_led_states, + bit_test(evdev->ev_led_states, code) != value); + return (0); + } + EVDEV_ENTER(evdev); + /* Fix evdev state corrupted with discarding of kdb events */ + if (evdev->ev_kdb_active) { + evdev->ev_kdb_active = false; + evdev_restore_after_kdb(evdev); + } + evdev_modify_event(evdev, type, code, &value); if (type == EV_SYN && code == SYN_REPORT && bit_test(evdev->ev_flags, EVDEV_FLAG_MT_AUTOREL)) diff --git a/sys/dev/evdev/evdev_private.h b/sys/dev/evdev/evdev_private.h index 05206a9d09bd..71bdecaa57be 100644 --- a/sys/dev/evdev/evdev_private.h +++ b/sys/dev/evdev/evdev_private.h @@ -117,6 +117,10 @@ struct evdev_dev bitstr_t bit_decl(ev_sw_states, SW_CNT); bool ev_report_opened; + /* KDB state: */ + bool ev_kdb_active; + bitstr_t bit_decl(ev_kdb_led_states, LED_CNT); + /* Multitouch protocol type B state: */ struct evdev_mt * ev_mt; @@ -132,9 +136,14 @@ struct evdev_dev LIST_HEAD(, evdev_client) ev_clients; }; +#define SYSTEM_CONSOLE_LOCK &Giant + #define EVDEV_LOCK(evdev) mtx_lock((evdev)->ev_lock) #define EVDEV_UNLOCK(evdev) mtx_unlock((evdev)->ev_lock) -#define EVDEV_LOCK_ASSERT(evdev) mtx_assert((evdev)->ev_lock, MA_OWNED) +#define EVDEV_LOCK_ASSERT(evdev) do { \ + if ((evdev)->ev_lock != SYSTEM_CONSOLE_LOCK) \ + mtx_assert((evdev)->ev_lock, MA_OWNED); \ +} while (0) #define EVDEV_ENTER(evdev) do { \ if ((evdev)->ev_lock_type == EV_LOCK_INTERNAL) \ EVDEV_LOCK(evdev); \ @@ -185,6 +194,7 @@ int evdev_cdev_destroy(struct evdev_dev *); bool evdev_event_supported(struct evdev_dev *, uint16_t); void evdev_set_abs_bit(struct evdev_dev *, uint16_t); void evdev_set_absinfo(struct evdev_dev *, uint16_t, struct input_absinfo *); +void evdev_restore_after_kdb(struct evdev_dev *); /* Client interface: */ int evdev_register_client(struct evdev_dev *, struct evdev_client *); diff --git a/sys/dev/filemon/filemon_wrapper.c b/sys/dev/filemon/filemon_wrapper.c index 54150777ed9f..cd4f7b2932e7 100644 --- a/sys/dev/filemon/filemon_wrapper.c +++ b/sys/dev/filemon/filemon_wrapper.c @@ -149,7 +149,8 @@ filemon_event_process_exec(void *arg __unused, struct proc *p, } static void -_filemon_wrapper_openat(struct thread *td, char *upath, int flags, int fd) +_filemon_wrapper_openat(struct thread *td, const char *upath, int flags, + int fd) { int error; struct file *fp; @@ -262,7 +263,8 @@ copyfail: } static void -_filemon_wrapper_link(struct thread *td, char *upath1, char *upath2) +_filemon_wrapper_link(struct thread *td, const char *upath1, + const char *upath2) { struct filemon *filemon; int error; diff --git a/sys/dev/hwpmc/hwpmc_amd.c b/sys/dev/hwpmc/hwpmc_amd.c index 1b0470606368..9610ff6b01f0 100644 --- a/sys/dev/hwpmc/hwpmc_amd.c +++ b/sys/dev/hwpmc/hwpmc_amd.c @@ -105,7 +105,139 @@ static struct amd_descr amd_pmcdesc[AMD_NPMCS] = }, .pm_evsel = AMD_PMC_EVSEL_3, .pm_perfctr = AMD_PMC_PERFCTR_3 - } + }, + { + .pm_descr = + { + .pd_name = "", + .pd_class = -1, + .pd_caps = AMD_PMC_CAPS, + .pd_width = 48 + }, + .pm_evsel = AMD_PMC_EVSEL_4, + .pm_perfctr = AMD_PMC_PERFCTR_4 + }, + { + .pm_descr = + { + .pd_name = "", + .pd_class = -1, + .pd_caps = AMD_PMC_CAPS, + .pd_width = 48 + }, + .pm_evsel = AMD_PMC_EVSEL_5, + .pm_perfctr = AMD_PMC_PERFCTR_5 + }, + { + .pm_descr = + { + .pd_name = "", + .pd_class = -1, + .pd_caps = AMD_PMC_CAPS, + .pd_width = 48 + }, + .pm_evsel = AMD_PMC_EVSEL_EP_L3_0, + .pm_perfctr = AMD_PMC_PERFCTR_EP_L3_0 + }, + { + .pm_descr = + { + .pd_name = "", + .pd_class = -1, + .pd_caps = AMD_PMC_CAPS, + .pd_width = 48 + }, + .pm_evsel = AMD_PMC_EVSEL_EP_L3_1, + .pm_perfctr = AMD_PMC_PERFCTR_EP_L3_1 + }, + { + .pm_descr = + { + .pd_name = "", + .pd_class = -1, + .pd_caps = AMD_PMC_CAPS, + .pd_width = 48 + }, + .pm_evsel = AMD_PMC_EVSEL_EP_L3_2, + .pm_perfctr = AMD_PMC_PERFCTR_EP_L3_2 + }, + { + .pm_descr = + { + .pd_name = "", + .pd_class = -1, + .pd_caps = AMD_PMC_CAPS, + .pd_width = 48 + }, + .pm_evsel = AMD_PMC_EVSEL_EP_L3_3, + .pm_perfctr = AMD_PMC_PERFCTR_EP_L3_3 + }, + { + .pm_descr = + { + .pd_name = "", + .pd_class = -1, + .pd_caps = AMD_PMC_CAPS, + .pd_width = 48 + }, + .pm_evsel = AMD_PMC_EVSEL_EP_L3_4, + .pm_perfctr = AMD_PMC_PERFCTR_EP_L3_4 + }, + { + .pm_descr = + { + .pd_name = "", + .pd_class = -1, + .pd_caps = AMD_PMC_CAPS, + .pd_width = 48 + }, + .pm_evsel = AMD_PMC_EVSEL_EP_L3_5, + .pm_perfctr = AMD_PMC_PERFCTR_EP_L3_5 + }, + { + .pm_descr = + { + .pd_name = "", + .pd_class = -1, + .pd_caps = AMD_PMC_CAPS, + .pd_width = 48 + }, + .pm_evsel = AMD_PMC_EVSEL_EP_DF_0, + .pm_perfctr = AMD_PMC_PERFCTR_EP_DF_0 + }, + { + .pm_descr = + { + .pd_name = "", + .pd_class = -1, + .pd_caps = AMD_PMC_CAPS, + .pd_width = 48 + }, + .pm_evsel = AMD_PMC_EVSEL_EP_DF_1, + .pm_perfctr = AMD_PMC_PERFCTR_EP_DF_1 + }, + { + .pm_descr = + { + .pd_name = "", + .pd_class = -1, + .pd_caps = AMD_PMC_CAPS, + .pd_width = 48 + }, + .pm_evsel = AMD_PMC_EVSEL_EP_DF_2, + .pm_perfctr = AMD_PMC_PERFCTR_EP_DF_2 + }, + { + .pm_descr = + { + .pd_name = "", + .pd_class = -1, + .pd_caps = AMD_PMC_CAPS, + .pd_width = 48 + }, + .pm_evsel = AMD_PMC_EVSEL_EP_DF_3, + .pm_perfctr = AMD_PMC_PERFCTR_EP_DF_3 + } }; struct amd_event_code_map { @@ -435,7 +567,7 @@ amd_allocate_pmc(int cpu, int ri, struct pmc *pm, const struct pmc_op_pmcallocate *a) { int i; - uint32_t allowed_unitmask, caps, config, unitmask; + uint64_t allowed_unitmask, caps, config, unitmask; enum pmc_event pe; const struct pmc_descr *pd; @@ -456,6 +588,13 @@ amd_allocate_pmc(int cpu, int ri, struct pmc *pm, PMCDBG2(MDP,ALL,1,"amd-allocate ri=%d caps=0x%x", ri, caps); + if((ri >= 0 && ri < 6) && !(a->pm_md.pm_amd.pm_amd_sub_class == PMC_AMD_SUB_CLASS_CORE)) + return EINVAL; + if((ri >= 6 && ri < 12) && !(a->pm_md.pm_amd.pm_amd_sub_class == PMC_AMD_SUB_CLASS_L3_CACHE)) + return EINVAL; + if((ri >= 12 && ri < 16) && !(a->pm_md.pm_amd.pm_amd_sub_class == PMC_AMD_SUB_CLASS_DATA_FABRIC)) + return EINVAL; + if ((pd->pd_caps & caps) != caps) return EPERM; if (strlen(pmc_cpuid) != 0) { @@ -556,7 +695,7 @@ amd_release_pmc(int cpu, int ri, struct pmc *pmc) static int amd_start_pmc(int cpu, int ri) { - uint32_t config; + uint64_t config; struct pmc *pm; struct pmc_hw *phw; const struct amd_descr *pd; @@ -636,7 +775,7 @@ static int amd_intr(struct trapframe *tf) { int i, error, retval, cpu; - uint32_t config, evsel, perfctr; + uint64_t config, evsel, perfctr; struct pmc *pm; struct amd_cpu *pac; pmc_value_t v; @@ -688,8 +827,8 @@ amd_intr(struct trapframe *tf) KASSERT((config & ~AMD_PMC_ENABLE) == (pm->pm_md.pm_amd.pm_amd_evsel & ~AMD_PMC_ENABLE), - ("[amd,%d] config mismatch reg=0x%x pm=0x%x", __LINE__, - config, pm->pm_md.pm_amd.pm_amd_evsel)); + ("[amd,%d] config mismatch reg=0x%jx pm=0x%jx", __LINE__, + (uintmax_t)config, (uintmax_t)pm->pm_md.pm_amd.pm_amd_evsel)); wrmsr(evsel, config & ~AMD_PMC_ENABLE); wrmsr(perfctr, AMD_RELOAD_COUNT_TO_PERFCTR_VALUE(v)); diff --git a/sys/dev/hwpmc/hwpmc_amd.h b/sys/dev/hwpmc/hwpmc_amd.h index 2eb5a2d3ce15..9cf5260bf8b9 100644 --- a/sys/dev/hwpmc/hwpmc_amd.h +++ b/sys/dev/hwpmc/hwpmc_amd.h @@ -44,9 +44,39 @@ #define AMD_PMC_PERFCTR_1 0xC0010005 #define AMD_PMC_PERFCTR_2 0xC0010006 #define AMD_PMC_PERFCTR_3 0xC0010007 +/* CORE */ +#define AMD_PMC_EVSEL_4 0xC0010208 +#define AMD_PMC_EVSEL_5 0xC001020A +#define AMD_PMC_PERFCTR_4 0xC0010209 +#define AMD_PMC_PERFCTR_5 0xC001020B +/* L3 */ +#define AMD_PMC_EVSEL_EP_L3_0 0xC0010230 +#define AMD_PMC_EVSEL_EP_L3_1 0xC0010232 +#define AMD_PMC_EVSEL_EP_L3_2 0xC0010234 +#define AMD_PMC_EVSEL_EP_L3_3 0xC0010236 +#define AMD_PMC_EVSEL_EP_L3_4 0xC0010238 +#define AMD_PMC_EVSEL_EP_L3_5 0xC001023A + +#define AMD_PMC_PERFCTR_EP_L3_0 0xC0010231 +#define AMD_PMC_PERFCTR_EP_L3_1 0xC0010233 +#define AMD_PMC_PERFCTR_EP_L3_2 0xC0010235 +#define AMD_PMC_PERFCTR_EP_L3_3 0xC0010237 +#define AMD_PMC_PERFCTR_EP_L3_4 0xC0010239 +#define AMD_PMC_PERFCTR_EP_L3_5 0xC001023B +/* DF */ +#define AMD_PMC_EVSEL_EP_DF_0 0xC0010240 +#define AMD_PMC_EVSEL_EP_DF_1 0xC0010242 +#define AMD_PMC_EVSEL_EP_DF_2 0xC0010244 +#define AMD_PMC_EVSEL_EP_DF_3 0xC0010246 + +#define AMD_PMC_PERFCTR_EP_DF_0 0xC0010241 +#define AMD_PMC_PERFCTR_EP_DF_1 0xC0010243 +#define AMD_PMC_PERFCTR_EP_DF_2 0xC0010245 +#define AMD_PMC_PERFCTR_EP_DF_3 0xC0010247 + +#define AMD_NPMCS 16 -#define AMD_NPMCS 4 #define AMD_PMC_COUNTERMASK 0xFF000000 #define AMD_PMC_TO_COUNTER(x) (((x) << 24) & AMD_PMC_COUNTERMASK) @@ -57,6 +87,10 @@ #define AMD_PMC_EDGE (1 << 18) #define AMD_PMC_OS (1 << 17) #define AMD_PMC_USR (1 << 16) +#define AMD_PMC_L3SLICEMASK (0x000F000000000000) +#define AMD_PMC_L3COREMASK (0xFF00000000000000) +#define AMD_PMC_TO_L3SLICE(x) (((x) << 48) & AMD_PMC_L3SLICEMASK) +#define AMD_PMC_TO_L3CORE(x) (((x) << 56) & AMD_PMC_L3COREMASK) #define AMD_PMC_UNITMASK_M 0x10 #define AMD_PMC_UNITMASK_O 0x08 @@ -70,6 +104,7 @@ #define AMD_PMC_TO_UNITMASK(x) (((x) << 8) & AMD_PMC_UNITMASK) #define AMD_PMC_TO_EVENTMASK(x) (((x) & 0xFF) | (((uint64_t)(x) & 0xF00) << 24)) +#define AMD_PMC_TO_EVENTMASK_DF(x) (((x) & 0xFF) | (((uint64_t)(x) & 0x0F00) << 24)) | (((uint64_t)(x) & 0x3000) << 47) #define AMD_VALID_BITS (AMD_PMC_COUNTERMASK | AMD_PMC_INVERT | \ AMD_PMC_ENABLE | AMD_PMC_INT | AMD_PMC_PC | AMD_PMC_EDGE | \ AMD_PMC_OS | AMD_PMC_USR | AMD_PMC_UNITMASK | AMD_PMC_EVENTMASK) @@ -84,15 +119,22 @@ #define AMD_RELOAD_COUNT_TO_PERFCTR_VALUE(V) (-(V)) #define AMD_PERFCTR_VALUE_TO_RELOAD_COUNT(P) (-(P)) +enum sub_class{ + PMC_AMD_SUB_CLASS_CORE, + PMC_AMD_SUB_CLASS_L3_CACHE, + PMC_AMD_SUB_CLASS_DATA_FABRIC +}; + struct pmc_md_amd_op_pmcallocate { - uint32_t pm_amd_config; + uint64_t pm_amd_config; + uint32_t pm_amd_sub_class; }; #ifdef _KERNEL /* MD extension for 'struct pmc' */ struct pmc_md_amd_pmc { - uint32_t pm_amd_evsel; + uint64_t pm_amd_evsel; }; #endif /* _KERNEL */ diff --git a/sys/dev/hwpmc/hwpmc_logging.c b/sys/dev/hwpmc/hwpmc_logging.c index 8764ac9e922c..e76aa9b710eb 100644 --- a/sys/dev/hwpmc/hwpmc_logging.c +++ b/sys/dev/hwpmc/hwpmc_logging.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/capsicum.h> +#include <sys/domainset.h> #include <sys/file.h> #include <sys/kernel.h> #include <sys/kthread.h> @@ -1231,8 +1232,8 @@ pmclog_process_userlog(struct pmc_owner *po, struct pmc_op_writelog *wl) void pmclog_initialize() { - int domain; struct pmclog_buffer *plb; + int domain, ncpus, total; if (pmclog_buffer_size <= 0 || pmclog_buffer_size > 16*1024) { (void) printf("hwpmc: tunable logbuffersize=%d must be " @@ -1253,16 +1254,17 @@ pmclog_initialize() pmclog_buffer_size = PMC_LOG_BUFFER_SIZE; } for (domain = 0; domain < vm_ndomains; domain++) { - int ncpus = pmc_dom_hdrs[domain]->pdbh_ncpus; - int total = ncpus*pmc_nlogbuffers_pcpu; + ncpus = pmc_dom_hdrs[domain]->pdbh_ncpus; + total = ncpus * pmc_nlogbuffers_pcpu; - plb = malloc_domain(sizeof(struct pmclog_buffer)*total, M_PMC, domain, M_WAITOK|M_ZERO); + plb = malloc_domainset(sizeof(struct pmclog_buffer) * total, + M_PMC, DOMAINSET_PREF(domain), M_WAITOK | M_ZERO); pmc_dom_hdrs[domain]->pdbh_plbs = plb; - for (int i = 0; i < total; i++, plb++) { + for (; total > 0; total--, plb++) { void *buf; - buf = malloc_domain(1024 * pmclog_buffer_size, M_PMC, domain, - M_WAITOK|M_ZERO); + buf = malloc_domainset(1024 * pmclog_buffer_size, M_PMC, + DOMAINSET_PREF(domain), M_WAITOK | M_ZERO); PMCLOG_INIT_BUFFER_DESCRIPTOR(plb, buf, domain); pmc_plb_rele_unlocked(plb); } diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c index 1fad25c55702..f94f645b2e39 100644 --- a/sys/dev/hwpmc/hwpmc_mod.c +++ b/sys/dev/hwpmc/hwpmc_mod.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> +#include <sys/domainset.h> #include <sys/eventhandler.h> #include <sys/gtaskqueue.h> #include <sys/jail.h> @@ -78,14 +79,6 @@ __FBSDID("$FreeBSD$"); #include "hwpmc_soft.h" -#ifdef NUMA -#define NDOMAINS vm_ndomains -#else -#define NDOMAINS 1 -#define malloc_domain(size, type, domain, flags) malloc((size), (type), (flags)) -#define free_domain(addr, type) free(addr, type) -#endif - #define PMC_EPOCH_ENTER() struct epoch_tracker pmc_et; epoch_enter_preempt(global_epoch_preempt, &pmc_et) #define PMC_EPOCH_EXIT() epoch_exit_preempt(global_epoch_preempt, &pmc_et) @@ -5643,15 +5636,16 @@ pmc_initialize(void) continue; pc = pcpu_find(cpu); domain = pc->pc_domain; - sb = malloc_domain(sizeof(struct pmc_samplebuffer) + - pmc_nsamples * sizeof(struct pmc_sample), M_PMC, domain, - M_WAITOK|M_ZERO); + sb = malloc_domainset(sizeof(struct pmc_samplebuffer) + + pmc_nsamples * sizeof(struct pmc_sample), M_PMC, + DOMAINSET_PREF(domain), M_WAITOK | M_ZERO); KASSERT(pmc_pcpu[cpu] != NULL, ("[pmc,%d] cpu=%d Null per-cpu data", __LINE__, cpu)); - sb->ps_callchains = malloc_domain(pmc_callchaindepth * pmc_nsamples * - sizeof(uintptr_t), M_PMC, domain, M_WAITOK|M_ZERO); + sb->ps_callchains = malloc_domainset(pmc_callchaindepth * + pmc_nsamples * sizeof(uintptr_t), M_PMC, + DOMAINSET_PREF(domain), M_WAITOK | M_ZERO); for (n = 0, ps = sb->ps_samples; n < pmc_nsamples; n++, ps++) ps->ps_pc = sb->ps_callchains + @@ -5659,35 +5653,27 @@ pmc_initialize(void) pmc_pcpu[cpu]->pc_sb[PMC_HR] = sb; - sb = malloc_domain(sizeof(struct pmc_samplebuffer) + - pmc_nsamples * sizeof(struct pmc_sample), M_PMC, domain, - M_WAITOK|M_ZERO); - - KASSERT(pmc_pcpu[cpu] != NULL, - ("[pmc,%d] cpu=%d Null per-cpu data", __LINE__, cpu)); - - sb->ps_callchains = malloc_domain(pmc_callchaindepth * pmc_nsamples * - sizeof(uintptr_t), M_PMC, domain, M_WAITOK|M_ZERO); + sb = malloc_domainset(sizeof(struct pmc_samplebuffer) + + pmc_nsamples * sizeof(struct pmc_sample), M_PMC, + DOMAINSET_PREF(domain), M_WAITOK | M_ZERO); + sb->ps_callchains = malloc_domainset(pmc_callchaindepth * + pmc_nsamples * sizeof(uintptr_t), M_PMC, + DOMAINSET_PREF(domain), M_WAITOK | M_ZERO); for (n = 0, ps = sb->ps_samples; n < pmc_nsamples; n++, ps++) ps->ps_pc = sb->ps_callchains + (n * pmc_callchaindepth); pmc_pcpu[cpu]->pc_sb[PMC_SR] = sb; - sb = malloc_domain(sizeof(struct pmc_samplebuffer) + - pmc_nsamples * sizeof(struct pmc_sample), M_PMC, domain, - M_WAITOK|M_ZERO); - - KASSERT(pmc_pcpu[cpu] != NULL, - ("[pmc,%d] cpu=%d Null per-cpu data", __LINE__, cpu)); - - sb->ps_callchains = malloc_domain(pmc_callchaindepth * pmc_nsamples * - sizeof(uintptr_t), M_PMC, domain, M_WAITOK|M_ZERO); - + sb = malloc_domainset(sizeof(struct pmc_samplebuffer) + + pmc_nsamples * sizeof(struct pmc_sample), M_PMC, + DOMAINSET_PREF(domain), M_WAITOK | M_ZERO); + sb->ps_callchains = malloc_domainset(pmc_callchaindepth * + pmc_nsamples * sizeof(uintptr_t), M_PMC, + DOMAINSET_PREF(domain), M_WAITOK | M_ZERO); for (n = 0, ps = sb->ps_samples; n < pmc_nsamples; n++, ps++) - ps->ps_pc = sb->ps_callchains + - (n * pmc_callchaindepth); + ps->ps_pc = sb->ps_callchains + n * pmc_callchaindepth; pmc_pcpu[cpu]->pc_sb[PMC_UR] = sb; } diff --git a/sys/dev/ixl/iavf_vc.c b/sys/dev/ixl/iavf_vc.c index 933c4214debe..2a77f390faaa 100644 --- a/sys/dev/ixl/iavf_vc.c +++ b/sys/dev/ixl/iavf_vc.c @@ -720,10 +720,6 @@ iavf_update_stats_counters(struct iavf_sc *sc, struct i40e_eth_stats *es) uint64_t tx_discards; tx_discards = es->tx_discards; -#if 0 - for (int i = 0; i < vsi->num_queues; i++) - tx_discards += sc->vsi.queues[i].txr.br->br_drops; -#endif /* Update ifnet stats */ IXL_SET_IPACKETS(vsi, es->rx_unicast + @@ -826,7 +822,7 @@ iavf_config_rss_lut(struct iavf_sc *sc) /* * Fetch the RSS bucket id for the given indirection entry. * Cap it at the number of configured buckets (which is - * num_queues.) + * num_rx_queues.) */ que_id = rss_get_indirection_to_bucket(i); que_id = que_id % sc->vsi.num_rx_queues; diff --git a/sys/dev/ixl/if_iavf.c b/sys/dev/ixl/if_iavf.c index 3120433a7d87..0d14c88a5bf4 100644 --- a/sys/dev/ixl/if_iavf.c +++ b/sys/dev/ixl/if_iavf.c @@ -1946,10 +1946,10 @@ iavf_config_rss_reg(struct iavf_sc *sc) /* * Fetch the RSS bucket id for the given indirection entry. * Cap it at the number of configured buckets (which is - * num_queues.) + * num_rx_queues.) */ que_id = rss_get_indirection_to_bucket(i); - que_id = que_id % vsi->num_queues; + que_id = que_id % vsi->num_rx_queues; #else que_id = j; #endif diff --git a/sys/dev/kbdmux/kbdmux.c b/sys/dev/kbdmux/kbdmux.c index f17634c8879b..79f3216675e5 100644 --- a/sys/dev/kbdmux/kbdmux.c +++ b/sys/dev/kbdmux/kbdmux.c @@ -505,7 +505,7 @@ kbdmux_init(int unit, keyboard_t **kbdp, void *arg, int flags) evdev_support_led(evdev, LED_CAPSL); evdev_support_led(evdev, LED_SCROLLL); - if (evdev_register(evdev)) + if (evdev_register_mtx(evdev, &Giant)) evdev_free(evdev); else state->ks_evdev = evdev; diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c index 6699d06156ea..6c6adb0120e8 100644 --- a/sys/dev/random/random_harvestq.c +++ b/sys/dev/random/random_harvestq.c @@ -64,6 +64,17 @@ __FBSDID("$FreeBSD$"); #include <dev/random/randomdev.h> #include <dev/random/random_harvestq.h> +#if defined(RANDOM_ENABLE_ETHER) +#define _RANDOM_HARVEST_ETHER_OFF 0 +#else +#define _RANDOM_HARVEST_ETHER_OFF (1u << RANDOM_NET_ETHER) +#endif +#if defined(RANDOM_ENABLE_UMA) +#define _RANDOM_HARVEST_UMA_OFF 0 +#else +#define _RANDOM_HARVEST_UMA_OFF (1u << RANDOM_UMA) +#endif + static void random_kthread(void); static void random_sources_feed(void); @@ -254,6 +265,10 @@ read_rate_increment(u_int chunk) static int random_check_uint_harvestmask(SYSCTL_HANDLER_ARGS) { + static const u_int user_immutable_mask = + (((1 << ENTROPYSOURCE) - 1) & (-1UL << RANDOM_PURE_START)) | + _RANDOM_HARVEST_ETHER_OFF | _RANDOM_HARVEST_UMA_OFF; + int error; u_int value, orig_value; @@ -268,8 +283,8 @@ random_check_uint_harvestmask(SYSCTL_HANDLER_ARGS) /* * Disallow userspace modification of pure entropy sources. */ - hc_source_mask = (value & ~RANDOM_HARVEST_PURE_MASK) | - (orig_value & RANDOM_HARVEST_PURE_MASK); + hc_source_mask = (value & ~user_immutable_mask) | + (orig_value & user_immutable_mask); return (0); } @@ -351,13 +366,17 @@ random_print_harvestmask_symbolic(SYSCTL_HANDLER_ARGS) static void random_harvestq_init(void *unused __unused) { + static const u_int almost_everything_mask = + (((1 << (RANDOM_ENVIRONMENTAL_END + 1)) - 1) & + ~_RANDOM_HARVEST_ETHER_OFF & ~_RANDOM_HARVEST_UMA_OFF); + struct sysctl_oid *random_sys_o; random_sys_o = SYSCTL_ADD_NODE(&random_clist, SYSCTL_STATIC_CHILDREN(_kern_random), OID_AUTO, "harvest", CTLFLAG_RW, 0, "Entropy Device Parameters"); - hc_source_mask = RANDOM_HARVEST_EVERYTHING_MASK; + hc_source_mask = almost_everything_mask; SYSCTL_ADD_PROC(&random_clist, SYSCTL_CHILDREN(random_sys_o), OID_AUTO, "mask", CTLTYPE_UINT | CTLFLAG_RW, diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c index a850fc08eced..7e471ae84397 100644 --- a/sys/dev/sound/pci/hda/hdac.c +++ b/sys/dev/sound/pci/hda/hdac.c @@ -171,7 +171,7 @@ static const struct { { HDA_AMD_HUDSON2, "AMD Hudson-2", 0, 0 }, { HDA_RDC_M3010, "RDC M3010", 0, 0 }, { HDA_VIA_VT82XX, "VIA VT8251/8237A",0, 0 }, - { HDA_SIS_966, "SiS 966", 0, 0 }, + { HDA_SIS_966, "SiS 966/968", 0, 0 }, { HDA_ULI_M5461, "ULI M5461", 0, 0 }, /* Unknown */ { HDA_INTEL_ALL, "Intel", 0, 0 }, diff --git a/sys/dev/usb/controller/ehci_pci.c b/sys/dev/usb/controller/ehci_pci.c index 61efbee453c4..16db4e21ce66 100644 --- a/sys/dev/usb/controller/ehci_pci.c +++ b/sys/dev/usb/controller/ehci_pci.c @@ -210,6 +210,9 @@ ehci_pci_match(device_t self) case 0x15621131: return "Philips ISP156x USB 2.0 controller"; + case 0x70021039: + return "SiS 968 USB 2.0 controller"; + case 0x31041106: return ("VIA VT6202 USB 2.0 controller"); diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c index f35652c663dc..ea586990f082 100644 --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -1361,7 +1361,7 @@ ukbd_attach(device_t dev) if (sc->sc_flags & UKBD_FLAG_SCROLLLOCK) evdev_support_led(evdev, LED_SCROLLL); - if (evdev_register(evdev)) + if (evdev_register_mtx(evdev, &Giant)) evdev_free(evdev); else sc->sc_evdev = evdev; |
