Commit 52f00dd3 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Doug Ledford

ehca: stop using struct ib_phys_buf

And simplify the calling convention for full-memory registrations.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> [core]
Reviewed-by: default avatarSteve Wise <swise@opengridcomputing.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 33f09219
...@@ -316,9 +316,8 @@ struct ehca_mr_pginfo { ...@@ -316,9 +316,8 @@ struct ehca_mr_pginfo {
union { union {
struct { /* type EHCA_MR_PGI_PHYS section */ struct { /* type EHCA_MR_PGI_PHYS section */
int num_phys_buf; u64 addr;
struct ib_phys_buf *phys_buf_array; u16 size;
u64 next_buf;
} phy; } phy;
struct { /* type EHCA_MR_PGI_USER section */ struct { /* type EHCA_MR_PGI_USER section */
struct ib_umem *region; struct ib_umem *region;
......
...@@ -1289,7 +1289,6 @@ int ehca_reg_internal_maxmr( ...@@ -1289,7 +1289,6 @@ int ehca_reg_internal_maxmr(
u64 *iova_start; u64 *iova_start;
u64 size_maxmr; u64 size_maxmr;
struct ehca_mr_pginfo pginfo; struct ehca_mr_pginfo pginfo;
struct ib_phys_buf ib_pbuf;
u32 num_kpages; u32 num_kpages;
u32 num_hwpages; u32 num_hwpages;
u64 hw_pgsize; u64 hw_pgsize;
...@@ -1310,8 +1309,6 @@ int ehca_reg_internal_maxmr( ...@@ -1310,8 +1309,6 @@ int ehca_reg_internal_maxmr(
/* register internal max-MR on HCA */ /* register internal max-MR on HCA */
size_maxmr = ehca_mr_len; size_maxmr = ehca_mr_len;
iova_start = (u64 *)ehca_map_vaddr((void *)(KERNELBASE + PHYSICAL_START)); iova_start = (u64 *)ehca_map_vaddr((void *)(KERNELBASE + PHYSICAL_START));
ib_pbuf.addr = 0;
ib_pbuf.size = size_maxmr;
num_kpages = NUM_CHUNKS(((u64)iova_start % PAGE_SIZE) + size_maxmr, num_kpages = NUM_CHUNKS(((u64)iova_start % PAGE_SIZE) + size_maxmr,
PAGE_SIZE); PAGE_SIZE);
hw_pgsize = ehca_get_max_hwpage_size(shca); hw_pgsize = ehca_get_max_hwpage_size(shca);
...@@ -1323,8 +1320,8 @@ int ehca_reg_internal_maxmr( ...@@ -1323,8 +1320,8 @@ int ehca_reg_internal_maxmr(
pginfo.num_kpages = num_kpages; pginfo.num_kpages = num_kpages;
pginfo.num_hwpages = num_hwpages; pginfo.num_hwpages = num_hwpages;
pginfo.hwpage_size = hw_pgsize; pginfo.hwpage_size = hw_pgsize;
pginfo.u.phy.num_phys_buf = 1; pginfo.u.phy.addr = 0;
pginfo.u.phy.phys_buf_array = &ib_pbuf; pginfo.u.phy.size = size_maxmr;
ret = ehca_reg_mr(shca, e_mr, iova_start, size_maxmr, 0, e_pd, ret = ehca_reg_mr(shca, e_mr, iova_start, size_maxmr, 0, e_pd,
&pginfo, &e_mr->ib.ib_mr.lkey, &pginfo, &e_mr->ib.ib_mr.lkey,
...@@ -1620,17 +1617,15 @@ static int ehca_set_pagebuf_phys(struct ehca_mr_pginfo *pginfo, ...@@ -1620,17 +1617,15 @@ static int ehca_set_pagebuf_phys(struct ehca_mr_pginfo *pginfo,
u32 number, u64 *kpage) u32 number, u64 *kpage)
{ {
int ret = 0; int ret = 0;
struct ib_phys_buf *pbuf; u64 addr = pginfo->u.phy.addr;
u64 size = pginfo->u.phy.size;
u64 num_hw, offs_hw; u64 num_hw, offs_hw;
u32 i = 0; u32 i = 0;
/* loop over desired phys_buf_array entries */ num_hw = NUM_CHUNKS((addr % pginfo->hwpage_size) + size,
while (i < number) { pginfo->hwpage_size);
pbuf = pginfo->u.phy.phys_buf_array + pginfo->u.phy.next_buf; offs_hw = (addr & ~(pginfo->hwpage_size - 1)) / pginfo->hwpage_size;
num_hw = NUM_CHUNKS((pbuf->addr % pginfo->hwpage_size) +
pbuf->size, pginfo->hwpage_size);
offs_hw = (pbuf->addr & ~(pginfo->hwpage_size - 1)) /
pginfo->hwpage_size;
while (pginfo->next_hwpage < offs_hw + num_hw) { while (pginfo->next_hwpage < offs_hw + num_hw) {
/* sanity check */ /* sanity check */
if ((pginfo->kpage_cnt >= pginfo->num_kpages) || if ((pginfo->kpage_cnt >= pginfo->num_kpages) ||
...@@ -1645,12 +1640,12 @@ static int ehca_set_pagebuf_phys(struct ehca_mr_pginfo *pginfo, ...@@ -1645,12 +1640,12 @@ static int ehca_set_pagebuf_phys(struct ehca_mr_pginfo *pginfo,
pginfo->num_hwpages, i); pginfo->num_hwpages, i);
return -EFAULT; return -EFAULT;
} }
*kpage = (pbuf->addr & ~(pginfo->hwpage_size - 1)) + *kpage = (addr & ~(pginfo->hwpage_size - 1)) +
(pginfo->next_hwpage * pginfo->hwpage_size); (pginfo->next_hwpage * pginfo->hwpage_size);
if ( !(*kpage) && pbuf->addr ) { if ( !(*kpage) && addr ) {
ehca_gen_err("pbuf->addr=%llx pbuf->size=%llx " ehca_gen_err("addr=%llx size=%llx "
"next_hwpage=%llx", pbuf->addr, "next_hwpage=%llx", addr,
pbuf->size, pginfo->next_hwpage); size, pginfo->next_hwpage);
return -EFAULT; return -EFAULT;
} }
(pginfo->hwpage_cnt)++; (pginfo->hwpage_cnt)++;
...@@ -1667,10 +1662,9 @@ static int ehca_set_pagebuf_phys(struct ehca_mr_pginfo *pginfo, ...@@ -1667,10 +1662,9 @@ static int ehca_set_pagebuf_phys(struct ehca_mr_pginfo *pginfo,
if (i >= number) break; if (i >= number) break;
} }
if (pginfo->next_hwpage >= offs_hw + num_hw) { if (pginfo->next_hwpage >= offs_hw + num_hw) {
(pginfo->u.phy.next_buf)++;
pginfo->next_hwpage = 0; pginfo->next_hwpage = 0;
} }
}
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment