summaryrefslogtreecommitdiffstats
path: root/gdrcopy.diff
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@ipepdvdev1.ipe.kit.edu>2016-05-19 19:48:24 +0200
committerSuren A. Chilingaryan <csa@ipepdvdev1.ipe.kit.edu>2016-05-19 19:48:24 +0200
commit16e0aeeed527f8452e336685f664d7aa848702d3 (patch)
tree7d22cb7f5bee5d4e37e374adf80706715efa36ed /gdrcopy.diff
downloadgdrtest-16e0aeeed527f8452e336685f664d7aa848702d3.tar.gz
gdrtest-16e0aeeed527f8452e336685f664d7aa848702d3.tar.bz2
gdrtest-16e0aeeed527f8452e336685f664d7aa848702d3.tar.xz
gdrtest-16e0aeeed527f8452e336685f664d7aa848702d3.zip
First test
Diffstat (limited to 'gdrcopy.diff')
-rw-r--r--gdrcopy.diff57
1 files changed, 57 insertions, 0 deletions
diff --git a/gdrcopy.diff b/gdrcopy.diff
new file mode 100644
index 0000000..c7043c7
--- /dev/null
+++ b/gdrcopy.diff
@@ -0,0 +1,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, &params, 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 *)