2023-08-23 11:29:12 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
|
2015-10-30 18:58:43 -04:00
|
|
|
/*
|
2020-11-25 16:01:12 -05:00
|
|
|
* Copyright(c) 2020 - Cornelis Networks, Inc.
|
2017-05-04 05:14:39 -07:00
|
|
|
* Copyright(c) 2015 - 2017 Intel Corporation.
|
2015-10-30 18:58:43 -04:00
|
|
|
*/
|
|
|
|
|
2021-08-23 12:26:22 +08:00
|
|
|
#ifndef _HFI1_USER_EXP_RCV_H
|
|
|
|
#define _HFI1_USER_EXP_RCV_H
|
|
|
|
|
2016-02-05 11:57:46 -05:00
|
|
|
#include "hfi.h"
|
2017-06-09 15:59:40 -07:00
|
|
|
#include "exp_rcv.h"
|
2015-10-30 18:58:43 -04:00
|
|
|
|
2017-08-21 18:27:23 -07:00
|
|
|
struct tid_pageset {
|
|
|
|
u16 idx;
|
|
|
|
u16 count;
|
|
|
|
};
|
|
|
|
|
2017-08-21 18:26:51 -07:00
|
|
|
struct tid_user_buf {
|
2023-01-09 12:31:31 -05:00
|
|
|
struct mmu_interval_notifier notifier;
|
|
|
|
struct mutex cover_mutex;
|
2017-08-21 18:26:51 -07:00
|
|
|
unsigned long vaddr;
|
|
|
|
unsigned long length;
|
|
|
|
unsigned int npages;
|
|
|
|
struct page **pages;
|
|
|
|
struct tid_pageset *psets;
|
|
|
|
unsigned int n_psets;
|
|
|
|
};
|
|
|
|
|
2017-08-21 18:27:23 -07:00
|
|
|
struct tid_rb_node {
|
2019-11-12 16:22:23 -04:00
|
|
|
struct mmu_interval_notifier notifier;
|
|
|
|
struct hfi1_filedata *fdata;
|
2023-01-09 12:31:26 -05:00
|
|
|
struct mutex invalidate_mutex; /* covers hw removal */
|
2017-08-21 18:27:23 -07:00
|
|
|
unsigned long phys;
|
|
|
|
struct tid_group *grp;
|
|
|
|
u32 rcventry;
|
|
|
|
dma_addr_t dma_addr;
|
|
|
|
bool freed;
|
|
|
|
unsigned int npages;
|
2023-09-29 11:04:30 -07:00
|
|
|
struct page *pages[] __counted_by(npages);
|
2017-08-21 18:27:23 -07:00
|
|
|
};
|
|
|
|
|
2017-08-21 18:27:16 -07:00
|
|
|
static inline int num_user_pages(unsigned long addr,
|
|
|
|
unsigned long len)
|
|
|
|
{
|
|
|
|
const unsigned long spage = addr & PAGE_MASK;
|
|
|
|
const unsigned long epage = (addr + len - 1) & PAGE_MASK;
|
|
|
|
|
|
|
|
return 1 + ((epage - spage) >> PAGE_SHIFT);
|
|
|
|
}
|
|
|
|
|
2017-07-29 08:43:32 -07:00
|
|
|
int hfi1_user_exp_rcv_init(struct hfi1_filedata *fd,
|
|
|
|
struct hfi1_ctxtdata *uctxt);
|
2017-05-04 05:15:09 -07:00
|
|
|
void hfi1_user_exp_rcv_free(struct hfi1_filedata *fd);
|
2017-05-04 05:14:45 -07:00
|
|
|
int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd,
|
|
|
|
struct hfi1_tid_info *tinfo);
|
|
|
|
int hfi1_user_exp_rcv_clear(struct hfi1_filedata *fd,
|
|
|
|
struct hfi1_tid_info *tinfo);
|
|
|
|
int hfi1_user_exp_rcv_invalid(struct hfi1_filedata *fd,
|
|
|
|
struct hfi1_tid_info *tinfo);
|
2016-02-05 11:57:46 -05:00
|
|
|
|
2020-11-25 16:01:12 -05:00
|
|
|
static inline struct mm_struct *mm_from_tid_node(struct tid_rb_node *node)
|
|
|
|
{
|
|
|
|
return node->notifier.mm;
|
|
|
|
}
|
|
|
|
|
2015-10-30 18:58:43 -04:00
|
|
|
#endif /* _HFI1_USER_EXP_RCV_H */
|