env/vtophys: allow registration of >2MB regions
Change-Id: I4f005ce979a94b07bbaa109795ce0f6708b7fb8c Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
93982c19bb
commit
ee2eda24bc
@ -295,12 +295,13 @@ spdk_mem_map_set_translation(struct spdk_mem_map *map, uint64_t vaddr, uint64_t
|
||||
struct map_2mb *map_2mb;
|
||||
uint16_t *ref_count;
|
||||
|
||||
/* For now, only 2 MB registrations are supported */
|
||||
assert(size == 2 * 1024 * 1024);
|
||||
/* For now, only 2 MB-aligned registrations are supported */
|
||||
assert(size % (2 * 1024 * 1024) == 0);
|
||||
assert((vaddr & MASK_2MB) == 0);
|
||||
|
||||
vfn_2mb = vaddr >> SHIFT_2MB;
|
||||
|
||||
while (size) {
|
||||
map_1gb = spdk_mem_map_get_map_1gb(map, vfn_2mb);
|
||||
if (!map_1gb) {
|
||||
#ifdef DEBUG
|
||||
@ -324,6 +325,10 @@ spdk_mem_map_set_translation(struct spdk_mem_map *map, uint64_t vaddr, uint64_t
|
||||
map_2mb->translation_2mb = translation;
|
||||
|
||||
(*ref_count)++;
|
||||
|
||||
size -= 2 * 1024 * 1024;
|
||||
vfn_2mb++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -335,12 +340,13 @@ spdk_mem_map_clear_translation(struct spdk_mem_map *map, uint64_t vaddr, uint64_
|
||||
struct map_2mb *map_2mb;
|
||||
uint16_t *ref_count;
|
||||
|
||||
/* For now, only 2 MB registrations are supported */
|
||||
assert(size == 2 * 1024 * 1024);
|
||||
/* For now, only 2 MB-aligned registrations are supported */
|
||||
assert(size % (2 * 1024 * 1024) == 0);
|
||||
assert((vaddr & MASK_2MB) == 0);
|
||||
|
||||
vfn_2mb = vaddr >> SHIFT_2MB;
|
||||
|
||||
while (size) {
|
||||
map_1gb = spdk_mem_map_get_map_1gb(map, vfn_2mb);
|
||||
if (!map_1gb) {
|
||||
#ifdef DEBUG
|
||||
@ -364,6 +370,10 @@ spdk_mem_map_clear_translation(struct spdk_mem_map *map, uint64_t vaddr, uint64_
|
||||
if (*ref_count == 0) {
|
||||
map_2mb->translation_2mb = map->default_translation;
|
||||
}
|
||||
|
||||
size -= 2 * 1024 * 1024;
|
||||
vfn_2mb++;
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t
|
||||
|
Loading…
Reference in New Issue
Block a user