1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
diff --git a/gdrapi.c b/gdrapi.c
index e38fb8a..c9faeb5 100644
--- a/gdrapi.c
+++ b/gdrapi.c
@@ -218,6 +218,7 @@ int gdr_get_info(gdr_t g, gdr_mh_t handle, gdr_info_t *info)
info->page_size = params.page_size;
info->tm_cycles = params.tm_cycles;
info->cycles_per_ms = params.tsc_khz;
+ info->bus_addr = params.bus_addr;
}
return ret;
}
diff --git a/gdrapi.h b/gdrapi.h
index da02719..006f7f0 100644
--- a/gdrapi.h
+++ b/gdrapi.h
@@ -89,6 +89,7 @@ struct gdr_info {
uint32_t page_size;
uint64_t tm_cycles;
uint32_t cycles_per_ms;
+ uint64_t bus_addr;
};
typedef struct gdr_info gdr_info_t;
int gdr_get_info(gdr_t g, gdr_mh_t handle, gdr_info_t *info);
diff --git a/gdrdrv/gdrdrv.c b/gdrdrv/gdrdrv.c
index 8363051..8e78441 100644
--- a/gdrdrv/gdrdrv.c
+++ b/gdrdrv/gdrdrv.c
@@ -443,11 +443,16 @@ static int gdrdrv_get_info(gdr_info_t *info, void __user *_params)
return -EINVAL;
}
+ struct nvidia_p2p_page *page = mr->page_table->pages[0];
+ unsigned long page_paddr = page->physical_address;
+ unsigned long paddr = page_paddr + mr->offset;
+
params.va = mr->va;
params.mapped_size = mr->mapped_size;
params.page_size = mr->page_size;
params.tm_cycles = mr->tm_cycles;
params.tsc_khz = mr->tsc_khz;
+ params.bus_addr = paddr;
if (copy_to_user(_params, ¶ms, sizeof(params))) {
gdr_err("copy_to_user failed on user pointer %p\n", _params);
diff --git a/gdrdrv/gdrdrv.h b/gdrdrv/gdrdrv.h
index 672a203..e1fd2a5 100644
--- a/gdrdrv/gdrdrv.h
+++ b/gdrdrv/gdrdrv.h
@@ -77,6 +77,7 @@ struct GDRDRV_IOC_GET_INFO_PARAMS
__u32 page_size;
__u32 tsc_khz;
__u64 tm_cycles;
+ __u64 bus_addr;
};
#define GDRDRV_IOC_GET_INFO _IOWR(GDRDRV_IOCTL, 4, struct GDRDRV_IOC_GET_INFO_PARAMS *)
|