ipath patches for 2.6.19
PATCH 1/1 ipath patches for 2.6.19
Hi, Roland -
This patch series brings the ipath driver almost up to date with what's in our internal tree. The only substantial thing missing is the memcpy_cachebypass patch that I sent out a while back and haven't had time to rework.
These patches have seen a lot of testing, including on a git snapshot as of yesterday afternoon. Please apply.
Thanks,
<b
PATCH 1/1 IB/ipath - fix memory leak if allocation fails
If the second allocation failed, the first structure allocated in this routine was not freed.
drivers/infiniband/hw/ipath/ipath_driver.c +3 -0
@@ -1326,6 +1326,9 @@ int ipath_create_rcvhdrq(struct ipath_de"for port %u rcvhdrqtailaddr failed\n" , pd->port_port); ret = -ENOMEM ; +dma_free_coherent (&dd->pcidev->dev, amt, + pd->port_rcvhdrq, pd->port_rcvhdrq_phys); + pd->port_rcvhdrq =NULL ; goto bail; } pd->port_rcvhdrqtailaddr_phys = phys_hdrqtail;
PATCH 1/1 IB/ipath - driver support for userspace sharing of HW contexts
In reply to Bryan O'SullivanThis allows multiple userspace processes to share a single hardware context in a master/slave arrangement. It is backwards binary compatible with existing userspace.
drivers/infiniband/hw/ipath/ipath_common.h +38 -11
@@ -185,6 +185,7 @@ typedef enum _ipath_ureg {#define IPATH_RUNTIME_PCIE 0x2#define IPATH_RUNTIME_FORCE_WC_ORDER 0x4#define IPATH_RUNTIME_RCVHDR_COPY 0x8 +#define IPATH_RUNTIME_MASTER 0x10/* * This structure is returned by ipath_userinit() immediately after
@@ -202,7 +203,8 @@ struct ipath_base_info {/* version of software, for feature checking. */ __u32 spi_sw_version;/* InfiniPath port assigned, goes into sent packets */ -__u32 spi_port; +__u16 spi_port; +__u16 spi_subport;/* * IB MTU, packets IB data must be less than this. * The MTU is in bytes, and will be a multiple of 4 bytes.
@@ -218,7 +220,7 @@ struct ipath_base_info {__u32 spi_tidcnt;/* size of the TID Eager list in infinipath, in entries */ __u32 spi_tidegrcnt; -/* size of a single receive header queue entry. */ +/* size of a single receive header queue entry in words. */ __u32 spi_rcvhdrent_size;/* * Count of receive header queue entries allocated.
@@ -310,6 +312,12 @@ struct ipath_base_info {__u32 spi_filler_for_align;/* address of readonly memory copy of the rcvhdrq tail register. */ __u64 spi_rcvhdr_tailaddr; + +/* shared memory pages for subports if IPATH_RUNTIME_MASTER is set */ +__u64 spi_subport_uregbase; +__u64 spi_subport_rcvegrbuf; +__u64 spi_subport_rcvhdr_base; + } __attribute__ ((aligned(8)));
@@ -328,12 +336,12 @@ struct ipath_base_info {/* * Minor version differences are always compatible -* a within a major version, however if if user software is larger +* a within a major version, however if user software is larger * than driver software, some new features and/or structure fields * may not be implemented; the user code must deal with this if it -* cares, or it must abort after initialization reports the difference -*/ -#define IPATH_USER_SWMINOR 2 +* cares, or it must abort after initialization reports the difference. +*/ +#define IPATH_USER_SWMINOR 3#define IPATH_USER_SWVERSION ((IPATH_USER_SWMAJOR<<16) | IPATH_USER_SWMINOR)
@@ -379,7 +387,16 @@ struct ipath_user_info {*/ __u32 spu_rcvhdrsize; -__u64 spu_unused;/* kept for compatible layout */ +/* +* If two or more processes wish to share a port, each process +* must set the spu_subport_cnt and spu_subport_id to the same +* values. The only restriction on the spu_subport_id is that +* it be unique for a given node. +*/ +__u16 spu_subport_cnt; +__u16 spu_subport_id; + +__u32 spu_unused;/* kept for compatible layout */ /* * address of struct base_info to write to
@@ -398,13 +415,17 @@ struct ipath_user_info {#define IPATH_CMD_TID_UPDATE 19/* update expected TID entries */ #define IPATH_CMD_TID_FREE 20/* free expected TID entries */ #define IPATH_CMD_SET_PART_KEY 21/* add partition key */ - -#define IPATH_CMD_MAX 21 +#define IPATH_CMD_SLAVE_INFO 22/* return info on slave processes */ + +#define IPATH_CMD_MAX 22struct ipath_port_info {__u32 num_active;/* number of active units */ __u32 unit;/* unit (chip) assigned to caller */ -__u32 port;/* port on unit assigned to caller */ +__u16 port;/* port on unit assigned to caller */ +__u16 subport;/* subport on unit assigned to caller */ +__u16 num_ports;/* number of ports available on unit */ +__u16 num_subports;/* number of subport slaves opened on port */ };struct ipath_tid_info {
@@ -435,6 +456,8 @@ struct ipath_cmd {__u32 recv_ctrl;/* partition key to set */ __u16 part_key; +/* user address of __u32 bitmask of active slaves */ +__u64 slave_mask_addr; } cmd; };
@@ -596,6 +619,10 @@ struct infinipath_counters {/* K_PktFlags bits */ #define INFINIPATH_KPF_INTR 0x1 +#define INFINIPATH_KPF_SUBPORT_MASK 0x3 +#define INFINIPATH_KPF_SUBPORT_SHIFT 1 + +#define INFINIPATH_MAX_SUBPORT 4/* SendPIO per-buffer control */ #define INFINIPATH_SP_TEST 0x40
@@ -610,7 +637,7 @@ struct ipath_header {/* * Version - 4 bits, Port - 4 bits, TID - 10 bits and Offset - * 14 bits before ECO change ~28 Dec 03. After that, Vers 4, -* Port 3, TID 11, offset 14. +* Port 4, TID 11, offset 13. */ __le32 ver_port_tid_offset;__le16 chksum;
drivers/infiniband/hw/ipath/ipath_driver.c +5 -2
@@ -1827,9 +1827,9 @@ void ipath_free_pddata(struct ipath_devddma_free_coherent (&dd->pcidev->dev, size, base, pd->port_rcvegrbuf_phys[e]); } -vfree (pd->port_rcvegrbuf); +kfree (pd->port_rcvegrbuf); pd->port_rcvegrbuf =NULL ; -vfree (pd->port_rcvegrbuf_phys); +kfree (pd->port_rcvegrbuf_phys); pd->port_rcvegrbuf_phys =NULL ; pd->port_rcvegrbuf_chunks =0 ; }else if (pd->port_port ==0 && dd->ipath_port0_skbs) {
@@ -1845,6 +1845,9 @@ void ipath_free_pddata(struct ipath_devdvfree (skbs); }kfree (pd->port_tid_pg_list); +vfree (pd->subport_uregbase); +vfree (pd->subport_rcvegrbuf); +vfree (pd->subport_rcvhdr_base);kfree (pd); }
drivers/infiniband/hw/ipath/ipath_file_ops.c +690 -243
1,347 lines not on this page · raw message
drivers/infiniband/hw/ipath/ipath_kernel.h +27 -3
@@ -79,8 +79,8 @@ struct ipath_portdata {dma_addr_t port_rcvhdrq_phys;dma_addr_t port_rcvhdrqtailaddr_phys;/* -* number of opens on this instance (0 or 1; ignoring forks, dup, -* etc. for now) +* number of opens (including slave subports) on this instance +* (ignoring forks, dup, etc. for now) */ int port_cnt;/*
@@ -89,6 +89,10 @@ struct ipath_portdata {*/ /* instead of calculating it */ unsigned port_port; +/* non-zero if port is being shared. */ +u16 port_subport_cnt; +/* non-zero if port is being shared. */ +u16 port_subport_id;/* chip offset of PIO buffers for this port */ u32 port_piobufs;/* how many alloc_pages() chunks in port_rcvegrbuf_pages */
@@ -121,6 +125,16 @@ struct ipath_portdata {u16 port_pkeys[4 ];/* so file ops can get at unit */ struct ipath_devdata *port_dd; +/* A page of memory for rcvhdrhead, rcvegrhead, rcvegrtail * N */ +void *subport_uregbase; +/* An array of pages for the eager receive buffers * N */ +void *subport_rcvegrbuf; +/* An array of pages for the eager header queue entries * N */ +void *subport_rcvhdr_base; +/* The version of the library which opened this port */ +u32 userversion; +/* Bitmask of active slaves */ +u32 active_slaves; };struct sk_buff ;
@@ -512,6 +526,12 @@ struct ipath_devdata {u32 ipath_lli_errors; }; +/* Private data for file operations */ +struct ipath_filedata { +struct ipath_portdata *pd; +unsigned subport; +unsigned tidcursor; +};extern struct list_head ipath_dev_list;extern spinlock_t ipath_devs_lock;extern struct ipath_devdata *ipath_lookup (int unit);
@@ -572,7 +592,11 @@ int ipath_set_rx_pol_inv(struct ipath_deint ipath_set_rx_pol_inv (struct ipath_devdata *dd,u8 new_pol_inv);/* for use in system calls, where we want to know device type, etc. */ -#define port_fp (fp) ((struct ipath_portdata *) (fp)->private_data) +#define port_fp (fp) ((struct ipath_filedata *)(fp)->private_data)->pd +#define subport_fp (fp) \ + ((struct ipath_filedata *)(fp)->private_data)->subport +#define tidcursor_fp (fp) \ + ((struct ipath_filedata *)(fp)->private_data)->tidcursor/* * values for ipath_flags
drivers/infiniband/hw/ipath/ipath_sysfs.c +12 -0
@@ -295,6 +295,16 @@ static ssize_t show_nguid(struct devicestruct ipath_devdata *dd =dev_get_drvdata (dev);return scnprintf (buf,PAGE_SIZE ,"%u\n" , dd->ipath_nguid); +} + +static ssize_t show_nports (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct ipath_devdata *dd =dev_get_drvdata (dev); + +/* Return the number of user ports available. */ +return scnprintf (buf,PAGE_SIZE ,"%u\n" , dd->ipath_cfgports -1 ); } static ssize_t show_serial(struct device *dev,
@@ -608,6 +618,7 @@ static DEVICE_ATTR(mtu, S_IWUSR | S_IRUG static DEVICE_ATTR(mtu, S_IWUSR | S_IRUGO, show_mtu, store_mtu); static DEVICE_ATTR(enabled, S_IWUSR | S_IRUGO, show_enabled, store_enabled); static DEVICE_ATTR(nguid, S_IRUGO, show_nguid, NULL); +static DEVICE_ATTR(nports, S_IRUGO, show_nports, NULL); static DEVICE_ATTR(reset, S_IWUSR, NULL, store_reset); static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL); static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
@@ -623,6 +634,7 @@ static struct attribute *dev_attributes[ &dev_attr_mlid.attr, &dev_attr_mtu.attr, &dev_attr_nguid.attr, + &dev_attr_nports.attr, &dev_attr_serial.attr, &dev_attr_status.attr, &dev_attr_status_str.attr,
PATCH 1/1 IB/ipath - limit # of packets sent without an ACK received
In reply to Bryan O'SullivanThe sender requests an ACK every 1/2 MB to avoid retransmit timeouts that were causing MVAPICH mod_bw to fail after a predictable number of sends.
drivers/infiniband/hw/ipath/ipath_qp.c +2 -1
@@ -342,6 +342,7 @@ static void ipath_reset_qp(struct ipath_ qp->s_last =0 ; qp->s_ssn =1 ; qp->s_lsn =0 ; + qp->s_wait_credit =0 ;if (qp->r_rq.wq) { qp->r_rq.wq->head =0 ; qp->r_rq.wq->tail =0 ;
@@ -516,7 +517,7 @@ int ipath_modify_qp(struct ib_qp *ibqp, qp->remote_qpn = attr->dest_qp_num;if (attr_mask &IB_QP_SQ_PSN ) { - qp->s_next_psn = attr->sq_psn; + qp->s_psn = qp->s_next_psn = attr->sq_psn; qp->s_last_psn = qp->s_next_psn -1 ; }
drivers/infiniband/hw/ipath/ipath_rc.c +29 -18
113 lines not on this page · raw message
drivers/infiniband/hw/ipath/ipath_verbs.c +2 -1
@@ -1683,6 +1683,7 @@ static ssize_t show_stats(struct class_d"RC OTH NAKs %d\n" "RC timeouts %d\n" "RC RDMA dup %d\n" +"RC stalls %d\n" "piobuf wait %d\n" "no piobuf %d\n" "PKT drops %d\n"
@@ -1690,7 +1691,7 @@ static ssize_t show_stats(struct class_d dev->n_rc_resends, dev->n_rc_qacks, dev->n_rc_acks, dev->n_seq_naks, dev->n_rdma_seq, dev->n_rnr_naks, dev->n_other_naks, dev->n_timeouts, - dev->n_rdma_dup_busy, dev->n_piowait, + dev->n_rdma_dup_busy, dev->n_rc_stalls, dev->n_piowait, dev->n_no_piobuf, dev->n_pkt_drops, dev->n_wqe_errs);for (i =0 ; i <ARRAY_SIZE (dev->opstats); i++) {const struct ipath_opcode_stats *si = &dev->opstats[i];
drivers/infiniband/hw/ipath/ipath_verbs.h +4 -0
@@ -370,6 +370,7 @@ struct ipath_qp {u8 s_rnr_retry_cnt;u8 s_retry;/* requester retry counter */ u8 s_rnr_retry;/* requester RNR retry counter */ +u8 s_wait_credit;/* limit number of unacked packets sent */ u8 s_pkey_index;/* PKEY index to use */ u8 timeout;/* Timeout for this QP */ enum ib_mtu path_mtu;
@@ -392,6 +393,8 @@ struct ipath_qp {*/ #define IPATH_S_BUSY 0#define IPATH_S_SIGNAL_REQ_WR 1 + +#define IPATH_PSN_CREDIT 2048/* * Since struct ipath_swqe is not a fixed size, we can't simply index into
@@ -521,6 +524,7 @@ struct ipath_ibdev {u32 n_rnr_naks;u32 n_other_naks;u32 n_timeouts; +u32 n_rc_stalls;u32 n_pkt_drops;u32 n_vl15_dropped;u32 n_wqe_errs;
PATCH 1/1 IB/ipath - unregister from IB core early
In reply to Bryan O'SullivanThis gives upper-level protocols a chance to unregister while the device is still usable.
drivers/infiniband/hw/ipath/ipath_driver.c +11 -1
@@ -536,7 +536,12 @@ static void __devexit ipath_remove_one(sreturn ; dd =pci_get_drvdata (pdev); -ipath_unregister_ib_device (dd->verbs_dev); + +if (dd->verbs_dev) { +ipath_unregister_ib_device (dd->verbs_dev); + dd->verbs_dev =NULL ; + } +ipath_diag_remove (dd);ipath_user_remove (dd);ipathfs_remove_device (dd);
@@ -2027,6 +2032,11 @@ static void __exit infinipath_cleanup(volist_for_each_entry_safe (dd, tmp, &ipath_dev_list, ipath_list) {spin_unlock_irqrestore (&ipath_devs_lock, flags); +if (dd->verbs_dev) { +ipath_unregister_ib_device (dd->verbs_dev); + dd->verbs_dev =NULL ; + } +if (dd->ipath_kregbase)cleanup_device (dd);
PATCH 1/1 IB/ipath - flush RWQEs if access error or invalid error seen
In reply to Bryan O'SullivanIf the receiver goes into the error state, we need to flush the posted receive WQEs.
drivers/infiniband/hw/ipath/ipath_qp.c +10 -3
@@ -335,6 +335,7 @@ static void ipath_reset_qp(struct ipath_ qp->s_ack_state =IB_OPCODE_RC_ACKNOWLEDGE ; qp->r_ack_state =IB_OPCODE_RC_ACKNOWLEDGE ; qp->r_nak_state =0 ; + qp->r_wrid_valid =0 ; qp->s_rnr_timeout =0 ; qp->s_head =0 ; qp->s_tail =0 ;
@@ -353,12 +354,13 @@ static void ipath_reset_qp(struct ipath_/** * ipath_error_qp - put a QP into an error state * @qp: the QP to put into an error state +* @err: the receive completion error to signal if a RWQE is active * * Flushes both send and receive work queues. * QP s_lock should be held and interrupts disabled. */ -void ipath_error_qp (struct ipath_qp *qp) +void ipath_error_qp (struct ipath_qp *qp,enum ib_wc_status err) {struct ipath_ibdev *dev =to_idev (qp->ibqp.device);struct ib_wc wc;
@@ -374,7 +376,6 @@ void ipath_error_qp(struct ipath_qp *qp)list_del_init (&qp->piowait);spin_unlock (&dev->pending_lock); - wc.status =IB_WC_WR_FLUSH_ERR ; wc.vendor_err =0 ; wc.byte_len =0 ; wc.imm_data =0 ;
@@ -386,6 +387,12 @@ void ipath_error_qp(struct ipath_qp *qp) wc.sl =0 ; wc.dlid_path_bits =0 ; wc.port_num =0 ; +if (qp->r_wrid_valid) { + qp->r_wrid_valid =0 ; + wc.status = err; +ipath_cq_enter (to_icq (qp->ibqp.send_cq), &wc,1 ); + } + wc.status =IB_WC_WR_FLUSH_ERR ;while (qp->s_last != qp->s_head) {struct ipath_swqe *wqe =get_swqe_ptr (qp, qp->s_last);
@@ -502,7 +509,7 @@ int ipath_modify_qp(struct ib_qp *ibqp,break ;case IB_QPS_ERR : -ipath_error_qp (qp); +ipath_error_qp (qp,IB_WC_GENERAL_ERR );break ;default :
drivers/infiniband/hw/ipath/ipath_rc.c +12 -6
@@ -1293,6 +1293,14 @@ done:return 1 ; } +static void ipath_rc_error (struct ipath_qp *qp,enum ib_wc_status err) +{ +spin_lock_irq (&qp->s_lock); + qp->state =IB_QPS_ERR ; +ipath_error_qp (qp, err); +spin_unlock_irq (&qp->s_lock); +} +/** * ipath_rc_rcv - process an incoming RC packet * @dev: the device this packet came in on
@@ -1385,8 +1393,7 @@ void ipath_rc_rcv(struct ipath_ibdev *de*/ if (qp->r_ack_state >=OP (COMPARE_SWAP )) goto send_ack; -/* XXX Flush WQEs */ - qp->state =IB_QPS_ERR ; +ipath_rc_error (qp,IB_WC_REM_INV_REQ_ERR ); qp->r_ack_state =OP (SEND_ONLY ); qp->r_nak_state =IB_NAK_INVALID_REQUEST ; qp->r_ack_psn = qp->r_psn;
@@ -1492,9 +1499,9 @@ void ipath_rc_rcv(struct ipath_ibdev *de goto nack_inv;ipath_copy_sge (&qp->r_sge, data, tlen); qp->r_msn++; -if (opcode ==OP (RDMA_WRITE_LAST ) || - opcode ==OP (RDMA_WRITE_ONLY )) +if (!qp->r_wrid_valid)break ; + qp->r_wrid_valid =0 ; wc.wr_id = qp->r_wr_id; wc.status =IB_WC_SUCCESS ; wc.opcode =IB_WC_RECV ;
@@ -1685,8 +1692,7 @@ nack_acc:* is pending though. */ if (qp->r_ack_state <OP (COMPARE_SWAP )) { -/* XXX Flush WQEs */ - qp->state =IB_QPS_ERR ; +ipath_rc_error (qp,IB_WC_REM_ACCESS_ERR ); qp->r_ack_state =OP (RDMA_WRITE_ONLY ); qp->r_nak_state =IB_NAK_REMOTE_ACCESS_ERROR ; qp->r_ack_psn = qp->r_psn;
drivers/infiniband/hw/ipath/ipath_ruc.c +1 -0
@@ -229,6 +229,7 @@ int ipath_get_rwqe(struct ipath_qp *qp, } }spin_unlock_irqrestore (&rq->lock, flags); + qp->r_wrid_valid =1 ; bail:return ret;
drivers/infiniband/hw/ipath/ipath_verbs.h +3 -0
@@ -365,6 +365,7 @@ struct ipath_qp {u8 r_min_rnr_timer;/* retry timeout value for RNR NAKs */ u8 r_reuse_sge;/* for UC receive errors */ u8 r_sge_inx;/* current index into sg_list */ +u8 r_wrid_valid;/* r_wrid set but CQ entry not yet made */ u8 qp_access_flags;u8 s_max_sge;/* size of s_wq->sg_list */ u8 s_retry_cnt;/* number of times to retry */
@@ -639,6 +640,8 @@ struct ib_qp *ipath_create_qp(struct ib_int ipath_destroy_qp (struct ib_qp *ibqp); +void ipath_error_qp (struct ipath_qp *qp,enum ib_wc_status err); +int ipath_modify_qp (struct ib_qp *ibqp,struct ib_qp_attr *attr,int attr_mask,struct ib_udata *udata);
PATCH 1/1 IB/ipath - call mtrr_del with correct arguments
In reply to Bryan O'SullivanWe were passing 0 for base and length, which worked on older kernels, but it doesn't seem to any longer.
drivers/infiniband/hw/ipath/ipath_kernel.h +2 -0
@@ -336,6 +336,8 @@ struct ipath_devdata {u8 ipath_ht_slave_off;/* for write combining settings */ unsigned long ipath_wc_cookie; +unsigned long ipath_wc_base; +unsigned long ipath_wc_len;/* ref count for each pkey */ atomic_t ipath_pkeyrefs[4 ];/* shadow copy of all exptids physaddr; used only by funcsim */
drivers/infiniband/hw/ipath/ipath_wc_x86_64.c +11 -2
@@ -123,6 +123,8 @@ int ipath_enable_wc(struct ipath_devdataipath_cdbg (VERBOSE ,"Set mtrr for chip to WC, " "cookie is %d\n" , cookie); dd->ipath_wc_cookie = cookie; + dd->ipath_wc_base = (unsigned long ) pioaddr; + dd->ipath_wc_len = (unsigned long ) piolen; } }
@@ -136,9 +138,16 @@ void ipath_disable_wc(struct ipath_devdavoid ipath_disable_wc (struct ipath_devdata *dd) {if (dd->ipath_wc_cookie) { +int r;ipath_cdbg (VERBOSE ,"undoing WCCOMB on pio buffers\n" ); -mtrr_del (dd->ipath_wc_cookie,0 ,0 ); - dd->ipath_wc_cookie =0 ; + r =mtrr_del (dd->ipath_wc_cookie, dd->ipath_wc_base, + dd->ipath_wc_len); +if (r <0 ) +dev_info (&dd->pcidev->dev, +"mtrr_del(%lx, %lx, %lx) failed: %d\n" , + dd->ipath_wc_cookie, dd->ipath_wc_base, + dd->ipath_wc_len, r); + dd->ipath_wc_cookie =0 ;// even on failure } }
PATCH 1/1 IB/ipath - clean up module exit code
In reply to Bryan O'Sullivandrivers/infiniband/hw/ipath/ipath_driver.c +130 -163
@@ -517,33 +517,146 @@ bail:return ret; } +static void __devexit cleanup_device(struct ipath_devdata *dd) +{ +int port; + +ipath_shutdown_device (dd); + +if (*dd->ipath_statusp &IPATH_STATUS_CHIP_PRESENT ) { +/* can't do anything more with chip; needs re-init */ + *dd->ipath_statusp &= ~IPATH_STATUS_CHIP_PRESENT ; +if (dd->ipath_kregbase) { +/* +* if we haven't already cleaned up before these are +* to ensure any register reads/writes "fail" until +* re-init +*/ + dd->ipath_kregbase =NULL ; + dd->ipath_uregbase =0 ; + dd->ipath_sregbase =0 ; + dd->ipath_cregbase =0 ; + dd->ipath_kregsize =0 ; + } +ipath_disable_wc (dd); + } + +if (dd->ipath_pioavailregs_dma) { +dma_free_coherent (&dd->pcidev->dev,PAGE_SIZE , + (void *) dd->ipath_pioavailregs_dma, + dd->ipath_pioavailregs_phys); + dd->ipath_pioavailregs_dma =NULL ; + } +if (dd->ipath_dummy_hdrq) { +dma_free_coherent (&dd->pcidev->dev, + dd->ipath_pd[0 ]->port_rcvhdrq_size, + dd->ipath_dummy_hdrq, dd->ipath_dummy_hdrq_phys); + dd->ipath_dummy_hdrq =NULL ; + } + +if (dd->ipath_pageshadow) { +struct page **tmpp = dd->ipath_pageshadow; +dma_addr_t *tmpd = dd->ipath_physshadow; +int i, cnt =0 ; + +ipath_cdbg (VERBOSE ,"Unlocking any expTID pages still " +"locked\n" ); +for (port =0 ; port < dd->ipath_cfgports; port++) { +int port_tidbase = port * dd->ipath_rcvtidcnt; +int maxtid = port_tidbase + dd->ipath_rcvtidcnt; +for (i = port_tidbase; i < maxtid; i++) { +if (!tmpp[i]) +continue ; +pci_unmap_page (dd->pcidev, tmpd[i], +PAGE_SIZE ,PCI_DMA_FROMDEVICE ); +ipath_release_user_pages (&tmpp[i],1 ); + tmpp[i] =NULL ; + cnt++; + } + } +if (cnt) { + ipath_stats.sps_pageunlocks += cnt; +ipath_cdbg (VERBOSE ,"There were still %u expTID " +"entries locked\n" , cnt); + } +if (ipath_stats.sps_pagelocks || + ipath_stats.sps_pageunlocks) +ipath_cdbg (VERBOSE ,"%llu pages locked, %llu " +"unlocked via ipath_m{un}lock\n" , + (unsigned long long ) + ipath_stats.sps_pagelocks, + (unsigned long long ) + ipath_stats.sps_pageunlocks); + +ipath_cdbg (VERBOSE ,"Free shadow page tid array at %p\n" , + dd->ipath_pageshadow); +vfree (dd->ipath_pageshadow); + dd->ipath_pageshadow =NULL ; + } + +/* +* free any resources still in use (usually just kernel ports) +* at unload; we do for portcnt, not cfgports, because cfgports +* could have changed while we were loaded. +*/ +for (port =0 ; port < dd->ipath_portcnt; port++) { +struct ipath_portdata *pd = dd->ipath_pd[port]; + dd->ipath_pd[port] =NULL ; +ipath_free_pddata (dd, pd); + } +kfree (dd->ipath_pd); +/* +* debuggability, in case some cleanup path tries to use it +* after this +*/ + dd->ipath_pd =NULL ; +} + static void __devexit ipath_remove_one(struct pci_dev *pdev) { -struct ipath_devdata *dd; - -ipath_cdbg (VERBOSE ,"removing, pdev=%p\n" , pdev); -if (!pdev) -return ; - - dd =pci_get_drvdata (pdev); - -if (dd->verbs_dev) { +struct ipath_devdata *dd =pci_get_drvdata (pdev); + +ipath_cdbg (VERBOSE ,"removing, pdev=%p, dd=%p\n" , pdev, dd); + +if (dd->verbs_dev)ipath_unregister_ib_device (dd->verbs_dev); - dd->verbs_dev =NULL ; - }ipath_diag_remove (dd);ipath_user_remove (dd);ipathfs_remove_device (dd);ipath_device_remove_group (&pdev->dev, dd); +ipath_cdbg (VERBOSE ,"Releasing pci memory regions, dd %p, " "unit %u\n" , dd, (u32 ) dd->ipath_unit); -if (dd->ipath_kregbase) { -ipath_cdbg (VERBOSE ,"Unmapping kregbase %p\n" , - dd->ipath_kregbase); -iounmap ((volatile void __iomem *) dd->ipath_kregbase); - dd->ipath_kregbase =NULL ; - } + +cleanup_device (dd); + +/* +* turn off rcv, send, and interrupts for all ports, all drivers +* should also hard reset the chip here? +* free up port 0 (kernel) rcvhdr, egr bufs, and eventually tid bufs +* for all versions of the driver, if they were allocated +*/ +if (pdev->irq) { +ipath_cdbg (VERBOSE , +"unit %u free_irq of irq %x\n" , + dd->ipath_unit, pdev->irq); +free_irq (pdev->irq, dd); + }else +ipath_dbg ("irq is 0, not doing free_irq " +"for unit %u\n" , dd->ipath_unit); +/* +* we check for NULL here, because it's outside +* the kregbase check, and we need to call it +* after the free_irq. Thus it's possible that +* the function pointers were never initialized. +*/ +if (dd->ipath_f_cleanup) +/* clean up chip-specific stuff */ + dd->ipath_f_cleanup (dd); + +ipath_cdbg (VERBOSE ,"Unmapping kregbase %p\n" , dd->ipath_kregbase); +iounmap ((volatile void __iomem *) dd->ipath_kregbase);pci_release_regions (pdev);ipath_cdbg (VERBOSE ,"calling pci_disable_device\n" );pci_disable_device (pdev);
@@ -1917,157 +2030,11 @@ bail:return ret; } -static void cleanup_device (struct ipath_devdata *dd) -{ -int port; - -ipath_shutdown_device (dd); - -if (*dd->ipath_statusp &IPATH_STATUS_CHIP_PRESENT ) { -/* can't do anything more with chip; needs re-init */ - *dd->ipath_statusp &= ~IPATH_STATUS_CHIP_PRESENT ; -if (dd->ipath_kregbase) { -/* -* if we haven't already cleaned up before these are -* to ensure any register reads/writes "fail" until -* re-init -*/ - dd->ipath_kregbase =NULL ; - dd->ipath_uregbase =0 ; - dd->ipath_sregbase =0 ; - dd->ipath_cregbase =0 ; - dd->ipath_kregsize =0 ; - } -ipath_disable_wc (dd); - } - -if (dd->ipath_pioavailregs_dma) { -dma_free_coherent (&dd->pcidev->dev,PAGE_SIZE , - (void *) dd->ipath_pioavailregs_dma, - dd->ipath_pioavailregs_phys); - dd->ipath_pioavailregs_dma =NULL ; - } -if (dd->ipath_dummy_hdrq) { -dma_free_coherent (&dd->pcidev->dev, - dd->ipath_pd[0 ]->port_rcvhdrq_size, - dd->ipath_dummy_hdrq, dd->ipath_dummy_hdrq_phys); - dd->ipath_dummy_hdrq =NULL ; - } - -if (dd->ipath_pageshadow) { -struct page **tmpp = dd->ipath_pageshadow; -dma_addr_t *tmpd = dd->ipath_physshadow; -int i, cnt =0 ; - -ipath_cdbg (VERBOSE ,"Unlocking any expTID pages still " -"locked\n" ); -for (port =0 ; port < dd->ipath_cfgports; port++) { -int port_tidbase = port * dd->ipath_rcvtidcnt; -int maxtid = port_tidbase + dd->ipath_rcvtidcnt; -for (i = port_tidbase; i < maxtid; i++) { -if (!tmpp[i]) -continue ; -pci_unmap_page (dd->pcidev, tmpd[i], -PAGE_SIZE ,PCI_DMA_FROMDEVICE ); -ipath_release_user_pages (&tmpp[i],1 ); - tmpp[i] =NULL ; - cnt++; - } - } -if (cnt) { - ipath_stats.sps_pageunlocks += cnt; -ipath_cdbg (VERBOSE ,"There were still %u expTID " -"entries locked\n" , cnt); - } -if (ipath_stats.sps_pagelocks || - ipath_stats.sps_pageunlocks) -ipath_cdbg (VERBOSE ,"%llu pages locked, %llu " -"unlocked via ipath_m{un}lock\n" , - (unsigned long long ) - ipath_stats.sps_pagelocks, - (unsigned long long ) - ipath_stats.sps_pageunlocks); - -ipath_cdbg (VERBOSE ,"Free shadow page tid array at %p\n" , - dd->ipath_pageshadow); -vfree (dd->ipath_pageshadow); - dd->ipath_pageshadow =NULL ; - } - -/* -* free any resources still in use (usually just kernel ports) -* at unload; we do for portcnt, not cfgports, because cfgports -* could have changed while we were loaded. -*/ -for (port =0 ; port < dd->ipath_portcnt; port++) { -struct ipath_portdata *pd = dd->ipath_pd[port]; - dd->ipath_pd[port] =NULL ; -ipath_free_pddata (dd, pd); - } -kfree (dd->ipath_pd); -/* -* debuggability, in case some cleanup path tries to use it -* after this -*/ - dd->ipath_pd =NULL ; -} - static void __exit infinipath_cleanup(void) { -struct ipath_devdata *dd, *tmp; -unsigned long flags; - -ipath_diagpkt_remove (); -ipath_exit_ipathfs ();ipath_driver_remove_group (&ipath_driver.driver); - -spin_lock_irqsave (&ipath_devs_lock, flags); - -/* -* turn off rcv, send, and interrupts for all ports, all drivers -* should also hard reset the chip here? -* free up port 0 (kernel) rcvhdr, egr bufs, and eventually tid bufs -* for all versions of the driver, if they were allocated -*/ -list_for_each_entry_safe (dd, tmp, &ipath_dev_list, ipath_list) { -spin_unlock_irqrestore (&ipath_devs_lock, flags); - -if (dd->verbs_dev) { -ipath_unregister_ib_device (dd->verbs_dev); - dd->verbs_dev =NULL ; - } - -if (dd->ipath_kregbase) -cleanup_device (dd); - -if (dd->pcidev) { -if (dd->pcidev->irq) { -ipath_cdbg (VERBOSE , -"unit %u free_irq of irq %x\n" , - dd->ipath_unit, dd->pcidev->irq); -free_irq (dd->pcidev->irq, dd); - }else -ipath_dbg ("irq is 0, not doing free_irq " -"for unit %u\n" , dd->ipath_unit); - -/* -* we check for NULL here, because it's outside -* the kregbase check, and we need to call it -* after the free_irq. Thus it's possible that -* the function pointers were never initialized. -*/ -if (dd->ipath_f_cleanup) -/* clean up chip-specific stuff */ - dd->ipath_f_cleanup (dd); - - dd->pcidev =NULL ; - } -spin_lock_irqsave (&ipath_devs_lock, flags); - } - -spin_unlock_irqrestore (&ipath_devs_lock, flags);ipath_cdbg (VERBOSE ,"Unregistering pci driver\n" );pci_unregister_driver (&ipath_driver);
PATCH 1/1 IB/ipath - change HT CRC message to indicate how to resolve problem
In reply to Bryan O'SullivanThe system must be powercycled to clear a HT CRC error; reloading the driver is not enough.
drivers/infiniband/hw/ipath/ipath_iba6110.c +1 -1
@@ -338,7 +338,7 @@ static void hwerr_crcbits(struct ipath_dif (crcbits) {u16 ctrl0, ctrl1; snprintf(bitsmsg, sizeof bitsmsg, - "[HT%s lane %s CRC (%llx); ignore till reload]", + "[HT%s lane %s CRC (%llx); powercycle to completely clear]", !(crcbits & _IPATH_HTLINK1_CRCBITS) ? "0 (A)" : (!(crcbits & _IPATH_HTLINK0_CRCBITS) ? "1 (B)" : "0+1 (A+B)"),
PATCH 1/1 IB/ipath - improved support for powerpc
In reply to Bryan O'Sullivandrivers/infiniband/hw/ipath/ipath_driver.c +38 -26
@@ -755,8 +755,8 @@ static inline void *ipath_get_egrbuf(strstatic inline void *ipath_get_egrbuf (struct ipath_devdata *dd,u32 bufnum,int err) { -return dd->ipath_port0_skbs ? - (void *)dd->ipath_port0_skbs[bufnum]->data :NULL ; +return dd->ipath_port0_skbinfo ? + (void *) dd->ipath_port0_skbinfo[bufnum].skb->data :NULL ; }/**
@@ -778,31 +778,34 @@ struct sk_buff *ipath_alloc_skb(struct i*/ /* -* We need 4 extra bytes for unaligned transfer copying +* We need 2 extra bytes for ipath_ether data sent in the +* key header. In order to keep everything dword aligned, +* we'll reserve 4 bytes. */ + len = dd->ipath_ibmaxlen +4 ; +if (dd->ipath_flags &IPATH_4BYTE_TID ) { -/* we need a 4KB multiple alignment, and there is no way +/* We need a 2KB multiple alignment, and there is no way * to do it except to allocate extra and then skb_reserve * enough to bring it up to the right alignment. */ - len = dd->ipath_ibmaxlen +4 + (1 <<11 ) -1 ; - } -else - len = dd->ipath_ibmaxlen +4 ; + len +=2047 ; + } + skb =__dev_alloc_skb (len, gfp_mask);if (!skb) {ipath_dev_err (dd,"Failed to allocate skbuff, length %u\n" , len); goto bail; } + +skb_reserve (skb,4 ); +if (dd->ipath_flags &IPATH_4BYTE_TID ) { -u32 una = ((1 <<11 ) -1 ) & (unsigned long )(skb->data +4 ); +u32 una = (unsigned long )skb->data &2047 ;if (una) -skb_reserve (skb,4 + (1 <<11 ) - una); -else -skb_reserve (skb,4 ); - }else -skb_reserve (skb,4 ); +skb_reserve (skb,2048 - una); + } bail:return skb;
@@ -1345,8 +1348,9 @@ int ipath_create_rcvhdrq(struct ipath_deipath_cdbg (VERBOSE ,"reuse port %d rcvhdrq @%p %llx phys; " "hdrtailaddr@%p %llx physical\n" , pd->port_port, pd->port_rcvhdrq, - pd->port_rcvhdrq_phys, pd->port_rcvhdrtail_kvaddr, - (unsigned long long )pd->port_rcvhdrqtailaddr_phys); + (unsigned long long ) pd->port_rcvhdrq_phys, + pd->port_rcvhdrtail_kvaddr, (unsigned long long ) + pd->port_rcvhdrqtailaddr_phys);/* clear for security and sanity on each use */ memset (pd->port_rcvhdrq,0 , pd->port_rcvhdrq_size);
@@ -1827,17 +1831,22 @@ void ipath_free_pddata(struct ipath_devdkfree (pd->port_rcvegrbuf_phys); pd->port_rcvegrbuf_phys =NULL ; pd->port_rcvegrbuf_chunks =0 ; - }else if (pd->port_port ==0 && dd->ipath_port0_skbs) { + }else if (pd->port_port ==0 && dd->ipath_port0_skbinfo) {unsigned e; -struct sk_buff **skbs = dd->ipath_port0_skbs; - - dd->ipath_port0_skbs =NULL ; -ipath_cdbg (VERBOSE ,"free closed port %d ipath_port0_skbs " -"@ %p\n" , pd->port_port, skbs); +struct ipath_skbinfo *skbinfo = dd->ipath_port0_skbinfo; + + dd->ipath_port0_skbinfo =NULL ; +ipath_cdbg (VERBOSE ,"free closed port %d " +"ipath_port0_skbinfo @ %p\n" , pd->port_port, + skbinfo);for (e =0 ; e < dd->ipath_rcvegrcnt; e++) -if (skbs[e]) -dev_kfree_skb (skbs[e]); -vfree (skbs); +if (skbinfo[e].skb) { +pci_unmap_single (dd->pcidev, skbinfo[e].phys, + dd->ipath_ibmaxlen, +PCI_DMA_FROMDEVICE ); +dev_kfree_skb (skbinfo[e].skb); + } +vfree (skbinfo); }kfree (pd->port_tid_pg_list);vfree (pd->subport_uregbase);
@@ -1934,7 +1943,7 @@ static void cleanup_device(struct ipath_if (dd->ipath_pioavailregs_dma) {dma_free_coherent (&dd->pcidev->dev,PAGE_SIZE , - dd->ipath_pioavailregs_dma, + (void *) dd->ipath_pioavailregs_dma, dd->ipath_pioavailregs_phys); dd->ipath_pioavailregs_dma =NULL ; }
@@ -1947,6 +1956,7 @@ static void cleanup_device(struct ipath_if (dd->ipath_pageshadow) {struct page **tmpp = dd->ipath_pageshadow; +dma_addr_t *tmpd = dd->ipath_physshadow;int i, cnt =0 ; ipath_cdbg(VERBOSE, "Unlocking any expTID pages still "
@@ -1957,6 +1967,8 @@ static void cleanup_device(struct ipath_for (i = port_tidbase; i < maxtid; i++) {if (!tmpp[i])continue ; +pci_unmap_page (dd->pcidev, tmpd[i], +PAGE_SIZE ,PCI_DMA_FROMDEVICE );ipath_release_user_pages (&tmpp[i],1 ); tmpp[i] =NULL ; cnt++;
drivers/infiniband/hw/ipath/ipath_file_ops.c +33 -22
155 lines not on this page · raw message
drivers/infiniband/hw/ipath/ipath_iba6120.c +1 -1
@@ -1113,7 +1113,7 @@ static void ipath_pe_put_tid_2(struct ipif (pa != dd->ipath_tidinvalid) {if (pa & ((1U <<11 ) -1 )) {dev_info (&dd->pcidev->dev,"BUG: physaddr %lx " -"not 4KB aligned!\n" , pa); +"not 2KB aligned!\n" , pa);return ; } pa >>=11 ;
drivers/infiniband/hw/ipath/ipath_init_chip.c +38 -18
94 lines not on this page · raw message
drivers/infiniband/hw/ipath/ipath_intr.c +1 -1
@@ -605,7 +605,7 @@ static int handle_errors(struct ipath_de* don't report same point multiple times, * except kernel */ - tl = (u32) * pd->port_rcvhdrtail_kvaddr; + tl = *(u64 *) pd->port_rcvhdrtail_kvaddr;if (tl == dd->ipath_lastrcvhdrqtails[i])continue ; hd = ipath_read_ureg32(dd, ur_rcvhdrhead,
drivers/infiniband/hw/ipath/ipath_kernel.h +18 -2
@@ -39,6 +39,8 @@*/ #include <linux/interrupt.h> +#include <linux/pci.h> +#include <linux/dma-mapping.h> #include <asm/io.h> #include "ipath_common.h"
@@ -62,7 +64,7 @@ struct ipath_portdata {/* rcvhdrq base, needs mmap before useful */ void *port_rcvhdrq;/* kernel virtual address where hdrqtail is updated */ -volatile __le64 *port_rcvhdrtail_kvaddr; +void *port_rcvhdrtail_kvaddr;/* * temp buffer for expected send setup, allocated at open, instead * of each setup call
@@ -146,6 +148,11 @@ struct _ipath_layer {void *l_arg; }; +struct ipath_skbinfo { +struct sk_buff *skb; +dma_addr_t phys; +}; +struct ipath_devdata {struct list_head ipath_list;
@@ -168,7 +175,7 @@ struct ipath_devdata {/* ipath_cfgports pointers */ struct ipath_portdata **ipath_pd;/* sk_buffs used by port 0 eager receive queue */ -struct sk_buff **ipath_port0_skbs; +struct ipath_skbinfo *ipath_port0_skbinfo;/* kvirt address of 1st 2k pio buffer */ void __iomem *ipath_pio2kbase;/* kvirt address of 1st 4k pio buffer */
@@ -335,6 +342,8 @@ struct ipath_devdata {u64 *ipath_tidsimshadow;/* shadow copy of struct page *'s for exp tid pages */ struct page **ipath_pageshadow; +/* shadow copy of dma handles for exp tid pages */ +dma_addr_t *ipath_physshadow;/* lock to workaround chip bug 9437 */ spinlock_t ipath_tid_lock;
@@ -865,6 +874,13 @@ int ipathfs_remove_device(struct ipath_dint ipathfs_remove_device (struct ipath_devdata *);/* +* dma_addr wrappers - all 0's invalid for hw +*/ +dma_addr_t ipath_map_page (struct pci_dev *,struct page *,unsigned long , +size_t ,int ); +dma_addr_t ipath_map_single (struct pci_dev *,void *,size_t ,int ); + +/* * Flush write combining store buffers (if present) and perform a write * barrier. */
drivers/infiniband/hw/ipath/ipath_user_pages.c +56 -0
62 lines not on this page · raw message
drivers/infiniband/hw/ipath/ipath_wc_ppc64.c +15 -5
@@ -38,13 +38,23 @@#include "ipath_kernel.h" /** -* ipath_unordered_wc - indicate whether write combining is ordered +* ipath_enable_wc - enable write combining for MMIO writes to the device +* @dd: infinipath device * -* PowerPC systems (at least those in the 970 processor family) -* write partially filled store buffers in address order, but will write -* completely filled store buffers in "random" order, and therefore must -* have serialization for correctness with current InfiniPath chips. +* Nothing to do on PowerPC, so just return without error. +*/ +int ipath_enable_wc (struct ipath_devdata *dd) +{ +return 0 ; +} + +/** +* ipath_unordered_wc - indicate whether write combining is unordered * +* Because our performance depends on our ability to do write +* combining mmio writes in the most efficient way, we need to +* know if we are on a processor that may reorder stores when +* write combining. */ int ipath_unordered_wc (void ) {
PATCH 1/1 IB/ipath - fix and recover TXE piobuf and PBC parity errors
In reply to Bryan O'SullivanWe can sometimes trigger parity errors due to processor speculative
reads to our write-combined memory (mostly seen on Woodcrest). Add a
stats counter for these.
Factored out the sendbuffererror buffer cancellation code so it can be used in the new handling; suppress likely subsequent error messages if within two jiffies of the cancellation.
Also restore 2 dropped TXE lines on hwe_bitsextant noticed while debugging.
drivers/infiniband/hw/ipath/ipath_common.h +2 -1
@@ -141,8 +141,9 @@ struct infinipath_stats {* packets if ipath not configured, etc.) */ __u64 sps_krdrops; +__u64 sps_txeparity;// PIO buffer parity error, recovered /* pad for future growth */ -__u64 __sps_pad[46 ]; +__u64 __sps_pad[45 ]; };/*
drivers/infiniband/hw/ipath/ipath_iba6110.c +31 -1
@@ -451,7 +451,10 @@ static void ipath_ht_handle_hwerrors(str* make sure we get this much out, unless told to be quiet, * or it's occurred within the last 5 seconds */ -if ((hwerrs & ~dd->ipath_lasthwerror) || +if ((hwerrs & ~(dd->ipath_lasthwerror | + ((INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF | +INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC ) + <<INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT ))) || (ipath_debug & __IPATH_VERBDBG))dev_info (&dd->pcidev->dev,"Hardware error: hwerr=0x%llx " "(cleared)\n" , (unsigned long long ) hwerrs);
@@ -464,6 +467,33 @@ static void ipath_ht_handle_hwerrors(str ctrl =ipath_read_kreg32 (dd, dd->ipath_kregs->kr_control);if (ctrl &INFINIPATH_C_FREEZEMODE ) { +/* +* parity errors in send memory are recoverable, +* just cancel the send (if indicated in * sendbuffererror), +* count the occurrence, unfreeze (if no other handled +* hardware error bits are set), and continue. They can +* occur if a processor speculative read is done to the PIO +* buffer while we are sending a packet, for example. +*/ +if (hwerrs & ((INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF | +INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC ) + <<INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT )) { + ipath_stats.sps_txeparity++; +ipath_dbg ("Recovering from TXE parity error (%llu), " +"hwerrstatus=%llx\n" , + (unsigned long long ) ipath_stats.sps_txeparity, + (unsigned long long ) hwerrs); +ipath_disarm_senderrbufs (dd); + hwerrs &= ~((INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF | +INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC ) + <<INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT ); +if (!hwerrs) {// else leave in freeze mode +ipath_write_kreg (dd, + dd->ipath_kregs->kr_control, + dd->ipath_control); +return ; + } + }if (hwerrs) {/* * if any set that we aren't ignoring; only
drivers/infiniband/hw/ipath/ipath_iba6120.c +34 -3
@@ -370,7 +370,10 @@ static void ipath_pe_handle_hwerrors(str* make sure we get this much out, unless told to be quiet, * or it's occurred within the last 5 seconds */ -if ((hwerrs & ~dd->ipath_lasthwerror) || +if ((hwerrs & ~(dd->ipath_lasthwerror | + ((INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF | +INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC ) + <<INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT ))) || (ipath_debug & __IPATH_VERBDBG))dev_info (&dd->pcidev->dev,"Hardware error: hwerr=0x%llx " "(cleared)\n" , (unsigned long long ) hwerrs);
@@ -383,6 +386,33 @@ static void ipath_pe_handle_hwerrors(str ctrl =ipath_read_kreg32 (dd, dd->ipath_kregs->kr_control);if (ctrl &INFINIPATH_C_FREEZEMODE ) { +/* +* parity errors in send memory are recoverable, +* just cancel the send (if indicated in * sendbuffererror), +* count the occurrence, unfreeze (if no other handled +* hardware error bits are set), and continue. They can +* occur if a processor speculative read is done to the PIO +* buffer while we are sending a packet, for example. +*/ +if (hwerrs & ((INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF | +INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC ) + <<INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT )) { + ipath_stats.sps_txeparity++; +ipath_dbg ("Recovering from TXE parity error (%llu), " +"hwerrstatus=%llx\n" , + (unsigned long long ) ipath_stats.sps_txeparity, + (unsigned long long ) hwerrs); +ipath_disarm_senderrbufs (dd); + hwerrs &= ~((INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF | +INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC ) + <<INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT ); +if (!hwerrs) {// else leave in freeze mode +ipath_write_kreg (dd, + dd->ipath_kregs->kr_control, + dd->ipath_control); +return ; + } + }if (hwerrs) {/* * if any set that we aren't ignoring only make the
@@ -406,9 +436,8 @@ static void ipath_pe_handle_hwerrors(str }else {ipath_dbg ("Clearing freezemode on ignored hardware " "error\n" ); - ctrl &= ~INFINIPATH_C_FREEZEMODE ;ipath_write_kreg (dd, dd->ipath_kregs->kr_control, - ctrl); + dd->ipath_control); } }
@@ -880,6 +909,8 @@ static void ipath_init_pe_variables(stru dd->ipath_hwe_bitsextant = (INFINIPATH_HWE_RXEMEMPARITYERR_MASK <<INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT ) | + (INFINIPATH_HWE_TXEMEMPARITYERR_MASK << +INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT ) | (INFINIPATH_HWE_PCIEMEMPARITYERR_MASK <<INFINIPATH_HWE_PCIEMEMPARITYERR_SHIFT ) | INFINIPATH_HWE_PCIE1PLLFAILED |
drivers/infiniband/hw/ipath/ipath_intr.c +54 -46
119 lines not on this page · raw message
drivers/infiniband/hw/ipath/ipath_kernel.h +4 -2
@@ -427,6 +427,9 @@ struct ipath_devdata {unsigned long ipath_rcvctrl;/* shadow kr_sendctrl */ unsigned long ipath_sendctrl; +/* ports waiting for PIOavail intr */ +unsigned long ipath_portpiowait; +unsigned long ipath_lastcancel;// to not count armlaunch after cancel /* value we put in kr_rcvhdrcnt */ u32 ipath_rcvhdrcnt;
@@ -490,8 +493,6 @@ struct ipath_devdata {u32 ipath_htwidth;/* HT speed (200,400,800,1000) from HT config */ u32 ipath_htspeed; -/* ports waiting for PIOavail intr */ -unsigned long ipath_portpiowait;/* * number of sequential ibcstatus change for polling active/quiet * (i.e., link not coming up).
@@ -585,6 +586,7 @@ void ipath_disable_wc(struct ipath_devdavoid ipath_disable_wc (struct ipath_devdata *dd);int ipath_count_units (int *npresentp,int *nupp,u32 *maxportsp);void ipath_shutdown_device (struct ipath_devdata *); +void ipath_disarm_senderrbufs (struct ipath_devdata *);struct file_operations ; int ipath_cdev_init(int minor, char *name, struct file_operations *fops,
PATCH 1/1 IB/ipath - fix EEPROM read when driver is compiled with -Os
In reply to Bryan O'SullivanThe EEPROM is read via programmable I/O pins. When the driver is compiled -Os, the CPU can speculatively read the I/O value before it is valid. This patch fixes the problem.
drivers/infiniband/hw/ipath/ipath_eeprom.c +1 -0
@@ -187,6 +187,7 @@ static void i2c_wait_for_writes(struct istatic void i2c_wait_for_writes (struct ipath_devdata *dd) { (void )ipath_read_kreg32 (dd, dd->ipath_kregs->kr_scratch); +rmb (); }static void scl_out (struct ipath_devdata *dd,u8 bit)
PATCH 1/1 IB/ipath - support new PCIE device, QLE7142
In reply to Bryan O'Sullivandrivers/infiniband/hw/ipath/ipath_iba6120.c +3 -0
@@ -538,6 +538,9 @@ static int ipath_pe_boardname(struct ipacase 5 : n ="InfiniPath_QMH7140" ;break ; +case 6 : + n ="InfiniPath_QLE7142" ; +break ;default : ipath_dev_err(dd, "Don't yet know about board with ID %u\n",
PATCH 1/1 IB/mthca - Fix compiler warnings with gcc4 on possible unitialized variables
In reply to Bryan O'SullivanIt's possible (from the compiler perspective) that f0 is unitialized in two functions (shows up with gcc4.0.2 on fc4, for example). Initialize to zero to fix warning.
drivers/infiniband/hw/mthca/mthca_qp.c +2 -2
@@ -1527,7 +1527,7 @@ int mthca_tavor_post_send(struct ib_qp *int i;int size;int size0 =0 ; -u32 f0; +u32 f0 =0 ;int ind;u8 op0 =0 ;
@@ -1870,7 +1870,7 @@ int mthca_arbel_post_send(struct ib_qp *int i;int size;int size0 =0 ; -u32 f0; +u32 f0 =0 ;int ind;u8 op0 =0 ;
PATCH 1/1 IB/ipath - Set CPU affinity early
In reply to Bryan O'SullivanThis change moves around port assignment so that it happens before any memory is allocated. This allows memory to be allocated on an appropriate CPU, which improves performance for users of /dev/ipath.
drivers/infiniband/hw/ipath/ipath_common.h +5 -3
@@ -412,15 +412,17 @@ struct ipath_user_info {#define IPATH_CMD_MIN 16 -#define IPATH_CMD_USER_INIT 16/* set up userspace */ +#define __IPATH_CMD_USER_INIT 16/* old set up userspace (for old user code) */ #define IPATH_CMD_PORT_INFO 17/* find out what resources we got */ #define IPATH_CMD_RECV_CTRL 18/* control receipt of packets */ #define IPATH_CMD_TID_UPDATE 19/* update expected TID entries */ #define IPATH_CMD_TID_FREE 20/* free expected TID entries */ #define IPATH_CMD_SET_PART_KEY 21/* add partition key */ #define IPATH_CMD_SLAVE_INFO 22/* return info on slave processes */ - -#define IPATH_CMD_MAX 22 +#define IPATH_CMD_ASSIGN_PORT 23/* allocate HCA and port */ +#define IPATH_CMD_USER_INIT 24/* set up userspace */ + +#define IPATH_CMD_MAX 24struct ipath_port_info {__u32 num_active;/* number of active units */
drivers/infiniband/hw/ipath/ipath_file_ops.c +31 -8
@@ -1701,18 +1701,17 @@ done:static int ipath_open (struct inode *in,struct file *fp) { -/* The real work is performed later in ipath_do_user_init() */ +/* The real work is performed later in ipath_assign_port() */ fp->private_data =kzalloc (sizeof (struct ipath_filedata ),GFP_KERNEL );return fp->private_data ?0 : -ENOMEM ; } -static int ipath_do_user_init (struct file *fp, + +// Get port early, so can set affinity prior to memory allocation +static int ipath_assign_port (struct file *fp,const struct ipath_user_info *uinfo) {int ret; -struct ipath_portdata *pd; -struct ipath_devdata *dd; -u32 head32;int i_minor;unsigned swminor;
@@ -1757,8 +1756,18 @@ static int ipath_do_user_init(struct filmutex_unlock (&ipath_mutex); -if (ret) - goto done; +done: +return ret; +} + + +static int ipath_do_user_init (struct file *fp, +const struct ipath_user_info *uinfo) +{ +int ret; +struct ipath_portdata *pd; +struct ipath_devdata *dd; +u32 head32; pd =port_fp (fp); dd = pd->port_dd;
@@ -2035,6 +2044,8 @@ static ssize_t ipath_write(struct file * consumed =sizeof (cmd.type);switch (cmd.type) { +case IPATH_CMD_ASSIGN_PORT : +case __IPATH_CMD_USER_INIT:case IPATH_CMD_USER_INIT : copy =sizeof (cmd.cmd.user_info); dest = &cmd.cmd.user_info;
@@ -2083,12 +2094,24 @@ static ssize_t ipath_write(struct file * consumed += copy; pd =port_fp (fp); -if (!pd && cmd.type !=IPATH_CMD_USER_INIT ) { +if (!pd && cmd.type != __IPATH_CMD_USER_INIT && + cmd.type !=IPATH_CMD_ASSIGN_PORT ) { ret = -EINVAL ; goto bail; }switch (cmd.type) { +case IPATH_CMD_ASSIGN_PORT : + ret =ipath_assign_port (fp, &cmd.cmd.user_info); +if (ret) + goto bail; +break ; +case __IPATH_CMD_USER_INIT: +// backwards compatibility, get port first + ret =ipath_assign_port (fp, &cmd.cmd.user_info); +if (ret) + goto bail; +// and fall through to current version. case IPATH_CMD_USER_INIT : ret =ipath_do_user_init (fp, &cmd.cmd.user_info);if (ret)
PATCH 1/1 IB/ipath - fix races with ib_resize_cq()
In reply to Bryan O'SullivanThe resize CQ function changes the memory used to store the queue. Other routines need to honor the lock before accessing the pointer to the queue and verify that the head and tail are in range.
drivers/infiniband/hw/ipath/ipath_cq.c +23 -9
@@ -46,7 +46,7 @@*/ void ipath_cq_enter (struct ipath_cq *cq,struct ib_wc *entry,int solicited) { -struct ipath_cq_wc *wc = cq->queue; +struct ipath_cq_wc *wc;unsigned long flags;u32 head;u32 next;
@@ -57,6 +57,7 @@ void ipath_cq_enter(struct ipath_cq *cq,* Note that the head pointer might be writable by user processes. * Take care to verify it is a sane value. */ + wc = cq->queue; head = wc->head;if (head >= (unsigned ) cq->ibcq.cqe) { head = cq->ibcq.cqe;
@@ -109,21 +110,27 @@ int ipath_poll_cq(struct ib_cq *ibcq, inint ipath_poll_cq (struct ib_cq *ibcq,int num_entries,struct ib_wc *entry) {struct ipath_cq *cq =to_icq (ibcq); -struct ipath_cq_wc *wc = cq->queue; +struct ipath_cq_wc *wc;unsigned long flags;int npolled; +u32 tail;spin_lock_irqsave (&cq->lock, flags); + wc = cq->queue; + tail = wc->tail; +if (tail > (u32 ) cq->ibcq.cqe) + tail = (u32 ) cq->ibcq.cqe;for (npolled =0 ; npolled < num_entries; ++npolled, ++entry) { -if (wc->tail == wc->head) +if (tail == wc->head)break ; - *entry = wc->queue[wc->tail]; -if (wc->tail >= cq->ibcq.cqe) - wc->tail =0 ; + *entry = wc->queue[tail]; +if (tail >= cq->ibcq.cqe) + tail =0 ;else - wc->tail++; - } + tail++; + } + wc->tail = tail;spin_unlock_irqrestore (&cq->lock, flags);
@@ -322,10 +329,16 @@ int ipath_req_notify_cq(struct ib_cq *ibreturn 0 ; } +/** +* ipath_resize_cq - change the size of the CQ +* @ibcq: the completion queue +* +* Returns 0 for success. +*/ int ipath_resize_cq (struct ib_cq *ibcq,int cqe,struct ib_udata *udata) {struct ipath_cq *cq =to_icq (ibcq); -struct ipath_cq_wc *old_wc = cq->queue; +struct ipath_cq_wc *old_wc;struct ipath_cq_wc *wc;u32 head, tail, n;int ret;
@@ -361,6 +374,7 @@ int ipath_resize_cq(struct ib_cq *ibcq,* Make sure head and tail are sane since they * might be user writable. */ + old_wc = cq->queue; head = old_wc->head;if (head > (u32 ) cq->ibcq.cqe) head = (u32 ) cq->ibcq.cqe;
PATCH 1/1 IB/ipath - fix lockdep error upon "ifconfig ibN down"
In reply to Bryan O'Sullivandrivers/infiniband/hw/ipath/ipath_verbs.c +8 -6
@@ -1202,6 +1202,7 @@ static struct ib_ah *ipath_create_ah(strstruct ipath_ah *ah;struct ib_ah *ret;struct ipath_ibdev *dev =to_idev (pd->device); +unsigned long flags;/* A multicast address requires a GRH (see ch. 8.4.1). */ if (ah_attr->dlid >= IPATH_MULTICAST_LID_BASE &&
@@ -1228,16 +1229,16 @@ static struct ib_ah *ipath_create_ah(str goto bail; } -spin_lock (&dev->n_ahs_lock); +spin_lock_irqsave (&dev->n_ahs_lock, flags);if (dev->n_ahs_allocated == ib_ipath_max_ahs) { -spin_unlock (&dev->n_ahs_lock); +spin_unlock_irqrestore (&dev->n_ahs_lock, flags);kfree (ah); ret =ERR_PTR (-ENOMEM ); goto bail; } dev->n_ahs_allocated++; -spin_unlock (&dev->n_ahs_lock); +spin_unlock_irqrestore (&dev->n_ahs_lock, flags);/* ib_create_ah() will initialize ah->ibah. */ ah->attr = *ah_attr;
@@ -1258,10 +1259,11 @@ static int ipath_destroy_ah(struct ib_ah {struct ipath_ibdev *dev =to_idev (ibah->device);struct ipath_ah *ah =to_iah (ibah); - -spin_lock (&dev->n_ahs_lock); +unsigned long flags; + +spin_lock_irqsave (&dev->n_ahs_lock, flags); dev->n_ahs_allocated--; -spin_unlock (&dev->n_ahs_lock); +spin_unlock_irqrestore (&dev->n_ahs_lock, flags);kfree (ah);
PATCH 1/1 IB/ipath - support multiple simultaneous devices of different types
In reply to Bryan O'SullivanPrior to this change, the driver was not able to support a HT and PCIE card simultaneously present in the same machine.
drivers/infiniband/hw/ipath/ipath_driver.c +0 -10
@@ -94,16 +94,6 @@ const char *ipath_ibcstatus_str[] = {"RecovWaitRmt" , "RecovIdle", }; - -/* -* These variables are initialized in the chip-specific files -* but are defined here. -*/ -u16 ipath_gpio_sda_num, ipath_gpio_scl_num; -u64 ipath_gpio_sda, ipath_gpio_scl; -u64 infinipath_i_bitsextant; -ipath_err_t infinipath_e_bitsextant, infinipath_hwe_bitsextant; -u32 infinipath_i_rcvavail_mask, infinipath_i_rcvurg_mask; static void __devexit ipath_remove_one(struct pci_dev *); static int __devinit ipath_init_one(struct pci_dev *,
drivers/infiniband/hw/ipath/ipath_eeprom.c +8 -8
@@ -100,9 +100,9 @@ static int i2c_gpio_set(struct ipath_dev gpioval = &dd->ipath_gpio_out; read_val =ipath_read_kreg64 (dd, dd->ipath_kregs->kr_extctrl);if (line == i2c_line_scl) - mask = ipath_gpio_scl; + mask = dd->ipath_gpio_scl;else - mask = ipath_gpio_sda; + mask = dd->ipath_gpio_sda;if (new_line_state == i2c_line_high)/* tri-state the output rather than force high */
@@ -119,12 +119,12 @@ static int i2c_gpio_set(struct ipath_dev write_val =0x0UL ;if (line == i2c_line_scl) { - write_val <<= ipath_gpio_scl_num; - *gpioval = *gpioval & ~(1UL << ipath_gpio_scl_num); + write_val <<= dd->ipath_gpio_scl_num; + *gpioval = *gpioval & ~(1UL << dd->ipath_gpio_scl_num); *gpioval |= write_val; }else { - write_val <<= ipath_gpio_sda_num; - *gpioval = *gpioval & ~(1UL << ipath_gpio_sda_num); + write_val <<= dd->ipath_gpio_sda_num; + *gpioval = *gpioval & ~(1UL << dd->ipath_gpio_sda_num); *gpioval |= write_val; }ipath_write_kreg (dd, dd->ipath_kregs->kr_gpio_out, *gpioval);
@@ -157,9 +157,9 @@ static int i2c_gpio_get(struct ipath_dev read_val =ipath_read_kreg64 (dd, dd->ipath_kregs->kr_extctrl);/* config line to be an input */ if (line == i2c_line_scl) - mask = ipath_gpio_scl; + mask = dd->ipath_gpio_scl;else - mask = ipath_gpio_sda; + mask = dd->ipath_gpio_sda; write_val = read_val & ~mask;ipath_write_kreg (dd, dd->ipath_kregs->kr_extctrl, write_val); read_val =ipath_read_kreg64 (dd, dd->ipath_kregs->kr_extstatus);
drivers/infiniband/hw/ipath/ipath_iba6110.c +18 -18
@@ -252,8 +252,8 @@ static const struct ipath_cregs ipath_ht };/* kr_intstatus, kr_intclear, kr_intmask bits */ -#define INFINIPATH_I_RCVURG_MASK 0x1FF -#define INFINIPATH_I_RCVAVAIL_MASK 0x1FF +#define INFINIPATH_I_RCVURG_MASK ((1U<<9)-1) +#define INFINIPATH_I_RCVAVAIL_MASK ((1U<<9)-1)/* kr_hwerrclear, kr_hwerrmask, kr_hwerrstatus, bits */ #define INFINIPATH_HWE_HTCMEMPARITYERR_SHIFT 0
@@ -457,10 +457,10 @@ static void ipath_ht_handle_hwerrors(str "(cleared)\n", (unsigned long long) hwerrs); dd->ipath_lasthwerror |= hwerrs; -if (hwerrs & ~infinipath_hwe_bitsextant) +if (hwerrs & ~dd->ipath_hwe_bitsextant)ipath_dev_err (dd,"hwerror interrupt with unknown errors " "%llx set\n" , (unsigned long long ) - (hwerrs & ~infinipath_hwe_bitsextant)); + (hwerrs & ~dd->ipath_hwe_bitsextant)); ctrl =ipath_read_kreg32 (dd, dd->ipath_kregs->kr_control);if (ctrl &INFINIPATH_C_FREEZEMODE ) {
@@ -1059,21 +1059,21 @@ static void ipath_setup_ht_setextled(stripath_write_kreg (dd, dd->ipath_kregs->kr_extctrl, extctl); } -static void ipath_init_ht_variables (void ) -{ - ipath_gpio_sda_num = _IPATH_GPIO_SDA_NUM; - ipath_gpio_scl_num = _IPATH_GPIO_SCL_NUM; - ipath_gpio_sda =IPATH_GPIO_SDA ; - ipath_gpio_scl =IPATH_GPIO_SCL ; - - infinipath_i_bitsextant = +static void ipath_init_ht_variables (struct ipath_devdata *dd) +{ + dd->ipath_gpio_sda_num = _IPATH_GPIO_SDA_NUM; + dd->ipath_gpio_scl_num = _IPATH_GPIO_SCL_NUM; + dd->ipath_gpio_sda =IPATH_GPIO_SDA ; + dd->ipath_gpio_scl =IPATH_GPIO_SCL ; + + dd->ipath_i_bitsextant = (INFINIPATH_I_RCVURG_MASK <<INFINIPATH_I_RCVURG_SHIFT ) | (INFINIPATH_I_RCVAVAIL_MASK <<INFINIPATH_I_RCVAVAIL_SHIFT ) |INFINIPATH_I_ERROR |INFINIPATH_I_SPIOSENT |INFINIPATH_I_SPIOBUFAVAIL |INFINIPATH_I_GPIO ; - infinipath_e_bitsextant = + dd->ipath_e_bitsextant =INFINIPATH_E_RFORMATERR |INFINIPATH_E_RVCRC |INFINIPATH_E_RICRC |INFINIPATH_E_RMINPKTLEN | INFINIPATH_E_RMAXPKTLEN | INFINIPATH_E_RLONGPKTLEN |
@@ -1091,7 +1091,7 @@ static void ipath_init_ht_variables(voidINFINIPATH_E_INVALIDADDR |INFINIPATH_E_RESET |INFINIPATH_E_HARDWARE ; - infinipath_hwe_bitsextant = + dd->ipath_hwe_bitsextant = (INFINIPATH_HWE_HTCMEMPARITYERR_MASK << INFINIPATH_HWE_HTCMEMPARITYERR_SHIFT) | (INFINIPATH_HWE_TXEMEMPARITYERR_MASK <<
@@ -1120,8 +1120,8 @@ static void ipath_init_ht_variables(voidINFINIPATH_HWE_IBCBUSTOSPCPARITYERR |INFINIPATH_HWE_IBCBUSFRSPCPARITYERR ; - infinipath_i_rcvavail_mask =INFINIPATH_I_RCVAVAIL_MASK ; - infinipath_i_rcvurg_mask =INFINIPATH_I_RCVURG_MASK ; + dd->ipath_i_rcvavail_mask =INFINIPATH_I_RCVAVAIL_MASK ; + dd->ipath_i_rcvurg_mask =INFINIPATH_I_RCVURG_MASK ; }/**
@@ -1586,5 +1586,5 @@ void ipath_init_iba6110_funcs(struct ipa* do very early init that is needed before ipath_f_bus is * called */ -ipath_init_ht_variables (); -} +ipath_init_ht_variables (dd); +}
drivers/infiniband/hw/ipath/ipath_iba6120.c +17 -17
@@ -263,8 +263,8 @@ static const struct ipath_cregs ipath_pe };/* kr_intstatus, kr_intclear, kr_intmask bits */ -#define INFINIPATH_I_RCVURG_MASK 0x1F -#define INFINIPATH_I_RCVAVAIL_MASK 0x1F +#define INFINIPATH_I_RCVURG_MASK ((1U<<5)-1) +#define INFINIPATH_I_RCVAVAIL_MASK ((1U<<5)-1)/* kr_hwerrclear, kr_hwerrmask, kr_hwerrstatus, bits */ #define INFINIPATH_HWE_PCIEMEMPARITYERR_MASK 0x000000000000003fULL
@@ -376,10 +376,10 @@ static void ipath_pe_handle_hwerrors(str "(cleared)\n", (unsigned long long) hwerrs); dd->ipath_lasthwerror |= hwerrs; -if (hwerrs & ~infinipath_hwe_bitsextant) +if (hwerrs & ~dd->ipath_hwe_bitsextant)ipath_dev_err (dd,"hwerror interrupt with unknown errors " "%llx set\n" , (unsigned long long ) - (hwerrs & ~infinipath_hwe_bitsextant)); + (hwerrs & ~dd->ipath_hwe_bitsextant)); ctrl =ipath_read_kreg32 (dd, dd->ipath_kregs->kr_control);if (ctrl &INFINIPATH_C_FREEZEMODE ) {
@@ -865,19 +865,19 @@ static int ipath_setup_pe_config(structreturn 0 ; } -static void ipath_init_pe_variables (void ) +static void ipath_init_pe_variables (struct ipath_devdata *dd) {/* * bits for selecting i2c direction and values, * used for I2C serial flash */ - ipath_gpio_sda_num = _IPATH_GPIO_SDA_NUM; - ipath_gpio_scl_num = _IPATH_GPIO_SCL_NUM; - ipath_gpio_sda =IPATH_GPIO_SDA ; - ipath_gpio_scl =IPATH_GPIO_SCL ; + dd->ipath_gpio_sda_num = _IPATH_GPIO_SDA_NUM; + dd->ipath_gpio_scl_num = _IPATH_GPIO_SCL_NUM; + dd->ipath_gpio_sda =IPATH_GPIO_SDA ; + dd->ipath_gpio_scl =IPATH_GPIO_SCL ;/* variables for sanity checking interrupt and errors */ - infinipath_hwe_bitsextant = + dd->ipath_hwe_bitsextant = (INFINIPATH_HWE_RXEMEMPARITYERR_MASK << INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT) | (INFINIPATH_HWE_PCIEMEMPARITYERR_MASK <<
@@ -895,13 +895,13 @@ static void ipath_init_pe_variables(voidINFINIPATH_HWE_SERDESPLLFAILED |INFINIPATH_HWE_IBCBUSTOSPCPARITYERR |INFINIPATH_HWE_IBCBUSFRSPCPARITYERR ; - infinipath_i_bitsextant = + dd->ipath_i_bitsextant = (INFINIPATH_I_RCVURG_MASK <<INFINIPATH_I_RCVURG_SHIFT ) | (INFINIPATH_I_RCVAVAIL_MASK <<INFINIPATH_I_RCVAVAIL_SHIFT ) |INFINIPATH_I_ERROR |INFINIPATH_I_SPIOSENT |INFINIPATH_I_SPIOBUFAVAIL |INFINIPATH_I_GPIO ; - infinipath_e_bitsextant = + dd->ipath_e_bitsextant =INFINIPATH_E_RFORMATERR |INFINIPATH_E_RVCRC |INFINIPATH_E_RICRC |INFINIPATH_E_RMINPKTLEN | INFINIPATH_E_RMAXPKTLEN | INFINIPATH_E_RLONGPKTLEN |
@@ -919,8 +919,8 @@ static void ipath_init_pe_variables(voidINFINIPATH_E_INVALIDADDR |INFINIPATH_E_RESET |INFINIPATH_E_HARDWARE ; - infinipath_i_rcvavail_mask =INFINIPATH_I_RCVAVAIL_MASK ; - infinipath_i_rcvurg_mask =INFINIPATH_I_RCVURG_MASK ; + dd->ipath_i_rcvavail_mask =INFINIPATH_I_RCVAVAIL_MASK ; + dd->ipath_i_rcvurg_mask =INFINIPATH_I_RCVURG_MASK ; }/* setup the MSI stuff again after a reset. I'd like to just call
@@ -1326,6 +1326,6 @@ void ipath_init_iba6120_funcs(struct ipa dd->ipath_kregs = &ipath_pe_kregs; dd->ipath_cregs = &ipath_pe_cregs; -ipath_init_pe_variables (); -} - +ipath_init_pe_variables (dd); +} +
drivers/infiniband/hw/ipath/ipath_intr.c +8 -8
@@ -480,10 +480,10 @@ static int handle_errors(struct ipath_de dd->ipath_f_handle_hwerrors (dd, msg,sizeof msg); } -if (!noprint && (errs & ~infinipath_e_bitsextant)) +if (!noprint && (errs & ~dd->ipath_e_bitsextant))ipath_dev_err (dd,"error interrupt with unknown errors " "%llx set\n" , (unsigned long long ) - (errs & ~infinipath_e_bitsextant)); + (errs & ~dd->ipath_e_bitsextant));if (errs &E_SUM_ERRS ) ignore_this_time =handle_e_sum_errs (dd, errs);
@@ -805,9 +805,9 @@ static void handle_urcv(struct ipath_devint rcvdint =0 ; portr = ((istat >>INFINIPATH_I_RCVAVAIL_SHIFT ) & - infinipath_i_rcvavail_mask) + dd->ipath_i_rcvavail_mask) | ((istat >>INFINIPATH_I_RCVURG_SHIFT ) & - infinipath_i_rcvurg_mask); + dd->ipath_i_rcvurg_mask);for (i =1 ; i < dd->ipath_cfgports; i++) {struct ipath_portdata *pd = dd->ipath_pd[i]; if (portr & (1 << i) && pd && pd->port_cnt &&
@@ -914,10 +914,10 @@ irqreturn_t ipath_intr(int irq, void *daif (unexpected) unexpected =0 ; -if (unlikely (istat & ~infinipath_i_bitsextant)) +if (unlikely (istat & ~dd->ipath_i_bitsextant))ipath_dev_err (dd,"interrupt with unknown interrupts %x set\n" , - istat & (u32 ) ~ infinipath_i_bitsextant); + istat & (u32 ) ~ dd->ipath_i_bitsextant);else ipath_cdbg (VERBOSE ,"intr stat=0x%x\n" , istat);
@@ -1041,9 +1041,9 @@ irqreturn_t ipath_intr(int irq, void *da istat &= ~port0rbits; } -if (istat & ((infinipath_i_rcvavail_mask << +if (istat & ((dd->ipath_i_rcvavail_mask <<INFINIPATH_I_RCVAVAIL_SHIFT ) - | (infinipath_i_rcvurg_mask << + | (dd->ipath_i_rcvurg_mask <<INFINIPATH_I_RCVURG_SHIFT )))handle_urcv (dd, istat);
drivers/infiniband/hw/ipath/ipath_kernel.h +24 -0
@@ -533,6 +533,30 @@ struct ipath_devdata {u32 ipath_rxfc_unsupvl_errs;u32 ipath_overrun_thresh_errs;u32 ipath_lli_errs; + +/* +* Not all devices managed by a driver instance are the same +* type, so these fields must be per-device. +*/ +u64 ipath_i_bitsextant; +ipath_err_t ipath_e_bitsextant; +ipath_err_t ipath_hwe_bitsextant; + +/* +* Below should be computable from number of ports, +* since they are never modified. +*/ +u32 ipath_i_rcvavail_mask; +u32 ipath_i_rcvurg_mask; + +/* +* Register bits for selecting i2c direction and values, used for +* I2C serial flash. +*/ +u16 ipath_gpio_sda_num; +u16 ipath_gpio_scl_num; +u64 ipath_gpio_sda; +u64 ipath_gpio_scl; };/* Private data for file operations */
drivers/infiniband/hw/ipath/ipath_registers.h +11 -7
@@ -316,19 +316,23 @@typedef u64 ipath_err_t ; +/* The following change with the type of device, so +* need to be part of the ipath_devdata struct, or +* we could have problems plugging in devices of +* different types (e.g. one HT, one PCIE) +* in one system, to be managed by one driver. +* On the other hand, this file is may also be included +* by other code, so leave the declarations here +* temporarily. Minor footprint issue if common-model +* linker used, none if C89+ linker used. +*/ +/* mask of defined bits for various registers */ extern u64 infinipath_i_bitsextant;extern ipath_err_t infinipath_e_bitsextant, infinipath_hwe_bitsextant;/* masks that are different in various chips, or only exist in some chips */ extern u32 infinipath_i_rcvavail_mask, infinipath_i_rcvurg_mask; - -/* -* register bits for selecting i2c direction and values, used for I2C serial -* flash -*/ -extern u16 ipath_gpio_sda_num, ipath_gpio_scl_num; -extern u64 ipath_gpio_sda, ipath_gpio_scl;/* * These are the infinipath general register numbers (not offsets).
PATCH 1/1 IB/ipath - drop unnecessary "(void *)" casts
In reply to Bryan O'Sullivandrivers/infiniband/hw/ipath/ipath_driver.c +3 -3
@@ -1350,7 +1350,7 @@ int ipath_create_rcvhdrq(struct ipath_de/* clear for security and sanity on each use */ memset (pd->port_rcvhdrq,0 , pd->port_rcvhdrq_size); -memset ((void *)pd->port_rcvhdrtail_kvaddr,0 ,PAGE_SIZE ); +memset (pd->port_rcvhdrtail_kvaddr,0 ,PAGE_SIZE );/* * tell chip each time we init it, even if we are re-using previous
@@ -1803,7 +1803,7 @@ void ipath_free_pddata(struct ipath_devd pd->port_rcvhdrq =NULL ;if (pd->port_rcvhdrtail_kvaddr) {dma_free_coherent (&dd->pcidev->dev,PAGE_SIZE , - (void *)pd->port_rcvhdrtail_kvaddr, + pd->port_rcvhdrtail_kvaddr, pd->port_rcvhdrqtailaddr_phys); pd->port_rcvhdrtail_kvaddr =NULL ; }
@@ -1934,7 +1934,7 @@ static void cleanup_device(struct ipath_if (dd->ipath_pioavailregs_dma) {dma_free_coherent (&dd->pcidev->dev,PAGE_SIZE , - (void *) dd->ipath_pioavailregs_dma, + dd->ipath_pioavailregs_dma, dd->ipath_pioavailregs_phys); dd->ipath_pioavailregs_dma =NULL ; }
PATCH 1/1 IB/ipath - fix compiler warnings and errors on non-x86_64 systems
In reply to Bryan O'Sullivandrivers/infiniband/hw/ipath/ipath_file_ops.c +4 -5
@@ -206,11 +206,10 @@ static int ipath_get_base_info(struct fi kinfo->spi_subport_rcvhdr_base = (u64 ) pd->subport_rcvhdr_base &MMAP64_MASK ;ipath_cdbg (PROC ,"port %u flags %x %llx %llx %llx\n" , - kinfo->spi_port, - kinfo->spi_runtime_flags, - kinfo->spi_subport_uregbase, - kinfo->spi_subport_rcvegrbuf, - kinfo->spi_subport_rcvhdr_base); + kinfo->spi_port, kinfo->spi_runtime_flags, + (unsigned long long ) kinfo->spi_subport_uregbase, + (unsigned long long ) kinfo->spi_subport_rcvegrbuf, + (unsigned long long ) kinfo->spi_subport_rcvhdr_base); }if (copy_to_user (ubase, kinfo,sizeof (*kinfo)))
PATCH 1/1 IB/ipath - Fix mismatch in shifts and masks for printing debug info
In reply to Bryan O'SullivanFixed mismatch in linkstate/trainingstate shifts and masks in the IPATH_IBSTATE_MASK macro. It kept some linktrainingstates from being printed correctly in debug; no functionality issue unless I misread the code.
drivers/infiniband/hw/ipath/ipath_registers.h +2 -2
@@ -223,9 +223,9 @@/* combination link status states that we use with some frequency */ #define IPATH_IBSTATE_MASK ((INFINIPATH_IBCS_LINKTRAININGSTATE_MASK \ - << INFINIPATH_IBCS_LINKSTATE_SHIFT) | \ + << INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT) | \ (INFINIPATH_IBCS_LINKSTATE_MASK \ - <<INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT)) + <<INFINIPATH_IBCS_LINKSTATE_SHIFT))#define IPATH_IBSTATE_INIT ((INFINIPATH_IBCS_L_STATE_INIT \ << INFINIPATH_IBCS_LINKSTATE_SHIFT) | \ (INFINIPATH_IBCS_LT_STATE_LINKUP \
PATCH 1/1 IB/ipath - count SRQs properly
In reply to Bryan O'Sullivandrivers/infiniband/hw/ipath/ipath_srq.c +15 -8
@@ -103,11 +103,6 @@ struct ib_srq *ipath_create_srq(struct istruct ipath_srq *srq;u32 sz;struct ib_srq *ret; - -if (dev->n_srqs_allocated == ib_ipath_max_srqs) { - ret =ERR_PTR (-ENOMEM ); - goto done; - }if (srq_init_attr->attr.max_wr ==0 ) { ret =ERR_PTR (-EINVAL );
@@ -180,10 +175,17 @@ struct ib_srq *ipath_create_srq(struct ispin_lock_init (&srq->rq.lock); srq->rq.wq->head =0 ; srq->rq.wq->tail =0 ; - srq->rq.max_sge = srq_init_attr->attr.max_sge; srq->limit = srq_init_attr->attr.srq_limit; - dev->n_srqs_allocated++; +spin_lock (&dev->n_srqs_lock); +if (dev->n_srqs_allocated == ib_ipath_max_srqs) { +spin_unlock (&dev->n_srqs_lock); + ret =ERR_PTR (-ENOMEM ); + goto bail_wq; + } + + dev->n_srqs_allocated++; +spin_unlock (&dev->n_srqs_lock); ret = &srq->ibsrq; goto done;
@@ -351,8 +353,13 @@ int ipath_destroy_srq(struct ib_srq *ibsstruct ipath_srq *srq =to_isrq (ibsrq);struct ipath_ibdev *dev =to_idev (ibsrq->device); +spin_lock (&dev->n_srqs_lock); dev->n_srqs_allocated--; -vfree (srq->rq.wq); +spin_unlock (&dev->n_srqs_lock); +if (srq->ip) +kref_put (&srq->ip->ref, ipath_release_mmap_info); +else +vfree (srq->rq.wq);kfree (srq);return 0 ;
PATCH 1/1 IB/ipath - RC and UC should validate SLID and DLID
In reply to Bryan O'SullivanThis is required for IB conformance (spec ch. 9.6.1.5).
drivers/infiniband/hw/ipath/ipath_rc.c +4 -0
@@ -1319,6 +1319,10 @@ void ipath_rc_rcv(struct ipath_ibdev *deint diff;struct ib_reth *reth;int header_in_data; + +/* Validate the SLID. See Ch. 9.6.1.5 */ +if (unlikely (be16_to_cpu (hdr->lrh[3 ]) != qp->remote_ah_attr.dlid)) + goto done;/* Check for GRH */ if (!has_grh) {
drivers/infiniband/hw/ipath/ipath_uc.c +4 -0
@@ -246,6 +246,10 @@ void ipath_uc_rcv(struct ipath_ibdev *destruct ib_reth *reth;int header_in_data; +/* Validate the SLID. See Ch. 9.6.1.5 */ +if (unlikely (be16_to_cpu (hdr->lrh[3 ]) != qp->remote_ah_attr.dlid)) + goto done; +/* Check for GRH */ if (!has_grh) { ohdr = &hdr->u.oth;
PATCH 1/1 IB/ipath - only allow complete writes to flash
In reply to Bryan O'SullivanDon't allow a write to the eeprom from ipathfs unless the write is exactly 128 bytes and starts at offset 0.
drivers/infiniband/hw/ipath/ipath_fs.c +5 -8
@@ -357,18 +357,15 @@ static ssize_t flash_write(struct file * pos = *ppos; -if ( pos <0 ) { +if (pos !=0 ) { ret = -EINVAL ; goto bail; } -if (pos >=sizeof (struct ipath_flash )) { - ret =0 ; - goto bail; - } - -if (count >sizeof (struct ipath_flash ) - pos) - count =sizeof (struct ipath_flash ) - pos; +if (count !=sizeof (struct ipath_flash )) { + ret = -EINVAL ; + goto bail; + } tmp =kmalloc (count,GFP_KERNEL );if (!tmp) {
PATCH 1/1 IB/ipath - ensure that PD of MR matches PD of QP checking the Rkey
In reply to Bryan O'Sullivandrivers/infiniband/hw/ipath/ipath_keys.c +8 -4
@@ -118,9 +118,10 @@ void ipath_free_lkey(struct ipath_lkey_t* Check the IB SGE for validity and initialize our internal version * of it. */ -int ipath_lkey_ok (struct ipath_lkey_table *rkt,struct ipath_sge *isge, +int ipath_lkey_ok (struct ipath_qp *qp,struct ipath_sge *isge,struct ib_sge *sge,int acc) { +struct ipath_lkey_table *rkt = &to_idev (qp->ibqp.device)->lk_table;struct ipath_mregion *mr;unsigned n, m;size_t off;
@@ -140,7 +141,8 @@ int ipath_lkey_ok(struct ipath_lkey_tabl goto bail; } mr = rkt->table[(sge->lkey >> (32 - ib_ipath_lkey_table_size))]; -if (unlikely (mr ==NULL || mr->lkey != sge->lkey)) { +if (unlikely (mr ==NULL || mr->lkey != sge->lkey || + qp->ibqp.pd != mr->pd)) { ret =0 ; goto bail; }
@@ -188,9 +190,10 @@ bail:* * Return 1 if successful, otherwise 0. */ -int ipath_rkey_ok (struct ipath_ibdev *dev,struct ipath_sge_state *ss, +int ipath_rkey_ok (struct ipath_qp *qp,struct ipath_sge_state *ss,u32 len,u64 vaddr,u32 rkey,int acc) { +struct ipath_ibdev *dev =to_idev (qp->ibqp.device);struct ipath_lkey_table *rkt = &dev->lk_table;struct ipath_sge *sge = &ss->sge;struct ipath_mregion *mr;
@@ -214,7 +217,8 @@ int ipath_rkey_ok(struct ipath_ibdev *de } mr = rkt->table[(rkey >> (32 - ib_ipath_lkey_table_size))]; -if (unlikely (mr ==NULL || mr->lkey != rkey)) { +if (unlikely (mr ==NULL || mr->lkey != rkey || + qp->ibqp.pd != mr->pd)) { ret =0 ; goto bail; }
drivers/infiniband/hw/ipath/ipath_mr.c +3 -0
@@ -138,6 +138,7 @@ struct ib_mr *ipath_reg_phys_mr(struct i goto bail; } + mr->mr.pd = pd; mr->mr.user_base = *iova_start; mr->mr.iova = *iova_start; mr->mr.length =0 ;
@@ -197,6 +198,7 @@ struct ib_mr *ipath_reg_user_mr(struct i goto bail; } + mr->mr.pd = pd; mr->mr.user_base = region->user_base; mr->mr.iova = region->virt_base; mr->mr.length = region->length;
@@ -289,6 +291,7 @@ struct ib_fmr *ipath_alloc_fmr(struct ib* Resources are allocated but no valid mapping (RKEY can't be * used). */ + fmr->mr.pd = pd; fmr->mr.user_base =0 ; fmr->mr.iova =0 ; fmr->mr.length =0 ;
drivers/infiniband/hw/ipath/ipath_rc.c +4 -4
@@ -1234,7 +1234,7 @@ static inline int ipath_rc_rcv_error(str* Address range must be a subset of the original * request and start on pmtu boundaries. */ - ok =ipath_rkey_ok (dev, &qp->s_rdma_sge, + ok =ipath_rkey_ok (qp, &qp->s_rdma_sge, qp->s_rdma_len, vaddr, rkey,IB_ACCESS_REMOTE_READ );if (unlikely (!ok)) {
@@ -1532,7 +1532,7 @@ void ipath_rc_rcv(struct ipath_ibdev *deint ok;/* Check rkey & NAK */ - ok =ipath_rkey_ok (dev, &qp->r_sge, + ok =ipath_rkey_ok (qp, &qp->r_sge, qp->r_len, vaddr, rkey,IB_ACCESS_REMOTE_WRITE );if (unlikely (!ok))
@@ -1574,7 +1574,7 @@ void ipath_rc_rcv(struct ipath_ibdev *deint ok;/* Check rkey & NAK */ - ok =ipath_rkey_ok (dev, &qp->s_rdma_sge, + ok =ipath_rkey_ok (qp, &qp->s_rdma_sge, qp->s_rdma_len, vaddr, rkey,IB_ACCESS_REMOTE_READ );if (unlikely (!ok)) {
@@ -1633,7 +1633,7 @@ void ipath_rc_rcv(struct ipath_ibdev *de goto nack_inv; rkey =be32_to_cpu (ateth->rkey);/* Check rkey & NAK */ -if (unlikely (!ipath_rkey_ok (dev, &qp->r_sge, +if (unlikely (!ipath_rkey_ok (qp, &qp->r_sge,sizeof (u64), vaddr, rkey,IB_ACCESS_REMOTE_ATOMIC ))) goto nack_acc;
drivers/infiniband/hw/ipath/ipath_ruc.c +5 -8
@@ -108,7 +108,6 @@ void ipath_insert_rnr_queue(struct ipathstatic int init_sge (struct ipath_qp *qp,struct ipath_rwqe *wqe) { -struct ipath_ibdev *dev =to_idev (qp->ibqp.device);int user =to_ipd (qp->ibqp.pd)->user;int i, j, ret;struct ib_wc wc;
@@ -119,8 +118,7 @@ static int init_sge(struct ipath_qp *qp,continue ;/* Check LKEY */ if ((user && wqe->sg_list[i].lkey ==0 ) || - !ipath_lkey_ok (&dev->lk_table, - &qp->r_sg_list[j], &wqe->sg_list[i], + !ipath_lkey_ok (qp, &qp->r_sg_list[j], &wqe->sg_list[i],IB_ACCESS_LOCAL_WRITE )) goto bad_lkey; qp->r_len += wqe->sg_list[i].length;
@@ -326,7 +324,7 @@ again:case IB_WR_RDMA_WRITE :if (wqe->length ==0 )break ; -if (unlikely (!ipath_rkey_ok (dev, &qp->r_sge, wqe->length, +if (unlikely (!ipath_rkey_ok (qp, &qp->r_sge, wqe->length, wqe->wr.wr.rdma.remote_addr, wqe->wr.wr.rdma.rkey,IB_ACCESS_REMOTE_WRITE ))) {
@@ -350,7 +348,7 @@ again:break ;case IB_WR_RDMA_READ : -if (unlikely (!ipath_rkey_ok (dev, &sqp->s_sge, wqe->length, +if (unlikely (!ipath_rkey_ok (qp, &sqp->s_sge, wqe->length, wqe->wr.wr.rdma.remote_addr, wqe->wr.wr.rdma.rkey,IB_ACCESS_REMOTE_READ )))
@@ -365,7 +363,7 @@ again:case IB_WR_ATOMIC_CMP_AND_SWP :case IB_WR_ATOMIC_FETCH_AND_ADD : -if (unlikely (!ipath_rkey_ok (dev, &qp->r_sge,sizeof (u64), +if (unlikely (!ipath_rkey_ok (qp, &qp->r_sge,sizeof (u64), wqe->wr.wr.rdma.remote_addr, wqe->wr.wr.rdma.rkey,IB_ACCESS_REMOTE_ATOMIC )))
@@ -575,8 +573,7 @@ int ipath_post_ruc_send(struct ipath_qp }if (wr->sg_list[i].length ==0 )continue ; -if (!ipath_lkey_ok (&to_idev (qp->ibqp.device)->lk_table, - &wqe->sg_list[j], &wr->sg_list[i], +if (!ipath_lkey_ok (qp, &wqe->sg_list[j], &wr->sg_list[i], acc)) {spin_unlock_irqrestore (&qp->s_lock, flags); ret = -EINVAL ;
drivers/infiniband/hw/ipath/ipath_uc.c +1 -1
@@ -444,7 +444,7 @@ void ipath_uc_rcv(struct ipath_ibdev *deint ok;/* Check rkey */ - ok =ipath_rkey_ok (dev, &qp->r_sge, qp->r_len, + ok =ipath_rkey_ok (qp, &qp->r_sge, qp->r_len, vaddr, rkey,IB_ACCESS_REMOTE_WRITE );if (unlikely (!ok)) {
drivers/infiniband/hw/ipath/ipath_ud.c +2 -4
@@ -39,7 +39,6 @@ static int init_sge(struct ipath_qp *qp,static int init_sge (struct ipath_qp *qp,struct ipath_rwqe *wqe,u32 *lengthp,struct ipath_sge_state *ss) { -struct ipath_ibdev *dev =to_idev (qp->ibqp.device);int user =to_ipd (qp->ibqp.pd)->user;int i, j, ret;struct ib_wc wc;
@@ -50,8 +49,7 @@ static int init_sge(struct ipath_qp *qp,continue ;/* Check LKEY */ if ((user && wqe->sg_list[i].lkey ==0 ) || - !ipath_lkey_ok (&dev->lk_table, - j ? &ss->sg_list[j -1 ] : &ss->sge, + !ipath_lkey_ok (qp, j ? &ss->sg_list[j -1 ] : &ss->sge, &wqe->sg_list[i],IB_ACCESS_LOCAL_WRITE )) goto bad_lkey; *lengthp += wqe->sg_list[i].length;
@@ -343,7 +341,7 @@ int ipath_post_ud_send(struct ipath_qp *if (wr->sg_list[i].length ==0 )continue ; -if (!ipath_lkey_ok (&dev->lk_table, ss.num_sge ? +if (!ipath_lkey_ok (qp, ss.num_sge ? sg_list + ss.num_sge -1 : &ss.sge, &wr->sg_list[i],0 )) { ret = -EINVAL ;
drivers/infiniband/hw/ipath/ipath_verbs.h +3 -8
@@ -220,6 +220,7 @@ struct ipath_segarray { };struct ipath_mregion { +struct ib_pd *pd;/* shares refcnt of ibmr.pd */ u64 user_base;/* User's address for this region */ u64 iova;/* IB start address of this region */ size_t length;
@@ -657,12 +658,6 @@ int ipath_verbs_send(struct ipath_devdatvoid ipath_cq_enter (struct ipath_cq *cq,struct ib_wc *entry,int sig); -int ipath_rkey_ok (struct ipath_ibdev *dev,struct ipath_sge_state *ss, -u32 len,u64 vaddr,u32 rkey,int acc); - -int ipath_lkey_ok (struct ipath_lkey_table *rkt,struct ipath_sge *isge, -struct ib_sge *sge,int acc); -void ipath_copy_sge (struct ipath_sge_state *ss,void *data,u32 length);void ipath_skip_sge (struct ipath_sge_state *ss,u32 length);
@@ -687,10 +682,10 @@ int ipath_alloc_lkey(struct ipath_lkey_tvoid ipath_free_lkey (struct ipath_lkey_table *rkt,u32 lkey); -int ipath_lkey_ok (struct ipath_lkey_table *rkt,struct ipath_sge *isge, +int ipath_lkey_ok (struct ipath_qp *qp,struct ipath_sge *isge,struct ib_sge *sge,int acc); -int ipath_rkey_ok (struct ipath_ibdev *dev,struct ipath_sge_state *ss, +int ipath_rkey_ok (struct ipath_qp *qp,struct ipath_sge_state *ss,u32 len,u64 vaddr,u32 rkey,int acc); int ipath_post_srq_receive(struct ib_srq *ibsrq, struct ib_recv_wr *wr,
PATCH 1/1 IB/ipath - print more informative parity error messages
In reply to Bryan O'Sullivandrivers/infiniband/hw/ipath/ipath_iba6110.c +23 -45
@@ -389,17 +389,28 @@ static void hwerr_crcbits(struct ipath_d _IPATH_HTLINK1_CRCBITS))); } +/* 6110 specific hardware errors... */ +static const struct ipath_hwerror_msgs ipath_6110_hwerror_msgs[] = { +INFINIPATH_HWE_MSG (HTCBUSIREQPARITYERR ,"HTC Ireq Parity" ), +INFINIPATH_HWE_MSG (HTCBUSTREQPARITYERR ,"HTC Treq Parity" ), +INFINIPATH_HWE_MSG (HTCBUSTRESPPARITYERR ,"HTC Tresp Parity" ), +INFINIPATH_HWE_MSG (HTCMISCERR5 ,"HT core Misc5" ), +INFINIPATH_HWE_MSG (HTCMISCERR6 ,"HT core Misc6" ), +INFINIPATH_HWE_MSG (HTCMISCERR7 ,"HT core Misc7" ), +INFINIPATH_HWE_MSG (RXDSYNCMEMPARITYERR ,"Rx Dsync" ), +INFINIPATH_HWE_MSG (SERDESPLLFAILED ,"SerDes PLL" ), +}; +/** -* ipath_ht_handle_hwerrors - display hardware errors +* ipath_ht_handle_hwerrors - display hardware errors. * @dd: the infinipath device * @msg: the output buffer * @msgl: the size of the output buffer * -* Use same msg buffer as regular errors to avoid -* excessive stack use. Most hardware errors are catastrophic, but for -* right now, we'll print them and continue. -* We reuse the same message buffer as ipath_handle_errors() to avoid -* excessive stack usage. +* Use same msg buffer as regular errors to avoid excessive stack +* use. Most hardware errors are catastrophic, but for right now, +* we'll print them and continue. We reuse the same message buffer as +* ipath_handle_errors() to avoid excessive stack usage. */ static void ipath_ht_handle_hwerrors (struct ipath_devdata *dd,char *msg,size_t msgl)
@@ -499,44 +510,16 @@ static void ipath_ht_handle_hwerrors(str bits);strlcat (msg, bitsmsg, msgl); } -if (hwerrs & (INFINIPATH_HWE_RXEMEMPARITYERR_MASK - <<INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT )) { - bits = (u32) ((hwerrs >> -INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT ) & -INFINIPATH_HWE_RXEMEMPARITYERR_MASK ); -snprintf (bitsmsg,sizeof bitsmsg,"[RXE Parity Errs %x] " , - bits); -strlcat (msg, bitsmsg, msgl); - } -if (hwerrs & (INFINIPATH_HWE_TXEMEMPARITYERR_MASK - <<INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT )) { - bits = (u32) ((hwerrs >> -INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT ) & -INFINIPATH_HWE_TXEMEMPARITYERR_MASK ); -snprintf (bitsmsg,sizeof bitsmsg,"[TXE Parity Errs %x] " , - bits); -strlcat (msg, bitsmsg, msgl); - } -if (hwerrs &INFINIPATH_HWE_IBCBUSTOSPCPARITYERR ) -strlcat (msg,"[IB2IPATH Parity]" , msgl); -if (hwerrs &INFINIPATH_HWE_IBCBUSFRSPCPARITYERR ) -strlcat (msg,"[IPATH2IB Parity]" , msgl); -if (hwerrs &INFINIPATH_HWE_HTCBUSIREQPARITYERR ) -strlcat (msg,"[HTC Ireq Parity]" , msgl); -if (hwerrs &INFINIPATH_HWE_HTCBUSTREQPARITYERR ) -strlcat (msg,"[HTC Treq Parity]" , msgl); -if (hwerrs &INFINIPATH_HWE_HTCBUSTRESPPARITYERR ) -strlcat (msg,"[HTC Tresp Parity]" , msgl); + +ipath_format_hwerrors (hwerrs, + ipath_6110_hwerror_msgs, +sizeof (ipath_6110_hwerror_msgs) / +sizeof (ipath_6110_hwerror_msgs[0 ]), + msg, msgl);if (hwerrs & (_IPATH_HTLINK0_CRCBITS | _IPATH_HTLINK1_CRCBITS))hwerr_crcbits (dd, hwerrs, msg, msgl); -if (hwerrs &INFINIPATH_HWE_HTCMISCERR5 ) -strlcat (msg,"[HT core Misc5]" , msgl); -if (hwerrs &INFINIPATH_HWE_HTCMISCERR6 ) -strlcat (msg,"[HT core Misc6]" , msgl); -if (hwerrs &INFINIPATH_HWE_HTCMISCERR7 ) -strlcat (msg,"[HT core Misc7]" , msgl);if (hwerrs &INFINIPATH_HWE_MEMBISTFAILED ) {strlcat (msg,"[Memory BIST test failed, InfiniPath hardware unusable]" , msgl);
@@ -572,11 +555,6 @@ static void ipath_ht_handle_hwerrors(stripath_write_kreg (dd, dd->ipath_kregs->kr_hwerrmask, dd->ipath_hwerrmask); } - -if (hwerrs &INFINIPATH_HWE_RXDSYNCMEMPARITYERR ) -strlcat (msg,"[Rx Dsync]" , msgl); -if (hwerrs &INFINIPATH_HWE_SERDESPLLFAILED ) -strlcat (msg,"[SerDes PLL]" , msgl);ipath_dev_err (dd,"%s hardware error\n" , msg);if (isfatal && !ipath_diag_inuse && dd->ipath_freezemsg)
drivers/infiniband/hw/ipath/ipath_iba6120.c +27 -50
101 lines not on this page · raw message
drivers/infiniband/hw/ipath/ipath_intr.c +76 -0
82 lines not on this page · raw message
drivers/infiniband/hw/ipath/ipath_kernel.h +16 -0
@@ -897,4 +897,20 @@ extern struct mutex ipath_mutex;#endif /* _IPATH_DEBUGGING */ +/* +* this is used for formatting hw error messages... +*/ +struct ipath_hwerror_msgs { +u64 mask; +const char *msg; +}; + +#define INFINIPATH_HWE_MSG (a, b) { .mask = INFINIPATH_HWE_##a, .msg = b } + +/* in ipath_intr.c... */ +void ipath_format_hwerrors (u64 hwerrs, +const struct ipath_hwerror_msgs *hwerrmsgs, +size_t nhwerrmsgs, +char *msg,size_t lmsg); +#endif /* _IPATH_KERNEL_H */
drivers/infiniband/hw/ipath/ipath_registers.h +16 -2
@@ -134,10 +134,24 @@#define INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT 40#define INFINIPATH_HWE_RXEMEMPARITYERR_MASK 0x7FULL#define INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT 44 -#define INFINIPATH_HWE_RXDSYNCMEMPARITYERR 0x0000000400000000ULL -#define INFINIPATH_HWE_MEMBISTFAILED 0x0040000000000000ULL#define INFINIPATH_HWE_IBCBUSTOSPCPARITYERR 0x4000000000000000ULL#define INFINIPATH_HWE_IBCBUSFRSPCPARITYERR 0x8000000000000000ULL +/* txe mem parity errors (shift by INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT) */ +#define INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF 0x1ULL +#define INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC 0x2ULL +#define INFINIPATH_HWE_TXEMEMPARITYERR_PIOLAUNCHFIFO 0x4ULL +/* rxe mem parity errors (shift by INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT) */ +#define INFINIPATH_HWE_RXEMEMPARITYERR_RCVBUF 0x01ULL +#define INFINIPATH_HWE_RXEMEMPARITYERR_LOOKUPQ 0x02ULL +#define INFINIPATH_HWE_RXEMEMPARITYERR_EAGERTID 0x04ULL +#define INFINIPATH_HWE_RXEMEMPARITYERR_EXPTID 0x08ULL +#define INFINIPATH_HWE_RXEMEMPARITYERR_FLAGBUF 0x10ULL +#define INFINIPATH_HWE_RXEMEMPARITYERR_DATAINFO 0x20ULL +#define INFINIPATH_HWE_RXEMEMPARITYERR_HDRINFO 0x40ULL +/* waldo specific -- find the rest in ipath_6110.c */ +#define INFINIPATH_HWE_RXDSYNCMEMPARITYERR 0x0000000400000000ULL +/* monty specific -- find the rest in ipath_6120.c */ +#define INFINIPATH_HWE_MEMBISTFAILED 0x0040000000000000ULL/* kr_hwdiagctrl bits */ #define INFINIPATH_DC_FORCETXEMEMPARITYERR_MASK 0xFULL
PATCH 1/1 IB/ipath - lock and count allocated CQs properly
In reply to Bryan O'Sullivandrivers/infiniband/hw/ipath/ipath_cq.c +12 -6
@@ -174,11 +174,6 @@ struct ib_cq *ipath_create_cq(struct ib_if (entries <1 || entries > ib_ipath_max_cqes) { ret =ERR_PTR (-EINVAL ); - goto done; - } - -if (dev->n_cqs_allocated == ib_ipath_max_cqs) { - ret =ERR_PTR (-ENOMEM ); goto done; }
@@ -237,6 +232,16 @@ struct ib_cq *ipath_create_cq(struct ib_ }else cq->ip =NULL ; +spin_lock (&dev->n_cqs_lock); +if (dev->n_cqs_allocated == ib_ipath_max_cqs) { +spin_unlock (&dev->n_cqs_lock); + ret =ERR_PTR (-ENOMEM ); + goto bail_wc; + } + + dev->n_cqs_allocated++; +spin_unlock (&dev->n_cqs_lock); +/* * ib_create_cq() will initialize cq->ibcq except for cq->ibcq.cqe. * The number of entries should be >= the number requested or return
@@ -253,7 +258,6 @@ struct ib_cq *ipath_create_cq(struct ib_ ret = &cq->ibcq; - dev->n_cqs_allocated++; goto done; bail_wc:
@@ -280,7 +284,9 @@ int ipath_destroy_cq(struct ib_cq *ibcq)struct ipath_cq *cq =to_icq (ibcq);tasklet_kill (&cq->comptask); +spin_lock (&dev->n_cqs_lock); dev->n_cqs_allocated--; +spin_unlock (&dev->n_cqs_lock);if (cq->ip)kref_put (&cq->ip->ref, ipath_release_mmap_info);else
PATCH 1/1 IB/ipath - clean up handling of GUID 0
In reply to Bryan O'SullivanRespond with an error to the SM if our GUID is 0, and don't allow the user to set our GUID to 0.
drivers/infiniband/hw/ipath/ipath_mad.c +11 -5
@@ -87,7 +87,8 @@ static int recv_subn_get_nodeinfo(structstruct ipath_devdata *dd =to_idev (ibdev)->dd;u32 vendor, majrev, minrev; -if (smp->attr_mod) +/* GUID 0 is illegal */ +if (smp->attr_mod || (dd->ipath_guid ==0 )) smp->status |=IB_SMP_INVALID_FIELD ; nip->base_version =1 ;
@@ -131,10 +132,15 @@ static int recv_subn_get_guidinfo(struct* We only support one GUID for now. If this changes, the * portinfo.guid_cap field needs to be updated too. */ -if (startgx ==0 ) -/* The first is a copy of the read-only HW GUID. */ - *p =to_idev (ibdev)->dd->ipath_guid; -else +if (startgx ==0 ) { +__be64 g =to_idev (ibdev)->dd->ipath_guid; +if (g ==0 ) +/* GUID 0 is illegal */ + smp->status |=IB_SMP_INVALID_FIELD ; +else +/* The first is a copy of the read-only HW GUID. */ + *p = g; + }else smp->status |=IB_SMP_INVALID_FIELD ;return reply (smp);
drivers/infiniband/hw/ipath/ipath_sysfs.c +6 -3
@@ -257,7 +257,7 @@ static ssize_t store_guid(struct devicestruct ipath_devdata *dd =dev_get_drvdata (dev);ssize_t ret;unsigned short guid[8 ]; -__be64 nguid; +__be64 new_guid;u8 *ng;int i;
@@ -266,7 +266,7 @@ static ssize_t store_guid(struct device &guid[4], &guid[5], &guid[6], &guid[7]) != 8) goto invalid; - ng = (u8 *) &nguid; + ng = (u8 *) &new_guid;for (i =0 ; i <8 ; i++) {if (guid[i] >0xff )
@@ -274,7 +274,10 @@ static ssize_t store_guid(struct device ng[i] = guid[i]; } - dd->ipath_guid = nguid; +if (new_guid ==0 ) + goto invalid; + + dd->ipath_guid = new_guid; dd->ipath_nguid =1 ; ret =strlen (buf);
PATCH 1/1 IB/ipath - support revision 2 InfiniPath PCIE devices
In reply to Bryan O'SullivanThis also entailed a little GPIO-interrupt general cleanup.
drivers/infiniband/hw/ipath/ipath_common.h +2 -0
@@ -186,6 +186,8 @@ typedef enum _ipath_ureg {#define IPATH_RUNTIME_FORCE_WC_ORDER 0x4#define IPATH_RUNTIME_RCVHDR_COPY 0x8#define IPATH_RUNTIME_MASTER 0x10 +#define IPATH_RUNTIME_PBC_REWRITE 0x20 +#define IPATH_RUNTIME_LOOSE_DMA_ALIGN 0x40/* * This structure is returned by ipath_userinit() immediately after
drivers/infiniband/hw/ipath/ipath_iba6120.c +104 -14
196 lines not on this page · raw message
drivers/infiniband/hw/ipath/ipath_intr.c +73 -19
105 lines not on this page · raw message
drivers/infiniband/hw/ipath/ipath_kernel.h +18 -0
@@ -524,6 +524,15 @@ struct ipath_devdata {u32 ipath_lli_counter;/* local link integrity errors */ u32 ipath_lli_errors; +/* +* Above counts only cases where _successive_ LocalLinkIntegrity +* errors were seen in the receive headers of kern-packets. +* Below are the three (monotonically increasing) counters +* maintained via GPIO interrupts on iba6120-rev2. +*/ +u32 ipath_rxfc_unsupvl_errs; +u32 ipath_overrun_thresh_errs; +u32 ipath_lli_errs; };/* Private data for file operations */
@@ -636,6 +645,15 @@ int ipath_set_rx_pol_inv(struct ipath_de/* can miss port0 rx interrupts */ #define IPATH_POLL_RX_INTR 0x40000#define IPATH_DISABLED 0x80000/* administratively disabled */ +/* Use GPIO interrupts for new counters */ +#define IPATH_GPIO_ERRINTRS 0x100000 + +/* Bits in GPIO for the added interrupts */ +#define IPATH_GPIO_PORT0_BIT 2 +#define IPATH_GPIO_RXUVL_BIT 3 +#define IPATH_GPIO_OVRUN_BIT 4 +#define IPATH_GPIO_LLI_BIT 5 +#define IPATH_GPIO_ERRINTR_MASK 0x38/* portdata flag bit offsets */ /* waiting for a packet to arrive */
drivers/infiniband/hw/ipath/ipath_verbs.c +21 -7
@@ -898,7 +898,8 @@ int ipath_get_counters(struct ipath_devdipath_snap_cntr (dd, dd->ipath_cregs->cr_erricrccnt) +ipath_snap_cntr (dd, dd->ipath_cregs->cr_errvcrccnt) +ipath_snap_cntr (dd, dd->ipath_cregs->cr_errlpcrccnt) + -ipath_snap_cntr (dd, dd->ipath_cregs->cr_badformatcnt); +ipath_snap_cntr (dd, dd->ipath_cregs->cr_badformatcnt) + + dd->ipath_rxfc_unsupvl_errs; cntrs->port_rcv_remphys_errors =ipath_snap_cntr (dd, dd->ipath_cregs->cr_rcvebpcnt); cntrs->port_xmit_discards =
@@ -911,8 +912,10 @@ int ipath_get_counters(struct ipath_devdipath_snap_cntr (dd, dd->ipath_cregs->cr_pktsendcnt); cntrs->port_rcv_packets =ipath_snap_cntr (dd, dd->ipath_cregs->cr_pktrcvcnt); - cntrs->local_link_integrity_errors = dd->ipath_lli_errors; - cntrs->excessive_buffer_overrun_errors =0 ;/* XXX */ + cntrs->local_link_integrity_errors = + (dd->ipath_flags &IPATH_GPIO_ERRINTRS ) ? + dd->ipath_lli_errs : dd->ipath_lli_errors; + cntrs->excessive_buffer_overrun_errors = dd->ipath_overrun_thresh_errs; ret =0 ;
@@ -1380,11 +1383,13 @@ static int enable_timer(struct ipath_dev* processing. */ if (dd->ipath_flags &IPATH_GPIO_INTR ) { +u64 val;ipath_write_kreg (dd, dd->ipath_kregs->kr_debugportselect,0x2074076542310ULL );/* Enable GPIO bit 2 interrupt */ -ipath_write_kreg (dd, dd->ipath_kregs->kr_gpio_mask, - (u64) (1 <<2 )); + val =ipath_read_kreg64 (dd, dd->ipath_kregs->kr_gpio_mask); + val |= (u64) (1 <<IPATH_GPIO_PORT0_BIT ); +ipath_write_kreg ( dd, dd->ipath_kregs->kr_gpio_mask, val); }init_timer (&dd->verbs_timer);
@@ -1399,8 +1404,17 @@ static int disable_timer(struct ipath_destatic int disable_timer (struct ipath_devdata *dd) {/* Disable GPIO bit 2 interrupt */ -if (dd->ipath_flags &IPATH_GPIO_INTR ) -ipath_write_kreg (dd, dd->ipath_kregs->kr_gpio_mask,0 ); +if (dd->ipath_flags &IPATH_GPIO_INTR ) { +u64 val; +/* Disable GPIO bit 2 interrupt */ + val =ipath_read_kreg64 (dd, dd->ipath_kregs->kr_gpio_mask); + val &= ~((u64) (1 <<IPATH_GPIO_PORT0_BIT )); +ipath_write_kreg ( dd, dd->ipath_kregs->kr_gpio_mask, val); +/* +* We might want to undo changes to debugportselect, +* but how? +*/ + }del_timer_sync (&dd->verbs_timer);
Roland Dreier
NAKRe: [PATCH 24 of 28] IB/mthca - Fix compiler warnings with gcc4 on possible unitialized variables
In reply to Bryan O'SullivanNAK -- I don't want to generate worse code to fix a compiler warning false positive.
- R.
Re: [PATCH 4 of 28] IB/ipath - support revision 2 InfiniPath PCIE devices
In reply to Bryan O'Sullivandrivers/infiniband/hw/ipath/ipath_iba6120.c static void ipath_pe_quiet_serdes(struct
Quoted 3 lines
drivers/infiniband/hw/ipath/ipath_iba6120.c +2
-0+/* +/* Use GPIO interrupts for new counters */
trailing whitespace...
Re: [PATCH 25 of 28] IB/ipath - Set CPU affinity early
In reply to Bryan O'SullivanQuoted 1 line
+// Get port early, so can set affinity prior to memory allocation
C++ style comments are frowned on in the kernel.
I fixed all the new ones up to "/* */" style when applying the patches.
Re: [PATCH 1 of 28] IB/ipath - limit # of packets sent without an ACK received
In reply to Bryan O'SullivanI applied all except #24 with minor comments as sent separately.
- R.
Re: [PATCH 1 of 28] IB/ipath - limit # of packets sent without an ACK received
Quoted 1 line · Roland Dreier
I applied all except #24 with minor comments as sent separately.
Thanks!
<b
Re: [PATCH 24 of 28] IB/mthca - Fix compiler warnings with gcc4 on possible unitialized variables
In reply to Roland DreierQuoted 3 lines · Roland Dreier
NAK -- I don't want to generate worse code to fix a compiler warning false positive.
Maybe we should have a "make defined" operation for this kind of thing:
#define DEFVALUE(x) asm("" : "=rm" (x))Which is pretty ugly, I admit...
J
Quoted 9 lines · Bryan O'Sullivan
Hi, Roland -
This patch series brings the ipath driver almost up to date with what's in our internal tree. The only substantial thing missing is the
memcpy_cachebypasspatch that I sent out a while back and haven't had time to rework.These patches have seen a lot of testing, including on a git snapshot as of yesterday afternoon. Please apply.
Have you tested your driver against the -mm tree?
To the best of my knowledge the irq handling of your hypertransport card is a complete and total hack that works only by chance.
In the -mm tree I have added a first pass at proper support for the hypertranport interrupt capability. As this code is slated to go into 2.6.19 could you please test against that?
I would have tested it myself except when I mentioned this earlier I was told that your card does not actually implement the hypertransport interrupt capability properly.
The practical reason for pathscale to work on this is the genirq work in 2.6.19 changes the internal implementation detail your hypertransport card has been relying on to work so your hypertranport card will not work without fixes.
Thanks,
Eric
Quoted 1 line · Eric W. Biederman
Have you tested your driver against the -mm tree?
No.
Quoted 2 lines
To the best of my knowledge the irq handling of your hypertransport card is a complete and total hack that works only by chance.
And a happy Monday morning to you, too :-)
Quoted 3 lines
In the -mm tree I have added a first pass at proper support for the hypertranport interrupt capability. As this code is slated to go into 2.6.19 could you please test against that?
I'm on vacation for a few weeks. We'll find someone to do it.
<b
Quoted 10 lines · Bryan O'Sullivan
Quoted 1 line · Eric W. Biederman
Have you tested your driver against the -mm tree?
No.
Quoted 2 lines
To the best of my knowledge the irq handling of your hypertransport card is a complete and total hack that works only by chance.
And a happy Monday morning to you, too :-)
:)
Quoted 5 lines
Quoted 3 lines
In the -mm tree I have added a first pass at proper support for the hypertranport interrupt capability. As this code is slated to go into 2.6.19 could you please test against that?
I'm on vacation for a few weeks. We'll find someone to do it.
Sure. I talked to Dave Olson about this a while ago, and I couldn't get anything happening.
Eric
Quoted 2 lines · Eric W. Biederman
Sure. I talked to Dave Olson about this a while ago, and I couldn't get anything happening.
Driver authors tend to find imminent breakage quite stimulating, in my experience :-)
<b