~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/rdma/ib_umem_odp.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/rdma/ib_umem_odp.h (Architecture mips) and /include/rdma/ib_umem_odp.h (Architecture i386)


  1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-O      1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
  2 /*                                                  2 /*
  3  * Copyright (c) 2014 Mellanox Technologies. A      3  * Copyright (c) 2014 Mellanox Technologies. All rights reserved.
  4  */                                                 4  */
  5                                                     5 
  6 #ifndef IB_UMEM_ODP_H                               6 #ifndef IB_UMEM_ODP_H
  7 #define IB_UMEM_ODP_H                               7 #define IB_UMEM_ODP_H
  8                                                     8 
  9 #include <rdma/ib_umem.h>                           9 #include <rdma/ib_umem.h>
 10 #include <rdma/ib_verbs.h>                         10 #include <rdma/ib_verbs.h>
 11                                                    11 
 12 struct ib_umem_odp {                               12 struct ib_umem_odp {
 13         struct ib_umem umem;                       13         struct ib_umem umem;
 14         struct mmu_interval_notifier notifier;     14         struct mmu_interval_notifier notifier;
 15         struct pid *tgid;                          15         struct pid *tgid;
 16                                                    16 
 17         /* An array of the pfns included in th     17         /* An array of the pfns included in the on-demand paging umem. */
 18         unsigned long *pfn_list;                   18         unsigned long *pfn_list;
 19                                                    19 
 20         /*                                         20         /*
 21          * An array with DMA addresses mapped      21          * An array with DMA addresses mapped for pfns in pfn_list.
 22          * The lower two bits designate access     22          * The lower two bits designate access permissions.
 23          * See ODP_READ_ALLOWED_BIT and ODP_WR     23          * See ODP_READ_ALLOWED_BIT and ODP_WRITE_ALLOWED_BIT.
 24          */                                        24          */
 25         dma_addr_t              *dma_list;         25         dma_addr_t              *dma_list;
 26         /*                                         26         /*
 27          * The umem_mutex protects the page_li     27          * The umem_mutex protects the page_list and dma_list fields of an ODP
 28          * umem, allowing only a single thread     28          * umem, allowing only a single thread to map/unmap pages. The mutex
 29          * also protects access to the mmu not     29          * also protects access to the mmu notifier counters.
 30          */                                        30          */
 31         struct mutex            umem_mutex;        31         struct mutex            umem_mutex;
 32         void                    *private; /* f     32         void                    *private; /* for the HW driver to use. */
 33                                                    33 
 34         int npages;                                34         int npages;
 35                                                    35 
 36         /*                                         36         /*
 37          * An implicit odp umem cannot be DMA      37          * An implicit odp umem cannot be DMA mapped, has 0 length, and serves
 38          * only as an anchor for the driver to     38          * only as an anchor for the driver to hold onto the per_mm. FIXME:
 39          * This should be removed and drivers      39          * This should be removed and drivers should work with the per_mm
 40          * directly.                               40          * directly.
 41          */                                        41          */
 42         bool is_implicit_odp;                      42         bool is_implicit_odp;
 43                                                    43 
 44         unsigned int            page_shift;        44         unsigned int            page_shift;
 45 };                                                 45 };
 46                                                    46 
 47 static inline struct ib_umem_odp *to_ib_umem_o     47 static inline struct ib_umem_odp *to_ib_umem_odp(struct ib_umem *umem)
 48 {                                                  48 {
 49         return container_of(umem, struct ib_um     49         return container_of(umem, struct ib_umem_odp, umem);
 50 }                                                  50 }
 51                                                    51 
 52 /* Returns the first page of an ODP umem. */       52 /* Returns the first page of an ODP umem. */
 53 static inline unsigned long ib_umem_start(stru     53 static inline unsigned long ib_umem_start(struct ib_umem_odp *umem_odp)
 54 {                                                  54 {
 55         return umem_odp->notifier.interval_tre     55         return umem_odp->notifier.interval_tree.start;
 56 }                                                  56 }
 57                                                    57 
 58 /* Returns the address of the page after the l     58 /* Returns the address of the page after the last one of an ODP umem. */
 59 static inline unsigned long ib_umem_end(struct     59 static inline unsigned long ib_umem_end(struct ib_umem_odp *umem_odp)
 60 {                                                  60 {
 61         return umem_odp->notifier.interval_tre     61         return umem_odp->notifier.interval_tree.last + 1;
 62 }                                                  62 }
 63                                                    63 
 64 static inline size_t ib_umem_odp_num_pages(str     64 static inline size_t ib_umem_odp_num_pages(struct ib_umem_odp *umem_odp)
 65 {                                                  65 {
 66         return (ib_umem_end(umem_odp) - ib_ume     66         return (ib_umem_end(umem_odp) - ib_umem_start(umem_odp)) >>
 67                umem_odp->page_shift;               67                umem_odp->page_shift;
 68 }                                                  68 }
 69                                                    69 
 70 /*                                                 70 /*
 71  * The lower 2 bits of the DMA address signal      71  * The lower 2 bits of the DMA address signal the R/W permissions for
 72  * the entry. To upgrade the permissions, prov     72  * the entry. To upgrade the permissions, provide the appropriate
 73  * bitmask to the map_dma_pages function.          73  * bitmask to the map_dma_pages function.
 74  *                                                 74  *
 75  * Be aware that upgrading a mapped address mi     75  * Be aware that upgrading a mapped address might result in change of
 76  * the DMA address for the page.                   76  * the DMA address for the page.
 77  */                                                77  */
 78 #define ODP_READ_ALLOWED_BIT  (1<<0ULL)            78 #define ODP_READ_ALLOWED_BIT  (1<<0ULL)
 79 #define ODP_WRITE_ALLOWED_BIT (1<<1ULL)            79 #define ODP_WRITE_ALLOWED_BIT (1<<1ULL)
 80                                                    80 
 81 #define ODP_DMA_ADDR_MASK (~(ODP_READ_ALLOWED_     81 #define ODP_DMA_ADDR_MASK (~(ODP_READ_ALLOWED_BIT | ODP_WRITE_ALLOWED_BIT))
 82                                                    82 
 83 #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING          83 #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING
 84                                                    84 
 85 struct ib_umem_odp *                               85 struct ib_umem_odp *
 86 ib_umem_odp_get(struct ib_device *device, unsi     86 ib_umem_odp_get(struct ib_device *device, unsigned long addr, size_t size,
 87                 int access, const struct mmu_i     87                 int access, const struct mmu_interval_notifier_ops *ops);
 88 struct ib_umem_odp *ib_umem_odp_alloc_implicit     88 struct ib_umem_odp *ib_umem_odp_alloc_implicit(struct ib_device *device,
 89                                                    89                                                int access);
 90 struct ib_umem_odp *                               90 struct ib_umem_odp *
 91 ib_umem_odp_alloc_child(struct ib_umem_odp *ro     91 ib_umem_odp_alloc_child(struct ib_umem_odp *root_umem, unsigned long addr,
 92                         size_t size,               92                         size_t size,
 93                         const struct mmu_inter     93                         const struct mmu_interval_notifier_ops *ops);
 94 void ib_umem_odp_release(struct ib_umem_odp *u     94 void ib_umem_odp_release(struct ib_umem_odp *umem_odp);
 95                                                    95 
 96 int ib_umem_odp_map_dma_and_lock(struct ib_ume     96 int ib_umem_odp_map_dma_and_lock(struct ib_umem_odp *umem_odp, u64 start_offset,
 97                                  u64 bcnt, u64     97                                  u64 bcnt, u64 access_mask, bool fault);
 98                                                    98 
 99 void ib_umem_odp_unmap_dma_pages(struct ib_ume     99 void ib_umem_odp_unmap_dma_pages(struct ib_umem_odp *umem_odp, u64 start_offset,
100                                  u64 bound);      100                                  u64 bound);
101                                                   101 
102 #else /* CONFIG_INFINIBAND_ON_DEMAND_PAGING */    102 #else /* CONFIG_INFINIBAND_ON_DEMAND_PAGING */
103                                                   103 
104 static inline struct ib_umem_odp *                104 static inline struct ib_umem_odp *
105 ib_umem_odp_get(struct ib_device *device, unsi    105 ib_umem_odp_get(struct ib_device *device, unsigned long addr, size_t size,
106                 int access, const struct mmu_i    106                 int access, const struct mmu_interval_notifier_ops *ops)
107 {                                                 107 {
108         return ERR_PTR(-EINVAL);                  108         return ERR_PTR(-EINVAL);
109 }                                                 109 }
110                                                   110 
111 static inline void ib_umem_odp_release(struct     111 static inline void ib_umem_odp_release(struct ib_umem_odp *umem_odp) {}
112                                                   112 
113 #endif /* CONFIG_INFINIBAND_ON_DEMAND_PAGING *    113 #endif /* CONFIG_INFINIBAND_ON_DEMAND_PAGING */
114                                                   114 
115 #endif /* IB_UMEM_ODP_H */                        115 #endif /* IB_UMEM_ODP_H */
116                                                   116 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php