Subject: linux-next: manual merge of the rdma tree with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 22 Apr 2025 14:30:19 +1000

Hi all,

Today's linux-next merge of the rdma tree got conflicts in:

  drivers/infiniband/sw/rxe/rxe_mr.c
  drivers/infiniband/sw/rxe/rxe_resp.c

between commit:

  1b2fe85f3cf1 ("RDMA/rxe: Fix null pointer dereference in ODP MR check")

from Linus' tree and commits:

  6703cb3dced0 ("RDMA/rxe: Enable ODP in RDMA FLUSH operation")
  b84001ad0cee ("RDMA/rxe: Enable ODP in ATOMIC WRITE operation")

from the rdma tree.

I fixed it up (see below - and some changed code from the latter was
removed in the former) and can carry the fix as necessary. This is now
fixed as far as linux-next is concerned, but any non trivial conflicts
should be mentioned to your upstream maintainer when your tree is
submitted for merging.  You may also want to consider cooperating with
the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/infiniband/sw/rxe/rxe_mr.c
index 432d864c3ce9,1a74013a14ab..000000000000
--- a/drivers/infiniband/sw/rxe/rxe_mr.c
+++ b/drivers/infiniband/sw/rxe/rxe_mr.c
@@@ -468,6 -458,28 +458,28 @@@ static int rxe_mr_flush_pmem_iova(struc
  	return 0;
  }
  
+ int rxe_flush_pmem_iova(struct rxe_mr *mr, u64 start, unsigned int length)
+ {
+ 	int err;
+ 
+ 	/* mr must be valid even if length is zero */
+ 	if (WARN_ON(!mr))
+ 		return -EINVAL;
+ 
+ 	if (length == 0)
+ 		return 0;
+ 
+ 	if (mr->ibmr.type == IB_MR_TYPE_DMA)
+ 		return -EFAULT;
+ 
 -	if (mr->umem->is_odp)
++	if (is_odp_mr(mr))
+ 		err = rxe_odp_flush_pmem_iova(mr, start, length);
+ 	else
+ 		err = rxe_mr_flush_pmem_iova(mr, start, length);
+ 
+ 	return err;
+ }
+ 
  /* Guarantee atomicity of atomic operations at the machine level. */
  DEFINE_SPINLOCK(atomic_ops_lock);
  
diff --cc drivers/infiniband/sw/rxe/rxe_resp.c
index 5d9174e408db,fd7bac5bce18..000000000000
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@@ -753,7 -749,16 +749,16 @@@ static enum resp_states atomic_write_re
  	value = *(u64 *)payload_addr(pkt);
  	iova = qp->resp.va + qp->resp.offset;
  
- 	err = rxe_mr_do_atomic_write(mr, iova, value);
+ 	/* See IBA oA19-28 */
+ 	if (unlikely(mr->state != RXE_MR_STATE_VALID)) {
+ 		rxe_dbg_mr(mr, "mr not in valid state\n");
+ 		return RESPST_ERR_RKEY_VIOLATION;
+ 	}
+ 
 -	if (mr->umem->is_odp)
++	if (is_odp_mr(mr))
+ 		err = rxe_odp_do_atomic_write(mr, iova, value);
+ 	else
+ 		err = rxe_mr_do_atomic_write(mr, iova, value);
  	if (err)
  		return err;