Date: Wed, 11 Nov 2015 18:54:49 +0000 (UTC) From: "Conrad E. Meyer" <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290678 - head/sys/dev/ntb/ntb_hw Message-ID: <201511111854.tABIsnb8007764@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cem Date: Wed Nov 11 18:54:49 2015 New Revision: 290678 URL: https://svnweb.freebsd.org/changeset/base/290678 Log: NTB: Skip db_valid validation writing DB link bit In ntb_poll_link, we are intentionally writing the link bit, which is absent from db_valid_mask. Don't panic on a kassert when we do so. The Linux version of this (dual BSD/GPL) driver has the db_valid_mask assertions in callers of db_iowrite() rather than db_iowrite() itself; it skips the assertions in the equivalent of ntb_poll_link(). Rather than duplicating the assertions in every caller, add a db_iowrite_raw() that doesn't check and use it from ntb_poll_link(). Suggested by: kassert_panic Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw.c Wed Nov 11 18:45:48 2015 (r290677) +++ head/sys/dev/ntb/ntb_hw/ntb_hw.c Wed Nov 11 18:54:49 2015 (r290678) @@ -283,7 +283,8 @@ static void ntb_interrupt(struct ntb_sof static void ndev_vec_isr(void *arg); static void ndev_irq_isr(void *arg); static inline uint64_t db_ioread(struct ntb_softc *, uint64_t regoff); -static inline void db_iowrite(struct ntb_softc *, uint64_t regoff, uint64_t val); +static inline void db_iowrite(struct ntb_softc *, uint64_t regoff, uint64_t); +static inline void db_iowrite_raw(struct ntb_softc *, uint64_t regoff, uint64_t); static int ntb_create_msix_vec(struct ntb_softc *ntb, uint32_t num_vectors); static void ntb_free_msix_vec(struct ntb_softc *ntb); static struct ntb_hw_info *ntb_get_device_info(uint32_t device_id); @@ -994,6 +995,12 @@ db_iowrite(struct ntb_softc *ntb, uint64 if (regoff == ntb->self_reg->db_mask) DB_MASK_ASSERT(ntb, MA_OWNED); + db_iowrite_raw(ntb, regoff, val); +} + +static inline void +db_iowrite_raw(struct ntb_softc *ntb, uint64_t regoff, uint64_t val) +{ if (ntb->type == NTB_ATOM) { ntb_reg_write(8, regoff, val); @@ -1875,7 +1882,7 @@ ntb_poll_link(struct ntb_softc *ntb) ntb->ntb_ctl = ntb_cntl; ntb->lnk_sta = ntb_reg_read(4, ntb->reg->lnk_sta); } else { - db_iowrite(ntb, ntb->self_reg->db_bell, ntb->db_link_mask); + db_iowrite_raw(ntb, ntb->self_reg->db_bell, ntb->db_link_mask); reg_val = pci_read_config(ntb->device, ntb->reg->lnk_sta, 2); if (reg_val == ntb->lnk_sta)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511111854.tABIsnb8007764>