svn commit: r295609 - head/sys/dev/xen/blkfront
Author: cperciva Date: Sun Feb 14 13:42:16 2016 New Revision: 295609 URL: https://svnweb.freebsd.org/changeset/base/295609 Log: Don't dereference a pointer immediately after determining that it is equal to NULL. [1] While I'm here, s/xb/xbd/ (the name changed a long time ago but this instance wasn't corrected). Reported by: PVS-Studio [1] Modified: head/sys/dev/xen/blkfront/blkfront.c Modified: head/sys/dev/xen/blkfront/blkfront.c == --- head/sys/dev/xen/blkfront/blkfront.cSun Feb 14 07:20:07 2016 (r295608) +++ head/sys/dev/xen/blkfront/blkfront.cSun Feb 14 13:42:16 2016 (r295609) @@ -674,7 +674,7 @@ xbd_open(struct disk *dp) struct xbd_softc *sc = dp->d_drv1; if (sc == NULL) { - printf("xb%d: not found", sc->xbd_unit); + printf("xbd%d: not found", dp->d_unit); return (ENXIO); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r295610 - head/usr.bin/hexdump
Author: kevlo Date: Sun Feb 14 14:23:56 2016 New Revision: 295610 URL: https://svnweb.freebsd.org/changeset/base/295610 Log: Fix a bug that caused nothing to be skipped when skipping exactly the number of bytes present in a regular file was requested. Obtained from:OpenBSD Modified: head/usr.bin/hexdump/display.c Modified: head/usr.bin/hexdump/display.c == --- head/usr.bin/hexdump/display.c Sun Feb 14 13:42:16 2016 (r295609) +++ head/usr.bin/hexdump/display.c Sun Feb 14 14:23:56 2016 (r295610) @@ -374,7 +374,7 @@ doskip(const char *fname, int statok) if (statok) { if (fstat(fileno(stdin), &sb)) err(1, "%s", fname); - if (S_ISREG(sb.st_mode) && skip >= sb.st_size) { + if (S_ISREG(sb.st_mode) && skip > sb.st_size) { address += sb.st_size; skip -= sb.st_size; return; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r295607 - head/sys/dev/usb/wlan
uhm, why'd you not just file a separate pr for this? 8 keys limits how many stations it can support in hostap mode :( I'd rather the bitmap management code gets fixed. -a On 13 February 2016 at 23:16, Hans Petter Selasky wrote: > Author: hselasky > Date: Sun Feb 14 07:16:36 2016 > New Revision: 295607 > URL: https://svnweb.freebsd.org/changeset/base/295607 > > Log: > Reduce the number of supported WLAN keys in the rum driver, else we > risk bit shifting overflows. Found by D5245 / PVS. > > MFC after:1 week > > Modified: > head/sys/dev/usb/wlan/if_rum.c > head/sys/dev/usb/wlan/if_rumreg.h > > Modified: head/sys/dev/usb/wlan/if_rum.c > == > --- head/sys/dev/usb/wlan/if_rum.c Sun Feb 14 02:28:59 2016 > (r295606) > +++ head/sys/dev/usb/wlan/if_rum.c Sun Feb 14 07:16:36 2016 > (r295607) > @@ -2732,7 +2732,7 @@ rum_pair_key_del_cb(struct rum_softc *sc > DPRINTF("%s: removing key %d\n", __func__, k->wk_keyix); > rum_clrbits(sc, (k->wk_keyix < 32) ? RT2573_SEC_CSR2 : > RT2573_SEC_CSR3, > 1 << (k->wk_keyix % 32)); > - sc->keys_bmap &= ~(1 << k->wk_keyix); > + sc->keys_bmap &= ~(1ULL << k->wk_keyix); > if (--sc->vap_key_count[rvp_id] == 0) > rum_clrbits(sc, RT2573_SEC_CSR4, 1 << rvp_id); > } > @@ -2749,8 +2749,8 @@ rum_key_alloc(struct ieee80211vap *vap, > if (!(k->wk_flags & IEEE80211_KEY_SWCRYPT)) { > RUM_LOCK(sc); > for (i = 0; i < RT2573_ADDR_MAX; i++) { > - if ((sc->keys_bmap & (1 << i)) == 0) { > - sc->keys_bmap |= 1 << i; > + if ((sc->keys_bmap & (1ULL << i)) == 0) { > + sc->keys_bmap |= (1ULL << i); > *keyix = i; > break; > } > > Modified: head/sys/dev/usb/wlan/if_rumreg.h > == > --- head/sys/dev/usb/wlan/if_rumreg.h Sun Feb 14 02:28:59 2016 > (r295606) > +++ head/sys/dev/usb/wlan/if_rumreg.h Sun Feb 14 07:16:36 2016 > (r295607) > @@ -47,7 +47,7 @@ > * H/w encryption/decryption support > */ > #define KEY_SIZE (IEEE80211_KEYBUF_SIZE + > IEEE80211_MICBUF_SIZE) > -#define RT2573_ADDR_MAX 64 > +#define RT2573_ADDR_MAX (32 / RT2573_SKEY_MAX) > #define RT2573_SKEY_MAX4 > > #define RT2573_SKEY(vap, kidx) (0x1000 + ((vap) * RT2573_SKEY_MAX + \ > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r295607 - head/sys/dev/usb/wlan
On 02/14/16 16:23, Adrian Chadd wrote: uhm, why'd you not just file a separate pr for this? 8 keys limits how many stations it can support in hostap mode :( I'd rather the bitmap management code gets fixed. Hi, From what I can see 8 keys is the maximum due to the following shift: /* Set cipher mode. */ if (rum_modbits(sc, rvp_id < 2 ? RT2573_SEC_CSR1 : RT2573_SEC_CSR5, mode << (rvp_id % 2 + k->wk_keyix) * RT2573_SKEY_MAX, RT2573_MODE_MASK << (rvp_id % 2 + k->wk_keyix) * RT2573_SKEY_MAX) != 0) goto print_err; It is only about bitmanagement, but about where to actually write those bits. Feel free to fix it. --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r295607 - head/sys/dev/usb/wlan
On 02/14/16 16:39, Hans Petter Selasky wrote: It is only about bitmanagement, ^ not --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r295607 - head/sys/dev/usb/wlan
Sun, 14 Feb 2016 17:39:32 +0200 було написано Hans Petter Selasky : This does not related to pairwise keys management: static void rum_group_key_set_cb(struct rum_softc *sc, union sec_param *data, uint8_t rvp_id) { ... /* Set cipher mode. */ if (rum_modbits(sc, rvp_id < 2 ? RT2573_SEC_CSR1 : RT2573_SEC_CSR5, mode << (rvp_id % 2 + k->wk_keyix) * RT2573_SKEY_MAX, RT2573_MODE_MASK << (rvp_id % 2 + k->wk_keyix) * RT2573_SKEY_MAX) != 0) goto print_err; ... } For group keys, k->wk_keyix is assigned in another way: static int rum_key_alloc(struct ieee80211vap *vap, struct ieee80211_key *k, ieee80211_keyix *keyix, ieee80211_keyix *rxkeyix) { ... *keyix = k - vap->iv_nw_keys; } ... } On 02/14/16 16:23, Adrian Chadd wrote: uhm, why'd you not just file a separate pr for this? 8 keys limits how many stations it can support in hostap mode :( I'd rather the bitmap management code gets fixed. Hi, From what I can see 8 keys is the maximum due to the following shift: /* Set cipher mode. */ if (rum_modbits(sc, rvp_id < 2 ? RT2573_SEC_CSR1 : RT2573_SEC_CSR5, mode << (rvp_id % 2 + k->wk_keyix) * RT2573_SKEY_MAX, RT2573_MODE_MASK << (rvp_id % 2 + k->wk_keyix) * RT2573_SKEY_MAX) != 0) goto print_err; It is only about bitmanagement, but about where to actually write those bits. Feel free to fix it. --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r295607 - head/sys/dev/usb/wlan
On 02/14/16 16:42, Andriy Voskoboinyk wrote: Sun, 14 Feb 2016 17:39:32 +0200 було написано Hans Petter Selasky : This does not related to pairwise keys management: static void rum_group_key_set_cb(struct rum_softc *sc, union sec_param *data, uint8_t rvp_id) { ... Then the if_rumreg.h part of the patch was not needed. Do you want me to fix it? --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r295607 - head/sys/dev/usb/wlan
Sun, 14 Feb 2016 09:16:36 +0200 було написано Hans Petter Selasky : Author: hselasky Date: Sun Feb 14 07:16:36 2016 New Revision: 295607 URL: https://svnweb.freebsd.org/changeset/base/295607 Log: Reduce the number of supported WLAN keys in the rum driver, else we risk bit shifting overflows. Found by D5245 / PVS. MFC after: 1 week Hardware crypto support was never merged (so, there is nothing to MFC). Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h Modified: head/sys/dev/usb/wlan/if_rum.c == --- head/sys/dev/usb/wlan/if_rum.c Sun Feb 14 02:28:59 2016 (r295606) +++ head/sys/dev/usb/wlan/if_rum.c Sun Feb 14 07:16:36 2016 (r295607) ... --- skipped --- ... Modified: head/sys/dev/usb/wlan/if_rumreg.h == --- head/sys/dev/usb/wlan/if_rumreg.h Sun Feb 14 02:28:59 2016 (r295606) +++ head/sys/dev/usb/wlan/if_rumreg.h Sun Feb 14 07:16:36 2016 (r295607) @@ -47,7 +47,7 @@ * H/w encryption/decryption support */ #define KEY_SIZE (IEEE80211_KEYBUF_SIZE + IEEE80211_MICBUF_SIZE) -#define RT2573_ADDR_MAX 64 +#define RT2573_ADDR_MAX (32 / RT2573_SKEY_MAX) #define RT2573_SKEY_MAX4 #define RT2573_SKEY(vap, kidx) (0x1000 + ((vap) * RT2573_SKEY_MAX + \ Reason of this change? (device table has 64 entries, not 8). I have not seen any overflows, caused by it: 1) vap->iv_key_set = rum_key_set; vap->iv_key_delete = rum_key_delete; vap->iv_update_beacon = rum_update_beacon; vap->iv_max_aid = RT2573_ADDR_MAX; // not the case usb_callout_init_mtx(&rvp->ratectl_ch, &sc->sc_mtx, 0); TASK_INIT(&rvp->ratectl_task, 0, rum_ratectl_task, rvp); 2) k < &vap->iv_nw_keys[IEEE80211_WEP_NKID])) { if (!(k->wk_flags & IEEE80211_KEY_SWCRYPT)) { RUM_LOCK(sc); for (i = 0; i < RT2573_ADDR_MAX; i++) { // can hold [0;63] without any overflows; // keys_bmap is 64-bit, so there is no overflow too if ((sc->keys_bmap & (1ULL << i)) == 0) { sc->keys_bmap |= 1ULL << i; *keyix = i; 3) } } RUM_UNLOCK(sc); if (i == RT2573_ADDR_MAX) {// like the first case device_printf(sc->sc_dev, "%s: no free space in the key table\n", __func__); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r295607 - head/sys/dev/usb/wlan
On 02/14/16 16:13, Andriy Voskoboinyk wrote: Sun, 14 Feb 2016 09:16:36 +0200 було написано Hans Petter Selasky : Author: hselasky Date: Sun Feb 14 07:16:36 2016 New Revision: 295607 URL: https://svnweb.freebsd.org/changeset/base/295607 Log: Reduce the number of supported WLAN keys in the rum driver, else we risk bit shifting overflows. Found by D5245 / PVS. MFC after:1 week Hardware crypto support was never merged (so, there is nothing to MFC). OK. Modified: head/sys/dev/usb/wlan/if_rumreg.h == --- head/sys/dev/usb/wlan/if_rumreg.hSun Feb 14 02:28:59 2016 (r295606) +++ head/sys/dev/usb/wlan/if_rumreg.hSun Feb 14 07:16:36 2016 (r295607) @@ -47,7 +47,7 @@ * H/w encryption/decryption support */ #define KEY_SIZE(IEEE80211_KEYBUF_SIZE + IEEE80211_MICBUF_SIZE) -#define RT2573_ADDR_MAX 64 +#define RT2573_ADDR_MAX (32 / RT2573_SKEY_MAX) #define RT2573_SKEY_MAX4 #define RT2573_SKEY(vap, kidx)(0x1000 + ((vap) * RT2573_SKEY_MAX + \ Reason of this change? (device table has 64 entries, not 8). I have not seen any overflows, caused by it: You're right. 1) vap->iv_key_set = rum_key_set; vap->iv_key_delete = rum_key_delete; vap->iv_update_beacon = rum_update_beacon; vap->iv_max_aid = RT2573_ADDR_MAX;// not the case usb_callout_init_mtx(&rvp->ratectl_ch, &sc->sc_mtx, 0); TASK_INIT(&rvp->ratectl_task, 0, rum_ratectl_task, rvp); 2) k < &vap->iv_nw_keys[IEEE80211_WEP_NKID])) { if (!(k->wk_flags & IEEE80211_KEY_SWCRYPT)) { RUM_LOCK(sc); for (i = 0; i < RT2573_ADDR_MAX; i++) { // can hold [0;63] without any overflows; // keys_bmap is 64-bit, so there is no overflow too if ((sc->keys_bmap & (1ULL << i)) == 0) { sc->keys_bmap |= 1ULL << i; *keyix = i; 3) } I'll revert the header file change shortly. Then we're up to date. --HPS ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r295611 - head/sys/dev/usb/wlan
Author: hselasky Date: Sun Feb 14 16:18:39 2016 New Revision: 295611 URL: https://svnweb.freebsd.org/changeset/base/295611 Log: Restore maximum number of host keys to 64. Discussed with: adrian @ and avos @ Modified: head/sys/dev/usb/wlan/if_rumreg.h Modified: head/sys/dev/usb/wlan/if_rumreg.h == --- head/sys/dev/usb/wlan/if_rumreg.h Sun Feb 14 14:23:56 2016 (r295610) +++ head/sys/dev/usb/wlan/if_rumreg.h Sun Feb 14 16:18:39 2016 (r295611) @@ -47,7 +47,7 @@ * H/w encryption/decryption support */ #define KEY_SIZE (IEEE80211_KEYBUF_SIZE + IEEE80211_MICBUF_SIZE) -#define RT2573_ADDR_MAX (32 / RT2573_SKEY_MAX) +#define RT2573_ADDR_MAX64 #define RT2573_SKEY_MAX4 #define RT2573_SKEY(vap, kidx) (0x1000 + ((vap) * RT2573_SKEY_MAX + \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r295612 - head/sys/arm/mv
Author: andrew Date: Sun Feb 14 16:38:32 2016 New Revision: 295612 URL: https://svnweb.freebsd.org/changeset/base/295612 Log: Remove an unused include. Modified: head/sys/arm/mv/twsi.c Modified: head/sys/arm/mv/twsi.c == --- head/sys/arm/mv/twsi.c Sun Feb 14 16:18:39 2016(r295611) +++ head/sys/arm/mv/twsi.c Sun Feb 14 16:38:32 2016(r295612) @@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include "iicbus_if.h" ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r295607 - head/sys/dev/usb/wlan
Sun, 14 Feb 2016 18:19:02 +0200 було написано Hans Petter Selasky : On 02/14/16 16:13, Andriy Voskoboinyk wrote: Sun, 14 Feb 2016 09:16:36 +0200 було написано Hans Petter Selasky : Author: hselasky Date: Sun Feb 14 07:16:36 2016 New Revision: 295607 URL: https://svnweb.freebsd.org/changeset/base/295607 Log: Reduce the number of supported WLAN keys in the rum driver, else we risk bit shifting overflows. Found by D5245 / PVS. MFC after:1 week Hardware crypto support was never merged (so, there is nothing to MFC). OK. Modified: head/sys/dev/usb/wlan/if_rumreg.h == --- head/sys/dev/usb/wlan/if_rumreg.hSun Feb 14 02:28:59 2016 (r295606) +++ head/sys/dev/usb/wlan/if_rumreg.hSun Feb 14 07:16:36 2016 (r295607) @@ -47,7 +47,7 @@ * H/w encryption/decryption support */ #define KEY_SIZE(IEEE80211_KEYBUF_SIZE + IEEE80211_MICBUF_SIZE) -#define RT2573_ADDR_MAX 64 +#define RT2573_ADDR_MAX (32 / RT2573_SKEY_MAX) #define RT2573_SKEY_MAX4 #define RT2573_SKEY(vap, kidx)(0x1000 + ((vap) * RT2573_SKEY_MAX + \ Reason of this change? (device table has 64 entries, not 8). I have not seen any overflows, caused by it: You're right. 1) vap->iv_key_set = rum_key_set; vap->iv_key_delete = rum_key_delete; vap->iv_update_beacon = rum_update_beacon; vap->iv_max_aid = RT2573_ADDR_MAX;// not the case usb_callout_init_mtx(&rvp->ratectl_ch, &sc->sc_mtx, 0); TASK_INIT(&rvp->ratectl_task, 0, rum_ratectl_task, rvp); 2) k < &vap->iv_nw_keys[IEEE80211_WEP_NKID])) { if (!(k->wk_flags & IEEE80211_KEY_SWCRYPT)) { RUM_LOCK(sc); for (i = 0; i < RT2573_ADDR_MAX; i++) { // can hold [0;63] without any overflows; // keys_bmap is 64-bit, so there is no overflow too if ((sc->keys_bmap & (1ULL << i)) == 0) { sc->keys_bmap |= 1ULL << i; *keyix = i; 3) } I'll revert the header file change shortly. Then we're up to date. --HPS Thanks! ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r295616 - head/sys/fs/ext2fs
Author: pfg Date: Sun Feb 14 19:52:50 2016 New Revision: 295616 URL: https://svnweb.freebsd.org/changeset/base/295616 Log: ext2fs: Remove panics for rename() race conditions. Sync with r84642 from UFS: The panics are inappropriate because the IN_RENAME flag only fixes a few of the huge number of race conditions that can result in the source path becoming invalid even prior to the VOP_RENAME() call. Found accidentally while checking an issue from PVS Static Analysis. MFC after:3 days Modified: head/sys/fs/ext2fs/ext2_vnops.c Modified: head/sys/fs/ext2fs/ext2_vnops.c == --- head/sys/fs/ext2fs/ext2_vnops.c Sun Feb 14 18:57:40 2016 (r295615) +++ head/sys/fs/ext2fs/ext2_vnops.c Sun Feb 14 19:52:50 2016 (r295616) @@ -985,10 +985,10 @@ abortit: dp = VTOI(fdvp); } else { /* -* From name has disappeared. +* From name has disappeared. IN_RENAME is not sufficient +* to protect against directory races due to timing windows, +* so we can't panic here. */ - if (doingdirectory) - panic("ext2_rename: lost dir entry"); vrele(ap->a_fvp); return (0); } @@ -1003,8 +1003,11 @@ abortit: * rename. */ if (xp != ip) { - if (doingdirectory) - panic("ext2_rename: lost dir entry"); + /* +* From name resolves to a different inode. IN_RENAME is +* not sufficient protection against timing window races +* so we can't panic here. +*/ } else { /* * If the source is a directory with a ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r295618 - head/sys/dev/ntb/ntb_hw
Author: cem Date: Sun Feb 14 22:37:28 2016 New Revision: 295618 URL: https://svnweb.freebsd.org/changeset/base/295618 Log: NTB: workaround for high traffic hardware hang This patch comes from Dave Jiang's Linux tree, davejiang/ntb. It hasn't been accepted into Linus' tree, so I do not have an authoritative SHA1 to point at. Original commit log: = A hardware errata causes the NTB to hang when heavy bi-directional traffic in addition to the usage of BAR0/1 (where the registers reside, including the doorbell registers to trigger interrupts). This workaround is only available on Haswell and Broadwell platform. The workaround is to enable split BAR in the BIOS to allow the 64bit BAR4 to be split into two 32bit BAR4 and BAR5. The BAR4 shall be pointed to LAPIC region of the remote host. We will bypass the db mechanism and directly trigger the MSIX interrupts. The offsets and vectors are exchanged during transport scratch pad negotiation. The scratch pads are now overloaded in order to allow the exchange of the information. This gets around using the doorbell and prevents the lockup with additional pcode changes in BIOS. Signed-off-by:Dave Jiang = Notable changes in the FreeBSD version of this patch: * The MSIX BAR is configurable, like hw.ntb.b2b_mw_idx (msix_mw_idx). The Linux version of the patch only uses BAR4. * MSIX negotiation aborts if the link goes down. Obtained from:Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c head/sys/dev/ntb/ntb_hw/ntb_hw.h head/sys/dev/ntb/ntb_hw/ntb_regs.h Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c == --- head/sys/dev/ntb/ntb_hw/ntb_hw.cSun Feb 14 22:31:38 2016 (r295617) +++ head/sys/dev/ntb/ntb_hw/ntb_hw.cSun Feb 14 22:37:28 2016 (r295618) @@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -42,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -70,6 +73,19 @@ __FBSDID("$FreeBSD$"); #define DEVICE2SOFTC(dev) ((struct ntb_softc *) device_get_softc(dev)) +#defineNTB_MSIX_VER_GUARD 0xaabbccdd +#defineNTB_MSIX_RECEIVED 0xe0f0e0f0 +#defineONE_MB (1024u * 1024) + +/* + * PCI constants could be somewhere more generic, but aren't defined/used in + * pci.c. + */ +#definePCI_MSIX_ENTRY_SIZE 16 +#definePCI_MSIX_ENTRY_LOWER_ADDR 0 +#definePCI_MSIX_ENTRY_UPPER_ADDR 4 +#definePCI_MSIX_ENTRY_DATA 8 + enum ntb_device_type { NTB_XEON, NTB_ATOM @@ -95,6 +111,18 @@ enum ntb_bar { NTB_MAX_BARS }; +enum { + NTB_MSIX_GUARD = 0, + NTB_MSIX_DATA0, + NTB_MSIX_DATA1, + NTB_MSIX_DATA2, + NTB_MSIX_OFS0, + NTB_MSIX_OFS1, + NTB_MSIX_OFS2, + NTB_MSIX_DONE, + NTB_MAX_MSIX_SPAD +}; + /* Device features and workarounds */ #define HAS_FEATURE(feature) \ ((ntb->features & (feature)) != 0) @@ -131,6 +159,7 @@ struct ntb_int_info { struct ntb_vec { struct ntb_softc*ntb; uint32_tnum; + unsignedmasked; }; struct ntb_reg { @@ -169,6 +198,11 @@ struct ntb_b2b_addr { uint64_tbar5_addr32; }; +struct ntb_msix_data { + uint32_tnmd_ofs; + uint32_tnmd_data; +}; + struct ntb_softc { device_tdevice; enum ntb_device_typetype; @@ -178,6 +212,13 @@ struct ntb_softc { struct ntb_int_info int_info[MAX_MSIX_INTERRUPTS]; uint32_tallocated_interrupts; + struct ntb_msix_datapeer_msix_data[XEON_NONLINK_DB_MSIX_BITS]; + struct ntb_msix_datamsix_data[XEON_NONLINK_DB_MSIX_BITS]; + boolpeer_msix_good; + boolpeer_msix_done; + struct ntb_pci_bar_info *peer_lapic_bar; + struct callout peer_msix_work; + struct callout heartbeat_timer; struct callout lr_timer; @@ -198,6 +239,7 @@ struct ntb_softc { /* Memory window used to access peer bar0 */ #define B2B_MW_DISABLEDUINT8_MAX uint8_t b2b_mw_idx; + uint8_t msix_mw_idx; uint8_t mw_count; uint8_t spad_count; @@ -292,6 +334,8 @@ static inline void db_iowrite(struct ntb static inline void db_iowrite_raw(struct ntb_softc *, uint64_t regoff, uint64_t); static int ntb_create_msix_vec
Re: svn commit: r292373 - in head: share/man/man9 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/dev/drm2/i915 sys/dev/drm2/ttm sys/dev/md sys/fs/fuse sys/fs/nfsclient sys/fs/smbfs sys/fs/tmpfs sy
On (16/12/2015 21:30), Gleb Smirnoff wrote: > Author: glebius > Date: Wed Dec 16 21:30:45 2015 > New Revision: 292373 > URL: https://svnweb.freebsd.org/changeset/base/292373 > > Log: > A change to KPI of vm_pager_get_pages() and underlying VOP_GETPAGES(). > > o With new KPI consumers can request contiguous ranges of pages, and > unlike before, all pages will be kept busied on return, like it was > done before with the 'reqpage' only. Now the reqpage goes away. With > new interface it is easier to implement code protected from race > conditions. > > Such arrayed requests for now should be preceeded by a call to > vm_pager_haspage() to make sure that request is possible. This > could be improved later, making vm_pager_haspage() obsolete. vm_pager_haspage is essentially wrapper around VOP_BMAP. VOP_BMAP is a stub for all non UFS-like file systems. E.g. it's return (0) in zfs and return (EOPNOTSUPP) in tmpfs. Could you elaborate on how strong the requirement of "should be preceded by a call to vm_pager_haspage" is. It's also not clear how to approach it if file system doesn't have bmap and getpages/putpages, but uses standard fallback pager through read/write. You've added vm_pager_has_page to exec_map_first_page. Should we now assume that vm_pager_get_pages(VM_INITIAL_PAGEIN) may fail if 'after' returned by vm_pager_has_page is less than VM_INITIAL_PAGEIN? Could you please take a look at 2 patches attached. I'd like to commit the one fixing vnode_pager_haspage, but I'm not sure about vm_pager_has_page usage in exec_map_first_page. 0001-Emulate-vop_stdbmap-in-vnode_pager_haspage-if-bmap-i.patch 'after' will be uninitialized if VOP_BMAP returns error. KASSERT in exec_map_first_page may fail because of it. I'm not sure if after = 0 is currently expected in exec_map_first_page. Extend the logic to treat EOPNOTSUPP as vop_stdbmap (set before and after to 0). Then extend both to fs block size. 0002-Handle-vm_pager_has_page-failure-during-exec.patch Patch may be dropped if vm_pager_has_page is required to succeed as described above. Thanks, Gleb. >From 40978eba392bcb20bf59704eac3d744d15f1e080 Mon Sep 17 00:00:00 2001 From: Gleb Kurtsou Date: Sat, 13 Feb 2016 23:00:00 -0800 Subject: [PATCH 1/2] Emulate vop_stdbmap in vnode_pager_haspage if bmap is not supported fs. Reset 'before' and 'after' to zero if VOP_BMAP fails. Assume no error if bmap is not supported by file system and adjust 'before', 'after' accordingly. --- sys/vm/vnode_pager.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 66dd29d7686..063d8d55495 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -321,32 +321,39 @@ vnode_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, if (IDX_TO_OFF(pindex) >= object->un_pager.vnp.vnp_size) return FALSE; bsize = vp->v_mount->mnt_stat.f_iosize; pagesperblock = bsize / PAGE_SIZE; blocksperpage = 0; if (pagesperblock > 0) { reqblock = pindex / pagesperblock; } else { blocksperpage = (PAGE_SIZE / bsize); reqblock = pindex * blocksperpage; } VM_OBJECT_WUNLOCK(object); err = VOP_BMAP(vp, reqblock, NULL, &bn, after, before); VM_OBJECT_WLOCK(object); - if (err) - return TRUE; + if (err) { + if (before) + *before = 0; + if (after) + *after = 0; + if (err != EOPNOTSUPP) + return TRUE; + bn = reqblock; + } if (bn == -1) return FALSE; if (pagesperblock > 0) { poff = pindex - (reqblock * pagesperblock); if (before) { *before *= pagesperblock; *before += poff; } if (after) { /* * The BMAP vop can report a partial block in the * 'after', but must not report blocks after EOF. * Assert the latter, and truncate 'after' in case * of the former. */ -- 2.4.2 >From 0d4ed2d975a796b612914ee70b82064ba5fa19e3 Mon Sep 17 00:00:00 2001 From: Gleb Kurtsou Date: Sat, 13 Feb 2016 23:07:50 -0800 Subject: [PATCH 2/2] Handle vm_pager_has_page failure during exec. Relax exec_map_first_page dependency on vm_pager_has_page to calculate initial number of pages. r292373 changed behavior to completely rely on vm_pager_has_page(). Fallback to VM_INITIAL_PAGEIN if vm_pager_has_page fails or number of pages reported as available ('after' argument) is zero. --- sys/kern/kern_exec.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 741bc3e48c6..e71a32fca09 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -954,39 +954,34 @@ exec_map_first_page(imgp) vm_page_t ma[VM_INITIAL_PAGEIN]; vm_object_t object; if (imgp->firstpage != NULL) exec_unmap_first_page(imgp); object = imgp->vp->v_object; if (object == NULL) return (EACCES); VM_OBJECT_WLOCK(object); #if VM_NRESERVLEVEL > 0 vm_object_color(object, 0); #endif ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL); if (
svn commit: r295621 - in head/sys/arm: conf mv
Author: andrew Date: Sun Feb 14 23:42:07 2016 New Revision: 295621 URL: https://svnweb.freebsd.org/changeset/base/295621 Log: Create the twsi device option in preparation to move the driver to a common location. The device is also found in Allwinner SoCs. Sponsored by: ABT Systems Ltd Modified: head/sys/arm/conf/ARMADA38X head/sys/arm/conf/ARMADAXP head/sys/arm/conf/DB-78XXX head/sys/arm/conf/DB-88F5XXX head/sys/arm/conf/DB-88F6XXX head/sys/arm/conf/DOCKSTAR head/sys/arm/conf/DREAMPLUG-1001 head/sys/arm/conf/NOTES head/sys/arm/mv/files.mv Modified: head/sys/arm/conf/ARMADA38X == --- head/sys/arm/conf/ARMADA38X Sun Feb 14 23:05:45 2016(r295620) +++ head/sys/arm/conf/ARMADA38X Sun Feb 14 23:42:07 2016(r295621) @@ -78,6 +78,7 @@ deviceda # I2C device iic device iicbus +device twsi #FDT optionsFDT Modified: head/sys/arm/conf/ARMADAXP == --- head/sys/arm/conf/ARMADAXP Sun Feb 14 23:05:45 2016(r295620) +++ head/sys/arm/conf/ARMADAXP Sun Feb 14 23:42:07 2016(r295621) @@ -90,6 +90,7 @@ deviceuart # I2C (TWSI) device iic device iicbus +device twsi #Network device ether Modified: head/sys/arm/conf/DB-78XXX == --- head/sys/arm/conf/DB-78XXX Sun Feb 14 23:05:45 2016(r295620) +++ head/sys/arm/conf/DB-78XXX Sun Feb 14 23:42:07 2016(r295621) @@ -82,6 +82,7 @@ deviceda # I2C (TWSI) device iic device iicbus +device twsi device ds133x # SATA Modified: head/sys/arm/conf/DB-88F5XXX == --- head/sys/arm/conf/DB-88F5XXXSun Feb 14 23:05:45 2016 (r295620) +++ head/sys/arm/conf/DB-88F5XXXSun Feb 14 23:42:07 2016 (r295621) @@ -74,6 +74,7 @@ options HZ=1000 # I2C (TWSI) device iic device iicbus +device twsi device ds133x # USB Modified: head/sys/arm/conf/DB-88F6XXX == --- head/sys/arm/conf/DB-88F6XXXSun Feb 14 23:05:45 2016 (r295620) +++ head/sys/arm/conf/DB-88F6XXXSun Feb 14 23:42:07 2016 (r295621) @@ -87,6 +87,7 @@ deviceda # I2C (TWSI) device iic device iicbus +device twsi # SATA device mvs Modified: head/sys/arm/conf/DOCKSTAR == --- head/sys/arm/conf/DOCKSTAR Sun Feb 14 23:05:45 2016(r295620) +++ head/sys/arm/conf/DOCKSTAR Sun Feb 14 23:42:07 2016(r295621) @@ -117,6 +117,7 @@ device u3g # USB-based 3G modems (O # I2C (TWSI) device iic device iicbus +device twsi # Sound device sound Modified: head/sys/arm/conf/DREAMPLUG-1001 == --- head/sys/arm/conf/DREAMPLUG-1001Sun Feb 14 23:05:45 2016 (r295620) +++ head/sys/arm/conf/DREAMPLUG-1001Sun Feb 14 23:42:07 2016 (r295621) @@ -121,6 +121,7 @@ device u3g # USB-based 3G modems (O # I2C (TWSI) device iic device iicbus +device twsi # GPIO device gpio Modified: head/sys/arm/conf/NOTES == --- head/sys/arm/conf/NOTES Sun Feb 14 23:05:45 2016(r295620) +++ head/sys/arm/conf/NOTES Sun Feb 14 23:42:07 2016(r295621) @@ -51,6 +51,9 @@ deviceat91_board_tsc4370 device at91rm9200 device nand +# IIC +device twsi + nooptions SMP nooptions MAXCPU Modified: head/sys/arm/mv/files.mv == --- head/sys/arm/mv/files.mvSun Feb 14 23:05:45 2016(r295620) +++ head/sys/arm/mv/files.mvSun Feb 14 23:42:07 2016(r295621) @@ -19,7 +19,7 @@ arm/mv/mv_machdep.c standard arm/mv/mv_pci.coptionalpci arm/mv/mv_ts.c standard arm/mv/timer.c standard -arm/mv/twsi.c optionaliicbus +arm/mv/twsi.c optionaltwsi dev/cesa/cesa.coptionalcesa dev/mge/if_mge.c optionalmge ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r295622 - in head/sys: arm/mv conf dev/iicbus/twsi
Author: andrew Date: Sun Feb 14 23:51:13 2016 New Revision: 295622 URL: https://svnweb.freebsd.org/changeset/base/295622 Log: Move the twsi driver source to be under iicbus. It is in a separate directory as it is expected multiple attachments will be added for the SoC families that use this hardware. Sponsored by: ABT Systems Ltd Added: head/sys/dev/iicbus/twsi/ head/sys/dev/iicbus/twsi/twsi.c - copied unchanged from r295621, head/sys/arm/mv/twsi.c Deleted: head/sys/arm/mv/twsi.c Modified: head/sys/arm/mv/files.mv head/sys/conf/files.arm Modified: head/sys/arm/mv/files.mv == --- head/sys/arm/mv/files.mvSun Feb 14 23:42:07 2016(r295621) +++ head/sys/arm/mv/files.mvSun Feb 14 23:51:13 2016(r295622) @@ -19,7 +19,6 @@ arm/mv/mv_machdep.c standard arm/mv/mv_pci.coptionalpci arm/mv/mv_ts.c standard arm/mv/timer.c standard -arm/mv/twsi.c optionaltwsi dev/cesa/cesa.coptionalcesa dev/mge/if_mge.c optionalmge Modified: head/sys/conf/files.arm == --- head/sys/conf/files.arm Sun Feb 14 23:42:07 2016(r295621) +++ head/sys/conf/files.arm Sun Feb 14 23:51:13 2016(r295622) @@ -101,6 +101,7 @@ dev/fb/fb.c optionalsc dev/fdt/fdt_arm_platform.c optionalplatform fdt dev/hwpmc/hwpmc_arm.c optionalhwpmc dev/hwpmc/hwpmc_armv7.coptionalhwpmc armv6 +dev/iicbus/twsi/twsi.c optionaltwsi dev/psci/psci.coptionalpsci dev/psci/psci_arm.Soptionalpsci dev/syscons/scgfbrndr.coptionalsc Copied: head/sys/dev/iicbus/twsi/twsi.c (from r295621, head/sys/arm/mv/twsi.c) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/twsi/twsi.c Sun Feb 14 23:51:13 2016 (r295622, copy of r295621, head/sys/arm/mv/twsi.c) @@ -0,0 +1,644 @@ +/*- + * Copyright (C) 2008 MARVELL INTERNATIONAL LTD. + * All rights reserved. + * + * Developed by Semihalf. + * + * 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 MARVELL nor the names of contributors + *may be used to endorse or promote products derived from this software + *without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY 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 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. + */ + +/* + * Driver for the TWSI (aka I2C, aka IIC) bus controller found on Marvell + * SoCs. Supports master operation only, and works in polling mode. + * + * Calls to DELAY() are needed per Application Note AN-179 "TWSI Software + * Guidelines for Discovery(TM), Horizon (TM) and Feroceon(TM) Devices". + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include "iicbus_if.h" + +#define MV_TWSI_NAME "twsi" +#defineIICBUS_DEVNAME "iicbus" + +#define TWSI_SLAVE_ADDR0x00 +#define TWSI_EXT_SLAVE_ADDR0x10 +#define TWSI_DATA 0x04 + +#define TWSI_CONTROL 0x08 +#define TWSI_CONTROL_ACK (1 << 2) +#define TWSI_CONTROL_IFLG (1 << 3) +#define TWSI_CONTROL_STOP (1 << 4) +#define TWSI_CONTROL_START (1 << 5) +#define TWSI_CONTROL_TWSIEN(1 << 6) +#define TWSI_CONTROL_INTEN (1 << 7) + +#