Merge branch 'mr_fix' into git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma for-next
Update mlx4 to support user MR creation against read-only memory, previously it required the memory to be writable. Based on rdma for-rc due to dependencies. * mr_fix: (2 commits) IB/mlx4: Mark user MR as writable if actual virtual memory is writable IB/core: Make testing MR flags for writability a static inline function
This commit is contained in:
@@ -48,7 +48,6 @@ struct ib_umem {
|
||||
int writable;
|
||||
int hugetlb;
|
||||
struct work_struct work;
|
||||
struct pid *pid;
|
||||
struct mm_struct *mm;
|
||||
unsigned long diff;
|
||||
struct ib_umem_odp *odp_data;
|
||||
|
@@ -3766,6 +3766,20 @@ static inline int ib_check_mr_access(int flags)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline bool ib_access_writable(int access_flags)
|
||||
{
|
||||
/*
|
||||
* We have writable memory backing the MR if any of the following
|
||||
* access flags are set. "Local write" and "remote write" obviously
|
||||
* require write access. "Remote atomic" can do things like fetch and
|
||||
* add, which will modify memory, and "MW bind" can change permissions
|
||||
* by binding a window.
|
||||
*/
|
||||
return access_flags &
|
||||
(IB_ACCESS_LOCAL_WRITE | IB_ACCESS_REMOTE_WRITE |
|
||||
IB_ACCESS_REMOTE_ATOMIC | IB_ACCESS_MW_BIND);
|
||||
}
|
||||
|
||||
/**
|
||||
* ib_check_mr_status: lightweight check of MR status.
|
||||
* This routine may provide status checks on a selected
|
||||
|
@@ -411,13 +411,13 @@ static inline int uverbs_attr_get_enum_id(const struct uverbs_attr_bundle *attrs
|
||||
static inline void *uverbs_attr_get_obj(const struct uverbs_attr_bundle *attrs_bundle,
|
||||
u16 idx)
|
||||
{
|
||||
struct ib_uobject *uobj =
|
||||
uverbs_attr_get(attrs_bundle, idx)->obj_attr.uobject;
|
||||
const struct uverbs_attr *attr;
|
||||
|
||||
if (IS_ERR(uobj))
|
||||
return uobj;
|
||||
attr = uverbs_attr_get(attrs_bundle, idx);
|
||||
if (IS_ERR(attr))
|
||||
return ERR_CAST(attr);
|
||||
|
||||
return uobj->object;
|
||||
return attr->obj_attr.uobject->object;
|
||||
}
|
||||
|
||||
static inline int uverbs_copy_to(const struct uverbs_attr_bundle *attrs_bundle,
|
||||
|
Reference in New Issue
Block a user