VTOPYHS Mapping
by Kumaraparameshwaran Rathnavel
Hi All,
I was looking into the vtophys.c and I had the following query.
I understand that this creates a mapping of 128TB Virtual Address Space where Physical Addresses are populated in the map.
The number of entries for Top-Level Map should be 17 Bits(30-46) which is 128K 1GB entries. But we have created entries for 18bits. So what is the reason behind having extra entries. And also the second level page map would require 9 Bits (21-29) 512 entries of 2MB page for a single 1GB map. Why do we create 1024 entries.
Please correct if my understanding is wrong.
SHIFT_128TB 47
SHIFT_1GB 30
SHIFT_2MB 21
/* Translation of a single 2MB page. */
struct map_2mb {
uint64_t translation_2mb;
};
/* Second-level map table indexed by bits [21..29] of the virtual address.
* Each entry contains the address translation or SPDK_VTOPHYS_ERROR for entries that haven't
* been retrieved yet.
*/
struct map_1gb {
struct map_2mb map[1ULL << (SHIFT_1GB - SHIFT_2MB + 1)];
uint16_t ref_count[1ULL << (SHIFT_1GB - SHIFT_2MB + 1)];
};
/* Top-level map table indexed by bits [30..46] of the virtual address.
* Each entry points to a second-level map table or NULL.
*/
struct map_128tb {
struct map_1gb *map[1ULL << (SHIFT_128TB - SHIFT_1GB + 1)];
};
Thanking You,
Param.