From 20694769bd0ae33e298a6539640da702107fec15 Mon Sep 17 00:00:00 2001 From: Vladimir Kondratyev Date: Tue, 22 Jan 2019 22:39:46 +0000 Subject: [PATCH 001/142] Add quirk to enable mic and headphones redirection on HP Spectre laptops. Tested on HP AF006UR. MFC after: 2 weeks --- sys/dev/sound/pci/hda/hdaa_patches.c | 12 ++++++++++++ sys/dev/sound/pci/hda/hdac.h | 1 + 2 files changed, 13 insertions(+) diff --git a/sys/dev/sound/pci/hda/hdaa_patches.c b/sys/dev/sound/pci/hda/hdaa_patches.c index 5c7702a34580..3bfd349c952c 100644 --- a/sys/dev/sound/pci/hda/hdaa_patches.c +++ b/sys/dev/sound/pci/hda/hdaa_patches.c @@ -410,6 +410,18 @@ hdac_pin_patch(struct hdaa_widget *w) patch = "as=1 seq=15"; break; } + } else if (id == HDA_CODEC_ALC295 && subid == HP_AF006UR_SUBVENDOR) { + switch (nid) { + case 18: + patch = "as=2"; + break; + case 25: + patch = "as=2 seq=15"; + break; + case 33: + patch = "as=1 seq=15"; + break; + } } else if (id == HDA_CODEC_ALC298 && subid == DELL_XPS9560_SUBVENDOR) { switch (nid) { case 24: diff --git a/sys/dev/sound/pci/hda/hdac.h b/sys/dev/sound/pci/hda/hdac.h index 49e0f7f4b09d..86672a57ac51 100644 --- a/sys/dev/sound/pci/hda/hdac.h +++ b/sys/dev/sound/pci/hda/hdac.h @@ -188,6 +188,7 @@ #define HP_DV5000_SUBVENDOR HDA_MODEL_CONSTRUCT(HP, 0x30a5) #define HP_DC7700S_SUBVENDOR HDA_MODEL_CONSTRUCT(HP, 0x2801) #define HP_DC7700_SUBVENDOR HDA_MODEL_CONSTRUCT(HP, 0x2802) +#define HP_AF006UR_SUBVENDOR HDA_MODEL_CONSTRUCT(HP, 0x83a2) #define HP_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(HP, 0xffff) /* What is wrong with XN 2563 anyway? (Got the picture ?) */ #define HP_NX6325_SUBVENDORX 0x103c30b0 From 16ac0705815ba661a3c1a693ff3a7562e932fb47 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Wed, 23 Jan 2019 02:09:15 +0000 Subject: [PATCH 002/142] libbe(3): simplify import, allow replication streams Previously, we directly used libzfs_core's lzc_receive to import to a temporary snapshot, then cloned the snapshot and setup the properties. This failed when attempting to import replication streams with questionable error. libzfs's zfs_receive is a much better fit here, so we now use it instead with the destination dataset and let libzfs take care of the dirty details. be_import is greatly simplified as a result. Reported by: Marie Helene Kvello-Aune MFC after: 1 week --- lib/libbe/be.c | 49 +++++++------------------------------------------ 1 file changed, 7 insertions(+), 42 deletions(-) diff --git a/lib/libbe/be.c b/lib/libbe/be.c index 8640af11a5df..b07e791805b6 100644 --- a/lib/libbe/be.c +++ b/lib/libbe/be.c @@ -649,32 +649,14 @@ int be_import(libbe_handle_t *lbh, const char *bootenv, int fd) { char buf[BE_MAXPATHLEN]; - time_t rawtime; nvlist_t *props; zfs_handle_t *zfs; - int err, len; - char nbuf[24]; + recvflags_t flags = { .nomount = 1 }; + int err; - /* - * We don't need this to be incredibly random, just unique enough that - * it won't conflict with an existing dataset name. Chopping time - * down to 32 bits is probably good enough for this. - */ - snprintf(nbuf, 24, "tmp%u", - (uint32_t)(time(NULL) & 0xFFFFFFFF)); - if ((err = be_root_concat(lbh, nbuf, buf)) != 0) - /* - * Technically this is our problem, but we try to use short - * enough names that we won't run into problems except in - * worst-case BE root approaching MAXPATHLEN. - */ - return (set_error(lbh, BE_ERR_PATHLEN)); + be_root_concat(lbh, bootenv, buf); - time(&rawtime); - len = strlen(buf); - strftime(buf + len, sizeof(buf) - len, "@%F-%T", localtime(&rawtime)); - - if ((err = lzc_receive(buf, NULL, NULL, false, fd)) != 0) { + if ((err = zfs_receive(lbh->lzh, buf, NULL, &flags, fd, NULL)) != 0) { switch (err) { case EINVAL: return (set_error(lbh, BE_ERR_NOORIGIN)); @@ -687,39 +669,22 @@ be_import(libbe_handle_t *lbh, const char *bootenv, int fd) } } - if ((zfs = zfs_open(lbh->lzh, buf, ZFS_TYPE_SNAPSHOT)) == NULL) + if ((zfs = zfs_open(lbh->lzh, buf, ZFS_TYPE_FILESYSTEM)) == NULL) return (set_error(lbh, BE_ERR_ZFSOPEN)); nvlist_alloc(&props, NV_UNIQUE_NAME, KM_SLEEP); nvlist_add_string(props, "canmount", "noauto"); nvlist_add_string(props, "mountpoint", "/"); - be_root_concat(lbh, bootenv, buf); - - err = zfs_clone(zfs, buf, props); - zfs_close(zfs); + err = zfs_prop_set_list(zfs, props); nvlist_free(props); - if (err != 0) - return (set_error(lbh, BE_ERR_UNKNOWN)); - - /* - * Finally, we open up the dataset we just cloned the snapshot so that - * we may promote it. This is necessary in order to clean up the ghost - * snapshot that doesn't need to be seen after the operation is - * complete. - */ - if ((zfs = zfs_open(lbh->lzh, buf, ZFS_TYPE_DATASET)) == NULL) - return (set_error(lbh, BE_ERR_ZFSOPEN)); - - err = zfs_promote(zfs); zfs_close(zfs); if (err != 0) return (set_error(lbh, BE_ERR_UNKNOWN)); - /* Clean up the temporary snapshot */ - return (be_destroy(lbh, nbuf, 0)); + return (0); } #if SOON From d65e72a8188d69cd41f595ea570a8b1536ed3203 Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Wed, 23 Jan 2019 02:46:35 +0000 Subject: [PATCH 003/142] Fix systat's :only command parser for the multiple arguments case According to systat(1) :only option is supposed to accept multiple drives but the parser for its arguments stops after first entry. Fix the parser logic to accept multiple drives. PR: 59220 Reported by: Andy Farkas MFC after: 1 week --- usr.bin/systat/devs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/systat/devs.c b/usr.bin/systat/devs.c index c802a843eb2c..62c511d62ae6 100644 --- a/usr.bin/systat/devs.c +++ b/usr.bin/systat/devs.c @@ -288,7 +288,7 @@ dsselect(const char *args, devstat_select_mode select_mode, int maxshowdevs, ; if (*cp) *cp++ = '\0'; - if (cp - args == 0) + if (cp - tmpstr1 == 0) break; for (i = 0; i < num_devices; i++) { asprintf(&buffer, "%s%d", dev_select[i].device_name, @@ -312,7 +312,7 @@ dsselect(const char *args, devstat_select_mode select_mode, int maxshowdevs, } if (i >= num_devices) error("%s: unknown drive", args); - args = cp; + tmpstr1 = cp; } free(tmpstr); From 96329ce7e2edd7c2688428123ffdb5a42092d5b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20E=C3=9Fer?= Date: Wed, 23 Jan 2019 10:05:27 +0000 Subject: [PATCH 004/142] Silence Clang Scan warning about use of unitialized variable. While the warning is a false positive, it is possible to clarify the code by always initializing the variable. This does also allow to make the sending of the "beep" control sequence depend on the validity of its parameters. I have left the redundant assignment of 0 to the now initialized variables in place since this makes the code simpler to understand and does not add any run-time overhead (the compiler completely removes the "else if" test and the assignments). There was an embedded literal escape character in a string, which messes up diplaying the source code on a terminal that interprets ANSI sequences. The literal escape has been replaced by \e (non-standard, but supported by all relevant compilers, and already used in other source files in base). MFC after: 2 weeks --- usr.sbin/kbdcontrol/kbdcontrol.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.sbin/kbdcontrol/kbdcontrol.c b/usr.sbin/kbdcontrol/kbdcontrol.c index 73ee449755b6..3144e44d72b3 100644 --- a/usr.sbin/kbdcontrol/kbdcontrol.c +++ b/usr.sbin/kbdcontrol/kbdcontrol.c @@ -961,6 +961,8 @@ set_bell_values(char *opt) int bell, duration, pitch; bell = 0; + duration = 0; + pitch = 0; if (!strncmp(opt, "quiet.", 6)) { bell = CONS_QUIET_BELL; opt += 6; @@ -991,8 +993,8 @@ set_bell_values(char *opt) } ioctl(0, CONS_BELLTYPE, &bell); - if (!(bell & CONS_VISUAL_BELL)) - fprintf(stderr, "[=%d;%dB", pitch, duration); + if (duration > 0 && pitch > 0) + fprintf(stderr, "\e[=%d;%dB", pitch, duration); } static void From d514ab894a3a2ee10bf6b37ed18c22d5fbc6ba66 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Wed, 23 Jan 2019 12:43:46 +0000 Subject: [PATCH 005/142] net80211: fix channel list construction for non-auto operating mode. Change the way how channel list mode <-> desired mode match is done: - Match channel list mode for next non-auto desired modes: * 11b: 11g, 11ng, 11acg; * 11a: 11na, 11ac - Add pre-defined channels only when one of the next conditions met: * the desired channel mode is 'auto' or * the desired channel and selected channel list modes are exactly the same or * the previous rule (11g / 11n / 11ac promotion) applies. Before r275875 construction work properly for all except 11ng / 11na / 11acg / 11ac modes - these were broken at all (i.e., the scan list was empty); after r275875 all checks were removed, so scan table was populated by all device-compatible channels (desired mode was ignored). For example, if I will set 'ifconfig wlan0 mode 11ng' for RTL8821AU: - pre-r275875: nothing, scan will not work; - after r275875: both 11ng and 11na bands were scanned; also, since 11b channel list was used, 14th channel was scanned too. - after this change: only 11ng - 1-13 channels - are used for scanning. Tested with: * RTL8188EE, STA mode. * RTL8821AU, STA mode. MFC after: 5 days --- sys/net80211/ieee80211_scan_sta.c | 62 ++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/sys/net80211/ieee80211_scan_sta.c b/sys/net80211/ieee80211_scan_sta.c index c6a18bc8b38e..675dd83a25b7 100644 --- a/sys/net80211/ieee80211_scan_sta.c +++ b/sys/net80211/ieee80211_scan_sta.c @@ -472,6 +472,8 @@ static const u_int chanflags[IEEE80211_MODE_MAX] = { /* check legacy */ [IEEE80211_MODE_11NA] = IEEE80211_CHAN_A, [IEEE80211_MODE_11NG] = IEEE80211_CHAN_G, + [IEEE80211_MODE_VHT_5GHZ] = IEEE80211_CHAN_A, + [IEEE80211_MODE_VHT_2GHZ] = IEEE80211_CHAN_G, }; static void @@ -618,32 +620,48 @@ makescanlist(struct ieee80211_scan_state *ss, struct ieee80211vap *vap, */ for (scan = table; scan->list != NULL; scan++) { mode = scan->mode; - if (vap->iv_des_mode != IEEE80211_MODE_AUTO) { + + switch (mode) { + case IEEE80211_MODE_11B: + if (vap->iv_des_mode == IEEE80211_MODE_11B) + break; + /* - * If a desired mode was specified, scan only + * The scan table marks 2.4Ghz channels as b + * so if the desired mode is 11g / 11ng / 11acg, + * then use the 11b channel list but upgrade the mode. + * + * NB: 11b -> AUTO lets add_channels upgrade an + * 11b channel to 11g if available. + */ + if (vap->iv_des_mode == IEEE80211_MODE_AUTO || + vap->iv_des_mode == IEEE80211_MODE_11G || + vap->iv_des_mode == IEEE80211_MODE_11NG || + vap->iv_des_mode == IEEE80211_MODE_VHT_2GHZ) { + mode = vap->iv_des_mode; + break; + } + + continue; + case IEEE80211_MODE_11A: + /* Use 11a channel list for 11na / 11ac modes */ + if (vap->iv_des_mode == IEEE80211_MODE_11NA || + vap->iv_des_mode == IEEE80211_MODE_VHT_5GHZ) { + mode = vap->iv_des_mode; + break; + } + + /* FALLTHROUGH */ + default: + /* + * If a desired mode was specified, scan only * channels that satisfy that constraint. */ - if (vap->iv_des_mode != mode) { - /* - * The scan table marks 2.4Ghz channels as b - * so if the desired mode is 11g, then use - * the 11b channel list but upgrade the mode. - */ - if (vap->iv_des_mode == IEEE80211_MODE_11G) { - if (mode == IEEE80211_MODE_11G) /* Skip the G check */ - continue; - else if (mode == IEEE80211_MODE_11B) - mode = IEEE80211_MODE_11G; /* upgrade */ - } - } - } else { - /* - * This lets add_channels upgrade an 11b channel - * to 11g if available. - */ - if (mode == IEEE80211_MODE_11B) - mode = IEEE80211_MODE_AUTO; + if (vap->iv_des_mode != IEEE80211_MODE_AUTO && + vap->iv_des_mode != mode) + continue; } + #ifdef IEEE80211_F_XR /* XR does not operate on turbo channels */ if ((vap->iv_flags & IEEE80211_F_XR) && From 938ed5dad6554aa457ceecc0178b6e406496d923 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Wed, 23 Jan 2019 13:07:05 +0000 Subject: [PATCH 006/142] ifconfig: drop unused macros from ifieee80211.c MFC after: 5 days --- sbin/ifconfig/ifieee80211.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index 2e648d8feb48..ce1950e65b89 100644 --- a/sbin/ifconfig/ifieee80211.c +++ b/sbin/ifconfig/ifieee80211.c @@ -1528,9 +1528,6 @@ getmodeflags(const char *val) return flags; } -#define IEEE80211_CHAN_HTA (IEEE80211_CHAN_HT|IEEE80211_CHAN_5GHZ) -#define IEEE80211_CHAN_HTG (IEEE80211_CHAN_HT|IEEE80211_CHAN_2GHZ) - #define _APPLY(_flags, _base, _param, _v) do { \ if (_flags & IEEE80211_CHAN_HT) { \ if ((_flags & (IEEE80211_CHAN_5GHZ|IEEE80211_CHAN_2GHZ)) == 0) {\ @@ -1720,8 +1717,6 @@ DECL_CMD_FUNC(set80211maxretry, val, d) } #undef _APPLY_RATE #undef _APPLY -#undef IEEE80211_CHAN_HTA -#undef IEEE80211_CHAN_HTG static DECL_CMD_FUNC(set80211fragthreshold, val, d) From 7e2bcba46e9b01c9cbb7a1289f5a1fb98c079ec4 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Wed, 23 Jan 2019 13:17:03 +0000 Subject: [PATCH 007/142] net80211: turn channel mode check into assertion. There is may be only 11b channel (since chanflags[] table maps MODE_AUTO to the corresponding 11b channel flags). Checked with RTL8812AU, STA mode. MFC after: 5 days --- sys/net80211/ieee80211_scan_sta.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/net80211/ieee80211_scan_sta.c b/sys/net80211/ieee80211_scan_sta.c index 675dd83a25b7..1cada2927591 100644 --- a/sys/net80211/ieee80211_scan_sta.c +++ b/sys/net80211/ieee80211_scan_sta.c @@ -496,12 +496,15 @@ add_channels(struct ieee80211vap *vap, if (c == NULL || isexcluded(vap, c)) continue; if (mode == IEEE80211_MODE_AUTO) { + KASSERT(IEEE80211_IS_CHAN_B(c), + ("%s: wrong channel for 'auto' mode %u / %u\n", + __func__, c->ic_freq, c->ic_flags)); + /* * XXX special-case 11b/g channels so we select * the g channel if both are present. */ - if (IEEE80211_IS_CHAN_B(c) && - (cg = find11gchannel(ic, i, c->ic_freq)) != NULL) + if ((cg = find11gchannel(ic, i, c->ic_freq)) != NULL) c = cg; } ss->ss_chans[ss->ss_last++] = c; From 8c9874f5b1f7eb0de170c9869652180189c89f0c Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Wed, 23 Jan 2019 14:21:23 +0000 Subject: [PATCH 008/142] netmap: fix knote() argument to match the mutex state The nm_os_selwakeup function needs to call knote() to wake up kqueue(9) users. However, this function can be called from different code paths, with different lock requirements. This patch fixes the knote() call argument to match the relavant lock state. Also, comments have been updated to reflect current code. PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219846 Reported by: Aleksandr Fedorov Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D18876 --- sys/dev/netmap/netmap.c | 5 +- sys/dev/netmap/netmap_freebsd.c | 85 +++++++++++++++------------------ sys/dev/netmap/netmap_kern.h | 1 - 3 files changed, 41 insertions(+), 50 deletions(-) diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index 2d3db72f5773..8b508737e328 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -2531,7 +2531,6 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, } nifp = priv->np_nifp; - priv->np_td = td; /* for debugging purposes */ /* return the offset of the netmap_if object */ req->nr_rx_rings = na->num_rx_rings; @@ -3207,8 +3206,8 @@ nmreq_checkoptions(struct nmreq_header *hdr) * * Can be called for one or more queues. * Return true the event mask corresponding to ready events. - * If there are no ready events, do a selrecord on either individual - * selinfo or on the global one. + * If there are no ready events (and 'sr' is not NULL), do a + * selrecord on either individual selinfo or on the global one. * Device-dependent parts (locking and sync of tx/rx rings) * are done through callbacks. * diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebsd.c index 3b0cdabe570f..ef6a7427a270 100644 --- a/sys/dev/netmap/netmap_freebsd.c +++ b/sys/dev/netmap/netmap_freebsd.c @@ -85,7 +85,7 @@ void nm_os_selinfo_uninit(NM_SELINFO_T *si) { /* XXX kqueue(9) needed; these will mirror knlist_init. */ - knlist_delete(&si->si.si_note, curthread, 0 /* not locked */ ); + knlist_delete(&si->si.si_note, curthread, /*islocked=*/0); knlist_destroy(&si->si.si_note); /* now we don't need the mutex anymore */ mtx_destroy(&si->m); @@ -1294,21 +1294,21 @@ nm_os_kctx_destroy(struct nm_kctx *nmk) /******************** kqueue support ****************/ /* - * nm_os_selwakeup also needs to issue a KNOTE_UNLOCKED. - * We use a non-zero argument to distinguish the call from the one - * in kevent_scan() which instead also needs to run netmap_poll(). - * The knote uses a global mutex for the time being. We might - * try to reuse the one in the si, but it is not allocated - * permanently so it might be a bit tricky. + * In addition to calling selwakeuppri(), nm_os_selwakeup() also + * needs to call KNOTE to wake up kqueue listeners. + * We use a non-zero 'hint' argument to inform the netmap_knrw() + * function that it is being called from 'nm_os_selwakeup'; this + * is necessary because when netmap_knrw() is called by the kevent + * subsystem (i.e. kevent_scan()) we also need to call netmap_poll(). + * The knote uses a private mutex associated to the 'si' (see struct + * selinfo, struct nm_selinfo, and nm_os_selinfo_init). * - * The *kqfilter function registers one or another f_event - * depending on read or write mode. - * In the call to f_event() td_fpop is NULL so any child function - * calling devfs_get_cdevpriv() would fail - and we need it in - * netmap_poll(). As a workaround we store priv into kn->kn_hook - * and pass it as first argument to netmap_poll(), which then - * uses the failure to tell that we are called from f_event() - * and do not need the selrecord(). + * The netmap_kqfilter() function registers one or another f_event + * depending on read or write mode. A pointer to the struct + * 'netmap_priv_d' is stored into kn->kn_hook, so that it can later + * be passed to netmap_poll(). We pass NULL as a third argument to + * netmap_poll(), so that the latter only runs the txsync/rxsync + * (if necessary), and skips the nm_os_selrecord() calls. */ @@ -1316,12 +1316,13 @@ void nm_os_selwakeup(struct nm_selinfo *si) { if (netmap_verbose) - D("on knote %p", &si->si.si_note); + nm_prinf("on knote %p", &si->si.si_note); selwakeuppri(&si->si, PI_NET); - /* use a non-zero hint to tell the notification from the - * call done in kqueue_scan() which uses 0 + /* We use a non-zero hint to distinguish this notification call + * from the call done in kqueue_scan(), which uses hint=0. */ - KNOTE_UNLOCKED(&si->si.si_note, 0x100 /* notification */); + KNOTE(&si->si.si_note, /*hint=*/0x100, + mtx_owned(&si->m) ? KNF_LISTLOCKED : 0); } void @@ -1337,7 +1338,7 @@ netmap_knrdetach(struct knote *kn) struct selinfo *si = &priv->np_si[NR_RX]->si; D("remove selinfo %p", si); - knlist_remove(&si->si_note, kn, 0); + knlist_remove(&si->si_note, kn, /*islocked=*/0); } static void @@ -1347,14 +1348,15 @@ netmap_knwdetach(struct knote *kn) struct selinfo *si = &priv->np_si[NR_TX]->si; D("remove selinfo %p", si); - knlist_remove(&si->si_note, kn, 0); + knlist_remove(&si->si_note, kn, /*islocked=*/0); } /* - * callback from notifies (generated externally) and our - * calls to kevent(). The former we just return 1 (ready) - * since we do not know better. - * In the latter we call netmap_poll and return 0/1 accordingly. + * Callback triggered by netmap notifications (see netmap_notify()), + * and by the application calling kevent(). In the former case we + * just return 1 (events ready), since we are not able to do better. + * In the latter case we use netmap_poll() to see which events are + * ready. */ static int netmap_knrw(struct knote *kn, long hint, int events) @@ -1363,21 +1365,17 @@ netmap_knrw(struct knote *kn, long hint, int events) int revents; if (hint != 0) { - ND(5, "call from notify"); - return 1; /* assume we are ready */ - } - priv = kn->kn_hook; - /* the notification may come from an external thread, - * in which case we do not want to run the netmap_poll - * This should be filtered above, but check just in case. - */ - if (curthread != priv->np_td) { /* should not happen */ - RD(5, "curthread changed %p %p", curthread, priv->np_td); + /* Called from netmap_notify(), typically from a + * thread different from the one issuing kevent(). + * Assume we are ready. */ return 1; - } else { - revents = netmap_poll(priv, events, NULL); - return (events & revents) ? 1 : 0; } + + /* Called from kevent(). */ + priv = kn->kn_hook; + revents = netmap_poll(priv, events, /*thread=*/NULL); + + return (events & revents) ? 1 : 0; } static int @@ -1408,7 +1406,7 @@ static struct filterops netmap_wfiltops = { /* * This is called when a thread invokes kevent() to record * a change in the configuration of the kqueue(). - * The 'priv' should be the same as in the netmap device. + * The 'priv' is the one associated to the open netmap device. */ static int netmap_kqfilter(struct cdev *dev, struct knote *kn) @@ -1435,16 +1433,11 @@ netmap_kqfilter(struct cdev *dev, struct knote *kn) } /* the si is indicated in the priv */ si = priv->np_si[(ev == EVFILT_WRITE) ? NR_TX : NR_RX]; - // XXX lock(priv) ? kn->kn_fop = (ev == EVFILT_WRITE) ? &netmap_wfiltops : &netmap_rfiltops; kn->kn_hook = priv; - knlist_add(&si->si.si_note, kn, 0); - // XXX unlock(priv) - ND("register %p %s td %p priv %p kn %p np_nifp %p kn_fp/fpop %s", - na, na->ifp->if_xname, curthread, priv, kn, - priv->np_nifp, - kn->kn_fp == curthread->td_fpop ? "match" : "MISMATCH"); + knlist_add(&si->si.si_note, kn, /*islocked=*/0); + return 0; } diff --git a/sys/dev/netmap/netmap_kern.h b/sys/dev/netmap/netmap_kern.h index 0d49b5e019a8..e30fef343732 100644 --- a/sys/dev/netmap/netmap_kern.h +++ b/sys/dev/netmap/netmap_kern.h @@ -1946,7 +1946,6 @@ struct netmap_priv_d { * (N entries). */ struct nm_csb_ktoa *np_csb_ktoa_base; - struct thread *np_td; /* kqueue, just debugging */ #ifdef linux struct file *np_filp; /* used by sync kloop */ #endif /* linux */ From f79ba6d75befff748df583a570e368c8f3434dc7 Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Wed, 23 Jan 2019 14:51:36 +0000 Subject: [PATCH 009/142] netmap: improvements to the netmap kloop (CSB mode) Changelist: - Add the proper memory barriers in the kloop ring processing functions. - Fix memory barriers usage in the user helpers (nm_sync_kloop_appl_write, nm_sync_kloop_appl_read). - Fix nm_kr_txempty() helper to look at rhead rather than rcur. This is important since the kloop can read a value of rcur which is ahead of the value of rhead (see explanation in nm_sync_kloop_appl_write) - Remove obsolete ptnetmap_guest_write_kring_csb() and ptnet_guest_read_kring_csb(), and update if_ptnet(4) to use those. - Prepare in advance the arguments for netmap_sync_kloop_[tr]x_ring(), to make the kloop faster. - Provide kernel and user implementation for nm_ldld_barrier() and nm_ldst_barrier() MFC after: 2 weeks --- sys/dev/netmap/if_ptnet.c | 16 +++- sys/dev/netmap/netmap_kern.h | 53 +----------- sys/dev/netmap/netmap_kloop.c | 146 ++++++++++++++++++++++------------ sys/net/netmap.h | 33 ++++++-- 4 files changed, 139 insertions(+), 109 deletions(-) diff --git a/sys/dev/netmap/if_ptnet.c b/sys/dev/netmap/if_ptnet.c index c362018b95af..02f91ee3d888 100644 --- a/sys/dev/netmap/if_ptnet.c +++ b/sys/dev/netmap/if_ptnet.c @@ -1688,7 +1688,7 @@ ptnet_ring_update(struct ptnet_queue *pq, struct netmap_kring *kring, /* Mimic nm_txsync_prologue/nm_rxsync_prologue. */ kring->rcur = kring->rhead = head; - ptnetmap_guest_write_kring_csb(atok, kring->rcur, kring->rhead); + nm_sync_kloop_appl_write(atok, kring->rcur, kring->rhead); /* Kick the host if needed. */ if (NM_ACCESS_ONCE(ktoa->kern_need_kick)) { @@ -1764,7 +1764,12 @@ ptnet_drain_transmit_queue(struct ptnet_queue *pq, unsigned int budget, * the host. */ atok->appl_need_kick = 1; - /* Double-check. */ + /* Double check. We need a full barrier to + * prevent the store to atok->appl_need_kick + * to be reordered with the load from + * ktoa->hwcur and ktoa->hwtail (store-load + * barrier). */ + nm_stld_barrier(); ptnet_sync_tail(ktoa, kring); if (likely(PTNET_TX_NOSPACE(head, kring, minspace))) { @@ -2046,7 +2051,12 @@ ptnet_rx_eof(struct ptnet_queue *pq, unsigned int budget, bool may_resched) * last interrupt. */ atok->appl_need_kick = 1; - /* Double-check. */ + /* Double check for more completed RX slots. + * We need a full barrier to prevent the store + * to atok->appl_need_kick to be reordered with + * the load from ktoa->hwcur and ktoa->hwtail + * (store-load barrier). */ + nm_stld_barrier(); ptnet_sync_tail(ktoa, kring); if (likely(head == ring->tail)) { break; diff --git a/sys/dev/netmap/netmap_kern.h b/sys/dev/netmap/netmap_kern.h index e30fef343732..e9b83a23532b 100644 --- a/sys/dev/netmap/netmap_kern.h +++ b/sys/dev/netmap/netmap_kern.h @@ -1159,7 +1159,7 @@ nm_kr_rxspace(struct netmap_kring *k) static inline int nm_kr_txempty(struct netmap_kring *kring) { - return kring->rcur == kring->nr_hwtail; + return kring->rhead == kring->nr_hwtail; } /* True if no more completed slots in the rx ring, only valid after @@ -2245,61 +2245,14 @@ int ptnet_nm_krings_create(struct netmap_adapter *na); void ptnet_nm_krings_delete(struct netmap_adapter *na); void ptnet_nm_dtor(struct netmap_adapter *na); -/* Guest driver: Write kring pointers (cur, head) to the CSB. - * This routine is coupled with ptnetmap_host_read_kring_csb(). */ -static inline void -ptnetmap_guest_write_kring_csb(struct nm_csb_atok *atok, uint32_t cur, - uint32_t head) -{ - /* - * We need to write cur and head to the CSB but we cannot do it atomically. - * There is no way we can prevent the host from reading the updated value - * of one of the two and the old value of the other. However, if we make - * sure that the host never reads a value of head more recent than the - * value of cur we are safe. We can allow the host to read a value of cur - * more recent than the value of head, since in the netmap ring cur can be - * ahead of head and cur cannot wrap around head because it must be behind - * tail. Inverting the order of writes below could instead result into the - * host to think head went ahead of cur, which would cause the sync - * prologue to fail. - * - * The following memory barrier scheme is used to make this happen: - * - * Guest Host - * - * STORE(cur) LOAD(head) - * mb() <-----------> mb() - * STORE(head) LOAD(cur) - */ - atok->cur = cur; - nm_stst_barrier(); - atok->head = head; -} - -/* Guest driver: Read kring pointers (hwcur, hwtail) from the CSB. - * This routine is coupled with ptnetmap_host_write_kring_csb(). */ -static inline void -ptnetmap_guest_read_kring_csb(struct nm_csb_ktoa *ktoa, - struct netmap_kring *kring) -{ - /* - * We place a memory barrier to make sure that the update of hwtail never - * overtakes the update of hwcur. - * (see explanation in ptnetmap_host_write_kring_csb). - */ - kring->nr_hwtail = ktoa->hwtail; - nm_stst_barrier(); - kring->nr_hwcur = ktoa->hwcur; -} - -/* Helper function wrapping ptnetmap_guest_read_kring_csb(). */ +/* Helper function wrapping nm_sync_kloop_appl_read(). */ static inline void ptnet_sync_tail(struct nm_csb_ktoa *ktoa, struct netmap_kring *kring) { struct netmap_ring *ring = kring->ring; /* Update hwcur and hwtail as known by the host. */ - ptnetmap_guest_read_kring_csb(ktoa, kring); + nm_sync_kloop_appl_read(ktoa, &kring->nr_hwtail, &kring->nr_hwcur); /* nm_sync_finalize */ ring->tail = kring->rtail = kring->nr_hwtail; diff --git a/sys/dev/netmap/netmap_kloop.c b/sys/dev/netmap/netmap_kloop.c index 11ec7091467f..5a6243e16cc1 100644 --- a/sys/dev/netmap/netmap_kloop.c +++ b/sys/dev/netmap/netmap_kloop.c @@ -66,8 +66,12 @@ static inline void sync_kloop_kernel_write(struct nm_csb_ktoa __user *ptr, uint32_t hwcur, uint32_t hwtail) { + /* Issue a first store-store barrier to make sure writes to the + * netmap ring do not overcome updates on ktoa->hwcur and ktoa->hwtail. */ + nm_stst_barrier(); + /* - * The same scheme used in ptnetmap_guest_write_kring_csb() applies here. + * The same scheme used in nm_sync_kloop_appl_write() applies here. * We allow the application to read a value of hwcur more recent than the value * of hwtail, since this would anyway result in a consistent view of the * ring state (and hwcur can never wraparound hwtail, since hwcur must be @@ -75,11 +79,11 @@ sync_kloop_kernel_write(struct nm_csb_ktoa __user *ptr, uint32_t hwcur, * * The following memory barrier scheme is used to make this happen: * - * Application Kernel + * Application Kernel * - * STORE(hwcur) LOAD(hwtail) - * mb() <-------------> mb() - * STORE(hwtail) LOAD(hwcur) + * STORE(hwcur) LOAD(hwtail) + * wmb() <-------------> rmb() + * STORE(hwtail) LOAD(hwcur) */ CSB_WRITE(ptr, hwcur, hwcur); nm_stst_barrier(); @@ -96,12 +100,16 @@ sync_kloop_kernel_read(struct nm_csb_atok __user *ptr, /* * We place a memory barrier to make sure that the update of head never * overtakes the update of cur. - * (see explanation in ptnetmap_guest_write_kring_csb). + * (see explanation in sync_kloop_kernel_write). */ CSB_READ(ptr, head, shadow_ring->head); - nm_stst_barrier(); + nm_ldld_barrier(); CSB_READ(ptr, cur, shadow_ring->cur); CSB_READ(ptr, sync_flags, shadow_ring->flags); + + /* Make sure that loads from atok->head and atok->cur are not delayed + * after the loads from the netmap ring. */ + nm_ldld_barrier(); } /* Enable or disable application --> kernel kicks. */ @@ -127,10 +135,10 @@ csb_atok_intr_enabled(struct nm_csb_atok __user *csb_atok) static inline void sync_kloop_kring_dump(const char *title, const struct netmap_kring *kring) { - nm_prinf("%s - name: %s hwcur: %d hwtail: %d " - "rhead: %d rcur: %d rtail: %d", - title, kring->name, kring->nr_hwcur, kring->nr_hwtail, - kring->rhead, kring->rcur, kring->rtail); + nm_prinf("%s, kring %s, hwcur %d, rhead %d, " + "rcur %d, rtail %d, hwtail %d", + title, kring->name, kring->nr_hwcur, kring->rhead, + kring->rcur, kring->rtail, kring->nr_hwtail); } struct sync_kloop_ring_args { @@ -240,7 +248,8 @@ netmap_sync_kloop_tx_ring(const struct sync_kloop_ring_args *a) */ /* Reenable notifications. */ csb_ktoa_kick_enable(csb_ktoa, 1); - /* Doublecheck. */ + /* Double check, with store-load memory barrier. */ + nm_stld_barrier(); sync_kloop_kernel_read(csb_atok, &shadow_ring, num_slots); if (shadow_ring.head != kring->rhead) { /* We won the race condition, there are more packets to @@ -358,7 +367,8 @@ netmap_sync_kloop_rx_ring(const struct sync_kloop_ring_args *a) */ /* Reenable notifications. */ csb_ktoa_kick_enable(csb_ktoa, 1); - /* Doublecheck. */ + /* Double check, with store-load memory barrier. */ + nm_stld_barrier(); sync_kloop_kernel_read(csb_atok, &shadow_ring, num_slots); if (!sync_kloop_norxslots(kring, shadow_ring.head)) { /* We won the race condition, more slots are available. Disable @@ -439,6 +449,7 @@ netmap_sync_kloop(struct netmap_priv_d *priv, struct nmreq_header *hdr) struct sync_kloop_poll_ctx *poll_ctx = NULL; #endif /* SYNC_KLOOP_POLL */ int num_rx_rings, num_tx_rings, num_rings; + struct sync_kloop_ring_args *args = NULL; uint32_t sleep_us = req->sleep_us; struct nm_csb_atok* csb_atok_base; struct nm_csb_ktoa* csb_ktoa_base; @@ -488,6 +499,12 @@ netmap_sync_kloop(struct netmap_priv_d *priv, struct nmreq_header *hdr) num_tx_rings = priv->np_qlast[NR_TX] - priv->np_qfirst[NR_TX]; num_rings = num_tx_rings + num_rx_rings; + args = nm_os_malloc(num_rings * sizeof(args[0])); + if (!args) { + err = ENOMEM; + goto out; + } + /* Validate notification options. */ opt = nmreq_findoption((struct nmreq_option *)(uintptr_t)hdr->nr_options, NETMAP_REQ_OPT_SYNC_KLOOP_EVENTFDS); @@ -558,8 +575,8 @@ netmap_sync_kloop(struct netmap_priv_d *priv, struct nmreq_header *hdr) si[NR_TX] = nm_si_user(priv, NR_TX) ? &na->si[NR_TX] : &na->tx_rings[priv->np_qfirst[NR_TX]]->si; NMG_UNLOCK(); - poll_wait(priv->np_filp, si[NR_RX], &poll_ctx->wait_table); poll_wait(priv->np_filp, si[NR_TX], &poll_ctx->wait_table); + poll_wait(priv->np_filp, si[NR_RX], &poll_ctx->wait_table); } #else /* SYNC_KLOOP_POLL */ opt->nro_status = EOPNOTSUPP; @@ -567,6 +584,31 @@ netmap_sync_kloop(struct netmap_priv_d *priv, struct nmreq_header *hdr) #endif /* SYNC_KLOOP_POLL */ } + /* Prepare the arguments for netmap_sync_kloop_tx_ring() + * and netmap_sync_kloop_rx_ring(). */ + for (i = 0; i < num_tx_rings; i++) { + struct sync_kloop_ring_args *a = args + i; + + a->kring = NMR(na, NR_TX)[i + priv->np_qfirst[NR_TX]]; + a->csb_atok = csb_atok_base + i; + a->csb_ktoa = csb_ktoa_base + i; +#ifdef SYNC_KLOOP_POLL + if (poll_ctx) + a->irq_ctx = poll_ctx->entries[i].irq_ctx; +#endif /* SYNC_KLOOP_POLL */ + } + for (i = 0; i < num_rx_rings; i++) { + struct sync_kloop_ring_args *a = args + num_tx_rings + i; + + a->kring = NMR(na, NR_RX)[i + priv->np_qfirst[NR_RX]]; + a->csb_atok = csb_atok_base + num_tx_rings + i; + a->csb_ktoa = csb_ktoa_base + num_tx_rings + i; +#ifdef SYNC_KLOOP_POLL + if (poll_ctx) + a->irq_ctx = poll_ctx->entries[num_tx_rings + i].irq_ctx; +#endif /* SYNC_KLOOP_POLL */ + } + /* Main loop. */ for (;;) { if (unlikely(NM_ACCESS_ONCE(priv->np_kloop_state) & NM_SYNC_KLOOP_STOPPING)) { @@ -574,47 +616,40 @@ netmap_sync_kloop(struct netmap_priv_d *priv, struct nmreq_header *hdr) } #ifdef SYNC_KLOOP_POLL - if (poll_ctx) - __set_current_state(TASK_INTERRUPTIBLE); + if (poll_ctx) { + /* It is important to set the task state as + * interruptible before processing any TX/RX ring, + * so that if a notification on ring Y comes after + * we have processed ring Y, but before we call + * schedule(), we don't miss it. This is true because + * the wake up function will change the the task state, + * and therefore the schedule_timeout() call below + * will observe the change). + */ + set_current_state(TASK_INTERRUPTIBLE); + } #endif /* SYNC_KLOOP_POLL */ /* Process all the TX rings bound to this file descriptor. */ for (i = 0; i < num_tx_rings; i++) { - struct sync_kloop_ring_args a = { - .kring = NMR(na, NR_TX)[i + priv->np_qfirst[NR_TX]], - .csb_atok = csb_atok_base + i, - .csb_ktoa = csb_ktoa_base + i, - }; + struct sync_kloop_ring_args *a = args + i; -#ifdef SYNC_KLOOP_POLL - if (poll_ctx) - a.irq_ctx = poll_ctx->entries[i].irq_ctx; -#endif /* SYNC_KLOOP_POLL */ - if (unlikely(nm_kr_tryget(a.kring, 1, NULL))) { + if (unlikely(nm_kr_tryget(a->kring, 1, NULL))) { continue; } - netmap_sync_kloop_tx_ring(&a); - nm_kr_put(a.kring); + netmap_sync_kloop_tx_ring(a); + nm_kr_put(a->kring); } /* Process all the RX rings bound to this file descriptor. */ for (i = 0; i < num_rx_rings; i++) { - struct sync_kloop_ring_args a = { - .kring = NMR(na, NR_RX)[i + priv->np_qfirst[NR_RX]], - .csb_atok = csb_atok_base + num_tx_rings + i, - .csb_ktoa = csb_ktoa_base + num_tx_rings + i, - }; + struct sync_kloop_ring_args *a = args + num_tx_rings + i; -#ifdef SYNC_KLOOP_POLL - if (poll_ctx) - a.irq_ctx = poll_ctx->entries[num_tx_rings + i].irq_ctx; -#endif /* SYNC_KLOOP_POLL */ - - if (unlikely(nm_kr_tryget(a.kring, 1, NULL))) { + if (unlikely(nm_kr_tryget(a->kring, 1, NULL))) { continue; } - netmap_sync_kloop_rx_ring(&a); - nm_kr_put(a.kring); + netmap_sync_kloop_rx_ring(a); + nm_kr_put(a->kring); } #ifdef SYNC_KLOOP_POLL @@ -622,7 +657,7 @@ netmap_sync_kloop(struct netmap_priv_d *priv, struct nmreq_header *hdr) /* If a poll context is present, yield to the scheduler * waiting for a notification to come either from * netmap or the application. */ - schedule_timeout_interruptible(msecs_to_jiffies(1000)); + schedule_timeout(msecs_to_jiffies(20000)); } else #endif /* SYNC_KLOOP_POLL */ { @@ -657,6 +692,11 @@ netmap_sync_kloop(struct netmap_priv_d *priv, struct nmreq_header *hdr) } #endif /* SYNC_KLOOP_POLL */ + if (args) { + nm_os_free(args); + args = NULL; + } + /* Reset the kloop state. */ NMG_LOCK(); priv->np_kloop_state = 0; @@ -719,7 +759,7 @@ netmap_pt_guest_txsync(struct nm_csb_atok *atok, struct nm_csb_ktoa *ktoa, * packets. */ kring->nr_hwcur = ktoa->hwcur; - ptnetmap_guest_write_kring_csb(atok, kring->rcur, kring->rhead); + nm_sync_kloop_appl_write(atok, kring->rcur, kring->rhead); /* Ask for a kick from a guest to the host if needed. */ if (((kring->rhead != kring->nr_hwcur || nm_kr_txempty(kring)) @@ -733,7 +773,8 @@ netmap_pt_guest_txsync(struct nm_csb_atok *atok, struct nm_csb_ktoa *ktoa, * Second part: reclaim buffers for completed transmissions. */ if (nm_kr_txempty(kring) || (flags & NAF_FORCE_RECLAIM)) { - ptnetmap_guest_read_kring_csb(ktoa, kring); + nm_sync_kloop_appl_read(ktoa, &kring->nr_hwtail, + &kring->nr_hwcur); } /* @@ -744,8 +785,10 @@ netmap_pt_guest_txsync(struct nm_csb_atok *atok, struct nm_csb_ktoa *ktoa, if (nm_kr_txempty(kring) && !(kring->nr_kflags & NKR_NOINTR)) { /* Reenable notifications. */ atok->appl_need_kick = 1; - /* Double check */ - ptnetmap_guest_read_kring_csb(ktoa, kring); + /* Double check, with store-load memory barrier. */ + nm_stld_barrier(); + nm_sync_kloop_appl_read(ktoa, &kring->nr_hwtail, + &kring->nr_hwcur); /* If there is new free space, disable notifications */ if (unlikely(!nm_kr_txempty(kring))) { atok->appl_need_kick = 0; @@ -784,7 +827,7 @@ netmap_pt_guest_rxsync(struct nm_csb_atok *atok, struct nm_csb_ktoa *ktoa, * hwtail to the hwtail known from the host (read from the CSB). * This also updates the kring hwcur. */ - ptnetmap_guest_read_kring_csb(ktoa, kring); + nm_sync_kloop_appl_read(ktoa, &kring->nr_hwtail, &kring->nr_hwcur); kring->nr_kflags &= ~NKR_PENDINTR; /* @@ -792,8 +835,7 @@ netmap_pt_guest_rxsync(struct nm_csb_atok *atok, struct nm_csb_ktoa *ktoa, * released, by updating cur and head in the CSB. */ if (kring->rhead != kring->nr_hwcur) { - ptnetmap_guest_write_kring_csb(atok, kring->rcur, - kring->rhead); + nm_sync_kloop_appl_write(atok, kring->rcur, kring->rhead); /* Ask for a kick from the guest to the host if needed. */ if (NM_ACCESS_ONCE(ktoa->kern_need_kick)) { atok->sync_flags = flags; @@ -809,8 +851,10 @@ netmap_pt_guest_rxsync(struct nm_csb_atok *atok, struct nm_csb_ktoa *ktoa, if (nm_kr_rxempty(kring) && !(kring->nr_kflags & NKR_NOINTR)) { /* Reenable notifications. */ atok->appl_need_kick = 1; - /* Double check */ - ptnetmap_guest_read_kring_csb(ktoa, kring); + /* Double check, with store-load memory barrier. */ + nm_stld_barrier(); + nm_sync_kloop_appl_read(ktoa, &kring->nr_hwtail, + &kring->nr_hwcur); /* If there are new slots, disable notifications. */ if (!nm_kr_rxempty(kring)) { atok->appl_need_kick = 0; diff --git a/sys/net/netmap.h b/sys/net/netmap.h index f3688fc9e919..098d369b07d6 100644 --- a/sys/net/netmap.h +++ b/sys/net/netmap.h @@ -769,6 +769,8 @@ struct nm_csb_ktoa { #ifdef __KERNEL__ #define nm_stst_barrier smp_wmb +#define nm_ldld_barrier smp_rmb +#define nm_stld_barrier smp_mb #else /* !__KERNEL__ */ static inline void nm_stst_barrier(void) { @@ -777,18 +779,31 @@ static inline void nm_stst_barrier(void) * which is fine for us. */ __atomic_thread_fence(__ATOMIC_RELEASE); } +static inline void nm_ldld_barrier(void) +{ + /* A memory barrier with acquire semantic has the combined + * effect of a load-load barrier and a store-load barrier, + * which is fine for us. */ + __atomic_thread_fence(__ATOMIC_ACQUIRE); +} #endif /* !__KERNEL__ */ #elif defined(__FreeBSD__) #ifdef _KERNEL #define nm_stst_barrier atomic_thread_fence_rel +#define nm_ldld_barrier atomic_thread_fence_acq +#define nm_stld_barrier atomic_thread_fence_seq_cst #else /* !_KERNEL */ #include static inline void nm_stst_barrier(void) { atomic_thread_fence(memory_order_release); } +static inline void nm_ldld_barrier(void) +{ + atomic_thread_fence(memory_order_acquire); +} #endif /* !_KERNEL */ #else /* !__linux__ && !__FreeBSD__ */ @@ -801,6 +816,10 @@ static inline void nm_sync_kloop_appl_write(struct nm_csb_atok *atok, uint32_t cur, uint32_t head) { + /* Issue a first store-store barrier to make sure writes to the + * netmap ring do not overcome updates on atok->cur and atok->head. */ + nm_stst_barrier(); + /* * We need to write cur and head to the CSB but we cannot do it atomically. * There is no way we can prevent the host from reading the updated value @@ -815,11 +834,11 @@ nm_sync_kloop_appl_write(struct nm_csb_atok *atok, uint32_t cur, * * The following memory barrier scheme is used to make this happen: * - * Guest Host + * Guest Host * - * STORE(cur) LOAD(head) - * mb() <-----------> mb() - * STORE(head) LOAD(cur) + * STORE(cur) LOAD(head) + * wmb() <-----------> rmb() + * STORE(head) LOAD(cur) * */ atok->cur = cur; @@ -839,8 +858,12 @@ nm_sync_kloop_appl_read(struct nm_csb_ktoa *ktoa, uint32_t *hwtail, * (see explanation in sync_kloop_kernel_write). */ *hwtail = ktoa->hwtail; - nm_stst_barrier(); + nm_ldld_barrier(); *hwcur = ktoa->hwcur; + + /* Make sure that loads from ktoa->hwtail and ktoa->hwcur are not delayed + * after the loads from the netmap ring. */ + nm_ldld_barrier(); } /* From 797f009d59850f0bdd7908c774d225c878bfefe8 Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Wed, 23 Jan 2019 16:44:21 +0000 Subject: [PATCH 010/142] gmirror: Relocate DEVICE_FLAGS to adjacent lines gmirror's sc_flags is shared between some on-disk state and some runtime only state. There's no real reason for that and they could probably be split up. Until they are, locate all of the flags for the same field nearby each other in the source, for clarity. No functional change. Sponsored by: Dell EMC Isilon --- sys/geom/mirror/g_mirror.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/geom/mirror/g_mirror.h b/sys/geom/mirror/g_mirror.h index 050219acd1ba..370715a831e0 100644 --- a/sys/geom/mirror/g_mirror.h +++ b/sys/geom/mirror/g_mirror.h @@ -78,6 +78,12 @@ G_MIRROR_DEVICE_FLAG_NOFAILSYNC) #ifdef _KERNEL +#define G_MIRROR_DEVICE_FLAG_DESTROY 0x0100000000000000ULL +#define G_MIRROR_DEVICE_FLAG_DRAIN 0x0200000000000000ULL +#define G_MIRROR_DEVICE_FLAG_CLOSEWAIT 0x0400000000000000ULL +#define G_MIRROR_DEVICE_FLAG_TASTING 0x0800000000000000ULL +#define G_MIRROR_DEVICE_FLAG_WIPE 0x1000000000000000ULL + extern int g_mirror_debug; #define G_MIRROR_DEBUG(lvl, ...) do { \ @@ -167,12 +173,6 @@ struct g_mirror_event { TAILQ_ENTRY(g_mirror_event) e_next; }; -#define G_MIRROR_DEVICE_FLAG_DESTROY 0x0100000000000000ULL -#define G_MIRROR_DEVICE_FLAG_DRAIN 0x0200000000000000ULL -#define G_MIRROR_DEVICE_FLAG_CLOSEWAIT 0x0400000000000000ULL -#define G_MIRROR_DEVICE_FLAG_TASTING 0x0800000000000000ULL -#define G_MIRROR_DEVICE_FLAG_WIPE 0x1000000000000000ULL - #define G_MIRROR_DEVICE_STATE_STARTING 0 #define G_MIRROR_DEVICE_STATE_RUNNING 1 From f9be23fd42a6060ac7bce6e570ed239831c15241 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 23 Jan 2019 17:28:39 +0000 Subject: [PATCH 011/142] ocs_fc: Ensure that we zero-initialize memory before copying it out. Note that the affected interface is available only to root. admbugs: 765 Reported by: Vlad Tsyrklevich Reviewed by: emaste, ram MFC after: 1 day Security: Kernel memory disclosure Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18914 --- sys/dev/ocs_fc/ocs_mgmt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/ocs_fc/ocs_mgmt.c b/sys/dev/ocs_fc/ocs_mgmt.c index 2532745ff876..b084403402c5 100644 --- a/sys/dev/ocs_fc/ocs_mgmt.c +++ b/sys/dev/ocs_fc/ocs_mgmt.c @@ -851,6 +851,7 @@ ocs_mgmt_firmware_write(ocs_t *ocs, char *name, void *buf, uint32_t buf_len, voi if (arg_out_length > sizeof(status_str)) { arg_out_length = sizeof(status_str); } + ocs_memset(status_str, 0, sizeof(status_str)); ocs_snprintf(status_str, arg_out_length, "%d", change_status); if (ocs_copy_to_user(arg_out, status_str, arg_out_length)) { ocs_log_test(ocs, "copy to user failed for change_status\n"); From 4915e5c71987230657669b7e6e190edd094819d3 Mon Sep 17 00:00:00 2001 From: Ram Kishore Vegesna Date: Wed, 23 Jan 2019 17:34:01 +0000 Subject: [PATCH 012/142] Fixed issues reported by coverity scan. Approved by: mav MFC after: 3 weeks --- sys/dev/ocs_fc/ocs_cam.c | 26 +++++++---- sys/dev/ocs_fc/ocs_hw.c | 84 +++++++++++++++++++++------------- sys/dev/ocs_fc/ocs_hw_queues.c | 29 ++++++++---- sys/dev/ocs_fc/ocs_ioctl.c | 10 ++-- sys/dev/ocs_fc/ocs_mgmt.c | 17 ++++--- sys/dev/ocs_fc/ocs_node.c | 2 +- sys/dev/ocs_fc/ocs_pci.c | 2 +- sys/dev/ocs_fc/ocs_xport.c | 4 -- sys/dev/ocs_fc/sli4.c | 11 +++-- 9 files changed, 116 insertions(+), 69 deletions(-) diff --git a/sys/dev/ocs_fc/ocs_cam.c b/sys/dev/ocs_fc/ocs_cam.c index d89fa6968b13..7efdc7a07edf 100644 --- a/sys/dev/ocs_fc/ocs_cam.c +++ b/sys/dev/ocs_fc/ocs_cam.c @@ -1164,15 +1164,24 @@ ocs_scsi_del_target(ocs_node_t *node, ocs_scsi_del_target_reason_e reason) struct ocs_softc *ocs = node->ocs; ocs_fcport *fcp = NULL; ocs_fc_target_t *tgt = NULL; - uint32_t tgt_id; + int32_t tgt_id; + + if (ocs == NULL) { + ocs_log_err(ocs,"OCS is NULL \n"); + return -1; + } fcp = node->sport->tgt_data; if (fcp == NULL) { ocs_log_err(ocs,"FCP is NULL \n"); - return 0; + return -1; } tgt_id = ocs_tgt_find(fcp, node); + if (tgt_id == -1) { + ocs_log_err(ocs,"target is invalid\n"); + return -1; + } tgt = &fcp->tgt[tgt_id]; @@ -1781,13 +1790,9 @@ ocs_initiator_io(struct ocs_softc *ocs, union ccb *ccb) ocs_io_t *io = NULL; ocs_scsi_sgl_t sgl[OCS_FC_MAX_SGL]; int32_t sgl_count; + ocs_fcport *fcp; - ocs_fcport *fcp = NULL; fcp = FCPORT(ocs, cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path))); - if (fcp == NULL) { - device_printf(ocs->dev, "%s: fcp is NULL\n", __func__); - return -1; - } if (fcp->tgt[ccb_h->target_id].state == OCS_TGT_STATE_LOST) { device_printf(ocs->dev, "%s: device LOST %d\n", __func__, @@ -2250,8 +2255,11 @@ ocs_action(struct cam_sim *sim, union ccb *ccb) } case XPT_RESET_BUS: if (ocs_xport_control(ocs->xport, OCS_XPORT_PORT_OFFLINE) == 0) { - ocs_xport_control(ocs->xport, OCS_XPORT_PORT_ONLINE); - + rc = ocs_xport_control(ocs->xport, OCS_XPORT_PORT_ONLINE); + if (rc) { + ocs_log_debug(ocs, "Failed to bring port online" + " : %d\n", rc); + } ocs_set_ccb_status(ccb, CAM_REQ_CMP); } else { ocs_set_ccb_status(ccb, CAM_REQ_CMP_ERR); diff --git a/sys/dev/ocs_fc/ocs_hw.c b/sys/dev/ocs_fc/ocs_hw.c index 9cbb3f67e306..3c114ddf7634 100644 --- a/sys/dev/ocs_fc/ocs_hw.c +++ b/sys/dev/ocs_fc/ocs_hw.c @@ -242,10 +242,7 @@ ocs_hw_get_num_chutes(ocs_hw_t *hw) static ocs_hw_rtn_e ocs_hw_link_event_init(ocs_hw_t *hw) { - if (hw == NULL) { - ocs_log_err(hw->os, "bad parameter hw=%p\n", hw); - return OCS_HW_RTN_ERROR; - } + ocs_hw_assert(hw); hw->link.status = SLI_LINK_STATUS_MAX; hw->link.topology = SLI_LINK_TOPO_NONE; @@ -1757,6 +1754,7 @@ ocs_hw_get(ocs_hw_t *hw, ocs_hw_property_e prop, uint32_t *value) break; case OCS_HW_MAX_VPORTS: *value = sli_get_max_rsrc(&hw->sli, SLI_RSRC_FCOE_VPI); + break; default: ocs_log_test(hw->os, "unsupported property %#x\n", prop); rc = OCS_HW_RTN_ERROR; @@ -1996,6 +1994,7 @@ ocs_hw_set(ocs_hw_t *hw, ocs_hw_property_e prop, uint32_t value) break; case OCS_ESOC: hw->config.esoc = value; + break; case OCS_HW_HIGH_LOGIN_MODE: rc = sli_set_hlm(&hw->sli, value); break; @@ -4395,7 +4394,7 @@ ocs_hw_send_frame(ocs_hw_t *hw, fc_header_le_t *hdr, uint8_t sof, uint8_t eof, o OCS_STAT(wq->use_count++); - return rc ? OCS_HW_RTN_ERROR : OCS_HW_RTN_SUCCESS; + return OCS_HW_RTN_SUCCESS; } ocs_hw_rtn_e @@ -4696,7 +4695,7 @@ ocs_hw_io_overflow_sgl(ocs_hw_t *hw, ocs_hw_io_t *io) } /* fail if we don't have an overflow SGL registered */ - if (io->ovfl_sgl == NULL) { + if (io->ovfl_io == NULL || io->ovfl_sgl == NULL) { return OCS_HW_RTN_ERROR; } @@ -6321,6 +6320,11 @@ ocs_hw_config_watchdog_timer(ocs_hw_t *hw) ocs_hw_rtn_e rc = OCS_HW_RTN_SUCCESS; uint8_t *buf = ocs_malloc(hw->os, SLI4_BMBX_SIZE, OCS_M_NOWAIT); + if (!buf) { + ocs_log_err(hw->os, "no buffer for command\n"); + return OCS_HW_RTN_NO_MEMORY; + } + sli4_cmd_lowlevel_set_watchdog(&hw->sli, buf, SLI4_BMBX_SIZE, hw->watchdog_timeout); rc = ocs_hw_command(hw, buf, OCS_CMD_NOWAIT, ocs_hw_cb_cfg_watchdog, NULL); if (rc) { @@ -8486,7 +8490,14 @@ ocs_hw_cq_process(ocs_hw_t *hw, hw_cq_t *cq) break; case SLI_QENTRY_WQ_RELEASE: { uint32_t wq_id = rid; - uint32_t index = ocs_hw_queue_hash_find(hw->wq_hash, wq_id); + int32_t index = ocs_hw_queue_hash_find(hw->wq_hash, wq_id); + + if (unlikely(index < 0)) { + ocs_log_err(hw->os, "unknown idx=%#x rid=%#x\n", + index, rid); + break; + } + hw_wq_t *wq = hw->hw_wq[index]; /* Submit any HW IOs that are on the WQ pending list */ @@ -9300,7 +9311,8 @@ ocs_hw_cb_link(void *ctx, void *e) hw->link.status = event->status; - for (i = 0; d = hw->domains[i], i < SLI4_MAX_FCFI; i++) { + for (i = 0; i < SLI4_MAX_FCFI; i++) { + d = hw->domains[i]; if (d != NULL && hw->callback.domain != NULL) { hw->callback.domain(hw->args.domain, OCS_HW_DOMAIN_LOST, d); @@ -9322,6 +9334,9 @@ ocs_hw_cb_fip(void *ctx, void *e) ocs_domain_t *domain = NULL; sli4_fip_event_t *event = e; + ocs_hw_assert(event); + ocs_hw_assert(hw); + /* Find the associated domain object */ if (event->type == SLI4_FCOE_FIP_FCF_CLEAR_VLINK) { ocs_domain_t *d = NULL; @@ -9330,7 +9345,8 @@ ocs_hw_cb_fip(void *ctx, void *e) /* Clear VLINK is different from the other FIP events as it passes back * a VPI instead of a FCF index. Check all attached SLI ports for a * matching VPI */ - for (i = 0; d = hw->domains[i], i < SLI4_MAX_FCFI; i++) { + for (i = 0; i < SLI4_MAX_FCFI; i++) { + d = hw->domains[i]; if (d != NULL) { ocs_sport_t *sport = NULL; @@ -11202,6 +11218,7 @@ target_wqe_timer_nop_cb(ocs_hw_t *hw, int32_t status, uint8_t *mqe, void *arg) ocs_hw_io_t *io_next = NULL; uint64_t ticks_current = ocs_get_os_ticks(); uint32_t sec_elapsed; + ocs_hw_rtn_e rc; sli4_mbox_command_header_t *hdr = (sli4_mbox_command_header_t *)mqe; @@ -11213,34 +11230,39 @@ target_wqe_timer_nop_cb(ocs_hw_t *hw, int32_t status, uint8_t *mqe, void *arg) /* loop through active WQE list and check for timeouts */ ocs_lock(&hw->io_lock); - ocs_list_foreach_safe(&hw->io_timed_wqe, io, io_next) { - sec_elapsed = ((ticks_current - io->submit_ticks) / ocs_get_os_tick_freq()); + ocs_list_foreach_safe(&hw->io_timed_wqe, io, io_next) { + sec_elapsed = ((ticks_current - io->submit_ticks) / ocs_get_os_tick_freq()); - /* - * If elapsed time > timeout, abort it. No need to check type since - * it wouldn't be on this list unless it was a target WQE - */ - if (sec_elapsed > io->tgt_wqe_timeout) { - ocs_log_test(hw->os, "IO timeout xri=0x%x tag=0x%x type=%d\n", - io->indicator, io->reqtag, io->type); + /* + * If elapsed time > timeout, abort it. No need to check type since + * it wouldn't be on this list unless it was a target WQE + */ + if (sec_elapsed > io->tgt_wqe_timeout) { + ocs_log_test(hw->os, "IO timeout xri=0x%x tag=0x%x type=%d\n", + io->indicator, io->reqtag, io->type); - /* remove from active_wqe list so won't try to abort again */ - ocs_list_remove(&hw->io_timed_wqe, io); + /* remove from active_wqe list so won't try to abort again */ + ocs_list_remove(&hw->io_timed_wqe, io); - /* save status of "timed out" for when abort completes */ - io->status_saved = 1; - io->saved_status = SLI4_FC_WCQE_STATUS_TARGET_WQE_TIMEOUT; - io->saved_ext = 0; - io->saved_len = 0; + /* save status of "timed out" for when abort completes */ + io->status_saved = 1; + io->saved_status = SLI4_FC_WCQE_STATUS_TARGET_WQE_TIMEOUT; + io->saved_ext = 0; + io->saved_len = 0; - /* now abort outstanding IO */ - ocs_hw_io_abort(hw, io, FALSE, NULL, NULL); + /* now abort outstanding IO */ + rc = ocs_hw_io_abort(hw, io, FALSE, NULL, NULL); + if (rc) { + ocs_log_test(hw->os, + "abort failed xri=%#x tag=%#x rc=%d\n", + io->indicator, io->reqtag, rc); } - /* - * need to go through entire list since each IO could have a - * different timeout value - */ } + /* + * need to go through entire list since each IO could have a + * different timeout value + */ + } ocs_unlock(&hw->io_lock); /* if we're not in the middle of shutting down, schedule next timer */ diff --git a/sys/dev/ocs_fc/ocs_hw_queues.c b/sys/dev/ocs_fc/ocs_hw_queues.c index 2527d72865a7..3157fc7dfe22 100644 --- a/sys/dev/ocs_fc/ocs_hw_queues.c +++ b/sys/dev/ocs_fc/ocs_hw_queues.c @@ -149,13 +149,16 @@ ocs_hw_init_queues(ocs_hw_t *hw, ocs_hw_qtop_t *qtop) default_lengths[QTOP_CQ] = len; break; } + + if (!eq || !next_qt) { + goto fail; + } /* If this CQ is for MRQ, then delay the creation */ if (!use_mrq || next_qt->entry != QTOP_RQ) { cq = hw_new_cq(eq, len); if (cq == NULL) { - hw_queue_teardown(hw); - return OCS_HW_RTN_NO_MEMORY; + goto fail; } } break; @@ -173,11 +176,13 @@ ocs_hw_init_queues(ocs_hw_t *hw, ocs_hw_qtop_t *qtop) hw_queue_teardown(hw); return OCS_HW_RTN_NO_MEMORY; } + + if (cq == NULL) + goto fail; wq = hw_new_wq(cq, len, qt->class, hw->ulp_start + qt->ulp); if (wq == NULL) { - hw_queue_teardown(hw); - return OCS_HW_RTN_NO_MEMORY; + goto fail; } /* Place this WQ on the EQ WQ array */ @@ -249,10 +254,12 @@ ocs_hw_init_queues(ocs_hw_t *hw, ocs_hw_qtop_t *qtop) break; } + if (cq == NULL) + goto fail; + mq = hw_new_mq(cq, len); if (mq == NULL) { - hw_queue_teardown(hw); - return OCS_HW_RTN_NO_MEMORY; + goto fail; } break; @@ -332,6 +339,9 @@ ocs_hw_init_queues(ocs_hw_t *hw, ocs_hw_qtop_t *qtop) } return OCS_HW_RTN_SUCCESS; +fail: + hw_queue_teardown(hw); + return OCS_HW_RTN_NO_MEMORY; } @@ -737,8 +747,9 @@ hw_new_rq_set(hw_cq_t *cqs[], hw_rq_t *rqs[], uint32_t num_rq_pairs, uint32_t en for (i = 0; i < num_rq_pairs; i++) { if (rqs[i] != NULL) { if (rqs[i]->rq_tracker != NULL) { - ocs_free(hw->os, rq->rq_tracker, - sizeof(ocs_hw_sequence_t*) * rq->entry_count); + ocs_free(hw->os, rqs[i]->rq_tracker, + sizeof(ocs_hw_sequence_t*) * + rqs[i]->entry_count); } ocs_free(hw->os, rqs[i], sizeof(*rqs[i])); } @@ -861,9 +872,9 @@ hw_del_wq(hw_wq_t *wq) void hw_del_rq(hw_rq_t *rq) { - ocs_hw_t *hw = rq->cq->eq->hw; if (rq != NULL) { + ocs_hw_t *hw = rq->cq->eq->hw; /* Free RQ tracker */ if (rq->rq_tracker != NULL) { ocs_free(hw->os, rq->rq_tracker, sizeof(ocs_hw_sequence_t*) * rq->entry_count); diff --git a/sys/dev/ocs_fc/ocs_ioctl.c b/sys/dev/ocs_fc/ocs_ioctl.c index 0e0ffb46af2a..70e1a99c1d3b 100644 --- a/sys/dev/ocs_fc/ocs_ioctl.c +++ b/sys/dev/ocs_fc/ocs_ioctl.c @@ -243,9 +243,13 @@ ocs_process_mbx_ioctl(ocs_t *ocs, ocs_ioctl_elxu_mbox_t *mcmd) * 6. ioctl code releases the lock */ mtx_lock(&ocs->dbg_lock); - ocs_hw_command(&ocs->hw, mcmd->payload, OCS_CMD_NOWAIT, - __ocs_ioctl_mbox_cb, ocs); - msleep(ocs, &ocs->dbg_lock, 0, "ocsmbx", 0); + if (ocs_hw_command(&ocs->hw, mcmd->payload, OCS_CMD_NOWAIT, + __ocs_ioctl_mbox_cb, ocs)) { + + device_printf(ocs->dev, "%s: command- %x failed\n", __func__, + ((sli4_mbox_command_header_t *)mcmd->payload)->command); + } + msleep(ocs, &ocs->dbg_lock, 0, "ocsmbx", 0); mtx_unlock(&ocs->dbg_lock); if( SLI4_MBOX_COMMAND_SLI_CONFIG == ((sli4_mbox_command_header_t *)mcmd->payload)->command diff --git a/sys/dev/ocs_fc/ocs_mgmt.c b/sys/dev/ocs_fc/ocs_mgmt.c index b084403402c5..cf2e9219aacc 100644 --- a/sys/dev/ocs_fc/ocs_mgmt.c +++ b/sys/dev/ocs_fc/ocs_mgmt.c @@ -2129,7 +2129,7 @@ set_port_protocol(ocs_t *ocs, char *name, char *value) if (ocs_sem_p(&(result.semaphore), OCS_SEM_FOREVER) != 0) { /* Undefined failure */ ocs_log_err(ocs, "ocs_sem_p failed\n"); - rc = -ENXIO; + return -ENXIO; } if (result.status == 0) { /* Success. */ @@ -2321,7 +2321,7 @@ set_active_profile(ocs_t *ocs, char *name, char *value) if (ocs_sem_p(&(result.semaphore), OCS_SEM_FOREVER) != 0) { /* Undefined failure */ ocs_log_err(ocs, "ocs_sem_p failed\n"); - rc = -ENXIO; + return -ENXIO; } if (result.status == 0) { /* Success. */ @@ -2527,8 +2527,8 @@ set_nv_wwn(ocs_t *ocs, char *name, char *wwn_p) char *wwpn_p = NULL; char *wwnn_p = NULL; int32_t rc = -1; - int wwpn; - int wwnn; + int wwpn = 0; + int wwnn = 0; int i; /* This is a read-modify-write operation, so first we have to read @@ -2556,8 +2556,13 @@ set_nv_wwn(ocs_t *ocs, char *name, char *wwn_p) wwnn_p = wwn_p; } - wwpn = ocs_strcmp(wwpn_p, "NA"); - wwnn = ocs_strcmp(wwnn_p, "NA"); + if (wwpn_p != NULL) { + wwpn = ocs_strcmp(wwpn_p, "NA"); + } + + if (wwnn_p != NULL) { + wwnn = ocs_strcmp(wwnn_p, "NA"); + } /* Parse the new WWPN */ if ((wwpn_p != NULL) && (wwpn != 0)) { diff --git a/sys/dev/ocs_fc/ocs_node.c b/sys/dev/ocs_fc/ocs_node.c index 0e4b08369562..4809b98957c3 100644 --- a/sys/dev/ocs_fc/ocs_node.c +++ b/sys/dev/ocs_fc/ocs_node.c @@ -253,7 +253,7 @@ ocs_node_create_pool(ocs_t *ocs, uint32_t node_count) if (0 == ocs_hw_get(&ocs->hw, OCS_HW_MAX_SGE, &max_sge) && 0 == ocs_hw_get(&ocs->hw, OCS_HW_N_SGL, &num_sgl)) { - max_xfer_size = max_sge * num_sgl; + max_xfer_size = (max_sge * (uint64_t)num_sgl); } else { max_xfer_size = 65536; } diff --git a/sys/dev/ocs_fc/ocs_pci.c b/sys/dev/ocs_fc/ocs_pci.c index 018c4e6da8f7..c4b703301b4d 100644 --- a/sys/dev/ocs_fc/ocs_pci.c +++ b/sys/dev/ocs_fc/ocs_pci.c @@ -591,7 +591,7 @@ ocs_device_detach(ocs_t *ocs) } ocs_cam_detach(ocs); - ocs_free(ocs, ocs->fcports, sizeof(ocs->fcports)); + ocs_free(ocs, ocs->fcports, sizeof(*(ocs->fcports))); for (i = 0; (io = ocs_io_get_instance(ocs, i)); i++) { if (bus_dmamap_destroy(ocs->buf_dmat, io->tgt_io.dmap)) { diff --git a/sys/dev/ocs_fc/ocs_xport.c b/sys/dev/ocs_fc/ocs_xport.c index b73c1d071a29..112f8d0af7e4 100644 --- a/sys/dev/ocs_fc/ocs_xport.c +++ b/sys/dev/ocs_fc/ocs_xport.c @@ -292,10 +292,6 @@ ocs_xport_attach(ocs_xport_t *xport) ocs_node_free_pool(ocs); } - if (rq_threads_created) { - ocs_xport_rq_threads_teardown(xport); - } - return -1; } diff --git a/sys/dev/ocs_fc/sli4.c b/sys/dev/ocs_fc/sli4.c index c5e7a74203a9..075b9bb27f13 100644 --- a/sys/dev/ocs_fc/sli4.c +++ b/sys/dev/ocs_fc/sli4.c @@ -1867,10 +1867,7 @@ sli_cmd_common_create_cq(sli4_t *sli4, void *buf, size_t size, } } break; - default: - ocs_log_test(sli4->os, "unsupported IF_TYPE %d\n", if_type); - return -1; - } + } return (sli_config_off + cmd_size); } @@ -4637,6 +4634,8 @@ sli_cq_alloc_set(sli4_t *sli4, sli4_queue_t *qs[], uint32_t num_cqs, return -1; } + memset(&dma, 0, sizeof(dma)); + /* Align the queue DMA memory */ for (i = 0; i < num_cqs; i++) { if (__sli_queue_init(sli4, qs[i], SLI_QTYPE_CQ, SLI4_CQE_BYTES, @@ -4886,7 +4885,7 @@ sli_queue_reset(sli4_t *sli4, sli4_queue_t *q) } if (q->dma.virt != NULL) { - ocs_memset(q->dma.virt, 0, (q->size * q->length)); + ocs_memset(q->dma.virt, 0, (q->size * (uint64_t)q->length)); } ocs_unlock(&q->lock); @@ -8480,6 +8479,8 @@ sli_fc_rq_set_alloc(sli4_t *sli4, uint32_t num_rq_pairs, sli4_res_common_create_queue_set_t *rsp = NULL; sli4_req_fcoe_rq_create_v2_t *req = NULL; + ocs_memset(&dma, 0, sizeof(dma)); + for (i = 0; i < (num_rq_pairs * 2); i++) { if (__sli_queue_init(sli4, qs[i], SLI_QTYPE_RQ, SLI4_FCOE_RQE_SIZE, n_entries, SLI_PAGE_SIZE)) { From 05d3471d5d0fae91da4b01cfe99cd4f4ba142f72 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Wed, 23 Jan 2019 18:53:13 +0000 Subject: [PATCH 013/142] Add USB quirk. Submitted by: Gary Jennejohn MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/dev/usb/quirk/usb_quirk.c | 1 + sys/dev/usb/usbdevs | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/dev/usb/quirk/usb_quirk.c b/sys/dev/usb/quirk/usb_quirk.c index 4506168cefcc..eb803a9180ca 100644 --- a/sys/dev/usb/quirk/usb_quirk.c +++ b/sys/dev/usb/quirk/usb_quirk.c @@ -278,6 +278,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { USB_QUIRK(IOMEGA, ZIP100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_TEST_UNIT_READY), /* XXX ZIP drives can also use ATAPI */ + USB_QUIRK(JMICRON, JMS566, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN), USB_QUIRK(JMICRON, JMS567, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN), USB_QUIRK(JMICRON, JM20337, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index 422021ba94f0..52c4ba284619 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -2646,6 +2646,7 @@ product JATON EDA 0x5704 Ethernet product JETI SPC1201 0x04b2 FTDI compatible adapter /* JMicron products */ +product JMICRON JMS566 0x3569 USB to SATA 3.0Gb/s bridge product JMICRON JMS567 0x0567 USB to SATA 6.0Gb/s bridge product JMICRON JM20336 0x2336 USB to SATA Bridge product JMICRON JM20337 0x2338 USB to ATA/ATAPI Bridge From 862203935e6d4da6065778136de19f276e9abb03 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 23 Jan 2019 18:58:15 +0000 Subject: [PATCH 014/142] Correct uma_prealloc()'s use of domainset iterators after r339925. The iterator should be reinitialized after every successful slab allocation. A request to advance the iterator is interpreted as an allocation failure, so a sufficiently large preallocation would cause the iterator to believe that all domains were exhausted, resulting in a sleep with the keg lock held. [1] Also, keg_alloc_slab() should pass the unmodified wait flag to the item initialization routine, which may use it to perform allocations from other zones. Reported and tested by: slavah Diagnosed by: kib [1] Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/vm/uma_core.c | 58 ++++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 7d0245d80d04..63196404e53d 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -241,7 +241,7 @@ static void *pcpu_page_alloc(uma_zone_t, vm_size_t, int, uint8_t *, int); static void *startup_alloc(uma_zone_t, vm_size_t, int, uint8_t *, int); static void page_free(void *, vm_size_t, uint8_t); static void pcpu_page_free(void *, vm_size_t, uint8_t); -static uma_slab_t keg_alloc_slab(uma_keg_t, uma_zone_t, int, int); +static uma_slab_t keg_alloc_slab(uma_keg_t, uma_zone_t, int, int, int); static void cache_drain(uma_zone_t); static void bucket_drain(uma_zone_t, uma_bucket_t); static void bucket_cache_drain(uma_zone_t zone); @@ -1049,20 +1049,22 @@ zone_drain(uma_zone_t zone) * otherwise the keg will be left unlocked. * * Arguments: - * wait Shall we wait? + * flags Wait flags for the item initialization routine + * aflags Wait flags for the slab allocation * * Returns: * The slab that was allocated or NULL if there is no memory and the * caller specified M_NOWAIT. */ static uma_slab_t -keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int wait) +keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int flags, + int aflags) { uma_alloc allocf; uma_slab_t slab; unsigned long size; uint8_t *mem; - uint8_t flags; + uint8_t sflags; int i; KASSERT(domain >= 0 && domain < vm_ndomains, @@ -1076,7 +1078,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int wait) slab = NULL; mem = NULL; if (keg->uk_flags & UMA_ZONE_OFFPAGE) { - slab = zone_alloc_item(keg->uk_slabzone, NULL, domain, wait); + slab = zone_alloc_item(keg->uk_slabzone, NULL, domain, aflags); if (slab == NULL) goto out; } @@ -1089,16 +1091,16 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int wait) */ if ((keg->uk_flags & UMA_ZONE_MALLOC) == 0) - wait |= M_ZERO; + aflags |= M_ZERO; else - wait &= ~M_ZERO; + aflags &= ~M_ZERO; if (keg->uk_flags & UMA_ZONE_NODUMP) - wait |= M_NODUMP; + aflags |= M_NODUMP; /* zone is passed for legacy reasons. */ size = keg->uk_ppera * PAGE_SIZE; - mem = allocf(zone, size, domain, &flags, wait); + mem = allocf(zone, size, domain, &sflags, aflags); if (mem == NULL) { if (keg->uk_flags & UMA_ZONE_OFFPAGE) zone_free_item(keg->uk_slabzone, slab, NULL, SKIP_NONE); @@ -1118,7 +1120,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int wait) slab->us_keg = keg; slab->us_data = mem; slab->us_freecount = keg->uk_ipers; - slab->us_flags = flags; + slab->us_flags = sflags; slab->us_domain = domain; BIT_FILL(SLAB_SETSIZE, &slab->us_free); #ifdef INVARIANTS @@ -1128,7 +1130,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int wait) if (keg->uk_init != NULL) { for (i = 0; i < keg->uk_ipers; i++) if (keg->uk_init(slab->us_data + (keg->uk_rsize * i), - keg->uk_size, wait) != 0) + keg->uk_size, flags) != 0) break; if (i != keg->uk_ipers) { keg_free_slab(keg, slab, i); @@ -2698,7 +2700,7 @@ keg_fetch_slab(uma_keg_t keg, uma_zone_t zone, int rdomain, const int flags) zone->uz_items <= zone->uz_max_items, ("%s: zone %p overflow", __func__, zone)); - slab = keg_alloc_slab(keg, zone, domain, aflags); + slab = keg_alloc_slab(keg, zone, domain, flags, aflags); /* * If we got a slab here it's safe to mark it partially used * and return. We assume that the caller is going to remove @@ -3548,24 +3550,34 @@ uma_prealloc(uma_zone_t zone, int items) uma_domain_t dom; uma_slab_t slab; uma_keg_t keg; - int domain, flags, slabs; + int aflags, domain, slabs; KEG_GET(zone, keg); KEG_LOCK(keg); slabs = items / keg->uk_ipers; if (slabs * keg->uk_ipers < items) slabs++; - flags = M_WAITOK; - vm_domainset_iter_policy_ref_init(&di, &keg->uk_dr, &domain, &flags); while (slabs-- > 0) { - slab = keg_alloc_slab(keg, zone, domain, flags); - if (slab == NULL) - return; - MPASS(slab->us_keg == keg); - dom = &keg->uk_domain[slab->us_domain]; - LIST_INSERT_HEAD(&dom->ud_free_slab, slab, us_link); - if (vm_domainset_iter_policy(&di, &domain) != 0) - break; + aflags = M_NOWAIT; + vm_domainset_iter_policy_ref_init(&di, &keg->uk_dr, &domain, + &aflags); + for (;;) { + slab = keg_alloc_slab(keg, zone, domain, M_WAITOK, + aflags); + if (slab != NULL) { + MPASS(slab->us_keg == keg); + dom = &keg->uk_domain[slab->us_domain]; + LIST_INSERT_HEAD(&dom->ud_free_slab, slab, + us_link); + break; + } + KEG_LOCK(keg); + if (vm_domainset_iter_policy(&di, &domain) != 0) { + KEG_UNLOCK(keg); + vm_wait_doms(&keg->uk_dr.dr_policy->ds_mask); + KEG_LOCK(keg); + } + } } KEG_UNLOCK(keg); } From 27ed53c3117c6d937c9f55e94a2354345a42a604 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 23 Jan 2019 20:02:17 +0000 Subject: [PATCH 015/142] Remove extraneous setutxent() calls in write(1). We already call setutxent() once during initialization. Furthermore, the subsequent calls occur after the process has entered capability mode, so they fail, and attempts to fetch database entries fail as a result. PR: 235096 Submitted by: fullermd@over-yonder.net MFC after: 3 days --- usr.bin/write/write.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/usr.bin/write/write.c b/usr.bin/write/write.c index 2febe3b42302..06cae97d9fc9 100644 --- a/usr.bin/write/write.c +++ b/usr.bin/write/write.c @@ -204,7 +204,6 @@ utmp_chk(char *user, char *tty) struct utmpx lu, *u; strncpy(lu.ut_line, tty, sizeof lu.ut_line); - setutxent(); while ((u = getutxline(&lu)) != NULL) if (u->ut_type == USER_PROCESS && strcmp(user, u->ut_user) == 0) { @@ -237,7 +236,6 @@ search_utmp(int devfd, char *user, char *tty, char *mytty, uid_t myuid) bestatime = 0; user_is_me = 0; - setutxent(); while ((u = getutxent()) != NULL) if (u->ut_type == USER_PROCESS && strcmp(user, u->ut_user) == 0) { From b29e142648453f93bea592b5379ae141137397ee Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 23 Jan 2019 22:00:17 +0000 Subject: [PATCH 016/142] Add [initial] functional tests for sendfile(2) as lib/libc/sys/sendfile These testcases exercise a number of functional requirements for sendfile(2). The testcases use IPv4 and IPv6 domain sockets with TCP, and were confirmed functional on UFS and ZFS. UDP address family sockets cannot be used per the sendfile(2) contract, thus using UDP sockets is outside the scope of testing the syscall in positive cases. As seen in `:s_negative_udp_socket_test`, UDP is used to test the sendfile(2) contract to ensure that EINVAL is returned by sendfile(2). The testcases added explicitly avoid testing out `SF_SYNC` due to the complexity of verifying that support. However, this is a good next logical item to verify. The `hdtr_positive*` testcases work to a certain degree (the header testcases pass), but the trailer testcases do not work (it is an expected failure). In particular, the value received by the mock server doesn't match the expected value, and instead looks something like the following (using python array notation): `trailer[:]message[1:]` instead of: `message[:]trailer[:]` This makes me think there's a buffer overrun issue or problem with the offset somewhere in the sendfile(2) system call, but I need to do some other testing first to verify that the code is indeed sane, and my assumptions/code isn't buggy. The `sbytes_negative` testcases that check `sbytes` being set to an invalid value resulting in `EFAULT` fails today as the other change (which checks `copyout(9)`) has not been committed [1]. Thus, it should remain an expected failure (see bug 232210 for more details on this item). Next steps for testing sendfile(2): 1. Fix the header/trailer testcases so that they pass. 2. Setup if_tap interface and test with it, instead of using "localhost", per @asomers's suggestion. 3. Handle short recv(2)'s in `server_cat(..)`. 4. Add `SF_SYNC` support. 5. Add some more negative tests outside the scope of the functional contract. MFC after: 1 month Reviewed by: asomers Approved by: emaste (mentor) PR: 232210 Sponsored by: Netflix, Inc Differential Revision: https://reviews.freebsd.org/D18625 --- lib/libc/tests/sys/Makefile | 1 + lib/libc/tests/sys/sendfile_test.c | 1146 ++++++++++++++++++++++++++++ 2 files changed, 1147 insertions(+) create mode 100644 lib/libc/tests/sys/sendfile_test.c diff --git a/lib/libc/tests/sys/Makefile b/lib/libc/tests/sys/Makefile index 0dca18966313..72dc29b6b54a 100644 --- a/lib/libc/tests/sys/Makefile +++ b/lib/libc/tests/sys/Makefile @@ -8,6 +8,7 @@ PACKAGE= tests ATF_TESTS_C+= brk_test .endif ATF_TESTS_C+= queue_test +ATF_TESTS_C+= sendfile_test # TODO: clone, lwp_create, lwp_ctl, posix_fadvise, recvmmsg, # swapcontext diff --git a/lib/libc/tests/sys/sendfile_test.c b/lib/libc/tests/sys/sendfile_test.c new file mode 100644 index 000000000000..545f79d1c660 --- /dev/null +++ b/lib/libc/tests/sys/sendfile_test.c @@ -0,0 +1,1146 @@ +/*- + * Copyright (c) 2018 Enji Cooper. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +const char DETERMINISTIC_PATTERN[] = + "The past is already gone, the future is not yet here. There's only one moment for you to live.\n"; + +#define SOURCE_FILE "source" +#define DESTINATION_FILE "dest" + +#define PORTRANGE_FIRST "net.inet.ip.portrange.first" +#define PORTRANGE_LAST "net.inet.ip.portrange.last" + +static int portrange_first, portrange_last; + +static int +get_int_via_sysctlbyname(const char *oidname) +{ + size_t oldlen; + int int_value; + + ATF_REQUIRE_EQ_MSG(sysctlbyname(oidname, &int_value, &oldlen, NULL, 0), + 0, "sysctlbyname(%s, ...) failed: %s", oidname, strerror(errno)); + ATF_REQUIRE_EQ_MSG(sizeof(int_value), oldlen, "sanity check failed"); + + return (int_value); +} + +static int +generate_random_port(int seed) +{ + int random_port; + + printf("Generating a random port with seed=%d\n", seed); + if (portrange_first == 0) { + portrange_first = get_int_via_sysctlbyname(PORTRANGE_FIRST); + printf("Port range lower bound: %d\n", portrange_first); + } + + if (portrange_last == 0) { + portrange_last = get_int_via_sysctlbyname(PORTRANGE_LAST); + printf("Port range upper bound: %d\n", portrange_last); + } + + srand((unsigned)seed); + + random_port = rand() % (portrange_last - portrange_first) + + portrange_first; + + printf("Random port generated: %d\n", random_port); + return (random_port); +} + +static void +resolve_localhost(struct addrinfo **res, int domain, int type, int port) +{ + char *serv; + struct addrinfo hints; + int error; + + ATF_REQUIRE_MSG(domain == AF_INET || domain == AF_INET6, + "unhandled domain: %d", domain); + + ATF_REQUIRE_MSG(asprintf(&serv, "%d", port) >= 0, + "asprintf failed: %s", strerror(errno)); + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = domain; + hints.ai_flags = AI_ADDRCONFIG|AI_NUMERICSERV; + hints.ai_socktype = type; + + error = getaddrinfo("localhost", serv, &hints, res); + ATF_REQUIRE_EQ_MSG(error, 0, + "getaddrinfo failed: %s", gai_strerror(errno)); + free(serv); +} + +static int +make_socket(int domain, int type, int protocol) +{ + int sock; + + sock = socket(domain, type, protocol); + ATF_REQUIRE_MSG(sock != -1, "socket(%d, %d, 0) failed: %s", + domain, type, strerror(errno)); + + return (sock); +} + +static int +setup_client(int domain, int type, int port) +{ + struct addrinfo *res; + char host[NI_MAXHOST+1]; + int error, sock; + + resolve_localhost(&res, domain, type, port); + error = getnameinfo( + (const struct sockaddr*)res->ai_addr, res->ai_addrlen, + host, nitems(host) - 1, NULL, 0, NI_NUMERICHOST); + ATF_REQUIRE_EQ_MSG(error, 0, + "getnameinfo failed: %s", gai_strerror(error)); + printf( + "Will try to connect to host='%s', address_family=%d, " + "socket_type=%d\n", + host, res->ai_family, res->ai_socktype); + sock = make_socket(res->ai_family, res->ai_socktype, res->ai_protocol); + error = connect(sock, (struct sockaddr*)res->ai_addr, res->ai_addrlen); + freeaddrinfo(res); + ATF_REQUIRE_EQ_MSG(error, 0, "connect failed: %s", strerror(errno)); + return (sock); +} + +/* + * XXX: use linear probing to find a free port and eliminate `port` argument as + * a [const] int (it will need to be a pointer so it can be passed back out of + * the function and can influence which port `setup_client(..)` connects on. + */ +static int +setup_server(int domain, int type, int port) +{ + struct addrinfo *res; + char host[NI_MAXHOST+1]; + int error, sock; + + resolve_localhost(&res, domain, type, port); + sock = make_socket(res->ai_family, res->ai_socktype, res->ai_protocol); + + error = getnameinfo( + (const struct sockaddr*)res->ai_addr, res->ai_addrlen, + host, nitems(host) - 1, NULL, 0, NI_NUMERICHOST); + ATF_REQUIRE_EQ_MSG(error, 0, + "getnameinfo failed: %s", gai_strerror(error)); + printf( + "Will try to bind socket to host='%s', address_family=%d, " + "socket_type=%d\n", + host, res->ai_family, res->ai_socktype); + error = bind(sock, res->ai_addr, res->ai_addrlen); + freeaddrinfo(res); + ATF_REQUIRE_EQ_MSG(error, 0, "bind failed: %s", strerror(errno)); + error = listen(sock, 1); + ATF_REQUIRE_EQ_MSG(error, 0, "listen failed: %s", strerror(errno)); + + return (sock); +} + +/* + * This function is a helper routine for taking data being sent by `sendfile` via + * `server_sock`, and pushing the received stream out to a file, denoted by + * `dest_filename`. + */ +static void +server_cat(const char *dest_filename, int server_sock, size_t len) +{ + void *buffer; + int recv_sock; + ssize_t received_bytes; + + buffer = calloc(len + 1, sizeof(char)); + if (buffer == NULL) + err(1, "malloc failed"); + + recv_sock = accept(server_sock, NULL, 0); + if (recv_sock == -1) + err(1, "accept failed"); + + /* + * XXX: this assumes the simplest case where all data is received in a + * single recv(2) call. + */ + if (recv(recv_sock, buffer, len, 0) == -1) + err(1, "recv failed"); + + atf_utils_create_file(dest_filename, "%s", buffer); + + /* + * This recv(2) call helps ensure the amount of sent data is exactly + * what was specified by `len`. + */ + received_bytes = recv(recv_sock, buffer, len, 0); + switch (received_bytes) { + case -1: + err(1, "recv failed"); + case 0: + break; + default: + errx(1, "received unexpected data: %s", buffer); + } + + (void)close(recv_sock); + (void)close(server_sock); + free(buffer); +} + +static int +setup_tcp_server(int domain, int port) +{ + + return (setup_server(domain, SOCK_STREAM, port)); +} + +static int +setup_tcp_client(int domain, int port) +{ + + return (setup_client(domain, SOCK_STREAM, port)); +} + +static off_t +file_size_from_fd(int fd) +{ + struct stat st; + + ATF_REQUIRE_EQ_MSG(0, fstat(fd, &st), + "fstat failed: %s", strerror(errno)); + + return (st.st_size); +} + +/* + * NB: `nbytes` == 0 has special connotations given the sendfile(2) API + * contract. In short, "send the whole file" (paraphrased). + */ +static void +verify_source_and_dest(const char* dest_filename, int src_fd, off_t offset, + size_t nbytes) +{ + void *dest_pointer, *src_pointer; + off_t dest_file_size, src_file_size; + size_t length; + int dest_fd; + + atf_utils_cat_file(dest_filename, "dest_file: "); + + dest_fd = open(dest_filename, O_RDONLY); + ATF_REQUIRE_MSG(dest_fd != -1, "open failed"); + + dest_file_size = file_size_from_fd(dest_fd); + src_file_size = file_size_from_fd(src_fd); + + /* + * Per sendfile(2), "send the whole file" (paraphrased). This means + * that we need to grab the file size, as passing in length = 0 with + * mmap(2) will result in a failure with EINVAL (length = 0 is invalid). + */ + length = (nbytes == 0) ? (size_t)(src_file_size - offset) : nbytes; + + ATF_REQUIRE_EQ_MSG(dest_file_size, length, + "number of bytes written out to %s (%ju) doesn't match the " + "expected number of bytes (%ju)", dest_filename, dest_file_size, + length); + + ATF_REQUIRE_EQ_MSG(0, lseek(src_fd, offset, SEEK_SET), + "lseek failed: %s", strerror(errno)); + + dest_pointer = mmap(NULL, length, PROT_READ, MAP_PRIVATE, dest_fd, 0); + ATF_REQUIRE_MSG(dest_pointer != MAP_FAILED, "mmap failed: %s", + strerror(errno)); + + printf("Will mmap in the source file from offset=%jd to length=%zu\n", + offset, length); + + src_pointer = mmap(NULL, length, PROT_READ, MAP_PRIVATE, src_fd, offset); + ATF_REQUIRE_MSG(src_pointer != MAP_FAILED, "mmap failed: %s", + strerror(errno)); + + ATF_REQUIRE_EQ_MSG(0, memcmp(src_pointer, dest_pointer, length), + "Contents of source and destination do not match. '%s' != '%s'", + src_pointer, dest_pointer); + + (void)munmap(src_pointer, length); + (void)munmap(dest_pointer, length); + (void)close(dest_fd); +} + +static void +fd_positive_file_test(int domain) +{ + off_t offset; + size_t nbytes, pattern_size; + int client_sock, error, fd, port, server_sock; + pid_t server_pid; + + pattern_size = strlen(DETERMINISTIC_PATTERN); + + atf_utils_create_file(SOURCE_FILE, "%s", DETERMINISTIC_PATTERN); + fd = open(SOURCE_FILE, O_RDONLY); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); + + port = generate_random_port(__LINE__ + domain); + server_sock = setup_tcp_server(domain, port); + client_sock = setup_tcp_client(domain, port); + + server_pid = atf_utils_fork(); + if (server_pid == 0) { + (void)close(client_sock); + server_cat(DESTINATION_FILE, server_sock, pattern_size); + _exit(0); + } else + (void)close(server_sock); + + nbytes = 0; + offset = 0; + error = sendfile(fd, client_sock, offset, nbytes, NULL, NULL, + SF_FLAGS(0, 0)); + ATF_REQUIRE_EQ_MSG(0, error, "sendfile failed: %s", strerror(errno)); + (void)close(client_sock); + + atf_utils_wait(server_pid, 0, "", ""); + verify_source_and_dest(DESTINATION_FILE, fd, offset, nbytes); + + (void)close(fd); +} + +ATF_TC(fd_positive_file_v4); +ATF_TC_HEAD(fd_positive_file_v4, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify regular file as file descriptor support (IPv4)"); +} +ATF_TC_BODY(fd_positive_file_v4, tc) +{ + + fd_positive_file_test(AF_INET); +} + +ATF_TC(fd_positive_file_v6); +ATF_TC_HEAD(fd_positive_file_v6, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify regular file as file descriptor support (IPv6)"); +} +ATF_TC_BODY(fd_positive_file_v6, tc) +{ + + fd_positive_file_test(AF_INET6); +} + +static void +fd_positive_shm_test(int domain) +{ + void *shm_pointer; + off_t offset; + size_t nbytes, pattern_size; + pid_t server_pid; + int client_sock, error, fd, port, server_sock; + + pattern_size = strlen(DETERMINISTIC_PATTERN); + + printf("pattern size: %zu\n", pattern_size); + + fd = shm_open(SHM_ANON, O_RDWR|O_CREAT, 0600); + ATF_REQUIRE_MSG(fd != -1, "shm_open failed: %s", strerror(errno)); + ATF_REQUIRE_EQ_MSG(0, ftruncate(fd, pattern_size), + "ftruncate failed: %s", strerror(errno)); + shm_pointer = mmap(NULL, pattern_size, PROT_READ|PROT_WRITE, + MAP_SHARED, fd, 0); + ATF_REQUIRE_MSG(shm_pointer != MAP_FAILED, + "mmap failed: %s", strerror(errno)); + memcpy(shm_pointer, DETERMINISTIC_PATTERN, pattern_size); + ATF_REQUIRE_EQ_MSG(0, + memcmp(shm_pointer, DETERMINISTIC_PATTERN, pattern_size), + "memcmp showed data mismatch: '%s' != '%s'", + DETERMINISTIC_PATTERN, shm_pointer); + + port = generate_random_port(__LINE__ + domain); + server_sock = setup_tcp_server(domain, port); + client_sock = setup_tcp_client(domain, port); + + server_pid = atf_utils_fork(); + if (server_pid == 0) { + (void)close(client_sock); + server_cat(DESTINATION_FILE, server_sock, pattern_size); + _exit(0); + } else + (void)close(server_sock); + + nbytes = 0; + offset = 0; + error = sendfile(fd, client_sock, offset, nbytes, NULL, NULL, + SF_FLAGS(0, 0)); + ATF_REQUIRE_EQ_MSG(0, error, "sendfile failed: %s", strerror(errno)); + (void)close(client_sock); + + atf_utils_wait(server_pid, 0, "", ""); + verify_source_and_dest(DESTINATION_FILE, fd, offset, nbytes); + + (void)munmap(shm_pointer, sizeof(DETERMINISTIC_PATTERN)); + (void)close(fd); +} + +ATF_TC(fd_positive_shm_v4); +ATF_TC_HEAD(fd_positive_shm_v4, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify shared memory as file descriptor support (IPv4)"); +} +ATF_TC_BODY(fd_positive_shm_v4, tc) +{ + + fd_positive_shm_test(AF_INET); +} + +ATF_TC(fd_positive_shm_v6); +ATF_TC_HEAD(fd_positive_shm_v6, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify shared memory as file descriptor support (IPv6))"); +} +ATF_TC_BODY(fd_positive_shm_v6, tc) +{ + + fd_positive_shm_test(AF_INET6); +} + +static void +fd_negative_bad_fd_test(int domain) +{ + int client_sock, error, fd, port, server_sock; + + port = generate_random_port(__LINE__ + domain); + server_sock = setup_tcp_server(domain, port); + client_sock = setup_tcp_client(domain, port); + + fd = -1; + + error = sendfile(fd, client_sock, 0, 0, NULL, NULL, SF_FLAGS(0, 0)); + ATF_REQUIRE_ERRNO(EBADF, error == -1); + + (void)close(client_sock); + (void)close(server_sock); +} + +ATF_TC(fd_negative_bad_fd_v4); +ATF_TC_HEAD(fd_negative_bad_fd_v4, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify bad file descriptor returns EBADF (IPv4)"); +} +ATF_TC_BODY(fd_negative_bad_fd_v4, tc) +{ + + fd_negative_bad_fd_test(AF_INET); +} + +ATF_TC(fd_negative_bad_fd_v6); +ATF_TC_HEAD(fd_negative_bad_fd_v6, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify bad file descriptor returns EBADF (IPv6)"); +} +ATF_TC_BODY(fd_negative_bad_fd_v6, tc) +{ + + fd_negative_bad_fd_test(AF_INET6); +} + +static void +flags_test(int domain) +{ + off_t offset; + size_t nbytes, pattern_size; + int client_sock, error, fd, i, port, server_sock; + pid_t server_pid; + int16_t number_pages = 10; + + pattern_size = strlen(DETERMINISTIC_PATTERN); + + struct testcase { + int16_t readahead_pages, flags; + } testcases[] = { + /* This is covered in `:fd_positive_file` */ +#if 0 + { + .readahead_pages = 0, + .flags = 0 + }, +#endif + { + .readahead_pages = 0, + .flags = SF_NOCACHE + }, +#ifdef SF_USER_READAHEAD + { + .readahead_pages = 0, + .flags = SF_NOCACHE|SF_USER_READAHEAD + }, + { + .readahead_pages = 0, + .flags = SF_USER_READAHEAD + }, +#endif + { + .readahead_pages = number_pages, + .flags = 0 + }, + { + .readahead_pages = number_pages, + .flags = SF_NOCACHE + }, +#ifdef SF_USER_READAHEAD + { + .readahead_pages = number_pages, + .flags = SF_NOCACHE|SF_USER_READAHEAD + }, +#endif + { + .readahead_pages = number_pages, + .flags = SF_NOCACHE + }, + { + .readahead_pages = number_pages, + .flags = SF_NODISKIO + } + }; + + atf_utils_create_file(SOURCE_FILE, "%s", DETERMINISTIC_PATTERN); + for (i = 0; i < nitems(testcases); i++) { + fd = open(SOURCE_FILE, O_RDONLY); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); + + port = generate_random_port(i * __LINE__ + domain); + server_sock = setup_tcp_server(domain, port); + client_sock = setup_tcp_client(domain, port); + + server_pid = atf_utils_fork(); + if (server_pid == 0) { + (void)close(client_sock); + server_cat(DESTINATION_FILE, server_sock, pattern_size); + _exit(0); + } else + (void)close(server_sock); + + nbytes = 0; + offset = 0; + error = sendfile(fd, client_sock, offset, nbytes, NULL, NULL, + SF_FLAGS(testcases[i].readahead_pages, testcases[i].flags)); + ATF_CHECK_EQ_MSG(error, 0, "sendfile testcase #%d failed: %s", + i, strerror(errno)); + (void)close(client_sock); + + atf_utils_wait(server_pid, 0, "", ""); + verify_source_and_dest(DESTINATION_FILE, fd, offset, nbytes); + + (void)close(fd); + } +} + +ATF_TC(flags_v4); +ATF_TC_HEAD(flags_v4, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Verify flags functionality (IPv4)"); +} +ATF_TC_BODY(flags_v4, tc) +{ + + flags_test(AF_INET); +} + +ATF_TC(flags_v6); +ATF_TC_HEAD(flags_v6, tc) +{ + + atf_tc_set_md_var(tc, "descr", "Verify flags functionality (IPv6)"); +} +ATF_TC_BODY(flags_v6, tc) +{ + + flags_test(AF_INET6); +} + +static void +hdtr_positive_test(int domain) +{ + struct iovec headers[1], trailers[1]; + struct testcase { + bool include_headers, include_trailers; + } testcases[] = { + /* This is covered in `:fd_positive_file` */ +#if 0 + { + .include_headers = false, + .include_trailers = false + }, +#endif + { + .include_headers = true, + .include_trailers = false + }, + { + .include_headers = false, + .include_trailers = true + }, + { + .include_headers = true, + .include_trailers = true + } + }; + off_t offset; + size_t nbytes; + int client_sock, error, fd, fd2, i, port, rc, server_sock; + pid_t server_pid; + + headers[0].iov_base = "This is a header"; + headers[0].iov_len = strlen(headers[0].iov_base); + trailers[0].iov_base = "This is a trailer"; + trailers[0].iov_len = strlen(trailers[0].iov_base); + offset = 0; + nbytes = 0; + + atf_tc_expect_fail( + "The header/trailer testcases fail today with a data mismatch; " + "bug # 234809"); + + for (i = 0; i < nitems(testcases); i++) { + struct sf_hdtr hdtr; + char *pattern; + + if (testcases[i].include_headers) { + hdtr.headers = headers; + hdtr.hdr_cnt = nitems(headers); + } else { + hdtr.headers = NULL; + hdtr.hdr_cnt = 0; + } + + if (testcases[i].include_trailers) { + hdtr.trailers = trailers; + hdtr.trl_cnt = nitems(trailers); + } else { + hdtr.trailers = NULL; + hdtr.trl_cnt = 0; + } + + port = generate_random_port(i * __LINE__ + domain); + server_sock = setup_tcp_server(domain, port); + client_sock = setup_tcp_client(domain, port); + + rc = asprintf(&pattern, "%s%s%s", + testcases[i].include_headers ? headers[0].iov_base : "", + DETERMINISTIC_PATTERN, + testcases[i].include_trailers ? trailers[0].iov_base : ""); + ATF_REQUIRE_MSG(rc != -1, "asprintf failed: %s", strerror(errno)); + + atf_utils_create_file(SOURCE_FILE ".full", "%s", pattern); + atf_utils_create_file(SOURCE_FILE, "%s", DETERMINISTIC_PATTERN); + + fd = open(SOURCE_FILE, O_RDONLY); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); + + fd2 = open(SOURCE_FILE ".full", O_RDONLY); + ATF_REQUIRE_MSG(fd2 != -1, "open failed: %s", strerror(errno)); + + server_pid = atf_utils_fork(); + if (server_pid == 0) { + (void)close(client_sock); + server_cat(DESTINATION_FILE, server_sock, + strlen(pattern)); + _exit(0); + } else + (void)close(server_sock); + + error = sendfile(fd, client_sock, offset, nbytes, &hdtr, + NULL, SF_FLAGS(0, 0)); + ATF_CHECK_EQ_MSG(error, 0, "sendfile testcase #%d failed: %s", + i, strerror(errno)); + (void)close(client_sock); + + atf_utils_wait(server_pid, 0, "", ""); + verify_source_and_dest(DESTINATION_FILE, fd2, offset, nbytes); + + (void)close(fd); + (void)close(fd2); + free(pattern); + pattern = NULL; + } +} + +ATF_TC(hdtr_positive_v4); +ATF_TC_HEAD(hdtr_positive_v4, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify positive hdtr functionality (IPv4)"); +} +ATF_TC_BODY(hdtr_positive_v4, tc) +{ + + hdtr_positive_test(AF_INET); +} + +ATF_TC(hdtr_positive_v6); +ATF_TC_HEAD(hdtr_positive_v6, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify positive hdtr functionality (IPv6)"); +} +ATF_TC_BODY(hdtr_positive_v6, tc) +{ + + hdtr_positive_test(AF_INET); +} + +static void +hdtr_negative_bad_pointers_test(int domain) +{ + int client_sock, error, fd, port, server_sock; + struct sf_hdtr *hdtr1, hdtr2, hdtr3; + + port = generate_random_port(__LINE__ + domain); + + hdtr1 = (struct sf_hdtr*)-1; + + memset(&hdtr2, 0, sizeof(hdtr2)); + hdtr2.hdr_cnt = 1; + hdtr2.headers = (struct iovec*)-1; + + memset(&hdtr3, 0, sizeof(hdtr3)); + hdtr3.trl_cnt = 1; + hdtr3.trailers = (struct iovec*)-1; + + fd = open(SOURCE_FILE, O_CREAT|O_RDWR); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); + + server_sock = setup_tcp_server(domain, port); + client_sock = setup_tcp_client(domain, port); + + error = sendfile(fd, client_sock, 0, 0, hdtr1, NULL, SF_FLAGS(0, 0)); + ATF_CHECK_ERRNO(EFAULT, error == -1); + + error = sendfile(fd, client_sock, 0, 0, &hdtr2, NULL, SF_FLAGS(0, 0)); + ATF_CHECK_ERRNO(EFAULT, error == -1); + + error = sendfile(fd, client_sock, 0, 0, &hdtr3, NULL, SF_FLAGS(0, 0)); + ATF_CHECK_ERRNO(EFAULT, error == -1); + + (void)close(fd); + (void)close(client_sock); + (void)close(server_sock); +} + +ATF_TC(hdtr_negative_bad_pointers_v4); +ATF_TC_HEAD(hdtr_negative_bad_pointers_v4, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify that bad pointers for hdtr storage result in EFAULT (IPv4)"); +} +ATF_TC_BODY(hdtr_negative_bad_pointers_v4, tc) +{ + + hdtr_negative_bad_pointers_test(AF_INET); +} + +ATF_TC(hdtr_negative_bad_pointers_v6); +ATF_TC_HEAD(hdtr_negative_bad_pointers_v6, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify that bad pointers for hdtr storage result in EFAULT (IPv6)"); +} +ATF_TC_BODY(hdtr_negative_bad_pointers_v6, tc) +{ + + hdtr_negative_bad_pointers_test(AF_INET6); +} + +static void +offset_negative_value_less_than_zero_test(int domain) +{ + int client_sock, error, fd, port, server_sock; + + port = generate_random_port(__LINE__ + domain); + server_sock = setup_tcp_server(domain, port); + client_sock = setup_tcp_client(domain, port); + + fd = open(SOURCE_FILE, O_CREAT|O_RDWR); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); + + error = sendfile(fd, client_sock, -1, 0, NULL, NULL, SF_FLAGS(0, 0)); + ATF_REQUIRE_ERRNO(EINVAL, error == -1); + + (void)close(fd); + (void)close(client_sock); + (void)close(server_sock); +} + +ATF_TC(offset_negative_value_less_than_zero_v4); +ATF_TC_HEAD(offset_negative_value_less_than_zero_v4, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify that a negative offset results in EINVAL (IPv4)"); +} +ATF_TC_BODY(offset_negative_value_less_than_zero_v4, tc) +{ + + offset_negative_value_less_than_zero_test(AF_INET); +} + +ATF_TC(offset_negative_value_less_than_zero_v6); +ATF_TC_HEAD(offset_negative_value_less_than_zero_v6, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify that a negative offset results in EINVAL (IPv6)"); +} +ATF_TC_BODY(offset_negative_value_less_than_zero_v6, tc) +{ + + offset_negative_value_less_than_zero_test(AF_INET6); +} + +static void +sbytes_positive_test(int domain) +{ + size_t pattern_size = strlen(DETERMINISTIC_PATTERN); + off_t sbytes; + int client_sock, error, fd, port, server_sock; + + port = generate_random_port(__LINE__ + domain); + server_sock = setup_tcp_server(domain, port); + client_sock = setup_tcp_client(domain, port); + + atf_utils_create_file(SOURCE_FILE, "%s", DETERMINISTIC_PATTERN); + fd = open(SOURCE_FILE, O_RDONLY); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); + + error = sendfile(fd, client_sock, 0, 0, NULL, &sbytes, SF_FLAGS(0, 0)); + ATF_CHECK_EQ_MSG(error, 0, "sendfile failed: %s", strerror(errno)); + + (void)close(fd); + (void)close(client_sock); + (void)close(server_sock); + + ATF_CHECK_EQ_MSG(pattern_size, sbytes, + "the value returned by sbytes does not match the expected pattern " + "size"); +} + +ATF_TC(sbytes_positive_v4); +ATF_TC_HEAD(sbytes_positive_v4, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify positive `sbytes` functionality (IPv4)"); +} +ATF_TC_BODY(sbytes_positive_v4, tc) +{ + + sbytes_positive_test(AF_INET); +} + +ATF_TC(sbytes_positive_v6); +ATF_TC_HEAD(sbytes_positive_v6, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify positive `sbytes` functionality (IPv6)"); +} +ATF_TC_BODY(sbytes_positive_v6, tc) +{ + + sbytes_positive_test(AF_INET6); +} + +static void +sbytes_negative_test(int domain) +{ + off_t *sbytes_p = (off_t*)-1; + int client_sock, error, fd, port, server_sock; + + port = generate_random_port(__LINE__ + domain); + server_sock = setup_tcp_server(domain, port); + client_sock = setup_tcp_client(domain, port); + + atf_utils_create_file(SOURCE_FILE, "%s", DETERMINISTIC_PATTERN); + fd = open(SOURCE_FILE, O_RDONLY); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); + + atf_tc_expect_fail( + "bug 232210: EFAULT assert fails because copyout(9) call is not checked"); + + error = sendfile(fd, client_sock, 0, 0, NULL, sbytes_p, SF_FLAGS(0, 0)); + ATF_REQUIRE_ERRNO(EFAULT, error == -1); + + (void)close(fd); + (void)close(client_sock); + (void)close(server_sock); +} + +ATF_TC(sbytes_negative_v4); +ATF_TC_HEAD(sbytes_negative_v4, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify negative `sbytes` functionality (IPv4)"); +} +ATF_TC_BODY(sbytes_negative_v4, tc) +{ + + sbytes_negative_test(AF_INET); +} + +ATF_TC(sbytes_negative_v6); +ATF_TC_HEAD(sbytes_negative_v6, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify negative `sbytes` functionality (IPv6)"); +} +ATF_TC_BODY(sbytes_negative_v6, tc) +{ + + sbytes_negative_test(AF_INET6); +} + +static void +s_negative_not_connected_socket_test(int domain) +{ + int client_sock, error, fd, port; + + port = generate_random_port(__LINE__ + domain); + client_sock = setup_tcp_server(domain, port); + + fd = open(SOURCE_FILE, O_CREAT|O_RDWR); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); + + error = sendfile(fd, client_sock, 0, 0, NULL, NULL, SF_FLAGS(0, 0)); + ATF_REQUIRE_ERRNO(ENOTCONN, error == -1); + + (void)close(fd); + (void)close(client_sock); +} + +ATF_TC(s_negative_not_connected_socket_v4); +ATF_TC_HEAD(s_negative_not_connected_socket_v4, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify that a non-connected SOCK_STREAM socket results in ENOTCONN (IPv4)"); +} + +ATF_TC_BODY(s_negative_not_connected_socket_v4, tc) +{ + + s_negative_not_connected_socket_test(AF_INET); +} + +ATF_TC(s_negative_not_connected_socket_v6); +ATF_TC_HEAD(s_negative_not_connected_socket_v6, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify that a non-connected SOCK_STREAM socket results in ENOTCONN (IPv6)"); +} + +ATF_TC_BODY(s_negative_not_connected_socket_v6, tc) +{ + + s_negative_not_connected_socket_test(AF_INET6); +} + +ATF_TC(s_negative_not_descriptor); +ATF_TC_HEAD(s_negative_not_descriptor, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify that an invalid file descriptor, e.g., -1, fails with EBADF"); +} + +ATF_TC_BODY(s_negative_not_descriptor, tc) +{ + int client_sock, error, fd; + + client_sock = -1; + + fd = open(SOURCE_FILE, O_CREAT|O_RDWR); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); + + error = sendfile(fd, client_sock, 0, 0, NULL, NULL, SF_FLAGS(0, 0)); + ATF_REQUIRE_ERRNO(EBADF, error == -1); + + (void)close(fd); +} + +ATF_TC(s_negative_not_socket_file_descriptor); +ATF_TC_HEAD(s_negative_not_socket_file_descriptor, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify that a non-socket file descriptor fails with ENOTSOCK"); +} + +ATF_TC_BODY(s_negative_not_socket_file_descriptor, tc) +{ + int client_sock, error, fd; + + fd = open(SOURCE_FILE, O_CREAT|O_RDWR); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); + + client_sock = open(_PATH_DEVNULL, O_WRONLY); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); + + error = sendfile(fd, client_sock, 0, 0, NULL, NULL, SF_FLAGS(0, 0)); + ATF_REQUIRE_ERRNO(ENOTSOCK, error == -1); + + (void)close(fd); + (void)close(client_sock); +} + +static void +s_negative_udp_socket_test(int domain) +{ + int client_sock, error, fd, port; + + port = generate_random_port(__LINE__ + domain); + client_sock = setup_client(domain, SOCK_DGRAM, port); + + fd = open(SOURCE_FILE, O_CREAT|O_RDWR); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); + + error = sendfile(fd, client_sock, 0, 0, NULL, NULL, SF_FLAGS(0, 0)); + ATF_REQUIRE_ERRNO(EINVAL, error == -1); + + (void)close(fd); + (void)close(client_sock); +} + +ATF_TC(s_negative_udp_socket_v4); +ATF_TC_HEAD(s_negative_udp_socket_v4, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify that a non-SOCK_STREAM type socket results in EINVAL (IPv4)"); +} +ATF_TC_BODY(s_negative_udp_socket_v4, tc) +{ + + s_negative_udp_socket_test(AF_INET); +} + +ATF_TC(s_negative_udp_socket_v6); +ATF_TC_HEAD(s_negative_udp_socket_v6, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Verify that a non-SOCK_STREAM type socket results in EINVAL (IPv6)"); +} +ATF_TC_BODY(s_negative_udp_socket_v6, tc) +{ + + s_negative_udp_socket_test(AF_INET6); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, fd_positive_file_v4); + ATF_TP_ADD_TC(tp, fd_positive_file_v6); + ATF_TP_ADD_TC(tp, fd_positive_shm_v4); + ATF_TP_ADD_TC(tp, fd_positive_shm_v6); + ATF_TP_ADD_TC(tp, fd_negative_bad_fd_v4); + ATF_TP_ADD_TC(tp, fd_negative_bad_fd_v6); + ATF_TP_ADD_TC(tp, flags_v4); + ATF_TP_ADD_TC(tp, flags_v6); + /* + * TODO: the negative case for SF_NODISKIO (returns EBUSY if file in + * use) is not covered yet. + * + * Need to lock a file in a subprocess in write mode, then try and + * send the data in read mode with sendfile. + * + * This should work with FFS/UFS, but there are no guarantees about + * other filesystem implementations of sendfile(2), e.g., ZFS. + */ + ATF_TP_ADD_TC(tp, hdtr_positive_v4); + ATF_TP_ADD_TC(tp, hdtr_positive_v6); + ATF_TP_ADD_TC(tp, hdtr_negative_bad_pointers_v4); + ATF_TP_ADD_TC(tp, hdtr_negative_bad_pointers_v6); + ATF_TP_ADD_TC(tp, offset_negative_value_less_than_zero_v4); + ATF_TP_ADD_TC(tp, offset_negative_value_less_than_zero_v6); + ATF_TP_ADD_TC(tp, sbytes_positive_v4); + ATF_TP_ADD_TC(tp, sbytes_positive_v6); + ATF_TP_ADD_TC(tp, sbytes_negative_v4); + ATF_TP_ADD_TC(tp, sbytes_negative_v6); + ATF_TP_ADD_TC(tp, s_negative_not_connected_socket_v4); + ATF_TP_ADD_TC(tp, s_negative_not_connected_socket_v6); + ATF_TP_ADD_TC(tp, s_negative_not_descriptor); + ATF_TP_ADD_TC(tp, s_negative_not_socket_file_descriptor); + ATF_TP_ADD_TC(tp, s_negative_udp_socket_v4); + ATF_TP_ADD_TC(tp, s_negative_udp_socket_v6); + + return (atf_no_error()); +} From c06cc56e3940ef36bca0f9163decf258766b52e2 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 23 Jan 2019 22:18:23 +0000 Subject: [PATCH 017/142] Fix an LLE lookup race. After the afdata read lock was converted to epoch(9), readers could observe a linked LLE and block on the LLE while a thread was unlinking the LLE. The writer would then release the lock and schedule the LLE for deferred free, allowing readers to continue and potentially schedule the LLE timer. By the point the timer fires, the structure is freed, typically resulting in a crash in the callout subsystem. Fix the problem by modifying the lookup path to check for the LLE_LINKED flag upon acquiring the LLE lock. If it's not set, the lookup fails. PR: 234296 Reviewed by: bz Tested by: sbruno, Victor , Mike Andrews MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18906 --- sys/netinet/in.c | 11 +++++++++++ sys/netinet6/in6.c | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 094ee7c9eb3a..7970288799bb 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1399,6 +1399,17 @@ in_lltable_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3add else LLE_RLOCK(lle); + /* + * If the afdata lock is not held, the LLE may have been unlinked while + * we were blocked on the LLE lock. Check for this case. + */ + if (__predict_false((lle->la_flags & LLE_LINKED) == 0)) { + if (flags & LLE_EXCLUSIVE) + LLE_WUNLOCK(lle); + else + LLE_RUNLOCK(lle); + return (NULL); + } return (lle); } diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 0f34397a15f7..57fa87b38635 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -2342,6 +2342,18 @@ in6_lltable_lookup(struct lltable *llt, u_int flags, LLE_WLOCK(lle); else LLE_RLOCK(lle); + + /* + * If the afdata lock is not held, the LLE may have been unlinked while + * we were blocked on the LLE lock. Check for this case. + */ + if (__predict_false((lle->la_flags & LLE_LINKED) == 0)) { + if (flags & LLE_EXCLUSIVE) + LLE_WUNLOCK(lle); + else + LLE_RUNLOCK(lle); + return (NULL); + } return (lle); } From 49cf58e55976ac13245e278324b02d592fc6de14 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 23 Jan 2019 22:19:49 +0000 Subject: [PATCH 018/142] Style. Reviewed by: bz MFC after: 3 days Sponsored by: The FreeBSD Foundation --- sys/netinet/in.c | 10 ++++------ sys/netinet6/in6.c | 9 +++------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 7970288799bb..b115885960fe 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1382,15 +1382,13 @@ in_lltable_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3add IF_AFDATA_LOCK_ASSERT(llt->llt_ifp); KASSERT(l3addr->sa_family == AF_INET, ("sin_family %d", l3addr->sa_family)); - lle = in_lltable_find_dst(llt, sin->sin_addr); + KASSERT((flags & (LLE_UNLOCKED | LLE_EXCLUSIVE)) != + (LLE_UNLOCKED | LLE_EXCLUSIVE), + ("wrong lle request flags: %#x", flags)); + lle = in_lltable_find_dst(llt, sin->sin_addr); if (lle == NULL) return (NULL); - - KASSERT((flags & (LLE_UNLOCKED|LLE_EXCLUSIVE)) != - (LLE_UNLOCKED|LLE_EXCLUSIVE),("wrong lle request flags: 0x%X", - flags)); - if (flags & LLE_UNLOCKED) return (lle); diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 57fa87b38635..0497f87acb8a 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -2325,16 +2325,13 @@ in6_lltable_lookup(struct lltable *llt, u_int flags, IF_AFDATA_LOCK_ASSERT(llt->llt_ifp); KASSERT(l3addr->sa_family == AF_INET6, ("sin_family %d", l3addr->sa_family)); + KASSERT((flags & (LLE_UNLOCKED | LLE_EXCLUSIVE)) != + (LLE_UNLOCKED | LLE_EXCLUSIVE), + ("wrong lle request flags: %#x", flags)); lle = in6_lltable_find_dst(llt, &sin6->sin6_addr); - if (lle == NULL) return (NULL); - - KASSERT((flags & (LLE_UNLOCKED|LLE_EXCLUSIVE)) != - (LLE_UNLOCKED|LLE_EXCLUSIVE),("wrong lle request flags: 0x%X", - flags)); - if (flags & LLE_UNLOCKED) return (lle); From de00e09d82a9d4962f6d55d550562bd99d440914 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 23 Jan 2019 23:06:39 +0000 Subject: [PATCH 019/142] Unbreak the gcc build with sendfile_test after r343362 gcc 8.x is more pedantic than clang 7.x with format strings and the tests passed `void*` variables while supplying `%s` (which is technically incorrect). Make the affected `void*` variables use `char*` storage instead to address this issue, as the compiler will upcast the values to `char*`. MFC after: 1 month MFC with: r343362 Approved by: emaste (mentor; implicit) Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D18934 --- lib/libc/tests/sys/sendfile_test.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libc/tests/sys/sendfile_test.c b/lib/libc/tests/sys/sendfile_test.c index 545f79d1c660..b81b94da5e60 100644 --- a/lib/libc/tests/sys/sendfile_test.c +++ b/lib/libc/tests/sys/sendfile_test.c @@ -195,7 +195,7 @@ setup_server(int domain, int type, int port) static void server_cat(const char *dest_filename, int server_sock, size_t len) { - void *buffer; + char *buffer; int recv_sock; ssize_t received_bytes; @@ -268,7 +268,7 @@ static void verify_source_and_dest(const char* dest_filename, int src_fd, off_t offset, size_t nbytes) { - void *dest_pointer, *src_pointer; + char *dest_pointer, *src_pointer; off_t dest_file_size, src_file_size; size_t length; int dest_fd; @@ -384,7 +384,7 @@ ATF_TC_BODY(fd_positive_file_v6, tc) static void fd_positive_shm_test(int domain) { - void *shm_pointer; + char *shm_pointer; off_t offset; size_t nbytes, pattern_size; pid_t server_pid; @@ -687,9 +687,9 @@ hdtr_positive_test(int domain) client_sock = setup_tcp_client(domain, port); rc = asprintf(&pattern, "%s%s%s", - testcases[i].include_headers ? headers[0].iov_base : "", + testcases[i].include_headers ? (char *)headers[0].iov_base : "", DETERMINISTIC_PATTERN, - testcases[i].include_trailers ? trailers[0].iov_base : ""); + testcases[i].include_trailers ? (char *)trailers[0].iov_base : ""); ATF_REQUIRE_MSG(rc != -1, "asprintf failed: %s", strerror(errno)); atf_utils_create_file(SOURCE_FILE ".full", "%s", pattern); From dab031103052f34e9aadb6f5ec4cb4e0b026cc28 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Wed, 23 Jan 2019 23:25:42 +0000 Subject: [PATCH 020/142] Remove documentation for the nonexistant cred_update_thread(9). This was a tangential change submitted as part of D18930. Submitted by: jack@gandi.net --- share/man/man9/Makefile | 3 +-- share/man/man9/ucred.9 | 12 ++---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 28a636b146ce..3034c24c6adb 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -2095,8 +2095,7 @@ MLINKS+=timeout.9 callout.9 \ timeout.9 callout_stop.9 \ timeout.9 callout_when.9 \ timeout.9 untimeout.9 -MLINKS+=ucred.9 cred_update_thread.9 \ - ucred.9 crcopy.9 \ +MLINKS+=ucred.9 crcopy.9 \ ucred.9 crcopysafe.9 \ ucred.9 crdup.9 \ ucred.9 crfree.9 \ diff --git a/share/man/man9/ucred.9 b/share/man/man9/ucred.9 index afe4812d196c..44cbe00f5ef4 100644 --- a/share/man/man9/ucred.9 +++ b/share/man/man9/ucred.9 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 27, 2017 +.Dd January 23, 2019 .Dt UCRED 9 .Os .Sh NAME @@ -36,8 +36,7 @@ .Nm crfree , .Nm crcopy , .Nm crdup , -.Nm cru2x , -.Nm cred_update_thread +.Nm cru2x .Nd "functions related to user credentials" .Sh SYNOPSIS .In sys/param.h @@ -58,8 +57,6 @@ .Fn crsetgroups "struct ucred *cr" "int ngrp" "gid_t *groups" .Ft void .Fn cru2x "struct ucred *cr" "struct xucred *xcr" -.Ft void -.Fn cred_update_thread "struct thread *td" .Sh DESCRIPTION The .Nm @@ -147,11 +144,6 @@ the former (e.g., .Va cr_version ) . .Pp -The -.Fn cred_update_thread -function sets the credentials of -.Fa td -to that of its process, freeing its old credential if required. .Sh RETURN VALUES .Fn crget , .Fn crhold , From 8dd6af34bc505a74b742efb0502c111c21d7fb99 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 23 Jan 2019 23:30:55 +0000 Subject: [PATCH 021/142] Unbreak the build on architectures where size_t isn't synonymous with uintmax_t I should have used `%zu` instead of `%ju` with `size_t` types. MFC after: 1 month MFC with: r343362, r343365 Approved by: emaste (mentor; implicit) Reviewed by: asomers Pointyhat to: ngie Submitted by: asomers Differential Revision: https://reviews.freebsd.org/D18935 --- lib/libc/tests/sys/sendfile_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/tests/sys/sendfile_test.c b/lib/libc/tests/sys/sendfile_test.c index b81b94da5e60..cdcb82b395e0 100644 --- a/lib/libc/tests/sys/sendfile_test.c +++ b/lib/libc/tests/sys/sendfile_test.c @@ -289,8 +289,8 @@ verify_source_and_dest(const char* dest_filename, int src_fd, off_t offset, length = (nbytes == 0) ? (size_t)(src_file_size - offset) : nbytes; ATF_REQUIRE_EQ_MSG(dest_file_size, length, - "number of bytes written out to %s (%ju) doesn't match the " - "expected number of bytes (%ju)", dest_filename, dest_file_size, + "number of bytes written out to %s (%zu) doesn't match the " + "expected number of bytes (%zu)", dest_filename, dest_file_size, length); ATF_REQUIRE_EQ_MSG(0, lseek(src_fd, offset, SEEK_SET), From e190da54d3d3674806cb8831a62bebf7a2643e75 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 23 Jan 2019 23:48:57 +0000 Subject: [PATCH 022/142] Fix up r343367 I should have only changed the format qualifier with the `size_t` value, `length`, not the other [`off_t`] value, `dest_file_size`. MFC after: 1 month MFC with: r343362, r343365, r343367 Approved by: emaste (mentor; implicit) Reported by: gcc 8.x --- lib/libc/tests/sys/sendfile_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/tests/sys/sendfile_test.c b/lib/libc/tests/sys/sendfile_test.c index cdcb82b395e0..4443c049e7d2 100644 --- a/lib/libc/tests/sys/sendfile_test.c +++ b/lib/libc/tests/sys/sendfile_test.c @@ -289,7 +289,7 @@ verify_source_and_dest(const char* dest_filename, int src_fd, off_t offset, length = (nbytes == 0) ? (size_t)(src_file_size - offset) : nbytes; ATF_REQUIRE_EQ_MSG(dest_file_size, length, - "number of bytes written out to %s (%zu) doesn't match the " + "number of bytes written out to %s (%ju) doesn't match the " "expected number of bytes (%zu)", dest_filename, dest_file_size, length); From 088a0b27adb406c4ca6141145332145ed1765ff0 Mon Sep 17 00:00:00 2001 From: Eric Joyner Date: Thu, 24 Jan 2019 01:03:00 +0000 Subject: [PATCH 023/142] intel iflib drivers: correct initialization of tx_cidx_processed From Jake: In r341156 ("Fix first-packet completion", 2018-11-28) a hack to work around a delta calculation determining how many descriptors were used was added to ixl_isc_tx_credits_update_dwb. The same fix was also applied to the em and igb drivers in r340310, and to ix in r341156. The hack checked the case where prev and cur were equal, and then added one. This works, because by the time we do the delta check, we already know there is at least one packet available, so the delta should be at least one. However, it's not a complete fix, and as indicated by the comment is really a hack to work around the real bug. The real problem is that the first time that we transmit a packet, tx_cidx_processed will be set to point to the start of the ring. Ultimately, the credits_update function expects it to point to the *last* descriptor that was processed. Since we haven't yet processed any descriptors, pointing it to 0 results in this incorrect calculation. Fix the initialization code to have it point to the end of the ring instead. One way to think about this, is that we are setting the value to be one prior to the first available descriptor. Doing so, corrects the delta calculation in all cases. The original fix only works if the first packet has exactly one descriptor. Otherwise, we will report 1 less than the correct value. As part of this fix, also update the MPASS assertions to match the real expectations. First, ensure that prev is not equal to cur, since this should never happen. Second, remove the assertion about prev==0 || delta != 0. It looks like that originated from when the em driver was converted to iflib. It seems like it was supposed to ensure that delta was non-zero. However, because we originally returned 0 delta for the first calculation, the "prev == 0" was tacked on. Instead, replace this with a check that delta is greater than zero, after the correction necessary when the ring pointers wrap around. This new solution should fix the same bug as r341156 did, but in a more robust way. Submitted by: Jacob Keller Reviewed by: shurd@ Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D18545 --- sys/dev/e1000/em_txrx.c | 9 ++------- sys/dev/e1000/if_em.c | 10 +++++++++- sys/dev/e1000/igb_txrx.c | 9 ++------- sys/dev/ixgbe/if_ix.c | 3 ++- sys/dev/ixgbe/if_ixv.c | 8 +++++++- sys/dev/ixgbe/ix_txrx.c | 4 ++-- sys/dev/ixl/ixl_txrx.c | 21 ++++++++++++--------- 7 files changed, 36 insertions(+), 28 deletions(-) diff --git a/sys/dev/e1000/em_txrx.c b/sys/dev/e1000/em_txrx.c index 6b7d3ff41f03..458de96a7b9d 100644 --- a/sys/dev/e1000/em_txrx.c +++ b/sys/dev/e1000/em_txrx.c @@ -457,16 +457,11 @@ em_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear) prev = txr->tx_cidx_processed; ntxd = scctx->isc_ntxd[0]; do { + MPASS(prev != cur); delta = (int32_t)cur - (int32_t)prev; - /* - * XXX This appears to be a hack for first-packet. - * A correct fix would prevent prev == cur in the first place. - */ - MPASS(prev == 0 || delta != 0); - if (prev == 0 && cur == 0) - delta += 1; if (delta < 0) delta += ntxd; + MPASS(delta > 0); DPRINTF(iflib_get_dev(adapter->ctx), "%s: cidx_processed=%u cur=%u clear=%d delta=%d\n", __FUNCTION__, prev, cur, clear, delta); diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 5ebc3cad4ca3..388a0bac53b5 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1208,6 +1208,7 @@ static void em_if_init(if_ctx_t ctx) { struct adapter *adapter = iflib_get_softc(ctx); + if_softc_ctx_t scctx = adapter->shared; struct ifnet *ifp = iflib_get_ifp(ctx); struct em_tx_queue *tx_que; int i; @@ -1240,7 +1241,14 @@ em_if_init(if_ctx_t ctx) for (i = 0, tx_que = adapter->tx_queues; i < adapter->tx_num_queues; i++, tx_que++) { struct tx_ring *txr = &tx_que->txr; - txr->tx_rs_cidx = txr->tx_rs_pidx = txr->tx_cidx_processed = 0; + txr->tx_rs_cidx = txr->tx_rs_pidx; + + /* Initialize the last processed descriptor to be the end of + * the ring, rather than the start, so that we avoid an + * off-by-one error when calculating how many descriptors are + * done in the credits_update function. + */ + txr->tx_cidx_processed = scctx->isc_ntxd[0] - 1; } /* Setup VLAN support, basic and offload if available */ diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index 92d4fe9edbb7..6c41d440c769 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -332,16 +332,11 @@ igb_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear) prev = txr->tx_cidx_processed; ntxd = scctx->isc_ntxd[0]; do { + MPASS(prev != cur); delta = (int32_t)cur - (int32_t)prev; - /* - * XXX This appears to be a hack for first-packet. - * A correct fix would prevent prev == cur in the first place. - */ - MPASS(prev == 0 || delta != 0); - if (prev == 0 && cur == 0) - delta += 1; if (delta < 0) delta += ntxd; + MPASS(delta > 0); processed += delta; prev = cur; diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index e2b1a4fd8722..b73e0449673a 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -806,7 +806,8 @@ ixgbe_initialize_transmit_units(if_ctx_t ctx) IXGBE_WRITE_REG(hw, IXGBE_TDT(j), 0); /* Cache the tail address */ - txr->tx_rs_cidx = txr->tx_rs_pidx = txr->tx_cidx_processed = 0; + txr->tx_rs_cidx = txr->tx_rs_pidx; + txr->tx_cidx_processed = scctx->isc_ntxd[0] - 1; for (int k = 0; k < scctx->isc_ntxd[0]; k++) txr->tx_rsq[k] = QIDX_INVALID; diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index 6e9acd6d601e..cd0fb5939e45 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -1228,7 +1228,13 @@ ixv_initialize_transmit_units(if_ctx_t ctx) /* Set Tx Tail register */ txr->tail = IXGBE_VFTDT(j); - txr->tx_rs_cidx = txr->tx_rs_pidx = txr->tx_cidx_processed = 0; + txr->tx_rs_cidx = txr->tx_rs_pidx; + /* Initialize the last processed descriptor to be the end of + * the ring, rather than the start, so that we avoid an + * off-by-one error when calculating how many descriptors are + * done in the credits_update function. + */ + txr->tx_cidx_processed = scctx->isc_ntxd[0] - 1; for (int k = 0; k < scctx->isc_ntxd[0]; k++) txr->tx_rsq[k] = QIDX_INVALID; diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c index 45690b2afcf7..2e021a120f20 100644 --- a/sys/dev/ixgbe/ix_txrx.c +++ b/sys/dev/ixgbe/ix_txrx.c @@ -296,11 +296,11 @@ ixgbe_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear) prev = txr->tx_cidx_processed; ntxd = scctx->isc_ntxd[0]; do { + MPASS(prev != cur); delta = (int32_t)cur - (int32_t)prev; - if (prev == 0 && cur == 0) - delta += 1; if (delta < 0) delta += ntxd; + MPASS(delta > 0); processed += delta; prev = cur; diff --git a/sys/dev/ixl/ixl_txrx.c b/sys/dev/ixl/ixl_txrx.c index ea215f272d9f..a705bfba4022 100644 --- a/sys/dev/ixl/ixl_txrx.c +++ b/sys/dev/ixl/ixl_txrx.c @@ -515,16 +515,11 @@ ixl_isc_txd_credits_update_dwb(void *arg, uint16_t txqid, bool clear) prev = txr->tx_cidx_processed; ntxd = scctx->isc_ntxd[0]; do { + MPASS(prev != cur); delta = (int32_t)cur - (int32_t)prev; - /* - * XXX This appears to be a hack for first-packet. - * A correct fix would prevent prev == cur in the first place. - */ - MPASS(prev == 0 || delta != 0); - if (prev == 0 && cur == 0) - delta += 1; if (delta < 0) delta += ntxd; + MPASS(delta > 0); #if 0 device_printf(iflib_get_dev(vsi->ctx), "%s: (q%d) cidx_processed=%u cur=%u clear=%d delta=%d\n", @@ -793,7 +788,14 @@ ixl_init_tx_rsqs(struct ixl_vsi *vsi) for (i = 0, tx_que = vsi->tx_queues; i < vsi->num_tx_queues; i++, tx_que++) { struct tx_ring *txr = &tx_que->txr; - txr->tx_rs_cidx = txr->tx_rs_pidx = txr->tx_cidx_processed = 0; + txr->tx_rs_cidx = txr->tx_rs_pidx; + + /* Initialize the last processed descriptor to be the end of + * the ring, rather than the start, so that we avoid an + * off-by-one error when calculating how many descriptors are + * done in the credits_update function. + */ + txr->tx_cidx_processed = scctx->isc_ntxd[0] - 1; for (j = 0; j < scctx->isc_ntxd[0]; j++) txr->tx_rsq[j] = QIDX_INVALID; @@ -803,13 +805,14 @@ ixl_init_tx_rsqs(struct ixl_vsi *vsi) void ixl_init_tx_cidx(struct ixl_vsi *vsi) { + if_softc_ctx_t scctx = vsi->shared; struct ixl_tx_queue *tx_que; int i; for (i = 0, tx_que = vsi->tx_queues; i < vsi->num_tx_queues; i++, tx_que++) { struct tx_ring *txr = &tx_que->txr; - txr->tx_cidx_processed = 0; + txr->tx_cidx_processed = scctx->isc_ntxd[0] - 1; } } From 2de16a737fd570a2eb3473e7248f7738891961cb Mon Sep 17 00:00:00 2001 From: Eric Joyner Date: Thu, 24 Jan 2019 01:08:37 +0000 Subject: [PATCH 024/142] ixl(4): Fix handling data passed with ioctl from NVM update tool From Krzysztof: Ensure that the entire data buffer passed from the NVM update tool is copied in to kernel space and copied back out to user space using copyin() and copyout(). PR: 234104 Submitted by: Krzysztof Galazka Reported by: Finn MFC after: 5 days Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D18817 --- sys/dev/ixl/ixl_pf_main.c | 69 ++++++++++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 11 deletions(-) diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index f775947fdc4c..6d393813e831 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -3663,23 +3663,34 @@ ixl_handle_nvmupd_cmd(struct ixl_pf *pf, struct ifdrv *ifd) struct i40e_nvm_access *nvma; device_t dev = pf->dev; enum i40e_status_code status = 0; - int perrno; + size_t nvma_size, ifd_len, exp_len; + int err, perrno; DEBUGFUNC("ixl_handle_nvmupd_cmd"); /* Sanity checks */ - if (ifd->ifd_len < sizeof(struct i40e_nvm_access) || + nvma_size = sizeof(struct i40e_nvm_access); + ifd_len = ifd->ifd_len; + + if (ifd_len < nvma_size || ifd->ifd_data == NULL) { device_printf(dev, "%s: incorrect ifdrv length or data pointer\n", __func__); device_printf(dev, "%s: ifdrv length: %zu, sizeof(struct i40e_nvm_access): %zu\n", - __func__, ifd->ifd_len, sizeof(struct i40e_nvm_access)); + __func__, ifd_len, nvma_size); device_printf(dev, "%s: data pointer: %p\n", __func__, ifd->ifd_data); return (EINVAL); } - nvma = (struct i40e_nvm_access *)ifd->ifd_data; + nvma = malloc(ifd_len, M_DEVBUF, M_WAITOK); + err = copyin(ifd->ifd_data, nvma, ifd_len); + if (err) { + device_printf(dev, "%s: Cannot get request from user space\n", + __func__); + free(nvma, M_DEVBUF); + return (err); + } if (pf->dbg_mask & IXL_DBG_NVMUPD) ixl_print_nvm_cmd(dev, nvma); @@ -3693,13 +3704,49 @@ ixl_handle_nvmupd_cmd(struct ixl_pf *pf, struct ifdrv *ifd) } } - if (!(pf->state & IXL_PF_STATE_ADAPTER_RESETTING)) { - // TODO: Might need a different lock here - // IXL_PF_LOCK(pf); - status = i40e_nvmupd_command(hw, nvma, nvma->data, &perrno); - // IXL_PF_UNLOCK(pf); - } else { - perrno = -EBUSY; + if (pf->state & IXL_PF_STATE_ADAPTER_RESETTING) { + free(nvma, M_DEVBUF); + return (-EBUSY); + } + + if (nvma->data_size < 1 || nvma->data_size > 4096) { + device_printf(dev, "%s: invalid request, data size not in supported range\n", + __func__); + free(nvma, M_DEVBUF); + return (EINVAL); + } + + /* + * Older versions of the NVM update tool don't set ifd_len to the size + * of the entire buffer passed to the ioctl. Check the data_size field + * in the contained i40e_nvm_access struct and ensure everything is + * copied in from userspace. + */ + exp_len = nvma_size + nvma->data_size - 1; /* One byte is kept in struct */ + + if (ifd_len < exp_len) { + ifd_len = exp_len; + nvma = realloc(nvma, ifd_len, M_DEVBUF, M_WAITOK); + err = copyin(ifd->ifd_data, nvma, ifd_len); + if (err) { + device_printf(dev, "%s: Cannot get request from user space\n", + __func__); + free(nvma, M_DEVBUF); + return (err); + } + } + + // TODO: Might need a different lock here + // IXL_PF_LOCK(pf); + status = i40e_nvmupd_command(hw, nvma, nvma->data, &perrno); + // IXL_PF_UNLOCK(pf); + + err = copyout(nvma, ifd->ifd_data, ifd_len); + free(nvma, M_DEVBUF); + if (err) { + device_printf(dev, "%s: Cannot return data to user space\n", + __func__); + return (err); } /* Let the nvmupdate report errors, show them only when debug is enabled */ From 95d69da4e011a265817b78dcb7bef49717c6723f Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:41:09 +0000 Subject: [PATCH 025/142] if_iwm - Update firmware rs table, instead of indexing the table in tx cmds. * Rather than providing a non-zero index into the firmware RS table, we should always use index 0 and update the firmware RS table whenever our chosen tx rate for data-frames changes. * Send IWM_LQ_CMD updates when the tx rate gets updated by the net80211 rate control (which is after we tell the tx status to the net80211 rate-control in iwm_mvm_rx_tx_cmd_single()). * Disregard frames transferred with a different tx rate than the currently selected rate for the rate-control calculations. This way we avoid counting management frames (which are sent at a slow, and fixed rate), as well as frames we added to the tx queue just before a new IWM_LQ_CMD update took effect. Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (5d6b465e288ac5b52d7115688d4e6516acbbea1c) --- sys/dev/iwm/if_iwm.c | 171 +++++++++++++++++++--------------------- sys/dev/iwm/if_iwmvar.h | 2 - 2 files changed, 79 insertions(+), 94 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 9bbf292bb74d..f2769c26371a 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -353,7 +353,9 @@ static int iwm_release(struct iwm_softc *, struct iwm_node *); static struct ieee80211_node * iwm_node_alloc(struct ieee80211vap *, const uint8_t[IEEE80211_ADDR_LEN]); -static void iwm_setrates(struct iwm_softc *, struct iwm_node *); +static uint8_t iwm_rate_from_ucode_rate(uint32_t); +static int iwm_rate2ridx(struct iwm_softc *, uint8_t); +static void iwm_setrates(struct iwm_softc *, struct iwm_node *, int); static int iwm_media_change(struct ifnet *); static int iwm_newstate(struct ieee80211vap *, enum ieee80211_state, int); static void iwm_endscan_cb(void *, int); @@ -3317,7 +3319,11 @@ iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, struct iwm_mvm_tx_resp *tx_resp = (void *)pkt->data; struct ieee80211_ratectl_tx_status *txs = &sc->sc_txs; struct ieee80211_node *ni = &in->in_ni; + struct ieee80211vap *vap = ni->ni_vap; int status = le16toh(tx_resp->status.status) & IWM_TX_STATUS_MSK; + int new_rate, cur_rate = vap->iv_bss->ni_txrate; + boolean_t rate_matched; + uint8_t tx_resp_rate; KASSERT(tx_resp->frame_count == 1, ("too many frames")); @@ -3333,6 +3339,17 @@ iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, le32toh(tx_resp->initial_rate), (int) le16toh(tx_resp->wireless_media_time)); + tx_resp_rate = iwm_rate_from_ucode_rate(le32toh(tx_resp->initial_rate)); + + /* For rate control, ignore frames sent at different initial rate */ + rate_matched = (tx_resp_rate != 0 && tx_resp_rate == cur_rate); + + if (tx_resp_rate != 0 && cur_rate != 0 && !rate_matched) { + IWM_DPRINTF(sc, IWM_DEBUG_TXRATE, + "tx_resp_rate doesn't match ni_txrate (tx_resp_rate=%u " + "ni_txrate=%d)\n", tx_resp_rate, cur_rate); + } + txs->flags = IEEE80211_RATECTL_STATUS_SHORT_RETRY | IEEE80211_RATECTL_STATUS_LONG_RETRY; txs->short_retries = tx_resp->failure_rts; @@ -3356,7 +3373,18 @@ iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt, } else { txs->status = IEEE80211_RATECTL_TX_SUCCESS; } - ieee80211_ratectl_tx_complete(ni, txs); + + if (rate_matched) { + ieee80211_ratectl_tx_complete(ni, txs); + + int rix = ieee80211_ratectl_rate(vap->iv_bss, NULL, 0); + new_rate = vap->iv_bss->ni_txrate; + if (new_rate != 0 && new_rate != cur_rate) { + struct iwm_node *in = IWM_NODE(vap->iv_bss); + iwm_setrates(sc, in, rix); + iwm_mvm_send_lq_cmd(sc, &in->in_lq, FALSE); + } + } return (txs->status != IEEE80211_RATECTL_TX_SUCCESS); } @@ -3482,37 +3510,6 @@ iwm_update_sched(struct iwm_softc *sc, int qid, int idx, uint8_t sta_id, } #endif -/* - * Take an 802.11 (non-n) rate, find the relevant rate - * table entry. return the index into in_ridx[]. - * - * The caller then uses that index back into in_ridx - * to figure out the rate index programmed /into/ - * the firmware for this given node. - */ -static int -iwm_tx_rateidx_lookup(struct iwm_softc *sc, struct iwm_node *in, - uint8_t rate) -{ - int i; - uint8_t r; - - for (i = 0; i < nitems(in->in_ridx); i++) { - r = iwm_rates[in->in_ridx[i]].rate; - if (rate == r) - return (i); - } - - IWM_DPRINTF(sc, IWM_DEBUG_XMIT | IWM_DEBUG_TXRATE, - "%s: couldn't find an entry for rate=%d\n", - __func__, - rate); - - /* XXX Return the first */ - /* XXX TODO: have it return the /lowest/ */ - return (0); -} - static int iwm_tx_rateidx_global_lookup(struct iwm_softc *sc, uint8_t rate) { @@ -3565,22 +3562,15 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, struct iwm_node *in, IWM_DPRINTF(sc, IWM_DEBUG_TXRATE, "%s: FIXED_RATE (%d)\n", __func__, tp->ucastrate); } else { - int i; - /* for data frames, use RS table */ IWM_DPRINTF(sc, IWM_DEBUG_TXRATE, "%s: DATA\n", __func__); - /* XXX pass pktlen */ - (void) ieee80211_ratectl_rate(ni, NULL, 0); - i = iwm_tx_rateidx_lookup(sc, in, ni->ni_txrate); - ridx = in->in_ridx[i]; + ridx = iwm_rate2ridx(sc, ni->ni_txrate); + if (ridx == -1) + ridx = 0; /* This is the index into the programmed table */ - tx->initial_rate_index = i; + tx->initial_rate_index = 0; tx->tx_flags |= htole32(IWM_TX_CMD_FLG_STA_RATE); - - IWM_DPRINTF(sc, IWM_DEBUG_XMIT | IWM_DEBUG_TXRATE, - "%s: start with i=%d, txrate %d\n", - __func__, i, iwm_rates[ridx].rate); } IWM_DPRINTF(sc, IWM_DEBUG_XMIT | IWM_DEBUG_TXRATE, @@ -4165,6 +4155,19 @@ iwm_node_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) M_NOWAIT | M_ZERO); } +static uint8_t +iwm_rate_from_ucode_rate(uint32_t rate_n_flags) +{ + uint8_t plcp = rate_n_flags & 0xff; + int i; + + for (i = 0; i <= IWM_RIDX_MAX; i++) { + if (iwm_rates[i].plcp == plcp) + return iwm_rates[i].rate; + } + return 0; +} + uint8_t iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx) { @@ -4180,15 +4183,36 @@ iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx) return 0; } +static int +iwm_rate2ridx(struct iwm_softc *sc, uint8_t rate) +{ + int i; + + for (i = 0; i <= IWM_RIDX_MAX; i++) { + if (iwm_rates[i].rate == rate) + return i; + } + + device_printf(sc->sc_dev, + "%s: WARNING: device rate for %u not found!\n", + __func__, rate); + + return -1; +} + + static void -iwm_setrates(struct iwm_softc *sc, struct iwm_node *in) +iwm_setrates(struct iwm_softc *sc, struct iwm_node *in, int rix) { struct ieee80211_node *ni = &in->in_ni; struct iwm_lq_cmd *lq = &in->in_lq; - int nrates = ni->ni_rates.rs_nrates; + struct ieee80211_rateset *rs = &ni->ni_rates; + int nrates = rs->rs_nrates; int i, ridx, tab = 0; // int txant = 0; + KASSERT(rix >= 0 && rix < nrates, ("invalid rix")); + if (nrates > nitems(lq->rs_table)) { device_printf(sc->sc_dev, "%s: node supports %d rates, driver handles " @@ -4200,45 +4224,11 @@ iwm_setrates(struct iwm_softc *sc, struct iwm_node *in) "%s: node supports 0 rates, odd!\n", __func__); return; } + nrates = imin(rix + 1, nrates); - /* - * XXX .. and most of iwm_node is not initialised explicitly; - * it's all just 0x0 passed to the firmware. - */ - - /* first figure out which rates we should support */ - /* XXX TODO: this isn't 11n aware /at all/ */ - memset(&in->in_ridx, -1, sizeof(in->in_ridx)); IWM_DPRINTF(sc, IWM_DEBUG_TXRATE, "%s: nrates=%d\n", __func__, nrates); - /* - * Loop over nrates and populate in_ridx from the highest - * rate to the lowest rate. Remember, in_ridx[] has - * IEEE80211_RATE_MAXSIZE entries! - */ - for (i = 0; i < min(nrates, IEEE80211_RATE_MAXSIZE); i++) { - int rate = ni->ni_rates.rs_rates[(nrates - 1) - i] & IEEE80211_RATE_VAL; - - /* Map 802.11 rate to HW rate index. */ - for (ridx = 0; ridx <= IWM_RIDX_MAX; ridx++) - if (iwm_rates[ridx].rate == rate) - break; - if (ridx > IWM_RIDX_MAX) { - device_printf(sc->sc_dev, - "%s: WARNING: device rate for %d not found!\n", - __func__, rate); - } else { - IWM_DPRINTF(sc, IWM_DEBUG_TXRATE, - "%s: rate: i: %d, rate=%d, ridx=%d\n", - __func__, - i, - rate, - ridx); - in->in_ridx[i] = ridx; - } - } - /* then construct a lq_cmd based on those */ memset(lq, 0, sizeof(*lq)); lq->sta_id = IWM_STATION_ID; @@ -4262,13 +4252,15 @@ iwm_setrates(struct iwm_softc *sc, struct iwm_node *in) * Note that we add the rates in the highest rate first * (opposite of ni_rates). */ - /* - * XXX TODO: this should be looping over the min of nrates - * and LQ_MAX_RETRY_NUM. Sigh. - */ for (i = 0; i < nrates; i++) { + int rate = rs->rs_rates[rix - i] & IEEE80211_RATE_VAL; int nextant; + /* Map 802.11 rate to HW rate index. */ + ridx = iwm_rate2ridx(sc, rate); + if (ridx == -1) + continue; + #if 0 if (txant == 0) txant = iwm_mvm_get_valid_tx_ant(sc); @@ -4277,12 +4269,6 @@ iwm_setrates(struct iwm_softc *sc, struct iwm_node *in) #else nextant = iwm_mvm_get_valid_tx_ant(sc); #endif - /* - * Map the rate id into a rate index into - * our hardware table containing the - * configuration to use for this rate. - */ - ridx = in->in_ridx[i]; tab = iwm_rates[ridx].plcp; tab |= nextant << IWM_RATE_MCS_ANT_POS; if (IWM_RIDX_IS_CCK(ridx)) @@ -4474,7 +4460,8 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) iwm_mvm_enable_beacon_filter(sc, ivp); iwm_mvm_power_update_mac(sc); iwm_mvm_update_quotas(sc, ivp); - iwm_setrates(sc, in); + int rix = ieee80211_ratectl_rate(&in->in_ni, NULL, 0); + iwm_setrates(sc, in, rix); if ((error = iwm_mvm_send_lq_cmd(sc, &in->in_lq, TRUE)) != 0) { device_printf(sc->sc_dev, diff --git a/sys/dev/iwm/if_iwmvar.h b/sys/dev/iwm/if_iwmvar.h index 7d9ae98dc3d1..07f0d1535e16 100644 --- a/sys/dev/iwm/if_iwmvar.h +++ b/sys/dev/iwm/if_iwmvar.h @@ -404,8 +404,6 @@ struct iwm_node { int in_assoc; struct iwm_lq_cmd in_lq; - - uint8_t in_ridx[IEEE80211_RATE_MAXSIZE]; }; #define IWM_NODE(_ni) ((struct iwm_node *)(_ni)) From aa0972c6ceaca46abe4e5b3f6fe250bd21b1127d Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:41:44 +0000 Subject: [PATCH 026/142] if_iwm - The iwm_prepare_card_hw() in iwm_attach() is only needed on 8K hw. * Doing the iwm_prepare_card_hw() call in iwm_attach() only on Family 8000 hardware matches the code in Linux iwlwifi. * While there remove DEFAULT_MAX_TX_POWER definition which is unused, and has a value different from IWL_DEFAULT_MAX_TX_POWER in iwlwifi. Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (e8560f8dc58df12a7c79a6bb4e6ccb156e001085) --- sys/dev/iwm/if_iwm.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index f2769c26371a..bec08779a4a6 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -1912,8 +1912,6 @@ enum nvm_sku_bits { #define IWM_NVM_RF_CFG_TX_ANT_MSK_8000(x) ((x >> 24) & 0xF) #define IWM_NVM_RF_CFG_RX_ANT_MSK_8000(x) ((x >> 28) & 0xF) -#define DEFAULT_MAX_TX_POWER 16 - /** * enum iwm_nvm_channel_flags - channel flags in NVM * @IWM_NVM_CHANNEL_VALID: channel is usable for this SKU/geo @@ -5863,19 +5861,18 @@ iwm_attach(device_t dev) * "dash" value). To keep hw_rev backwards compatible - we'll store it * in the old format. */ - if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) - sc->sc_hw_rev = (sc->sc_hw_rev & 0xfff0) | - (IWM_CSR_HW_REV_STEP(sc->sc_hw_rev << 2) << 2); - - if (iwm_prepare_card_hw(sc) != 0) { - device_printf(dev, "could not initialize hardware\n"); - goto fail; - } - if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) { int ret; uint32_t hw_step; + sc->sc_hw_rev = (sc->sc_hw_rev & 0xfff0) | + (IWM_CSR_HW_REV_STEP(sc->sc_hw_rev << 2) << 2); + + if (iwm_prepare_card_hw(sc) != 0) { + device_printf(dev, "could not initialize hardware\n"); + goto fail; + } + /* * In order to recognize C step the driver should read the * chip version id located at the AUX bus MISC address. From 544b40d85ed25e5a8f6367b2c065e879d6fd13b0 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:42:23 +0000 Subject: [PATCH 027/142] if_iwm - Move iwm_read_firmware() call into iwm_attach(). * We should load the firmware exactly once before the driver really initializes the hardware the first time, and unload it at detach time. There is no need to retrieve the firmware during execution of iwm_mvm_load_ucode_wait_alive(), we should make sure we already have the firmware data at hand before that. * The existing sc_preinit_hook code fails to deal with the case where if_iwm is loaded by the loader (or is statically linked) and the firmware needs to be loaded from disk. So we can just call iwm_read_firmware() from iwm_attach() directly. * A separate solution will have to be added to properly defer the firmware loading during bootup, until the necessary filesystem is mounted. Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (0104ee1f4cb6a2313c00c2526c6ae98d42e5041d) --- sys/dev/iwm/if_iwm.c | 108 ++++++++++++++++------------------------ sys/dev/iwm/if_iwmvar.h | 10 ---- 2 files changed, 43 insertions(+), 75 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index bec08779a4a6..14aca4c6d356 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -245,7 +245,7 @@ static int iwm_firmware_store_section(struct iwm_softc *, const uint8_t *, size_t); static int iwm_set_default_calib(struct iwm_softc *, const void *); static void iwm_fw_info_free(struct iwm_fw_info *); -static int iwm_read_firmware(struct iwm_softc *, enum iwm_ucode_type); +static int iwm_read_firmware(struct iwm_softc *); static int iwm_alloc_fwmem(struct iwm_softc *); static int iwm_alloc_sched(struct iwm_softc *); static int iwm_alloc_kw(struct iwm_softc *); @@ -536,12 +536,11 @@ iwm_fw_info_free(struct iwm_fw_info *fw) { firmware_put(fw->fw_fp, FIRMWARE_UNLOAD); fw->fw_fp = NULL; - /* don't touch fw->fw_status */ memset(fw->fw_sects, 0, sizeof(fw->fw_sects)); } static int -iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) +iwm_read_firmware(struct iwm_softc *sc) { struct iwm_fw_info *fw = &sc->sc_fw; const struct iwm_tlv_ucode_header *uhdr; @@ -558,24 +557,11 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) int error = 0; size_t len; - if (fw->fw_status == IWM_FW_STATUS_DONE && - ucode_type != IWM_UCODE_INIT) - return 0; - - while (fw->fw_status == IWM_FW_STATUS_INPROGRESS) - msleep(&sc->sc_fw, &sc->sc_mtx, 0, "iwmfwp", 0); - fw->fw_status = IWM_FW_STATUS_INPROGRESS; - - if (fw->fw_fp != NULL) - iwm_fw_info_free(fw); - /* * Load firmware into driver memory. * fw_fp will be set. */ - IWM_UNLOCK(sc); fwp = firmware_get(sc->cfg->fw_name); - IWM_LOCK(sc); if (fwp == NULL) { device_printf(sc->sc_dev, "could not read firmware %s (error %d)\n", @@ -634,9 +620,8 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) case IWM_UCODE_TLV_PROBE_MAX_LEN: if (tlv_len != sizeof(uint32_t)) { device_printf(sc->sc_dev, - "%s: PROBE_MAX_LEN (%d) != sizeof(uint32_t)\n", - __func__, - (int) tlv_len); + "%s: PROBE_MAX_LEN (%u) != sizeof(uint32_t)\n", + __func__, tlv_len); error = EINVAL; goto parse_out; } @@ -655,9 +640,8 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) case IWM_UCODE_TLV_PAN: if (tlv_len) { device_printf(sc->sc_dev, - "%s: IWM_UCODE_TLV_PAN: tlv_len (%d) > 0\n", - __func__, - (int) tlv_len); + "%s: IWM_UCODE_TLV_PAN: tlv_len (%u) > 0\n", + __func__, tlv_len); error = EINVAL; goto parse_out; } @@ -666,17 +650,15 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) case IWM_UCODE_TLV_FLAGS: if (tlv_len < sizeof(uint32_t)) { device_printf(sc->sc_dev, - "%s: IWM_UCODE_TLV_FLAGS: tlv_len (%d) < sizeof(uint32_t)\n", - __func__, - (int) tlv_len); + "%s: IWM_UCODE_TLV_FLAGS: tlv_len (%u) < sizeof(uint32_t)\n", + __func__, tlv_len); error = EINVAL; goto parse_out; } if (tlv_len % sizeof(uint32_t)) { device_printf(sc->sc_dev, - "%s: IWM_UCODE_TLV_FLAGS: tlv_len (%d) %% sizeof(uint32_t)\n", - __func__, - (int) tlv_len); + "%s: IWM_UCODE_TLV_FLAGS: tlv_len (%u) %% sizeof(uint32_t)\n", + __func__, tlv_len); error = EINVAL; goto parse_out; } @@ -698,17 +680,15 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) tlv_data, tlv_len)) != 0) { device_printf(sc->sc_dev, "%s: iwm_store_cscheme(): returned %d\n", - __func__, - error); + __func__, error); goto parse_out; } break; case IWM_UCODE_TLV_NUM_OF_CPU: if (tlv_len != sizeof(uint32_t)) { device_printf(sc->sc_dev, - "%s: IWM_UCODE_TLV_NUM_OF_CPU: tlv_len (%d) != sizeof(uint32_t)\n", - __func__, - (int) tlv_len); + "%s: IWM_UCODE_TLV_NUM_OF_CPU: tlv_len (%u) != sizeof(uint32_t)\n", + __func__, tlv_len); error = EINVAL; goto parse_out; } @@ -733,8 +713,7 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) IWM_UCODE_REGULAR, tlv_data, tlv_len)) != 0) { device_printf(sc->sc_dev, "%s: IWM_UCODE_REGULAR: iwm_firmware_store_section() failed; %d\n", - __func__, - error); + __func__, error); goto parse_out; } break; @@ -743,8 +722,7 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) IWM_UCODE_INIT, tlv_data, tlv_len)) != 0) { device_printf(sc->sc_dev, "%s: IWM_UCODE_INIT: iwm_firmware_store_section() failed; %d\n", - __func__, - error); + __func__, error); goto parse_out; } break; @@ -753,26 +731,23 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) IWM_UCODE_WOWLAN, tlv_data, tlv_len)) != 0) { device_printf(sc->sc_dev, "%s: IWM_UCODE_WOWLAN: iwm_firmware_store_section() failed; %d\n", - __func__, - error); + __func__, error); goto parse_out; } break; case IWM_UCODE_TLV_DEF_CALIB: if (tlv_len != sizeof(struct iwm_tlv_calib_data)) { device_printf(sc->sc_dev, - "%s: IWM_UCODE_TLV_DEV_CALIB: tlv_len (%d) < sizeof(iwm_tlv_calib_data) (%d)\n", - __func__, - (int) tlv_len, - (int) sizeof(struct iwm_tlv_calib_data)); + "%s: IWM_UCODE_TLV_DEV_CALIB: tlv_len (%u) < sizeof(iwm_tlv_calib_data) (%zu)\n", + __func__, tlv_len, + sizeof(struct iwm_tlv_calib_data)); error = EINVAL; goto parse_out; } if ((error = iwm_set_default_calib(sc, tlv_data)) != 0) { device_printf(sc->sc_dev, "%s: iwm_set_default_calib() failed: %d\n", - __func__, - error); + __func__, error); goto parse_out; } break; @@ -780,9 +755,8 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) if (tlv_len != sizeof(uint32_t)) { error = EINVAL; device_printf(sc->sc_dev, - "%s: IWM_UCODE_TLV_PHY_SKU: tlv_len (%d) < sizeof(uint32_t)\n", - __func__, - (int) tlv_len); + "%s: IWM_UCODE_TLV_PHY_SKU: tlv_len (%u) < sizeof(uint32_t)\n", + __func__, tlv_len); goto parse_out; } sc->sc_fw.phy_config = @@ -907,12 +881,9 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) out: if (error) { - fw->fw_status = IWM_FW_STATUS_NONE; if (fw->fw_fp != NULL) iwm_fw_info_free(fw); - } else - fw->fw_status = IWM_FW_STATUS_DONE; - wakeup(&sc->sc_fw); + } return error; } @@ -2858,11 +2829,6 @@ iwm_mvm_load_ucode_wait_alive(struct iwm_softc *sc, int error; static const uint16_t alive_cmd[] = { IWM_MVM_ALIVE }; - if ((error = iwm_read_firmware(sc, ucode_type)) != 0) { - device_printf(sc->sc_dev, "iwm_read_firmware: failed %d\n", - error); - return error; - } fw = &sc->sc_fw.fw_sects[ucode_type]; sc->cur_ucode = ucode_type; sc->ucode_loaded = FALSE; @@ -5849,7 +5815,7 @@ iwm_attach(device_t dev) sc->sc_wantresp = -1; - /* Check device type */ + /* Match device id */ error = iwm_dev_check(dev); if (error != 0) goto fail; @@ -5987,19 +5953,31 @@ iwm_attach(device_t dev) /* Max RSSI */ sc->sc_max_rssi = IWM_MAX_DBM - IWM_MIN_DBM; - sc->sc_preinit_hook.ich_func = iwm_preinit; - sc->sc_preinit_hook.ich_arg = sc; - if (config_intrhook_establish(&sc->sc_preinit_hook) != 0) { - device_printf(dev, "config_intrhook_establish failed\n"); - goto fail; - } - #ifdef IWM_DEBUG SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "debug", CTLFLAG_RW, &sc->sc_debug, 0, "control debugging"); #endif + error = iwm_read_firmware(sc); + if (error) { + goto fail; + } else if (sc->sc_fw.fw_fp == NULL) { + /* + * XXX Add a solution for properly deferring firmware load + * during bootup. + */ + goto fail; + } else { + sc->sc_preinit_hook.ich_func = iwm_preinit; + sc->sc_preinit_hook.ich_arg = sc; + if (config_intrhook_establish(&sc->sc_preinit_hook) != 0) { + device_printf(dev, + "config_intrhook_establish failed\n"); + goto fail; + } + } + IWM_DPRINTF(sc, IWM_DEBUG_RESET | IWM_DEBUG_TRACE, "<-%s\n", __func__); diff --git a/sys/dev/iwm/if_iwmvar.h b/sys/dev/iwm/if_iwmvar.h index 07f0d1535e16..6dfa1b100b1e 100644 --- a/sys/dev/iwm/if_iwmvar.h +++ b/sys/dev/iwm/if_iwmvar.h @@ -139,15 +139,6 @@ struct iwm_tx_radiotap_header { #define IWM_UCODE_SECTION_MAX 16 -/* - * fw_status is used to determine if we've already parsed the firmware file - * - * In addition to the following, status < 0 ==> -error - */ -#define IWM_FW_STATUS_NONE 0 -#define IWM_FW_STATUS_INPROGRESS 1 -#define IWM_FW_STATUS_DONE 2 - /** * enum iwm_ucode_type * @@ -197,7 +188,6 @@ struct iwm_fw_desc { struct iwm_fw_info { const struct firmware *fw_fp; - int fw_status; struct iwm_fw_sects { struct iwm_fw_desc fw_sect[IWM_UCODE_SECTION_MAX]; From 797b6586c6b3e630d838ebce74a15e28423b045e Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:42:59 +0000 Subject: [PATCH 028/142] if_iwm - Check sc->sc_attached flag in suspend/resume callbacks. * There is (almost) nothing to do in suspend/resume if if_iwm has failed during initialization (e.g. because of firmware load failure) and was already uninitialized by iwm_detach_local(). Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (67b5e090efb225654815fed91020db6cfc16bb19) --- sys/dev/iwm/if_iwm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 14aca4c6d356..41198cf6e7d2 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -6301,6 +6301,10 @@ iwm_resume(device_t dev) * PCI Tx retries from interfering with C3 CPU state. */ pci_write_config(dev, PCI_CFG_RETRY_TIMEOUT, 0x00, 1); + + if (!sc->sc_attached) + return 0; + iwm_init_task(device_get_softc(dev)); IWM_LOCK(sc); @@ -6324,6 +6328,9 @@ iwm_suspend(device_t dev) do_stop = !! (sc->sc_ic.ic_nrunning > 0); + if (!sc->sc_attached) + return (0); + ieee80211_suspend_all(&sc->sc_ic); if (do_stop) { From f33c830939c80c7cb6281b77251a03d75bb69a9f Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:43:45 +0000 Subject: [PATCH 029/142] iwm - Reduce gratuitous differences with Linux iwlwifi in struct naming. * Rename some structs and struct members for firmware handling. Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (4b1006a6e4d0f61d48c67b46e1f791e30837db67) --- sys/dev/iwm/if_iwm.c | 74 ++++++++++++++++++------------------- sys/dev/iwm/if_iwm_fw.c | 18 ++++----- sys/dev/iwm/if_iwm_fw.h | 4 +- sys/dev/iwm/if_iwm_phy_db.c | 4 +- sys/dev/iwm/if_iwm_scan.c | 27 ++++++++------ sys/dev/iwm/if_iwmvar.h | 18 +++++---- 6 files changed, 75 insertions(+), 70 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 41198cf6e7d2..80ed907a3090 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -305,16 +305,16 @@ static int iwm_pcie_load_section(struct iwm_softc *, uint8_t, static int iwm_pcie_load_firmware_chunk(struct iwm_softc *, uint32_t, bus_addr_t, uint32_t); static int iwm_pcie_load_cpu_sections_8000(struct iwm_softc *sc, - const struct iwm_fw_sects *, + const struct iwm_fw_img *, int, int *); static int iwm_pcie_load_cpu_sections(struct iwm_softc *, - const struct iwm_fw_sects *, + const struct iwm_fw_img *, int, int *); static int iwm_pcie_load_given_ucode_8000(struct iwm_softc *, - const struct iwm_fw_sects *); + const struct iwm_fw_img *); static int iwm_pcie_load_given_ucode(struct iwm_softc *, - const struct iwm_fw_sects *); -static int iwm_start_fw(struct iwm_softc *, const struct iwm_fw_sects *); + const struct iwm_fw_img *); +static int iwm_start_fw(struct iwm_softc *, const struct iwm_fw_img *); static int iwm_send_tx_ant_cfg(struct iwm_softc *, uint8_t); static int iwm_send_phy_cfg_cmd(struct iwm_softc *); static int iwm_mvm_load_ucode_wait_alive(struct iwm_softc *, @@ -426,7 +426,7 @@ static int iwm_firmware_store_section(struct iwm_softc *sc, enum iwm_ucode_type type, const uint8_t *data, size_t dlen) { - struct iwm_fw_sects *fws; + struct iwm_fw_img *fws; struct iwm_fw_desc *fwone; if (type >= IWM_UCODE_TYPE_MAX) @@ -434,11 +434,11 @@ iwm_firmware_store_section(struct iwm_softc *sc, if (dlen < sizeof(uint32_t)) return EINVAL; - fws = &sc->sc_fw.fw_sects[type]; + fws = &sc->sc_fw.img[type]; if (fws->fw_count >= IWM_UCODE_SECTION_MAX) return EINVAL; - fwone = &fws->fw_sect[fws->fw_count]; + fwone = &fws->sec[fws->fw_count]; /* first 32bit are device load offset */ memcpy(&fwone->offset, data, sizeof(uint32_t)); @@ -536,7 +536,7 @@ iwm_fw_info_free(struct iwm_fw_info *fw) { firmware_put(fw->fw_fp, FIRMWARE_UNLOAD); fw->fw_fp = NULL; - memset(fw->fw_sects, 0, sizeof(fw->fw_sects)); + memset(fw->img, 0, sizeof(fw->img)); } static int @@ -545,7 +545,7 @@ iwm_read_firmware(struct iwm_softc *sc) struct iwm_fw_info *fw = &sc->sc_fw; const struct iwm_tlv_ucode_header *uhdr; const struct iwm_ucode_tlv *tlv; - struct iwm_ucode_capabilities *capa = &sc->ucode_capa; + struct iwm_ucode_capabilities *capa = &sc->sc_fw.ucode_capa; enum iwm_ucode_tlv_type tlv_type; const struct firmware *fwp; const uint8_t *data; @@ -694,11 +694,11 @@ iwm_read_firmware(struct iwm_softc *sc) } num_of_cpus = le32_to_cpup((const uint32_t *)tlv_data); if (num_of_cpus == 2) { - fw->fw_sects[IWM_UCODE_REGULAR].is_dual_cpus = + fw->img[IWM_UCODE_REGULAR].is_dual_cpus = TRUE; - fw->fw_sects[IWM_UCODE_INIT].is_dual_cpus = + fw->img[IWM_UCODE_INIT].is_dual_cpus = TRUE; - fw->fw_sects[IWM_UCODE_WOWLAN].is_dual_cpus = + fw->img[IWM_UCODE_WOWLAN].is_dual_cpus = TRUE; } else if ((num_of_cpus > 2) || (num_of_cpus < 1)) { device_printf(sc->sc_dev, @@ -831,10 +831,10 @@ iwm_read_firmware(struct iwm_softc *sc) goto out; } - sc->sc_fw.fw_sects[IWM_UCODE_REGULAR].paging_mem_size = + sc->sc_fw.img[IWM_UCODE_REGULAR].paging_mem_size = paging_mem_size; usniffer_img = IWM_UCODE_REGULAR_USNIFFER; - sc->sc_fw.fw_sects[usniffer_img].paging_mem_size = + sc->sc_fw.img[usniffer_img].paging_mem_size = paging_mem_size; break; @@ -2447,7 +2447,7 @@ iwm_pcie_load_firmware_chunk(struct iwm_softc *sc, uint32_t dst_addr, static int iwm_pcie_load_cpu_sections_8000(struct iwm_softc *sc, - const struct iwm_fw_sects *image, int cpu, int *first_ucode_section) + const struct iwm_fw_img *image, int cpu, int *first_ucode_section) { int shift_param; int i, ret = 0, sec_num = 0x1; @@ -2470,15 +2470,15 @@ iwm_pcie_load_cpu_sections_8000(struct iwm_softc *sc, * PAGING_SEPARATOR_SECTION delimiter - separate between * CPU2 non paged to CPU2 paging sec. */ - if (!image->fw_sect[i].data || - image->fw_sect[i].offset == IWM_CPU1_CPU2_SEPARATOR_SECTION || - image->fw_sect[i].offset == IWM_PAGING_SEPARATOR_SECTION) { + if (!image->sec[i].data || + image->sec[i].offset == IWM_CPU1_CPU2_SEPARATOR_SECTION || + image->sec[i].offset == IWM_PAGING_SEPARATOR_SECTION) { IWM_DPRINTF(sc, IWM_DEBUG_RESET, "Break since Data not valid or Empty section, sec = %d\n", i); break; } - ret = iwm_pcie_load_section(sc, i, &image->fw_sect[i]); + ret = iwm_pcie_load_section(sc, i, &image->sec[i]); if (ret) return ret; @@ -2509,7 +2509,7 @@ iwm_pcie_load_cpu_sections_8000(struct iwm_softc *sc, static int iwm_pcie_load_cpu_sections(struct iwm_softc *sc, - const struct iwm_fw_sects *image, int cpu, int *first_ucode_section) + const struct iwm_fw_img *image, int cpu, int *first_ucode_section) { int shift_param; int i, ret = 0; @@ -2532,16 +2532,16 @@ iwm_pcie_load_cpu_sections(struct iwm_softc *sc, * PAGING_SEPARATOR_SECTION delimiter - separate between * CPU2 non paged to CPU2 paging sec. */ - if (!image->fw_sect[i].data || - image->fw_sect[i].offset == IWM_CPU1_CPU2_SEPARATOR_SECTION || - image->fw_sect[i].offset == IWM_PAGING_SEPARATOR_SECTION) { + if (!image->sec[i].data || + image->sec[i].offset == IWM_CPU1_CPU2_SEPARATOR_SECTION || + image->sec[i].offset == IWM_PAGING_SEPARATOR_SECTION) { IWM_DPRINTF(sc, IWM_DEBUG_RESET, "Break since Data not valid or Empty section, sec = %d\n", i); break; } - ret = iwm_pcie_load_section(sc, i, &image->fw_sect[i]); + ret = iwm_pcie_load_section(sc, i, &image->sec[i]); if (ret) return ret; } @@ -2553,8 +2553,7 @@ iwm_pcie_load_cpu_sections(struct iwm_softc *sc, } static int -iwm_pcie_load_given_ucode(struct iwm_softc *sc, - const struct iwm_fw_sects *image) +iwm_pcie_load_given_ucode(struct iwm_softc *sc, const struct iwm_fw_img *image) { int ret = 0; int first_ucode_section; @@ -2593,7 +2592,7 @@ iwm_pcie_load_given_ucode(struct iwm_softc *sc, int iwm_pcie_load_given_ucode_8000(struct iwm_softc *sc, - const struct iwm_fw_sects *image) + const struct iwm_fw_img *image) { int ret = 0; int first_ucode_section; @@ -2631,8 +2630,7 @@ iwm_enable_fw_load_int(struct iwm_softc *sc) /* XXX Add proper rfkill support code */ static int -iwm_start_fw(struct iwm_softc *sc, - const struct iwm_fw_sects *fw) +iwm_start_fw(struct iwm_softc *sc, const struct iwm_fw_img *fw) { int ret; @@ -2824,12 +2822,12 @@ iwm_mvm_load_ucode_wait_alive(struct iwm_softc *sc, { struct iwm_notification_wait alive_wait; struct iwm_mvm_alive_data alive_data; - const struct iwm_fw_sects *fw; + const struct iwm_fw_img *fw; enum iwm_ucode_type old_type = sc->cur_ucode; int error; static const uint16_t alive_cmd[] = { IWM_MVM_ALIVE }; - fw = &sc->sc_fw.fw_sects[ucode_type]; + fw = &sc->sc_fw.img[ucode_type]; sc->cur_ucode = ucode_type; sc->ucode_loaded = FALSE; @@ -4473,7 +4471,7 @@ static boolean_t iwm_mvm_is_lar_supported(struct iwm_softc *sc) { boolean_t nvm_lar = sc->nvm_data->lar_enabled; - boolean_t tlv_lar = fw_has_capa(&sc->ucode_capa, + boolean_t tlv_lar = fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_LAR_SUPPORT); if (iwm_lar_disable) @@ -4492,9 +4490,9 @@ iwm_mvm_is_lar_supported(struct iwm_softc *sc) static boolean_t iwm_mvm_is_wifi_mcc_supported(struct iwm_softc *sc) { - return fw_has_api(&sc->ucode_capa, + return fw_has_api(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_API_WIFI_MCC_UPDATE) || - fw_has_capa(&sc->ucode_capa, + fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC); } @@ -4515,7 +4513,7 @@ iwm_send_update_mcc_cmd(struct iwm_softc *sc, const char *alpha2) int n_channels; uint16_t mcc; #endif - int resp_v2 = fw_has_capa(&sc->ucode_capa, + int resp_v2 = fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_LAR_SUPPORT_V2); if (!iwm_mvm_is_lar_supported(sc)) { @@ -4674,7 +4672,7 @@ iwm_init_hw(struct iwm_softc *sc) if ((error = iwm_send_update_mcc_cmd(sc, "ZZ")) != 0) goto error; - if (fw_has_capa(&sc->ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) { + if (fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) { if ((error = iwm_mvm_config_umac_scan(sc)) != 0) goto error; } @@ -6208,7 +6206,7 @@ iwm_scan_start(struct ieee80211com *ic) device_printf(sc->sc_dev, "%s: Previous scan not completed yet\n", __func__); } - if (fw_has_capa(&sc->ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) + if (fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) error = iwm_mvm_umac_scan(sc); else error = iwm_mvm_lmac_scan(sc); diff --git a/sys/dev/iwm/if_iwm_fw.c b/sys/dev/iwm/if_iwm_fw.c index 280fe5558b0c..8eb09d2a6967 100644 --- a/sys/dev/iwm/if_iwm_fw.c +++ b/sys/dev/iwm/if_iwm_fw.c @@ -141,7 +141,7 @@ iwm_free_fw_paging(struct iwm_softc *sc) } static int -iwm_fill_paging_mem(struct iwm_softc *sc, const struct iwm_fw_sects *image) +iwm_fill_paging_mem(struct iwm_softc *sc, const struct iwm_fw_img *image) { int sec_idx, idx; uint32_t offset = 0; @@ -158,7 +158,7 @@ iwm_fill_paging_mem(struct iwm_softc *sc, const struct iwm_fw_sects *image) * CPU2 paging image (including instruction and data) */ for (sec_idx = 0; sec_idx < IWM_UCODE_SECTION_MAX; sec_idx++) { - if (image->fw_sect[sec_idx].offset == IWM_PAGING_SEPARATOR_SECTION) { + if (image->sec[sec_idx].offset == IWM_PAGING_SEPARATOR_SECTION) { sec_idx++; break; } @@ -168,7 +168,7 @@ iwm_fill_paging_mem(struct iwm_softc *sc, const struct iwm_fw_sects *image) * If paging is enabled there should be at least 2 more sections left * (one for CSS and one for Paging data) */ - if (sec_idx >= nitems(image->fw_sect) - 1) { + if (sec_idx >= nitems(image->sec) - 1) { device_printf(sc->sc_dev, "Paging: Missing CSS and/or paging sections\n"); iwm_free_fw_paging(sc); @@ -181,7 +181,7 @@ iwm_fill_paging_mem(struct iwm_softc *sc, const struct iwm_fw_sects *image) sec_idx); memcpy(sc->fw_paging_db[0].fw_paging_block.vaddr, - image->fw_sect[sec_idx].data, + image->sec[sec_idx].data, sc->fw_paging_db[0].fw_paging_size); IWM_DPRINTF(sc, IWM_DEBUG_FW, @@ -198,7 +198,7 @@ iwm_fill_paging_mem(struct iwm_softc *sc, const struct iwm_fw_sects *image) */ for (idx = 1; idx < sc->num_of_paging_blk; idx++) { memcpy(sc->fw_paging_db[idx].fw_paging_block.vaddr, - (const char *)image->fw_sect[sec_idx].data + offset, + (const char *)image->sec[sec_idx].data + offset, sc->fw_paging_db[idx].fw_paging_size); IWM_DPRINTF(sc, IWM_DEBUG_FW, @@ -212,7 +212,7 @@ iwm_fill_paging_mem(struct iwm_softc *sc, const struct iwm_fw_sects *image) /* copy the last paging block */ if (sc->num_of_pages_in_last_blk > 0) { memcpy(sc->fw_paging_db[idx].fw_paging_block.vaddr, - (const char *)image->fw_sect[sec_idx].data + offset, + (const char *)image->sec[sec_idx].data + offset, IWM_FW_PAGING_SIZE * sc->num_of_pages_in_last_blk); IWM_DPRINTF(sc, IWM_DEBUG_FW, @@ -224,7 +224,7 @@ iwm_fill_paging_mem(struct iwm_softc *sc, const struct iwm_fw_sects *image) } static int -iwm_alloc_fw_paging_mem(struct iwm_softc *sc, const struct iwm_fw_sects *image) +iwm_alloc_fw_paging_mem(struct iwm_softc *sc, const struct iwm_fw_img *image) { int blk_idx = 0; int error, num_of_pages; @@ -298,7 +298,7 @@ iwm_alloc_fw_paging_mem(struct iwm_softc *sc, const struct iwm_fw_sects *image) } int -iwm_save_fw_paging(struct iwm_softc *sc, const struct iwm_fw_sects *fw) +iwm_save_fw_paging(struct iwm_softc *sc, const struct iwm_fw_img *fw) { int ret; @@ -311,7 +311,7 @@ iwm_save_fw_paging(struct iwm_softc *sc, const struct iwm_fw_sects *fw) /* send paging cmd to FW in case CPU2 has paging image */ int -iwm_send_paging_cmd(struct iwm_softc *sc, const struct iwm_fw_sects *fw) +iwm_send_paging_cmd(struct iwm_softc *sc, const struct iwm_fw_img *fw) { int blk_idx; uint32_t dev_phy_addr; diff --git a/sys/dev/iwm/if_iwm_fw.h b/sys/dev/iwm/if_iwm_fw.h index de8910d6ea20..66b3d840a50d 100644 --- a/sys/dev/iwm/if_iwm_fw.h +++ b/sys/dev/iwm/if_iwm_fw.h @@ -107,7 +107,7 @@ #define IWM_PAGING_TLV_SECURE_MASK 1 extern void iwm_free_fw_paging(struct iwm_softc *); -extern int iwm_save_fw_paging(struct iwm_softc *, const struct iwm_fw_sects *); -extern int iwm_send_paging_cmd(struct iwm_softc *, const struct iwm_fw_sects *); +extern int iwm_save_fw_paging(struct iwm_softc *, const struct iwm_fw_img *); +extern int iwm_send_paging_cmd(struct iwm_softc *, const struct iwm_fw_img *); #endif /* __IF_IWM_FW_H__ */ diff --git a/sys/dev/iwm/if_iwm_phy_db.c b/sys/dev/iwm/if_iwm_phy_db.c index 70f985c07c10..40a0a05adb15 100644 --- a/sys/dev/iwm/if_iwm_phy_db.c +++ b/sys/dev/iwm/if_iwm_phy_db.c @@ -390,7 +390,7 @@ static uint8_t ch_id_to_ch_index(uint16_t ch_id) { if (!is_valid_channel(ch_id)) - return 0xff; + return 0xff; if (ch_id <= 14) return ch_id - 1; @@ -509,7 +509,7 @@ iwm_phy_db_send_all_channel_groups(struct iwm_phy_db *phy_db, int err; struct iwm_phy_db_entry *entry; - /* Send all the channel specific groups to operational fw */ + /* Send all the channel specific groups to operational fw */ for (i = 0; i < max_ch_groups; i++) { entry = iwm_phy_db_get_section(phy_db, type, diff --git a/sys/dev/iwm/if_iwm_scan.c b/sys/dev/iwm/if_iwm_scan.c index ee49086293d0..84948cc27829 100644 --- a/sys/dev/iwm/if_iwm_scan.c +++ b/sys/dev/iwm/if_iwm_scan.c @@ -215,7 +215,7 @@ static inline boolean_t iwm_mvm_rrm_scan_needed(struct iwm_softc *sc) { /* require rrm scan whenever the fw supports it */ - return fw_has_capa(&sc->ucode_capa, + return fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT); } @@ -251,7 +251,7 @@ iwm_mvm_rx_lmac_scan_complete_notif(struct iwm_softc *sc, /* If this happens, the firmware has mistakenly sent an LMAC * notification during UMAC scans -- warn and ignore it. */ - if (fw_has_capa(&sc->ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) { + if (fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) { device_printf(sc->sc_dev, "%s: Mistakenly got LMAC notification during UMAC scan\n", __func__); @@ -307,7 +307,8 @@ iwm_mvm_lmac_scan_fill_channels(struct iwm_softc *sc, int j; for (nchan = j = 0; - j < ss->ss_last && nchan < sc->ucode_capa.n_scan_channels; j++) { + j < ss->ss_last && nchan < sc->sc_fw.ucode_capa.n_scan_channels; + j++) { c = ss->ss_chans[j]; /* * Catch other channels, in case we have 900MHz channels or @@ -350,7 +351,8 @@ iwm_mvm_umac_scan_fill_channels(struct iwm_softc *sc, int j; for (nchan = j = 0; - j < ss->ss_last && nchan < sc->ucode_capa.n_scan_channels; j++) { + j < ss->ss_last && nchan < sc->sc_fw.ucode_capa.n_scan_channels; + j++) { c = ss->ss_chans[j]; /* * Catch other channels, in case we have 900MHz channels or @@ -495,7 +497,7 @@ iwm_mvm_config_umac_scan(struct iwm_softc *sc) IWM_SCAN_CONFIG_RATE_36M | IWM_SCAN_CONFIG_RATE_48M | IWM_SCAN_CONFIG_RATE_54M); - cmd_size = sizeof(*scan_config) + sc->ucode_capa.n_scan_channels; + cmd_size = sizeof(*scan_config) + sc->sc_fw.ucode_capa.n_scan_channels; scan_config = malloc(cmd_size, M_DEVBUF, M_NOWAIT | M_ZERO); if (scan_config == NULL) @@ -523,7 +525,8 @@ iwm_mvm_config_umac_scan(struct iwm_softc *sc) IWM_CHANNEL_FLAG_PRE_SCAN_PASSIVE2ACTIVE; for (nchan = j = 0; - j < ic->ic_nchans && nchan < sc->ucode_capa.n_scan_channels; j++) { + j < ic->ic_nchans && nchan < sc->sc_fw.ucode_capa.n_scan_channels; + j++) { c = &ic->ic_channels[j]; /* For 2GHz, only populate 11b channels */ /* For 5GHz, only populate 11a channels */ @@ -566,7 +569,7 @@ iwm_mvm_config_umac_scan(struct iwm_softc *sc) static boolean_t iwm_mvm_scan_use_ebs(struct iwm_softc *sc) { - const struct iwm_ucode_capabilities *capa = &sc->ucode_capa; + const struct iwm_ucode_capabilities *capa = &sc->sc_fw.ucode_capa; /* We can only use EBS if: * 1. the feature is supported; @@ -596,7 +599,7 @@ iwm_mvm_umac_scan(struct iwm_softc *sc) req_len = sizeof(struct iwm_scan_req_umac) + (sizeof(struct iwm_scan_channel_cfg_umac) * - sc->ucode_capa.n_scan_channels) + + sc->sc_fw.ucode_capa.n_scan_channels) + sizeof(struct iwm_scan_req_umac_tail); if (req_len > IWM_MAX_CMD_PAYLOAD_SIZE) return ENOMEM; @@ -630,7 +633,7 @@ iwm_mvm_umac_scan(struct iwm_softc *sc) tail = (void *)((char *)&req->data + sizeof(struct iwm_scan_channel_cfg_umac) * - sc->ucode_capa.n_scan_channels); + sc->sc_fw.ucode_capa.n_scan_channels); /* Check if we're doing an active directed scan. */ for (i = 0; i < nssid; i++) { @@ -694,7 +697,7 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) req_len = sizeof(struct iwm_scan_req_lmac) + (sizeof(struct iwm_scan_channel_cfg_lmac) * - sc->ucode_capa.n_scan_channels) + sizeof(struct iwm_scan_probe_req); + sc->sc_fw.ucode_capa.n_scan_channels) + sizeof(struct iwm_scan_probe_req); if (req_len > IWM_MAX_CMD_PAYLOAD_SIZE) return ENOMEM; req = malloc(req_len, M_DEVBUF, M_NOWAIT | M_ZERO); @@ -764,7 +767,7 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) ret = iwm_mvm_fill_probe_req(sc, (struct iwm_scan_probe_req *)(req->data + (sizeof(struct iwm_scan_channel_cfg_lmac) * - sc->ucode_capa.n_scan_channels))); + sc->sc_fw.ucode_capa.n_scan_channels))); if (ret) { free(req, M_DEVBUF); return ret; @@ -863,7 +866,7 @@ iwm_mvm_scan_stop_wait(struct iwm_softc *sc) IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Preparing to stop scan\n"); - if (fw_has_capa(&sc->ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) + if (fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) ret = iwm_mvm_umac_scan_abort(sc); else ret = iwm_mvm_lmac_scan_abort(sc); diff --git a/sys/dev/iwm/if_iwmvar.h b/sys/dev/iwm/if_iwmvar.h index 6dfa1b100b1e..bcd08ef65057 100644 --- a/sys/dev/iwm/if_iwmvar.h +++ b/sys/dev/iwm/if_iwmvar.h @@ -186,15 +186,20 @@ struct iwm_fw_desc { uint32_t offset; /* offset in the device */ }; +struct iwm_fw_img { + struct iwm_fw_desc sec[IWM_UCODE_SECTION_MAX]; + int fw_count; + int is_dual_cpus; + uint32_t paging_mem_size; +}; + struct iwm_fw_info { const struct firmware *fw_fp; - struct iwm_fw_sects { - struct iwm_fw_desc fw_sect[IWM_UCODE_SECTION_MAX]; - int fw_count; - int is_dual_cpus; - uint32_t paging_mem_size; - } fw_sects[IWM_UCODE_TYPE_MAX]; + /* ucode images */ + struct iwm_fw_img img[IWM_UCODE_TYPE_MAX]; + + struct iwm_ucode_capabilities ucode_capa; uint32_t phy_config; uint8_t valid_tx_ant; @@ -470,7 +475,6 @@ struct iwm_softc { int ucode_loaded; char sc_fwver[32]; - struct iwm_ucode_capabilities ucode_capa; char sc_fw_mcc[3]; int sc_intmask; From 27898346e21c6e20e183590a63029c1f5ebd93a6 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:44:20 +0000 Subject: [PATCH 030/142] if_iwm - Update struct iwm_scan_results_notif. Remove old/unused definitions * Remove outdated notifications IWM_SCAN_ABORT_CMD, IWM_SCAN_START_NOTIFICATION and IWM_SCAN_RESULTS_NOTIFICATION. * Remove unused enum iwm_scan_complete_status. * Use the updated FW Api version 3 of struct iwm_scan_results_notif. * No functional change, since struct iwm_scan_results_notif is never accessed in iwm at the moment. Taken-From: Linux iwlwifi commits 1083fd7391e989be52022f0f338e9dadc048b063 and 75118fdb63496e4611ab50380499ddd62b9de69f. Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (c947b0b8dc96dabefd63f7b70d53695e36c7b64f) --- sys/dev/iwm/if_iwmreg.h | 48 +++-------------------------------------- 1 file changed, 3 insertions(+), 45 deletions(-) diff --git a/sys/dev/iwm/if_iwmreg.h b/sys/dev/iwm/if_iwmreg.h index 22a669ffb86e..5c1113582197 100644 --- a/sys/dev/iwm/if_iwmreg.h +++ b/sys/dev/iwm/if_iwmreg.h @@ -1794,11 +1794,6 @@ enum { /* Thermal Throttling*/ IWM_REPLY_THERMAL_MNG_BACKOFF = 0x7e, - /* Scanning */ - IWM_SCAN_ABORT_CMD = 0x81, - IWM_SCAN_START_NOTIFICATION = 0x82, - IWM_SCAN_RESULTS_NOTIFICATION = 0x83, - /* NVM */ IWM_NVM_ACCESS_CMD = 0x88, @@ -4952,50 +4947,14 @@ struct iwm_periodic_scan_complete { uint32_t reserved; } __packed; -/* How many statistics are gathered for each channel */ -#define IWM_SCAN_RESULTS_STATISTICS 1 - /** - * enum iwm_scan_complete_status - status codes for scan complete notifications - * @IWM_SCAN_COMP_STATUS_OK: scan completed successfully - * @IWM_SCAN_COMP_STATUS_ABORT: scan was aborted by user - * @IWM_SCAN_COMP_STATUS_ERR_SLEEP: sending null sleep packet failed - * @IWM_SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT: timeout before channel is ready - * @IWM_SCAN_COMP_STATUS_ERR_PROBE: sending probe request failed - * @IWM_SCAN_COMP_STATUS_ERR_WAKEUP: sending null wakeup packet failed - * @IWM_SCAN_COMP_STATUS_ERR_ANTENNAS: invalid antennas chosen at scan command - * @IWM_SCAN_COMP_STATUS_ERR_INTERNAL: internal error caused scan abort - * @IWM_SCAN_COMP_STATUS_ERR_COEX: medium was lost ot WiMax - * @IWM_SCAN_COMP_STATUS_P2P_ACTION_OK: P2P public action frame TX was successful - * (not an error!) - * @IWM_SCAN_COMP_STATUS_ITERATION_END: indicates end of one repeatition the driver - * asked for - * @IWM_SCAN_COMP_STATUS_ERR_ALLOC_TE: scan could not allocate time events -*/ -enum iwm_scan_complete_status { - IWM_SCAN_COMP_STATUS_OK = 0x1, - IWM_SCAN_COMP_STATUS_ABORT = 0x2, - IWM_SCAN_COMP_STATUS_ERR_SLEEP = 0x3, - IWM_SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT = 0x4, - IWM_SCAN_COMP_STATUS_ERR_PROBE = 0x5, - IWM_SCAN_COMP_STATUS_ERR_WAKEUP = 0x6, - IWM_SCAN_COMP_STATUS_ERR_ANTENNAS = 0x7, - IWM_SCAN_COMP_STATUS_ERR_INTERNAL = 0x8, - IWM_SCAN_COMP_STATUS_ERR_COEX = 0x9, - IWM_SCAN_COMP_STATUS_P2P_ACTION_OK = 0xA, - IWM_SCAN_COMP_STATUS_ITERATION_END = 0x0B, - IWM_SCAN_COMP_STATUS_ERR_ALLOC_TE = 0x0C, -}; - -/** - * struct iwm_scan_results_notif - scan results for one channel - * ( IWM_SCAN_RESULTS_NOTIFICATION = 0x83 ) + * struct iwm_scan_results_notif - scan results for one channel - + * SCAN_RESULT_NTF_API_S_VER_3 * @channel: which channel the results are from * @band: 0 for 5.2 GHz, 1 for 2.4 GHz * @probe_status: IWM_SCAN_PROBE_STATUS_*, indicates success of probe request * @num_probe_not_sent: # of request that weren't sent due to not enough time * @duration: duration spent in channel, in usecs - * @statistics: statistics gathered for this channel */ struct iwm_scan_results_notif { uint8_t channel; @@ -5003,8 +4962,7 @@ struct iwm_scan_results_notif { uint8_t probe_status; uint8_t num_probe_not_sent; uint32_t duration; - uint32_t statistics[IWM_SCAN_RESULTS_STATISTICS]; -} __packed; /* IWM_SCAN_RESULT_NTF_API_S_VER_2 */ +} __packed; enum iwm_scan_framework_client { IWM_SCAN_CLIENT_SCHED_SCAN = (1 << 0), From 9612bbf4239704dccff266a6495b60f18d22197c Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:44:48 +0000 Subject: [PATCH 031/142] if_iwm - Configure the PCIe LTR, fix PCI express capability accesses. Taken-From: Linux iwlwifi Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (08a7ad5a5ff65aaaf2df6a609be7a4e1df43efc3) --- sys/dev/iwm/if_iwm.c | 18 ++++++++++++ sys/dev/iwm/if_iwm_pcie_trans.c | 31 ++++++++++++++++---- sys/dev/iwm/if_iwmreg.h | 52 +++++++++++++++++++++++++++++++++ sys/dev/iwm/if_iwmvar.h | 2 ++ 4 files changed, 98 insertions(+), 5 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 80ed907a3090..3495398ec092 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -320,6 +320,7 @@ static int iwm_send_phy_cfg_cmd(struct iwm_softc *); static int iwm_mvm_load_ucode_wait_alive(struct iwm_softc *, enum iwm_ucode_type); static int iwm_run_init_mvm_ucode(struct iwm_softc *, int); +static int iwm_mvm_config_ltr(struct iwm_softc *sc); static int iwm_rx_addbuf(struct iwm_softc *, int, int); static int iwm_mvm_get_signal_strength(struct iwm_softc *, struct iwm_rx_phy_info *); @@ -3000,6 +3001,19 @@ iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justnvm) return ret; } +static int +iwm_mvm_config_ltr(struct iwm_softc *sc) +{ + struct iwm_ltr_config_cmd cmd = { + .flags = htole32(IWM_LTR_CFG_FLAG_FEATURE_ENABLE), + }; + + if (!sc->sc_ltr_enabled) + return 0; + + return iwm_mvm_send_cmd_pdu(sc, IWM_LTR_CONFIG, 0, sizeof(cmd), &cmd); +} + /* * receive side */ @@ -4665,6 +4679,9 @@ iwm_init_hw(struct iwm_softc *sc) if (sc->cfg->device_family == IWM_DEVICE_FAMILY_7000) iwm_mvm_tt_tx_backoff(sc, 0); + if (iwm_mvm_config_ltr(sc) != 0) + device_printf(sc->sc_dev, "PCIe LTR configuration failed\n"); + error = iwm_mvm_power_update_device(sc); if (error) goto error; @@ -5292,6 +5309,7 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) case IWM_MAC_CONTEXT_CMD: case IWM_REPLY_SF_CFG_CMD: case IWM_POWER_TABLE_CMD: + case IWM_LTR_CONFIG: case IWM_PHY_CONTEXT_CMD: case IWM_BINDING_CONTEXT_CMD: case IWM_TIME_EVENT_CMD: diff --git a/sys/dev/iwm/if_iwm_pcie_trans.c b/sys/dev/iwm/if_iwm_pcie_trans.c index e65c81e54c00..a50e47945812 100644 --- a/sys/dev/iwm/if_iwm_pcie_trans.c +++ b/sys/dev/iwm/if_iwm_pcie_trans.c @@ -406,18 +406,39 @@ iwm_prepare_card_hw(struct iwm_softc *sc) void iwm_apm_config(struct iwm_softc *sc) { - uint16_t reg; + uint16_t lctl, cap; + int pcie_ptr; - reg = pci_read_config(sc->sc_dev, PCIER_LINK_CTL, sizeof(reg)); - if (reg & PCIEM_LINK_CTL_ASPMC_L1) { - /* Um the Linux driver prints "Disabling L0S for this one ... */ + /* + * HW bug W/A for instability in PCIe bus L0S->L1 transition. + * Check if BIOS (or OS) enabled L1-ASPM on this device. + * If so (likely), disable L0S, so device moves directly L0->L1; + * costs negligible amount of power savings. + * If not (unlikely), enable L0S, so there is at least some + * power savings, even without L1. + */ + int error; + + error = pci_find_cap(sc->sc_dev, PCIY_EXPRESS, &pcie_ptr); + if (error != 0) + return; + lctl = pci_read_config(sc->sc_dev, pcie_ptr + PCIER_LINK_CTL, + sizeof(lctl)); + if (lctl & PCIEM_LINK_CTL_ASPMC_L1) { IWM_SETBITS(sc, IWM_CSR_GIO_REG, IWM_CSR_GIO_REG_VAL_L0S_ENABLED); } else { - /* ... and "Enabling" here */ IWM_CLRBITS(sc, IWM_CSR_GIO_REG, IWM_CSR_GIO_REG_VAL_L0S_ENABLED); } + + cap = pci_read_config(sc->sc_dev, pcie_ptr + PCIER_DEVICE_CTL2, + sizeof(cap)); + sc->sc_ltr_enabled = (cap & PCIEM_CTL2_LTR_ENABLE) ? 1 : 0; + IWM_DPRINTF(sc, IWM_DEBUG_RESET | IWM_DEBUG_PWRSAVE, + "L1 %sabled - LTR %sabled\n", + (lctl & PCIEM_LINK_CTL_ASPMC_L1) ? "En" : "Dis", + sc->sc_ltr_enabled ? "En" : "Dis"); } /* diff --git a/sys/dev/iwm/if_iwmreg.h b/sys/dev/iwm/if_iwmreg.h index 5c1113582197..49ca45b56b3a 100644 --- a/sys/dev/iwm/if_iwmreg.h +++ b/sys/dev/iwm/if_iwmreg.h @@ -1790,6 +1790,7 @@ enum { /* Power - legacy power table command */ IWM_POWER_TABLE_CMD = 0x77, IWM_PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78, + IWM_LTR_CONFIG = 0xee, /* Thermal Throttling*/ IWM_REPLY_THERMAL_MNG_BACKOFF = 0x7e, @@ -3522,6 +3523,57 @@ struct iwm_nonqos_seq_query_cmd { /* Power Management Commands, Responses, Notifications */ +/** + * enum iwm_ltr_config_flags - masks for LTR config command flags + * @IWM_LTR_CFG_FLAG_FEATURE_ENABLE: Feature operational status + * @IWM_LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS: allow LTR change on shadow + * memory access + * @IWM_LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH: allow LTR msg send on ANY LTR + * reg change + * @IWM_LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3: allow LTR msg send on transition from + * D0 to D3 + * @IWM_LTR_CFG_FLAG_SW_SET_SHORT: fixed static short LTR register + * @IWM_LTR_CFG_FLAG_SW_SET_LONG: fixed static short LONG register + * @IWM_LTR_CFG_FLAG_DENIE_C10_ON_PD: allow going into C10 on PD + */ +enum iwm_ltr_config_flags { + IWM_LTR_CFG_FLAG_FEATURE_ENABLE = (1 << 0), + IWM_LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS = (1 << 1), + IWM_LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH = (1 << 2), + IWM_LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3 = (1 << 3), + IWM_LTR_CFG_FLAG_SW_SET_SHORT = (1 << 4), + IWM_LTR_CFG_FLAG_SW_SET_LONG = (1 << 5), + IWM_LTR_CFG_FLAG_DENIE_C10_ON_PD = (1 << 6), +}; + +/** + * struct iwm_ltr_config_cmd_v1 - configures the LTR + * @flags: See %enum iwm_ltr_config_flags + */ +struct iwm_ltr_config_cmd_v1 { + uint32_t flags; + uint32_t static_long; + uint32_t static_short; +} __packed; /* LTR_CAPABLE_API_S_VER_1 */ + +#define IWM_LTR_VALID_STATES_NUM 4 + +/** + * struct iwm_ltr_config_cmd - configures the LTR + * @flags: See %enum iwm_ltr_config_flags + * @static_long: + * @static_short: + * @ltr_cfg_values: + * @ltr_short_idle_timeout: + */ +struct iwm_ltr_config_cmd { + uint32_t flags; + uint32_t static_long; + uint32_t static_short; + uint32_t ltr_cfg_values[IWM_LTR_VALID_STATES_NUM]; + uint32_t ltr_short_idle_timeout; +} __packed; /* LTR_CAPABLE_API_S_VER_2 */ + /* Radio LP RX Energy Threshold measured in dBm */ #define IWM_POWER_LPRX_RSSI_THRESHOLD 75 #define IWM_POWER_LPRX_RSSI_THRESHOLD_MAX 94 diff --git a/sys/dev/iwm/if_iwmvar.h b/sys/dev/iwm/if_iwmvar.h index bcd08ef65057..e24861aacf54 100644 --- a/sys/dev/iwm/if_iwmvar.h +++ b/sys/dev/iwm/if_iwmvar.h @@ -556,6 +556,8 @@ struct iwm_softc { /* Indicate if device power save is allowed */ boolean_t sc_ps_disabled; + + int sc_ltr_enabled; }; #define IWM_LOCK_INIT(_sc) \ From ef217a3417d99c9ce35f47a28fd866d67c00bb50 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:45:24 +0000 Subject: [PATCH 032/142] if_iwm - Add firmware API definitions for TX power commands. * While there remove unused IWM_UCODE_TLV_CAPA_LMAC_UPLOAD definition, which isn't defined in iwlwifi. Taken-From: Linux iwlwifi Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (fd4f9de8bc72ea961e50829b45b59d0549040b7d) --- sys/dev/iwm/if_iwm_config.h | 2 ++ sys/dev/iwm/if_iwmreg.h | 52 ++++++++++++++++++++++++++++++++++--- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/sys/dev/iwm/if_iwm_config.h b/sys/dev/iwm/if_iwm_config.h index 0fe313f050f2..4d8979739686 100644 --- a/sys/dev/iwm/if_iwm_config.h +++ b/sys/dev/iwm/if_iwm_config.h @@ -80,6 +80,8 @@ enum iwm_device_family { IWM_DEVICE_FAMILY_8000, }; +#define IWM_DEFAULT_MAX_TX_POWER 22 + /* Antenna presence definitions */ #define IWM_ANT_NONE 0x0 #define IWM_ANT_A (1 << 0) diff --git a/sys/dev/iwm/if_iwmreg.h b/sys/dev/iwm/if_iwmreg.h index 49ca45b56b3a..72deea1dee80 100644 --- a/sys/dev/iwm/if_iwmreg.h +++ b/sys/dev/iwm/if_iwmreg.h @@ -702,8 +702,9 @@ enum iwm_ucode_tlv_api { * @IWM_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG: support getting more shared * memory addresses from the firmware. * @IWM_UCODE_TLV_CAPA_LQM_SUPPORT: supports Link Quality Measurement - * @IWM_UCODE_TLV_CAPA_LMAC_UPLOAD: supports upload mode in lmac (1=supported, - * 0=no support) + * @IWM_UCODE_TLV_CAPA_TX_POWER_ACK: reduced TX power API has larger + * command size (command version 4) that supports toggling ACK TX + * power reduction. * * @IWM_NUM_UCODE_TLV_CAPA: number of bits used */ @@ -744,9 +745,9 @@ enum iwm_ucode_tlv_capa { IWM_UCODE_TLV_CAPA_TEMP_THS_REPORT_SUPPORT = 75, IWM_UCODE_TLV_CAPA_CTDP_SUPPORT = 76, IWM_UCODE_TLV_CAPA_USNIFFER_UNIFIED = 77, - IWM_UCODE_TLV_CAPA_LMAC_UPLOAD = 79, IWM_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG = 80, IWM_UCODE_TLV_CAPA_LQM_SUPPORT = 81, + IWM_UCODE_TLV_CAPA_TX_POWER_ACK = 84, IWM_NUM_UCODE_TLV_CAPA = 128 }; @@ -1917,6 +1918,51 @@ struct iwm_reduce_tx_power_cmd { uint16_t pwr_restriction; } __packed; /* IWM_TX_REDUCED_POWER_API_S_VER_1 */ +enum iwm_dev_tx_power_cmd_mode { + IWM_TX_POWER_MODE_SET_MAC = 0, + IWM_TX_POWER_MODE_SET_DEVICE = 1, + IWM_TX_POWER_MODE_SET_CHAINS = 2, + IWM_TX_POWER_MODE_SET_ACK = 3, +}; /* TX_POWER_REDUCED_FLAGS_TYPE_API_E_VER_4 */; + +#define IWM_NUM_CHAIN_LIMITS 2 +#define IWM_NUM_SUB_BANDS 5 + +/** + * struct iwm_dev_tx_power_cmd - TX power reduction command + * @set_mode: see &enum iwl_dev_tx_power_cmd_mode + * @mac_context_id: id of the mac ctx for which we are reducing TX power. + * @pwr_restriction: TX power restriction in 1/8 dBms. + * @dev_24: device TX power restriction in 1/8 dBms + * @dev_52_low: device TX power restriction upper band - low + * @dev_52_high: device TX power restriction upper band - high + * @per_chain_restriction: per chain restrictions + */ +struct iwm_dev_tx_power_cmd_v3 { + uint32_t set_mode; + uint32_t mac_context_id; + uint16_t pwr_restriction; + uint16_t dev_24; + uint16_t dev_52_low; + uint16_t dev_52_high; + uint16_t per_chain_restriction[IWM_NUM_CHAIN_LIMITS][IWM_NUM_SUB_BANDS]; +} __packed; /* TX_REDUCED_POWER_API_S_VER_3 */ + +#define IWM_DEV_MAX_TX_POWER 0x7FFF + +/** + * struct iwm_dev_tx_power_cmd - TX power reduction command + * @v3: version 3 of the command, embedded here for easier software handling + * @enable_ack_reduction: enable or disable close range ack TX power + * reduction. + */ +struct iwm_dev_tx_power_cmd { + /* v4 is just an extension of v3 - keep this here */ + struct iwm_dev_tx_power_cmd_v3 v3; + uint8_t enable_ack_reduction; + uint8_t reserved[3]; +} __packed; /* TX_REDUCED_POWER_API_S_VER_4 */ + /* * Calibration control struct. * Sent as part of the phy configuration command. From 8d969c53d23c449c05bf9099d91046230636f6cc Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:45:55 +0000 Subject: [PATCH 033/142] iwm - Track firmware state better, and improve handling in iwm_newstate(). * This avoids firmware resets in all the cases in iwm_newstate(). Instead iwm_bring_down_firmware() is called, which tears down all the STA connection state, according to the sc->sc_firmware_state value. * Improve the behaviour of the LED blinking a bit, so it only blinks when there really is a wireless scan going on. * Print the newstate arg in debug output of iwm_newstate(), to help in debugging. This is inspired by the firmware state maintaining change in OpenBSD's iwm, by stsp@openbsd.org (OpenBSD Git 0ddb056fb7370664b1d4b84392697cb17d1a414a). Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (8a41b10ac639d0609878696808387a6799d39b57) --- sys/dev/iwm/if_iwm.c | 293 ++++++++++++++++------------------ sys/dev/iwm/if_iwm_mac_ctxt.c | 7 +- sys/dev/iwm/if_iwm_sta.c | 2 +- sys/dev/iwm/if_iwmvar.h | 4 + 4 files changed, 147 insertions(+), 159 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 3495398ec092..24203bb44c30 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -350,7 +350,6 @@ static int iwm_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); static int iwm_mvm_update_quotas(struct iwm_softc *, struct iwm_vap *); static int iwm_auth(struct ieee80211vap *, struct iwm_softc *); -static int iwm_release(struct iwm_softc *, struct iwm_node *); static struct ieee80211_node * iwm_node_alloc(struct ieee80211vap *, const uint8_t[IEEE80211_ADDR_LEN]); @@ -1263,6 +1262,7 @@ iwm_stop_device(struct iwm_softc *sc) iv->phy_ctxt = NULL; iv->is_uploaded = 0; } + sc->sc_firmware_state = 0; /* device going down, Stop using ICT table */ sc->sc_flags &= ~IWM_FLAG_USE_ICT; @@ -3951,8 +3951,11 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *sc) __func__, vap, ni); + IWM_DPRINTF(sc, IWM_DEBUG_STATE, "%s: Current node bssid: %s\n", + __func__, ether_sprintf(ni->ni_bssid)); in->in_assoc = 0; + iv->iv_auth = 1; /* * Firmware bug - it'll crash if the beacon interval is less @@ -4004,6 +4007,7 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *sc) goto out; } } + sc->sc_firmware_state = 1; if ((error = iwm_mvm_phy_ctxt_changed(sc, &sc->sc_phyctxt[0], in->in_ni.ni_chan, 1, 1)) != 0) { @@ -4018,6 +4022,7 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *sc) "%s: binding update cmd\n", __func__); goto out; } + sc->sc_firmware_state = 2; /* * Authentication becomes unreliable when powersaving is left enabled * here. Powersaving will be activated again when association has @@ -4037,6 +4042,7 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *sc) "%s: failed to add sta\n", __func__); goto out; } + sc->sc_firmware_state = 3; /* * Prevent the FW from wandering off channel during association @@ -4049,81 +4055,12 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *sc) error = 0; out: + if (error != 0) + iv->iv_auth = 0; ieee80211_free_node(ni); return (error); } -static int -iwm_release(struct iwm_softc *sc, struct iwm_node *in) -{ - uint32_t tfd_msk; - - /* - * Ok, so *technically* the proper set of calls for going - * from RUN back to SCAN is: - * - * iwm_mvm_power_mac_disable(sc, in); - * iwm_mvm_mac_ctxt_changed(sc, vap); - * iwm_mvm_rm_sta(sc, in); - * iwm_mvm_update_quotas(sc, NULL); - * iwm_mvm_mac_ctxt_changed(sc, in); - * iwm_mvm_binding_remove_vif(sc, IWM_VAP(in->in_ni.ni_vap)); - * iwm_mvm_mac_ctxt_remove(sc, in); - * - * However, that freezes the device not matter which permutations - * and modifications are attempted. Obviously, this driver is missing - * something since it works in the Linux driver, but figuring out what - * is missing is a little more complicated. Now, since we're going - * back to nothing anyway, we'll just do a complete device reset. - * Up your's, device! - */ - /* - * Just using 0xf for the queues mask is fine as long as we only - * get here from RUN state. - */ - tfd_msk = 0xf; - iwm_xmit_queue_drain(sc); - iwm_mvm_flush_tx_path(sc, tfd_msk, IWM_CMD_SYNC); - /* - * We seem to get away with just synchronously sending the - * IWM_TXPATH_FLUSH command. - */ -// iwm_trans_wait_tx_queue_empty(sc, tfd_msk); - iwm_stop_device(sc); - iwm_init_hw(sc); - if (in) - in->in_assoc = 0; - return 0; - -#if 0 - int error; - - iwm_mvm_power_mac_disable(sc, in); - - if ((error = iwm_mvm_mac_ctxt_changed(sc, vap)) != 0) { - device_printf(sc->sc_dev, "mac ctxt change fail 1 %d\n", error); - return error; - } - - if ((error = iwm_mvm_rm_sta(sc, in)) != 0) { - device_printf(sc->sc_dev, "sta remove fail %d\n", error); - return error; - } - error = iwm_mvm_rm_sta(sc, in); - in->in_assoc = 0; - iwm_mvm_update_quotas(sc, NULL); - if ((error = iwm_mvm_mac_ctxt_changed(sc, vap)) != 0) { - device_printf(sc->sc_dev, "mac ctxt change fail 2 %d\n", error); - return error; - } - iwm_mvm_binding_remove_vif(sc, IWM_VAP(in->in_ni.ni_vap)); - - iwm_mvm_mac_ctxt_remove(sc, in); - - return error; -#endif -} - static struct ieee80211_node * iwm_node_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) { @@ -4282,6 +4219,97 @@ iwm_media_change(struct ifnet *ifp) return error; } +static void +iwm_bring_down_firmware(struct iwm_softc *sc, struct ieee80211vap *vap) +{ + struct iwm_vap *ivp = IWM_VAP(vap); + int error; + + ivp->iv_auth = 0; + if (sc->sc_firmware_state == 3) { + iwm_xmit_queue_drain(sc); +// iwm_mvm_flush_tx_path(sc, 0xf, IWM_CMD_SYNC); + error = iwm_mvm_rm_sta(sc, vap, TRUE); + if (error) { + device_printf(sc->sc_dev, + "%s: Failed to remove station: %d\n", + __func__, error); + } + } + if (sc->sc_firmware_state == 3) { + error = iwm_mvm_mac_ctxt_changed(sc, vap); + if (error) { + device_printf(sc->sc_dev, + "%s: Failed to change mac context: %d\n", + __func__, error); + } + } + if (sc->sc_firmware_state == 3) { + error = iwm_mvm_sf_update(sc, vap, FALSE); + if (error) { + device_printf(sc->sc_dev, + "%s: Failed to update smart FIFO: %d\n", + __func__, error); + } + } + if (sc->sc_firmware_state == 3) { + error = iwm_mvm_rm_sta_id(sc, vap); + if (error) { + device_printf(sc->sc_dev, + "%s: Failed to remove station id: %d\n", + __func__, error); + } + } + if (sc->sc_firmware_state == 3) { + error = iwm_mvm_update_quotas(sc, NULL); + if (error) { + device_printf(sc->sc_dev, + "%s: Failed to update PHY quota: %d\n", + __func__, error); + } + } + if (sc->sc_firmware_state == 3) { + /* XXX Might need to specify bssid correctly. */ + error = iwm_mvm_mac_ctxt_changed(sc, vap); + if (error) { + device_printf(sc->sc_dev, + "%s: Failed to change mac context: %d\n", + __func__, error); + } + } + if (sc->sc_firmware_state == 3) { + sc->sc_firmware_state = 2; + } + if (sc->sc_firmware_state > 1) { + error = iwm_mvm_binding_remove_vif(sc, ivp); + if (error) { + device_printf(sc->sc_dev, + "%s: Failed to remove channel ctx: %d\n", + __func__, error); + } + } + if (sc->sc_firmware_state > 1) { + sc->sc_firmware_state = 1; + } + ivp->phy_ctxt = NULL; + if (sc->sc_firmware_state > 0) { + error = iwm_mvm_mac_ctxt_changed(sc, vap); + if (error) { + device_printf(sc->sc_dev, + "%s: Failed to change mac context: %d\n", + __func__, error); + } + } + if (sc->sc_firmware_state > 0) { + error = iwm_mvm_power_update_mac(sc); + if (error != 0) { + device_printf(sc->sc_dev, + "%s: failed to update power management\n", + __func__); + } + } + sc->sc_firmware_state = 0; +} static int iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) @@ -4293,115 +4321,64 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) int error; IWM_DPRINTF(sc, IWM_DEBUG_STATE, - "switching state %s -> %s\n", + "switching state %s -> %s arg=0x%x\n", ieee80211_state_name[vap->iv_state], - ieee80211_state_name[nstate]); + ieee80211_state_name[nstate], + arg); + IEEE80211_UNLOCK(ic); IWM_LOCK(sc); - if (vap->iv_state == IEEE80211_S_SCAN && nstate != vap->iv_state) + if ((sc->sc_flags & IWM_FLAG_SCAN_RUNNING) && + (nstate == IEEE80211_S_AUTH || + nstate == IEEE80211_S_ASSOC || + nstate == IEEE80211_S_RUN)) { + /* Stop blinking for a scan, when authenticating. */ iwm_led_blink_stop(sc); + } - /* disable beacon filtering if we're hopping out of RUN */ - if (vap->iv_state == IEEE80211_S_RUN && nstate != vap->iv_state) { + if (vap->iv_state == IEEE80211_S_RUN && nstate != IEEE80211_S_RUN) { + iwm_mvm_led_disable(sc); + /* disable beacon filtering if we're hopping out of RUN */ iwm_mvm_disable_beacon_filter(sc); - if (((in = IWM_NODE(vap->iv_bss)) != NULL)) in->in_assoc = 0; + } - if (nstate == IEEE80211_S_INIT) { - IWM_UNLOCK(sc); - IEEE80211_LOCK(ic); - error = ivp->iv_newstate(vap, nstate, arg); - IEEE80211_UNLOCK(ic); - IWM_LOCK(sc); - iwm_release(sc, NULL); - IWM_UNLOCK(sc); - IEEE80211_LOCK(ic); - return error; - } - + if ((vap->iv_state == IEEE80211_S_RUN || + vap->iv_state == IEEE80211_S_ASSOC) && + nstate == IEEE80211_S_INIT) { /* - * It's impossible to directly go RUN->SCAN. If we iwm_release() - * above then the card will be completely reinitialized, - * so the driver must do everything necessary to bring the card - * from INIT to SCAN. - * - * Additionally, upon receiving deauth frame from AP, - * OpenBSD 802.11 stack puts the driver in IEEE80211_S_AUTH - * state. This will also fail with this driver, so bring the FSM - * from IEEE80211_S_RUN to IEEE80211_S_SCAN in this case as well. - * - * XXX TODO: fix this for FreeBSD! + * In this case, iv_newstate() wants to send an 80211 frame on + * the network that we are leaving. So we need to call it, + * before tearing down all the firmware state. */ - if (nstate == IEEE80211_S_SCAN || - nstate == IEEE80211_S_AUTH || - nstate == IEEE80211_S_ASSOC) { - IWM_DPRINTF(sc, IWM_DEBUG_STATE, - "Force transition to INIT; MGT=%d\n", arg); - IWM_UNLOCK(sc); - IEEE80211_LOCK(ic); - /* Always pass arg as -1 since we can't Tx right now. */ - /* - * XXX arg is just ignored anyway when transitioning - * to IEEE80211_S_INIT. - */ - vap->iv_newstate(vap, IEEE80211_S_INIT, -1); - IWM_DPRINTF(sc, IWM_DEBUG_STATE, - "Going INIT->SCAN\n"); - nstate = IEEE80211_S_SCAN; - IEEE80211_UNLOCK(ic); - IWM_LOCK(sc); - } + IWM_UNLOCK(sc); + IEEE80211_LOCK(ic); + ivp->iv_newstate(vap, nstate, arg); + IEEE80211_UNLOCK(ic); + IWM_LOCK(sc); + iwm_bring_down_firmware(sc, vap); + IWM_UNLOCK(sc); + IEEE80211_LOCK(ic); + return 0; } switch (nstate) { case IEEE80211_S_INIT: case IEEE80211_S_SCAN: - if (vap->iv_state == IEEE80211_S_AUTH || - vap->iv_state == IEEE80211_S_ASSOC) { - int myerr; - IWM_UNLOCK(sc); - IEEE80211_LOCK(ic); - myerr = ivp->iv_newstate(vap, nstate, arg); - IEEE80211_UNLOCK(ic); - IWM_LOCK(sc); - error = iwm_mvm_rm_sta(sc, vap, FALSE); - if (error) { - device_printf(sc->sc_dev, - "%s: Failed to remove station: %d\n", - __func__, error); - } - error = iwm_mvm_mac_ctxt_changed(sc, vap); - if (error) { - device_printf(sc->sc_dev, - "%s: Failed to change mac context: %d\n", - __func__, error); - } - error = iwm_mvm_binding_remove_vif(sc, ivp); - if (error) { - device_printf(sc->sc_dev, - "%s: Failed to remove channel ctx: %d\n", - __func__, error); - } - ivp->phy_ctxt = NULL; - error = iwm_mvm_power_update_mac(sc); - if (error != 0) { - device_printf(sc->sc_dev, - "%s: failed to update power management\n", - __func__); - } - IWM_UNLOCK(sc); - IEEE80211_LOCK(ic); - return myerr; - } break; case IEEE80211_S_AUTH: + iwm_bring_down_firmware(sc, vap); if ((error = iwm_auth(vap, sc)) != 0) { device_printf(sc->sc_dev, "%s: could not move to auth state: %d\n", __func__, error); + iwm_bring_down_firmware(sc, vap); + IWM_UNLOCK(sc); + IEEE80211_LOCK(ic); + return 1; } break; @@ -5566,6 +5543,8 @@ iwm_intr(void *arg) device_printf(sc->sc_dev, " 802.11 state %d\n", (vap == NULL) ? -1 : vap->iv_state); + /* Reset our firmware state tracking. */ + sc->sc_firmware_state = 0; /* Don't stop the device; just do a VAP restart */ IWM_UNLOCK(sc); diff --git a/sys/dev/iwm/if_iwm_mac_ctxt.c b/sys/dev/iwm/if_iwm_mac_ctxt.c index 37725e79fb55..2bf0775cc10c 100644 --- a/sys/dev/iwm/if_iwm_mac_ctxt.c +++ b/sys/dev/iwm/if_iwm_mac_ctxt.c @@ -309,7 +309,12 @@ iwm_mvm_mac_ctxt_cmd_common(struct iwm_softc *sc, struct iwm_node *in, * iwm_mvm_mac_ctxt_changed() when already authenticating or * associating, ni->ni_bssid should always make sense here. */ - IEEE80211_ADDR_COPY(cmd->bssid_addr, ni->ni_bssid); + if (ivp->iv_auth) { + IEEE80211_ADDR_COPY(cmd->bssid_addr, ni->ni_bssid); + } else { + /* XXX Or maybe all zeroes address? */ + IEEE80211_ADDR_COPY(cmd->bssid_addr, ieee80211broadcastaddr); + } #endif /* diff --git a/sys/dev/iwm/if_iwm_sta.c b/sys/dev/iwm/if_iwm_sta.c index 21d6e5e590ae..507176710c8c 100644 --- a/sys/dev/iwm/if_iwm_sta.c +++ b/sys/dev/iwm/if_iwm_sta.c @@ -286,7 +286,7 @@ iwm_mvm_rm_sta(struct iwm_softc *sc, struct ieee80211vap *vap, for (ac = 0; ac < WME_NUM_AC; ac++) { tfd_queue_msk |= htole32(1 << iwm_mvm_ac_to_tx_fifo[ac]); } - ret = iwm_mvm_flush_tx_path(sc, tfd_queue_msk, 0); + ret = iwm_mvm_flush_tx_path(sc, tfd_queue_msk, IWM_CMD_SYNC); if (ret) return ret; #ifdef notyet /* function not yet implemented */ diff --git a/sys/dev/iwm/if_iwmvar.h b/sys/dev/iwm/if_iwmvar.h index e24861aacf54..ac7b35d56bd9 100644 --- a/sys/dev/iwm/if_iwmvar.h +++ b/sys/dev/iwm/if_iwmvar.h @@ -365,6 +365,7 @@ struct iwm_bf_data { struct iwm_vap { struct ieee80211vap iv_vap; int is_uploaded; + int iv_auth; int (*iv_newstate)(struct ieee80211vap *, enum ieee80211_state, int); @@ -558,6 +559,9 @@ struct iwm_softc { boolean_t sc_ps_disabled; int sc_ltr_enabled; + + /* Track firmware state for STA association. */ + int sc_firmware_state; }; #define IWM_LOCK_INIT(_sc) \ From 002c4a619bbdbf8db6e07af5262411b9b550170f Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:46:35 +0000 Subject: [PATCH 034/142] iwm - Avoid Tx watchdog timeout, when dropping a connection. Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (3e12596fb5c55351517cdd741d72979388a8c75c) --- sys/dev/iwm/if_iwm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 24203bb44c30..965a1eb1d23c 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -4329,6 +4329,10 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) IEEE80211_UNLOCK(ic); IWM_LOCK(sc); + /* Avoid Tx watchdog triggering, when a connectionm is dropped. */ + if (vap->iv_state == IEEE80211_S_RUN && nstate != IEEE80211_S_RUN) + sc->sc_tx_timer = 0; + if ((sc->sc_flags & IWM_FLAG_SCAN_RUNNING) && (nstate == IEEE80211_S_AUTH || nstate == IEEE80211_S_ASSOC || From 9a949c99e629f4a0e07a28daa137a3bb52fe9ce8 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:47:04 +0000 Subject: [PATCH 035/142] iwm - Improve firmware Time Event handling. * This is a mix of the OpenBSD Git 7fd9664469d1b717a307eebd74aeececbd3c41cc change, and syncing with the Linux iwlwifi code. Taken-From: Linux iwlwifi, and OpenBSD Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (706a3044afd27c3fecfdf57bec1695310e53e228) --- sys/dev/iwm/if_iwm.c | 13 ++- sys/dev/iwm/if_iwm_debug.h | 1 + sys/dev/iwm/if_iwm_time_event.c | 167 ++++++++++++++++++++++++++++++-- sys/dev/iwm/if_iwm_time_event.h | 4 +- sys/dev/iwm/if_iwmvar.h | 4 + 5 files changed, 180 insertions(+), 9 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 965a1eb1d23c..c197d991dd37 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -1263,6 +1263,7 @@ iwm_stop_device(struct iwm_softc *sc) iv->is_uploaded = 0; } sc->sc_firmware_state = 0; + sc->sc_flags &= ~IWM_FLAG_TE_ACTIVE; /* device going down, Stop using ICT table */ sc->sc_flags &= ~IWM_FLAG_USE_ICT; @@ -4050,8 +4051,7 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *sc) */ /* XXX duration is in units of TU, not MS */ duration = IWM_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS; - iwm_mvm_protect_session(sc, iv, duration, 500 /* XXX magic number */); - DELAY(100); + iwm_mvm_protect_session(sc, iv, duration, 500 /* XXX magic number */, TRUE); error = 0; out: @@ -4349,6 +4349,15 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) in->in_assoc = 0; } + if ((vap->iv_state == IEEE80211_S_AUTH || + vap->iv_state == IEEE80211_S_ASSOC || + vap->iv_state == IEEE80211_S_RUN) && + (nstate == IEEE80211_S_INIT || + nstate == IEEE80211_S_SCAN || + nstate == IEEE80211_S_AUTH)) { + iwm_mvm_stop_session_protection(sc, ivp); + } + if ((vap->iv_state == IEEE80211_S_RUN || vap->iv_state == IEEE80211_S_ASSOC) && nstate == IEEE80211_S_INIT) { diff --git a/sys/dev/iwm/if_iwm_debug.h b/sys/dev/iwm/if_iwm_debug.h index 2a2ac731288d..35d624436e08 100644 --- a/sys/dev/iwm/if_iwm_debug.h +++ b/sys/dev/iwm/if_iwm_debug.h @@ -44,6 +44,7 @@ enum { IWM_DEBUG_TEMP = 0x00100000, /* Thermal Sensor handling */ IWM_DEBUG_FW = 0x00200000, /* Firmware management */ IWM_DEBUG_LAR = 0x00400000, /* Location Aware Regulatory */ + IWM_DEBUG_TE = 0x00800000, /* Time Event handling */ IWM_DEBUG_REGISTER = 0x20000000, /* print chipset register */ IWM_DEBUG_TRACE = 0x40000000, /* Print begin and start driver function */ IWM_DEBUG_FATAL = 0x80000000, /* fatal errors */ diff --git a/sys/dev/iwm/if_iwm_time_event.c b/sys/dev/iwm/if_iwm_time_event.c index db24ea986fe4..340d19d27246 100644 --- a/sys/dev/iwm/if_iwm_time_event.c +++ b/sys/dev/iwm/if_iwm_time_event.c @@ -155,6 +155,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -165,32 +166,133 @@ __FBSDID("$FreeBSD$"); #define IWM_MVM_ROC_TE_TYPE_NORMAL IWM_TE_P2P_DEVICE_DISCOVERABLE #define IWM_MVM_ROC_TE_TYPE_MGMT_TX IWM_TE_P2P_CLIENT_ASSOC +static int +iwm_mvm_te_notif(struct iwm_softc *sc, struct iwm_rx_packet *pkt, + void *data) +{ + struct iwm_time_event_notif *resp; + int resp_len = iwm_rx_packet_payload_len(pkt); + + if (pkt->hdr.code != IWM_TIME_EVENT_NOTIFICATION || + resp_len != sizeof(*resp)) { + IWM_DPRINTF(sc, IWM_DEBUG_TE, + "Invalid TIME_EVENT_NOTIFICATION response\n"); + return 1; + } + + resp = (void *)pkt->data; + + /* te_data->uid is already set in the TIME_EVENT_CMD response */ + if (le32toh(resp->unique_id) != sc->sc_time_event_uid) + return false; + + IWM_DPRINTF(sc, IWM_DEBUG_TE, + "TIME_EVENT_NOTIFICATION response - UID = 0x%x\n", + sc->sc_time_event_uid); + if (!resp->status) { + IWM_DPRINTF(sc, IWM_DEBUG_TE, + "TIME_EVENT_NOTIFICATION received but not executed\n"); + } + + return 1; +} + +static int +iwm_mvm_time_event_response(struct iwm_softc *sc, struct iwm_rx_packet *pkt, + void *data) +{ + struct iwm_time_event_resp *resp; + int resp_len = iwm_rx_packet_payload_len(pkt); + + if (pkt->hdr.code != IWM_TIME_EVENT_CMD || + resp_len != sizeof(*resp)) { + IWM_DPRINTF(sc, IWM_DEBUG_TE, + "Invalid TIME_EVENT_CMD response\n"); + return 1; + } + + resp = (void *)pkt->data; + + /* we should never get a response to another TIME_EVENT_CMD here */ + if (le32toh(resp->id) != IWM_TE_BSS_STA_AGGRESSIVE_ASSOC) { + IWM_DPRINTF(sc, IWM_DEBUG_TE, + "Got TIME_EVENT_CMD response with wrong id: %d\n", + le32toh(resp->id)); + return 0; + } + + sc->sc_time_event_uid = le32toh(resp->unique_id); + IWM_DPRINTF(sc, IWM_DEBUG_TE, + "TIME_EVENT_CMD response - UID = 0x%x\n", sc->sc_time_event_uid); + return 1; +} + + +/* XXX Use the te_data function argument properly, like in iwlwifi's code. */ + static int iwm_mvm_time_event_send_add(struct iwm_softc *sc, struct iwm_vap *ivp, void *te_data, struct iwm_time_event_cmd *te_cmd) { + static const uint16_t time_event_response[] = { IWM_TIME_EVENT_CMD }; + struct iwm_notification_wait wait_time_event; int ret; - IWM_DPRINTF(sc, IWM_DEBUG_CMD | IWM_DEBUG_RESET, + IWM_DPRINTF(sc, IWM_DEBUG_TE, "Add new TE, duration %d TU\n", le32toh(te_cmd->duration)); - ret = iwm_mvm_send_cmd_pdu(sc, IWM_TIME_EVENT_CMD, IWM_CMD_SYNC, - sizeof(*te_cmd), te_cmd); + /* + * Use a notification wait, which really just processes the + * command response and doesn't wait for anything, in order + * to be able to process the response and get the UID inside + * the RX path. Using CMD_WANT_SKB doesn't work because it + * stores the buffer and then wakes up this thread, by which + * time another notification (that the time event started) + * might already be processed unsuccessfully. + */ + iwm_init_notification_wait(sc->sc_notif_wait, &wait_time_event, + time_event_response, + nitems(time_event_response), + iwm_mvm_time_event_response, /*te_data*/NULL); + + ret = iwm_mvm_send_cmd_pdu(sc, IWM_TIME_EVENT_CMD, 0, sizeof(*te_cmd), + te_cmd); if (ret) { - IWM_DPRINTF(sc, IWM_DEBUG_CMD | IWM_DEBUG_RESET, + IWM_DPRINTF(sc, IWM_DEBUG_TE, "%s: Couldn't send IWM_TIME_EVENT_CMD: %d\n", __func__, ret); + iwm_remove_notification(sc->sc_notif_wait, &wait_time_event); + return ret; + } + + /* No need to wait for anything, so just pass 1 (0 isn't valid) */ + IWM_UNLOCK(sc); + ret = iwm_wait_notification(sc->sc_notif_wait, &wait_time_event, 1); + IWM_LOCK(sc); + /* should never fail */ + if (ret) { + IWM_DPRINTF(sc, IWM_DEBUG_TE, + "%s: Failed to get response for IWM_TIME_EVENT_CMD: %d\n", + __func__, ret); } return ret; } +#define TU_TO_HZ(tu) (((uint64_t)(tu) * 1024 * hz) / 1000000) + void iwm_mvm_protect_session(struct iwm_softc *sc, struct iwm_vap *ivp, - uint32_t duration, uint32_t max_delay) + uint32_t duration, uint32_t max_delay, boolean_t wait_for_notif) { + const uint16_t te_notif_response[] = { IWM_TIME_EVENT_NOTIFICATION }; + struct iwm_notification_wait wait_te_notif; struct iwm_time_event_cmd time_cmd = {}; + /* Do nothing if a time event is already scheduled. */ + if (sc->sc_flags & IWM_FLAG_TE_ACTIVE) + return; + time_cmd.action = htole32(IWM_FW_CTXT_ACTION_ADD); time_cmd.id_and_color = htole32(IWM_FW_CMD_ID_AND_COLOR(ivp->id, ivp->color)); @@ -209,5 +311,58 @@ iwm_mvm_protect_session(struct iwm_softc *sc, struct iwm_vap *ivp, IWM_TE_V2_NOTIF_HOST_EVENT_END | IWM_T2_V2_START_IMMEDIATELY); - iwm_mvm_time_event_send_add(sc, ivp, /*te_data*/NULL, &time_cmd); + if (!wait_for_notif) { + iwm_mvm_time_event_send_add(sc, ivp, /*te_data*/NULL, &time_cmd); + DELAY(100); + sc->sc_flags |= IWM_FLAG_TE_ACTIVE; + return; + } + + /* + * Create notification_wait for the TIME_EVENT_NOTIFICATION to use + * right after we send the time event + */ + iwm_init_notification_wait(sc->sc_notif_wait, &wait_te_notif, + te_notif_response, nitems(te_notif_response), + iwm_mvm_te_notif, /*te_data*/NULL); + + /* If TE was sent OK - wait for the notification that started */ + if (iwm_mvm_time_event_send_add(sc, ivp, /*te_data*/NULL, &time_cmd)) { + IWM_DPRINTF(sc, IWM_DEBUG_TE, + "%s: Failed to add TE to protect session\n", __func__); + iwm_remove_notification(sc->sc_notif_wait, &wait_te_notif); + } else { + sc->sc_flags |= IWM_FLAG_TE_ACTIVE; + IWM_UNLOCK(sc); + if (iwm_wait_notification(sc->sc_notif_wait, &wait_te_notif, + TU_TO_HZ(max_delay))) { + IWM_DPRINTF(sc, IWM_DEBUG_TE, + "%s: Failed to protect session until TE\n", + __func__); + } + IWM_LOCK(sc); + } +} + +void +iwm_mvm_stop_session_protection(struct iwm_softc *sc, struct iwm_vap *ivp) +{ + struct iwm_time_event_cmd time_cmd = {}; + + /* Do nothing if the time event has already ended. */ + if ((sc->sc_flags & IWM_FLAG_TE_ACTIVE) == 0) + return; + + time_cmd.id = htole32(sc->sc_time_event_uid); + time_cmd.action = htole32(IWM_FW_CTXT_ACTION_REMOVE); + time_cmd.id_and_color = + htole32(IWM_FW_CMD_ID_AND_COLOR(ivp->id, ivp->color)); + + IWM_DPRINTF(sc, IWM_DEBUG_TE, + "%s: Removing TE 0x%x\n", __func__, le32toh(time_cmd.id)); + if (iwm_mvm_send_cmd_pdu(sc, IWM_TIME_EVENT_CMD, 0, sizeof(time_cmd), + &time_cmd) == 0) + sc->sc_flags &= ~IWM_FLAG_TE_ACTIVE; + + DELAY(100); } diff --git a/sys/dev/iwm/if_iwm_time_event.h b/sys/dev/iwm/if_iwm_time_event.h index 4c741428e1ea..0e6dd8887997 100644 --- a/sys/dev/iwm/if_iwm_time_event.h +++ b/sys/dev/iwm/if_iwm_time_event.h @@ -108,6 +108,8 @@ #define __IF_IWM_TIME_EVENT_H__ extern void iwm_mvm_protect_session(struct iwm_softc *sc, struct iwm_vap *ivp, - uint32_t duration, uint32_t max_delay); + uint32_t duration, uint32_t max_delay, boolean_t wait_for_notif); +extern void iwm_mvm_stop_session_protection(struct iwm_softc *sc, + struct iwm_vap *ivp); #endif /* __IF_IWM_TIME_EVENT_H__ */ diff --git a/sys/dev/iwm/if_iwmvar.h b/sys/dev/iwm/if_iwmvar.h index ac7b35d56bd9..536027493a1a 100644 --- a/sys/dev/iwm/if_iwmvar.h +++ b/sys/dev/iwm/if_iwmvar.h @@ -434,6 +434,7 @@ struct iwm_softc { #define IWM_FLAG_BUSY (1 << 4) #define IWM_FLAG_SCANNING (1 << 5) #define IWM_FLAG_SCAN_RUNNING (1 << 6) +#define IWM_FLAG_TE_ACTIVE (1 << 7) struct intr_config_hook sc_preinit_hook; struct callout sc_watchdog_to; @@ -562,6 +563,9 @@ struct iwm_softc { /* Track firmware state for STA association. */ int sc_firmware_state; + + /* Unique ID (assigned by the firmware) of the current Time Event. */ + uint32_t sc_time_event_uid; }; #define IWM_LOCK_INIT(_sc) \ From df34d80aa79fdebdc42c80a9974ed69ccf20c276 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:47:47 +0000 Subject: [PATCH 036/142] iwm - Clear Time Event active state, when receiving End Notification. * This hopefully avoids some firmware panics, I was occasionally seeing, when iwm disconnects upon losing signal to an access point at some point. * This is synchronizing the if_iwm_time_event.c file a bit more from the corresponding Linux iwlwifi/mvm/time-event.c. Taken-From: Linux iwlwifi Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (e8cb71584a6a72232c13151d60e57f7f229220eb) --- sys/dev/iwm/if_iwm.c | 10 +---- sys/dev/iwm/if_iwm_time_event.c | 75 ++++++++++++++++++++++++++++++--- sys/dev/iwm/if_iwm_time_event.h | 2 + sys/dev/iwm/if_iwmvar.h | 6 +++ 4 files changed, 78 insertions(+), 15 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index c197d991dd37..0a971f60491a 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -5375,15 +5375,9 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) break; } - case IWM_TIME_EVENT_NOTIFICATION: { - struct iwm_time_event_notif *notif; - notif = (void *)pkt->data; - - IWM_DPRINTF(sc, IWM_DEBUG_INTR, - "TE notif status = 0x%x action = 0x%x\n", - notif->status, notif->action); + case IWM_TIME_EVENT_NOTIFICATION: + iwm_mvm_rx_time_event_notif(sc, pkt); break; - } /* * Firmware versions 21 and 22 generate some DEBUG_LOG_MSG diff --git a/sys/dev/iwm/if_iwm_time_event.c b/sys/dev/iwm/if_iwm_time_event.c index 340d19d27246..a468b01656cf 100644 --- a/sys/dev/iwm/if_iwm_time_event.c +++ b/sys/dev/iwm/if_iwm_time_event.c @@ -159,12 +159,73 @@ __FBSDID("$FreeBSD$"); #include #include +#define TU_TO_HZ(tu) (((uint64_t)(tu) * 1024 * hz) / 1000000) + +static void +iwm_mvm_te_clear_data(struct iwm_softc *sc) +{ + sc->sc_time_event_uid = 0; + sc->sc_time_event_duration = 0; + sc->sc_time_event_end_ticks = 0; + sc->sc_flags &= ~IWM_FLAG_TE_ACTIVE; +} + /* - * For the high priority TE use a time event type that has similar priority to - * the FW's action scan priority. + * Handles a FW notification for an event that is known to the driver. + * + * @mvm: the mvm component + * @te_data: the time event data + * @notif: the notification data corresponding the time event data. */ -#define IWM_MVM_ROC_TE_TYPE_NORMAL IWM_TE_P2P_DEVICE_DISCOVERABLE -#define IWM_MVM_ROC_TE_TYPE_MGMT_TX IWM_TE_P2P_CLIENT_ASSOC +static void +iwm_mvm_te_handle_notif(struct iwm_softc *sc, + struct iwm_time_event_notif *notif) +{ + IWM_DPRINTF(sc, IWM_DEBUG_TE, + "Handle time event notif - UID = 0x%x action %d\n", + le32toh(notif->unique_id), + le32toh(notif->action)); + + if (!le32toh(notif->status)) { + const char *msg; + + if (notif->action & htole32(IWM_TE_V2_NOTIF_HOST_EVENT_START)) + msg = "Time Event start notification failure"; + else + msg = "Time Event end notification failure"; + + IWM_DPRINTF(sc, IWM_DEBUG_TE, "%s\n", msg); + } + + if (le32toh(notif->action) & IWM_TE_V2_NOTIF_HOST_EVENT_END) { + IWM_DPRINTF(sc, IWM_DEBUG_TE, + "TE ended - current time %d, estimated end %d\n", + ticks, sc->sc_time_event_end_ticks); + + iwm_mvm_te_clear_data(sc); + } else if (le32toh(notif->action) & IWM_TE_V2_NOTIF_HOST_EVENT_START) { + sc->sc_time_event_end_ticks = + ticks + TU_TO_HZ(sc->sc_time_event_duration); + } else { + device_printf(sc->sc_dev, "Got TE with unknown action\n"); + } +} + +/* + * The Rx handler for time event notifications + */ +void +iwm_mvm_rx_time_event_notif(struct iwm_softc *sc, struct iwm_rx_packet *pkt) +{ + struct iwm_time_event_notif *notif = (void *)pkt->data; + + IWM_DPRINTF(sc, IWM_DEBUG_TE, + "Time event notification - UID = 0x%x action %d\n", + le32toh(notif->unique_id), + le32toh(notif->action)); + + iwm_mvm_te_handle_notif(sc, notif); +} static int iwm_mvm_te_notif(struct iwm_softc *sc, struct iwm_rx_packet *pkt, @@ -241,6 +302,8 @@ iwm_mvm_time_event_send_add(struct iwm_softc *sc, struct iwm_vap *ivp, IWM_DPRINTF(sc, IWM_DEBUG_TE, "Add new TE, duration %d TU\n", le32toh(te_cmd->duration)); + sc->sc_time_event_duration = le32toh(te_cmd->duration); + /* * Use a notification wait, which really just processes the * command response and doesn't wait for anything, in order @@ -279,8 +342,6 @@ iwm_mvm_time_event_send_add(struct iwm_softc *sc, struct iwm_vap *ivp, return ret; } -#define TU_TO_HZ(tu) (((uint64_t)(tu) * 1024 * hz) / 1000000) - void iwm_mvm_protect_session(struct iwm_softc *sc, struct iwm_vap *ivp, uint32_t duration, uint32_t max_delay, boolean_t wait_for_notif) @@ -362,7 +423,7 @@ iwm_mvm_stop_session_protection(struct iwm_softc *sc, struct iwm_vap *ivp) "%s: Removing TE 0x%x\n", __func__, le32toh(time_cmd.id)); if (iwm_mvm_send_cmd_pdu(sc, IWM_TIME_EVENT_CMD, 0, sizeof(time_cmd), &time_cmd) == 0) - sc->sc_flags &= ~IWM_FLAG_TE_ACTIVE; + iwm_mvm_te_clear_data(sc); DELAY(100); } diff --git a/sys/dev/iwm/if_iwm_time_event.h b/sys/dev/iwm/if_iwm_time_event.h index 0e6dd8887997..d64da78557ec 100644 --- a/sys/dev/iwm/if_iwm_time_event.h +++ b/sys/dev/iwm/if_iwm_time_event.h @@ -107,6 +107,8 @@ #ifndef __IF_IWM_TIME_EVENT_H__ #define __IF_IWM_TIME_EVENT_H__ +extern void iwm_mvm_rx_time_event_notif(struct iwm_softc *sc, + struct iwm_rx_packet *pkt); extern void iwm_mvm_protect_session(struct iwm_softc *sc, struct iwm_vap *ivp, uint32_t duration, uint32_t max_delay, boolean_t wait_for_notif); extern void iwm_mvm_stop_session_protection(struct iwm_softc *sc, diff --git a/sys/dev/iwm/if_iwmvar.h b/sys/dev/iwm/if_iwmvar.h index 536027493a1a..c4ecd46bbab9 100644 --- a/sys/dev/iwm/if_iwmvar.h +++ b/sys/dev/iwm/if_iwmvar.h @@ -566,6 +566,12 @@ struct iwm_softc { /* Unique ID (assigned by the firmware) of the current Time Event. */ uint32_t sc_time_event_uid; + + /* Duration of the Time Event in TU. */ + uint32_t sc_time_event_duration; + + /* Expected end of the Time Event in HZ ticks. */ + int sc_time_event_end_ticks; }; #define IWM_LOCK_INIT(_sc) \ From d3c83cfead835e74de93dd68038fc3f4ad4ae1a0 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:48:27 +0000 Subject: [PATCH 037/142] iwm - Always clear watchdog timer, when bringing down firmware state. Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (8abdc2b36a45c4e9c95fc8263ca532ea26633dcb) --- sys/dev/iwm/if_iwm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 0a971f60491a..2422ff9e3164 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -4225,6 +4225,9 @@ iwm_bring_down_firmware(struct iwm_softc *sc, struct ieee80211vap *vap) struct iwm_vap *ivp = IWM_VAP(vap); int error; + /* Avoid Tx watchdog triggering, when transfers get dropped here. */ + sc->sc_tx_timer = 0; + ivp->iv_auth = 0; if (sc->sc_firmware_state == 3) { iwm_xmit_queue_drain(sc); @@ -4329,10 +4332,6 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) IEEE80211_UNLOCK(ic); IWM_LOCK(sc); - /* Avoid Tx watchdog triggering, when a connectionm is dropped. */ - if (vap->iv_state == IEEE80211_S_RUN && nstate != IEEE80211_S_RUN) - sc->sc_tx_timer = 0; - if ((sc->sc_flags & IWM_FLAG_SCAN_RUNNING) && (nstate == IEEE80211_S_AUTH || nstate == IEEE80211_S_ASSOC || From 93ff2218dd9f573994d8d0407af4ceb5d4cbe43f Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:48:50 +0000 Subject: [PATCH 038/142] if_iwm - Stop iwm_watchdog callout when idle. Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (6a8683b0e9d734f23bd9647e117da198c2b9a74e) --- sys/dev/iwm/if_iwm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 2422ff9e3164..805e791689cb 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -3814,6 +3814,8 @@ iwm_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, } else { error = iwm_tx(sc, m, ni, 0); } + if (sc->sc_tx_timer == 0) + callout_reset(&sc->sc_watchdog_to, hz, iwm_watchdog, sc); sc->sc_tx_timer = 5; IWM_UNLOCK(sc); @@ -4754,7 +4756,6 @@ iwm_init(struct iwm_softc *sc) * Ok, firmware loaded and we are jogging */ sc->sc_flags |= IWM_FLAG_HW_INITED; - callout_reset(&sc->sc_watchdog_to, hz, iwm_watchdog, sc); } static int @@ -4800,6 +4801,10 @@ iwm_start(struct iwm_softc *sc) ieee80211_free_node(ni); continue; } + if (sc->sc_tx_timer == 0) { + callout_reset(&sc->sc_watchdog_to, hz, iwm_watchdog, + sc); + } sc->sc_tx_timer = 15; } IWM_DPRINTF(sc, IWM_DEBUG_XMIT | IWM_DEBUG_TRACE, "<-%s\n", __func__); @@ -4834,8 +4839,8 @@ iwm_watchdog(void *arg) counter_u64_add(sc->sc_ic.ic_oerrors, 1); return; } + callout_reset(&sc->sc_watchdog_to, hz, iwm_watchdog, sc); } - callout_reset(&sc->sc_watchdog_to, hz, iwm_watchdog, sc); } static void From 569556b633a65ae8da99f4a8447c806c8da22928 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:49:11 +0000 Subject: [PATCH 039/142] iwm - Fix race during detach, where a callout is left after driver is gone. Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (ba3b4ff9a1fc04a349df05d6d3449f4d9b15c4be) --- sys/dev/iwm/if_iwm.c | 3 +++ sys/dev/iwm/if_iwm_led.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 805e791689cb..d23c6379f2f0 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -4829,6 +4829,9 @@ iwm_watchdog(void *arg) struct iwm_softc *sc = arg; struct ieee80211com *ic = &sc->sc_ic; + if (sc->sc_attached == 0) + return; + if (sc->sc_tx_timer > 0) { if (--sc->sc_tx_timer == 0) { device_printf(sc->sc_dev, "device timeout\n"); diff --git a/sys/dev/iwm/if_iwm_led.c b/sys/dev/iwm/if_iwm_led.c index 1114d4ef8cee..f22dd5d3b492 100644 --- a/sys/dev/iwm/if_iwm_led.c +++ b/sys/dev/iwm/if_iwm_led.c @@ -162,6 +162,9 @@ iwm_led_blink_timeout(void *arg) { struct iwm_softc *sc = arg; + if (sc->sc_attached == 0) + return; + if (iwm_mvm_led_is_enabled(sc)) iwm_mvm_led_disable(sc); else From e4bc6d1d19c3ae19dfd48014b043f871ef209da1 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:49:35 +0000 Subject: [PATCH 040/142] iwm - Update alive response handling, add v4 and remove old versions. Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (3820e2bf3331ced3541d1811a38c5a5136dfab93) --- sys/dev/iwm/if_iwm.c | 105 +++++++++++++++------------------------- sys/dev/iwm/if_iwmreg.h | 74 ++++++++-------------------- sys/dev/iwm/if_iwmvar.h | 2 +- 3 files changed, 59 insertions(+), 122 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index d23c6379f2f0..60cfb9e20b1e 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -2723,76 +2723,49 @@ static int iwm_alive_fn(struct iwm_softc *sc, struct iwm_rx_packet *pkt, void *data) { struct iwm_mvm_alive_data *alive_data = data; - struct iwm_mvm_alive_resp_ver1 *palive1; - struct iwm_mvm_alive_resp_ver2 *palive2; + struct iwm_mvm_alive_resp_v3 *palive3; struct iwm_mvm_alive_resp *palive; + struct iwm_umac_alive *umac; + struct iwm_lmac_alive *lmac1; + struct iwm_lmac_alive *lmac2 = NULL; + uint16_t status; - if (iwm_rx_packet_payload_len(pkt) == sizeof(*palive1)) { - palive1 = (void *)pkt->data; - - sc->support_umac_log = FALSE; - sc->error_event_table = - le32toh(palive1->error_event_table_ptr); - sc->log_event_table = - le32toh(palive1->log_event_table_ptr); - alive_data->scd_base_addr = le32toh(palive1->scd_base_ptr); - - alive_data->valid = le16toh(palive1->status) == - IWM_ALIVE_STATUS_OK; - IWM_DPRINTF(sc, IWM_DEBUG_RESET, - "Alive VER1 ucode status 0x%04x revision 0x%01X 0x%01X flags 0x%01X\n", - le16toh(palive1->status), palive1->ver_type, - palive1->ver_subtype, palive1->flags); - } else if (iwm_rx_packet_payload_len(pkt) == sizeof(*palive2)) { - palive2 = (void *)pkt->data; - sc->error_event_table = - le32toh(palive2->error_event_table_ptr); - sc->log_event_table = - le32toh(palive2->log_event_table_ptr); - alive_data->scd_base_addr = le32toh(palive2->scd_base_ptr); - sc->umac_error_event_table = - le32toh(palive2->error_info_addr); - - alive_data->valid = le16toh(palive2->status) == - IWM_ALIVE_STATUS_OK; - if (sc->umac_error_event_table) - sc->support_umac_log = TRUE; - - IWM_DPRINTF(sc, IWM_DEBUG_RESET, - "Alive VER2 ucode status 0x%04x revision 0x%01X 0x%01X flags 0x%01X\n", - le16toh(palive2->status), palive2->ver_type, - palive2->ver_subtype, palive2->flags); - - IWM_DPRINTF(sc, IWM_DEBUG_RESET, - "UMAC version: Major - 0x%x, Minor - 0x%x\n", - palive2->umac_major, palive2->umac_minor); - } else if (iwm_rx_packet_payload_len(pkt) == sizeof(*palive)) { + if (iwm_rx_packet_payload_len(pkt) == sizeof(*palive)) { palive = (void *)pkt->data; - - sc->error_event_table = - le32toh(palive->error_event_table_ptr); - sc->log_event_table = - le32toh(palive->log_event_table_ptr); - alive_data->scd_base_addr = le32toh(palive->scd_base_ptr); - sc->umac_error_event_table = - le32toh(palive->error_info_addr); - - alive_data->valid = le16toh(palive->status) == - IWM_ALIVE_STATUS_OK; - if (sc->umac_error_event_table) - sc->support_umac_log = TRUE; - - IWM_DPRINTF(sc, IWM_DEBUG_RESET, - "Alive VER3 ucode status 0x%04x revision 0x%01X 0x%01X flags 0x%01X\n", - le16toh(palive->status), palive->ver_type, - palive->ver_subtype, palive->flags); - - IWM_DPRINTF(sc, IWM_DEBUG_RESET, - "UMAC version: Major - 0x%x, Minor - 0x%x\n", - le32toh(palive->umac_major), - le32toh(palive->umac_minor)); + umac = &palive->umac_data; + lmac1 = &palive->lmac_data[0]; + lmac2 = &palive->lmac_data[1]; + status = le16toh(palive->status); + } else { + palive3 = (void *)pkt->data; + umac = &palive3->umac_data; + lmac1 = &palive3->lmac_data; + status = le16toh(palive3->status); } + sc->error_event_table[0] = le32toh(lmac1->error_event_table_ptr); + if (lmac2) + sc->error_event_table[1] = + le32toh(lmac2->error_event_table_ptr); + sc->log_event_table = le32toh(lmac1->log_event_table_ptr); + sc->umac_error_event_table = le32toh(umac->error_info_addr); + alive_data->scd_base_addr = le32toh(lmac1->scd_base_ptr); + alive_data->valid = status == IWM_ALIVE_STATUS_OK; + if (sc->umac_error_event_table) + sc->support_umac_log = TRUE; + + IWM_DPRINTF(sc, IWM_DEBUG_FW, + "Alive ucode status 0x%04x revision 0x%01X 0x%01X\n", + status, lmac1->ver_type, lmac1->ver_subtype); + + if (lmac2) + IWM_DPRINTF(sc, IWM_DEBUG_FW, "Alive ucode CDB\n"); + + IWM_DPRINTF(sc, IWM_DEBUG_FW, + "UMAC version: Major - 0x%x, Minor - 0x%x\n", + le32toh(umac->umac_major), + le32toh(umac->umac_minor)); + return TRUE; } @@ -5052,7 +5025,7 @@ iwm_nic_error(struct iwm_softc *sc) uint32_t base; device_printf(sc->sc_dev, "dumping device error log\n"); - base = sc->error_event_table; + base = sc->error_event_table[0]; if (base < 0x800000) { device_printf(sc->sc_dev, "Invalid error log pointer 0x%08x\n", base); diff --git a/sys/dev/iwm/if_iwmreg.h b/sys/dev/iwm/if_iwmreg.h index 72deea1dee80..0e24ef9dff9b 100644 --- a/sys/dev/iwm/if_iwmreg.h +++ b/sys/dev/iwm/if_iwmreg.h @@ -2144,41 +2144,13 @@ enum { #define IWM_ALIVE_FLG_RFKILL (1 << 0) -struct iwm_mvm_alive_resp_ver1 { - uint16_t status; - uint16_t flags; - uint8_t ucode_minor; - uint8_t ucode_major; - uint16_t id; - uint8_t api_minor; - uint8_t api_major; +struct iwm_lmac_alive { + uint32_t ucode_major; + uint32_t ucode_minor; uint8_t ver_subtype; uint8_t ver_type; uint8_t mac; uint8_t opt; - uint16_t reserved2; - uint32_t timestamp; - uint32_t error_event_table_ptr; /* SRAM address for error log */ - uint32_t log_event_table_ptr; /* SRAM address for event log */ - uint32_t cpu_register_ptr; - uint32_t dbgm_config_ptr; - uint32_t alive_counter_ptr; - uint32_t scd_base_ptr; /* SRAM address for SCD */ -} __packed; /* IWM_ALIVE_RES_API_S_VER_1 */ - -struct iwm_mvm_alive_resp_ver2 { - uint16_t status; - uint16_t flags; - uint8_t ucode_minor; - uint8_t ucode_major; - uint16_t id; - uint8_t api_minor; - uint8_t api_major; - uint8_t ver_subtype; - uint8_t ver_type; - uint8_t mac; - uint8_t opt; - uint16_t reserved2; uint32_t timestamp; uint32_t error_event_table_ptr; /* SRAM address for error log */ uint32_t log_event_table_ptr; /* SRAM address for LMAC event log */ @@ -2188,36 +2160,28 @@ struct iwm_mvm_alive_resp_ver2 { uint32_t scd_base_ptr; /* SRAM address for SCD */ uint32_t st_fwrd_addr; /* pointer to Store and forward */ uint32_t st_fwrd_size; - uint8_t umac_minor; /* UMAC version: minor */ - uint8_t umac_major; /* UMAC version: major */ - uint16_t umac_id; /* UMAC version: id */ +} __packed; /* UCODE_ALIVE_NTFY_API_S_VER_3 */ + +struct iwm_umac_alive { + uint32_t umac_major; /* UMAC version: major */ + uint32_t umac_minor; /* UMAC version: minor */ uint32_t error_info_addr; /* SRAM address for UMAC error log */ uint32_t dbg_print_buff_addr; -} __packed; /* ALIVE_RES_API_S_VER_2 */ +} __packed; /* UMAC_ALIVE_DATA_API_S_VER_2 */ + +struct iwm_mvm_alive_resp_v3 { + uint16_t status; + uint16_t flags; + struct iwm_lmac_alive lmac_data; + struct iwm_umac_alive umac_data; +} __packed; /* ALIVE_RES_API_S_VER_3 */ struct iwm_mvm_alive_resp { uint16_t status; uint16_t flags; - uint32_t ucode_minor; - uint32_t ucode_major; - uint8_t ver_subtype; - uint8_t ver_type; - uint8_t mac; - uint8_t opt; - uint32_t timestamp; - uint32_t error_event_table_ptr; /* SRAM address for error log */ - uint32_t log_event_table_ptr; /* SRAM address for LMAC event log */ - uint32_t cpu_register_ptr; - uint32_t dbgm_config_ptr; - uint32_t alive_counter_ptr; - uint32_t scd_base_ptr; /* SRAM address for SCD */ - uint32_t st_fwrd_addr; /* pointer to Store and forward */ - uint32_t st_fwrd_size; - uint32_t umac_minor; /* UMAC version: minor */ - uint32_t umac_major; /* UMAC version: major */ - uint32_t error_info_addr; /* SRAM address for UMAC error log */ - uint32_t dbg_print_buff_addr; -} __packed; /* ALIVE_RES_API_S_VER_3 */ + struct iwm_lmac_alive lmac_data[2]; + struct iwm_umac_alive umac_data; +} __packed; /* ALIVE_RES_API_S_VER_4 */ /* Error response/notification */ enum { diff --git a/sys/dev/iwm/if_iwmvar.h b/sys/dev/iwm/if_iwmvar.h index c4ecd46bbab9..c9149a170a78 100644 --- a/sys/dev/iwm/if_iwmvar.h +++ b/sys/dev/iwm/if_iwmvar.h @@ -538,7 +538,7 @@ struct iwm_softc { int cmd_hold_nic_awake; /* Firmware status */ - uint32_t error_event_table; + uint32_t error_event_table[2]; uint32_t log_event_table; uint32_t umac_error_event_table; int support_umac_log; From 37ac41d30fa2197e34cb0198df60cc561d3d78c9 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:50:03 +0000 Subject: [PATCH 041/142] iwm - Remove unused REPLY_MAX Taken-From: Linux git e4eb275ac5cfe71686612d929a9829345b2a4ada Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (92a727c99d6ec5abf14bb6853e95e3a187a0cd4e) --- sys/dev/iwm/if_iwmreg.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/dev/iwm/if_iwmreg.h b/sys/dev/iwm/if_iwmreg.h index 0e24ef9dff9b..622109af5c68 100644 --- a/sys/dev/iwm/if_iwmreg.h +++ b/sys/dev/iwm/if_iwmreg.h @@ -1866,8 +1866,6 @@ enum { IWM_NET_DETECT_PROFILES_CMD = 0x57, IWM_NET_DETECT_HOTSPOTS_CMD = 0x58, IWM_NET_DETECT_HOTSPOTS_QUERY_CMD = 0x59, - - IWM_REPLY_MAX = 0xff, }; enum iwm_phy_ops_subcmd_ids { From bdf95b739893af362687acd2769d7f6edc88d89f Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Jan 2019 03:50:27 +0000 Subject: [PATCH 042/142] iwm - Remove unused TX_CMD_NEXT_FRAME_* Taken-From: Linux git b1e06c65fb69c5e3fddcd91987561e225eaa9bfa Submitted by: Augustin Cavalier (Haiku) Obtained from: DragonFlyBSD (b0c6116f364a121ab6b9d634ca1997d4167fa747) --- sys/dev/iwm/if_iwmreg.h | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/sys/dev/iwm/if_iwmreg.h b/sys/dev/iwm/if_iwmreg.h index 622109af5c68..c7afcb35ce1c 100644 --- a/sys/dev/iwm/if_iwmreg.h +++ b/sys/dev/iwm/if_iwmreg.h @@ -4283,29 +4283,6 @@ enum iwm_tx_pm_timeouts { #define IWM_TX_CMD_SEC_WEP_KEY_IDX_MSK 0xc0 #define IWM_TX_CMD_SEC_KEY128 0x08 -/* TODO: how does these values are OK with only 16 bit variable??? */ -/* - * TX command next frame info - * - * bits 0:2 - security control (IWM_TX_CMD_SEC_*) - * bit 3 - immediate ACK required - * bit 4 - rate is taken from STA table - * bit 5 - frame belongs to BA stream - * bit 6 - immediate BA response expected - * bit 7 - unused - * bits 8:15 - Station ID - * bits 16:31 - rate - */ -#define IWM_TX_CMD_NEXT_FRAME_ACK_MSK (0x8) -#define IWM_TX_CMD_NEXT_FRAME_STA_RATE_MSK (0x10) -#define IWM_TX_CMD_NEXT_FRAME_BA_MSK (0x20) -#define IWM_TX_CMD_NEXT_FRAME_IMM_BA_RSP_MSK (0x40) -#define IWM_TX_CMD_NEXT_FRAME_FLAGS_MSK (0xf8) -#define IWM_TX_CMD_NEXT_FRAME_STA_ID_MSK (0xff00) -#define IWM_TX_CMD_NEXT_FRAME_STA_ID_POS (8) -#define IWM_TX_CMD_NEXT_FRAME_RATE_MSK (0xffff0000) -#define IWM_TX_CMD_NEXT_FRAME_RATE_POS (16) - /* * TX command Frame life time in us - to be written in pm_frame_timeout */ @@ -4343,7 +4320,7 @@ enum iwm_tx_pm_timeouts { * @initial_rate_index: index into the rate table for initial TX attempt. * Applied if IWM_TX_CMD_FLG_STA_RATE_MSK is set, normally 0 for data frames. * @key: security key - * @next_frame_flags: IWM_TX_CMD_SEC_* and IWM_TX_CMD_NEXT_FRAME_* + * @reserved3: reserved * @life_time: frame life time (usecs??) * @dram_lsb_ptr: Physical address of scratch area in the command (try_cnt + * btkill_cnd + reserved), first 32 bits. "0" disables usage. From 95ad3a2dca53795f4ef429f73923a31135ffb58d Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Thu, 24 Jan 2019 06:34:29 +0000 Subject: [PATCH 043/142] Fix prompt for MFSROOT in tinybsd tinybsd offers two choices when prompting user for MFSROOT: 'YES' and 'NO'. Script logic only handles 'yes'. Change offered values to lower case. PR: 131059 Submitted by: Brock Williams MFC after: 1 week --- tools/tools/tinybsd/tinybsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools/tinybsd/tinybsd b/tools/tools/tinybsd/tinybsd index 27216d4d2e3a..1675b09f2a52 100755 --- a/tools/tools/tinybsd/tinybsd +++ b/tools/tools/tinybsd/tinybsd @@ -206,7 +206,7 @@ loadconfig () { break fi done - MFSROOT=`confirm_action "$MFSROOT" "Use an MFSROOT? (YES/NO)"` + MFSROOT=`confirm_action "$MFSROOT" "Use an MFSROOT? (yes/no)"` IMG=`confirm_action "$IMG" "Image file to generate?"` # example of formatted value (NNN in this case) From 130f575d073ecaa360062585c16a097ca41175f6 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Thu, 24 Jan 2019 08:15:41 +0000 Subject: [PATCH 044/142] Fix duplicate acquiring of refcount when joining IPv6 multicast groups. This was observed by starting and stopping rpcbind(8) multiple times. PR: 233535 Differential Revision: https://reviews.freebsd.org/D18887 Reviewed by: bz (net) Tested by: ae MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/netinet6/in6_mcast.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c index 0f90f77ea46d..6d27614273cf 100644 --- a/sys/netinet6/in6_mcast.c +++ b/sys/netinet6/in6_mcast.c @@ -2178,7 +2178,10 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sopt) IN6_MULTI_UNLOCK(); goto out_im6o_free; } - in6m_acquire(inm); + /* + * NOTE: Refcount from in6_joingroup_locked() + * is protecting membership. + */ imo->im6o_membership[idx] = inm; } else { CTR1(KTR_MLD, "%s: merge inm state", __func__); From 7a028976478fe28cc889bea4658f14725628432c Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Thu, 24 Jan 2019 08:18:02 +0000 Subject: [PATCH 045/142] Add debugging sysctl to disable incoming MLD v2 messages similar to the existing sysctl for MLD v1 messages. PR: 233535 Differential Revision: https://reviews.freebsd.org/D18887 Reviewed by: bz (net) Tested by: ae MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/netinet6/mld6.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index 1170b8ebfcac..9536f4591b1c 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -243,6 +243,10 @@ static int mld_v1enable = 1; SYSCTL_INT(_net_inet6_mld, OID_AUTO, v1enable, CTLFLAG_RWTUN, &mld_v1enable, 0, "Enable fallback to MLDv1"); +static int mld_v2enable = 1; +SYSCTL_INT(_net_inet6_mld, OID_AUTO, v2enable, CTLFLAG_RWTUN, + &mld_v2enable, 0, "Enable MLDv2"); + static int mld_use_allow = 1; SYSCTL_INT(_net_inet6_mld, OID_AUTO, use_allow, CTLFLAG_RWTUN, &mld_use_allow, 0, "Use ALLOW/BLOCK for RFC 4604 SSM joins/leaves"); @@ -817,7 +821,12 @@ mld_v2_input_query(struct ifnet *ifp, const struct ip6_hdr *ip6, char ip6tbuf[INET6_ADDRSTRLEN]; #endif - is_general_query = 0; + if (!mld_v2enable) { + CTR3(KTR_MLD, "ignore v2 query src %s on ifp %p(%s)", + ip6_sprintf(ip6tbuf, &ip6->ip6_src), + ifp, if_name(ifp)); + return (0); + } /* * RFC3810 Section 6.2: MLD queries must originate from @@ -830,6 +839,8 @@ mld_v2_input_query(struct ifnet *ifp, const struct ip6_hdr *ip6, return (0); } + is_general_query = 0; + CTR2(KTR_MLD, "input v2 query on ifp %p(%s)", ifp, if_name(ifp)); mld = (struct mldv2_query *)(mtod(m, uint8_t *) + off); From dea72f062af179ccb8abe3d2e37f4eb9b1c152d4 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Thu, 24 Jan 2019 08:25:02 +0000 Subject: [PATCH 046/142] When detaching a network interface drain the workqueue freeing the inm's because the destructor will access the if_ioctl() callback in the ifnet pointer which is about to be freed. This prevents use-after-free. PR: 233535 Differential Revision: https://reviews.freebsd.org/D18887 Reviewed by: bz (net) Tested by: ae MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/netinet6/in6_ifattach.c | 7 +++++++ sys/netinet6/in6_mcast.c | 8 ++++++++ sys/netinet6/in6_var.h | 1 + 3 files changed, 16 insertions(+) diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 1e9901125f6a..14df5fff6450 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -884,6 +884,13 @@ in6_purgemaddrs(struct ifnet *ifp) IN6_MULTI_LIST_UNLOCK(); IN6_MULTI_UNLOCK(); in6m_release_list_deferred(&purgeinms); + + /* + * Make sure all multicast deletions invoking if_ioctl() are + * completed before returning. Else we risk accessing a freed + * ifnet structure pointer. + */ + in6m_release_wait(); } void diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c index 6d27614273cf..693345b1c5ee 100644 --- a/sys/netinet6/in6_mcast.c +++ b/sys/netinet6/in6_mcast.c @@ -584,6 +584,14 @@ in6m_release_list_deferred(struct in6_multi_head *inmh) GROUPTASK_ENQUEUE(&free_gtask); } +void +in6m_release_wait(void) +{ + + /* Wait for all jobs to complete. */ + gtaskqueue_drain_all(free_gtask.gt_taskqueue); +} + void in6m_disconnect(struct in6_multi *inm) { diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index 746aed35945c..a19747d97918 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -811,6 +811,7 @@ void in6m_print(const struct in6_multi *); int in6m_record_source(struct in6_multi *, const struct in6_addr *); void in6m_release_deferred(struct in6_multi *); void in6m_release_list_deferred(struct in6_multi_head *); +void in6m_release_wait(void); void ip6_freemoptions(struct ip6_moptions *); int ip6_getmoptions(struct inpcb *, struct sockopt *); int ip6_setmoptions(struct inpcb *, struct sockopt *); From 2cd6ad766eb239d84cb700cdd2752d3f5d8b3731 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Thu, 24 Jan 2019 08:34:13 +0000 Subject: [PATCH 047/142] Fix refcounting leaks in IPv6 MLD code leading to loss of IPv6 connectivity. Looking at past changes in this area like r337866, some refcounting bugs have been introduced, one by one. For example like calling in6m_disconnect() and in6m_rele_locked() in mld_v1_process_group_timer() where previously no disconnect nor refcount decrement was done. Calling in6m_disconnect() when it shouldn't causes IPv6 solitation to no longer work, because all the multicast addresses receiving the solitation messages are now deleted from the network interface. This patch reverts some recent changes while improving the MLD refcounting and concurrency model after the MLD code was converted to using EPOCH(9). List changes: - All CK_STAILQ_FOREACH() macros are now properly enclosed into EPOCH(9) sections. This simplifies assertion of locking inside in6m_ifmultiaddr_get_inm(). - Corrected bad use of in6m_disconnect() leading to loss of IPv6 connectivity for MLD v1. - Factored out checks for valid inm structure into in6m_ifmultiaddr_get_inm(). PR: 233535 Differential Revision: https://reviews.freebsd.org/D18887 Reviewed by: bz (net) Tested by: ae MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/netinet6/in6_ifattach.c | 29 +------- sys/netinet6/in6_mcast.c | 60 +++++++-------- sys/netinet6/in6_var.h | 40 ++++++---- sys/netinet6/mld6.c | 141 +++++++++++++++++------------------- sys/netinet6/mld6_var.h | 3 +- 5 files changed, 126 insertions(+), 147 deletions(-) diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 14df5fff6450..03285b60d2d4 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -854,36 +854,15 @@ in6_tmpaddrtimer(void *arg) static void in6_purgemaddrs(struct ifnet *ifp) { - struct in6_multi_head purgeinms; - struct in6_multi *inm; - struct ifmultiaddr *ifma, *next; + struct in6_multi_head inmh; - SLIST_INIT(&purgeinms); + SLIST_INIT(&inmh); IN6_MULTI_LOCK(); IN6_MULTI_LIST_LOCK(); - IF_ADDR_WLOCK(ifp); - /* - * Extract list of in6_multi associated with the detaching ifp - * which the PF_INET6 layer is about to release. - */ - restart: - CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { - if (ifma->ifma_addr->sa_family != AF_INET6 || - ifma->ifma_protospec == NULL) - continue; - inm = (struct in6_multi *)ifma->ifma_protospec; - in6m_disconnect(inm); - in6m_rele_locked(&purgeinms, inm); - if (__predict_false(ifma6_restart)) { - ifma6_restart = false; - goto restart; - } - } - IF_ADDR_WUNLOCK(ifp); - mld_ifdetach(ifp); + mld_ifdetach(ifp, &inmh); IN6_MULTI_LIST_UNLOCK(); IN6_MULTI_UNLOCK(); - in6m_release_list_deferred(&purgeinms); + in6m_release_list_deferred(&inmh); /* * Make sure all multicast deletions invoking if_ioctl() are diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c index 693345b1c5ee..3b60d26c84ee 100644 --- a/sys/netinet6/in6_mcast.c +++ b/sys/netinet6/in6_mcast.c @@ -190,7 +190,6 @@ static SYSCTL_NODE(_net_inet6_ip6_mcast, OID_AUTO, filters, CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_ip6_mcast_filters, "Per-interface stack-wide source filters"); -int ifma6_restart = 0; #ifdef KTR /* * Inline function which wraps assertions for a valid ifp. @@ -405,6 +404,7 @@ static int in6_getmulti(struct ifnet *ifp, const struct in6_addr *group, struct in6_multi **pinm) { + struct epoch_tracker et; struct sockaddr_in6 gsin6; struct ifmultiaddr *ifma; struct in6_multi *inm; @@ -420,7 +420,10 @@ in6_getmulti(struct ifnet *ifp, const struct in6_addr *group, IN6_MULTI_LOCK_ASSERT(); IN6_MULTI_LIST_LOCK(); IF_ADDR_WLOCK(ifp); + NET_EPOCH_ENTER(et); inm = in6m_lookup_locked(ifp, group); + NET_EPOCH_EXIT(et); + if (inm != NULL) { /* * If we already joined this group, just bump the @@ -593,7 +596,7 @@ in6m_release_wait(void) } void -in6m_disconnect(struct in6_multi *inm) +in6m_disconnect_locked(struct in6_multi_head *inmh, struct in6_multi *inm) { struct ifnet *ifp; struct ifaddr *ifa; @@ -601,10 +604,12 @@ in6m_disconnect(struct in6_multi *inm) struct in6_multi_mship *imm, *imm_tmp; struct ifmultiaddr *ifma, *ll_ifma; - ifp = inm->in6m_ifp; + IN6_MULTI_LIST_LOCK_ASSERT(); + ifp = inm->in6m_ifp; if (ifp == NULL) - return; + return; /* already called */ + inm->in6m_ifp = NULL; IF_ADDR_WLOCK_ASSERT(ifp); ifma = inm->in6m_ifma; @@ -623,7 +628,6 @@ in6m_disconnect(struct in6_multi *inm) MPASS(ll_ifma->ifma_llifma == NULL); MPASS(ll_ifma->ifma_ifp == ifp); if (--ll_ifma->ifma_refcount == 0) { - ifma6_restart = true; if (ll_ifma->ifma_flags & IFMA_F_ENQUEUED) { CK_STAILQ_REMOVE(&ifp->if_multiaddrs, ll_ifma, ifmultiaddr, ifma_link); ll_ifma->ifma_flags &= ~IFMA_F_ENQUEUED; @@ -641,28 +645,12 @@ in6m_disconnect(struct in6_multi *inm) if (inm == imm->i6mm_maddr) { LIST_REMOVE(imm, i6mm_chain); free(imm, M_IP6MADDR); + in6m_rele_locked(inmh, inm); } } } } -void -in6m_release_deferred(struct in6_multi *inm) -{ - struct in6_multi_head tmp; - - IN6_MULTI_LIST_LOCK_ASSERT(); - KASSERT(inm->in6m_refcount > 0, ("refcount == %d inm: %p", inm->in6m_refcount, inm)); - if (--inm->in6m_refcount == 0) { - MPASS(inm->in6m_ifp == NULL); - SLIST_INIT(&tmp); - inm->in6m_ifma->ifma_protospec = NULL; - MPASS(inm->in6m_ifma->ifma_llifma == NULL); - SLIST_INSERT_HEAD(&tmp, inm, in6m_nrele); - in6m_release_list_deferred(&tmp); - } -} - static void in6m_release_task(void *arg __unused) { @@ -1262,6 +1250,7 @@ in6_joingroup_locked(struct ifnet *ifp, const struct in6_addr *mcaddr, /*const*/ struct in6_mfilter *imf, struct in6_multi **pinm, const int delay) { + struct in6_multi_head inmh; struct in6_mfilter timf; struct in6_multi *inm; struct ifmultiaddr *ifma; @@ -1321,6 +1310,7 @@ in6_joingroup_locked(struct ifnet *ifp, const struct in6_addr *mcaddr, } out_in6m_release: + SLIST_INIT(&inmh); if (error) { struct epoch_tracker et; @@ -1332,13 +1322,14 @@ in6_joingroup_locked(struct ifnet *ifp, const struct in6_addr *mcaddr, break; } } - in6m_disconnect(inm); - in6m_release_deferred(inm); + in6m_disconnect_locked(&inmh, inm); + in6m_rele_locked(&inmh, inm); NET_EPOCH_EXIT(et); } else { *pinm = inm; } IN6_MULTI_LIST_UNLOCK(); + in6m_release_list_deferred(&inmh); return (error); } @@ -1372,6 +1363,7 @@ in6_leavegroup(struct in6_multi *inm, /*const*/ struct in6_mfilter *imf) int in6_leavegroup_locked(struct in6_multi *inm, /*const*/ struct in6_mfilter *imf) { + struct in6_multi_head inmh; struct in6_mfilter timf; struct ifnet *ifp; int error; @@ -1421,13 +1413,15 @@ in6_leavegroup_locked(struct in6_multi *inm, /*const*/ struct in6_mfilter *imf) CTR2(KTR_MLD, "%s: dropping ref on %p", __func__, inm); if (ifp) IF_ADDR_WLOCK(ifp); - if (inm->in6m_refcount == 1 && inm->in6m_ifp != NULL) - in6m_disconnect(inm); - in6m_release_deferred(inm); + + SLIST_INIT(&inmh); + if (inm->in6m_refcount == 1) + in6m_disconnect_locked(&inmh, inm); + in6m_rele_locked(&inmh, inm); if (ifp) IF_ADDR_WUNLOCK(ifp); IN6_MULTI_LIST_UNLOCK(); - + in6m_release_list_deferred(&inmh); return (error); } @@ -1941,6 +1935,7 @@ in6p_lookup_mcast_ifp(const struct inpcb *in6p, static int in6p_join_group(struct inpcb *inp, struct sockopt *sopt) { + struct in6_multi_head inmh; struct group_source_req gsr; sockunion_t *gsa, *ssa; struct ifnet *ifp; @@ -1951,6 +1946,7 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sopt) size_t idx; int error, is_new; + SLIST_INIT(&inmh); ifp = NULL; imf = NULL; lims = NULL; @@ -2227,7 +2223,7 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sopt) inm = imo->im6o_membership[idx]; if (inm != NULL) { IN6_MULTI_LIST_LOCK(); - in6m_release_deferred(inm); + in6m_rele_locked(&inmh, inm); IN6_MULTI_LIST_UNLOCK(); } imo->im6o_membership[idx] = NULL; @@ -2236,6 +2232,7 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sopt) out_in6p_locked: INP_WUNLOCK(inp); + in6m_release_list_deferred(&inmh); return (error); } @@ -2880,10 +2877,9 @@ sysctl_ip6_mcast_filters(SYSCTL_HANDLER_ARGS) IN6_MULTI_LIST_LOCK(); NET_EPOCH_ENTER(et); CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_INET6 || - ifma->ifma_protospec == NULL) + inm = in6m_ifmultiaddr_get_inm(ifma); + if (inm == NULL) continue; - inm = (struct in6_multi *)ifma->ifma_protospec; if (!IN6_ARE_ADDR_EQUAL(&inm->in6m_addr, &mcaddr)) continue; fmode = inm->in6m_st[1].iss_fmode; diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index a19747d97918..3e965c2d4b32 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -645,6 +645,7 @@ struct in6_multi { /* New fields for MLDv2 follow. */ struct mld_ifsoftc *in6m_mli; /* MLD info */ SLIST_ENTRY(in6_multi) in6m_nrele; /* to-be-released by MLD */ + SLIST_ENTRY(in6_multi) in6m_defer; /* deferred MLDv1 */ struct ip6_msource_tree in6m_srcs; /* tree of sources */ u_long in6m_nsrc; /* # of tree entries */ @@ -670,8 +671,8 @@ struct in6_multi { } in6m_st[2]; /* state at t0, t1 */ }; -void in6m_disconnect(struct in6_multi *inm); -extern int ifma6_restart; +void in6m_disconnect_locked(struct in6_multi_head *inmh, struct in6_multi *inm); + /* * Helper function to derive the filter mode on a source entry * from its internal counters. Predicates are: @@ -713,13 +714,25 @@ extern struct sx in6_multi_sx; #define IN6_MULTI_LOCK_ASSERT() sx_assert(&in6_multi_sx, SA_XLOCKED) #define IN6_MULTI_UNLOCK_ASSERT() sx_assert(&in6_multi_sx, SA_XUNLOCKED) +/* + * Get the in6_multi pointer from a ifmultiaddr. + * Returns NULL if ifmultiaddr is no longer valid. + */ +static __inline struct in6_multi * +in6m_ifmultiaddr_get_inm(struct ifmultiaddr *ifma) +{ + + NET_EPOCH_ASSERT(); + + return ((ifma->ifma_addr->sa_family != AF_INET6 || + (ifma->ifma_flags & IFMA_F_ENQUEUED) == 0) ? NULL : + ifma->ifma_protospec); +} /* * Look up an in6_multi record for an IPv6 multicast address * on the interface ifp. * If no record found, return NULL. - * - * SMPng: The IN6_MULTI_LOCK and IF_ADDR_LOCK on ifp must be held. */ static __inline struct in6_multi * in6m_lookup_locked(struct ifnet *ifp, const struct in6_addr *mcaddr) @@ -727,18 +740,14 @@ in6m_lookup_locked(struct ifnet *ifp, const struct in6_addr *mcaddr) struct ifmultiaddr *ifma; struct in6_multi *inm; - inm = NULL; - CK_STAILQ_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { - if (ifma->ifma_addr->sa_family == AF_INET6) { - inm = (struct in6_multi *)ifma->ifma_protospec; - if (inm == NULL) - continue; - if (IN6_ARE_ADDR_EQUAL(&inm->in6m_addr, mcaddr)) - break; - inm = NULL; - } + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + inm = in6m_ifmultiaddr_get_inm(ifma); + if (inm == NULL) + continue; + if (IN6_ARE_ADDR_EQUAL(&inm->in6m_addr, mcaddr)) + return (inm); } - return (inm); + return (NULL); } /* @@ -809,7 +818,6 @@ void in6m_clear_recorded(struct in6_multi *); void in6m_commit(struct in6_multi *); void in6m_print(const struct in6_multi *); int in6m_record_source(struct in6_multi *, const struct in6_addr *); -void in6m_release_deferred(struct in6_multi *); void in6m_release_list_deferred(struct in6_multi_head *); void in6m_release_wait(void); void ip6_freemoptions(struct ip6_moptions *); diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index 9536f4591b1c..62632e989c88 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -110,7 +110,7 @@ static void mli_delete_locked(const struct ifnet *); static void mld_dispatch_packet(struct mbuf *); static void mld_dispatch_queue(struct mbufq *, int); static void mld_final_leave(struct in6_multi *, struct mld_ifsoftc *); -static void mld_fasttimo_vnet(void); +static void mld_fasttimo_vnet(struct in6_multi_head *inmh); static int mld_handle_state_change(struct in6_multi *, struct mld_ifsoftc *); static int mld_initial_join(struct in6_multi *, struct mld_ifsoftc *, @@ -537,45 +537,48 @@ mli_alloc_locked(/*const*/ struct ifnet *ifp) * XXX This routine is also bitten by unlocked ifma_protospec access. */ void -mld_ifdetach(struct ifnet *ifp) +mld_ifdetach(struct ifnet *ifp, struct in6_multi_head *inmh) { + struct epoch_tracker et; struct mld_ifsoftc *mli; - struct ifmultiaddr *ifma, *next; + struct ifmultiaddr *ifma; struct in6_multi *inm; - struct in6_multi_head inmh; CTR3(KTR_MLD, "%s: called for ifp %p(%s)", __func__, ifp, if_name(ifp)); - SLIST_INIT(&inmh); IN6_MULTI_LIST_LOCK_ASSERT(); MLD_LOCK(); mli = MLD_IFINFO(ifp); - if (mli->mli_version == MLD_VERSION_2) { - IF_ADDR_WLOCK(ifp); - restart: - CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { - if (ifma->ifma_addr->sa_family != AF_INET6 || - ifma->ifma_protospec == NULL) - continue; - inm = (struct in6_multi *)ifma->ifma_protospec; - if (inm->in6m_state == MLD_LEAVING_MEMBER) { - in6m_disconnect(inm); - in6m_rele_locked(&inmh, inm); - ifma->ifma_protospec = NULL; - } + IF_ADDR_WLOCK(ifp); + /* + * Extract list of in6_multi associated with the detaching ifp + * which the PF_INET6 layer is about to release. + */ + NET_EPOCH_ENTER(et); + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + inm = in6m_ifmultiaddr_get_inm(ifma); + if (inm == NULL) + continue; + in6m_disconnect_locked(inmh, inm); + + if (mli->mli_version == MLD_VERSION_2) { in6m_clear_recorded(inm); - if (__predict_false(ifma6_restart)) { - ifma6_restart = false; - goto restart; + + /* + * We need to release the final reference held + * for issuing the INCLUDE {}. + */ + if (inm->in6m_state == MLD_LEAVING_MEMBER) { + inm->in6m_state = MLD_NOT_MEMBER; + in6m_rele_locked(inmh, inm); } } - IF_ADDR_WUNLOCK(ifp); } - + NET_EPOCH_EXIT(et); + IF_ADDR_WUNLOCK(ifp); MLD_UNLOCK(); - in6m_release_list_deferred(&inmh); } /* @@ -709,10 +712,9 @@ mld_v1_input_query(struct ifnet *ifp, const struct ip6_hdr *ip6, CTR2(KTR_MLD, "process v1 general query on ifp %p(%s)", ifp, if_name(ifp)); CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_INET6 || - ifma->ifma_protospec == NULL) + inm = in6m_ifmultiaddr_get_inm(ifma); + if (inm == NULL) continue; - inm = (struct in6_multi *)ifma->ifma_protospec; mld_v1_update_group(inm, timer); } } else { @@ -1324,15 +1326,19 @@ mld_input(struct mbuf *m, int off, int icmp6len) void mld_fasttimo(void) { + struct in6_multi_head inmh; VNET_ITERATOR_DECL(vnet_iter); + SLIST_INIT(&inmh); + VNET_LIST_RLOCK_NOSLEEP(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); - mld_fasttimo_vnet(); + mld_fasttimo_vnet(&inmh); CURVNET_RESTORE(); } VNET_LIST_RUNLOCK_NOSLEEP(); + in6m_release_list_deferred(&inmh); } /* @@ -1341,15 +1347,15 @@ mld_fasttimo(void) * VIMAGE: Assume caller has set up our curvnet. */ static void -mld_fasttimo_vnet(void) +mld_fasttimo_vnet(struct in6_multi_head *inmh) { + struct epoch_tracker et; struct mbufq scq; /* State-change packets */ struct mbufq qrq; /* Query response packets */ struct ifnet *ifp; struct mld_ifsoftc *mli; - struct ifmultiaddr *ifma, *next; - struct in6_multi *inm, *tinm; - struct in6_multi_head inmh; + struct ifmultiaddr *ifma; + struct in6_multi *inm; int uri_fasthz; uri_fasthz = 0; @@ -1364,7 +1370,6 @@ mld_fasttimo_vnet(void) !V_state_change_timers_running6) return; - SLIST_INIT(&inmh); IN6_MULTI_LIST_LOCK(); MLD_LOCK(); @@ -1410,25 +1415,20 @@ mld_fasttimo_vnet(void) } IF_ADDR_WLOCK(ifp); - restart: - CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { - if (ifma->ifma_addr->sa_family != AF_INET6 || - ifma->ifma_protospec == NULL) + NET_EPOCH_ENTER(et); + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + inm = in6m_ifmultiaddr_get_inm(ifma); + if (inm == NULL) continue; - inm = (struct in6_multi *)ifma->ifma_protospec; switch (mli->mli_version) { case MLD_VERSION_1: - mld_v1_process_group_timer(&inmh, inm); + mld_v1_process_group_timer(inmh, inm); break; case MLD_VERSION_2: - mld_v2_process_group_timers(&inmh, &qrq, + mld_v2_process_group_timers(inmh, &qrq, &scq, inm, uri_fasthz); break; } - if (__predict_false(ifma6_restart)) { - ifma6_restart = false; - goto restart; - } } IF_ADDR_WUNLOCK(ifp); @@ -1442,9 +1442,8 @@ mld_fasttimo_vnet(void) * IF_ADDR_LOCK internally as well as * ip6_output() to transmit a packet. */ - SLIST_FOREACH_SAFE(inm, &inmh, in6m_nrele, tinm) { - SLIST_REMOVE_HEAD(&inmh, - in6m_nrele); + while ((inm = SLIST_FIRST(inmh)) != NULL) { + SLIST_REMOVE_HEAD(inmh, in6m_defer); (void)mld_v1_transmit_report(inm, MLD_LISTENER_REPORT); } @@ -1452,14 +1451,9 @@ mld_fasttimo_vnet(void) case MLD_VERSION_2: mld_dispatch_queue(&qrq, 0); mld_dispatch_queue(&scq, 0); - - /* - * Free the in_multi reference(s) for - * this lifecycle. - */ - in6m_release_list_deferred(&inmh); break; } + NET_EPOCH_EXIT(et); } out_locked: @@ -1499,8 +1493,7 @@ mld_v1_process_group_timer(struct in6_multi_head *inmh, struct in6_multi *inm) case MLD_REPORTING_MEMBER: if (report_timer_expired) { inm->in6m_state = MLD_IDLE_MEMBER; - in6m_disconnect(inm); - in6m_rele_locked(inmh, inm); + SLIST_INSERT_HEAD(inmh, inm, in6m_defer); } break; case MLD_G_QUERY_PENDING_MEMBER: @@ -1624,7 +1617,7 @@ mld_v2_process_group_timers(struct in6_multi_head *inmh, if (inm->in6m_state == MLD_LEAVING_MEMBER && inm->in6m_scrv == 0) { inm->in6m_state = MLD_NOT_MEMBER; - in6m_disconnect(inm); + in6m_disconnect_locked(inmh, inm); in6m_rele_locked(inmh, inm); } } @@ -1669,10 +1662,11 @@ mld_set_version(struct mld_ifsoftc *mli, const int version) static void mld_v2_cancel_link_timers(struct mld_ifsoftc *mli) { - struct ifmultiaddr *ifma, *next; + struct epoch_tracker et; + struct in6_multi_head inmh; + struct ifmultiaddr *ifma; struct ifnet *ifp; struct in6_multi *inm; - struct in6_multi_head inmh; CTR3(KTR_MLD, "%s: cancel v2 timers on ifp %p(%s)", __func__, mli->mli_ifp, if_name(mli->mli_ifp)); @@ -1695,12 +1689,11 @@ mld_v2_cancel_link_timers(struct mld_ifsoftc *mli) ifp = mli->mli_ifp; IF_ADDR_WLOCK(ifp); - restart: - CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { - if (ifma->ifma_addr->sa_family != AF_INET6 || - ifma->ifma_protospec == NULL) + NET_EPOCH_ENTER(et); + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + inm = in6m_ifmultiaddr_get_inm(ifma); + if (inm == NULL) continue; - inm = (struct in6_multi *)ifma->ifma_protospec; switch (inm->in6m_state) { case MLD_NOT_MEMBER: case MLD_SILENT_MEMBER: @@ -1715,9 +1708,7 @@ mld_v2_cancel_link_timers(struct mld_ifsoftc *mli) * version, we need to release the final * reference held for issuing the INCLUDE {}. */ - in6m_disconnect(inm); in6m_rele_locked(&inmh, inm); - ifma->ifma_protospec = NULL; /* FALLTHROUGH */ case MLD_G_QUERY_PENDING_MEMBER: case MLD_SG_QUERY_PENDING_MEMBER: @@ -1733,11 +1724,8 @@ mld_v2_cancel_link_timers(struct mld_ifsoftc *mli) mbufq_drain(&inm->in6m_scq); break; } - if (__predict_false(ifma6_restart)) { - ifma6_restart = false; - goto restart; - } } + NET_EPOCH_EXIT(et); IF_ADDR_WUNLOCK(ifp); in6m_release_list_deferred(&inmh); } @@ -1909,6 +1897,14 @@ mld_change_state(struct in6_multi *inm, const int delay) error = 0; + /* + * Check if the in6_multi has already been disconnected. + */ + if (inm->in6m_ifp == NULL) { + CTR1(KTR_MLD, "%s: inm is disconnected", __func__); + return (0); + } + /* * Try to detect if the upper layer just asked us to change state * for an interface which has now gone away. @@ -2019,6 +2015,7 @@ mld_initial_join(struct in6_multi *inm, struct mld_ifsoftc *mli, if (mli->mli_version == MLD_VERSION_2 && inm->in6m_state == MLD_LEAVING_MEMBER) { inm->in6m_refcount--; + MPASS(inm->in6m_refcount > 0); } inm->in6m_state = MLD_REPORTING_MEMBER; @@ -3023,11 +3020,9 @@ mld_v2_dispatch_general_query(struct mld_ifsoftc *mli) NET_EPOCH_ENTER(et); CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_INET6 || - ifma->ifma_protospec == NULL) + inm = in6m_ifmultiaddr_get_inm(ifma); + if (inm == NULL) continue; - - inm = (struct in6_multi *)ifma->ifma_protospec; KASSERT(ifp == inm->in6m_ifp, ("%s: inconsistent ifp", __func__)); diff --git a/sys/netinet6/mld6_var.h b/sys/netinet6/mld6_var.h index 166c20555b96..8dc2ffa4cd7c 100644 --- a/sys/netinet6/mld6_var.h +++ b/sys/netinet6/mld6_var.h @@ -160,12 +160,13 @@ struct mld_ifsoftc { #define MLD_IFINFO(ifp) \ (((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->mld_ifinfo) +struct in6_multi_head; int mld_change_state(struct in6_multi *, const int); struct mld_ifsoftc * mld_domifattach(struct ifnet *); void mld_domifdetach(struct ifnet *); void mld_fasttimo(void); -void mld_ifdetach(struct ifnet *); +void mld_ifdetach(struct ifnet *, struct in6_multi_head *); int mld_input(struct mbuf *, int, int); void mld_slowtimo(void); From d81ca439e703f3ee4c83f0523aff43df9015e89d Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Thu, 24 Jan 2019 11:59:46 +0000 Subject: [PATCH 048/142] Make sh(1) support \u in PS1. This removes one fork/exec on interactive shell startup. Reviewed by: 0mp (man page), jilles MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18790 --- bin/sh/parser.c | 61 +++++++++++++++++++++++++++++++++++++++++++++ bin/sh/sh.1 | 4 ++- share/skel/dot.shrc | 2 +- 3 files changed, 65 insertions(+), 2 deletions(-) diff --git a/bin/sh/parser.c b/bin/sh/parser.c index 85498050b15b..297d19d4d9b6 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -40,6 +40,8 @@ static char sccsid[] = "@(#)parser.c 8.7 (Berkeley) 5/16/95"; #include __FBSDID("$FreeBSD$"); +#include +#include #include #include #include @@ -130,6 +132,7 @@ static void synexpect(int) __dead2; static void synerror(const char *) __dead2; static void setprompt(int); static int pgetc_linecont(void); +static void getusername(char *, size_t); static void * @@ -1969,6 +1972,53 @@ pgetc_linecont(void) return (c); } + +static struct passwd * +getpwlogin(void) +{ + const char *login; + + login = getlogin(); + if (login == NULL) + return (NULL); + + return (getpwnam(login)); +} + + +static void +getusername(char *name, size_t namelen) +{ + static char cached_name[MAXLOGNAME]; + struct passwd *pw; + uid_t euid; + + if (cached_name[0] == '\0') { + euid = geteuid(); + + /* + * Handle the case when there is more than one + * login with the same UID, or when the login + * returned by getlogin(2) does no longer match + * the current UID. + */ + pw = getpwlogin(); + if (pw == NULL || pw->pw_uid != euid) + pw = getpwuid(euid); + + if (pw != NULL) { + strlcpy(cached_name, pw->pw_name, + sizeof(cached_name)); + } else { + snprintf(cached_name, sizeof(cached_name), + "%u", euid); + } + } + + strlcpy(name, cached_name, namelen); +} + + /* * called by editline -- any expansions to the prompt * should be added here. @@ -2026,6 +2076,17 @@ getprompt(void *unused __unused) --i; break; + /* + * User name. + */ + case 'u': + ps[i] = '\0'; + getusername(&ps[i], PROMPTLEN - i); + /* Skip to end of username. */ + while (ps[i + 1] != '\0') + i++; + break; + /* * Working directory. * diff --git a/bin/sh/sh.1 b/bin/sh/sh.1 index e671a1f0d142..ca9f4c536eb2 100644 --- a/bin/sh/sh.1 +++ b/bin/sh/sh.1 @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd December 8, 2018 +.Dd January 24, 2019 .Dt SH 1 .Os .Sh NAME @@ -1402,6 +1402,8 @@ which are replaced by the given information: This system's fully-qualified hostname (FQDN). .It Li \eh This system's hostname. +.It Li \eu +User name. .It Li \eW The final component of the current working directory. .It Li \ew diff --git a/share/skel/dot.shrc b/share/skel/dot.shrc index 00575ce68107..f497bd66f819 100644 --- a/share/skel/dot.shrc +++ b/share/skel/dot.shrc @@ -33,7 +33,7 @@ alias g='egrep -i' # set prompt: ``username@hostname:directory $ '' -PS1="`whoami`@\h:\w \\$ " +PS1="\u@\h:\w \\$ " # search path for cd(1) # CDPATH=:$HOME From 34bb795ba17ff58ebeec220e0b33068ac25592c8 Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Thu, 24 Jan 2019 16:40:14 +0000 Subject: [PATCH 049/142] Update a comment to reflect the current reality. SYN-cache entries live for abaut 12 seconds, not 45, when default setting are used. MFC after: 1 week Sponsored by: Netflix, Inc. --- sys/netinet/tcp_syncache.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 100229a254e8..3b4e6ff8e033 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -154,7 +154,12 @@ static int syncookie_cmp(struct in_conninfo *inc, struct syncache_head *sch, /* * Transmit the SYN,ACK fewer times than TCP_MAXRXTSHIFT specifies. - * 3 retransmits corresponds to a timeout of 3 * (1 + 2 + 4 + 8) == 45 seconds, + * 3 retransmits corresponds to a timeout with default values of + * TCPTV_RTOBASE * ( 1 + + * tcp_syn_backoff[1] + + * tcp_syn_backoff[2] + + * tcp_syn_backoff[3]) + 3 * tcp_rexmit_slop, + * 3000 ms * (1 + 1 + 1 + 1) + 3 * 200 ms = 12300 ms, * the odds are that the user has given up attempting to connect by then. */ #define SYNCACHE_MAXREXMTS 3 From 42395cbe3176ab72c4e9203b4c6a42ac2fa500b5 Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Thu, 24 Jan 2019 16:43:13 +0000 Subject: [PATCH 050/142] Kill a trailing whitespace character... MFC after: 3 days Sponsored by: Netflix, Inc. --- sys/netinet/tcp_syncache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 3b4e6ff8e033..46b09c680d1a 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -156,7 +156,7 @@ static int syncookie_cmp(struct in_conninfo *inc, struct syncache_head *sch, * Transmit the SYN,ACK fewer times than TCP_MAXRXTSHIFT specifies. * 3 retransmits corresponds to a timeout with default values of * TCPTV_RTOBASE * ( 1 + - * tcp_syn_backoff[1] + + * tcp_syn_backoff[1] + * tcp_syn_backoff[2] + * tcp_syn_backoff[3]) + 3 * tcp_rexmit_slop, * 3000 ms * (1 + 1 + 1 + 1) + 3 * 200 ms = 12300 ms, From 989321df1180f46d0b89abe26b099a7546b4f2c3 Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Thu, 24 Jan 2019 16:47:18 +0000 Subject: [PATCH 051/142] Get the arithmetic right... MFC after: 3 days Sponsored by: Netflix, Inc. --- sys/netinet/tcp_syncache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 46b09c680d1a..778dda13f279 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -159,7 +159,7 @@ static int syncookie_cmp(struct in_conninfo *inc, struct syncache_head *sch, * tcp_syn_backoff[1] + * tcp_syn_backoff[2] + * tcp_syn_backoff[3]) + 3 * tcp_rexmit_slop, - * 3000 ms * (1 + 1 + 1 + 1) + 3 * 200 ms = 12300 ms, + * 3000 ms * (1 + 1 + 1 + 1) + 3 * 200 ms = 12600 ms, * the odds are that the user has given up attempting to connect by then. */ #define SYNCACHE_MAXREXMTS 3 From 56d417fd5d21e6172dc8d774b94d78b6140a886a Mon Sep 17 00:00:00 2001 From: Benedict Reuschling Date: Thu, 24 Jan 2019 18:13:23 +0000 Subject: [PATCH 052/142] Add ZFS usage tips to freebsd-tips. Add a bunch of examples on how to use ZFS features like: - listing available space, - setting and displaying a userquota, - displaying pool I/O statistics and pool history, - displaying the compression ratio for a dataset, - various list options (sorting, removing headers), - performing a dry-run of a snapshot delete, - removing a range of snapshots, - setting a custom property, - preventing removal of a snapshot with ZFS holds, - permission sets for zfs send/receive. Additionally, clarify the existing examples a bit when it comes to displaying space by mentioning UFS explicitly. Other examples include displaying I/O in top(1), querying sysctl(8) for active CPUs and available RAM. Mention systat(1) and its options, too. While here, reformat the example to upload a dmesg(8) a bit to wrap properly. Thanks to Allan Jude for his help with some of the ZFS examples. Reviewed by: dru,allanjude Approved by: allanjude (earlier version) MFC after: 3 days Relnotes: yes (ZFS examples in freebsd-tips) Differential Revision: https://reviews.freebsd.org/D18541 --- usr.bin/fortune/datfiles/freebsd-tips | 240 +++++++++++++++++++++++++- 1 file changed, 236 insertions(+), 4 deletions(-) diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index 5f05b4ede86f..1ec51666002b 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -270,12 +270,12 @@ To see how long it takes a command to run, type the word "time" before the command name. -- Dru % -To see how much disk space is left on your partitions, use +To see how much disk space is left on your UFS partitions, use df -h -- Dru % -To see the 10 largest files on a directory or partition, use +To see the 10 largest files on a directory or UFS partition, use du -h /partition_or_directory_name | sort -rh | head -- Dru @@ -554,9 +554,241 @@ Use "sysrc name=value" to add an entry and "sysrc -x name" to delete an entry. -- Lars Engels % -You can upload the dmesg of your system to help developers get an overview of commonly used hardware and peripherals for FreeBSD. -Use the curl package to upload it in one command: +You can upload the dmesg of your system to help developers get an overview of commonly +used hardware and peripherals for FreeBSD. Use the curl package to upload it like this: curl -v -d "nickname=$USER" -d "description=FreeBSD/$(uname -m) on \ $(kenv smbios.system.maker) $(kenv smbios.system.product)" -d "do=addd" \ --data-urlencode 'dmesg@/var/run/dmesg.boot' http://dmesgd.nycbug.org/index.cgi % +Want to know how much memory (in bytes) your machine has available? Let +sysctl(8) tell you with the following command: + +sysctl hw.physmem + +The number of active CPUs is displayed using this command: + +sysctl hw.ncpu + + -- Benedict Reuschling +% +When using ZFS as the file system the "df" command will display confusing +values. Use the built-in "zfs list" command to get an overview of space usage: + +zfs list -o space + + -- Benedict Reuschling +% +To learn more about what your system is doing, take a look at systat(1). For +example, to get an overview of I/O happening in the system, run: + +systat -iostat + +Other values are icmp, icmp6, ifstat, ip, ip6, netstat, pigs, sctp, swap, tcp, +vmstat, or zarc. You can switch between displays using : and exit +back to your shell by typing + +:quit + + -- Benedict Reuschling +% +To set a quota of 10 GB for the user named foo on a ZFS dataset, run the +following command: + +# zfs set userquota@foo=10G pool/home/foo + +The zfs userspace command can display the quota and current space usage: + +# zfs userspace pool/home/foo + +To unset a quota, assign "none" as the value. + -- Benedict Reuschling +% +ZFS can display I/O statistics for a given pool using the iostat subcommand. +By default, it will display one line of current activity. To display stats +every 5 seconds run the following command (cancel with CTRL+C): + +zpool iostat 5 + +To view individual disk activities, specify the -v parameter: + +zpool iostat -v + +Of course, both can be combined. For more options, see zpool(8). + -- Benedict Reuschling +% +FreeBSD's top(1) utility displays CPU statistics by default. +To display I/O activity for each process instead, run top like this: + +top -m io + + -- Benedict Reuschling +% +ZFS keeps a history of commands run against a specific pool using the +history subcommand to zpool: + +zpool history + +More details are available using the -i and -l parameters. Note that ZFS +will not keep the complete pool history forever and will remove older +events in favor of never ones. + -- Benedict Reuschling +% +To display the compression ratio for the ZFS dataset /var/log on the pool +mypool, run the following command: + +zfs get refcompressratio mypool/var/log + +The refcompressratio will only display the compression ratio for that specific +dataset, not the descendant datasets. To include the child datasets, the +command looks like this: + +zfs get compressratio mypool/var + + -- Benedict Reuschling +% +You can limit the depth of the displayed datasets in the "zfs list" output +using the -d parameter. To display only the first level of datasets below +mypool/usr and not the ones deeper than those, run this command: + +zfs list -d 1 mypool/usr + + -- Benedict Reuschling +% +The "zfs list" command can be filtered in multiple ways. To display just +the dataset name, use the -o parameter: + +zfs list -o name mypool/usr + +More columns and their order can be defined by separating them with commas: + +zfs list -o mountpoint,name,avail + + -- Benedict Reuschling +% +The output of "zfs list" can be sorted by a specific column using -s. To +sort the datasets by the "used" column in ascending order, run this command: + +zfs list -s used + +To sort in descending order instead, use -S: + +zfs list -S used + + -- Benedict Reuschling +% +To make the "zfs list" output more script-friendly, you can suppress the +output of the headers for each column by passing the -H parameter: + +zfs list -H + +Another helpful option for script writers is -p, which displays the numbers +in non-rounded, exact values: + +zfs list -p + + -- Benedict Reuschling +% +Before deleting a dataset or snapshot, perform a dry run using the -n +parameter. This is to make sure you really want to delete just that +dataset/snapshot and not any dependent ones. ZFS will display the resulting +action when -n is combined with the -v option without actually performing +it: + +zfs destroy -rvn mypool@mysnap + +Once you are sure this is exactly what you intend to do, remove the -n +parameter to execute the destroy operation. + -- Benedict Reuschling +% +You can delete a range of ZFS snapshots (a-z) in multiple ways. +The following will delete d and all earlier snapshots: + +zfs destroy mypool/data@%d + +To delete d and all later snapshots: + +zfs destroy mypool/data@d% + +To delete all dataset snapshots: + +zfs destroy mypool/data@% + +Make sure to let ZFS perform a dry run (-n option) first and display (-v) what +it would do to confirm that the delete operation is removing exactly what you +intended. + -- Benedict Reuschling +% +To set a custom ZFS property on the mypool pool, you need to provide it +using the "key1:key2=value" syntax, where the colon (:) is used as the +separator and identifier from the built-in ZFS properties: + +# zfs set warranty:expires=2038-01-19 mypool + +The custom property is applied to all datasets and can be queried like any +built-in properties using zfs get: + +zfs get warranty:expires mypool + +To reset the value of a custom property, use the inherit subcommand: + +# zfs inherit warranty:expires mypool + +Removing a custom property from a pool is done using the -r flag to the +"zfs inherit" command: + +# zfs inherit -r warranty:expires mypool + + -- Benedict Reuschling +% +To delete a range of ZFS snapshots, use the % (percent) character after the +full path to the first snapshot that should be included. For example, to +simulate deleting snapshots a through (including) d, use this command: + +# zfs destroy -rvn mypool/tmp@a%d + +Once you are sure that this is what you want, remove the -n option: + +# zfs destroy -rv mypool/tmp@a%d + + -- Benedict Reuschling +% +You can prevent the removal of a ZFS snapshot by using the hold subcommand. +For example, to prevent the snapshot called milestone from deletion, run the +following command: + +# zfs hold milestone_hold mypool/projects@my_milestone + +The "zfs holds" command will list all current snapshots that are protected +this way (-r for a recursive list): + +# zfs holds -r mypool + +The TIMESTAMP column in the output of the above command is from when the +hold was created, not the snapshot it holds. The "zfs destroy" command will +echo a "dataset is busy" message on the console when it encounters a hold. +Use "zfs release" to release the hold on the snapshot: + +# zfs release milestone_hold mypool/projects@my_milestone + + -- Benedict Reuschling +% +A user "sender" needs the following permissions set to send a ZFS dataset: + +# zfs allow -u sender send,snapshot txpool + +On the receiving side, the user "receiver" requires these permissions: + +# zfs allow -u receiver compression,mountpoint,mount,create,receive rxpool + + -- Benedict Reuschling +% +Don't let your zpool fill up completely by creating a dataset with +reservation. + +# zfs create -o refreservation=<5% of total pool space> /reserved + +You can always shrink the reserve if you need the space, but your pool will +always have space left this way. + + -- Benedict Reuschling +% From fc24ba59eef56147823b2af4c3af5a71946d007d Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Thu, 24 Jan 2019 18:26:30 +0000 Subject: [PATCH 053/142] freebsd-update: open $PAGER only if necessary PR: 194547, 208497 Submitted by: Gerald Aryeetey Reviewed by: delphij MFC after: 1 month Sponsored by: The FreeBSD Foundation --- usr.sbin/freebsd-update/freebsd-update.sh | 43 +++++++++++------------ 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index 68fdf2b774b8..a89e62234c35 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -1949,13 +1949,11 @@ fetch_create_manifest () { # Report to the user if any updates were avoided due to local changes if [ -s modifiedfiles ]; then - echo - echo -n "The following files are affected by updates, " - echo "but no changes have" - echo -n "been downloaded because the files have been " - echo "modified locally:" - cat modifiedfiles - fi | $PAGER + cat - modifiedfiles <<- EOF | ${PAGER} + The folling files are affected by updates but no changes have + been downloaded because the files have been modified locally: + EOF + fi rm modifiedfiles # If no files will be updated, tell the user and exit @@ -1981,30 +1979,29 @@ fetch_create_manifest () { # Report removed files, if any if [ -s files.removed ]; then - echo - echo -n "The following files will be removed " - echo "as part of updating to ${RELNUM}-p${RELPATCHNUM}:" - cat files.removed - fi | $PAGER + cat - files.removed <<- EOF | ${PAGER} + The following files will be removed as part of updating to + ${RELNUM}-p${RELPATCHNUM}: + EOF + fi rm files.removed # Report added files, if any if [ -s files.added ]; then - echo - echo -n "The following files will be added " - echo "as part of updating to ${RELNUM}-p${RELPATCHNUM}:" - cat files.added - fi | $PAGER + cat - files.added <<- EOF | ${PAGER} + The following files will be added as part of updating to + ${RELNUM}-p${RELPATCHNUM}: + EOF + fi rm files.added # Report updated files, if any if [ -s files.updated ]; then - echo - echo -n "The following files will be updated " - echo "as part of updating to ${RELNUM}-p${RELPATCHNUM}:" - - cat files.updated - fi | $PAGER + cat - files.updated <<- EOF | ${PAGER} + The following files will be updated as part of updating to + ${RELNUM}-p${RELPATCHNUM}: + EOF + fi rm files.updated # Create a directory for the install manifest. From f5ce14028c19e5e5be61a2b6aa8242fc36cc8e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20E=C3=9Fer?= Date: Thu, 24 Jan 2019 18:39:45 +0000 Subject: [PATCH 054/142] Silence Clang Scan warnings regarding the use of strcp(). While these warnings are false positives, the use of strdup() instead of malloc() and strcpy() simplifies and clarifies the code. While checking the remaining uses of strcpy and strcat I noticed an assignment of a strlen() to a variable "s", whose value needs to be preserved for use in later output routines (where it is used to allocate a buffer). I do not think that the value of "s" will come out lower than its correct value and thus there is no risk of a buffer overflow, in the general case, but a specially crafter argument might lead to an overflow. The bogus assignment to "s" is removed since this value was only used a single time in the following malloc() call, which has been removed. MFC after: 2 weeks --- usr.bin/whereis/whereis.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/usr.bin/whereis/whereis.c b/usr.bin/whereis/whereis.c index b9b8f7810b79..48426d376181 100644 --- a/usr.bin/whereis/whereis.c +++ b/usr.bin/whereis/whereis.c @@ -285,9 +285,9 @@ defaults(void) bindirs[nele] = NULL; if ((cp = getenv("PATH")) != NULL) { /* don't destroy the original environment... */ - if ((b = malloc(strlen(cp) + 1)) == NULL) + b = strdup(cp); + if (b == NULL) abort(); - strcpy(b, cp); decolonify(b, &bindirs, &nele); } } @@ -301,18 +301,18 @@ defaults(void) err(EX_OSERR, "error processing manpath results"); if ((b = strchr(buf, '\n')) != NULL) *b = '\0'; - if ((b = malloc(strlen(buf) + 1)) == NULL) + b = strdup(buf); + if (b == NULL) abort(); - strcpy(b, buf); nele = 0; decolonify(b, &mandirs, &nele); } /* -s defaults to precompiled list, plus subdirs of /usr/ports */ if (!sourcedirs) { - if ((b = malloc(strlen(sourcepath) + 1)) == NULL) + b = strdup(sourcepath); + if (b == NULL) abort(); - strcpy(b, sourcepath); nele = 0; decolonify(b, &sourcedirs, &nele); @@ -523,11 +523,9 @@ main(int argc, char **argv) * man -w found plain source * page, use it. */ - s = strlen(buf); - cp2 = malloc(s + 1); + cp2 = strdup(buf); if (cp2 == NULL) abort(); - strcpy(cp2, buf); } if (man == NULL) { From ae97aa98eafa43957f67d75eb6b018454a23fb8a Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Thu, 24 Jan 2019 18:41:00 +0000 Subject: [PATCH 055/142] freebsd-update: Stop installing empty component sets Submitted by: Gerald Aryeetey Reported by: rgrimes Reviewed by: delphij MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18927 --- usr.sbin/freebsd-update/freebsd-update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index a89e62234c35..c9413c71452f 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -2195,7 +2195,7 @@ upgrade_guess_components () { sort -k 2,2 -t ' ' > compfreq.present join -t ' ' -1 2 -2 2 compfreq.present compfreq.total | while read S P T; do - if [ ${P} -gt `expr ${T} / 2` ]; then + if [ ${T} -ne 0 -a ${P} -gt `expr ${T} / 2` ]; then echo ${S} fi done > comp.present From ed1b6cec4fb0182064b6188e335b32cb77805218 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Thu, 24 Jan 2019 18:48:15 +0000 Subject: [PATCH 056/142] freebsd-update: fix style from r343271 change PR: 234771 Submitted by: Gerald Aryeetey MFC with: r343271 Sponsored by: The FreeBSD Foundation --- usr.sbin/freebsd-update/freebsd-update.sh | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index c9413c71452f..0feff496cb0b 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -670,20 +670,20 @@ fetchupgrade_check_params () { # Disallow upgrade from a version that is not a release case ${RELNUM} in - *-RELEASE | *-ALPHA* | *-BETA* | *-RC*) - ;; - *) - echo -n "`basename $0`: " - cat <<- EOF - Cannot upgrade from a version that is not a release - (including alpha, beta and release candidates) - using `basename $0`. Instead, FreeBSD can be directly - upgraded by source or upgraded to a RELEASE/RELENG version - prior to running `basename $0`. - Currently running: ${RELNUM} - EOF - exit 1 - ;; + *-RELEASE | *-ALPHA* | *-BETA* | *-RC*) + ;; + *) + echo -n "`basename $0`: " + cat <<- EOF + Cannot upgrade from a version that is not a release + (including alpha, beta and release candidates) + using `basename $0`. Instead, FreeBSD can be directly + upgraded by source or upgraded to a RELEASE/RELENG version + prior to running `basename $0`. + Currently running: ${RELNUM} + EOF + exit 1 + ;; esac # Figure out what directory contains the running kernel From 9e8c28fcc079a9584516eea04b8cbc42a85e585d Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Thu, 24 Jan 2019 18:51:15 +0000 Subject: [PATCH 057/142] freebsd-update: Clarify unsupported upgrade message PR: 204115 Submitted by: Gerald Aryeetey Reviewed by: delphij MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18916 --- usr.sbin/freebsd-update/freebsd-update.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index 0feff496cb0b..c5d1b839e9cf 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -1022,7 +1022,16 @@ fetch_pick_server () { # Have we run out of mirrors? if [ `wc -l < serverlist` -eq 0 ]; then - echo "No mirrors remaining, giving up." + cat <<- EOF + No mirrors remaining, giving up. + + This may be because upgrading from this platform (${ARCH}) + or release (${RELNUM}) is unsupported by `basename $0`. Only + platforms with Tier 1 support can be upgraded by `basename $0`. + See https://www.freebsd.org/platforms/index.html for more info. + + If unsupported, FreeBSD must be upgraded by source. + EOF return 1 fi From b882e02bc4f3f4f74c6a5b428dc916ec92ad4198 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Thu, 24 Jan 2019 20:35:58 +0000 Subject: [PATCH 058/142] Fix a typo/wordsmith a description modified in r343407 r343407 accidentally introduced a typo (folling -> following). While reading the change out loud, I realized that the original sentence was wordy. almost sounding like a run-on sentence. Improve the flow by splitting up the two thoughts into two distinct sentence fragments. PR: 194547, 208497 Reviewed by: emaste Approved by: emaste (mentor) MFC after: 1 month MFC with: r343407 Differential Revision: https://reviews.freebsd.org/D18947 --- usr.sbin/freebsd-update/freebsd-update.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index c5d1b839e9cf..2ed1f43fa0b1 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -1959,8 +1959,9 @@ fetch_create_manifest () { # Report to the user if any updates were avoided due to local changes if [ -s modifiedfiles ]; then cat - modifiedfiles <<- EOF | ${PAGER} - The folling files are affected by updates but no changes have - been downloaded because the files have been modified locally: + The following files are affected by updates. No changes have + been downloaded, however, because the files have been modified + locally: EOF fi rm modifiedfiles From aa4dd64dfec15d8bc6118db6f26ca88f9dbec84e Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Thu, 24 Jan 2019 22:09:26 +0000 Subject: [PATCH 059/142] netmap: fix crash with monitors and VALE ports Crash report described here: https://github.com/luigirizzo/netmap/issues/583 Fixed by providing dummy sync callback in case it is missing. --- sys/dev/netmap/netmap_monitor.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/dev/netmap/netmap_monitor.c b/sys/dev/netmap/netmap_monitor.c index 7e88ae02f9ba..5297c0cb9123 100644 --- a/sys/dev/netmap/netmap_monitor.c +++ b/sys/dev/netmap/netmap_monitor.c @@ -259,11 +259,20 @@ static int netmap_monitor_parent_txsync(struct netmap_kring *, int); static int netmap_monitor_parent_rxsync(struct netmap_kring *, int); static int netmap_monitor_parent_notify(struct netmap_kring *, int); +static int +nm_monitor_dummycb(struct netmap_kring *kring, int flags) +{ + (void)kring; + (void)flags; + return 0; +} + static void nm_monitor_intercept_callbacks(struct netmap_kring *kring) { ND("intercept callbacks on %s", kring->name); - kring->mon_sync = kring->nm_sync; + kring->mon_sync = kring->nm_sync != NULL ? + kring->nm_sync : nm_monitor_dummycb; kring->mon_notify = kring->nm_notify; if (kring->tx == NR_TX) { kring->nm_sync = netmap_monitor_parent_txsync; From 60315f8f9de3087b0a4ee7fe85a38dfe0c3e0c02 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Thu, 24 Jan 2019 23:34:51 +0000 Subject: [PATCH 060/142] Install .shrc for root, and set PS1 for the toor account. Reviewed by: jilles MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18872 --- bin/sh/Makefile | 9 ++++++--- bin/sh/dot.profile | 3 +++ bin/sh/dot.shrc | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 bin/sh/dot.shrc diff --git a/bin/sh/Makefile b/bin/sh/Makefile index abd756bb8e6d..ee4fa87026cf 100644 --- a/bin/sh/Makefile +++ b/bin/sh/Makefile @@ -3,9 +3,12 @@ .include -CONFS= dot.profile profile -CONFSDIR_dot.profile= /root -CONFSNAME_dot.profile= .profile +CONFGROUPS= ETC ROOT +ETC= profile +ROOT= dot.shrc dot.profile +ROOTDIR= /root +ROOTNAME_dot.shrc= .shrc +ROOTNAME_dot.profile= .profile PACKAGE=runtime PROG= sh INSTALLFLAGS= -S diff --git a/bin/sh/dot.profile b/bin/sh/dot.profile index 76ebfd5e6168..fd0c43fdb927 100644 --- a/bin/sh/dot.profile +++ b/bin/sh/dot.profile @@ -9,6 +9,9 @@ export TERM PAGER=less export PAGER +# set ENV to a file invoked each time sh is started for interactive use. +ENV=$HOME/.shrc; export ENV + # Query terminal size; useful for serial lines. if [ -x /usr/bin/resizewin ] ; then /usr/bin/resizewin -z ; fi diff --git a/bin/sh/dot.shrc b/bin/sh/dot.shrc new file mode 100644 index 000000000000..f497bd66f819 --- /dev/null +++ b/bin/sh/dot.shrc @@ -0,0 +1,39 @@ +# $FreeBSD$ +# +# .shrc - bourne shell startup file +# +# This file will be used if the shell is invoked for interactive use and +# the environment variable ENV is set to this file. +# +# see also sh(1), environ(7). +# + + +# file permissions: rwxr-xr-x +# +# umask 022 + +# Uncomment this to enable the builtin vi(1) command line editor in sh(1), +# e.g. ESC to go into visual mode. +# set -o vi + + +# some useful aliases +alias h='fc -l' +alias j=jobs +alias m="$PAGER" +alias ll='ls -laFo' +alias l='ls -l' +alias g='egrep -i' + +# # be paranoid +# alias cp='cp -ip' +# alias mv='mv -i' +# alias rm='rm -i' + + +# set prompt: ``username@hostname:directory $ '' +PS1="\u@\h:\w \\$ " + +# search path for cd(1) +# CDPATH=:$HOME From 9df9e9361cddc9586f64e2bfec552dd01284fac3 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Fri, 25 Jan 2019 01:05:18 +0000 Subject: [PATCH 061/142] net80211: reuse TICKS_2_MSEC / MSEC_2_TICKS macros from sys/time.h Replace in-place implementation with system-wide one; since it guarantees non-zero result drop all less-than-one checks from drivers and net80211. MFC after: 2 weeks --- sys/dev/rtwn/pci/rtwn_pci_reg.c | 2 +- sys/dev/rtwn/usb/rtwn_usb_reg.c | 6 ++---- sys/net80211/ieee80211_amrr.c | 4 +--- sys/net80211/ieee80211_freebsd.c | 8 ++------ sys/net80211/ieee80211_freebsd.h | 6 +++--- sys/net80211/ieee80211_ioctl.c | 12 ++---------- sys/net80211/ieee80211_rssadapt.c | 4 +--- sys/net80211/ieee80211_scan.c | 2 +- 8 files changed, 13 insertions(+), 31 deletions(-) diff --git a/sys/dev/rtwn/pci/rtwn_pci_reg.c b/sys/dev/rtwn/pci/rtwn_pci_reg.c index 664fb33e6db8..6fe188c3f76d 100644 --- a/sys/dev/rtwn/pci/rtwn_pci_reg.c +++ b/sys/dev/rtwn/pci/rtwn_pci_reg.c @@ -118,6 +118,6 @@ rtwn_pci_delay(struct rtwn_softc *sc, int usec) DELAY(usec); else { (void) mtx_sleep(sc, &sc->sc_mtx, 0, "rtwn_pci", - MAX(msecs_to_ticks(usec / 1000), 1)); + msecs_to_ticks(usec / 1000)); } } diff --git a/sys/dev/rtwn/usb/rtwn_usb_reg.c b/sys/dev/rtwn/usb/rtwn_usb_reg.c index 2091c6ac6444..c464b69d7ece 100644 --- a/sys/dev/rtwn/usb/rtwn_usb_reg.c +++ b/sys/dev/rtwn/usb/rtwn_usb_reg.c @@ -172,8 +172,6 @@ rtwn_usb_delay(struct rtwn_softc *sc, int usec) /* 1ms delay as default is too big. */ if (usec < 1000) DELAY(usec); - else { - usb_pause_mtx(&sc->sc_mtx, - MAX(msecs_to_ticks(usec / 1000), 1)); - } + else + usb_pause_mtx(&sc->sc_mtx, msecs_to_ticks(usec / 1000)); } diff --git a/sys/net80211/ieee80211_amrr.c b/sys/net80211/ieee80211_amrr.c index a9f8d8e26925..f686b83bf04c 100644 --- a/sys/net80211/ieee80211_amrr.c +++ b/sys/net80211/ieee80211_amrr.c @@ -102,15 +102,13 @@ static void amrr_setinterval(const struct ieee80211vap *vap, int msecs) { struct ieee80211_amrr *amrr = vap->iv_rs; - int t; if (!amrr) return; if (msecs < 100) msecs = 100; - t = msecs_to_ticks(msecs); - amrr->amrr_interval = (t < 1) ? 1 : t; + amrr->amrr_interval = msecs_to_ticks(msecs); } static void diff --git a/sys/net80211/ieee80211_freebsd.c b/sys/net80211/ieee80211_freebsd.c index 925872593fa8..9e82e9e1ff83 100644 --- a/sys/net80211/ieee80211_freebsd.c +++ b/sys/net80211/ieee80211_freebsd.c @@ -136,13 +136,12 @@ int ieee80211_sysctl_msecs_ticks(SYSCTL_HANDLER_ARGS) { int msecs = ticks_to_msecs(*(int *)arg1); - int error, t; + int error; error = sysctl_handle_int(oidp, &msecs, 0, req); if (error || !req->newptr) return error; - t = msecs_to_ticks(msecs); - *(int *)arg1 = (t < 1) ? 1 : t; + *(int *)arg1 = msecs_to_ticks(msecs); return 0; } @@ -347,9 +346,6 @@ ieee80211_com_vdetach(struct ieee80211vap *vap) int sleep_time; sleep_time = msecs_to_ticks(250); - if (sleep_time == 0) - sleep_time = 1; - atomic_set_32(&vap->iv_com_state, IEEE80211_COM_DETACHED); while (MS(atomic_load_32(&vap->iv_com_state), IEEE80211_COM_REF) != 0) pause("comref", sleep_time); diff --git a/sys/net80211/ieee80211_freebsd.h b/sys/net80211/ieee80211_freebsd.h index a70de1086bf6..4e06b76ad60a 100644 --- a/sys/net80211/ieee80211_freebsd.h +++ b/sys/net80211/ieee80211_freebsd.h @@ -38,6 +38,7 @@ #include #include #include +#include /* * Common state locking definitions. @@ -249,9 +250,8 @@ void ieee80211_vap_destroy(struct ieee80211vap *); (((_ifp)->if_flags & IFF_UP) && \ ((_ifp)->if_drv_flags & IFF_DRV_RUNNING)) -/* XXX TODO: cap these at 1, as hz may not be 1000 */ -#define msecs_to_ticks(ms) (((ms)*hz)/1000) -#define ticks_to_msecs(t) (1000*(t) / hz) +#define msecs_to_ticks(ms) MSEC_2_TICKS(ms) +#define ticks_to_msecs(t) TICKS_2_MSEC(t) #define ticks_to_secs(t) ((t) / hz) #define ieee80211_time_after(a,b) ((long)(b) - (long)(a) < 0) diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index 7241a95bf8df..2b7e3dd7414b 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -2515,20 +2515,12 @@ ieee80211_scanreq(struct ieee80211vap *vap, struct ieee80211_scan_req *sr) sr->sr_duration > IEEE80211_IOC_SCAN_DURATION_MAX) return EINVAL; sr->sr_duration = msecs_to_ticks(sr->sr_duration); - if (sr->sr_duration < 1) - sr->sr_duration = 1; } /* convert min/max channel dwell */ - if (sr->sr_mindwell != 0) { + if (sr->sr_mindwell != 0) sr->sr_mindwell = msecs_to_ticks(sr->sr_mindwell); - if (sr->sr_mindwell < 1) - sr->sr_mindwell = 1; - } - if (sr->sr_maxdwell != 0) { + if (sr->sr_maxdwell != 0) sr->sr_maxdwell = msecs_to_ticks(sr->sr_maxdwell); - if (sr->sr_maxdwell < 1) - sr->sr_maxdwell = 1; - } /* NB: silently reduce ssid count to what is supported */ if (sr->sr_nssid > IEEE80211_SCAN_MAX_SSID) sr->sr_nssid = IEEE80211_SCAN_MAX_SSID; diff --git a/sys/net80211/ieee80211_rssadapt.c b/sys/net80211/ieee80211_rssadapt.c index f06208536165..7d9158414a4c 100644 --- a/sys/net80211/ieee80211_rssadapt.c +++ b/sys/net80211/ieee80211_rssadapt.c @@ -117,15 +117,13 @@ static void rssadapt_setinterval(const struct ieee80211vap *vap, int msecs) { struct ieee80211_rssadapt *rs = vap->iv_rs; - int t; if (!rs) return; if (msecs < 100) msecs = 100; - t = msecs_to_ticks(msecs); - rs->interval = (t < 1) ? 1 : t; + rs->interval = msecs_to_ticks(msecs); } static void diff --git a/sys/net80211/ieee80211_scan.c b/sys/net80211/ieee80211_scan.c index 958a0e1ff6ea..97186ccff755 100644 --- a/sys/net80211/ieee80211_scan.c +++ b/sys/net80211/ieee80211_scan.c @@ -294,7 +294,7 @@ ieee80211_scan_dump(struct ieee80211_scan_state *ss) if_printf(vap->iv_ifp, "scan set "); ieee80211_scan_dump_channels(ss); - printf(" dwell min %lums max %lums\n", + printf(" dwell min %ums max %ums\n", ticks_to_msecs(ss->ss_mindwell), ticks_to_msecs(ss->ss_maxdwell)); } #endif /* IEEE80211_DEBUG */ From d9d146e67bd40f8926b677435fc1d4fc7ffa5f5f Mon Sep 17 00:00:00 2001 From: Kristof Provost Date: Fri, 25 Jan 2019 01:06:06 +0000 Subject: [PATCH 062/142] pf: Fix use-after-free of counters When cleaning up a vnet we free the counters in V_pf_default_rule and V_pf_status from shutdown_pf(), but we can still use them later, for example through pf_purge_expired_src_nodes(). Free them as the very last operation, as they rely on nothing else themselves. PR: 235097 MFC after: 1 week --- sys/netpfil/pf/pf_ioctl.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 44dc804f81a5..2bfed9c265c3 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -3989,20 +3989,6 @@ shutdown_pf(void) /* status does not use malloced mem so no need to cleanup */ /* fingerprints and interfaces have their own cleanup code */ - - /* Free counters last as we updated them during shutdown. */ - counter_u64_free(V_pf_default_rule.states_cur); - counter_u64_free(V_pf_default_rule.states_tot); - counter_u64_free(V_pf_default_rule.src_nodes); - - for (int i = 0; i < PFRES_MAX; i++) - counter_u64_free(V_pf_status.counters[i]); - for (int i = 0; i < LCNT_MAX; i++) - counter_u64_free(V_pf_status.lcounters[i]); - for (int i = 0; i < FCNT_MAX; i++) - counter_u64_free(V_pf_status.fcounters[i]); - for (int i = 0; i < SCNT_MAX; i++) - counter_u64_free(V_pf_status.scounters[i]); } while(0); return (error); @@ -4232,6 +4218,20 @@ pf_unload_vnet(void) pf_cleanup(); if (IS_DEFAULT_VNET(curvnet)) pf_mtag_cleanup(); + + /* Free counters last as we updated them during shutdown. */ + counter_u64_free(V_pf_default_rule.states_cur); + counter_u64_free(V_pf_default_rule.states_tot); + counter_u64_free(V_pf_default_rule.src_nodes); + + for (int i = 0; i < PFRES_MAX; i++) + counter_u64_free(V_pf_status.counters[i]); + for (int i = 0; i < LCNT_MAX; i++) + counter_u64_free(V_pf_status.lcounters[i]); + for (int i = 0; i < FCNT_MAX; i++) + counter_u64_free(V_pf_status.fcounters[i]); + for (int i = 0; i < SCNT_MAX; i++) + counter_u64_free(V_pf_status.scounters[i]); } static void From 86d535ab471ed9d95add7b545aeb9e40a3d9705b Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Fri, 25 Jan 2019 13:48:40 +0000 Subject: [PATCH 063/142] Garbage collect AH_SUPPORT_AR5416 config option. It does nothing since r318857. --- share/man/man4/ath.4 | 3 +-- share/man/man4/ath_hal.4 | 13 +++---------- sys/amd64/conf/GENERIC | 1 - sys/conf/NOTES | 1 - sys/conf/options | 1 - sys/i386/conf/GENERIC | 1 - sys/mips/conf/ERL | 1 - sys/mips/conf/OCTEON1 | 1 - sys/mips/conf/PB92 | 1 - sys/mips/conf/std.AR_MIPS_BASE | 1 - sys/modules/ath_hal_ar5416/Makefile | 3 --- sys/powerpc/conf/GENERIC | 1 - sys/powerpc/conf/GENERIC64 | 1 - sys/sparc64/conf/GENERIC | 1 - tools/tools/ath/ath_ee_9300_print/Makefile | 1 - tools/tools/ath/athaggrstats/Makefile | 1 - tools/tools/ath/athdecode/Makefile | 1 - tools/tools/ath/athkey/Makefile | 1 - tools/tools/ath/athpoke/Makefile | 1 - tools/tools/ath/athprom/Makefile | 1 - tools/tools/ath/athradar/Makefile | 1 - tools/tools/ath/athratestats/Makefile | 1 - tools/tools/ath/athregs/Makefile | 1 - tools/tools/ath/athspectral/Makefile | 1 - tools/tools/ath/athstats/Makefile | 1 - tools/tools/ath/athsurvey/Makefile | 1 - tools/tools/nanobsd/pcengines/ALIX_DSK | 1 - 27 files changed, 4 insertions(+), 39 deletions(-) diff --git a/share/man/man4/ath.4 b/share/man/man4/ath.4 index acd83a86d3ff..ff0e39bfbc7e 100644 --- a/share/man/man4/ath.4 +++ b/share/man/man4/ath.4 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd April 14, 2014 +.Dd January 25, 2019 .Dt ATH 4 .Os .Sh NAME @@ -42,7 +42,6 @@ kernel configuration file: .Cd "device ath" .Cd "device ath_pci" .Cd "device ath_hal" -.Cd "options AH_SUPPORT_AR5416" .Cd "device ath_rate_sample" .Cd "device wlan" .Ed diff --git a/share/man/man4/ath_hal.4 b/share/man/man4/ath_hal.4 index e3a7dcf0c6fb..940809a9c3c9 100644 --- a/share/man/man4/ath_hal.4 +++ b/share/man/man4/ath_hal.4 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd July 22, 2013 +.Dd January 25, 2019 .Dt ATH_HAL 4 .Os .Sh NAME @@ -36,7 +36,6 @@ .Nd "Atheros Hardware Access Layer (HAL)" .Sh SYNOPSIS .Cd "device ath_hal" -.Cd "options AH_SUPPORT_AR5416" or .Cd "device ath_ar5210" .Cd "device ath_ar5211" @@ -57,12 +56,11 @@ or .Cd "device ath_ar9285" .Cd "device ath_ar9287" .Cd "device ath_ar9300" -.Cd "options AH_SUPPORT_AR5416" .Sh DESCRIPTION The hal provides hardware support for wireless network adapters based on the Atheros AR5210, AR5211, AR5212, AR5213, AR2413, AR2417, AR2425, -AR5413, AR5416, AR5418, AR5424, AR9160, AR9220, AR9280, AR9285, AR9287, -AR9380, AR9390, AR9580, AR9590, AR9562 and QCA9565 +AR5413, AR5416, AR5418, AR5424, AR9130, AR9160, AR9220, AR9280, AR9285, +AR9287, AR9380, AR9390, AR9580, AR9590, AR9562 and QCA9565 chips (and companion RF/baseband parts). This code is part of the .Xr ath 4 @@ -71,11 +69,6 @@ over the set of chips supported. Selecting .Nm enables support for all PCI and Cardbus devices. -Note this includes AR5416, AR5418, AR9130, AR9160, AR9220, AR9280, AR9285 -and AR9287 devices and must be accompanied by the -AH_SUPPORT_AR5416 -option to enable the extended hardware descriptor format used by -AR5416 and later devices. .Pp Some devices come in Cardbus/MiniPCI/PCI format. Others (for example AR2413, AR2427, AR5418, AR9280, AR9285, AR9287) come in diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index 1053166125b7..a6cce21a38d0 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -293,7 +293,6 @@ device an # Aironet 4500/4800 802.11 wireless NICs. device ath # Atheros NICs device ath_pci # Atheros pci/cardbus glue device ath_hal # pci/cardbus chip support -options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors options AH_AR5416_INTERRUPT_MITIGATION # AR5416 interrupt mitigation options ATH_ENABLE_11N # Enable 802.11n support for AR5416 and later device ath_rate_sample # SampleRate tx rate control for ath diff --git a/sys/conf/NOTES b/sys/conf/NOTES index e764c16fced0..9a43bd26164d 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2121,7 +2121,6 @@ device ath_hal # pci/cardbus chip support #device ath_rf5112 #device ath_rf5413 #device ath_ar5416 # AR5416 chips -options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors # All of the AR5212 parts have a problem when paired with the AR71xx # CPUS. These parts have a bug that triggers a fatal bus error on the AR71xx # only. Details of the exact nature of the bug are sketchy, but some can be diff --git a/sys/conf/options b/sys/conf/options index 6d902001b543..6c0439c5b168 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -828,7 +828,6 @@ ATH_DEBUG_ALQ opt_ath.h ATH_KTR_INTR_DEBUG opt_ath.h # options for the Atheros hal -AH_SUPPORT_AR5416 opt_ah.h # XXX For now, this breaks non-AR9130 chipsets, so only use it # XXX when actually targeting AR9130. AH_SUPPORT_AR9130 opt_ah.h diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC index fbcc61647ad7..f352b9eb5d42 100644 --- a/sys/i386/conf/GENERIC +++ b/sys/i386/conf/GENERIC @@ -289,7 +289,6 @@ device an # Aironet 4500/4800 802.11 wireless NICs. device ath # Atheros NICs device ath_pci # Atheros pci/cardbus glue device ath_hal # pci/cardbus chip support -options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors options AH_AR5416_INTERRUPT_MITIGATION # AR5416 interrupt mitigation options ATH_ENABLE_11N # Enable 802.11n support for AR5416 and later device ath_rate_sample # SampleRate tx rate control for ath diff --git a/sys/mips/conf/ERL b/sys/mips/conf/ERL index d1f23271dbe6..c58a7c2aa2bf 100644 --- a/sys/mips/conf/ERL +++ b/sys/mips/conf/ERL @@ -144,7 +144,6 @@ device wlan_amrr # AMRR transmit rate control algorithm #device ath # Atheros NIC's #device ath_pci # Atheros pci/cardbus glue #device ath_hal # pci/cardbus chip support -#options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors #device ath_rate_sample # SampleRate tx rate control for ath # Pseudo devices. diff --git a/sys/mips/conf/OCTEON1 b/sys/mips/conf/OCTEON1 index 09d1d395cdd7..4a61198952b0 100644 --- a/sys/mips/conf/OCTEON1 +++ b/sys/mips/conf/OCTEON1 @@ -177,7 +177,6 @@ device wlan_amrr # AMRR transmit rate control algorithm device ath # Atheros NIC's device ath_pci # Atheros pci/cardbus glue device ath_hal # pci/cardbus chip support -options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors device ath_rate_sample # SampleRate tx rate control for ath device ral # Ralink Technology RT2500 wireless NICs. diff --git a/sys/mips/conf/PB92 b/sys/mips/conf/PB92 index ea994ada1cda..550c98aaa045 100644 --- a/sys/mips/conf/PB92 +++ b/sys/mips/conf/PB92 @@ -84,7 +84,6 @@ options ATH_ENABLE_11N options ATH_DIAGAPI # device ath_hal -options AH_SUPPORT_AR5416 options AH_DEBUG options AH_DEBUG_ALQ diff --git a/sys/mips/conf/std.AR_MIPS_BASE b/sys/mips/conf/std.AR_MIPS_BASE index a6e95648aba9..0c1e9efe8681 100644 --- a/sys/mips/conf/std.AR_MIPS_BASE +++ b/sys/mips/conf/std.AR_MIPS_BASE @@ -55,7 +55,6 @@ options ATH_ENABLE_DFS options AH_DEBUG_ALQ options AH_DEBUG -options AH_SUPPORT_AR5416 options AH_AR5416_INTERRUPT_MITIGATION options AH_RXCFG_SDMAMW_4BYTES diff --git a/sys/modules/ath_hal_ar5416/Makefile b/sys/modules/ath_hal_ar5416/Makefile index b68782737893..00b7c438c695 100644 --- a/sys/modules/ath_hal_ar5416/Makefile +++ b/sys/modules/ath_hal_ar5416/Makefile @@ -40,9 +40,6 @@ SRCS= ah_osdep_ar5416.c # # AR5416, AR9130, AR9160, AR9220, AR9280, AR9285, AR9287 support. - -# Note enabling this support requires defining AH_SUPPORT_AR5416 -# in opt_ah.h so the 11n tx/rx descriptor format is handled. # # NB: 9160 depends on 5416 but 5416 does not require 9160 # diff --git a/sys/powerpc/conf/GENERIC b/sys/powerpc/conf/GENERIC index 2a5a3a865302..43f611803e34 100644 --- a/sys/powerpc/conf/GENERIC +++ b/sys/powerpc/conf/GENERIC @@ -200,7 +200,6 @@ device kue # Kawasaki LSI USB Ethernet # Wireless NIC cards options IEEE80211_SUPPORT_MESH -options AH_SUPPORT_AR5416 # Misc device iicbus # I2C bus code diff --git a/sys/powerpc/conf/GENERIC64 b/sys/powerpc/conf/GENERIC64 index bcf944d1a7ba..34a2f3636f85 100644 --- a/sys/powerpc/conf/GENERIC64 +++ b/sys/powerpc/conf/GENERIC64 @@ -214,7 +214,6 @@ device kue # Kawasaki LSI USB Ethernet # Wireless NIC cards options IEEE80211_SUPPORT_MESH -options AH_SUPPORT_AR5416 # FireWire support device firewire # FireWire bus code diff --git a/sys/sparc64/conf/GENERIC b/sys/sparc64/conf/GENERIC index cc905bf2a54a..92d76773d17e 100644 --- a/sys/sparc64/conf/GENERIC +++ b/sys/sparc64/conf/GENERIC @@ -225,7 +225,6 @@ device wlan_amrr # AMRR transmit rate control algorithm device ath # Atheros NICs device ath_pci # Atheros pci/cardbus glue device ath_hal # Atheros HAL (Hardware Access Layer) -options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors device ath_rate_sample # SampleRate tx rate control for ath # Pseudo devices. diff --git a/tools/tools/ath/ath_ee_9300_print/Makefile b/tools/tools/ath/ath_ee_9300_print/Makefile index efb73d2ac1ef..ad68eac3f9fb 100644 --- a/tools/tools/ath/ath_ee_9300_print/Makefile +++ b/tools/tools/ath/ath_ee_9300_print/Makefile @@ -11,7 +11,6 @@ CLEANFILES+= opt_ah.h opt_ah.h: echo "#define AH_DEBUG 1" > opt_ah.h echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h - echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h .include <../Makefile.inc> diff --git a/tools/tools/ath/athaggrstats/Makefile b/tools/tools/ath/athaggrstats/Makefile index 2748b6f3ac12..42b195cb440e 100644 --- a/tools/tools/ath/athaggrstats/Makefile +++ b/tools/tools/ath/athaggrstats/Makefile @@ -18,7 +18,6 @@ LIBADD+= bsdstat opt_ah.h: echo "#define AH_DEBUG 1" > opt_ah.h echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h - echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h ah_osdep.h: echo 'typedef void *HAL_SOFTC;' >ah_osdep.h diff --git a/tools/tools/ath/athdecode/Makefile b/tools/tools/ath/athdecode/Makefile index 00c452497a5c..d829b52890c8 100644 --- a/tools/tools/ath/athdecode/Makefile +++ b/tools/tools/ath/athdecode/Makefile @@ -17,7 +17,6 @@ CLEANFILES+= opt_ah.h opt_ah.h: echo "#define AH_DEBUG 1" > opt_ah.h echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h - echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h .include <../Makefile.inc> diff --git a/tools/tools/ath/athkey/Makefile b/tools/tools/ath/athkey/Makefile index 7aee04837957..071caa686fd4 100644 --- a/tools/tools/ath/athkey/Makefile +++ b/tools/tools/ath/athkey/Makefile @@ -10,7 +10,6 @@ CLEANFILES+= opt_ah.h opt_ah.h: echo "#define AH_DEBUG 1" > opt_ah.h echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h - echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h .include <../Makefile.inc> diff --git a/tools/tools/ath/athpoke/Makefile b/tools/tools/ath/athpoke/Makefile index a33c7396348b..39295606318a 100644 --- a/tools/tools/ath/athpoke/Makefile +++ b/tools/tools/ath/athpoke/Makefile @@ -17,7 +17,6 @@ CLEANFILES+= opt_ah.h opt_ah.h: echo "#define AH_DEBUG 1" > opt_ah.h echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h - echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h .include <../Makefile.inc> diff --git a/tools/tools/ath/athprom/Makefile b/tools/tools/ath/athprom/Makefile index f7b596728699..82a5d2bb294d 100644 --- a/tools/tools/ath/athprom/Makefile +++ b/tools/tools/ath/athprom/Makefile @@ -14,7 +14,6 @@ CLEANFILES+= opt_ah.h opt_ah.h: echo "#define AH_DEBUG 1" > opt_ah.h echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h - echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h CFLAGS+=-DDIR_TEMPLATE='"${TEMPLATEDIR}"' diff --git a/tools/tools/ath/athradar/Makefile b/tools/tools/ath/athradar/Makefile index 23d3012f2344..3e24a438fe69 100644 --- a/tools/tools/ath/athradar/Makefile +++ b/tools/tools/ath/athradar/Makefile @@ -11,6 +11,5 @@ CLEANFILES+= opt_ah.h opt_ah.h: echo "#define AH_DEBUG 1" > opt_ah.h echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h - echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h .include diff --git a/tools/tools/ath/athratestats/Makefile b/tools/tools/ath/athratestats/Makefile index b5397be23f94..7a51392a9a7e 100644 --- a/tools/tools/ath/athratestats/Makefile +++ b/tools/tools/ath/athratestats/Makefile @@ -19,7 +19,6 @@ CFLAGS+=-DATH_SUPPORT_TDMA opt_ah.h: echo "#define AH_DEBUG 1" > opt_ah.h echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h - echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h ah_osdep.h: echo 'typedef void *HAL_SOFTC;' >ah_osdep.h diff --git a/tools/tools/ath/athregs/Makefile b/tools/tools/ath/athregs/Makefile index 20e248910b52..886354ae9cd2 100644 --- a/tools/tools/ath/athregs/Makefile +++ b/tools/tools/ath/athregs/Makefile @@ -19,7 +19,6 @@ CLEANFILES+= opt_ah.h opt_ah.h: echo "#define AH_DEBUG 1" > opt_ah.h echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h - echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h .include <../Makefile.inc> diff --git a/tools/tools/ath/athspectral/Makefile b/tools/tools/ath/athspectral/Makefile index 8aebde60be28..e13891fec72c 100644 --- a/tools/tools/ath/athspectral/Makefile +++ b/tools/tools/ath/athspectral/Makefile @@ -11,6 +11,5 @@ CLEANFILES+= opt_ah.h opt_ah.h: echo "#define AH_DEBUG 1" > opt_ah.h echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h - echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h .include diff --git a/tools/tools/ath/athstats/Makefile b/tools/tools/ath/athstats/Makefile index 95b01fd4bc30..f0243f75379d 100644 --- a/tools/tools/ath/athstats/Makefile +++ b/tools/tools/ath/athstats/Makefile @@ -30,7 +30,6 @@ LIBADD= bsdstat opt_ah.h: echo "#define AH_DEBUG 1" > opt_ah.h echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h - echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h ah_osdep.h: echo 'typedef void *HAL_SOFTC;' >ah_osdep.h diff --git a/tools/tools/ath/athsurvey/Makefile b/tools/tools/ath/athsurvey/Makefile index 0b023eebc01c..6c0106095016 100644 --- a/tools/tools/ath/athsurvey/Makefile +++ b/tools/tools/ath/athsurvey/Makefile @@ -11,6 +11,5 @@ CLEANFILES+= opt_ah.h opt_ah.h: echo "#define AH_DEBUG 1" > opt_ah.h echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h - echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h .include diff --git a/tools/tools/nanobsd/pcengines/ALIX_DSK b/tools/tools/nanobsd/pcengines/ALIX_DSK index 7635a8c80b93..96ae724d736b 100644 --- a/tools/tools/nanobsd/pcengines/ALIX_DSK +++ b/tools/tools/nanobsd/pcengines/ALIX_DSK @@ -62,7 +62,6 @@ device wlan_amrr device an device ath device ath_hal -options AH_SUPPORT_AR5416 device ath_rate_sample device wi device loop From 7dc90a1de02bef4f91d3d30712ffcf9089d1f36d Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Fri, 25 Jan 2019 13:57:09 +0000 Subject: [PATCH 064/142] Fix a bug in the restart window computation of TCP New Reno When implementing support for IW10, an update in the computation of the restart window used after an idle phase was missed. To minimize code duplication, implement the logic in tcp_compute_initwnd() and call it. This fixes a bug in NewReno, which was not aware of IW10. Submitted by: Richard Scheffenegger Reviewed by: tuexen@ MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D18940 --- sys/netinet/cc/cc_newreno.c | 8 ++---- sys/netinet/tcp_input.c | 48 +++++++++++++++++++++-------------- sys/netinet/tcp_stacks/rack.c | 18 +++---------- sys/netinet/tcp_var.h | 1 + 4 files changed, 35 insertions(+), 40 deletions(-) diff --git a/sys/netinet/cc/cc_newreno.c b/sys/netinet/cc/cc_newreno.c index 988cdb087f3b..50c0b79660e2 100644 --- a/sys/netinet/cc/cc_newreno.c +++ b/sys/netinet/cc/cc_newreno.c @@ -199,7 +199,7 @@ newreno_ack_received(struct cc_var *ccv, uint16_t type) static void newreno_after_idle(struct cc_var *ccv) { - int rw; + uint32_t rw; /* * If we've been idle for more than one retransmit timeout the old @@ -214,11 +214,7 @@ newreno_after_idle(struct cc_var *ccv) * * See RFC5681 Section 4.1. "Restarting Idle Connections". */ - if (V_tcp_do_rfc3390) - rw = min(4 * CCV(ccv, t_maxseg), - max(2 * CCV(ccv, t_maxseg), 4380)); - else - rw = CCV(ccv, t_maxseg) * 2; + rw = tcp_compute_initwnd(tcp_maxseg(ccv->ccvc.tcp)); CCV(ccv, snd_cwnd) = min(rw, CCV(ccv, snd_cwnd)); } diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index c4a4746d4218..750046407fbd 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -371,31 +371,14 @@ cc_conn_init(struct tcpcb *tp) /* * Set the initial slow-start flight size. * - * RFC5681 Section 3.1 specifies the default conservative values. - * RFC3390 specifies slightly more aggressive values. - * RFC6928 increases it to ten segments. - * Support for user specified value for initial flight size. - * * If a SYN or SYN/ACK was lost and retransmitted, we have to * reduce the initial CWND to one segment as congestion is likely * requiring us to be cautious. */ if (tp->snd_cwnd == 1) tp->snd_cwnd = maxseg; /* SYN(-ACK) lost */ - else if (V_tcp_initcwnd_segments) - tp->snd_cwnd = min(V_tcp_initcwnd_segments * maxseg, - max(2 * maxseg, V_tcp_initcwnd_segments * 1460)); - else if (V_tcp_do_rfc3390) - tp->snd_cwnd = min(4 * maxseg, max(2 * maxseg, 4380)); - else { - /* Per RFC5681 Section 3.1 */ - if (maxseg > 2190) - tp->snd_cwnd = 2 * maxseg; - else if (maxseg > 1095) - tp->snd_cwnd = 3 * maxseg; - else - tp->snd_cwnd = 4 * maxseg; - } + else + tp->snd_cwnd = tcp_compute_initwnd(maxseg); if (CC_ALGO(tp)->conn_init != NULL) CC_ALGO(tp)->conn_init(tp->ccv); @@ -3818,3 +3801,30 @@ tcp_compute_pipe(struct tcpcb *tp) tp->sackhint.sack_bytes_rexmit - tp->sackhint.sacked_bytes); } + +uint32_t +tcp_compute_initwnd(uint32_t maxseg) +{ + /* + * Calculate the Initial Window, also used as Restart Window + * + * RFC5681 Section 3.1 specifies the default conservative values. + * RFC3390 specifies slightly more aggressive values. + * RFC6928 increases it to ten segments. + * Support for user specified value for initial flight size. + */ + if (V_tcp_initcwnd_segments) + return min(V_tcp_initcwnd_segments * maxseg, + max(2 * maxseg, V_tcp_initcwnd_segments * 1460)); + else if (V_tcp_do_rfc3390) + return min(4 * maxseg, max(2 * maxseg, 4380)); + else { + /* Per RFC5681 Section 3.1 */ + if (maxseg > 2190) + return (2 * maxseg); + else if (maxseg > 1095) + return (3 * maxseg); + else + return (4 * maxseg); + } +} diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index d2db801b1f85..8201dc514bf0 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -1425,21 +1425,9 @@ rack_cc_after_idle(struct tcpcb *tp, int reduce_largest) if (tp->snd_cwnd == 1) i_cwnd = tp->t_maxseg; /* SYN(-ACK) lost */ - else if (V_tcp_initcwnd_segments) - i_cwnd = min((V_tcp_initcwnd_segments * tp->t_maxseg), - max(2 * tp->t_maxseg, V_tcp_initcwnd_segments * 1460)); - else if (V_tcp_do_rfc3390) - i_cwnd = min(4 * tp->t_maxseg, - max(2 * tp->t_maxseg, 4380)); - else { - /* Per RFC5681 Section 3.1 */ - if (tp->t_maxseg > 2190) - i_cwnd = 2 * tp->t_maxseg; - else if (tp->t_maxseg > 1095) - i_cwnd = 3 * tp->t_maxseg; - else - i_cwnd = 4 * tp->t_maxseg; - } + else + i_cwnd = tcp_compute_initwnd(tcp_maxseg(tp)); + if (reduce_largest) { /* * Do we reduce the largest cwnd to make diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 2fbe07ade5dc..09316343cb2a 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -942,6 +942,7 @@ void tcp_sack_partialack(struct tcpcb *, struct tcphdr *); void tcp_free_sackholes(struct tcpcb *tp); int tcp_newreno(struct tcpcb *, struct tcphdr *); int tcp_compute_pipe(struct tcpcb *); +uint32_t tcp_compute_initwnd(uint32_t); void tcp_sndbuf_autoscale(struct tcpcb *, struct socket *, uint32_t); struct mbuf * tcp_m_copym(struct mbuf *m, int32_t off0, int32_t *plen, From ade4db4d0402d283d1d439005f2f78745e29f564 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Fri, 25 Jan 2019 14:46:13 +0000 Subject: [PATCH 065/142] clang: default to DWARF 4 as of FreeBSD 13 FreeBSD previously defaulted to DWARF 2 because several tools (gdb, ctfconvert, etc.) did not support later versions. These have either been fixed or are deprecated. Note that gdb 6 still exists but has been moved out of $PATH into /usr/libexec and is intended only for use by crashinfo(8). The kernel build sets the DWARF version explicitly via -gdwarf2, so this should have no effect there. PR: 234887 [exp-run] Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17930 --- contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.cpp | 7 +++++++ contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.cpp b/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.cpp index c16eabf06961..091ce3b80620 100644 --- a/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.cpp +++ b/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.cpp @@ -357,6 +357,13 @@ ToolChain::CXXStdlibType FreeBSD::GetDefaultCXXStdlibType() const { return ToolChain::CST_Libstdcxx; } +unsigned FreeBSD::GetDefaultDwarfVersion() const { + // Default to use DWARF 2 before FreeBSD 13. + if (getTriple().getOSMajorVersion() < 13) + return 2; + return 4; +} + void FreeBSD::addLibStdCxxIncludePaths( const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const { diff --git a/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.h b/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.h index 2943e1cacfbb..38e3adb21e18 100644 --- a/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.h +++ b/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.h @@ -70,7 +70,7 @@ class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic_ELF { const llvm::opt::ArgList &Args) const override; bool isPIEDefault() const override; SanitizerMask getSupportedSanitizers() const override; - unsigned GetDefaultDwarfVersion() const override { return 2; } + unsigned GetDefaultDwarfVersion() const override; // Until dtrace (via CTF) and LLDB can deal with distributed debug info, // FreeBSD defaults to standalone/full debug info. bool GetDefaultStandaloneDebug() const override { return true; } From 77102fd6a23e10d56bb179092b01334a258e2b50 Mon Sep 17 00:00:00 2001 From: Andrew Gallatin Date: Fri, 25 Jan 2019 15:02:18 +0000 Subject: [PATCH 066/142] Fix an iflib driver unload panic introduced in r343085 The new loop to sync and unload descriptors was indexed by "i", rather than "j". The panic was caused by "i" being advanced rather than "j", and eventually becoming out of bounds. Reviewed by: kib MFC after: 3 days Sponsored by: Netflix --- sys/net/iflib.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 0e4445a2575a..36adccc51670 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -2197,17 +2197,17 @@ iflib_rx_sds_free(iflib_rxq_t rxq) fl = &rxq->ifr_fl[i]; if (fl->ifl_desc_tag != NULL) { if (fl->ifl_sds.ifsd_map != NULL) { - for (j = 0; j < fl->ifl_size; i++) { - if (fl->ifl_sds.ifsd_map[i] == + for (j = 0; j < fl->ifl_size; j++) { + if (fl->ifl_sds.ifsd_map[j] == NULL) - continue; + continue; bus_dmamap_sync( fl->ifl_desc_tag, - fl->ifl_sds.ifsd_map[i], + fl->ifl_sds.ifsd_map[j], BUS_DMASYNC_POSTREAD); bus_dmamap_unload( fl->ifl_desc_tag, - fl->ifl_sds.ifsd_map[i]); + fl->ifl_sds.ifsd_map[j]); } } bus_dma_tag_destroy(fl->ifl_desc_tag); From 877fc2e350994e6af54c97c88062943753712f8e Mon Sep 17 00:00:00 2001 From: Takanori Watanabe Date: Fri, 25 Jan 2019 16:16:10 +0000 Subject: [PATCH 067/142] Use ACPI TPM2 table to probe tpmtis and tpmcrb device. Differential Revision: https://reviews.freebsd.org/D18937 --- sys/dev/tpm/tpm20.h | 6 ++++++ sys/dev/tpm/tpm_crb.c | 25 +++++++++---------------- sys/dev/tpm/tpm_tis.c | 23 +++++++++-------------- usr.sbin/acpi/acpidump/acpi.c | 15 ++++++++++++++- 4 files changed, 38 insertions(+), 31 deletions(-) diff --git a/sys/dev/tpm/tpm20.h b/sys/dev/tpm/tpm20.h index b478f3d0eb22..619b101d2fee 100644 --- a/sys/dev/tpm/tpm20.h +++ b/sys/dev/tpm/tpm20.h @@ -93,6 +93,12 @@ __FBSDID("$FreeBSD$"); #define TPM_CDEV_NAME "tpm0" #define TPM_CDEV_PERM_FLAG 0600 + +#define TPM2_START_METHOD_ACPI 2 +#define TPM2_START_METHOD_TIS 6 +#define TPM2_START_METHOD_CRB 7 +#define TPM2_START_METHOD_CRB_ACPI 8 + struct tpm_sc { device_t dev; diff --git a/sys/dev/tpm/tpm_crb.c b/sys/dev/tpm/tpm_crb.c index 778b208b83eb..abe4c4d13c25 100644 --- a/sys/dev/tpm/tpm_crb.c +++ b/sys/dev/tpm/tpm_crb.c @@ -104,27 +104,20 @@ char *tpmcrb_ids[] = {"MSFT0101", NULL}; static int tpmcrb_acpi_probe(device_t dev) { - struct resource *res; - int err, rid = 0; - uint32_t caps; - + int err; + ACPI_TABLE_TPM23 *tbl; + ACPI_STATUS status; err = ACPI_ID_PROBE(device_get_parent(dev), dev, tpmcrb_ids, NULL); if (err > 0) return (err); - - /* Check if device is in CRB mode */ - res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); - if (res == NULL) - return (ENXIO); - - caps = bus_read_4(res, TPM_CRB_INTF_ID); - bus_release_resource(dev, SYS_RES_MEMORY, rid, res); - - if ((caps & TPM_CRB_INTF_ID_TYPE) != TPM_CRB_INTF_ID_TYPE_CRB) - return (ENXIO); + /*Find TPM2 Header*/ + status = AcpiGetTable(ACPI_SIG_TPM2, 1, (ACPI_TABLE_HEADER **) &tbl); + if(ACPI_FAILURE(status) || + tbl->StartMethod != TPM2_START_METHOD_CRB) + err = ENXIO; device_set_desc(dev, "Trusted Platform Module 2.0, CRB mode"); - return (BUS_PROBE_DEFAULT); + return (err); } static ACPI_STATUS diff --git a/sys/dev/tpm/tpm_tis.c b/sys/dev/tpm/tpm_tis.c index 93f1ae3f7b38..170fdd3967ff 100644 --- a/sys/dev/tpm/tpm_tis.c +++ b/sys/dev/tpm/tpm_tis.c @@ -100,26 +100,21 @@ char *tpmtis_ids[] = {"MSFT0101", NULL}; static int tpmtis_acpi_probe(device_t dev) { - struct resource *res; - int err, rid = 0; - uint32_t caps; + int err; + ACPI_TABLE_TPM23 *tbl; + ACPI_STATUS status; err = ACPI_ID_PROBE(device_get_parent(dev), dev, tpmtis_ids, NULL); if (err > 0) return (err); - - /* Check if device is in TPM 2.0 TIS mode */ - res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); - if (res == NULL) - return (ENXIO); - - caps = bus_read_4(res, TPM_INTF_CAPS); - bus_release_resource(dev, SYS_RES_MEMORY, rid, res); - if ((caps & TPM_INTF_CAPS_VERSION) != TPM_INTF_CAPS_TPM20) - return (ENXIO); + /*Find TPM2 Header*/ + status = AcpiGetTable(ACPI_SIG_TPM2, 1, (ACPI_TABLE_HEADER **) &tbl); + if(ACPI_FAILURE(status) || + tbl->StartMethod != TPM2_START_METHOD_TIS) + err = ENXIO; device_set_desc(dev, "Trusted Platform Module 2.0, FIFO mode"); - return (BUS_PROBE_DEFAULT); + return (err); } static int diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c index 377e0fee315d..f858d8984139 100644 --- a/usr.sbin/acpi/acpidump/acpi.c +++ b/usr.sbin/acpi/acpidump/acpi.c @@ -970,7 +970,18 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) printf(END_COMMENT); } - +static void acpi_handle_tpm2(ACPI_TABLE_HEADER *sdp) +{ + ACPI_TABLE_TPM2 *tpm2; + + printf (BEGIN_COMMENT); + acpi_print_sdt(sdp); + tpm2 = (ACPI_TABLE_TPM2 *) sdp; + printf ("\t\tControlArea=%lx\n", tpm2->ControlAddress); + printf ("\t\tStartMethod=%x\n", tpm2->StartMethod); + printf (END_COMMENT); +} + static const char * devscope_type2str(int type) { @@ -1769,6 +1780,8 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp) acpi_handle_wddt(sdp); else if (!memcmp(sdp->Signature, ACPI_SIG_LPIT, 4)) acpi_handle_lpit(sdp); + else if (!memcmp(sdp->Signature, ACPI_SIG_TPM2, 4)) + acpi_handle_tpm2(sdp); else { printf(BEGIN_COMMENT); acpi_print_sdt(sdp); From f635b1c264404dcff6db91164fde8c7c325a253f Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Fri, 25 Jan 2019 17:08:28 +0000 Subject: [PATCH 068/142] Don't include two header files when not needed. This allows the part of the rewrite of TCP reassembly in this files to be MFCed to stable/11 with manual change. MFC after: 3 days Sponsored by: Netflix, Inc. --- sys/netinet/tcp_reass.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index e59565478e8d..d70fb09f1661 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -38,6 +38,10 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_tcpdebug.h" +/* For debugging we want counters and BB logging */ +/* #define TCP_REASS_COUNTERS 1 */ +/* #define TCP_REASS_LOGGING 1 */ + #include #include #include @@ -72,8 +76,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef TCP_REASS_LOGGING #include #include +#endif #include #include #ifdef TCPDEBUG @@ -92,10 +98,6 @@ __FBSDID("$FreeBSD$"); #define TCP_R_LOG_DUMP 10 #define TCP_R_LOG_TRIM 11 -/* For debugging we want counters and BB logging */ -/* #define TCP_REASS_COUNTERS 1 */ -/* #define TCP_REASS_LOGGING 1 */ - static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, "TCP Segment Reassembly Queue"); From 719fd9fb2c0b0c4cfd5f6da6d3903f9c6f8db4e3 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Fri, 25 Jan 2019 17:09:26 +0000 Subject: [PATCH 069/142] Comment out the default sh(1) aliases for root, introduced in r343416. The rest of this stuff is still to be discussed, but I think at this point we have the agreement that the aliases should go. MFC after: 2 weeks Sponsored by: DARPA, AFRL --- bin/sh/dot.shrc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/sh/dot.shrc b/bin/sh/dot.shrc index f497bd66f819..a8b75c9a67d3 100644 --- a/bin/sh/dot.shrc +++ b/bin/sh/dot.shrc @@ -18,13 +18,13 @@ # set -o vi -# some useful aliases -alias h='fc -l' -alias j=jobs -alias m="$PAGER" -alias ll='ls -laFo' -alias l='ls -l' -alias g='egrep -i' +# # some useful aliases +# alias h='fc -l' +# alias j=jobs +# alias m="$PAGER" +# alias ll='ls -laFo' +# alias l='ls -l' +# alias g='egrep -i' # # be paranoid # alias cp='cp -ip' From 24df7b15fa2c5d8019c4ced20b79e2d69e293839 Mon Sep 17 00:00:00 2001 From: Li-Wen Hsu Date: Fri, 25 Jan 2019 18:48:20 +0000 Subject: [PATCH 070/142] Temporarily mark lib.msun.{cbrt_test.cbrtl_powl,trig_test.reduction} expected failure after clang700-import merge PR: 234040 Reviewed by: ngie, markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18938 --- contrib/netbsd-tests/lib/libm/t_cbrt.c | 4 ++++ lib/msun/tests/trig_test.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/contrib/netbsd-tests/lib/libm/t_cbrt.c b/contrib/netbsd-tests/lib/libm/t_cbrt.c index b19413a01241..230ffb5a8065 100644 --- a/contrib/netbsd-tests/lib/libm/t_cbrt.c +++ b/contrib/netbsd-tests/lib/libm/t_cbrt.c @@ -268,6 +268,10 @@ ATF_TC_BODY(cbrtl_powl, tc) long double y, z; size_t i; +#if defined(__amd64__) && defined(__clang__) && __clang_major__ >= 7 + atf_tc_expect_fail("test fails with clang 7+ - bug 234040"); +#endif + for (i = 0; i < __arraycount(x); i++) { y = cbrtl(x[i]); diff --git a/lib/msun/tests/trig_test.c b/lib/msun/tests/trig_test.c index d333a5276355..204c0d07f25f 100644 --- a/lib/msun/tests/trig_test.c +++ b/lib/msun/tests/trig_test.c @@ -160,6 +160,10 @@ ATF_TC_BODY(reduction, tc) unsigned i; +#if defined(__amd64__) && defined(__clang__) && __clang_major__ >= 7 + atf_tc_expect_fail("test fails with clang 7+ - bug 234040"); +#endif + for (i = 0; i < nitems(f_pi_odd); i++) { ATF_CHECK(fabs(sinf(f_pi_odd[i])) < FLT_EPSILON); ATF_CHECK(cosf(f_pi_odd[i]) == -1.0); From f848b45958d7ca9a20fceb96fd17c574678c2c90 Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Fri, 25 Jan 2019 19:36:20 +0000 Subject: [PATCH 071/142] [mips] remove dublicate values in enable mask in nlm_usb_intr_en PR: 230572 Submitted by: David Binderman MFC after: 1 week --- sys/mips/nlm/usb_init.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/mips/nlm/usb_init.c b/sys/mips/nlm/usb_init.c index 29e397db336f..f9966335cd98 100644 --- a/sys/mips/nlm/usb_init.c +++ b/sys/mips/nlm/usb_init.c @@ -52,8 +52,7 @@ nlm_usb_intr_en(int node, int port) port_addr = nlm_get_usb_regbase(node, port); val = nlm_read_usb_reg(port_addr, USB_INT_EN); val = USB_CTRL_INTERRUPT_EN | USB_OHCI_INTERRUPT_EN | - USB_OHCI_INTERRUPT1_EN | USB_CTRL_INTERRUPT_EN | - USB_OHCI_INTERRUPT_EN | USB_OHCI_INTERRUPT2_EN; + USB_OHCI_INTERRUPT1_EN | USB_OHCI_INTERRUPT2_EN; nlm_write_usb_reg(port_addr, USB_INT_EN, val); } From 2b9ecf4896ee88883b4bb732169affe577fadc1c Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Fri, 25 Jan 2019 19:56:02 +0000 Subject: [PATCH 072/142] Document that `sendfile` will return an invalid value for `sbytes` if provided an invalid address This is meant to clarify the fact that the system call will not fail with -1/EFAULT, as one might expect, when reading the sendfile(2) manpage today. While here, pet the mandoc linter, when dealing with the section that describes valid values for `flags`. PR: 232210 MFC after: 2 weeks Approved by: emaste (mentor) Reviewed by: glebius, 0mp Differential Revision: https://reviews.freebsd.org/D18949 --- lib/libc/sys/sendfile.2 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/libc/sys/sendfile.2 b/lib/libc/sys/sendfile.2 index eba5d6234858..85825b7fdecb 100644 --- a/lib/libc/sys/sendfile.2 +++ b/lib/libc/sys/sendfile.2 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 12, 2018 +.Dd January 25, 2019 .Dt SENDFILE 2 .Os .Sh NAME @@ -104,7 +104,7 @@ variable pointed to by The least significant 16 bits of .Fa flags argument is a bitmap of these values: -.Bl -tag -offset indent +.Bl -tag -offset indent -width "SF_USER_READAHEAD" .It Dv SF_NODISKIO This flag causes .Nm @@ -403,3 +403,14 @@ The .Fx 11 implementation was written by .An Gleb Smirnoff Aq Mt glebius@FreeBSD.org . +.Sh BUGS +The +.Fn sendfile +system call will not fail, i.e., return +.Dv -1 +and set +.Va errno +to +.Er EFAULT , +if provided an invalid address for +.Fa sbytes . From fc606bb11bfee110a089565693711c6f0af76fab Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Fri, 25 Jan 2019 19:58:56 +0000 Subject: [PATCH 073/142] [mips] remove check that is always false (unsinged < 0) cpuid and local cpu variable are unsigned so checking if value is less than zero always yields false. PR: 211088 Submitted by: David Binderman MFC after: 1 week --- sys/mips/mips/tlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/mips/mips/tlb.c b/sys/mips/mips/tlb.c index 8d329baa0114..d2df51cb018c 100644 --- a/sys/mips/mips/tlb.c +++ b/sys/mips/mips/tlb.c @@ -348,7 +348,7 @@ DB_SHOW_COMMAND(tlb, ddb_dump_tlb) else cpu = PCPU_GET(cpuid); - if (cpu < 0 || cpu >= mp_ncpus) { + if (cpu >= mp_ncpus) { db_printf("Invalid CPU %u\n", cpu); return; } From 04a50a52721a3c30757c36556dc1c1b9d3e85eac Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Fri, 25 Jan 2019 20:02:55 +0000 Subject: [PATCH 074/142] [mips] Fix counter mask in jz4780 timer driver Fix dublicate value in what is apparent copypaste mistake. The last value in mask is supposed to be for counter 7, not counter 3. PR: 229790 Submitted by: David Binderman MFC after: 1 week --- sys/mips/ingenic/jz4780_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/mips/ingenic/jz4780_timer.c b/sys/mips/ingenic/jz4780_timer.c index 36e5eca1f793..f1d30a9a6107 100644 --- a/sys/mips/ingenic/jz4780_timer.c +++ b/sys/mips/ingenic/jz4780_timer.c @@ -185,7 +185,7 @@ jz4780_timer_attach(device_t dev) CSR_WRITE_4(sc, JZ_TC_TECR, TESR_OST); /* Stop all other channels as well */ CSR_WRITE_4(sc, JZ_TC_TECR, TESR_TCST0 | TESR_TCST1 | TESR_TCST2 | - TESR_TCST3 | TESR_TCST4 | TESR_TCST5 | TESR_TCST6 | TESR_TCST3); + TESR_TCST3 | TESR_TCST4 | TESR_TCST5 | TESR_TCST6 | TESR_TCST7); /* Clear detect mask flags */ CSR_WRITE_4(sc, JZ_TC_TFCR, 0xFFFFFFFF); /* Mask all interrupts */ From 0cde0ab2d3fa54d2c2d059bd3c7551db284c5447 Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Fri, 25 Jan 2019 20:07:18 +0000 Subject: [PATCH 075/142] Allow tunefs to include '_' as a legal character in label names to make it consistent with newfs. Document the legality of '_' in label names in both tunefs(8) and newfs(8). PR: 235182 Submitted by: darius@dons.net.au Reviewed by: Conrad Meyer MFC after: 3 days Sponsored by: Netflix --- sbin/newfs/newfs.8 | 1 + sbin/tunefs/tunefs.8 | 1 + sbin/tunefs/tunefs.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8 index 335d92086013..9a4acf868035 100644 --- a/sbin/newfs/newfs.8 +++ b/sbin/newfs/newfs.8 @@ -89,6 +89,7 @@ See for details. .It Fl L Ar volname Add a volume label to the new file system. +Legal characters are alphanumerics and underscores. .It Fl N Cause the file system parameters to be printed out without really creating the file system. diff --git a/sbin/tunefs/tunefs.8 b/sbin/tunefs/tunefs.8 index 0c63382cace8..00b9f41fb7f2 100644 --- a/sbin/tunefs/tunefs.8 +++ b/sbin/tunefs/tunefs.8 @@ -112,6 +112,7 @@ By default sets it to half of the space reserved to minfree. .It Fl L Ar volname Add/modify an optional file system volume label. +Legal characters are alphanumerics and underscores. .It Fl l Cm enable | disable Turn on/off MAC multilabel flag. .It Fl m Ar minfree diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c index 6a6b7f767ede..0bd5f314f4b6 100644 --- a/sbin/tunefs/tunefs.c +++ b/sbin/tunefs/tunefs.c @@ -189,7 +189,7 @@ main(int argc, char *argv[]) name = "volume label"; Lvalue = optarg; i = -1; - while (isalnum(Lvalue[++i])); + while (isalnum(Lvalue[++i]) || Lvalue[i] == '_'); if (Lvalue[i] != '\0') { errx(10, "bad %s. Valid characters are alphanumerics.", From 817f9fcca74cd195c11dc9a116c689b0058d00c2 Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Fri, 25 Jan 2019 20:10:57 +0000 Subject: [PATCH 076/142] [mips] Unbreak kernel build for CI20 - Include header required for boot_parse_XXX functions - Use boot_parse_args when parsing argc/argv style arguments - Remove unused function --- sys/mips/ingenic/jz4780_machdep.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/sys/mips/ingenic/jz4780_machdep.c b/sys/mips/ingenic/jz4780_machdep.c index ebfa04c890fc..2e8005eb17ad 100644 --- a/sys/mips/ingenic/jz4780_machdep.c +++ b/sys/mips/ingenic/jz4780_machdep.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -173,20 +174,6 @@ mips_init(void) #endif } -#ifdef FDT -static void -_parse_bootargs(char *cmdline) -{ - char *v; - - while ((v = strsep(&cmdline, " \n")) != NULL) { - if (*v == '\0') - continue; - boothowto |= boot_parse_arg(v); - } -} -#endif - void platform_start(__register_t a0, __register_t a1, __register_t a2 __unused, __register_t a3 __unused) @@ -247,7 +234,7 @@ platform_start(__register_t a0, __register_t a1, /* Parse cmdline from U-Boot */ argc = a0; argv = (char **)a1; - boothowto |= boot_parse_cmdline(argc, argv); + boothowto |= boot_parse_args(argc, argv); mips_init(); } From 232028b34e18592274344108334a37ebfb3445d7 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Fri, 25 Jan 2019 20:13:28 +0000 Subject: [PATCH 077/142] Add full support for PCI_ANY_ID when matching PCI IDs in the LinuxKPI. MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/compat/linuxkpi/common/include/linux/pci.h | 2 +- sys/compat/linuxkpi/common/src/linux_pci.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index a83278923427..60feeeca6001 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -71,7 +71,7 @@ struct pci_device_id { #define PCI_BASE_CLASS_BRIDGE 0x06 #define PCI_CLASS_BRIDGE_ISA 0x0601 -#define PCI_ANY_ID (-1) +#define PCI_ANY_ID -1U #define PCI_VENDOR_ID_APPLE 0x106b #define PCI_VENDOR_ID_ASUSTEK 0x1043 #define PCI_VENDOR_ID_ATI 0x1002 diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 899256bdacc8..72651a238da6 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -82,14 +82,21 @@ linux_pci_find(device_t dev, const struct pci_device_id **idp) struct pci_driver *pdrv; uint16_t vendor; uint16_t device; + uint16_t subvendor; + uint16_t subdevice; vendor = pci_get_vendor(dev); device = pci_get_device(dev); + subvendor = pci_get_subvendor(dev); + subdevice = pci_get_subdevice(dev); spin_lock(&pci_lock); list_for_each_entry(pdrv, &pci_drivers, links) { for (id = pdrv->id_table; id->vendor != 0; id++) { - if (vendor == id->vendor && device == id->device) { + if (vendor == id->vendor && + (PCI_ANY_ID == id->device || device == id->device) && + (PCI_ANY_ID == id->subvendor || subvendor == id->subvendor) && + (PCI_ANY_ID == id->subdevice || subdevice == id->subdevice)) { *idp = id; spin_unlock(&pci_lock); return (pdrv); @@ -145,8 +152,8 @@ linux_pci_attach(device_t dev) pdev->dev.bsddev = dev; INIT_LIST_HEAD(&pdev->dev.irqents); pdev->devfn = PCI_DEVFN(pci_get_slot(dev), pci_get_function(dev)); - pdev->device = id->device; - pdev->vendor = id->vendor; + pdev->device = dinfo->cfg.device; + pdev->vendor = dinfo->cfg.vendor; pdev->subsystem_vendor = dinfo->cfg.subvendor; pdev->subsystem_device = dinfo->cfg.subdevice; pdev->class = pci_get_class(dev); From e4376aaa328bf2ff03525c91433614de3842a6f1 Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Fri, 25 Jan 2019 20:14:28 +0000 Subject: [PATCH 078/142] [mips] Fix error condition check that always evaluates to false Use proper logical operand when checking the value of srcid PR: 200988 Submitted by: David Binderman MFC after: 1 week --- sys/mips/nlm/cms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/mips/nlm/cms.c b/sys/mips/nlm/cms.c index 197e989f43b2..b1105606e8d6 100644 --- a/sys/mips/nlm/cms.c +++ b/sys/mips/nlm/cms.c @@ -204,7 +204,7 @@ xlp_handle_msg_vc(u_int vcmask, int max_msgs) nlm_restore_flags(mflags); if (status != 0) /* no msg or error */ continue; - if (srcid < 0 && srcid >= 1024) { + if (srcid < 0 || srcid >= 1024) { printf("[%s]: bad src id %d\n", __func__, srcid); continue; From ee3da13fc66c9e4298316fb9057db0e12a0ec8f9 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Fri, 25 Jan 2019 20:20:27 +0000 Subject: [PATCH 079/142] Add new USB quirk. PR: 235202 Differential Revision: https://reviews.freebsd.org/D18917 MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/dev/usb/quirk/usb_quirk.c | 1 + sys/dev/usb/usbdevs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/quirk/usb_quirk.c b/sys/dev/usb/quirk/usb_quirk.c index eb803a9180ca..d2ed6cb6c48f 100644 --- a/sys/dev/usb/quirk/usb_quirk.c +++ b/sys/dev/usb/quirk/usb_quirk.c @@ -171,6 +171,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { USB_QUIRK(CORSAIR, K70_RGB, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), /* Quirk for Corsair STRAFE Gaming keyboard */ USB_QUIRK(CORSAIR, STRAFE, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), + USB_QUIRK(CORSAIR, STRAFE2, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), /* umodem(4) device quirks */ USB_QUIRK(METRICOM, RICOCHET_GS, 0x100, 0x100, UQ_ASSUME_CM_OVER_DATA), USB_QUIRK(SANYO, SCP4900, 0x000, 0x000, UQ_ASSUME_CM_OVER_DATA), diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index 52c4ba284619..d57e5087c44b 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -1583,7 +1583,8 @@ product COREGA FETHER_USB_TXC 0x9601 FEther USB-TXC product CORSAIR K60 0x0a60 Corsair Vengeance K60 keyboard product CORSAIR K70 0x1b09 Corsair Vengeance K70 keyboard product CORSAIR K70_RGB 0x1b13 Corsair K70 RGB Keyboard -product CORSAIR STRAFE 0x1b15 Cossair STRAFE Gaming keyboard +product CORSAIR STRAFE 0x1b15 Corsair STRAFE Gaming keyboard +product CORSAIR STRAFE2 0x1b44 Corsair STRAFE Gaming keyboard /* Creative products */ product CREATIVE NOMAD_II 0x1002 Nomad II MP3 player From 7aef71382b60c0cc17ddbd36a420b06a5808554e Mon Sep 17 00:00:00 2001 From: Cy Schubert Date: Fri, 25 Jan 2019 20:53:29 +0000 Subject: [PATCH 080/142] Fix 32-bit buildworld broken by r343438. --- usr.sbin/acpi/acpidump/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c index f858d8984139..8103c65d8175 100644 --- a/usr.sbin/acpi/acpidump/acpi.c +++ b/usr.sbin/acpi/acpidump/acpi.c @@ -977,7 +977,7 @@ static void acpi_handle_tpm2(ACPI_TABLE_HEADER *sdp) printf (BEGIN_COMMENT); acpi_print_sdt(sdp); tpm2 = (ACPI_TABLE_TPM2 *) sdp; - printf ("\t\tControlArea=%lx\n", tpm2->ControlAddress); + printf ("\t\tControlArea=%jx\n", tpm2->ControlAddress); printf ("\t\tStartMethod=%x\n", tpm2->StartMethod); printf (END_COMMENT); } From cecf8bebe7aa9b2a0bbbb50780e4263161aeb92b Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 25 Jan 2019 20:54:18 +0000 Subject: [PATCH 081/142] Fix a few more places to handle ofld tx queues for RATELIMIT. - Drain offload transmit queues when RATELIMIT is enabled but TCP_OFFLOAD is not. - Expose the per-VI nofldtxq and first_ofld_txq sysctls when RATELIMIT is enabled but TCP_OFFLOAD is not. - Clear offload transmit queue stats as part of a 'cxgbetool clearstats' request when RATELIMIT is enabled but TCP_OFFLOAD is not. Reviewed by: np MFC after: 2 weeks Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D18966 --- sys/dev/cxgbe/t4_main.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index fcdcf92add20..fe2fb1951282 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -5524,6 +5524,8 @@ vi_full_uninit(struct vi_info *vi) struct sge_txq *txq; #ifdef TCP_OFFLOAD struct sge_ofld_rxq *ofld_rxq; +#endif +#if defined(TCP_OFFLOAD) || defined(RATELIMIT) struct sge_wrq *ofld_txq; #endif @@ -5539,7 +5541,7 @@ vi_full_uninit(struct vi_info *vi) quiesce_txq(sc, txq); } -#ifdef TCP_OFFLOAD +#if defined(TCP_OFFLOAD) || defined(RATELIMIT) for_each_ofld_txq(vi, i, ofld_txq) { quiesce_wrq(sc, ofld_txq); } @@ -6327,15 +6329,9 @@ vi_sysctls(struct vi_info *vi) SYSCTL_ADD_INT(ctx, children, OID_AUTO, "nofldrxq", CTLFLAG_RD, &vi->nofldrxq, 0, "# of rx queues for offloaded TCP connections"); - SYSCTL_ADD_INT(ctx, children, OID_AUTO, "nofldtxq", CTLFLAG_RD, - &vi->nofldtxq, 0, - "# of tx queues for offloaded TCP connections"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "first_ofld_rxq", CTLFLAG_RD, &vi->first_ofld_rxq, 0, "index of first TOE rx queue"); - SYSCTL_ADD_INT(ctx, children, OID_AUTO, "first_ofld_txq", - CTLFLAG_RD, &vi->first_ofld_txq, 0, - "index of first TOE tx queue"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "holdoff_tmr_idx_ofld", CTLTYPE_INT | CTLFLAG_RW, vi, 0, sysctl_holdoff_tmr_idx_ofld, "I", @@ -6346,6 +6342,16 @@ vi_sysctls(struct vi_info *vi) "holdoff packet counter index for TOE queues"); } #endif +#if defined(TCP_OFFLOAD) || defined(RATELIMIT) + if (vi->nofldtxq != 0) { + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "nofldtxq", CTLFLAG_RD, + &vi->nofldtxq, 0, + "# of tx queues for TOE/ETHOFLD"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "first_ofld_txq", + CTLFLAG_RD, &vi->first_ofld_txq, 0, + "index of first TOE/ETHOFLD tx queue"); + } +#endif #ifdef DEV_NETMAP if (vi->nnmrxq != 0) { SYSCTL_ADD_INT(ctx, children, OID_AUTO, "nnmrxq", CTLFLAG_RD, @@ -10011,7 +10017,7 @@ t4_ioctl(struct cdev *dev, unsigned long cmd, caddr_t data, int fflag, mp_ring_reset_stats(txq->r); } -#ifdef TCP_OFFLOAD +#if defined(TCP_OFFLOAD) || defined(RATELIMIT) /* nothing to clear for each ofld_rxq */ for_each_ofld_txq(vi, i, wrq) { From dab83bd1e8d2a1c677530a4c8d6d1fa2e2c6dc2e Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Fri, 25 Jan 2019 21:24:09 +0000 Subject: [PATCH 082/142] Add printing of b_ioflags to DDB `show buffer' command. Sponsored by: Netflix --- sys/kern/vfs_bio.c | 9 ++++++--- sys/sys/bio.h | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index b44172939c47..4cd838fd925c 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -5329,9 +5329,12 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) } db_printf("buf at %p\n", bp); - db_printf("b_flags = 0x%b, b_xflags=0x%b, b_vflags=0x%b\n", - (u_int)bp->b_flags, PRINT_BUF_FLAGS, (u_int)bp->b_xflags, - PRINT_BUF_XFLAGS, (u_int)bp->b_vflags, PRINT_BUF_VFLAGS); + db_printf("b_flags = 0x%b, b_xflags=0x%b\n", + (u_int)bp->b_flags, PRINT_BUF_FLAGS, + (u_int)bp->b_xflags, PRINT_BUF_XFLAGS); + db_printf("b_vflags=0x%b b_ioflags0x%b\n", + (u_int)bp->b_vflags, PRINT_BUF_VFLAGS, + (u_int)bp->b_ioflags, PRINT_BIO_FLAGS); db_printf( "b_error = %d, b_bufsize = %ld, b_bcount = %ld, b_resid = %ld\n" "b_bufobj = (%p), b_data = %p, b_blkno = %jd, b_lblkno = %jd, " diff --git a/sys/sys/bio.h b/sys/sys/bio.h index 1dab615578ec..26a7ef444b4d 100644 --- a/sys/sys/bio.h +++ b/sys/sys/bio.h @@ -67,6 +67,9 @@ #define BIO_TRANSIENT_MAPPING 0x20 #define BIO_VLIST 0x40 +#define PRINT_BIO_FLAGS "\20\7vlist\6transient_mapping\5unmapped" \ + "\4ordered\3onqueue\2done\1error" + #ifdef _KERNEL struct disk; struct bio; From f913a5749fb75c730178a543d1501677dcc30574 Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Fri, 25 Jan 2019 21:38:28 +0000 Subject: [PATCH 083/142] Fix format/arg mismatch USe correct format for int arguments PR: 229549 Submitted by: David Binderman MFC after: 1 week --- sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c b/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c index 7844c4e3613e..36c0e295f8e4 100644 --- a/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c +++ b/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c @@ -1036,7 +1036,7 @@ bhnd_pmu_res_init(struct bhnd_pmu_softc *sc) return (error); } - PMU_DEBUG(sc, "Applying %s=%s to rsrc %d res_updn_timer\n", + PMU_DEBUG(sc, "Applying %s=%d to rsrc %d res_updn_timer\n", name, val, i); BHND_PMU_WRITE_4(sc, BHND_PMU_RES_TABLE_SEL, i); @@ -1111,7 +1111,7 @@ bhnd_pmu_res_init(struct bhnd_pmu_softc *sc) return (error); } - PMU_DEBUG(sc, "Applying %s=%s to rsrc %d res_dep_mask\n", name, + PMU_DEBUG(sc, "Applying %s=%d to rsrc %d res_dep_mask\n", name, val, i); BHND_PMU_WRITE_4(sc, BHND_PMU_RES_TABLE_SEL, i); From 771ec59bb782cd6dd44da9706d5b5886b2875955 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Fri, 25 Jan 2019 22:22:29 +0000 Subject: [PATCH 084/142] ext2fs: Add some extra consistency checks for the superblock. Maliciously formed, or badly corrupted, filesystems can cause kernel panics. In general, such acts of foot-shooting can only be accomplished by root, but in a world with VM images that is moving towards automated mounts it is important to have some form of prevention. Reported by: Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE. Incidentaly this should also fix a memory corruption issue reported by Dr Silvio Cesare of InfoSect. Huge thanks to all reseachers for making us aware of the issue. admbug: 872, 891 Reviewed by: fsu Obtained from: NetBSD (with minor changes) MFC after: 3 days --- sys/fs/ext2fs/ext2_vfsops.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c index 241f97cd3b65..cf74e9389a38 100644 --- a/sys/fs/ext2fs/ext2_vfsops.c +++ b/sys/fs/ext2fs/ext2_vfsops.c @@ -416,7 +416,16 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es, es->e3fs_desc_size); return (EINVAL); } + /* Check for block size = 1K|2K|4K */ + if (es->e2fs_log_bsize > 2) { + printf("ext2fs: bad block size: %d\n", es->e2fs_log_bsize); + return (EINVAL); + } /* Check for group size */ + if (fs->e2fs_bpg == 0) { + printf("ext2fs: zero blocks per group\n"); + return (EINVAL); + } if (fs->e2fs_bpg != fs->e2fs_bsize * 8) { printf("ext2fs: non-standard group size unsupported %d\n", fs->e2fs_bpg); @@ -424,7 +433,21 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es, } fs->e2fs_ipb = fs->e2fs_bsize / EXT2_INODE_SIZE(fs); + if (fs->e2fs_ipg == 0) { + printf("ext2fs: zero inodes per group\n"); + return (EINVAL); + } fs->e2fs_itpg = fs->e2fs_ipg / fs->e2fs_ipb; + /* Check for block consistency */ + if (es->e2fs_first_dblock >= fs->e2fs_bcount) { + printf("ext2fs: invalid first data block\n"); + return (EINVAL); + } + if (fs->e2fs_rbcount > fs->e2fs_bcount || + fs->e2fs_fbcount > fs->e2fs_bcount) { + printf("ext2fs: invalid block count\n"); + return (EINVAL); + } /* s_resuid / s_resgid ? */ fs->e2fs_gcount = howmany(fs->e2fs_bcount - es->e2fs_first_dblock, EXT2_BLOCKS_PER_GROUP(fs)); From 4ce7bd2527933c5f553da319514101289a97e6c2 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 26 Jan 2019 03:43:12 +0000 Subject: [PATCH 085/142] Fix reporting errors with `gai_strerror(..)` The return value (`err`) should be checked; not the `errno` value. PR: 235200 Approved by: emaste (mentor) Reviewed by: asomers, lwhsu MFC after: 28 days MFC with: r343362, r343365, r343367-r343368 Differential Revision: https://reviews.freebsd.org/D18969 --- lib/libc/tests/sys/sendfile_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/tests/sys/sendfile_test.c b/lib/libc/tests/sys/sendfile_test.c index 4443c049e7d2..822bb917f9c3 100644 --- a/lib/libc/tests/sys/sendfile_test.c +++ b/lib/libc/tests/sys/sendfile_test.c @@ -114,7 +114,7 @@ resolve_localhost(struct addrinfo **res, int domain, int type, int port) error = getaddrinfo("localhost", serv, &hints, res); ATF_REQUIRE_EQ_MSG(error, 0, - "getaddrinfo failed: %s", gai_strerror(errno)); + "getaddrinfo failed: %s", gai_strerror(error)); free(serv); } From 6967c09c691a0d505a1fe83f19f214958b5f0fed Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Sat, 26 Jan 2019 05:35:24 +0000 Subject: [PATCH 086/142] Expand DDB's set of printable soft dependency data structures. The set of known soft dependency data structures now includes: sd_worklist, sd_inodedep, sd_allocdirect, sd_allocindir, and sd_mkdir. DDB can also print lists of sd_allinodedeps, sd_mkdir_list, and sd_workhead. The sd_workhead script is useful for listing all the dependencies associated with a buffer, e.g. bp->b_dep. Prefix the soft dependency show names with sd_ so that they sort together when listed by DDB's "show help" and to distinguish them from other data structures printable by DDB. Sponsored by: Netflix --- sys/ufs/ffs/ffs_softdep.c | 228 +++++++++++++++++++++++++++++--------- 1 file changed, 173 insertions(+), 55 deletions(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index eb093d4bf419..60ee45cdb7d7 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -14406,47 +14406,129 @@ softdep_error(func, error) #ifdef DDB +/* exported to ffs_vfsops.c */ +extern void db_print_ffs(struct ufsmount *ump); +void +db_print_ffs(struct ufsmount *ump) +{ + db_printf("mp %p (%s) devvp %p\n", ump->um_mountp, + ump->um_mountp->mnt_stat.f_mntonname, ump->um_devvp); + db_printf(" fs %p su_wl %d su_deps %d su_req %d\n", + ump->um_fs, ump->softdep_on_worklist, + ump->softdep_deps, ump->softdep_req); +} + +static void +worklist_print(struct worklist *wk, int verbose) +{ + + if (!verbose) { + db_printf("%s: %p state 0x%b\n", TYPENAME(wk->wk_type), wk, + (u_int)wk->wk_state, PRINT_SOFTDEP_FLAGS); + return; + } + db_printf("worklist: %p type %s state 0x%b next %p\n ", wk, + TYPENAME(wk->wk_type), (u_int)wk->wk_state, PRINT_SOFTDEP_FLAGS, + LIST_NEXT(wk, wk_list)); + db_print_ffs(VFSTOUFS(wk->wk_mp)); +} + static void inodedep_print(struct inodedep *inodedep, int verbose) { - db_printf("%p fs %p st %x ino %jd inoblk %jd delta %jd nlink %jd" - " saveino %p\n", - inodedep, inodedep->id_fs, inodedep->id_state, + + worklist_print(&inodedep->id_list, 0); + db_printf(" fs %p ino %jd inoblk %jd delta %jd nlink %jd\n", + inodedep->id_fs, (intmax_t)inodedep->id_ino, (intmax_t)fsbtodb(inodedep->id_fs, - ino_to_fsba(inodedep->id_fs, inodedep->id_ino)), + ino_to_fsba(inodedep->id_fs, inodedep->id_ino)), (intmax_t)inodedep->id_nlinkdelta, - (intmax_t)inodedep->id_savednlink, - inodedep->id_savedino1); + (intmax_t)inodedep->id_savednlink); if (verbose == 0) return; - db_printf("\tpendinghd %p, bufwait %p, inowait %p, inoreflst %p, " - "mkdiradd %p\n", + db_printf(" bmsafemap %p, mkdiradd %p, inoreflst %p\n", + inodedep->id_bmsafemap, + inodedep->id_mkdiradd, + TAILQ_FIRST(&inodedep->id_inoreflst)); + db_printf(" dirremhd %p, pendinghd %p, bufwait %p\n", + LIST_FIRST(&inodedep->id_dirremhd), LIST_FIRST(&inodedep->id_pendinghd), - LIST_FIRST(&inodedep->id_bufwait), + LIST_FIRST(&inodedep->id_bufwait)); + db_printf(" inowait %p, inoupdt %p, newinoupdt %p\n", LIST_FIRST(&inodedep->id_inowait), - TAILQ_FIRST(&inodedep->id_inoreflst), - inodedep->id_mkdiradd); - db_printf("\tinoupdt %p, newinoupdt %p, extupdt %p, newextupdt %p\n", TAILQ_FIRST(&inodedep->id_inoupdt), - TAILQ_FIRST(&inodedep->id_newinoupdt), + TAILQ_FIRST(&inodedep->id_newinoupdt)); + db_printf(" extupdt %p, newextupdt %p, freeblklst %p\n", TAILQ_FIRST(&inodedep->id_extupdt), - TAILQ_FIRST(&inodedep->id_newextupdt)); + TAILQ_FIRST(&inodedep->id_newextupdt), + TAILQ_FIRST(&inodedep->id_freeblklst)); + db_printf(" saveino %p, savedsize %jd, savedextsize %jd\n", + inodedep->id_savedino1, + (intmax_t)inodedep->id_savedsize, + (intmax_t)inodedep->id_savedextsize); } -DB_SHOW_COMMAND(inodedep, db_show_inodedep) +static void +newblk_print(struct newblk *nbp) +{ + + worklist_print(&nbp->nb_list, 0); + db_printf(" newblkno %jd\n", (intmax_t)nbp->nb_newblkno); + db_printf(" jnewblk %p, bmsafemap %p, freefrag %p\n", + &nbp->nb_jnewblk, + &nbp->nb_bmsafemap, + &nbp->nb_freefrag); + db_printf(" indirdeps %p, newdirblk %p, jwork %p\n", + LIST_FIRST(&nbp->nb_indirdeps), + LIST_FIRST(&nbp->nb_newdirblk), + LIST_FIRST(&nbp->nb_jwork)); +} + +static void +allocdirect_print(struct allocdirect *adp) +{ + + newblk_print(&adp->ad_block); + db_printf(" oldblkno %jd, oldsize %ld, newsize %ld\n", + adp->ad_oldblkno, adp->ad_oldsize, adp->ad_newsize); + db_printf(" offset %d, inodedep %p\n", + adp->ad_offset, adp->ad_inodedep); +} + +static void +allocindir_print(struct allocindir *aip) +{ + + newblk_print(&aip->ai_block); + db_printf(" oldblkno %jd, lbn %jd\n", + (intmax_t)aip->ai_oldblkno, (intmax_t)aip->ai_lbn); + db_printf(" offset %d, indirdep %p\n", + aip->ai_offset, aip->ai_indirdep); +} + +static void +mkdir_print(struct mkdir *mkdir) +{ + + worklist_print(&mkdir->md_list, 0); + db_printf(" diradd %p, jaddref %p, buf %p\n", + mkdir->md_diradd, mkdir->md_jaddref, mkdir->md_buf); +} + +DB_SHOW_COMMAND(sd_inodedep, db_show_sd_inodedep) { if (have_addr == 0) { - db_printf("Address required\n"); + db_printf("inodedep address required\n"); return; } inodedep_print((struct inodedep*)addr, 1); } -DB_SHOW_COMMAND(inodedeps, db_show_inodedeps) +DB_SHOW_COMMAND(sd_allinodedeps, db_show_sd_allinodedeps) { struct inodedep_hashhead *inodedephd; struct inodedep *inodedep; @@ -14454,7 +14536,7 @@ DB_SHOW_COMMAND(inodedeps, db_show_inodedeps) int cnt; if (have_addr == 0) { - db_printf("Address required\n"); + db_printf("ufsmount address required\n"); return; } ump = (struct ufsmount *)addr; @@ -14466,72 +14548,108 @@ DB_SHOW_COMMAND(inodedeps, db_show_inodedeps) } } -DB_SHOW_COMMAND(worklist, db_show_worklist) +DB_SHOW_COMMAND(sd_worklist, db_show_sd_worklist) { - struct worklist *wk; if (have_addr == 0) { - db_printf("Address required\n"); + db_printf("worklist address required\n"); return; } - wk = (struct worklist *)addr; - printf("worklist: %p type %s state 0x%X\n", - wk, TYPENAME(wk->wk_type), wk->wk_state); + worklist_print((struct worklist *)addr, 1); } -DB_SHOW_COMMAND(workhead, db_show_workhead) +DB_SHOW_COMMAND(sd_workhead, db_show_sd_workhead) { + struct worklist *wk; struct workhead *wkhd; - struct worklist *wk; - int i; if (have_addr == 0) { - db_printf("Address required\n"); + db_printf("worklist address required " + "(for example value in bp->b_dep)\n"); return; } - wkhd = (struct workhead *)addr; - wk = LIST_FIRST(wkhd); - for (i = 0; i < 100 && wk != NULL; i++, wk = LIST_NEXT(wk, wk_list)) - db_printf("worklist: %p type %s state 0x%X", - wk, TYPENAME(wk->wk_type), wk->wk_state); - if (i == 100) - db_printf("workhead overflow"); - printf("\n"); + /* + * We often do not have the address of the worklist head but + * instead a pointer to its first entry (e.g., we have the + * contents of bp->b_dep rather than &bp->b_dep). But the back + * pointer of bp->b_dep will point at the head of the list, so + * we cheat and use that instead. If we are in the middle of + * a list we will still get the same result, so nothing + * unexpected will result. + */ + wk = (struct worklist *)addr; + if (wk == NULL) + return; + wkhd = (struct workhead *)wk->wk_list.le_prev; + LIST_FOREACH(wk, wkhd, wk_list) { + switch(wk->wk_type) { + case D_INODEDEP: + inodedep_print(WK_INODEDEP(wk), 0); + continue; + case D_ALLOCDIRECT: + allocdirect_print(WK_ALLOCDIRECT(wk)); + continue; + case D_ALLOCINDIR: + allocindir_print(WK_ALLOCINDIR(wk)); + continue; + case D_MKDIR: + mkdir_print(WK_MKDIR(wk)); + continue; + default: + worklist_print(wk, 0); + continue; + } + } } +DB_SHOW_COMMAND(sd_mkdir, db_show_sd_mkdir) +{ + if (have_addr == 0) { + db_printf("mkdir address required\n"); + return; + } + mkdir_print((struct mkdir *)addr); +} -DB_SHOW_COMMAND(mkdirs, db_show_mkdirs) +DB_SHOW_COMMAND(sd_mkdir_list, db_show_sd_mkdir_list) { struct mkdirlist *mkdirlisthd; - struct jaddref *jaddref; - struct diradd *diradd; struct mkdir *mkdir; if (have_addr == 0) { - db_printf("Address required\n"); + db_printf("mkdir listhead address required\n"); return; } mkdirlisthd = (struct mkdirlist *)addr; LIST_FOREACH(mkdir, mkdirlisthd, md_mkdirs) { - diradd = mkdir->md_diradd; - db_printf("mkdir: %p state 0x%X dap %p state 0x%X", - mkdir, mkdir->md_state, diradd, diradd->da_state); - if ((jaddref = mkdir->md_jaddref) != NULL) - db_printf(" jaddref %p jaddref state 0x%X", - jaddref, jaddref->ja_state); - db_printf("\n"); + mkdir_print(mkdir); + if (mkdir->md_diradd != NULL) { + db_printf(" "); + worklist_print(&mkdir->md_diradd->da_list, 0); + } + if (mkdir->md_jaddref != NULL) { + db_printf(" "); + worklist_print(&mkdir->md_jaddref->ja_list, 0); + } } } -/* exported to ffs_vfsops.c */ -extern void db_print_ffs(struct ufsmount *ump); -void -db_print_ffs(struct ufsmount *ump) +DB_SHOW_COMMAND(sd_allocdirect, db_show_sd_allocdirect) { - db_printf("mp %p %s devvp %p fs %p su_wl %d su_deps %d su_req %d\n", - ump->um_mountp, ump->um_mountp->mnt_stat.f_mntonname, - ump->um_devvp, ump->um_fs, ump->softdep_on_worklist, - ump->softdep_deps, ump->softdep_req); + if (have_addr == 0) { + db_printf("allocdirect address required\n"); + return; + } + allocdirect_print((struct allocdirect *)addr); +} + +DB_SHOW_COMMAND(sd_allocindir, db_show_sd_allocindir) +{ + if (have_addr == 0) { + db_printf("allocindir address required\n"); + return; + } + allocindir_print((struct allocindir *)addr); } #endif /* DDB */ From db009dddfd645f0a456042abcb78460492b13d9f Mon Sep 17 00:00:00 2001 From: Mariusz Zaborski Date: Sat, 26 Jan 2019 13:53:00 +0000 Subject: [PATCH 087/142] zfs: allow to change cache flush sysctl There is no reason for this variable to be tunable. This variable is used as a barrier in few places. Discussed with: pjd MFC after: 2 weeks Sponsored by: Fudo Security --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c index fe79b9b52fe7..f31ac23ce703 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c @@ -103,7 +103,7 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, zil_replay_disable, CTLFLAG_RWTUN, * out-of-order write cache is enabled. */ boolean_t zfs_nocacheflush = B_FALSE; -SYSCTL_INT(_vfs_zfs, OID_AUTO, cache_flush_disable, CTLFLAG_RDTUN, +SYSCTL_INT(_vfs_zfs, OID_AUTO, cache_flush_disable, CTLFLAG_RWTUN, &zfs_nocacheflush, 0, "Disable cache flush"); boolean_t zfs_trim_enabled = B_TRUE; SYSCTL_DECL(_vfs_zfs_trim); From 28f4385e45a2681c14bd04b83fe1796eaefe8265 Mon Sep 17 00:00:00 2001 From: Mariusz Zaborski Date: Sat, 26 Jan 2019 14:10:49 +0000 Subject: [PATCH 088/142] libcasper: do not run registered exit functions Casper library should not use exit(3) function because before setting it up applications may register it. Casper doesn't depend on any registered exit function, so it safe to change this. Reported by: jceel MFC after: 2 weeks --- lib/libcasper/libcasper/libcasper_service.c | 14 +++++++------- lib/libcasper/libcasper/service.c | 6 +++--- lib/libcasper/libcasper/zygote.c | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/libcasper/libcasper/libcasper_service.c b/lib/libcasper/libcasper/libcasper_service.c index 1291e58bac17..387f9b036517 100644 --- a/lib/libcasper/libcasper/libcasper_service.c +++ b/lib/libcasper/libcasper/libcasper_service.c @@ -148,20 +148,20 @@ service_execute(int chanfd) nvl = nvlist_recv(chanfd, 0); if (nvl == NULL) - exit(1); + _exit(1); if (!nvlist_exists_string(nvl, "service")) - exit(1); + _exit(1); servname = nvlist_get_string(nvl, "service"); casserv = service_find(servname); if (casserv == NULL) - exit(1); + _exit(1); service = casserv->cs_service; procfd = nvlist_take_descriptor(nvl, "procfd"); nvlist_destroy(nvl); service_start(service, chanfd, procfd); /* Not reached. */ - exit(1); + _exit(1); } static int @@ -231,7 +231,7 @@ casper_main_loop(int fd) int sock, maxfd, ret; if (zygote_init() < 0) - exit(1); + _exit(1); /* * Register core services. @@ -256,7 +256,7 @@ casper_main_loop(int fd) } if (maxfd == -1) { /* Nothing to do. */ - exit(0); + _exit(0); } maxfd++; @@ -267,7 +267,7 @@ casper_main_loop(int fd) if (ret == -1) { if (errno == EINTR) continue; - exit(1); + _exit(1); } TAILQ_FOREACH(casserv, &casper_services, cs_next) { diff --git a/lib/libcasper/libcasper/service.c b/lib/libcasper/libcasper/service.c index 0830a4ba7bc4..5c1c64d9a9d7 100644 --- a/lib/libcasper/libcasper/service.c +++ b/lib/libcasper/libcasper/service.c @@ -427,7 +427,7 @@ service_start(struct service *service, int sock, int procfd) service_clean(sock, procfd, service->s_flags); if (service_connection_add(service, sock, NULL) == NULL) - exit(1); + _exit(1); for (;;) { FD_ZERO(&fds); @@ -443,7 +443,7 @@ service_start(struct service *service, int sock, int procfd) nfds = select(maxfd + 1, &fds, NULL, NULL, NULL); if (nfds < 0) { if (errno != EINTR) - exit(1); + _exit(1); continue; } else if (nfds == 0) { /* Timeout. */ @@ -468,5 +468,5 @@ service_start(struct service *service, int sock, int procfd) } } - exit(0); + _exit(0); } diff --git a/lib/libcasper/libcasper/zygote.c b/lib/libcasper/libcasper/zygote.c index ef66222c3c59..2b84bb49a695 100644 --- a/lib/libcasper/libcasper/zygote.c +++ b/lib/libcasper/libcasper/zygote.c @@ -122,7 +122,7 @@ zygote_main(int sock) if (nvlin == NULL) { if (errno == ENOTCONN) { /* Casper exited. */ - exit(0); + _exit(0); } continue; } @@ -134,7 +134,7 @@ zygote_main(int sock) func = service_execute; break; default: - exit(0); + _exit(0); } /* @@ -161,7 +161,7 @@ zygote_main(int sock) close(chanfd[0]); func(chanfd[1]); /* NOTREACHED */ - exit(1); + _exit(1); default: /* Parent. */ close(chanfd[1]); From daeb432a7a121cd83edda93f155186c968bfd16b Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Sat, 26 Jan 2019 14:14:25 +0000 Subject: [PATCH 089/142] otus(4): fix a typo in man page (802.11 -> 802.11n) MFC after: 3 days --- share/man/man4/otus.4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man4/otus.4 b/share/man/man4/otus.4 index 2a7875cdd8f4..eb6048528a0d 100644 --- a/share/man/man4/otus.4 +++ b/share/man/man4/otus.4 @@ -166,4 +166,4 @@ and ported by The .Nm driver only supports 802.11a/b/g operations. -802.11 operation is not supported at this time. +802.11n operation is not supported at this time. From 34fd9d700086e421db256d9d8b1807f918513079 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Sat, 26 Jan 2019 14:54:06 +0000 Subject: [PATCH 090/142] geom_uzip(4): move NULL pointer KASSERT check before it is dereferenced PR: 203499 Submitted by: MFC after: 5 days --- sys/geom/uzip/g_uzip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/geom/uzip/g_uzip.c b/sys/geom/uzip/g_uzip.c index 6c29e946d0a8..0cadfcc559bc 100644 --- a/sys/geom/uzip/g_uzip.c +++ b/sys/geom/uzip/g_uzip.c @@ -889,13 +889,13 @@ g_uzip_destroy_geom(struct gctl_req *req, struct g_class *mp, struct g_geom *gp) g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, gp->name); g_topology_assert(); + KASSERT(gp != NULL, ("NULL geom")); if (gp->softc == NULL) { DPRINTF(GUZ_DBG_ERR, ("%s(%s): gp->softc == NULL\n", __func__, gp->name)); return (ENXIO); } - KASSERT(gp != NULL, ("NULL geom")); pp = LIST_FIRST(&gp->provider); KASSERT(pp != NULL, ("NULL provider")); if (pp->acr > 0 || pp->acw > 0 || pp->ace > 0) From b84b36380eb1404f1cf06224cc8af5f805edb090 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Sat, 26 Jan 2019 17:00:55 +0000 Subject: [PATCH 091/142] Remove 2GHz channel list copies from wireless drivers. Wrap ieee80211_add_channel_list_2ghz into another function which supplies default (1-14) channel list to it and drop its copies from drivers. Checked with RTL8188EE, country US / JP / KR / UA. MFC after: 2 weeks --- sys/dev/bwi/if_bwi.c | 6 +----- sys/dev/iwi/if_iwi.c | 6 ++---- sys/dev/ral/rt2560.c | 6 +----- sys/dev/ral/rt2661.c | 5 +---- sys/dev/ral/rt2860.c | 5 +---- sys/dev/rtwn/if_rtwn.c | 8 ++------ sys/dev/usb/wlan/if_rsu.c | 8 ++------ sys/dev/usb/wlan/if_rum.c | 6 +----- sys/dev/usb/wlan/if_run.c | 3 +-- sys/dev/usb/wlan/if_runreg.h | 3 --- sys/dev/usb/wlan/if_ural.c | 6 +----- sys/dev/usb/wlan/if_urtw.c | 6 +----- sys/dev/usb/wlan/if_zyd.c | 3 +-- sys/dev/usb/wlan/if_zydreg.h | 4 ---- sys/net80211/ieee80211.c | 11 +++++++++++ sys/net80211/ieee80211_var.h | 2 ++ 16 files changed, 28 insertions(+), 60 deletions(-) diff --git a/sys/dev/bwi/if_bwi.c b/sys/dev/bwi/if_bwi.c index 0349450652a0..79362f3db2a1 100644 --- a/sys/dev/bwi/if_bwi.c +++ b/sys/dev/bwi/if_bwi.c @@ -307,9 +307,6 @@ static const struct { [108] = { 7, 3 } }; -static const uint8_t bwi_chan_2ghz[] = - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; - #ifdef BWI_DEBUG #ifdef BWI_DEBUG_VERBOSE static uint32_t bwi_debug = BWI_DBG_ATTACH | BWI_DBG_INIT | BWI_DBG_TXPOWER; @@ -1715,8 +1712,7 @@ bwi_getradiocaps(struct ieee80211com *ic, panic("unknown phymode %d\n", phy->phy_mode); } - ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, - bwi_chan_2ghz, nitems(bwi_chan_2ghz), bands, 0); + ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0); } static void diff --git a/sys/dev/iwi/if_iwi.c b/sys/dev/iwi/if_iwi.c index b456c1430f44..07f9a347e2f2 100644 --- a/sys/dev/iwi/if_iwi.c +++ b/sys/dev/iwi/if_iwi.c @@ -132,8 +132,6 @@ static const struct iwi_ident iwi_ident_table[] = { { 0, 0, NULL } }; -static const uint8_t def_chan_2ghz[] = - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; static const uint8_t def_chan_5ghz_band1[] = { 36, 40, 44, 48, 52, 56, 60, 64 }; static const uint8_t def_chan_5ghz_band2[] = @@ -3604,8 +3602,8 @@ iwi_getradiocaps(struct ieee80211com *ic, iwi_collect_bands(ic, bands, sizeof(bands)); *nchans = 0; if (isset(bands, IEEE80211_MODE_11B) || isset(bands, IEEE80211_MODE_11G)) - ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, - def_chan_2ghz, nitems(def_chan_2ghz), bands, 0); + ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, + bands, 0); if (isset(bands, IEEE80211_MODE_11A)) { ieee80211_add_channel_list_5ghz(chans, maxchans, nchans, def_chan_5ghz_band1, nitems(def_chan_5ghz_band1), diff --git a/sys/dev/ral/rt2560.c b/sys/dev/ral/rt2560.c index af684ef2bada..de520c6a475e 100644 --- a/sys/dev/ral/rt2560.c +++ b/sys/dev/ral/rt2560.c @@ -189,9 +189,6 @@ static const uint32_t rt2560_rf2525e_r2[] = RT2560_RF2525E_R2; static const uint32_t rt2560_rf2526_r2[] = RT2560_RF2526_R2; static const uint32_t rt2560_rf2526_hi_r2[] = RT2560_RF2526_HI_R2; -static const uint8_t rt2560_chan_2ghz[] = - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; - static const uint8_t rt2560_chan_5ghz[] = { 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, @@ -2137,8 +2134,7 @@ rt2560_getradiocaps(struct ieee80211com *ic, memset(bands, 0, sizeof(bands)); setbit(bands, IEEE80211_MODE_11B); setbit(bands, IEEE80211_MODE_11G); - ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, - rt2560_chan_2ghz, nitems(rt2560_chan_2ghz), bands, 0); + ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0); if (sc->rf_rev == RT2560_RF_5222) { setbit(bands, IEEE80211_MODE_11A); diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c index a65551eea40b..0ae78e8b5271 100644 --- a/sys/dev/ral/rt2661.c +++ b/sys/dev/ral/rt2661.c @@ -195,8 +195,6 @@ static const struct rfprog { RT2661_RF5225_2 }; -static const uint8_t rt2661_chan_2ghz[] = - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; static const uint8_t rt2661_chan_5ghz[] = { 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, @@ -2757,8 +2755,7 @@ rt2661_getradiocaps(struct ieee80211com *ic, memset(bands, 0, sizeof(bands)); setbit(bands, IEEE80211_MODE_11B); setbit(bands, IEEE80211_MODE_11G); - ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, - rt2661_chan_2ghz, nitems(rt2661_chan_2ghz), bands, 0); + ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0); if (sc->rf_rev == RT2661_RF_5225 || sc->rf_rev == RT2661_RF_5325) { setbit(bands, IEEE80211_MODE_11A); diff --git a/sys/dev/ral/rt2860.c b/sys/dev/ral/rt2860.c index 7130ecee1e93..4b01c9924a9d 100644 --- a/sys/dev/ral/rt2860.c +++ b/sys/dev/ral/rt2860.c @@ -228,8 +228,6 @@ static const struct { RT5392_DEF_RF }; -static const uint8_t rt2860_chan_2ghz[] = - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; static const uint8_t rt2860_chan_5ghz[] = { 36, 38, 40, 44, 46, 48, 52, 54, 56, 60, 62, 64, 100, 102, 104, 108, 110, 112, 116, 118, 120, 124, 126, 128, 132, 134, 136, 140, @@ -2310,8 +2308,7 @@ rt2860_getradiocaps(struct ieee80211com *ic, int maxchans, int *nchans, memset(bands, 0, sizeof(bands)); setbit(bands, IEEE80211_MODE_11B); setbit(bands, IEEE80211_MODE_11G); - ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, - rt2860_chan_2ghz, nitems(rt2860_chan_2ghz), bands, 0); + ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0); if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850) { setbit(bands, IEEE80211_MODE_11A); diff --git a/sys/dev/rtwn/if_rtwn.c b/sys/dev/rtwn/if_rtwn.c index 78d9996b289d..6bf5235e17df 100644 --- a/sys/dev/rtwn/if_rtwn.c +++ b/sys/dev/rtwn/if_rtwn.c @@ -153,9 +153,6 @@ static void rtwn_stop(struct rtwn_softc *); MALLOC_DEFINE(M_RTWN_PRIV, "rtwn_priv", "rtwn driver private state"); -static const uint8_t rtwn_chan_2ghz[] = - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; - static const uint16_t wme2reg[] = { R92C_EDCA_BE_PARAM, R92C_EDCA_BK_PARAM, R92C_EDCA_VI_PARAM, R92C_EDCA_VO_PARAM }; @@ -1534,9 +1531,8 @@ rtwn_getradiocaps(struct ieee80211com *ic, setbit(bands, IEEE80211_MODE_11B); setbit(bands, IEEE80211_MODE_11G); setbit(bands, IEEE80211_MODE_11NG); - ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, - rtwn_chan_2ghz, nitems(rtwn_chan_2ghz), bands, - !!(ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40)); + ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, + bands, !!(ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40)); /* XXX workaround add_channel_list() limitations */ setbit(bands, IEEE80211_MODE_11A); diff --git a/sys/dev/usb/wlan/if_rsu.c b/sys/dev/usb/wlan/if_rsu.c index 8fbc5b611266..2aa09d83d567 100644 --- a/sys/dev/usb/wlan/if_rsu.c +++ b/sys/dev/usb/wlan/if_rsu.c @@ -286,9 +286,6 @@ MODULE_DEPEND(rsu, firmware, 1, 1, 1); MODULE_VERSION(rsu, 1); USB_PNP_HOST_INFO(rsu_devs); -static const uint8_t rsu_chan_2ghz[] = - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; - static uint8_t rsu_wme_ac_xfer_map[4] = { [WME_AC_BE] = RSU_BULK_TX_BE_BK, [WME_AC_BK] = RSU_BULK_TX_BE_BK, @@ -784,9 +781,8 @@ rsu_getradiocaps(struct ieee80211com *ic, setbit(bands, IEEE80211_MODE_11G); if (sc->sc_ht) setbit(bands, IEEE80211_MODE_11NG); - ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, - rsu_chan_2ghz, nitems(rsu_chan_2ghz), bands, - (ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) != 0); + ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, + bands, (ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) != 0); } static void diff --git a/sys/dev/usb/wlan/if_rum.c b/sys/dev/usb/wlan/if_rum.c index 40be784d7237..5d911b49e429 100644 --- a/sys/dev/usb/wlan/if_rum.c +++ b/sys/dev/usb/wlan/if_rum.c @@ -342,9 +342,6 @@ static const struct { { 107, 0x04 } }; -static const uint8_t rum_chan_2ghz[] = - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; - static const uint8_t rum_chan_5ghz[] = { 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, @@ -3220,8 +3217,7 @@ rum_getradiocaps(struct ieee80211com *ic, memset(bands, 0, sizeof(bands)); setbit(bands, IEEE80211_MODE_11B); setbit(bands, IEEE80211_MODE_11G); - ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, - rum_chan_2ghz, nitems(rum_chan_2ghz), bands, 0); + ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0); if (sc->rf_rev == RT2573_RF_5225 || sc->rf_rev == RT2573_RF_5226) { setbit(bands, IEEE80211_MODE_11A); diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c index 22407183fd58..40aaaed7191f 100644 --- a/sys/dev/usb/wlan/if_run.c +++ b/sys/dev/usb/wlan/if_run.c @@ -4859,8 +4859,7 @@ run_getradiocaps(struct ieee80211com *ic, memset(bands, 0, sizeof(bands)); setbit(bands, IEEE80211_MODE_11B); setbit(bands, IEEE80211_MODE_11G); - ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, - run_chan_2ghz, nitems(run_chan_2ghz), bands, 0); + ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0); if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850 || sc->rf_rev == RT3070_RF_3052 || sc->rf_rev == RT3593_RF_3053 || diff --git a/sys/dev/usb/wlan/if_runreg.h b/sys/dev/usb/wlan/if_runreg.h index c09aac8f3481..8561d2c14947 100644 --- a/sys/dev/usb/wlan/if_runreg.h +++ b/sys/dev/usb/wlan/if_runreg.h @@ -1086,9 +1086,6 @@ struct rt2860_rxwi { /* * Channel map for run(4) driver; taken from the table below. */ -static const uint8_t run_chan_2ghz[] = - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; - static const uint8_t run_chan_5ghz[] = { 36, 38, 40, 44, 46, 48, 52, 54, 56, 60, 62, 64, 100, 102, 104, 108, 110, 112, 116, 118, 120, 124, 126, 128, 132, 134, 136, 140, diff --git a/sys/dev/usb/wlan/if_ural.c b/sys/dev/usb/wlan/if_ural.c index f48cd5d1acac..104335f60932 100644 --- a/sys/dev/usb/wlan/if_ural.c +++ b/sys/dev/usb/wlan/if_ural.c @@ -361,9 +361,6 @@ static const struct { { 161, 0x08808, 0x0242f, 0x00281 } }; -static const uint8_t ural_chan_2ghz[] = - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; - static const uint8_t ural_chan_5ghz[] = { 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, @@ -1591,8 +1588,7 @@ ural_getradiocaps(struct ieee80211com *ic, memset(bands, 0, sizeof(bands)); setbit(bands, IEEE80211_MODE_11B); setbit(bands, IEEE80211_MODE_11G); - ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, - ural_chan_2ghz, nitems(ural_chan_2ghz), bands, 0); + ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0); if (sc->rf_rev == RAL_RF_5222) { setbit(bands, IEEE80211_MODE_11A); diff --git a/sys/dev/usb/wlan/if_urtw.c b/sys/dev/usb/wlan/if_urtw.c index 418d8b5089a5..28b9ac4e94d9 100644 --- a/sys/dev/usb/wlan/if_urtw.c +++ b/sys/dev/usb/wlan/if_urtw.c @@ -215,9 +215,6 @@ static uint8_t urtw_8225z2_agc[] = { 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31 }; -static const uint8_t urtw_chan_2ghz[] = - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; - static uint32_t urtw_8225_channel[] = { 0x0000, /* dummy channel 0 */ 0x085c, /* 1 */ @@ -1585,8 +1582,7 @@ urtw_getradiocaps(struct ieee80211com *ic, memset(bands, 0, sizeof(bands)); setbit(bands, IEEE80211_MODE_11B); setbit(bands, IEEE80211_MODE_11G); - ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, - urtw_chan_2ghz, nitems(urtw_chan_2ghz), bands, 0); + ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0); } static void diff --git a/sys/dev/usb/wlan/if_zyd.c b/sys/dev/usb/wlan/if_zyd.c index 9c6202204a0c..f084a430c4fc 100644 --- a/sys/dev/usb/wlan/if_zyd.c +++ b/sys/dev/usb/wlan/if_zyd.c @@ -2889,8 +2889,7 @@ zyd_getradiocaps(struct ieee80211com *ic, memset(bands, 0, sizeof(bands)); setbit(bands, IEEE80211_MODE_11B); setbit(bands, IEEE80211_MODE_11G); - ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, - zyd_chan_2ghz, nitems(zyd_chan_2ghz), bands, 0); + ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0); } static void diff --git a/sys/dev/usb/wlan/if_zydreg.h b/sys/dev/usb/wlan/if_zydreg.h index 724b8c57af2d..8c4a16c5bf24 100644 --- a/sys/dev/usb/wlan/if_zydreg.h +++ b/sys/dev/usb/wlan/if_zydreg.h @@ -421,10 +421,6 @@ #define ZYD_CR254 0x93f8 #define ZYD_CR255 0x93fc -/* nitems(ZYD_*_CHANTABLE) */ -static const uint8_t zyd_chan_2ghz[] = - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; - /* copied nearly verbatim from the Linux driver rewrite */ #define ZYD_DEF_PHY \ { \ diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index a0b36f2866bb..699728ee6909 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -1631,6 +1631,17 @@ ieee80211_add_channel_list_2ghz(struct ieee80211_channel chans[], int maxchans, return (add_chanlist(chans, maxchans, nchans, ieee, nieee, flags)); } +int +ieee80211_add_channels_default_2ghz(struct ieee80211_channel chans[], + int maxchans, int *nchans, const uint8_t bands[], int ht40) +{ + const uint8_t default_chan_list[] = + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; + + return (ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, + default_chan_list, nitems(default_chan_list), bands, ht40)); +} + int ieee80211_add_channel_list_5ghz(struct ieee80211_channel chans[], int maxchans, int *nchans, const uint8_t ieee[], int nieee, const uint8_t bands[], diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 0839baef885a..24ffbe106ba4 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -734,6 +734,8 @@ uint32_t ieee80211_get_channel_center_freq1(const struct ieee80211_channel *); uint32_t ieee80211_get_channel_center_freq2(const struct ieee80211_channel *); int ieee80211_add_channel_list_2ghz(struct ieee80211_channel[], int, int *, const uint8_t[], int, const uint8_t[], int); +int ieee80211_add_channels_default_2ghz(struct ieee80211_channel[], int, + int *, const uint8_t[], int); int ieee80211_add_channel_list_5ghz(struct ieee80211_channel[], int, int *, const uint8_t[], int, const uint8_t[], int); struct ieee80211_channel *ieee80211_find_channel(struct ieee80211com *, From 81df432ecfaa8d448ea03ad24479f0271dd65f45 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Sat, 26 Jan 2019 17:17:25 +0000 Subject: [PATCH 092/142] geom_uzip(4): set 'gp != NULL' assertion on top of the function There was yet another access to this variable in g_trace() few lines upper. PR: 203499 Reported by: cem MFC after: 5 days MFC with: 343473 --- sys/geom/uzip/g_uzip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/geom/uzip/g_uzip.c b/sys/geom/uzip/g_uzip.c index 0cadfcc559bc..deedf2db22e0 100644 --- a/sys/geom/uzip/g_uzip.c +++ b/sys/geom/uzip/g_uzip.c @@ -886,10 +886,10 @@ g_uzip_destroy_geom(struct gctl_req *req, struct g_class *mp, struct g_geom *gp) { struct g_provider *pp; + KASSERT(gp != NULL, ("NULL geom")); g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, gp->name); g_topology_assert(); - KASSERT(gp != NULL, ("NULL geom")); if (gp->softc == NULL) { DPRINTF(GUZ_DBG_ERR, ("%s(%s): gp->softc == NULL\n", __func__, gp->name)); From 4aa37fe4fc6628edb619fb2259caf24f14680830 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Sat, 26 Jan 2019 17:27:12 +0000 Subject: [PATCH 093/142] ObsoleteFiles.inc: remove adv(4) / adw(4) man pages after r339567 --- ObsoleteFiles.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 7d7a417bcd16..3a872c3ca3ff 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20190126: adv(4) / adw(4) removal +OLD_FILES+=usr/share/man/man4/adv.4.gz +OLD_FILES+=usr/share/man/man4/adw.4.gz # 20190114: old pbuf allocator removed OLD_FILES+=usr/share/man/man9/pbuf.9.gz # 20181219: ibcs removal From b294eac56bcb1a3acb75d299fe0554fd9cf28b83 Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Sat, 26 Jan 2019 17:52:12 +0000 Subject: [PATCH 094/142] Fix logic errors in iwm_pcie_load_firmware_chunk introduced in r314065. * There's no reason to have a while() loop here, because: - if msleep returns 0, that means we were woken up by the interrupt handler, and we are going to exit immediately as sc_fw_chunk_done will now be 1 (there is nothing else that sleeps on sc_fw.) - if msleep doesn't return 0 (i.e. it returned ETIMEDOUT) then we will exit immediately because of the if-test. So, just use a single msleep() and then check sc_fw_chunk_done as before. * The comment said we were sleeping for 5 seconds, but the msleep was only for 1. Before r314065, this was 1 second and so was the comment, and in that commit the comment was changed and the function call wasn't. Possibly fixes failures to initialize uCode on certain devices. Submitted by: Augustin Cavalier (waddlesplash gmail.com) Obtained from: Haiku 132990ecdcb072f2ce597b5d497ff3e5b1f09c20 MFC after: 10 days --- sys/dev/iwm/if_iwm.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 60cfb9e20b1e..b87085244a72 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -2397,8 +2397,6 @@ static int iwm_pcie_load_firmware_chunk(struct iwm_softc *sc, uint32_t dst_addr, bus_addr_t phy_addr, uint32_t byte_cnt) { - int ret; - sc->sc_fw_chunk_done = 0; if (!iwm_nic_lock(sc)) @@ -2430,14 +2428,9 @@ iwm_pcie_load_firmware_chunk(struct iwm_softc *sc, uint32_t dst_addr, iwm_nic_unlock(sc); /* wait up to 5s for this segment to load */ - ret = 0; - while (!sc->sc_fw_chunk_done) { - ret = msleep(&sc->sc_fw, &sc->sc_mtx, 0, "iwmfw", hz); - if (ret) - break; - } + msleep(&sc->sc_fw, &sc->sc_mtx, 0, "iwmfw", hz * 5); - if (ret != 0) { + if (!sc->sc_fw_chunk_done) { device_printf(sc->sc_dev, "fw chunk addr 0x%x len %d failed to load\n", dst_addr, byte_cnt); From 030a1f8ba2e2873195454e5fbd4da6123b0b57a0 Mon Sep 17 00:00:00 2001 From: Alexander Leidinger Date: Sat, 26 Jan 2019 18:23:19 +0000 Subject: [PATCH 095/142] Catch up with some years of driver development. Most impressive in terms of doxygen stuff are the isci and ocs_fc drivers. --- tools/kerneldoc/subsys/Doxyfile-dev_aacraid | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_al_eth | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_alpm | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_altera | 21 +++++++++++++++++++ .../subsys/Doxyfile-dev_amd_ecc_inject | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_amdgpio | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_amdpm | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_amdsmb | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_amdsmn | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_axgbe | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_beri | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_bhnd | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_bnxt | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_buslogic | 21 ------------------- .../{Doxyfile-dev_asr => Doxyfile-dev_bvm} | 8 +++---- tools/kerneldoc/subsys/Doxyfile-dev_cadence | 21 +++++++++++++++++++ .../subsys/Doxyfile-dev_chromebook_platform | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_cyapa | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_digi | 21 ------------------- .../{Doxyfile-dev_aha => Doxyfile-dev_dme} | 8 +++---- tools/kerneldoc/subsys/Doxyfile-dev_dpaa | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_dpt | 21 ------------------- tools/kerneldoc/subsys/Doxyfile-dev_drm2 | 21 +++++++++++++++++++ .../{Doxyfile-dev_ahb => Doxyfile-dev_dwc} | 8 +++---- tools/kerneldoc/subsys/Doxyfile-dev_efidev | 21 +++++++++++++++++++ .../{Doxyfile-dev_aic => Doxyfile-dev_ena} | 8 +++---- .../kerneldoc/subsys/Doxyfile-dev_etherswitch | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_evdev | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_extres | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_fatm | 21 ------------------- tools/kerneldoc/subsys/Doxyfile-dev_ffec | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_filemon | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_gxemul | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_hatm | 21 ------------------- tools/kerneldoc/subsys/Doxyfile-dev_hdmi | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_hptnr | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_hyperv | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_ichiic | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_ieee488 | 21 ------------------- tools/kerneldoc/subsys/Doxyfile-dev_imcsmb | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_intel | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_intpm | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_ioat | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_isci | 21 +++++++++++++++++++ .../subsys/Doxyfile-dev_iscsi_initiator | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_iser | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_isl | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_ismt | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_iwm | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_ixl | 21 +++++++++++++++++++ .../kerneldoc/subsys/Doxyfile-dev_jedec_dimm | 21 +++++++++++++++++++ ...ile-dev_advansys => Doxyfile-dev_liquidio} | 8 +++---- tools/kerneldoc/subsys/Doxyfile-dev_mbox | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_mdio | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_mlx4 | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_mlx5 | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_mmcnull | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_mpr | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_mrsas | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_mthca | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_nand | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_nctgpio | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_ncv | 21 ------------------- tools/kerneldoc/subsys/Doxyfile-dev_neta | 21 +++++++++++++++++++ .../kerneldoc/subsys/Doxyfile-dev_netfpga10g | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_nfsmb | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_nsp | 21 ------------------- tools/kerneldoc/subsys/Doxyfile-dev_ntb | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_nvd | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_nvdimm | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_nve | 21 ------------------- tools/kerneldoc/subsys/Doxyfile-dev_nvme | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_oce | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_ocs_fc | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_otus | 21 +++++++++++++++++++ .../{Doxyfile-dev_cm => Doxyfile-dev_ow} | 8 +++---- tools/kerneldoc/subsys/Doxyfile-dev_patm | 21 ------------------- tools/kerneldoc/subsys/Doxyfile-dev_pdq | 21 ------------------- tools/kerneldoc/subsys/Doxyfile-dev_pms | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_proto | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_psci | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_pwm | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_qlnx | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_qlxgbe | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_qlxge | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_rccgpio | 21 +++++++++++++++++++ .../{Doxyfile-dev_ct => Doxyfile-dev_rl} | 8 +++---- tools/kerneldoc/subsys/Doxyfile-dev_rtwn | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_siba | 21 ------------------- tools/kerneldoc/subsys/Doxyfile-dev_smartpqi | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_snc | 21 ------------------- tools/kerneldoc/subsys/Doxyfile-dev_stg | 21 ------------------- tools/kerneldoc/subsys/Doxyfile-dev_streams | 21 ------------------- tools/kerneldoc/subsys/Doxyfile-dev_tcp_log | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_terasic | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_utopia | 21 ------------------- tools/kerneldoc/subsys/Doxyfile-dev_veriexec | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_viapm | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_videomode | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_vmware | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_vnic | 21 +++++++++++++++++++ .../{Doxyfile-dev_en => Doxyfile-dev_vt} | 8 +++---- tools/kerneldoc/subsys/Doxyfile-dev_wbwd | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_xdma | 21 +++++++++++++++++++ tools/kerneldoc/subsys/Doxyfile-dev_xilinx | 21 +++++++++++++++++++ .../subsys/{Doxyfile-dev_ie => Doxyfile-xen} | 11 +++++----- 106 files changed, 1738 insertions(+), 374 deletions(-) create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_aacraid create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_al_eth create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_alpm create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_altera create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_amd_ecc_inject create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_amdgpio create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_amdpm create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_amdsmb create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_amdsmn create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_axgbe create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_beri create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_bhnd create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_bnxt delete mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_buslogic rename tools/kerneldoc/subsys/{Doxyfile-dev_asr => Doxyfile-dev_bvm} (74%) create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_cadence create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_chromebook_platform create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_cyapa delete mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_digi rename tools/kerneldoc/subsys/{Doxyfile-dev_aha => Doxyfile-dev_dme} (74%) create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_dpaa delete mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_dpt create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_drm2 rename tools/kerneldoc/subsys/{Doxyfile-dev_ahb => Doxyfile-dev_dwc} (74%) create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_efidev rename tools/kerneldoc/subsys/{Doxyfile-dev_aic => Doxyfile-dev_ena} (74%) create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_etherswitch create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_evdev create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_extres delete mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_fatm create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_ffec create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_filemon create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_gxemul delete mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_hatm create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_hdmi create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_hptnr create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_hyperv create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_ichiic delete mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_ieee488 create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_imcsmb create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_intel create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_intpm create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_ioat create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_isci create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_iscsi_initiator create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_iser create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_isl create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_ismt create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_iwm create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_ixl create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_jedec_dimm rename tools/kerneldoc/subsys/{Doxyfile-dev_advansys => Doxyfile-dev_liquidio} (72%) create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_mbox create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_mdio create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_mlx4 create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_mlx5 create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_mmcnull create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_mpr create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_mrsas create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_mthca create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_nand create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_nctgpio delete mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_ncv create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_neta create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_netfpga10g create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_nfsmb delete mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_nsp create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_ntb create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_nvd create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_nvdimm delete mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_nve create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_nvme create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_oce create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_ocs_fc create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_otus rename tools/kerneldoc/subsys/{Doxyfile-dev_cm => Doxyfile-dev_ow} (75%) delete mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_patm delete mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_pdq create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_pms create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_proto create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_psci create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_pwm create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_qlnx create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_qlxgbe create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_qlxge create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_rccgpio rename tools/kerneldoc/subsys/{Doxyfile-dev_ct => Doxyfile-dev_rl} (75%) create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_rtwn delete mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_siba create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_smartpqi delete mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_snc delete mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_stg delete mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_streams create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_tcp_log create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_terasic delete mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_utopia create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_veriexec create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_viapm create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_videomode create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_vmware create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_vnic rename tools/kerneldoc/subsys/{Doxyfile-dev_en => Doxyfile-dev_vt} (75%) create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_wbwd create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_xdma create mode 100644 tools/kerneldoc/subsys/Doxyfile-dev_xilinx rename tools/kerneldoc/subsys/{Doxyfile-dev_ie => Doxyfile-xen} (61%) diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_aacraid b/tools/kerneldoc/subsys/Doxyfile-dev_aacraid new file mode 100644 index 000000000000..c0a52df4a116 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_aacraid @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel aacraid device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_aacraid/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/aacraid/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_aacraid/dev_aacraid.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_al_eth b/tools/kerneldoc/subsys/Doxyfile-dev_al_eth new file mode 100644 index 000000000000..6c2ed7a9161f --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_al_eth @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel al_eth device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_al_eth/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/al_eth/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_al_eth/dev_al_eth.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_alpm b/tools/kerneldoc/subsys/Doxyfile-dev_alpm new file mode 100644 index 000000000000..fb1cac442b90 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_alpm @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel alpm device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_alpm/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/alpm/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_alpm/dev_alpm.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_altera b/tools/kerneldoc/subsys/Doxyfile-dev_altera new file mode 100644 index 000000000000..8ba54b9bf616 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_altera @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel altera device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_altera/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/altera/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_altera/dev_altera.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_amd_ecc_inject b/tools/kerneldoc/subsys/Doxyfile-dev_amd_ecc_inject new file mode 100644 index 000000000000..9784b4a293c1 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_amd_ecc_inject @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel amd_ecc_inject device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_amd_ecc_inject/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/amd_ecc_inject/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_amd_ecc_inject/dev_amd_ecc_inject.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_amdgpio b/tools/kerneldoc/subsys/Doxyfile-dev_amdgpio new file mode 100644 index 000000000000..b36c12d442e5 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_amdgpio @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel amdgpio device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_amdgpio/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/amdgpio/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_amdgpio/dev_amdgpio.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_amdpm b/tools/kerneldoc/subsys/Doxyfile-dev_amdpm new file mode 100644 index 000000000000..ff3e803e6b0c --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_amdpm @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel amdpm device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_amdpm/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/amdpm/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_amdpm/dev_amdpm.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_amdsmb b/tools/kerneldoc/subsys/Doxyfile-dev_amdsmb new file mode 100644 index 000000000000..9c7edcad0739 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_amdsmb @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel amdsmb device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_amdsmb/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/amdsmb/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_amdsmb/dev_amdsmb.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_amdsmn b/tools/kerneldoc/subsys/Doxyfile-dev_amdsmn new file mode 100644 index 000000000000..4dbbb6a04820 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_amdsmn @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel amdsmn device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_amdsmn/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/amdsmn/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_amdsmn/dev_amdsmn.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_axgbe b/tools/kerneldoc/subsys/Doxyfile-dev_axgbe new file mode 100644 index 000000000000..d3750f16601b --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_axgbe @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel axgbe device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_axgbe/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/axgbe/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_axgbe/dev_axgbe.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_beri b/tools/kerneldoc/subsys/Doxyfile-dev_beri new file mode 100644 index 000000000000..abb8bdf2a8e6 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_beri @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel beri device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_beri/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/beri/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_beri/dev_beri.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_bhnd b/tools/kerneldoc/subsys/Doxyfile-dev_bhnd new file mode 100644 index 000000000000..3c8d448993bc --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_bhnd @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel bhnd device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_bhnd/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/bhnd/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_bhnd/dev_bhnd.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_bnxt b/tools/kerneldoc/subsys/Doxyfile-dev_bnxt new file mode 100644 index 000000000000..e5b86c7c184d --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_bnxt @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel bnxt device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_bnxt/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/bnxt/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_bnxt/dev_bnxt.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_buslogic b/tools/kerneldoc/subsys/Doxyfile-dev_buslogic deleted file mode 100644 index e13c76a83536..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-dev_buslogic +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.5.2 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel BUSLOGIC device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_buslogic/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/buslogic/ \ - $(NOTREVIEWED) - -GENERATE_TAGFILE = dev_buslogic/dev_buslogic.tag - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_asr b/tools/kerneldoc/subsys/Doxyfile-dev_bvm similarity index 74% rename from tools/kerneldoc/subsys/Doxyfile-dev_asr rename to tools/kerneldoc/subsys/Doxyfile-dev_bvm index 05aaa705d564..6cc7ed31062b 100644 --- a/tools/kerneldoc/subsys/Doxyfile-dev_asr +++ b/tools/kerneldoc/subsys/Doxyfile-dev_bvm @@ -5,16 +5,16 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel ASR device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_asr/ +PROJECT_NAME = "FreeBSD kernel bvm device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_bvm/ EXTRACT_ALL = YES # for undocumented src, no warnings enabled #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/asr/ \ +INPUT = $(DOXYGEN_SRC_PATH)/dev/bvm/ \ $(NOTREVIEWED) -GENERATE_TAGFILE = dev_asr/dev_asr.tag +GENERATE_TAGFILE = dev_bvm/dev_bvm.tag @INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) @INCLUDE = common-Doxyfile diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_cadence b/tools/kerneldoc/subsys/Doxyfile-dev_cadence new file mode 100644 index 000000000000..4fe3b1487f1e --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_cadence @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel cadence device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_cadence/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/cadence/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_cadence/dev_cadence.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_chromebook_platform b/tools/kerneldoc/subsys/Doxyfile-dev_chromebook_platform new file mode 100644 index 000000000000..d9f434f0503c --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_chromebook_platform @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel chromebook_platform device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_chromebook_platform/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/chromebook_platform/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_chromebook_platform/dev_chromebook_platform.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_cyapa b/tools/kerneldoc/subsys/Doxyfile-dev_cyapa new file mode 100644 index 000000000000..60280bd285b9 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_cyapa @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel cyapa device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_cyapa/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/cyapa/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_cyapa/dev_cyapa.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_digi b/tools/kerneldoc/subsys/Doxyfile-dev_digi deleted file mode 100644 index e2c5d0117202..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-dev_digi +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.5.2 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel DIGI device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_digi/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/digi/ \ - $(NOTREVIEWED) - -GENERATE_TAGFILE = dev_digi/dev_digi.tag - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_aha b/tools/kerneldoc/subsys/Doxyfile-dev_dme similarity index 74% rename from tools/kerneldoc/subsys/Doxyfile-dev_aha rename to tools/kerneldoc/subsys/Doxyfile-dev_dme index 7efc60839f89..c5465c30c99e 100644 --- a/tools/kerneldoc/subsys/Doxyfile-dev_aha +++ b/tools/kerneldoc/subsys/Doxyfile-dev_dme @@ -5,16 +5,16 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel AHA device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_aha/ +PROJECT_NAME = "FreeBSD kernel dme device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_dme/ EXTRACT_ALL = YES # for undocumented src, no warnings enabled #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/aha/ \ +INPUT = $(DOXYGEN_SRC_PATH)/dev/dme/ \ $(NOTREVIEWED) -GENERATE_TAGFILE = dev_aha/dev_aha.tag +GENERATE_TAGFILE = dev_dme/dev_dme.tag @INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) @INCLUDE = common-Doxyfile diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_dpaa b/tools/kerneldoc/subsys/Doxyfile-dev_dpaa new file mode 100644 index 000000000000..a3da742e7062 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_dpaa @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel dpaa device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_dpaa/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/dpaa/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_dpaa/dev_dpaa.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_dpt b/tools/kerneldoc/subsys/Doxyfile-dev_dpt deleted file mode 100644 index cc0f8e5cc483..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-dev_dpt +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.5.2 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel DPT device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_dpt/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/dpt/ \ - $(NOTREVIEWED) - -GENERATE_TAGFILE = dev_dpt/dev_dpt.tag - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_drm2 b/tools/kerneldoc/subsys/Doxyfile-dev_drm2 new file mode 100644 index 000000000000..832124359749 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_drm2 @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel drm2 device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_drm2/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/drm2/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_drm2/dev_drm2.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_ahb b/tools/kerneldoc/subsys/Doxyfile-dev_dwc similarity index 74% rename from tools/kerneldoc/subsys/Doxyfile-dev_ahb rename to tools/kerneldoc/subsys/Doxyfile-dev_dwc index 61f2607164a6..f62629e42ba1 100644 --- a/tools/kerneldoc/subsys/Doxyfile-dev_ahb +++ b/tools/kerneldoc/subsys/Doxyfile-dev_dwc @@ -5,16 +5,16 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel AHB device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_ahb/ +PROJECT_NAME = "FreeBSD kernel dwc device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_dwc/ EXTRACT_ALL = YES # for undocumented src, no warnings enabled #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/ahb/ \ +INPUT = $(DOXYGEN_SRC_PATH)/dev/dwc/ \ $(NOTREVIEWED) -GENERATE_TAGFILE = dev_ahb/dev_ahb.tag +GENERATE_TAGFILE = dev_dwc/dev_dwc.tag @INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) @INCLUDE = common-Doxyfile diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_efidev b/tools/kerneldoc/subsys/Doxyfile-dev_efidev new file mode 100644 index 000000000000..607ac073c1f3 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_efidev @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel efidev device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_efidev/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/efidev/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_efidev/dev_efidev.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_aic b/tools/kerneldoc/subsys/Doxyfile-dev_ena similarity index 74% rename from tools/kerneldoc/subsys/Doxyfile-dev_aic rename to tools/kerneldoc/subsys/Doxyfile-dev_ena index 3e31e58da66b..0b31e9a1f035 100644 --- a/tools/kerneldoc/subsys/Doxyfile-dev_aic +++ b/tools/kerneldoc/subsys/Doxyfile-dev_ena @@ -5,16 +5,16 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel AIC device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_aic/ +PROJECT_NAME = "FreeBSD kernel ena device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_ena/ EXTRACT_ALL = YES # for undocumented src, no warnings enabled #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/aic/ \ +INPUT = $(DOXYGEN_SRC_PATH)/dev/ena/ \ $(NOTREVIEWED) -GENERATE_TAGFILE = dev_aic/dev_aic.tag +GENERATE_TAGFILE = dev_ena/dev_ena.tag @INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) @INCLUDE = common-Doxyfile diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_etherswitch b/tools/kerneldoc/subsys/Doxyfile-dev_etherswitch new file mode 100644 index 000000000000..3dd10cb4ea51 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_etherswitch @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel etherswitch device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_etherswitch/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/etherswitch/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_etherswitch/dev_etherswitch.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_evdev b/tools/kerneldoc/subsys/Doxyfile-dev_evdev new file mode 100644 index 000000000000..c42bba615a1e --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_evdev @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel evdev device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_evdev/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/evdev/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_evdev/dev_evdev.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_extres b/tools/kerneldoc/subsys/Doxyfile-dev_extres new file mode 100644 index 000000000000..8e0639276406 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_extres @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel extres device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_extres/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/extres/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_extres/dev_extres.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_fatm b/tools/kerneldoc/subsys/Doxyfile-dev_fatm deleted file mode 100644 index 01f0a2d5bed9..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-dev_fatm +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.5.2 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel FATM device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_fatm/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/fatm/ \ - $(NOTREVIEWED) - -GENERATE_TAGFILE = dev_fatm/dev_fatm.tag - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_ffec b/tools/kerneldoc/subsys/Doxyfile-dev_ffec new file mode 100644 index 000000000000..0efe4883a893 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_ffec @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel ffec device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_ffec/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/ffec/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_ffec/dev_ffec.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_filemon b/tools/kerneldoc/subsys/Doxyfile-dev_filemon new file mode 100644 index 000000000000..1549fba02441 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_filemon @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel filemon device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_filemon/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/filemon/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_filemon/dev_filemon.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_gxemul b/tools/kerneldoc/subsys/Doxyfile-dev_gxemul new file mode 100644 index 000000000000..bc4dea6e25fe --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_gxemul @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel gxemul device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_gxemul/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/gxemul/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_gxemul/dev_gxemul.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_hatm b/tools/kerneldoc/subsys/Doxyfile-dev_hatm deleted file mode 100644 index 24c216baecbe..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-dev_hatm +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.5.2 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel HATM device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_hatm/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/hatm/ \ - $(NOTREVIEWED) - -GENERATE_TAGFILE = dev_hatm/dev_hatm.tag - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_hdmi b/tools/kerneldoc/subsys/Doxyfile-dev_hdmi new file mode 100644 index 000000000000..b6bc8c89c7e4 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_hdmi @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel hdmi device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_hdmi/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/hdmi/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_hdmi/dev_hdmi.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_hptnr b/tools/kerneldoc/subsys/Doxyfile-dev_hptnr new file mode 100644 index 000000000000..5defaddd9316 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_hptnr @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel hptnr device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_hptnr/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/hptnr/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_hptnr/dev_hptnr.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_hyperv b/tools/kerneldoc/subsys/Doxyfile-dev_hyperv new file mode 100644 index 000000000000..d8325a6d18bb --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_hyperv @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel hyperv device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_hyperv/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/hyperv/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_hyperv/dev_hyperv.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_ichiic b/tools/kerneldoc/subsys/Doxyfile-dev_ichiic new file mode 100644 index 000000000000..e3973429935b --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_ichiic @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel ichiic device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_ichiic/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/ichiic/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_ichiic/dev_ichiic.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_ieee488 b/tools/kerneldoc/subsys/Doxyfile-dev_ieee488 deleted file mode 100644 index 46883cf6262e..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-dev_ieee488 +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.5.2 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel IEEE488 device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_ieee488/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/ieee488/ \ - $(NOTREVIEWED) - -GENERATE_TAGFILE = dev_ieee488/dev_ieee488.tag - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_imcsmb b/tools/kerneldoc/subsys/Doxyfile-dev_imcsmb new file mode 100644 index 000000000000..ede8d02b3833 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_imcsmb @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel imcsmb device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_imcsmb/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/imcsmb/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_imcsmb/dev_imcsmb.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_intel b/tools/kerneldoc/subsys/Doxyfile-dev_intel new file mode 100644 index 000000000000..663949a787fa --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_intel @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel intel device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_intel/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/intel/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_intel/dev_intel.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_intpm b/tools/kerneldoc/subsys/Doxyfile-dev_intpm new file mode 100644 index 000000000000..ce79f71bf6f8 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_intpm @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel intpm device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_intpm/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/intpm/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_intpm/dev_intpm.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_ioat b/tools/kerneldoc/subsys/Doxyfile-dev_ioat new file mode 100644 index 000000000000..49df520b6dd4 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_ioat @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel ioat device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_ioat/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/ioat/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_ioat/dev_ioat.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_isci b/tools/kerneldoc/subsys/Doxyfile-dev_isci new file mode 100644 index 000000000000..75a931b398e0 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_isci @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel isci device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_isci/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/isci/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_isci/dev_isci.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_iscsi_initiator b/tools/kerneldoc/subsys/Doxyfile-dev_iscsi_initiator new file mode 100644 index 000000000000..ffffa77f4e4d --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_iscsi_initiator @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel iscsi_initiator device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_iscsi_initiator/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/iscsi_initiator/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_iscsi_initiator/dev_iscsi_initiator.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_iser b/tools/kerneldoc/subsys/Doxyfile-dev_iser new file mode 100644 index 000000000000..e5dd49bdc8d8 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_iser @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel iser device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_iser/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/iser/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_iser/dev_iser.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_isl b/tools/kerneldoc/subsys/Doxyfile-dev_isl new file mode 100644 index 000000000000..31a9ad325784 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_isl @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel isl device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_isl/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/isl/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_isl/dev_isl.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_ismt b/tools/kerneldoc/subsys/Doxyfile-dev_ismt new file mode 100644 index 000000000000..edd64eca760d --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_ismt @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel ismt device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_ismt/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/ismt/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_ismt/dev_ismt.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_iwm b/tools/kerneldoc/subsys/Doxyfile-dev_iwm new file mode 100644 index 000000000000..f97c74050448 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_iwm @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel iwm device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_iwm/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/iwm/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_iwm/dev_iwm.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_ixl b/tools/kerneldoc/subsys/Doxyfile-dev_ixl new file mode 100644 index 000000000000..23bef0bb6765 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_ixl @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel ixl device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_ixl/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/ixl/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_ixl/dev_ixl.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_jedec_dimm b/tools/kerneldoc/subsys/Doxyfile-dev_jedec_dimm new file mode 100644 index 000000000000..0396d3fb1190 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_jedec_dimm @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel jedec_dimm device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_jedec_dimm/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/jedec_dimm/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE jedec_= dev_jedec_dimm/dev_dimm.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_advansys b/tools/kerneldoc/subsys/Doxyfile-dev_liquidio similarity index 72% rename from tools/kerneldoc/subsys/Doxyfile-dev_advansys rename to tools/kerneldoc/subsys/Doxyfile-dev_liquidio index f8a333220163..a6cb7712c81e 100644 --- a/tools/kerneldoc/subsys/Doxyfile-dev_advansys +++ b/tools/kerneldoc/subsys/Doxyfile-dev_liquidio @@ -5,16 +5,16 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel ADVANSYS device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_advansys/ +PROJECT_NAME = "FreeBSD kernel liquidio device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_liquidio/ EXTRACT_ALL = YES # for undocumented src, no warnings enabled #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/advansys/ \ +INPUT = $(DOXYGEN_SRC_PATH)/dev/liquidio/ \ $(NOTREVIEWED) -GENERATE_TAGFILE = dev_advansys/dev_advansys.tag +GENERATE_TAGFILE = dev_liquidio/dev_liquidio.tag @INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) @INCLUDE = common-Doxyfile diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_mbox b/tools/kerneldoc/subsys/Doxyfile-dev_mbox new file mode 100644 index 000000000000..e9bfa5486353 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_mbox @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel mbox device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_mbox/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/mbox/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_mbox/dev_mbox.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_mdio b/tools/kerneldoc/subsys/Doxyfile-dev_mdio new file mode 100644 index 000000000000..428030c6396b --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_mdio @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel mdio device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_mdio/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/mdio/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_mdio/dev_mdio.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_mlx4 b/tools/kerneldoc/subsys/Doxyfile-dev_mlx4 new file mode 100644 index 000000000000..b361d115d5c3 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_mlx4 @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel mlx4 device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_mlx4/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/mlx4/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_mlx4/dev_mlx4.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_mlx5 b/tools/kerneldoc/subsys/Doxyfile-dev_mlx5 new file mode 100644 index 000000000000..630e80b764f4 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_mlx5 @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel mlx5 device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_mlx5/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/mlx5/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_mlx5/dev_mlx5.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_mmcnull b/tools/kerneldoc/subsys/Doxyfile-dev_mmcnull new file mode 100644 index 000000000000..b8661444fa8a --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_mmcnull @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel mmcnull device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_mmcnull/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/mmcnull/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_mmcnull/dev_mmcnull.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_mpr b/tools/kerneldoc/subsys/Doxyfile-dev_mpr new file mode 100644 index 000000000000..d63e8a6f28ae --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_mpr @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel mpr device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_mpr/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/mpr/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_mpr/dev_mpr.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_mrsas b/tools/kerneldoc/subsys/Doxyfile-dev_mrsas new file mode 100644 index 000000000000..c372615f1c18 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_mrsas @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel mrsas device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_mrsas/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/mrsas/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_mrsas/dev_mrsas.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_mthca b/tools/kerneldoc/subsys/Doxyfile-dev_mthca new file mode 100644 index 000000000000..565a0d32b923 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_mthca @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel mthca device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_mthca/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/mthca/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_mthca/dev_mthca.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_nand b/tools/kerneldoc/subsys/Doxyfile-dev_nand new file mode 100644 index 000000000000..cf7915073939 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_nand @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel nand device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_nand/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/nand/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_nand/dev_nand.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_nctgpio b/tools/kerneldoc/subsys/Doxyfile-dev_nctgpio new file mode 100644 index 000000000000..37d7d1852327 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_nctgpio @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel nctgpio device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_nctgpio/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/nctgpio/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_nctgpio/dev_nctgpio.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_ncv b/tools/kerneldoc/subsys/Doxyfile-dev_ncv deleted file mode 100644 index 011856841de0..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-dev_ncv +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.5.2 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel NCV device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_ncv/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/ncv/ \ - $(NOTREVIEWED) - -GENERATE_TAGFILE = dev_ncv/dev_ncv.tag - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_neta b/tools/kerneldoc/subsys/Doxyfile-dev_neta new file mode 100644 index 000000000000..06c78640fa95 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_neta @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel neta device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_neta/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/neta/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_neta/dev_neta.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_netfpga10g b/tools/kerneldoc/subsys/Doxyfile-dev_netfpga10g new file mode 100644 index 000000000000..c4617f68e2e0 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_netfpga10g @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel netfpga10g device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_netfpga10g/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/netfpga10g/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_netfpga10g/dev_netfpga10g.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_nfsmb b/tools/kerneldoc/subsys/Doxyfile-dev_nfsmb new file mode 100644 index 000000000000..c15b4c64bea5 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_nfsmb @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel nfsmb device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_nfsmb/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/nfsmb/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_nfsmb/dev_nfsmb.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_nsp b/tools/kerneldoc/subsys/Doxyfile-dev_nsp deleted file mode 100644 index 0dd794b3fe88..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-dev_nsp +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.5.2 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel NSP device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_nsp/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/nsp/ \ - $(NOTREVIEWED) - -GENERATE_TAGFILE = dev_nsp/dev_nsp.tag - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_ntb b/tools/kerneldoc/subsys/Doxyfile-dev_ntb new file mode 100644 index 000000000000..89e03822a543 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_ntb @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel ntb device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_ntb/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/ntb/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_ntb/dev_ntb.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_nvd b/tools/kerneldoc/subsys/Doxyfile-dev_nvd new file mode 100644 index 000000000000..960677caaea6 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_nvd @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel nvd device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_nvd/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/nvd/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_nvd/dev_nvd.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_nvdimm b/tools/kerneldoc/subsys/Doxyfile-dev_nvdimm new file mode 100644 index 000000000000..464b59f961a2 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_nvdimm @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel nvdimm device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_nvdimm/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/nvdimm/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_nvdimm/dev_nvdimm.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_nve b/tools/kerneldoc/subsys/Doxyfile-dev_nve deleted file mode 100644 index da49e8786e8a..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-dev_nve +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.5.2 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel NVE device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_nve/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/nve/ \ - $(NOTREVIEWED) - -GENERATE_TAGFILE = dev_nve/dev_nve.tag - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_nvme b/tools/kerneldoc/subsys/Doxyfile-dev_nvme new file mode 100644 index 000000000000..fe09c9d6a61b --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_nvme @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel nvme device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_nvme/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/nvme/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_nvme/dev_nvme.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_oce b/tools/kerneldoc/subsys/Doxyfile-dev_oce new file mode 100644 index 000000000000..5aa2b1a636be --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_oce @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel oce device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_oce/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/oce/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_oce/dev_oce.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_ocs_fc b/tools/kerneldoc/subsys/Doxyfile-dev_ocs_fc new file mode 100644 index 000000000000..dc7088ef4d96 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_ocs_fc @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel ocs_fc device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_ocs_fc/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/ocs_fc/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_ocs_fc/dev_ocs_fc.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_otus b/tools/kerneldoc/subsys/Doxyfile-dev_otus new file mode 100644 index 000000000000..c0c87085e3b9 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_otus @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel otus device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_otus/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/otus/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_otus/dev_otus.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_cm b/tools/kerneldoc/subsys/Doxyfile-dev_ow similarity index 75% rename from tools/kerneldoc/subsys/Doxyfile-dev_cm rename to tools/kerneldoc/subsys/Doxyfile-dev_ow index 8cdcea975d15..13a73e54e036 100644 --- a/tools/kerneldoc/subsys/Doxyfile-dev_cm +++ b/tools/kerneldoc/subsys/Doxyfile-dev_ow @@ -5,16 +5,16 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel CM device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_cm/ +PROJECT_NAME = "FreeBSD kernel ow device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_ow/ EXTRACT_ALL = YES # for undocumented src, no warnings enabled #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/cm/ \ +INPUT = $(DOXYGEN_SRC_PATH)/dev/ow/ \ $(NOTREVIEWED) -GENERATE_TAGFILE = dev_cm/dev_cm.tag +GENERATE_TAGFILE = dev_ow/dev_ow.tag @INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) @INCLUDE = common-Doxyfile diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_patm b/tools/kerneldoc/subsys/Doxyfile-dev_patm deleted file mode 100644 index b1853f6e668c..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-dev_patm +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.5.2 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel PATM device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_patm/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/patm/ \ - $(NOTREVIEWED) - -GENERATE_TAGFILE = dev_patm/dev_patm.tag - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_pdq b/tools/kerneldoc/subsys/Doxyfile-dev_pdq deleted file mode 100644 index aff31ace82fb..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-dev_pdq +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.5.2 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel PDQ device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_pdq/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/pdq/ \ - $(NOTREVIEWED) - -GENERATE_TAGFILE = dev_pdq/dev_pdq.tag - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_pms b/tools/kerneldoc/subsys/Doxyfile-dev_pms new file mode 100644 index 000000000000..2efb7e9eeaa9 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_pms @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel pms device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_pms/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/pms/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_pms/dev_pms.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_proto b/tools/kerneldoc/subsys/Doxyfile-dev_proto new file mode 100644 index 000000000000..a09da9655f61 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_proto @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel proto device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_proto/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/proto/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_proto/dev_proto.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_psci b/tools/kerneldoc/subsys/Doxyfile-dev_psci new file mode 100644 index 000000000000..ceb894ee8290 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_psci @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel psci device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_psci/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/psci/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_psci/dev_psci.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_pwm b/tools/kerneldoc/subsys/Doxyfile-dev_pwm new file mode 100644 index 000000000000..7741437ff75f --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_pwm @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel pwm device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_pwm/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/pwm/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_pwm/dev_pwm.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_qlnx b/tools/kerneldoc/subsys/Doxyfile-dev_qlnx new file mode 100644 index 000000000000..9ca69d4a5610 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_qlnx @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel qlnx device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_qlnx/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/qlnx/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_qlnx/dev_qlnx.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_qlxgbe b/tools/kerneldoc/subsys/Doxyfile-dev_qlxgbe new file mode 100644 index 000000000000..1a14cdc18877 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_qlxgbe @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel qlxgbe device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_qlxgbe/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/qlxgbe/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_qlxgbe/dev_qlxgbe.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_qlxge b/tools/kerneldoc/subsys/Doxyfile-dev_qlxge new file mode 100644 index 000000000000..510f8efd4343 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_qlxge @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel qlxge device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_qlxge/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/qlxge/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_qlxge/dev_qlxge.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_rccgpio b/tools/kerneldoc/subsys/Doxyfile-dev_rccgpio new file mode 100644 index 000000000000..292adda05733 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_rccgpio @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel rccgpio device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_rccgpio/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/rccgpio/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_rccgpio/dev_rccgpio.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_ct b/tools/kerneldoc/subsys/Doxyfile-dev_rl similarity index 75% rename from tools/kerneldoc/subsys/Doxyfile-dev_ct rename to tools/kerneldoc/subsys/Doxyfile-dev_rl index 7c5be46f1f31..f8d0a4a99d2a 100644 --- a/tools/kerneldoc/subsys/Doxyfile-dev_ct +++ b/tools/kerneldoc/subsys/Doxyfile-dev_rl @@ -5,16 +5,16 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel CT device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_ct/ +PROJECT_NAME = "FreeBSD kernel rl device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_rl/ EXTRACT_ALL = YES # for undocumented src, no warnings enabled #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/ct/ \ +INPUT = $(DOXYGEN_SRC_PATH)/dev/rl/ \ $(NOTREVIEWED) -GENERATE_TAGFILE = dev_ct/dev_ct.tag +GENERATE_TAGFILE = dev_rl/dev_rl.tag @INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) @INCLUDE = common-Doxyfile diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_rtwn b/tools/kerneldoc/subsys/Doxyfile-dev_rtwn new file mode 100644 index 000000000000..a6b3d9affd71 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_rtwn @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel rtwn device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_rtwn/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/rtwn/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_rtwn/dev_rtwn.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_siba b/tools/kerneldoc/subsys/Doxyfile-dev_siba deleted file mode 100644 index 9705cf59b80c..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-dev_siba +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.5.2 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel SIBA device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_siba/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/siba/ \ - $(NOTREVIEWED) - -GENERATE_TAGFILE = dev_siba/dev_siba.tag - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_smartpqi b/tools/kerneldoc/subsys/Doxyfile-dev_smartpqi new file mode 100644 index 000000000000..d23cc03d3e54 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_smartpqi @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel smartpqi device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_smartpqi/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/smartpqi/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_smartpqi/dev_smartpqi.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_snc b/tools/kerneldoc/subsys/Doxyfile-dev_snc deleted file mode 100644 index 98127df9e11a..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-dev_snc +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.5.2 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel SNC device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_snc/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/snc/ \ - $(NOTREVIEWED) - -GENERATE_TAGFILE = dev_snc/dev_snc.tag - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_stg b/tools/kerneldoc/subsys/Doxyfile-dev_stg deleted file mode 100644 index f42ff478e337..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-dev_stg +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.5.2 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel STG device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_stg/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/stg/ \ - $(NOTREVIEWED) - -GENERATE_TAGFILE = dev_stg/dev_stg.tag - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_streams b/tools/kerneldoc/subsys/Doxyfile-dev_streams deleted file mode 100644 index 635969cab332..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-dev_streams +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.5.2 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel STREAMS device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_streams/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/streams/ \ - $(NOTREVIEWED) - -GENERATE_TAGFILE = dev_streams/dev_streams.tag - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_tcp_log b/tools/kerneldoc/subsys/Doxyfile-dev_tcp_log new file mode 100644 index 000000000000..044182d54f84 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_tcp_log @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel tcp_log device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_tcp_log/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/tcp_log/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_tcp_log/dev_tcp_log.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_terasic b/tools/kerneldoc/subsys/Doxyfile-dev_terasic new file mode 100644 index 000000000000..fcbc10ef42fe --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_terasic @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel terasic device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_terasic/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/terasic/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_terasic/dev_terasic.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_utopia b/tools/kerneldoc/subsys/Doxyfile-dev_utopia deleted file mode 100644 index 07dd1df786c5..000000000000 --- a/tools/kerneldoc/subsys/Doxyfile-dev_utopia +++ /dev/null @@ -1,21 +0,0 @@ -# Doxyfile 1.5.2 - -# $FreeBSD$ - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel UTOPIA device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_utopia/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/utopia/ \ - $(NOTREVIEWED) - -GENERATE_TAGFILE = dev_utopia/dev_utopia.tag - -@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) -@INCLUDE = common-Doxyfile - diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_veriexec b/tools/kerneldoc/subsys/Doxyfile-dev_veriexec new file mode 100644 index 000000000000..adc0e41374d2 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_veriexec @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel veriexec device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_veriexec/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/veriexec/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_veriexec/dev_veriexec.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_viapm b/tools/kerneldoc/subsys/Doxyfile-dev_viapm new file mode 100644 index 000000000000..c640452f5220 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_viapm @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel viapm device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_viapm/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/viapm/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_viapm/dev_viapm.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_videomode b/tools/kerneldoc/subsys/Doxyfile-dev_videomode new file mode 100644 index 000000000000..7c6eec454e68 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_videomode @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel videomode device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_videomode/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/videomode/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_videomode/dev_videomode.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_vmware b/tools/kerneldoc/subsys/Doxyfile-dev_vmware new file mode 100644 index 000000000000..fc77b0cf80ca --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_vmware @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel vmware device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_vmware/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/vmware/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_vmware/dev_vmware.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_vnic b/tools/kerneldoc/subsys/Doxyfile-dev_vnic new file mode 100644 index 000000000000..a41df5263450 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_vnic @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel vnic device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_vnic/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/vnic/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_vnic/dev_vnic.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_en b/tools/kerneldoc/subsys/Doxyfile-dev_vt similarity index 75% rename from tools/kerneldoc/subsys/Doxyfile-dev_en rename to tools/kerneldoc/subsys/Doxyfile-dev_vt index 647f3eb68a3a..48eae34d1a2b 100644 --- a/tools/kerneldoc/subsys/Doxyfile-dev_en +++ b/tools/kerneldoc/subsys/Doxyfile-dev_vt @@ -5,16 +5,16 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel EN device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_en/ +PROJECT_NAME = "FreeBSD kernel vt device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_vt/ EXTRACT_ALL = YES # for undocumented src, no warnings enabled #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/en/ \ +INPUT = $(DOXYGEN_SRC_PATH)/dev/vt/ \ $(NOTREVIEWED) -GENERATE_TAGFILE = dev_en/dev_en.tag +GENERATE_TAGFILE = dev_vt/dev_vt.tag @INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) @INCLUDE = common-Doxyfile diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_wbwd b/tools/kerneldoc/subsys/Doxyfile-dev_wbwd new file mode 100644 index 000000000000..ec855581cb6b --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_wbwd @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel wbwd device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_wbwd/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/wbwd/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_wbwd/dev_wbwd.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_xdma b/tools/kerneldoc/subsys/Doxyfile-dev_xdma new file mode 100644 index 000000000000..f394ac7eb635 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_xdma @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel xdma device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_xdma/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/xdma/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_xdma/dev_xdma.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_xilinx b/tools/kerneldoc/subsys/Doxyfile-dev_xilinx new file mode 100644 index 000000000000..3b863fd5bd55 --- /dev/null +++ b/tools/kerneldoc/subsys/Doxyfile-dev_xilinx @@ -0,0 +1,21 @@ +# Doxyfile 1.5.2 + +# $FreeBSD$ + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "FreeBSD kernel xilinx device code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_xilinx/ +EXTRACT_ALL = YES # for undocumented src, no warnings enabled +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = $(DOXYGEN_SRC_PATH)/dev/xilinx/ \ + $(NOTREVIEWED) + +GENERATE_TAGFILE = dev_xilinx/dev_xilinx.tag + +@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) +@INCLUDE = common-Doxyfile + diff --git a/tools/kerneldoc/subsys/Doxyfile-dev_ie b/tools/kerneldoc/subsys/Doxyfile-xen similarity index 61% rename from tools/kerneldoc/subsys/Doxyfile-dev_ie rename to tools/kerneldoc/subsys/Doxyfile-xen index 422050e5de42..51b59f7003f5 100644 --- a/tools/kerneldoc/subsys/Doxyfile-dev_ie +++ b/tools/kerneldoc/subsys/Doxyfile-xen @@ -5,16 +5,15 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "FreeBSD kernel IE device code" -OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_ie/ -EXTRACT_ALL = YES # for undocumented src, no warnings enabled +PROJECT_NAME = "FreeBSD xen subsystem code" +OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/xen/ +EXTRACT_ALL = NO #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = $(DOXYGEN_SRC_PATH)/dev/ie/ \ - $(NOTREVIEWED) +INPUT = $(DOXYGEN_SRC_PATH)/xen/ -GENERATE_TAGFILE = dev_ie/dev_ie.tag +GENERATE_TAGFILE = xen/xen.tag @INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH) @INCLUDE = common-Doxyfile From 71bc4af6edda147f6272a5c525c213d36ce7d9ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20E=C3=9Fer?= Date: Sat, 26 Jan 2019 20:43:28 +0000 Subject: [PATCH 096/142] Fix potential buffer overflow and undefined behavior. The buffer allocated in read_chat() could be 1 element too short, if the chatstr parameter passed in is 1 or 3 charachters long (e.g. "a" or "a b"). The allocation of the pointer array does not account for the terminating NULL pointer in that case. Overlapping source and destination strings are undefined in strcpy(). Instead of moving a string to the left by one character just increment the char pointer before it is assigned to the results array. MFC after: 2 weeks --- libexec/getty/chat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libexec/getty/chat.c b/libexec/getty/chat.c index a65d9b243efe..0f2def37b028 100644 --- a/libexec/getty/chat.c +++ b/libexec/getty/chat.c @@ -141,7 +141,7 @@ read_chat(char **chatstr) int l; if ((l=strlen(str)) > 0 && (tmp=malloc(l + 1)) != NULL && - (res=malloc((l / 2 + 1) * sizeof(char *))) != NULL) { + (res=malloc(((l + 1) / 2 + 1) * sizeof(char *))) != NULL) { static char ws[] = " \t"; char * p; @@ -216,7 +216,7 @@ read_chat(char **chatstr) q = strrchr(p+1, *p); if (q != NULL && *q == *p && q[1] == '\0') { *q = '\0'; - strcpy(p, p+1); + p++; } } From 4268f3b3e0d87bc090b7fe0f95fb52a2e904db25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20E=C3=9Fer?= Date: Sat, 26 Jan 2019 21:30:26 +0000 Subject: [PATCH 097/142] Silence Clang Scan warning about potentially unsafe use of strcpy. While this is a false positive, the use of strdup() simplifies the code. MFC after: 2 weeks --- lib/libfigpar/string_m.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/libfigpar/string_m.c b/lib/libfigpar/string_m.c index d358e90488d7..c991aebb4a57 100644 --- a/lib/libfigpar/string_m.c +++ b/lib/libfigpar/string_m.c @@ -119,10 +119,9 @@ replaceall(char *source, const char *find, const char *replace) /* If replace is longer than find, we'll need to create a temp copy */ if (rlen > flen) { - temp = malloc(slen + 1); - if (errno != 0) /* could not allocate memory */ + temp = strdup(source); + if (temp == NULL) /* could not allocate memory */ return (-1); - strcpy(temp, source); } else temp = source; From 3db348b54a93de22271e7c83f11e24abe228f6ba Mon Sep 17 00:00:00 2001 From: Marius Strobl Date: Sat, 26 Jan 2019 21:35:51 +0000 Subject: [PATCH 098/142] - In _iflib_fl_refill(), don't mark an RX buffer as available in the corresponding bitmap before adding an mbuf has actually succeeded. Previously, m_gethdr(M_NOWAIT, ...) failing caused a "hole" in the RX ring but not in its bitmap. One implication of such a hole was that in a subsequent call to _iflib_fl_refill() with the RX buffer accounting still indicating another reclaimable buffer, bit_ffc(3) nevertheless returned -1 in frag_idx which in turn caused havoc when used as an index. Thus, additionally assert that frag_idx is 0 or greater. Another possible consequence of a hole in the RX ring was a NULL- dereference when trying to use the unallocated mbuf, for example in iflib_rxd_pkt_get(). While at it, make the variable declarations in _iflib_fl_refill() conform to style(9) and remove redundant checks already performed by bit_ffc{,_at}(3). - In iflib_queues_alloc(), don't pass redundant M_ZERO to bit_alloc(3). Reported and tested by: pho --- sys/net/iflib.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 36adccc51670..f02b94de0ece 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -1921,27 +1921,27 @@ _rxq_refill_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) static void _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) { - struct mbuf *m; - int idx, frag_idx = fl->ifl_fragidx; - int pidx = fl->ifl_pidx; - caddr_t cl, *sd_cl; - struct mbuf **sd_m; struct if_rxd_update iru; struct rxq_refill_cb_arg cb_arg; + struct mbuf *m; + caddr_t cl, *sd_cl; + struct mbuf **sd_m; bus_dmamap_t *sd_map; - int n, i = 0; bus_addr_t bus_addr, *sd_ba; - int err; + int err, frag_idx, i, idx, n, pidx; qidx_t credits; sd_m = fl->ifl_sds.ifsd_m; sd_map = fl->ifl_sds.ifsd_map; sd_cl = fl->ifl_sds.ifsd_cl; sd_ba = fl->ifl_sds.ifsd_ba; + pidx = fl->ifl_pidx; idx = pidx; + frag_idx = fl->ifl_fragidx; credits = fl->ifl_credits; - n = count; + i = 0; + n = count; MPASS(n > 0); MPASS(credits + n <= fl->ifl_size); @@ -1963,9 +1963,11 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) * * If the cluster is still set then we know a minimum sized packet was received */ - bit_ffc_at(fl->ifl_rx_bitmap, frag_idx, fl->ifl_size, &frag_idx); - if ((frag_idx < 0) || (frag_idx >= fl->ifl_size)) - bit_ffc(fl->ifl_rx_bitmap, fl->ifl_size, &frag_idx); + bit_ffc_at(fl->ifl_rx_bitmap, frag_idx, fl->ifl_size, + &frag_idx); + if (frag_idx < 0) + bit_ffc(fl->ifl_rx_bitmap, fl->ifl_size, &frag_idx); + MPASS(frag_idx >= 0); if ((cl = sd_cl[frag_idx]) == NULL) { if ((cl = m_cljget(NULL, M_NOWAIT, fl->ifl_buf_size)) == NULL) break; @@ -1995,12 +1997,12 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) bus_addr = sd_ba[frag_idx]; } - bit_set(fl->ifl_rx_bitmap, frag_idx); MPASS(sd_m[frag_idx] == NULL); if ((m = m_gethdr(M_NOWAIT, MT_NOINIT)) == NULL) { break; } sd_m[frag_idx] = m; + bit_set(fl->ifl_rx_bitmap, frag_idx); #if MEMORY_LOGGING fl->ifl_m_enqueued++; #endif @@ -2025,7 +2027,6 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) fl->ifl_pidx = idx; fl->ifl_credits = credits; } - } if (i) { @@ -4896,7 +4897,6 @@ iflib_device_deregister(if_ctx_t ctx) for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) free(fl->ifl_rx_bitmap, M_IFLIB); - } tqg = qgroup_if_config_tqg; if (ctx->ifc_admin_task.gt_uniq != NULL) @@ -5304,7 +5304,8 @@ iflib_queues_alloc(if_ctx_t ctx) } for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) - fl->ifl_rx_bitmap = bit_alloc(fl->ifl_size, M_IFLIB, M_WAITOK|M_ZERO); + fl->ifl_rx_bitmap = bit_alloc(fl->ifl_size, M_IFLIB, + M_WAITOK); } /* TXQs */ From 59ba78ccae74a8a116e4784b4edb840dae61610d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20E=C3=9Fer?= Date: Sat, 26 Jan 2019 22:24:15 +0000 Subject: [PATCH 099/142] Slightly improve previous commit that silenced a Clang Scan warning. The strdup() call does not take advantage of the known length of the source string. Replace by malloc() and memcpy() utilizimng the pre- calculated string length. Submitted by: cperciva Reported by: rgrimes MFC after: 2 weeks --- lib/libfigpar/string_m.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libfigpar/string_m.c b/lib/libfigpar/string_m.c index c991aebb4a57..158774143ec3 100644 --- a/lib/libfigpar/string_m.c +++ b/lib/libfigpar/string_m.c @@ -119,9 +119,10 @@ replaceall(char *source, const char *find, const char *replace) /* If replace is longer than find, we'll need to create a temp copy */ if (rlen > flen) { - temp = strdup(source); + temp = malloc(slen + 1); if (temp == NULL) /* could not allocate memory */ return (-1); + memcpy(temp, source, slen + 1); } else temp = source; From cd29c58eae881e96a4b9f5349daa35c812aefc68 Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Sat, 26 Jan 2019 22:27:12 +0000 Subject: [PATCH 100/142] Update tunefs and newfs error messages for the -L (volume label) option to note that underscores are valid. PR: 235182 Reported by: Rodney W. Grimes (rgrimes@) Sponsored by: Netflix --- sbin/newfs/newfs.c | 3 ++- sbin/tunefs/tunefs.c | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 472b740d385b..3c5d4fa08ca1 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -155,7 +155,8 @@ main(int argc, char *argv[]) while (isalnum(volumelabel[++i]) || volumelabel[i] == '_'); if (volumelabel[i] != '\0') { - errx(1, "bad volume label. Valid characters are alphanumerics."); + errx(1, "bad volume label. Valid characters " + "are alphanumerics and underscores."); } if (strlen(volumelabel) >= MAXVOLLEN) { errx(1, "bad volume label. Length is longer than %d.", diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c index 0bd5f314f4b6..d1f1c36cf787 100644 --- a/sbin/tunefs/tunefs.c +++ b/sbin/tunefs/tunefs.c @@ -191,9 +191,8 @@ main(int argc, char *argv[]) i = -1; while (isalnum(Lvalue[++i]) || Lvalue[i] == '_'); if (Lvalue[i] != '\0') { - errx(10, - "bad %s. Valid characters are alphanumerics.", - name); + errx(10, "bad %s. Valid characters are " + "alphanumerics and underscores.", name); } if (strlen(Lvalue) >= MAXVOLLEN) { errx(10, "bad %s. Length is longer than %d.", From 8b40aab156eb4b8bde73210f1cda8c27322f84d6 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sun, 27 Jan 2019 00:37:52 +0000 Subject: [PATCH 101/142] Remove now redundand ifunc relocation code which should have been removed as part of r341441. This call to reloc_non_plt() may crash if ifunc resolvers use the needed libraries symbols since the pass over the needed libs relocation is not yet done. The change in r341441 ensures the right relocation order otherwise. Submitted by: theraven MFC after: 1 week Discussed in: https://reviews.freebsd.org/D17529 --- libexec/rtld-elf/rtld.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 1a2a0089bb7a..163e107a91a3 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -2897,16 +2897,6 @@ relocate_object(Obj_Entry *obj, bool bind_now, Obj_Entry *rtldobj, lockstate) == -1) return (-1); - /* - * Process the non-PLT IFUNC relocations. The relocations are - * processed in two phases, because IFUNC resolvers may - * reference other symbols, which must be readily processed - * before resolvers are called. - */ - if (obj->non_plt_gnu_ifunc && - reloc_non_plt(obj, rtldobj, flags | SYMLOOK_IFUNC, lockstate)) - return (-1); - if (!obj->mainprog && obj_enforce_relro(obj) == -1) return (-1); From e5ac30498922cdacefdeabb9cd2dd3d7d3024cd6 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sun, 27 Jan 2019 00:46:06 +0000 Subject: [PATCH 102/142] Bump SPECNAMELEN to MAXNAMLEN. This includes the bump for cdevsw d_version. Otherwise, the impact on the ABI (not KBI) is surprisingly low. The most important affected interface is devname(3) and ttyname(3) which already correctly handle long names (and ttyname(3) should not be affected at all). Still, due to the d_version bump, I argue that the change is not MFC-able. Requested by: mmacy Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D18932 --- lib/libprocstat/Symbol.map | 5 +- lib/libprocstat/libprocstat_compat.c | 88 ++++++++++++++++++++++++++-- sys/kern/kern_conf.c | 2 +- sys/sys/conf.h | 3 +- sys/sys/param.h | 4 +- 5 files changed, 91 insertions(+), 11 deletions(-) diff --git a/lib/libprocstat/Symbol.map b/lib/libprocstat/Symbol.map index 31f19d02d724..cea784900536 100644 --- a/lib/libprocstat/Symbol.map +++ b/lib/libprocstat/Symbol.map @@ -35,9 +35,12 @@ FBSD_1.3 { FBSD_1.5 { procstat_freeptlwpinfo; procstat_getptlwpinfo; - procstat_get_pts_info; procstat_get_sem_info; procstat_get_shm_info; procstat_get_socket_info; +}; + +FBSD_1.6 { + procstat_get_pts_info; procstat_get_vnode_info; }; diff --git a/lib/libprocstat/libprocstat_compat.c b/lib/libprocstat/libprocstat_compat.c index 3b867e4cbe2f..580f2c89794f 100644 --- a/lib/libprocstat/libprocstat_compat.c +++ b/lib/libprocstat/libprocstat_compat.c @@ -36,9 +36,11 @@ __FBSDID("$FreeBSD$"); #include "libprocstat.h" +#define SPECNAMELEN_COMPAT12 63 + struct freebsd11_ptsstat { uint32_t dev; - char devname[SPECNAMELEN + 1]; + char devname[SPECNAMELEN_COMPAT12 + 1]; }; struct freebsd11_vnstat { @@ -49,7 +51,7 @@ struct freebsd11_vnstat { uint32_t vn_fsid; int vn_type; uint16_t vn_mode; - char vn_devname[SPECNAMELEN + 1]; + char vn_devname[SPECNAMELEN_COMPAT12 + 1]; }; struct freebsd11_semstat { uint32_t value; @@ -75,8 +77,25 @@ struct freebsd11_sockstat { char dname[32]; }; +struct freebsd12_vnstat { + uint64_t vn_fileid; + uint64_t vn_size; + uint64_t vn_dev; + uint64_t vn_fsid; + char *vn_mntdir; + int vn_type; + uint16_t vn_mode; + char vn_devname[SPECNAMELEN_COMPAT12 + 1]; +}; +struct freebsd12_ptsstat { + uint64_t dev; + char devname[SPECNAMELEN_COMPAT12 + 1]; +}; + int freebsd11_procstat_get_pts_info(struct procstat *procstat, struct filestat *fst, struct freebsd11_ptsstat *pts, char *errbuf); +int freebsd12_procstat_get_pts_info(struct procstat *procstat, + struct filestat *fst, struct freebsd12_ptsstat *pts_compat, char *errbuf); int freebsd11_procstat_get_sem_info(struct procstat *procstat, struct filestat *fst, struct freebsd11_semstat *sem, char *errbuf); int freebsd11_procstat_get_shm_info(struct procstat *procstat, @@ -85,6 +104,10 @@ int freebsd11_procstat_get_socket_info(struct procstat *procstat, struct filestat *fst, struct freebsd11_sockstat *sock, char *errbuf); int freebsd11_procstat_get_vnode_info(struct procstat *procstat, struct filestat *fst, struct freebsd11_vnstat *vn, char *errbuf); +int freebsd12_procstat_get_vnode_info(struct procstat *procstat, + struct filestat *fst, struct freebsd12_vnstat *vn_compat, char *errbuf); + +static const char trunc_name[] = ""; int freebsd11_procstat_get_pts_info(struct procstat *procstat, @@ -97,8 +120,30 @@ freebsd11_procstat_get_pts_info(struct procstat *procstat, if (r != 0) return (r); pts_compat->dev = pts.dev; - memcpy(pts_compat->devname, pts.devname, - sizeof(pts_compat->devname)); + if (strlen(pts.devname) >= sizeof(pts_compat->devname)) + strcpy(pts_compat->devname, trunc_name); + else + memcpy(pts_compat->devname, pts.devname, + sizeof(pts_compat->devname)); + return (0); +} + +int +freebsd12_procstat_get_pts_info(struct procstat *procstat, + struct filestat *fst, struct freebsd12_ptsstat *pts_compat, char *errbuf) +{ + struct ptsstat pts; + int r; + + r = procstat_get_pts_info(procstat, fst, &pts, errbuf); + if (r != 0) + return (r); + pts_compat->dev = pts.dev; + if (strlen(pts.devname) >= sizeof(pts_compat->devname)) + strcpy(pts_compat->devname, trunc_name); + else + memcpy(pts_compat->devname, pts.devname, + sizeof(pts_compat->devname)); return (0); } @@ -174,8 +219,36 @@ freebsd11_procstat_get_vnode_info(struct procstat *procstat, vn_compat->vn_fsid = vn.vn_fsid; vn_compat->vn_type = vn.vn_type; vn_compat->vn_mode = vn.vn_mode; - memcpy(vn_compat->vn_devname, vn.vn_devname, - sizeof(vn_compat->vn_devname)); + if (strlen(vn.vn_devname) >= sizeof(vn_compat->vn_devname)) + strcpy(vn_compat->vn_devname, trunc_name); + else + memcpy(vn_compat->vn_devname, vn.vn_devname, + sizeof(vn_compat->vn_devname)); + return (0); +} + +int +freebsd12_procstat_get_vnode_info(struct procstat *procstat, + struct filestat *fst, struct freebsd12_vnstat *vn_compat, char *errbuf) +{ + struct vnstat vn; + int r; + + r = procstat_get_vnode_info(procstat, fst, &vn, errbuf); + if (r != 0) + return (r); + vn_compat->vn_fileid = vn.vn_fileid; + vn_compat->vn_size = vn.vn_size; + vn_compat->vn_mntdir = vn.vn_mntdir; + vn_compat->vn_dev = vn.vn_dev; + vn_compat->vn_fsid = vn.vn_fsid; + vn_compat->vn_type = vn.vn_type; + vn_compat->vn_mode = vn.vn_mode; + if (strlen(vn.vn_devname) >= sizeof(vn_compat->vn_devname)) + strcpy(vn_compat->vn_devname, trunc_name); + else + memcpy(vn_compat->vn_devname, vn.vn_devname, + sizeof(vn_compat->vn_devname)); return (0); } @@ -186,3 +259,6 @@ __sym_compat(procstat_get_vnode_info, freebsd11_procstat_get_vnode_info, FBSD_1.2); __sym_compat(procstat_get_sem_info, freebsd11_procstat_get_sem_info, FBSD_1.3); __sym_compat(procstat_get_shm_info, freebsd11_procstat_get_shm_info, FBSD_1.3); +__sym_compat(procstat_get_pts_info, freebsd12_procstat_get_pts_info, FBSD_1.5); +__sym_compat(procstat_get_vnode_info, freebsd12_procstat_get_vnode_info, + FBSD_1.5); diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 5c2c485ae7a8..8fc1b0930096 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -630,7 +630,7 @@ prep_cdevsw(struct cdevsw *devsw, int flags) return (0); } - if (devsw->d_version != D_VERSION_03) { + if (devsw->d_version != D_VERSION_04) { printf( "WARNING: Device driver \"%s\" has wrong version %s\n", devsw->d_name == NULL ? "???" : devsw->d_name, diff --git a/sys/sys/conf.h b/sys/sys/conf.h index 190562c6ef47..1e004ebebcef 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -166,7 +166,8 @@ typedef int dumper_hdr_t(struct dumperinfo *di, struct kerneldumpheader *kdh, #define D_VERSION_01 0x17032005 /* Add d_uid,gid,mode & kind */ #define D_VERSION_02 0x28042009 /* Add d_mmap_single */ #define D_VERSION_03 0x17122009 /* d_mmap takes memattr,vm_ooffset_t */ -#define D_VERSION D_VERSION_03 +#define D_VERSION_04 0x5c48c353 /* SPECNAMELEN bumped to MAXNAMLEN */ +#define D_VERSION D_VERSION_04 /* * Flags used for internal housekeeping diff --git a/sys/sys/param.h b/sys/sys/param.h index 291e54da8b7a..07b113f2747a 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300009 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300010 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, @@ -115,7 +115,7 @@ #define NOFILE OPEN_MAX /* max open files per process */ #define NOGROUP 65535 /* marker for empty group set member */ #define MAXHOSTNAMELEN 256 /* max hostname size */ -#define SPECNAMELEN 63 /* max length of devicename */ +#define SPECNAMELEN 255 /* max length of devicename */ /* More types and definitions used throughout the kernel. */ #ifdef _KERNEL From 60f4a175c58b4afb2d01068471064d25e2ed7629 Mon Sep 17 00:00:00 2001 From: Cy Schubert Date: Sun, 27 Jan 2019 02:31:42 +0000 Subject: [PATCH 103/142] Fix a typo. MFC after: 3 days --- contrib/ipfilter/man/ipnat.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/ipfilter/man/ipnat.5 b/contrib/ipfilter/man/ipnat.5 index 69163fc14407..ab56573d79ea 100644 --- a/contrib/ipfilter/man/ipnat.5 +++ b/contrib/ipfilter/man/ipnat.5 @@ -104,7 +104,7 @@ map le0 10.0.0.0/8 -> 192.168.55.0/24 portmap tcp/udp auto In this instance, the word "auto" tells IPFilter to calculate a private range of port numbers for each address on the LHS to use without fear of them being trampled by others. This can lead to problems if there are -connections being generated mire quickly than IPFilter can expire them. +connections being generated more quickly than IPFilter can expire them. In this instance, and if we want to get away from a private range of port numbers, we can say: .nf From c188c336f34cb4274ceec0d89aef0d5a99fb8c63 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Sun, 27 Jan 2019 15:10:20 +0000 Subject: [PATCH 104/142] wlan.4: improve wording PR: 218075 Submitted by: Aaron Taylor MFC after: 5 days --- share/man/man4/wlan.4 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/share/man/man4/wlan.4 b/share/man/man4/wlan.4 index 4d29bca5d084..f4384ccef4fa 100644 --- a/share/man/man4/wlan.4 +++ b/share/man/man4/wlan.4 @@ -167,9 +167,8 @@ was used to be compatible with .Pp Mesh stations follow the 802.11s Draft 3.0 specification which is not ratified and subject to change. -Beware that this specification is incompatible with earlier drafts; -and stations implementing earlier drafts (e.g. Linux) -may not interoperate. +Be aware that this specification is incompatible with earlier drafts. +Stations implementing earlier drafts (e.g., Linux) may be incompatible. .Sh SEE ALSO .Xr an 4 , .Xr ath 4 , From 21b56f292068e330cd16e01bd6aeffee496c7b61 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Sun, 27 Jan 2019 15:19:28 +0000 Subject: [PATCH 105/142] pcf(4): fix parentheses in if condition PR: 210709 Submitted by: David Binderman MFC after: 5 days --- sys/dev/pcf/pcf_isa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/pcf/pcf_isa.c b/sys/dev/pcf/pcf_isa.c index d2ba419ca658..ed345349c5c0 100644 --- a/sys/dev/pcf/pcf_isa.c +++ b/sys/dev/pcf/pcf_isa.c @@ -111,7 +111,7 @@ pcf_isa_probe(device_t dev) /* The port address must be explicitly specified */ bus_get_resource(dev, SYS_RES_IOPORT, rid, &start, &count); - if ((error = resource_int_value(PCF_NAME, 0, "port", &port) != 0)) + if ((error = resource_int_value(PCF_NAME, 0, "port", &port)) != 0) return (error); /* Probe is only successful for the specified base io */ From bbf61f79ce21ae6526a124321e76d14893f262c2 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Sun, 27 Jan 2019 15:29:58 +0000 Subject: [PATCH 106/142] devd.conf(5): simplify regex Submitted by: Helge Oldach MFC after: 5 days --- sbin/devd/devd.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/devd/devd.conf b/sbin/devd/devd.conf index 572e53714268..1af5334b152e 100644 --- a/sbin/devd/devd.conf +++ b/sbin/devd/devd.conf @@ -43,7 +43,7 @@ options { # notify 0 { match "system" "IFNET"; - match "subsystem" "(?!usbus[0-9]+|?!wlan[0-9]+)"; + match "subsystem" "!(usbus|wlan)[0-9]+"; match "type" "ATTACH"; action "/etc/pccard_ether $subsystem start"; }; From 1289ca623ec4fba58b2b870d09823bc53d88e54c Mon Sep 17 00:00:00 2001 From: Michal Meloun Date: Sun, 27 Jan 2019 15:50:36 +0000 Subject: [PATCH 107/142] Properly define and declare phynode_topo_lock, it should be single global variable. X-MFC with: r340845 Noticed by: phynode_topo_lock --- sys/dev/extres/phy/phy.c | 2 +- sys/dev/extres/phy/phy_internal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/extres/phy/phy.c b/sys/dev/extres/phy/phy.c index ab0929036c57..ac1feebf0425 100644 --- a/sys/dev/extres/phy/phy.c +++ b/sys/dev/extres/phy/phy.c @@ -68,7 +68,7 @@ static phynode_method_t phynode_methods[] = { DEFINE_CLASS_0(phynode, phynode_class, phynode_methods, 0); static phynode_list_t phynode_list = TAILQ_HEAD_INITIALIZER(phynode_list); - +struct sx phynode_topo_lock; SX_SYSINIT(phy_topology, &phynode_topo_lock, "Phy topology lock"); /* ---------------------------------------------------------------------------- diff --git a/sys/dev/extres/phy/phy_internal.h b/sys/dev/extres/phy/phy_internal.h index c2b985d68406..c4979a1dc739 100644 --- a/sys/dev/extres/phy/phy_internal.h +++ b/sys/dev/extres/phy/phy_internal.h @@ -78,6 +78,6 @@ struct phy { #define PHYNODE_XLOCK(_sc) sx_xlock(&((_sc)->lock)) #define PHYNODE_UNLOCK(_sc) sx_unlock(&((_sc)->lock)) -struct sx phynode_topo_lock; +extern struct sx phynode_topo_lock; #endif /* DEV_EXTRES_PHY_INTERNAL_H */ From 1a7c1b2cbc9484c77d88b5c7af69907dcb6a678c Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Sun, 27 Jan 2019 15:55:31 +0000 Subject: [PATCH 108/142] rc(8): do not stop dhclient(8) when wpa_supplicant(8) / hostapd(8) is used They will stop it automatically ('Interface wlan0 is down, dhclient exiting'); use /etc/rc.d/dhclient stop command only when none of them is used. MFC after: 5 days --- libexec/rc/network.subr | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libexec/rc/network.subr b/libexec/rc/network.subr index e4628df3a863..e3e1a2ffbbdc 100644 --- a/libexec/rc/network.subr +++ b/libexec/rc/network.subr @@ -257,9 +257,7 @@ ifconfig_down() elif hostapif $1; then /etc/rc.d/hostapd stop $1 _cfg=0 - fi - - if dhcpif $1; then + elif dhcpif $1; then /etc/rc.d/dhclient stop $1 _cfg=0 fi From 58c43838f704883e0bb4a71522a8960ca961ce02 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Sun, 27 Jan 2019 16:44:27 +0000 Subject: [PATCH 109/142] m_getm2: correct a comment. The comment states that function always return a top of allocated mbuf; however, the function actually return the overall mbuf chain top pointer. Since there are already existing users of it (via m_getm(4) macro), rephrase the comment and leave behavior unchanged. PR: 134335 MFC after: 12 days --- sys/kern/kern_mbuf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index af1fe9e5de04..9339590be7ec 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -1031,8 +1031,7 @@ m_getjcl(int how, short type, int flags, int size) * Allocate a given length worth of mbufs and/or clusters (whatever fits * best) and return a pointer to the top of the allocated chain. If an * existing mbuf chain is provided, then we will append the new chain - * to the existing one but still return the top of the newly allocated - * chain. + * to the existing one and return a pointer to the provided mbuf. */ struct mbuf * m_getm2(struct mbuf *m, int len, int how, short type, int flags) From 4dafe01e7d26de64904ff679522ac7638a1293b0 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Sun, 27 Jan 2019 17:51:49 +0000 Subject: [PATCH 110/142] Add NO_6_BYTE / NO_SYNC_CACHE quirks for (C|D|E).* Olympus digital cameras PR: 97472 Submitted by: Fabio Luis Girardi Reviewed by: imp MFC after: 3 weeks --- sys/cam/scsi/scsi_da.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index b9f2ca850e9e..a3160d613979 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -1090,6 +1090,30 @@ static struct da_quirk_entry da_quirk_table[] = { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "???PVT*", "*" }, /*quirks*/DA_Q_4K }, + { + /* + * Olympus digital cameras (C-3040ZOOM, C-2040ZOOM, C-1) + * PR: usb/97472 + */ + { T_DIRECT, SIP_MEDIA_REMOVABLE, "OLYMPUS", "C*", "*"}, + /*quirks*/ DA_Q_NO_6_BYTE | DA_Q_NO_SYNC_CACHE + }, + { + /* + * Olympus digital cameras (D-370) + * PR: usb/97472 + */ + { T_DIRECT, SIP_MEDIA_REMOVABLE, "OLYMPUS", "D*", "*"}, + /*quirks*/ DA_Q_NO_6_BYTE + }, + { + /* + * Olympus digital cameras (E-100RS, E-10). + * PR: usb/97472 + */ + { T_DIRECT, SIP_MEDIA_REMOVABLE, "OLYMPUS", "E*", "*"}, + /*quirks*/ DA_Q_NO_6_BYTE | DA_Q_NO_SYNC_CACHE + }, { /* * Olympus FE-210 camera From 31f53eaa40ce70ff62715fab7f90d97ca0c2f5c8 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Sun, 27 Jan 2019 18:53:36 +0000 Subject: [PATCH 111/142] Remove RADIUS-related files when WITHOUT_RADIUS_SUPPORT=true is set in src.conf(5) PR: 234041 MFC after: 5 days --- tools/build/mk/OptionalObsoleteFiles.inc | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 58a22ea55669..4ab781e42cc4 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -7647,6 +7647,54 @@ OLD_FILES+=usr/share/man/man8/quotaon.8.gz OLD_FILES+=usr/share/man/man8/repquota.8.gz .endif +.if ${MK_RADIUS_SUPPORT} == no +OLD_FILES+=usr/lib/libradius.a +OLD_FILES+=usr/lib/libradius.so +OLD_LIBS+=usr/lib/libradius.so.4 +OLD_FILES+=usr/lib/libradius_p.a +OLD_FILES+=usr/lib/pam_radius.so +OLD_LIBS+=usr/lib/pam_radius.so.6 +OLD_FILES+=usr/include/radlib.h +OLD_FILES+=usr/include/radlib_vs.h +OLD_FILES+=usr/share/man/man3/libradius.3.gz +OLD_FILES+=usr/share/man/man3/rad_acct_open.3.gz +OLD_FILES+=usr/share/man/man3/rad_add_server.3.gz +OLD_FILES+=usr/share/man/man3/rad_add_server_ex.3.gz +OLD_FILES+=usr/share/man/man3/rad_auth_open.3.gz +OLD_FILES+=usr/share/man/man3/rad_bind_to.3.gz +OLD_FILES+=usr/share/man/man3/rad_close.3.gz +OLD_FILES+=usr/share/man/man3/rad_config.3.gz +OLD_FILES+=usr/share/man/man3/rad_continue_send_request.3.gz +OLD_FILES+=usr/share/man/man3/rad_create_request.3.gz +OLD_FILES+=usr/share/man/man3/rad_create_response.3.gz +OLD_FILES+=usr/share/man/man3/rad_cvt_addr.3.gz +OLD_FILES+=usr/share/man/man3/rad_cvt_int.3.gz +OLD_FILES+=usr/share/man/man3/rad_cvt_string.3.gz +OLD_FILES+=usr/share/man/man3/rad_demangle.3.gz +OLD_FILES+=usr/share/man/man3/rad_demangle_mppe_key.3.gz +OLD_FILES+=usr/share/man/man3/rad_get_attr.3.gz +OLD_FILES+=usr/share/man/man3/rad_get_vendor_attr.3.gz +OLD_FILES+=usr/share/man/man3/rad_init_send_request.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_addr.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_attr.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_int.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_message_authentic.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_string.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_vendor_addr.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_vendor_attr.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_vendor_int.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_vendor_string.3.gz +OLD_FILES+=usr/share/man/man3/rad_receive_request.3.gz +OLD_FILES+=usr/share/man/man3/rad_request_authenticator.3.gz +OLD_FILES+=usr/share/man/man3/rad_send_request.3.gz +OLD_FILES+=usr/share/man/man3/rad_send_response.3.gz +OLD_FILES+=usr/share/man/man3/rad_server_open.3.gz +OLD_FILES+=usr/share/man/man3/rad_server_secret.3.gz +OLD_FILES+=usr/share/man/man3/rad_strerror.3.gz +OLD_FILES+=usr/share/man/man5/radius.conf.5.gz +OLD_FILES+=usr/share/man/man8/pam_radius.8.gz +.endif + .if ${MK_RBOOTD} == no OLD_FILES+=usr/libexec/rbootd OLD_FILES+=usr/share/man/man8/rbootd.8.gz From f2ef15fec455a662cfda392260d6b2bb08a82066 Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Mon, 28 Jan 2019 02:00:39 +0000 Subject: [PATCH 112/142] Fix whiteout support in find(1) find(1) ignores -type w passed to it. With this patch find(1) properly identifies and prints whiteouts. PR: 126384, 156703 Submitted by: oleg@mamontov.net MFC after: 1 week --- usr.bin/find/find.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.bin/find/find.c b/usr.bin/find/find.c index fd1d39660366..656a7e06204e 100644 --- a/usr.bin/find/find.c +++ b/usr.bin/find/find.c @@ -208,8 +208,10 @@ find_execute(PLAN *plan, char *paths[]) entry->fts_path, strerror(entry->fts_errno)); exitstatus = 1; continue; -#ifdef FTS_W +#if defined(FTS_W) && defined(FTS_WHITEOUT) case FTS_W: + if (ftsoptions & FTS_WHITEOUT) + break; continue; #endif /* FTS_W */ } From 6bda1ad8a279e60ff3684ebae92fffd355aed54b Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Mon, 28 Jan 2019 02:15:41 +0000 Subject: [PATCH 113/142] rtwn_usb(4): add new USB id. Submitted by: Github issue: https://github.com/s3erios/rtwn/issues/4 MFC after: 5 days --- share/man/man4/rtwn_usb.4 | 3 ++- sys/dev/rtwn/usb/rtwn_usb_attach.h | 3 ++- sys/dev/usb/usbdevs | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/share/man/man4/rtwn_usb.4 b/share/man/man4/rtwn_usb.4 index fff4e8a4cfc5..5576b95f89f8 100644 --- a/share/man/man4/rtwn_usb.4 +++ b/share/man/man4/rtwn_usb.4 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd January 2, 2019 +.Dd January 28, 2019 .Dt RTWN_USB 4 .Os .Sh NAME @@ -80,6 +80,7 @@ based USB wireless network adapters, including: .It "Edimax EW-7811Un" Ta RTL8188CUS Ta USB 2.0 .It "Edimax EW-7811UTC" Ta RTL8821AU Ta USB 2.0 .It "Edimax EW-7822UAC" Ta RTL8812AU Ta USB 3.0 +.It "EDUP EP-AC1620" Ta RTL8821AU Ta USB 2.0 .It "Elecom WDC-150SU2M" Ta RTL8188EU Ta USB 2.0 .It "EnGenius EUB1200AC" Ta RTL8812AU Ta USB 3.0 .It "Hawking HD65U" Ta RTL8821AU Ta USB 2.0 diff --git a/sys/dev/rtwn/usb/rtwn_usb_attach.h b/sys/dev/rtwn/usb/rtwn_usb_attach.h index 1b54e5409d2e..a22c39ada643 100644 --- a/sys/dev/rtwn/usb/rtwn_usb_attach.h +++ b/sys/dev/rtwn/usb/rtwn_usb_attach.h @@ -157,7 +157,8 @@ static const STRUCT_USB_HOST_ID rtwn_devs[] = { RTWN_RTL8821AU_DEV(HAWKING, HD65U), RTWN_RTL8821AU_DEV(MELCO, WIU2433DM), RTWN_RTL8821AU_DEV(NETGEAR, A6100), - RTWN_RTL8821AU_DEV(REALTEK, RTL8821AU) + RTWN_RTL8821AU_DEV(REALTEK, RTL8821AU_1), + RTWN_RTL8821AU_DEV(REALTEK, RTL8821AU_2) #undef RTWN_RTL8821AU_DEV }; diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index d57e5087c44b..a63c9d2266ce 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -3954,6 +3954,7 @@ product REALTEK DUMMY 0x0000 Dummy product product REALTEK USB20CRW 0x0158 USB20CRW Card Reader product REALTEK RTL8188ETV 0x0179 RTL8188ETV product REALTEK RTL8188CTV 0x018a RTL8188CTV +product REALTEK RTL8821AU_2 0x0811 RTL8821AU product REALTEK RTL8188RU_2 0x317f RTL8188RU product REALTEK USBKR100 0x8150 USBKR100 USB Ethernet product REALTEK RTL8152 0x8152 RTL8152 USB Ethernet @@ -3984,7 +3985,7 @@ product REALTEK RTL8187B_2 0x8198 RTL8187B Wireless Adapter product REALTEK RTL8712 0x8712 RTL8712 product REALTEK RTL8713 0x8713 RTL8713 product REALTEK RTL8188CU_COMBO 0x8754 RTL8188CU -product REALTEK RTL8821AU 0xa811 RTL8821AU +product REALTEK RTL8821AU_1 0xa811 RTL8821AU product REALTEK RTL8723BU 0xb720 RTL8723BU product REALTEK RTL8192SU 0xc512 RTL8192SU product REALTEK RTL8812AU 0x8812 RTL8812AU Wireless Adapter From 542feeff96df53919c4229ddec5ec4d86c74c734 Mon Sep 17 00:00:00 2001 From: Kristof Provost Date: Mon, 28 Jan 2019 08:36:10 +0000 Subject: [PATCH 114/142] pfctl: Point users to net.pf.request_maxcount if large requests are rejected The kernel will reject very large tables to avoid resource exhaustion attacks. Some users run into this limit with legitimate table configurations. The error message in this case was not very clear: pf.conf:1: cannot define table nets: Invalid argument pfctl: Syntax error in config file: pf rules not loaded If a table definition fails we now check the request_maxcount sysctl, and if we've tried to create more than that point the user at net.pf.request_maxcount: pf.conf:1: cannot define table nets: too many elements. Consider increasing net.pf.request_maxcount. pfctl: Syntax error in config file: pf rules not loaded PR: 235076 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D18909 --- sbin/pfctl/parse.y | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index b0410f452b89..1182dde3b079 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -4743,6 +4743,8 @@ process_tabledef(char *name, struct table_opts *opts) { struct pfr_buffer ab; struct node_tinit *ti; + unsigned long maxcount; + size_t s = sizeof(maxcount); bzero(&ab, sizeof(ab)); ab.pfrb_type = PFRB_ADDRS; @@ -4770,8 +4772,19 @@ process_tabledef(char *name, struct table_opts *opts) if (!(pf->opts & PF_OPT_NOACTION) && pfctl_define_table(name, opts->flags, opts->init_addr, pf->anchor->name, &ab, pf->anchor->ruleset.tticket)) { - yyerror("cannot define table %s: %s", name, - pfr_strerror(errno)); + + if (sysctlbyname("net.pf.request_maxcount", &maxcount, &s, + NULL, 0) == -1) + maxcount = 65535; + + if (ab.pfrb_size > maxcount) + yyerror("cannot define table %s: too many elements.\n" + "Consider increasing net.pf.request_maxcount.", + name); + else + yyerror("cannot define table %s: %s", name, + pfr_strerror(errno)); + goto _error; } pf->tdirty = 1; From 701957cbb6c4195998d9ca4798708c17b8509ca8 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Mon, 28 Jan 2019 11:39:54 +0000 Subject: [PATCH 115/142] rsu(4): do not ignore mgmtrate / mcastrate / ucastrate. Enforce net80211 rates for control / management / multicast / EAPOL frames and allow to override rate for unicast frames via ifconfig(8) 'ucastrate' option; by default it still uses f/w rate adaptation for unicast frames. MFC after: 1 week --- sys/dev/usb/wlan/if_rsu.c | 31 +++++++++++++++++++++++++++++-- sys/dev/usb/wlan/if_rsureg.h | 7 ++++++- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/sys/dev/usb/wlan/if_rsu.c b/sys/dev/usb/wlan/if_rsu.c index 2aa09d83d567..e5245f3c2478 100644 --- a/sys/dev/usb/wlan/if_rsu.c +++ b/sys/dev/usb/wlan/if_rsu.c @@ -2753,15 +2753,17 @@ static int rsu_tx_start(struct rsu_softc *sc, struct ieee80211_node *ni, struct mbuf *m0, struct rsu_data *data) { + const struct ieee80211_txparam *tp = ni->ni_txparms; struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = ni->ni_vap; struct ieee80211_frame *wh; struct ieee80211_key *k = NULL; struct r92s_tx_desc *txd; - uint8_t type, cipher; + uint8_t rate, ridx, type, cipher; int prio = 0; uint8_t which; int hasqos; + int ismcast; int xferlen; int qid; @@ -2769,10 +2771,26 @@ rsu_tx_start(struct rsu_softc *sc, struct ieee80211_node *ni, wh = mtod(m0, struct ieee80211_frame *); type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; + ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1); RSU_DPRINTF(sc, RSU_DEBUG_TX, "%s: data=%p, m=%p\n", __func__, data, m0); + /* Choose a TX rate index. */ + if (type == IEEE80211_FC0_TYPE_MGT || + type == IEEE80211_FC0_TYPE_CTL || + (m0->m_flags & M_EAPOL) != 0) + rate = tp->mgmtrate; + else if (ismcast) + rate = tp->mcastrate; + else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) + rate = tp->ucastrate; + else + rate = 0; + + if (rate != 0) + ridx = rate2ridx(rate); + if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { k = ieee80211_crypto_encap(ni, m0); if (k == NULL) { @@ -2851,8 +2869,17 @@ rsu_tx_start(struct rsu_softc *sc, struct ieee80211_node *ni, } /* XXX todo: set AGGEN bit if appropriate? */ txd->txdw2 |= htole32(R92S_TXDW2_BK); - if (IEEE80211_IS_MULTICAST(wh->i_addr1)) + if (ismcast) txd->txdw2 |= htole32(R92S_TXDW2_BMCAST); + + /* Force mgmt / mcast / ucast rate if needed. */ + if (rate != 0) { + /* Data rate fallback limit (max). */ + txd->txdw5 |= htole32(SM(R92S_TXDW5_DATARATE_FB_LMT, 0x1f)); + txd->txdw5 |= htole32(SM(R92S_TXDW5_DATARATE, ridx)); + txd->txdw4 |= htole32(R92S_TXDW4_DRVRATE); + } + /* * Firmware will use and increment the sequence number for the * specified priority. diff --git a/sys/dev/usb/wlan/if_rsureg.h b/sys/dev/usb/wlan/if_rsureg.h index 973280cf9753..b1cd36ea3f0f 100644 --- a/sys/dev/usb/wlan/if_rsureg.h +++ b/sys/dev/usb/wlan/if_rsureg.h @@ -700,9 +700,14 @@ struct r92s_tx_desc { uint32_t txdw4; #define R92S_TXDW4_TXBW 0x00040000 +#define R92S_TXDW4_DRVRATE 0x80000000 uint32_t txdw5; -#define R92S_TXDW5_DISFB 0x00008000 +#define R92S_TXDW5_DATARATE_M 0x00007e00 +#define R92S_TXDW5_DATARATE_S 9 +#define R92S_TXDW5_DISFB 0x00008000 +#define R92S_TXDW5_DATARATE_FB_LMT_M 0x001f0000 +#define R92S_TXDW5_DATARATE_FB_LMT_S 16 uint16_t ipchksum; uint16_t tcpchksum; From bf7fcdb18a75a69af0c03f8e2ff1ee9bc0b63543 Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Mon, 28 Jan 2019 12:45:31 +0000 Subject: [PATCH 116/142] Fix the detection of ECN-setup SYN-ACK packets. RFC 3168 defines an ECN-setup SYN-ACK packet as on with the ECE flags set and the CWR flags not set. The code was only checking if ECE flag is set. This patch adds the check to verify that the CWR flags is not set. Submitted by: Richard Scheffenegger Reviewed by: tuexen@ MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D18996 --- sys/netinet/tcp_input.c | 3 ++- sys/netinet/tcp_stacks/rack.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 750046407fbd..39351d897f25 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2010,7 +2010,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, else tp->t_flags |= TF_ACKNOW; - if ((thflags & TH_ECE) && V_tcp_do_ecn) { + if (((thflags & (TH_CWR | TH_ECE)) == TH_ECE) && + V_tcp_do_ecn) { tp->t_flags |= TF_ECN_PERMIT; TCPSTAT_INC(tcps_ecn_shs); } diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 8201dc514bf0..158d2cb3abf8 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -5233,7 +5233,8 @@ rack_do_syn_sent(struct mbuf *m, struct tcphdr *th, struct socket *so, tp->t_flags |= TF_ACKNOW; } - if ((thflags & TH_ECE) && V_tcp_do_ecn) { + if (((thflags & (TH_CWR | TH_ECE)) == TH_ECE) && + V_tcp_do_ecn) { tp->t_flags |= TF_ECN_PERMIT; TCPSTAT_INC(tcps_ecn_shs); } From 8fc2164b47f8b783eb20f65f0bfae6edacf436ef Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Mon, 28 Jan 2019 16:23:56 +0000 Subject: [PATCH 117/142] Remove a redundant test. The existence of a PV entry for a mapping guarantees that the mapping exists, so we should not need to test for that. Reviewed by: kib MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18866 --- sys/riscv/riscv/pmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index e3dee2488434..2e9c3a12579b 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -2655,7 +2655,7 @@ pmap_page_wired_mappings(vm_page_t m) } } l3 = pmap_l3(pmap, pv->pv_va); - if (l3 != NULL && (pmap_load(l3) & PTE_SW_WIRED) != 0) + if ((pmap_load(l3) & PTE_SW_WIRED) != 0) count++; PMAP_UNLOCK(pmap); } From fbf997c5eb7304fc01ae719aaa9ce22b11803a51 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Mon, 28 Jan 2019 18:34:04 +0000 Subject: [PATCH 118/142] ifconfig: fix endianness bug displaying pfsync interfaces Reviewed by: kp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D19005 --- sbin/ifconfig/ifpfsync.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/ifconfig/ifpfsync.c b/sbin/ifconfig/ifpfsync.c index 3c9a9ed7a70f..6df38c1ac997 100644 --- a/sbin/ifconfig/ifpfsync.c +++ b/sbin/ifconfig/ifpfsync.c @@ -195,16 +195,16 @@ pfsync_status(int s) return; if (preq.pfsyncr_syncdev[0] != '\0' || - preq.pfsyncr_syncpeer.s_addr != INADDR_PFSYNC_GROUP) + preq.pfsyncr_syncpeer.s_addr != htonl(INADDR_PFSYNC_GROUP)) printf("\t"); if (preq.pfsyncr_syncdev[0] != '\0') printf("pfsync: syncdev: %s ", preq.pfsyncr_syncdev); - if (preq.pfsyncr_syncpeer.s_addr != INADDR_PFSYNC_GROUP) + if (preq.pfsyncr_syncpeer.s_addr != htonl(INADDR_PFSYNC_GROUP)) printf("syncpeer: %s ", inet_ntoa(preq.pfsyncr_syncpeer)); if (preq.pfsyncr_syncdev[0] != '\0' || - preq.pfsyncr_syncpeer.s_addr != INADDR_PFSYNC_GROUP) { + preq.pfsyncr_syncpeer.s_addr != htonl(INADDR_PFSYNC_GROUP)) { printf("maxupd: %d ", preq.pfsyncr_maxupdates); printf("defer: %s\n", preq.pfsyncr_defer ? "on" : "off"); } From a9ea96eafd9f3144f297cc5420bbfde0471f4bc4 Mon Sep 17 00:00:00 2001 From: Benedict Reuschling Date: Mon, 28 Jan 2019 19:54:58 +0000 Subject: [PATCH 119/142] A few corrections and clarifications to r343406. - Use "in" instead of "on" when referring to directory and UFS partition. - Switch from hw.physmem to hw.realmem and add a description to distinguish the two. - Explain why the "df" command is having trouble displaying ZFS sizes correctly. Add a bit more descriptive text to help why the output of "zfs list -o space" should be used. - Switch to vmstat instead of iostat display for systat(1) as it shows more information on one screen. Describe what is displayed based on the text of the man page. Change the list of the other values accordingly. - Sort the flags to "zfs destroy" alphabetically. Reviewed by: rgrimes Approved by: rgrimes MFC after: 8 days Differential Revision: https://reviews.freebsd.org/D18993 --- usr.bin/fortune/datfiles/freebsd-tips | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index 1ec51666002b..98344090a3bd 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -275,7 +275,7 @@ To see how much disk space is left on your UFS partitions, use df -h -- Dru % -To see the 10 largest files on a directory or UFS partition, use +To see the 10 largest files in a directory or on a UFS partition, use du -h /partition_or_directory_name | sort -rh | head -- Dru @@ -560,10 +560,13 @@ curl -v -d "nickname=$USER" -d "description=FreeBSD/$(uname -m) on \ $(kenv smbios.system.maker) $(kenv smbios.system.product)" -d "do=addd" \ --data-urlencode 'dmesg@/var/run/dmesg.boot' http://dmesgd.nycbug.org/index.cgi % -Want to know how much memory (in bytes) your machine has available? Let +Want to know how much memory (in bytes) your machine has installed? Let sysctl(8) tell you with the following command: -sysctl hw.physmem +sysctl hw.realmem + +The realmem value is memory before the kernel and modules are loaded, whereas +hw.physmem is what is left after they were loaded. The number of active CPUs is displayed using this command: @@ -571,20 +574,24 @@ sysctl hw.ncpu -- Benedict Reuschling % -When using ZFS as the file system the "df" command will display confusing -values. Use the built-in "zfs list" command to get an overview of space usage: +When using ZFS as the file system the "df" command is reporting the pool size +and not file system sizes. It also does not know about descendent ZFS +datasets, snapshots, quotas, and reservations with their individual space usage. +Use the built-in "zfs list" command to get a better overview of space usage: zfs list -o space -- Benedict Reuschling % To learn more about what your system is doing, take a look at systat(1). For -example, to get an overview of I/O happening in the system, run: +example, to get various of statistics related to virtual memory usage, process +scheduling, device interrupts, system name translation caching, and disk I/O, +enter the following: -systat -iostat +systat -vmstat -Other values are icmp, icmp6, ifstat, ip, ip6, netstat, pigs, sctp, swap, tcp, -vmstat, or zarc. You can switch between displays using : and exit +Other values are icmp, icmp6, ifstat, iostat, ip, ip6, netstat, pigs, sctp, +swap, tcp, or zarc. You can switch between displays using : and exit back to your shell by typing :quit @@ -694,7 +701,7 @@ dataset/snapshot and not any dependent ones. ZFS will display the resulting action when -n is combined with the -v option without actually performing it: -zfs destroy -rvn mypool@mysnap +zfs destroy -nrv mypool@mysnap Once you are sure this is exactly what you intend to do, remove the -n parameter to execute the destroy operation. From 8824a2ed0df5dd449fa5929e2de3a02311a1ff58 Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Mon, 28 Jan 2019 20:22:17 +0000 Subject: [PATCH 120/142] [usb] Add UQ_KBD_BOOTPROTO quirk for Corsair K68 keyboard PR: 222114 Submitted by: Zane C. Bowers-Hadley MFC after: 1 week --- sys/dev/usb/quirk/usb_quirk.c | 2 ++ sys/dev/usb/usbdevs | 1 + 2 files changed, 3 insertions(+) diff --git a/sys/dev/usb/quirk/usb_quirk.c b/sys/dev/usb/quirk/usb_quirk.c index d2ed6cb6c48f..1c1d607d8b61 100644 --- a/sys/dev/usb/quirk/usb_quirk.c +++ b/sys/dev/usb/quirk/usb_quirk.c @@ -165,6 +165,8 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { USB_QUIRK(MICROSOFT, WLINTELLIMOUSE, 0x0000, 0xffff, UQ_MS_LEADING_BYTE), /* Quirk for Corsair Vengeance K60 keyboard */ USB_QUIRK(CORSAIR, K60, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), + /* Quirk for Corsair Gaming K68 keyboard */ + USB_QUIRK(CORSAIR, K68, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), /* Quirk for Corsair Vengeance K70 keyboard */ USB_QUIRK(CORSAIR, K70, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), /* Quirk for Corsair K70 RGB keyboard */ diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index a63c9d2266ce..73f03cd03319 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -1581,6 +1581,7 @@ product COREGA FETHER_USB_TXC 0x9601 FEther USB-TXC /* Corsair products */ product CORSAIR K60 0x0a60 Corsair Vengeance K60 keyboard +product CORSAIR K68 0x1b3f Corsair Gaming K68 keyboard product CORSAIR K70 0x1b09 Corsair Vengeance K70 keyboard product CORSAIR K70_RGB 0x1b13 Corsair K70 RGB Keyboard product CORSAIR STRAFE 0x1b15 Corsair STRAFE Gaming keyboard From 59099cd3853da12a4868388d32d1e5578cafa1c5 Mon Sep 17 00:00:00 2001 From: Patrick Kelsey Date: Mon, 28 Jan 2019 20:26:09 +0000 Subject: [PATCH 121/142] Don't re-evaluate ALTQ kernel configuration due to events on non-ALTQ interfaces Re-evaluating the ALTQ kernel configuration can be expensive, particularly when there are a large number (hundreds or thousands) of queues, and is wholly unnecessary in response to events on interfaces that do not support ALTQ as such interfaces cannot be part of an ALTQ configuration. Reviewed by: kp MFC after: 1 week Sponsored by: RG Nets Differential Revision: https://reviews.freebsd.org/D18918 --- sys/netpfil/pf/pf_ioctl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 2bfed9c265c3..eba8a7f64a3c 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -683,6 +683,14 @@ pf_altq_ifnet_event(struct ifnet *ifp, int remove) u_int32_t ticket; int error = 0; + /* + * No need to re-evaluate the configuration for events on interfaces + * that do not support ALTQ, as it's not possible for such + * interfaces to be part of the configuration. + */ + if (!ALTQ_IS_READY(&ifp->if_snd)) + return; + /* Interrupt userland queue modifications */ if (V_altqs_inactive_open) pf_rollback_altq(V_ticket_altqs_inactive); From 80e72d52169469742befe2f0a47b90d316c507ab Mon Sep 17 00:00:00 2001 From: Patrick Kelsey Date: Mon, 28 Jan 2019 20:30:04 +0000 Subject: [PATCH 122/142] Speed up non-status operations applied to a single interface When performing a non-status operation on a single interface, it is not necessary for ifconfig to build a list of all addresses in the system, sort them, then iterate through them looking for the entry for the single interface of interest. Doing so becomes increasingly expensive as the number of interfaces in the system grows (e.g., in a system with 1000+ vlan(4) interfaces). Reviewed by: ae, kp MFC after: 1 week Sponsored by: RG Nets Differential Revision: https://reviews.freebsd.org/D18919 --- sbin/ifconfig/ifconfig.c | 57 +++++++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index d9cc46e0ec68..95ef3b065c8c 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -111,6 +111,8 @@ static void status(const struct afswtch *afp, const struct sockaddr_dl *sdl, static void tunnel_status(int s); static _Noreturn void usage(void); +static int getifflags(const char *ifname, int us); + static struct afswtch *af_getbyname(const char *name); static struct afswtch *af_getbyfamily(int af); static void af_other_status(int); @@ -369,6 +371,7 @@ main(int argc, char *argv[]) const char *ifname; struct option *p; size_t iflen; + int flags; all = downonly = uponly = namesonly = noload = verbose = 0; f_inet = f_inet6 = f_ether = f_addr = NULL; @@ -526,6 +529,25 @@ main(int argc, char *argv[]) argc--, argv++; } + /* + * Check for a requested configuration action on a single interface, + * which doesn't require building, sorting, and searching the entire + * system address list + */ + if ((argc > 0) && (ifname != NULL)) { + iflen = strlcpy(name, ifname, sizeof(name)); + if (iflen >= sizeof(name)) { + warnx("%s: interface name too long, skipping", ifname); + } else { + flags = getifflags(name, -1); + if (!(((flags & IFF_CANTCONFIG) != 0) || + (downonly && (flags & IFF_UP) != 0) || + (uponly && (flags & IFF_UP) == 0))) + ifconfig(argc, argv, 0, afp); + } + goto done; + } + if (getifaddrs(&ifap) != 0) err(EXIT_FAILURE, "getifaddrs"); @@ -609,6 +631,7 @@ main(int argc, char *argv[]) printf("\n"); freeifaddrs(ifap); +done: freeformat(); exit(exit_code); } @@ -1020,6 +1043,28 @@ setifdstaddr(const char *addr, int param __unused, int s, afp->af_getaddr(addr, DSTADDR); } +static int +getifflags(const char *ifname, int us) +{ + struct ifreq my_ifr; + int s; + + memset(&my_ifr, 0, sizeof(my_ifr)); + (void) strlcpy(my_ifr.ifr_name, ifname, sizeof(my_ifr.ifr_name)); + if (us < 0) { + if ((s = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0) + err(1, "socket(family AF_LOCAL,SOCK_DGRAM"); + } else + s = us; + if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&my_ifr) < 0) { + Perror("ioctl (SIOCGIFFLAGS)"); + exit(1); + } + if (us < 0) + close(s); + return ((my_ifr.ifr_flags & 0xffff) | (my_ifr.ifr_flagshigh << 16)); +} + /* * Note: doing an SIOCIGIFFLAGS scribbles on the union portion * of the ifreq structure, which may confuse other parts of ifconfig. @@ -1031,20 +1076,14 @@ setifflags(const char *vname, int value, int s, const struct afswtch *afp) struct ifreq my_ifr; int flags; - memset(&my_ifr, 0, sizeof(my_ifr)); - (void) strlcpy(my_ifr.ifr_name, name, sizeof(my_ifr.ifr_name)); - - if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&my_ifr) < 0) { - Perror("ioctl (SIOCGIFFLAGS)"); - exit(1); - } - flags = (my_ifr.ifr_flags & 0xffff) | (my_ifr.ifr_flagshigh << 16); - + flags = getifflags(name, s); if (value < 0) { value = -value; flags &= ~value; } else flags |= value; + memset(&my_ifr, 0, sizeof(my_ifr)); + (void) strlcpy(my_ifr.ifr_name, name, sizeof(my_ifr.ifr_name)); my_ifr.ifr_flags = flags & 0xffff; my_ifr.ifr_flagshigh = flags >> 16; if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&my_ifr) < 0) From baba6af702f29f3be4b4f77eb724578f9ef3db41 Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Mon, 28 Jan 2019 21:36:45 +0000 Subject: [PATCH 123/142] This bug was introduced with the change to use softdep_bp_to_mp() in January 2018 changes -r327723 and -r327821. The softdep_bp_to_mp() function failed to include VFIFO as one of the valid cases. Although fifo's do not allocate blocks in the filesystem, they will allocate blocks if they use extended attributes (such as ACLs). Thus, softdep_bp_to_mp() needs to return a non-NULL mount pointer when presented with a fifo vnode so that the soft updates write complete will properly process the soft updates structures associated with the extended attribute blocks. It was the failure to process these soft updates structures, thus leaving them hanging off the buffer, which lead to the "panic: softdep_deallocate_dependencies: dangling deps" when trying to clean up the buffer after it was written. PR: 230962 Reported by: 2t8mr7kx9f@protonmail.com Reviewed by: kib Tested by: Peter Holm MFC after: 1 week Sponsored by: Netflix --- sys/ufs/ffs/ffs_softdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 60ee45cdb7d7..391d7b79dc87 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -13983,7 +13983,7 @@ softdep_bp_to_mp(bp) if (mp == NULL) goto retry; } else if (vp->v_type == VREG || vp->v_type == VDIR || - vp->v_type == VLNK) { + vp->v_type == VLNK || vp->v_type == VFIFO) { mp = vp->v_mount; } else { return (NULL); From ef967412591f61942d071c489f13cb9e619ef41b Mon Sep 17 00:00:00 2001 From: Navdeep Parhar Date: Tue, 29 Jan 2019 00:49:12 +0000 Subject: [PATCH 124/142] cxgbe(4): Add adapter information to messages logged by the OS-agnostic code in t4_hw.c. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/osdep.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/dev/cxgbe/osdep.h b/sys/dev/cxgbe/osdep.h index 6eec287db1a7..95c93d83cff8 100644 --- a/sys/dev/cxgbe/osdep.h +++ b/sys/dev/cxgbe/osdep.h @@ -42,10 +42,14 @@ #include #include -#define CH_ERR(adap, fmt, ...) log(LOG_ERR, fmt, ##__VA_ARGS__) -#define CH_WARN(adap, fmt, ...) log(LOG_WARNING, fmt, ##__VA_ARGS__) -#define CH_ALERT(adap, fmt, ...) log(LOG_ALERT, fmt, ##__VA_ARGS__) -#define CH_WARN_RATELIMIT(adap, fmt, ...) log(LOG_WARNING, fmt, ##__VA_ARGS__) +#define CH_ERR(adap, fmt, ...) log(LOG_ERR, "%s: " fmt, \ + device_get_nameunit(adap->dev), ##__VA_ARGS__) +#define CH_WARN(adap, fmt, ...) log(LOG_WARNING, "%s: " fmt, \ + device_get_nameunit(adap->dev), ##__VA_ARGS__) +#define CH_ALERT(adap, fmt, ...) log(LOG_ALERT, "%s: " fmt, \ + device_get_nameunit(adap->dev), ##__VA_ARGS__) +#define CH_WARN_RATELIMIT(adap, fmt, ...) log(LOG_WARNING, "%s: " fmt, \ + device_get_nameunit(adap->dev), ##__VA_ARGS__) #ifndef LINUX_TYPES_DEFINED typedef int8_t s8; From 635588c25c9b49558f9a4db849d839c5e52f66eb Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Tue, 29 Jan 2019 03:28:47 +0000 Subject: [PATCH 125/142] Drop some unneeded includes from wireless USB drivers. MFC after: 1 week --- sys/dev/usb/wlan/if_rsu.c | 4 ---- sys/dev/usb/wlan/if_rum.c | 4 ---- sys/dev/usb/wlan/if_run.c | 4 ---- sys/dev/usb/wlan/if_uath.c | 4 ---- sys/dev/usb/wlan/if_upgt.c | 1 - sys/dev/usb/wlan/if_ural.c | 4 ---- sys/dev/usb/wlan/if_urtw.c | 4 ---- sys/dev/usb/wlan/if_zyd.c | 4 ---- 8 files changed, 29 deletions(-) diff --git a/sys/dev/usb/wlan/if_rsu.c b/sys/dev/usb/wlan/if_rsu.c index e5245f3c2478..6a294a0c7111 100644 --- a/sys/dev/usb/wlan/if_rsu.c +++ b/sys/dev/usb/wlan/if_rsu.c @@ -39,13 +39,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include -#include -#include - #include #include #include diff --git a/sys/dev/usb/wlan/if_rum.c b/sys/dev/usb/wlan/if_rum.c index 5d911b49e429..2dcb29adaa5d 100644 --- a/sys/dev/usb/wlan/if_rum.c +++ b/sys/dev/usb/wlan/if_rum.c @@ -44,10 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include - #include #include #include diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c index 40aaaed7191f..d92fdcf3368e 100644 --- a/sys/dev/usb/wlan/if_run.c +++ b/sys/dev/usb/wlan/if_run.c @@ -44,10 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include - #include #include #include diff --git a/sys/dev/usb/wlan/if_uath.c b/sys/dev/usb/wlan/if_uath.c index 7ae52bdb3902..816a8f2f7410 100644 --- a/sys/dev/usb/wlan/if_uath.c +++ b/sys/dev/usb/wlan/if_uath.c @@ -85,10 +85,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include - #include #include #include diff --git a/sys/dev/usb/wlan/if_upgt.c b/sys/dev/usb/wlan/if_upgt.c index 4da80fa68965..7fe9ca5c7b62 100644 --- a/sys/dev/usb/wlan/if_upgt.c +++ b/sys/dev/usb/wlan/if_upgt.c @@ -41,7 +41,6 @@ #include #include -#include #include #include diff --git a/sys/dev/usb/wlan/if_ural.c b/sys/dev/usb/wlan/if_ural.c index 104335f60932..a71666379190 100644 --- a/sys/dev/usb/wlan/if_ural.c +++ b/sys/dev/usb/wlan/if_ural.c @@ -45,10 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include - #include #include #include diff --git a/sys/dev/usb/wlan/if_urtw.c b/sys/dev/usb/wlan/if_urtw.c index 28b9ac4e94d9..bd1e72dc101d 100644 --- a/sys/dev/usb/wlan/if_urtw.c +++ b/sys/dev/usb/wlan/if_urtw.c @@ -34,10 +34,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include - #include #include #include diff --git a/sys/dev/usb/wlan/if_zyd.c b/sys/dev/usb/wlan/if_zyd.c index f084a430c4fc..852587d417c5 100644 --- a/sys/dev/usb/wlan/if_zyd.c +++ b/sys/dev/usb/wlan/if_zyd.c @@ -44,10 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include - #include #include #include From e42b9932738d5e2e41f334b17c1c9e371cf12845 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Tue, 29 Jan 2019 03:31:36 +0000 Subject: [PATCH 126/142] upgt(4): unbreak build with UPGT_DEBUG MFC after: 1 week --- sys/dev/usb/wlan/if_upgt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/wlan/if_upgt.c b/sys/dev/usb/wlan/if_upgt.c index 7fe9ca5c7b62..7451381411fa 100644 --- a/sys/dev/usb/wlan/if_upgt.c +++ b/sys/dev/usb/wlan/if_upgt.c @@ -1615,7 +1615,7 @@ upgt_fw_load(struct upgt_softc *sc) data_cmd->buflen = bsize; upgt_bulk_tx(sc, data_cmd); - DPRINTF(sc, UPGT_DEBUG_FW, "FW offset=%d, read=%d, sent=%d\n", + DPRINTF(sc, UPGT_DEBUG_FW, "FW offset=%zu, read=%d, sent=%d\n", offset, n, bsize); bsize = n; } @@ -1772,7 +1772,7 @@ upgt_fw_verify(struct upgt_softc *sc) } DPRINTF(sc, UPGT_DEBUG_FW, - "firmware Boot Record Area found at offset %d\n", offset); + "firmware Boot Record Area found at offset %zu\n", offset); /* * Parse Boot Record Area (BRA) options. From bf05ccc39780804d2a3a1dbccbd584ecc78f6620 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Tue, 29 Jan 2019 04:08:49 +0000 Subject: [PATCH 127/142] bectl(8) test: Force destroy the zpool in cleanup This is a wild guess as to why bectl tests failed once upon a time in CI, given no apparent way to see a transcript of cleanup routines with Kyua. The bectl tests construct a new, clean zpool for every test. The failure indicated was because of a mount that was leftover from a previous test, but the previous test had succeeded so it's not clear how the mount remained leftover unless the `zpool get health ${pool}` had somehow failed. MFC after: 1 week --- sbin/bectl/tests/bectl_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/bectl/tests/bectl_test.sh b/sbin/bectl/tests/bectl_test.sh index ecad748f5c0f..76f22655d44c 100755 --- a/sbin/bectl/tests/bectl_test.sh +++ b/sbin/bectl/tests/bectl_test.sh @@ -62,7 +62,7 @@ bectl_cleanup() zpool=$1 if zpool get health ${zpool} >/dev/null 2>&1; then - zpool destroy ${zpool} + zpool destroy -f ${zpool} fi } From 93b904b310e75df7304aca236f4069eead7b80ac Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Tue, 29 Jan 2019 08:07:14 +0000 Subject: [PATCH 128/142] Update pci_vendors to 2019.01.29 MFC after: 2 days --- share/misc/pci_vendors | 831 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 742 insertions(+), 89 deletions(-) diff --git a/share/misc/pci_vendors b/share/misc/pci_vendors index a84b72b76734..2f90d82a2e48 100644 --- a/share/misc/pci_vendors +++ b/share/misc/pci_vendors @@ -2,11 +2,11 @@ # List of PCI ID's # -# Version: 2018.08.12 -# Date: 2018-08-12 03:15:01 +# Version: 2019.01.29 +# Date: 2019-01-29 03:15:01 # # Maintained by Albert Pool, Martin Mares, and other volunteers from -# the PCI ID Project at http://pci-ids.ucw.cz/. +# the PCI ID Project at https://pci-ids.ucw.cz/. # # New data are always welcome, especially if they are accurate. If you have # anything to contribute, please follow the instructions at the web site. @@ -58,8 +58,7 @@ 0680 Ultra ATA/133 IDE RAID CONTROLLER CARD # Wrong ID used in subsystem ID of the TELES.S0/PCI 2.x ISDN adapter 00a7 Teles AG (Wrong ID) -# nee nCipher -0100 Thales e-Security +0100 nCipher Security 0123 General Dynamics 0128 Dell (wrong ID) # 018a is not LevelOne but there is a board misprogrammed @@ -275,6 +274,7 @@ 8086 9460 RAID Controller RSP3TD160F 8086 9480 RAID Controller RSP3MD088F 0015 MegaRAID Tri-Mode SAS3416 + 1d49 0503 ThinkSystem RAID 530-16i PCIe 12Gb Adapter 0016 MegaRAID Tri-Mode SAS3508 1028 1fc9 PERC H840 Adapter 1028 1fcb PERC H740P Adapter @@ -282,7 +282,6 @@ 1028 1fcf PERC H740P Mini 1d49 0601 ThinkSystem RAID 930-8i 2GB Flash PCIe 12Gb Adapter 1d49 0603 ThinkSystem RAID 930-24i 4GB Flash PCIe 12Gb Adapter - 1d49 0604 ThinkSystem RAID 930-8e 4GB Flash PCIe 12Gb Adapter 8086 352e Integrated RAID Module RMSP3CD080F 8086 352f Integrated RAID Module RMSP3HD080E 8086 9461 RAID Controller RSP3DD080F @@ -413,6 +412,7 @@ 005c SAS1064A PCI-X Fusion-MPT SAS 005d MegaRAID SAS-3 3108 [Invader] 1000 9361 MegaRAID SAS 9361-8i + 1000 9363 MegaRAID SAS 9361-4i 1000 9364 MegaRAID SAS 9364-8i 1000 936a MegaRAID SAS 9364-8i 1028 1f41 PERC H830 Adapter @@ -445,6 +445,7 @@ 1028 1f4d PERC H330 Embedded (for monolithic) 1054 306a SAS 3004 iMR ROMB 1d49 04db ServeRAID M1210 SAS/SATA Controller + 1d49 0504 ThinkSystem RAID 520-8i PCIe 12Gb Adapter 0060 MegaRAID SAS 1078 1000 1006 MegaRAID SAS 8888ELP 1000 100a MegaRAID SAS 8708ELP @@ -483,15 +484,17 @@ 0065 SAS2116 PCI-Express Fusion-MPT SAS-2 [Meteor] 006e SAS2308 PCI-Express Fusion-MPT SAS-2 0070 SAS2004 PCI-Express Fusion-MPT SAS-2 [Spitfire] + 1000 3010 SAS9211-4i 0071 MR SAS HBA 2004 0072 SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon] + 1000 3040 9210-8i 1000 30b0 9200-8e [LSI SAS 6Gb/s SAS/SATA PCIe x8 External HBA] 1028 1f1c 6Gbps SAS HBA Adapter 1028 1f1d PERC H200 Adapter 1028 1f1e PERC H200 Integrated 1028 1f1f PERC H200 Modular 1028 1f20 PERC H200 Embedded - 1028 1f22 Internal Tape Adapter + 1028 1f22 PERC H200 Internal Tape Adapter 8086 350f RMS2LL040 RAID Controller 8086 3700 SSD 910 Series 0073 MegaRAID SAS 2008 [Falcon] @@ -506,6 +509,7 @@ 1028 1f52 PERC H310 Embedded1 1028 1f53 PERC H310 Embedded2 1028 1f54 PERC H310 Reserved + 1028 1f78 PERC H310 1054 3035 LSI MegaRAID SAS 9240-8i 1137 0072 2004 iMR ROMB 1137 0073 2008 ROMB @@ -586,10 +590,13 @@ 0084 SAS2208 PCI-Express Fusion-MPT SAS-2 0085 SAS2208 PCI-Express Fusion-MPT SAS-2 0086 SAS2308 PCI-Express Fusion-MPT SAS-2 + 15d9 0690 Onboard MegaRAID SAS2208 [Thunderbolt] + 15d9 0691 Onboard SAS2308 PCI-Express Fusion-MPT SAS-2 0087 SAS2308 PCI-Express Fusion-MPT SAS-2 1000 3020 9207-8i SAS2.1 HBA 1000 3040 9207-8e SAS2.1 HBA 1000 3050 SAS9217-8i + 1014 0472 N2125 External Host Bus Adapter 1590 0044 H220i 8086 3000 RS25GB008 RAID Controller 8086 3060 RS25FB044 RAID Controller @@ -627,6 +634,7 @@ 8086 3020 RAID Controller RSP3GD016J 00ae SAS3508 Fusion-MPT Tri-Mode RAID On Chip (ROC) 00af SAS3408 Fusion-MPT Tri-Mode I/O Controller Chip (IOC) + 1000 3010 HBA 9400-8i 1d49 0200 ThinkSystem 430-8i SAS/SATA 12Gb HBA 1d49 0202 ThinkSystem 430-8e SAS/SATA 12Gb HBA 1d49 0204 ThinkSystem 430-8i SAS/SATA 12Gb Dense HBA @@ -650,11 +658,19 @@ 00d0 SAS3716 Fusion-MPT Tri-Mode RAID Controller Chip (ROC) 00d1 SAS3616 Fusion-MPT Tri-Mode I/O Controller Chip (IOC) 00d3 MegaRAID Tri-Mode SAS3716W + 00e0 Fusion-MPT 12GSAS/PCIe Unsupported SAS39xx + 00e1 Fusion-MPT 12GSAS/PCIe SAS39xx + 00e2 Fusion-MPT 12GSAS/PCIe Secure SAS39xx + 00e3 Fusion-MPT 12GSAS/PCIe Unsupported SAS39xx + 00e4 Fusion-MPT 12GSAS/PCIe Unsupported SAS38xx + 00e5 Fusion-MPT 12GSAS/PCIe SAS38xx + 00e6 Fusion-MPT 12GSAS/PCIe Secure SAS38xx + 00e7 Fusion-MPT 12GSAS/PCIe Unsupported SAS38xx 02b0 Virtual Endpoint on PCIe Switch 1d49 0001 ThinkSystem 1610-4P NVMe Switch Adapter 1d49 0002 ThinkSystem 810-4P NVMe Switch Adapter 02b1 Virtual Endpoint on PCIe Switch (9749) - 1d49 0004 Lenovo ThinkSystem 1610-8P NVMe Switch Adapter + 1d49 0004 ThinkSystem 1610-8P NVMe Switch Adapter 0407 MegaRAID 1000 0530 MegaRAID 530 SCSI 320-0X RAID Controller 1000 0531 MegaRAID 531 SCSI 320-4X RAID Controller @@ -725,6 +741,14 @@ 0807 SA2020ZC 0901 61C102 1000 63C815 + 10e0 MegaRAID 12GSAS/PCIe Unsupported SAS39xx + 10e1 MegaRAID 12GSAS/PCIe SAS39xx + 10e2 MegaRAID 12GSAS/PCIe Secure SAS39xx + 10e3 MegaRAID 12GSAS/PCIe Unsupported SAS39xx + 10e4 MegaRAID 12GSAS/PCIe Unsupported SAS38xx + 10e5 MegaRAID 12GSAS/PCIe SAS38xx + 10e6 MegaRAID 12GSAS/PCIe Secure SAS38xx + 10e7 MegaRAID 12GSAS/PCIe Unsupported SAS38xx 1960 MegaRAID 1000 0518 MegaRAID 518 SCSI 320-2 Controller 1000 0520 MegaRAID 520 SCSI 320-1 Controller @@ -777,11 +801,20 @@ 131b Kaveri [Radeon R4 Graphics] 131c Kaveri [Radeon R7 Graphics] 131d Kaveri [Radeon R6 Graphics] + 13e9 Ariel + 154c Kryptos + 154e Garfield + 1551 Arlene + 1552 Pooky + 1561 Anubis 15d8 Picasso 15dd Raven Ridge [Radeon Vega Series / Radeon Vega Mobile Series] 103c 83c6 Radeon Vega 8 Mobile 1458 d000 Radeon RX Vega 11 - 15ff Vega 11 [Radeon Vega 28 Mobile] + 15de Raven Ridge HDMI/DP Audio Controller + 15ff Fenghuang [Zhongshan Subor Z+] + 1607 Arden + 1636 Renoir 1714 BeaverCreek HDMI Audio [Radeon HD 6500D and 6400G-6600G series] 103c 168b ProBook 4535s 3150 RV380/M24 [Mobility Radeon X600] @@ -863,19 +896,28 @@ 4337 RS200M [Radeon IGP 330M/340M/345M/350M] 1014 053a ThinkPad R40e 103c 0850 Radeon IGP 345M - 4341 IXP150 AC'97 Audio Controller - 4342 IXP200 3COM 3C920B Ethernet Controller - 4345 EHCI USB Controller - 4347 OHCI USB Controller #1 - 4348 OHCI USB Controller #2 - 4349 Dual Channel Bus Master PCI IDE Controller - 434d IXP AC'97 Modem - 4353 SMBus + 4341 SB200 AC97 Audio Controller + 4342 SB200 PCI to PCI Bridge + 4345 SB200 EHCI USB Controller + 4346 Crayola 6 [XENOS Parent Die (XBOX 360)] + 4347 SB200 OHCI USB Controller #1 + 4348 SB200 OHCI USB Controller #2 + 4349 SB200 IDE Controller + 434c SB200 PCI to LPC Bridge + 434d SB200 AC97 Modem Controller + 4353 SB200 SMBus Controller 4354 215CT [Mach64 CT PCI] 4358 Mach64 CX [Graphics Xpression] - 4361 IXP SB300 AC'97 Audio Controller - 4363 SMBus - 436e 436E Serial ATA Controller + 4361 SB300 AC'97 Audio Controller + 4362 SB300 PCI to PCI Bridge + 4363 SB300 SMBus Controller + 4365 SB300 USB Controller (EHCI) + 4367 SB300 USB Controller (EHCI) + 4368 SB300 USB Controller (EHCI) + 4369 SB300 IDE Controller + 436c SB300 PCI to LPC Bridge + 436d SB300 AC97 Modem Controller + 436e SB300 Serial ATA Controller 4370 IXP SB400 AC'97 Audio Controller 1025 0079 Aspire 5024WLMMi 1025 0091 Aspire 5032WXMi @@ -1021,6 +1063,7 @@ 103c 1611 Pavilion DM1Z-3000 1043 82ef M3A78-EH Motherboard 1043 8443 M5A88-V EVO + 1043 84dd M5A99X EVO (R1.0) SB950 105b 0e13 N15235/A74MX mainboard / AMD SB700 174b 1001 PURE Fusion Mini 4392 SB7x0/SB8x0/SB9x0 SATA Controller [Non-RAID5 mode] @@ -1056,6 +1099,7 @@ 105b 0e13 N15235/A74MX mainboard / AMD SB700 174b 1001 PURE Fusion Mini 439c SB7x0/SB8x0/SB9x0 IDE Controller + 1002 4392 MSI MS-7713 motherboard 1019 2120 A785GM-M 1043 82ef M3A78-EH Motherboard 105b 0e13 N15235/A74MX mainboard / AMD SB700 @@ -1072,6 +1116,8 @@ 43a3 SB900 PCI to PCI bridge (PCIE port 3) 4437 RS250 [Mobility Radeon 7000 IGP] 4554 210888ET [Mach64 ET] + 4630 XENOS Parent Die (XBOX 360) + 4631 XENOS Daughter Die (XBOX 360) 4654 Mach64 VT 4742 Rage 3 [3D Rage PRO AGP 2X] 1002 0040 Rage Pro Turbo AGP 2X @@ -1152,6 +1198,22 @@ 1002 0084 Rage 3D Pro AGP 2x XPERT 98 1002 0087 Rage 3D IIC 1002 475a Rage IIC AGP + 4845 Xilleon 220 HBIU for HDTV2 + 4846 Xilleon 220 IDE for HDTV2 + 4847 Xilleon 220 USB for HDTV2 + 4848 Xilleon 220 DAIO-0 for HDTV2 + 4849 Xilleon 220 DAIO-1 for HDTV2 + 484a Xilleon 220 LPC for HDTV2 + 4850 Xilleon 215 HBIU for X215 + 4851 Xilleon 215 IDE for X215 + 4852 Xilleon 215 USB for X215 + 4853 Xilleon 215 DAIO-0 for X215 + 4854 Xilleon 215 DAIO-1 for X215 + 4855 Xilleon 225 HBIU for X225 + 4856 Xilleon 225 IDE for X225 + 4857 Xilleon 225 USB for X225 + 4858 Xilleon 225 DAIO-0 for X225 + 4859 Xilleon 225 DAIO-1 for X225 4966 RV250 [Radeon 9000 Series] 10f1 0002 RV250 If [Tachyon G9000 PRO] 148c 2039 RV250 If [Radeon 9000 Pro "Evil Commando"] @@ -1668,7 +1730,8 @@ 106b 014b Tropo XT [Radeon R9 M380 Mac Edition] 6641 Saturn PRO [Radeon HD 8930M] 6646 Bonaire XT [Radeon R9 M280X] - 6647 Bonaire PRO [Radeon R9 M270X] + 6647 Saturn PRO/XT [Radeon R9 M270X/M280X] + 1043 223d N551ZU laptop Radeon R9 M280X 6649 Bonaire [FirePro W5100] 1002 0b0c FirePro W4300 103c 0b0c Bonaire [FirePro W4300] @@ -1677,6 +1740,7 @@ 6650 Bonaire 6651 Bonaire 6658 Bonaire XTX [Radeon R7 260X/360] + 1043 04d3 AMD Radeon R7 260X 148c 0907 Radeon R7 360 1682 0907 Radeon R7 360 1682 7360 Radeon R7 360 @@ -1702,7 +1766,7 @@ 1462 2938 Radeon R9 360 OEM 1462 3271 Radeon R9 360 OEM 1682 7360 Radeon R7 360 - 6660 Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330 / M430 / R7 M520] + 6660 Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330 / M430 / Radeon 520 Mobile] 1028 05ea Radeon HD 8670M 1028 06bf Radeon R5 M335 103c 1970 Radeon HD 8670M @@ -1718,7 +1782,8 @@ 1025 0846 Radeon HD 8570A 17aa 3805 Radeon HD 8570M 6664 Jet XT [Radeon R5 M240] - 6665 Jet PRO [Radeon R5 M230] + 6665 Jet PRO [Radeon R5 M230 / R7 M260DX / Radeon 520 Mobile] + 17aa 1309 Radeon R7 M260DX 17aa 368f Radeon R5 A230 6667 Jet ULT [Radeon R5 M230] 666f Sun LE [Radeon HD 8550M / R5 M230] @@ -1727,7 +1792,7 @@ 66a2 Vega 20 66a3 Vega 20 66a7 Vega 20 [Radeon Pro Vega 20] - 66af Vega 20 + 66af Vega 20 [Radeon VII] 6704 Cayman PRO GL [FirePro V7900] 6707 Cayman LE GL [FirePro V5900] 6718 Cayman XT [Radeon HD 6970] @@ -2182,6 +2247,7 @@ 1028 2120 Radeon HD 6450 103c 2128 Radeon HD 6450 103c 2aee Radeon HD 7450A + 1092 6450 Radeon HD 6450 1462 2125 Radeon HD 6450 1462 2346 Radeon HD 7450 1462 2490 Radeon HD 6450 @@ -2328,7 +2394,7 @@ 67cc Ellesmere [Polaris10] 67cf Ellesmere [Polaris10] 67d0 Ellesmere [Radeon Pro V7300X / V7350x2] - 67df Ellesmere [Radeon RX 470/480/570/570X/580/580X] + 67df Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] 1002 0b37 Radeon RX 480 1028 1722 Radeon RX 570X 1028 1723 Radeon RX 580X @@ -2336,13 +2402,14 @@ 1043 04b0 Radeon RX 470 1043 04fb Radeon RX 480 1043 04fd Radeon RX 480 8GB + 1043 056a Radeon RX 590 106b 0161 Radeon Pro 580 106b 0162 Radeon Pro 575 106b 0163 Radeon Pro 570 1458 22f0 Radeon RX 570 1458 22f7 Radeon RX 570 Gaming 4G 1462 3411 Radeon RX 470 - 1462 3413 Radeon RX 480 + 1462 3413 Radeon RX 480 Gaming X 8GB 1462 3416 Radeon RX 570 1462 3418 Radeon RX 580 Armor 4G OC 148c 2372 Radeon RX 480 @@ -2355,8 +2422,8 @@ 1787 a470 Radeon RX 470 1787 a480 Radeon RX 480 1849 5001 Phantom Gaming X RX 580 OC - 1da2 e353 Sapphire Radeon RX 580 Pulse 8GB - 1da2 e366 Nitro+ Radeon RX 580 4GB + 1da2 e353 Radeon RX 570 Pulse 4GB + 1da2 e366 Nitro+ Radeon RX 570/580 67e0 Baffin [Radeon Pro WX 4170] 103c 8270 Radeon Pro WX 4170 103c 8272 Radeon Pro WX 4170 @@ -2466,8 +2533,9 @@ 15c3 2b1e MED-X6000 6829 Cape Verde 682a Venus PRO - 682b Venus LE / Tropo PRO-L [Radeon HD 8830M / R7 M465X] + 682b Cape Verde PRO / Venus LE / Tropo PRO-L [Radeon HD 8830M / R7 250 / R7 M465X] 0128 079c Radeon R7 465X + 1462 3012 Radeon R7 250 682c Cape Verde GL [FirePro W4100] 682d Chelsea XT GL [FirePro M4000] 682f Chelsea LP [Radeon HD 7730M] @@ -2608,9 +2676,9 @@ 6863 Vega 10 XTX [Radeon Vega Frontier Edition] 6864 Vega 6867 Vega 10 XL [Radeon Pro Vega 56] - 6868 Vega 10 [Radeon PRO WX 8100] + 6868 Vega 10 [Radeon PRO WX 8100/8200] 686c Vega 10 [Radeon Instinct MI25 MxGPU] - 687f Vega 10 XT [Radeon RX Vega 64] + 687f Vega 10 XL/XT [Radeon RX Vega 56/64] 6880 Lexington [Radeon HD 6550M] 103c 163c Pavilion dv6 Radeon HD 6550M 6888 Cypress XT [FirePro V8800] @@ -3126,8 +3194,9 @@ 148c 9380 Radeon R9 380 # Make naming scheme consistent 174b e308 Radeon R9 380 Nitro 4G D5 - 694c Polaris 22 [Radeon RX Vega M GH] + 694c Polaris 22 XT [Radeon RX Vega M GH] 694e Polaris 22 XL [Radeon RX Vega M GL] + 694f Polaris 22 MGL XL [Radeon Pro WX Vega M GL] 6980 Polaris12 6981 Polaris12 6985 Lexa XT [Radeon PRO WX 3100] @@ -3142,7 +3211,8 @@ 69a1 Vega 12 69a2 Vega 12 69a3 Vega 12 - 69af Vega 12 + 69af Vega 12 [Radeon Pro Vega 20] + 6fdf Polaris 20 XL [Radeon RX 580 2048SP] 700f RS100 AGP Bridge 7010 RS200/RS250 AGP Bridge 7100 R520 [Radeon X1800 XT] @@ -3285,6 +3355,8 @@ 1043 049e Radeon R9 FURY 1043 04a0 Radeon R9 FURY X 174b e329 Radeon R9 FURY + 7310 Navi 10 + 731f Navi 10 7833 RS350 Host Bridge 7834 RS350 [Radeon 9100 PRO/XT IGP] 7835 RS350M [Mobility Radeon 9000 IGP] @@ -3577,6 +3649,8 @@ 17aa 5113 Radeon R6 Graphics 17aa 5116 Radeon R6 Graphics 17aa 5118 Radeon R5 Graphics + 9890 Amur + 98c0 Nolan 98e4 Stoney [Radeon R2/R3/R4/R5 Graphics] 9900 Trinity [Radeon HD 7660G] 103c 1985 Pavilion 17-e163sg Notebook PC @@ -3605,13 +3679,18 @@ 9917 Trinity [Radeon HD 7620G] 9918 Trinity [Radeon HD 7600G] 9919 Trinity [Radeon HD 7500G] + 991e Bishop 9920 Liverpool [Playstation 4 APU] 9921 Liverpool HDMI/DP Audio Controller - 9990 Trinity [Radeon HD 7520G] - 9991 Trinity [Radeon HD 7540D] - 9992 Trinity [Radeon HD 7420G] - 9993 Trinity [Radeon HD 7480D] - 9994 Trinity [Radeon HD 7400G] + 9922 Starship + 9923 Starsha2 [Kingston/Clayton] + 9924 Gladius + 9926 Jupiter + 9990 Trinity 2 [Radeon HD 7520G] + 9991 Trinity 2 [Radeon HD 7540D] + 9992 Trinity 2 [Radeon HD 7420G] + 9993 Trinity 2 [Radeon HD 7480D] + 9994 Trinity 2 [Radeon HD 7400G] 9995 Richland [Radeon HD 8450G] 9996 Richland [Radeon HD 8470D] 9997 Richland [Radeon HD 8350G] @@ -3622,9 +3701,9 @@ 999c Richland # AMD Quad-Core A8-Series APU A8-6500T with Radeon HD 8550D 999d Richland [Radeon HD 8550D] - 99a0 Trinity [Radeon HD 7520G] - 99a2 Trinity [Radeon HD 7420G] - 99a4 Trinity [Radeon HD 7400G] + 99a0 Trinity 2 [Radeon HD 7520G] + 99a2 Trinity 2 [Radeon HD 7420G] + 99a4 Trinity 2 [Radeon HD 7400G] aa00 R600 HDMI Audio [Radeon HD 2900 GT/PRO/XT] aa01 RV635 HDMI Audio [Radeon HD 3650/3730/3750] aa08 RV630 HDMI Audio [Radeon HD 2600 PRO/XT / HD 3610] @@ -3656,13 +3735,34 @@ aab0 Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] aac0 Tobago HDMI Audio [Radeon R7 360 / R9 360 OEM] aac8 Hawaii HDMI Audio [Radeon R9 290/290X / 390/390X] -# I have a Tonga card and this is the HDMI Audio part aad8 Tonga HDMI Audio [Radeon R9 285/380] 174b aad8 Radeon R9 285/380 HDMI Audio + aae0 Baffin HDMI/DP Audio [Radeon RX 550 640SP / RX 560/560X] aae8 Fiji HDMI/DP Audio [Radeon R9 Nano / FURY/FURY X] - aaf0 Ellesmere [Radeon RX 580] - ac00 Theater 600 Pro + aaf0 Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590] + aaf8 Vega 10 HDMI Audio [Radeon Vega 56/64] + ab00 Baffin HDMI/DP Audio [Radeon RX 550 640SP / RX 560/560X] + ab08 Polaris 22 HDMI Audio + ab10 Lexa HDMI Audio + ab18 Vega 12 HDMI Audio + ab20 Vega 20 HDMI Audio [Radeon VII] + ab38 Navi 10 HDMI Audio + ac00 Theater 506 World-Wide Analog Decoder + ac01 Theater 506 World-Wide Analog Decoder ac02 TV Wonder HD 600 PCIe + ac03 Theater 506 PCIe + ac04 Theater 506 USB + ac05 Theater 506 USB + ac06 Theater 506 External USB + ac07 Theater 506 External USB + ac08 Theater 506A World-Wide Analog Decoder + Demodulator + ac09 Theater 506A World-Wide Analog Decoder + Demodulator + ac0a Theater 506A PCIe + ac0b Theater 506A PCIe + ac0c Theater 506A USB + ac0d Theater 506A USB + ac0e Theater 506A External USB + ac0f Theater 506A External USB ac12 Theater HD T507 (DVB-T) TV tuner/capture device cab0 RS100 Host Bridge cab2 RS200 Host Bridge @@ -4082,6 +4182,7 @@ 03dc POWER8 Host Bridge (PHB3) 044b GenWQE Accelerator Adapter 04aa Flash Adapter 90 (PCIe2 0.9TB) + 04c1 POWER9 Host Bridge (PHB4) 04da PCI-E IPR SAS+ Adapter (ASIC) 1014 04fb PCIe3 x16 20GB Cache 12Gb Quad SAS RAID+ Adapter(580B) 1014 04fc PCIe3 x8 12Gb Quad SAS RAID+ Adapter(580A) @@ -4212,7 +4313,7 @@ 1439 Family 16h Processor Functions 5:1 1450 Family 17h (Models 00h-0fh) Root Complex 1451 Family 17h (Models 00h-0fh) I/O Memory Management Unit - 1452 Family 17h (Models 00h-0fh) PCIe Dummy Host Bridge + 1452 Family 17h (Models 00h-1fh) PCIe Dummy Host Bridge 1453 Family 17h (Models 00h-0fh) PCIe GPP Bridge 1454 Family 17h (Models 00h-0fh) Internal PCIe GPP Bridge 0 to Bus B 1456 Family 17h (Models 00h-0fh) Platform Security Processor @@ -4243,6 +4344,8 @@ 1535 Family 16h Processor Function 5 1536 Family 16h Processor Root Complex 1538 Family 16h Processor Function 0 + 1566 Family 16h (Models 30h-3fh) Processor Root Complex + 156b Family 16h (Models 30h-3fh) Host Bridge 1570 Family 15h (Models 60h-6fh) Processor Function 0 1571 Family 15h (Models 60h-6fh) Processor Function 1 1572 Family 15h (Models 60h-6fh) Processor Function 2 @@ -4254,6 +4357,14 @@ 157a Family 15h (Models 60h-6fh) Audio Controller 157b Family 15h (Models 60h-6fh) Host Bridge 157c Family 15h (Models 60h-6fh) Processor Root Port + 1580 Family 16h (Models 30h-3fh) Processor Function 0 + 1581 Family 16h (Models 30h-3fh) Processor Function 1 + 1582 Family 16h (Models 30h-3fh) Processor Function 2 + 1583 Family 16h (Models 30h-3fh) Processor Function 3 + 1584 Family 16h (Models 30h-3fh) Processor Function 4 + 1585 Family 16h (Models 30h-3fh) Processor Function 5 + 15df Family 17h (Models 10h-1fh) Platform Security Processor + 15e3 Family 17h (Models 10h-1fh) HD Audio Controller 1600 Family 15h Processor Function 0 1601 Family 15h Processor Function 1 1602 Family 15h Processor Function 2 @@ -4323,12 +4434,22 @@ 43a1 Hudson PCI to PCI bridge (PCIE port 1) 43a2 Hudson PCI to PCI bridge (PCIE port 2) 43a3 Hudson PCI to PCI bridge (PCIE port 3) + 43b0 X370 Series Chipset PCIe Upstream Port + 1849 43c6 Fatal1ty X370 Professional Gaming 43b1 X399 Series Chipset PCIe Bridge 43b4 300 Series Chipset PCIe Port + 43b5 X370 Series Chipset SATA Controller + 1849 43c8 Fatal1ty X370 Professional Gaming 43b6 X399 Series Chipset SATA Controller 43b7 300 Series Chipset SATA Controller + 43b9 X370 Series Chipset USB 3.1 xHCI Controller + 1849 43d0 Fatal1ty X370 Professional Gaming 43ba X399 Series Chipset USB 3.1 xHCI Controller 43bb 300 Series Chipset USB 3.1 xHCI Controller + 43c6 400 Series Chipset PCIe Bridge + 43c7 400 Series Chipset PCIe Port + 43c8 400 Series Chipset SATA Controller + 43d5 400 Series Chipset USB 3.1 XHCI Controller 7006 AMD-751 [Irongate] System Controller 7007 AMD-751 [Irongate] AGP Bridge 700a AMD-IGR4 AGP Host to PCI Bridge @@ -4778,11 +4899,14 @@ 1028 028d PowerEdge T410 MGA G200eW WPCM450 1028 029c PowerEdge M710 MGA G200eW WPCM450 1028 02a4 PowerEdge T310 MGA G200eW WPCM450 + 15d9 0605 X8SIL 15d9 0624 X9SCM-F Motherboard + 15d9 066b X9SRL-F 15d9 a811 H8DGU 0533 MGA G200EH 103c 3381 iLO4 0534 G200eR2 + 1028 04f7 PowerEdge R320 server 0536 Integrated Matrox G200eW3 Graphics Controller 0538 MGA G200eH3 1590 00e4 iLO5 VGA @@ -5290,6 +5414,7 @@ 122e PCI-X Local Bus Adapter 127b sx1000 System Bus Adapter 127c sx1000 I/O Controller + 128d Diva [GSP] Management Board 1290 Auxiliary Diva Serial Port 103c 1291 Diva SP2 1291 Auxiliary Diva Serial Port @@ -5819,10 +5944,19 @@ 104d Sony Corporation 8004 DTL-H2500 [Playstation development board] 8009 CXD1947Q i.LINK Controller + 800c DTL-H800 [PS1 sound development board] 8039 CXD3222 i.LINK Controller + 8047 PS2 TOOL MRP 8056 Rockwell HCF 56K modem 808a Memory Stick Controller + 80ff PS2 Performance Analyzer + 814a PS2 Performance Analyzer + 8183 ATHENS [PS3 prototype developer interface card] + 81b0 BM-1 [PSP TOOL Board Management Device] + 81c3 VO-4 [PSP TOOL Video Output Device] 81ce SxS Pro memory card + 81ff PS3 TOOL MRP + 820e CXD9208GP [PS3 PS2 emulation subsystem adapter] # 2nd ID 905c SxS Pro memory card # 2nd ID @@ -6258,6 +6392,8 @@ 0074 U4 HT Bridge # should be 14e4:1645 1645 Broadcom NetXtreme BCM5701 Gigabit Ethernet + 1801 T2 Bridge Controller + 1802 T2 Secure Enclave Processor 2001 S1X NVMe Controller 2002 S3ELab NVMe Controller 2003 S3X NVMe Controller @@ -6373,6 +6509,8 @@ 1077 02a8 QLE2692 Dual Port 16Gb FC to PCIe Gen3 x8 Adapter 1077 02ab QLE2740 Single Port 32Gb FC to PCIe Gen3 x8 Adapter 1077 02ac QLE2742 Dual Port 32Gb FC to PCIe Gen3 x8 Adapter + 1077 02b8 2x16Gb QME2692 FC HBA + 1077 02b9 2x32Gb QME2742 FC HBA 1590 00f9 StoreFabric SN1100Q 16Gb Single Port Fibre Channel Host Bus Adapter 1590 00fa StoreFabric SN1100Q 16Gb Dual Port Fibre Channel Host Bus Adapter 1590 0203 StoreFabric SN1600Q 32Gb Single Port Fibre Channel Host Bus Adapter @@ -6442,10 +6580,14 @@ 1077 0007 QLogic 2x1GE+2x10GE QL41264HMCU CNA 1077 0009 QLogic 2x1GE+2x10GE QL41162HMRJ CNA 1077 000b 25GE 2P QL41262HxCU-DE Adapter + 1077 000f 2x25GE QL41262HMKR CNA + 1077 0010 2x25GE QL41232HMKR NIC 1077 0011 FastLinQ QL41212HLCU 25GbE Adapter 1077 0012 FastLinQ QL41112H 10GbE Adapter 1077 0019 QL41232HOCU - Dual Port 25/10GbE SFP28 OCP Adapter 1077 0039 QLogic QL41262 PCIe 25Gb 2-Port SFP28 Ethernet Adapter + 1590 021a 10GbE 2P QL41162HLRJ-HP Adapter + 1590 021b 10GbE 2P QL41162HLRJ-HP Adapter 1590 021d 10/25GbE 2P QL41222HLCU-HP Adapter 1590 021e 10/25GbE 2P QL41162HMRJ-HP Adapter 1590 021f 10/25GbE 2P QL41262HMCU-HP Adapter @@ -6462,6 +6604,9 @@ 1077 000c QLogic 2x25GE QL41262HMCU CNA 1077 000d FastLinQ QL41262H 25GbE FCoE Adapter 1077 000e FastLinQ QL41162H 10GbE FCoE Adapter + 1077 000f 2x25GE QL41262HMKR CNA + 1590 021a 10GbE 2P QL41162HLRJ-HP Adapter + 1590 021b 10GbE 2P QL41162HLRJ-HP Adapter 8084 FastLinQ QL41000 Series 10/25/40/50GbE Controller (iSCSI) 1077 0001 10GE 2P QL41162HxRJ-DE Adapter 1077 0002 10GE 2P QL41112HxCU-DE Adapter @@ -6475,6 +6620,9 @@ 1077 000c QLogic 2x25GE QL41262HMCU CNA 1077 000d FastLinQ QL41262H 25GbE iSCSI Adapter 1077 000e FastLinQ QL41162H 10GbE iSCSI Adapter + 1077 000f 2x25GE QL41262HMKR CNA + 1590 021a 10GbE 2P QL41162HLRJ-HP Adapter + 1590 021b 10GbE 2P QL41162HLRJ-HP Adapter 8090 FastLinQ QL41000 Series Gigabit Ethernet Controller (SR-IOV VF) 1077 0001 25GE 2P QL41262HxCU-DE Adapter 1077 0002 10GE 2P QL41112HxCU-DE Adapter @@ -6488,8 +6636,12 @@ 1077 000c QLogic 2x25GE QL41262HMCU CNA 1077 000d FastLinQ QL41262H 25GbE FCoE Adapter (SR-IOV VF) 1077 000e FastLinQ QL41162H 10GbE iSCSI Adapter (SR-IOV VF) + 1077 000f 2x25GE QL41262HMKR CNA + 1077 0010 2x25GE QL41232HMKR NIC 1077 0011 FastLinQ QL41212H 25GbE Adapter (SR-IOV VF) 1077 0012 FastLinQ QL41112H 10GbE Adapter (SR-IOV VF) + 1590 021a 10GbE 2P QL41162HLRJ-HP Adapter + 1590 021b 10GbE 2P QL41162HLRJ-HP Adapter 1590 021e 10/25GbE 2P QL41162HMRJ-HP Adapter 1590 021f 10/25GbE 2P QL41262HMCU-HP Adapter 8430 ISP8324 1/10GbE Converged Network Controller (NIC VF) @@ -7492,6 +7644,7 @@ 036c Bt879(??) Video Capture 13e9 0070 Win/TV (Video Section) 036e Bt878 Video Capture + 0000 0001 Euresys Picolo PCIe 0070 13eb WinTV Series 0070 ff01 Viewcast Osprey 200 0071 0101 DigiTV PCI @@ -7586,6 +7739,7 @@ 1851 1851 FlyVideo'98 EZ - video 1852 1852 FlyVideo'98 (with FM Tuner) 0878 Bt878 Audio Capture + 0000 0001 Euresys Picolo PCIe 0070 13eb WinTV Series 0070 ff01 Viewcast Osprey 200 0071 0101 DigiTV PCI @@ -8921,7 +9075,6 @@ 018b NV18GL [Quadro4 380 XGL] 018c NV18GL [Quadro NVS 50 PCI] 018d NV18M [GeForce4 448 Go] - 018f NV18 0190 G80 [GeForce 8800 GTS / 8800 GTX] 0191 G80 [GeForce 8800 GTX] 0192 G80 [GeForce 8800 GTS] @@ -9464,6 +9617,7 @@ 040f G84GL [Quadro FX 1700] 0410 G92 [GeForce GT 330] 0414 G92 [GeForce 9800 GT] + 0418 G92 [GeForce GT 330 OEM] 0420 G86 [GeForce 8400 SE] 0421 G86 [GeForce 8500 GT] 1462 0960 NX8500GT-TD512EH/M2 @@ -10324,10 +10478,12 @@ 0f00 GF108 [GeForce GT 630] 0f01 GF108 [GeForce GT 620] 0f02 GF108 [GeForce GT 730] + 0f03 GF108 [GeForce GT 610] 0f06 GF108 [GeForce GT 730] 0fb0 GM200 High Definition Audio 0fb8 GP108 High Definition Audio Controller 0fb9 GP107GL High Definition Audio Controller + 0fba GM206 High Definition Audio Controller 0fbb GM204 High Definition Audio Controller 0fc0 GK107 [GeForce GT 640 OEM] 0fc1 GK107 [GeForce GT 640] @@ -10509,6 +10665,9 @@ 10ef GP102 HDMI Audio Controller 10f0 GP104 High Definition Audio Controller 10f1 GP106 High Definition Audio Controller + 10f7 TU102 High Definition Audio Controller + 10f9 TU106 High Definition Audio Controller + 1043 8673 TURBO-RTX2070-8G 1140 GF117M [GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M] 1019 0799 GeForce 820M 1019 999f GeForce GT 720M @@ -11047,6 +11206,7 @@ 1392 GM107M [GeForce GTX 860M] 1393 GM107M [GeForce 840M] 1398 GM107M [GeForce 845M] + 1399 GM107M [GeForce 945M] 139a GM107M [GeForce GTX 950M] 17aa 362c GeForce GTX 950A 17aa 362f GeForce GTX 950A @@ -11121,13 +11281,20 @@ 174d GM108M [GeForce MX130] 174e GM108M [GeForce MX110] 1789 GM107GL [GRID M3-3020] + 179c GM107 [GeForce 940MX] 17c2 GM200 [GeForce GTX TITAN X] 17c8 GM200 [GeForce GTX 980 Ti] 17f0 GM200GL [Quadro M6000] 17f1 GM200GL [Quadro M6000 24GB] 17fd GM200GL [Tesla M40] + 1ad6 TU102 USB 3.1 Controller + 1ad7 TU102 UCSI Controller + 1ada TU106 USB 3.1 Host Controller + 1043 8673 TURBO-RTX2070-8G + 1adb TU106 USB Type-C Port Policy Controller + 1043 8673 TURBO-RTX2070-8G 1b00 GP102 [TITAN X] - 1b01 GP102 + 1b01 GP102 [GeForce GTX 1080 Ti 10GB] 1b02 GP102 [TITAN Xp] 1b04 GP102 1b06 GP102 [GeForce GTX 1080 Ti] @@ -11149,18 +11316,23 @@ 1462 11e9 GeForce GTX 1070 Max-Q 1558 9501 GeForce GTX 1070 Max-Q 1ba2 GP104M [GeForce GTX 1070 Mobile] + 1ba9 GP104M + 1baa GP104M 1bad GP104 [GeForce GTX 1070 Engineering Sample] 1bb0 GP104GL [Quadro P5000] 1bb1 GP104GL [Quadro P4000] 1bb3 GP104GL [Tesla P4] 1bb4 GP104GL [Tesla P6] 1bb5 GP104GLM [Quadro P5200 Mobile] + 103c 842f P5200 [Zbook 17 G5 mobile workstation] 1bb6 GP104GLM [Quadro P5000 Mobile] 1bb7 GP104GLM [Quadro P4000 Mobile] 1462 11e9 Quadro P4000 Max-Q 1bb8 GP104GLM [Quadro P3000 Mobile] 1bb9 GP104GLM [Quadro P4200 Mobile] + 103c 842f P4200 [Zbook 17 G5 mobile workstation] 1bbb GP104GLM [Quadro P3200 Mobile] + 103c 842f P3200 [Zbook 17 G5 moble workstation] 1bc7 GP104 [P104-101] 1be0 GP104BM [GeForce GTX 1080 Mobile] 1028 07c0 GeForce GTX 1080 Max-Q @@ -11178,6 +11350,9 @@ 17aa 39b9 GeForce GTX 1060 Max-Q 3GB 1c21 GP106M [GeForce GTX 1050 Ti Mobile] 1c22 GP106M [GeForce GTX 1050 Mobile] + 1c23 GP106M [GeForce GTX 1060 Mobile Rev. 2] + 1414 0020 GTX 1060 Mobile + 1c2d GP106M 1c30 GP106GL [Quadro P2000] 1c35 GP106 1c60 GP106BM [GeForce GTX 1060 Mobile 6GB] @@ -11201,17 +11376,28 @@ 1cb3 GP107GL [Quadro P400] 1cb6 GP107GL [Quadro P620] 1cba GP107GLM [Quadro P2000 Mobile] + 103c 842c P2000 [Zbook 15 G5 mobile workstation] + 103c 842f P2000 [Zbook 17 G5 mobile workstation] 1cbb GP107GLM [Quadro P1000 Mobile] + 103c 8429 P1000 [Zbook Studio G5 mobile workstation] + 103c 842c P1000 [Zbook 15 G5 mobile workstation] + 103c 842f P1000 [Zbook 17 G5 mobile workstation] + 103c 8451 P1000 [Zbook Studio x360 G5 mobile workstation] 1cbc GP107GLM [Quadro P600 Mobile] 1ccc GP107BM [GeForce GTX 1050 Ti Mobile] 1ccd GP107BM [GeForce GTX 1050 Mobile] 1d01 GP108 [GeForce GT 1030] 1d10 GP108M [GeForce MX150] + 17aa 225e ThinkPad T480 + 1d11 GP108M [GeForce MX230] 1d12 GP108M [GeForce MX150] 1d72 1701 Mi Notebook Pro [GeForce MX150] + 1d13 GP108M [GeForce MX250] 1d33 GP108GLM [Quadro P500 Mobile] + 1d52 GP108BM [GeForce MX250] 1d81 GV100 [TITAN V] 1db1 GV100GL [Tesla V100 SXM2 16GB] + 1db2 GV100 [Tesla V100-DGXS-16GB] 1db3 GV100GL [Tesla V100 FHHL 16GB] 1db4 GV100GL [Tesla V100 PCIe 16GB] 1db5 GV100GL [Tesla V100 SXM2 32GB] @@ -11219,11 +11405,41 @@ 1db7 GV100GL [Tesla V100 DGXS 32GB] 1dba GV100GL [Quadro GV100] 10de 12eb TITAN V CEO Edition - 1e07 GV102 - 1e3c GV102GL - 1e82 GV104 - 1e87 GV104 - 1eab GV104M + 1e02 TU102 [TITAN RTX] + 1e04 TU102 [GeForce RTX 2080 Ti] + 1e07 TU102 [GeForce RTX 2080 Ti Rev. A] + 1462 3715 RTX 2080 Ti GAMING X TRIO + 1e2d TU102B + 1e2e TU102B + 1e30 TU102GL [Quadro RTX 6000/8000] + 10de 129e Quadro RTX 8000 + 10de 12ba Quadro RTX 6000 + 1e38 TU102GL + 1e3c TU102GL + 1e3d TU102GL + 1e3e TU102GL + 1e82 TU104 [GeForce RTX 2080] + 1e87 TU104 [GeForce RTX 2080 Rev. A] + 1e90 TU104M [GeForce RTX 2080 Mobile] + 1eab TU104M + 1eae TU104M + 1eb0 TU104GL [Quadro RTX 5000] + 1eb1 TU104GL [Quadro RTX 4000] + 1eb8 TU104GL [Tesla T4] + 1ed0 TU104M [GeForce RTX 2080 Mobile] + 1f02 TU106 [GeForce RTX 2070] + 1043 8673 TURBO RTX 2070 + 1f04 TU106 + 1f07 TU106 [GeForce RTX 2070 Rev. A] + 1f08 TU106 [GeForce RTX 2060 Rev. A] + 1f10 TU106M [GeForce RTX 2070 Mobile] + 1f11 TU106M [GeForce RTX 2060 Mobile] + 1f2e TU106M + 1f50 TU106M [GeForce RTX 2070 Mobile] + 1f51 TU106M [GeForce RTX 2060 Mobile] + 1f82 TU107 + 1f92 TU107M + 1fbf TU107GL 10df Emulex Corporation 0720 OneConnect NIC (Skyhawk) 103c 1934 FlexFabric 20Gb 2-port 650M Adapter @@ -11264,6 +11480,7 @@ 10df e322 Lancer Gen6: LPe31000 Fibre Channel Host Adapter 10df e323 Lancer Gen6: LPe31000 Fibre Channel Host Adapter 10df e325 Lancer Gen6: LPe31000 Fibre Channel Host Adapter + e333 Lancer Gen6: LPe32000 Fibre Channel Host Adapter f011 Saturn: LightPulse Fibre Channel Host Adapter f015 Saturn: LightPulse Fibre Channel Host Adapter f085 LP850 Fibre Channel Host Adapter @@ -11410,6 +11627,7 @@ 524a RTS524A PCI Express Card Reader 5250 RTS5250 PCI Express Card Reader 525a RTS525A PCI Express Card Reader + 1028 06dc Latitude E7470 1028 06e4 XPS 15 9550 17aa 224f ThinkPad X1 Carbon 5th Gen 5286 RTS5286 PCI Express Card Reader @@ -11570,6 +11788,7 @@ 10ec 8739 Dell Wireless 1801 b822 RTL8822BE 802.11a/b/g/n/ac WiFi adapter c821 RTL8821CE 802.11ac PCIe Wireless Network Adapter + d723 RTL8723DE 802.11b/g/n PCIe Adapter 10ed Ascii Corporation 7310 V7310 10ee Xilinx Corporation @@ -11599,6 +11818,7 @@ ebf0 SED Systems Modulator/Demodulator ebf1 SED Systems Audio Interface Card ebf2 SED Systems Common PCI Interface + ebf3 SED Systems PCIe-AXI Bridge 10ef Racore Computer Products, Inc. 8154 M815x Token Ring Adapter 10f0 Peritek Corporation @@ -13089,6 +13309,15 @@ 1137 012e VIC 1227 PCIe Ethernet NIC 1137 0137 VIC 1380 Mezzanine Ethernet NIC 1137 014d VIC 1385 PCIe Ethernet NIC + 1137 015d VIC 1387 MLOM Ethernet NIC + 1137 0215 VIC 1440 Mezzanine Ethernet NIC + 1137 0216 VIC 1480 MLOM Ethernet NIC + 1137 0217 VIC 1455 PCIe Ethernet NIC + 1137 0218 VIC 1457 MLOM Ethernet NIC + 1137 0219 VIC 1485 PCIe Ethernet NIC + 1137 021a VIC 1487 MLOM Ethernet NIC + 1137 024a VIC 1495 PCIe Ethernet NIC + 1137 024b VIC 1497 MLOM Ethernet NIC 0044 VIC Ethernet NIC Dynamic 1137 0047 VIC P81E PCIe Ethernet NIC Dynamic 1137 0048 VIC M81KR Mezzanine Ethernet NIC Dynamic @@ -13134,6 +13363,7 @@ 1137 012c VIC 1340 MLOM Userspace NIC 1137 012e VIC 1227 PCIe Userspace NIC 1137 0137 VIC 1380 Mezzanine Userspace NIC + 023e 1GigE I350 LOM 1138 Ziatech Corporation 8905 8905 [STD 32 Bridge] 1139 Dynamic Pictures, Inc @@ -13509,6 +13739,13 @@ 0102 Extended IDE Controller 0103 EX-IDE Type-B 010f NVMe Controller + 0110 NVMe SSD Controller Cx5 + 1028 1ffb Express Flash NVMe 960G (RI) U.2 (CD5) + 1028 1ffc Express Flash NVMe 1.92T (RI) U.2 (CD5) + 1028 1ffd Express Flash NVMe 3.84T (RI) U.2 (CD5) + 1028 1ffe Express Flash NVMe 7.68T (RI) U.2 (CD5) + 1d49 4039 Thinksystem U.2 CM5 NVMe SSD + 1d49 403a Thinksystem AIC CM5 NVMe SSD 0115 XG4 NVMe SSD Controller 0404 DVD Decoder card 0406 Tecra Video Capture device @@ -13611,7 +13848,7 @@ 14ef 0220 PCD-RP-220S 17aa 201c ThinkPad X60/X60s 17aa 20c4 ThinkPad T61/R61 - 17aa 20c6 ThinkPad R61 + 17aa 20c6 ThinkPad R61/T400 0477 RL5c477 0478 RL5c478 1014 0184 ThinkPad A30p @@ -13646,7 +13883,7 @@ 1043 1237 A6J-Q008 1043 1967 V6800V 144d c018 X20 IV - 17aa 20ca ThinkPad T61 + 17aa 20ca ThinkPad T61/T400 0811 R5C811 0822 R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter 1014 0556 ThinkPad X40 / X41 / X60s / Z60t @@ -13668,7 +13905,7 @@ 144d c018 X20 IV 17aa 201d ThinkPad X60/X60s 17aa 20c7 ThinkPad T61 - 17aa 20c8 ThinkPad W500 + 17aa 20c8 ThinkPad T400/W500 0832 R5C832 IEEE 1394 Controller 1025 0121 Aspire 5920G 1028 01d7 XPS M1210 @@ -13705,6 +13942,7 @@ 1043 1967 V6800V 1180 0852 Pavilion 2410us 1324 10cf P7120 + 17aa 20cb ThinkPad T400 e230 R5U2xx (R5U230 / R5U231 / R5U241) [Memory Stick Host Controller] e476 CardBus bridge 1028 040a Latitude E6410 @@ -13712,6 +13950,7 @@ e822 MMC/SD Host Controller 1028 040a Latitude E6410 1028 040b Latitude E6510 + 17aa 21cf ThinkPad T520 e823 PCIe SDXC/MMC Host Controller 17aa 21cf ThinkPad T520 e832 R5C832 PCIe IEEE 1394 Controller @@ -14376,6 +14615,7 @@ 7384 PM7384 [FREEDM - 84P672 Frm Engine & Datalink Mgr] 8000 PM8000 [SPC - SAS Protocol Controller] 8009 PM8009 SPCve 8x6G + 8018 PM8018 Adaptec SAS Adaptor ASA-70165H PCIe Gen3 x8 6 Gbps 16-lane 4x SFF-8644 8032 PM8032 Tachyon QE8 117c 003a Celerity FC-81EN Fibre Channel Adapter 117c 003b Celerity FC-82EN Fibre Channel Adapter @@ -16194,6 +16434,7 @@ 1043 8428 Virtuoso 100 (Xonar Xense) 1043 8467 CMI8786 (Xonar DG) 1043 8521 CMI8786 (Xonar DGX) + 1043 8522 Xonar DSX 1043 85f4 Virtuoso 100 (Xonar Essence STX II) 13f6 8782 PCI 2.0 HD Audio 13f6 ffff CMI8787-HG2PCI @@ -16225,15 +16466,19 @@ 1612 0004 PCI-1612 4-port RS-232/422/485 1603 PCI-1603 2-port isolated RS-232/current loop 1604 PCI-1604 2-port RS-232 + 1680 PCI-1680 Rev.A1 2-port CAN-bus with isolation protection 16ff PCI-16xx series PCI multiport serial board (function 1: RX/TX steering CPLD) 1601 0000 PCI-1601 2-port unisolated RS-422/485 PCI communications card 1602 0000 PCI-1602 2-port isolated RS-422/485 1612 0000 PCI-1612 4-port RS-232/422/485 1711 PCI-1711 16-channel data acquisition card 12-bit, 100kS/s + 1713 PCI-1713 32-channel isolated analog input card 1733 PCI-1733 32-channel isolated digital input card - 1752 PCI-1752 - 1754 PCI-1754 - 1756 PCI-1756 + 1734 PCI-1734 32-channel isolated digital output card + 1752 PCI-1752 64-channel Isolated Digital Output Card + 1754 PCI-1754 64-channel Isolated Digital Input Card + 1756 PCI-1756 64-ch Isolated Digital I/O PCI Card + a004 PCI-1612 4-port RS-232/422/485 # FPGA bridge to two SJA1000 c302 MIOe-3680 2-Port CAN-Bus MIOe Module with Isolation Protection 13ff Silicon Spice Inc @@ -16697,6 +16942,8 @@ 50ac T540-50AC Unified Wire Ethernet Controller 50ad T520-50AD Unified Wire Ethernet Controller 50ae T540-50AE Unified Wire Ethernet Controller + 50af T580-50AF Unified Wire Ethernet Controller + 50b0 T520-50B0 Unified Wire Ethernet Controller 5401 T520-CR Unified Wire Ethernet Controller 5402 T522-CR Unified Wire Ethernet Controller 5403 T540-CR Unified Wire Ethernet Controller @@ -16765,6 +17012,8 @@ 54ac T540-50AC Unified Wire Ethernet Controller 54ad T520-50AD Unified Wire Ethernet Controller 54ae T540-50AE Unified Wire Ethernet Controller + 54af T580-50AF Unified Wire Ethernet Controller + 54b0 T520-50B0 Unified Wire Ethernet Controller 5501 T520-CR Unified Wire Storage Controller 5502 T522-CR Unified Wire Storage Controller 5503 T540-CR Unified Wire Storage Controller @@ -16833,6 +17082,8 @@ 55ac T540-50AC Unified Wire Storage Controller 55ad T520-50AD Unified Wire Storage Controller 55ae T540-50AE Unified Wire Storage Controller + 55af T580-50AF Unified Wire Storage Controller + 55b0 T520-50B0 Unified Wire Storage Controller 5601 T520-CR Unified Wire Storage Controller 5602 T522-CR Unified Wire Storage Controller 5603 T540-CR Unified Wire Storage Controller @@ -16901,6 +17152,8 @@ 56ac T540-50AC Unified Wire Storage Controller 56ad T520-50AD Unified Wire Storage Controller 56ae T540-50AE Unified Wire Storage Controller + 56af T580-50AF Unified Wire Storage Controller + 56b0 T520-50B0 Unified Wire Storage Controller 5701 T520-CR Unified Wire Ethernet Controller 5702 T522-CR Unified Wire Ethernet Controller 5703 T540-CR Unified Wire Ethernet Controller @@ -17008,6 +17261,8 @@ 58ac T540-50AC Unified Wire Ethernet Controller [VF] 58ad T520-50AD Unified Wire Ethernet Controller [VF] 58ae T540-50AE Unified Wire Ethernet Controller [VF] + 58af T580-50AF Unified Wire Ethernet Controller [VF] + 58b0 T520-50B0 Unified Wire Ethernet Controller [VF] 6001 T6225-CR Unified Wire Ethernet Controller 6002 T6225-SO-CR Unified Wire Ethernet Controller 6003 T6425-CR Unified Wire Ethernet Controller @@ -17031,6 +17286,7 @@ 6087 T6225-6087 Unified Wire Ethernet Controller 6088 T62100-6088 Unified Wire Ethernet Controller 6089 T62100-6089 Unified Wire Ethernet Controller + 608a T62100-608a Unified Wire Ethernet Controller 6401 T6225-CR Unified Wire Ethernet Controller 6402 T6225-SO-CR Unified Wire Ethernet Controller 6403 T6425-CR Unified Wire Ethernet Controller @@ -17054,6 +17310,7 @@ 6487 T6225-6087 Unified Wire Ethernet Controller 6488 T62100-6088 Unified Wire Ethernet Controller 6489 T62100-6089 Unified Wire Ethernet Controller + 648a T62100-608a Unified Wire Ethernet Controller 6501 T6225-CR Unified Wire Storage Controller 6502 T6225-SO-CR Unified Wire Storage Controller 6503 T6425-CR Unified Wire Storage Controller @@ -17077,6 +17334,7 @@ 6587 T6225-6087 Unified Wire Storage Controller 6588 T62100-6088 Unified Wire Storage Controller 6589 T62100-6089 Unified Wire Storage Controller + 658a T62100-608a Unified Wire Storage Controller 6601 T6225-CR Unified Wire Storage Controller 6602 T6225-SO-CR Unified Wire Storage Controller 6603 T6425-CR Unified Wire Storage Controller @@ -17100,6 +17358,7 @@ 6687 T6225-6087 Unified Wire Storage Controller 6688 T62100-6088 Unified Wire Storage Controller 6689 T62100-6089 Unified Wire Storage Controller + 668a T62100-608a Unified Wire Storage Controller 6801 T6225-CR Unified Wire Ethernet Controller [VF] 6802 T6225-SO-CR Unified Wire Ethernet Controller [VF] 6803 T6425-CR Unified Wire Ethernet Controller [VF] @@ -17123,6 +17382,7 @@ 6887 T6225-6087 Unified Wire Ethernet Controller [VF] 6888 T62100-6088 Unified Wire Ethernet Controller [VF] 6889 T62100-6089 Unified Wire Ethernet Controller [VF] + 688a T62100-608a Unified Wire Ethernet Controller [VF] a000 PE10K Unified Wire Ethernet Controller 1426 Storage Technology Corp. 1427 Better On-Line Solutions @@ -17197,6 +17457,7 @@ a802 NVMe SSD Controller SM951/PM951 a804 NVMe SSD Controller SM961/PM961 a808 NVMe SSD Controller SM981/PM981 + 1d49 403b Thinksystem U.2 PM983 NVMe SSD a820 NVMe SSD Controller 171X 1028 1f95 Express Flash NVMe XS1715 SSD 400GB 1028 1f96 Express Flash NVMe XS1715 SSD 800GB @@ -17217,6 +17478,9 @@ 1014 0621 PCIe3 1.6TB NVMe Flash Adapter II x8 1014 0622 PCIe3 3.2TB NVMe Flash Adapter II x8 1014 0629 PCIe3 6.4TB NVMe Flash Adapter II x8 + 1014 064a PCIe3 1.6TB NVMe Flash Adapter III x8 + 1014 064b PCIe3 3.2TB NVMe Flash Adapter III x8 + 1014 064c PCIe3 6.4TB NVMe Flash Adapter III x8 1028 1fd9 Express Flash PM1725a 800GB SFF 1028 1fda Express Flash PM1725a 1.6TB SFF 1028 1fdb Express Flash PM1725a 3.2TB SFF @@ -17453,6 +17717,9 @@ e010 VScom 100HV2 1 port serial adaptor e020 VScom 200HV2 2 port serial adaptor 14d3 CIRTECH (UK) Ltd + 0002 DTL-T14000 Rev. 1 [PS2 TOOL CD/DVD Emulator] + 0003 DTL-T14000 Rev. 2 [PS2 TOOL CD/DVD Emulator] + 0004 DTL-T14000 Rev. 3 [PS2 TOOL CD/DVD Emulator] 14d4 Panacom Technology Corp 14d5 Nitsuko Corporation 14d6 Accusys Inc @@ -17676,7 +17943,8 @@ 103c 0890 NC6000 laptop 103c 099c NX6110/NC6120 10cf 1279 LifeBook E8010D - 165f NetXtreme BCM5720 Gigabit Ethernet PCIe + 165f NetXtreme BCM5720 2-port Gigabit Ethernet PCIe + 1028 04f7 PowerEdge R320 server 1662 NetXtreme II BCM57712 10 Gigabit Ethernet 1663 NetXtreme II BCM57712 10 Gigabit Ethernet Multi Function 1665 NetXtreme BCM5717 Gigabit Ethernet PCIe @@ -18203,6 +18471,8 @@ 5850 BCM5850 Crypto Accelerator 5e87 Valkyrie offload engine 8602 BCM7400/BCM7405 Serial ATA Controller + 9026 CN99xx [ThunderX2] Integrated USB 3.0 xHCI Host Controller + 9027 CN99xx [ThunderX2] Integrated AHCI/SATA 3 Host Controller a8d8 BCM43224/5 Wireless Network Adapter aa52 BCM43602 802.11ac Wireless LAN SoC b302 BCM56302 StrataXGS 24x1GE 2x10GE Switch Controller @@ -18218,11 +18488,13 @@ b842 BCM56842 Trident 10GE Switch Controller # Trident2 b850 Broadcom BCM56850 Switch ASIC + b880 BCM56880 Switch ASIC # Tomahawk b960 Broadcom BCM56960 Switch ASIC d802 BCM58802 Stingray 50Gb Ethernet SoC - 14e4 8024 Stingray Dual-Port 25Gb Ethernet PCIe SmartNIC w4GB DRAM - 14e4 8028 Stingray Dual-Port 25Gb Ethernet PCIe SmartNIC w8GB DRAM + 14e4 8021 Stingray Dual-Port 25Gb Ethernet PCIe SmartNIC w16GB DRAM (Part No BCM958802A8046C) + 14e4 8024 Stingray Dual-Port 25Gb Ethernet PCIe SmartNIC w4GB DRAM (Part No BCM958802A8044C) + 14e4 8028 Stingray Dual-Port 25Gb Ethernet PCIe SmartNIC w8GB DRAM (Part No BCM958802A8048C) d804 BCM58804 Stingray 100Gb Ethernet SoC 14e5 Pixelfusion Ltd 14e6 SHINING Technology Inc @@ -18881,6 +19153,8 @@ 020f MT28908A0 Family [ConnectX-6 Flash Recovery] 0210 MT28908A0 Family [ConnectX-6 Secure Flash Recovery] 0211 MT416842 Family [BlueField SoC Flash Recovery] + 0212 MT2892 Family [ConnectX-6 Dx Flash Recovery] + 0213 MT2892 Family [ConnectX-6 Dx Secure Flash Recovery] 024e MT53100 [Spectrum-2, Flash recovery mode] 024f MT53100 [Spectrum-2, Secure Flash recovery mode] 0262 MT27710 [ConnectX-4 Lx Programmable] EN @@ -18962,8 +19236,8 @@ 101a MT28800 Family [ConnectX-5 Ex Virtual Function] 101b MT28908 Family [ConnectX-6] 101c MT28908 Family [ConnectX-6 Virtual Function] - 101d MT28841 - 101e MT28850 + 101d MT2892 Family [ConnectX-6 Dx] + 101e MT2892 Family [ConnectX-6 Dx Virtual Function] 101f MT28851 1020 MT28860 1021 MT28861 @@ -19051,6 +19325,8 @@ 15b7 Sandisk Corp 2001 Skyhawk Series NVME SSD 5001 WD Black NVMe SSD + 5002 WD Black 2018/PC SN720 NVMe SSD + 5003 WD Black 2018/PC SN520 NVMe SSD 15b8 ADDI-DATA GmbH 1001 APCI1516 SP controller (16 digi outputs) 1003 APCI1032 SP controller (32 digi inputs w/ opto coupler) @@ -19316,6 +19592,7 @@ 7191 Proc10a_48S 71a1 Proc10a_66S 71b1 Proc10A + 72b1 HawkEye 73b1 Proc10s 165d Hsing Tech. Enterprise Co., Ltd. 165f Linux Media Labs, LLC @@ -19347,6 +19624,7 @@ 167e ONNTO Corp. 1681 Hercules 1682 XFX Pine Group Inc. + c580 Radeon RX 580 1688 CastleNet Technology Inc. 1170 WLAN 802.11b card # nee Atheros Communications, Inc. @@ -19578,6 +19856,7 @@ 1a3b 2100 AW-NB100H 802.11n Wireless Mini PCIe Card 003c QCA986x/988x 802.11ac Wireless Network Adapter 003e QCA6174 802.11ac Wireless Network Adapter + 1a56 143a Killer 1435 Wireless-AC 1a56 1525 Killer N1525 Wireless-AC 0040 QCA9980/9990 802.11ac Wireless Network Adapter 0041 QCA6164 802.11ac Wireless Network Adapter @@ -19662,6 +19941,8 @@ 4353 PMC-DX2003 Reconfigurable FPGA with TTL and Differential I/O 4357 PMC-DX502 Reconfigurable Differential I/O Module 4457 PMC730, APC730, AcPC730 Multifunction Module + 4471 XMC730 Multi-function I/O module with front I/O + 4473 XMC730CC Multi-function I/O module with rear I/O Conduction-cooled 464d PMC408 32-Channel Digital Input/Output Module 4850 PMC220-16 12-Bit Analog Output Module 4a42 PMC483, APC483, AcPC483 Counter Timer Module @@ -19797,7 +20078,15 @@ 1760 TEDIA spol. s r. o. 0101 PCD-7004 Digital Bi-Directional Ports PCI Card 0102 PCD-7104 Digital Input & Output PCI Card + 0121 PCT-7303A PC card with IRC counters + 0122 PCT-7408A PC card with counters and timers + 0123 PCT-7424 PCI card with standard counters + 0214 PCT-7424C (F0) PC card with standard counters + 0215 PCT-7424C (F1) PC card with standard counters + 0216 PCT-7424E (F0) PC card with standard counters + 0217 PCT-7424E (F1) PC card with standard counters 0303 PCD-7006C Digital Input & Output PCI Card + ff00 CTU CAN FD PCIe Card 1761 Pickering Interfaces Ltd 1771 InnoVISION Multimedia Ltd. # nee SBS Technologies @@ -19899,6 +20188,8 @@ a100 THUNDERX CN88XX 48 core SoC a200 OCTEON TX CN81XX/CN80XX a300 OCTEON TX CN83XX + af00 CN99xx [ThunderX2] Integrated PCI Host bridge + af84 CN99xx [ThunderX2] Integrated PCI Express RP Bridge 1787 Hightech Information System Ltd. 1789 Ennyah Technologies Corp. # also used by Struck Innovative Systeme for joint developments @@ -19909,13 +20200,28 @@ 0004 CAMAC Controller 0005 PROFIBUS 0006 AMCC HOTlink + 0007 LVD Cable Bus + 0008 100MHz, 64bit Sequence Generator based on VirtexII + 0009 double 14bit-ADC + 000a SIS1100 with N110 TDC + 000b double 14bit-ADC with memory 000d Synchronisation Slave 000e SIS1100-eCMC 000f TDC (GPX) 0010 PCIe Counter Timer 0011 SIS1100-e single link 0012 SIS1100-e quad link + 0013 4x2.5GHz SFP to 4 lane PCIe bridge + 0014 SIS1100 with GPX piggy back 0015 SIS8100 [Gigabit link, MicroTCA] + 0016 SIS1100e with 4 lanes + 0017 Quad 14bit, 50MHz ADC with 2.5GHz SFP + 0018 SIS8300 4-lane PCI Express, Micro TCA for Physics ADC + 0019 SIS SIS8300-Lx MTCA.4 Digitizer + 001a 100MHz, 64bit Sequence Generator based on VirtexII + 001c Quad 16bit, 150MHz ADC with 2.5GHz SFP + 0030 100MHz, 64bit Sequence Generator based on Spartan6 + 0031 200MHz 64bit Sequence Generator based on Spartan7 # nee Techwell, Inc. 1797 Intersil Techwell 5864 TW5864 multimedia video controller @@ -19957,6 +20263,7 @@ 7163 GL9701 PCIe to PCI Bridge 8083 GL880 USB 1.1 UHCI controller 8084 GL880 USB 2.0 EHCI controller + 9750 GL9750 SD Host Controller 17aa Lenovo 402b Intel 82599ES 10Gb 2-port Server Adapter X520-2 17ab Phillips Components @@ -20115,6 +20422,7 @@ 17f2 Albatron Corp. 17f3 RDC Semiconductor, Inc. 1010 R1010 IDE Controller + 1031 PCI/PCI-X to PCI-E Bridge 2012 M2012/R3308 VGA-compatible graphics adapter 6020 R6020 North Bridge 6021 R6021 Host Bridge @@ -20614,6 +20922,7 @@ 1924 0500 SFE4005-A0 c101 EF1-21022T [EtherFabric] 192a BiTMICRO Networks Inc. + 0008 RAMPART 192e TransDimension 1931 Option N.V. 000c Qualcomm MSM6275 UMTS chip @@ -20777,6 +21086,7 @@ 2048 Attansic L2 Fast Ethernet 2060 AR8152 v1.1 Fast Ethernet 2062 AR8152 v2.0 Fast Ethernet + 1043 8468 Eee PC 1015PX # E2200, E2201, E2205 e091 Killer E220x Gigabit Ethernet Controller e0a1 Killer E2400 Gigabit Ethernet Controller @@ -20786,10 +21096,14 @@ 0102 NodalCore C-2000 Content Classification Accelerator 0105 NodalCore C-3000 Content Classification Accelerator 196d Club-3D BV +196e PNY 1971 AGEIA Technologies, Inc. 1011 Physics Processing Unit [PhysX] 1043 0001 PhysX P1 -1974 Eberspaecher Electronics +# nee Eberspaecher Electronics +1974 Star Electronics GmbH & Co. KG + 0009 FlexCard PMC-II + 0011 FlexCard PMC-II Ethernet 1976 TRENDnet 1977 Parsec 197b JMicron Technology Corp. @@ -20826,6 +21140,8 @@ 1982 Distant Early Warning Communications Inc 1600 OX16C954 HOST-A 16ff OX16C954 HOST-B +1987 Phison Electronics Corporation + 5012 E12 NVMe Controller 1989 Montilio Inc. 0001 RapidFile Bridge 8001 RapidFile @@ -20907,8 +21223,12 @@ 19e5 3033 NVMe SSD ES3600C V3 1200GB HHHL AIC 19e5 3034 NVMe SSD ES3600C V3 1600GB HHHL AIC 19e5 3036 NVMe SSD ES3600C V3 3200GB HHHL AIC - 0200 Hi1822 Family (2*25GE) - 0201 Hi1822 Family (2*100GE) + 0200 Hi1822 Family (2*100GE) + 0202 Hi1822 Family (2*32G FC) + 0203 Hi1822 Family (2*16G FC) + 0205 Hi1822 Family (2*100GE) + 0210 Hi1822 Family (4*25GE) + 0212 Hi1822 Family (2*8G FC) 1710 iBMA Virtual Network Adapter 1711 Hi1710 [iBMC Intelligent Management system chip w/VGA support] 1822 Hi1822 Family (4*25GE) @@ -20934,6 +21254,7 @@ a238 HiSilicon USB 3.0 Host Controller a239 HiSilicon USB 2.0 2-port Host Controller a23a HiSilicon USB 2.0 Host Controller + a23b HiSilicon USB 1.1 Host Controller a250 HiSilicon ZIP Engine a251 HiSilicon ZIP Engine(Virtual Function) a255 HiSilicon SEC Engine @@ -20954,6 +21275,8 @@ 1a03 ASPEED Technology, Inc. 1150 AST1150 PCI-to-PCI Bridge 2000 ASPEED Graphics Family + 15d9 0832 X10SRL-F +1a05 deltaww 1a07 Kvaser AB 0006 CAN interface PC104+ HS/HS 0007 CAN interface PCIcanx II HS or HS/HS @@ -21084,7 +21407,7 @@ 0a44 microEnable IV-FULL x4 0e44 microEnable IV-GigE x4 1ae9 Wilocity Ltd. - 0101 Wil6200 PCI Express Root Port + 0101 Wil6200 PCI Express Upstream Port 0200 Wil6200 PCI Express Port 0201 Wil6200 Wireless PCI Express Port 0301 Wil6200 802.11ad Wireless Network Adapter @@ -21161,8 +21484,22 @@ 1080 ASM1083/1085 PCIe to PCI Bridge 1849 1080 Motherboard 1142 ASM1042A USB 3.0 Host Controller + 1184 ASM1184e PCIe Switch Port + 1849 1184 ASM1184e PCIe Switch 1242 ASM1142 USB 3.1 Host Controller 1343 ASM1143 USB 3.1 Host Controller + 2142 ASM2142 USB 3.1 Host Controller +1b26 Netcope Technologies, a.s. + c132 COMBO-LXT155 + c1c0 NFB-100G1-e0 + c1c1 NFB-100G1-e1 + c250 NFB-200G2-master + c251 NFB-200G2-slave + c2c0 NFB-100G2-e0 + c2c1 NFB-100G2-e1 + cb20 COMBO-20G + cb40 COMBO-40G + cb80 NFB-40G2 1b2c Opal-RT Technologies Inc. 1b36 Red Hat, Inc. 0001 QEMU PCI-PCI bridge @@ -21198,6 +21535,7 @@ 001f DSU 0020 ADQ14 0023 ADQ7 + 0026 ADQ8 2014 TX320 2019 S6000 # now owned by HGST (a Western Digital subsidiary) @@ -21258,6 +21596,7 @@ 1d5c 1000 Anker USB 3.0 Express Card 1009 FL1009 USB 3.0 Host Controller 1100 FL1100 USB 3.0 Host Controller + 16b8 6e31 Allegro Pro USB 3.0 PCIe 1b74 OpenVox Communication Co. Ltd. 0115 D115P/D115E Single-port E1/T1 card d130 D130P/D130E Single-port E1/T1 card (3rd GEN) @@ -21274,6 +21613,7 @@ e400 PX14400 Dual Xilinx Virtex5 based Digitizer 1b96 Western Digital 1b9a XAVi Technologies Corp. +1baa QNAP Systems, Inc. 1bad ReFLEX CES 1bb0 SimpliVity Corporation 0002 OmniCube Accelerator OA-3000 @@ -21298,8 +21638,14 @@ 0100 Nytro Flash Storage 1bb1 0101 Nytro XF1440 1bb1 0103 Nytro 5000 + 1bb1 0105 Nytro 5020 + 1bb1 0106 Nytro 5020 TCG 1bb1 0121 Nytro XM1440 1bb1 0123 Nytro 5000 +# Kiowa M.2 + 1bb1 0125 Nytro 5020 +# Kiowa M.2 TCG + 1bb1 0126 Nytro 5020 1bb1 01a1 Nytro XP7102 1bb3 Bluecherry 4304 BC-04120A MPEG4 4 port video encoder / decoder @@ -21382,8 +21728,10 @@ 1014 04f5 PCIe3 1.6TB NVMe Flash Adapter 1014 04f6 PCIe3 3.2TB NVMe Flash Adapter 0023 Ultrastar SN200 Series NVMe SSD + 1c58 8823 Ultrastar Memory (ME200) 1c5c SK hynix 1283 PC300 NVMe Solid State Drive + 1504 SC300 512GB M.2 2280 SATA Solid State Drive 1c5f Beijing Memblaze Technology Co. Ltd. 0540 PBlaze4 NVMe SSD # http://www.nicevt.ru/ (in Russian) @@ -21428,6 +21776,7 @@ 0008 ExaNIC V5P 0009 ExaNIC X25 0100 ExaDISK FX1 +1cf0 Akitio 1cf7 Subspace Dynamics 1d00 Pure Storage 1d05 Tongfang Hongkong Limited @@ -21544,9 +21893,12 @@ 1d72 Xiaomi 1d78 DERA 1d7c Aerotech, Inc. +1d82 NETINT Technologies Inc. 1d87 Fuzhou Rockchip Electronics Co., Ltd + 0100 RK3399 PCI Express Root Port + 1808 RK1808 Neural Network Processor Card 1d8f Enyx -1d94 Chengdu Higon IC Design Co.Ltd +1d94 Chengdu Haiguang IC Design Co., Ltd. 1450 Root Complex 1451 I/O Memory Management Unit 1452 PCIe Dummy Host Bridge @@ -21578,9 +21930,12 @@ 790e FCH LPC Bridge 1d95 Graphcore Ltd 0001 Colossus GC2 [C2] + 0002 Colossus GC1 [S1] 1da1 Teko Telecom S.r.l. 1da2 Sapphire Technology Limited 1dbb NGD Systems, Inc. +1dbf Guizhou Huaxintong Semiconductor Technology Co., Ltd + 0401 StarDragon4800 PCI Express Root Port 1de1 Tekram Technology Co.,Ltd. 0391 TRM-S1040 [DC-315 / DC-395 series] 2020 DC-390 @@ -21590,20 +21945,41 @@ 1000 IO Memory Controller 2000 NoLoad Hardware Development Kit 1def Ampere Computing, LLC - e005 Skylark PCI Express Root Port 0 [eMAG] - e006 Skylark PCI Express Root Port 1 [eMAG] - e007 Skylark PCI Express Root Port 2 [eMAG] - e008 Skylark PCI Express Root Port 3 [eMAG] - e009 Skylark PCI Express Root Port 4 [eMAG] - e00a Skylark PCI Express Root Port 5 [eMAG] - e00b Skylark PCI Express Root Port 6 [eMAG] - e00c Skylark PCI Express Root Port 7 [eMAG] + e005 eMAG PCI Express Root Port 0 + e006 eMAG PCI Express Root Port 1 + e007 eMAG PCI Express Root Port 2 + e008 eMAG PCI Express Root Port 3 + e009 eMAG PCI Express Root Port 4 + e00a eMAG PCI Express Root Port 5 + e00b eMAG PCI Express Root Port 6 + e00c eMAG PCI Express Root Port 7 +1df3 Ethernity Networks + 0201 ACE-NIC40 Programmable Network Accelerator + 1df3 0001 ENA1040 + 1df3 0002 ENA1044 + 1df3 0003 ENA1044S + 0202 ACE-NIC50 Programmable Network Accelerator + 1df3 0001 ENA2050F + 1df3 0002 ENA2050FS + 0203 ACE-NIC100 Programmable Network Accelerator + 1df3 0001 ENA2080F + 1df3 0002 ENA2080FS + 1df3 0003 ENA2100F + 0204 ACE-NIC-NID Programmable Network Accelerator + 1df3 0001 ENA1020Z + 1df3 0002 ENA1020ZS 1df7 opencpi.org 0001 ml605 0002 alst4 0003 alst4x 1dfc JSC NT-COM 1181 TDM 8 Port E1/T1/J1 Adapter +1e24 Squirrels Research Labs + 0101 Acorn CLE-101 + 0215 Acorn CLE-215 + 021f Acorn CLE-215+ + 1525 Xilinx BCU-1525 +1e3d Burlywood, Inc # nee Tumsan Oy 1fc0 Ascom (Finland) Oy 0300 E2200 Dual E1/Rawpipe Card @@ -21656,6 +22032,7 @@ 1154 0368 LGY-PCIE-MG 1432 8104 10 Gigabit Ethernet PCI Express Adapter 1546 4027 GE10-PCIE4XG202P 10Gbase-T/NBASE-T Ethernet Adapter + 1baa 3310 PCIe Expansion Card 1fc9 3015 Ethernet Adapter 4c52 1001 LREC6860BT 10 Gigabit Ethernet Adapter 4527 TN9710Q 5GBase-T/NBASE-T Ethernet Adapter @@ -22253,7 +22630,7 @@ 544c Teralogic Inc 0350 TL880-based HDTV/ATSC tuner 544d TBS Technologies - 6178 DVB-S2 4 Tuner PCIe Card + 6178 DVB Tuner PCIe Card 544d 6904 TBS6904 DVB-S2 Quad Tuner PCIe Card 544d 6905 TBS6905 DVB-S2 Quad Tuner PCIe Card 6205 0001 TBS6205 DVB-T2/T/C Quad TV Tuner PCIe Card @@ -22287,6 +22664,7 @@ c110 Virtualized HID # Device surfaced in guests to provide 2d graphics capabilities c147 Virtualized Graphics Device + c200 XCP-ng Project PCI Device for Windows Update 5854 GoTView 5ace Beholder International Ltd. 6205 TBS Technologies (wrong ID) @@ -22480,7 +22858,7 @@ 1043 108d VivoBook X202EV 0158 Xeon E3-1200 v2/Ivy Bridge DRAM Controller 1043 844d P8 series motherboard - 8086 2010 Server Board S1200BTS + 8086 2010 Server Board S1200BT Family 0159 Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port 015a Xeon E3-1200 v2/Ivy Bridge Graphics Controller 015c Xeon E3-1200 v2/3rd Gen Core processor DRAM Controller @@ -22526,6 +22904,7 @@ 0406 Haswell Integrated Graphics Controller 040a Xeon E3-1200 v3 Processor Integrated Graphics Controller 0412 Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller + 17aa 309f ThinkCentre M83 0416 4th Gen Core Processor Integrated Graphics Controller 17aa 220e ThinkPad T440p 041a Xeon E3-1200 v3 Processor Integrated Graphics Controller @@ -22985,13 +23364,41 @@ 0a2a Haswell-ULT Integrated Graphics Controller 0a2e Haswell-ULT Integrated Graphics Controller 0a53 DC P3520 SSD - 0a54 Express Flash NVMe P4500/P4600 + 0a54 NVMe Datacenter SSD [3DNAND, Beta Rock Controller] 1028 1fe1 Express Flash NVMe 1TB 2.5" U.2 (P4500) 1028 1fe2 Express Flash NVMe 2TB 2.5" U.2 (P4500) 1028 1fe3 Express Flash NVMe 4TB 2.5" U.2 (P4500) 1028 1fe4 Express Flash NVMe 4TB HHHL AIC (P4500) + 1028 1fee Express Flash NVMe 1.6TB 2.5" U.2 (P4610) + 1028 1fef Express Flash NVMe 3.2TB 2.5" U.2 (P4610) + 1028 1ff0 Express Flash NVMe 6.4TB 2.5" U.2 (P4610) + 1028 1fff Express Flash NVMe 8.0TB 2.5" U.2 (P4510) + 1028 2003 Express Flash NVMe 1.0 TB 2.5" U.2 (P4510) + 1028 2004 Express Flash NVMe 2.0TB 2.5" U.2 (P4510) + 1028 2005 Express Flash NVMe 4.0TB 2.5" U.2 (P4510) + 108e 4870 NVMe PCIe 3.0 SSD 6.4TB AIC (P4608) + 108e 4871 NVMe PCIe 3.0 SSD 6.4TB 2.5-inch (P4600) + 108e 487a NVMe PCIe 3.0 SSD v2 6.4TB 2.5-inch (P4610) + 1590 025d NVMe Datacenter SSD [3DNAND] 1.0TB 2.5" U.2 (P4500) + 1590 025e NVMe Datacenter SSD [3DNAND] 2.0TB 2.5" U.2 (P4500) + 1590 025f NVMe Datacenter SSD [3DNAND] 4.0TB 2.5" U.2 (P4500) + 1590 0262 NVMe Datacenter SSD [3DNAND] 1.6TB 2.5" U.2 (P4600) + 1590 0264 NVMe Datacenter SSD [3DNAND] 3.2TB 2.5" U.2 (P4600) + 1590 0265 NVMe Datacenter SSD [3DNAND] 6.4TB 2.5" U.2 (P4600) + 1590 026c NVMe Datacenter SSD [3DNAND] 4.0TB AIC (P4500) + 1d49 4802 Thinksystem U.2 P4510 NVMe SSD + 1d49 4812 Thinksystem U.2 P4610 NVMe SSD 8086 4308 Intel SSD D5-P4320 and D5-P4326 - 0a55 Express Flash NVMe P4600 + 8086 4702 NVMe Datacenter SSD [3DNAND] SE 2.5" U.2 (P4500) + 8086 4704 NVMe Datacenter SSD [3DNAND] SE AIC (P4500) + 8086 4712 NVMe Datacenter SSD [3DNAND] ME 2.5" U.2 (P4600) + 8086 4714 NVMe Datacenter SSD [3DNAND] ME AIC (P4600) + 8086 4802 NVMe Datacenter SSD [3DNAND] SE 2.5" U.2 (P4510) + 8086 4804 NVMe Datacenter SSD [3DNAND] SE AIC (P4510) + 8086 4805 NVMe Datacenter SSD [3DNAND] SE M.2 (P4511) + 8086 4812 NVMe Datacenter SSD [3DNAND] ME 2.5" U.2 (P4610) + 8086 4814 NVMe Datacenter SSD [3DNAND] ME AIC (P4610) + 0a55 NVMe DC SSD [3DNAND, Beta Rock Controller] 1028 1fe5 Express Flash NVMe 1.6TB 2.5" U.2 (P4600) 1028 1fe6 Express Flash NVMe 2TB 2.5" U.2 (P4600) 1028 1fe7 Express Flash NVMe 3.2TB 2.5" U.2 (P4600) @@ -23024,6 +23431,7 @@ 0bf6 Atom Processor D2xxx/N2xxx DRAM Controller 0bf7 Atom Processor D2xxx/N2xxx DRAM Controller 0c00 4th Gen Core Processor DRAM Controller + 17aa 309f ThinkCentre M83 0c01 Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller 0c04 Xeon E3-1200 v3/4th Gen Core Processor DRAM Controller 103c 1909 ZBook 15 @@ -23033,6 +23441,7 @@ 0c09 Xeon E3-1200 v3/4th Gen Core Processor PCI Express x4 Controller 0c0c Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller 17aa 220e ThinkPad T440p + 17aa 309f ThinkCentre M83 0c46 Atom Processor S1200 PCI Express Root Port 1 0c47 Atom Processor S1200 PCI Express Root Port 2 0c48 Atom Processor S1200 PCI Express Root Port 3 @@ -23079,14 +23488,18 @@ 0d26 Crystal Well Integrated Graphics Controller 0d36 Crystal Well Integrated Graphics Controller 0e00 Xeon E7 v2/Xeon E5 v2/Core i7 DMI2 + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server + 15d9 066b X9SRL-F 0e01 Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port in DMI2 Mode 0e02 Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 1a + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server 0e03 Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 1b 0e04 Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 2a 0e05 Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 2b 0e06 Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 2c 0e07 Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 2d 0e08 Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 3a + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server 0e09 Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 3b 0e0a Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 3c 0e0b Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 3d @@ -23099,24 +23512,48 @@ 0e1e Xeon E7 v2/Xeon E5 v2/Core i7 UBOX Registers 0e1f Xeon E7 v2/Xeon E5 v2/Core i7 UBOX Registers 0e20 Xeon E7 v2/Xeon E5 v2/Core i7 Crystal Beach DMA Channel 0 + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server + 15d9 066b X9SRL-F 0e21 Xeon E7 v2/Xeon E5 v2/Core i7 Crystal Beach DMA Channel 1 + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server + 15d9 066b X9SRL-F 0e22 Xeon E7 v2/Xeon E5 v2/Core i7 Crystal Beach DMA Channel 2 + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server + 15d9 066b X9SRL-F 0e23 Xeon E7 v2/Xeon E5 v2/Core i7 Crystal Beach DMA Channel 3 + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server + 15d9 066b X9SRL-F 0e24 Xeon E7 v2/Xeon E5 v2/Core i7 Crystal Beach DMA Channel 4 + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server + 15d9 066b X9SRL-F 0e25 Xeon E7 v2/Xeon E5 v2/Core i7 Crystal Beach DMA Channel 5 + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server + 15d9 066b X9SRL-F 0e26 Xeon E7 v2/Xeon E5 v2/Core i7 Crystal Beach DMA Channel 6 + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server + 15d9 066b X9SRL-F 0e27 Xeon E7 v2/Xeon E5 v2/Core i7 Crystal Beach DMA Channel 7 + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server + 15d9 066b X9SRL-F 0e28 Xeon E7 v2/Xeon E5 v2/Core i7 VTd/Memory Map/Misc + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server + 15d9 066b X9SRL-F 0e29 Xeon E7 v2/Xeon E5 v2/Core i7 Memory Hotplug 0e2a Xeon E7 v2/Xeon E5 v2/Core i7 IIO RAS + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server + 15d9 066b X9SRL-F 0e2c Xeon E7 v2/Xeon E5 v2/Core i7 IOAPIC + 15d9 066b X9SRL-F 0e2e Xeon E7 v2/Xeon E5 v2/Core i7 CBDMA 0e2f Xeon E7 v2/Xeon E5 v2/Core i7 CBDMA 0e30 Xeon E7 v2/Xeon E5 v2/Core i7 Home Agent 0 + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server 0e32 Xeon E7 v2/Xeon E5 v2/Core i7 QPI Link 0 0e33 Xeon E7 v2/Xeon E5 v2/Core i7 QPI Link 1 0e34 Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server 0e36 Xeon E7 v2/Xeon E5 v2/Core i7 QPI Ring Performance Ring Monitoring + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server 0e37 Xeon E7 v2/Xeon E5 v2/Core i7 QPI Ring Performance Ring Monitoring 0e38 Xeon E7 v2/Xeon E5 v2/Core i7 Home Agent 1 0e3a Xeon E7 v2/Xeon E5 v2/Core i7 QPI Link 2 @@ -23143,6 +23580,7 @@ 0e7f Xeon E7 v2/Xeon E5 v2/Core i7 QPI Ring Registers 0e80 Xeon E7 v2/Xeon E5 v2/Core i7 QPI Link 0 0e81 Xeon E7 v2/Xeon E5 v2/Core i7 QPI Ring Registers + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server 0e83 Xeon E7 v2/Xeon E5 v2/Core i7 QPI Link Reut 0 0e84 Xeon E7 v2/Xeon E5 v2/Core i7 QPI Link Reut 0 0e85 Xeon E7 v2/Xeon E5 v2/Core i7 QPI Link Agent Register @@ -23152,6 +23590,7 @@ 0e94 Xeon E7 v2/Xeon E5 v2/Core i7 QPI Link Reut 1 0e95 Xeon E7 v2/Xeon E5 v2/Core i7 QPI Link Agent Register 0ea0 Xeon E7 v2/Xeon E5 v2/Core i7 Home Agent 0 + 1028 04f7 Xeon E5 v2 on PowerEdge R320 server 0ea8 Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Target Address/Thermal Registers 0eaa Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers 0eab Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers @@ -23429,6 +23868,8 @@ 104b 82566DC Gigabit Network Connection 104c 82562V 10/100 Network Connection 104d 82566MC Gigabit Network Connection + 104e Ethernet Controller X710 for 10 Gigabit SFP+ + 104f Ethernet Controller X710 for 10 Gigabit backplane 1050 82562EZ 10/100 Ethernet Controller 1028 019d Dimension 3000 1462 728c 865PE Neo2 (MS-6728) @@ -23644,9 +24085,11 @@ 1043 8369 Motherboard 1093 76e9 PCIe-8233 Ethernet Adapter 10a9 8029 Prism XL Single Port Gigabit Ethernet + 15d9 0605 X8SIL 15d9 060a X7SPA-H/X7SPA-HF Motherboard 15d9 060d C7SIM-Q Motherboard 8086 0001 Gigabit CT2 Desktop Adapter + 8086 3578 Server Board S1200BTLR 8086 357a Server Board S1200BTS 8086 a01f Gigabit CT Desktop Adapter e4bf 50c1 PC1-GROOVE @@ -23699,6 +24142,7 @@ 8086 106f 10-Gigabit XF LR Server Adapter 8086 a06f 10-Gigabit XF LR Server Adapter 10f5 82567LM Gigabit Network Connection + 17aa 20ee ThinkPad T400 10f6 82574L Gigabit Network Connection 10f7 10 Gigabit BR KX4 Dual Port Network Connection 108e 7b12 Sun Dual 10GbE PCIe 2.0 FEM @@ -23981,6 +24425,7 @@ 1502 82579LM Gigabit Network Connection (Lewisville) 1028 04a3 Precision M4600 17aa 21ce ThinkPad T520 + 8086 3578 Server Board S1200BTLR 8086 357a Server Board S1200BTS 1503 82579V Gigabit Network Connection 1043 849c P8P67 Deluxe Motherboard @@ -24042,6 +24487,7 @@ 1093 76b1 PCIe-8237R-S Ethernet Adapter 1093 775b PCIe-8237 Ethernet Adapter 10a9 802a UV2-BaseIO dual-port GbE + 1137 023e 1GigE I350 LOM 15d9 0652 Dual Port i350 GbE MicroLP [AOC-CGP-i2] 17aa 1074 ThinkServer I350-T4 AnyFabric 17aa 4005 I350 Gigabit Network Connection @@ -24109,6 +24555,7 @@ 152e 82599 Virtual Function 152f I350 Virtual Function 1530 X540 Virtual Function + 1531 I210 Gigabit Unprogrammed 1533 I210 Gigabit Network Connection 103c 0003 Ethernet I210-T1 GbE NIC 1093 7706 Compact Vision System Ethernet Adapter @@ -24131,6 +24578,7 @@ 153a Ethernet Connection I217-LM 103c 1909 ZBook 15 17aa 220e ThinkPad T440p + 17aa 309f ThinkCentre M83 153b Ethernet Connection I217-V 1547 DSL3510 Thunderbolt Controller [Cactus Ridge 4C 2012] 1548 DSL3310 Thunderbolt Controller [Cactus Ridge 2C 2012] @@ -24186,6 +24634,7 @@ 156c DSL5520 Thunderbolt 2 NHI [Falcon Ridge 4C 2013] 156d DSL5520 Thunderbolt 2 Bridge [Falcon Ridge 4C 2013] 156f Ethernet Connection I219-LM + 1028 06dc Latitude E7470 1570 Ethernet Connection I219-V 1571 Ethernet Virtual Function 700 Series 1572 Ethernet Controller X710 for 10GbE SFP+ @@ -24280,9 +24729,12 @@ 8086 00a0 Ethernet Converged Network Adapter X710-T4 8086 1003 Ethernet Converged Network Adapter X710-T 158a Ethernet Controller XXV710 for 25GbE backplane + 1590 0000 10/25Gb Ethernet Adapter 1590 0286 Synergy 4610C 10/25Gb Ethernet Adapter 8086 000a Ethernet 25G 2P XXV710 Mezz 158b Ethernet Controller XXV710 for 25GbE SFP28 + 1137 0000 Ethernet Network Adapter XXV710 + 1137 0225 Ethernet Network Adapter XXV710 8086 0000 Ethernet Network Adapter XXV710 8086 0001 Ethernet Network Adapter XXV710-2 8086 0002 Ethernet Network Adapter XXV710-2 @@ -24294,6 +24746,9 @@ 8086 0008 Ethernet Network Adapter OCP XXV710-1 8086 0009 Ethernet 25G 2P XXV710 Adapter 8086 4001 Ethernet Network Adapter XXV710-2 + 1591 Ethernet Controller E810-C for backplane + 1592 Ethernet Controller E810-C for QSFP + 1593 Ethernet Controller E810-C for SFP 15a0 Ethernet Connection (2) I218-LM 15a1 Ethernet Connection (2) I218-V 15a2 Ethernet Connection (3) I218-LM @@ -24304,8 +24759,8 @@ 15a9 X552 Virtual Function 15aa Ethernet Connection X552 10 GbE Backplane 1059 0120 T4008 10GbE interface - 1059 0150 RD-01068 10GbE interface 15ab Ethernet Connection X552 10 GbE Backplane + 1059 0150 RD-01068 10GbE interface 1059 0170 RD-01213 10GbE interface 15ac Ethernet Connection X552 10 GbE SFP+ 1059 0160 RD-01167 10GbE interface @@ -24350,8 +24805,10 @@ 15d8 Ethernet Connection (4) I219-V 17aa 2247 ThinkPad T570 17aa 224f ThinkPad X1 Carbon 5th Gen + 17aa 225d ThinkPad T480 15d9 JHL6340 Thunderbolt 3 NHI (C step) [Alpine Ridge 2C 2016] 15da JHL6340 Thunderbolt 3 Bridge (C step) [Alpine Ridge 2C 2016] + 15db JHL6340 Thunderbolt 3 USB 3.1 Controller (C step) [Alpine Ridge 2C 2016] 15df Ethernet Connection (8) I219-LM 15e0 Ethernet Connection (8) I219-V 15e1 Ethernet Connection (9) I219-LM @@ -24367,6 +24824,8 @@ 15ec JHL7540 Thunderbolt 3 USB Controller [Titan Ridge 4C 2018] 15ef JHL7540 Thunderbolt 3 Bridge [Titan Ridge DD 2018] 15f0 JHL7540 Thunderbolt 3 USB Controller [Titan Ridge DD 2018] + 15f6 I210 Gigabit Ethernet Connection + 15ff Ethernet Controller X710 for 10GBASE-T 1600 Broadwell-U Host Bridge -OPI 1601 Broadwell-U PCI Express x16 Controller 1602 Broadwell-U Integrated Graphics @@ -24410,8 +24869,11 @@ 1901 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) 1902 HD Graphics 510 1903 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem + 1028 06dc Latitude E7470 1028 06e4 XPS 15 9550 + 17aa 225d ThinkPad T480 1904 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers + 1028 06dc Latitude E7470 1028 06f3 Latitude 3570 17aa 382a B51-80 Laptop 1905 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x8) @@ -24426,8 +24888,10 @@ 1911 Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th Gen Core Processor Gaussian Mixture Model 17aa 2247 ThinkPad T570 17aa 224f ThinkPad X1 Carbon 5th Gen + 17aa 225d ThinkPad T480 1912 HD Graphics 530 1916 Skylake GT2 [HD Graphics 520] + 1028 06dc Latitude E7470 1028 06f3 Latitude 3570 1918 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers 1919 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Imaging Unit @@ -24521,7 +24985,7 @@ 1c02 6 Series/C200 Series Chipset Family 6 port Desktop SATA AHCI Controller 1028 04aa XPS 8300 1043 844d P8 series motherboard - 8086 7270 Server Board S1200BTS + 8086 7270 Server Board S1200BT Family 1c03 6 Series/C200 Series Chipset Family 6 port Mobile SATA AHCI Controller 1028 04a3 Precision M4600 1028 04b2 Vostro 3350 @@ -24579,7 +25043,7 @@ 1028 04da Vostro 3750 1043 844d P8 series motherboard 17aa 21cf ThinkPad T520 - 8086 7270 Server Board S1200BTS / Apple MacBook Pro 8,1/8,2 + 8086 7270 Server Board S1200BT Family / Apple MacBook Pro 8,1/8,2 1c24 6 Series/C200 Series Chipset Family Thermal Management Controller 1c25 6 Series/C200 Series Chipset Family DMI to PCI Bridge 1c26 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 @@ -24589,7 +25053,7 @@ 1028 04da Vostro 3750 1043 844d P8 series motherboard 17aa 21cf ThinkPad T520 - 8086 7270 Server Board S1200BTS / Apple MacBook Pro 8,1/8,2 + 8086 7270 Server Board S1200BT Family / Apple MacBook Pro 8,1/8,2 1c27 6 Series/C200 Series Chipset Family USB Universal Host Controller #1 8086 7270 Apple MacBookPro8,2 [Core i7, 15", 2011] 1c2c 6 Series/C200 Series Chipset Family USB Universal Host Controller #5 @@ -24601,7 +25065,7 @@ 1028 04da Vostro 3750 1043 844d P8 series motherboard 17aa 21cf ThinkPad T520 - 8086 7270 Server Board S1200BTS / Apple MacBook Pro 8,1/8,2 + 8086 7270 Server Board S1200BT Family / Apple MacBook Pro 8,1/8,2 1c33 6 Series/C200 Series Chipset Family LAN Controller 1c35 6 Series/C200 Series Chipset Family VECI Controller 1c3a 6 Series/C200 Series Chipset Family MEI Controller #1 @@ -24659,10 +25123,12 @@ 1c5f 6 Series/C200 Series Chipset Family LPC Controller 1d00 C600/X79 series chipset 4-Port SATA IDE Controller 1d02 C600/X79 series chipset 6-Port SATA AHCI Controller + 1028 04f7 C602J on PowerEdge R320 server 1d04 C600/X79 series chipset SATA RAID Controller 1d06 C600/X79 series chipset SATA Premium RAID Controller 1d08 C600/X79 series chipset 2-Port SATA IDE Controller 1d10 C600/X79 series chipset PCI Express Root Port 1 + 1028 04f7 C602J on PowerEdge R320 server 1d11 C600/X79 series chipset PCI Express Root Port 1 1d12 C600/X79 series chipset PCI Express Root Port 2 1d13 C600/X79 series chipset PCI Express Root Port 2 @@ -24671,29 +25137,44 @@ 1d16 C600/X79 series chipset PCI Express Root Port 4 1d17 C600/X79 series chipset PCI Express Root Port 4 1d18 C600/X79 series chipset PCI Express Root Port 5 + 1028 04f7 C602J on PowerEdge R320 server 1d19 C600/X79 series chipset PCI Express Root Port 5 1d1a C600/X79 series chipset PCI Express Root Port 6 1d1b C600/X79 series chipset PCI Express Root Port 6 1d1c C600/X79 series chipset PCI Express Root Port 7 1d1d C600/X79 series chipset PCI Express Root Port 7 1d1e C600/X79 series chipset PCI Express Root Port 8 + 1028 04f7 C602J on PowerEdge R320 server 1d1f C600/X79 series chipset PCI Express Root Port 8 1d20 C600/X79 series chipset High Definition Audio Controller 1d22 C600/X79 series chipset SMBus Host Controller + 15d9 066b X9SRL-F 1d24 C600/X79 series chipset Thermal Management Controller + 15d9 066b X9SRL-F 1d25 C600/X79 series chipset DMI to PCI Bridge 1d26 C600/X79 series chipset USB2 Enhanced Host Controller #1 + 1028 04f7 C602J on PowerEdge R320 server + 15d9 066b X9SRL-F 1d2d C600/X79 series chipset USB2 Enhanced Host Controller #2 + 1028 04f7 C602J on PowerEdge R320 server + 15d9 066b X9SRL-F 1d33 C600/X79 series chipset LAN Controller 1d35 C600/X79 series chipset VECI Controller 1d3a C600/X79 series chipset MEI Controller #1 + 1028 04f7 C602J on PowerEdge R320 server + 15d9 066b X9SRL-F 1d3b C600/X79 series chipset MEI Controller #2 + 1028 04f7 C602J on PowerEdge R320 server + 15d9 066b X9SRL-F 1d3c C600/X79 series chipset IDE-r Controller 1d3d C600/X79 series chipset KT Controller 1d3e C600/X79 series chipset PCI Express Virtual Root Port + 1028 04f7 C602J on PowerEdge R320 server 1d3f C608/C606/X79 series chipset PCI Express Virtual Switch Port 1d40 C600/X79 series chipset LPC Controller 1d41 C600/X79 series chipset LPC Controller + 1028 04f7 C602J on PowerEdge R320 server + 15d9 066b X9SRL-F 1d50 C608 chipset Dual 4-Port SATA/SAS Storage Control Unit 1d54 C600/X79 series chipset Dual 4-Port SATA/SAS Storage Control Unit 1d55 C600/X79 series chipset 4-Port SATA/SAS Storage Control Unit @@ -24806,6 +25287,7 @@ 1043 1477 N56VZ 1043 1517 Zenbook Prime UX31A 1043 84ca P8 series motherboard + 17aa 21f3 ThinkPad T430 1849 1e31 Motherboard 1e33 7 Series/C210 Series Chipset Family LAN Controller 1e3a 7 Series/C216 Chipset Family MEI Controller #1 @@ -24921,13 +25403,30 @@ 201a Sky Lake-E Non-Transparent Bridge Registers 201c Sky Lake-E Non-Transparent Bridge Registers 2020 Sky Lake-E DMI3 Registers + 15d9 095d X11SPM-TF 2021 Sky Lake-E CBDMA Registers 2024 Sky Lake-E MM/Vt-d Configuration Registers + 2025 Sky Lake-E RAS + 2026 Sky Lake-E IOAPIC 2030 Sky Lake-E PCI Express Root Port A 2031 Sky Lake-E PCI Express Root Port B 2032 Sky Lake-E PCI Express Root Port C 2033 Sky Lake-E PCI Express Root Port D + 2034 Sky Lake-E VT-d 2035 Sky Lake-E RAS Configuration Registers + 2036 Sky Lake-E IOxAPIC Configuration Registers + 2040 Sky Lake-E Integrated Memory Controller + 2041 Sky Lake-E Integrated Memory Controller + 2042 Sky Lake-E Integrated Memory Controller + 2043 Sky Lake-E Integrated Memory Controller + 2044 Sky Lake-E Integrated Memory Controller + 2045 Sky Lake-E LM Channel 1 + 2046 Sky Lake-E LMS Channel 1 + 2047 Sky Lake-E LMDP Channel 1 + 2048 Sky Lake-E DECS Channel 2 + 2049 Sky Lake-E LM Channel 2 + 204a Sky Lake-E LMS Channel 2 + 204b Sky Lake-E LMDP Channel 2 204c Sky Lake-E M3KTI Registers 204d Sky Lake-E M3KTI Registers 204e Sky Lake-E M3KTI Registers @@ -24935,6 +25434,9 @@ 2055 Sky Lake-E CHA Registers 2056 Sky Lake-E CHA Registers 2057 Sky Lake-E CHA Registers + 2058 Sky Lake-E KTI 0 + 2059 Sky Lake-E UPI Registers + 2066 Sky Lake-E Integrated Memory Controller 2068 Sky Lake-E DDRIO Registers 2069 Sky Lake-E DDRIO Registers 206a Sky Lake-E IOxAPIC Configuration Registers @@ -25184,6 +25686,7 @@ 1028 020d Inspiron 530 1028 0211 Optiplex 755 1028 02da OptiPlex 980 + 1028 04f7 PowerEdge R320 server 103c 2a3b Pavilion A1512X 103c 2a6f Asus IPIBL-LB Motherboard 103c 31fe ProLiant DL140 G3 @@ -26193,20 +26696,25 @@ 2700 Optane SSD 900P Series 8086 3900 900P Series [Add-in Card] 8086 3901 900P Series [2.5" SFF] - 2701 Optane DC P4800X Series SSD - 8086 3904 DC P4800X Series [Add-in Card] - 8086 3905 DC P4800X Series [2.5" SFF] + 2701 NVMe Datacenter SSD [Optane] + 1028 2000 Express Flash NVMe [Optane] 375GB 2.5" U.2 (P4800X) + 1028 2001 Express Flash NVMe [Optane] 750GB 2.5" U.2 (P4800X) + 1028 2002 Express Flash NVMe [Optane] 750GB AIC (P4800X) + 8086 3904 NVMe Datacenter SSD [Optane] x4 AIC (P4800X) + 8086 3905 NVMe Datacenter SSD [Optane] 15mm 2.5" U.2 (P4800X) 2770 82945G/GZ/P/PL Memory Controller Hub 1028 01ad OptiPlex GX620 103c 2a3b Pavilion A1512X 1043 817a P5LD2-VM Mainboard 107b 5048 E4500 1462 7418 Wind PC MS-7418 + 1849 2770 ConRoe1333-D667 8086 544e DeskTop Board D945GTP 2771 82945G/GZ/P/PL PCI Express Root Port 2772 82945G/GZ Integrated Graphics Controller 103c 2a3b Pavilion A1512X 1462 7418 Wind PC MS-7418 + 1849 2772 ConRoe1333-D667 8086 544e DeskTop Board D945GTP 8086 d605 Desktop Board D945GCCR 2774 82955X Memory Controller Hub @@ -26282,6 +26790,7 @@ 10f7 8338 Panasonic CF-Y5 laptop 17aa 2009 ThinkPad R60/T60/X60 series 27bc NM10 Family LPC Controller + 1043 83ad Eee PC 1015PX 105b 0d7c D270S/D250S Motherboard 144d c072 Notebook N150P 1458 5001 GA-D525TUD @@ -26305,6 +26814,7 @@ 27c1 NM10/ICH7 Family SATA Controller [AHCI mode] 1028 01df PowerEdge SC440 103c 2a3b Pavilion A1512X + 1043 83ad Eee PC 1015PX 105b 0d7c D270S/D250S Motherboard 144d c072 Notebook N150P 1458 b005 GA-D525TUD @@ -26339,6 +26849,7 @@ 103c 30d5 530 Laptop 1043 1237 A6J-Q008 1043 8179 P5KPL-VM,P5LD2-VM Mainboard + 1043 83ad Eee PC 1015PX 105b 0d7c D270S/D250S Motherboard 1071 8209 Medion MIM 2240 Notebook PC [MD98100] 107b 5048 E4500 @@ -26363,6 +26874,7 @@ 103c 30a3 Compaq nw8440 1043 1237 A6J-Q008 1043 8179 P5KPL-VM,P5LD2-VM Mainboard + 1043 83ad Eee PC 1015PX 105b 0d7c D270S/D250S Motherboard 1071 8209 Medion MIM 2240 Notebook PC [MD98100] 107b 5048 E4500 @@ -26387,6 +26899,7 @@ 103c 30a3 Compaq nw8440 1043 1237 A6J-Q008 1043 8179 P5KPL-VM,P5LD2-VM Mainboard + 1043 83ad Eee PC 1015PX 105b 0d7c D270S/D250S Motherboard 1071 8209 Medion MIM 2240 Notebook PC [MD98100] 107b 5048 E4500 @@ -26409,6 +26922,7 @@ 103c 30a3 Compaq nw8440 1043 1237 A6J-Q008 1043 8179 P5KPL-VM,P5LD2-VM Mainboard + 1043 83ad Eee PC 1015PX 105b 0d7c D270S/D250S Motherboard 1071 8209 Medion MIM 2240 Notebook PC [MD98100] 107b 5048 E4500 @@ -26433,6 +26947,7 @@ 103c 30d5 530 Laptop 1043 1237 A6J-Q008 1043 8179 P5KPL-VM,P5LD2-VM Mainboard + 1043 83ad Eee PC 1015PX 105b 0d7c D270S/D250S Motherboard 1071 8209 Medion MIM 2240 Notebook PC [MD98100] 144d c072 Notebook N150P @@ -26491,6 +27006,7 @@ 1043 817f P5LD2-VM Mainboard (Realtek ALC 882 codec) 1043 8290 P5KPL-VM Motherboard 1043 82ea P5KPL-CM Motherboard + 1043 8437 Eee PC 1015PX 105b 0d7c D270S/D250S Motherboard 1071 8207 Medion MIM 2240 Notebook PC [MD98100] 107b 5048 E4500 @@ -26560,6 +27076,7 @@ 1775 11cc CC11/CL11 27e2 82801GR/GH/GHM (ICH7 Family) PCI Express Port 6 1775 11cc CC11/CL11 + 280b Intel(R) Display Audio 2810 82801HB/HR (ICH8/R) LPC Interface Controller 1043 81ec P5B 2811 82801HEM (ICH8M-E) LPC Interface Controller @@ -26817,6 +27334,7 @@ 1462 7345 MS-7345 Motherboard 8086 5044 Desktop Board DP35DP 2917 ICH9M-E LPC Interface Controller + 17aa 20f5 ThinkPad T400 e4bf cc4d CCM-BOOGIE 2918 82801IB (ICH9) LPC Interface Controller 1028 0236 PowerEdge R610 82801IB (ICH9) LPC Interface Controller @@ -26856,6 +27374,7 @@ 2928 82801IBM/IEM (ICH9M/ICH9M-E) 2 port SATA Controller [IDE mode] 2929 82801IBM/IEM (ICH9M/ICH9M-E) 4 port SATA Controller [AHCI mode] 103c 3628 dv6-1190en + 17aa 20f8 ThinkPad T400 e4bf cc4d CCM-BOOGIE 292c 82801IEM (ICH9M-E) SATA Controller [RAID mode] 292d 82801IBM/IEM (ICH9M/ICH9M-E) 2 port SATA Controller [IDE mode] @@ -26868,6 +27387,7 @@ 1043 8277 P5K PRO Motherboard: 82801IR [ICH9R] 1462 7345 MS-7345 Motherboard: Intel 82801I/IR [ICH9/ICH9R] 1462 7360 G33/P35 Neo + 17aa 20f9 ThinkPad T400 1af4 1100 QEMU Virtual Machine 8086 5044 Desktop Board DP35DP e4bf cc4d CCM-BOOGIE @@ -26889,6 +27409,7 @@ 1043 8277 P5K PRO Motherboard: 82801IR [ICH9R] 1462 7345 MS-7345 Motherboard: Intel 82801I/IR [ICH9/ICH9R] 1462 7360 G33/P35 Neo + 17aa 20f0 ThinkPad T400 1af4 1100 QEMU Virtual Machine 8086 5044 Desktop Board DP35DP e4bf cc4d CCM-BOOGIE @@ -26907,6 +27428,7 @@ 1043 8277 P5K PRO Motherboard: 82801IR [ICH9R] 1462 7345 MS-7345 Motherboard: Intel 82801I/IR [ICH9/ICH9R] 1462 7360 G33/P35 Neo + 17aa 20f0 ThinkPad T400 1af4 1100 QEMU Virtual Machine 8086 5044 Desktop Board DP35DP e4bf cc4d CCM-BOOGIE @@ -26923,6 +27445,7 @@ 1043 8277 P5K PRO Motherboard: 82801IR [ICH9R] 1462 7345 MS-7345 Motherboard: Intel 82801I/IR [ICH9/ICH9R] 1462 7360 G33/P35 Neo + 17aa 20f0 ThinkPad T400 1af4 1100 QEMU Virtual Machine 8086 5044 Desktop Board DP35DP e4bf cc4d CCM-BOOGIE @@ -26939,6 +27462,7 @@ 1043 8277 P5K PRO Motherboard: 82801IR [ICH9R] 1462 7345 MS-7345 Motherboard: Intel 82801I/IR [ICH9/ICH9R] 1462 7360 G33/P35 Neo + 17aa 20f0 ThinkPad T400 1af4 1100 QEMU Virtual Machine 8086 2937 Optiplex 755 8086 2942 828011 (ICH9 Family ) USB UHCI Controller @@ -26956,6 +27480,7 @@ 1043 8277 P5K PRO Motherboard: 82801IR [ICH9R] 1462 7345 MS-7345 Motherboard: Intel 82801I/IR [ICH9/ICH9R] 1462 7360 G33/P35 Neo + 17aa 20f0 ThinkPad T400 1af4 1100 QEMU Virtual Machine 8086 2938 Optiplex 755 8086 5044 Desktop Board DP35DP @@ -26968,6 +27493,7 @@ 1043 8277 P5K PRO Motherboard: 82801IR [ICH9R] 1462 7345 MS-7345 Motherboard: Intel 82801I/IR [ICH9/ICH9R] 1462 7360 G33/P35 Neo + 17aa 20f0 ThinkPad T400 1af4 1100 QEMU Virtual Machine 8086 5044 Desktop Board DP35DP e4bf cc4d CCM-BOOGIE @@ -26986,6 +27512,7 @@ 1043 8277 P5K PRO Motherboard: 82801IR [ICH9R] 1462 7345 MS-7345 Motherboard: Intel 82801I/IR [ICH9/ICH9R] 1462 7360 G33/P35 Neo + 17aa 20f1 ThinkPad T400 1af4 1100 QEMU Virtual Machine 8086 5044 Desktop Board DP35DP e4bf cc4d CCM-BOOGIE @@ -27001,6 +27528,7 @@ 1043 8277 P5K PRO Motherboard: 82801IR [ICH9R] 1462 7345 MS-7345 Motherboard: Intel 82801I/IR [ICH9/ICH9R] 1462 7360 G33/P35 Neo + 17aa 20f1 ThinkPad T400 1af4 1100 QEMU Virtual Machine 8086 293c Optiplex 755 8086 5044 Desktop Board DP35DP @@ -27013,6 +27541,7 @@ 1043 829f P5K PRO Motherboard: 82801IR [ICH9R] 1462 735a MS-7345 Motherboard: Intel 82801I/IR [ICH9/ICH9R] 1462 7360 G33/P35 Neo + 17aa 20f2 ThinkPad T400 1af4 1100 QEMU Virtual Machine 8086 293e Optiplex 755 8086 2940 Optiplex 755 @@ -27188,14 +27717,18 @@ 2a16 Mobile GME965/GLE960 PT IDER Controller 2a17 Mobile GME965/GLE960 KT Controller 2a40 Mobile 4 Series Chipset Memory Controller Hub + 17aa 20e0 ThinkPad T400 e4bf cc4d CCM-BOOGIE 2a41 Mobile 4 Series Chipset PCI Express Graphics Port e4bf cc4d CCM-BOOGIE 2a42 Mobile 4 Series Chipset Integrated Graphics Controller + 17aa 2112 ThinkPad T400 e4bf cc4d CCM-BOOGIE 2a43 Mobile 4 Series Chipset Integrated Graphics Controller + 17aa 2112 ThinkPad T400 e4bf cc4d CCM-BOOGIE 2a44 Mobile 4 Series Chipset MEI Controller + 17aa 20e6 ThinkPad T400 2a45 Mobile 4 Series Chipset MEI Controller 2a46 Mobile 4 Series Chipset PT IDER Controller 2a47 Mobile 4 Series Chipset AMT SOL Redirection @@ -27602,6 +28135,22 @@ # Stone Peak 1x1 8086 4210 Dual Band Wireless AC 3165 3166 Dual Band Wireless-AC 3165 Plus Bluetooth + 3184 UHD Graphics 605 + 318c Celeron/Pentium Silver Processor Dynamic Platform and Thermal Framework Processor Participant + 318e Celeron/Pentium Silver Processor NorthPeak + 3197 Celeron/Pentium Silver Processor PCI-default ISA-bridge + 319a Celeron/Pentium Silver Processor Trusted Execution Engine Interface + 31ac Celeron/Pentium Silver Processor Serial IO I2C Host Controller + 31ae Celeron/Pentium Silver Processor Serial IO I2C Host Controller + 31bc Celeron/Pentium Silver Processor Serial IO UART Host Controller + 31be Celeron/Pentium Silver Processor Serial IO UART Host Controller + 31c0 Celeron/Pentium Silver Processor Serial IO UART Host Controller + 31c2 Celeron/Pentium Silver Processor Serial IO SPI Host Controller + 31c4 Celeron/Pentium Silver Processor Serial IO SPI Host Controller + 31c6 Celeron/Pentium Silver Processor Serial IO SPI Host Controller + 31cc Celeron/Pentium Silver Processor SDA Standard Compliant SD Host Controller + 31d4 Celeron/Pentium Silver Processor Gaussian Mixture Model + 31ee Celeron/Pentium Silver Processor Serial IO UART Host Controller 3200 GD31244 PCI-X SATA HBA 1775 c200 C2K onboard SATA host bus adapter 3310 IOP348 I/O Processor @@ -28077,6 +28626,7 @@ 3b12 3400 Series Chipset LPC Interface Controller 3b13 5 Series/3400 Series Chipset LPC Interface Controller 3b14 3420 Chipset LPC Interface Controller + 15d9 0605 X8SIL 3b15 5 Series/3400 Series Chipset LPC Interface Controller 3b16 3450 Chipset LPC Interface Controller 3b17 5 Series/3400 Series Chipset LPC Interface Controller @@ -28092,6 +28642,7 @@ 3b21 5 Series/3400 Series Chipset 2 port SATA IDE Controller 3b22 5 Series/3400 Series Chipset 6 port SATA AHCI Controller 1028 02da OptiPlex 980 + 15d9 0605 X8SIL 15d9 060d C7SIM-Q Motherboard 3b23 5 Series/3400 Series Chipset 4 port SATA AHCI Controller 3b25 5 Series/3400 Series Chipset SATA RAID Controller @@ -28123,6 +28674,7 @@ 1043 3838 P7P55-M Motherboard 1043 8383 P7P55-M Motherboard 144d c06a R730 Laptop + 15d9 0605 X8SIL 15d9 060d C7SIM-Q Motherboard 17c0 10d2 Medion Akoya E7214 Notebook PC [MD98410] e4bf 50c1 PC1-GROOVE @@ -28137,6 +28689,7 @@ 1028 040a Latitude E6410 1028 040b Latitude E6510 144d c06a R730 Laptop + 15d9 0605 X8SIL 15d9 060d C7SIM-Q Motherboard 17c0 10d2 Medion Akoya E7214 Notebook PC [MD98410] e4bf 50c1 PC1-GROOVE @@ -28152,6 +28705,7 @@ 1028 040a Latitude E6410 1028 040b Latitude E6510 144d c06a R730 Laptop + 15d9 0605 X8SIL 15d9 060d C7SIM-Q Motherboard 17c0 10d2 Medion Akoya E7214 Notebook PC [MD98410] e4bf 50c1 PC1-GROOVE @@ -28288,6 +28842,11 @@ 3e85 8th Gen Core Processor PCIe Controller (x8) 3e89 8th Gen Core Processor PCIe Controller (x4) 3e91 8th Gen Core Processor Gaussian Mixture Model + 3e92 UHD Graphics 630 (Desktop) + 3e93 UHD Graphics 610 + 3e9b UHD Graphics 630 (Mobile) + 3ea0 UHD Graphics 620 (Whiskey Lake) + 3ea5 Iris Plus Graphics 655 3ec2 8th Gen Core Processor Host Bridge/DRAM Registers 3ec4 8th Gen Core Processor Host Bridge/DRAM Registers 3ec6 8th Gen Core Processor Host Bridge/DRAM Registers @@ -28483,13 +29042,21 @@ 5911 Xeon E3-1200 v6/7th Gen Core Processor Gaussian Mixture Model 5912 HD Graphics 630 5914 Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers + 17aa 225d ThinkPad T480 5916 HD Graphics 620 17aa 2248 ThinkPad T570 17aa 224f ThinkPad X1 Carbon 5th Gen 5917 UHD Graphics 620 + 17aa 225e ThinkPad T480 5918 Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers + 591b HD Graphics 630 + 591c UHD Graphics 615 591d HD Graphics P630 + 591e HD Graphics 615 591f Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers + 5923 HD Graphics 635 + 5926 Iris Plus Graphics 640 + 5927 Iris Plus Graphics 650 5a84 Celeron N3350/Pentium N4200/Atom E3900 Series Integrated Graphics Controller 5a88 Celeron N3350/Pentium N4200/Atom E3900 Series Imaging Unit 5a98 Celeron N3350/Pentium N4200/Atom E3900 Series Audio Cluster @@ -28546,6 +29113,7 @@ 65fa 5100 Chipset PCI Express x16 Port 4-7 65ff 5100 Chipset DMA Engine 6f00 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DMI2 + 15d9 0832 X10SRL-F 6f01 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI Express Root Port 0 6f02 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI Express Root Port 1 6f03 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI Express Root Port 1 @@ -28574,17 +29142,29 @@ 6f1e Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Ubox 6f1f Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Ubox 6f20 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Crystal Beach DMA Channel 0 + 15d9 0832 X10SRL-F 6f21 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Crystal Beach DMA Channel 1 + 15d9 0832 X10SRL-F 6f22 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Crystal Beach DMA Channel 2 + 15d9 0832 X10SRL-F 6f23 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Crystal Beach DMA Channel 3 + 15d9 0832 X10SRL-F 6f24 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Crystal Beach DMA Channel 4 + 15d9 0832 X10SRL-F 6f25 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Crystal Beach DMA Channel 5 + 15d9 0832 X10SRL-F 6f26 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Crystal Beach DMA Channel 6 + 15d9 0832 X10SRL-F 6f27 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Crystal Beach DMA Channel 7 + 15d9 0832 X10SRL-F 6f28 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Map/VTd_Misc/System Management + 15d9 0832 X10SRL-F 6f29 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D IIO Hot Plug + 15d9 0832 X10SRL-F 6f2a Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D IIO RAS/Control Status/Global Errors + 15d9 0832 X10SRL-F 6f2c Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D I/O APIC + 15d9 0832 X10SRL-F 6f30 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Home Agent 0 6f32 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D QPI Link 0 6f33 Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D QPI Link 1 @@ -28837,6 +29417,7 @@ 1993 0ded mGuard-PCI AV#2 1993 0dee mGuard-PCI AV#1 1993 0def mGuard-PCI AV#0 + 87c0 UHD Graphics 617 8800 Platform Controller Hub EG20T PCI Express Port 8801 Platform Controller Hub EG20T Packet Hub 8802 Platform Controller Hub EG20T Gigabit Ethernet Controller @@ -28866,6 +29447,7 @@ 8c00 8 Series/C220 Series Chipset Family 4-port SATA Controller 1 [IDE mode] 8c01 8 Series Chipset Family 4-port SATA Controller 1 [IDE mode] - Mobile 8c02 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] + 17aa 309f ThinkCentre M83 8c03 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] 103c 1909 ZBook 15 17aa 220e ThinkPad T440p @@ -28898,28 +29480,34 @@ 8c20 8 Series/C220 Series Chipset High Definition Audio Controller 103c 1909 ZBook 15 17aa 220e ThinkPad T440p + 17aa 309f ThinkCentre M83 8c21 8 Series/C220 Series Chipset High Definition Audio Controller 8c22 8 Series/C220 Series Chipset Family SMBus Controller 103c 1909 ZBook 15 17aa 220e ThinkPad T440p + 17aa 309f ThinkCentre M83 8c23 8 Series Chipset Family CHAP Counters 8c24 8 Series Chipset Family Thermal Management Controller 8c26 8 Series/C220 Series Chipset Family USB EHCI #1 103c 1909 ZBook 15 17aa 220e ThinkPad T440p 17aa 2210 ThinkPad T540p + 17aa 309f ThinkCentre M83 2210 17aa ThinkPad T540p 8c2d 8 Series/C220 Series Chipset Family USB EHCI #2 103c 1909 ZBook 15 17aa 220e ThinkPad T440p + 17aa 309f ThinkCentre M83 8c31 8 Series/C220 Series Chipset Family USB xHCI 103c 1909 ZBook 15 17aa 220e ThinkPad T440p + 17aa 309f ThinkCentre M83 8c33 8 Series/C220 Series Chipset Family LAN Controller 8c34 8 Series/C220 Series Chipset Family NAND Controller 8c3a 8 Series/C220 Series Chipset Family MEI Controller #1 103c 1909 ZBook 15 17aa 220e ThinkPad T440p + 17aa 309f ThinkCentre M83 8c3b 8 Series/C220 Series Chipset Family MEI Controller #2 8c3c 8 Series/C220 Series Chipset Family IDE-r Controller 8c3d 8 Series/C220 Series Chipset Family KT Controller @@ -28936,6 +29524,7 @@ 8c4a H87 Express LPC Controller 8c4b HM87 Express LPC Controller 8c4c Q85 Express LPC Controller + 17aa 309f ThinkCentre M83 8c4d 8 Series/C220 Series Chipset Family LPC Controller 8c4e Q87 Express LPC Controller 8c4f QM87 Express LPC Controller @@ -29020,14 +29609,20 @@ 8d20 C610/X99 series chipset HD Audio Controller 8d21 C610/X99 series chipset HD Audio Controller 8d22 C610/X99 series chipset SMBus Controller + 15d9 0832 X10SRL-F 8d24 C610/X99 series chipset Thermal Subsystem 8d26 C610/X99 series chipset USB Enhanced Host Controller #1 + 15d9 0832 X10SRL-F 8d2d C610/X99 series chipset USB Enhanced Host Controller #2 + 15d9 0832 X10SRL-F 8d31 C610/X99 series chipset USB xHCI Host Controller + 15d9 0832 X10SRL-F 8d33 C610/X99 series chipset LAN Controller 8d34 C610/X99 series chipset NAND Controller 8d3a C610/X99 series chipset MEI Controller #1 + 15d9 0832 X10SRL-F 8d3b C610/X99 series chipset MEI Controller #2 + 15d9 0832 X10SRL-F 8d3c C610/X99 series chipset IDE-r Controller 8d3d C610/X99 series chipset KT Controller 8d40 C610/X99 series chipset LPC Controller @@ -29035,6 +29630,7 @@ 8d42 C610/X99 series chipset LPC Controller 8d43 C610/X99 series chipset LPC Controller 8d44 C610/X99 series chipset LPC Controller + 15d9 0832 X10SRL-F 8d45 C610/X99 series chipset LPC Controller 8d46 C610/X99 series chipset LPC Controller 8d47 C610/X99 series chipset LPC Controller @@ -29053,6 +29649,7 @@ 8d68 C610/X99 series chipset sSATA Controller [IDE mode] 8d6e C610/X99 series chipset sSATA Controller [RAID mode] 8d7c C610/X99 series chipset SPSR + 15d9 0832 X10SRL-F 8d7d C610/X99 series chipset MS SMBus 0 8d7e C610/X99 series chipset MS SMBus 1 8d7f C610/X99 series chipset MS SMBus 2 @@ -29170,7 +29767,9 @@ 9ce5 Wildcat Point-LP Serial IO GSPI Controller #0 9ce6 Wildcat Point-LP Serial IO GSPI Controller #1 9d03 Sunrise Point-LP SATA Controller [AHCI mode] + 1028 06dc Latitude E7470 1028 06f3 Latitude 3570 + 17aa 225d ThinkPad T480 17aa 382a B51-80 Laptop 9d10 Sunrise Point-LP PCI Express Root Port #1 9d12 Sunrise Point-LP PCI Express Root Port #3 @@ -29184,13 +29783,17 @@ 17aa 382a B51-80 Laptop 9d19 Sunrise Point-LP PCI Express Root Port #10 9d21 Sunrise Point-LP PMC + 1028 06dc Latitude E7470 1028 06f3 Latitude 3570 17aa 224f ThinkPad X1 Carbon 5th Gen + 17aa 225d ThinkPad T480 17aa 382a B51-80 Laptop 9d23 Sunrise Point-LP SMBus + 1028 06dc Latitude E7470 1028 06f3 Latitude 3570 17aa 2247 ThinkPad T570 17aa 224f ThinkPad X1 Carbon 5th Gen + 17aa 225d ThinkPad T480 17aa 382a B51-80 Laptop 9d27 Sunrise Point-LP Serial IO UART Controller #0 9d28 Sunrise Point-LP Serial IO UART Controller #1 @@ -29198,31 +29801,42 @@ 9d2a Sunrise Point-LP Serial IO SPI Controller #1 9d2d Sunrise Point-LP Secure Digital IO Controller 9d2f Sunrise Point-LP USB 3.0 xHCI Controller + 1028 06dc Latitude E7470 1028 06f3 Latitude 3570 17aa 2247 ThinkPad T570 + 17aa 225d ThinkPad T480 17aa 382a B51-80 Laptop 9d31 Sunrise Point-LP Thermal subsystem + 1028 06dc Latitude E7470 1028 06f3 Latitude 3570 17aa 2247 ThinkPad T570 17aa 224f ThinkPad X1 Carbon 5th Gen + 17aa 225d ThinkPad T480 17aa 382a B51-80 Laptop 9d35 Sunrise Point-LP Integrated Sensor Hub 9d3a Sunrise Point-LP CSME HECI #1 + 1028 06dc Latitude E7470 1028 06f3 Latitude 3570 17aa 2247 ThinkPad T570 17aa 224f ThinkPad X1 Carbon 5th Gen + 17aa 225d ThinkPad T480 17aa 382a B51-80 Laptop + 9d3d Sunrise Point-LP Active Management Technology - SOL 9d43 Sunrise Point-LP LPC Controller 17aa 382a B51-80 Laptop 9d48 Sunrise Point-LP LPC Controller + 1028 06dc Latitude E7470 1028 06f3 Latitude 3570 9d4e Intel(R) 100 Series Chipset Family LPC Controller/eSPI Controller - 9D4E + 17aa 225d ThinkPad T480 + 9d50 Sunrise Point LPC Controller 9d56 Sunrise Point-LP LPC Controller 9d58 Sunrise Point-LP LPC Controller 17aa 2247 ThinkPad T570 17aa 224f ThinkPad X1 Carbon 5th Gen 9d60 Sunrise Point-LP Serial IO I2C Controller #0 1028 06f3 Latitude 3570 + 17aa 225d ThinkPad T480 8086 9d60 100 Series PCH/Sunrise Point PCH I2C0 [Skylake/Kaby Lake LPSS I2C] 9d61 Sunrise Point-LP Serial IO I2C Controller #1 9d62 Sunrise Point-LP Serial IO I2C Controller #2 @@ -29231,9 +29845,25 @@ 9d65 Sunrise Point-LP Serial IO I2C Controller #5 9d66 Sunrise Point-LP Serial IO UART Controller #2 9d70 Sunrise Point-LP HD Audio + 1028 06dc Latitude E7470 1028 06f3 Latitude 3570 17aa 382a B51-80 Laptop 9d71 Sunrise Point-LP HD Audio + 17aa 225d ThinkPad T480 + 9d84 Cannon Point-LP LPC Controller + 9da3 Cannon Point-LP SMBus Controller + 9da4 Cannon Point-LP SPI Controller + 9db0 Cannon Point-LP PCI Express Root Port #9 + 9db6 Cannon Point-LP PCI Express Root Port #15 + 9db8 Cannon Point-LP PCI Express Root Port #1 + 9dbc Cannon Point-LP PCI Express Root Port #5 + 9dc8 Cannon Point-LP High Definition Audio Controller + 9dd3 Cannon Point-LP SATA Controller [AHCI Mode] + 9de0 Cannon Point-LP MEI Controller #1 + 9ded Cannon Point-LP USB 3.1 xHCI Controller + 9def Cannon Point-LP Shared SRAM + 9df0 Cannon Point-LP CNVi [Wireless-AC] + 9df9 Cannon Point-LP Thermal Controller a000 Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge 1458 5000 GA-D525TUD 8086 4f4d DeskTop Board D510MO @@ -29245,10 +29875,13 @@ a002 Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller a003 Atom Processor D4xx/D5xx/N4xx/N5xx CHAPS counter a010 Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge + 1043 83ac Eee PC 1015PX 144d c072 Notebook N150P a011 Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller + 1043 83ac Eee PC 1015PX 144d c072 Notebook N150P a012 Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller + 1043 83ac Eee PC 1015PX 144d c072 Notebook N150P a013 Atom Processor D4xx/D5xx/N4xx/N5xx CHAPS counter a102 Q170/Q150/B150/H170/H110/Z170/CM236 Chipset SATA Controller [AHCI Mode] @@ -29366,19 +29999,28 @@ a19f C620 Series Chipset Family PCI Express Root Port #16 a1a0 C620 Series Chipset Family P2SB a1a1 C620 Series Chipset Family Power Management Controller + 15d9 095d X11SPM-TF a1a2 C620 Series Chipset Family cAVS a1a3 C620 Series Chipset Family SMBus + 15d9 095d X11SPM-TF a1a4 C620 Series Chipset Family SPI Controller + 15d9 095d X11SPM-TF a1a6 C620 Series Chipset Family Trace Hub a1af C620 Series Chipset Family USB 3.0 xHCI Controller + 15d9 095d X11SPM-TF a1b1 C620 Series Chipset Family Thermal Subsystem + 15d9 095d X11SPM-TF a1ba C620 Series Chipset Family MEI Controller #1 + 15d9 095d X11SPM-TF a1bb C620 Series Chipset Family MEI Controller #2 + 15d9 095d X11SPM-TF a1bc C620 Series Chipset Family IDE Redirection a1bd C620 Series Chipset Family KT Redirection a1be C620 Series Chipset Family MEI Controller #3 + 15d9 095d X11SPM-TF a1c1 C621 Series Chipset LPC/eSPI Controller a1c2 C622 Series Chipset LPC/eSPI Controller + 15d9 095d X11SPM-TF a1c3 C624 Series Chipset LPC/eSPI Controller a1c4 C625 Series Chipset LPC/eSPI Controller a1c5 C626 Series Chipset LPC/eSPI Controller @@ -29489,6 +30131,11 @@ a348 Cannon Lake PCH cAVS a352 Cannon Lake PCH SATA AHCI Controller a360 Cannon Lake PCH HECI Controller + a363 Cannon Lake PCH Active Management Technology - SOL + a368 Cannon Lake PCH Serial IO I2C Controller #0 + a369 Cannon Lake PCH Serial IO I2C Controller #1 + a36a Cannon Lake PCH Serial IO I2C Controller #2 + a36b Cannon Lake PCH Serial IO I2C Controller #3 a36d Cannon Lake PCH USB 3.1 xHCI Host Controller a36f Cannon Lake PCH Shared SRAM a370 Wireless-AC 9560 [Jefferson Peak] @@ -29507,6 +30154,7 @@ 4c53 1051 CE7 mainboard e4bf 1000 CC8-1-BLUES d130 Core Processor DMI + 15d9 0605 X8SIL d131 Core Processor DMI 1028 02da OptiPlex 980 15d9 060d C7SIM-Q Motherboard @@ -29662,7 +30310,7 @@ 9004 7888 AHA-2930UW SCSI Controller 8b78 ABA-1030 ec78 AHA-4944W/UW -# acquired by Microsemi +# Acquired by Microchip Technology 9005 Adaptec 0010 AHA-2940U2/U2W 9005 2180 AHA-2940U2 SCSI Controller @@ -30105,6 +30753,7 @@ bdbd Blackmagic Design a144 DeckLink Mini Monitor 4K a148 DeckLink SDI Micro a14b DeckLink 8K Pro + a1ff eGPU RX580 c001 TSI Telsys c0a9 Micron/Crucial Technology c0de Motorola @@ -30118,6 +30767,8 @@ caed Canny Edge cafe Chrysalis-ITS 0003 Luna K3 Hardware Security Module 0006 Luna PCI-e 3000 Hardware Security Module + 0008 Luna K7 Hardware Security Module +cc53 ScaleFlux Inc. cccc Catapult Communications ccec Curtiss-Wright Controls Embedded Computing cddd Tyzx, Inc. @@ -30328,6 +30979,7 @@ edd8 ARK Logic Inc # Found on M2N68-AM Motherboard f043 ASUSTeK Computer Inc. (Wrong ID) f05b Foxconn International, Inc. (Wrong ID) +f15e SiFive, Inc. f1d0 AJA Video c0fe Xena HS/HD-R c0ff Kona/Xena 2 @@ -30339,6 +30991,7 @@ f1d0 AJA Video dcaf Kona HD dfee Xena HD-DA eb0e Corvid 44 + eb1d Kona 5 efac Xena SD-MM/SD-22-MM facd Xena HD-MM f5f5 F5 Networks, Inc. From 1165591e7fa8a83f14ae3f05afad8aeae26daf7b Mon Sep 17 00:00:00 2001 From: Dmitry Morozovsky Date: Tue, 29 Jan 2019 10:21:41 +0000 Subject: [PATCH 129/142] Allow dashes as a valid character in UFS labels. Reviewed by: mckusick, imp, 0mp MFC after: 2 weeks Differential Revision: D18991 --- sbin/newfs/newfs.8 | 4 ++-- sbin/newfs/newfs.c | 4 ++-- sbin/tunefs/tunefs.8 | 4 ++-- sbin/tunefs/tunefs.c | 7 +++++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8 index 9a4acf868035..1e6814859cf0 100644 --- a/sbin/newfs/newfs.8 +++ b/sbin/newfs/newfs.8 @@ -28,7 +28,7 @@ .\" @(#)newfs.8 8.6 (Berkeley) 5/3/95 .\" $FreeBSD$ .\" -.Dd July 7, 2017 +.Dd January 29, 2019 .Dt NEWFS 8 .Os .Sh NAME @@ -89,7 +89,7 @@ See for details. .It Fl L Ar volname Add a volume label to the new file system. -Legal characters are alphanumerics and underscores. +Legal characters are alphanumerics, dashes, and underscores. .It Fl N Cause the file system parameters to be printed out without really creating the file system. diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 3c5d4fa08ca1..232436c0aa7f 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -153,10 +153,10 @@ main(int argc, char *argv[]) volumelabel = optarg; i = -1; while (isalnum(volumelabel[++i]) || - volumelabel[i] == '_'); + volumelabel[i] == '_' || volumelabel[i] == '-'); if (volumelabel[i] != '\0') { errx(1, "bad volume label. Valid characters " - "are alphanumerics and underscores."); + "are alphanumerics, dashes, and underscores."); } if (strlen(volumelabel) >= MAXVOLLEN) { errx(1, "bad volume label. Length is longer than %d.", diff --git a/sbin/tunefs/tunefs.8 b/sbin/tunefs/tunefs.8 index 00b9f41fb7f2..065844a831cd 100644 --- a/sbin/tunefs/tunefs.8 +++ b/sbin/tunefs/tunefs.8 @@ -28,7 +28,7 @@ .\" @(#)tunefs.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd April 19, 2016 +.Dd January 29, 2019 .Dt TUNEFS 8 .Os .Sh NAME @@ -112,7 +112,7 @@ By default sets it to half of the space reserved to minfree. .It Fl L Ar volname Add/modify an optional file system volume label. -Legal characters are alphanumerics and underscores. +Legal characters are alphanumerics, dashes, and underscores. .It Fl l Cm enable | disable Turn on/off MAC multilabel flag. .It Fl m Ar minfree diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c index d1f1c36cf787..9ae879ec1285 100644 --- a/sbin/tunefs/tunefs.c +++ b/sbin/tunefs/tunefs.c @@ -189,10 +189,13 @@ main(int argc, char *argv[]) name = "volume label"; Lvalue = optarg; i = -1; - while (isalnum(Lvalue[++i]) || Lvalue[i] == '_'); + while (isalnum(Lvalue[++i]) || Lvalue[i] == '_' || + Lvalue[i] == '-') + ; if (Lvalue[i] != '\0') { errx(10, "bad %s. Valid characters are " - "alphanumerics and underscores.", name); + "alphanumerics, dashes, and underscores.", + name); } if (strlen(Lvalue) >= MAXVOLLEN) { errx(10, "bad %s. Length is longer than %d.", From a56136a1ba97e9b7cbe914f5d9549c852620640e Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Tue, 29 Jan 2019 10:28:50 +0000 Subject: [PATCH 130/142] netmap: add notifications on kloop stop On sync-kloop stop, send a wake-up signal to the kloop, so that waiting for the timeout is not needed. Also, improve logging in netmap_freebsd.c. MFC after: 3 days --- sys/dev/netmap/netmap_bdg.c | 4 +- sys/dev/netmap/netmap_freebsd.c | 83 ++++++++++++++++----------------- sys/dev/netmap/netmap_kloop.c | 33 +++++++++---- 3 files changed, 66 insertions(+), 54 deletions(-) diff --git a/sys/dev/netmap/netmap_bdg.c b/sys/dev/netmap/netmap_bdg.c index e70e67821afb..1ad57f31654a 100644 --- a/sys/dev/netmap/netmap_bdg.c +++ b/sys/dev/netmap/netmap_bdg.c @@ -1141,8 +1141,8 @@ netmap_bwrap_intr_notify(struct netmap_kring *kring, int flags) goto put_out; if (kring->nr_hwcur == kring->nr_hwtail) { if (netmap_verbose) - nm_prerr("how strange, interrupt with no packets on %s", - na->name); + nm_prlim(1, "interrupt with no packets on %s", + kring->name); goto put_out; } diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebsd.c index ef6a7427a270..94bde267a279 100644 --- a/sys/dev/netmap/netmap_freebsd.c +++ b/sys/dev/netmap/netmap_freebsd.c @@ -240,7 +240,7 @@ nm_os_csum_tcpudp_ipv4(struct nm_iphdr *iph, void *data, static int notsupported = 0; if (!notsupported) { notsupported = 1; - D("inet4 segmentation not supported"); + nm_prerr("inet4 segmentation not supported"); } #endif } @@ -256,7 +256,7 @@ nm_os_csum_tcpudp_ipv6(struct nm_ipv6hdr *ip6h, void *data, static int notsupported = 0; if (!notsupported) { notsupported = 1; - D("inet6 segmentation not supported"); + nm_prerr("inet6 segmentation not supported"); } #endif } @@ -288,8 +288,9 @@ freebsd_generic_rx_handler(struct ifnet *ifp, struct mbuf *m) { int stolen; - if (!NM_NA_VALID(ifp)) { - RD(1, "Warning: got RX packet for invalid emulated adapter"); + if (unlikely(!NM_NA_VALID(ifp))) { + nm_prlim(1, "Warning: RX packet intercepted, but no" + " emulated adapter"); return; } @@ -315,15 +316,16 @@ nm_os_catch_rx(struct netmap_generic_adapter *gna, int intercept) nm_os_ifnet_lock(); if (intercept) { if (gna->save_if_input) { - D("cannot intercept again"); - ret = EINVAL; /* already set */ + nm_prerr("RX on %s already intercepted", na->name); + ret = EBUSY; /* already set */ goto out; } gna->save_if_input = ifp->if_input; ifp->if_input = freebsd_generic_rx_handler; } else { - if (!gna->save_if_input){ - D("cannot restore"); + if (!gna->save_if_input) { + nm_prerr("Failed to undo RX intercept on %s", + na->name); ret = EINVAL; /* not saved */ goto out; } @@ -392,11 +394,11 @@ nm_os_generic_xmit_frame(struct nm_os_gen_arg *a) * we need to copy from the cluster to the netmap buffer. */ if (MBUF_REFCNT(m) != 1) { - D("invalid refcnt %d for %p", MBUF_REFCNT(m), m); + nm_prerr("invalid refcnt %d for %p", MBUF_REFCNT(m), m); panic("in generic_xmit_frame"); } if (m->m_ext.ext_size < len) { - RD(5, "size %d < len %d", m->m_ext.ext_size, len); + nm_prlim(2, "size %d < len %d", m->m_ext.ext_size, len); len = m->m_ext.ext_size; } bcopy(a->addr, m->m_data, len); @@ -459,7 +461,6 @@ nm_os_generic_set_features(struct netmap_generic_adapter *gna) void nm_os_mitigation_init(struct nm_generic_mit *mit, int idx, struct netmap_adapter *na) { - ND("called"); mit->mit_pending = 0; mit->mit_ring_idx = idx; mit->mit_na = na; @@ -469,21 +470,19 @@ nm_os_mitigation_init(struct nm_generic_mit *mit, int idx, struct netmap_adapter void nm_os_mitigation_start(struct nm_generic_mit *mit) { - ND("called"); } void nm_os_mitigation_restart(struct nm_generic_mit *mit) { - ND("called"); } int nm_os_mitigation_active(struct nm_generic_mit *mit) { - ND("called"); + return 0; } @@ -491,12 +490,12 @@ nm_os_mitigation_active(struct nm_generic_mit *mit) void nm_os_mitigation_cleanup(struct nm_generic_mit *mit) { - ND("called"); } static int nm_vi_dummy(struct ifnet *ifp, u_long cmd, caddr_t addr) { + return EINVAL; } @@ -559,7 +558,7 @@ nm_vi_free_index(uint8_t val) } } if (lim == nm_vi_indices.active) - D("funny, index %u didn't found", val); + nm_prerr("Index %u not found", val); mtx_unlock(&nm_vi_indices.lock); } #undef NM_VI_MAX @@ -597,7 +596,7 @@ nm_os_vi_persist(const char *name, struct ifnet **ret) ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { - D("if_alloc failed"); + nm_prerr("if_alloc failed"); return ENOMEM; } if_initname(ifp, name, IF_DUNIT_NONE); @@ -638,7 +637,7 @@ struct nm_os_extmem { void nm_os_extmem_delete(struct nm_os_extmem *e) { - D("freeing %zx bytes", (size_t)e->size); + nm_prinf("freeing %zx bytes", (size_t)e->size); vm_map_remove(kernel_map, e->kva, e->kva + e->size); nm_os_free(e); } @@ -688,7 +687,7 @@ nm_os_extmem_create(unsigned long p, struct nmreq_pools_info *pi, int *perror) rv = vm_map_lookup(&map, p, VM_PROT_RW, &entry, &obj, &index, &prot, &wired); if (rv != KERN_SUCCESS) { - D("address %lx not found", p); + nm_prerr("address %lx not found", p); goto out_free; } /* check that we are given the whole vm_object ? */ @@ -707,13 +706,13 @@ nm_os_extmem_create(unsigned long p, struct nmreq_pools_info *pi, int *perror) VMFS_OPTIMAL_SPACE, VM_PROT_READ | VM_PROT_WRITE, VM_PROT_READ | VM_PROT_WRITE, 0); if (rv != KERN_SUCCESS) { - D("vm_map_find(%zx) failed", (size_t)e->size); + nm_prerr("vm_map_find(%zx) failed", (size_t)e->size); goto out_rel; } rv = vm_map_wire(kernel_map, e->kva, e->kva + e->size, VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); if (rv != KERN_SUCCESS) { - D("vm_map_wire failed"); + nm_prerr("vm_map_wire failed"); goto out_rem; } @@ -795,7 +794,7 @@ nm_os_pt_memdev_iomap(struct ptnetmap_memdev *ptn_dev, vm_paddr_t *nm_paddr, { int rid; - D("ptn_memdev_driver iomap"); + nm_prinf("ptn_memdev_driver iomap"); rid = PCIR_BAR(PTNETMAP_MEM_PCI_BAR); *mem_size = bus_read_4(ptn_dev->pci_io, PTNET_MDEV_IO_MEMSIZE_HI); @@ -814,7 +813,7 @@ nm_os_pt_memdev_iomap(struct ptnetmap_memdev *ptn_dev, vm_paddr_t *nm_paddr, *nm_paddr = rman_get_start(ptn_dev->pci_mem); *nm_addr = rman_get_virtual(ptn_dev->pci_mem); - D("=== BAR %d start %lx len %lx mem_size %lx ===", + nm_prinf("=== BAR %d start %lx len %lx mem_size %lx ===", PTNETMAP_MEM_PCI_BAR, (unsigned long)(*nm_paddr), (unsigned long)rman_get_size(ptn_dev->pci_mem), @@ -832,7 +831,7 @@ nm_os_pt_memdev_ioread(struct ptnetmap_memdev *ptn_dev, unsigned int reg) void nm_os_pt_memdev_iounmap(struct ptnetmap_memdev *ptn_dev) { - D("ptn_memdev_driver iounmap"); + nm_prinf("ptn_memdev_driver iounmap"); if (ptn_dev->pci_mem) { bus_release_resource(ptn_dev->dev, SYS_RES_MEMORY, @@ -868,8 +867,6 @@ ptn_memdev_attach(device_t dev) int rid; uint16_t mem_id; - D("ptn_memdev_driver attach"); - ptn_dev = device_get_softc(dev); ptn_dev->dev = dev; @@ -893,7 +890,7 @@ ptn_memdev_attach(device_t dev) } netmap_mem_get(ptn_dev->nm_mem); - D("ptn_memdev_driver probe OK - host_mem_id: %d", mem_id); + nm_prinf("ptnetmap memdev attached, host memid: %u", mem_id); return (0); } @@ -904,10 +901,11 @@ ptn_memdev_detach(device_t dev) { struct ptnetmap_memdev *ptn_dev; - D("ptn_memdev_driver detach"); ptn_dev = device_get_softc(dev); if (ptn_dev->nm_mem) { + nm_prinf("ptnetmap memdev detached, host memid %u", + netmap_mem_get_id(ptn_dev->nm_mem)); netmap_mem_put(ptn_dev->nm_mem); ptn_dev->nm_mem = NULL; } @@ -928,7 +926,6 @@ ptn_memdev_detach(device_t dev) static int ptn_memdev_shutdown(device_t dev) { - D("ptn_memdev_driver shutdown"); return bus_generic_shutdown(dev); } @@ -953,7 +950,7 @@ netmap_dev_pager_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot, struct netmap_vm_handle_t *vmh = handle; if (netmap_verbose) - D("handle %p size %jd prot %d foff %jd", + nm_prinf("handle %p size %jd prot %d foff %jd", handle, (intmax_t)size, prot, (intmax_t)foff); if (color) *color = 0; @@ -970,7 +967,7 @@ netmap_dev_pager_dtor(void *handle) struct netmap_priv_d *priv = vmh->priv; if (netmap_verbose) - D("handle %p", handle); + nm_prinf("handle %p", handle); netmap_dtor(priv); free(vmh, M_DEVBUF); dev_rel(dev); @@ -989,7 +986,7 @@ netmap_dev_pager_fault(vm_object_t object, vm_ooffset_t offset, vm_memattr_t memattr; vm_pindex_t pidx; - ND("object %p offset %jd prot %d mres %p", + nm_prdis("object %p offset %jd prot %d mres %p", object, (intmax_t)offset, prot, mres); memattr = object->memattr; pidx = OFF_TO_IDX(offset); @@ -1045,7 +1042,7 @@ netmap_mmap_single(struct cdev *cdev, vm_ooffset_t *foff, vm_object_t obj; if (netmap_verbose) - D("cdev %p foff %jd size %jd objp %p prot %d", cdev, + nm_prinf("cdev %p foff %jd size %jd objp %p prot %d", cdev, (intmax_t )*foff, (intmax_t )objsize, objp, prot); vmh = malloc(sizeof(struct netmap_vm_handle_t), M_DEVBUF, @@ -1070,7 +1067,7 @@ netmap_mmap_single(struct cdev *cdev, vm_ooffset_t *foff, &netmap_cdev_pager_ops, objsize, prot, *foff, NULL); if (obj == NULL) { - D("cdev_pager_allocate failed"); + nm_prerr("cdev_pager_allocate failed"); error = EINVAL; goto err_deref; } @@ -1104,7 +1101,7 @@ static int netmap_close(struct cdev *dev, int fflag, int devtype, struct thread *td) { if (netmap_verbose) - D("dev %p fflag 0x%x devtype %d td %p", + nm_prinf("dev %p fflag 0x%x devtype %d td %p", dev, fflag, devtype, td); return 0; } @@ -1255,11 +1252,11 @@ nm_os_kctx_worker_start(struct nm_kctx *nmk) goto err; } - D("nm_kthread started td %p", nmk->worker); + nm_prinf("nm_kthread started td %p", nmk->worker); return 0; err: - D("nm_kthread start failed err %d", error); + nm_prerr("nm_kthread start failed err %d", error); nmk->worker = NULL; return error; } @@ -1337,7 +1334,7 @@ netmap_knrdetach(struct knote *kn) struct netmap_priv_d *priv = (struct netmap_priv_d *)kn->kn_hook; struct selinfo *si = &priv->np_si[NR_RX]->si; - D("remove selinfo %p", si); + nm_prinf("remove selinfo %p", si); knlist_remove(&si->si_note, kn, /*islocked=*/0); } @@ -1347,7 +1344,7 @@ netmap_knwdetach(struct knote *kn) struct netmap_priv_d *priv = (struct netmap_priv_d *)kn->kn_hook; struct selinfo *si = &priv->np_si[NR_TX]->si; - D("remove selinfo %p", si); + nm_prinf("remove selinfo %p", si); knlist_remove(&si->si_note, kn, /*islocked=*/0); } @@ -1418,17 +1415,17 @@ netmap_kqfilter(struct cdev *dev, struct knote *kn) int ev = kn->kn_filter; if (ev != EVFILT_READ && ev != EVFILT_WRITE) { - D("bad filter request %d", ev); + nm_prerr("bad filter request %d", ev); return 1; } error = devfs_get_cdevpriv((void**)&priv); if (error) { - D("device not yet setup"); + nm_prerr("device not yet setup"); return 1; } na = priv->np_na; if (na == NULL) { - D("no netmap adapter for this file descriptor"); + nm_prerr("no netmap adapter for this file descriptor"); return 1; } /* the si is indicated in the priv */ @@ -1535,7 +1532,7 @@ netmap_loader(__unused struct module *module, int event, __unused void *arg) * then the module can not be unloaded. */ if (netmap_use_count) { - D("netmap module can not be unloaded - netmap_use_count: %d", + nm_prerr("netmap module can not be unloaded - netmap_use_count: %d", netmap_use_count); error = EBUSY; break; diff --git a/sys/dev/netmap/netmap_kloop.c b/sys/dev/netmap/netmap_kloop.c index 5a6243e16cc1..98536cd03f57 100644 --- a/sys/dev/netmap/netmap_kloop.c +++ b/sys/dev/netmap/netmap_kloop.c @@ -567,16 +567,12 @@ netmap_sync_kloop(struct netmap_priv_d *priv, struct nmreq_header *hdr) /* Poll for notifications coming from the netmap rings bound to * this file descriptor. */ { - NM_SELINFO_T *si[NR_TXRX]; - NMG_LOCK(); - si[NR_RX] = nm_si_user(priv, NR_RX) ? &na->si[NR_RX] : - &na->rx_rings[priv->np_qfirst[NR_RX]]->si; - si[NR_TX] = nm_si_user(priv, NR_TX) ? &na->si[NR_TX] : - &na->tx_rings[priv->np_qfirst[NR_TX]]->si; + poll_wait(priv->np_filp, priv->np_si[NR_TX], + &poll_ctx->wait_table); + poll_wait(priv->np_filp, priv->np_si[NR_RX], + &poll_ctx->wait_table); NMG_UNLOCK(); - poll_wait(priv->np_filp, si[NR_TX], &poll_ctx->wait_table); - poll_wait(priv->np_filp, si[NR_RX], &poll_ctx->wait_table); } #else /* SYNC_KLOOP_POLL */ opt->nro_status = EOPNOTSUPP; @@ -657,7 +653,7 @@ netmap_sync_kloop(struct netmap_priv_d *priv, struct nmreq_header *hdr) /* If a poll context is present, yield to the scheduler * waiting for a notification to come either from * netmap or the application. */ - schedule_timeout(msecs_to_jiffies(20000)); + schedule_timeout(msecs_to_jiffies(3000)); } else #endif /* SYNC_KLOOP_POLL */ { @@ -708,12 +704,31 @@ netmap_sync_kloop(struct netmap_priv_d *priv, struct nmreq_header *hdr) int netmap_sync_kloop_stop(struct netmap_priv_d *priv) { + struct netmap_adapter *na; bool running = true; int err = 0; + if (priv->np_nifp == NULL) { + return ENXIO; + } + mb(); /* make sure following reads are not from cache */ + + na = priv->np_na; + if (!nm_netmap_on(na)) { + return ENXIO; + } + + /* Set the kloop stopping flag. */ NMG_LOCK(); priv->np_kloop_state |= NM_SYNC_KLOOP_STOPPING; NMG_UNLOCK(); + + /* Send a notification to the kloop, in case it is blocked in + * schedule_timeout(). We can use either RX or TX, because the + * kloop is waiting on both. */ + nm_os_selwakeup(priv->np_si[NR_RX]); + + /* Wait for the kloop to actually terminate. */ while (running) { usleep_range(1000, 1500); NMG_LOCK(); From 524553f56d0b89c689754f1e0a51205bbbcf5071 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Tue, 29 Jan 2019 11:04:17 +0000 Subject: [PATCH 131/142] Extract the coverage sanitizer KPI to a new file. This will allow multiple consumers of the coverage data to be compiled into the kernel together. The only requirement is only one can be registered at a given point in time, however it is expected they will only register when the coverage data is needed. A new kernel conflig option COVERAGE is added. This will allow kcov to become a module that can be loaded as needed, or compiled into the kernel. While here clean up the #include style a little. Reviewed by: kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18955 --- sys/amd64/conf/GENERIC | 5 +- sys/amd64/conf/GENERIC-NODEBUG | 3 +- sys/arm64/conf/GENERIC | 5 +- sys/arm64/conf/GENERIC-NODEBUG | 2 + sys/conf/files | 2 + sys/conf/kern.pre.mk | 4 +- sys/conf/options | 3 +- sys/kern/kern_kcov.c | 174 +++++------------------- sys/kern/subr_coverage.c | 237 +++++++++++++++++++++++++++++++++ sys/sys/coverage.h | 60 +++++++++ sys/sys/kcov.h | 9 +- 11 files changed, 352 insertions(+), 152 deletions(-) create mode 100644 sys/kern/subr_coverage.c create mode 100644 sys/sys/coverage.h diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index a6cce21a38d0..2a6d980d4ffe 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -100,9 +100,12 @@ options WITNESS # Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default + +# Kernel Sanitizers +#options COVERAGE # Generic kernel coverage. Used by KCOV +#options KCOV # Kernel Coverage Sanitizer # Warning: KUBSAN can result in a kernel too large for loader to load #options KUBSAN # Kernel Undefined Behavior Sanitizer -#options KCOV # Kernel Coverage Sanitizer # Kernel dump features. options EKCD # Support for encrypted kernel dumps diff --git a/sys/amd64/conf/GENERIC-NODEBUG b/sys/amd64/conf/GENERIC-NODEBUG index 1bba3c0b59d2..c19b222c8b3d 100644 --- a/sys/amd64/conf/GENERIC-NODEBUG +++ b/sys/amd64/conf/GENERIC-NODEBUG @@ -37,4 +37,5 @@ nooptions WITNESS_SKIPSPIN nooptions BUF_TRACKING nooptions DEADLKRES nooptions FULL_BUF_TRACKING - +nooptions COVERAGE +nooptions KCOV diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index b1149a377ba3..5178455c364c 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -92,9 +92,12 @@ options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones options ALT_BREAK_TO_DEBUGGER # Enter debugger on keyboard escape sequence options USB_DEBUG # enable debug msgs options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default + +# Kernel Sanitizers +#options COVERAGE # Generic kernel coverage. Used by KCOV +#options KCOV # Kernel Coverage Sanitizer # Warning: KUBSAN can result in a kernel too large for loader to load #options KUBSAN # Kernel Undefined Behavior Sanitizer -#options KCOV # Kernel Coverage Sanitizer # Kernel dump features. options EKCD # Support for encrypted kernel dumps diff --git a/sys/arm64/conf/GENERIC-NODEBUG b/sys/arm64/conf/GENERIC-NODEBUG index d3ae3d0f071f..491853971503 100644 --- a/sys/arm64/conf/GENERIC-NODEBUG +++ b/sys/arm64/conf/GENERIC-NODEBUG @@ -36,3 +36,5 @@ nooptions WITNESS nooptions WITNESS_SKIPSPIN nooptions DEADLKRES nooptions USB_DEBUG +nooptions COVERAGE +nooptions KCOV diff --git a/sys/conf/files b/sys/conf/files index 2166d0621094..92a3068664a7 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3883,6 +3883,8 @@ kern/subr_capability.c standard kern/subr_clock.c standard kern/subr_compressor.c standard \ compile-with "${NORMAL_C} -I$S/contrib/zstd/lib/freebsd" +kern/subr_coverage.c optional coverage \ + compile-with "${NORMAL_C} -fno-sanitize=all" kern/subr_counter.c standard kern/subr_devstat.c standard kern/subr_disk.c standard diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index 5239162e6052..ef90658147d2 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -118,8 +118,8 @@ KUBSAN_ENABLED!= grep KUBSAN opt_global.h || true ; echo SAN_CFLAGS+= -fsanitize=undefined .endif -KCOV_ENABLED!= grep KCOV opt_kcov.h || true ; echo -.if !empty(KCOV_ENABLED) +COVERAGE_ENABLED!= grep COVERAGE opt_global.h || true ; echo +.if !empty(COVERAGE_ENABLED) SAN_CFLAGS+= -fsanitize-coverage=trace-pc,trace-cmp .endif diff --git a/sys/conf/options b/sys/conf/options index 6c0439c5b168..235226e8fdd1 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -57,7 +57,6 @@ DDB_CTF opt_ddb.h DDB_NUMSYM opt_ddb.h FULL_BUF_TRACKING opt_global.h GDB -KCOV opt_kcov.h KDB opt_global.h KDB_TRACE opt_kdb.h KDB_UNATTENDED opt_kdb.h @@ -234,6 +233,8 @@ VERBOSE_SYSINIT ZSTDIO opt_zstdio.h # Sanitizers +COVERAGE opt_global.h +KCOV KUBSAN opt_global.h # POSIX kernel options diff --git a/sys/kern/kern_kcov.c b/sys/kern/kern_kcov.c index c90fdc36d6a1..d2631a687f13 100644 --- a/sys/kern/kern_kcov.c +++ b/sys/kern/kern_kcov.c @@ -39,29 +39,26 @@ __FBSDID("$FreeBSD$"); #include +#include #include -#include #include #include +#include #include #include #include #include #include #include -#include #include -#include -#include #include +#include #include #include #include #include -#include - MALLOC_DEFINE(M_KCOV_INFO, "kcovinfo", "KCOV info type"); #define KCOV_ELEMENT_SIZE sizeof(uint64_t) @@ -138,17 +135,6 @@ static d_close_t kcov_close; static d_mmap_single_t kcov_mmap_single; static d_ioctl_t kcov_ioctl; -void __sanitizer_cov_trace_pc(void); -void __sanitizer_cov_trace_cmp1(uint8_t, uint8_t); -void __sanitizer_cov_trace_cmp2(uint16_t, uint16_t); -void __sanitizer_cov_trace_cmp4(uint32_t, uint32_t); -void __sanitizer_cov_trace_cmp8(uint64_t, uint64_t); -void __sanitizer_cov_trace_const_cmp1(uint8_t, uint8_t); -void __sanitizer_cov_trace_const_cmp2(uint16_t, uint16_t); -void __sanitizer_cov_trace_const_cmp4(uint32_t, uint32_t); -void __sanitizer_cov_trace_const_cmp8(uint64_t, uint64_t); -void __sanitizer_cov_trace_switch(uint64_t, uint64_t *); - static int kcov_alloc(struct kcov_info *info, size_t entries); static void kcov_init(const void *unused); @@ -169,6 +155,7 @@ SYSCTL_UINT(_kern_kcov, OID_AUTO, max_entries, CTLFLAG_RW, "Maximum number of entries in the kcov buffer"); static struct mtx kcov_lock; +static int active_count; static struct kcov_info * get_kinfo(struct thread *td) @@ -197,25 +184,13 @@ get_kinfo(struct thread *td) return (info); } -/* - * Main entry point. A call to this function will be inserted - * at every edge, and if coverage is enabled for the thread - * this function will add the PC to the buffer. - */ -void -__sanitizer_cov_trace_pc(void) +static void +trace_pc(uintptr_t ret) { struct thread *td; struct kcov_info *info; uint64_t *buf, index; - /* - * To guarantee curthread is properly set, we exit early - * until the driver has been initialized - */ - if (cold) - return; - td = curthread; info = get_kinfo(td); if (info == NULL) @@ -237,7 +212,7 @@ __sanitizer_cov_trace_pc(void) if (index + 2 > info->entries) return; - buf[index + 1] = (uint64_t)__builtin_return_address(0); + buf[index + 1] = ret; buf[0] = index + 1; } @@ -248,13 +223,6 @@ trace_cmp(uint64_t type, uint64_t arg1, uint64_t arg2, uint64_t ret) struct kcov_info *info; uint64_t *buf, index; - /* - * To guarantee curthread is properly set, we exit early - * until the driver has been initialized - */ - if (cold) - return (false); - td = curthread; info = get_kinfo(td); if (info == NULL) @@ -287,108 +255,6 @@ trace_cmp(uint64_t type, uint64_t arg1, uint64_t arg2, uint64_t ret) return (true); } -void -__sanitizer_cov_trace_cmp1(uint8_t arg1, uint8_t arg2) -{ - - trace_cmp(KCOV_CMP_SIZE(0), arg1, arg2, - (uint64_t)__builtin_return_address(0)); -} - -void -__sanitizer_cov_trace_cmp2(uint16_t arg1, uint16_t arg2) -{ - - trace_cmp(KCOV_CMP_SIZE(1), arg1, arg2, - (uint64_t)__builtin_return_address(0)); -} - -void -__sanitizer_cov_trace_cmp4(uint32_t arg1, uint32_t arg2) -{ - - trace_cmp(KCOV_CMP_SIZE(2), arg1, arg2, - (uint64_t)__builtin_return_address(0)); -} - -void -__sanitizer_cov_trace_cmp8(uint64_t arg1, uint64_t arg2) -{ - - trace_cmp(KCOV_CMP_SIZE(3), arg1, arg2, - (uint64_t)__builtin_return_address(0)); -} - -void -__sanitizer_cov_trace_const_cmp1(uint8_t arg1, uint8_t arg2) -{ - - trace_cmp(KCOV_CMP_SIZE(0) | KCOV_CMP_CONST, arg1, arg2, - (uint64_t)__builtin_return_address(0)); -} - -void -__sanitizer_cov_trace_const_cmp2(uint16_t arg1, uint16_t arg2) -{ - - trace_cmp(KCOV_CMP_SIZE(1) | KCOV_CMP_CONST, arg1, arg2, - (uint64_t)__builtin_return_address(0)); -} - -void -__sanitizer_cov_trace_const_cmp4(uint32_t arg1, uint32_t arg2) -{ - - trace_cmp(KCOV_CMP_SIZE(2) | KCOV_CMP_CONST, arg1, arg2, - (uint64_t)__builtin_return_address(0)); -} - -void -__sanitizer_cov_trace_const_cmp8(uint64_t arg1, uint64_t arg2) -{ - - trace_cmp(KCOV_CMP_SIZE(3) | KCOV_CMP_CONST, arg1, arg2, - (uint64_t)__builtin_return_address(0)); -} - -/* - * val is the switch operand - * cases[0] is the number of case constants - * cases[1] is the size of val in bits - * cases[2..n] are the case constants - */ -void -__sanitizer_cov_trace_switch(uint64_t val, uint64_t *cases) -{ - uint64_t i, count, ret, type; - - count = cases[0]; - ret = (uint64_t)__builtin_return_address(0); - - switch (cases[1]) { - case 8: - type = KCOV_CMP_SIZE(0); - break; - case 16: - type = KCOV_CMP_SIZE(1); - break; - case 32: - type = KCOV_CMP_SIZE(2); - break; - case 64: - type = KCOV_CMP_SIZE(3); - break; - default: - return; - } - - val |= KCOV_CMP_CONST; - - for (i = 0; i < count; i++) - if (!trace_cmp(type, val, cases[i + 2], ret)) - return; -} - /* * The fd is being closed, cleanup everything we can. */ @@ -456,6 +322,7 @@ kcov_close(struct cdev *dev, int fflag, int devtype, struct thread *td) struct kcov_info *info; int error; + if ((error = devfs_get_cdevpriv((void **)&info)) != 0) return (error); @@ -571,6 +438,16 @@ kcov_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag __unused, error = EINVAL; break; } + + /* Lets hope nobody opens this 2 billion times */ + KASSERT(active_count < INT_MAX, + ("%s: Open too many times", __func__)); + active_count++; + if (active_count == 1) { + cov_register_pc(&trace_pc); + cov_register_cmp(&trace_cmp); + } + KASSERT(info->thread == NULL, ("Enabling kcov when already enabled")); info->thread = td; @@ -589,6 +466,13 @@ kcov_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag __unused, error = EINVAL; break; } + KASSERT(active_count > 0, ("%s: Open count is zero", __func__)); + active_count--; + if (active_count == 0) { + cov_register_pc(&trace_pc); + cov_register_cmp(&trace_cmp); + } + td->td_kcov_info = NULL; atomic_store_int(&info->state, KCOV_STATE_READY); /* @@ -618,6 +502,12 @@ kcov_thread_dtor(void *arg __unused, struct thread *td) return; mtx_lock_spin(&kcov_lock); + KASSERT(active_count > 0, ("%s: Open count is zero", __func__)); + active_count--; + if (active_count == 0) { + cov_register_pc(&trace_pc); + cov_register_cmp(&trace_cmp); + } td->td_kcov_info = NULL; if (info->state != KCOV_STATE_DYING) { /* @@ -673,4 +563,4 @@ kcov_init(const void *unused) EVENTHANDLER_PRI_ANY); } -SYSINIT(kcovdev, SI_SUB_DEVFS, SI_ORDER_ANY, kcov_init, NULL); +SYSINIT(kcovdev, SI_SUB_LAST, SI_ORDER_ANY, kcov_init, NULL); diff --git a/sys/kern/subr_coverage.c b/sys/kern/subr_coverage.c new file mode 100644 index 000000000000..0c1b280a135c --- /dev/null +++ b/sys/kern/subr_coverage.c @@ -0,0 +1,237 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (C) 2018 The FreeBSD Foundation. All rights reserved. + * Copyright (C) 2018, 2019 Andrew Turner + * + * This software was developed by Mitchell Horne under sponsorship of + * the FreeBSD Foundation. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include + +void __sanitizer_cov_trace_pc(void); +void __sanitizer_cov_trace_cmp1(uint8_t, uint8_t); +void __sanitizer_cov_trace_cmp2(uint16_t, uint16_t); +void __sanitizer_cov_trace_cmp4(uint32_t, uint32_t); +void __sanitizer_cov_trace_cmp8(uint64_t, uint64_t); +void __sanitizer_cov_trace_const_cmp1(uint8_t, uint8_t); +void __sanitizer_cov_trace_const_cmp2(uint16_t, uint16_t); +void __sanitizer_cov_trace_const_cmp4(uint32_t, uint32_t); +void __sanitizer_cov_trace_const_cmp8(uint64_t, uint64_t); +void __sanitizer_cov_trace_switch(uint64_t, uint64_t *); + +static cov_trace_pc_t cov_trace_pc; +static cov_trace_cmp_t cov_trace_cmp; + +void +cov_register_pc(cov_trace_pc_t trace_pc) +{ + + atomic_store_ptr(&cov_trace_pc, trace_pc); +} + +void +cov_unregister_pc(void) +{ + + atomic_store_ptr(&cov_trace_pc, NULL); +} + +void +cov_register_cmp(cov_trace_cmp_t trace_cmp) +{ + + atomic_store_ptr(&cov_trace_cmp, trace_cmp); +} + +void +cov_unregister_cmp(void) +{ + + atomic_store_ptr(&cov_trace_cmp, NULL); +} + +/* + * Main entry point. A call to this function will be inserted + * at every edge, and if coverage is enabled for the thread + * this function will add the PC to the buffer. + */ +void +__sanitizer_cov_trace_pc(void) +{ + cov_trace_pc_t trace_pc; + + trace_pc = (cov_trace_pc_t)atomic_load_ptr(&cov_trace_pc); + if (trace_pc != NULL) + trace_pc((uint64_t)__builtin_return_address(0)); +} + +/* + * Comparison entry points. When the kernel performs a comparison + * operation the compiler inserts a call to one of the following + * functions to record the operation. + */ +void +__sanitizer_cov_trace_cmp1(uint8_t arg1, uint8_t arg2) +{ + cov_trace_cmp_t trace_cmp; + + trace_cmp = (cov_trace_cmp_t)atomic_load_ptr(&cov_trace_cmp); + if (trace_cmp != NULL) + trace_cmp(COV_CMP_SIZE(0), arg1, arg2, + (uint64_t)__builtin_return_address(0)); +} + +void +__sanitizer_cov_trace_cmp2(uint16_t arg1, uint16_t arg2) +{ + cov_trace_cmp_t trace_cmp; + + trace_cmp = (cov_trace_cmp_t)atomic_load_ptr(&cov_trace_cmp); + if (trace_cmp != NULL) + trace_cmp(COV_CMP_SIZE(1), arg1, arg2, + (uint64_t)__builtin_return_address(0)); +} + +void +__sanitizer_cov_trace_cmp4(uint32_t arg1, uint32_t arg2) +{ + cov_trace_cmp_t trace_cmp; + + trace_cmp = (cov_trace_cmp_t)atomic_load_ptr(&cov_trace_cmp); + if (trace_cmp != NULL) + trace_cmp(COV_CMP_SIZE(2), arg1, arg2, + (uint64_t)__builtin_return_address(0)); +} + +void +__sanitizer_cov_trace_cmp8(uint64_t arg1, uint64_t arg2) +{ + cov_trace_cmp_t trace_cmp; + + trace_cmp = (cov_trace_cmp_t)atomic_load_ptr(&cov_trace_cmp); + if (trace_cmp != NULL) + trace_cmp(COV_CMP_SIZE(3), arg1, arg2, + (uint64_t)__builtin_return_address(0)); +} + +void +__sanitizer_cov_trace_const_cmp1(uint8_t arg1, uint8_t arg2) +{ + cov_trace_cmp_t trace_cmp; + + trace_cmp = (cov_trace_cmp_t)atomic_load_ptr(&cov_trace_cmp); + if (trace_cmp != NULL) + trace_cmp(COV_CMP_SIZE(0) | COV_CMP_CONST, arg1, arg2, + (uint64_t)__builtin_return_address(0)); +} + +void +__sanitizer_cov_trace_const_cmp2(uint16_t arg1, uint16_t arg2) +{ + cov_trace_cmp_t trace_cmp; + + trace_cmp = (cov_trace_cmp_t)atomic_load_ptr(&cov_trace_cmp); + if (trace_cmp != NULL) + trace_cmp(COV_CMP_SIZE(1) | COV_CMP_CONST, arg1, arg2, + (uint64_t)__builtin_return_address(0)); +} + +void +__sanitizer_cov_trace_const_cmp4(uint32_t arg1, uint32_t arg2) +{ + cov_trace_cmp_t trace_cmp; + + trace_cmp = (cov_trace_cmp_t)atomic_load_ptr(&cov_trace_cmp); + if (trace_cmp != NULL) + trace_cmp(COV_CMP_SIZE(2) | COV_CMP_CONST, arg1, arg2, + (uint64_t)__builtin_return_address(0)); +} + +void +__sanitizer_cov_trace_const_cmp8(uint64_t arg1, uint64_t arg2) +{ + cov_trace_cmp_t trace_cmp; + + trace_cmp = (cov_trace_cmp_t)atomic_load_ptr(&cov_trace_cmp); + if (trace_cmp != NULL) + trace_cmp(COV_CMP_SIZE(3) | COV_CMP_CONST, arg1, arg2, + (uint64_t)__builtin_return_address(0)); +} + +/* + * val is the switch operand + * cases[0] is the number of case constants + * cases[1] is the size of val in bits + * cases[2..n] are the case constants + */ +void +__sanitizer_cov_trace_switch(uint64_t val, uint64_t *cases) +{ + uint64_t i, count, ret, type; + cov_trace_cmp_t trace_cmp; + + trace_cmp = (cov_trace_cmp_t)atomic_load_ptr(&cov_trace_cmp); + if (trace_cmp == NULL) + return; + + count = cases[0]; + ret = (uint64_t)__builtin_return_address(0); + + switch (cases[1]) { + case 8: + type = COV_CMP_SIZE(0); + break; + case 16: + type = COV_CMP_SIZE(1); + break; + case 32: + type = COV_CMP_SIZE(2); + break; + case 64: + type = COV_CMP_SIZE(3); + break; + default: + return; + } + + val |= COV_CMP_CONST; + + for (i = 0; i < count; i++) + if (!trace_cmp(type, val, cases[i + 2], ret)) + return; +} diff --git a/sys/sys/coverage.h b/sys/sys/coverage.h new file mode 100644 index 000000000000..f00d6b992cf4 --- /dev/null +++ b/sys/sys/coverage.h @@ -0,0 +1,60 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (C) 2018 The FreeBSD Foundation. All rights reserved. + * Copyright (C) 2018, 2019 Andrew Turner. + * + * This software was developed by Mitchell Horne under sponsorship of + * the FreeBSD Foundation. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS_COVERAGE_H_ +#define _SYS_COVERAGE_H_ + +#if !defined(_KERNEL) && !defined(_SYS_KCOV_H_) +#error Do not include this file directly in userspace, use sys/kcov.h +#endif + +#define COV_CMP_CONST (1 << 0) +#define COV_CMP_SIZE(x) ((x) << 1) +#define COV_CMP_MASK (3 << 1) +#define COV_CMP_GET_SIZE(x) (((x) >> 1) & 3) + +#ifdef _KERNEL +typedef void (*cov_trace_pc_t)(uintptr_t); +typedef bool (*cov_trace_cmp_t)(uint64_t, uint64_t, uint64_t, uint64_t); + +void cov_register_cmp(cov_trace_cmp_t); +void cov_unregister_cmp(void); +void cov_register_pc(cov_trace_pc_t); +void cov_unregister_pc(void); +#endif + +#endif /* _SYS_COVERAGE_H_ */ diff --git a/sys/sys/kcov.h b/sys/sys/kcov.h index 0a9ac19e226c..89be2c3df5de 100644 --- a/sys/sys/kcov.h +++ b/sys/sys/kcov.h @@ -38,6 +38,7 @@ #ifndef _SYS_KCOV_H_ #define _SYS_KCOV_H_ +#include #include #define KCOV_MAXENTRIES (1 << 24) /* 16M */ @@ -51,9 +52,9 @@ #define KIODISABLE _IO('c', 3) /* Disable coverage recording */ #define KIOSETBUFSIZE _IOWINT('c', 4) /* Set the buffer size */ -#define KCOV_CMP_CONST (1 << 0) -#define KCOV_CMP_SIZE(x) ((x) << 1) -#define KCOV_CMP_MASK (3 << 1) -#define KCOV_CMP_GET_SIZE(x) (((x) >> 1) & 3) +#define KCOV_CMP_CONST COV_CMP_CONST +#define KCOV_CMP_SIZE(x) COV_CMP_SIZE(x) +#define KCOV_CMP_MASK COV_CMP_MASK +#define KCOV_CMP_GET_SIZE(x) COV_CMP_GET_SIZE(x) #endif /* _SYS_KCOV_H_ */ From 7664b71b62fce77519bf2378451efbf57b1baeba Mon Sep 17 00:00:00 2001 From: "Andrey V. Elsukov" Date: Tue, 29 Jan 2019 11:18:41 +0000 Subject: [PATCH 132/142] Fix the bug introduced in r342908, that causes problems with dynamic handling for protocols without ports numbers. Since port numbers were uninitialized for protocols like ICMP/ICMPv6, ipfw_chk() used some non-zero values to create dynamic states, and due this it failed to match replies with created states. Reported by: Oliver Hartmann, Boris Lytochkin Obtained from: Yandex LLC X-MFC after: r342908 --- sys/netpfil/ipfw/ip_fw2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netpfil/ipfw/ip_fw2.c b/sys/netpfil/ipfw/ip_fw2.c index be69eb1ec7fb..5c91b76c2fd6 100644 --- a/sys/netpfil/ipfw/ip_fw2.c +++ b/sys/netpfil/ipfw/ip_fw2.c @@ -1410,6 +1410,7 @@ ipfw_chk(struct ip_fw_args *args) dst_ip.s_addr = 0; /* make sure it is initialized */ src_ip.s_addr = 0; /* make sure it is initialized */ + src_port = dst_port = 0; pktlen = m->m_pkthdr.len; DYN_INFO_INIT(&dyn_info); @@ -1688,7 +1689,6 @@ do { \ args->f_id.dst_ip = ntohl(dst_ip.s_addr); } else { proto = 0; - src_port = dst_port = 0; dst_ip.s_addr = src_ip.s_addr = 0; args->f_id.addr_type = 1; /* XXX */ From 93ef29690e8cfecf495f8eada5e87156af6c0cc9 Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Tue, 29 Jan 2019 14:31:41 +0000 Subject: [PATCH 133/142] vtnet: fix typo in vtnet_free_taskqueues Because of a typo, the code was mistakenly resetting the vtnrx_vq pointer rather than vtntx_tq. Reviewed by: bryanv MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D19015 --- sys/dev/virtio/network/if_vtnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index cf9e70921db0..129818ff0a06 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -2748,7 +2748,7 @@ vtnet_free_taskqueues(struct vtnet_softc *sc) rxq = &sc->vtnet_rxqs[i]; if (rxq->vtnrx_tq != NULL) { taskqueue_free(rxq->vtnrx_tq); - rxq->vtnrx_vq = NULL; + rxq->vtnrx_tq = NULL; } txq = &sc->vtnet_txqs[i]; From c245efb99bca4c8e135ff423dc0f501bdc71f43a Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Tue, 29 Jan 2019 19:54:37 +0000 Subject: [PATCH 134/142] calendar(1): Fix Aschermittwoch date for Austrian calendar PR: 165516 Submitted by: jhs@berklix.com MFC after: 1 week --- usr.bin/calendar/calendars/de_AT.ISO_8859-15/calendar.feiertag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/calendar/calendars/de_AT.ISO_8859-15/calendar.feiertag b/usr.bin/calendar/calendars/de_AT.ISO_8859-15/calendar.feiertag index 751c001982ca..fe998f592ae9 100644 --- a/usr.bin/calendar/calendars/de_AT.ISO_8859-15/calendar.feiertag +++ b/usr.bin/calendar/calendars/de_AT.ISO_8859-15/calendar.feiertag @@ -37,7 +37,7 @@ Easter+60 Fronleichnam /* Gedenktage - nicht arbeitsfreie Feiertage */ 02/14 Valentinstag -02/WednesdayLast Aschermittwoch +Easter-46 Aschermittwoch Easter-7 Palmsonntag Nov Sun+3 Totensonntag Nov Sun+4 1. Advent From 09efc56d6699e7a7b2941455d581625f40775a88 Mon Sep 17 00:00:00 2001 From: "David E. O'Brien" Date: Tue, 29 Jan 2019 20:10:27 +0000 Subject: [PATCH 135/142] Follow arm[32] and sparc64 KAPI and provide the FreeBSD standard spelling across all architectures for this header. Reviewed by: stevek Obtained from: Juniper Networks --- sys/arm64/include/sigframe.h | 2 ++ sys/riscv/include/sigframe.h | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 sys/arm64/include/sigframe.h create mode 100644 sys/riscv/include/sigframe.h diff --git a/sys/arm64/include/sigframe.h b/sys/arm64/include/sigframe.h new file mode 100644 index 000000000000..9787f579d563 --- /dev/null +++ b/sys/arm64/include/sigframe.h @@ -0,0 +1,2 @@ +/* $FreeBSD$ */ +#include diff --git a/sys/riscv/include/sigframe.h b/sys/riscv/include/sigframe.h new file mode 100644 index 000000000000..9787f579d563 --- /dev/null +++ b/sys/riscv/include/sigframe.h @@ -0,0 +1,2 @@ +/* $FreeBSD$ */ +#include From 56eee7cbb4f62b6322ca615aeeac7b966a267eec Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Tue, 29 Jan 2019 20:35:09 +0000 Subject: [PATCH 136/142] Reimplement BIO_ORDERED handling in nvd(4). This fixes BIO_ORDERED semantics while also improving performance by: - sleeping also before BIO_ORDERED bio, as defined, not only after; - not queueing BIO_ORDERED bio to taskqueue if no other bios running; - waking up sleeping taskqueue explicitly rather then rely on polling. On Samsung SSD 970 PRO this shows sync write latency, measured with `diskinfo -wS`, reduction from ~2ms to ~1.1ms by not sleeping without reason till next HZ tick. On the same device ZFS pool with 8 ZVOLs synchronously writing 4KB blocks shows ~950 IOPS instead of ~750 IOPS before. I suspect ZFS does not need BIO_ORDERED on BIO_FLUSH at all, but that will be next question. MFC after: 2 weeks Sponsored by: iXsystems, Inc. --- sys/dev/nvd/nvd.c | 94 ++++++++++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 41 deletions(-) diff --git a/sys/dev/nvd/nvd.c b/sys/dev/nvd/nvd.c index b0057d577710..d228b7b16db9 100644 --- a/sys/dev/nvd/nvd.c +++ b/sys/dev/nvd/nvd.c @@ -82,6 +82,7 @@ struct nvd_disk { struct nvme_namespace *ns; uint32_t cur_depth; +#define NVD_ODEPTH (1 << 31) uint32_t ordered_in_flight; u_int unit; @@ -181,39 +182,50 @@ nvd_unload() mtx_destroy(&nvd_lock); } -static int +static void nvd_bio_submit(struct nvd_disk *ndisk, struct bio *bp) { int err; bp->bio_driver1 = NULL; - atomic_add_int(&ndisk->cur_depth, 1); + if (__predict_false(bp->bio_flags & BIO_ORDERED)) + atomic_add_int(&ndisk->cur_depth, NVD_ODEPTH); + else + atomic_add_int(&ndisk->cur_depth, 1); err = nvme_ns_bio_process(ndisk->ns, bp, nvd_done); if (err) { - atomic_add_int(&ndisk->cur_depth, -1); - if (__predict_false(bp->bio_flags & BIO_ORDERED)) + if (__predict_false(bp->bio_flags & BIO_ORDERED)) { + atomic_add_int(&ndisk->cur_depth, -NVD_ODEPTH); atomic_add_int(&ndisk->ordered_in_flight, -1); + wakeup(&ndisk->cur_depth); + } else { + if (atomic_fetchadd_int(&ndisk->cur_depth, -1) == 1 && + __predict_false(ndisk->ordered_in_flight != 0)) + wakeup(&ndisk->cur_depth); + } bp->bio_error = err; bp->bio_flags |= BIO_ERROR; bp->bio_resid = bp->bio_bcount; biodone(bp); - return (-1); } - - return (0); } static void nvd_strategy(struct bio *bp) { - struct nvd_disk *ndisk; + struct nvd_disk *ndisk = (struct nvd_disk *)bp->bio_disk->d_drv1; - ndisk = (struct nvd_disk *)bp->bio_disk->d_drv1; - - if (__predict_false(bp->bio_flags & BIO_ORDERED)) - atomic_add_int(&ndisk->ordered_in_flight, 1); - - if (__predict_true(ndisk->ordered_in_flight == 0)) { + /* + * bio with BIO_ORDERED flag must be executed after all previous + * bios in the queue, and before any successive bios. + */ + if (__predict_false(bp->bio_flags & BIO_ORDERED)) { + if (atomic_fetchadd_int(&ndisk->ordered_in_flight, 1) == 0 && + ndisk->cur_depth == 0 && bioq_first(&ndisk->bioq) == NULL) { + nvd_bio_submit(ndisk, bp); + return; + } + } else if (__predict_true(ndisk->ordered_in_flight == 0)) { nvd_bio_submit(ndisk, bp); return; } @@ -281,11 +293,8 @@ nvd_ioctl(struct disk *ndisk, u_long cmd, void *data, int fflag, static int nvd_dump(void *arg, void *virt, vm_offset_t phys, off_t offset, size_t len) { - struct nvd_disk *ndisk; - struct disk *dp; - - dp = arg; - ndisk = dp->d_drv1; + struct disk *dp = arg; + struct nvd_disk *ndisk = dp->d_drv1; return (nvme_ns_dump(ndisk->ns, virt, offset, len)); } @@ -293,16 +302,18 @@ nvd_dump(void *arg, void *virt, vm_offset_t phys, off_t offset, size_t len) static void nvd_done(void *arg, const struct nvme_completion *cpl) { - struct bio *bp; - struct nvd_disk *ndisk; + struct bio *bp = (struct bio *)arg; + struct nvd_disk *ndisk = bp->bio_disk->d_drv1; - bp = (struct bio *)arg; - - ndisk = bp->bio_disk->d_drv1; - - atomic_add_int(&ndisk->cur_depth, -1); - if (__predict_false(bp->bio_flags & BIO_ORDERED)) + if (__predict_false(bp->bio_flags & BIO_ORDERED)) { + atomic_add_int(&ndisk->cur_depth, -NVD_ODEPTH); atomic_add_int(&ndisk->ordered_in_flight, -1); + wakeup(&ndisk->cur_depth); + } else { + if (atomic_fetchadd_int(&ndisk->cur_depth, -1) == 1 && + __predict_false(ndisk->ordered_in_flight != 0)) + wakeup(&ndisk->cur_depth); + } biodone(bp); } @@ -320,22 +331,23 @@ nvd_bioq_process(void *arg, int pending) if (bp == NULL) break; - if (nvd_bio_submit(ndisk, bp) != 0) { - continue; + if (__predict_false(bp->bio_flags & BIO_ORDERED)) { + /* + * bio with BIO_ORDERED flag set must be executed + * after all previous bios. + */ + while (ndisk->cur_depth > 0) + tsleep(&ndisk->cur_depth, 0, "nvdorb", 1); + } else { + /* + * bio with BIO_ORDERED flag set must be completed + * before proceeding with additional bios. + */ + while (ndisk->cur_depth >= NVD_ODEPTH) + tsleep(&ndisk->cur_depth, 0, "nvdora", 1); } -#ifdef BIO_ORDERED - /* - * BIO_ORDERED flag dictates that the bio with BIO_ORDERED - * flag set must be completed before proceeding with - * additional bios. - */ - if (bp->bio_flags & BIO_ORDERED) { - while (ndisk->cur_depth > 0) { - pause("nvd flush", 1); - } - } -#endif + nvd_bio_submit(ndisk, bp); } } From e34c029020878b7958dd60b540e701223933d5e5 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Tue, 29 Jan 2019 20:50:29 +0000 Subject: [PATCH 137/142] Fix GCC build, failed due to false integer overflow in r343562. MFC after: 2 weeks --- sys/dev/nvd/nvd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/nvd/nvd.c b/sys/dev/nvd/nvd.c index d228b7b16db9..5a7b502ff225 100644 --- a/sys/dev/nvd/nvd.c +++ b/sys/dev/nvd/nvd.c @@ -82,7 +82,7 @@ struct nvd_disk { struct nvme_namespace *ns; uint32_t cur_depth; -#define NVD_ODEPTH (1 << 31) +#define NVD_ODEPTH (1 << 30) uint32_t ordered_in_flight; u_int unit; From 1a3b2ebf9595f4203df1b54d8a1343b908a1ea9d Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Tue, 29 Jan 2019 22:40:42 +0000 Subject: [PATCH 138/142] Adjust posix symbols from rtld-elf/malloc.c with the __crt_ prefix. This allows to reuse the allocator in other environments that get malloc(3) and related functions from libc or interposer. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D18988 --- libexec/rtld-elf/malloc.c | 22 +++++++++++++--------- libexec/rtld-elf/rtld.c | 30 ++++++++++++++++++++++++++++++ libexec/rtld-elf/rtld.h | 5 +++++ libexec/rtld-elf/xmalloc.c | 18 +++++++++++------- 4 files changed, 59 insertions(+), 16 deletions(-) diff --git a/libexec/rtld-elf/malloc.c b/libexec/rtld-elf/malloc.c index b85133b30a93..020d2fe112da 100644 --- a/libexec/rtld-elf/malloc.c +++ b/libexec/rtld-elf/malloc.c @@ -153,7 +153,7 @@ botch(s) */ void * -malloc(size_t nbytes) +__crt_malloc(size_t nbytes) { union overhead *op; int bucket; @@ -236,7 +236,7 @@ malloc(size_t nbytes) } void * -calloc(size_t num, size_t size) +__crt_calloc(size_t num, size_t size) { void *ret; @@ -245,7 +245,7 @@ calloc(size_t num, size_t size) return (NULL); } - if ((ret = malloc(num * size)) != NULL) + if ((ret = __crt_malloc(num * size)) != NULL) memset(ret, 0, num * size); return (ret); @@ -298,7 +298,7 @@ morecore(int bucket) } void -free(void * cp) +__crt_free(void *cp) { int size; union overhead *op; @@ -339,7 +339,7 @@ free(void * cp) static int realloc_srchlen = 4; /* 4 should be plenty, -1 =>'s whole list */ void * -realloc(void *cp, size_t nbytes) +__crt_realloc(void *cp, size_t nbytes) { u_int onb; int i; @@ -348,7 +348,7 @@ realloc(void *cp, size_t nbytes) int was_alloced = 0; if (cp == NULL) - return (malloc(nbytes)); + return (__crt_malloc(nbytes)); op = (union overhead *)((caddr_t)cp - sizeof (union overhead)); if (op->ov_magic == MAGIC) { was_alloced++; @@ -393,10 +393,10 @@ realloc(void *cp, size_t nbytes) #endif return(cp); } else - free(cp); + __crt_free(cp); } - if ((res = malloc(nbytes)) == NULL) - return (NULL); + if ((res = __crt_malloc(nbytes)) == NULL) + return (NULL); if (cp != res) /* common optimization if "compacting" */ bcopy(cp, res, (nbytes < onb) ? nbytes : onb); return (res); @@ -467,9 +467,11 @@ morepages(int n) caddr_t addr = (caddr_t) (((long)pagepool_start + pagesz - 1) & ~(pagesz - 1)); if (munmap(addr, pagepool_end - addr) != 0) { +#ifdef IN_RTLD rtld_fdprintf(STDERR_FILENO, _BASENAME_RTLD ": " "morepages: cannot munmap %p: %s\n", addr, rtld_strerror(errno)); +#endif } } @@ -478,9 +480,11 @@ morepages(int n) if ((pagepool_start = mmap(0, n * pagesz, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, fd, 0)) == (caddr_t)-1) { +#ifdef IN_RTLD rtld_fdprintf(STDERR_FILENO, _BASENAME_RTLD ": morepages: " "cannot mmap anonymous memory: %s\n", rtld_strerror(errno)); +#endif return 0; } pagepool_end = pagepool_start + n * pagesz; diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 163e107a91a3..691bb32f5f4b 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include "paths.h" #include "rtld_tls.h" #include "rtld_printf.h" +#include "rtld_malloc.h" #include "rtld_utrace.h" #include "notes.h" @@ -5637,3 +5638,32 @@ bzero(void *dest, size_t len) for (i = 0; i < len; i++) ((char *)dest)[i] = 0; } + +/* malloc */ +void * +malloc(size_t nbytes) +{ + + return (__crt_malloc(nbytes)); +} + +void * +calloc(size_t num, size_t size) +{ + + return (__crt_calloc(num, size)); +} + +void +free(void *cp) +{ + + __crt_free(cp); +} + +void * +realloc(void *cp, size_t nbytes) +{ + + return (__crt_realloc(cp, nbytes)); +} diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index 68cfbb01e949..735df1f5809b 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -409,4 +409,9 @@ void pre_init(void); void init_pltgot(Obj_Entry *); void allocate_initial_tls(Obj_Entry *); +void *__crt_calloc(size_t num, size_t size); +void __crt_free(void *cp); +void *__crt_malloc(size_t nbytes); +void *__crt_realloc(void *cp, size_t nbytes); + #endif /* } */ diff --git a/libexec/rtld-elf/xmalloc.c b/libexec/rtld-elf/xmalloc.c index f3883cc0ae24..2231d4339124 100644 --- a/libexec/rtld-elf/xmalloc.c +++ b/libexec/rtld-elf/xmalloc.c @@ -33,13 +33,14 @@ #include #include "rtld.h" #include "rtld_printf.h" +#include "rtld_malloc.h" void * xcalloc(size_t number, size_t size) { void *p; - p = calloc(number, size); + p = __crt_calloc(number, size); if (p == NULL) { rtld_fdputstr(STDERR_FILENO, "Out of memory\n"); _exit(1); @@ -50,12 +51,15 @@ xcalloc(size_t number, size_t size) void * xmalloc(size_t size) { - void *p = malloc(size); - if (p == NULL) { - rtld_fdputstr(STDERR_FILENO, "Out of memory\n"); - _exit(1); - } - return p; + + void *p; + + p = __crt_malloc(size); + if (p == NULL) { + rtld_fdputstr(STDERR_FILENO, "Out of memory\n"); + _exit(1); + } + return (p); } char * From 7a6d40b22c52a28fb31ee0775128945acf897a01 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Tue, 29 Jan 2019 22:45:24 +0000 Subject: [PATCH 139/142] Add header file missed in r343564. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D18988 --- libexec/rtld-elf/rtld_malloc.h | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 libexec/rtld-elf/rtld_malloc.h diff --git a/libexec/rtld-elf/rtld_malloc.h b/libexec/rtld-elf/rtld_malloc.h new file mode 100644 index 000000000000..a8eb25272a57 --- /dev/null +++ b/libexec/rtld-elf/rtld_malloc.h @@ -0,0 +1,45 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef RTLD_MALLOC_H +#define RTLD_MALLOC_H + +void *__crt_calloc(size_t num, size_t size); +void __crt_free(void *cp); +void *__crt_malloc(size_t nbytes); +void *__crt_realloc(void *cp, size_t nbytes); + +extern int npagesizes; +extern size_t *pagesizes; + +#endif From 381c2d2e9a882f8ba03ab84d6fc06f1347866f65 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Tue, 29 Jan 2019 22:46:44 +0000 Subject: [PATCH 140/142] Untangle jemalloc and mutexes initialization. The need to use libc malloc(3) from some places in libthr always caused issues. For instance, per-thread key allocation was switched to use plain mmap(2) to get storage, because some third party mallocs used keys for implementation of calloc(3). Even more important, libthr calls calloc(3) during initialization of pthread mutexes, and jemalloc uses pthread mutexes. Jemalloc provides some way to both postpone the initialization, and to make initialization to use specialized allocator, but this is very fragile and often breaks. See the referenced PR for another example. Add the small malloc implementation used by rtld, to libthr. Use it in thr_spec.c and for mutexes initialization. This avoids the issues with mutual dependencies between malloc and libthr in principle. The drawback is that some more allocations are not interceptable for alternate malloc implementations. There should be not too much memory use from this allocator, and the alternative, direct use of mmap(2) is obviously worse. PR: 235211 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D18988 --- lib/libthr/Makefile | 3 + lib/libthr/thread/Makefile.inc | 1 + lib/libthr/thread/thr_fork.c | 6 ++ lib/libthr/thread/thr_init.c | 1 + lib/libthr/thread/thr_malloc.c | 137 ++++++++++++++++++++++++++++++++ lib/libthr/thread/thr_mutex.c | 9 ++- lib/libthr/thread/thr_private.h | 8 ++ lib/libthr/thread/thr_spec.c | 10 +-- 8 files changed, 165 insertions(+), 10 deletions(-) create mode 100644 lib/libthr/thread/thr_malloc.c diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile index 9b932cdb7aac..56905d36e8c5 100644 --- a/lib/libthr/Makefile +++ b/lib/libthr/Makefile @@ -27,6 +27,7 @@ CFLAGS+=-I${SRCTOP}/lib/libthread_db CFLAGS+=-Winline CFLAGS.thr_stack.c+= -Wno-cast-align +CFLAGS.malloc.c+= -Wno-cast-align .include .if !(${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 40300) CFLAGS.thr_symbols.c+= -Wno-missing-variable-declarations @@ -50,12 +51,14 @@ CFLAGS+=-D_PTHREADS_INVARIANTS PRECIOUSLIB= .PATH: ${.CURDIR}/arch/${MACHINE_CPUARCH}/${MACHINE_CPUARCH} +.PATH: ${SRCTOP}/libexec/rtld-elf .if exists(${.CURDIR}/arch/${MACHINE_CPUARCH}/Makefile.inc) .include "${.CURDIR}/arch/${MACHINE_CPUARCH}/Makefile.inc" .endif .include "${.CURDIR}/sys/Makefile.inc" .include "${.CURDIR}/thread/Makefile.inc" +SRCS+= malloc.c .if ${MK_INSTALLLIB} != "no" SYMLINKS+=lib${LIB}.a ${LIBDIR}/libpthread.a diff --git a/lib/libthr/thread/Makefile.inc b/lib/libthr/thread/Makefile.inc index 795ed3989abe..34b881a69637 100644 --- a/lib/libthr/thread/Makefile.inc +++ b/lib/libthr/thread/Makefile.inc @@ -31,6 +31,7 @@ SRCS+= \ thr_kern.c \ thr_kill.c \ thr_main_np.c \ + thr_malloc.c \ thr_multi_np.c \ thr_mutex.c \ thr_mutexattr.c \ diff --git a/lib/libthr/thread/thr_fork.c b/lib/libthr/thread/thr_fork.c index 8d969cbf9718..2e151618ffbc 100644 --- a/lib/libthr/thread/thr_fork.c +++ b/lib/libthr/thread/thr_fork.c @@ -170,6 +170,7 @@ __thr_fork(void) */ if (_thr_isthreaded() != 0) { was_threaded = 1; + __thr_malloc_prefork(curthread); _malloc_prefork(); __thr_pshared_atfork_pre(); _rtld_atfork_pre(rtld_locks); @@ -197,6 +198,10 @@ __thr_fork(void) */ curthread->tlflags &= ~TLFLAGS_IN_TDLIST; + /* before thr_self() */ + if (was_threaded) + __thr_malloc_postfork(curthread); + /* child is a new kernel thread. */ thr_self(&curthread->tid); @@ -241,6 +246,7 @@ __thr_fork(void) _thr_signal_postfork(); if (was_threaded) { + __thr_malloc_postfork(curthread); _rtld_atfork_post(rtld_locks); __thr_pshared_atfork_post(); _malloc_postfork(); diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c index 4781f8956c48..1568529e8c51 100644 --- a/lib/libthr/thread/thr_init.c +++ b/lib/libthr/thread/thr_init.c @@ -461,6 +461,7 @@ init_private(void) */ if (init_once == 0) { __thr_pshared_init(); + __thr_malloc_init(); /* Find the stack top */ mib[0] = CTL_KERN; mib[1] = KERN_USRSTACK; diff --git a/lib/libthr/thread/thr_malloc.c b/lib/libthr/thread/thr_malloc.c new file mode 100644 index 000000000000..157c72f10d6c --- /dev/null +++ b/lib/libthr/thread/thr_malloc.c @@ -0,0 +1,137 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include "thr_private.h" + +int npagesizes; +size_t *pagesizes; +static size_t pagesizes_d[2]; +static struct umutex thr_malloc_umtx; + +void +__thr_malloc_init(void) +{ + + npagesizes = getpagesizes(pagesizes_d, nitems(pagesizes_d)); + if (npagesizes == -1) { + npagesizes = 1; + pagesizes_d[0] = PAGE_SIZE; + } + pagesizes = pagesizes_d; + _thr_umutex_init(&thr_malloc_umtx); +} + +static void +thr_malloc_lock(struct pthread *curthread) +{ + + curthread->locklevel++; + _thr_umutex_lock(&thr_malloc_umtx, TID(curthread)); +} + +static void +thr_malloc_unlock(struct pthread *curthread) +{ + + _thr_umutex_unlock(&thr_malloc_umtx, TID(curthread)); + curthread->locklevel--; + _thr_ast(curthread); +} + +void * +__thr_calloc(size_t num, size_t size) +{ + struct pthread *curthread; + void *res; + + curthread = _get_curthread(); + thr_malloc_lock(curthread); + res = __crt_calloc(num, size); + thr_malloc_unlock(curthread); + return (res); +} + +void +__thr_free(void *cp) +{ + struct pthread *curthread; + + curthread = _get_curthread(); + thr_malloc_lock(curthread); + __crt_free(cp); + thr_malloc_unlock(curthread); +} + +void * +__thr_malloc(size_t nbytes) +{ + struct pthread *curthread; + void *res; + + curthread = _get_curthread(); + thr_malloc_lock(curthread); + res = __crt_malloc(nbytes); + thr_malloc_unlock(curthread); + return (res); +} + +void * +__thr_realloc(void *cp, size_t nbytes) +{ + struct pthread *curthread; + void *res; + + curthread = _get_curthread(); + thr_malloc_lock(curthread); + res = __crt_realloc(cp, nbytes); + thr_malloc_unlock(curthread); + return (res); +} + +void +__thr_malloc_prefork(struct pthread *curthread) +{ + + _thr_umutex_lock(&thr_malloc_umtx, TID(curthread)); +} + +void +__thr_malloc_postfork(struct pthread *curthread) +{ + + _thr_umutex_unlock(&thr_malloc_umtx, TID(curthread)); +} diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c index d2d9f5b54c10..f6f37c1264e2 100644 --- a/lib/libthr/thread/thr_mutex.c +++ b/lib/libthr/thread/thr_mutex.c @@ -306,10 +306,11 @@ init_static(struct pthread *thread, pthread_mutex_t *mutex) THR_LOCK_ACQUIRE(thread, &_mutex_static_lock); if (*mutex == THR_MUTEX_INITIALIZER) - ret = mutex_init(mutex, &_pthread_mutexattr_default, calloc); + ret = mutex_init(mutex, &_pthread_mutexattr_default, + __thr_calloc); else if (*mutex == THR_ADAPTIVE_MUTEX_INITIALIZER) ret = mutex_init(mutex, &_pthread_mutexattr_adaptive_default, - calloc); + __thr_calloc); else ret = 0; THR_LOCK_RELEASE(thread, &_mutex_static_lock); @@ -390,7 +391,7 @@ __pthread_mutex_init(pthread_mutex_t * __restrict mutex, if (mutex_attr == NULL || (*mutex_attr)->m_pshared == PTHREAD_PROCESS_PRIVATE) { return (mutex_init(mutex, mutex_attr ? *mutex_attr : NULL, - calloc)); + __thr_calloc)); } pmtx = __thr_pshared_offpage(__DECONST(void *, mutex), 1); if (pmtx == NULL) @@ -483,7 +484,7 @@ _pthread_mutex_destroy(pthread_mutex_t *mutex) } else { *mutex = THR_MUTEX_DESTROYED; mutex_assert_not_owned(_get_curthread(), m); - free(m); + __thr_free(m); ret = 0; } } diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h index b2816c03b44b..897784ad721e 100644 --- a/lib/libthr/thread/thr_private.h +++ b/lib/libthr/thread/thr_private.h @@ -1003,6 +1003,14 @@ void __thr_pshared_destroy(void *key) __hidden; void __thr_pshared_atfork_pre(void) __hidden; void __thr_pshared_atfork_post(void) __hidden; +void *__thr_calloc(size_t num, size_t size); +void __thr_free(void *cp); +void *__thr_malloc(size_t nbytes); +void *__thr_realloc(void *cp, size_t nbytes); +void __thr_malloc_init(void); +void __thr_malloc_prefork(struct pthread *curthread); +void __thr_malloc_postfork(struct pthread *curthread); + __END_DECLS __NULLABILITY_PRAGMA_POP diff --git a/lib/libthr/thread/thr_spec.c b/lib/libthr/thread/thr_spec.c index faa88e2fc8ba..d4da21d096a9 100644 --- a/lib/libthr/thread/thr_spec.c +++ b/lib/libthr/thread/thr_spec.c @@ -155,8 +155,7 @@ _thread_cleanupspecific(void) } } THR_LOCK_RELEASE(curthread, &_keytable_lock); - munmap(curthread->specific, PTHREAD_KEYS_MAX * sizeof(struct - pthread_specific_elem)); + __thr_free(curthread->specific); curthread->specific = NULL; if (curthread->specific_data_count > 0) { stderr_debug("Thread %p has exited with leftover " @@ -179,10 +178,9 @@ _pthread_setspecific(pthread_key_t userkey, const void *value) pthread = _get_curthread(); if (pthread->specific == NULL) { - tmp = mmap(NULL, PTHREAD_KEYS_MAX * - sizeof(struct pthread_specific_elem), - PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); - if (tmp == MAP_FAILED) + tmp = __thr_calloc(PTHREAD_KEYS_MAX, + sizeof(struct pthread_specific_elem)); + if (tmp == NULL) return (ENOMEM); pthread->specific = tmp; } From 9a52756044676370f20527b85d450d5fc3ac32e5 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Wed, 30 Jan 2019 02:07:13 +0000 Subject: [PATCH 141/142] i386: Merge PAE and non-PAE pmaps into same kernel. Effectively all i386 kernels now have two pmaps compiled in: one managing PAE pagetables, and another non-PAE. The implementation is selected at cold time depending on the CPU features. The vm_paddr_t is always 64bit now. As result, nx bit can be used on all capable CPUs. Option PAE only affects the bus_addr_t: it is still 32bit for non-PAE configs, for drivers compatibility. Kernel layout, esp. max kernel address, low memory PDEs and max user address (same as trampoline start) are now same for PAE and for non-PAE regardless of the type of page tables used. Non-PAE kernel (when using PAE pagetables) can handle physical memory up to 24G now, larger memory requires re-tuning the KVA consumers and instead the code caps the maximum at 24G. Unfortunately, a lot of drivers do not use busdma(9) properly so by default even 4G barrier is not easy. There are two tunables added: hw.above4g_allow and hw.above24g_allow, the first one is kept enabled for now to evaluate the status on HEAD, second is only for dev use. i386 now creates three freelists if there is any memory above 4G, to allow proper bounce pages allocation. Also, VM_KMEM_SIZE_SCALE changed from 3 to 1. The PAE_TABLES kernel config option is retired. In collaboarion with: pho Discussed with: emaste Reviewed by: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D18894 --- lib/libkvm/kvm_i386.h | 8 +- sys/conf/files.i386 | 6 +- sys/conf/options.i386 | 5 - sys/dev/dcons/dcons_os.c | 2 +- sys/dev/fb/fb.c | 2 +- sys/dev/fb/fbreg.h | 2 +- sys/dev/fb/vga.c | 2 +- sys/dev/fb/vgareg.h | 2 +- sys/dev/syscons/syscons.c | 2 +- sys/i386/acpica/acpi_machdep.c | 2 +- sys/i386/i386/bios.c | 24 +- sys/i386/i386/copyout.c | 31 +- sys/i386/i386/genassym.c | 17 +- sys/i386/i386/initcpu.c | 9 +- sys/i386/i386/locore.s | 9 - sys/i386/i386/machdep.c | 62 +- sys/i386/i386/mem.c | 1 - sys/i386/i386/minidump_machdep.c | 306 +------ sys/i386/i386/minidump_machdep_base.c | 360 ++++++++ sys/i386/i386/minidump_machdep_nopae.c | 40 + sys/i386/i386/minidump_machdep_pae.c | 41 + sys/i386/i386/mp_machdep.c | 8 +- sys/i386/i386/mpboot.s | 28 +- sys/i386/i386/pmap.c | 1099 ++++++++++++++---------- sys/i386/i386/pmap_base.c | 954 ++++++++++++++++++++ sys/i386/i386/pmap_nopae.c | 48 ++ sys/i386/i386/pmap_pae.c | 49 ++ sys/i386/i386/trap.c | 5 +- sys/i386/i386/vm86.c | 157 +++- sys/i386/i386/vm86bios.s | 14 +- sys/i386/i386/vm_machdep.c | 32 +- sys/i386/include/md_var.h | 2 + sys/i386/include/param.h | 32 +- sys/i386/include/pmap.h | 209 ++--- sys/i386/include/pmap_base.h | 124 +++ sys/i386/include/pmap_nopae.h | 100 +++ sys/i386/include/pmap_pae.h | 123 +++ sys/i386/include/vm86.h | 2 +- sys/i386/include/vmparam.h | 51 +- sys/i386/pci/pci_cfgreg.c | 4 +- sys/x86/acpica/acpi_wakeup.c | 12 +- sys/x86/include/_types.h | 4 - sys/x86/include/x86_var.h | 15 +- sys/x86/x86/identcpu.c | 18 + 44 files changed, 2815 insertions(+), 1208 deletions(-) create mode 100644 sys/i386/i386/minidump_machdep_base.c create mode 100644 sys/i386/i386/minidump_machdep_nopae.c create mode 100644 sys/i386/i386/minidump_machdep_pae.c create mode 100644 sys/i386/i386/pmap_base.c create mode 100644 sys/i386/i386/pmap_nopae.c create mode 100644 sys/i386/i386/pmap_pae.c create mode 100644 sys/i386/include/pmap_base.h create mode 100644 sys/i386/include/pmap_nopae.h create mode 100644 sys/i386/include/pmap_pae.h diff --git a/lib/libkvm/kvm_i386.h b/lib/libkvm/kvm_i386.h index 5440db2adc69..1a4d672f16f3 100644 --- a/lib/libkvm/kvm_i386.h +++ b/lib/libkvm/kvm_i386.h @@ -67,14 +67,16 @@ typedef uint64_t i386_pde_pae_t; _Static_assert(PAGE_SHIFT == I386_PAGE_SHIFT, "PAGE_SHIFT mismatch"); _Static_assert(PAGE_SIZE == I386_PAGE_SIZE, "PAGE_SIZE mismatch"); _Static_assert(PAGE_MASK == I386_PAGE_MASK, "PAGE_MASK mismatch"); +#if 0 _Static_assert(NPTEPG == I386_NPTEPG, "NPTEPG mismatch"); -_Static_assert(PDRSHIFT == I386_PDRSHIFT, "PDRSHIFT mismatch"); _Static_assert(NBPDR == I386_NBPDR, "NBPDR mismatch"); +#endif +_Static_assert(PDRSHIFT_NOPAE == I386_PDRSHIFT, "PDRSHIFT mismatch"); _Static_assert(PG_V == I386_PG_V, "PG_V mismatch"); _Static_assert(PG_PS == I386_PG_PS, "PG_PS mismatch"); -_Static_assert((u_int)PG_FRAME == I386_PG_FRAME, "PG_FRAME mismatch"); -_Static_assert(PG_PS_FRAME == I386_PG_PS_FRAME, "PG_PS_FRAME mismatch"); +_Static_assert((u_int)PG_FRAME_NOPAE == I386_PG_FRAME, "PG_FRAME mismatch"); +_Static_assert(PG_PS_FRAME_NOPAE == I386_PG_PS_FRAME, "PG_PS_FRAME mismatch"); #endif int _i386_native(kvm_t *); diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index c7531cc9c1e0..a1fb52d39146 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -492,12 +492,16 @@ i386/i386/longrun.c optional cpu_enable_longrun i386/i386/machdep.c standard i386/i386/mem.c optional mem i386/i386/minidump_machdep.c standard +i386/i386/minidump_machdep_pae.c standard +i386/i386/minidump_machdep_nopae.c standard i386/i386/mp_clock.c optional smp i386/i386/mp_machdep.c optional smp i386/i386/mpboot.s optional smp i386/i386/npx.c standard i386/i386/perfmon.c optional perfmon -i386/i386/pmap.c standard +i386/i386/pmap_base.c standard +i386/i386/pmap_nopae.c standard +i386/i386/pmap_pae.c standard i386/i386/prof_machdep.c optional profiling-routine i386/i386/ptrace_machdep.c standard i386/i386/sigtramp.s standard diff --git a/sys/conf/options.i386 b/sys/conf/options.i386 index 8c96ff40c558..73957449413f 100644 --- a/sys/conf/options.i386 +++ b/sys/conf/options.i386 @@ -33,11 +33,6 @@ KVA_PAGES opt_global.h # Physical address extensions and support for >4G ram. As above. PAE opt_global.h -# Use PAE page tables, but limit memory support to 4GB. -# This keeps the i386 non-PAE KBI, in particular, drivers see -# 32bit vm_paddr_t. -PAE_TABLES opt_global.h - TIMER_FREQ opt_clock.h CPU_ATHLON_SSE_HACK opt_cpu.h diff --git a/sys/dev/dcons/dcons_os.c b/sys/dev/dcons/dcons_os.c index 9ec789fcc224..3ccdfeade53b 100644 --- a/sys/dev/dcons/dcons_os.c +++ b/sys/dev/dcons/dcons_os.c @@ -309,7 +309,7 @@ dcons_drv_init(int stage) * Allow read/write access to dcons buffer. */ for (pa = trunc_page(addr); pa < addr + size; pa += PAGE_SIZE) - *vtopte(PMAP_MAP_LOW + pa) |= PG_RW; + pmap_ksetrw(PMAP_MAP_LOW + pa); invltlb(); #endif /* XXX P to V */ diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index 2f821c8b65f1..98b197adde66 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -513,7 +513,7 @@ int genfbioctl(genfb_softc_t *sc, video_adapter_t *adp, u_long cmd, } int genfbmmap(genfb_softc_t *sc, video_adapter_t *adp, vm_ooffset_t offset, - vm_offset_t *paddr, int prot, vm_memattr_t *memattr) + vm_paddr_t *paddr, int prot, vm_memattr_t *memattr) { return vidd_mmap(adp, offset, paddr, prot, memattr); } diff --git a/sys/dev/fb/fbreg.h b/sys/dev/fb/fbreg.h index 5e8f2cd105f3..d5bfd0daa0cd 100644 --- a/sys/dev/fb/fbreg.h +++ b/sys/dev/fb/fbreg.h @@ -327,7 +327,7 @@ int genfbwrite(genfb_softc_t *sc, video_adapter_t *adp, int genfbioctl(genfb_softc_t *sc, video_adapter_t *adp, u_long cmd, caddr_t arg, int flag, struct thread *td); int genfbmmap(genfb_softc_t *sc, video_adapter_t *adp, - vm_ooffset_t offset, vm_offset_t *paddr, + vm_ooffset_t offset, vm_paddr_t *paddr, int prot, vm_memattr_t *memattr); #endif /* FB_INSTALL_CDEV */ diff --git a/sys/dev/fb/vga.c b/sys/dev/fb/vga.c index 572c2b9d2844..88ce75b922e1 100644 --- a/sys/dev/fb/vga.c +++ b/sys/dev/fb/vga.c @@ -147,7 +147,7 @@ vga_ioctl(struct cdev *dev, vga_softc_t *sc, u_long cmd, caddr_t arg, int flag, int vga_mmap(struct cdev *dev, vga_softc_t *sc, vm_ooffset_t offset, - vm_offset_t *paddr, int prot, vm_memattr_t *memattr) + vm_paddr_t *paddr, int prot, vm_memattr_t *memattr) { return genfbmmap(&sc->gensc, sc->adp, offset, paddr, prot, memattr); } diff --git a/sys/dev/fb/vgareg.h b/sys/dev/fb/vgareg.h index 229231d1f843..b2c148a4dd3b 100644 --- a/sys/dev/fb/vgareg.h +++ b/sys/dev/fb/vgareg.h @@ -91,7 +91,7 @@ int vga_write(struct cdev *dev, vga_softc_t *sc, struct uio *uio, int flag); int vga_ioctl(struct cdev *dev, vga_softc_t *sc, u_long cmd, caddr_t arg, int flag, struct thread *td); int vga_mmap(struct cdev *dev, vga_softc_t *sc, vm_ooffset_t offset, - vm_offset_t *paddr, int prot, vm_memattr_t *memattr); + vm_paddr_t *paddr, int prot, vm_memattr_t *memattr); #endif extern int (*vga_sub_configure)(int flags); diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 0785bd52c53b..278c3c82b67a 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -291,7 +291,7 @@ ec_putc(int c) #ifdef __amd64__ fb = KERNBASE + 0xb8000; #else /* __i386__ */ - fb = PMAP_MAP_LOW + 0xb8000; + fb = pmap_get_map_low() + 0xb8000; #endif xsize = 80; ysize = 25; diff --git a/sys/i386/acpica/acpi_machdep.c b/sys/i386/acpica/acpi_machdep.c index b0c4680f15a5..cca0a15c67b6 100644 --- a/sys/i386/acpica/acpi_machdep.c +++ b/sys/i386/acpica/acpi_machdep.c @@ -134,7 +134,7 @@ table_map(vm_paddr_t pa, int offset, vm_offset_t length) off = pa & PAGE_MASK; length = round_page(length + off); - pa = pa & PG_FRAME; + pa = pmap_pg_frame(pa); va = (vm_offset_t)pmap_kenter_temporary(pa, offset) + (offset * PAGE_SIZE); data = (void *)(va + off); diff --git a/sys/i386/i386/bios.c b/sys/i386/i386/bios.c index fdd79ddd94c1..6cdaaf71f261 100644 --- a/sys/i386/i386/bios.c +++ b/sys/i386/i386/bios.c @@ -329,9 +329,7 @@ bios16(struct bios_args *args, char *fmt, ...) va_list ap; int flags = BIOSCODE_FLAG | BIOSDATA_FLAG; u_int i, arg_start, arg_end; - pt_entry_t *pte; - pd_entry_t *ptd, orig_ptd; - + void *bios16_pmap_handle; arg_start = 0xffffffff; arg_end = 0; @@ -388,18 +386,10 @@ bios16(struct bios_args *args, char *fmt, ...) args->seg.args.limit = 0xffff; } - args->seg.code32.base = (u_int)&bios16_jmp & PG_FRAME; + args->seg.code32.base = pmap_pg_frame((u_int)&bios16_jmp); args->seg.code32.limit = 0xffff; - /* - * no page table, so create one and install it. - */ - pte = (pt_entry_t *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK); - ptd = IdlePTD; - *pte = vm86phystk | PG_RW | PG_V; - orig_ptd = *ptd; - *ptd = vtophys(pte) | PG_RW | PG_V; - pmap_invalidate_all(kernel_pmap); /* XXX insurance for now */ + bios16_pmap_handle = pmap_bios16_enter(); stack_top = stack; va_start(ap, fmt); @@ -451,13 +441,7 @@ bios16(struct bios_args *args, char *fmt, ...) bioscall_vector.vec16.segment = GSEL(GBIOSCODE16_SEL, SEL_KPL); i = bios16_call(&args->r, stack_top); - - *ptd = orig_ptd; /* remove page table */ - /* - * XXX only needs to be invlpg(0) but that doesn't work on the 386 - */ - pmap_invalidate_all(kernel_pmap); - free(pte, M_TEMP); /* ... and free it */ + pmap_bios16_leave(bios16_pmap_handle); return (i); } diff --git a/sys/i386/i386/copyout.c b/sys/i386/i386/copyout.c index a051e8c25a8f..84615cd8670b 100644 --- a/sys/i386/i386/copyout.c +++ b/sys/i386/i386/copyout.c @@ -47,12 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(PAE) || defined(PAE_TABLES) -#define KCR3 ((u_int)IdlePDPT) -#else -#define KCR3 ((u_int)IdlePTD) -#endif - int copyin_fast(const void *udaddr, void *kaddr, size_t len, u_int); static int (*copyin_fast_tramp)(const void *, void *, size_t, u_int); int copyout_fast(const void *kaddr, void *udaddr, size_t len, u_int); @@ -103,7 +97,6 @@ cp_slow0(vm_offset_t uva, size_t len, bool write, { struct pcpu *pc; vm_page_t m[2]; - pt_entry_t *pte; vm_offset_t kaddr; int error, i, plen; bool sleepable; @@ -128,12 +121,7 @@ cp_slow0(vm_offset_t uva, size_t len, bool write, sx_xlock(&pc->pc_copyout_slock); kaddr = pc->pc_copyout_saddr; } - for (i = 0, pte = vtopte(kaddr); i < plen; i++, pte++) { - *pte = PG_V | PG_RW | PG_A | PG_M | VM_PAGE_TO_PHYS(m[i]) | - pmap_cache_bits(kernel_pmap, pmap_page_get_memattr(m[i]), - FALSE); - invlpg(kaddr + ptoa(i)); - } + pmap_cp_slow0_map(kaddr, plen, m); kaddr += uva - trunc_page(uva); f(kaddr, arg); sched_unpin(); @@ -225,7 +213,7 @@ copyin(const void *udaddr, void *kaddr, size_t len) (uintptr_t)udaddr + len > VM_MAXUSER_ADDRESS) return (EFAULT); if (len == 0 || (fast_copyout && len <= TRAMP_COPYOUT_SZ && - copyin_fast_tramp(udaddr, kaddr, len, KCR3) == 0)) + copyin_fast_tramp(udaddr, kaddr, len, pmap_get_kcr3()) == 0)) return (0); for (plen = 0, uc = (vm_offset_t)udaddr, ca.kc = (vm_offset_t)kaddr; plen < len; uc += ca.len, ca.kc += ca.len, plen += ca.len) { @@ -260,7 +248,7 @@ copyout(const void *kaddr, void *udaddr, size_t len) (uintptr_t)udaddr + len > VM_MAXUSER_ADDRESS) return (EFAULT); if (len == 0 || (fast_copyout && len <= TRAMP_COPYOUT_SZ && - copyout_fast_tramp(kaddr, udaddr, len, KCR3) == 0)) + copyout_fast_tramp(kaddr, udaddr, len, pmap_get_kcr3()) == 0)) return (0); for (plen = 0, uc = (vm_offset_t)udaddr, ca.kc = (vm_offset_t)kaddr; plen < len; uc += ca.len, ca.kc += ca.len, plen += ca.len) { @@ -296,7 +284,7 @@ fubyte(volatile const void *base) (uintptr_t)base + sizeof(uint8_t) > VM_MAXUSER_ADDRESS) return (-1); if (fast_copyout) { - res = fubyte_fast_tramp(base, KCR3); + res = fubyte_fast_tramp(base, pmap_get_kcr3()); if (res != -1) return (res); } @@ -322,7 +310,7 @@ fuword16(volatile const void *base) (uintptr_t)base + sizeof(uint16_t) > VM_MAXUSER_ADDRESS) return (-1); if (fast_copyout) { - res = fuword16_fast_tramp(base, KCR3); + res = fuword16_fast_tramp(base, pmap_get_kcr3()); if (res != -1) return (res); } @@ -348,7 +336,7 @@ fueword(volatile const void *base, long *val) (uintptr_t)base + sizeof(*val) > VM_MAXUSER_ADDRESS) return (-1); if (fast_copyout) { - if (fueword_fast_tramp(base, val, KCR3) == 0) + if (fueword_fast_tramp(base, val, pmap_get_kcr3()) == 0) return (0); } if (cp_slow0((vm_offset_t)base, sizeof(long), false, fueword_slow0, @@ -383,7 +371,7 @@ subyte(volatile void *base, int byte) if ((uintptr_t)base + sizeof(uint8_t) < (uintptr_t)base || (uintptr_t)base + sizeof(uint8_t) > VM_MAXUSER_ADDRESS) return (-1); - if (fast_copyout && subyte_fast_tramp(base, byte, KCR3) == 0) + if (fast_copyout && subyte_fast_tramp(base, byte, pmap_get_kcr3()) == 0) return (0); return (cp_slow0((vm_offset_t)base, sizeof(u_char), true, subyte_slow0, &byte) != 0 ? -1 : 0); @@ -403,7 +391,8 @@ suword16(volatile void *base, int word) if ((uintptr_t)base + sizeof(uint16_t) < (uintptr_t)base || (uintptr_t)base + sizeof(uint16_t) > VM_MAXUSER_ADDRESS) return (-1); - if (fast_copyout && suword16_fast_tramp(base, word, KCR3) == 0) + if (fast_copyout && suword16_fast_tramp(base, word, pmap_get_kcr3()) + == 0) return (0); return (cp_slow0((vm_offset_t)base, sizeof(int16_t), true, suword16_slow0, &word) != 0 ? -1 : 0); @@ -423,7 +412,7 @@ suword(volatile void *base, long word) if ((uintptr_t)base + sizeof(word) < (uintptr_t)base || (uintptr_t)base + sizeof(word) > VM_MAXUSER_ADDRESS) return (-1); - if (fast_copyout && suword_fast_tramp(base, word, KCR3) == 0) + if (fast_copyout && suword_fast_tramp(base, word, pmap_get_kcr3()) == 0) return (0); return (cp_slow0((vm_offset_t)base, sizeof(long), true, suword_slow0, &word) != 0 ? -1 : 0); diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c index 3c3af0e81b50..15408d66717b 100644 --- a/sys/i386/i386/genassym.c +++ b/sys/i386/i386/genassym.c @@ -101,21 +101,8 @@ ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); ASSYM(TD0_KSTACK_PAGES, TD0_KSTACK_PAGES); ASSYM(PAGE_SIZE, PAGE_SIZE); -ASSYM(NPTEPG, NPTEPG); -ASSYM(NPDEPG, NPDEPG); -ASSYM(NPDEPTD, NPDEPTD); -ASSYM(NPGPTD, NPGPTD); -ASSYM(PDESIZE, sizeof(pd_entry_t)); -ASSYM(PTESIZE, sizeof(pt_entry_t)); -ASSYM(PDESHIFT, PDESHIFT); -ASSYM(PTESHIFT, PTESHIFT); ASSYM(PAGE_SHIFT, PAGE_SHIFT); ASSYM(PAGE_MASK, PAGE_MASK); -ASSYM(PDRSHIFT, PDRSHIFT); -ASSYM(PDRMASK, PDRMASK); -ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS); -ASSYM(KERNBASE, KERNBASE); -ASSYM(KERNLOAD, KERNLOAD); ASSYM(PCB_CR0, offsetof(struct pcb, pcb_cr0)); ASSYM(PCB_CR2, offsetof(struct pcb, pcb_cr2)); ASSYM(PCB_CR3, offsetof(struct pcb, pcb_cr3)); @@ -222,6 +209,9 @@ ASSYM(PC_KESP0, offsetof(struct pcpu, pc_kesp0)); ASSYM(PC_TRAMPSTK, offsetof(struct pcpu, pc_trampstk)); ASSYM(PC_COPYOUT_BUF, offsetof(struct pcpu, pc_copyout_buf)); ASSYM(PC_IBPB_SET, offsetof(struct pcpu, pc_ibpb_set)); +ASSYM(PMAP_TRM_MIN_ADDRESS, PMAP_TRM_MIN_ADDRESS); +ASSYM(KERNLOAD, KERNLOAD); +ASSYM(KERNBASE, KERNBASE); #ifdef DEV_APIC ASSYM(LA_EOI, LAPIC_EOI * LAPIC_MEM_MUL); @@ -237,7 +227,6 @@ ASSYM(GPROC0_SEL, GPROC0_SEL); ASSYM(VM86_FRAMESIZE, sizeof(struct vm86frame)); ASSYM(VM86_STACK_SPACE, VM86_STACK_SPACE); -ASSYM(PMAP_TRM_MIN_ADDRESS, PMAP_TRM_MIN_ADDRESS); ASSYM(TRAMP_COPYOUT_SZ, TRAMP_COPYOUT_SZ); #ifdef HWPMC_HOOKS diff --git a/sys/i386/i386/initcpu.c b/sys/i386/i386/initcpu.c index f85df4cd6824..24dd01a6537a 100644 --- a/sys/i386/i386/initcpu.c +++ b/sys/i386/i386/initcpu.c @@ -632,6 +632,7 @@ extern int elf32_nxstack; void initializecpu(void) { + uint64_t msr; switch (cpu) { #ifdef I486_CPU @@ -744,16 +745,10 @@ initializecpu(void) load_cr4(rcr4() | CR4_FXSR | CR4_XMM); cpu_fxsr = hw_instruction_sse = 1; } -#if defined(PAE) || defined(PAE_TABLES) - if ((amd_feature & AMDID_NX) != 0) { - uint64_t msr; - + if (elf32_nxstack) { msr = rdmsr(MSR_EFER) | EFER_NXE; wrmsr(MSR_EFER, msr); - pg_nx = PG_NX; - elf32_nxstack = 1; } -#endif } void diff --git a/sys/i386/i386/locore.s b/sys/i386/i386/locore.s index 454f7f0a1010..2bc751ba8ffc 100644 --- a/sys/i386/i386/locore.s +++ b/sys/i386/i386/locore.s @@ -53,15 +53,6 @@ #include "assym.inc" -/* - * PTmap is recursive pagemap at top of virtual address space. - * Within PTmap, the page directory can be found (third indirection). - */ - .globl PTmap,PTD,PTDpde - .set PTmap,(PTDPTDI << PDRSHIFT) - .set PTD,PTmap + (PTDPTDI * PAGE_SIZE) - .set PTDpde,PTD + (PTDPTDI * PDESIZE) - /* * Compiled KERNBASE location and the kernel load address, now identical. */ diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 95d3ae4a3452..d7324f977e4b 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -175,6 +175,8 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL); int _udatasel, _ucodesel; u_int basemem; +static int above4g_allow = 1; +static int above24g_allow = 0; int cold = 1; @@ -1675,6 +1677,7 @@ static int add_physmap_entry(uint64_t base, uint64_t length, vm_paddr_t *physmap, int *physmap_idxp) { + uint64_t lim, ign; int i, insert_idx, physmap_idx; physmap_idx = *physmap_idxp; @@ -1682,13 +1685,24 @@ add_physmap_entry(uint64_t base, uint64_t length, vm_paddr_t *physmap, if (length == 0) return (1); -#ifndef PAE - if (base > 0xffffffff) { - printf("%uK of memory above 4GB ignored\n", - (u_int)(length / 1024)); + lim = 0x100000000; /* 4G */ + if (pae_mode && above4g_allow) + lim = above24g_allow ? -1ULL : 0x600000000; /* 24G */ + if (base >= lim) { + printf("%uK of memory above %uGB ignored, pae %d " + "above4g_allow %d above24g_allow %d\n", + (u_int)(length / 1024), (u_int)(lim >> 30), pae_mode, + above4g_allow, above24g_allow); return (1); } -#endif + if (base + length >= lim) { + ign = base + length - lim; + length -= ign; + printf("%uK of memory above %uGB ignored, pae %d " + "above4g_allow %d above24g_allow %d\n", + (u_int)(ign / 1024), (u_int)(lim >> 30), pae_mode, + above4g_allow, above24g_allow); + } /* * Find insertion point while checking for overlap. Start off by @@ -1781,8 +1795,6 @@ add_smap_entries(struct bios_smap *smapbase, vm_paddr_t *physmap, static void basemem_setup(void) { - pt_entry_t *pte; - int i; if (basemem > 640) { printf("Preposterous BIOS basemem of %uK, truncating to 640K\n", @@ -1790,15 +1802,7 @@ basemem_setup(void) basemem = 640; } - /* - * Map pages between basemem and ISA_HOLE_START, if any, r/w into - * the vm86 page table so that vm86 can scribble on them using - * the vm86 map too. XXX: why 2 ways for this and only 1 way for - * page 0, at least as initialized here? - */ - pte = (pt_entry_t *)vm86paddr; - for (i = basemem / 4; i < 160; i++) - pte[i] = (i << PAGE_SHIFT) | PG_V | PG_RW | PG_U; + pmap_basemem_setup(basemem); } /* @@ -1820,7 +1824,6 @@ getmemsize(int first) int has_smap, off, physmap_idx, pa_indx, da_indx; u_long memtest; vm_paddr_t physmap[PHYSMAP_SIZE]; - pt_entry_t *pte; quad_t dcons_addr, dcons_size, physmem_tunable; int hasbrokenint12, i, res; u_int extmem; @@ -1841,6 +1844,9 @@ getmemsize(int first) */ vm_phys_add_seg((vm_paddr_t)KERNLOAD, trunc_page(first)); + TUNABLE_INT_FETCH("hw.above4g_allow", &above4g_allow); + TUNABLE_INT_FETCH("hw.above24g_allow", &above24g_allow); + /* * Check if the loader supplied an SMAP memory map. If so, * use that and do not make any VM86 calls. @@ -2031,7 +2037,6 @@ getmemsize(int first) phys_avail[pa_indx++] = physmap[0]; phys_avail[pa_indx] = physmap[0]; dump_avail[da_indx] = physmap[0]; - pte = CMAP3; /* * Get dcons buffer address @@ -2052,7 +2057,7 @@ getmemsize(int first) end = trunc_page(physmap[i + 1]); for (pa = round_page(physmap[i]); pa < end; pa += PAGE_SIZE) { int tmp, page_bad, full; - int *ptr = (int *)CADDR3; + int *ptr; full = FALSE; /* @@ -2076,8 +2081,7 @@ getmemsize(int first) /* * map page into kernel: valid, read/write,non-cacheable */ - *pte = pa | PG_V | PG_RW | PG_N; - invltlb(); + ptr = (int *)pmap_cmap3(pa, PG_V | PG_RW | PG_N); tmp = *(int *)ptr; /* @@ -2158,8 +2162,7 @@ getmemsize(int first) break; } } - *pte = 0; - invltlb(); + pmap_cmap3(0, 0); /* * XXX @@ -2414,6 +2417,7 @@ init386(int first) finishidentcpu(); /* Final stage of CPU initialization */ i386_setidt2(); + pmap_set_nx(); initializecpu(); /* Initialize CPU registers */ initializecpucache(); @@ -2508,11 +2512,7 @@ init386(int first) /* setup proc 0's pcb */ thread0.td_pcb->pcb_flags = 0; -#if defined(PAE) || defined(PAE_TABLES) - thread0.td_pcb->pcb_cr3 = (int)IdlePDPT; -#else - thread0.td_pcb->pcb_cr3 = (int)IdlePTD; -#endif + thread0.td_pcb->pcb_cr3 = pmap_get_kcr3(); thread0.td_pcb->pcb_ext = 0; thread0.td_frame = &proc0_tf; @@ -2581,11 +2581,7 @@ machdep_init_trampoline(void) (int)dblfault_stack + PAGE_SIZE; dblfault_tss->tss_ss = dblfault_tss->tss_ss0 = dblfault_tss->tss_ss1 = dblfault_tss->tss_ss2 = GSEL(GDATA_SEL, SEL_KPL); -#if defined(PAE) || defined(PAE_TABLES) - dblfault_tss->tss_cr3 = (int)IdlePDPT; -#else - dblfault_tss->tss_cr3 = (int)IdlePTD; -#endif + dblfault_tss->tss_cr3 = pmap_get_kcr3(); dblfault_tss->tss_eip = (int)dblfault_handler; dblfault_tss->tss_eflags = PSL_KERNEL; dblfault_tss->tss_ds = dblfault_tss->tss_es = diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index e72b4e1360d5..c17a9f774aa7 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -148,7 +148,6 @@ memrw(struct cdev *dev, struct uio *uio, int flags) error = uiomove((caddr_t)&ptvmmap[o], (int)c, uio); pmap_qremove((vm_offset_t)ptvmmap, 1); sx_xunlock(&memsxlock); - } return (error); diff --git a/sys/i386/i386/minidump_machdep.c b/sys/i386/i386/minidump_machdep.c index b6fe9a405843..47e6a14d4d3d 100644 --- a/sys/i386/i386/minidump_machdep.c +++ b/sys/i386/i386/minidump_machdep.c @@ -49,310 +49,11 @@ __FBSDID("$FreeBSD$"); CTASSERT(sizeof(struct kerneldumpheader) == 512); -#define MD_ALIGN(x) (((off_t)(x) + PAGE_MASK) & ~PAGE_MASK) -#define DEV_ALIGN(x) roundup2((off_t)(x), DEV_BSIZE) - uint32_t *vm_page_dump; int vm_page_dump_size; -static struct kerneldumpheader kdh; - -/* Handle chunked writes. */ -static size_t fragsz; -static void *dump_va; -static uint64_t counter, progress; - CTASSERT(sizeof(*vm_page_dump) == 4); - -static int -is_dumpable(vm_paddr_t pa) -{ - int i; - - for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { - if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) - return (1); - } - return (0); -} - -#define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8) - -static int -blk_flush(struct dumperinfo *di) -{ - int error; - - if (fragsz == 0) - return (0); - - error = dump_append(di, dump_va, 0, fragsz); - fragsz = 0; - return (error); -} - -static int -blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz) -{ - size_t len; - int error, i, c; - u_int maxdumpsz; - - maxdumpsz = min(di->maxiosize, MAXDUMPPGS * PAGE_SIZE); - if (maxdumpsz == 0) /* seatbelt */ - maxdumpsz = PAGE_SIZE; - error = 0; - if ((sz % PAGE_SIZE) != 0) { - printf("size not page aligned\n"); - return (EINVAL); - } - if (ptr != NULL && pa != 0) { - printf("cant have both va and pa!\n"); - return (EINVAL); - } - if (pa != 0 && (((uintptr_t)ptr) % PAGE_SIZE) != 0) { - printf("address not page aligned\n"); - return (EINVAL); - } - if (ptr != NULL) { - /* If we're doing a virtual dump, flush any pre-existing pa pages */ - error = blk_flush(di); - if (error) - return (error); - } - while (sz) { - len = maxdumpsz - fragsz; - if (len > sz) - len = sz; - counter += len; - progress -= len; - if (counter >> 24) { - printf(" %lld", PG2MB(progress >> PAGE_SHIFT)); - counter &= (1<<24) - 1; - } - - wdog_kern_pat(WD_LASTVAL); - - if (ptr) { - error = dump_append(di, ptr, 0, len); - if (error) - return (error); - ptr += len; - sz -= len; - } else { - for (i = 0; i < len; i += PAGE_SIZE) - dump_va = pmap_kenter_temporary(pa + i, (i + fragsz) >> PAGE_SHIFT); - fragsz += len; - pa += len; - sz -= len; - if (fragsz == maxdumpsz) { - error = blk_flush(di); - if (error) - return (error); - } - } - - /* Check for user abort. */ - c = cncheckc(); - if (c == 0x03) - return (ECANCELED); - if (c != -1) - printf(" (CTRL-C to abort) "); - } - - return (0); -} - -/* A fake page table page, to avoid having to handle both 4K and 2M pages */ -static pt_entry_t fakept[NPTEPG]; - -int -minidumpsys(struct dumperinfo *di) -{ - uint64_t dumpsize; - uint32_t ptesize; - vm_offset_t va; - int error; - uint32_t bits; - uint64_t pa; - pd_entry_t *pd; - pt_entry_t *pt; - int i, j, k, bit; - struct minidumphdr mdhdr; - - counter = 0; - /* Walk page table pages, set bits in vm_page_dump */ - ptesize = 0; - for (va = KERNBASE; va < kernel_vm_end; va += NBPDR) { - /* - * We always write a page, even if it is zero. Each - * page written corresponds to 2MB of space - */ - ptesize += PAGE_SIZE; - pd = IdlePTD; /* always mapped! */ - j = va >> PDRSHIFT; - if ((pd[j] & (PG_PS | PG_V)) == (PG_PS | PG_V)) { - /* This is an entire 2M page. */ - pa = pd[j] & PG_PS_FRAME; - for (k = 0; k < NPTEPG; k++) { - if (is_dumpable(pa)) - dump_add_page(pa); - pa += PAGE_SIZE; - } - continue; - } - if ((pd[j] & PG_V) == PG_V) { - /* set bit for each valid page in this 2MB block */ - pt = pmap_kenter_temporary(pd[j] & PG_FRAME, 0); - for (k = 0; k < NPTEPG; k++) { - if ((pt[k] & PG_V) == PG_V) { - pa = pt[k] & PG_FRAME; - if (is_dumpable(pa)) - dump_add_page(pa); - } - } - } else { - /* nothing, we're going to dump a null page */ - } - } - - /* Calculate dump size. */ - dumpsize = ptesize; - dumpsize += round_page(msgbufp->msg_size); - dumpsize += round_page(vm_page_dump_size); - for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) { - bits = vm_page_dump[i]; - while (bits) { - bit = bsfl(bits); - pa = (((uint64_t)i * sizeof(*vm_page_dump) * NBBY) + bit) * PAGE_SIZE; - /* Clear out undumpable pages now if needed */ - if (is_dumpable(pa)) { - dumpsize += PAGE_SIZE; - } else { - dump_drop_page(pa); - } - bits &= ~(1ul << bit); - } - } - dumpsize += PAGE_SIZE; - - progress = dumpsize; - - /* Initialize mdhdr */ - bzero(&mdhdr, sizeof(mdhdr)); - strcpy(mdhdr.magic, MINIDUMP_MAGIC); - mdhdr.version = MINIDUMP_VERSION; - mdhdr.msgbufsize = msgbufp->msg_size; - mdhdr.bitmapsize = vm_page_dump_size; - mdhdr.ptesize = ptesize; - mdhdr.kernbase = KERNBASE; -#if defined(PAE) || defined(PAE_TABLES) - mdhdr.paemode = 1; -#endif - - dump_init_header(di, &kdh, KERNELDUMPMAGIC, KERNELDUMP_I386_VERSION, - dumpsize); - - error = dump_start(di, &kdh); - if (error != 0) - goto fail; - - printf("Physical memory: %ju MB\n", ptoa((uintmax_t)physmem) / 1048576); - printf("Dumping %llu MB:", (long long)dumpsize >> 20); - - /* Dump my header */ - bzero(&fakept, sizeof(fakept)); - bcopy(&mdhdr, &fakept, sizeof(mdhdr)); - error = blk_write(di, (char *)&fakept, 0, PAGE_SIZE); - if (error) - goto fail; - - /* Dump msgbuf up front */ - error = blk_write(di, (char *)msgbufp->msg_ptr, 0, round_page(msgbufp->msg_size)); - if (error) - goto fail; - - /* Dump bitmap */ - error = blk_write(di, (char *)vm_page_dump, 0, round_page(vm_page_dump_size)); - if (error) - goto fail; - - /* Dump kernel page table pages */ - for (va = KERNBASE; va < kernel_vm_end; va += NBPDR) { - /* We always write a page, even if it is zero */ - pd = IdlePTD; /* always mapped! */ - j = va >> PDRSHIFT; - if ((pd[j] & (PG_PS | PG_V)) == (PG_PS | PG_V)) { - /* This is a single 2M block. Generate a fake PTP */ - pa = pd[j] & PG_PS_FRAME; - for (k = 0; k < NPTEPG; k++) { - fakept[k] = (pa + (k * PAGE_SIZE)) | PG_V | PG_RW | PG_A | PG_M; - } - error = blk_write(di, (char *)&fakept, 0, PAGE_SIZE); - if (error) - goto fail; - /* flush, in case we reuse fakept in the same block */ - error = blk_flush(di); - if (error) - goto fail; - continue; - } - if ((pd[j] & PG_V) == PG_V) { - pa = pd[j] & PG_FRAME; - error = blk_write(di, 0, pa, PAGE_SIZE); - if (error) - goto fail; - } else { - bzero(fakept, sizeof(fakept)); - error = blk_write(di, (char *)&fakept, 0, PAGE_SIZE); - if (error) - goto fail; - /* flush, in case we reuse fakept in the same block */ - error = blk_flush(di); - if (error) - goto fail; - } - } - - /* Dump memory chunks */ - /* XXX cluster it up and use blk_dump() */ - for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) { - bits = vm_page_dump[i]; - while (bits) { - bit = bsfl(bits); - pa = (((uint64_t)i * sizeof(*vm_page_dump) * NBBY) + bit) * PAGE_SIZE; - error = blk_write(di, 0, pa, PAGE_SIZE); - if (error) - goto fail; - bits &= ~(1ul << bit); - } - } - - error = blk_flush(di); - if (error) - goto fail; - - error = dump_finish(di, &kdh); - if (error != 0) - goto fail; - - printf("\nDump complete\n"); - return (0); - - fail: - if (error < 0) - error = -error; - - if (error == ECANCELED) - printf("\nDump aborted\n"); - else if (error == E2BIG || error == ENOSPC) - printf("\nDump failed. Partition too small.\n"); - else - printf("\n** DUMP FAILED (ERROR %d) **\n", error); - return (error); -} - void dump_add_page(vm_paddr_t pa) { @@ -375,3 +76,10 @@ dump_drop_page(vm_paddr_t pa) atomic_clear_int(&vm_page_dump[idx], 1ul << bit); } +int +minidumpsys(struct dumperinfo *di) +{ + + return (pae_mode ? minidumpsys_pae(di) : minidumpsys_nopae(di)); +} + diff --git a/sys/i386/i386/minidump_machdep_base.c b/sys/i386/i386/minidump_machdep_base.c new file mode 100644 index 000000000000..c2a3852edc1e --- /dev/null +++ b/sys/i386/i386/minidump_machdep_base.c @@ -0,0 +1,360 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2006 Peter Wemm + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_watchdog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +CTASSERT(sizeof(struct kerneldumpheader) == 512); + +#define MD_ALIGN(x) (((off_t)(x) + PAGE_MASK) & ~PAGE_MASK) +#define DEV_ALIGN(x) roundup2((off_t)(x), DEV_BSIZE) + +extern uint32_t *vm_page_dump; +extern int vm_page_dump_size; + +static struct kerneldumpheader kdh; + +/* Handle chunked writes. */ +static size_t fragsz; +static void *dump_va; +static uint64_t counter, progress; + +CTASSERT(sizeof(*vm_page_dump) == 4); + + +static int +is_dumpable(vm_paddr_t pa) +{ + int i; + + for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { + if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) + return (1); + } + return (0); +} + +#define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8) + +static int +blk_flush(struct dumperinfo *di) +{ + int error; + + if (fragsz == 0) + return (0); + + error = dump_append(di, dump_va, 0, fragsz); + fragsz = 0; + return (error); +} + +static int +blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz) +{ + size_t len; + int error, i, c; + u_int maxdumpsz; + + maxdumpsz = min(di->maxiosize, MAXDUMPPGS * PAGE_SIZE); + if (maxdumpsz == 0) /* seatbelt */ + maxdumpsz = PAGE_SIZE; + error = 0; + if ((sz % PAGE_SIZE) != 0) { + printf("size not page aligned\n"); + return (EINVAL); + } + if (ptr != NULL && pa != 0) { + printf("cant have both va and pa!\n"); + return (EINVAL); + } + if (pa != 0 && (((uintptr_t)ptr) % PAGE_SIZE) != 0) { + printf("address not page aligned\n"); + return (EINVAL); + } + if (ptr != NULL) { + /* If we're doing a virtual dump, flush any pre-existing pa pages */ + error = blk_flush(di); + if (error) + return (error); + } + while (sz) { + len = maxdumpsz - fragsz; + if (len > sz) + len = sz; + counter += len; + progress -= len; + if (counter >> 24) { + printf(" %lld", PG2MB(progress >> PAGE_SHIFT)); + counter &= (1<<24) - 1; + } + + wdog_kern_pat(WD_LASTVAL); + + if (ptr) { + error = dump_append(di, ptr, 0, len); + if (error) + return (error); + ptr += len; + sz -= len; + } else { + for (i = 0; i < len; i += PAGE_SIZE) + dump_va = pmap_kenter_temporary(pa + i, (i + fragsz) >> PAGE_SHIFT); + fragsz += len; + pa += len; + sz -= len; + if (fragsz == maxdumpsz) { + error = blk_flush(di); + if (error) + return (error); + } + } + + /* Check for user abort. */ + c = cncheckc(); + if (c == 0x03) + return (ECANCELED); + if (c != -1) + printf(" (CTRL-C to abort) "); + } + + return (0); +} + +/* A fake page table page, to avoid having to handle both 4K and 2M pages */ +static pt_entry_t fakept[NPTEPG]; + +#ifdef PMAP_PAE_COMP +#define minidumpsys minidumpsys_pae +#define IdlePTD IdlePTD_pae +#else +#define minidumpsys minidumpsys_nopae +#define IdlePTD IdlePTD_nopae +#endif + +int +minidumpsys(struct dumperinfo *di) +{ + uint64_t dumpsize; + uint32_t ptesize; + vm_offset_t va; + int error; + uint32_t bits; + uint64_t pa; + pd_entry_t *pd; + pt_entry_t *pt; + int i, j, k, bit; + struct minidumphdr mdhdr; + + counter = 0; + /* Walk page table pages, set bits in vm_page_dump */ + ptesize = 0; + for (va = KERNBASE; va < kernel_vm_end; va += NBPDR) { + /* + * We always write a page, even if it is zero. Each + * page written corresponds to 2MB of space + */ + ptesize += PAGE_SIZE; + pd = IdlePTD; /* always mapped! */ + j = va >> PDRSHIFT; + if ((pd[j] & (PG_PS | PG_V)) == (PG_PS | PG_V)) { + /* This is an entire 2M page. */ + pa = pd[j] & PG_PS_FRAME; + for (k = 0; k < NPTEPG; k++) { + if (is_dumpable(pa)) + dump_add_page(pa); + pa += PAGE_SIZE; + } + continue; + } + if ((pd[j] & PG_V) == PG_V) { + /* set bit for each valid page in this 2MB block */ + pt = pmap_kenter_temporary(pd[j] & PG_FRAME, 0); + for (k = 0; k < NPTEPG; k++) { + if ((pt[k] & PG_V) == PG_V) { + pa = pt[k] & PG_FRAME; + if (is_dumpable(pa)) + dump_add_page(pa); + } + } + } else { + /* nothing, we're going to dump a null page */ + } + } + + /* Calculate dump size. */ + dumpsize = ptesize; + dumpsize += round_page(msgbufp->msg_size); + dumpsize += round_page(vm_page_dump_size); + for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) { + bits = vm_page_dump[i]; + while (bits) { + bit = bsfl(bits); + pa = (((uint64_t)i * sizeof(*vm_page_dump) * NBBY) + bit) * PAGE_SIZE; + /* Clear out undumpable pages now if needed */ + if (is_dumpable(pa)) { + dumpsize += PAGE_SIZE; + } else { + dump_drop_page(pa); + } + bits &= ~(1ul << bit); + } + } + dumpsize += PAGE_SIZE; + + progress = dumpsize; + + /* Initialize mdhdr */ + bzero(&mdhdr, sizeof(mdhdr)); + strcpy(mdhdr.magic, MINIDUMP_MAGIC); + mdhdr.version = MINIDUMP_VERSION; + mdhdr.msgbufsize = msgbufp->msg_size; + mdhdr.bitmapsize = vm_page_dump_size; + mdhdr.ptesize = ptesize; + mdhdr.kernbase = KERNBASE; + mdhdr.paemode = pae_mode; + + dump_init_header(di, &kdh, KERNELDUMPMAGIC, KERNELDUMP_I386_VERSION, + dumpsize); + + error = dump_start(di, &kdh); + if (error != 0) + goto fail; + + printf("Physical memory: %ju MB\n", ptoa((uintmax_t)physmem) / 1048576); + printf("Dumping %llu MB:", (long long)dumpsize >> 20); + + /* Dump my header */ + bzero(&fakept, sizeof(fakept)); + bcopy(&mdhdr, &fakept, sizeof(mdhdr)); + error = blk_write(di, (char *)&fakept, 0, PAGE_SIZE); + if (error) + goto fail; + + /* Dump msgbuf up front */ + error = blk_write(di, (char *)msgbufp->msg_ptr, 0, round_page(msgbufp->msg_size)); + if (error) + goto fail; + + /* Dump bitmap */ + error = blk_write(di, (char *)vm_page_dump, 0, round_page(vm_page_dump_size)); + if (error) + goto fail; + + /* Dump kernel page table pages */ + for (va = KERNBASE; va < kernel_vm_end; va += NBPDR) { + /* We always write a page, even if it is zero */ + pd = IdlePTD; /* always mapped! */ + j = va >> PDRSHIFT; + if ((pd[j] & (PG_PS | PG_V)) == (PG_PS | PG_V)) { + /* This is a single 2M block. Generate a fake PTP */ + pa = pd[j] & PG_PS_FRAME; + for (k = 0; k < NPTEPG; k++) { + fakept[k] = (pa + (k * PAGE_SIZE)) | PG_V | PG_RW | PG_A | PG_M; + } + error = blk_write(di, (char *)&fakept, 0, PAGE_SIZE); + if (error) + goto fail; + /* flush, in case we reuse fakept in the same block */ + error = blk_flush(di); + if (error) + goto fail; + continue; + } + if ((pd[j] & PG_V) == PG_V) { + pa = pd[j] & PG_FRAME; + error = blk_write(di, 0, pa, PAGE_SIZE); + if (error) + goto fail; + } else { + bzero(fakept, sizeof(fakept)); + error = blk_write(di, (char *)&fakept, 0, PAGE_SIZE); + if (error) + goto fail; + /* flush, in case we reuse fakept in the same block */ + error = blk_flush(di); + if (error) + goto fail; + } + } + + /* Dump memory chunks */ + /* XXX cluster it up and use blk_dump() */ + for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) { + bits = vm_page_dump[i]; + while (bits) { + bit = bsfl(bits); + pa = (((uint64_t)i * sizeof(*vm_page_dump) * NBBY) + bit) * PAGE_SIZE; + error = blk_write(di, 0, pa, PAGE_SIZE); + if (error) + goto fail; + bits &= ~(1ul << bit); + } + } + + error = blk_flush(di); + if (error) + goto fail; + + error = dump_finish(di, &kdh); + if (error != 0) + goto fail; + + printf("\nDump complete\n"); + return (0); + + fail: + if (error < 0) + error = -error; + + if (error == ECANCELED) + printf("\nDump aborted\n"); + else if (error == E2BIG || error == ENOSPC) + printf("\nDump failed. Partition too small.\n"); + else + printf("\n** DUMP FAILED (ERROR %d) **\n", error); + return (error); +} diff --git a/sys/i386/i386/minidump_machdep_nopae.c b/sys/i386/i386/minidump_machdep_nopae.c new file mode 100644 index 000000000000..52283881561f --- /dev/null +++ b/sys/i386/i386/minidump_machdep_nopae.c @@ -0,0 +1,40 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include "minidump_machdep_base.c" diff --git a/sys/i386/i386/minidump_machdep_pae.c b/sys/i386/i386/minidump_machdep_pae.c new file mode 100644 index 000000000000..bec842de5973 --- /dev/null +++ b/sys/i386/i386/minidump_machdep_pae.c @@ -0,0 +1,41 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#define PMAP_PAE_COMP +#include +#include +#include +#include +#include +#include "minidump_machdep_base.c" diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index 183f7f4be4eb..fa568de2cb31 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -309,9 +309,7 @@ start_all_aps(void) mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); - /* Remap lowest 1MB */ - IdlePTD[0] = IdlePTD[1]; - load_cr3(rcr3()); /* invalidate TLB */ + pmap_remap_lower(true); /* install the AP 1st level boot code */ install_ap_tramp(); @@ -359,9 +357,7 @@ start_all_aps(void) CPU_SET(cpu, &all_cpus); /* record AP in CPU map */ } - /* Unmap lowest 1MB again */ - IdlePTD[0] = 0; - load_cr3(rcr3()); + pmap_remap_lower(false); /* restore the warmstart vector */ *(u_int32_t *) WARMBOOT_OFF = mpbioswarmvec; diff --git a/sys/i386/i386/mpboot.s b/sys/i386/i386/mpboot.s index 29b49f14a804..f53399d74447 100644 --- a/sys/i386/i386/mpboot.s +++ b/sys/i386/i386/mpboot.s @@ -81,19 +81,17 @@ NON_GPROF_ENTRY(MPentry) testl $CPUID_PSE,%edx jz 1f orl $CR4_PSE,%eax /* Enable PSE */ -1: - testl $CPUID_PGE,%edx - jz 1f +1: testl $CPUID_PGE,%edx + jz 2f orl $CR4_PGE,%eax /* Enable PGE */ -1: - testl $CPUID_VME,%edx - jz 1f +2: testl $CPUID_VME,%edx + jz 3f orl $CR4_VME,%eax /* Enable VME */ -1: - movl %eax,%cr4 +3: movl %eax,%cr4 /* Now enable paging mode */ -#if defined(PAE) || defined(PAE_TABLES) + cmpl $0, pae_mode + je 4f movl IdlePDPT, %eax movl %eax, %cr3 movl %cr4, %eax @@ -103,21 +101,19 @@ NON_GPROF_ENTRY(MPentry) cpuid movl $0x80000001, %ebx cmpl %ebx, %eax - jb 1f + jb 5f movl %ebx, %eax cpuid testl $AMDID_NX, %edx - je 1f + je 5f movl $MSR_EFER, %ecx rdmsr orl $EFER_NXE,%eax wrmsr -1: -#else - movl IdlePTD, %eax + jmp 5f +4: movl IdlePTD_nopae, %eax movl %eax,%cr3 -#endif - movl %cr0,%eax +5: movl %cr0,%eax orl $CR0_PE|CR0_PG,%eax /* enable paging */ movl %eax,%cr0 /* let the games begin! */ movl bootSTK,%esp /* boot stack end loc. */ diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 6b796251b0bc..94e013723bb3 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -158,10 +158,7 @@ __FBSDID("$FreeBSD$"); #ifdef SMP #include #endif - -#ifndef PMAP_SHPGPERPROC -#define PMAP_SHPGPERPROC 200 -#endif +#include #if !defined(DIAGNOSTIC) #ifdef __GNUC_GNU_INLINE__ @@ -182,6 +179,26 @@ __FBSDID("$FreeBSD$"); #define pa_index(pa) ((pa) >> PDRSHIFT) #define pa_to_pvh(pa) (&pv_table[pa_index(pa)]) +/* + * PTmap is recursive pagemap at top of virtual address space. + * Within PTmap, the page directory can be found (third indirection). + */ +#define PTmap ((pt_entry_t *)(PTDPTDI << PDRSHIFT)) +#define PTD ((pd_entry_t *)((PTDPTDI << PDRSHIFT) + (PTDPTDI * PAGE_SIZE))) +#define PTDpde ((pd_entry_t *)((PTDPTDI << PDRSHIFT) + (PTDPTDI * PAGE_SIZE) + \ + (PTDPTDI * PDESIZE))) + +/* + * Translate a virtual address to the kernel virtual address of its page table + * entry (PTE). This can be used recursively. If the address of a PTE as + * previously returned by this macro is itself given as the argument, then the + * address of the page directory entry (PDE) that maps the PTE will be + * returned. + * + * This macro may be used before pmap_bootstrap() is called. + */ +#define vtopte(va) (PTmap + i386_btop(va)) + /* * Get PDEs and PTEs for user/kernel address space */ @@ -198,30 +215,29 @@ __FBSDID("$FreeBSD$"); atomic_clear_int((u_int *)(pte), PG_W)) #define pmap_pte_set_prot(pte, v) ((*(int *)pte &= ~PG_PROT), (*(int *)pte |= (v))) -struct pmap kernel_pmap_store; +_Static_assert(sizeof(struct pmap) <= sizeof(struct pmap_KBI), + "pmap_KBI"); -vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss) */ -vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */ static int pgeflag = 0; /* PG_G or-in */ static int pseflag = 0; /* PG_PS or-in */ static int nkpt = NKPT; -vm_offset_t kernel_vm_end = /* 0 + */ NKPT * NBPDR; -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP pt_entry_t pg_nx; static uma_zone_t pdptzone; #endif -static SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); +_Static_assert(VM_MAXUSER_ADDRESS == VADDR(TRPTDI, 0), "VM_MAXUSER_ADDRESS"); +_Static_assert(VM_MAX_KERNEL_ADDRESS <= VADDR(PTDPTDI, 0), + "VM_MAX_KERNEL_ADDRESS"); +_Static_assert(PMAP_MAP_LOW == VADDR(LOWPTDI, 0), "PMAP_MAP_LOW"); +_Static_assert(KERNLOAD == (KERNPTDI << PDRSHIFT), "KERNLOAD"); -static int pat_works = 1; -SYSCTL_INT(_vm_pmap, OID_AUTO, pat_works, CTLFLAG_RD, &pat_works, 1, - "Is page attribute table fully functional?"); +extern int pat_works; +extern int pg_ps_enabled; -static int pg_ps_enabled = 1; -SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, - &pg_ps_enabled, 0, "Are large page mappings enabled?"); +extern int elf32_nxstack; #define PAT_INDEX_SIZE 8 static int pat_index[PAT_INDEX_SIZE]; /* cache mode to PAT index conversion */ @@ -244,21 +260,21 @@ static struct rwlock_padalign pvh_global_lock; * Data for the pv entry allocation mechanism */ static TAILQ_HEAD(pch, pv_chunk) pv_chunks = TAILQ_HEAD_INITIALIZER(pv_chunks); -static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0; +extern int pv_entry_max, pv_entry_count; +static int pv_entry_high_water = 0; static struct md_page *pv_table; -static int shpgperproc = PMAP_SHPGPERPROC; +extern int shpgperproc; -struct pv_chunk *pv_chunkbase; /* KVA block for pv_chunks */ -int pv_maxchunks; /* How many chunks we have KVA for */ -vm_offset_t pv_vafree; /* freelist stored in the PTE */ +static struct pv_chunk *pv_chunkbase; /* KVA block for pv_chunks */ +static int pv_maxchunks; /* How many chunks we have KVA for */ +static vm_offset_t pv_vafree; /* freelist stored in the PTE */ /* * All those kernel PT submaps that BSD is so fond of */ -pt_entry_t *CMAP3; +static pt_entry_t *CMAP3; static pd_entry_t *KPTD; -caddr_t ptvmmap = 0; -caddr_t CADDR3; +static caddr_t CADDR3; /* * Crashdump maps. @@ -269,23 +285,12 @@ static pt_entry_t *PMAP1 = NULL, *PMAP2, *PMAP3; static pt_entry_t *PADDR1 = NULL, *PADDR2, *PADDR3; #ifdef SMP static int PMAP1cpu, PMAP3cpu; -static int PMAP1changedcpu; -SYSCTL_INT(_debug, OID_AUTO, PMAP1changedcpu, CTLFLAG_RD, - &PMAP1changedcpu, 0, - "Number of times pmap_pte_quick changed CPU with same PMAP1"); +extern int PMAP1changedcpu; #endif -static int PMAP1changed; -SYSCTL_INT(_debug, OID_AUTO, PMAP1changed, CTLFLAG_RD, - &PMAP1changed, 0, - "Number of times pmap_pte_quick changed PMAP1"); -static int PMAP1unchanged; -SYSCTL_INT(_debug, OID_AUTO, PMAP1unchanged, CTLFLAG_RD, - &PMAP1unchanged, 0, - "Number of times pmap_pte_quick didn't change PMAP1"); +extern int PMAP1changed; +extern int PMAP1unchanged; static struct mtx PMAP2mutex; -int pti; - /* * Internal flags for pmap_enter()'s helper functions. */ @@ -313,12 +318,7 @@ static int pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t newpde, u_int flags, vm_page_t m); static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte); -static void pmap_flush_page(vm_page_t m); static int pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte); -static void pmap_invalidate_cache_range_selfsnoop(vm_offset_t sva, - vm_offset_t eva); -static void pmap_invalidate_cache_range_all(vm_offset_t sva, - vm_offset_t eva); static void pmap_invalidate_pde_page(pmap_t pmap, vm_offset_t va, pd_entry_t pde); static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte); @@ -358,30 +358,37 @@ static void _pmap_unwire_ptp(pmap_t pmap, vm_page_t m, struct spglist *free); static pt_entry_t *pmap_pte_quick(pmap_t pmap, vm_offset_t va); static void pmap_pte_release(pt_entry_t *pte); static int pmap_unuse_pt(pmap_t, vm_offset_t, struct spglist *); -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP static void *pmap_pdpt_allocf(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *flags, int wait); #endif static void pmap_init_trm(void); +static void pmap_invalidate_all_int(pmap_t pmap); static __inline void pagezero(void *page); CTASSERT(1 << PDESHIFT == sizeof(pd_entry_t)); CTASSERT(1 << PTESHIFT == sizeof(pt_entry_t)); -void pmap_cold(void); extern char _end[]; -u_long physfree; /* phys addr of next free page */ -u_long vm86phystk; /* PA of vm86/bios stack */ -u_long vm86paddr; /* address of vm86 region */ -int vm86pa; /* phys addr of vm86 region */ -u_long KERNend; /* phys addr end of kernel (just after bss) */ -pd_entry_t *IdlePTD; /* phys addr of kernel PTD */ -#if defined(PAE) || defined(PAE_TABLES) +extern u_long physfree; /* phys addr of next free page */ +extern u_long vm86phystk;/* PA of vm86/bios stack */ +extern u_long vm86paddr;/* address of vm86 region */ +extern int vm86pa; /* phys addr of vm86 region */ +extern u_long KERNend; /* phys addr end of kernel (just after bss) */ +#ifdef PMAP_PAE_COMP +pd_entry_t *IdlePTD_pae; /* phys addr of kernel PTD */ pdpt_entry_t *IdlePDPT; /* phys addr of kernel PDPT */ +pt_entry_t *KPTmap_pae; /* address of kernel page tables */ +#define IdlePTD IdlePTD_pae +#define KPTmap KPTmap_pae +#else +pd_entry_t *IdlePTD_nopae; +pt_entry_t *KPTmap_nopae; +#define IdlePTD IdlePTD_nopae +#define KPTmap KPTmap_nopae #endif -pt_entry_t *KPTmap; /* address of kernel page tables */ -u_long KPTphys; /* phys addr of kernel page tables */ +extern u_long KPTphys; /* phys addr of kernel page tables */ extern u_long tramp_idleptd; static u_long @@ -412,7 +419,18 @@ pmap_cold_mapident(u_long pa, u_long cnt) pmap_cold_map(pa, pa, cnt); } -_Static_assert(2 * NBPDR == KERNBASE, "Broken double-map of zero PTD"); +_Static_assert(LOWPTDI * 2 * NBPDR == KERNBASE, + "Broken double-map of zero PTD"); + +static void +__CONCAT(PMTYPE, remap_lower)(bool enable) +{ + int i; + + for (i = 0; i < LOWPTDI; i++) + IdlePTD[i] = enable ? IdlePTD[LOWPTDI + i] : 0; + load_cr3(rcr3()); /* invalidate TLB */ +} /* * Called from locore.s before paging is enabled. Sets up the first @@ -420,7 +438,7 @@ _Static_assert(2 * NBPDR == KERNBASE, "Broken double-map of zero PTD"); * does not require relocations. */ void -pmap_cold(void) +__CONCAT(PMTYPE, cold)(void) { pt_entry_t *pt; u_long a; @@ -439,7 +457,7 @@ pmap_cold(void) KPTmap = (pt_entry_t *)KPTphys; /* Allocate Page Table Directory */ -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP /* XXX only need 32 bytes (easier for now) */ IdlePDPT = (pdpt_entry_t *)allocpages(1, &physfree); #endif @@ -464,7 +482,7 @@ pmap_cold(void) for (a = 0; a < NKPT; a++) IdlePTD[a] = (KPTphys + ptoa(a)) | PG_V | PG_RW | PG_A | PG_M; -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP /* PAE install PTD pointers into PDPT */ for (a = 0; a < NPGPTD; a++) IdlePDPT[a] = ((u_int)IdlePTD + ptoa(a)) | PG_V; @@ -490,12 +508,12 @@ pmap_cold(void) * access for various reasons. Kernel mappings never have any * access restrictions. */ - pmap_cold_mapident(0, atop(NBPDR)); - pmap_cold_map(0, NBPDR, atop(NBPDR)); + pmap_cold_mapident(0, atop(NBPDR) * LOWPTDI); + pmap_cold_map(0, NBPDR * LOWPTDI, atop(NBPDR) * LOWPTDI); pmap_cold_mapident(KERNBASE, atop(KERNend - KERNBASE)); /* Map page table directory */ -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP pmap_cold_mapident((u_long)IdlePDPT, 1); #endif pmap_cold_mapident((u_long)IdlePTD, NPGPTD); @@ -537,14 +555,14 @@ pmap_cold(void) pgeflag = PG_G; } ncr4 |= (cpu_feature & CPUID_VME) != 0 ? CR4_VME : 0; -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP ncr4 |= CR4_PAE; #endif if (ncr4 != 0) load_cr4(rcr4() | ncr4); /* Now enable paging */ -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP cr3 = (u_int)IdlePDPT; #else cr3 = (u_int)IdlePTD; @@ -562,8 +580,31 @@ pmap_cold(void) * Remove the lowest part of the double mapping of low memory * to get some null pointer checks. */ - IdlePTD[0] = 0; - load_cr3(cr3); /* invalidate TLB */ + __CONCAT(PMTYPE, remap_lower)(false); + + kernel_vm_end = /* 0 + */ NKPT * NBPDR; +#ifdef PMAP_PAE_COMP + i386_pmap_VM_NFREEORDER = VM_NFREEORDER_PAE; + i386_pmap_VM_LEVEL_0_ORDER = VM_LEVEL_0_ORDER_PAE; + i386_pmap_PDRSHIFT = PDRSHIFT_PAE; +#else + i386_pmap_VM_NFREEORDER = VM_NFREEORDER_NOPAE; + i386_pmap_VM_LEVEL_0_ORDER = VM_LEVEL_0_ORDER_NOPAE; + i386_pmap_PDRSHIFT = PDRSHIFT_NOPAE; +#endif +} + +static void +__CONCAT(PMTYPE, set_nx)(void) +{ + +#ifdef PMAP_PAE_COMP + if ((amd_feature & AMDID_NX) == 0) + return; + pg_nx = PG_NX; + elf32_nxstack = 1; + /* EFER.EFER_NXE is set in initializecpu(). */ +#endif } /* @@ -573,8 +614,8 @@ pmap_cold(void) * kernel page table and enabled paging, and just syncs the pmap * module with what has already been done. */ -void -pmap_bootstrap(vm_paddr_t firstaddr) +static void +__CONCAT(PMTYPE, bootstrap)(vm_paddr_t firstaddr) { vm_offset_t va; pt_entry_t *pte, *unused; @@ -611,7 +652,7 @@ pmap_bootstrap(vm_paddr_t firstaddr) */ PMAP_LOCK_INIT(kernel_pmap); kernel_pmap->pm_pdir = IdlePTD; -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP kernel_pmap->pm_pdpt = IdlePDPT; #endif CPU_FILL(&kernel_pmap->pm_active); /* don't allow deactivation */ @@ -705,6 +746,13 @@ pmap_init_reserved_pages(void) vm_offset_t pages; int i; +#ifdef PMAP_PAE_COMP + if (!pae_mode) + return; +#else + if (pae_mode) + return; +#endif CPU_FOREACH(i) { pc = pcpu_find(i); mtx_init(&pc->pc_copyout_mlock, "cpmlk", NULL, MTX_DEF | @@ -745,8 +793,8 @@ SYSINIT(rpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_reserved_pages, NULL); /* * Setup the PAT MSR. */ -void -pmap_init_pat(void) +static void +__CONCAT(PMTYPE, init_pat)(void) { int pat_table[PAT_INDEX_SIZE]; uint64_t pat_msr; @@ -846,18 +894,7 @@ pmap_init_pat(void) load_cr4(cr4); } -/* - * Initialize a vm_page's machine-dependent fields. - */ -void -pmap_page_init(vm_page_t m) -{ - - TAILQ_INIT(&m->md.pv_list); - m->md.pat_mode = PAT_WRITE_BACK; -} - -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP static void * pmap_pdpt_allocf(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *flags, int wait) @@ -930,8 +967,8 @@ pmap_ptelist_init(vm_offset_t *head, void *base, int npages) * Called by vm_init, to initialize any structures that the pmap * system needs to map virtual memory. */ -void -pmap_init(void) +static void +__CONCAT(PMTYPE, init)(void) { struct pmap_preinit_mapping *ppim; vm_page_t mpte; @@ -1018,7 +1055,7 @@ pmap_init(void) if (pv_chunkbase == NULL) panic("pmap_init: not enough kvm for pv chunks"); pmap_ptelist_init(&pv_vafree, pv_chunkbase, pv_maxchunks); -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP pdptzone = uma_zcreate("PDPT", NPGPTD * sizeof(pdpt_entry_t), NULL, NULL, NULL, NULL, (NPGPTD * sizeof(pdpt_entry_t)) - 1, UMA_ZONE_VM | UMA_ZONE_NOFREE); @@ -1040,37 +1077,17 @@ pmap_init(void) } - -SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_max, CTLFLAG_RD, &pv_entry_max, 0, - "Max number of PV entries"); -SYSCTL_INT(_vm_pmap, OID_AUTO, shpgperproc, CTLFLAG_RD, &shpgperproc, 0, - "Page share factor per proc"); - -static SYSCTL_NODE(_vm_pmap, OID_AUTO, pde, CTLFLAG_RD, 0, - "2/4MB page mapping counters"); - -static u_long pmap_pde_demotions; -SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, demotions, CTLFLAG_RD, - &pmap_pde_demotions, 0, "2/4MB page demotions"); - -static u_long pmap_pde_mappings; -SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, mappings, CTLFLAG_RD, - &pmap_pde_mappings, 0, "2/4MB page mappings"); - -static u_long pmap_pde_p_failures; -SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, p_failures, CTLFLAG_RD, - &pmap_pde_p_failures, 0, "2/4MB page promotion failures"); - -static u_long pmap_pde_promotions; -SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, promotions, CTLFLAG_RD, - &pmap_pde_promotions, 0, "2/4MB page promotions"); +extern u_long pmap_pde_demotions; +extern u_long pmap_pde_mappings; +extern u_long pmap_pde_p_failures; +extern u_long pmap_pde_promotions; /*************************************************** * Low level helper routines..... ***************************************************/ -boolean_t -pmap_is_valid_memattr(pmap_t pmap __unused, vm_memattr_t mode) +static boolean_t +__CONCAT(PMTYPE, is_valid_memattr)(pmap_t pmap __unused, vm_memattr_t mode) { return (mode >= 0 && mode < PAT_INDEX_SIZE && @@ -1081,8 +1098,8 @@ pmap_is_valid_memattr(pmap_t pmap __unused, vm_memattr_t mode) * Determine the appropriate bits to set in a PTE or PDE for a specified * caching mode. */ -int -pmap_cache_bits(pmap_t pmap, int mode, boolean_t is_pde) +static int +__CONCAT(PMTYPE, cache_bits)(pmap_t pmap, int mode, boolean_t is_pde) { int cache_bits, pat_flag, pat_idx; @@ -1106,8 +1123,8 @@ pmap_cache_bits(pmap_t pmap, int mode, boolean_t is_pde) return (cache_bits); } -bool -pmap_ps_enabled(pmap_t pmap __unused) +static bool +__CONCAT(PMTYPE, ps_enabled)(pmap_t pmap __unused) { return (pg_ps_enabled); @@ -1147,14 +1164,6 @@ pmap_update_pde_invalidate(vm_offset_t va, pd_entry_t newpde) invltlb(); } -void -invltlb_glob(void) -{ - - invltlb(); -} - - #ifdef SMP /* * For SMP, these functions have to use the IPI mechanism for coherence. @@ -1175,8 +1184,8 @@ invltlb_glob(void) * immutable. The kernel page table is always active on every * processor. */ -void -pmap_invalidate_page(pmap_t pmap, vm_offset_t va) +static void +pmap_invalidate_page_int(pmap_t pmap, vm_offset_t va) { cpuset_t *mask, other_cpus; u_int cpuid; @@ -1201,15 +1210,15 @@ pmap_invalidate_page(pmap_t pmap, vm_offset_t va) /* 4k PTEs -- Chosen to exceed the total size of Broadwell L2 TLB */ #define PMAP_INVLPG_THRESHOLD (4 * 1024 * PAGE_SIZE) -void -pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) +static void +pmap_invalidate_range_int(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { cpuset_t *mask, other_cpus; vm_offset_t addr; u_int cpuid; if (eva - sva >= PMAP_INVLPG_THRESHOLD) { - pmap_invalidate_all(pmap); + pmap_invalidate_all_int(pmap); return; } @@ -1231,8 +1240,8 @@ pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) sched_unpin(); } -void -pmap_invalidate_all(pmap_t pmap) +static void +pmap_invalidate_all_int(pmap_t pmap) { cpuset_t *mask, other_cpus; u_int cpuid; @@ -1254,8 +1263,8 @@ pmap_invalidate_all(pmap_t pmap) sched_unpin(); } -void -pmap_invalidate_cache(void) +static void +__CONCAT(PMTYPE, invalidate_cache)(void) { sched_pin(); @@ -1351,16 +1360,16 @@ pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_t *pde, pd_entry_t newpde) * Normal, non-SMP, 486+ invalidation functions. * We inline these within pmap.c for speed. */ -PMAP_INLINE void -pmap_invalidate_page(pmap_t pmap, vm_offset_t va) +static void +pmap_invalidate_page_int(pmap_t pmap, vm_offset_t va) { if (pmap == kernel_pmap) invlpg(va); } -PMAP_INLINE void -pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) +static void +pmap_invalidate_range_int(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { vm_offset_t addr; @@ -1369,16 +1378,16 @@ pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) invlpg(addr); } -PMAP_INLINE void -pmap_invalidate_all(pmap_t pmap) +static void +pmap_invalidate_all_int(pmap_t pmap) { if (pmap == kernel_pmap) invltlb(); } -PMAP_INLINE void -pmap_invalidate_cache(void) +static void +__CONCAT(PMTYPE, invalidate_cache)(void) { wbinvd(); @@ -1397,6 +1406,28 @@ pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_t *pde, pd_entry_t newpde) } #endif /* !SMP */ +static void +__CONCAT(PMTYPE, invalidate_page)(pmap_t pmap, vm_offset_t va) +{ + + pmap_invalidate_page_int(pmap, va); +} + +static void +__CONCAT(PMTYPE, invalidate_range)(pmap_t pmap, vm_offset_t sva, + vm_offset_t eva) +{ + + pmap_invalidate_range_int(pmap, sva, eva); +} + +static void +__CONCAT(PMTYPE, invalidate_all)(pmap_t pmap) +{ + + pmap_invalidate_all_int(pmap); +} + static void pmap_invalidate_pde_page(pmap_t pmap, vm_offset_t va, pd_entry_t pde) { @@ -1413,111 +1444,9 @@ pmap_invalidate_pde_page(pmap_t pmap, vm_offset_t va, pd_entry_t pde) * 2- or 4MB page mapping from the TLB. */ if ((pde & PG_PROMOTED) != 0) - pmap_invalidate_range(pmap, va, va + NBPDR - 1); + pmap_invalidate_range_int(pmap, va, va + NBPDR - 1); else - pmap_invalidate_page(pmap, va); -} - -DEFINE_IFUNC(, void, pmap_invalidate_cache_range, (vm_offset_t, vm_offset_t), - static) -{ - - if ((cpu_feature & CPUID_SS) != 0) - return (pmap_invalidate_cache_range_selfsnoop); - if ((cpu_feature & CPUID_CLFSH) != 0) - return (pmap_force_invalidate_cache_range); - return (pmap_invalidate_cache_range_all); -} - -#define PMAP_CLFLUSH_THRESHOLD (2 * 1024 * 1024) - -static void -pmap_invalidate_cache_range_check_align(vm_offset_t sva, vm_offset_t eva) -{ - - KASSERT((sva & PAGE_MASK) == 0, - ("pmap_invalidate_cache_range: sva not page-aligned")); - KASSERT((eva & PAGE_MASK) == 0, - ("pmap_invalidate_cache_range: eva not page-aligned")); -} - -static void -pmap_invalidate_cache_range_selfsnoop(vm_offset_t sva, vm_offset_t eva) -{ - - pmap_invalidate_cache_range_check_align(sva, eva); -} - -void -pmap_force_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva) -{ - - sva &= ~(vm_offset_t)(cpu_clflush_line_size - 1); - if (eva - sva >= PMAP_CLFLUSH_THRESHOLD) { - /* - * The supplied range is bigger than 2MB. - * Globally invalidate cache. - */ - pmap_invalidate_cache(); - return; - } - -#ifdef DEV_APIC - /* - * XXX: Some CPUs fault, hang, or trash the local APIC - * registers if we use CLFLUSH on the local APIC - * range. The local APIC is always uncached, so we - * don't need to flush for that range anyway. - */ - if (pmap_kextract(sva) == lapic_paddr) - return; -#endif - - if ((cpu_stdext_feature & CPUID_STDEXT_CLFLUSHOPT) != 0) { - /* - * Do per-cache line flush. Use the sfence - * instruction to insure that previous stores are - * included in the write-back. The processor - * propagates flush to other processors in the cache - * coherence domain. - */ - sfence(); - for (; sva < eva; sva += cpu_clflush_line_size) - clflushopt(sva); - sfence(); - } else { - /* - * Writes are ordered by CLFLUSH on Intel CPUs. - */ - if (cpu_vendor_id != CPU_VENDOR_INTEL) - mfence(); - for (; sva < eva; sva += cpu_clflush_line_size) - clflush(sva); - if (cpu_vendor_id != CPU_VENDOR_INTEL) - mfence(); - } -} - -static void -pmap_invalidate_cache_range_all(vm_offset_t sva, vm_offset_t eva) -{ - - pmap_invalidate_cache_range_check_align(sva, eva); - pmap_invalidate_cache(); -} - -void -pmap_invalidate_cache_pages(vm_page_t *pages, int count) -{ - int i; - - if (count >= PMAP_CLFLUSH_THRESHOLD / PAGE_SIZE || - (cpu_feature & CPUID_CLFSH) == 0) { - pmap_invalidate_cache(); - } else { - for (i = 0; i < count; i++) - pmap_flush_page(pages[i]); - } + pmap_invalidate_page_int(pmap, va); } /* @@ -1534,8 +1463,8 @@ pmap_is_current(pmap_t pmap) * If the given pmap is not the current or kernel pmap, the returned pte must * be released by passing it to pmap_pte_release(). */ -pt_entry_t * -pmap_pte(pmap_t pmap, vm_offset_t va) +static pt_entry_t * +__CONCAT(PMTYPE, pte)(pmap_t pmap, vm_offset_t va) { pd_entry_t newpf; pd_entry_t *pde; @@ -1551,7 +1480,8 @@ pmap_pte(pmap_t pmap, vm_offset_t va) newpf = *pde & PG_FRAME; if ((*PMAP2 & PG_FRAME) != newpf) { *PMAP2 = newpf | PG_RW | PG_V | PG_A | PG_M; - pmap_invalidate_page(kernel_pmap, (vm_offset_t)PADDR2); + pmap_invalidate_page_int(kernel_pmap, + (vm_offset_t)PADDR2); } return (PADDR2 + (i386_btop(va) & (NPTEPG - 1))); } @@ -1685,14 +1615,41 @@ pmap_pte_ufast(pmap_t pmap, vm_offset_t va, pd_entry_t pde) return (pte); } +/* + * Extract from the kernel page table the physical address that is mapped by + * the given virtual address "va". + * + * This function may be used before pmap_bootstrap() is called. + */ +static vm_paddr_t +__CONCAT(PMTYPE, kextract)(vm_offset_t va) +{ + vm_paddr_t pa; + + if ((pa = pte_load(&PTD[va >> PDRSHIFT])) & PG_PS) { + pa = (pa & PG_PS_FRAME) | (va & PDRMASK); + } else { + /* + * Beware of a concurrent promotion that changes the PDE at + * this point! For example, vtopte() must not be used to + * access the PTE because it would use the new PDE. It is, + * however, safe to use the old PDE because the page table + * page is preserved by the promotion. + */ + pa = KPTmap[i386_btop(va)]; + pa = (pa & PG_FRAME) | (va & PAGE_MASK); + } + return (pa); +} + /* * Routine: pmap_extract * Function: * Extract the physical page address associated * with the given map/virtual_address pair. */ -vm_paddr_t -pmap_extract(pmap_t pmap, vm_offset_t va) +static vm_paddr_t +__CONCAT(PMTYPE, extract)(pmap_t pmap, vm_offset_t va) { vm_paddr_t rtval; pt_entry_t pte; @@ -1720,8 +1677,8 @@ pmap_extract(pmap_t pmap, vm_offset_t va) * with the given pmap and virtual address pair * if that mapping permits the given protection. */ -vm_page_t -pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot) +static vm_page_t +__CONCAT(PMTYPE, extract_and_hold)(pmap_t pmap, vm_offset_t va, vm_prot_t prot) { pd_entry_t pde; pt_entry_t pte; @@ -1769,8 +1726,8 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot) * * This function may be used before pmap_bootstrap() is called. */ -PMAP_INLINE void -pmap_kenter(vm_offset_t va, vm_paddr_t pa) +static void +__CONCAT(PMTYPE, kenter)(vm_offset_t va, vm_paddr_t pa) { pt_entry_t *pte; @@ -1794,8 +1751,8 @@ pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode) * * This function may be used before pmap_bootstrap() is called. */ -PMAP_INLINE void -pmap_kremove(vm_offset_t va) +static void +__CONCAT(PMTYPE, kremove)(vm_offset_t va) { pt_entry_t *pte; @@ -1815,8 +1772,9 @@ pmap_kremove(vm_offset_t va) * update '*virt' with the first usable address after the mapped * region. */ -vm_offset_t -pmap_map(vm_offset_t *virt, vm_paddr_t start, vm_paddr_t end, int prot) +static vm_offset_t +__CONCAT(PMTYPE, map)(vm_offset_t *virt, vm_paddr_t start, vm_paddr_t end, + int prot) { vm_offset_t va, sva; vm_paddr_t superpage_offset; @@ -1854,7 +1812,7 @@ pmap_map(vm_offset_t *virt, vm_paddr_t start, vm_paddr_t end, int prot) start += PAGE_SIZE; } } - pmap_invalidate_range(kernel_pmap, sva, va); + pmap_invalidate_range_int(kernel_pmap, sva, va); *virt = va; return (sva); } @@ -1869,8 +1827,8 @@ pmap_map(vm_offset_t *virt, vm_paddr_t start, vm_paddr_t end, int prot) * over. The page *must* be wired. * Note: SMP coherent. Uses a ranged shootdown IPI. */ -void -pmap_qenter(vm_offset_t sva, vm_page_t *ma, int count) +static void +__CONCAT(PMTYPE, qenter)(vm_offset_t sva, vm_page_t *ma, int count) { pt_entry_t *endpte, oldpte, pa, *pte; vm_page_t m; @@ -1884,7 +1842,7 @@ pmap_qenter(vm_offset_t sva, vm_page_t *ma, int count) m->md.pat_mode, 0); if ((*pte & (PG_FRAME | PG_PTE_CACHE)) != pa) { oldpte |= *pte; -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP pte_store(pte, pa | pg_nx | PG_RW | PG_V); #else pte_store(pte, pa | PG_RW | PG_V); @@ -1893,7 +1851,7 @@ pmap_qenter(vm_offset_t sva, vm_page_t *ma, int count) pte++; } if (__predict_false((oldpte & PG_V) != 0)) - pmap_invalidate_range(kernel_pmap, sva, sva + count * + pmap_invalidate_range_int(kernel_pmap, sva, sva + count * PAGE_SIZE); } @@ -1902,8 +1860,8 @@ pmap_qenter(vm_offset_t sva, vm_page_t *ma, int count) * kernel -- it is meant only for temporary mappings. * Note: SMP coherent. Uses a ranged shootdown IPI. */ -void -pmap_qremove(vm_offset_t sva, int count) +static void +__CONCAT(PMTYPE, qremove)(vm_offset_t sva, int count) { vm_offset_t va; @@ -1912,7 +1870,7 @@ pmap_qremove(vm_offset_t sva, int count) pmap_kremove(va); va += PAGE_SIZE; } - pmap_invalidate_range(kernel_pmap, sva, va); + pmap_invalidate_range_int(kernel_pmap, sva, va); } /*************************************************** @@ -2022,13 +1980,13 @@ pmap_unuse_pt(pmap_t pmap, vm_offset_t va, struct spglist *free) /* * Initialize the pmap for the swapper process. */ -void -pmap_pinit0(pmap_t pmap) +static void +__CONCAT(PMTYPE, pinit0)(pmap_t pmap) { PMAP_LOCK_INIT(pmap); pmap->pm_pdir = IdlePTD; -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP pmap->pm_pdpt = IdlePDPT; #endif pmap->pm_root.rt_root = 0; @@ -2042,8 +2000,8 @@ pmap_pinit0(pmap_t pmap) * Initialize a preallocated and zeroed pmap structure, * such as one in a vmspace structure. */ -int -pmap_pinit(pmap_t pmap) +static int +__CONCAT(PMTYPE, pinit)(pmap_t pmap) { vm_page_t m; int i; @@ -2056,7 +2014,7 @@ pmap_pinit(pmap_t pmap) pmap->pm_pdir = (pd_entry_t *)kva_alloc(NBPTD); if (pmap->pm_pdir == NULL) return (0); -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP pmap->pm_pdpt = uma_zalloc(pdptzone, M_WAITOK | M_ZERO); KASSERT(((vm_offset_t)pmap->pm_pdpt & ((NPGPTD * sizeof(pdpt_entry_t)) - 1)) == 0, @@ -2072,18 +2030,13 @@ pmap_pinit(pmap_t pmap) /* * allocate the page directory page(s) */ - for (i = 0; i < NPGPTD;) { + for (i = 0; i < NPGPTD; i++) { m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO); - if (m == NULL) { - vm_wait(NULL); - } else { - pmap->pm_ptdpg[i] = m; -#if defined(PAE) || defined(PAE_TABLES) - pmap->pm_pdpt[i] = VM_PAGE_TO_PHYS(m) | PG_V; + VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_WAITOK); + pmap->pm_ptdpg[i] = m; +#ifdef PMAP_PAE_COMP + pmap->pm_pdpt[i] = VM_PAGE_TO_PHYS(m) | PG_V; #endif - i++; - } } pmap_qenter((vm_offset_t)pmap->pm_pdir, pmap->pm_ptdpg, NPGPTD); @@ -2203,8 +2156,8 @@ pmap_allocpte(pmap_t pmap, vm_offset_t va, u_int flags) * Called when a pmap initialized by pmap_pinit is being released. * Should only be called if the map contains no valid mappings. */ -void -pmap_release(pmap_t pmap) +static void +__CONCAT(PMTYPE, release)(pmap_t pmap) { vm_page_t m; int i; @@ -2221,7 +2174,7 @@ pmap_release(pmap_t pmap) for (i = 0; i < NPGPTD; i++) { m = pmap->pm_ptdpg[i]; -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP KASSERT(VM_PAGE_TO_PHYS(m) == (pmap->pm_pdpt[i] & PG_FRAME), ("pmap_release: got wrong ptd page")); #endif @@ -2230,31 +2183,11 @@ pmap_release(pmap_t pmap) } } -static int -kvm_size(SYSCTL_HANDLER_ARGS) -{ - unsigned long ksize = VM_MAX_KERNEL_ADDRESS - KERNBASE; - - return (sysctl_handle_long(oidp, &ksize, 0, req)); -} -SYSCTL_PROC(_vm, OID_AUTO, kvm_size, CTLTYPE_LONG|CTLFLAG_RD, - 0, 0, kvm_size, "IU", "Size of KVM"); - -static int -kvm_free(SYSCTL_HANDLER_ARGS) -{ - unsigned long kfree = VM_MAX_KERNEL_ADDRESS - kernel_vm_end; - - return (sysctl_handle_long(oidp, &kfree, 0, req)); -} -SYSCTL_PROC(_vm, OID_AUTO, kvm_free, CTLTYPE_LONG|CTLFLAG_RD, - 0, 0, kvm_free, "IU", "Amount of KVM free"); - /* * grow the number of kernel page table entries, if needed */ -void -pmap_growkernel(vm_offset_t addr) +static void +__CONCAT(PMTYPE, growkernel)(vm_offset_t addr) { vm_paddr_t ptppaddr; vm_page_t nkpg; @@ -2325,30 +2258,10 @@ static const uint32_t pc_freemask[_NPCM] = { PC_FREE0_9, PC_FREE10 }; -SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, &pv_entry_count, 0, - "Current number of pv entries"); - #ifdef PV_STATS -static int pc_chunk_count, pc_chunk_allocs, pc_chunk_frees, pc_chunk_tryfail; - -SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_count, CTLFLAG_RD, &pc_chunk_count, 0, - "Current number of pv entry chunks"); -SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_allocs, CTLFLAG_RD, &pc_chunk_allocs, 0, - "Current number of pv entry chunks allocated"); -SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_frees, CTLFLAG_RD, &pc_chunk_frees, 0, - "Current number of pv entry chunks frees"); -SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_tryfail, CTLFLAG_RD, &pc_chunk_tryfail, 0, - "Number of times tried to get a chunk page but failed."); - -static long pv_entry_frees, pv_entry_allocs; -static int pv_entry_spare; - -SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_frees, CTLFLAG_RD, &pv_entry_frees, 0, - "Current number of pv entry frees"); -SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_allocs, CTLFLAG_RD, &pv_entry_allocs, 0, - "Current number of pv entry allocs"); -SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_spare, CTLFLAG_RD, &pv_entry_spare, 0, - "Current number of spare pv entries"); +extern int pc_chunk_count, pc_chunk_allocs, pc_chunk_frees, pc_chunk_tryfail; +extern long pv_entry_frees, pv_entry_allocs; +extern int pv_entry_spare; #endif /* @@ -2382,7 +2295,7 @@ pmap_pv_reclaim(pmap_t locked_pmap) TAILQ_REMOVE(&pv_chunks, pc, pc_lru); if (pmap != pc->pc_pmap) { if (pmap != NULL) { - pmap_invalidate_all(pmap); + pmap_invalidate_all_int(pmap); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); } @@ -2410,7 +2323,7 @@ pmap_pv_reclaim(pmap_t locked_pmap) pde = pmap_pde(pmap, va); if ((*pde & PG_PS) != 0) continue; - pte = pmap_pte(pmap, va); + pte = __CONCAT(PMTYPE, pte)(pmap, va); tpte = *pte; if ((tpte & PG_W) == 0) tpte = pte_load_clear(pte); @@ -2421,7 +2334,7 @@ pmap_pv_reclaim(pmap_t locked_pmap) ("pmap_pv_reclaim: pmap %p va %x zero pte", pmap, va)); if ((tpte & PG_G) != 0) - pmap_invalidate_page(pmap, va); + pmap_invalidate_page_int(pmap, va); m = PHYS_TO_VM_PAGE(tpte & PG_FRAME); if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); @@ -2479,7 +2392,7 @@ pmap_pv_reclaim(pmap_t locked_pmap) out: TAILQ_CONCAT(&pv_chunks, &newtail, pc_lru); if (pmap != NULL) { - pmap_invalidate_all(pmap); + pmap_invalidate_all_int(pmap); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); } @@ -2880,7 +2793,8 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) mtx_lock(&PMAP2mutex); if ((*PMAP2 & PG_FRAME) != mptepa) { *PMAP2 = mptepa | PG_RW | PG_V | PG_A | PG_M; - pmap_invalidate_page(kernel_pmap, (vm_offset_t)PADDR2); + pmap_invalidate_page_int(kernel_pmap, + (vm_offset_t)PADDR2); } firstpte = PADDR2; } @@ -2930,7 +2844,7 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) /* * Invalidate the recursive mapping of the page table page. */ - pmap_invalidate_page(pmap, (vm_offset_t)vtopte(va)); + pmap_invalidate_page_int(pmap, (vm_offset_t)vtopte(va)); /* * Demote the pv entry. This depends on the earlier demotion @@ -2984,7 +2898,7 @@ pmap_remove_kernel_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) /* * Invalidate the recursive mapping of the page table page. */ - pmap_invalidate_page(pmap, (vm_offset_t)vtopte(va)); + pmap_invalidate_page_int(pmap, (vm_offset_t)vtopte(va)); } /* @@ -3065,7 +2979,7 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t va, * PG_G. */ if (oldpte & PG_G) - pmap_invalidate_page(kernel_pmap, va); + pmap_invalidate_page_int(kernel_pmap, va); pmap->pm_stats.resident_count -= 1; if (oldpte & PG_MANAGED) { m = PHYS_TO_VM_PAGE(oldpte & PG_FRAME); @@ -3092,7 +3006,7 @@ pmap_remove_page(pmap_t pmap, vm_offset_t va, struct spglist *free) if ((pte = pmap_pte_quick(pmap, va)) == NULL || *pte == 0) return; pmap_remove_pte(pmap, pte, va, free); - pmap_invalidate_page(pmap, va); + pmap_invalidate_page_int(pmap, va); } /* @@ -3133,8 +3047,8 @@ pmap_remove_ptes(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, * It is assumed that the start and end are properly * rounded to the page size. */ -void -pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) +static void +__CONCAT(PMTYPE, remove)(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { vm_offset_t pdnxt; pd_entry_t ptpaddr; @@ -3226,7 +3140,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) out: sched_unpin(); if (anyvalid) - pmap_invalidate_all(pmap); + pmap_invalidate_all_int(pmap); rw_wunlock(&pvh_global_lock); PMAP_UNLOCK(pmap); vm_page_free_pages_toq(&free, true); @@ -3245,8 +3159,8 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) * pmap_remove (slow...) */ -void -pmap_remove_all(vm_page_t m) +static void +__CONCAT(PMTYPE, remove_all)(vm_page_t m) { struct md_page *pvh; pv_entry_t pv; @@ -3295,7 +3209,7 @@ pmap_remove_all(vm_page_t m) if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); pmap_unuse_pt(pmap, pv->pv_va, &free); - pmap_invalidate_page(pmap, pv->pv_va); + pmap_invalidate_page_int(pmap, pv->pv_va); TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); free_pv_entry(pmap, pv); PMAP_UNLOCK(pmap); @@ -3332,7 +3246,7 @@ pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot) } if ((prot & VM_PROT_WRITE) == 0) newpde &= ~(PG_RW | PG_M); -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP if ((prot & VM_PROT_EXECUTE) == 0) newpde |= pg_nx; #endif @@ -3356,8 +3270,9 @@ pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot) * Set the physical protection on the * specified range of this map as requested. */ -void -pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) +static void +__CONCAT(PMTYPE, protect)(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, + vm_prot_t prot) { vm_offset_t pdnxt; pd_entry_t ptpaddr; @@ -3370,9 +3285,9 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) return; } -#if defined(PAE) || defined(PAE_TABLES) - if ((prot & (VM_PROT_WRITE|VM_PROT_EXECUTE)) == - (VM_PROT_WRITE|VM_PROT_EXECUTE)) +#ifdef PMAP_PAE_COMP + if ((prot & (VM_PROT_WRITE | VM_PROT_EXECUTE)) == + (VM_PROT_WRITE | VM_PROT_EXECUTE)) return; #else if (prot & VM_PROT_WRITE) @@ -3430,7 +3345,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) pv_lists_locked = TRUE; if (!rw_try_wlock(&pvh_global_lock)) { if (anychanged) - pmap_invalidate_all( + pmap_invalidate_all_int( pmap); PMAP_UNLOCK(pmap); goto resume; @@ -3473,13 +3388,13 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) } pbits &= ~(PG_RW | PG_M); } -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP if ((prot & VM_PROT_EXECUTE) == 0) pbits |= pg_nx; #endif if (pbits != obits) { -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP if (!atomic_cmpset_64(pte, obits, pbits)) goto retry; #else @@ -3488,14 +3403,14 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) goto retry; #endif if (obits & PG_G) - pmap_invalidate_page(pmap, sva); + pmap_invalidate_page_int(pmap, sva); else anychanged = TRUE; } } } if (anychanged) - pmap_invalidate_all(pmap); + pmap_invalidate_all_int(pmap); if (pv_lists_locked) { sched_unpin(); rw_wunlock(&pvh_global_lock); @@ -3654,9 +3569,9 @@ pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) * or lose information. That is, this routine must actually * insert this page into the given map NOW. */ -int -pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, - u_int flags, int8_t psind) +static int +__CONCAT(PMTYPE, enter)(pmap_t pmap, vm_offset_t va, vm_page_t m, + vm_prot_t prot, u_int flags, int8_t psind) { pd_entry_t *pde; pt_entry_t *pte; @@ -3688,7 +3603,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, newpte |= PG_RW; KASSERT((newpte & (PG_M | PG_RW)) != PG_M, ("pmap_enter: flags includes VM_PROT_WRITE but prot doesn't")); -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP if ((prot & VM_PROT_EXECUTE) == 0) newpte |= pg_nx; #endif @@ -3832,7 +3747,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_aflag_clear(om, PGA_WRITEABLE); } if ((origpte & PG_A) != 0) - pmap_invalidate_page(pmap, va); + pmap_invalidate_page_int(pmap, va); origpte = 0; } else { /* @@ -3875,7 +3790,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, * the PTE no longer has PG_M set. */ } -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP else if ((origpte & PG_NX) != 0 || (newpte & PG_NX) == 0) { /* * This PTE change does not require TLB invalidation. @@ -3884,7 +3799,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, } #endif if ((origpte & PG_A) != 0) - pmap_invalidate_page(pmap, va); + pmap_invalidate_page_int(pmap, va); } else pte_store(pte, newpte); @@ -3925,7 +3840,7 @@ pmap_enter_4mpage(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) PG_PS | PG_V; if ((m->oflags & VPO_UNMANAGED) == 0) newpde |= PG_MANAGED; -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP if ((prot & VM_PROT_EXECUTE) == 0) newpde |= pg_nx; #endif @@ -3978,7 +3893,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t newpde, u_int flags, pmap_invalidate_pde_page(pmap, va, oldpde); } else { if (pmap_remove_ptes(pmap, va, va + NBPDR, &free)) - pmap_invalidate_all(pmap); + pmap_invalidate_all_int(pmap); } vm_page_free_pages_toq(&free, true); if (pmap == kernel_pmap) { @@ -4041,8 +3956,8 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t newpde, u_int flags, * is mapped; only those for which a resident page exists with the * corresponding offset from m_start are mapped. */ -void -pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_offset_t end, +static void +__CONCAT(PMTYPE, enter_object)(pmap_t pmap, vm_offset_t start, vm_offset_t end, vm_page_t m_start, vm_prot_t prot) { vm_offset_t va; @@ -4080,8 +3995,9 @@ pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_offset_t end, * but is *MUCH* faster than pmap_enter... */ -void -pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) +static void +__CONCAT(PMTYPE, enter_quick)(pmap_t pmap, vm_offset_t va, vm_page_t m, + vm_prot_t prot) { rw_wlock(&pvh_global_lock); @@ -4163,7 +4079,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, if (mpte != NULL) { SLIST_INIT(&free); if (pmap_unwire_ptp(pmap, mpte, &free)) { - pmap_invalidate_page(pmap, va); + pmap_invalidate_page_int(pmap, va); vm_page_free_pages_toq(&free, true); } @@ -4182,7 +4098,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, pmap_cache_bits(pmap, m->md.pat_mode, 0); if ((m->oflags & VPO_UNMANAGED) == 0) newpte |= PG_MANAGED; -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP if ((prot & VM_PROT_EXECUTE) == 0) newpte |= pg_nx; #endif @@ -4197,8 +4113,8 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, * Make a temporary mapping for a physical address. This is only intended * to be used for panic dumps. */ -void * -pmap_kenter_temporary(vm_paddr_t pa, int i) +static void * +__CONCAT(PMTYPE, kenter_temporary)(vm_paddr_t pa, int i) { vm_offset_t va; @@ -4213,9 +4129,9 @@ pmap_kenter_temporary(vm_paddr_t pa, int i) * processor address space. Note that some shortcuts * are taken, but the code works. */ -void -pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, vm_object_t object, - vm_pindex_t pindex, vm_size_t size) +static void +__CONCAT(PMTYPE, object_init_pt)(pmap_t pmap, vm_offset_t addr, + vm_object_t object, vm_pindex_t pindex, vm_size_t size) { pd_entry_t *pde; vm_paddr_t pa, ptepa; @@ -4290,8 +4206,8 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, vm_object_t object, * The wired attribute of the page table entry is not a hardware feature, * so there is no need to invalidate any TLB entries. */ -void -pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) +static void +__CONCAT(PMTYPE, unwire)(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { vm_offset_t pdnxt; pd_entry_t *pde; @@ -4388,9 +4304,9 @@ pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) * world. */ -void -pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, - vm_offset_t src_addr) +static void +__CONCAT(PMTYPE, copy)(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, + vm_size_t len, vm_offset_t src_addr) { struct spglist free; pt_entry_t *src_pte, *dst_pte, ptetemp; @@ -4476,8 +4392,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, SLIST_INIT(&free); if (pmap_unwire_ptp(dst_pmap, dstmpte, &free)) { - pmap_invalidate_page(dst_pmap, - addr); + pmap_invalidate_page_int( + dst_pmap, addr); vm_page_free_pages_toq(&free, true); } @@ -4517,8 +4433,8 @@ pagezero(void *page) /* * Zero the specified hardware page. */ -void -pmap_zero_page(vm_page_t m) +static void +__CONCAT(PMTYPE, zero_page)(vm_page_t m) { pt_entry_t *cmap_pte2; struct pcpu *pc; @@ -4548,8 +4464,8 @@ pmap_zero_page(vm_page_t m) * Zero an an area within a single hardware page. off and size must not * cover an area beyond a single hardware page. */ -void -pmap_zero_page_area(vm_page_t m, int off, int size) +static void +__CONCAT(PMTYPE, zero_page_area)(vm_page_t m, int off, int size) { pt_entry_t *cmap_pte2; struct pcpu *pc; @@ -4575,8 +4491,8 @@ pmap_zero_page_area(vm_page_t m, int off, int size) /* * Copy 1 specified hardware page to another. */ -void -pmap_copy_page(vm_page_t src, vm_page_t dst) +static void +__CONCAT(PMTYPE, copy_page)(vm_page_t src, vm_page_t dst) { pt_entry_t *cmap_pte1, *cmap_pte2; struct pcpu *pc; @@ -4603,11 +4519,9 @@ pmap_copy_page(vm_page_t src, vm_page_t dst) mtx_unlock(&pc->pc_cmap_lock); } -int unmapped_buf_allowed = 1; - -void -pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], - vm_offset_t b_offset, int xfersize) +static void +__CONCAT(PMTYPE, copy_pages)(vm_page_t ma[], vm_offset_t a_offset, + vm_page_t mb[], vm_offset_t b_offset, int xfersize) { vm_page_t a_pg, b_pg; char *a_cp, *b_cp; @@ -4658,8 +4572,8 @@ pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], * is only necessary that true be returned for a small * subset of pmaps for proper page aging. */ -boolean_t -pmap_page_exists_quick(pmap_t pmap, vm_page_t m) +static boolean_t +__CONCAT(PMTYPE, page_exists_quick)(pmap_t pmap, vm_page_t m) { struct md_page *pvh; pv_entry_t pv; @@ -4701,8 +4615,8 @@ pmap_page_exists_quick(pmap_t pmap, vm_page_t m) * Return the number of managed mappings to the given physical page * that are wired. */ -int -pmap_page_wired_mappings(vm_page_t m) +static int +__CONCAT(PMTYPE, page_wired_mappings)(vm_page_t m) { int count; @@ -4749,8 +4663,8 @@ pmap_pvh_wired_mappings(struct md_page *pvh, int count) * Returns TRUE if the given page is mapped individually or as part of * a 4mpage. Otherwise, returns FALSE. */ -boolean_t -pmap_page_is_mapped(vm_page_t m) +static boolean_t +__CONCAT(PMTYPE, page_is_mapped)(vm_page_t m) { boolean_t rv; @@ -4772,8 +4686,8 @@ pmap_page_is_mapped(vm_page_t m) * mode enabled. This is much faster than pmap_remove * in the case of running down an entire address space. */ -void -pmap_remove_pages(pmap_t pmap) +static void +__CONCAT(PMTYPE, remove_pages)(pmap_t pmap) { pt_entry_t *pte, tpte; vm_page_t m, mpte, mt; @@ -4894,7 +4808,7 @@ pmap_remove_pages(pmap_t pmap) } } sched_unpin(); - pmap_invalidate_all(pmap); + pmap_invalidate_all_int(pmap); rw_wunlock(&pvh_global_lock); PMAP_UNLOCK(pmap); vm_page_free_pages_toq(&free, true); @@ -4906,8 +4820,8 @@ pmap_remove_pages(pmap_t pmap) * Return whether or not the specified physical page was modified * in any physical maps. */ -boolean_t -pmap_is_modified(vm_page_t m) +static boolean_t +__CONCAT(PMTYPE, is_modified)(vm_page_t m) { boolean_t rv; @@ -4965,8 +4879,8 @@ pmap_is_modified_pvh(struct md_page *pvh) * Return whether or not the specified virtual address is elgible * for prefault. */ -boolean_t -pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr) +static boolean_t +__CONCAT(PMTYPE, is_prefaultable)(pmap_t pmap, vm_offset_t addr) { pd_entry_t pde; boolean_t rv; @@ -4986,8 +4900,8 @@ pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr) * Return whether or not the specified physical page was referenced * in any physical maps. */ -boolean_t -pmap_is_referenced(vm_page_t m) +static boolean_t +__CONCAT(PMTYPE, is_referenced)(vm_page_t m) { boolean_t rv; @@ -5032,8 +4946,8 @@ pmap_is_referenced_pvh(struct md_page *pvh) /* * Clear the write and modified bits in each of the given page's mappings. */ -void -pmap_remove_write(vm_page_t m) +static void +__CONCAT(PMTYPE, remove_write)(vm_page_t m) { struct md_page *pvh; pv_entry_t next_pv, pv; @@ -5088,7 +5002,7 @@ pmap_remove_write(vm_page_t m) goto retry; if ((oldpte & PG_M) != 0) vm_page_dirty(m); - pmap_invalidate_page(pmap, pv->pv_va); + pmap_invalidate_page_int(pmap, pv->pv_va); } PMAP_UNLOCK(pmap); } @@ -5113,8 +5027,8 @@ pmap_remove_write(vm_page_t m) * dirty pages. Those dirty pages will only be detected by a future call * to pmap_is_modified(). */ -int -pmap_ts_referenced(vm_page_t m) +static int +__CONCAT(PMTYPE, ts_referenced)(vm_page_t m) { struct md_page *pvh; pv_entry_t pv, pvf; @@ -5169,7 +5083,7 @@ pmap_ts_referenced(vm_page_t m) (uintptr_t)pmap) & (NPTEPG - 1)) == 0 && (*pde & PG_W) == 0) { atomic_clear_int((u_int *)pde, PG_A); - pmap_invalidate_page(pmap, pv->pv_va); + pmap_invalidate_page_int(pmap, pv->pv_va); } rtval++; } @@ -5198,7 +5112,7 @@ pmap_ts_referenced(vm_page_t m) vm_page_dirty(m); if ((*pte & PG_A) != 0) { atomic_clear_int((u_int *)pte, PG_A); - pmap_invalidate_page(pmap, pv->pv_va); + pmap_invalidate_page_int(pmap, pv->pv_va); rtval++; } PMAP_UNLOCK(pmap); @@ -5220,8 +5134,9 @@ pmap_ts_referenced(vm_page_t m) * given pmap. Depending on the advice, clear the referenced and/or * modified flags in each mapping and set the mapped page's dirty field. */ -void -pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, int advice) +static void +__CONCAT(PMTYPE, advise)(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, + int advice) { pd_entry_t oldpde, *pde; pt_entry_t *pte; @@ -5256,7 +5171,7 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, int advice) pv_lists_locked = TRUE; if (!rw_try_wlock(&pvh_global_lock)) { if (anychanged) - pmap_invalidate_all(pmap); + pmap_invalidate_all_int(pmap); PMAP_UNLOCK(pmap); goto resume; } @@ -5314,15 +5229,15 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, int advice) continue; maybe_invlrng: if (va != pdnxt) { - pmap_invalidate_range(pmap, va, sva); + pmap_invalidate_range_int(pmap, va, sva); va = pdnxt; } } if (va != pdnxt) - pmap_invalidate_range(pmap, va, sva); + pmap_invalidate_range_int(pmap, va, sva); } if (anychanged) - pmap_invalidate_all(pmap); + pmap_invalidate_all_int(pmap); if (pv_lists_locked) { sched_unpin(); rw_wunlock(&pvh_global_lock); @@ -5333,8 +5248,8 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, int advice) /* * Clear the modify bits on the specified physical page. */ -void -pmap_clear_modify(vm_page_t m) +static void +__CONCAT(PMTYPE, clear_modify)(vm_page_t m) { struct md_page *pvh; pv_entry_t next_pv, pv; @@ -5390,7 +5305,8 @@ pmap_clear_modify(vm_page_t m) oldpte & ~(PG_M | PG_RW))) oldpte = *pte; vm_page_dirty(m); - pmap_invalidate_page(pmap, va); + pmap_invalidate_page_int(pmap, + va); } } } @@ -5412,7 +5328,7 @@ pmap_clear_modify(vm_page_t m) * 32 bits. */ atomic_clear_int((u_int *)pte, PG_M); - pmap_invalidate_page(pmap, pv->pv_va); + pmap_invalidate_page_int(pmap, pv->pv_va); } PMAP_UNLOCK(pmap); } @@ -5464,8 +5380,8 @@ pmap_pde_attr(pd_entry_t *pde, int cache_bits) * routine is intended to be used for mapping device memory, * NOT real memory. */ -void * -pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, int mode) +static void * +__CONCAT(PMTYPE, mapdev_attr)(vm_paddr_t pa, vm_size_t size, int mode) { struct pmap_preinit_mapping *ppim; vm_offset_t va, offset; @@ -5510,27 +5426,13 @@ pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, int mode) } for (tmpsize = 0; tmpsize < size; tmpsize += PAGE_SIZE) pmap_kenter_attr(va + tmpsize, pa + tmpsize, mode); - pmap_invalidate_range(kernel_pmap, va, va + tmpsize); + pmap_invalidate_range_int(kernel_pmap, va, va + tmpsize); pmap_invalidate_cache_range(va, va + size); return ((void *)(va + offset)); } -void * -pmap_mapdev(vm_paddr_t pa, vm_size_t size) -{ - - return (pmap_mapdev_attr(pa, size, PAT_UNCACHEABLE)); -} - -void * -pmap_mapbios(vm_paddr_t pa, vm_size_t size) -{ - - return (pmap_mapdev_attr(pa, size, PAT_WRITE_BACK)); -} - -void -pmap_unmapdev(vm_offset_t va, vm_size_t size) +static void +__CONCAT(PMTYPE, unmapdev)(vm_offset_t va, vm_size_t size) { struct pmap_preinit_mapping *ppim; vm_offset_t offset; @@ -5562,8 +5464,8 @@ pmap_unmapdev(vm_offset_t va, vm_size_t size) /* * Sets the memory attribute for the specified page. */ -void -pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) +static void +__CONCAT(PMTYPE, page_set_memattr)(vm_page_t m, vm_memattr_t ma) { m->md.pat_mode = ma; @@ -5592,7 +5494,7 @@ pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) } static void -pmap_flush_page(vm_page_t m) +__CONCAT(PMTYPE, flush_page)(vm_page_t m) { pt_entry_t *cmap_pte2; struct pcpu *pc; @@ -5651,8 +5553,8 @@ pmap_flush_page(vm_page_t m) * of the virtual address range was not mapped, and ENOMEM is returned if * there was insufficient memory available to complete the change. */ -int -pmap_change_attr(vm_offset_t va, vm_size_t size, int mode) +static int +__CONCAT(PMTYPE, change_attr)(vm_offset_t va, vm_size_t size, int mode) { vm_offset_t base, offset, tmpva; pd_entry_t *pde; @@ -5749,7 +5651,7 @@ pmap_change_attr(vm_offset_t va, vm_size_t size, int mode) * shouldn't be, etc. */ if (changed) { - pmap_invalidate_range(kernel_pmap, base, tmpva); + pmap_invalidate_range_int(kernel_pmap, base, tmpva); pmap_invalidate_cache_range(base, tmpva); } return (0); @@ -5758,8 +5660,8 @@ pmap_change_attr(vm_offset_t va, vm_size_t size, int mode) /* * perform the pmap work for mincore */ -int -pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) +static int +__CONCAT(PMTYPE, mincore)(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) { pd_entry_t pde; pt_entry_t pte; @@ -5805,8 +5707,8 @@ pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) return (val); } -void -pmap_activate(struct thread *td) +static void +__CONCAT(PMTYPE, activate)(struct thread *td) { pmap_t pmap, oldpmap; u_int cpuid; @@ -5823,7 +5725,7 @@ pmap_activate(struct thread *td) CPU_CLR(cpuid, &oldpmap->pm_active); CPU_SET(cpuid, &pmap->pm_active); #endif -#if defined(PAE) || defined(PAE_TABLES) +#ifdef PMAP_PAE_COMP cr3 = vtophys(pmap->pm_pdpt); #else cr3 = vtophys(pmap->pm_pdir); @@ -5836,8 +5738,8 @@ pmap_activate(struct thread *td) critical_exit(); } -void -pmap_activate_boot(pmap_t pmap) +static void +__CONCAT(PMTYPE, activate_boot)(pmap_t pmap) { u_int cpuid; @@ -5850,17 +5752,12 @@ pmap_activate_boot(pmap_t pmap) PCPU_SET(curpmap, pmap); } -void -pmap_sync_icache(pmap_t pm, vm_offset_t va, vm_size_t sz) -{ -} - /* * Increase the starting virtual address of the given mapping if a * different alignment might result in more superpage mappings. */ -void -pmap_align_superpage(vm_object_t object, vm_ooffset_t offset, +static void +__CONCAT(PMTYPE, align_superpage)(vm_object_t object, vm_ooffset_t offset, vm_offset_t *addr, vm_size_t size) { vm_offset_t superpage_offset; @@ -5879,8 +5776,8 @@ pmap_align_superpage(vm_object_t object, vm_ooffset_t offset, *addr = ((*addr + PDRMASK) & ~PDRMASK) + superpage_offset; } -vm_offset_t -pmap_quick_enter_page(vm_page_t m) +static vm_offset_t +__CONCAT(PMTYPE, quick_enter_page)(vm_page_t m) { vm_offset_t qaddr; pt_entry_t *pte; @@ -5889,7 +5786,8 @@ pmap_quick_enter_page(vm_page_t m) qaddr = PCPU_GET(qmap_addr); pte = vtopte(qaddr); - KASSERT(*pte == 0, ("pmap_quick_enter_page: PTE busy")); + KASSERT(*pte == 0, + ("pmap_quick_enter_page: PTE busy %#jx", (uintmax_t)*pte)); *pte = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | PG_A | PG_M | pmap_cache_bits(kernel_pmap, pmap_page_get_memattr(m), 0); invlpg(qaddr); @@ -5897,8 +5795,8 @@ pmap_quick_enter_page(vm_page_t m) return (qaddr); } -void -pmap_quick_remove_page(vm_offset_t addr) +static void +__CONCAT(PMTYPE, quick_remove_page)(vm_offset_t addr) { vm_offset_t qaddr; pt_entry_t *pte; @@ -5948,8 +5846,8 @@ pmap_trm_import(void *unused __unused, vmem_size_t size, int flags, return (0); } -static -void pmap_init_trm(void) +void +pmap_init_trm(void) { vm_page_t pd_m; @@ -5966,8 +5864,8 @@ void pmap_init_trm(void) pmap_cache_bits(kernel_pmap, VM_MEMATTR_DEFAULT, TRUE); } -void * -pmap_trm_alloc(size_t size, int flags) +static void * +__CONCAT(PMTYPE, trm_alloc)(size_t size, int flags) { vmem_addr_t res; int error; @@ -5982,8 +5880,8 @@ pmap_trm_alloc(size_t size, int flags) return ((void *)res); } -void -pmap_trm_free(void *addr, size_t size) +static void +__CONCAT(PMTYPE, trm_free)(void *addr, size_t size) { vmem_free(pmap_trm_arena, (uintptr_t)addr, roundup2(size, 4)); @@ -6049,3 +5947,254 @@ pmap_pid_dump(int pid) return (npte); } #endif + +static void +__CONCAT(PMTYPE, ksetrw)(vm_offset_t va) +{ + + *vtopte(va) |= PG_RW; +} + +static void +__CONCAT(PMTYPE, remap_lowptdi)(bool enable) +{ + + PTD[KPTDI] = enable ? PTD[LOWPTDI] : 0; + invltlb_glob(); +} + +static vm_offset_t +__CONCAT(PMTYPE, get_map_low)(void) +{ + + return (PMAP_MAP_LOW); +} + +static vm_offset_t +__CONCAT(PMTYPE, get_vm_maxuser_address)(void) +{ + + return (VM_MAXUSER_ADDRESS); +} + +static vm_paddr_t +__CONCAT(PMTYPE, pg_frame)(vm_paddr_t pa) +{ + + return (pa & PG_FRAME); +} + +static void +__CONCAT(PMTYPE, sf_buf_map)(struct sf_buf *sf) +{ + pt_entry_t opte, *ptep; + + /* + * Update the sf_buf's virtual-to-physical mapping, flushing the + * virtual address from the TLB. Since the reference count for + * the sf_buf's old mapping was zero, that mapping is not + * currently in use. Consequently, there is no need to exchange + * the old and new PTEs atomically, even under PAE. + */ + ptep = vtopte(sf->kva); + opte = *ptep; + *ptep = VM_PAGE_TO_PHYS(sf->m) | PG_RW | PG_V | + pmap_cache_bits(kernel_pmap, sf->m->md.pat_mode, 0); + + /* + * Avoid unnecessary TLB invalidations: If the sf_buf's old + * virtual-to-physical mapping was not used, then any processor + * that has invalidated the sf_buf's virtual address from its TLB + * since the last used mapping need not invalidate again. + */ +#ifdef SMP + if ((opte & (PG_V | PG_A)) == (PG_V | PG_A)) + CPU_ZERO(&sf->cpumask); +#else + if ((opte & (PG_V | PG_A)) == (PG_V | PG_A)) + pmap_invalidate_page_int(kernel_pmap, sf->kva); +#endif +} + +static void +__CONCAT(PMTYPE, cp_slow0_map)(vm_offset_t kaddr, int plen, vm_page_t *ma) +{ + pt_entry_t *pte; + int i; + + for (i = 0, pte = vtopte(kaddr); i < plen; i++, pte++) { + *pte = PG_V | PG_RW | PG_A | PG_M | VM_PAGE_TO_PHYS(ma[i]) | + pmap_cache_bits(kernel_pmap, pmap_page_get_memattr(ma[i]), + FALSE); + invlpg(kaddr + ptoa(i)); + } +} + +static u_int +__CONCAT(PMTYPE, get_kcr3)(void) +{ + +#ifdef PMAP_PAE_COMP + return ((u_int)IdlePDPT); +#else + return ((u_int)IdlePTD); +#endif +} + +static u_int +__CONCAT(PMTYPE, get_cr3)(pmap_t pmap) +{ + +#ifdef PMAP_PAE_COMP + return ((u_int)vtophys(pmap->pm_pdpt)); +#else + return ((u_int)vtophys(pmap->pm_pdir)); +#endif +} + +static caddr_t +__CONCAT(PMTYPE, cmap3)(vm_paddr_t pa, u_int pte_bits) +{ + pt_entry_t *pte; + + pte = CMAP3; + *pte = pa | pte_bits; + invltlb(); + return (CADDR3); +} + +static void +__CONCAT(PMTYPE, basemem_setup)(u_int basemem) +{ + pt_entry_t *pte; + int i; + + /* + * Map pages between basemem and ISA_HOLE_START, if any, r/w into + * the vm86 page table so that vm86 can scribble on them using + * the vm86 map too. XXX: why 2 ways for this and only 1 way for + * page 0, at least as initialized here? + */ + pte = (pt_entry_t *)vm86paddr; + for (i = basemem / 4; i < 160; i++) + pte[i] = (i << PAGE_SHIFT) | PG_V | PG_RW | PG_U; +} + +struct bios16_pmap_handle { + pt_entry_t *pte; + pd_entry_t *ptd; + pt_entry_t orig_ptd; +}; + +static void * +__CONCAT(PMTYPE, bios16_enter)(void) +{ + struct bios16_pmap_handle *h; + + /* + * no page table, so create one and install it. + */ + h = malloc(sizeof(struct bios16_pmap_handle), M_TEMP, M_WAITOK); + h->pte = (pt_entry_t *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + h->ptd = IdlePTD; + *h->pte = vm86phystk | PG_RW | PG_V; + h->orig_ptd = *h->ptd; + *h->ptd = vtophys(h->pte) | PG_RW | PG_V; + pmap_invalidate_all_int(kernel_pmap); /* XXX insurance for now */ + return (h); +} + +static void +__CONCAT(PMTYPE, bios16_leave)(void *arg) +{ + struct bios16_pmap_handle *h; + + h = arg; + *h->ptd = h->orig_ptd; /* remove page table */ + /* + * XXX only needs to be invlpg(0) but that doesn't work on the 386 + */ + pmap_invalidate_all_int(kernel_pmap); + free(h->pte, M_TEMP); /* ... and free it */ +} + +#define PMM(a) \ + .pm_##a = __CONCAT(PMTYPE, a), + +struct pmap_methods __CONCAT(PMTYPE, methods) = { + PMM(ksetrw) + PMM(remap_lower) + PMM(remap_lowptdi) + PMM(align_superpage) + PMM(quick_enter_page) + PMM(quick_remove_page) + PMM(trm_alloc) + PMM(trm_free) + PMM(get_map_low) + PMM(get_vm_maxuser_address) + PMM(kextract) + PMM(pg_frame) + PMM(sf_buf_map) + PMM(cp_slow0_map) + PMM(get_kcr3) + PMM(get_cr3) + PMM(cmap3) + PMM(basemem_setup) + PMM(set_nx) + PMM(bios16_enter) + PMM(bios16_leave) + PMM(bootstrap) + PMM(is_valid_memattr) + PMM(cache_bits) + PMM(ps_enabled) + PMM(pinit0) + PMM(pinit) + PMM(activate) + PMM(activate_boot) + PMM(advise) + PMM(clear_modify) + PMM(change_attr) + PMM(mincore) + PMM(copy) + PMM(copy_page) + PMM(copy_pages) + PMM(zero_page) + PMM(zero_page_area) + PMM(enter) + PMM(enter_object) + PMM(enter_quick) + PMM(kenter_temporary) + PMM(object_init_pt) + PMM(unwire) + PMM(page_exists_quick) + PMM(page_wired_mappings) + PMM(page_is_mapped) + PMM(remove_pages) + PMM(is_modified) + PMM(is_prefaultable) + PMM(is_referenced) + PMM(remove_write) + PMM(ts_referenced) + PMM(mapdev_attr) + PMM(unmapdev) + PMM(page_set_memattr) + PMM(extract) + PMM(extract_and_hold) + PMM(map) + PMM(qenter) + PMM(qremove) + PMM(release) + PMM(remove) + PMM(protect) + PMM(remove_all) + PMM(init) + PMM(init_pat) + PMM(growkernel) + PMM(invalidate_page) + PMM(invalidate_range) + PMM(invalidate_all) + PMM(invalidate_cache) + PMM(flush_page) + PMM(kenter) + PMM(kremove) +}; diff --git a/sys/i386/i386/pmap_base.c b/sys/i386/i386/pmap_base.c new file mode 100644 index 000000000000..5d1a5b06da9d --- /dev/null +++ b/sys/i386/i386/pmap_base.c @@ -0,0 +1,954 @@ +/*- + * SPDX-License-Identifier: BSD-4-Clause + * + * Copyright (c) 1991 Regents of the University of California. + * All rights reserved. + * Copyright (c) 1994 John S. Dyson + * All rights reserved. + * Copyright (c) 1994 David Greenman + * All rights reserved. + * Copyright (c) 2005-2010 Alan L. Cox + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department and William Jolitz of UUNET Technologies 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 + */ +/*- + * Copyright (c) 2003 Networks Associates Technology, Inc. + * All rights reserved. + * Copyright (c) 2018 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed for the FreeBSD Project by Jake Burkholder, + * Safeport Network Services, and Network Associates Laboratories, the + * Security Research Division of Network Associates, Inc. under + * DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA + * CHATS research program. + * + * Portions of this software were developed by + * Konstantin Belousov under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_apic.h" +#include "opt_cpu.h" +#include "opt_pmap.h" +#include "opt_smp.h" +#include "opt_vm.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef DEV_APIC +#include +#include +#include +#endif +#include + +static SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); + +#include +#include +#include +#include +#include + +vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss) */ +vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */ + +int unmapped_buf_allowed = 1; + +int pti; + +u_long physfree; /* phys addr of next free page */ +u_long vm86phystk; /* PA of vm86/bios stack */ +u_long vm86paddr; /* address of vm86 region */ +int vm86pa; /* phys addr of vm86 region */ +u_long KERNend; /* phys addr end of kernel (just after bss) */ +u_long KPTphys; /* phys addr of kernel page tables */ +caddr_t ptvmmap = 0; +vm_offset_t kernel_vm_end; + +int i386_pmap_VM_NFREEORDER; +int i386_pmap_VM_LEVEL_0_ORDER; +int i386_pmap_PDRSHIFT; + +int pat_works = 1; +SYSCTL_INT(_vm_pmap, OID_AUTO, pat_works, CTLFLAG_RD, + &pat_works, 1, + "Is page attribute table fully functional?"); + +int pg_ps_enabled = 1; +SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, + &pg_ps_enabled, 0, + "Are large page mappings enabled?"); + +int pv_entry_max = 0; +SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_max, CTLFLAG_RD, + &pv_entry_max, 0, + "Max number of PV entries"); + +int pv_entry_count = 0; +SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, + &pv_entry_count, 0, + "Current number of pv entries"); + +#ifndef PMAP_SHPGPERPROC +#define PMAP_SHPGPERPROC 200 +#endif + +int shpgperproc = PMAP_SHPGPERPROC; +SYSCTL_INT(_vm_pmap, OID_AUTO, shpgperproc, CTLFLAG_RD, + &shpgperproc, 0, + "Page share factor per proc"); + +static SYSCTL_NODE(_vm_pmap, OID_AUTO, pde, CTLFLAG_RD, 0, + "2/4MB page mapping counters"); + +u_long pmap_pde_demotions; +SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, demotions, CTLFLAG_RD, + &pmap_pde_demotions, 0, + "2/4MB page demotions"); + +u_long pmap_pde_mappings; +SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, mappings, CTLFLAG_RD, + &pmap_pde_mappings, 0, + "2/4MB page mappings"); + +u_long pmap_pde_p_failures; +SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, p_failures, CTLFLAG_RD, + &pmap_pde_p_failures, 0, + "2/4MB page promotion failures"); + +u_long pmap_pde_promotions; +SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, promotions, CTLFLAG_RD, + &pmap_pde_promotions, 0, + "2/4MB page promotions"); + +#ifdef SMP +int PMAP1changedcpu; +SYSCTL_INT(_debug, OID_AUTO, PMAP1changedcpu, CTLFLAG_RD, + &PMAP1changedcpu, 0, + "Number of times pmap_pte_quick changed CPU with same PMAP1"); +#endif + +int PMAP1changed; +SYSCTL_INT(_debug, OID_AUTO, PMAP1changed, CTLFLAG_RD, + &PMAP1changed, 0, + "Number of times pmap_pte_quick changed PMAP1"); +int PMAP1unchanged; +SYSCTL_INT(_debug, OID_AUTO, PMAP1unchanged, CTLFLAG_RD, + &PMAP1unchanged, 0, + "Number of times pmap_pte_quick didn't change PMAP1"); + +static int +kvm_size(SYSCTL_HANDLER_ARGS) +{ + unsigned long ksize; + + ksize = VM_MAX_KERNEL_ADDRESS - KERNBASE; + return (sysctl_handle_long(oidp, &ksize, 0, req)); +} +SYSCTL_PROC(_vm, OID_AUTO, kvm_size, CTLTYPE_LONG | CTLFLAG_RD | CTLFLAG_MPSAFE, + 0, 0, kvm_size, "IU", + "Size of KVM"); + +static int +kvm_free(SYSCTL_HANDLER_ARGS) +{ + unsigned long kfree; + + kfree = VM_MAX_KERNEL_ADDRESS - kernel_vm_end; + return (sysctl_handle_long(oidp, &kfree, 0, req)); +} +SYSCTL_PROC(_vm, OID_AUTO, kvm_free, CTLTYPE_LONG | CTLFLAG_RD | CTLFLAG_MPSAFE, + 0, 0, kvm_free, "IU", + "Amount of KVM free"); + +#ifdef PV_STATS +int pc_chunk_count, pc_chunk_allocs, pc_chunk_frees, pc_chunk_tryfail; +long pv_entry_frees, pv_entry_allocs; +int pv_entry_spare; + +SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_count, CTLFLAG_RD, + &pc_chunk_count, 0, + "Current number of pv entry chunks"); +SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_allocs, CTLFLAG_RD, + &pc_chunk_allocs, 0, + "Current number of pv entry chunks allocated"); +SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_frees, CTLFLAG_RD, + &pc_chunk_frees, 0, + "Current number of pv entry chunks frees"); +SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_tryfail, CTLFLAG_RD, + &pc_chunk_tryfail, 0, + "Number of times tried to get a chunk page but failed."); +SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_frees, CTLFLAG_RD, + &pv_entry_frees, 0, + "Current number of pv entry frees"); +SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_allocs, CTLFLAG_RD, + &pv_entry_allocs, 0, + "Current number of pv entry allocs"); +SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_spare, CTLFLAG_RD, + &pv_entry_spare, 0, + "Current number of spare pv entries"); +#endif + +struct pmap kernel_pmap_store; +static struct pmap_methods *pmap_methods_ptr; + +/* + * Initialize a vm_page's machine-dependent fields. + */ +void +pmap_page_init(vm_page_t m) +{ + + TAILQ_INIT(&m->md.pv_list); + m->md.pat_mode = PAT_WRITE_BACK; +} + +void +invltlb_glob(void) +{ + + invltlb(); +} + +static void pmap_invalidate_cache_range_selfsnoop(vm_offset_t sva, + vm_offset_t eva); +static void pmap_invalidate_cache_range_all(vm_offset_t sva, + vm_offset_t eva); + +void +pmap_flush_page(vm_page_t m) +{ + + pmap_methods_ptr->pm_flush_page(m); +} + +DEFINE_IFUNC(, void, pmap_invalidate_cache_range, (vm_offset_t, vm_offset_t), + static) +{ + + if ((cpu_feature & CPUID_SS) != 0) + return (pmap_invalidate_cache_range_selfsnoop); + if ((cpu_feature & CPUID_CLFSH) != 0) + return (pmap_force_invalidate_cache_range); + return (pmap_invalidate_cache_range_all); +} + +#define PMAP_CLFLUSH_THRESHOLD (2 * 1024 * 1024) + +static void +pmap_invalidate_cache_range_check_align(vm_offset_t sva, vm_offset_t eva) +{ + + KASSERT((sva & PAGE_MASK) == 0, + ("pmap_invalidate_cache_range: sva not page-aligned")); + KASSERT((eva & PAGE_MASK) == 0, + ("pmap_invalidate_cache_range: eva not page-aligned")); +} + +static void +pmap_invalidate_cache_range_selfsnoop(vm_offset_t sva, vm_offset_t eva) +{ + + pmap_invalidate_cache_range_check_align(sva, eva); +} + +void +pmap_force_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva) +{ + + sva &= ~(vm_offset_t)(cpu_clflush_line_size - 1); + if (eva - sva >= PMAP_CLFLUSH_THRESHOLD) { + /* + * The supplied range is bigger than 2MB. + * Globally invalidate cache. + */ + pmap_invalidate_cache(); + return; + } + +#ifdef DEV_APIC + /* + * XXX: Some CPUs fault, hang, or trash the local APIC + * registers if we use CLFLUSH on the local APIC + * range. The local APIC is always uncached, so we + * don't need to flush for that range anyway. + */ + if (pmap_kextract(sva) == lapic_paddr) + return; +#endif + + if ((cpu_stdext_feature & CPUID_STDEXT_CLFLUSHOPT) != 0) { + /* + * Do per-cache line flush. Use the sfence + * instruction to insure that previous stores are + * included in the write-back. The processor + * propagates flush to other processors in the cache + * coherence domain. + */ + sfence(); + for (; sva < eva; sva += cpu_clflush_line_size) + clflushopt(sva); + sfence(); + } else { + /* + * Writes are ordered by CLFLUSH on Intel CPUs. + */ + if (cpu_vendor_id != CPU_VENDOR_INTEL) + mfence(); + for (; sva < eva; sva += cpu_clflush_line_size) + clflush(sva); + if (cpu_vendor_id != CPU_VENDOR_INTEL) + mfence(); + } +} + +static void +pmap_invalidate_cache_range_all(vm_offset_t sva, vm_offset_t eva) +{ + + pmap_invalidate_cache_range_check_align(sva, eva); + pmap_invalidate_cache(); +} + +void +pmap_invalidate_cache_pages(vm_page_t *pages, int count) +{ + int i; + + if (count >= PMAP_CLFLUSH_THRESHOLD / PAGE_SIZE || + (cpu_feature & CPUID_CLFSH) == 0) { + pmap_invalidate_cache(); + } else { + for (i = 0; i < count; i++) + pmap_flush_page(pages[i]); + } +} + +void +pmap_ksetrw(vm_offset_t va) +{ + + pmap_methods_ptr->pm_ksetrw(va); +} + +void +pmap_remap_lower(bool enable) +{ + + pmap_methods_ptr->pm_remap_lower(enable); +} + +void +pmap_remap_lowptdi(bool enable) +{ + + pmap_methods_ptr->pm_remap_lowptdi(enable); +} + +void +pmap_align_superpage(vm_object_t object, vm_ooffset_t offset, + vm_offset_t *addr, vm_size_t size) +{ + + return (pmap_methods_ptr->pm_align_superpage(object, offset, + addr, size)); +} + +vm_offset_t +pmap_quick_enter_page(vm_page_t m) +{ + + return (pmap_methods_ptr->pm_quick_enter_page(m)); +} + +void +pmap_quick_remove_page(vm_offset_t addr) +{ + + return (pmap_methods_ptr->pm_quick_remove_page(addr)); +} + +void * +pmap_trm_alloc(size_t size, int flags) +{ + + return (pmap_methods_ptr->pm_trm_alloc(size, flags)); +} + +void +pmap_trm_free(void *addr, size_t size) +{ + + pmap_methods_ptr->pm_trm_free(addr, size); +} + +void +pmap_sync_icache(pmap_t pm, vm_offset_t va, vm_size_t sz) +{ +} + +vm_offset_t +pmap_get_map_low(void) +{ + + return (pmap_methods_ptr->pm_get_map_low()); +} + +vm_offset_t +pmap_get_vm_maxuser_address(void) +{ + + return (pmap_methods_ptr->pm_get_vm_maxuser_address()); +} + +vm_paddr_t +pmap_kextract(vm_offset_t va) +{ + + return (pmap_methods_ptr->pm_kextract(va)); +} + +vm_paddr_t +pmap_pg_frame(vm_paddr_t pa) +{ + + return (pmap_methods_ptr->pm_pg_frame(pa)); +} + +void +pmap_sf_buf_map(struct sf_buf *sf) +{ + + pmap_methods_ptr->pm_sf_buf_map(sf); +} + +void +pmap_cp_slow0_map(vm_offset_t kaddr, int plen, vm_page_t *ma) +{ + + pmap_methods_ptr->pm_cp_slow0_map(kaddr, plen, ma); +} + +u_int +pmap_get_kcr3(void) +{ + + return (pmap_methods_ptr->pm_get_kcr3()); +} + +u_int +pmap_get_cr3(pmap_t pmap) +{ + + return (pmap_methods_ptr->pm_get_cr3(pmap)); +} + +caddr_t +pmap_cmap3(vm_paddr_t pa, u_int pte_flags) +{ + + return (pmap_methods_ptr->pm_cmap3(pa, pte_flags)); +} + +void +pmap_basemem_setup(u_int basemem) +{ + + pmap_methods_ptr->pm_basemem_setup(basemem); +} + +void +pmap_set_nx(void) +{ + + pmap_methods_ptr->pm_set_nx(); +} + +void * +pmap_bios16_enter(void) +{ + + return (pmap_methods_ptr->pm_bios16_enter()); +} + +void +pmap_bios16_leave(void *handle) +{ + + pmap_methods_ptr->pm_bios16_leave(handle); +} + +void +pmap_bootstrap(vm_paddr_t firstaddr) +{ + + pmap_methods_ptr->pm_bootstrap(firstaddr); +} + +boolean_t +pmap_is_valid_memattr(pmap_t pmap, vm_memattr_t mode) +{ + + return (pmap_methods_ptr->pm_is_valid_memattr(pmap, mode)); +} + +int +pmap_cache_bits(pmap_t pmap, int mode, boolean_t is_pde) +{ + + return (pmap_methods_ptr->pm_cache_bits(pmap, mode, is_pde)); +} + +bool +pmap_ps_enabled(pmap_t pmap) +{ + + return (pmap_methods_ptr->pm_ps_enabled(pmap)); +} + +void +pmap_pinit0(pmap_t pmap) +{ + + pmap_methods_ptr->pm_pinit0(pmap); +} + +int +pmap_pinit(pmap_t pmap) +{ + + return (pmap_methods_ptr->pm_pinit(pmap)); +} + +void +pmap_activate(struct thread *td) +{ + + pmap_methods_ptr->pm_activate(td); +} + +void +pmap_activate_boot(pmap_t pmap) +{ + + pmap_methods_ptr->pm_activate_boot(pmap); +} + +void +pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, int advice) +{ + + pmap_methods_ptr->pm_advise(pmap, sva, eva, advice); +} + +void +pmap_clear_modify(vm_page_t m) +{ + + pmap_methods_ptr->pm_clear_modify(m); +} + +int +pmap_change_attr(vm_offset_t va, vm_size_t size, int mode) +{ + + return (pmap_methods_ptr->pm_change_attr(va, size, mode)); +} + +int +pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) +{ + + return (pmap_methods_ptr->pm_mincore(pmap, addr, locked_pa)); +} + +void +pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, + vm_offset_t src_addr) +{ + + pmap_methods_ptr->pm_copy(dst_pmap, src_pmap, dst_addr, len, src_addr); +} + +void +pmap_copy_page(vm_page_t src, vm_page_t dst) +{ + + pmap_methods_ptr->pm_copy_page(src, dst); +} + +void +pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], + vm_offset_t b_offset, int xfersize) +{ + + pmap_methods_ptr->pm_copy_pages(ma, a_offset, mb, b_offset, xfersize); +} + +void +pmap_zero_page(vm_page_t m) +{ + + pmap_methods_ptr->pm_zero_page(m); +} + +void +pmap_zero_page_area(vm_page_t m, int off, int size) +{ + + pmap_methods_ptr->pm_zero_page_area(m, off, size); +} + +int +pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, + u_int flags, int8_t psind) +{ + + return (pmap_methods_ptr->pm_enter(pmap, va, m, prot, flags, psind)); +} + +void +pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_offset_t end, + vm_page_t m_start, vm_prot_t prot) +{ + + pmap_methods_ptr->pm_enter_object(pmap, start, end, m_start, prot); +} + +void +pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot) +{ + + pmap_methods_ptr->pm_enter_quick(pmap, va, m, prot); +} + +void * +pmap_kenter_temporary(vm_paddr_t pa, int i) +{ + + return (pmap_methods_ptr->pm_kenter_temporary(pa, i)); +} + +void +pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, vm_object_t object, + vm_pindex_t pindex, vm_size_t size) +{ + + pmap_methods_ptr->pm_object_init_pt(pmap, addr, object, pindex, size); +} + +void +pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) +{ + + pmap_methods_ptr->pm_unwire(pmap, sva, eva); +} + +boolean_t +pmap_page_exists_quick(pmap_t pmap, vm_page_t m) +{ + + return (pmap_methods_ptr->pm_page_exists_quick(pmap, m)); +} + +int +pmap_page_wired_mappings(vm_page_t m) +{ + + return (pmap_methods_ptr->pm_page_wired_mappings(m)); +} + +boolean_t +pmap_page_is_mapped(vm_page_t m) +{ + + return (pmap_methods_ptr->pm_page_is_mapped(m)); +} + +void +pmap_remove_pages(pmap_t pmap) +{ + + pmap_methods_ptr->pm_remove_pages(pmap); +} + +boolean_t +pmap_is_modified(vm_page_t m) +{ + + return (pmap_methods_ptr->pm_is_modified(m)); +} + +boolean_t +pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr) +{ + + return (pmap_methods_ptr->pm_is_prefaultable(pmap, addr)); +} + +boolean_t +pmap_is_referenced(vm_page_t m) +{ + + return (pmap_methods_ptr->pm_is_referenced(m)); +} + +void +pmap_remove_write(vm_page_t m) +{ + + pmap_methods_ptr->pm_remove_write(m); +} + +int +pmap_ts_referenced(vm_page_t m) +{ + + return (pmap_methods_ptr->pm_ts_referenced(m)); +} + +void * +pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, int mode) +{ + + return (pmap_methods_ptr->pm_mapdev_attr(pa, size, mode)); +} + +void * +pmap_mapdev(vm_paddr_t pa, vm_size_t size) +{ + + return (pmap_methods_ptr->pm_mapdev_attr(pa, size, PAT_UNCACHEABLE)); +} + +void * +pmap_mapbios(vm_paddr_t pa, vm_size_t size) +{ + + return (pmap_methods_ptr->pm_mapdev_attr(pa, size, PAT_WRITE_BACK)); +} + +void +pmap_unmapdev(vm_offset_t va, vm_size_t size) +{ + + pmap_methods_ptr->pm_unmapdev(va, size); +} + +void +pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) +{ + + pmap_methods_ptr->pm_page_set_memattr(m, ma); +} + +vm_paddr_t +pmap_extract(pmap_t pmap, vm_offset_t va) +{ + + return (pmap_methods_ptr->pm_extract(pmap, va)); +} + +vm_page_t +pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot) +{ + + return (pmap_methods_ptr->pm_extract_and_hold(pmap, va, prot)); +} + +vm_offset_t +pmap_map(vm_offset_t *virt, vm_paddr_t start, vm_paddr_t end, int prot) +{ + + return (pmap_methods_ptr->pm_map(virt, start, end, prot)); +} + +void +pmap_qenter(vm_offset_t sva, vm_page_t *ma, int count) +{ + + pmap_methods_ptr->pm_qenter(sva, ma, count); +} + +void +pmap_qremove(vm_offset_t sva, int count) +{ + + pmap_methods_ptr->pm_qremove(sva, count); +} + +void +pmap_release(pmap_t pmap) +{ + + pmap_methods_ptr->pm_release(pmap); +} + +void +pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) +{ + + pmap_methods_ptr->pm_remove(pmap, sva, eva); +} + +void +pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) +{ + + pmap_methods_ptr->pm_protect(pmap, sva, eva, prot); +} + +void +pmap_remove_all(vm_page_t m) +{ + + pmap_methods_ptr->pm_remove_all(m); +} + +void +pmap_init(void) +{ + + pmap_methods_ptr->pm_init(); +} + +void +pmap_init_pat(void) +{ + + pmap_methods_ptr->pm_init_pat(); +} + +void +pmap_growkernel(vm_offset_t addr) +{ + + pmap_methods_ptr->pm_growkernel(addr); +} + +void +pmap_invalidate_page(pmap_t pmap, vm_offset_t va) +{ + + pmap_methods_ptr->pm_invalidate_page(pmap, va); +} + +void +pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) +{ + + pmap_methods_ptr->pm_invalidate_range(pmap, sva, eva); +} + +void +pmap_invalidate_all(pmap_t pmap) +{ + + pmap_methods_ptr->pm_invalidate_all(pmap); +} + +void +pmap_invalidate_cache(void) +{ + + pmap_methods_ptr->pm_invalidate_cache(); +} + +void +pmap_kenter(vm_offset_t va, vm_paddr_t pa) +{ + + pmap_methods_ptr->pm_kenter(va, pa); +} + +void +pmap_kremove(vm_offset_t va) +{ + + pmap_methods_ptr->pm_kremove(va); +} + +extern struct pmap_methods pmap_pae_methods, pmap_nopae_methods; +int pae_mode; +SYSCTL_INT(_vm_pmap, OID_AUTO, pae_mode, CTLFLAG_RD, + &pae_mode, 1, + "PAE"); + +void +pmap_cold(void) +{ + + if ((cpu_feature & CPUID_PAE) != 0) { + pae_mode = 1; + pmap_methods_ptr = &pmap_pae_methods; + pmap_pae_cold(); + } else { + pmap_methods_ptr = &pmap_nopae_methods; + pmap_nopae_cold(); + } +} diff --git a/sys/i386/i386/pmap_nopae.c b/sys/i386/i386/pmap_nopae.c new file mode 100644 index 000000000000..6ab9906190e5 --- /dev/null +++ b/sys/i386/i386/pmap_nopae.c @@ -0,0 +1,48 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_apic.h" +#include "opt_cpu.h" +#include "opt_pmap.h" +#include "opt_smp.h" +#include "opt_vm.h" + +#include +#include +#include +#define PMTYPE pmap_nopae_ +#include +#include +_Static_assert(sizeof(struct pmap_KBI) >= sizeof(struct pmap), "pmap KBI"); +#include "pmap.c" diff --git a/sys/i386/i386/pmap_pae.c b/sys/i386/i386/pmap_pae.c new file mode 100644 index 000000000000..f3872a33e5b7 --- /dev/null +++ b/sys/i386/i386/pmap_pae.c @@ -0,0 +1,49 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_apic.h" +#include "opt_cpu.h" +#include "opt_pmap.h" +#include "opt_smp.h" +#include "opt_vm.h" + +#define PMAP_PAE_COMP +#include +#include +#include +#define PMTYPE pmap_pae_ +#include +#include +_Static_assert(sizeof(struct pmap_KBI) >= sizeof(struct pmap), "pmap KBI"); +#include "pmap.c" diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index f260469e4eb9..6581450a0a9a 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -119,6 +119,7 @@ static void trap_fatal(struct trapframe *, vm_offset_t); void dblfault_handler(void); extern inthand_t IDTVEC(bpt), IDTVEC(dbg), IDTVEC(int0x80_syscall); +extern uint64_t pg_nx; #define MAX_TRAP_MSG 32 @@ -871,10 +872,8 @@ trap_pfault(struct trapframe *frame, int usermode, vm_offset_t eva) */ if (frame->tf_err & PGEX_W) ftype = VM_PROT_WRITE; -#if defined(PAE) || defined(PAE_TABLES) else if ((frame->tf_err & PGEX_I) && pg_nx != 0) ftype = VM_PROT_EXECUTE; -#endif else ftype = VM_PROT_READ; @@ -935,10 +934,8 @@ trap_fatal(frame, eva) printf("fault code = %s %s%s, %s\n", code & PGEX_U ? "user" : "supervisor", code & PGEX_W ? "write" : "read", -#if defined(PAE) || defined(PAE_TABLES) pg_nx != 0 ? (code & PGEX_I ? " instruction" : " data") : -#endif "", code & PGEX_RSV ? "reserved bits in PTE" : code & PGEX_P ? "protection violation" : "page not present"); diff --git a/sys/i386/i386/vm86.c b/sys/i386/i386/vm86.c index 778bbe3baec2..021ed5f246cc 100644 --- a/sys/i386/i386/vm86.c +++ b/sys/i386/i386/vm86.c @@ -397,8 +397,8 @@ vm86_emulate(struct vm86frame *vmf) (sizeof(struct pcb_ext) - sizeof(struct segment_descriptor) + \ INTMAP_SIZE + IOMAP_SIZE + 1) -struct vm86_layout { - pt_entry_t vml_pgtbl[PGTABLE_SIZE]; +struct vm86_layout_pae { + uint64_t vml_pgtbl[PGTABLE_SIZE]; struct pcb vml_pcb; struct pcb_ext vml_ext; char vml_intmap[INTMAP_SIZE]; @@ -406,12 +406,26 @@ struct vm86_layout { char vml_iomap_trailer; }; -void -vm86_initialize(void) +struct vm86_layout_nopae { + uint32_t vml_pgtbl[PGTABLE_SIZE]; + struct pcb vml_pcb; + struct pcb_ext vml_ext; + char vml_intmap[INTMAP_SIZE]; + char vml_iomap[IOMAP_SIZE]; + char vml_iomap_trailer; +}; + +_Static_assert(sizeof(struct vm86_layout_pae) <= ctob(3), + "struct vm86_layout_pae exceeds space allocated in locore.s"); +_Static_assert(sizeof(struct vm86_layout_nopae) <= ctob(3), + "struct vm86_layout_nopae exceeds space allocated in locore.s"); + +static void +vm86_initialize_pae(void) { int i; u_int *addr; - struct vm86_layout *vml = (struct vm86_layout *)vm86paddr; + struct vm86_layout_pae *vml; struct pcb *pcb; struct pcb_ext *ext; struct soft_segment_descriptor ssd = { @@ -425,12 +439,6 @@ vm86_initialize(void) 0 /* granularity */ }; - /* - * this should be a compile time error, but cpp doesn't grok sizeof(). - */ - if (sizeof(struct vm86_layout) > ctob(3)) - panic("struct vm86_layout exceeds space allocated in locore.s"); - /* * Below is the memory layout that we use for the vm86 region. * @@ -473,6 +481,7 @@ vm86_initialize(void) #define vm86_frame pcb_ebp #define pgtable_va pcb_ebx + vml = (struct vm86_layout_pae *)vm86paddr; pcb = &vml->vml_pcb; ext = &vml->vml_ext; @@ -482,13 +491,13 @@ vm86_initialize(void) pcb->new_ptd = vm86pa | PG_V | PG_RW | PG_U; pcb->vm86_frame = vm86paddr - sizeof(struct vm86frame); pcb->pgtable_va = vm86paddr; - pcb->pcb_flags = PCB_VM86CALL; + pcb->pcb_flags = PCB_VM86CALL; pcb->pcb_ext = ext; - bzero(ext, sizeof(struct pcb_ext)); + bzero(ext, sizeof(struct pcb_ext)); ext->ext_tss.tss_esp0 = vm86paddr; ext->ext_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL); - ext->ext_tss.tss_ioopt = + ext->ext_tss.tss_ioopt = ((u_int)vml->vml_iomap - (u_int)&ext->ext_tss) << 16; ext->ext_iomap = vml->vml_iomap; ext->ext_vm86.vm86_intmap = vml->vml_intmap; @@ -502,7 +511,7 @@ vm86_initialize(void) vml->vml_iomap_trailer = 0xff; ssd.ssd_base = (u_int)&ext->ext_tss; - ssd.ssd_limit = TSS_SIZE - 1; + ssd.ssd_limit = TSS_SIZE - 1; ssdtosd(&ssd, &ext->ext_tssd); vm86pcb = pcb; @@ -517,6 +526,80 @@ vm86_initialize(void) #endif } +static void +vm86_initialize_nopae(void) +{ + int i; + u_int *addr; + struct vm86_layout_nopae *vml; + struct pcb *pcb; + struct pcb_ext *ext; + struct soft_segment_descriptor ssd = { + 0, /* segment base address (overwritten) */ + 0, /* length (overwritten) */ + SDT_SYS386TSS, /* segment type */ + 0, /* priority level */ + 1, /* descriptor present */ + 0, 0, + 0, /* default 16 size */ + 0 /* granularity */ + }; + + vml = (struct vm86_layout_nopae *)vm86paddr; + pcb = &vml->vml_pcb; + ext = &vml->vml_ext; + + mtx_init(&vm86_lock, "vm86 lock", NULL, MTX_DEF); + + bzero(pcb, sizeof(struct pcb)); + pcb->new_ptd = vm86pa | PG_V | PG_RW | PG_U; + pcb->vm86_frame = vm86paddr - sizeof(struct vm86frame); + pcb->pgtable_va = vm86paddr; + pcb->pcb_flags = PCB_VM86CALL; + pcb->pcb_ext = ext; + + bzero(ext, sizeof(struct pcb_ext)); + ext->ext_tss.tss_esp0 = vm86paddr; + ext->ext_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL); + ext->ext_tss.tss_ioopt = + ((u_int)vml->vml_iomap - (u_int)&ext->ext_tss) << 16; + ext->ext_iomap = vml->vml_iomap; + ext->ext_vm86.vm86_intmap = vml->vml_intmap; + + if (cpu_feature & CPUID_VME) + ext->ext_vm86.vm86_has_vme = (rcr4() & CR4_VME ? 1 : 0); + + addr = (u_int *)ext->ext_vm86.vm86_intmap; + for (i = 0; i < (INTMAP_SIZE + IOMAP_SIZE) / sizeof(u_int); i++) + *addr++ = 0; + vml->vml_iomap_trailer = 0xff; + + ssd.ssd_base = (u_int)&ext->ext_tss; + ssd.ssd_limit = TSS_SIZE - 1; + ssdtosd(&ssd, &ext->ext_tssd); + + vm86pcb = pcb; + +#if 0 + /* + * use whatever is leftover of the vm86 page layout as a + * message buffer so we can capture early output. + */ + msgbufinit((vm_offset_t)vm86paddr + sizeof(struct vm86_layout), + ctob(3) - sizeof(struct vm86_layout)); +#endif +} + +void +vm86_initialize(void) +{ + + if (pae_mode) + vm86_initialize_pae(); + else + vm86_initialize_nopae(); +} + vm_offset_t vm86_getpage(struct vm86context *vmc, int pagenum) { @@ -644,19 +727,31 @@ vm86_intcall(int intnum, struct vm86frame *vmf) int vm86_datacall(int intnum, struct vm86frame *vmf, struct vm86context *vmc) { - pt_entry_t *pte; + uint64_t *pte_pae; + uint32_t *pte_nopae; int (*p)(struct vm86frame *); vm_paddr_t page; int i, entry, retval; - pte = (pt_entry_t *)vm86paddr; mtx_lock(&vm86_lock); - for (i = 0; i < vmc->npages; i++) { - page = vtophys(vmc->pmap[i].kva & PG_FRAME); - entry = vmc->pmap[i].pte_num; - vmc->pmap[i].old_pte = pte[entry]; - pte[entry] = page | PG_V | PG_RW | PG_U; - pmap_invalidate_page(kernel_pmap, vmc->pmap[i].kva); + if (pae_mode) { + pte_pae = (uint64_t *)vm86paddr; + for (i = 0; i < vmc->npages; i++) { + page = vtophys(vmc->pmap[i].kva & PG_FRAME_PAE); + entry = vmc->pmap[i].pte_num; + vmc->pmap[i].old_pte = pte_pae[entry]; + pte_pae[entry] = page | PG_V | PG_RW | PG_U; + pmap_invalidate_page(kernel_pmap, vmc->pmap[i].kva); + } + } else { + pte_nopae = (uint32_t *)vm86paddr; + for (i = 0; i < vmc->npages; i++) { + page = vtophys(vmc->pmap[i].kva & PG_FRAME_NOPAE); + entry = vmc->pmap[i].pte_num; + vmc->pmap[i].old_pte = pte_nopae[entry]; + pte_nopae[entry] = page | PG_V | PG_RW | PG_U; + pmap_invalidate_page(kernel_pmap, vmc->pmap[i].kva); + } } vmf->vmf_trapno = intnum; @@ -666,10 +761,18 @@ vm86_datacall(int intnum, struct vm86frame *vmf, struct vm86context *vmc) retval = p(vmf); critical_exit(); - for (i = 0; i < vmc->npages; i++) { - entry = vmc->pmap[i].pte_num; - pte[entry] = vmc->pmap[i].old_pte; - pmap_invalidate_page(kernel_pmap, vmc->pmap[i].kva); + if (pae_mode) { + for (i = 0; i < vmc->npages; i++) { + entry = vmc->pmap[i].pte_num; + pte_pae[entry] = vmc->pmap[i].old_pte; + pmap_invalidate_page(kernel_pmap, vmc->pmap[i].kva); + } + } else { + for (i = 0; i < vmc->npages; i++) { + entry = vmc->pmap[i].pte_num; + pte_nopae[entry] = vmc->pmap[i].old_pte; + pmap_invalidate_page(kernel_pmap, vmc->pmap[i].kva); + } } mtx_unlock(&vm86_lock); diff --git a/sys/i386/i386/vm86bios.s b/sys/i386/i386/vm86bios.s index 79079a63573e..26bebebdb0c6 100644 --- a/sys/i386/i386/vm86bios.s +++ b/sys/i386/i386/vm86bios.s @@ -101,8 +101,12 @@ ENTRY(vm86_bioscall) movl %cr3,%eax pushl %eax /* save address space */ - movl IdlePTD,%ecx /* va (and pa) of Idle PTD */ - movl %ecx,%ebx + cmpb $0,pae_mode + jne 2f + movl IdlePTD_nopae,%ecx /* va (and pa) of Idle PTD */ + jmp 3f +2: movl IdlePTD_pae,%ecx +3: movl %ecx,%ebx movl 0(%ebx),%eax pushl %eax /* old ptde != 0 when booting */ pushl %ebx /* keep for reuse */ @@ -112,10 +116,10 @@ ENTRY(vm86_bioscall) movl SCR_NEWPTD(%edx),%eax /* mapping for vm86 page table */ movl %eax,0(%ebx) /* ... install as PTD entry 0 */ -#if defined(PAE) || defined(PAE_TABLES) + cmpb $0,pae_mode + je 4f movl IdlePDPT,%ecx -#endif - movl %ecx,%cr3 /* new page tables */ +4: movl %ecx,%cr3 /* new page tables */ movl SCR_VMFRAME(%edx),%esp /* switch to new stack */ pushl %esp diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 250689459643..dd2557e57d8b 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -230,11 +230,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) * Set registers for trampoline to user mode. Leave space for the * return address on stack. These are the kernel mode register values. */ -#if defined(PAE) || defined(PAE_TABLES) - pcb2->pcb_cr3 = vtophys(vmspace_pmap(p2->p_vmspace)->pm_pdpt); -#else - pcb2->pcb_cr3 = vtophys(vmspace_pmap(p2->p_vmspace)->pm_pdir); -#endif + pcb2->pcb_cr3 = pmap_get_cr3(vmspace_pmap(p2->p_vmspace)); pcb2->pcb_edi = 0; pcb2->pcb_esi = (int)fork_return; /* fork_trampoline argument */ pcb2->pcb_ebp = 0; @@ -572,34 +568,10 @@ kvtop(void *addr) void sf_buf_map(struct sf_buf *sf, int flags) { - pt_entry_t opte, *ptep; - /* - * Update the sf_buf's virtual-to-physical mapping, flushing the - * virtual address from the TLB. Since the reference count for - * the sf_buf's old mapping was zero, that mapping is not - * currently in use. Consequently, there is no need to exchange - * the old and new PTEs atomically, even under PAE. - */ - ptep = vtopte(sf->kva); - opte = *ptep; - *ptep = VM_PAGE_TO_PHYS(sf->m) | PG_RW | PG_V | - pmap_cache_bits(kernel_pmap, sf->m->md.pat_mode, 0); - - /* - * Avoid unnecessary TLB invalidations: If the sf_buf's old - * virtual-to-physical mapping was not used, then any processor - * that has invalidated the sf_buf's virtual address from its TLB - * since the last used mapping need not invalidate again. - */ + pmap_sf_buf_map(sf); #ifdef SMP - if ((opte & (PG_V | PG_A)) == (PG_V | PG_A)) - CPU_ZERO(&sf->cpumask); - sf_buf_shootdown(sf, flags); -#else - if ((opte & (PG_V | PG_A)) == (PG_V | PG_A)) - pmap_invalidate_page(kernel_pmap, sf->kva); #endif } diff --git a/sys/i386/include/md_var.h b/sys/i386/include/md_var.h index 53e1861c8fff..b20446dce12b 100644 --- a/sys/i386/include/md_var.h +++ b/sys/i386/include/md_var.h @@ -69,6 +69,8 @@ void doreti_popl_fs_fault(void) __asm(__STRING(doreti_popl_fs_fault)); void fill_based_sd(struct segment_descriptor *sdp, uint32_t base); void i686_pagezero(void *addr); void sse2_pagezero(void *addr); +int minidumpsys_nopae(struct dumperinfo *); +int minidumpsys_pae(struct dumperinfo *); void init_AMD_Elan_sc520(void); vm_paddr_t kvtop(void *addr); void panicifcpuunsupported(void); diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h index 2033433ae271..7b1d05eebf15 100644 --- a/sys/i386/include/param.h +++ b/sys/i386/include/param.h @@ -88,25 +88,23 @@ #define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) #define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ -#define PAGE_SIZE (1< -#if defined(PAE) || defined(PAE_TABLES) - -typedef uint64_t pdpt_entry_t; -typedef uint64_t pd_entry_t; -typedef uint64_t pt_entry_t; - -#define PTESHIFT (3) -#define PDESHIFT (3) - -#else - -typedef uint32_t pd_entry_t; -typedef uint32_t pt_entry_t; - -#define PTESHIFT (2) -#define PDESHIFT (2) - -#endif - /* * Address of current address space page table maps and directories. */ #ifdef _KERNEL -#include - -extern pt_entry_t PTmap[]; -extern pd_entry_t PTD[]; -extern pd_entry_t PTDpde[]; - -#if defined(PAE) || defined(PAE_TABLES) -extern pdpt_entry_t *IdlePDPT; -#endif -extern pd_entry_t *IdlePTD; /* physical address of "Idle" state directory */ - -/* - * Translate a virtual address to the kernel virtual address of its page table - * entry (PTE). This can be used recursively. If the address of a PTE as - * previously returned by this macro is itself given as the argument, then the - * address of the page directory entry (PDE) that maps the PTE will be - * returned. - * - * This macro may be used before pmap_bootstrap() is called. - */ -#define vtopte(va) (PTmap + i386_btop(va)) /* * Translate a virtual address to its physical address. @@ -223,72 +149,10 @@ extern pd_entry_t *IdlePTD; /* physical address of "Idle" state directory */ */ #define vtophys(va) pmap_kextract((vm_offset_t)(va)) -/* - * KPTmap is a linear mapping of the kernel page table. It differs from the - * recursive mapping in two ways: (1) it only provides access to kernel page - * table pages, and not user page table pages, and (2) it provides access to - * a kernel page table page after the corresponding virtual addresses have - * been promoted to a 2/4MB page mapping. - * - * KPTmap is first initialized by pmap_cold() to support just NPKT page table - * pages. Later, it is reinitialized by pmap_bootstrap() to allow for - * expansion of the kernel page table. - */ -extern pt_entry_t *KPTmap; - -#if (defined(PAE) || defined(PAE_TABLES)) - -#define pde_cmpset(pdep, old, new) atomic_cmpset_64_i586(pdep, old, new) -#define pte_load_store(ptep, pte) atomic_swap_64_i586(ptep, pte) -#define pte_load_clear(ptep) atomic_swap_64_i586(ptep, 0) -#define pte_store(ptep, pte) atomic_store_rel_64_i586(ptep, pte) -#define pte_load(ptep) atomic_load_acq_64_i586(ptep) - -extern pt_entry_t pg_nx; - -#else /* !(PAE || PAE_TABLES) */ - -#define pde_cmpset(pdep, old, new) atomic_cmpset_int(pdep, old, new) -#define pte_load_store(ptep, pte) atomic_swap_int(ptep, pte) -#define pte_load_clear(ptep) atomic_swap_int(ptep, 0) -#define pte_store(ptep, pte) do { \ - *(u_int *)(ptep) = (u_int)(pte); \ -} while (0) -#define pte_load(ptep) atomic_load_acq_int(ptep) - -#endif /* !(PAE || PAE_TABLES) */ - #define pte_clear(ptep) pte_store(ptep, 0) #define pde_store(pdep, pde) pte_store(pdep, pde) -/* - * Extract from the kernel page table the physical address that is mapped by - * the given virtual address "va". - * - * This function may be used before pmap_bootstrap() is called. - */ -static __inline vm_paddr_t -pmap_kextract(vm_offset_t va) -{ - vm_paddr_t pa; - - if ((pa = pte_load(&PTD[va >> PDRSHIFT])) & PG_PS) { - pa = (pa & PG_PS_FRAME) | (va & PDRMASK); - } else { - /* - * Beware of a concurrent promotion that changes the PDE at - * this point! For example, vtopte() must not be used to - * access the PTE because it would use the new PDE. It is, - * however, safe to use the old PDE because the page table - * page is preserved by the promotion. - */ - pa = KPTmap[i386_btop(va)]; - pa = (pa & PG_FRAME) | (va & PAGE_MASK); - } - return (pa); -} - #endif /* _KERNEL */ /* @@ -302,20 +166,30 @@ struct md_page { int pat_mode; }; +#define PMAP_EXTERN_FIELDS \ + cpuset_t pm_active; /* active on cpus */ \ + struct mtx pm_mtx; \ + struct pmap_statistics pm_stats; /* pmap statistics */ + +struct pmap_KBI { + PMAP_EXTERN_FIELDS + int32_t pm_fill[32]; +}; + +#ifdef PMTYPE struct pmap { - struct mtx pm_mtx; + PMAP_EXTERN_FIELDS pd_entry_t *pm_pdir; /* KVA of page directory */ TAILQ_HEAD(,pv_chunk) pm_pvchunk; /* list of mappings in pmap */ - cpuset_t pm_active; /* active on cpus */ - struct pmap_statistics pm_stats; /* pmap statistics */ LIST_ENTRY(pmap) pm_list; /* List of all pmaps */ -#if defined(PAE) || defined(PAE_TABLES) pdpt_entry_t *pm_pdpt; /* KVA of page directory pointer table */ -#endif struct vm_radix pm_root; /* spare page table pages */ vm_page_t pm_ptdpg[NPGPTD]; }; +#else +#define pmap pmap_KBI +#endif typedef struct pmap *pmap_t; @@ -360,8 +234,6 @@ struct pv_chunk { #ifdef _KERNEL -extern caddr_t CADDR3; -extern pt_entry_t *CMAP3; extern vm_paddr_t phys_avail[]; extern vm_paddr_t dump_avail[]; extern char *ptvmmap; /* poor name! */ @@ -372,27 +244,45 @@ extern vm_offset_t virtual_end; #define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITEABLE) != 0) #define pmap_unmapbios(va, sz) pmap_unmapdev((va), (sz)) +struct sf_buf; + /* * Only the following functions or macros may be used before pmap_bootstrap() * is called: pmap_kenter(), pmap_kextract(), pmap_kremove(), vtophys(), and * vtopte(). */ void pmap_activate_boot(pmap_t pmap); +void pmap_basemem_setup(u_int basemem); +void *pmap_bios16_enter(void); +void pmap_bios16_leave(void *handle); void pmap_bootstrap(vm_paddr_t); int pmap_cache_bits(pmap_t, int mode, boolean_t is_pde); int pmap_change_attr(vm_offset_t, vm_size_t, int); +caddr_t pmap_cmap3(vm_paddr_t pa, u_int pte_bits); +void pmap_cp_slow0_map(vm_offset_t kaddr, int plen, vm_page_t *ma); +void pmap_flush_page(vm_page_t m); +u_int pmap_get_kcr3(void); +u_int pmap_get_cr3(pmap_t); +vm_offset_t pmap_get_map_low(void); +vm_offset_t pmap_get_vm_maxuser_address(void); void pmap_init_pat(void); void pmap_kenter(vm_offset_t va, vm_paddr_t pa); void *pmap_kenter_temporary(vm_paddr_t pa, int i); +vm_paddr_t pmap_kextract(vm_offset_t va); void pmap_kremove(vm_offset_t); +void pmap_ksetrw(vm_offset_t va); void *pmap_mapbios(vm_paddr_t, vm_size_t); void *pmap_mapdev(vm_paddr_t, vm_size_t); void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, int); boolean_t pmap_page_is_mapped(vm_page_t m); void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma); +vm_paddr_t pmap_pg_frame(vm_paddr_t pa); bool pmap_ps_enabled(pmap_t pmap); +void pmap_remap_lower(bool); +void pmap_remap_lowptdi(bool); +void pmap_set_nx(void); +void pmap_sf_buf_map(struct sf_buf *sf); void pmap_unmapdev(vm_offset_t, vm_size_t); -pt_entry_t *pmap_pte(pmap_t, vm_offset_t) __pure2; void pmap_invalidate_page(pmap_t, vm_offset_t); void pmap_invalidate_range(pmap_t, vm_offset_t, vm_offset_t); void pmap_invalidate_all(pmap_t); @@ -405,6 +295,13 @@ void pmap_trm_free(void *addr, size_t size); void invltlb_glob(void); +struct thread; + +extern int pae_mode; +extern int i386_pmap_VM_NFREEORDER; +extern int i386_pmap_VM_LEVEL_0_ORDER; +extern int i386_pmap_PDRSHIFT; + #endif /* _KERNEL */ #endif /* !LOCORE */ diff --git a/sys/i386/include/pmap_base.h b/sys/i386/include/pmap_base.h new file mode 100644 index 000000000000..9458549f9c8e --- /dev/null +++ b/sys/i386/include/pmap_base.h @@ -0,0 +1,124 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PMAP_BASE_H_ +#define _MACHINE_PMAP_BASE_H_ + +struct pmap_methods { + void (*pm_ksetrw)(vm_offset_t); + void (*pm_remap_lower)(bool); + void (*pm_remap_lowptdi)(bool); + void (*pm_align_superpage)(vm_object_t object, vm_ooffset_t offset, + vm_offset_t *addr, vm_size_t size); + vm_offset_t (*pm_quick_enter_page)(vm_page_t m); + void (*pm_quick_remove_page)(vm_offset_t addr); + void *(*pm_trm_alloc)(size_t size, int flags); + void (*pm_trm_free)(void *addr, size_t size); + vm_offset_t (*pm_get_map_low)(void); + vm_offset_t (*pm_get_vm_maxuser_address)(void); + vm_paddr_t (*pm_kextract)(vm_offset_t va); + vm_paddr_t (*pm_pg_frame)(vm_paddr_t pa); + void (*pm_sf_buf_map)(struct sf_buf *sf); + void (*pm_cp_slow0_map)(vm_offset_t kaddr, int plen, vm_page_t *ma); + u_int (*pm_get_kcr3)(void); + u_int (*pm_get_cr3)(pmap_t); + caddr_t (*pm_cmap3)(vm_paddr_t pa, u_int pte_flags); + void (*pm_basemem_setup)(u_int basemem); + void (*pm_set_nx)(void); + void *(*pm_bios16_enter)(void); + void (*pm_bios16_leave)(void *handle); + void (*pm_bootstrap)(vm_paddr_t firstaddr); + boolean_t (*pm_is_valid_memattr)(pmap_t, vm_memattr_t); + int (*pm_cache_bits)(pmap_t, int, boolean_t); + bool (*pm_ps_enabled)(pmap_t); + void (*pm_pinit0)(pmap_t); + int (*pm_pinit)(pmap_t); + void (*pm_activate)(struct thread *); + void (*pm_activate_boot)(pmap_t); + void (*pm_advise)(pmap_t, vm_offset_t, vm_offset_t, int); + void (*pm_clear_modify)(vm_page_t); + int (*pm_change_attr)(vm_offset_t, vm_size_t, int); + int (*pm_mincore)(pmap_t, vm_offset_t, vm_paddr_t *); + void (*pm_copy)(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t); + void (*pm_copy_page)(vm_page_t, vm_page_t); + void (*pm_copy_pages)(vm_page_t [], vm_offset_t, vm_page_t [], + vm_offset_t, int); + void (*pm_zero_page)(vm_page_t); + void (*pm_zero_page_area)(vm_page_t, int, int); + int (*pm_enter)(pmap_t, vm_offset_t, vm_page_t, vm_prot_t, u_int, + int8_t); + void (*pm_enter_object)(pmap_t, vm_offset_t, vm_offset_t, + vm_page_t, vm_prot_t); + void (*pm_enter_quick)(pmap_t, vm_offset_t, vm_page_t, vm_prot_t); + void *(*pm_kenter_temporary)(vm_paddr_t pa, int); + void (*pm_object_init_pt)(pmap_t, vm_offset_t, vm_object_t, + vm_pindex_t, vm_size_t); + void (*pm_unwire)(pmap_t, vm_offset_t, vm_offset_t); + boolean_t (*pm_page_exists_quick)(pmap_t, vm_page_t); + int (*pm_page_wired_mappings)(vm_page_t); + boolean_t (*pm_page_is_mapped)(vm_page_t); + void (*pm_remove_pages)(pmap_t); + boolean_t (*pm_is_modified)(vm_page_t); + boolean_t (*pm_is_prefaultable)(pmap_t, vm_offset_t); + boolean_t (*pm_is_referenced)(vm_page_t); + void (*pm_remove_write)(vm_page_t); + int (*pm_ts_referenced)(vm_page_t); + void *(*pm_mapdev_attr)(vm_paddr_t, vm_size_t, int); + void (*pm_unmapdev)(vm_offset_t, vm_size_t); + void (*pm_page_set_memattr)(vm_page_t, vm_memattr_t); + vm_paddr_t (*pm_extract)(pmap_t, vm_offset_t); + vm_page_t (*pm_extract_and_hold)(pmap_t, vm_offset_t, vm_prot_t); + vm_offset_t (*pm_map)(vm_offset_t *, vm_paddr_t, vm_paddr_t, int); + void (*pm_qenter)(vm_offset_t sva, vm_page_t *, int); + void (*pm_qremove)(vm_offset_t, int); + void (*pm_release)(pmap_t); + void (*pm_protect)(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t); + void (*pm_remove)(pmap_t, vm_offset_t, vm_offset_t); + void (*pm_remove_all)(vm_page_t); + void (*pm_init)(void); + void (*pm_init_pat)(void); + void (*pm_growkernel)(vm_offset_t); + void (*pm_invalidate_page)(pmap_t, vm_offset_t); + void (*pm_invalidate_range)(pmap_t, vm_offset_t, vm_offset_t); + void (*pm_invalidate_all)(pmap_t); + void (*pm_invalidate_cache)(void); + void (*pm_flush_page)(vm_page_t); + void (*pm_kenter)(vm_offset_t, vm_paddr_t); + void (*pm_kremove)(vm_offset_t); +}; + +void pmap_cold(void); +void pmap_pae_cold(void); +void pmap_nopae_cold(void); + +#endif diff --git a/sys/i386/include/pmap_nopae.h b/sys/i386/include/pmap_nopae.h new file mode 100644 index 000000000000..d35872fcdf6c --- /dev/null +++ b/sys/i386/include/pmap_nopae.h @@ -0,0 +1,100 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 1991 Regents of the University of California. + * All rights reserved. + * + * Copyright (c) 2018 The FreeBSD Foundation + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department and William Jolitz of UUNET Technologies Inc. + * + * Portions of this software were developed by + * Konstantin Belousov under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Derived from hp300 version by Mike Hibler, this version by William + * Jolitz uses a recursive map [a pde points to the page directory] to + * map the page tables using the pagetables themselves. This is done to + * reduce the impact on kernel virtual memory for lots of sparse address + * space, and to reduce the cost of memory to each process. + * + * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 + * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 + * $FreeBSD$ + */ + +#ifndef _MACHINE_PMAP_NOPAE_H +#define _MACHINE_PMAP_NOPAE_H + +#define NTRPPTD 1 +#define LOWPTDI 1 +#define KERNPTDI 2 + +#define NPGPTD 1 +#define NPGPTD_SHIFT 10 +#undef PDRSHIFT +#define PDRSHIFT PDRSHIFT_NOPAE +#undef NBPDR +#define NBPDR (1 << PDRSHIFT_NOPAE) /* bytes/page dir */ + +#define PG_FRAME PG_FRAME_NOPAE +#define PG_PS_FRAME PG_PS_FRAME_NOPAE + +#define KVA_PAGES (256*4) + +#ifndef NKPT +#define NKPT 30 +#endif + +typedef uint32_t pd_entry_t; +typedef uint32_t pt_entry_t; +typedef uint32_t pdpt_entry_t; /* Only to keep struct pmap layout. */ + +#define PTESHIFT (2) +#define PDESHIFT (2) + +#define pde_cmpset(pdep, old, new) atomic_cmpset_int(pdep, old, new) +#define pte_load_store(ptep, pte) atomic_swap_int(ptep, pte) +#define pte_load_clear(ptep) atomic_swap_int(ptep, 0) +#define pte_store(ptep, pte) do { \ + *(u_int *)(ptep) = (u_int)(pte); \ +} while (0) +#define pte_load(ptep) atomic_load_int(ptep) + +extern pt_entry_t PTmap[]; +extern pd_entry_t PTD[]; +extern pd_entry_t PTDpde[]; +extern pd_entry_t *IdlePTD_nopae; +extern pt_entry_t *KPTmap_nopae; + +struct pmap; +pt_entry_t *__CONCAT(PMTYPE, pmap_pte)(struct pmap *, vm_offset_t) __pure2; + +#endif diff --git a/sys/i386/include/pmap_pae.h b/sys/i386/include/pmap_pae.h new file mode 100644 index 000000000000..5bf229ca900e --- /dev/null +++ b/sys/i386/include/pmap_pae.h @@ -0,0 +1,123 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 1991 Regents of the University of California. + * All rights reserved. + * + * Copyright (c) 2018 The FreeBSD Foundation + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department and William Jolitz of UUNET Technologies Inc. + * + * Portions of this software were developed by + * Konstantin Belousov under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Derived from hp300 version by Mike Hibler, this version by William + * Jolitz uses a recursive map [a pde points to the page directory] to + * map the page tables using the pagetables themselves. This is done to + * reduce the impact on kernel virtual memory for lots of sparse address + * space, and to reduce the cost of memory to each process. + * + * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 + * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 + * $FreeBSD$ + */ + +#ifndef _MACHINE_PMAP_PAE_H +#define _MACHINE_PMAP_PAE_H + +#define NTRPPTD 2 /* Number of PTDs for trampoline + mapping */ +#define LOWPTDI 2 /* low memory map pde */ +#define KERNPTDI 4 /* start of kernel text pde */ + +#define NPGPTD 4 /* Num of pages for page directory */ +#define NPGPTD_SHIFT 9 +#undef PDRSHIFT +#define PDRSHIFT PDRSHIFT_PAE +#undef NBPDR +#define NBPDR (1 << PDRSHIFT_PAE) /* bytes/page dir */ + +#define PG_FRAME PG_FRAME_PAE +#define PG_PS_FRAME PG_PS_FRAME_PAE + +/* + * Size of Kernel address space. This is the number of page table pages + * (4MB each) to use for the kernel. 256 pages == 1 Gigabyte. + * This **MUST** be a multiple of 4 (eg: 252, 256, 260, etc). + * For PAE, the page table page unit size is 2MB. This means that 512 pages + * is 1 Gigabyte. Double everything. It must be a multiple of 8 for PAE. + */ +#define KVA_PAGES (512*4) + +/* + * The initial number of kernel page table pages that are constructed + * by pmap_cold() must be sufficient to map vm_page_array. That number can + * be calculated as follows: + * max_phys / PAGE_SIZE * sizeof(struct vm_page) / NBPDR + * PAE: max_phys 16G, sizeof(vm_page) 76, NBPDR 2M, 152 page table pages. + * PAE_TABLES: max_phys 4G, sizeof(vm_page) 68, NBPDR 2M, 36 page table pages. + * Non-PAE: max_phys 4G, sizeof(vm_page) 68, NBPDR 4M, 18 page table pages. + */ +#ifndef NKPT +#define NKPT 240 +#endif + +typedef uint64_t pdpt_entry_t; +typedef uint64_t pd_entry_t; +typedef uint64_t pt_entry_t; + +#define PTESHIFT (3) +#define PDESHIFT (3) + +#define pde_cmpset(pdep, old, new) atomic_cmpset_64_i586(pdep, old, new) +#define pte_load_store(ptep, pte) atomic_swap_64_i586(ptep, pte) +#define pte_load_clear(ptep) atomic_swap_64_i586(ptep, 0) +#define pte_store(ptep, pte) atomic_store_rel_64_i586(ptep, pte) +#define pte_load(ptep) atomic_load_acq_64_i586(ptep) + +extern pdpt_entry_t *IdlePDPT; +extern pt_entry_t pg_nx; +extern pd_entry_t *IdlePTD_pae; /* physical address of "Idle" state directory */ + +/* + * KPTmap is a linear mapping of the kernel page table. It differs from the + * recursive mapping in two ways: (1) it only provides access to kernel page + * table pages, and not user page table pages, and (2) it provides access to + * a kernel page table page after the corresponding virtual addresses have + * been promoted to a 2/4MB page mapping. + * + * KPTmap is first initialized by pmap_cold() to support just NPKT page table + * pages. Later, it is reinitialized by pmap_bootstrap() to allow for + * expansion of the kernel page table. + */ +extern pt_entry_t *KPTmap_pae; + +#endif diff --git a/sys/i386/include/vm86.h b/sys/i386/include/vm86.h index 42e8516c4274..ca71745fc074 100644 --- a/sys/i386/include/vm86.h +++ b/sys/i386/include/vm86.h @@ -111,7 +111,7 @@ struct vm86context { int flags; int pte_num; vm_offset_t kva; - u_int old_pte; + uint64_t old_pte; } pmap[VM86_PMAPSIZE]; }; diff --git a/sys/i386/include/vmparam.h b/sys/i386/include/vmparam.h index a21cd63d07ed..9ed4c21d3daa 100644 --- a/sys/i386/include/vmparam.h +++ b/sys/i386/include/vmparam.h @@ -95,25 +95,32 @@ #define VM_FREEPOOL_DIRECT 0 /* - * Create two free page lists: VM_FREELIST_DEFAULT is for physical - * pages that are above the largest physical address that is - * accessible by ISA DMA and VM_FREELIST_LOWMEM is for physical pages - * that are below that address. + * Create up to three free page lists: VM_FREELIST_DMA32 is for physical pages + * that have physical addresses below 4G but are not accessible by ISA DMA, + * and VM_FREELIST_ISADMA is for physical pages that are accessible by ISA + * DMA. */ -#define VM_NFREELIST 2 +#define VM_NFREELIST 3 #define VM_FREELIST_DEFAULT 0 -#define VM_FREELIST_LOWMEM 1 +#define VM_FREELIST_DMA32 1 +#define VM_FREELIST_LOWMEM 2 #define VM_LOWMEM_BOUNDARY (16 << 20) /* 16MB ISA DMA limit */ +/* + * Always create DMA32 freelist if there is any memory above 4G. + * Bounce dma is extremely fragile and simultaneously intensively + * used. + */ +#define VM_DMA32_NPAGES_THRESHOLD 1 + /* * The largest allocation size is 2MB under PAE and 4MB otherwise. */ -#ifdef PAE -#define VM_NFREEORDER 10 -#else -#define VM_NFREEORDER 11 -#endif +#define VM_NFREEORDER_PAE 10 +#define VM_NFREEORDER_NOPAE 11 +#define VM_NFREEORDER_MAX VM_NFREEORDER_NOPAE +#define VM_NFREEORDER i386_pmap_VM_NFREEORDER /* * Enable superpage reservations: 1 level. @@ -127,18 +134,19 @@ * used, and 1024 pages otherwise. */ #ifndef VM_LEVEL_0_ORDER -#if defined(PAE) || defined(PAE_TABLES) -#define VM_LEVEL_0_ORDER 9 +#define VM_LEVEL_0_ORDER_PAE 9 +#define VM_LEVEL_0_ORDER_NOPAE 10 +#define VM_LEVEL_0_ORDER_MAX VM_LEVEL_0_ORDER_NOPAE +#define VM_LEVEL_0_ORDER i386_pmap_VM_LEVEL_0_ORDER #else -#define VM_LEVEL_0_ORDER 10 -#endif +#define VM_LEVEL_0_ORDER_MAX VM_LEVEL_0_ORDER #endif /* * Kernel physical load address. */ #ifndef KERNLOAD -#define KERNLOAD (KERNPTDI << PDRSHIFT) +#define KERNLOAD (8 * 1024 * 1024) #endif /* !defined(KERNLOAD) */ /* @@ -148,7 +156,7 @@ * messy at times, but hey, we'll do anything to save a page :-) */ -#define VM_MAX_KERNEL_ADDRESS VADDR(PTDPTDI, 0) +#define VM_MAX_KERNEL_ADDRESS (0xffffffffU - 16 * 1024 * 1024 + 1) #define VM_MIN_KERNEL_ADDRESS 0 @@ -157,7 +165,7 @@ #define UPT_MAX_ADDRESS VADDR(PTDPTDI, PTDPTDI) #define UPT_MIN_ADDRESS VADDR(PTDPTDI, 0) -#define VM_MAXUSER_ADDRESS VADDR(TRPTDI, 0) +#define VM_MAXUSER_ADDRESS (0xffffffff - 4 * 1024 * 1024 + 1) #define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) #define USRSTACK SHAREDPAGE @@ -168,12 +176,13 @@ #define PMAP_TRM_MIN_ADDRESS VM_MAXUSER_ADDRESS #define PMAP_TRM_MAX_ADDRESS 0xffffffff -#define PMAP_MAP_LOW VADDR(LOWPTDI, 0) +#define PMAP_MAP_LOW (4 * 1024 * 1024) /* * KVA layout. The unit of the system allocation is single PDE, which * represents NBPDR bytes, aligned to NBPDR. NBPDR is 4M for non-PAE - * page tables, and 2M for PAE. Addresses below are shown for non-PAE. + * page tables, and 2M for PAE, so PAE mode requires twice as many PTDs + * to create the same memory map as non-PAE. * * 0x00000000 - 0x003fffff Transient identity map of low memory (0-4M), * normally disabled to catch NULL derefs. @@ -193,7 +202,7 @@ * How many physical pages per kmem arena virtual page. */ #ifndef VM_KMEM_SIZE_SCALE -#define VM_KMEM_SIZE_SCALE (3) +#define VM_KMEM_SIZE_SCALE (1) #endif /* diff --git a/sys/i386/pci/pci_cfgreg.c b/sys/i386/pci/pci_cfgreg.c index b58ec7544a18..3a3596d8bd27 100644 --- a/sys/i386/pci/pci_cfgreg.c +++ b/sys/i386/pci/pci_cfgreg.c @@ -490,15 +490,13 @@ pcie_cfgregopen(uint64_t base, uint8_t minbus, uint8_t maxbus) if (minbus != 0) return (0); -#ifndef PAE - if (base >= 0x100000000) { + if (!pae_mode && base >= 0x100000000) { if (bootverbose) printf( "PCI: Memory Mapped PCI configuration area base 0x%jx too high\n", (uintmax_t)base); return (0); } -#endif if (bootverbose) printf("PCIe: Memory Mapped configuration base @ 0x%jx\n", diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/x86/acpica/acpi_wakeup.c index 222fd4fb055b..29012d741405 100644 --- a/sys/x86/acpica/acpi_wakeup.c +++ b/sys/x86/acpica/acpi_wakeup.c @@ -194,8 +194,7 @@ acpi_wakeup_cpus(struct acpi_softc *sc) * cpususpend_handler() and we will release them soon. Then each * will invalidate its TLB. */ - PTD[KPTDI] = 0; - invltlb_glob(); + pmap_remap_lowptdi(false); #endif /* restore the warmstart vector */ @@ -277,7 +276,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) * be careful to use the kernel map (PTD[0] is for curthread * which may be a user thread in deprecated APIs). */ - PTD[KPTDI] = PTD[LOWPTDI]; + pmap_remap_lowptdi(true); #endif /* Call ACPICA to enter the desired sleep state */ @@ -449,12 +448,7 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) /* Save pointers to some global data. */ WAKECODE_FIXUP(wakeup_ret, void *, resumectx); #ifndef __amd64__ -#if defined(PAE) || defined(PAE_TABLES) - WAKECODE_FIXUP(wakeup_cr3, register_t, vtophys(kernel_pmap->pm_pdpt)); -#else - WAKECODE_FIXUP(wakeup_cr3, register_t, vtophys(kernel_pmap->pm_pdir)); -#endif - + WAKECODE_FIXUP(wakeup_cr3, register_t, pmap_get_kcr3()); #else /* __amd64__ */ /* Create the initial 1GB replicated page tables */ for (i = 0; i < 512; i++) { diff --git a/sys/x86/include/_types.h b/sys/x86/include/_types.h index 2c7301dd857f..68dd7eba6ce1 100644 --- a/sys/x86/include/_types.h +++ b/sys/x86/include/_types.h @@ -135,11 +135,7 @@ typedef __uint64_t __vm_size_t; #else typedef __uint32_t __u_register_t; typedef __uint32_t __vm_offset_t; -#ifdef PAE typedef __uint64_t __vm_paddr_t; -#else -typedef __uint32_t __vm_paddr_t; -#endif typedef __uint32_t __vm_size_t; #endif typedef int ___wchar_t; diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h index 8f53b41fd197..1b1b3ebd6055 100644 --- a/sys/x86/include/x86_var.h +++ b/sys/x86/include/x86_var.h @@ -102,23 +102,10 @@ struct trapframe; */ typedef void alias_for_inthand_t(void); -/* - * Returns the maximum physical address that can be used with the - * current system. - */ -static __inline vm_paddr_t -cpu_getmaxphyaddr(void) -{ -#if defined(__i386__) && !defined(PAE) - return (0xffffffff); -#else - return ((1ULL << cpu_maxphyaddr) - 1); -#endif -} - bool acpi_get_fadt_bootflags(uint16_t *flagsp); void *alloc_fpusave(int flags); void busdma_swi(void); +vm_paddr_t cpu_getmaxphyaddr(void); bool cpu_mwait_usable(void); void cpu_probe_amdc1e(void); void cpu_setregs(void); diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c index ec408c88b385..b46f7cdcd630 100644 --- a/sys/x86/x86/identcpu.c +++ b/sys/x86/x86/identcpu.c @@ -53,6 +53,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include #include #include @@ -2533,3 +2536,18 @@ print_hypervisor_info(void) if (*hv_vendor) printf("Hypervisor: Origin = \"%s\"\n", hv_vendor); } + +/* + * Returns the maximum physical address that can be used with the + * current system. + */ +vm_paddr_t +cpu_getmaxphyaddr(void) +{ + +#if defined(__i386__) + if (!pae_mode) + return (0xffffffff); +#endif + return ((1ULL << cpu_maxphyaddr) - 1); +} From 3496224a96d23ba5784ddec6db48bf9c00aa59ce Mon Sep 17 00:00:00 2001 From: Navdeep Parhar Date: Wed, 30 Jan 2019 05:39:47 +0000 Subject: [PATCH 142/142] cxgbe/iw_cxgbe: Fix an address calculation in the memory registration code that was added in r342266. Submitted by: Krishnamraju Eraparaju @ Chelsio Sponsored by: Chelsio Communications --- sys/dev/cxgbe/iw_cxgbe/mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/iw_cxgbe/mem.c b/sys/dev/cxgbe/iw_cxgbe/mem.c index 7eb3b975d0e2..eee2bc0f7c18 100644 --- a/sys/dev/cxgbe/iw_cxgbe/mem.c +++ b/sys/dev/cxgbe/iw_cxgbe/mem.c @@ -207,7 +207,7 @@ _c4iw_write_mem_dma(struct c4iw_rdev *rdev, u32 addr, u32 len, void *data) if (ret) goto out; addr += dmalen >> 5; - data = (u64 *)data + dmalen; + data = (u8 *)data + dmalen; daddr = daddr + dmalen; } if (remain)